From 7d7a99521d76d82fca456a31c23a379de4c51974 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 28 Nov 2014 13:20:22 -0600 Subject: [PATCH] Only refresh abilities if needed diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index a9b4160..506a03c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1143,12 +1143,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setFlying(boolean value) { + boolean needsUpdate = getHandle().abilities.canFly != value; // PaperSpigot - Only refresh abilities if needed if (!getAllowFlight() && value) { throw new IllegalArgumentException("Cannot make player fly if getAllowFlight() is false"); } getHandle().abilities.isFlying = value; - getHandle().updateAbilities(); + if (needsUpdate) getHandle().updateAbilities(); // PaperSpigot - Only refresh abilities if needed } @Override -- 2.5.2