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

    • QuitPlayerMemory

      public QuitPlayerMemory(OfflinePlayer player, Team team, long lastJoinTime, long quitTime, boolean bypassTraps, @Nullable @Nullable BukkitTask soloRejoinTask)
    • QuitPlayerMemory

      public QuitPlayerMemory(UUID uniqueId, String username, Team team, long lastJoinTime, long quitTime, boolean bypassTraps, @Nullable @Nullable BukkitTask soloRejoinTask)
  • 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 long getLastJoinTime()
      Returns the last time (in millis) the player rejoned the match
      Returns:
      The previous time the player joined the arena
    • setLastJoinTime

      public void setLastJoinTime(long time)
      Set the last time (in millis) the player rejoned the match
      Parameters:
      time - The new previous time the player joined the arena
    • getQuitTime

      public long getQuitTime()
      Returns the time (in millis) the player has lastly quit the arena.
      Returns:
      The time the player decided to leave the match
    • setQuitTime

      public void setQuitTime(long time)
      Set the time (in millis) the player has lastly quit the arena.
      Parameters:
      time - The new time the player decided to leave the match
    • getPlayTime

      public long getPlayTime()
      Returns the total time (in millis) 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 playtime of the player
    • setPlayTime

      public void setPlayTime(long playTime)
      Set the total play time (in millis).
      Parameters:
      playTime - The new playTime
    • 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