Class OfflinePlayer
java.lang.Object
fr.fidorial.entity.OfflinePlayer
-
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares handles by identity.Gets the time at which this identity was first observed.inthashCode()booleanChecks whether the server holds any record of this identity.voidPerforms the given action on the connected player behind this identity, if there is one.booleanisOnline()Checks whether this identity is currently connected.booleanChecks whether this identity holds operator status.label()Gets a label suitable for display, falling back to the identity when no name is known.lastSeen()Gets the time at which this identity was most recently observed.name()Gets the most recent name observed foruuid().static OfflinePlayerof(OfflinePlayers registry, UUID uuid, @Nullable String name, long firstSeen, long lastSeen) Creates a handle bound to the given registry.online()Gets the connected player behind this identity.refresh()Produces an updated handle for this identity.voidsetOperator(boolean operator) Sets the operator status of this identity.snapshot()Reads the saved state of this identity.toString()uuid()Gets the unique identifier of this player.
-
Method Details
-
of
@Internal @Contract(value="_, _, _, _, _ -> new", pure=true) public static OfflinePlayer of(OfflinePlayers registry, UUID uuid, @Nullable String name, long firstSeen, long lastSeen) Creates a handle bound to the given registry.- Parameters:
registry- the registry serving the state-dependent operationsuuid- the player identityname- the last known name, ornullif none was ever observedfirstSeen- the epoch milliseconds of the first observation, or0if unknownlastSeen- the epoch milliseconds of the most recent observation, or0if unknown- Returns:
- a new handle
- Since:
- 0.1.0
-
uuid
Gets the unique identifier of this player.- Returns:
- the player identity
- Since:
- 0.1.0
-
name
-
label
-
hasPlayedBefore
@Contract(pure=true) public boolean hasPlayedBefore()Checks whether the server holds any record of this identity.- Returns:
trueif this identity has been observed at least once- Since:
- 0.1.0
-
firstSeen
-
lastSeen
-
online
-
isOnline
public boolean isOnline()Checks whether this identity is currently connected.- Returns:
trueif a player with this identity is connected- Since:
- 0.1.0
-
ifOnline
-
isOperator
public boolean isOperator()Checks whether this identity holds operator status.- Returns:
trueif this identity is an operator- Since:
- 0.1.0
-
setOperator
public void setOperator(boolean operator) Sets the operator status of this identity.- Parameters:
operator- the new operator status- Since:
- 0.1.0
-
snapshot
Reads the saved state of this identity.- Returns:
- a future completing with the saved state, or with an empty result if none exists
- Since:
- 0.1.0
-
refresh
Produces an updated handle for this identity.- Returns:
- a future completing with an updated handle for the same identity
- Since:
- 0.1.0
-
equals
-
hashCode
-
toString
-