Class BanHandler
java.lang.Object
me.github.simonplays15.betterbansystem.core.ban.BanHandler
The BanHandler class provides methods for banning and unbanning players and IP
addresses.
-
Constructor Summary
ConstructorsConstructorDescriptionThe BanHandler class provides methods for handling bans and IP bans. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull IBanEntry
addBan
(@NotNull BaseCommandSender sender, @NotNull String target, String reason, Date expires) Adds a ban entry for a target player.static @NotNull IIPBanEntry
addIpBan
(@NotNull BaseCommandSender sender, String ipAddress, String reason, Date expires) Adds an IP ban entry.static IBanEntry
findBanEntry
(String playerName) Finds a ban entry for the given player name.static IBanEntry
findBanEntry
(UUID uuid) Finds a ban entry for the given UUID.static IIPBanEntry
findIPBanEntry
(String ipAddress) Finds an IP ban entry given the IP address.static void
Removes the ban for the specified target.static void
removeIpBan
(String target) Removes an IP ban for a given target.
-
Constructor Details
-
BanHandler
@Contract(pure=true) public BanHandler()The BanHandler class provides methods for handling bans and IP bans.
-
-
Method Details
-
addBan
@NotNull public static @NotNull IBanEntry addBan(@NotNull @NotNull BaseCommandSender sender, @NotNull @NotNull String target, String reason, Date expires) Adds a ban entry for a target player.- Parameters:
sender
- The sender who is adding the ban.target
- The target player.reason
- The reason for the ban.expires
- The expiration date of the ban. Can be null for a permanent ban.- Returns:
- The added ban entry.
-
removeBan
Removes the ban for the specified target.- Parameters:
target
- The name of the player for whom to remove the ban.
-
findBanEntry
Finds a ban entry for the given UUID.- Parameters:
uuid
- the UUID of the player- Returns:
- the ban entry for the given UUID
-
findBanEntry
Finds a ban entry for the given player name.- Parameters:
playerName
- the name of the player- Returns:
- the ban entry of the player
-
findIPBanEntry
Finds an IP ban entry given the IP address.- Parameters:
ipAddress
- The IP address to search for.- Returns:
- The IP ban entry matching the given IP address, or null if no match is found.
-
removeIpBan
Removes an IP ban for a given target.- Parameters:
target
- The IP address to remove the ban for.
-
addIpBan
@NotNull public static @NotNull IIPBanEntry addIpBan(@NotNull @NotNull BaseCommandSender sender, String ipAddress, String reason, Date expires) Adds an IP ban entry.- Parameters:
sender
- the command sender who is adding the banipAddress
- the IP address to banreason
- the reason for the banexpires
- the date the ban expires (null for permanent ban)- Returns:
- the IP ban entry that was added
-