All Known Implementing Classes:
BanProvider

public sealed interface Ban permits BanProvider
The Ban interface defines methods to manage user bans within a system.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    ban(int userId, int creatorId, int reasonId, long time)
    Bans a user for a specified time period.
    getExpiredDate(int userId)
    Retrieves the expiration date for the ban of the user with the specified ID in a human-readable format.
    long
    getExpiredTime(int userId)
    Retrieves the expiration time for the ban of the user with the specified ID.
    Retrieves the Log instance associated with this Ban system.
    Retrieves the Reason instance associated with the Ban system.
    boolean
    isBanned(int userId)
    Checks whether a user is currently banned.
    void
    unban(int userId)
    Unbans a user with the given user ID.
  • Method Details

    • ban

      void ban(int userId, int creatorId, int reasonId, long time)
      Bans a user for a specified time period.
      Parameters:
      userId - The ID of the user to be banned.
      creatorId - The ID of the user who is performing the ban action.
      reasonId - The ID of the reason for banning the user.
      time - The duration of the ban in milliseconds since the epoch.
    • unban

      void unban(int userId)
      Unbans a user with the given user ID.
      Parameters:
      userId - The ID of the user to be unbanned.
    • getExpiredTime

      long getExpiredTime(int userId)
      Retrieves the expiration time for the ban of the user with the specified ID.
      Parameters:
      userId - The ID of the user whose ban expiration time is to be retrieved.
      Returns:
      The expiration time of the ban in milliseconds since the epoch, or -1 if the user is not banned.
    • getExpiredDate

      String getExpiredDate(int userId)
      Retrieves the expiration date for the ban of the user with the specified ID in a human-readable format.
      Parameters:
      userId - The ID of the user whose ban expiration date is to be retrieved.
      Returns:
      The expiration date of the ban as a string, or "Not Banned" if the user is not banned.
    • isBanned

      boolean isBanned(int userId)
      Checks whether a user is currently banned.
      Parameters:
      userId - The ID of the user to check.
      Returns:
      True if the user is banned, false otherwise.
    • getReason

      Reason getReason()
      Retrieves the Reason instance associated with the Ban system.
      Returns:
      The Reason instance configured for this Ban system.
    • getLog

      Log getLog()
      Retrieves the Log instance associated with this Ban system.
      Returns:
      The Log instance configured for this Ban system.