Class QuitPlayerMemory

java.lang.Object
de.marcely.bedwars.api.arena.QuitPlayerMemory
All Implemented Interfaces:
Metadatable

public class QuitPlayerMemory extends Object implements Metadatable
Gets constructed whenever a player leaves a running match. This object contains all the info of the player that's needed to allow him to rejoin the match.
  • Constructor Details

  • Method Details

    • getUniqueId

      public UUID getUniqueId()
      Returns the uuid (OfflinePlayer.getUniqueId()) of the player.
      Returns:
      The uniqueId of the player
    • getUsername

      public String getUsername()
      Returns the name (OfflinePlayer.getName()) of the player.
      Returns:
      The username of the player
    • getTeam

      public Team getTeam()
      Returns the team to which he belongs to.
      Returns:
      The team of the player
    • setTeam

      public void setTeam(Team team)
      Set the team to which the player belongs to.
      Parameters:
      team - The new team of the player
    • 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

      public Instant getLastJoinTime()
      Returns the time when the player has the last (re)joined the match.
      Returns:
      The previous time the player joined the arena
    • setLastJoinTime

      public void setLastJoinTime(Instant time)
      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

      public Instant getQuitTime()
      Returns the time when the player has quit the arena.
      Returns:
      The time the player decided to leave the match
    • setQuitTime

      public void setQuitTime(Instant time)
      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

      public Duration getPlayTime()
      Returns the duration that the player has been within the match.

      The returned value may not match getQuitTime() minus getLastJoinTime() as the player may rejoined multiple times.

      Returns:
      The play time of the player
    • setPlayTime

      public void setPlayTime(Duration playTime)
      Set the total play time the player has been within the match.
      Parameters:
      playTime - The new play time
    • getBuyGroupLevels

      public Map<BuyGroup,Integer> 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

      public Inventory 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

      public Set<ShopItem> getOneTimePurchaseBoughtItems()
      Returns all ShopItems the player has bought which have ShopItem.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

      @Nullable public @Nullable BukkitTask 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. null if there were other players on the team still
    • setSoloRejoinTask

      public void setSoloRejoinTask(@Nullable @Nullable BukkitTask task)
      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. null if there were other players on the team still
    • getGameStats

      public Map<String,Number> 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_RESOURCES achievement.

      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_RESOURCES achievement.

      Parameters:
      amount - The new amount of resources the player has spent
    • getMetadata

      public List<MetadataValue> getMetadata(String key)
      Specified by:
      getMetadata in interface Metadatable
    • hasMetadata

      public boolean hasMetadata(String key)
      Specified by:
      hasMetadata in interface Metadatable
    • removeMetadata

      public void removeMetadata(String key, Plugin plugin)
      Specified by:
      removeMetadata in interface Metadatable
    • setMetadata

      public void setMetadata(String key, MetadataValue value)
      Specified by:
      setMetadata in interface Metadatable