java.lang.Object
me.remigio07.chatplugin.api.common.punishment.Punishment
me.remigio07.chatplugin.api.common.punishment.warning.Warning

public abstract class Warning extends Punishment
Represents a warning handled by the WarningManager.
See Also:
  • Field Details

    • PLACEHOLDERS

      public static final String[] PLACEHOLDERS
      Array containing all available placeholders that can be translated with a warning's information.

      Content: ["id", "player", "player_uuid", "staff_member", "who_unwarned", "reason", "server", "date", "unwarn_date", "expiration_date", "duration", "remaining_time", "amount", "max_amount", "active", "global", "silent"]

      See Also:
  • Method Details

    • getPlayer

      public OfflinePlayer getPlayer()
      Gets this warning's player.
      Returns:
      Warning's player
    • getWhoUnwarned

      public String getWhoUnwarned()
      Gets who unwarned getPlayer().

      Will return null if the player has not been manually unwarned.

      Returns:
      Who unwarned the player
    • setWhoUnwarned

      public void setWhoUnwarned(String whoUnwarned)
      Sets who unwarned getPlayer().
      Parameters:
      whoUnwarned - Who unwarned the player
    • getUnwarnDate

      public long getUnwarnDate()
      Gets this warning's unwarn date, in milliseconds.

      Will return -1 if the player has not been unwarned.

      Returns:
      Unwarn's date
    • setUnwarnDate

      public void setUnwarnDate(long unwarnDate)
      Sets this warning's unwarn date, in milliseconds.
      Parameters:
      unwarnDate - Unwarn's date
    • getDuration

      public long getDuration()
      Gets this warning's duration, in milliseconds.
      Returns:
      Warning's duration
    • getRemainingTime

      public long getRemainingTime()
      Gets this warning's remaining time, in milliseconds.

      Will return 0 if the player has been unwarned.

      Returns:
      Warning's remaining time
    • getTaskID

      public long getTaskID()
      Gets this warning's expiration task's ID.

      May be used with TaskManager.cancelAsync(long).

      Will return -1 if this warning has already expired or if !Environment.isProxy() && ProxyManager.isEnabled().

      Returns:
      Warning's expiration task's ID
    • isGlobal

      public boolean isGlobal()
      Checks if this warning affects all servers inside of the network.

      Only applies on multi instance setups with a proxy.

      Returns:
      Whether this warning is global
    • setGlobal

      public void setGlobal(boolean global)
      Sets if this warning should affect all servers inside of the network.

      Only applies on multi instance setups with a proxy.

      Parameters:
      global - Whether this warning is global
    • isActive

      public boolean isActive()
      Checks if this warning is active at the moment.
      Returns:
      Whether this warning is active