Interface OfflinePlayer
- All Superinterfaces:
- AnimalTamer,- ConfigurationSerializable,- PersistentDataViewHolder,- PlayerHeadObjectContents.SkinSource,- ServerOperator
- All Known Subinterfaces:
- Player
- 
Method SummaryModifier and TypeMethodDescriptiondefault voidApplies this skin source to the given player head contents builder.<E extends BanEntry<? super PlayerProfile>>
 @Nullable EAdds this user to theProfileBanList.<E extends BanEntry<? super PlayerProfile>>
 @Nullable EAdds this user to theProfileBanList.<E extends BanEntry<? super PlayerProfile>>
 @Nullable EAdds this user to theProfileBanList.default BanEntryDeprecated.default BanEntryDeprecated.default BanEntryDeprecated.default BanEntryDeprecated.default BanEntrybanPlayer(@Nullable String reason, @Nullable Date expires, @Nullable String source, boolean kickIfOnline) Deprecated.voiddecrementStatistic(Statistic statistic) Decrements the given statistic for this player.voiddecrementStatistic(Statistic statistic, int amount) Decrements the given statistic for this player.voiddecrementStatistic(Statistic statistic, EntityType entityType) Decrements the given statistic for this player for the given entity.voiddecrementStatistic(Statistic statistic, EntityType entityType, int amount) Decrements the given statistic for this player for the given entity.voiddecrementStatistic(Statistic statistic, Material material) Decrements the given statistic for this player for the given material.voiddecrementStatistic(Statistic statistic, Material material, int amount) Decrements the given statistic for this player for the given material.booleanDetermines if the OfflinePlayer is allowed to fly via jump key double-tap like in creative mode.Deprecated.Misleading name.longGets the first date and time that this player was witnessed on this server.floatGets the current allowed speed that a client can fly.Gets the player's last death location.longGets the last date and time that this player logged into the server.longDeprecated.The API contract is ambiguous and the implementation may or may not return the correct value given this API ambiguity.longGets the last date and time that this player was seen on the server.Gets the player's current location.getName()Returns the name of this playerYields a view of the persistent data container for this offline player.Gets aPlayerobject that this represents, if there is oneGets a copy of the player's profile.Gets the Location where the player will spawn at,nullif they don't have a valid respawn point.getRespawnLocation(boolean loadLocationAndValidate) Gets the Location where the player will spawn at,nullif they don't have a valid respawn point.intgetStatistic(Statistic statistic) Gets the value of the given statistic for this player.intgetStatistic(Statistic statistic, EntityType entityType) Gets the value of the given statistic for this player.intgetStatistic(Statistic statistic, Material material) Gets the value of the given statistic for this player.Returns the UUID of this playerfloatGets the current allowed speed that a client can walk.booleanChecks if this player has played on this server before.voidincrementStatistic(Statistic statistic) Increments the given statistic for this player.voidincrementStatistic(Statistic statistic, int amount) Increments the given statistic for this player.voidincrementStatistic(Statistic statistic, EntityType entityType) Increments the given statistic for this player for the given entity.voidincrementStatistic(Statistic statistic, EntityType entityType, int amount) Increments the given statistic for this player for the given entity.voidincrementStatistic(Statistic statistic, Material material) Increments the given statistic for this player for the given material.voidincrementStatistic(Statistic statistic, Material material, int amount) Increments the given statistic for this player for the given material.booleanisBanned()Checks if this player has had their profile banned.booleanChecks whether the connection to this player is still valid.booleanisFlying()Checks to see if this player is currently flying or not.booleanisOnline()Checks if this player is currently online It should be noted that this will return true if any instance of this player is online! This instance may have disconnected.booleanChecks if this player is whitelisted or notvoidsetAllowFlight(boolean flight) Sets if the OfflinePlayer is allowed to fly via jump key double-tap like in creative mode.voidsetFlying(boolean value) Makes this player start or stop flying.voidsetFlySpeed(float value) Sets the speed at which a client will fly.voidsetStatistic(Statistic statistic, int newValue) Sets the given statistic for this player.voidsetStatistic(Statistic statistic, EntityType entityType, int newValue) Sets the given statistic for this player for the given entity.voidsetStatistic(Statistic statistic, Material material, int newValue) Sets the given statistic for this player for the given material.voidsetWalkSpeed(float value) Sets the speed at which a client will walk.voidsetWhitelisted(boolean value) Sets if this player is whitelisted or notbooleanteleportOffline(Location destination) Sets OfflinePlayer's location.booleanteleportOffline(Location destination, PlayerTeleportEvent.TeleportCause cause) Sets OfflinePlayer's location.teleportOfflineAsync(Location destination) Sets OfflinePlayer's location.teleportOfflineAsync(Location destination, PlayerTeleportEvent.TeleportCause cause) Sets OfflinePlayer's location.Methods inherited from interface org.bukkit.configuration.serialization.ConfigurationSerializableserializeMethods inherited from interface org.bukkit.permissions.ServerOperatorisOp, setOp
