Interface LapisBansAPI


  • public interface LapisBansAPI
    This is the LapisBansAPI, it can be used to get and create punishments Methods may be added or removed from this API while LapisBans 2.0.0 is still in Beta
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      PunishmentInterface createPunishment​(PunishmentType type, java.util.UUID appliedTo, java.util.UUID appliedBy, java.lang.String reason, boolean isShadow, boolean isTemp, java.lang.Long start, java.lang.Long length)
      Generate and return a punishment
      java.util.List<PunishmentInterface> getAllActivePunishments​(java.util.UUID uuid)
      Get all currently active punishments applied to a player, this excludes punishments that have ended
      java.util.List<PunishmentInterface> getAllPunishments​(java.util.UUID uuid)
      Get all punishments applied to a UUID, this includes punishments that have ended e.g.
      java.util.UUID getConsoleUUID()
      Get the UUID of the console, this can be used for getPunishmentsAppliedBy(UUID)
      java.util.List<PunishmentInterface> getPunishmentsAppliedBy​(java.util.UUID uuid)
      Get all punishments applied by a user, these are punishments set by the provided UUID
      java.util.UUID ipAddressToUUID​(java.lang.String ip)
      IP addresses are stored as UUIDs because all punishment types store data the same way, This means you need a way to convert an IP address to an UUID to create a punishment This is exactly what this method does, use the IP ban punishment method of getIPAddress() to do the reverse
    • Method Detail

      • getAllPunishments

        java.util.List<PunishmentInterface> getAllPunishments​(java.util.UUID uuid)
        Get all punishments applied to a UUID, this includes punishments that have ended e.g. expired temp bans
        Parameters:
        uuid - The UUID of the player you wish to lookup
        Returns:
        Returns a list of punishments where the PunishmentInterface.getAppliedTo() is equal to the provided UUID
      • getAllActivePunishments

        java.util.List<PunishmentInterface> getAllActivePunishments​(java.util.UUID uuid)
        Get all currently active punishments applied to a player, this excludes punishments that have ended
        Parameters:
        uuid - The UUID of the player you wish to lookup
        Returns:
        Returns a list of punishments where the PunishmentInterface.getAppliedTo() is equal to the provided UUID
      • getPunishmentsAppliedBy

        java.util.List<PunishmentInterface> getPunishmentsAppliedBy​(java.util.UUID uuid)
        Get all punishments applied by a user, these are punishments set by the provided UUID
        Parameters:
        uuid - The UUID of the user you wish to look up
        Returns:
        Returns a list of punishments where the PunishmentInterface.getAppliedBy() is equal to the provided UUID
      • createPunishment

        PunishmentInterface createPunishment​(PunishmentType type,
                                             java.util.UUID appliedTo,
                                             java.util.UUID appliedBy,
                                             java.lang.String reason,
                                             boolean isShadow,
                                             boolean isTemp,
                                             java.lang.Long start,
                                             java.lang.Long length)
        Generate and return a punishment
        Parameters:
        type - The type of punishment you would like to make e.g. PunishmentType.Ban
        appliedTo - The UUID of the player the punishment should be applied to (Use ipAddressToUUID(String) to get the UUID for IP bans)
        appliedBy - The UUID of the user that applied the punishment
        reason - The reason for the punishment
        isShadow - True if the punishment should be a shadow punishment (Doesn't apply to warning or kick)
        isTemp - True if the punishment should expire at some point (Also doesn't apply to warning or kick)
        start - The start time of the punishment
        length - The length of the punishment in milliseconds, should be 0 if isTemp is false
        Returns:
        Returns the Punishment object that represents values provided
      • ipAddressToUUID

        java.util.UUID ipAddressToUUID​(java.lang.String ip)
        IP addresses are stored as UUIDs because all punishment types store data the same way, This means you need a way to convert an IP address to an UUID to create a punishment This is exactly what this method does, use the IP ban punishment method of getIPAddress() to do the reverse
        Parameters:
        ip - The IP address you wish to convert to an UUID
        Returns:
        Returns the UUID of the IP address provided
      • getConsoleUUID

        java.util.UUID getConsoleUUID()
        Get the UUID of the console, this can be used for getPunishmentsAppliedBy(UUID)
        Returns:
        UUID of console