Class BanManager

java.lang.Object
com.gamersafer.minecraft.auth.common.ban.BanManager

public class BanManager extends Object
  • Constructor Details

  • Method Details

    • isUserBanned

      public CompletableFuture<Boolean> isUserBanned(UserIdentity identity, @Nullable String guildMemberId)
      Checks whether the given used is banned.
      Parameters:
      identity - the user identity
      guildMemberId - their guild member id
      Returns:
      true if they are banned, false otherwise
    • isUserBanned

      public CompletableFuture<Boolean> isUserBanned(UserIdentity identity, @Nullable String guildMemberId, boolean excludeIpBans)
      Checks whether the given user is banned.
      Parameters:
      identity - the user identity
      guildMemberId - their guild member id
      excludeIpBans - whether to ignore IP-bans and only check for regular bans
      Returns:
      true if they are banned, false otherwise
    • isUserIpBanned

      public CompletableFuture<Boolean> isUserIpBanned(UserIdentity identity, @Nullable String guildMemberId)
      Checks whether the given used is IP-banned. NOTE: regular bans are ignored. See isUserBanned(UserIdentity, String, boolean)
      Parameters:
      identity - the user identity
      guildMemberId - their guild member id
      Returns:
      true if they are IP-banned, false otherwise
    • banUser

      public CompletableFuture<Ban> banUser(String organization, @Nullable String uniqueServerId, Date banTime, @Nullable Date endTime, @Nullable String guildMemberId, UUID playerUuid, String playerName, @Nullable String playerHostAddress, boolean ipBan, @Nullable String reporterGuildMemberId, UUID reporterPlayerUuid, String reporterPlayerName, Category category, boolean wasChildInvolved, String message)
    • unbanUser

      public CompletableFuture<Void> unbanUser(String organization, @Nullable String uniqueServerId, Date unbanTime, @Nullable String guildMemberId, UUID playerUuid, String playerName, @Nullable String reporterGuildMemberId, UUID reporterPlayerUuid, String reporterPlayerName, String message)
    • unbanIpUser

      public CompletableFuture<Void> unbanIpUser(String organization, @Nullable String uniqueServerId, Date unbanTime, @Nullable String guildMemberId, UUID playerUuid, String playerName, @NonNull String playerHostAddress, @Nullable String reporterGuildMemberId, UUID reporterPlayerUuid, String reporterPlayerName, String message)
    • getBans

      public CompletableFuture<List<Ban>> getBans(UserIdentity identity, @Nullable String guildMemberId)
      Gets all bans associated with the given user identity.
      Parameters:
      identity - the user identity
      guildMemberId - the guild member id
      Returns:
      all bans, including both regular and IP bans
    • getBans

      public CompletableFuture<List<Ban>> getBans(String guildMemberId)
      Gets all bans associated with the given guild member id. NOTE: this might not return IP punishments. See getBans(UserIdentity, String)
      Parameters:
      guildMemberId - the guild member id
      Returns:
      the bans associated with the given guild member id
    • getSignificantActiveBan

      public CompletableFuture<Optional<Ban>> getSignificantActiveBan(UserIdentity identity, @Nullable String guildMemberId)
      Gets the most recent and relevant active ban. The "significance" of bans is based on these prioritiess:
      1. permanent IP-bans
      2. temporary IP-bans
      3. permanent regular bans
      4. temporary regular bans
      Parameters:
      identity - the user identity
      guildMemberId - the guild member id
      Returns:
      the most recent active ban, if present
    • shutdown

      public void shutdown()
      Waits for the background saving task to finish.
    • importBans

      public CompletableFuture<Void> importBans(List<Ban> bans)