Skip to content
Leo edited this page Dec 1, 2023 · 5 revisions

Styles are a way of separating the look and feel of your plugin from the translation.

Each Translations instance owns a style dictionary, which is basically a set of new tags to use. Example styles file:

c-negative="<red>"
c-positive="<green>"
list-el="<gray>- </gray><white>{slot}</white>\n"
cmd="<white><i><hover:show_text:Click to run><click:run_cmd:{slot}>{slot}</click></hover></i></white>"

The given styles storage provides three different styles that can be used within all messages of the Translations.

errors.no_perm=<c-negative>You don't have permission!</c-negative>
# Here we create a list of commands without declaring at all what it will look like. We just claim that /creative is a command and a list element
# It will read the styles from the dictionary and give it the according look
cmd_help.list="<list-el><cmd>/creative</cmd></list-el><list-el><cmd>/survival</cmd></list-el>"

Syntax

A style string can be created with two approachs. Either, just open tags

a=<red>
b=<green><i>
c=<rainbow>

The parser will append the {slot} argument at the end and will parse it like every other style string:

The {slot} argument contains everything within the opening and the closing tag of your style. So if we have style

a=<red>:)</red><green>{slot}</green><yellow>{slot}</yellow>

and message

b=<a>Hello world!</a>

it will take the style, replace the {slot} with the content between <a> and </a> ("Hello world!"), producing:

# The following result will be parsed by minimessage
result=<red>:)</red><green>Hello world!</green><yellow>Hello world!</yellow>