mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19: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
|
||||
public void setFlying(boolean value) {
|
||||
boolean needsUpdate = getHandle().getAbilities().flying != value; // Paper - Only refresh abilities if needed
|
||||
if (!this.getAllowFlight()) {
|
||||
Preconditions.checkArgument(!value, "Player is not allowed to fly (check #getAllowFlight())");
|
||||
}
|
||||
|
||||
this.getHandle().getAbilities().flying = value;
|
||||
this.getHandle().onUpdateAbilities();
|
||||
if (needsUpdate) this.getHandle().onUpdateAbilities(); // Paper - Only refresh abilities if needed
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue