Only refresh abilities if needed

This commit is contained in:
Zach Brown 2016-03-01 23:12:03 -06:00
parent 840b8a7bfa
commit 3e1c79c850

View file

@ -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