#Can I change a text or a color of text via kjs?

7 messages · Page 1 of 1 (latest)

versed marlin
#

I doing system that allows player to choose a subclass of mage (electromancer for example) and can I change the already written message?

tired hullBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

versed marlin
lean hatch
#

You can use Components instead of strings inside (strings are implicitly wrapped into Components anyway):

Component.ofString("My text").white()

There are pre-defined colors like one above, but you could also use any arbitrary color with .color, though be aware that color takes a function that outputs an integer corresponding to color. Luckly JS supports writing number literals in hexadecimal:

Component.ofString("My text").color(() => 0x00FF00)
#

(the above will result in pure green text)

versed marlin
#

And can I see a full list of actions for this?

ItemEvents.rightClicked(event => {
    const clickableMessage = Text.of({
        text: "Click me to execute KubeJS code",
        click: {
            action: "run_command",
            value: "/command"
        }
    });
    event.player.tell(clickableMessage);
});