BlazeBans API/Reference

Type reference

Every public type in `net.blazebans.api`, in one place. Twenty-three classes.

BlazeBansProvider

Static holder. net.blazebans.api.BlazeBansProvider.

MethodReturnsNotes
get()BlazeBansApiThrows IllegalStateException when unavailable
optional()Optional<BlazeBansApi>Empty when unavailable
available()booleanWhether it is registered right now
register(api)voidBlazeBans only. Do not call
unregister(api)voidBlazeBans only. Do not call
registerAddon(addon)voidAdds or replaces addon metadata
unregisterAddon(pluginId)voidRemoves it
addons()List<BlazeBansAddon>Sorted by display name
addon(pluginId)Optional<BlazeBansAddon>Case-insensitive lookup

BlazeBansApi

MethodReturns
version()String
punishments()PunishmentService
players()PlayerService

PunishmentService

Every method returns a CompletableFuture. See Threading.

MethodCompletes with
isBanned(name, uuid)Boolean
isBanned(name, uuid, ipAddress)Boolean
isMuted(name, uuid)Boolean
isMuted(name, uuid, ipAddress)Boolean
activeBan(name, uuid)Optional<Punishment>
activeBan(name, uuid, ipAddress)Optional<Punishment>
activeMute(name, uuid)Optional<Punishment>
activeMute(name, uuid, ipAddress)Optional<Punishment>
activePunishment(type, name, uuid)Optional<Punishment>
punishmentById(id)Optional<Punishment>
history(target)List<Punishment>
activeBans()List<Punishment>
activeMutes()List<Punishment>
activeWarns()List<Punishment>
createPunishment(request)Optional<Punishment>
revokePunishment(id, staffName, reason)Optional<Punishment>
revokeActive(request)Optional<Punishment>
editReason(id, reason)Optional<Punishment>

target accepts a name, a UUID string, or a raw IP address. IDs work with or without the #.

PlayerService

MethodCompletes with
recordPlayer(name, uuid, ipAddress)Void
profile(target)Optional<PlayerProfile>
knownPlayerNames()List<String>
alts(target)List<PlayerProfile>
nameHistory(target)List<PlayerNameEntry>

Punishment

Immutable record.

ComponentTypeNullable
id()Stringno
type()PunishmentTypeno
targetName()Stringno
targetUuid()UUIDyes
staffName()Stringno
staffUuid()UUIDyes
reason()Stringno
createdAt()Instantno
expiresAt()Instantyes, null means permanent
revokedAt()Instantyes
revokedBy()Stringyes
revokeReason()Stringyes
proofUrl()Stringno, blank when absent
serverScope()Stringno
serverId()Stringno, blank when global
silent()booleanno

Derived:

MethodReturns
active()true only while neither revoked nor expired
permanent()true when expiresAt is null
status()ACTIVE, REVOKED, or EXPIRED, computed on call

PunishmentCreateRequest

Mutable. Every field has a getter and a setter of the same name.

Constructor order: type, targetName, targetUuid, targetIpAddress, staffName, staffUuid, duration, reason, proofUrl, serverScope, serverId, silent.

FieldTypeBehaviour
typePunishmentTypeThrows on null
targetNameStringNull becomes ""
targetUuidUUIDNull allowed
targetIpAddressStringNull becomes ""
staffNameStringNull becomes ""
staffUuidUUIDNull allowed
durationDurationNull becomes Duration.ZERO, which is permanent
reasonStringNull becomes "", which uses the configured default
proofUrlStringNull becomes ""
serverScopeStringNull becomes ""
serverIdStringNull becomes ""
silentboolean

PunishmentRevokeRequest

Constructor: types, target, staffName, reason.

MemberTypeMutable
types()List<PunishmentType>no, copied on construction
target()Stringno
staffName()Stringyes
reason()Stringyes

Enums

PunishmentType: BAN, MUTE, WARN, KICK, IP_BAN, IP_MUTE, VOICE_MUTE

PunishmentStatus: ACTIVE, REVOKED, EXPIRED

PunishmentScope: GLOBAL, SERVER

BlazeBansEnforcementType: BAN_LOGIN, KICK, MUTE_CHAT, MUTE_COMMAND

Records carry scope as a string rather than the enum, so compare case-insensitively.

PlayerProfile

Record: name(), uuid(), lastSeen(). UUID and instant may be null.

PlayerNameEntry

Record: name(), uuid(), seenAt(), source(). UUID and instant may be null.

BlazeBansAddon

Record: pluginId(), name(), version(), description(), status().

All five are trimmed on construction, and null becomes "". pluginId and name throw IllegalArgumentException if blank.

Events

All extend org.bukkit.event.Event and implement Cancellable.

EventMembers
BlazeBansPunishmentCreateEventrequest()
BlazeBansPunishmentCreatedEventpunishment(), enforcementDelay(), enforcementDelay(Duration)
BlazeBansPunishmentRevokeEventrequest()
BlazeBansPunishmentRevokedEventpunishment()
BlazeBansPunishmentEnforceEventenforcementType(), punishment(), playerName(), playerUuid()
BlazeBansMutedChatEventpunishment(), playerName(), playerUuid(), message()
BlazeBansMutedCommandEventpunishment(), playerName(), playerUuid(), command()

enforcementDelay(Duration) clamps null and negative values to zero, and the Paper implementation caps the total at five seconds.

What cancelling each one does is in Event reference.

AddonConsole

Constructors:

java
new AddonConsole(String addonName, Consumer<Component> output);
new AddonConsole(String addonName, Consumer<Component> output, Consumer<String> trueColorOutput);

addonName cannot be blank.

MethodColour
blank()empty line
info(message)light grey
step(message)blaze orange
success(message)green
warning(message)amber
error(message)red
error(message, throwable)red, with the stack trace

Every line is prefixed [BlazeBans <addonName>].

Package layout

txt
net.blazebans.api
  BlazeBansApi
  BlazeBansProvider
net.blazebans.api.addon
  BlazeBansAddon
net.blazebans.api.console
  AddonConsole
  TrueColorAnsi
net.blazebans.api.event
  BlazeBansEnforcementType
  BlazeBansMutedChatEvent
  BlazeBansMutedCommandEvent
  BlazeBansPunishmentCreateEvent
  BlazeBansPunishmentCreatedEvent
  BlazeBansPunishmentEnforceEvent
  BlazeBansPunishmentRevokeEvent
  BlazeBansPunishmentRevokedEvent
net.blazebans.api.player
  PlayerNameEntry
  PlayerProfile
  PlayerService
net.blazebans.api.punishment
  Punishment
  PunishmentCreateRequest
  PunishmentRevokeRequest
  PunishmentScope
  PunishmentService
  PunishmentStatus
  PunishmentType

These names are frozen across releases. Nothing outside this package is supported.