mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-23 00:03:48 -07:00
Only refresh abilities if needed
This commit is contained in:
@@ -2120,12 +2120,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFlying(boolean value) {
|
public void setFlying(boolean value) {
|
||||||
|
boolean needsUpdate = getHandle().getAbilities().flying != value; // Paper - Only refresh abilities if needed
|
||||||
if (!this.getAllowFlight()) {
|
if (!this.getAllowFlight()) {
|
||||||
Preconditions.checkArgument(!value, "Player is not allowed to fly (check #getAllowFlight())");
|
Preconditions.checkArgument(!value, "Player is not allowed to fly (check #getAllowFlight())");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getHandle().getAbilities().flying = value;
|
this.getHandle().getAbilities().flying = value;
|
||||||
this.getHandle().onUpdateAbilities();
|
if (needsUpdate) this.getHandle().onUpdateAbilities(); // Paper - Only refresh abilities if needed
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user