Fix abilities not updating properly
This commit is contained in:
parent
4b5f07b37c
commit
37b1ebeae5
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user