Interface OfflinePlayer
-
- All Superinterfaces:
AnimalTamer
,ConfigurationSerializable
,ServerOperator
- All Known Subinterfaces:
Player
public interface OfflinePlayer extends ServerOperator, AnimalTamer, ConfigurationSerializable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
decrementStatistic(@NotNull Statistic statistic)
Decrements the given statistic for this player.void
decrementStatistic(@NotNull Statistic statistic, int amount)
Decrements the given statistic for this player.void
decrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType)
Decrements the given statistic for this player for the given entity.void
decrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int amount)
Decrements the given statistic for this player for the given entity.void
decrementStatistic(@NotNull Statistic statistic, @NotNull Material material)
Decrements the given statistic for this player for the given material.void
decrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount)
Decrements the given statistic for this player for the given material.@Nullable Location
getBedSpawnLocation()
Gets the Location where the player will spawn at their bed, null if they have not slept in one or their current bed spawn is invalid.long
getFirstPlayed()
Gets the first date and time that this player was witnessed on this server.long
getLastPlayed()
Gets the last date and time that this player was witnessed on this server.@Nullable String
getName()
Returns the name of this player@Nullable Player
getPlayer()
Gets aPlayer
object that this represents, if there is oneint
getStatistic(@NotNull Statistic statistic)
Gets the value of the given statistic for this player.int
getStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType)
Gets the value of the given statistic for this player.int
getStatistic(@NotNull Statistic statistic, @NotNull Material material)
Gets the value of the given statistic for this player.@NotNull UUID
getUniqueId()
Returns the UUID of this playerboolean
hasPlayedBefore()
Checks if this player has played on this server before.void
incrementStatistic(@NotNull Statistic statistic)
Increments the given statistic for this player.void
incrementStatistic(@NotNull Statistic statistic, int amount)
Increments the given statistic for this player.void
incrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType)
Increments the given statistic for this player for the given entity.void
incrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int amount)
Increments the given statistic for this player for the given entity.void
incrementStatistic(@NotNull Statistic statistic, @NotNull Material material)
Increments the given statistic for this player for the given material.void
incrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount)
Increments the given statistic for this player for the given material.boolean
isBanned()
Checks if this player is banned or notboolean
isOnline()
Checks if this player is currently onlineboolean
isWhitelisted()
Checks if this player is whitelisted or notvoid
setStatistic(@NotNull Statistic statistic, int newValue)
Sets the given statistic for this player.void
setStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int newValue)
Sets the given statistic for this player for the given entity.void
setStatistic(@NotNull Statistic statistic, @NotNull Material material, int newValue)
Sets the given statistic for this player for the given material.void
setWhitelisted(boolean value)
Sets if this player is whitelisted or not-
Methods inherited from interface org.bukkit.configuration.serialization.ConfigurationSerializable
serialize
-
Methods inherited from interface org.bukkit.permissions.ServerOperator
isOp, setOp
-
-
-
-
Method Detail
-
isOnline
boolean isOnline()
Checks if this player is currently online- Returns:
- true if they are online
-
getName
@Nullable @Nullable String getName()
Returns the name of this playerNames are no longer unique past a single game session. For persistent storage it is recommended that you use
getUniqueId()
instead.- Specified by:
getName
in interfaceAnimalTamer
- Returns:
- Player name or null if we have not seen a name for this player yet
-
getUniqueId
@NotNull @NotNull UUID getUniqueId()
Returns the UUID of this player- Specified by:
getUniqueId
in interfaceAnimalTamer
- Returns:
- Player UUID
-
isBanned
boolean isBanned()
Checks if this player is banned or not- Returns:
- true if banned, otherwise false
-
isWhitelisted
boolean isWhitelisted()
Checks if this player is whitelisted or not- Returns:
- true if whitelisted
-
setWhitelisted
void setWhitelisted(boolean value)
Sets if this player is whitelisted or not- Parameters:
value
- true if whitelisted
-
getPlayer
@Nullable @Nullable Player getPlayer()
Gets aPlayer
object that this represents, if there is oneIf the player is online, this will return that player. Otherwise, it will return null.
- Returns:
- Online player
-
getFirstPlayed
long getFirstPlayed()
Gets the first date and time that this player was witnessed on this server.If the player has never played before, this will return 0. Otherwise, it will be the amount of milliseconds since midnight, January 1, 1970 UTC.
- Returns:
- Date of first log-in for this player, or 0
-
getLastPlayed
long getLastPlayed()
Gets the last date and time that this player was witnessed on this server.If the player has never played before, this will return 0. Otherwise, it will be the amount of milliseconds since midnight, January 1, 1970 UTC.
- Returns:
- Date of last log-in for this player, or 0
-
hasPlayedBefore
boolean hasPlayedBefore()
Checks if this player has played on this server before.- Returns:
- True if the player has played before, otherwise false
-
getBedSpawnLocation
@Nullable @Nullable Location getBedSpawnLocation()
Gets the Location where the player will spawn at their bed, null if they have not slept in one or their current bed spawn is invalid.- Returns:
- Bed Spawn Location if bed exists, otherwise null.
-
incrementStatistic
void incrementStatistic(@NotNull @NotNull Statistic statistic) throws IllegalArgumentException
Increments the given statistic for this player.This is equivalent to the following code:
incrementStatistic(Statistic, 1)
- Parameters:
statistic
- Statistic to increment- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if the statistic requires an additional parameter
-
decrementStatistic
void decrementStatistic(@NotNull @NotNull Statistic statistic) throws IllegalArgumentException
Decrements the given statistic for this player.This is equivalent to the following code:
decrementStatistic(Statistic, 1)
- Parameters:
statistic
- Statistic to decrement- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if the statistic requires an additional parameter
-
incrementStatistic
void incrementStatistic(@NotNull @NotNull Statistic statistic, int amount) throws IllegalArgumentException
Increments the given statistic for this player.- Parameters:
statistic
- Statistic to incrementamount
- Amount to increment this statistic by- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if amount is negativeIllegalArgumentException
- if the statistic requires an additional parameter
-
decrementStatistic
void decrementStatistic(@NotNull @NotNull Statistic statistic, int amount) throws IllegalArgumentException
Decrements the given statistic for this player.- Parameters:
statistic
- Statistic to decrementamount
- Amount to decrement this statistic by- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if amount is negativeIllegalArgumentException
- if the statistic requires an additional parameter
-
setStatistic
void setStatistic(@NotNull @NotNull Statistic statistic, int newValue) throws IllegalArgumentException
Sets the given statistic for this player.- Parameters:
statistic
- Statistic to setnewValue
- The value to set this statistic to- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if newValue is negativeIllegalArgumentException
- if the statistic requires an additional parameter
-
getStatistic
int getStatistic(@NotNull @NotNull Statistic statistic) throws IllegalArgumentException
Gets the value of the given statistic for this player.- Parameters:
statistic
- Statistic to check- Returns:
- the value of the given statistic
- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if the statistic requires an additional parameter
-
incrementStatistic
void incrementStatistic(@NotNull @NotNull Statistic statistic, @NotNull @NotNull Material material) throws IllegalArgumentException
Increments the given statistic for this player for the given material.This is equivalent to the following code:
incrementStatistic(Statistic, Material, 1)
- Parameters:
statistic
- Statistic to incrementmaterial
- Material to offset the statistic with- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if material is nullIllegalArgumentException
- if the given parameter is not valid for the statistic
-
decrementStatistic
void decrementStatistic(@NotNull @NotNull Statistic statistic, @NotNull @NotNull Material material) throws IllegalArgumentException
Decrements the given statistic for this player for the given material.This is equivalent to the following code:
decrementStatistic(Statistic, Material, 1)
- Parameters:
statistic
- Statistic to decrementmaterial
- Material to offset the statistic with- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if material is nullIllegalArgumentException
- if the given parameter is not valid for the statistic
-
getStatistic
int getStatistic(@NotNull @NotNull Statistic statistic, @NotNull @NotNull Material material) throws IllegalArgumentException
Gets the value of the given statistic for this player.- Parameters:
statistic
- Statistic to checkmaterial
- Material offset of the statistic- Returns:
- the value of the given statistic
- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if material is nullIllegalArgumentException
- if the given parameter is not valid for the statistic
-
incrementStatistic
void incrementStatistic(@NotNull @NotNull Statistic statistic, @NotNull @NotNull Material material, int amount) throws IllegalArgumentException
Increments the given statistic for this player for the given material.- Parameters:
statistic
- Statistic to incrementmaterial
- Material to offset the statistic withamount
- Amount to increment this statistic by- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if material is nullIllegalArgumentException
- if amount is negativeIllegalArgumentException
- if the given parameter is not valid for the statistic
-
decrementStatistic
void decrementStatistic(@NotNull @NotNull Statistic statistic, @NotNull @NotNull Material material, int amount) throws IllegalArgumentException
Decrements the given statistic for this player for the given material.- Parameters:
statistic
- Statistic to decrementmaterial
- Material to offset the statistic withamount
- Amount to decrement this statistic by- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if material is nullIllegalArgumentException
- if amount is negativeIllegalArgumentException
- if the given parameter is not valid for the statistic
-
setStatistic
void setStatistic(@NotNull @NotNull Statistic statistic, @NotNull @NotNull Material material, int newValue) throws IllegalArgumentException
Sets the given statistic for this player for the given material.- Parameters:
statistic
- Statistic to setmaterial
- Material to offset the statistic withnewValue
- The value to set this statistic to- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if material is nullIllegalArgumentException
- if newValue is negativeIllegalArgumentException
- if the given parameter is not valid for the statistic
-
incrementStatistic
void incrementStatistic(@NotNull @NotNull Statistic statistic, @NotNull @NotNull EntityType entityType) throws IllegalArgumentException
Increments the given statistic for this player for the given entity.This is equivalent to the following code:
incrementStatistic(Statistic, EntityType, 1)
- Parameters:
statistic
- Statistic to incremententityType
- EntityType to offset the statistic with- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if entityType is nullIllegalArgumentException
- if the given parameter is not valid for the statistic
-
decrementStatistic
void decrementStatistic(@NotNull @NotNull Statistic statistic, @NotNull @NotNull EntityType entityType) throws IllegalArgumentException
Decrements the given statistic for this player for the given entity.This is equivalent to the following code:
decrementStatistic(Statistic, EntityType, 1)
- Parameters:
statistic
- Statistic to decremententityType
- EntityType to offset the statistic with- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if entityType is nullIllegalArgumentException
- if the given parameter is not valid for the statistic
-
getStatistic
int getStatistic(@NotNull @NotNull Statistic statistic, @NotNull @NotNull EntityType entityType) throws IllegalArgumentException
Gets the value of the given statistic for this player.- Parameters:
statistic
- Statistic to checkentityType
- EntityType offset of the statistic- Returns:
- the value of the given statistic
- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if entityType is nullIllegalArgumentException
- if the given parameter is not valid for the statistic
-
incrementStatistic
void incrementStatistic(@NotNull @NotNull Statistic statistic, @NotNull @NotNull EntityType entityType, int amount) throws IllegalArgumentException
Increments the given statistic for this player for the given entity.- Parameters:
statistic
- Statistic to incremententityType
- EntityType to offset the statistic withamount
- Amount to increment this statistic by- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if entityType is nullIllegalArgumentException
- if amount is negativeIllegalArgumentException
- if the given parameter is not valid for the statistic
-
decrementStatistic
void decrementStatistic(@NotNull @NotNull Statistic statistic, @NotNull @NotNull EntityType entityType, int amount)
Decrements the given statistic for this player for the given entity.- Parameters:
statistic
- Statistic to decremententityType
- EntityType to offset the statistic withamount
- Amount to decrement this statistic by- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if entityType is nullIllegalArgumentException
- if amount is negativeIllegalArgumentException
- if the given parameter is not valid for the statistic
-
setStatistic
void setStatistic(@NotNull @NotNull Statistic statistic, @NotNull @NotNull EntityType entityType, int newValue)
Sets the given statistic for this player for the given entity.- Parameters:
statistic
- Statistic to setentityType
- EntityType to offset the statistic withnewValue
- The value to set this statistic to- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if entityType is nullIllegalArgumentException
- if newValue is negativeIllegalArgumentException
- if the given parameter is not valid for the statistic
-
-