Class Ban
BanManager.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]Array containing all available placeholders that can be translated with a ban's information. -
Method Summary
Modifier and TypeMethodDescriptionlongGets this ban's duration, in milliseconds.Gets the IP address the player had when this ban occurred.Gets this ban's player.longGets this ban's remaining time, in milliseconds.longGets this ban's expiration task's ID.getType()Gets this ban's type.longGets this ban's unban date, in milliseconds.Gets who unbannedgetPlayer().booleanisActive()Checks if this ban is active at the moment.booleanisGlobal()Checks if this ban affects all servers inside of the network.voidsetDuration(long duration) Sets this ban's duration, in milliseconds.voidsetGlobal(boolean global) Sets if this ban should affect all servers inside of the network.voidsetUnbanDate(long unbanDate) Sets this ban's unban date, in milliseconds.voidsetWhoUnbanned(String whoUnbanned) Sets who unbannedgetPlayer().Methods inherited from class me.remigio07.chatplugin.api.common.punishment.Punishment
formatPlaceholders, formatPlaceholders, getDate, getID, getReason, getServer, getStaffMember, isSilent, setDate, setReason, setServer, setSilent, setStaffMember
-
Field Details
-
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
Gets this ban's player.Will return
nullif they have not been specified (BanType.IP_ADDRESSwith no given player).- Returns:
- Ban's player
-
getIPAddress
Gets the IP address the player had when this ban occurred.Will return
nullif the IP address is unknown.- Returns:
- Ban's IP address
-
getWhoUnbanned
Gets who unbannedgetPlayer().Will return
nullif the player has not been manually unbanned.- Returns:
- Who unbanned the player
-
setWhoUnbanned
Sets who unbannedgetPlayer().- Parameters:
whoUnbanned- Who unbanned the player
-
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
-