Interface PlayerAbilities


public sealed interface PlayerAbilities
The movement abilities of a player that persist across sessions.
Since:
0.1.0
  • Field Details

  • Method Details

    • abilities

      @Contract(value="_, _, _, _ -> new", pure=true) static PlayerAbilities abilities(boolean flightAllowed, boolean flying, float flySpeed, float walkSpeed)
      Creates abilities.
      Parameters:
      flightAllowed - whether the player is allowed to fly
      flying - whether the player is flying
      flySpeed - the flying speed
      walkSpeed - the walking speed
      Returns:
      the abilities
      Throws:
      IllegalArgumentException - if a speed is not finite
      Since:
      0.1.0
    • flightAllowed

      @Contract(pure=true) boolean flightAllowed()
      Returns whether the player may fly; reset to the game mode's default when the game mode changes.
      Returns:
      whether the player may fly; reset to the game mode's default when the game mode changes
      Since:
      0.1.0
    • flying

      @Contract(pure=true) boolean flying()
      Returns whether the player is flying; never true unless flightAllowed().
      Returns:
      whether the player is flying; never true unless flightAllowed()
      Since:
      0.1.0
    • flySpeed

      @Contract(pure=true) float flySpeed()
      Returns the flying speed, 0.05 by default.
      Returns:
      the flying speed, 0.05 by default
      Since:
      0.1.0
    • walkSpeed

      @Contract(pure=true) float walkSpeed()
      Returns the walking speed, which becomes the base of the player's movement speed attribute, 0.1 by default.
      Returns:
      the walking speed, which becomes the base of the player's movement speed attribute, 0.1 by default
      Since:
      0.1.0
    • withFlightAllowed

      @Contract(value="_ -> new", pure=true) PlayerAbilities withFlightAllowed(boolean flightAllowed)
      Parameters:
      flightAllowed - whether the player is allowed to fly; disallowing it also stops flight
      Returns:
      a copy with the given flight permission
      Since:
      0.1.0
    • withFlying

      @Contract(value="_ -> new", pure=true) PlayerAbilities withFlying(boolean flying)
      Parameters:
      flying - whether the player is flying; ignored unless flightAllowed()
      Returns:
      a copy with the given flying state
      Since:
      0.1.0
    • withFlySpeed

      @Contract(value="_ -> new", pure=true) PlayerAbilities withFlySpeed(float flySpeed)
      Parameters:
      flySpeed - the flying speed
      Returns:
      a copy with the given flying speed
      Throws:
      IllegalArgumentException - if flySpeed is not finite
      Since:
      0.1.0
    • withWalkSpeed

      @Contract(value="_ -> new", pure=true) PlayerAbilities withWalkSpeed(float walkSpeed)
      Parameters:
      walkSpeed - the walking speed
      Returns:
      a copy with the given walking speed
      Throws:
      IllegalArgumentException - if walkSpeed is not finite
      Since:
      0.1.0