Interface PunishmentRevoker
public interface PunishmentRevoker
Agent of removing active punishments in accordance with constraints. For
example, one victim cannot have more than 1 ban, therefore a ban may be
undone if the victim is known.
Only active punishments can be undone. Historical punishments cannot be removed. See
Note that
Only active punishments can be undone. Historical punishments cannot be removed. See
space.arim.libertybans.api.punish for a description of
active and historical punishments. Note that
Punishment.undoPunishment() should be used instead of a
revocation order if a punishment instance is already obtained.- Author:
- A248
-
Method Summary
Modifier and TypeMethodDescriptionexpungePunishment(long id) Totally expunges a punishment according to its ID.revokeById(long id) Gets aRevocationOrderto undo a punishment according to its ID.revokeByIdAndType(long id, PunishmentType type) Gets aRevocationOrderto undo a punishment by its ID and type.revokeByTypeAndPossibleVictims(PunishmentType type, List<Victim> victims) Gets aRevocationOrderto undo a punishment by its type and victim, trying multiple victims until one of them is found to be punished.revokeByTypeAndVictim(PunishmentType type, Victim victim) Gets aRevocationOrderto undo a punishment by its type and victim.
-
Method Details
-
revokeByIdAndType
Gets aRevocationOrderto undo a punishment by its ID and type.- Parameters:
id- the id of the punishment to undotype- the type of the punishment to undo- Returns:
- a revocation order using the ID and type
-
revokeById
Gets aRevocationOrderto undo a punishment according to its ID.
When the punishment type is known,revokeByIdAndType(long, PunishmentType)should be used.- Parameters:
id- the id of the punishment to undo- Returns:
- a revocation order using the ID
-
revokeByTypeAndVictim
Gets aRevocationOrderto undo a punishment by its type and victim. This is commonly be used for singular punishments (bans and mutes), relying on the fact that a single victim cannot have more than 1 such punishment.
For non-singular punishments, or for aCompositeVictimwith wildcards (CompositeVictim.WILDCARD_UUIDorCompositeVictim.WILDCARD_ADDRESS) multiple punishments may match the given criteria. In this case, it is explicitly unspecified which punishment is revoked.- Parameters:
type- the punishment typevictim- the victim whose punishment to undo- Returns:
- a revocation order using the type and victim
-
revokeByTypeAndPossibleVictims
Gets aRevocationOrderto undo a punishment by its type and victim, trying multiple victims until one of them is found to be punished.
The process for undoing the punishment is identical torevokeByTypeAndVictim(PunishmentType, Victim), except that multiple victims are tried: if the first victim is punished, that punishment is undone, if second victim is punished, that punishment is undone, et cetera.- Parameters:
type- the punishment typevictims- the victims, one of whose punishments will be undone- Returns:
- a revocation order using the type and victim
- Throws:
IllegalArgumentException- if the list of victims is empty
-
expungePunishment
Totally expunges a punishment according to its ID. This uses the most efficient means to completely remove a punishment from the database without any trace leftover. Punishments deleted through this method are not recoverable.- Parameters:
id- the id of the punishment to expunge- Returns:
- an expunction order
-