Interface BanService
-
public interface BanServiceRepresents a service with which to ban things, such asGameProfiles 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 java.util.concurrent.CompletableFuture<java.util.Optional<? extends Ban>>add(Ban ban)Adds a ban.java.util.concurrent.CompletableFuture<java.util.Collection<? extends Ban>>bans()Gets all bans registered.java.util.concurrent.CompletableFuture<java.util.Optional<Ban.IP>>find(java.net.InetAddress address)Gets the ban for the given address, if available.java.util.concurrent.CompletableFuture<java.util.Optional<Ban.Profile>>find(GameProfile profile)Gets the ban for the givenGameProfile, if available.java.util.concurrent.CompletableFuture<java.util.Collection<Ban.IP>>ipBans()Gets all IP bans registered.java.util.concurrent.CompletableFuture<java.lang.Boolean>pardon(java.net.InetAddress address)Pardons an IP address, or removes its ban, if present.java.util.concurrent.CompletableFuture<java.lang.Boolean>pardon(GameProfile profile)Pardons a profile, or removes its ban, if present.java.util.concurrent.CompletableFuture<java.util.Collection<Ban.Profile>>profileBans()Gets allGameProfilebans registered.java.util.concurrent.CompletableFuture<java.lang.Boolean>remove(Ban ban)Removes a ban.
-
-
-
Method Detail
-
bans
java.util.concurrent.CompletableFuture<java.util.Collection<? extends Ban>> bans()
Gets all bans registered.- Returns:
- All registered bans
-
profileBans
java.util.concurrent.CompletableFuture<java.util.Collection<Ban.Profile>> profileBans()
Gets allGameProfilebans registered.- Returns:
- All registered
GameProfilebans
-
ipBans
java.util.concurrent.CompletableFuture<java.util.Collection<Ban.IP>> ipBans()
Gets all IP bans registered.- Returns:
- All registered IP bans
-
find
java.util.concurrent.CompletableFuture<java.util.Optional<Ban.Profile>> find(GameProfile profile)
Gets the ban for the givenGameProfile, if available.- Parameters:
profile- The profile- Returns:
- The ban, if available
-
find
java.util.concurrent.CompletableFuture<java.util.Optional<Ban.IP>> find(java.net.InetAddress address)
Gets the ban for the given address, if available.- Parameters:
address- The address.- Returns:
- All registered IP bans
-
pardon
java.util.concurrent.CompletableFuture<java.lang.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
java.util.concurrent.CompletableFuture<java.lang.Boolean> pardon(java.net.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
java.util.concurrent.CompletableFuture<java.lang.Boolean> remove(Ban ban)
Removes a ban.- Parameters:
ban- The ban- Returns:
- Whether the ban was present in this ban service
-
add
java.util.concurrent.CompletableFuture<java.util.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
-
-