Interface Ban
-
- All Known Subinterfaces:
Ban.IP
,Ban.Profile
public interface Ban
Represents a ban made on an object.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface 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 aGameProfile
.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.Optional<Component>
banSource()
Gets the source that created this ban, if available.static Ban.Builder
builder()
Creates a new Builder.java.time.Instant
creationDate()
Gets the creation date of the ban.java.util.Optional<java.time.Instant>
expirationDate()
Gets the expiration date of this ban, if available.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, Component reason)
Creates an indefinite ban with a reason on a profile.java.util.Optional<Component>
reason()
Gets the reason for the ban, if available.BanType
type()
Gets the type of this ban.
-
-
-
Method Detail
-
builder
static Ban.Builder builder()
Creates a new Builder.- Returns:
- A new ban builder
-
of
static Ban of(GameProfile profile)
Creates an indefinite ban on a profile.- Parameters:
profile
- The profile- Returns:
- The created ban
-
of
static Ban of(GameProfile profile, Component reason)
Creates an indefinite ban with a reason on a profile.- Parameters:
profile
- The profilereason
- The reason- Returns:
- The created ban
-
type
BanType type()
Gets the type of this ban.- Returns:
- The ban type
-
reason
java.util.Optional<Component> reason()
Gets the reason for the ban, if available.- Returns:
- The reason specified for the ban, if available
-
creationDate
java.time.Instant creationDate()
Gets the creation date of the ban.Note that this
Instant
has no effect on whether or not a ban is active. Any ban returned byBanService.find(GameProfile)
will be used (when checking if a player can join, for example), regardless of its creation date.- Returns:
- Creation date of the ban
-
banSource
java.util.Optional<Component> banSource()
Gets the source that created this ban, if available.- Returns:
- the source of this ban, if available
-
expirationDate
java.util.Optional<java.time.Instant> expirationDate()
Gets the expiration date of this ban, if available.- Returns:
- Expiration time of the ban or
Optional.empty()
-
isIndefinite
default boolean isIndefinite()
Gets whether this ban is indefinitely long, e.g. has no expiration date.- Returns:
- True if this ban has no expiration date, otherwise false
-
-