Move isAllowedToFly and setFlying to AbstractPlayer, protect them.

This commit is contained in:
wizjany 2019-07-16 22:17:19 -04:00
parent 2cc6a367c6
commit 4ee2d3b47c
2 changed files with 18 additions and 18 deletions

View File

@ -187,24 +187,6 @@ public interface Player extends Entity, Actor {
*/
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.
*

View File

@ -328,6 +328,24 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
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
public Location getBlockIn() {
final Location location = getLocation();