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 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 Details

    • revokeByIdAndType

      RevocationOrder revokeByIdAndType(long id, PunishmentType type)
      Gets a RevocationOrder to undo a punishment by its ID and type.
      Parameters:
      id - the id of the punishment to undo
      type - the type of the punishment to undo
      Returns:
      a revocation order using the ID and type
    • revokeById

      RevocationOrder revokeById(long id)
      Gets a RevocationOrder to 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

      RevocationOrder revokeByTypeAndVictim(PunishmentType type, Victim victim)
      Gets a RevocationOrder to 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 a CompositeVictim with wildcards (CompositeVictim.WILDCARD_UUID or CompositeVictim.WILDCARD_ADDRESS) multiple punishments may match the given criteria. In this case, it is explicitly unspecified which punishment is revoked.
      Parameters:
      type - the punishment type
      victim - the victim whose punishment to undo
      Returns:
      a revocation order using the type and victim
    • revokeByTypeAndPossibleVictims

      RevocationOrder revokeByTypeAndPossibleVictims(PunishmentType type, List<Victim> victims)
      Gets a RevocationOrder to 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 to revokeByTypeAndVictim(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 type
      victims - 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

      ExpunctionOrder expungePunishment(long id)
      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