testserver/Spigot-Server-Patches/0034-Only-refresh-abilities...

29 lines
1.1 KiB
Diff
Raw Normal View History

2014-12-14 22:26:48 +00:00
From 5b4cf49b42198e46038ba4f9a2e1c2ef2448ec76 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
2014-11-28 01:17:45 +00:00
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 4559d97..7358519 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1176,12 +1176,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
2014-11-28 01:17:45 +00:00
@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
}
2014-11-28 01:17:45 +00:00
@Override
--
1.9.1