Paper/Spigot-Server-Patches/0034-Only-refresh-abilities-if-needed.patch
2015-01-06 22:13:40 -06:00

29 lines
1.1 KiB
Diff

From c8203a2b2a6a8e956c40407471543dadbe698393 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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 0b329be..1a41f87 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1177,12 +1177,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
--
1.9.1