29 lines
1.1 KiB
Diff
29 lines
1.1 KiB
Diff
|
From 33b18cbf6cb34aaa872507e4c20dc731ec877916 Mon Sep 17 00:00:00 2001
|
||
|
From: Aikar <aikar@aikar.co>
|
||
|
Date: Sun, 19 Oct 2014 16:04:28 -0500
|
||
|
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 096615e..73ec0f7 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 {
|
||
|
}
|
||
|
|
||
|
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
|
||
|
}
|
||
|
|
||
|
public boolean getAllowFlight() {
|
||
|
--
|
||
|
1.9.1
|
||
|
|