This repository has been archived by the owner on Jun 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.ms
149 lines (128 loc) · 4.51 KB
/
main.ms
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
######################################################
#
# Sample Main file. This file is run when the server
# starts up, or the plugin is reloaded. It can be used
# as an opportunity to register events or do other things
# when the server initially starts. Variables defined here
# will go out of scope, so you can't assign() something and
# then use it in a command, for instance.
#
######################################################
/*
assign(@server_name, '<Server Name>')
*/
#Echo out a server greeting to the #console
#console('Welcome to this server, which is running CommandHelper! (Change this message in plugins/CommandHelper/main.ms)')
#Bind an event to the player join, and tell ops hello. We send in
#@server_name, so we can use it inside the event handler
/*
bind(player_join, null, null, @event, @server_name,
#if the player is an op, let's send them a welcome message
if(pisop(@event[player]), tmsg(@event[player], 'Welcome to '.@server_name.' (Change this message in plugins/CommandHelper/main.ms)'))
)
*/
bind(item_pre_enchant, null, null, @event, @server_name,
#msg('')
#msg(@event)
#modify_event(item, array(type: 1))
)
bind(item_enchant, null, null, @event, @server_name,
#msg('')
#msg(@event)
assign(@rand, rand(1))
#console(@rand, false)
if(equals(@rand, 0),
if(equals(@event[levels], 10),
modify_event(enchants, array(array(etype: 'ARROW_FIRE', elevel: 0)))
)
if(equals(@event[levels], 20),
#msg(@event[levels])
modify_event(enchants, array(array(etype: 'ARROW_FIRE', elevel: -1)))
assign(@level, get_itemmeta(@event[player], pinfo(@event[player], 15)))
if(nequals(@level[enchants], null),
assign(@level, @level[enchants])
assign(@level, @level[0])
assign(@level, @level[elevel])
)
set_itemmeta(null, array(lore: array('Wither I'), enchants: array('Wither I')))
)
)
)
#store_value(tree_toggle, 'false')
bind(tab_complete_command, null, null, @event,
if(equals(@event[command], 'reenchant'),
modify_event(completions, enchantment_list())
)
)
/*
bind(player_interact, null, null, @event,
if(equals(@event[action], 'right_click_block'),
if(and(equals(array_index_exists(get_itemmeta(@event[player], pinfo(@event[player], 15)), display), 'true'), equals(get_itemmeta(@event[player], pinfo(@event[player], 15))[display], '§2Tree Grower')),
#assign(@name, get_itemmeta(@event[player], pinfo(@event[player], 15)))
#if(nequals(array_index_exists(array(@name), display), 'false'),
assign(@name, @name[display])
#assign(@name, @name[0])
#assign(@name, @name[elevel])
#)
if(equals(@name, '§2Tree Grower'),
if(equals(@event[facing], 'up'),
assign(@loc, @event[location])
msg(@loc)
#assign(@loc[y], add(@loc[y], 1))
set_block_at(@loc[x], @loc[y], @loc[z], 0)
#generate_tree(@loc)
#assign(@chunk, get_chunk_loc(@loc))
#msg(@chunk)
#refresh_chunk(@chunk[x], @chunk[z])
)
)
)
)
)
*/
bind(entity_damage, null, null, @event,
#console(@event, false)
if(equals(@event[cause], 'PROJECTILE'),
#msg('1')
if(equals(array_index_exists(@event, player), true),
#msg('2')
assign(@player, @event[player])
)
if(equals(array_index_exists(@event, shooter), true),
#msg('3')
assign(@shooter, @event[shooter])
)
tmsg(@shooter, concat('+', @event[amount]))
assign(@level, get_itemmeta(@shooter, pinfo(@shooter, 15)))
if(nequals(@level[enchants], null),
#msg('4')
assign(@level, @level[enchants])
assign(@level, @level[0])
assign(@level, @level[elevel])
#msg(@level)
)
if(equals(@level, 0),
#msg('5')
if(equals(@event[type], 'PLAYER'),
#msg('6')
set_peffect(@player, 20, 2, 8, false)
)
if(nequals(@event[type], 'PLAYER'),
#msg('7')
set_mob_effect(@event[id], 20, 2, 8, false)
)
)
if(equals(@level, 65535),
#msg('5')
if(equals(@event[type], 'PLAYER'),
#msg('6')
set_peffect(@player, 20, 4, 16, false)
)
if(nequals(@event[type], 'PLAYER'),
#msg('7')
set_mob_effect(@event[id], 20, 4, 16, false)
)
)
)
#msg('8')
)