Interface BanManager
public interface BanManager
A service that manages bans.
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptionbooleanRecords a ban, replacing any existing entry for the same target.bans()Gets the active bans.disconnectMessage(BanEntry entry) Builds the message shown on the disconnect screen of a banned player.find(InetAddress address) Gets the active ban on a client address.Gets the active ban on a player identity.findAny(UUID uuid, @Nullable InetAddress address) Gets whatever bans a connecting player, whether that is their identity or the address they connect from.findByName(String name) Gets the active ban recorded under a name, matched case-insensitively.default Stream<BanEntry.Address> ipBans()Gets the active bans issued against a client address.default booleanisBanned(InetAddress address) Checks whether a client address is currently banned.default booleanChecks whether a player identity is currently banned.booleanpardon(InetAddress address) Lifts the ban on a client address.booleanLifts the ban on a player identity.default Stream<BanEntry.Profile> Gets the active bans issued against a player identity.intGets how many targets are currently banned.
-
Method Details
-
find
Gets the active ban on a player identity.An expired entry must not be returned; implementations are free to discard it.
- Parameters:
uuid- the player identity- Returns:
- the active ban, or empty when nothing bans the identity
- Since:
- 0.1.0
-
find
Gets the active ban on a client address.An expired entry must not be returned; implementations are free to discard it.
- Parameters:
address- the client address- Returns:
- the active ban, or empty when nothing bans the address
- Since:
- 0.1.0
-
findByName
Gets the active ban recorded under a name, matched case-insensitively.Only entries carrying a recorded name can match, so this never resolves an address.
- Parameters:
name- the player name- Returns:
- the active ban, or empty
- Since:
- 0.1.0
-
findAny
Gets whatever bans a connecting player, whether that is their identity or the address they connect from.- Parameters:
uuid- the player identityaddress- the address the client connects from, ornullwhen unknown- Returns:
- the active ban, or empty when the player may connect
- Since:
- 0.1.0
-
isBanned
Checks whether a player identity is currently banned.- Parameters:
uuid- the player identity- Returns:
truewhen the identity is banned- Since:
- 0.1.0
-
isBanned
Checks whether a client address is currently banned.- Parameters:
address- the client address- Returns:
truewhen the address is banned- Since:
- 0.1.0
-
ban
Records a ban, replacing any existing entry for the same target.- Parameters:
entry- the ban to record- Returns:
truewhen the target was not already banned- Since:
- 0.1.0
-
pardon
Lifts the ban on a player identity.- Parameters:
uuid- the player identity- Returns:
truewhen a ban was actually lifted- Since:
- 0.1.0
-
pardon
Lifts the ban on a client address.- Parameters:
address- the client address- Returns:
truewhen a ban was actually lifted- Since:
- 0.1.0
-
bans
-
profileBans
Gets the active bans issued against a player identity.- Returns:
- the bans, most recently issued first; expired entries are excluded
- Since:
- 0.1.0
-
ipBans
Gets the active bans issued against a client address.- Returns:
- the bans, most recently issued first; expired entries are excluded
- Since:
- 0.1.0
-
totalBans
@Contract(pure=true) int totalBans()Gets how many targets are currently banned.- Returns:
- the number of active bans
- Since:
- 0.1.0
-
disconnectMessage
Builds the message shown on the disconnect screen of a banned player.This is the single place the message is produced: callers must not assemble their own, so that an implementation replacing this one is actually the message players see.
- Parameters:
entry- the ban- Returns:
- the disconnect message
- Since:
- 0.1.0
-