#Can I change a text or a color of text via kjs?
7 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
I want use e.player.tell() to send message to a player
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)
Can I change component after click?
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);
});