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