Class QuitPlayerMemory
- All Implemented Interfaces:
Metadatable
Used to keep track of all prior players who already have left. Also used to store data for a player's rejoin capability.
-
Constructor Summary
ConstructorsConstructorDescriptionQuitPlayerMemory(UUID uniqueId, String username, Team team, boolean rejoinPermitted, Instant lastJoinTime, Instant quitTime, Duration playTime, boolean bypassTraps, Inventory playerPrivateInventory, @Nullable BukkitTask soloRejoinTask, int shopResourcesSpentAmount) QuitPlayerMemory(OfflinePlayer player, Team team, boolean rejoinPermitted, Instant lastJoinTime, Instant quitTime, Duration playTime, boolean bypassTraps, Inventory playerPrivateInventory, @Nullable BukkitTask soloRejoinTask, int shopResourcesSpentAmount) -
Method Summary
Modifier and TypeMethodDescriptionReturns a map containing all the corresponding buy-group levels of the player.booleanSet if the player is able to bypass traps.Returns the internal map that represents the game stats of the player.Returns the time when the player has the last (re)joined the match.getMetadata(String key) Returns all ShopItems the player has bought which haveShopItem.isOneTimePurchase()set to true.Returns the players private inventory, used for ender chests in some configurations.Returns the duration that the player has been within the match.Returns the time when the player has quit the arena.intReturns the amount of resources the player has spent in the shop.@Nullable BukkitTaskReturns the task used to eliminate a team if no players rejoin in the configured time.getTeam()Returns the team to which he belongs to.Returns the uuid (OfflinePlayer.getUniqueId()) of the player.Returns the name (OfflinePlayer.getName()) of the player.booleanhasMetadata(String key) booleanReturns if the player is able to rejoin the match.voidremoveMetadata(String key, Plugin plugin) voidsetBypassTraps(boolean bypassTraps) Set if the player is able to bypass traps.voidsetLastJoinTime(Instant time) Set the time when the player has the last time (re)joined the matchvoidsetMetadata(String key, MetadataValue value) voidsetPlayTime(Duration playTime) Set the total play time the player has been within the match.voidsetQuitTime(Instant time) Set the time when the player has the last time quit the arena.voidsetRejoinPermitted(boolean rejoinPermitted) Set if the player is able to rejoin the match.voidsetShopResourcesSpentAmount(int amount) Set the amount of resources the player has spent in the shop.voidsetSoloRejoinTask(@Nullable BukkitTask task) Set the task used to eliminate a team if no players rejoin in the configured time.voidSet the team to which the player belongs to.
-
Constructor Details
-
QuitPlayerMemory
public QuitPlayerMemory(OfflinePlayer player, Team team, boolean rejoinPermitted, Instant lastJoinTime, Instant quitTime, Duration playTime, boolean bypassTraps, Inventory playerPrivateInventory, @Nullable @Nullable BukkitTask soloRejoinTask, int shopResourcesSpentAmount) -
QuitPlayerMemory
-
-
Method Details
-
getUniqueId
Returns the uuid (OfflinePlayer.getUniqueId()) of the player.- Returns:
- The uniqueId of the player
-
getUsername
Returns the name (OfflinePlayer.getName()) of the player.- Returns:
- The username of the player
-
getTeam
Returns the team to which he belongs to.- Returns:
- The team of the player
-
setTeam
Set the team to which the player belongs to.- Parameters:
team- The new team of the player
-
isRejoinPermitted
public boolean isRejoinPermitted()Returns if the player is able to rejoin the match.A player may not be permitted if e.g. his team's elimination was the cause for him to quit.
- Returns:
- if the player can rejoin
-
setRejoinPermitted
public void setRejoinPermitted(boolean rejoinPermitted) Set if the player is able to rejoin the match.A player may not be permitted if e.g. his team's elimination was the cause for him to quit.
- Parameters:
rejoinPermitted- if the player can rejoin
-
getBypassTraps
public boolean getBypassTraps()Set if the player is able to bypass traps.- Returns:
- if the player can bypass traps
-
setBypassTraps
public void setBypassTraps(boolean bypassTraps) Set if the player is able to bypass traps.- Parameters:
bypassTraps- if the player can bypass traps
-
getLastJoinTime
Returns the time when the player has the last (re)joined the match.- Returns:
- The previous time the player joined the arena
-
setLastJoinTime
Set the time when the player has the last time (re)joined the match- Parameters:
time- The new previous time the player joined the arena
-
getQuitTime
Returns the time when the player has quit the arena.- Returns:
- The time the player decided to leave the match
-
setQuitTime
Set the time when the player has the last time quit the arena.- Parameters:
time- The new time the player decided to leave the match
-
getPlayTime
Returns the duration that the player has been within the match.The returned value may not match
getQuitTime()minusgetLastJoinTime()as the player may rejoined multiple times.- Returns:
- The play time of the player
-
setPlayTime
Set the total play time the player has been within the match.- Parameters:
playTime- The new play time
-
getBuyGroupLevels
Returns a map containing all the corresponding buy-group levels of the player. Not all existing buy-groups may be present.It is safe to modify the entries of the Map.
- Returns:
- A map storing the buy-groups of the player
-
getPlayerPrivateInventory
Returns the players private inventory, used for ender chests in some configurations.It is safe to modify the contents of the Inventory.
- Returns:
- The private inventory belong to the player
-
getOneTimePurchaseBoughtItems
Returns all ShopItems the player has bought which haveShopItem.isOneTimePurchase()set to true.It is safe to modify the entries of the Set.
- Returns:
- All one-time-purchase items that have been bought
-
getSoloRejoinTask
Returns the task used to eliminate a team if no players rejoin in the configured time.If you dont want this team to be eliminated if the player does not rejoin, simply cancel this task.
- Returns:
- The task that will eliminate the players team if he leaves the team empty.
nullif there were other players on the team still
-
setSoloRejoinTask
Set the task used to eliminate a team if no players rejoin in the configured time.Note: This doesn't cancel the current task if it exists. Make sure to cancel it before setting a new one.
- Parameters:
task- The task that will eliminate the players team if he leaves the team empty.nullif there were other players on the team still
-
getGameStats
Returns the internal map that represents the game stats of the player.Note that they won't be added to the actual stats thereafter. They only exist for representiation purposes.
- Returns:
- The game stats of the player
- See Also:
-
getShopResourcesSpentAmount
public int getShopResourcesSpentAmount()Returns the amount of resources the player has spent in the shop.This number is used for the
DefaultPlayerAchievement.SPEND_200_RESOURCESachievement.- Returns:
- The amount of resources the player has spent
-
setShopResourcesSpentAmount
public void setShopResourcesSpentAmount(int amount) Set the amount of resources the player has spent in the shop.This number is used for the
DefaultPlayerAchievement.SPEND_200_RESOURCESachievement.- Parameters:
amount- The new amount of resources the player has spent
-
getMetadata
- Specified by:
getMetadatain interfaceMetadatable
-
hasMetadata
- Specified by:
hasMetadatain interfaceMetadatable
-
removeMetadata
- Specified by:
removeMetadatain interfaceMetadatable
-
setMetadata
- Specified by:
setMetadatain interfaceMetadatable
-