Package com.lahuca.botsentry.api
Class BotSentryList
java.lang.Object
com.lahuca.botsentry.api.BotSentryList
The base operations for the black- and whitelist.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Deprecated.As of version 9.4-THANATOS.Returns aCompletableFuture
which executes a task who adds the item to the list.void
clear()
Deprecated.As of version 9.4-THANATOS.Returns aCompletableFuture
which executes a task who clears all items in the list.void
Deprecated.As of version 9.4-THANATOS.containsItem
(String item) Returns aCompletableFuture
which executes a task who checks if the item is in the list.void
Deprecated.As of version 9.4-THANATOS.getList()
Returns aCompletableFuture
which executes a task who returns all items in the list.Returns the list type this object is associated with.boolean
Gives the list type of the current object in a boolean format.void
Deprecated.As of version 9.4-THANATOS.removeItem
(String item) Returns aCompletableFuture
which executes a task who removes the item from the list.
-
Method Details
-
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 forListType.BLACKLIST
, true for other values.- Returns:
- If the list if a whitelist or not.
- See Also:
-
containsItem
Returns aCompletableFuture
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 theSupplier
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. UsecontainsItem(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
Returns aCompletableFuture
which executes a task who adds the item to the list. ThisCompletableFuture
can be used to check when the task is done. If the IP is already inside the list, it will do nothing. If theListType
is of typeListType.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 theSupplier
for this task. - Throws:
IllegalArgumentException
- If the item is not in the correct format.
-
add
Deprecated.As of version 9.4-THANATOS. UseaddItem(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
Returns aCompletableFuture
which executes a task who removes the item from the list. ThisCompletableFuture
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 theSupplier
for this task. - Throws:
IllegalArgumentException
- If the item is not in the correct format.
-
remove
Deprecated.As of version 9.4-THANATOS. UseremoveItem(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
Returns aCompletableFuture
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 theSupplier
for this task.
-
get
Deprecated.As of version 9.4-THANATOS. UsegetList()
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
Returns aCompletableFuture
which executes a task who clears all items in the list.- Returns:
- The
CompletableFuture
which holds theSupplier
for this task.
-
clear
Deprecated.As of version 9.4-THANATOS. UseclearList()
which gives more options about threading. This might be removed in a later update.Clears this list fully asynchronously.
-