Package net.glowstone.io
Interface PlayerDataService.PlayerReader
- All Superinterfaces:
AutoCloseable
- Enclosing interface:
- PlayerDataService
A piecewise reader for initializing new players. See
PlayerDataService.beginReadingData(java.util.UUID)
.-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close any resources involved in reading the player data.org.bukkit.Location
Get the player's bed spawn location if available.long
Get the first-played time if available.Get the player's last known username if available.long
Get the last-login time if available.long
Get the last-played time if available.org.bukkit.Location
Get the last saved location of the player if available.boolean
Check whether the player has played before.void
readData
(GlowPlayer player) Finish reading the rest of the player's entity data into the specified player entity.
-
Method Details
-
hasPlayedBefore
boolean hasPlayedBefore()Check whether the player has played before.If the player has not played before, most of the rest of the fields will have their default values.
If the player has played before, some fields may still not have meaningful values, depending on the data.
- Returns:
- True if the player has played before.
-
getLocation
org.bukkit.Location getLocation()Get the last saved location of the player if available.- Returns:
- The location, or null.
-
getBedSpawnLocation
org.bukkit.Location getBedSpawnLocation()Get the player's bed spawn location if available.- Returns:
- The location, or null.
-
getFirstPlayed
long getFirstPlayed()Get the first-played time if available.- Returns:
- Time in milliseconds since epoch, or 0.
-
getLastPlayed
long getLastPlayed()Get the last-played time if available.- Returns:
- Time in milliseconds since epoch, or 0.
-
getLastLogin
long getLastLogin()Get the last-login time if available.- Returns:
- Time in milliseconds since epoch, or 0.
-
getLastKnownName
String getLastKnownName()Get the player's last known username if available.- Returns:
- The name, or null.
-
readData
Finish reading the rest of the player's entity data into the specified player entity.- Parameters:
player
- The target player.
-
close
void close()Close any resources involved in reading the player data.- Specified by:
close
in interfaceAutoCloseable
-