- 
Method Details- 
isOnlineboolean isOnline()Checks if this player is currently online It should be noted that this will return true if any instance of this player is online! This instance may have disconnected. If you wish to check if this specific instance of the player is still online, seeisConnected().- Returns:
- true if they are online
 
- 
isConnectedboolean isConnected()Checks whether the connection to this player is still valid. This will return true as long as this specific instance of the player is still connected. This will return false after this instance has disconnected, even if the same player has reconnected since.- Returns:
- true if this player instance is connected
 
- 
getNameReturns 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:
- getNamein interface- AnimalTamer
- Returns:
- Player name or null if we have not seen a name for this player yet
 
- 
getUniqueIdUUID getUniqueId()Returns the UUID of this player- Specified by:
- getUniqueIdin interface- AnimalTamer
- Returns:
- Player UUID
 
- 
getPlayerProfilePlayerProfile getPlayerProfile()Gets a copy of the player's profile.If the player is online, the returned profile will be complete. Otherwise, only the unique id is guaranteed to be present. You can use PlayerProfile.update()to complete the returned profile.- Returns:
- the player's profile
 
- 
isBannedboolean isBanned()Checks if this player has had their profile banned.- Returns:
- true if banned, otherwise false
 
- 
banPlayerDeprecated.Permanently Bans this player from the server- Parameters:
- reason- Reason for Ban
- Returns:
- Ban Entry
 
- 
banPlayer@Deprecated(since="1.20.4") default BanEntry banPlayer(@Nullable String reason, @Nullable String source) Deprecated.Permanently Bans this player from the server- Parameters:
- reason- Reason for Ban
- source- Source of the ban, or null for default
- Returns:
- Ban Entry
 
- 
banPlayer@Deprecated(since="1.20.4") default BanEntry banPlayer(@Nullable String reason, @Nullable Date expires) Deprecated.Bans this player from the server- Parameters:
- reason- Reason for Ban
- expires- When to expire the ban
- Returns:
- Ban Entry
 
- 
banPlayer@Deprecated(since="1.20.4") default BanEntry banPlayer(@Nullable String reason, @Nullable Date expires, @Nullable String source) Deprecated.Bans this player from the server- Parameters:
- reason- Reason for Ban
- expires- When to expire the ban
- source- Source of the ban or null for default
- Returns:
- Ban Entry
 
- 
banPlayer@Deprecated(since="1.20.4") default BanEntry banPlayer(@Nullable String reason, @Nullable Date expires, @Nullable String source, boolean kickIfOnline) Deprecated.
- 
ban<E extends BanEntry<? super PlayerProfile>> @Nullable E ban(@Nullable String reason, @Nullable Date expires, @Nullable String source) Adds this user to theProfileBanList. If a previous ban exists, this will update the entry.- Parameters:
- reason- reason for the ban, null indicates implementation default
- expires- date for the ban's expiration (unban), or null to imply forever
- source- source of the ban, null indicates implementation default
- Returns:
- the entry for the newly created ban, or the entry for the (updated) previous ban
 
