πŸ’»xWhitelist API

The xWhitelistAPI provides static methods to interact programmatically with xWhitelist. You can manage the whitelist, maintenance whitelist, and check plugin status directly from your code without creating an instance.


πŸ›  Installation

First of all, add the repository and dependency of xWhitelist.

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependency>
    <groupId>com.github.xDrygo</groupId>
    <artifactId>xWhitelist</artifactId>
    <version>1.3.1</version>
    <scope>provided</scope>
</dependency>

After adding the dependency, add xWhitelist as dependency in your plugin.

name: MyPlugin
main: com.example.MyPlugin.MyPlugin
version: 1.0
depend: # depend if is necesary the API, soft-depend if is opcional use.
- xWhitelist

πŸ“‹ xWhitelistAPI Methods

πŸ“ General Whitelist Methods

Click to expand
  • boolean isWhitelistActive() Returns whether the main whitelist is enabled.

  • void toggleWhitelist() Toggles the main whitelist status (enabled/disabled).

  • List<String> getFileWhitelist() Returns a list of players currently in the local file whitelist.

  • boolean isPlayerInWhitelist(String playerName) Checks if a player is in the whitelist (works for both file and MySQL modes).

  • void addPlayerToWhitelist(String playerName) Adds a player to the whitelist (file or MySQL).

  • void removePlayerFromWhitelist(String playerName) Removes a player from the whitelist (file or MySQL).

  • List<String> listWhitelist() Returns a list of all whitelisted players.

  • void clearWhitelist() Clears all entries in the whitelist.


πŸ› οΈ Maintenance Whitelist Methods

Click to expand
  • boolean isMaintenanceWhitelistActive() Returns whether the maintenance whitelist is enabled.

  • void toggleMaintenanceWhitelist() Toggles the maintenance whitelist status.

  • List<String> getMaintenanceWhitelist() Returns the list of players in the maintenance whitelist.

  • boolean isPlayerInMaintenanceWhitelist(String playerName) Checks if a player is in the maintenance whitelist.

  • void addPlayerToMaintenanceWhitelist(String playerName) Adds a player to the maintenance whitelist.

  • void removePlayerFromMaintenanceWhitelist(String playerName) Removes a player from the maintenance whitelist.

  • void cleanupMaintenanceWhitelist() Clears all entries in the maintenance whitelist.

  • List<String> listMaintenanceWhitelist() Returns a list of all players in the maintenance whitelist.


πŸ’‘ Notes

  • All API methods are static, so you do not need to instantiate XWhitelistAPI.

  • Methods handle both local file and MySQL storage automatically.

  • Maintenance whitelist methods always operate on the staff whitelist file, even if MySQL is enabled.

  • Be sure to reload your configuration after modifying whitelist files if needed.


πŸ”— References

Last updated