### Serialize Disguises and Manage Game Profiles with DisguiseAPI Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Utilize DisguiseAPI for serializing disguises into strings and managing custom player skins via UserProfiles. This example covers serialization, registering game profiles, and controlling self-view and action bar visibility. ```java import me.libraryaddict.disguise.DisguiseAPI; import me.libraryaddict.disguise.disguisetypes.PlayerDisguise; import me.libraryaddict.disguise.disguisetypes.MobDisguise; import me.libraryaddict.disguise.disguisetypes.DisguiseType; import com.github.retrooper.packetevents.protocol.player.UserProfile; import org.bukkit.entity.Player; // --- Serialise a disguise to its string form --- Player player = Bukkit.getPlayer("Steve"); MobDisguise disguise = new MobDisguise(DisguiseType.VILLAGER); disguise.getWatcher().setCustomName("§aMerchant"); String serialized = DisguiseAPI.parseToString(disguise); // e.g. "Villager setCustomName §aMerchant" System.out.println(serialized); // Serialise without including skin data String noSkin = DisguiseAPI.parseToString(new PlayerDisguise("Notch"), false); // --- Register a pre-built UserProfile as a named skin --- // (UserProfile built externally, e.g. from MineSkin API response) UserProfile customProfile = /* ... build UserProfile ... */ null; DisguiseAPI.addGameProfile("MySuperSkin", customProfile); // Now a PlayerDisguise can reference it by name PlayerDisguise skinDisguise = new PlayerDisguise("DisplayName", "MySuperSkin"); DisguiseAPI.disguiseEntity(player, skinDisguise); // --- Query self-disguise and bar preferences --- System.out.println("Self-disguised: " + DisguiseAPI.isSelfDisguised(player)); System.out.println("Notify bar shown: " + DisguiseAPI.isNotifyBarShown(player)); // Toggle self-view programmatically DisguiseAPI.setViewDisguiseToggled(player, true); DisguiseAPI.setActionBarShown(player, false); ``` -------------------------------- ### Register and Manage Custom Disguises with DisguiseAPI Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Use DisguiseAPI to register custom disguises from serialized strings, allowing them to be retrieved by name and used in-game. This example demonstrates adding, retrieving, and removing a custom disguise. ```java import me.libraryaddict.disguise.DisguiseAPI; import me.libraryaddict.disguise.disguisetypes.Disguise; import me.libraryaddict.disguise.utilities.parser.DisguiseParseException; try { // Register a custom disguise called "BigSlime" as a large blue-glowing slime DisguiseAPI.addCustomDisguise( "BigSlime", "Slime setSize 10 setGlowing true setGlowColor BLUE" ); // Retrieve the registered disguise Disguise bigSlime = DisguiseAPI.getCustomDisguise("BigSlime"); if (bigSlime != null) { DisguiseAPI.disguiseEntity(Bukkit.getPlayer("Steve"), bigSlime); } // Retrieve raw string form String raw = DisguiseAPI.getRawCustomDisguise("BigSlime"); System.out.println("Raw disguise: " + raw); // Remove the custom disguise DisguiseAPI.removeCustomDisguise("BigSlime"); } catch (DisguiseParseException e) { System.err.println("Invalid disguise syntax: " + e.getMessage()); } ``` -------------------------------- ### Handle Disguise and Undisguise Events in Bukkit Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Implement listeners for DisguiseEvent and UndisguiseEvent to intercept and modify disguise actions. This example shows how to cancel creeper disguises for non-operators and log disguise applications. ```java import me.libraryaddict.disguise.events.DisguiseEvent; import me.libraryaddict.disguise.events.UndisguiseEvent; import me.libraryaddict.disguise.disguisetypes.DisguiseType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; public class DisguiseListener implements Listener { @EventHandler public void onDisguise(DisguiseEvent event) { // Cancel creeper disguises for non-op players if (event.getDisguise().getType() == DisguiseType.CREEPER) { if (event.getEntity() instanceof Player) { Player p = (Player) event.getEntity(); if (!p.isOp()) { event.setCancelled(true); p.sendMessage("§cYou cannot disguise as a creeper!"); } } } // Log who applied the disguise if (event.getCommandSender() != null) { System.out.println(event.getCommandSender().getName() + " disguised " + event.getEntity().getName() + " as " + event.getDisguise().getType()); } } @EventHandler public void onUndisguise(UndisguiseEvent event) { // Prevent undisguise during an active event if (!event.isBeingReplaced()) { System.out.println(event.getDisguised().getName() + " was undisguised."); } // event.setCancelled(true); // can be prevented if isCancellable() is true } } ``` -------------------------------- ### Constructing and Applying Disguises with DisguiseAPI Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Demonstrates how to create basic and full entity disguises using `DisguiseAPI.constructDisguise`. It also shows how to apply a disguise to a player and retrieve active disguises. Ensure the target entity is valid before proceeding. ```java import me.libraryaddict.disguise.DisguiseAPI; import me.libraryaddict.disguise.disguisetypes.Disguise; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; // Get a nearby entity to copy Entity target = /* nearby entity obtained from event or world query */ null; Player player = Bukkit.getPlayer("Steve"); if (target != null) { // Basic clone — copies entity type only Disguise cloneBasic = DisguiseAPI.constructDisguise(target); // Full clone — copies equipment and extra animations (sprinting, sneaking etc.) Disguise cloneFull = DisguiseAPI.constructDisguise(target, true, true); // Apply the constructed disguise to the player DisguiseAPI.disguiseEntity(player, cloneFull); // Retrieve all active disguises on an entity (multiple simultaneous disguises possible) Disguise[] allDisguises = DisguiseAPI.getDisguises(player); System.out.println("Active disguise count: " + allDisguises.length); // Retrieve the disguise as seen by a specific observer Disguise observerView = DisguiseAPI.getDisguise(Bukkit.getPlayer("Alice"), player); } ``` -------------------------------- ### Configure Base Disguise Settings Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Set up sound replacement, self-view options, notify bars, custom data, and timed expiry for a disguise. Ensure necessary imports are present. ```java import me.libraryaddict.disguise.disguisetypes.*; import me.libraryaddict.disguise.utilities.animations.DisguiseAnimation; import me.libraryaddict.disguise.DisguiseConfig; import org.bukkit.boss.BarColor; import org.bukkit.boss.BarStyle; import org.bukkit.entity.Player; Player player = Bukkit.getPlayer("Steve"); MobDisguise disguise = new MobDisguise(DisguiseType.PHANTOM); // Sound replacement disguise.setReplaceSounds(true); // replace entity sounds with disguise sounds disguise.setHearSelfDisguise(true); // disguised player hears their own disguise sounds // Self-view disguise.setViewSelfDisguise(true); // player can see their own disguise // Notify bars disguise.setNotifyBar(DisguiseConfig.NotifyBar.BOSS_BAR); disguise.setBossBar(BarColor.PURPLE, BarStyle.SOLID); // Disguise name displayed in notify bar disguise.setDisguiseName("§5Phantom"); // Custom data storage (e.g. track who applied the disguise) disguise.addCustomData("appliedBy", "AdminPlugin"); String applier = (String) disguise.getCustomData("appliedBy"); // Multi-line nameplate (armorstand labels above head) disguise.setMultiName("§eLine 1", "§7Line 2"); // Timed expiry disguise.setExpires(System.currentTimeMillis() + 30_000L); // 30 seconds DisguiseAPI.disguiseEntity(player, disguise); // Play animation to all nearby observers if (disguise.isDisguiseInUse()) { int count = disguise.playAnimation(DisguiseAnimation.SWING_MAIN_ARM); System.out.println("Animation sent to " + count + " players"); } // Upside-down rendering disguise.setUpsideDown(true); ``` -------------------------------- ### DisguiseAPI - Serialization and Game Profiles Source: https://context7.com/libraryaddict/libsdisguises/llms.txt This section covers `DisguiseAPI.parseToString` for serializing disguises into strings and `DisguiseAPI.addGameProfile` for registering custom skins. It also includes methods for checking self-disguise status and toggling view preferences. ```APIDOC ## DisguiseAPI — Serialisation and Game Profiles `DisguiseAPI.parseToString` serialises any active or configured disguise back to its string representation. `addGameProfile` registers a custom skin `UserProfile` under a name, allowing `PlayerDisguise` to resolve it by that name. ```java import me.libraryaddict.disguise.DisguiseAPI; import me.libraryaddict.disguise.disguisetypes.PlayerDisguise; import me.libraryaddict.disguise.disguisetypes.MobDisguise; import me.libraryaddict.disguise.disguisetypes.DisguiseType; import com.github.retrooper.packetevents.protocol.player.UserProfile; import org.bukkit.entity.Player; // --- Serialise a disguise to its string form --- Player player = Bukkit.getPlayer("Steve"); MobDisguise disguise = new MobDisguise(DisguiseType.VILLAGER); disguise.getWatcher().setCustomName("§aMerchant"); String serialized = DisguiseAPI.parseToString(disguise); // e.g. "Villager setCustomName §aMerchant" System.out.println(serialized); // Serialise without including skin data String noSkin = DisguiseAPI.parseToString(new PlayerDisguise("Notch"), false); // --- Register a pre-built UserProfile as a named skin --- // (UserProfile built externally, e.g. from MineSkin API response) UserProfile customProfile = /* ... build UserProfile ... */ null; DisguiseAPI.addGameProfile("MySuperSkin", customProfile); // Now a PlayerDisguise can reference it by name PlayerDisguise skinDisguise = new PlayerDisguise("DisplayName", "MySuperSkin"); DisguiseAPI.disguiseEntity(player, skinDisguise); // --- Query self-disguise and bar preferences --- System.out.println("Self-disguised: " + DisguiseAPI.isSelfDisguised(player)); System.out.println("Notify bar shown: " + DisguiseAPI.isNotifyBarShown(player)); // Toggle self-view programmatically DisguiseAPI.setViewDisguiseToggled(player, true); DisguiseAPI.setActionBarShown(player, false); ``` ``` -------------------------------- ### PlayerDisguise: Basic Player Skin Disguise Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Disguise an entity as a named player, fetching their skin automatically. Configure tab-list visibility and name. ```java import me.libraryaddict.disguise.disguisetypes.PlayerDisguise; import me.libraryaddict.disguise.DisguiseAPI; import org.bukkit.entity.Player; Player player = Bukkit.getPlayer("Steve"); // Disguise as a named player with their skin auto-fetched PlayerDisguise notchDisguise = new PlayerDisguise("Notch"); notchDisguise.setViewSelfDisguise(true); // Show in tab list as "Notch" notchDisguise.setDisplayedInTab(true); notchDisguise.setTablistName("§6Notch"); // Special rendering effects PlayerDisguise dinnerboneDisguise = new PlayerDisguise("Dinnerbone"); // renders upside-down PlayerDisguise mau5Disguise = new PlayerDisguise("deadmau5"); // renders with ears // Use a different skin from the displayed name PlayerDisguise namedDisguise = new PlayerDisguise("CustomName", "Herobrine"); // name shown is "CustomName", skin is fetched for "Herobrine" // Disguise as another online player (copies skin directly) Player skinSource = Bukkit.getPlayer("Alice"); PlayerDisguise liveDisguise = new PlayerDisguise(player, skinSource); // Dynamic name: name follows the entity's display name at runtime namedDisguise.setDynamicName(true); DisguiseAPI.disguiseEntity(player, notchDisguise); // Change name while disguise is active — packets refresh automatically notchDisguise.setName("§bCoolPlayer"); // Remove from tab list entry notchDisguise.setDisplayedInTab(false); DisguiseAPI.undisguiseToAll(player); ``` -------------------------------- ### DisguiseAPI - Core Static Facade Source: https://context7.com/libraryaddict/libsdisguises/llms.txt The DisguiseAPI class provides static methods for applying, removing, and inspecting disguises on any Bukkit Entity. It handles the underlying logic for managing client-side entity rendering. ```APIDOC ## DisguiseAPI - Core Static Facade `DisguiseAPI` is the primary entry point for all programmatic disguise operations. It provides static methods to apply, remove, and inspect disguises on any Bukkit `Entity`, handling cloning and entity assignment automatically. ### Apply a mob disguise to a player ```java Player player = Bukkit.getPlayer("Steve"); MobDisguise creeperDisguise = new MobDisguise(DisguiseType.CREEPER); creeperDisguise.setViewSelfDisguise(true); // player can see themselves as creeper creeperDisguise.setReplaceSounds(true); // replace sounds with creeper sounds DisguiseAPI.disguiseEntity(player, creeperDisguise); ``` ### Apply a player disguise ```java PlayerDisguise playerDisguise = new PlayerDisguise("Notch"); playerDisguise.setSkin("Notch"); // fetch Notch's skin asynchronously DisguiseAPI.disguiseToAll(player, playerDisguise); // visible to everyone ``` ### Show disguise only to specific players ```java Player observer = Bukkit.getPlayer("Alice"); MobDisguise zombieDisguise = new MobDisguise(DisguiseType.ZOMBIE); DisguiseAPI.disguiseToPlayers(player, zombieDisguise, observer); ``` ### Hide disguise from specific players (everyone else sees it) ```java Player exemptPlayer = Bukkit.getPlayer("Bob"); MobDisguise skeletonDisguise = new MobDisguise(DisguiseType.SKELETON); DisguiseAPI.disguiseIgnorePlayers(player, skeletonDisguise, exemptPlayer); ``` ### Check and retrieve disguise ```java if (DisguiseAPI.isDisguised(player)) { Disguise active = DisguiseAPI.getDisguise(player); System.out.println("Disguised as: " + active.getType()); } ``` ### Remove all disguises ```java DisguiseAPI.undisguiseToAll(player); ``` ### Disguise the next entity to be spawned ```java MobDisguise wolfDisguise = new MobDisguise(DisguiseType.WOLF); int reservedId = DisguiseAPI.disguiseNextEntity(wolfDisguise); // spawn entity immediately after this call ``` ``` -------------------------------- ### Apply and Manage Disguises with DisguiseAPI Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Use DisguiseAPI for core operations like applying, removing, and checking disguises. Supports various disguise types and visibility controls. ```java import me.libraryaddict.disguise.DisguiseAPI; import me.libraryaddict.disguise.disguisetypes.*; import org.bukkit.entity.Player; import org.bukkit.entity.Entity; // --- Apply a mob disguise to a player --- Player player = Bukkit.getPlayer("Steve"); MobDisguise creeperDisguise = new MobDisguise(DisguiseType.CREEPER); creeperDisguise.setViewSelfDisguise(true); // player can see themselves as creeper creeperDisguise.setReplaceSounds(true); // replace sounds with creeper sounds DisguiseAPI.disguiseEntity(player, creeperDisguise); // --- Apply a player disguise --- PlayerDisguise playerDisguise = new PlayerDisguise("Notch"); playerDisguise.setSkin("Notch"); // fetch Notch's skin asynchronously DisguiseAPI.disguiseToAll(player, playerDisguise); // visible to everyone // --- Show disguise only to specific players --- Player observer = Bukkit.getPlayer("Alice"); MobDisguise zombieDisguise = new MobDisguise(DisguiseType.ZOMBIE); DisguiseAPI.disguiseToPlayers(player, zombieDisguise, observer); // --- Hide disguise from specific players (everyone else sees it) --- Player exemptPlayer = Bukkit.getPlayer("Bob"); MobDisguise skeletonDisguise = new MobDisguise(DisguiseType.SKELETON); DisguiseAPI.disguiseIgnorePlayers(player, skeletonDisguise, exemptPlayer); // --- Check and retrieve disguise --- if (DisguiseAPI.isDisguised(player)) { Disguise active = DisguiseAPI.getDisguise(player); System.out.println("Disguised as: " + active.getType()); } // --- Remove all disguises --- DisguiseAPI.undisguiseToAll(player); // --- Disguise the next entity to be spawned --- MobDisguise wolfDisguise = new MobDisguise(DisguiseType.WOLF); int reservedId = DisguiseAPI.disguiseNextEntity(wolfDisguise); // spawn entity immediately after this call ``` -------------------------------- ### Adding Libs Disguises Dependency to Maven Project Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Configure your `pom.xml` file to include Libs Disguises as a provided dependency. Ensure the repository is correctly set up to fetch the artifact. ```xml libsdisguises-public https://mvn.lib.co.nz/public/ me.libraryaddict.disguises libsdisguises 11.0.13 provided ``` -------------------------------- ### Disguise Base Configuration Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Configure general properties of a disguise, such as sound replacement, self-view, notify bars, custom data, and expiry. ```APIDOC ## Disguise Configuration ### Description Provides methods to configure various aspects of a disguise, affecting how it sounds, appears, and is perceived by the player and others. ### Methods - `setReplaceSounds(boolean)`: Enables or disables replacing entity sounds with disguise sounds. - `setHearSelfDisguise(boolean)`: Enables or disables the disguised player hearing their own disguise sounds. - `setViewSelfDisguise(boolean)`: Enables or disables the player seeing their own disguise. - `setNotifyBar(DisguiseConfig.NotifyBar)`: Sets the type of notify bar to use (e.g., BOSS_BAR). - `setBossBar(BarColor, BarStyle)`: Configures the appearance of the boss bar. - `setDisguiseName(String)`: Sets the name to be displayed in the notify bar. - `addCustomData(String key, Object value)`: Stores custom data associated with the disguise. - `getCustomData(String key)`: Retrieves custom data associated with the disguise. - `setMultiName(String... lines)`: Sets a multi-line nameplate to be displayed above the entity's head. - `setExpires(long)`: Sets a timestamp for when the disguise should expire. - `setUpsideDown(boolean)`: Enables or disables upside-down rendering for the disguise. ### Example Usage ```java import me.libraryaddict.disguise.disguisetypes.*; import me.libraryaddict.disguise.DisguiseConfig; import org.bukkit.boss.BarColor; import org.bukkit.boss.BarStyle; import org.bukkit.entity.Player; Player player = Bukkit.getPlayer("Steve"); MobDisguise disguise = new MobDisguise(DisguiseType.PHANTOM); // Sound replacement disguise.setReplaceSounds(true); disguise.setHearSelfDisguise(true); // Self-view disguise.setViewSelfDisguise(true); // Notify bars disguise.setNotifyBar(DisguiseConfig.NotifyBar.BOSS_BAR); disguise.setBossBar(BarColor.PURPLE, BarStyle.SOLID); // Disguise name disguise.setDisguiseName("§5Phantom"); // Custom data storage disguise.addCustomData("appliedBy", "AdminPlugin"); String applier = (String) disguise.getCustomData("appliedBy"); // Multi-line nameplate disguise.setMultiName("§eLine 1", "§7Line 2"); // Timed expiry disguise.setExpires(System.currentTimeMillis() + 30_000L); // 30 seconds DisguiseAPI.disguiseEntity(player, disguise); // Upside-down rendering disguise.setUpsideDown(true); ``` ``` -------------------------------- ### Declaring Libs Disguises as a Plugin Dependency Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Specify Libs Disguises as a dependency in your `plugin.yml` file. Use `depend` for a hard dependency or `soft-depend` for a soft dependency. ```yaml # plugin.yml — declare soft or hard dependency depend: [LibsDisguises] # or soft-depend: [LibsDisguises] ``` -------------------------------- ### DisguiseAPI.constructDisguise Source: https://context7.com/libraryaddict/libsdisguises/llms.txt `DisguiseAPI.constructDisguise` creates a disguise that mirrors an existing entity's current state, optionally copying equipment and animation flags, useful for "clone" mechanics. ```APIDOC ## DisguiseAPI.constructDisguise ### Description Creates a disguise that mirrors an existing entity's current state. This method is useful for implementing "clone" mechanics where one entity's appearance needs to be replicated on another. ### Method Signature `Disguise constructDisguise(Entity target)` `Disguise constructDisguise(Entity target, boolean copyEquipment, boolean copyAnimationFlags)` ### Parameters #### `constructDisguise(Entity target)` - **target** (Entity) - Required - The entity whose state will be mirrored. #### `constructDisguise(Entity target, boolean copyEquipment, boolean copyAnimationFlags)` - **target** (Entity) - Required - The entity whose state will be mirrored. - **copyEquipment** (boolean) - Required - If true, the target's equipment will be copied to the disguise. - **copyAnimationFlags** (boolean) - Required - If true, the target's animation flags (e.g., sprinting, sneaking) will be copied. ### Request Example ```java // Basic clone — copies entity type only Disguise cloneBasic = DisguiseAPI.constructDisguise(target); // Full clone — copies equipment and extra animations (sprinting, sneaking etc.) Disguise cloneFull = DisguiseAPI.constructDisguise(target, true, true); ``` ### Response #### Success Response - **Disguise** - The constructed disguise object. ### Related Methods - `DisguiseAPI.disguiseEntity(Player player, Disguise disguise)`: Applies a disguise to an entity. - `DisguiseAPI.getDisguises(Player player)`: Retrieves all active disguises on an entity. - `DisguiseAPI.getDisguise(Player observer, Player target)`: Retrieves the disguise of a target entity as seen by a specific observer. ``` -------------------------------- ### DisguiseAPI - Custom Disguise Registration Source: https://context7.com/libraryaddict/libsdisguises/llms.txt The `DisguiseAPI.addCustomDisguise` method allows for the registration of custom disguises from serialized strings. These registered disguises are persisted and can be retrieved by name for use in commands or by other plugins. ```APIDOC ## DisguiseAPI — Custom Disguise Registration `DisguiseAPI.addCustomDisguise` registers a named disguise from a serialized string, persisting it to `configs/disguises.yml`. Custom disguises can then be retrieved by name, used in commands, or distributed to other plugins. ```java import me.libraryaddict.disguise.DisguiseAPI; import me.libraryaddict.disguise.disguisetypes.Disguise; import me.libraryaddict.disguise.utilities.parser.DisguiseParseException; try { // Register a custom disguise called "BigSlime" as a large blue-glowing slime DisguiseAPI.addCustomDisguise( "BigSlime", "Slime setSize 10 setGlowing true setGlowColor BLUE" ); // Retrieve the registered disguise Disguise bigSlime = DisguiseAPI.getCustomDisguise("BigSlime"); if (bigSlime != null) { DisguiseAPI.disguiseEntity(Bukkit.getPlayer("Steve"), bigSlime); } // Retrieve raw string form String raw = DisguiseAPI.getRawCustomDisguise("BigSlime"); System.out.println("Raw disguise: " + raw); // Remove the custom disguise DisguiseAPI.removeCustomDisguise("BigSlime"); } catch (DisguiseParseException e) { System.err.println("Invalid disguise syntax: " + e.getMessage()); } ``` ``` -------------------------------- ### Adding Libs Disguises Dependency to Gradle Project Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Configure your `build.gradle` file to include Libs Disguises as a compile-time dependency. The repository must be added to resolve the artifact. ```groovy // build.gradle (Groovy DSL) repositories { maven { url "https://mvn.lib.co.nz/public" } } dependencies { // Lib's Disguises API (provided at runtime by the server plugin) compileOnly group: 'me.libraryaddict.disguises', name: 'libsdisguises', version: '11.0.13' } ``` -------------------------------- ### Gradle Dependency for Libs Disguises Source: https://github.com/libraryaddict/libsdisguises/blob/master/README.md Add this to your build.gradle file to include Libs Disguises as a dependency. Ensure you are using a compatible Minecraft version (1.12+). ```groovy repositories { maven { url "https://mvn.lib.co.nz/public" } } dependencies { implementation group: 'me.libraryaddict.disguises', name: 'libsdisguises', version: '11.0.13' } ``` -------------------------------- ### Disguise - Animation Playback Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Plays a specific animation for the disguise to nearby observers. ```APIDOC ## Disguise.playAnimation ### Description Triggers a specified animation for the disguise and sends the animation packets to all nearby observing players. ### Method `int playAnimation(DisguiseAnimation animation)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **animation** (DisguiseAnimation) - Required - The animation to play (e.g., `DisguiseAnimation.SWING_MAIN_ARM`). ### Request Example ```java if (disguise.isDisguiseInUse()) { int count = disguise.playAnimation(DisguiseAnimation.SWING_MAIN_ARM); System.out.println("Animation sent to " + count + " players"); } ``` ### Response #### Success Response (200) - **count** (int) - The number of players the animation was sent to. #### Response Example ```json { "count": 5 } ``` ``` -------------------------------- ### Customize Mob Disguises with MobDisguise Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Create and customize disguises for living mobs. Supports adult/baby variants, glowing effects, custom names, and expiration. ```java import me.libraryaddict.disguise.disguisetypes.MobDisguise; import me.libraryaddict.disguise.disguisetypes.DisguiseType; import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher; import me.libraryaddict.disguise.DisguiseAPI; import org.bukkit.entity.Player; import org.bukkit.ChatColor; Player player = Bukkit.getPlayer("Steve"); // Adult cow disguise MobDisguise cowDisguise = new MobDisguise(DisguiseType.COW); // Baby cow disguise MobDisguise babyCowDisguise = new MobDisguise(DisguiseType.COW, false /* isAdult */); ((AgeableWatcher) babyCowDisguise.getWatcher()).setBaby(true); // Glowing with a custom colour MobDisguise glowingEnderman = new MobDisguise(DisguiseType.ENDERMAN); glowingEnderman.getWatcher().setGlowing(true); glowingEnderman.getWatcher().setGlowColor(ChatColor.AQUA); // Keep the disguise after the player dies glowingEnderman.setKeepDisguiseOnPlayerDeath(true); // Disguise expires after 60 seconds glowingEnderman.setExpires(System.currentTimeMillis() + 60_000L); DisguiseAPI.disguiseEntity(player, glowingEnderman); // Clone and reuse a disguise for another entity MobDisguise clone = glowingEnderman.clone(); DisguiseAPI.disguiseEntity(Bukkit.getPlayer("Alex"), clone); // Check adult/baby state System.out.println("Is adult: " + cowDisguise.isAdult()); ``` -------------------------------- ### Configure Targeted Disguise Visibility Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Control which players can see a disguise using `TargetType` and observer lists. Players can be explicitly included or excluded from seeing the disguise. Ensure necessary imports are present. ```java import me.libraryaddict.disguise.disguisetypes.*; import me.libraryaddict.disguise.disguisetypes.TargetedDisguise.TargetType; import me.libraryaddict.disguise.DisguiseAPI; import org.bukkit.entity.Player; Player disguisedPlayer = Bukkit.getPlayer("Steve"); Player alice = Bukkit.getPlayer("Alice"); Player bob = Bukkit.getPlayer("Bob"); MobDisguise disguise = new MobDisguise(DisguiseType.SPIDER); // Mode: show to everyone EXCEPT the listed players (default) disguise.setDisguiseTarget(TargetType.SHOW_TO_EVERYONE_BUT_THESE_PLAYERS); disguise.addPlayer(alice); // Alice will NOT see the disguise // Mode: hide from everyone EXCEPT the listed players MobDisguise secretDisguise = new MobDisguise(DisguiseType.WITCH); secretDisguise.setDisguiseTarget(TargetType.HIDE_DISGUISE_TO_EVERYONE_BUT_THESE_PLAYERS); secretDisguise.addPlayer(bob); // only Bob sees the disguise secretDisguise.addPlayer(alice); // Alice also sees it // Check at runtime System.out.println("Bob can see disguise: " + secretDisguise.canSee(bob)); System.out.println("Observers: " + secretDisguise.getObservers()); // Remove a player from the observer list while disguise is live // (triggers an automatic packet refresh for that player) secretDisguise.removePlayer(bob); // Silent add/remove — no packet refresh triggered disguise.silentlyAddPlayer(alice.getName()); disguise.silentlyRemovePlayer(alice.getName()); DisguiseAPI.disguiseEntity(disguisedPlayer, disguise); ``` -------------------------------- ### Maven Dependency for Libs Disguises Source: https://github.com/libraryaddict/libsdisguises/blob/master/README.md Add this to your pom.xml file to include Libs Disguises as a dependency. Ensure you are using a compatible Minecraft version (1.12+). ```xml libsdisguises-public https://mvn.lib.co.nz/public/ me.libraryaddict.disguises libsdisguises 11.0.13 provided ``` -------------------------------- ### MobDisguise - Living Mob Disguise Source: https://context7.com/libraryaddict/libsdisguises/llms.txt The MobDisguise class allows disguising an entity as any living mob. It supports variants like adult/baby and provides access to a typed watcher for metadata customization. ```APIDOC ## MobDisguise - Living Mob Disguise `MobDisguise` disguises an entity as any living mob entity type. It supports adult/baby variants and exposes a typed `LivingWatcher` for metadata customisation. ### Adult cow disguise ```java Player player = Bukkit.getPlayer("Steve"); MobDisguise cowDisguise = new MobDisguise(DisguiseType.COW); ``` ### Baby cow disguise ```java MobDisguise babyCowDisguise = new MobDisguise(DisguiseType.COW, false /* isAdult */); ((AgeableWatcher) babyCowDisguise.getWatcher()).setBaby(true); ``` ### Glowing with a custom colour ```java MobDisguise glowingEnderman = new MobDisguise(DisguiseType.ENDERMAN); glowingEnderman.getWatcher().setGlowing(true); glowingEnderman.getWatcher().setGlowColor(ChatColor.AQUA); ``` ### Keep the disguise after the player dies ```java glowingEnderman.setKeepDisguiseOnPlayerDeath(true); ``` ### Disguise expires after 60 seconds ```java glowingEnderman.setExpires(System.currentTimeMillis() + 60_000L); ``` ### Apply disguise and clone for another entity ```java DisguiseAPI.disguiseEntity(player, glowingEnderman); // Clone and reuse a disguise for another entity MobDisguise clone = glowingEnderman.clone(); DisguiseAPI.disguiseEntity(Bukkit.getPlayer("Alex"), clone); ``` ### Check adult/baby state ```java System.out.println("Is adult: " + cowDisguise.isAdult()); ``` ``` -------------------------------- ### DisguiseEvent and UndisguiseEvent Hooks Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Lib's Disguises provides two cancellable Bukkit events: `DisguiseEvent` (fired before a disguise is applied) and `UndisguiseEvent` (fired before a disguise is removed). Both events provide access to the entity being disguised, the disguise itself, and the command sender. ```APIDOC ## DisguiseEvent and UndisguiseEvent — Bukkit Event Hooks Lib's Disguises fires two cancellable Bukkit events: `DisguiseEvent` (before a disguise becomes active) and `UndisguiseEvent` (before a disguise is removed), both of which expose the entity, disguise, and optional commanding sender. ```java import me.libraryaddict.disguise.events.DisguiseEvent; import me.libraryaddict.disguise.events.UndisguiseEvent; import me.libraryaddict.disguise.disguisetypes.DisguiseType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; public class DisguiseListener implements Listener { @EventHandler public void onDisguise(DisguiseEvent event) { // Cancel creeper disguises for non-op players if (event.getDisguise().getType() == DisguiseType.CREEPER) { if (event.getEntity() instanceof Player) { Player p = (Player) event.getEntity(); if (!p.isOp()) { event.setCancelled(true); p.sendMessage("§cYou cannot disguise as a creeper!"); } } } // Log who applied the disguise if (event.getCommandSender() != null) { System.out.println(event.getCommandSender().getName() + " disguised " + event.getEntity().getName() + " as " + event.getDisguise().getType()); } } @EventHandler public void onUndisguise(UndisguiseEvent event) { // Prevent undisguise during an active event if (!event.isBeingReplaced()) { System.out.println(event.getDisguised().getName() + " was undisguised."); } // event.setCancelled(true); // can be prevented if isCancellable() is true } } ``` ``` -------------------------------- ### PlayerDisguise Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Disguises an entity to appear as a named Minecraft player, with options for skin fetching, tab-list visibility, and special rendering effects. ```APIDOC ## PlayerDisguise — Player-Skin Disguise `PlayerDisguise` disguises an entity to appear as a named Minecraft player, complete with skin fetching, tab-list visibility control, deadmau5 ears, and upside-down rendering. ```java import me.libraryaddict.disguise.disguisetypes.PlayerDisguise; import me.libraryaddict.disguise.DisguiseAPI; import org.bukkit.entity.Player; Player player = Bukkit.getPlayer("Steve"); // Disguise as a named player with their skin auto-fetched PlayerDisguise notchDisguise = new PlayerDisguise("Notch"); notchDisguise.setViewSelfDisguise(true); // Show in tab list as "Notch" notchDisguise.setDisplayedInTab(true); notchDisguise.setTablistName("§6Notch"); // Special rendering effects PlayerDisguise dinnerboneDisguise = new PlayerDisguise("Dinnerbone"); // renders upside-down PlayerDisguise mau5Disguise = new PlayerDisguise("deadmau5"); // renders with ears // Use a different skin from the displayed name PlayerDisguise namedDisguise = new PlayerDisguise("CustomName", "Herobrine"); // name shown is "CustomName", skin is fetched for "Herobrine" // Disguise as another online player (copies skin directly) Player skinSource = Bukkit.getPlayer("Alice"); PlayerDisguise liveDisguise = new PlayerDisguise(player, skinSource); // Dynamic name: name follows the entity's display name at runtime namedDisguise.setDynamicName(true); DisguiseAPI.disguiseEntity(player, notchDisguise); // Change name while disguise is active — packets refresh automatically notchDisguise.setName("§bCoolPlayer"); // Remove from tab list entry notchDisguise.setDisplayedInTab(false); DisguiseAPI.undisguiseToAll(player); ``` ``` -------------------------------- ### DisguiseAPI - Entity Disguising Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Applies a configured disguise to a target entity. ```APIDOC ## DisguiseAPI.disguiseEntity ### Description Applies a given `Disguise` object to a target `Player` entity. ### Method `DisguiseAPI.disguiseEntity(Player target, Disguise disguise) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java Player player = Bukkit.getPlayer("Steve"); MobDisguise disguise = new MobDisguise(DisguiseType.PHANTOM); // ... configure disguise ... DisguiseAPI.disguiseEntity(player, disguise); ``` ### Response #### Success Response (200) Void (operation is performed) #### Response Example None ``` -------------------------------- ### TargetedDisguise Visibility Control Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Control which players can see a disguise using observer lists and target types. ```APIDOC ## TargetedDisguise Visibility ### Description Manages per-player visibility of a disguise, allowing fine-grained access control over who sees the disguise based on observer lists and target types. ### Target Types - `TargetType.SHOW_TO_EVERYONE_BUT_THESE_PLAYERS`: The disguise is visible to all players except those explicitly added to the observer list. - `TargetType.HIDE_DISGUISE_TO_EVERYONE_BUT_THESE_PLAYERS`: The disguise is only visible to players explicitly added to the observer list. ### Methods - `setDisguiseTarget(TargetType)`: Sets the visibility targeting mode for the disguise. - `addPlayer(Player)`: Adds a player to the observer list. - `removePlayer(Player)`: Removes a player from the observer list, triggering a packet refresh. - `silentlyAddPlayer(String playerName)`: Adds a player to the observer list without triggering a packet refresh. - `silentlyRemovePlayer(String playerName)`: Removes a player from the observer list without triggering a packet refresh. - `canSee(Player)`: Checks if a specific player can currently see the disguise. - `getObservers()`: Returns a collection of players who are currently observing the disguise. ### Example Usage ```java import me.libraryaddict.disguise.disguisetypes.*; import me.libraryaddict.disguise.disguisetypes.TargetedDisguise.TargetType; import me.libraryaddict.disguise.DisguiseAPI; import org.bukkit.entity.Player; Player disguisedPlayer = Bukkit.getPlayer("Steve"); Player alice = Bukkit.getPlayer("Alice"); Player bob = Bukkit.getPlayer("Bob"); MobDisguise disguise = new MobDisguise(DisguiseType.SPIDER); // Mode: show to everyone EXCEPT the listed players (default) disguise.setDisguiseTarget(TargetType.SHOW_TO_EVERYONE_BUT_THESE_PLAYERS); disguise.addPlayer(alice); // Alice will NOT see the disguise // Mode: hide from everyone EXCEPT the listed players MobDisguise secretDisguise = new MobDisguise(DisguiseType.WITCH); secretDisguise.setDisguiseTarget(TargetType.HIDE_DISGUISE_TO_EVERYONE_BUT_THESE_PLAYERS); secretDisguise.addPlayer(bob); // only Bob sees the disguise secretDisguise.addPlayer(alice); // Alice also sees it // Check at runtime System.out.println("Bob can see disguise: " + secretDisguise.canSee(bob)); System.out.println("Observers: " + secretDisguise.getObservers()); // Remove a player from the observer list while disguise is live secretDisguise.removePlayer(bob); // Silent add/remove — no packet refresh triggered disguise.silentlyAddPlayer(alice.getName()); disguise.silentlyRemovePlayer(alice.getName()); DisguiseAPI.disguiseEntity(disguisedPlayer, disguise); ``` ``` -------------------------------- ### DisguiseAPI.disguiseEntity Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Applies a constructed disguise to a target entity. ```APIDOC ## DisguiseAPI.disguiseEntity ### Description Applies a constructed disguise to a target entity, making them appear as the disguised entity. ### Method Signature `void disguiseEntity(Player player, Disguise disguise)` ### Parameters - **player** (Player) - Required - The player entity to apply the disguise to. - **disguise** (Disguise) - Required - The disguise object to apply. ### Request Example ```java DisguiseAPI.disguiseEntity(player, cloneFull); ``` ### Response This method does not return a value. ``` -------------------------------- ### MiscDisguise: Non-Living Object Disguise Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Disguise entities as non-living objects like dropped items or falling blocks. Configure specific watcher properties and bounding box behavior. ```java import me.libraryaddict.disguise.disguisetypes.MiscDisguise; import me.libraryaddict.disguise.disguisetypes.DisguiseType; import me.libraryaddict.disguise.disguisetypes.watchers.DroppedItemWatcher; import me.libraryaddict.disguise.disguisetypes.watchers.FallingBlockWatcher; import me.libraryaddict.disguise.DisguiseAPI; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; Player player = Bukkit.getPlayer("Steve"); // Disguise as a dropped diamond sword ItemStack sword = new ItemStack(Material.DIAMOND_SWORD); MiscDisguise droppedItem = new MiscDisguise(DisguiseType.DROPPED_ITEM, sword); DisguiseAPI.disguiseEntity(player, droppedItem); // Disguise as a falling gravel block MiscDisguise fallingBlock = new MiscDisguise(DisguiseType.FALLING_BLOCK, new ItemStack(Material.GRAVEL)); ((FallingBlockWatcher) fallingBlock.getWatcher()).setBlock(new ItemStack(Material.GRAVEL)); DisguiseAPI.disguiseEntity(player, fallingBlock); // Disguise as a generic area effect cloud MiscDisguise aec = new MiscDisguise(DisguiseType.AREA_EFFECT_CLOUD); DisguiseAPI.disguiseEntity(player, aec); // Disable bounding box modification for a misc disguise droppedItem.setModifyBoundingBox(false); // Check disguise type at runtime Disguise active = DisguiseAPI.getDisguise(player); if (active != null && active.isMiscDisguise()) { System.out.println("Entity is a misc disguise: " + active.getType()); } ``` -------------------------------- ### DisguiseAPI.getDisguise Source: https://context7.com/libraryaddict/libsdisguises/llms.txt Retrieves the disguise of a target entity as it appears from a specific observer's perspective. ```APIDOC ## DisguiseAPI.getDisguise ### Description Retrieves the disguise of a target entity as seen by a specific observer. This is useful for scenarios where disguises might be client-specific or filtered. ### Method Signature `Disguise getDisguise(Player observer, Player target)` ### Parameters - **observer** (Player) - Required - The player whose perspective is used to view the disguise. - **target** (Player) - Required - The player entity whose disguise is being observed. ### Request Example ```java Disguise observerView = DisguiseAPI.getDisguise(Bukkit.getPlayer("Alice"), player); ``` ### Response #### Success Response - **Disguise** - The `Disguise` object as seen by the observer, or null if no disguise is visible or applicable. ```