👀Event patterns
Last updated
Last updated
Event patterns can perform actions when a certain event occurs, allowing for more user-friendly messages.
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 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
Type | Aliases | Data syntax |
---|---|---|
This is the most basic hover event type, allows strings with color pattern support. Example: "<text;Hovering!>Hover over this text/>"
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/>"
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 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
Opens the specified url to the player on their default browser. Example: "<url;https://mcutils.xdec0de.me>Check the documentation!/>"
Makes the player open the specified file by path. Example: "<file;path/to/file>Click to open!/>"
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/>"
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!/>"
Copies the specified text to the player's clipboard. Example: "<copy;You just copied some random text>Click this to copy some secret text!/>"
Aliases | Data syntax (Just text) | |
---|---|---|
text
Any string, can be colored with color patterns
item
Separated by spaces: material
amount
NBT
entity
Separated by spaces: type
uuid
name
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