Interface BanService
-
public interface BanService
Represents a service with which to ban things, such asGameProfile
s or IP addresses.Implementors of this service should treat expired bans as non-existent, even if they choose to retain them in a way not accessible through the ban service API (e.g. writing them to a database). In essence, expired bans should be treated the same as user-removed bans.
For example,
bans()
would not include any expired bans.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CompletableFuture<Optional<? extends Ban>>
add(Ban ban)
Adds a ban.CompletableFuture<Collection<? extends Ban>>
bans()
Gets all bans registered.CompletableFuture<Optional<Ban.IP>>
find(InetAddress address)
Gets the ban for the given address, if available.CompletableFuture<Optional<Ban.Profile>>
find(GameProfile profile)
Gets the ban for the givenGameProfile
, if available.CompletableFuture<Collection<Ban.IP>>
ipBans()
Gets all IP bans registered.CompletableFuture<Boolean>
pardon(InetAddress address)
Pardons an IP address, or removes its ban, if present.CompletableFuture<Boolean>
pardon(GameProfile profile)
Pardons a profile, or removes its ban, if present.CompletableFuture<Collection<Ban.Profile>>
profileBans()
Gets allGameProfile
bans registered.CompletableFuture<Boolean>
remove(Ban ban)
Removes a ban.
-
-
-
Method Detail
-
bans
CompletableFuture<Collection<? extends Ban>> bans()
Gets all bans registered.- Returns:
- All registered bans
-
profileBans
CompletableFuture<Collection<Ban.Profile>> profileBans()
Gets allGameProfile
bans registered.- Returns:
- All registered
GameProfile
bans
-
ipBans
CompletableFuture<Collection<Ban.IP>> ipBans()
Gets all IP bans registered.- Returns:
- All registered IP bans
-
find
CompletableFuture<Optional<Ban.Profile>> find(GameProfile profile)
Gets the ban for the givenGameProfile
, if available.- Parameters:
profile
- The profile- Returns:
- The ban, if available
-
find
CompletableFuture<Optional<Ban.IP>> find(InetAddress address)
Gets the ban for the given address, if available.- Parameters:
address
- The address.- Returns:
- All registered IP bans
-
pardon
CompletableFuture<Boolean> pardon(GameProfile profile)
Pardons a profile, or removes its ban, if present.- Parameters:
profile
- The profile- Returns:
- Whether the profile had a ban present
-
pardon
CompletableFuture<Boolean> pardon(InetAddress address)
Pardons an IP address, or removes its ban, if present.- Parameters:
address
- The IP address- Returns:
- Whether the address had a ban present
-
remove
CompletableFuture<Boolean> remove(Ban ban)
Removes a ban.- Parameters:
ban
- The ban- Returns:
- Whether the ban was present in this ban service
-
add
CompletableFuture<Optional<? extends Ban>> add(Ban ban)
Adds a ban.If the GameProfile or IP address of the ban already has a ban set, the passed in ban will replace the existing ban.
- Parameters:
ban
- The ban to add to this ban service- Returns:
- The previous ban, if available
-
-