Class BotSentryAPI

java.lang.Object
com.lahuca.botsentry.api.BotSentryAPI

public class BotSentryAPI extends Object
Master class of the API for BotSentry.

Retrieve the instance of the API using getAPI().

  • Method Details

    • getAPI

      public static BotSentryAPI getAPI()
      Gives the instance of the BotSentry API which hooks into the plugin. The instance can be null for these reasons:
      • The plugin is not present on the server
      • The plugin is not enabled on the server
      • An error occurred when it was enabling
      Returns:
      Instance of the com.lahuca.botsentry.api. Can be null for several reasons.
    • checkIP

      public static boolean checkIP(String ip)
      Checks the string and returns true if the string is correctly written like IPv4. IPv4 Requirements:
      • Four sections split by a dot. (XXX.XXX.XXX.XXX)
      • Every section should be a number.
      • Every number must lay between 0 and 255.
      Parameters:
      ip - The string to check for.
      Returns:
      The correctness of the given string.
    • getPlatform

      public APIPlatform getPlatform()
      Gives the platform where the plugin is running on. To make it compatible with later versions, it will return APIPlatform.UNKNOWN if platform is not known in the API.
      Returns:
      The platform the API is running on.
    • getMySQL

      public BotSentryMySQL getMySQL()
      Gives the MySQL values object. Null if MySQL is disabled.
      Returns:
      The MySQL values object or null.
    • getIPStatus

      public CompletableFuture<IPStatus> getIPStatus(String ip)
      Returns a CompletableFuture which executes a task who returns the IPStatus of the given IP.
      Parameters:
      ip - The IP to retrieve the status from.
      Returns:
      The CompletableFuture which holds the Supplier for this task.
      Throws:
      IllegalArgumentException - If the IP is not in the correct IPv4 format.
    • getIPStatus

      @Deprecated public void getIPStatus(String ip, Consumer<IPStatus> callback) throws IllegalArgumentException
      Deprecated.
      As of version 9.4-THANATOS. Use getIPStatus(String) which gives more options about threading. This might be removed in a later update.
      Gives the current status of the given IP asynchronously. In case of the IPStatus.BLACKLIST and IPStatus.WHITELIST IP status values, it can also have IPStatus.CHECKED, only if AutoPurger for blacklist is enabled (starting from 8.3-ARES); You can confirm this with isChecked(String, Consumer)
      Parameters:
      ip - The IP to retrieve the status from.
      callback - The callback object, it will return the value when it is retrieved asynchronously.
      Throws:
      IllegalArgumentException - If the IP is not in the correct IPv4 format.
    • isChecked

      @Deprecated public void isChecked(String ip, Consumer<Boolean> callback) throws IllegalArgumentException
      Deprecated.
      As of version 9.4-THANATOS. Use getIPStatus(String) to check if the given IP is checked, which gives more options about threading. This might be removed in a later update.
      Gives the checked status of the given IP asynchronously. This can still give true if the value from getIPStatus(String, Consumer) is IPStatus.WHITELIST or IPStatus.BLACKLIST.

      Starting from 8.3-ARES the checked state has been changed. Now it only stores the checked state when AutoPurger for blacklist is enabled. If it is disabled, it will still return false.

      Parameters:
      ip - The IP to retrieve the checked status from.
      callback - The callback object, it will return the value when it is retrieved asynchronously.
      Throws:
      IllegalArgumentException - If the IP is not in the correct IPv4 format.
    • getCheckedIP

      public CompletableFuture<CheckedIP> getCheckedIP(String ip)
      Returns a CompletableFuture which executes a task who returns the CheckedIP of the given IP. If the IP is not checked, it will return null. Or starting from 8.3-ARES, it will also return null, if AutoPurger for blacklist is disabled.
      Parameters:
      ip - The IP to retrieve the checked data from.
      Returns:
      The CompletableFuture which holds the Supplier for this task.
      Throws:
      IllegalArgumentException - If the IP is not in the correct IPv4 format.
    • getCheckedIP

      @Deprecated public void getCheckedIP(String ip, Consumer<CheckedIP> callback) throws IllegalArgumentException
      Deprecated.
      As of version 9.4-THANATOS. Use getCheckedIP(String) which gives more options about threading. This might be removed in a later update.
      Gives the checked object of the given IP asynchronously. It can also callback null, when the IP is not checked. Or starting from 8.3-ARES, it will also return null, if AutoPurger for blacklist is disabled.
      Parameters:
      ip - The IP to retrieve the checked object from.
      callback - The callback object, it will return the checked object or null when it is retrieved asynchronously.
      Throws:
      IllegalArgumentException - If the IP is not in the correct IPv4 format.
    • getNotForcedWhitelist

      public BotSentryList getNotForcedWhitelist()
      Gives the not forced IPs whitelist. Operations can be done through CompletableFuture, allowing synchronous and asynchronous tasks. These IPs can be removed from this whitelist by detection methods.
      Returns:
      The not forced IPs whitelist.
    • getForcedWhitelist

      public BotSentryList getForcedWhitelist()
      Gives the forced IPs whitelist. Operations can be done through CompletableFuture, allowing synchronous and asynchronous tasks. These IPs can only be removed through the API or BotSentry commands.
      Returns:
      The not forced IPs whitelist.
    • getUsernamesWhitelist

      public BotSentryList getUsernamesWhitelist()
      Gives the usernames whitelist. Operations can be done through CompletableFuture, allowing synchronous and asynchronous tasks. A player that joins with a username in this list, will automatically add their IP to the getNotForcedWhitelist().
      Returns:
      The usernames whitelist.
    • getWhitelist

      @Deprecated public BotSentryList getWhitelist()
      Deprecated.
      Gives the whitelist object, where operations can be asynchronously scheduled.
      Returns:
      The whitelist object.
    • getBlacklist

      public BotSentryList getBlacklist()
      Gives the blacklist. Operations can be done through CompletableFuture, allowing synchronous and asynchronous tasks.
      Returns:
      The blacklist.
    • getAntiBotMode

      public AntiBotSentryMode getAntiBotMode()
      Gives the AntiBot Mode object for handling and retrieving information about AntiBot Mode
      Returns:
      The AntiBot Mode object.