Custom Items - On Click
Executable types:
To add a custom on-click event to your item, you will need to do the following:
Let's take the item from "Custom Items - Creating" for this example.
GUI-items:
<Item_ID>:
slot: [39, 40, 41]
custom-model-data: 499
item: "STRUCTURE_VOID"
name: "&c&lClose"
lore:
- "&7Screw this, I'm out!"
on-click:
left-click:
free:
execute:
- "[SOUND] UI_BUTTON_CLICK 1 1"
buy:
type: "MONEY"
money:
price: 1
item:
item: "COAL"
placeholder-name: "Coal"
model-data: -1
amount: 1
buy:
execute:
- "[MESSAGE] &7Execute either way"
on-success:
- "[MESSAGE] &7Only execute if the player can afford it."
on-fail:
- "[MESSAGE] &7Executeif the player does not have enough money"
special:
special-to-execute:
- "[SPECIAL] closeGUI"
On Click - Free
Free
The "free"
event will execute anything in the "execute"
variable without any condition.
On Click - Buy
Buy
The "buy" event has a few rules. It requires a type of currency, either "MONEY" or "ITEM".
Buy currency types:
"MONEY"
- Using an economy plugin such as Vault to charge the player"ITEM"
- Instead of money, charge the player an item.If the
"model-data"
is -1, any kind of item of that type will be accepted as payment.If the
"model-data"
is <any number>, only items with that custom model data will be accepted as payment.And the
"amount"
is the amount of that item to charge the player.
Executable types:
After you're done with the buy type, its time for the executables.
buy:
type: "MONEY"
money:
price: 1
item:
item: "COAL"
placeholder-name: "Coal"
model-data: -1
amount: 1
buy:
execute:
- "[MESSAGE] &7Execute either way"
on-success:
- "[MESSAGE] &7Only execute if the player can afford it."
on-fail:
- "[MESSAGE] &7Executeif the player does not have enough money"
You will need to add another "buy" value, and to it assign the following:
An "execute" variable, that runs on click.
An "on-success" variable, that will run if the transaction was a success.
And an "on-fail" variable, that will run if the player does not have sufficient funds.
On Click - Special
The special tag, as per its name, is a special tag that does things only BaseRaiders can do, such as buying fuel, upgrading or collecting the generator.
special:
special-to-execute:
- "[SPECIAL] <special name>"
More info about special executables here:
Special executablesLast updated