Move isAllowedToFly and setFlying to AbstractPlayer, protect them.

Dieser Commit ist enthalten in:
wizjany 2019-07-16 22:17:19 -04:00
Ursprung 2cc6a367c6
Commit 4ee2d3b47c
2 geänderte Dateien mit 18 neuen und 18 gelöschten Zeilen

Datei anzeigen

@ -187,24 +187,6 @@ public interface Player extends Entity, Actor {
*/ */
void floatAt(int x, int y, int z, boolean alwaysGlass); void floatAt(int x, int y, int z, boolean alwaysGlass);
/**
* Check whether the player is allowed to fly.
*
* @return true if allowed flight
*/
default boolean isAllowedToFly() {
return false;
}
/**
* Set whether the player is currently flying.
*
* @param flying true to fly
*/
default void setFlying(boolean flying) {
throw new UnsupportedOperationException("setFlying unimplemented but isAllowedToFly was true (or unchecked)");
}
/** /**
* Get the point of the block that is being stood in. * Get the point of the block that is being stood in.
* *

Datei anzeigen

@ -328,6 +328,24 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
setPosition(Vector3.at(x + 0.5, y, z + 0.5)); setPosition(Vector3.at(x + 0.5, y, z + 0.5));
} }
/**
* Check whether the player is allowed to fly.
*
* @return true if allowed flight
*/
protected boolean isAllowedToFly() {
return false;
}
/**
* Set whether the player is currently flying.
*
* @param flying true to fly
*/
protected void setFlying(boolean flying) {
}
@Override @Override
public Location getBlockIn() { public Location getBlockIn() {
final Location location = getLocation(); final Location location = getLocation();