Package io.github.emcw.map.entities
Class Player
- All Implemented Interfaces:
ILocatable<Player>
,ISerializable
- Direct Known Subclasses:
Resident
-
Field Summary
Fields inherited from interface io.github.emcw.interfaces.ILocatable
INT_ARRAY_X, INT_ARRAY_Z
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionasResident
(String mapName) static @Nullable Player
Static helper method for retrieving an onlinePlayer
.boolean
If this player has set a nickname.boolean
hidden()
Essentially the opposite ofvisible()
.boolean
Check if this player is also a resident on the map this instance was retrieved from.boolean
Whether this player is located at the default Dynmap location.boolean
Check if this player is online in the inputted map.void
setLocation
(com.google.gson.JsonObject obj, @NotNull Boolean parsed) boolean
visible()
If this player is visible on the Dynmap.Methods inherited from class io.github.emcw.map.entities.BaseEntity
setInfo
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.github.emcw.interfaces.ILocatable
getNearby, getNearby
Methods inherited from interface io.github.emcw.interfaces.ISerializable
asString
-
Constructor Details
-
Player
public Player(com.google.gson.JsonObject obj) -
Player
-
Player
-
Player
-
-
Method Details
-
setLocation
-
asResident
Converts this player into a
Resident
.
Essentially equivalent to a "downcast", adding new fields and methods found inResident
, 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 aMissingEntryException
. - Throws:
MissingEntryException
-
hasCustomNickname
public boolean hasCustomNickname()If this player has set a nickname.- Returns:
- true/false if
nickname
is same as their accountBaseEntity.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.
-
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
Check if this player is online in the inputted map.
- Returns:
- true/false if the player is online.
-
getOnline
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
-