- 
ban<E extends BanEntry<? super PlayerProfile>> @Nullable E ban(@Nullable String reason, @Nullable Instant expires, @Nullable String source) Adds this user to theProfileBanList. If a previous ban exists, this will update the entry.- Parameters:
- reason- reason for the ban, null indicates implementation default
- expires- instant for the ban's expiration (unban), or null to imply forever
- source- source of the ban, null indicates implementation default
- Returns:
- the entry for the newly created ban, or the entry for the (updated) previous ban
 
- 
ban<E extends BanEntry<? super PlayerProfile>> @Nullable E ban(@Nullable String reason, @Nullable Duration duration, @Nullable String source) Adds this user to theProfileBanList. If a previous ban exists, this will update the entry.- Parameters:
- reason- reason for the ban, null indicates implementation default
- duration- how long the ban last, or null to imply forever
- source- source of the ban, null indicates implementation default
- Returns:
- the entry for the newly created ban, or the entry for the (updated) previous ban
 
- 
isWhitelistedboolean isWhitelisted()Checks if this player is whitelisted or not- Returns:
- true if whitelisted
 
- 
setWhitelistedvoid setWhitelisted(boolean value) Sets if this player is whitelisted or not- Parameters:
- value- true if whitelisted
 
- 
getPlayerGets aPlayerobject that this represents, if there is oneIf the player is online, this will return that player. Otherwise, it will return null. - Returns:
- Online player
 
- 
getFirstPlayedlong 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
 
- 
getLastPlayedDeprecated.The API contract is ambiguous and the implementation may or may not return the correct value given this API ambiguity. It is instead recommended usegetLastLogin()orgetLastSeen()depending on your needs.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
 
- 
hasPlayedBeforeboolean hasPlayedBefore()Checks if this player has played on this server before.- Returns:
- True if the player has played before, otherwise false
 
- 
getBedSpawnLocationDeprecated.Misleading name. This method also returns the location of respawn anchors.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.
- See Also:
 
- 
getLastLoginlong getLastLogin()Gets the last date and time that this player logged into the 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:
- last login time
 
- 
getLastSeenlong getLastSeen()Gets the last date and time that this player was seen on the server.If the player has never played before, this will return 0. If the player is currently online, this will return the current time. Otherwise it will be the amount of milliseconds since midnight, January 1, 1970 UTC. - Returns:
- last seen time
 
- 
getRespawnLocationGets the Location where the player will spawn at,nullif they don't have a valid respawn point.
 Unlike online players, the location if found will not be loaded by default.- Returns:
- respawn location if exists, otherwise null.
- See Also:
 
- 
getRespawnLocationGets the Location where the player will spawn at,nullif they don't have a valid respawn point.- Parameters:
- loadLocationAndValidate- load the expected respawn location to retrieve the exact position of the spawn block and check if this position is still valid or not. Loading the location will induce a sync chunk load and must hence be used with caution.
- Returns:
- respawn location if exists, otherwise null.
 
- 
incrementStatisticIncrements 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 null
- IllegalArgumentException- if the statistic requires an additional parameter
 
- 
decrementStatisticDecrements 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 null
- IllegalArgumentException- if the statistic requires an additional parameter
 
- 
incrementStatisticIncrements the given statistic for this player.- Parameters:
- statistic- Statistic to increment
- amount- Amount to increment this statistic by
- Throws:
- IllegalArgumentException- if statistic is null
- IllegalArgumentException- if amount is negative
- IllegalArgumentException- if the statistic requires an additional parameter
 
- 
decrementStatisticDecrements the given statistic for this player.- Parameters:
- statistic- Statistic to decrement
- amount- Amount to decrement this statistic by
- Throws:
- IllegalArgumentException- if statistic is null
- IllegalArgumentException- if amount is negative
- IllegalArgumentException- if the statistic requires an additional parameter
 
- 
setStatisticSets the given statistic for this player.- Parameters:
- statistic- Statistic to set
- newValue- The value to set this statistic to
- Throws:
- IllegalArgumentException- if statistic is null
- IllegalArgumentException- if newValue is negative
- IllegalArgumentException- if the statistic requires an additional parameter
 
- 
getStatisticGets 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 null
- IllegalArgumentException- if the statistic requires an additional parameter
 
