👀Event patterns

Event patterns can perform actions when a certain event occurs, allowing for more user-friendly messages.

Event pattern syntax

All event patterns share the same syntax and can be combined, for example, you can add a Hover and Click event to the same text, the syntax is easy: "<type;data>Affected text/> unaffected text"

Hover events

Hover events are triggered whenever a player hovers over a chat message or a portion of a chat message, here is a table with all currently supported types

TypeAliasesData syntax

text

Any string, can be colored with color patterns

item

Separated by spaces: material amount NBT

entity

Separated by spaces: type uuid name

show_text

This is the most basic hover event type, allows strings with color pattern support. Example: "<text;Hovering!>Hover over this text/>"

show_item

Used to show an item tooltip when hovering over a text message. Example: "Here is a <item;minecraft:diamond 64 {display:{Name:'[{"text":"Name"}]'}}>Diamond/>"

show_entity

As you might have guessed, shows an entity when hovering over a text message. Example: "Just a <entity;minecraft:pig 48fe714b-7446-4812-a9b7-3d0b7f43f1fc Name>pig/>"

Click events

Click events are triggered whenever a player clicks on a chat message or a portion of a chat message, here is a table with all currently supported types

AliasesData syntax (Just text)

url

The url to open to the player

file

The file path to open to the player

run, run_cmd

The command to run as the player

suggest, suggest_cmd

The command to suggest to the player

copy

The text to copy on player's clipboard

open_url

Opens the specified url to the player on their default browser. Example: "<url;https://mcutils.xdec0de.me>Check the documentation!/>"

open_file

Makes the player open the specified file by path. Example: "<file;path/to/file>Click to open!/>"

run_command

Makes the player execute the specified command as if the player executed it from the chat. Example: "<run;/say MCUtils is cool!>Click to say the truth/>"

suggest_command

Similar to run_command, but it doesn't actually run the command, only types it on the player's chat so the player can actually confirm sending the command by pressing enter. Example: "<suggest;/op xDec0de_>This command is dangerous, check it before running it!/>"

copy_to_clipboard

Copies the specified text to the player's clipboard. Example: "<copy;You just copied some random text>Click this to copy some secret text!/>"

Last updated