java.lang.Object
me.remigio07.chatplugin.api.common.punishment.Punishment
me.remigio07.chatplugin.api.common.punishment.ban.Ban

public abstract class Ban extends Punishment
Represents a ban handled by the BanManager.
See Also:
  • Field Details

    • PLACEHOLDERS

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

      Content: ["id", "player", "player_uuid", "ip_address", "staff_member", "who_unbanned", "reason", "server", "type", "date", "unban_date", "expiration_date", "duration", "remaining_time", "active", "global", "silent"]

      See Also:
  • Method Details

    • getPlayer

      public OfflinePlayer getPlayer()
      Gets this ban's player.

      Will return null if they have not been specified (BanType.IP_ADDRESS with no given player).

      Returns:
      Ban's player
    • getIPAddress

      public InetAddress getIPAddress()
      Gets the IP address the player had when this ban occurred.

      Will return null if the IP address is unknown.

      Returns:
      Ban's IP address
    • getWhoUnbanned

      public String getWhoUnbanned()
      Gets who unbanned getPlayer().

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

      Returns:
      Who unbanned the player
    • setWhoUnbanned

      public void setWhoUnbanned(String whoUnbanned)
      Sets who unbanned getPlayer().
      Parameters:
      whoUnbanned - Who unbanned the player
    • getType

      public BanType getType()
      Gets this ban's type.
      Returns:
      Ban's type
    • getUnbanDate

      public long getUnbanDate()
      Gets this ban's unban date, in milliseconds.

      Will return -1 if the player has not been manually unbanned.

      Returns:
      Unban's date
    • setUnbanDate

      public void setUnbanDate(long unbanDate)
      Sets this ban's unban date, in milliseconds.
      Parameters:
      unbanDate - Unban's date
    • getDuration

      public long getDuration()
      Gets this ban's duration, in milliseconds.

      Will return -1 if this ban is permanent.

      Returns:
      Ban's duration
    • setDuration

      public void setDuration(long duration)
      Sets this ban's duration, in milliseconds.

      You can specify -1 for a permanent ban.

      Parameters:
      duration - Ban's duration
    • getRemainingTime

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

      Will return 0 if the player has been unbanned otherwise -1 if the ban is permanent.

      Returns:
      Ban's remaining time
    • getTaskID

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

      May be used with TaskManager.cancelAsync(long).

      Will return -1 if this ban is permanent, if it has already expired or if !Environment.isProxy() && ProxyManager.isEnabled().

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

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

      Only applies on multi instance setups with a proxy.

      Returns:
      Whether this ban is global
    • setGlobal

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

      Only applies on multi instance setups with a proxy.

      Parameters:
      global - Whether this ban is global
    • isActive

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