# Cosmetics

Apply cosmetic skins from Nexo to your own items. The item stays exactly the same: stats, enchantments, durability, name and lore never change, only the look does. Every player sees the new design. Requires the Nexo plugin and a resource pack containing the models.

**The ownership rule:** a skin is only visible while the item's current holder has the cosmetic unlocked. Hand the item to someone who does not own the cosmetic and the design disappears automatically. Once the item returns to an unlocked player, the skin comes back. Unlocks belong permanently to the player's account and survive even a season reset with a fresh world.

## Commands

| Subcommand | Syntax | Permission | Default | Description |
|---|---|---|---|---|
| (GUI) | `/cosmetic` (alias `/cosmetics`) | `cosmetic.use` | `true` | Opens the cosmetics menu |
| `apply` | `/cosmetic apply <id>` | `cosmetic.use` | `true` | Applies a cosmetic to the item in your main hand |
| `remove` | `/cosmetic remove` | `cosmetic.use` | `true` | Restores the original look |
| `list` | `/cosmetic list` | `cosmetic.use` | `true` | Lists your unlocked cosmetics |
| `grant` | `/cosmetic grant <player> <id>` | `cosmetic.admin` | op | Unlocks a cosmetic (console and offline players work too) |
| `revoke` | `/cosmetic revoke <player> <id>` | `cosmetic.admin` | op | Takes an unlock away |
| `reload` | `/cosmetic reload` | `cosmetic.admin` | op | Reloads the cosmetics registry |

**Unlock permissions:** every cosmetic additionally has the permission `cosmetic.use.<id>` (default `false`). Any crate or shop plugin can hand out cosmetics with zero extra setup: simply grant that permission as the prize. Alternatively `/cosmetic grant` unlocks permanently (survives a season reset too).

**Duplicate protection for crates:** for every unlocked cosmetic, CoreEngine automatically reports the permission `cosmetic.owns.<id>` on online players. Crate plugins with a prize blacklist (for example CrazyCrates with `BlackListed-Permissions`) detect already-owned skins this way and can pay out a substitute prize instead, without storing marker permissions anywhere. After a `revoke` the permission disappears again automatically.

> **Tip:** the menu (`/cosmetic`) needs a single click: hold the item in your main hand, click a cosmetic, done. If the held item already wears the skin, the same click removes it. Locked cosmetics show greyed out with a hint where to get them. If a price is configured, the purchase is confirmed in an anvil for safety.

> **Note:** skins only fit non-stackable items (armor, weapons, tools). Which item types a cosmetic accepts is defined per cosmetic in the config, for example chestplates only. Items with a custom look from another source are never touched, so nothing can get lost.

## 3D Body Models

Some cosmetics are more than a new item look: a barrel chestplate or a backpack needs real 3D geometry on the player, and worn armor in Minecraft can only ever show flat textures. That is what the body layer is for: while a player wears an item carrying such a cosmetic in the matching armor slot, the 3D model appears right on their body, rotates with them and is visible to everyone.

This is built to be cheap on purpose: the invisible helper object has no AI, no physics, is never saved to disk and rides along as a passenger of the player, so the server sends no position data for it after mounting. Per wearing player it costs about as much as a single dropped item lying around.

Ingame behavior: the model hides automatically while swimming, crawling or elytra-flying (the body is horizontal), in spectator mode, for vanished players and while riding. Wearers see their own model in third person; `hide-own-view` can hide it from the wearer entirely (Minecraft cannot exempt only the first-person view). At most one body model shows per player; the ownership rule applies unchanged, handing the item away removes the model together with the design.

In the config, `body-cosmetics.mode` controls the whole layer: `entity` is the recommended default, `off` disables all body models without touching hat and hand skins (kill switch, takes effect right after `/cosmetic reload`). `packet` is reserved for a future packet-only variant and currently behaves like `entity` with a log notice.

## Web Panel

