3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-22 22:38:17 +01:00
Paper/Spigot-Server-Patches/0035-Only-refresh-abilities-if-needed.patch

29 Zeilen
1.1 KiB
Diff

2014-11-30 23:21:39 +01:00
From ca69d5f4566892c66abcf55ad2a01295ab897312 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
2014-11-28 02:17:45 +01: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
2014-11-30 23:21:39 +01:00
index ab8afd7..a2cda7e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
2014-11-30 23:21:39 +01:00
@@ -1175,12 +1175,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
2014-11-28 02:17:45 +01: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 02:17:45 +01:00
@Override
--
1.9.1