Package com.lahuca.botsentry.api
Class BotSentryAPI
java.lang.Object
com.lahuca.botsentry.api.BotSentryAPI
Master class of the API for BotSentry.
Retrieve the instance of the API using getAPI()
.
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Checks the string and returns true if the string is correctly written like IPv4.Gives the AntiBot Mode object for handling and retrieving information about AntiBot Modestatic BotSentryAPI
getAPI()
Gives the instance of the BotSentry API which hooks into the plugin.Gives the blacklist.getCheckedIP
(String ip) Returns aCompletableFuture
which executes a task who returns theCheckedIP
of the given IP.void
getCheckedIP
(String ip, Consumer<CheckedIP> callback) Deprecated.As of version 9.4-THANATOS.Gives the forced IPs whitelist.getIPStatus
(String ip) Returns aCompletableFuture
which executes a task who returns theIPStatus
of the given IP.void
getIPStatus
(String ip, Consumer<IPStatus> callback) Deprecated.As of version 9.4-THANATOS.getMySQL()
Gives the MySQL values object.Gives the not forced IPs whitelist.Gives the platform where the plugin is running on.Gives the usernames whitelist.Deprecated.void
Deprecated.As of version 9.4-THANATOS.
-
Method Details
-
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
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
Gives the platform where the plugin is running on. To make it compatible with later versions, it will returnAPIPlatform.UNKNOWN
if platform is not known in the API.- Returns:
- The platform the API is running on.
-
getMySQL
Gives the MySQL values object. Null if MySQL is disabled.- Returns:
- The MySQL values object or null.
-
getIPStatus
Returns aCompletableFuture
which executes a task who returns theIPStatus
of the given IP.- Parameters:
ip
- The IP to retrieve the status from.- Returns:
- The
CompletableFuture
which holds theSupplier
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. UsegetIPStatus(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 theIPStatus.BLACKLIST
andIPStatus.WHITELIST
IP status values, it can also haveIPStatus.CHECKED
, only if AutoPurger for blacklist is enabled (starting from 8.3-ARES); You can confirm this withisChecked(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. UsegetIPStatus(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 fromgetIPStatus(String, Consumer)
isIPStatus.WHITELIST
orIPStatus.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
Returns aCompletableFuture
which executes a task who returns theCheckedIP
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 theSupplier
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. UsegetCheckedIP(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
Gives the not forced IPs whitelist. Operations can be done throughCompletableFuture
, allowing synchronous and asynchronous tasks. These IPs can be removed from this whitelist by detection methods.- Returns:
- The not forced IPs whitelist.
-
getForcedWhitelist
Gives the forced IPs whitelist. Operations can be done throughCompletableFuture
, allowing synchronous and asynchronous tasks. These IPs can only be removed through the API or BotSentry commands.- Returns:
- The not forced IPs whitelist.
-
getUsernamesWhitelist
Gives the usernames whitelist. Operations can be done throughCompletableFuture
, allowing synchronous and asynchronous tasks. A player that joins with a username in this list, will automatically add their IP to thegetNotForcedWhitelist()
.- Returns:
- The usernames whitelist.
-
getWhitelist
Deprecated.Gives the whitelist object, where operations can be asynchronously scheduled.- Returns:
- The whitelist object.
-
getBlacklist
Gives the blacklist. Operations can be done throughCompletableFuture
, allowing synchronous and asynchronous tasks.- Returns:
- The blacklist.
-
getAntiBotMode
Gives the AntiBot Mode object for handling and retrieving information about AntiBot Mode- Returns:
- The AntiBot Mode object.
-