mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-02 17:32:03 +01:00
Only refresh abilities if needed
This commit is contained in:
parent
840b8a7bfa
commit
3e1c79c850
1 changed files with 2 additions and 1 deletions
|
@ -2120,12 +2120,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFlying(boolean value) {
|
public void setFlying(boolean value) {
|
||||||
|
boolean needsUpdate = getHandle().getAbilities().flying != value; // Paper - Only refresh abilities if needed
|
||||||
if (!this.getAllowFlight()) {
|
if (!this.getAllowFlight()) {
|
||||||
Preconditions.checkArgument(!value, "Player is not allowed to fly (check #getAllowFlight())");
|
Preconditions.checkArgument(!value, "Player is not allowed to fly (check #getAllowFlight())");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getHandle().getAbilities().flying = value;
|
this.getHandle().getAbilities().flying = value;
|
||||||
this.getHandle().onUpdateAbilities();
|
if (needsUpdate) this.getHandle().onUpdateAbilities(); // Paper - Only refresh abilities if needed
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue