Class PunishmentManager
- All Implemented Interfaces:
ChatPluginManager
- Direct Known Subclasses:
BanManager
,KickManager
,MuteManager
,WarningManager
Punishment
s and interacts with the storage.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract String
formatReason
(String reason, Language language) Formats a punishment's reason checking if it was not specified (== null
): in that case, it will be replaced with the default one set in the specified language's messages file.int
Gets the amount of punishments performed by the anticheat stored in the storage.Gets the next punishment's ID.int
Gets the amount of punishments performed by Staff members stored in the storage.int
Gets the amount of punishments stored in the storage.boolean
Checks if this manager is enabled.void
load()
Loads (or reloads) this manager.void
setAnticheatStorageCount
(int anticheatStorageCount) Sets the amount of punishments performed by the anticheat stored in the storage.void
setStaffStorageCount
(int staffStorageCount) Sets the amount of punishments performed by Staff members stored in the storage.void
setStorageCount
(int storageCount) Sets the amount of punishments stored in the storage.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface me.remigio07.chatplugin.api.common.util.manager.ChatPluginManager
checkAvailability, isReloadable, reload, unload
-
Constructor Details
-
PunishmentManager
public PunishmentManager()
-
-
Method Details
-
load
Description copied from interface:ChatPluginManager
Loads (or reloads) this manager.- Specified by:
load
in interfaceChatPluginManager
- Throws:
ChatPluginManagerException
- If something goes wrong
-
isEnabled
public boolean isEnabled()Description copied from interface:ChatPluginManager
Checks if this manager is enabled.- Specified by:
isEnabled
in interfaceChatPluginManager
- Returns:
- Whether this manager is enabled
-
getNextID
Gets the next punishment's ID.- Returns:
- Next punishment's ID
-
getStorageCount
public int getStorageCount()Gets the amount of punishments stored in the storage.This value is only used to translate "{total_punishments}", where "punishments" is one of the following: "bans", "warnings", "kicks", "mutes".
- Returns:
- Amount of punishments
-
setStorageCount
public void setStorageCount(int storageCount) Sets the amount of punishments stored in the storage.This value is only used to translate "{total_punishments}", where "punishments" is one of the following: "bans", "warnings", "kicks", "mutes".
This method also updates
getNextID()
's value.- Parameters:
storageCount
- Amount of punishments
-
getStaffStorageCount
public int getStaffStorageCount()Gets the amount of punishments performed by Staff members stored in the storage.This value is only used to translate "{total_staff_punishments}", where "punishments" is one of the following: "bans", "warnings", "kicks", "mutes".
- Returns:
- Amount of punishments
-
setStaffStorageCount
public void setStaffStorageCount(int staffStorageCount) Sets the amount of punishments performed by Staff members stored in the storage.This value is only used to translate "{total_staff_punishments}", where "punishments" is one of the following: "bans", "warnings", "kicks", "mutes".
- Parameters:
staffStorageCount
- Amount of punishments
-
getAnticheatStorageCount
public int getAnticheatStorageCount()Gets the amount of punishments performed by the anticheat stored in the storage.This value is only used to translate "{total_anticheat_punishments}", where "punishments" is one of the following: "bans", "warnings", "kicks", "mutes".
- Returns:
- Amount of punishments
-
setAnticheatStorageCount
public void setAnticheatStorageCount(int anticheatStorageCount) Sets the amount of punishments performed by the anticheat stored in the storage.This value is only used to translate "{total_anticheat_punishments}", where "punishments" is one of the following: "bans", "warnings", "kicks", "mutes".
- Parameters:
anticheatStorageCount
- Amount of punishments
-
formatReason
Formats a punishment's reason checking if it was not specified (== null
): in that case, it will be replaced with the default one set in the specified language's messages file.- Parameters:
reason
- Reason to formatlanguage
- Language used to translate the reason- Returns:
- Formatted reason
-