Placeholders
BoxCosmetics placeholders are for scoreboards, shops and your own menus (DeluxeMenus and the like). They need PlaceholderAPI. BoxCosmetics registers them itself, so there is nothing to download with /papi ecloud.
Common tasks
These recipes build a cosmetics menu in DeluxeMenus. The menu file goes in plugins/DeluxeMenus/gui_menus/, and DeluxeMenus' own config.yml lists it under gui_menus:
# plugins/DeluxeMenus/config.yml
gui_menus:
cosmetics:
file: cosmetics.yml
The recipes use top-hat, the cosmetic from Getting Started. Other menu plugins take the same placeholders and commands, written in their own way.
One item for one cosmetic
Give the item the status line as its lore, and make a click run /bc toggle. Then the menu opens again, so that the status line shows the change.
# plugins/DeluxeMenus/gui_menus/cosmetics.yml
menu_title: "&8Cosmetics"
open_command: cosmeticsmenu
size: 27
items:
"top-hat":
material: PAPER
slot: 12
display_name: "&fTop Hat"
lore:
- "%boxcosmetics_status_top-hat%"
- ""
- "&eClick:&7 wear / take off"
left_click_commands:
- "[player] bc toggle top-hat -s"
- "[openguimenu] cosmetics"
In game, /cosmeticsmenu shows the Top Hat with Wearing, In your collection or Can't wear under its name. A click puts it on or takes it off, and does nothing for a player who has no Top Hat. The full rules are under Commands for buttons.
Sell a cosmetic
The button checks that the player does not have the cosmetic yet and has the money. Then it takes the money and adds the cosmetic to the player's Collection from the console. has money and [takemoney] need Vault and an economy plugin.
# plugins/DeluxeMenus/gui_menus/cosmetics.yml
items:
"buy-top-hat":
material: GOLD_INGOT
slot: 21
display_name: "&fBuy the Top Hat"
lore:
- "&7Price: &f500"
left_click_requirement:
requirements:
not_owned:
type: string equals
input: "%boxcosmetics_unlocked_top-hat%"
output: "false"
deny_commands:
- "[message] &cYou have the Top Hat already."
price:
type: has money
amount: 500
deny_commands:
- "[message] &cThe Top Hat costs 500."
left_click_commands:
- "[takemoney] 500"
- "[console] bc collection add %player_name% top-hat"
- "[openguimenu] cosmetics"
In game, a player with 500 or more pays, finds a Top Hat in their Collection, and sees its status line change. Accessories are never added to a Collection, so sell an accessory with [console] bc give %player_name% <cosmetic>. The command is under collection.
Coloured slots behind the cosmetics
Put the marks placeholder first in the title, with the menu's rows, the first cosmetic's place, and the cosmetics in the order of their places.
# plugins/DeluxeMenus/gui_menus/cosmetics.yml
menu_title: "%boxcosmetics_marks_3_12_top-hat,dragon-wings%&8Cosmetics"
open_command: cosmeticsmenu
size: 27
items:
"top-hat":
material: PAPER
slot: 12 # the first place, as the title says
display_name: "&fTop Hat"
left_click_commands:
- "[player] bc toggle top-hat -s"
- "[openguimenu] cosmetics"
"dragon-wings":
material: FEATHER
slot: 13 # the next place
display_name: "&fDragon Wings"
left_click_commands:
- "[player] bc toggle dragon-wings -s"
- "[openguimenu] cosmetics"
In game, a raised slot shows behind each of the two: yellow while the player wears the cosmetic, green while they have it, and red while they do not. Players need the BoxCosmetics resource pack. The full rules are under Coloured slots.
Open BoxCosmetics' palette from your menu
A left click opens the palette of the player's piece, and the palette's Back button runs your menu's open command. Here a right click wears the cosmetic or takes it off.
# plugins/DeluxeMenus/gui_menus/cosmetics.yml
items:
"top-hat":
material: PAPER
slot: 12
display_name: "&fTop Hat"
lore:
- "%boxcosmetics_status_top-hat%"
- ""
- "&eLeft Click:&7 change color"
- "&eRight Click:&7 wear / take off"
left_click_commands:
- "[player] bc color top-hat -s back:cosmeticsmenu"
right_click_commands:
- "[player] bc toggle top-hat -s"
- "[openguimenu] cosmetics"
In game, a left click opens the Top Hat's palette, and Back there returns to /cosmeticsmenu. The cosmetic needs dyeable: true. The full rules are under Colours.
All placeholders
<cosmetic> is a cosmetic's name in cosmetics/. <slot> is head, helmet, chestplate, leggings, boots, hand, offhand, balloon or wear. For an accessory slot, it is accessory-head, accessory-wear, accessory-balloon or accessory-offhand.
| Placeholder | Answer |
|---|---|
%boxcosmetics_state_<cosmetic>% |
equipped, stored or locked |
%boxcosmetics_status_<cosmetic>% |
Wearing, In your collection or Can't wear |
%boxcosmetics_unlocked_<cosmetic>% |
true if the player keeps it in the Collection, wears it, or has it by permission |
%boxcosmetics_equipped_<cosmetic>% |
true if the player wears it |
%boxcosmetics_slot_<slot>% |
The cosmetic last put in that slot |
%boxcosmetics_color_<cosmetic>% |
The player's colour for it, as #RRGGBB |
stategives the first of these that is true:equipped(worn),stored(kept in the Collection, or had by its permission),locked(the player has none).statusis a lore line to put under the cosmetic's item in your menu. Its words arecollection.status-worn,status-hadandstatus-lockedinmessages.yml.- The
true/falseplaceholders answerfalsein every other case.slot_<slot>is empty when no cosmetic is in the slot. A<slot>that is not one of the names above leaves the placeholder as it is written. equippedcounts a cosmetic's own item in a slot, not a model put on with/bc head,/bc wearor/bc balloon.- For an offline player, the placeholders answer as for a player with nothing:
locked,false,0, or empty forslot_<slot>.color_<cosmetic>gives the cosmetic's owntint, or is empty when it has none.totalanddyeable_<cosmetic>answer the same for every player.
| Placeholder | Answer |
|---|---|
%boxcosmetics_granted_<cosmetic>% |
true if had by permission, else false. /bc equip puts such a cosmetic on; /bc withdraw has no piece of it to take out |
%boxcosmetics_stored_<cosmetic>% |
How many pieces of it are in the Collection |
%boxcosmetics_slot_<slot>_count% |
Items the slot holds |
%boxcosmetics_slot_<slot>_max% |
How many items the slot may hold |
%boxcosmetics_collection_pieces% |
Pieces in the Collection |
%boxcosmetics_collection_kinds% |
How many different cosmetics are among those pieces |
%boxcosmetics_total% |
Cosmetics on the server that have an item |
%boxcosmetics_dyeable_<cosmetic>% |
true if its file says dyeable: true, else false |
%boxcosmetics_colored_<cosmetic>% |
true if the player picked a colour for a piece of it that they wear, else for a piece in their Collection, else for the cosmetic that their permission gives. Else false |
%boxcosmetics_color_rgb_<cosmetic>% |
The same colour as color, written as r, g, b, the form a menu plugin uses to dye a leather icon. Empty for a cosmetic with no colour at all |
%boxcosmetics_marks_<rows>_<first>_<cosmetic>,<cosmetic>,...% |
Raised slots for a menu title: Coloured slots |
color looks at the same piece as colored. It gives the picked colour, else the cosmetic's tint, else nothing.
Commands for buttons
Your menu's buttons can run the Collection commands and /bc color as the player ([player] in DeluxeMenus). Add -s, so that the answer shows in the menu instead of in chat:
[player] bc toggle <cosmetic> -s
- Buttons may also run these commands from the console, with the player's name in the command.
- One item per cosmetic: give each item
%boxcosmetics_status_<cosmetic>%as its lore line and/bc toggle <cosmetic> -sas its click command. - To sell a cosmetic: after your economy plugin takes the price, run
[console] bc collection add %player_name% <cosmetic>. - The cosmetic's own item as the icon: use
itemsadder-<namespace>:<id>ornexo-<id>in DeluxeMenus. - After a click, reopen the menu (
[openguimenu] <this menu>in DeluxeMenus), so that the status line and the coloured slots update.
Coloured slots
Put %boxcosmetics_marks_<rows>_<first>_<cosmetic>,...% first in a menu title. It draws a raised slot behind each listed cosmetic: yellow if the player wears it, green if they have it, red if they do not. Players need the BoxCosmetics resource pack.
# plugins/DeluxeMenus/gui_menus/cosmetics.yml
menu_title: '%boxcosmetics_marks_6_9_neon-knight-jetpack,neon-knight-drone%&8Cosmetics'
<rows>is the number of rows in the menu, 1 to 6. A larger number counts as 6.<first>is the place of the first cosmetic: 0 is the top left, and 9 is the first place of row two. The other cosmetics take the next places, one by one. Cosmetics past the menu's last place get no raised slot.- If
<rows>or<first>is not a whole number, the placeholder gives nothing. - An empty entry in the cosmetic list, or a name that is no cosmetic, leaves its place with no raised slot.
- The title is built when the menu opens, so
[refresh]does not redraw it.
Colours
Players can colour a dyeable cosmetic with BoxCosmetics' palette, or with your own colour buttons:
[player] bc color neon-knight-jetpack -s back:cosmeticsmenu
[player] bc color neon-knight-jetpack #FF0000 -s
- BoxCosmetics' palette:
/bc color <cosmetic> back:<command>(color). Make<command>your menu's open command, so that the palette's Back button returns to your menu. - Your own colours: make one button per colour that runs
/bc color <cosmetic> <#RRGGBB> -s, and one that runs/bc color <cosmetic> reset -s. - Whether a menu plugin's
rgboption reads a placeholder depends on the plugin and its version, so test yours first.