- 
incrementStatisticIncrements 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 increment
- material- Material to offset the statistic with
- Throws:
- IllegalArgumentException- if statistic is null
- IllegalArgumentException- if material is null
- IllegalArgumentException- if the given parameter is not valid for the statistic
 
- 
decrementStatisticDecrements 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 decrement
- material- Material to offset the statistic with
- Throws:
- IllegalArgumentException- if statistic is null
- IllegalArgumentException- if material is null
- IllegalArgumentException- if the given parameter is not valid for the statistic
 
- 
getStatisticGets the value of the given statistic for this player.- Parameters:
- statistic- Statistic to check
- material- Material offset of the statistic
- Returns:
- the value of the given statistic
- Throws:
- IllegalArgumentException- if statistic is null
- IllegalArgumentException- if material is null
- IllegalArgumentException- if the given parameter is not valid for the statistic
 
- 
incrementStatisticvoid incrementStatistic(Statistic statistic, Material material, int amount) throws IllegalArgumentException Increments the given statistic for this player for the given material.- Parameters:
- statistic- Statistic to increment
- material- Material to offset the statistic with
- amount- Amount to increment this statistic by
- Throws:
- IllegalArgumentException- if statistic is null
- IllegalArgumentException- if material is null
- IllegalArgumentException- if amount is negative
- IllegalArgumentException- if the given parameter is not valid for the statistic
 
- 
decrementStatisticvoid decrementStatistic(Statistic statistic, Material material, int amount) throws IllegalArgumentException Decrements the given statistic for this player for the given material.- Parameters:
- statistic- Statistic to decrement
- material- Material to offset the statistic with
- amount- Amount to decrement this statistic by
- Throws:
- IllegalArgumentException- if statistic is null
- IllegalArgumentException- if material is null
- IllegalArgumentException- if amount is negative
- IllegalArgumentException- if the given parameter is not valid for the statistic
 
- 
setStatisticvoid setStatistic(Statistic statistic, Material material, int newValue) throws IllegalArgumentException Sets the given statistic for this player for the given material.- Parameters:
- statistic- Statistic to set
- material- Material to offset the statistic with
- newValue- The value to set this statistic to
- Throws:
- IllegalArgumentException- if statistic is null
- IllegalArgumentException- if material is null
- IllegalArgumentException- if newValue is negative
- IllegalArgumentException- if the given parameter is not valid for the statistic
 
- 
incrementStatisticIncrements 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 increment
- entityType- EntityType to offset the statistic with
- Throws:
- IllegalArgumentException- if statistic is null
- IllegalArgumentException- if entityType is null
- IllegalArgumentException- if the given parameter is not valid for the statistic
 
- 
decrementStatisticDecrements 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 decrement
- entityType- EntityType to offset the statistic with
- Throws:
- IllegalArgumentException- if statistic is null
- IllegalArgumentException- if entityType is null
- IllegalArgumentException- if the given parameter is not valid for the statistic
 
- 
getStatisticGets the value of the given statistic for this player.- Parameters:
- statistic- Statistic to check
- entityType- EntityType offset of the statistic
- Returns:
- the value of the given statistic
- Throws:
- IllegalArgumentException- if statistic is null
- IllegalArgumentException- if entityType is null
- IllegalArgumentException- if the given parameter is not valid for the statistic
 
- 
incrementStatisticvoid incrementStatistic(Statistic statistic, EntityType entityType, int amount) throws IllegalArgumentException Increments the given statistic for this player for the given entity.- Parameters:
- statistic- Statistic to increment
- entityType- EntityType to offset the statistic with
- amount- Amount to increment this statistic by
- Throws:
- IllegalArgumentException- if statistic is null
- IllegalArgumentException- if entityType is null
- IllegalArgumentException- if amount is negative
- IllegalArgumentException- if the given parameter is not valid for the statistic
 
- 
decrementStatisticDecrements the given statistic for this player for the given entity.- Parameters:
- statistic- Statistic to decrement
- entityType- EntityType to offset the statistic with
- amount- Amount to decrement this statistic by
- Throws:
- IllegalArgumentException- if statistic is null
- IllegalArgumentException- if entityType is null
- IllegalArgumentException- if amount is negative
- IllegalArgumentException- if the given parameter is not valid for the statistic
 
