Actions
Actions executed once you click the button

Example

1
'Close':
2
update: [-1, 5, -1, -1]
3
display:
4
material: Red Stained Glass Pane
5
name: ['&cC&7lose', '&cCl&7ose', '&cClo&7se', '&cClos&7e', '&cClose']
6
# actions section
7
actions:
8
# Click type (all of the supported ones)
9
all: close
Copied!
1
'*':
2
update: [-1, 5, 20, -1]
3
display: # ...
4
# Actions section
5
actions:
6
# Click type (left click)
7
left:
8
- 'set-meta: icon_server_hide true'
9
- 'sound: BLOCK_NOTE_BLOCK_BIT-1-0'
10
- 'refresh'
Copied!

Click types

1
package me.arasple.mc.trmenu.api.inventory
2
3
/**
4
* @author Arasple
5
* @date 2020/3/22 10:23
6
*/
7
enum class InvClickType {
8
9
/**
10
* Left CLick
11
*/
12
LEFT,
13
14
/**
15
* Shift + Left Click
16
*/
17
SHIFT_LEFT,
18
19
/**
20
* Right CLick
21
*/
22
RIGHT,
23
24
/**
25
* Shift + Right Click
26
*/
27
SHIFT_RIGHT,
28
29
/**
30
* Middle Click (mouse wheel)
31
*/
32
MIDDLE,
33
34
/**
35
* Shift + Middle Click
36
*/
37
DOUBLE_CLICK,
38
39
/**
40
* Drop key (Q by default)
41
*/
42
DROP,
43
44
/**
45
* Switch Item in Offhand (F by default) (1.16+)
46
*/
47
OFFHAND,
48
49
/**
50
* Ctrl + Drop key
51
*/
52
CONTROL_DROP,
53
54
/**
55
* Creative mode + Middle Click
56
*/
57
CREATIVE,
58
59
/**
60
* Number Keys from 1 to 9
61
*/
62
NUMBER_KEY,
63
64
/**
65
* Number Key 1
66
*/
67
NUMBER_KEY_1,
68
69
/**
70
* NumberKey 2
71
*/
72
NUMBER_KEY_2,
73
74
/**
75
* Number Key 3
76
*/
77
NUMBER_KEY_3,
78
79
/**
80
* Number Key 4
81
*/
82
NUMBER_KEY_4,
83
84
/**
85
* Number Key 5
86
*/
87
NUMBER_KEY_5,
88
89
/**
90
* Number Key 6
91
*/
92
NUMBER_KEY_6,
93
94
/**
95
* Number Key 7
96
*/
97
NUMBER_KEY_7,
98
99
/**
100
* Number Key 8
101
*/
102
NUMBER_KEY_8,
103
104
/**
105
* Number Key 9
106
*/
107
NUMBER_KEY_9,
108
109
/**
110
* Left Border of the Inventory
111
*/
112
WINDOW_BORDER_LEFT,
113
114
/**
115
* Right Border of the Inventory
116
*/
117
WINDOW_BORDER_RIGHT,
118
119
/**
120
* All above supported types
121
*/
122
ALL;
123
124
}
Copied!

Tips

  • You can easily combine multiple click types to execute the same actions
1
actions:
2
# The action will be executed if you left clicked the button,
3
# middle clicked it, or pressed the 8 key button.
4
left,middle,number_key_8:
5
- 'tell: Hello'
Copied!

Note

  • Actions support multiple action types, the same as those in the Periodic Tasks and in the Menu Events. They will be listed and detailed later.
  • The actions section must be at the same level as the displaysection
  • Both default button icons and conditionnal icons can have seperated actions.
Last modified 1yr ago