Give players tokens
Hand out the create and edit tokens that let players make and change their own tags and colours, from a command, a rank or a store.
A player makes a custom tag or colour only if they hold a token for it. You hand tokens out with one command, from a rank, a crate or a store callback.
Before you start#
Tokens pay for what players write themselves, see Custom cosmetics. There are two kinds, per type:
| Kind | Buys |
|---|---|
create | writing one new cosmetic |
edit | changing one they already made |
The types are customtag (tag), customcolor (chat colour), customnick (nick colour) and customrank (rank colour). Each has its own two balances: tokens for custom tags do not pay for custom colours. A catalogue type such as tag or font is refused, nobody writes one.
Give tokens#
Run the command
/cca tokens give <player> <type> <create|edit> <amount>, for example /cca tokens give Notch customcolor create 3.
Add edits if you sell them
/cca tokens give Notch customcolor edit 5.
Automate it
Run the same command from whatever grants the rank or the purchase: a LuckPerms group's command list, a crate, a store callback. The player can be offline, the balance waits for them.
Check that it works#
Run /cca tokens check <player> to list every balance they hold, or ask the player to run /cc tokens. In the browser, the Create button shows To make and To change with what is left.
Going further#
Take or set a balance#
/cca tokens take <player> <type> <create|edit> <amount> never goes below zero. /cca tokens set ... writes the number outright.
What spends a token#
| Action | Costs |
|---|---|
Create in a browser, or /cc customtag create, /cc customcolor create, /cc customnick create, /cc customrank create | one create |
| Shift right click on a row the player made | one edit |
| Drop key on a row the player made (delete) | nothing, and refunds nothing |
The balance is checked before the questions, so nobody writes a tag to be told they could not afford it. It is spent after the last answer, once the text passed every rule, so a refused tag costs nothing. Deleting never refunds: a player given three creations makes three, however many they delete.
There is no permission that carries a balance, on purpose. exyliachatcosmetics.customtag.create (and the same for the three colour kinds) only opens the door, and each creation still costs a token.
Show balances#
| Placeholder | Is |
|---|---|
%exyliachatcosmetics_tokens_customtag_create% | tokens left to write custom tags |
%exyliachatcosmetics_tokens_customtag_edit% | tokens left to change them |
The same shape works for customcolor, customnick and customrank: %exyliachatcosmetics_tokens_<type>_<kind>%. Use them on a scoreboard or in the description of a store item. See Placeholders.
Technical details
Balances live in the table chatcosmetics_tokens, one row per player, type and kind. They are player data, not configuration, and nothing appears in config.yml. The database is set up as in Database.
In menus, %customcolor_create_tokens% and %customtag_edit_tokens% read a kind from any screen, and inside a browser the bare %create_tokens% and %edit_tokens% mean the kind on screen, see Menus. The spend happens before the row is written, so a second click while the first saves finds the balance already short. /cca customtag set <player> <text> [color] writes one for a player without spending a token.
Something missing on this page? Tell us on Discord