The web panel (`/cweb`) has an **Inventory** tab: it shows all unlocked cosmetics and the matching items from your inventory. Skins can be applied or removed there via a simple selection; changes are staged like everywhere else in the panel and applied with one click. If the item is moved or changed in the game in the meantime, the action aborts with a clear message, the wrong item is never touched. The tab only appears when Nexo is installed.

## Configuration (modules/cosmetics.yml)

```yaml
# Enables or disables the cosmetics module.
enabled: true

cosmetics:
  # How unlocks are checked:
  #   permission = via cosmetic.use.<id> (crate plugins)
  #   database   = only via /cosmetic grant
  #   both       = either counts
  unlock-mode: both
  # Where /cosmetic grant stores unlocks: database, standalone-file or both.
  # both additionally writes cosmetic-unlocks.json in the plugin folder,
  # which even survives a completely rebuilt database.
  unlock-storage: both
  # Price for applying (0 = free, no anvil confirmation).
  apply-cost: 0
  # Price for removing.
  remove-cost: 0
  # Seconds a player must wait between two actions.
  cooldown-seconds: 3
  # Seconds between safety checks of carried items.
  sweep-interval-seconds: 5
  # Allow cosmetics on Nexo items as well.
  allow-on-nexo-items: false
  # Show locked cosmetics greyed out in the menu.
  show-locked-in-gui: true
  # Hint shown on locked cosmetics.
  locked-hint: "Win cosmetics from crates!"
  # Global material whitelist (empty = every non-stackable item).
  allowed-materials: []
  # 3D body models (cosmetics with a body block).
  body-cosmetics:
    # off = no body models, entity = normal operation,
    # packet = reserved, currently behaves like entity.
    mode: entity
    # Render distance of the models in blocks.
    view-distance: 48
    # Hide the model from the wearer entirely (third person too).
    hide-own-view: false
    # Vanished players show no model.
    hide-while-vanished: true
    # Hide while swimming, crawling or elytra-flying.
    hide-in-special-poses: true
  # The cosmetics themselves. The look is read live from the Nexo item,
  # nothing is maintained twice.
  registry:
    barrel:
      nexo-item: barrel_chestplate
      display-name: "Barrel"
      description: "Hide inside a sturdy oak barrel."
      allowed-materials:
        - LEATHER_CHESTPLATE
        - COPPER_CHESTPLATE
        - IRON_CHESTPLATE
        - DIAMOND_CHESTPLATE
        - NETHERITE_CHESTPLATE
      permission: ""
      hidden: false
      sort-order: 0
      # Optional: 3D model on the body while the item is worn.
      body:
        # Nexo item whose model appears on the body.
        nexo-item: barrel_chestplate
        # Which slot triggers the model: HEAD, CHEST, BACK, LEGS, FEET
        # (BACK also rides the chest slot, e.g. for backpacks).
        slot: CHEST
        # The model rides at the wearer's HEAD height; negative Y moves it
        # down to the chest. Tune scale and offset until it sits right.
        scale: 1.0
        offset: [0.0, -0.7, 0.0]
        # The armor loses its own worn texture.
        hide-vanilla-armor: true
```

## Season Resets

Unlocks are bound to the player UUID, not to a world, inventory or season. After a reset with a fresh world players lose their skinned items but never their cosmetics: just apply the skin to the new item. With `unlock-storage: both` unlocks even survive a completely rebuilt database, because cosmetic-unlocks.json is read back and merged automatically on startup. For extra safety, copy that file into a backup before the season switch.

## Frequently Asked Questions

**What happens when a cosmetic is removed from Nexo?** Nothing bad: the item stays fully intact, only the skin turns invisible. If the cosmetic returns later, the skin reappears.

**Can players pass the skin to others via anvil or crafting?** No. The ownership rule also applies after anvil, grindstone or smithing table: without an unlock, the new holder sees the design disappear.

**Do players without the resource pack see the skin?** No, they see the normal item. The resource pack with the Nexo models must be installed.
