Class StorageManager
java.lang.Object
net.sacredlabyrinth.phaed.simpleclans.managers.StorageManager
- Author:
- phaed
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCallback that returns some data -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChatBlock(org.bukkit.command.CommandSender player, ChatBlock cb) Store pending chat lines for a playervoidCloses DB connectionvoiddeleteClan(Clan clan) Delete a clan from the databasevoidDelete a clan player from the databasevoiddeleteKills(String playerName) Deprecated.voiddeleteKills(UUID playerUniqueId) Delete a player's kill record form the databasegetChatBlock(org.bukkit.entity.Player player) Retrieve a player's pending chat linesgetKillsPerPlayer(String playerName) Returns a map of victim->count of all kills that specific player didvoidgetKillsPerPlayer(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 readyReturns a map of tag->count of all killsvoidgetMostKilled(StorageManager.DataCallback<Map<String, Integer>> callback) Gets, asynchronously, a map of tag->count of all kills and notifies via callback when it's readyvoidImport all data from database to memoryvoidimportFromDatabaseOnePlayer(org.bukkit.entity.Player player) Deprecated.voidInitiates the dbvoidinsertClan(Clan clan) Insert a clan into the databasevoidInsert a clan player into the databasevoidinsertKill(@NotNull ClanPlayer attacker, @NotNull ClanPlayer victim, @NotNull String type, @NotNull LocalDateTime time) Insert a kill into the databasevoidinsertKill(org.bukkit.entity.Player attacker, String attackerTag, org.bukkit.entity.Player victim, String victimTag, String type) Deprecated.Retrieves all clan players from the databaseRetrieves all simple clans from the database@Nullable ClanretrieveOneClan(String tagClan) Retrieves one Clan from the database Used for BungeeCord Reload ClanPlayer and your Clan@Nullable ClanPlayerretrieveOneClanPlayer(UUID playerUniqueId) Retrieves one clan player from the database Used for BungeeCord Reload ClanPlayer and your ClanvoidSaves modified Clans and ClanPlayers to the databasevoidupdateClan(Clan clan) Update a clan to the databasevoidupdateClan(Clan clan, boolean updateLastUsed) Update a clan to the databasevoidupdateClanAsync(Clan clan) Deprecated.voidUpdate a clan player to the databasevoidDeprecated.voidupdatePlayerName(@NotNull ClanPlayer cp) Change the name of a player in the databasevoidupdatePlayerNameAsync(@NotNull ClanPlayer cp) Change the name of a player in the database asynchronously
-
Constructor Details
-
StorageManager
public StorageManager()
-
-
Method Details
-
getChatBlock
Retrieve a player's pending chat lines- Parameters:
player- the Player- Returns:
- the ChatBlock
-
addChatBlock
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.Import one ClanPlayer data from database to memory Used for BungeeCord Reload ClanPlayer and your Clan -
retrieveClans
Retrieves all simple clans from the database -
retrieveOneClan
Retrieves one Clan from the database Used for BungeeCord Reload ClanPlayer and your Clan -
retrieveClanPlayers
Retrieves all clan players from the database -
retrieveOneClanPlayer
Retrieves one clan player from the database Used for BungeeCord Reload ClanPlayer and your Clan -
insertClan
Insert a clan into the database -
updateClanAsync
Deprecated.Update a clan to the database asynchronously -
updatePlayerNameAsync
Change the name of a player in the database asynchronously- Parameters:
cp- to update
-
updatePlayerName
Change the name of a player in the database- Parameters:
cp- to update
-
updateClan
Update a clan to the database -
updateClan
Update a clan to the database- Parameters:
clan- clan to updateupdateLastUsed- should the clan's last used time be updated as well?
-
deleteClan
Delete a clan from the database -
insertClanPlayer
Insert a clan player into the database -
updateClanPlayerAsync
Deprecated.Update a clan player to the database asynchronously -
updateClanPlayer
Update a clan player to the database -
deleteClanPlayer
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 attackervictim- the victimtype- the kill type
-
deleteKills
Deprecated.Delete a player's kill record form the database -
deleteKills
Delete a player's kill record form the database -
getKillsPerPlayer
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
Returns a map of tag->count of all kills- Returns:
- a map of kills per attacker+victim
-
getMostKilled
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
-