Interface IDatabase
public interface IDatabase
Represents a database interface for managing player statistics and data.
-
Method Summary
Modifier and TypeMethodDescriptionfetchStats
(UUID uuid) Fetches the player statistics for the given UUID.int
Gets the value of a statistics column for the given player.getCustomStat
(String columnName, UUID player) Retrieves a custom statistic for a player.getLanguage
(UUID player) Gets the language of a player.Object[]
getLevelData
(UUID player) Gets the player's level and experience points (XP).getQuickBuySlots
(UUID uuid, int slot) Gets the value of the quick buy slot for a player.getQuickBuySlots
(UUID uuid, int[] slots) Gets the values of multiple quick buy slots for a player.boolean
hasQuickBuy
(UUID player) Checks if a player has any quick buy slots.boolean
Checks if a player has remote statistics.void
init()
Initializes the database.void
pushQuickBuyChanges
(HashMap<Integer, String> updateSlots, UUID uuid, List<IQuickBuyElement> elementList) Pushes the changes to the quick buy slots for a player.void
saveCustomStat
(String columnName, UUID player, Object value, String dataType) Saves a custom statistic for a player.void
saveStats
(IPlayerStats stats) Creates or replaces statistics for a player.void
setLanguage
(UUID player, String iso) Sets the language for a player.void
setLevelData
(UUID player, int level, int xp, String displayName, int nextCost) Sets the level data for a player.
-
Method Details
-
init
void init()Initializes the database. -
hasStats
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
Creates or replaces statistics for a player.- Parameters:
stats
- The player statistics to save.
-
fetchStats
Fetches the player statistics for the given UUID.- Parameters:
uuid
- The UUID of the player.- Returns:
- The player statistics for the specified UUID.
-
saveCustomStat
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
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
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
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
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
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
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
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
Sets the language for a player.- Parameters:
player
- The UUID of the player.iso
- The ISO code representing the player's language.
-
getLanguage
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.
-