Interface IDatabase


public interface IDatabase
Represents a database interface for managing player statistics and data.
  • Method Details

    • init

      void init()
      Initializes the database.
    • hasStats

      boolean hasStats(UUID uuid)
      Checks if a player has remote statistics.
      Parameters:
      uuid - The UUID of the player.
      Returns:
      true if the player has remote statistics, false otherwise.
    • saveStats

      void saveStats(IPlayerStats stats)
      Creates or replaces statistics for a player.
      Parameters:
      stats - The player statistics to save.
    • fetchStats

      IPlayerStats fetchStats(UUID uuid)
      Fetches the player statistics for the given UUID.
      Parameters:
      uuid - The UUID of the player.
      Returns:
      The player statistics for the specified UUID.
    • saveCustomStat

      void saveCustomStat(String columnName, UUID player, Object value, String dataType)
      Saves a custom statistic for a player.
      Parameters:
      columnName - The name of the custom column to save the statistic in.
      player - The UUID of the player.
      value - The value of the custom statistic.
      dataType - The data type of the custom statistic.
    • getCustomStat

      Object getCustomStat(String columnName, UUID player)
      Retrieves a custom statistic for a player.
      Parameters:
      columnName - The name of the custom column to retrieve the statistic from.
      player - The UUID of the player.
      Returns:
      The value of the custom statistic, or null if the statistic is not found.
    • getQuickBuySlots

      String getQuickBuySlots(UUID uuid, int slot)
      Gets the value of the quick buy slot for a player.
      Parameters:
      uuid - The UUID of the player.
      slot - The identifier of the quick buy slot.
      Returns:
      The value of the quick buy slot.
    • getQuickBuySlots

      HashMap<Integer,String> getQuickBuySlots(UUID uuid, int[] slots)
      Gets the values of multiple quick buy slots for a player.
      Parameters:
      uuid - The UUID of the player.
      slots - An array of identifiers of the quick buy slots.
      Returns:
      A HashMap containing the slot identifier as the key and the slot value as the value.
    • hasQuickBuy

      boolean hasQuickBuy(UUID player)
      Checks if a player has any quick buy slots.
      Parameters:
      player - The UUID of the player.
      Returns:
      true if the player has quick buy slots, false otherwise.
    • getColumn

      int getColumn(UUID player, String column)
      Gets the value of a statistics column for the given player.
      Parameters:
      player - The UUID of the player.
      column - The name of the statistics column.
      Returns:
      The value of the statistics column.
    • getLevelData

      Object[] getLevelData(UUID player)
      Gets the player's level and experience points (XP).
      Parameters:
      player - The UUID of the player.
      Returns:
      An Object array containing the player's level, XP, display name, and next level cost. Index 0: player level (int) Index 1: player XP (int) Index 2: display name (String) Index 3: next level cost (int)
    • setLevelData

      void setLevelData(UUID player, int level, int xp, String displayName, int nextCost)
      Sets the level data for a player.
      Parameters:
      player - The UUID of the player.
      level - The player's level.
      xp - The player's experience points (XP).
      displayName - The display name associated with the player's level.
      nextCost - The cost required for the next level.
    • setLanguage

      void setLanguage(UUID player, String iso)
      Sets the language for a player.
      Parameters:
      player - The UUID of the player.
      iso - The ISO code representing the player's language.
    • getLanguage

      String getLanguage(UUID player)
      Gets the language of a player.
      Parameters:
      player - The UUID of the player.
      Returns:
      The ISO code representing the player's language.
    • pushQuickBuyChanges

      void pushQuickBuyChanges(HashMap<Integer,String> updateSlots, UUID uuid, List<IQuickBuyElement> elementList)
      Pushes the changes to the quick buy slots for a player.
      Parameters:
      updateSlots - A HashMap where the key is the slot ID and the value is the element.
      uuid - The UUID of the player.
      elementList - A list of quick buy elements.