Class PunishmentManager

java.lang.Object
me.remigio07.chatplugin.api.common.punishment.PunishmentManager
All Implemented Interfaces:
ChatPluginManager
Direct Known Subclasses:
BanManager, KickManager, MuteManager, WarningManager

public abstract class PunishmentManager extends Object implements ChatPluginManager
Abstract manager that handles Punishments and interacts with the storage.
See Also:
  • Constructor Details

    • PunishmentManager

      public PunishmentManager()
  • Method Details

    • load

      public void load() throws ChatPluginManagerException
      Description copied from interface: ChatPluginManager
      Loads (or reloads) this manager.
      Specified by:
      load in interface ChatPluginManager
      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 interface ChatPluginManager
      Returns:
      Whether this manager is enabled
    • getNextID

      public AtomicInteger 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

      public abstract 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.
      Parameters:
      reason - Reason to format
      language - Language used to translate the reason
      Returns:
      Formatted reason