Class BotSentryList

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

public class BotSentryList extends Object
The base operations for the black- and whitelist.
  • Method Details

    • getListType

      public ListType getListType()
      Returns the list type this object is associated with.
      Returns:
      The list type.
    • isWhitelist

      public boolean isWhitelist()
      Gives the list type of the current object in a boolean format. False for ListType.BLACKLIST, true for other values.
      Returns:
      If the list if a whitelist or not.
      See Also:
    • containsItem

      public CompletableFuture<Boolean> containsItem(String item)
      Returns a CompletableFuture which executes a task who checks if the item is in the list.
      Parameters:
      item - The ip/username to check if it is inside the list.
      Returns:
      The CompletableFuture which holds the Supplier for this task.
      Throws:
      IllegalArgumentException - If the item is not in the correct format.
    • contains

      @Deprecated public void contains(String ip, Consumer<Boolean> callback) throws IllegalArgumentException
      Deprecated.
      As of version 9.4-THANATOS. Use containsItem(String) which gives more options about threading. This might be removed in a later update.
      Gives the contains value of the given IP in this list asynchronously.
      Parameters:
      ip - The ip to check if it is inside the list.
      callback - The callback object, it will return the contains value when it is retrieved asynchronously.
      Throws:
      IllegalArgumentException - If the IP is not in the correct IPv4 format.
    • addItem

      public CompletableFuture<Void> addItem(String item)
      Returns a CompletableFuture which executes a task who adds the item to the list. This CompletableFuture can be used to check when the task is done. If the IP is already inside the list, it will do nothing. If the ListType is of type ListType.BLACKLIST and the IP is in the not forced whitelist, this method has no effect.
      Parameters:
      item - The ip/username to add to the list.
      Returns:
      The CompletableFuture which holds the Supplier for this task.
      Throws:
      IllegalArgumentException - If the item is not in the correct format.
    • add

      @Deprecated public void add(String ip)
      Deprecated.
      As of version 9.4-THANATOS. Use addItem(String) which gives more options about threading. This might be removed in a later update.
      Adds an IP to the list asynchronously. If the IP is already inside the list, it will do nothing.
      Parameters:
      ip - The ip to add to the list.
      Throws:
      IllegalArgumentException - If the IP is not in the correct IPv4 format.
    • removeItem

      public CompletableFuture<Void> removeItem(String item)
      Returns a CompletableFuture which executes a task who removes the item from the list. This CompletableFuture can be used to check when the task is done.
      Parameters:
      item - The ip/username to remove from the list.
      Returns:
      The CompletableFuture which holds the Supplier for this task.
      Throws:
      IllegalArgumentException - If the item is not in the correct format.
    • remove

      @Deprecated public void remove(String ip)
      Deprecated.
      As of version 9.4-THANATOS. Use removeItem(String) which gives more options about threading. This might be removed in a later update.
      Removes an IP from the list asynchronously. If the IP is not in the list, it will do nothing.
      Parameters:
      ip - The ip to remove from the list.
      Throws:
      IllegalArgumentException - If the IP is not in the correct IPv4 format.
    • getList

      public CompletableFuture<ArrayList<String>> getList()
      Returns a CompletableFuture which executes a task who returns all items in the list. The returned list is mutable but has no effects on the actual list. This can be used to retrieve the list size or a copy on any given point in time.
      Returns:
      The CompletableFuture which holds the Supplier for this task.
    • get

      @Deprecated public void get(Consumer<Set<String>> callback)
      Deprecated.
      As of version 9.4-THANATOS. Use getList() which gives more options about threading. This might be removed in a later update.
      Gives all IPs in this list asynchronously.
      Parameters:
      callback - The callback object, it will return all IPs in this list when it is retrieved asynchronously.
    • clearList

      public CompletableFuture<Void> clearList()
      Returns a CompletableFuture which executes a task who clears all items in the list.
      Returns:
      The CompletableFuture which holds the Supplier for this task.
    • clear

      @Deprecated public void clear()
      Deprecated.
      As of version 9.4-THANATOS. Use clearList() which gives more options about threading. This might be removed in a later update.
      Clears this list fully asynchronously.