java.lang.Object
me.github.simonplays15.betterbansystem.core.ban.BanHandler

public class BanHandler extends Object
The BanHandler class provides methods for banning and unbanning players and IP addresses.
  • 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

      public static void removeBan (String target)
      Removes the ban for the specified target.
      Parameters:
      target - The name of the player for whom to remove the ban.
    • findBanEntry

      public static IBanEntry findBanEntry (UUID uuid)
      Finds a ban entry for the given UUID.
      Parameters:
      uuid - the UUID of the player
      Returns:
      the ban entry for the given UUID
    • findBanEntry

      public static IBanEntry findBanEntry (String playerName)
      Finds a ban entry for the given player name.
      Parameters:
      playerName - the name of the player
      Returns:
      the ban entry of the player
    • findIPBanEntry

      public static IIPBanEntry findIPBanEntry (String ipAddress)
      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

      public static void removeIpBan (String target)
      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 ban
      ipAddress - the IP address to ban
      reason - the reason for the ban
      expires - the date the ban expires (null for permanent ban)
      Returns:
      the IP ban entry that was added