public class DatabaseManager
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
DatabaseManager.BannerType
The different types of banners for storing/retrieving in the database
|
static class |
DatabaseManager.UpdateType
The different types of updates for storing/retrieving in the database
|
| Constructor and Description |
|---|
DatabaseManager(Banana plugin) |
| Modifier and Type | Method and Description |
|---|---|
void |
asyncAddBan(java.lang.String uuid,
java.lang.Enum<DatabaseManager.BannerType> type,
java.lang.String bannerUUID,
java.lang.String message,
boolean tempBanned,
java.lang.Long tempBanDate,
java.lang.String unparsedDate)
Used to add a player who has been banned.
|
void |
asyncAddMute(java.lang.String uuid,
java.lang.String reason,
boolean tempMuted,
java.lang.Long unmuteDate,
java.lang.String unparsedMuteDate)
Used to add a mute to the database (both temp and perm)
|
void |
asyncAddStaffMember(java.lang.String uuid)
Async adds a staff member's uuid to the database
|
void |
asyncAddWarning(java.lang.String uuid,
java.lang.String warnMessage,
java.lang.String warner)
Used to add a warning to the database, it will be
|
void |
asyncBanIP(java.lang.String address,
java.lang.String message,
java.lang.Enum<DatabaseManager.BannerType> type,
java.lang.String bannerUUID,
boolean tempBanned,
java.lang.Long tempBanDate,
java.lang.String unparsedDate)
Used to add async add an IP ban to the database
|
void |
asyncDeleteWarning(int warningID)
Used to delete a warning in the database
|
void |
asyncListWarnings(org.bukkit.command.CommandSender sender,
java.lang.String uuid)
List the warnings to the player who is specified
|
void |
asyncPurgeWarnings(java.lang.String uuid)
Purges warnings for the particular player
|
void |
asyncRemoveBan(java.lang.String uuid)
Used to delete a ban in the database.
|
void |
asyncRemoveIPBan(java.lang.String address)
Used to async unban an ip
|
void |
asyncRemoveMute(java.lang.String uuid)
Used to async remove mutes from the database
|
void |
asyncRemoveStaffMember(java.lang.String uuid)
Async removes a member's uuid from the database
|
void |
asyncUpdatePlayer(java.lang.String uuid,
java.lang.String address,
java.lang.String playerName)
Used to async update the player's information in the database.
|
void |
decrementWarning(int id)
Decrements the warning number of a player by its ID (and removes it from the list)
|
static boolean |
isUpating()
Used to tell if the database is set to loop (this doesn't necessarily mean it's looping, though)
|
void |
kickAllUpdatePublisher(java.lang.String kickerName,
java.lang.String message)
Sends the update to kick all players to the database.
|
void |
logCommand(java.lang.Enum<CommandType> commandType,
java.util.UUID senderUUID,
java.lang.String[] args,
boolean isConsole)
Used to log a command a player ran! Only really useful for commands inside of BANana
|
boolean |
populateDatabase()
Used to get the database ready for work!
|
void |
queueEntry(java.lang.String sql)
Adds an entry to be updating upon the next loop
|
static void |
setUpdating(boolean isUpdating)
Used to set if the database loop runs.
|
void |
startLoop()
Used to start the update loop...
|
boolean |
syncLoadValues()
Used to load all of the stored information into the active cache (should only be used once!)
Done in a sync thread.
|
public DatabaseManager(Banana plugin)
public static void setUpdating(boolean isUpdating)
isUpdating - public static boolean isUpating()
public void startLoop()
public void queueEntry(java.lang.String sql)
sql - The string sql to be updatedpublic boolean populateDatabase()
public boolean syncLoadValues()
public void asyncAddBan(java.lang.String uuid,
java.lang.Enum<DatabaseManager.BannerType> type,
java.lang.String bannerUUID,
java.lang.String message,
boolean tempBanned,
java.lang.Long tempBanDate,
java.lang.String unparsedDate)
uuid - The uuid to banmessage - The message to ban! Cannot be null, must be some valuetempBanned - If the player is being tempbanned or nottempBanDate - If the player is being tempBanned, a long version of the date (in milliseconds) must be providedpublic void asyncRemoveBan(java.lang.String uuid)
uuid - The uuid to unbanpublic void asyncAddWarning(java.lang.String uuid,
java.lang.String warnMessage,
java.lang.String warner)
uuid - The uuid to add to the stringwarnMessage - The message that went along with the warning!public void asyncDeleteWarning(int warningID)
warningID - The row ID to deletepublic void asyncListWarnings(org.bukkit.command.CommandSender sender,
java.lang.String uuid)
sender - The entity to send the messages touuid - The uuid to fetch the warnings frompublic void logCommand(java.lang.Enum<CommandType> commandType, java.util.UUID senderUUID, java.lang.String[] args, boolean isConsole)
commandName - The name of the command to logsenderUUID - The sender of the commandargs - The arguments of the command.. Once again for logging purposespublic void asyncBanIP(java.lang.String address,
java.lang.String message,
java.lang.Enum<DatabaseManager.BannerType> type,
java.lang.String bannerUUID,
boolean tempBanned,
java.lang.Long tempBanDate,
java.lang.String unparsedDate)
address - The address to ban (wildcards might be supported D:)message - The message to go with the ban (optional)tempBanned - Set to true if this is a tempbantempBanDate - If tempBanned is set to true, you must give the date of the unbanpublic void asyncUpdatePlayer(java.lang.String uuid,
java.lang.String address,
java.lang.String playerName)
uuid - The uuid of the playeraddress - The player's ip addressplayerName - the player's latest usernamepublic void asyncRemoveIPBan(java.lang.String address)
address - The IP to unbanpublic void asyncAddMute(java.lang.String uuid,
java.lang.String reason,
boolean tempMuted,
java.lang.Long unmuteDate,
java.lang.String unparsedMuteDate)
uuid - The uuid to mutereason - The reason used alongside the mutetempMuted - If the player is temp muted or notunmuteDate - The date that the player will be unmutedunparsedMuteDate - The pure form of the date (in the form 0:0:0:0 or similar). This iw
only for pushing the updates to the servers outside the networkpublic void asyncRemoveMute(java.lang.String uuid)
uuid - The uuid to remove (will remove all mutes on that specific UUIDpublic void asyncAddStaffMember(java.lang.String uuid)
uuid - The uuid to addpublic void asyncRemoveStaffMember(java.lang.String uuid)
uuid - public void decrementWarning(int id)
id - the id to check forpublic void asyncPurgeWarnings(java.lang.String uuid)
uuid - The uuid to remove all warnings forpublic void kickAllUpdatePublisher(java.lang.String kickerName,
java.lang.String message)
kickerName - The name of the player who is kicking all the other players. (Not a UUID!)message - The message to kick the players with! Simple, right? No..? screw you!