-
Notifications
You must be signed in to change notification settings - Fork 0
Developer‐API
Keine Secrets edited this page Feb 5, 2025
·
1 revision
SimpleLootbox has a developer API that allows you to create custom lootboxes and rewards programmatically. Below are the details of the main API methods available:
The LootboxesAPI class is the main entry point for interacting with the plugin's API. It provides access to various configurations and managers.
-
static LootboxesAPI instance()- Gets the current instance ofLootboxesAPI. -
DatabaseConfiguration databaseConfiguration()- Gets the database configuration. -
MessagesConfiguration messagesConfiguration()- Gets the messages configuration. -
GeneralConfiguration generalConfiguration()- Gets the general configuration. -
RarityConfiguration rarityConfiguration()- Gets the rarity configuration. -
DatabaseManager databaseManager()- Gets the database manager. -
LiveDropManager liveDropManager()- Gets the live drop manager.
The Utility class provides utility methods for common operations.
-
static boolean inRange(Number value, Number min, Number max)- Check if a value is in a range.
The DatabaseManager interface provides methods to manage the database.
-
LootboxManager lootboxManager()- Gets the lootbox manager.
Here is an example of how to use the API to create a lootbox:
LootboxesAPI api = LootboxesAPI.instance();
DatabaseConfiguration dbConfig = api.databaseConfiguration();
MessagesConfiguration msgConfig = api.messagesConfiguration();
GeneralConfiguration genConfig = api.generalConfiguration();
RarityConfiguration rarConfig = api.rarityConfiguration();
DatabaseManager dbManager = api.databaseManager();
LiveDropManager liveDropManager = api.liveDropManager();
// Create a new lootbox
Lootbox newLootbox = new Lootbox("exampleLootbox", Component.text("Example Lootbox"), Material.CHEST, new ArrayList<>());
dbManager.lootboxManager().save(newLootbox);To import the SimpleLootbox API into your project, add the following dependency to your build.gradle file:
repositories {
maven { url = "https://jitpack.io/" }
}
dependencies {
implementation 'com.github.whynotmax.SimpleLootbox:api:-SNAPSHOT'
}