mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 08:20:51 +01:00
26 lines
1.2 KiB
Diff
26 lines
1.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
|
Date: Tue, 1 Mar 2016 23:12:03 -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 c6c4a50bc9d8dbba4c8e5980417e93e190f25d42..9f1ab39b333ef51ed41a80d5d513a7c1d30d92f9 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -1984,12 +1984,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
|
|
@Override
|
|
public void setFlying(boolean value) {
|
|
+ boolean needsUpdate = getHandle().getAbilities().flying != value; // Paper - Only refresh abilities if needed
|
|
if (!this.getAllowFlight()) {
|
|
Preconditions.checkArgument(!value, "Player is not allowed to fly (check #getAllowFlight())");
|
|
}
|
|
|
|
this.getHandle().getAbilities().flying = value;
|
|
- this.getHandle().onUpdateAbilities();
|
|
+ if (needsUpdate) this.getHandle().onUpdateAbilities(); // Paper - Only refresh abilities if needed
|
|
}
|
|
|
|
@Override
|