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 TypeMethodDescriptionlong
Gets this ban's duration, in milliseconds.Gets the IP address the player had when this ban occurred.Gets this ban's player.long
Gets this ban's remaining time, in milliseconds.long
Gets this ban's expiration task's ID.getType()
Gets this ban's type.long
Gets this ban's unban date, in milliseconds.Gets who unbannedgetPlayer()
.boolean
isActive()
Checks if this ban is active at the moment.boolean
isGlobal()
Checks if this ban affects all servers inside of the network.void
setDuration
(long duration) Sets this ban's duration, in milliseconds.void
setGlobal
(boolean global) Sets if this ban should affect all servers inside of the network.void
setUnbanDate
(long unbanDate) Sets this ban's unban date, in milliseconds.void
setWhoUnbanned
(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
null
if they have not been specified (BanType.IP_ADDRESS
with no given player).- Returns:
- Ban's player
-
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
Gets who unbannedgetPlayer()
.Will return
null
if 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
-