Class Warning
java.lang.Object
me.remigio07.chatplugin.api.common.punishment.Punishment
me.remigio07.chatplugin.api.common.punishment.warning.Warning
Represents a warning handled by the
WarningManager
.-
Field Summary
Modifier and TypeFieldDescriptionstatic final String[]
Array containing all available placeholders that can be translated with a warning's information. -
Method Summary
Modifier and TypeMethodDescriptionlong
Gets this warning's duration, in milliseconds.Gets this warning's player.long
Gets this warning's remaining time, in milliseconds.long
Gets this warning's expiration task's ID.long
Gets this warning's unwarn date, in milliseconds.Gets who unwarnedgetPlayer()
.boolean
isActive()
Checks if this warning is active at the moment.boolean
isGlobal()
Checks if this warning affects all servers inside of the network.void
setGlobal
(boolean global) Sets if this warning should affect all servers inside of the network.void
setUnwarnDate
(long unwarnDate) Sets this warning's unwarn date, in milliseconds.void
setWhoUnwarned
(String whoUnwarned) Sets who unwarnedgetPlayer()
.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 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"]
-
-
Method Details
-
getPlayer
Gets this warning's player.- Returns:
- Warning's player
-
getWhoUnwarned
Gets who unwarnedgetPlayer()
.Will return
null
if the player has not been manually unwarned.- Returns:
- Who unwarned the player
-
setWhoUnwarned
Sets who unwarnedgetPlayer()
.- 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
-