Fix abilities not updating properly

This commit is contained in:
Bjorn Beishline 2026-02-01 11:46:18 -07:00
parent 4b5f07b37c
commit 37b1ebeae5
2 changed files with 10 additions and 4 deletions

View File

@ -1180,8 +1180,10 @@ public class PatchBukkitPlayer
@Override @Override
public void setAllowFlight(boolean flight) { public void setAllowFlight(boolean flight) {
var abilities = NativePatchBukkit.getAbilities(this.uuid); var abilities = NativePatchBukkit.getAbilities(this.uuid).withAllowFlying(flight);
abilities.withAllowFlying(flight); if (flight == false) {
abilities = abilities.withFlying(false);
}
NativePatchBukkit.setAbilities(this.uuid, abilities); NativePatchBukkit.setAbilities(this.uuid, abilities);
} }
@ -1259,8 +1261,7 @@ public class PatchBukkitPlayer
@Override @Override
public void setFlying(boolean value) { public void setFlying(boolean value) {
var abilities = NativePatchBukkit.getAbilities(this.getUniqueId()); var abilities = NativePatchBukkit.getAbilities(this.getUniqueId()).withFlying(value);
abilities.withFlying(value);
NativePatchBukkit.setAbilities(this.getUniqueId(), abilities); NativePatchBukkit.setAbilities(this.getUniqueId(), abilities);
} }

View File

@ -54,6 +54,11 @@ pub extern "C" fn rust_set_abilities(
}) })
}); });
let player = player.clone();
ctx.runtime.spawn(async move {
player.send_abilities_update().await;
});
return true; return true;
} }
} }