- 
setStatisticSets the given statistic for this player for the given entity.- Parameters:
- statistic- Statistic to set
- entityType- EntityType to offset the statistic with
- newValue- The value to set this statistic to
- Throws:
- IllegalArgumentException- if statistic is null
- IllegalArgumentException- if entityType is null
- IllegalArgumentException- if newValue is negative
- IllegalArgumentException- if the given parameter is not valid for the statistic
 
- 
getLastDeathLocationGets the player's last death location.- Returns:
- the last death location if it exists, otherwise null.
 
- 
getLocationGets the player's current location.- Returns:
- the player's location, nullif player hasn't ever played before.
 
- 
getPersistentDataContainerPersistentDataContainerView getPersistentDataContainer()Yields a view of the persistent data container for this offline player. In case thisOfflinePlayerinstance was created for an offline player, the returned view will wrap the persistent data on disk.As such, this method as well as queries to the PersistentDataContainerViewmay produce blocking IO requests to read the requested data from disk. Caution in its usage is hence advised.- Specified by:
- getPersistentDataContainerin interface- PersistentDataViewHolder
- Returns:
- the persistent data container view
- See Also:
 
- 
applySkinToPlayerHeadContentsDescription copied from interface:net.kyori.adventure.text.object.PlayerHeadObjectContents.SkinSourceApplies this skin source to the given player head contents builder.The name, id, and properties will be cleared prior to calling by the builder. - Specified by:
- applySkinToPlayerHeadContentsin interface- PlayerHeadObjectContents.SkinSource
- Parameters:
- builder- builder to apply to
 
- 
getAllowFlightboolean getAllowFlight()Determines if the OfflinePlayer is allowed to fly via jump key double-tap like in creative mode.- Returns:
- True if the player is allowed to fly.
 
- 
setAllowFlightvoid setAllowFlight(boolean flight) Sets if the OfflinePlayer is allowed to fly via jump key double-tap like in creative mode.- Parameters:
- flight- If flight should be allowed.
 
- 
isFlyingboolean isFlying()Checks to see if this player is currently flying or not.- Returns:
- True if the player is flying, else false.
 
- 
setFlyingvoid setFlying(boolean value) Makes this player start or stop flying.- Parameters:
- value- True to fly.
 
- 
setFlySpeedSets the speed at which a client will fly. Negative values indicate reverse directions.- Parameters:
- value- The new speed, from -1 to 1.
- Throws:
- IllegalArgumentException- If new speed is less than -1 or greater than 1
 
- 
setWalkSpeedSets the speed at which a client will walk. Negative values indicate reverse directions.- Parameters:
- value- The new speed, from -1 to 1.
- Throws:
- IllegalArgumentException- If new speed is less than -1 or greater than 1
 
- 
getFlySpeedfloat getFlySpeed()Gets the current allowed speed that a client can fly.- Returns:
- The current allowed speed, from -1 to 1
 
- 
getWalkSpeedfloat getWalkSpeed()Gets the current allowed speed that a client can walk.- Returns:
- The current allowed speed, from -1 to 1
 
- 
teleportOfflineSets OfflinePlayer's location. If player is online, it falls back to the Player#teleport implementation.- Parameters:
- destination-
- Returns:
- true if teleportation was successful
 
- 
teleportOfflineSets OfflinePlayer's location. If player is online, it falls back to the Player#teleport implementation.- Parameters:
- destination-
- cause- Teleport cause used if player is online
- Returns:
- true if teleportation was successful
 
- 
teleportOfflineAsyncSets OfflinePlayer's location. If player is online, it falls back to the Player#teleportAsync implementation.- Parameters:
- destination-
- Returns:
- trueif teleportation successful
 
- 
teleportOfflineAsyncCompletableFuture<Boolean> teleportOfflineAsync(Location destination, PlayerTeleportEvent.TeleportCause cause) Sets OfflinePlayer's location. If player is online, it falls back to the Player#teleportAsync implementation.- Parameters:
- destination-
- cause- Teleport cause used if player is online
- Returns:
- trueif teleportation successful
 
 
- 
ban(String, Date, String)