### Complete Plugin Example: Giving Players Skulls Source: https://context7.com/rollczi/liteskullapi/llms.txt A full working example demonstrating how to create a command that gives players skulls using LiteSkullAPI. It initializes the API with caching and registers a command executor to handle skull retrieval and inventory addition. ```java import dev.rollczi.liteskullapi.LiteSkullFactory; import dev.rollczi.liteskullapi.SkullAPI; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.command.PluginCommand; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import java.time.Duration; public class SkullPlugin extends JavaPlugin { private SkullAPI skullAPI; @Override public void onEnable() { // Initialize the SkullAPI with custom settings this.skullAPI = LiteSkullFactory.builder() .cacheExpireAfterWrite(Duration.ofMinutes(45L)) .bukkitScheduler(this) .build(); // Register command PluginCommand command = this.getCommand("give-skull"); if (command != null) { command.setExecutor(new SkullCommand(skullAPI)); } } @Override public void onDisable() { if (this.skullAPI != null) { this.skullAPI.shutdown(); } } } class SkullCommand implements CommandExecutor { private final SkullAPI skullAPI; public SkullCommand(SkullAPI skullAPI) { this.skullAPI = skullAPI; } @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (!(sender instanceof Player player)) { sender.sendMessage("This command can only be used by players!"); return true; } // Use provided name or default to sender's name String targetName = args.length > 0 ? args[0] : player.getName(); // Get skull and add to inventory (callback runs on main thread) this.skullAPI.acceptSkull(targetName, itemStack -> { player.getInventory().addItem(itemStack); player.sendMessage("You received " + targetName + "'s skull!"); }); return true; } } ``` -------------------------------- ### Get Player Skull by Name using CompletableFuture (Java) Source: https://context7.com/rollczi/liteskullapi/llms.txt Shows how to retrieve a player's skull ItemStack asynchronously using their name. It utilizes CompletableFuture for handling the asynchronous result and includes examples for both `thenAcceptAsync` and `whenComplete`. ```java import dev.rollczi.liteskullapi.SkullAPI; import org.bukkit.inventory.ItemStack; import java.util.concurrent.CompletableFuture; public void getSkullByName(SkullAPI skullAPI, String playerName) { CompletableFuture future = skullAPI.getSkull(playerName); future.thenAcceptAsync(itemStack -> { // Handle the skull item asynchronously System.out.println("Got skull for: " + playerName); // Use itemStack in your plugin logic }); // With exception handling future.whenComplete((itemStack, throwable) -> { if (throwable != null) { System.err.println("Failed to get skull: " + throwable.getMessage()); return; } // Process itemStack }); } ``` -------------------------------- ### Get Skull Data with CompletableFuture Source: https://github.com/rollczi/liteskullapi/blob/master/README.md Obtains a CompletableFuture that will resolve to SkullData containing the texture value and signature for a player's skull. Ideal for complex asynchronous workflows. ```java // you can get completable future with skull data CompletableFuture completableFuture = skullAPI.getSkullData("Rollczi"); completableFuture.thenAcceptAsync(skullData -> { String value = skullData.getValue(); // texture value String signature = skullData.getSignature(); // texture signature }); ``` -------------------------------- ### Get Skull Item with CompletableFuture Source: https://github.com/rollczi/liteskullapi/blob/master/README.md Obtains a CompletableFuture that will resolve to an ItemStack representing the player's skull. This allows for chaining asynchronous operations. ```java // you can get completable future with skull item CompletableFuture completableFuture = skullAPI.getSkull("Rollczi"); completableFuture.thenAcceptAsync(itemStack -> { itemStack // some code }); ``` -------------------------------- ### Get Skull Data by Player Name (Java) Source: https://context7.com/rollczi/liteskullapi/llms.txt Retrieves player skull data including texture and signature using the player's name. It returns a CompletableFuture which can be used to asynchronously process the data once available. Dependencies include the LiteSkullAPI library. ```java import dev.rollczi.liteskullapi.SkullAPI; import dev.rollczi.liteskullapi.SkullData; import java.util.concurrent.CompletableFuture; public void getSkullDataByName(SkullAPI skullAPI, String playerName) { CompletableFuture future = skullAPI.getSkullData(playerName); future.thenAccept(skullData -> { String texture = skullData.getTexture(); // Base64 encoded texture data String signature = skullData.getSignature(); // Mojang signature for the texture String name = skullData.getName(); // Player name System.out.println("Texture: " + texture); System.out.println("Signature: " + signature); }); } ``` -------------------------------- ### Get Skull Data by Player Name Source: https://context7.com/rollczi/liteskullapi/llms.txt Retrieves raw skull texture and signature data for a given player name asynchronously. This is useful for custom skull manipulations where you need the base64 texture value and Mojang signature. ```APIDOC ## GET /api/skull/data/{playerName} ### Description Retrieves raw skull texture and signature data for a given player name asynchronously. This is useful for custom skull manipulations where you need the base64 texture value and Mojang signature. ### Method GET ### Endpoint `/api/skull/data/{playerName}` ### Parameters #### Path Parameters - **playerName** (String) - Required - The name of the player whose skull data is to be retrieved. ### Request Example ```json { "example": "Not applicable for GET request" } ``` ### Response #### Success Response (200) - **texture** (String) - The Base64 encoded texture data. - **signature** (String) - The Mojang signature for the texture. - **name** (String) - The player's name. #### Response Example ```json { "texture": "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5tb2phbmcubmV0L3RleHR1cmUvODQ2ZDI1YjQ5YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmOD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JmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmODJmYjQ3YjE1YjJmOD ``` -------------------------------- ### Get Skull Data by Player UUID (Java) Source: https://context7.com/rollczi/liteskullapi/llms.txt Fetches player skull data, including texture and signature, using the player's UUID. This method returns a CompletableFuture for asynchronous data handling. Ensure the LiteSkullAPI library is included in your project. ```java import dev.rollczi.liteskullapi.SkullAPI; import dev.rollczi.liteskullapi.SkullData; import java.util.UUID; import java.util.concurrent.CompletableFuture; public void getSkullDataByUuid(SkullAPI skullAPI, UUID playerUuid) { CompletableFuture future = skullAPI.getSkullData(playerUuid); future.thenAccept(skullData -> { // Access raw skull texture data String texture = skullData.getTexture(); String signature = skullData.getSignature(); // Use texture data for custom implementations }); } ``` -------------------------------- ### Shutdown LiteSkullAPI Executor Service (Java) Source: https://context7.com/rollczi/liteskullapi/llms.txt Properly shuts down the internal executor service used by LiteSkullAPI. This method must be called when disabling a plugin to release resources and prevent memory leaks. Example shown within a Bukkit plugin's onDisable method. ```java import dev.rollczi.liteskullapi.SkullAPI; import org.bukkit.plugin.java.JavaPlugin; public class MyPlugin extends JavaPlugin { private SkullAPI skullAPI; @Override public void onEnable() { // Initialize skullAPI... } @Override public void onDisable() { if (this.skullAPI != null) { this.skullAPI.shutdown(); // Clean up thread pools } } } ``` -------------------------------- ### Initialize LiteSkullAPI with Builder Pattern (Java) Source: https://context7.com/rollczi/liteskullapi/llms.txt Demonstrates how to initialize and configure an instance of SkullAPI using the LiteSkullFactory builder. It shows customization options for caching, thread pools, and schedulers. ```java import dev.rollczi.liteskullapi.LiteSkullFactory; import dev.rollczi.liteskullapi.SkullAPI; import org.bukkit.plugin.java.JavaPlugin; import java.time.Duration; public class MyPlugin extends JavaPlugin { private SkullAPI skullAPI; @Override public void onEnable() { this.skullAPI = LiteSkullFactory.builder() .cacheExpireAfterWrite(Duration.ofMinutes(45L)) // Cache entries expire 45 min after write .cacheExpireAfterAccess(Duration.ofMinutes(30L)) // Cache entries expire 30 min after last access .dataBaseSaveExpire(Duration.ofHours(1L)) // Database entries expire after 1 hour .threadPool(8) // Use 8 threads for async operations .bukkitScheduler(this) // Use Bukkit scheduler for sync callbacks .build(); } @Override public void onDisable() { this.skullAPI.shutdown(); // Always shutdown to cleanup thread pools } } ``` -------------------------------- ### Initialize LiteSkullAPI in Plugin Source: https://github.com/rollczi/liteskullapi/blob/master/README.md Demonstrates how to initialize the SkullAPI instance within your Bukkit/Spigot/Paper plugin's onEnable method. It configures caching and scheduler integration. ```java public final class ExamplePlugin extends JavaPlugin { private SkullAPI skullAPI; @Override public void onEnable() { this.skullAPI = LiteSkullFactory.builder() .cacheExpireAfterWrite(Duration.ofMinutes(45L)) .bukkitScheduler(this) .build(); } } ```