public interface Ban
Modifier and Type | Interface and Description |
---|---|
static interface |
Ban.Builder
Represents a builder that creates bans.
|
static interface |
Ban.Ip
Represents a ban made on an IP.
|
static interface |
Ban.Profile
Represents a ban made on a
GameProfile . |
Modifier and Type | Method and Description |
---|---|
static Ban.Builder |
builder()
Creates a new Builder.
|
Optional<CommandSource> |
getBanCommandSource()
Gets the source that created this ban in
CommandSource form,
if available. |
Optional<Text> |
getBanSource()
Gets the source that created this ban, if available.
|
Instant |
getCreationDate()
Gets the creation date of the ban.
|
Optional<Instant> |
getExpirationDate()
Gets the expiration date of this ban, if available.
|
Optional<Text> |
getReason()
Gets the reason for the ban, if available.
|
BanType |
getType()
Gets the type of this ban.
|
default boolean |
isIndefinite()
Gets whether this ban is indefinitely long, e.g.
|
static Ban |
of(GameProfile profile)
Creates an indefinite ban on a profile.
|
static Ban |
of(GameProfile profile,
Text reason)
Creates an indefinite ban with a reason on a profile.
|
static Ban.Builder builder()
static Ban of(GameProfile profile)
profile
- The profilestatic Ban of(GameProfile profile, Text reason)
profile
- The profilereason
- The reasonBanType getType()
Optional<Text> getReason()
Instant getCreationDate()
Note that this Instant
has no effect on whether or not a ban is
active. Any ban for which BanService.hasBan(Ban)
returns
true
will be used (when checking if a player can join,
for example), regardless of its creation date.
Optional<Text> getBanSource()
Depending on the implementation, the returned Text
may represent a CommandSource
. getBanCommandSource()
can be
used to attempt to convert the source to a CommandSource
.
Optional<CommandSource> getBanCommandSource()
CommandSource
form,
if available.
Depending on the implementation, it may not be possible to determine
the CommandSource
responsible for this ban. Because of this,
it is recommended to check getBanSource()
if this method
returns Optional.empty()
.
Optional.empty()
Optional<Instant> getExpirationDate()
Optional.empty()
default boolean isIndefinite()