-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapproval.sk
329 lines (271 loc) · 15.1 KB
/
approval.sk
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# ### Newbie island & approval system by Roy Curtis
# ### Licensed under MIT, 2015
# ### Global variables
# approval.correct.%player% - number; highest consecutive section has player completed successfully
# approval.wrong.%player% - number; how many wrong answers by player
# approval.pickup.%player% - date; last time player attempted to pick item up
# approval.playtime.%player% - timespan; amount of playtime by player
# ### Configuration
options:
# Newbie island
max wrong answers : 5
wrong answer message : [AUTO] Too many wrong answers on newbie island; gamealition@gmail.com
skipped section message : [AUTO] Attempted to cheat newbie island; gamealition@gmail.com
# Newbie rank
max time newbie rank : 90 minutes
# Untrusted rank
max time untrusted rank : 24 hours
# ### Events
every minute:
loop all players:
loop-player has permission "gamealition.group.newbie" or "gamealition.group.untrusted"
add 1 minute to {approval.playtime.%loop-player%}
# Handle auto-promote to untrusted rank
if loop-player has permission "gamealition.group.newbie":
{approval.playtime.%loop-player%} >= {@max time newbie rank}
execute console command "/approve-untrusted %loop-player%"
# Handle auto-promote to player rank
else if loop-player has permission "gamealition.group.untrusted":
{approval.playtime.%loop-player%} >= {@max time untrusted rank}
execute console command "/approve %loop-player%"
on player join:
player has permission "gamealition.group.default" or "gamealition.group.newbie"
message "*** Sending approval join messages to %player%" to console
set {approval.pickup.%player%} to now
wait 5 seconds
if player has permission "gamealition.group.default":
set {approval.playtime.%player%} to 0 minutes
message "&2&LHello, %player%! &fYou can look around freely."
message " To join our community, do the command &3/approve-me"
else if player has permission "gamealition.group.newbie":
set {_remaining} to difference between {@max time newbie rank} and {approval.playtime.%player%}
message "&2&LWelcome back, %player%! &fYou still have &a%{_remaining}%&f of playtime until you're fully approved. Meanwhile, you can gather resources in the resource world, or explore!"
message "To go to resource world: &b/warp resource"
on pick up:
player has permission "gamealition.group.default"
cancel the event
# Do message only every 6 seconds
{approval.pickup.%player%} was more than 6 seconds ago
set {approval.pickup.%player%} to now
execute console command "/approve-error %player% Can't pick that up!"
on hunger level change:
player has permission "gamealition.group.default"
set player's hunger level to 10
on break:
player has permission "gamealition.group.default" or "gamealition.group.newbie"
# For newbie rank, only cancel if outside resource world
if player has permission "gamealition.group.newbie":
player's world is "resource" or "resource_nether" or "resource_the_end"
exit trigger
cancel the event
execute console command "/approve-error %player% Can't break that!"
on craft:
player has permission "gamealition.group.default" or "gamealition.group.newbie"
# For newbie rank, only cancel if outside resource world
if player has permission "gamealition.group.newbie":
player's world is "resource" or "resource_nether" or "resource_the_end"
exit trigger
cancel the event
execute console command "/approve-error %player% Can't craft that!"
on place:
player has permission "gamealition.group.default" or "gamealition.group.newbie"
# For newbie rank, only cancel if outside resource world
if player has permission "gamealition.group.newbie":
player's world is "resource" or "resource_nether" or "resource_the_end"
exit trigger
cancel the event
execute console command "/approve-error %player% Can't place that!"
on right click on anything:
player has permission "gamealition.group.default" or "gamealition.group.newbie"
clicked block is not a door or sign or stone button or stone pressure plate
# For newbie rank, only cancel if outside resource world
if player has permission "gamealition.group.newbie":
player's world is "resource" or "resource_nether" or "resource_the_end"
exit trigger
cancel the event
execute console command "/approve-error %player% Can't use that!"
on vehicle destroy:
attacker has permission "gamealition.group.default" or "gamealition.group.newbie"
# For newbie rank, only cancel if outside resource world
if attacker has permission "gamealition.group.newbie":
attacker's world is "resource" or "resource_nether" or "resource_the_end"
exit trigger
cancel the event
execute console command "/approve-error %attacker% Can't destroy that!"
on damage:
attacker is a player
attacker has permission "gamealition.group.default" or "gamealition.group.newbie"
# For newbie rank, only cancel if outside resource world
if attacker has permission "gamealition.group.newbie":
attacker's world is "resource" or "resource_nether" or "resource_the_end"
exit trigger
cancel the event
execute console command "/approve-error %attacker% Can't hurt that!"
# ### Newbie island functions
command /ni-wrong <text> <player>:
permission: gamealition.admin
executable by: console
trigger:
# Logic
set {_dest} to arg 1
set {_player} to arg 2
execute console command "/mvtp %{_player}% %{_dest}%"
message "&c*** Wrong answer! Please read the signs carefully. You may be banned for too many wrong answers" to {_player}
{_player} has permission "gamealition.group.default"
add 1 to {approval.wrong.%{_player}%}
if {approval.wrong.%{_player}%} >= {@max wrong answers}:
delete {approval.correct.%{_player}%}
delete {approval.wrong.%{_player}%}
execute console command "/ban %{_player}% {@wrong answer message}"
else:
message "*** Wrong newbie island answer by %{_player}%, total %{approval.wrong.%{_player}%}%" to console
command /ni-correct <number> <text> <player>:
permission: gamealition.admin
executable by: console
trigger:
# Logic
set {_section} to arg 1
set {_sectionPrev} to arg 1 - 1
set {_dest} to arg 2
set {_player} to arg 3
execute console command "/mvtp %{_player}% %{_dest}%"
# Begin checking for attempts at cheating (e.g. flying past sections)
{_player} has permission "gamealition.group.default"
# Special case for first section
if {_section} is 1:
set {approval.correct.%{_player}%} to 1
else if {approval.correct.%{_player}%} is not set:
set {approval.correct.%{_player}%} to -1
if {approval.correct.%{_player}%} < {_sectionPrev}:
delete {approval.correct.%{_player}%}
delete {approval.wrong.%{_player}%}
execute console command "/ban %{_player}% {@skipped section message}"
else:
set {approval.correct.%{_player}%} to {_section}
# ### Approval functions
command /approve-info <offline player>:
description: Debugs approval information of a player
permission: gamealition.group.player
executable by: players and console
trigger:
player command "/age %arg 1%"
player command "/isbanned %arg 1%"
message "&7*** &2%arg 1%&f's approval info..."
message "&7• Playtime: &f%{approval.playtime.%arg 1%}%"
if arg 1 has permission "gamealition.group.default":
message "&7• Default rank; no approval"
else if arg 1 has permission "gamealition.group.newbie":
set {_remaining} to difference between {@max time newbie rank} and {approval.playtime.%arg 1%}
message "&7• Newbie rank; resource world only"
message "&7• Remaining until untrusted: &f%{_remaining}%"
else if arg 1 has permission "gamealition.group.untrusted":
set {_remaining} to difference between {@max time untrusted rank} and {approval.playtime.%arg 1%}
message "&7• Untrusted rank; NoCheatPlus checks active"
message "&7• Remaining until full: &f%{_remaining}%"
else if arg 1 has permission "gamealition.group.player":
message "&7• Fully approved player"
if arg 1 has permission "gamealition.flatland":
message "&7• Approved for flatland building"
else:
message "&7• Not approved for flatland building"
command /approve-newbie <player>:
description: Adds given player to the "newbie" perm group (first tier)
permission: gamealition.mod-high
executable by: players and console
trigger:
if arg 1 has the permission "derpi.inmate":
message "&c*** Can't approve; %arg 1% is in the DERPI"
exit trigger
if arg 1 has the permission "gamealition.group.newbie":
message "&c*** %arg 1% is already approved at newbie tier"
exit trigger
if arg 1 has the permission "gamealition.group.untrusted":
message "&c*** %arg 1% is already approved at untrusted tier; use /unapprove instead"
exit trigger
if arg 1 has the permission "gamealition.group.player":
message "&c*** %arg 1% is already approved at player tier; use /unapprove instead"
exit trigger
delete {approval.correct.%arg 1%}
delete {approval.wrong.%arg 1%}
console command "/broadcast-irc *** &f%arg 1% &7has been &aapproved&7 for resource world play!"
console command "/perms player %arg 1% setgroup newbie"
console command "/playsound entity.player.levelup neutral %arg 1% ~ ~ ~ 1 1 1"
message "&a*** Thanks for reading our rules! &fFor your first" to arg 1
message " &a{@max time newbie rank}&f of playtime, &ayou can only mine/build in resource world&f. Use the time to gather stuff in resource world for your survival adventure!" to arg 1
command /approve-untrusted <player>:
description: Adds given player to the "untrusted" perm group (second tier)
permission: gamealition.mod-high
executable by: players and console
trigger:
if arg 1 has the permission "derpi.inmate":
message "&c*** Can't approve; %arg 1% is in the DERPI"
exit trigger
if arg 1 has the permission "gamealition.group.untrusted":
message "&c*** %arg 1% is already approved at untrusted tier"
exit trigger
if arg 1 has the permission "gamealition.group.player":
message "&c*** %arg 1% is already approved at player tier; use /unapprove instead"
exit trigger
delete {approval.correct.%arg 1%}
delete {approval.wrong.%arg 1%}
console command "/broadcast-irc *** &f%arg 1% &7has been &aapproved&7 for full server play"
console command "/perms player %arg 1% setgroup untrusted"
console command "/playsound entity.player.levelup neutral %arg 1% ~ ~ ~ 1 1 1"
message "&a*** Since you have completed enough play time, &ayou are now a full player&f! You can now build anywhere in the Survival worlds. Be aware; until you have &a{@max time untrusted rank}&f of playtime, you will still be subject to NoCheatPlus checks" to arg 1
command /approve <offline player>:
description: Adds given player to the "player" perm group (final tier)
permission: gamealition.mod-high
executable by: players and console
trigger:
if arg 1 has the permission "derpi.inmate":
message "&c*** Can't approve; %arg 1% is in the DERPI"
exit trigger
if arg 1 has the permission "gamealition.group.player":
message "&c*** %arg 1% is already fully approved"
exit trigger
delete {approval.correct.%arg 1%}
delete {approval.wrong.%arg 1%}
console command "/broadcast-irc *** &f%arg 1% &7has been &aapproved&7 for full & trusted server play"
console command "/perms player %arg 1% setgroup player"
console command "/playsound entity.player.levelup neutral %arg 1% ~ ~ ~ 1 1 1"
command /unapprove <offline player>:
description: Removes given player from the "player" perm group
permission: gamealition.mod-high
executable by: players and console
trigger:
if arg 1 has the permission "derpi.inmate":
message "&c*** %arg 1% is in the DERPI; unapprove when released"
exit trigger
delete {approval.correct.%arg 1%}
delete {approval.wrong.%arg 1%}
set {approval.playtime.%arg 1%} to 0 seconds
console command "/broadcast-irc *** &f%arg 1% &7has been &cunapproved&7 for server play"
console command "/perms player %arg 1% setgroup default"
command /approve-me:
description: Allows a new (unapproved) player to go through the approval process
permission: gamealition.group.default
executable by: players
trigger:
execute console command "/mvtp %player% a:newbie_part1"
# Wait for region messages
wait 1 second
message "&f*** Please follow the lights and read the signs carefully"
# Approval skript functions
command /approve-error <player> <text=Can't do that!>:
description: Gives newbie error to guests who try to do restricted things
executable by: console
trigger:
message "*** Sending approval message to %arg 1%: ""%arg 2%""" to console
if arg 1 has permission "gamealition.group.default":
message "&2&lYou can look but not touch, %arg 1%!" to arg 1
message "&fDo the command &3/approve-me &fto begin the approval process!" to arg 1
execute console command "/title %arg 1% times 10 60 40"
execute console command "/title %arg 1% subtitle [""Want to join? Do "",{""color"":""dark_aqua"",""text"":""/approve-me!""}]"
execute console command "/title %arg 1% title {""color"":""red"",""text"":""%arg 2%""}"
else if arg 1 has permission "gamealition.group.newbie":
set {_remaining} to difference between {@max time newbie rank} and {approval.playtime.%arg 1%}
message "&2&lYou can't do much here yet, %arg 1%!" to arg 1
message "You still have &a%{_remaining}%&f of playtime left until you can change stuff outside of resource world! To go to resource world, do &3/spawn&f and look for the portal!" to arg 1
execute console command "/title %arg 1% times 10 60 40"
execute console command "/title %arg 1% subtitle [{""color"":""green"",""text"":""%{_remaining}% ""},""playtime remaining!""]"
execute console command "/title %arg 1% title {""color"":""red"",""text"":""%arg 2%""}"