Expert users

Installing the required dependencies

To get more info about skript-reflect please read its wikiโ€‹
I'm not a skript expert and I'm not the developer of skript nor skript-reflect. Every question about skript will be ignored, I hope you understand.

Examples

Getting item on command
Check if clicked block is custom block
Custom GUI
Change hud value
item menu
1
import:
2
dev.lone.itemsadder.api.ItemsAdder
3
โ€‹
4
command /iaskript:
5
trigger:
6
set {testItem} to ItemsAdder.getCustomItem("itemsadder:ruby")
7
sender.getInventory().addItem({testItem})
Copied!
1
import:
2
dev.lone.itemsadder.api.ItemsAdder
3
org.bukkit.event.player.PlayerInteractEvent
4
org.bukkit.inventory.EquipmentSlot as EquipmentSlot
5
โ€‹
6
on PlayerInteractEvent:
7
if event.getHand() is EquipmentSlot.OFF_HAND:
8
stop
9
โ€‹
10
set {_clickedBlock} to event.getClickedBlock()
11
set {_isCustomBlock} to ItemsAdder.isCustomBlock({_clickedBlock})
12
event.getPlayer().sendMessage("Is custom block: %{_isCustomBlock}%")
13
โ€‹
14
if {_isCustomBlock} is true:
15
set {_tmp} to ItemsAdder.getCustomBlock({_clickedBlock})
16
set {_name} to {_tmp}.getItemMeta().getDisplayName()
17
event.getPlayer().sendMessage("%{_name}%")
Copied!
1
import:
2
dev.lone.itemsadder.api.ItemsAdder
3
dev.lone.itemsadder.api.FontImages.TexturedInventoryWrapper
4
dev.lone.itemsadder.api.FontImages.FontImageWrapper
5
org.bukkit.entity.Player
6
7
8
9
command /iaguitest:
10
trigger:
11
12
set {_customTexture} to new FontImageWrapper("mcguis:blank_menu")
13
set {_gui} to new TexturedInventoryWrapper(null, 54, "&0Test" and {_customTexture})
14
set {_icon} to ItemsAdder.getCustomItem("mcicons:icon_confirm")
15
add player to {players::*}
16
set slot 12 of {_gui}.getInternal() to {_icon}
17
{_gui}.showInventory(player)
18
19
on inventory click:
20
if {players::*} contain player:
21
if index of event-slot = 12:
22
cancel event
23
send "Confirmed!"
24
โ€‹
25
on inventory close:
26
remove player from {players::*}
Copied!
1
import:
2
dev.lone.itemsadder.api.FontImages.PlayerQuantityHudWrapper
3
dev.lone.itemsadder.api.FontImages.PlayerHudsHolderWrapper
4
โ€‹
5
โ€‹
6
command /healme:
7
trigger:
8
set {_player} to new PlayerHudsHolderWrapper(player)
9
set {_hud} to new PlayerQuantityHudWrapper({_player}, "realcraft:thirst_bar")
10
{_hud}.setFloatValue(10.0)
11
heal the player
12
set the player's food level to 10
Copied!
1
import:
2
dev.lone.itemsadder.api.CustomStack
3
dev.lone.itemsadder.api.ItemsAdder
4
โ€‹
5
on load:
6
delete {items::*}
7
loop ...ItemsAdder.getAllItems("itemsadder"):
8
add loop-value.getNamespacedID() to {items::*}
9
โ€‹
10
command /item_menu:
11
trigger:
12
item_menu(player, 0)
13
โ€‹
14
โ€‹
15
function item_menu(player: player, pag: number):
16
set {_pagina_inicio} to (45 * {_pag})
17
set {_slot} to 0
18
set metadata "item_menu_pag" of {_player} to {_pag}
19
loop {items::*}:
20
add 1 to {_total}
21
if {_total} = 45:
22
add 1 to {_pags}
23
set {_total} to 0
24
set {_inv} to chest with 6 row named "&6Pag &l%{_pag}%/%{_pags}%"
25
wait tick
26
set metadata "item_menu" of {_player} to {_inv}
27
rellenarINV({_inv}, (46, 47, 48, 49, 50, 51 and 52))
28
wait tick
29
loop {items::*}:
30
(loop-index parsed as integer) > {_pagina_inicio}
31
set slot {_slot} of {_inv} to CustomStack.getInstance(loop-value).getItemStack()
32
add 1 to {_slot}
33
if {_slot} = 45:
34
exit loop
35
if (amount of {items::*}) > {_pagina_inicio} + 45:
36
set slot 53 of {_inv} to arrow named "&6next page >>"
37
else:
38
rellenarINV({_inv}, 53)
39
if {_pag} > 0:
40
set slot 45 of {_inv} to arrow named "&6<< back page"
41
else:
42
rellenarINV({_inv}, 45)
43
open {_inv} to {_player}
44
โ€‹
45
on inventory click:
46
if event-inventory = (metadata value "item_menu" of player):
47
cancel event
48
if event-slot is not 45, 46, 47, 48, 49, 50, 51, 52 or 53:
49
give event-item to player
50
if event-slot = 53:
51
if event-slot is arrow named "&6next page >>":
52
item_menu(player, (metadata "item_menu_pag" of player) + 1)
53
if event-slot = 45:
54
if event-slot is arrow named "&6<< back page":
55
item_menu(player, (metadata "item_menu_pag" of player) - 1)
56
if current inventory contains (metadata value "item_menu" of player):
57
if event-inventory is player's inventory:
58
cancel event
59
โ€‹
60
โ€‹
61
function rellenarINV(inv: inventory, slots: integers):
62
loop {_slots::*}:
63
set slot loop-value of {_inv} to black stained glass pane named " "
64
โ€‹
Copied!
Copy link
Edit on GitHub