TextComponent - Click Event Callback (Section) — SkBee

Addon: SkBee · Category: Section · Since: 2.17.0

Syntax

create [a] [new] [click event] callback for %textcomp% [with %-number% use[s]] [[and] with [a] (lifetime|duration) of %-timespan%]

Description

Create a click event, that when clicked will run the code in this section.

NOTE: Internally this just makes the player run a special command so you will see console messages where a player runs the command "/paper callback" in your console.

NOTE: Paper didn't make this command available by default so you'll have to give your players the permission `bukkit.command.paper.callback`. (As of PaperMC 1.20.1[build-169], the permission is no longer required).

`uses` = The amount of times the player can click this. Defaults to 1. Use `-1` for unlimited uses.

`lifetime` = How long the player has til they can't click it. Defaults to 12 hours.

Examples

set {_t} to mini message from "JOIN US AT SPAWN FOR A SPECIAL EVENT (10 SECONDS REMAINING!)"
create callback for {_t} with a duration of 10 seconds:
	teleport player to spawn of world "world"
send component {_t} to all players

set {_t} to text component from "&cDONT CLICK ME"
create callback for {_t} with (size of players) uses:
	kill player
	broadcast "&b%player% &eclicked it &cAND DIED&7!!!"
send component {_t} to all players

set {_t} to text component from "Hey you! Click this for a free item."
set {_t2} to text component from "&e&lONE TIME USE!"
create a callback for {_t}:
	give player random item out of available item types
send components (merge components {_t} and {_t2} with " ") to players

View source