Class BanProvider

java.lang.Object
de.murmelmeister.murmelapi.bansystem.ban.BanProvider
All Implemented Interfaces:
Ban

public final class BanProvider extends Object implements Ban
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static enum 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Log
     
    private final Reason
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • 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.
    private void
    createTable(String tableName)
     
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • reason

      private final Reason reason
    • log

      private final Log log
  • Constructor Details

    • BanProvider

      public BanProvider()
  • Method Details

    • createTable

      private void createTable(String tableName)
    • ban

      public void ban(int userId, int creatorId, int reasonId, long time)
      Description copied from interface: Ban
      Bans a user for a specified time period.
      Specified by:
      ban in interface Ban
      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

      public void unban(int userId)
      Description copied from interface: Ban
      Unbans a user with the given user ID.
      Specified by:
      unban in interface Ban
      Parameters:
      userId - The ID of the user to be unbanned.
    • getExpiredTime

      public long getExpiredTime(int userId)
      Description copied from interface: Ban
      Retrieves the expiration time for the ban of the user with the specified ID.
      Specified by:
      getExpiredTime in interface Ban
      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

      public String getExpiredDate(int userId)
      Description copied from interface: Ban
      Retrieves the expiration date for the ban of the user with the specified ID in a human-readable format.
      Specified by:
      getExpiredDate in interface Ban
      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

      public boolean isBanned(int userId)
      Description copied from interface: Ban
      Checks whether a user is currently banned.
      Specified by:
      isBanned in interface Ban
      Parameters:
      userId - The ID of the user to check.
      Returns:
      True if the user is banned, false otherwise.
    • getReason

      public Reason getReason()
      Description copied from interface: Ban
      Retrieves the Reason instance associated with the Ban system.
      Specified by:
      getReason in interface Ban
      Returns:
      The Reason instance configured for this Ban system.
    • getLog

      public Log getLog()
      Description copied from interface: Ban
      Retrieves the Log instance associated with this Ban system.
      Specified by:
      getLog in interface Ban
      Returns:
      The Log instance configured for this Ban system.