Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-24 07:10:10 +01:00
Implemented new player flight methods. This implements BUKKIT-1281. This also fixes BUKKIT-1146.
Dieser Commit ist enthalten in:
Ursprung
ca8b9a0bb4
Commit
8fb141bfa0
@ -577,14 +577,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
getHandle().getFoodData().foodLevel = value;
|
getHandle().getFoodData().foodLevel = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getAllowFlight() {
|
|
||||||
return getHandle().itemInWorldManager.player.abilities.canFly;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAllowFlight(boolean flight) {
|
|
||||||
getHandle().itemInWorldManager.player.abilities.canFly = flight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getBedSpawnLocation() {
|
public Location getBedSpawnLocation() {
|
||||||
World world = getServer().getWorld(getHandle().spawnWorld);
|
World world = getServer().getWorld(getHandle().spawnWorld);
|
||||||
if ((world != null) && (getHandle().getBed() != null)) {
|
if ((world != null) && (getHandle().getBed() != null)) {
|
||||||
@ -813,4 +805,30 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
public void disconnect(String reason) {
|
public void disconnect(String reason) {
|
||||||
conversationTracker.abandonAllConversations();
|
conversationTracker.abandonAllConversations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isFlying() {
|
||||||
|
return getHandle().abilities.isFlying;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFlying(boolean value) {
|
||||||
|
if (!getAllowFlight() && value) {
|
||||||
|
throw new IllegalArgumentException("Cannot make player fly if getAllowFlight() is false");
|
||||||
|
}
|
||||||
|
|
||||||
|
getHandle().abilities.isFlying = value;
|
||||||
|
getHandle().updateAbilities();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getAllowFlight() {
|
||||||
|
return getHandle().abilities.canFly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAllowFlight(boolean value) {
|
||||||
|
if (isFlying() && !value) {
|
||||||
|
getHandle().abilities.canFly = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
getHandle().abilities.canFly = value;
|
||||||
|
getHandle().updateAbilities();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren