Class StorageManager

java.lang.Object
net.sacredlabyrinth.phaed.simpleclans.managers.StorageManager

public final class StorageManager extends Object
Author:
phaed
  • Constructor Details

    • StorageManager

      public StorageManager()
  • Method Details

    • getChatBlock

      public ChatBlock getChatBlock(org.bukkit.entity.Player player)
      Retrieve a player's pending chat lines
      Parameters:
      player - the Player
      Returns:
      the ChatBlock
    • addChatBlock

      public void addChatBlock(org.bukkit.command.CommandSender player, ChatBlock cb)
      Store pending chat lines for a player
    • initiateDB

      public void initiateDB()
      Initiates the db
    • closeConnection

      public void closeConnection()
      Closes DB connection
    • importFromDatabase

      public void importFromDatabase()
      Import all data from database to memory
    • importFromDatabaseOnePlayer

      @Deprecated public void importFromDatabaseOnePlayer(org.bukkit.entity.Player player)
      Deprecated.
      Import one ClanPlayer data from database to memory Used for BungeeCord Reload ClanPlayer and your Clan
    • retrieveClans

      public List<Clan> retrieveClans()
      Retrieves all simple clans from the database
    • retrieveOneClan

      @Nullable public @Nullable Clan retrieveOneClan(String tagClan)
      Retrieves one Clan from the database Used for BungeeCord Reload ClanPlayer and your Clan
    • retrieveClanPlayers

      public List<ClanPlayer> retrieveClanPlayers()
      Retrieves all clan players from the database
    • retrieveOneClanPlayer

      @Nullable public @Nullable ClanPlayer retrieveOneClanPlayer(UUID playerUniqueId)
      Retrieves one clan player from the database Used for BungeeCord Reload ClanPlayer and your Clan
    • insertClan

      public void insertClan(Clan clan)
      Insert a clan into the database
    • updateClanAsync

      @Deprecated public void updateClanAsync(Clan clan)
      Deprecated.
      Update a clan to the database asynchronously
    • updatePlayerNameAsync

      public void updatePlayerNameAsync(@NotNull @NotNull ClanPlayer cp)
      Change the name of a player in the database asynchronously
      Parameters:
      cp - to update
    • updatePlayerName

      public void updatePlayerName(@NotNull @NotNull ClanPlayer cp)
      Change the name of a player in the database
      Parameters:
      cp - to update
    • updateClan

      public void updateClan(Clan clan)
      Update a clan to the database
    • updateClan

      public void updateClan(Clan clan, boolean updateLastUsed)
      Update a clan to the database
      Parameters:
      clan - clan to update
      updateLastUsed - should the clan's last used time be updated as well?
    • deleteClan

      public void deleteClan(Clan clan)
      Delete a clan from the database
    • insertClanPlayer

      public void insertClanPlayer(ClanPlayer cp)
      Insert a clan player into the database
    • updateClanPlayerAsync

      @Deprecated public void updateClanPlayerAsync(ClanPlayer cp)
      Deprecated.
      Update a clan player to the database asynchronously
    • updateClanPlayer

      public void updateClanPlayer(ClanPlayer cp)
      Update a clan player to the database
    • deleteClanPlayer

      public void deleteClanPlayer(ClanPlayer cp)
      Delete a clan player from the database
    • insertKill

      @Deprecated public void insertKill(org.bukkit.entity.Player attacker, String attackerTag, org.bukkit.entity.Player victim, String victimTag, String type)
      Deprecated.
      Insert a kill into the database
    • insertKill

      public void insertKill(@NotNull @NotNull ClanPlayer attacker, @NotNull @NotNull ClanPlayer victim, @NotNull @NotNull String type, @NotNull @NotNull LocalDateTime time)
      Insert a kill into the database
      Parameters:
      attacker - the attacker
      victim - the victim
      type - the kill type
    • deleteKills

      @Deprecated public void deleteKills(String playerName)
      Deprecated.
      Delete a player's kill record form the database
    • deleteKills

      public void deleteKills(UUID playerUniqueId)
      Delete a player's kill record form the database
    • getKillsPerPlayer

      public Map<String,Integer> getKillsPerPlayer(String playerName)
      Returns a map of victim->count of all kills that specific player did
      Parameters:
      playerName - the attacker name
      Returns:
      a map of kills per victim
    • getMostKilled

      public Map<String,Integer> getMostKilled()
      Returns a map of tag->count of all kills
      Returns:
      a map of kills per attacker+victim
    • getMostKilled

      public void getMostKilled(StorageManager.DataCallback<Map<String,Integer>> callback)
      Gets, asynchronously, a map of tag->count of all kills and notifies via callback when it's ready
      Parameters:
      callback - the callback
    • getKillsPerPlayer

      public void getKillsPerPlayer(String playerName, StorageManager.DataCallback<Map<String,Integer>> callback)
      Gets, asynchronously, a map of victim->count of all kills that specific player did and notifies via callback when it's ready
    • saveModified

      public void saveModified()
      Saves modified Clans and ClanPlayers to the database
      Since:
      2.10.2

      author: RoinujNosde