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
    • 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
    • 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