29 lines
1.2 KiB
Diff
29 lines
1.2 KiB
Diff
|
From d6016c6327a2f0e3a84feae6ce462fab7740c636 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 096615edc..73ec0f7b6 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() {
|
||
|
--
|
||
|
2.13.3
|
||
|
|