### Get Plugin Instance Source: https://github.com/nulli0n/excellentcrates-spigot/wiki/Developer-API Obtain the main plugin instance to access other API features. This is the first step for most API interactions. ```java ExcellentCrates plugin = ExcellentCratesAPI.PLUGIN; ``` -------------------------------- ### Get Plugin Instance Source: https://github.com/nulli0n/excellentcrates-spigot/wiki/Developer-API Obtain the plugin instance using the ExcellentCratesAPI class. This instance is required to access other API methods. ```APIDOC ## Get Plugin Instance ### Description Obtain the plugin instance using the `ExcellentCratesAPI` class. This instance is required to access other API methods. ### Method Static method call ### Endpoint N/A (Java API) ### Code Example ```java ExcellentCrates plugin = ExcellentCratesAPI.PLUGIN; ``` ``` -------------------------------- ### Get Crate Instance by Block Source: https://github.com/nulli0n/excellentcrates-spigot/wiki/Developer-API Find a Crate instance associated with a specific block. This is helpful for crates placed in the world. ```java // By Block Crate crate = plugin.getCrateManager().getCrateByBlock(block); ``` -------------------------------- ### Get Crate Instance Source: https://github.com/nulli0n/excellentcrates-spigot/wiki/Developer-API Retrieve a Crate instance by various identifiers such as ID, NPC ID, ItemStack, Block, or Location. ```APIDOC ## Get Crate Instance ### Description Retrieve a `Crate` instance by various identifiers such as ID, NPC ID, ItemStack, Block, or Location. ### Method `getCrateManager().getCrateById(id)` `getCrateManager().getCrateByNPC(npcId)` `getCrateManager().getCrateByItem(item)` `getCrateManager().getCrateByBlock(block)` `getCrateManager().getCrateByLocation(location)` ### Endpoint N/A (Java API) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```java // By id Crate crate = plugin.getCrateManager().getCrateById(id); // By Citizens NPC ID Crate crate = plugin.getCrateManager().getCrateByNPC(npcId); // By ItemStack Crate crate = plugin.getCrateManager().getCrateByItem(item); // By Block Crate crate = plugin.getCrateManager().getCrateByBlock(block); // By Location Crate crate = plugin.getCrateManager().getCrateByLocation(location); ``` ### Response #### Success Response (200) - **crate** (Crate) - The Crate object matching the identifier. ``` -------------------------------- ### Get KeyManager Instance Source: https://github.com/nulli0n/excellentcrates-spigot/wiki/Developer-API Access the KeyManager to manage crate keys. This manager provides methods for key-related operations. ```APIDOC ## Get KeyManager Instance ### Description Access the `KeyManager` to manage crate keys. This manager provides methods for key-related operations. ### Method `getKeyManager()` ### Endpoint N/A (Java API) ### Code Example ```java KeyManager km = plugin.getKeyManager(); ``` ``` -------------------------------- ### Get Crate Instance by ItemStack Source: https://github.com/nulli0n/excellentcrates-spigot/wiki/Developer-API Retrieve a Crate instance based on an ItemStack. This is useful if you have the item that represents the crate. ```java // By ItemStack Crate crate = plugin.getCrateManager().getCrateByItem(item); ``` -------------------------------- ### Get CrateManager Instance Source: https://github.com/nulli0n/excellentcrates-spigot/wiki/Developer-API Obtain the CrateManager to interact with crates. This manager allows retrieval and management of crate definitions. ```APIDOC ## Get CrateManager Instance ### Description Obtain the `CrateManager` to interact with crates. This manager allows retrieval and management of crate definitions. ### Method `getCrateManager()` ### Endpoint N/A (Java API) ### Code Example ```java CrateManager cm = plugin.getCrateManager(); ``` ``` -------------------------------- ### Get CrateManager Instance Source: https://github.com/nulli0n/excellentcrates-spigot/wiki/Developer-API Obtain the CrateManager to access and manage all crates within the plugin. This is essential for crate-specific operations. ```java CrateManager cm = plugin.getCrateManager(); ``` -------------------------------- ### Get Crate Instance by ID Source: https://github.com/nulli0n/excellentcrates-spigot/wiki/Developer-API Retrieve a specific Crate instance using its unique identifier. This is useful for targeting a particular crate. ```java // By id Crate crate = plugin.getCrateManager().getCrateById(id); ``` -------------------------------- ### Get Crate Instance by Location Source: https://github.com/nulli0n/excellentcrates-spigot/wiki/Developer-API Retrieve a Crate instance based on its world location. This allows for precise targeting of crates in the game world. ```java // By Location Crate crate = plugin.getCrateManager().getCrateByLocation(location); ``` -------------------------------- ### Get KeyManager Instance Source: https://github.com/nulli0n/excellentcrates-spigot/wiki/Developer-API Access the KeyManager to interact with crate keys. This manager handles all key-related operations within the plugin. ```java KeyManager km = plugin.getKeyManager(); ``` -------------------------------- ### Define Crate Slots in Menu Configuration Source: https://github.com/nulli0n/excellentcrates-spigot/wiki/Virtual-Crates Assign crate IDs to specific inventory slots within your virtual crate GUI configuration. This example shows how to map 'emerald', 'golden', and 'diamond' crates to slots 20, 22, and 24 respectively. ```yaml Slots: emerald: 20 golden: 22 diamond: 24 ``` -------------------------------- ### Get CrateUser Instance Source: https://github.com/nulli0n/excellentcrates-spigot/wiki/Developer-API Retrieve a CrateUser instance to access player-specific data. This can be done using a Player object, UUID, or player name. ```APIDOC ## Get CrateUser Instance ### Description Retrieve a `CrateUser` instance to access player-specific data. This can be done using a Player object, UUID, or player name. ### Method `getUserManager().getUserData(player)` `getUserManager().getUserData(uuid)` `getUserManager().getUserData(name)` ### Endpoint N/A (Java API) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```java // By Player object CrateUser user = plugin.getUserManager().getUserData(player); // By UUID CrateUser user = plugin.getUserManager().getUserData(uuid); // By player name CrateUser user = plugin.getUserManager().getUserData(name); ``` ### Response #### Success Response (200) - **user** (CrateUser) - The CrateUser object for the specified player. ``` -------------------------------- ### Get CrateUser Data Source: https://github.com/nulli0n/excellentcrates-spigot/wiki/Developer-API Retrieve a CrateUser instance to manage player-specific data. Supports lookup by Player object, UUID, or player name. ```java // By Player object CrateUser user = plugin.getUserManager().getUserData(player); // By UUID CrateUser user = plugin.getUserManager().getUserData(uuid); // By player name CrateUser user = plugin.getUserManager().getUserData(name); ``` -------------------------------- ### Get Crate Instance by NPC ID Source: https://github.com/nulli0n/excellentcrates-spigot/wiki/Developer-API Find a Crate instance associated with a Citizens NPC. This allows interaction with crates linked to NPCs. ```java // By Citizens NPC ID Crate crate = plugin.getCrateManager().getCrateByNPC(npcId); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.