Class Player

All Implemented Interfaces:
ILocatable<Player>, ISerializable
Direct Known Subclasses:
Resident

public class Player extends BaseEntity<Player> implements ISerializable, ILocatable<Player>
  • Constructor Details

    • Player

      public Player(com.google.gson.JsonObject obj)
    • Player

      public Player(com.google.gson.JsonObject obj, Boolean resident)
    • Player

      public Player(com.google.gson.JsonObject obj, Boolean resident, Boolean parsed)
    • Player

      public Player(@NotNull @NotNull Player player)
  • Method Details

    • setLocation

      public void setLocation(com.google.gson.JsonObject obj, @NotNull @NotNull Boolean parsed)
    • asResident

      public Resident asResident(String mapName) throws MissingEntryException

      Converts this player into a Resident.
      Essentially equivalent to a "downcast", adding new fields and methods found in Resident, keeping all existing info the same.

      Parameters:
      mapName - The map used to retrieve the resident from. If invalid, Aurora will be assumed.
      Returns:
      The Resident instance if found, otherwise a MissingEntryException.
      Throws:
      MissingEntryException
    • hasCustomNickname

      public boolean hasCustomNickname()
      If this player has set a nickname.
      Returns:
      true/false if nickname is same as their account BaseEntity.name.
    • visible

      public boolean visible()
      If this player is visible on the Dynmap.
      Returns:
      true/false if world is "earth" and player is not under a block.
    • hidden

      public boolean hidden()
      Essentially the opposite of visible().

      NOTE: This returns true for players under a tree, in the nether etc.

      Returns:
      true/false if world is NOT "earth" and location is 0, 64, 0.
    • locationIsDefault

      public boolean locationIsDefault()
      Whether this player is located at the default Dynmap location.
      Returns:
      true/false if location is 0, 64, 0
    • isResident

      public boolean isResident()
      Check if this player is also a resident on the map this instance was retrieved from.
    • online

      public boolean online(String map)

      Check if this player is online in the inputted map.

      Returns:
      true/false if the player is online.
    • getOnline

      @Nullable public static @Nullable Player getOnline(String mapName, String playerName)

      Static helper method for retrieving an online Player.

      Parameters:
      mapName - The map this player is online in.
      If invalid map is inputted, Aurora will be assumed.
      playerName - The name of the player we want to retrieve.
      Returns:
      A new instance of this class