Twilight Events
Twilight provides additional events which are not found in Spigot or Paper. These are:
PlayerMainHandInteractEvent
PlayerOffHandInteractEvent
PlayerOpChangeEvent
PlayerOpEvent
PlayerDeopEvent
ChatClickEvent
You can opt out of Twilight calling these events. For example:
ChatClickEvent
Due to limitations imposed by the Minecraft server software, when interacting with a clickable message in chat or in a book the only response options are RUN_COMMAND, SUGGEST_COMMAND, CHANGE_PAGE, COPY_TO_CLIPBOARD, OPEN_FILE and OPEN_URL. None of these match the most common use case: running custom code. Twilight utilizes the RUN_COMMAND response to call a custom ChatClickEvent which can be listened to like a regular event.
To use this feature, where you would normally build your clickable message, use the Twilight extension functions to add a custom click event. Twilight will then redirect any data which you put in the parameters to be accessible as a variable from within the ChatClickEvent when the player clicks the message.
For Paper/Adventure (recommended):
For Spigot/BungeeCord:
From there, simply listen to the event as normal, and access the data attached to the message the player has clicked. In this basic example, information to open a "warps" GUI has been passed through as the custom data, and so the correct action can be taken: