-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
punishments.sk
385 lines (363 loc) · 19.6 KB
/
punishments.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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
#Configuration
variables:
prefix = "&c&lPunish »" #Change the prefix in chat
options:
error.offline: "%{prefix}% &cThe player is not online"
usage.kick: "%{prefix}% &cCorrect Usage: &7/kick <player> <reason>"
usage.warn: "%{prefix}% &cCorrect Usage: &7/warn <player> <reason>"
usage.mute: "%{prefix}% &cCorrect Usage: &7/mute <player> <time> <reason>"
usage.unmute: "%{prefix}% &cCorrect Usage: &7/unmute <player> <reason>"
usage.ban: "%{prefix}% &cCorrect Usage: &7/ban <player> <time> <reason>"
usage.unban: "%{prefix}% &cCorrect Usage: &7/unban <player> <reason>"
format.time: "&cThe time needs to be in the following format: <amount><sec/min/hour/day> (For example 10min)"
usage.logs: "%{prefix}% &cCorrect Usage: &7/logs <player> &cor &7&7/logs server"
command.cooldown: 5 seconds #Change the cooldown for the command
on load:
wait 1 tick
Time_Register()
PunishTime_Register()
PunishColor_Register()
PunishShow_Register()
function Time_Register():
clear {time.types::*}
set {time.types::second} to "sec"
set {time.types::minute} to "min"
set {time.types::hour} to "hour"
set {time.types::day} to "day"
clear {letters::*}
set {_str} to "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,/,!,@,##,$,%%,^,*,(,),{,},[,],"",|,;,',`,?"
set {letters::*} to {_str} split at ","
function PunishTime_Register():
#Mutes
set {punish.time::mute::1} to "5 Minutes"
set {punish.time::mute::2} to "30 Minutes"
set {punish.time::mute::3} to "1 Hour"
set {punish.time::mute::4} to "1 Day"
#Bans
set {punish.time::ban::1} to "1 Hour"
set {punish.time::ban::2} to "12 Hours"
set {punish.time::ban::3} to "1 Day"
set {punish.time::ban::4} to "30 Days"
function PunishColor_Register():
clear {punish.color::*}
set {punish.color::warns} to "&e"
set {punish.color::kicks} to "&f"
set {punish.color::mutes} to "&8"
set {punish.color::bans} to "&c"
function PunishShow_Register():
clear {punish.show::*}
set {punish.show::warns} to "Warn"
set {punish.show::kicks} to "Kick"
set {punish.show::mutes} to "Mute"
set {punish.show::bans} to "Ban"
function Time_Check(time: string, c: boolean = true) :: boolean:
loop {letters::*}:
{_num} contains loop-value-2:
set {_c} to false
exit loop
return {_c}
on inventory close:
delete {inventory::%player's uuid%}
command /logs [<offline player>] [<text>] [<number>]:
permission: skript.logs
trigger:
if arg-1 is set:
if "%arg-1%" is "clear":
player is op
clear {%arg-2%::*}
send "%{prefix}% &aCleared all %arg-2%"
else if arg-2 isn't set:
set {_menu} to chest inventory with 5 rows named "Logs %arg-1%"
set slot (integers from 0 to 8) of {_menu} to black glass pane named " "
set slot (integers from 37 to 45) of {_menu} to black glass pane named " "
set slot 36 of {_menu} to barrier named "&cClose"
set slot 19 of {_menu} to yellow concrete named "&e&lWarns"
set slot 21 of {_menu} to white concrete named "&f&lKicks"
set slot 23 of {_menu} to gray concrete named "&8&lMutes"
set slot 25 of {_menu} to red concrete named "&c&lBans"
open {_menu} to player
set {inventory::%player's uuid%} to "logs.main/%arg-1%"
else if arg-2 is "warns" or "kicks" or "mutes" or "bans":
set {_menu} to chest inventory with 6 rows named "Logs %arg-1% - %{punish.show::%arg-2%}%"
set slot (integers from 0 to 8) of {_menu} to black glass pane named " "
set slot (integers from 46 to 53) of {_menu} to black glass pane named " "
set slot 45 of {_menu} to barrier named "&cBack"
set {_color} to {punish.color::%arg-2%}
set {_slot} to 9
if arg-1 isn't "server":
loop {punish::%arg-1's uuid%::%arg-2%::*}:
set {_id} to loop-value
if {%arg-2%::%{_id}%::staff} is set:
if arg-2 is "warns" or "kicks":
set slot {_slot} of {_menu} to paper named "%{_color}%%{punish.show::%arg-2%}% ##%{_id}%" with lore "&7Staff: %{_color}%%{%arg-2%::%{_id}%::staff}%", "&7Reason: %{_color}%%{%arg-2%::%{_id}%::reason}%" and "&7Date: %{_color}%%{%arg-2%::%{_id}%::when}%"
else:
if {%arg-2%::%{_id}%::time} isn't "perm":
set {_time} to {%arg-2%::%{_id}%::time} parsed as timespan
else:
set {_time} to {%arg-2%::%{_id}%::time}
if {%arg-2%::%{_id}%::undo.staff} is set:
set slot {_slot} of {_menu} to paper named "%{_color}%%{punish.show::%arg-2%}% ##%{_id}%" with lore "&7Staff: %{_color}%%{%arg-2%::%{_id}%::staff}%", "&7Reason: %{_color}%%{%arg-2%::%{_id}%::reason}%", "&7Date: %{_color}%%{%arg-2%::%{_id}%::when}%", "&7Length: %{_color}%%{_time}%", "&7Canceled By: %{_color}%%{%arg-2%::%{_id}%::undo.staff}%" and "&7Reason For Cancel: %{_color}%%{%arg-2%::%{_id}%::undo.reason}%"
else:
set slot {_slot} of {_menu} to paper named "%{_color}%%{punish.show::%arg-2%}% ##%{_id}%" with lore "&7Staff: %{_color}%%{%arg-2%::%{_id}%::staff}%", "&7Reason: %{_color}%%{%arg-2%::%{_id}%::reason}%", "&7Date: %{_color}%%{%arg-2%::%{_id}%::when}%" and "&7Length: %{_color}%%{_time}%"
add 1 to {_slot}
if {_slot} >= 45:
set slot 54 of {_menu} to arrow named "&eNext Page"
exit loop
else:
remove {_id} from {punish::%arg-1's uuid%::%arg-2%::*}
else:
if arg-3 isn't set:
set {_c} to true
else:
set slot 45 of {_menu} to arrow named "&ePrevious Page"
set {_need} to arg-3
loop all indices of {%arg-2%::*}:
if {_c} isn't true:
add 1 to {_num}
if {_num} >= {_need} - 1:
set {_c} to true
else:
set {_id} to loop-value
if arg-2 is "warns" or "kicks":
set slot {_slot} of {_menu} to paper named "%{_color}%%{punish.show::%arg-2%}% ##%{_id}%" with lore "&7Player: %{_color}%%{%arg-2%::%{_id}%::player}%", "&7Staff: %{_color}%%{%arg-2%::%{_id}%::staff}%", "&7Reason: %{_color}%%{%arg-2%::%{_id}%::reason}%" and "&7Date: %{_color}%%{%arg-2%::%{_id}%::when}%"
else:
if {%arg-2%::%{_id}%::time} isn't "perm":
set {_time} to {%arg-2%::%{_id}%::time} parsed as timespan
else:
set {_time} to {%arg-2%::%{_id}%::time}
if {%arg-2%::%{_id}%::undo.staff} is set:
set slot {_slot} of {_menu} to paper named "%{_color}%%{punish.show::%arg-2%}% ##%{_id}%" with lore "&7Player: %{_color}%%{%arg-2%::%{_id}%::player}%", "&7Staff: %{_color}%%{%arg-2%::%{_id}%::staff}%", "&7Reason: %{_color}%%{%arg-2%::%{_id}%::reason}%", "&7Date: %{_color}%%{%arg-2%::%{_id}%::when}%", "&7Length: %{_color}%%{_time}%", "&7Canceled By: %{_color}%%{%arg-2%::%{_id}%::undo.staff}%" and "&7Reason For Cancel: %{_color}%%{%arg-2%::%{_id}%::undo.reason}%"
else:
set slot {_slot} of {_menu} to paper named "%{_color}%%{punish.show::%arg-2%}% ##%{_id}%" with lore "&7Player: %{_color}%%{%arg-2%::%{_id}%::player}%", "&7Staff: %{_color}%%{%arg-2%::%{_id}%::staff}%", "&7Reason: %{_color}%%{%arg-2%::%{_id}%::reason}%", "&7Date: %{_color}%%{%arg-2%::%{_id}%::when}%" and "&7Length: %{_color}%%{_time}%"
add 1 to {_slot}
if {_slot} >= 45:
set slot 53 of {_menu} to arrow named "&eNext Page"
set {_last} to (loop-value parsed as integer) + 1
exit loop
open {_menu} to player
if {_last} is set:
set {inventory::%player's uuid%} to "logs.%arg-2%/%arg-1%/%{_last}%"
else:
set {inventory::%player's uuid%} to "logs.%arg-2%/%arg-1%"
else:
send {@usage.logs}
on inventory click:
if {inventory::%player's uuid%} contains "logs":
cancel event
if {inventory::%player's uuid%} contains "main":
if event-slot is concrete:
set {_temp::*} to {inventory::%player's uuid%} split at "/"
make player execute command "/logs %{_temp::2}% %uncolored name of event-slot in lower case%"
else if event-slot is barrier:
close player's inventory
else:
if event-slot is barrier:
set {_temp::*} to {inventory::%player's uuid%} split at "/"
make player execute command "/logs %{_temp::2}%"
else if event-slot is arrow:
set {_temp::*} to {inventory::%player's uuid%} split at "/"
set {_type} to {_temp::1}
replace all "logs." in {_type} with ""
if uncolored name of event-slot contains "Next":
set {_num} to {_temp::3}
else:
set {_num} to ("%{_temp::3}%" parsed as integer) - 36
if {_num} <= 1:
make player execute command "/logs %{_temp::2}% %{_type}%"
stop
make player execute command "/logs %{_temp::2}% %{_type}% %{_num}%"
command /warn [<player>] [<text>]:
permission: skript.warn
trigger:
if arg-1 is set:
if arg-1 is online:
if arg-2 is set:
add 1 to {warn.count}
set {warns::%{warn.count}%::player} to arg-1
set {warns::%{warn.count}%::staff} to player
set {warns::%{warn.count}%::reason} to arg-2
set {warns::%{warn.count}%::when} to now
add {warn.count} to {punish::%arg-1's uuid%::warns::*}
broadcast "&e&lWarns » &e%arg-1% &7has been warned by &e%player% &7for &c%arg-2% &7(ID: %{warn.count}%)"
else:
send {@usage.warn}
else:
send {@error.offline}
else:
send {@usage.warn}
command /kick [<player>] [<text>]:
permission: skript.kick
trigger:
if arg-1 is set:
if arg-1 is online:
if arg-2 is set:
add 1 to {kick.count}
set {kicks::%{kick.count}%::player} to arg-1
set {kicks::%{kick.count}%::staff} to player
set {kicks::%{kick.count}%::reason} to arg-2
set {kicks::%{kick.count}%::when} to now
add {kick.count} to {punish::%arg-1's uuid%::kicks::*}
kick arg-1 due to "&fYou were kicked by %player% for %arg-2% (ID: %{kick.count}%)"
else:
send {@usage.kick}
else:
send {@error.offline}
else:
send {@usage.kick}
command /mute [<offline player>] [<text>] [<text>]:
permission: skript.mute
trigger:
if arg-1 is set:
if arg-2 is set:
if arg-3 is set:
set {_time} to arg-2 in lower case
if {_time} isn't "perm":
loop {time.types::*}:
if {_time} contains loop-value:
set {_num} to {_time}
replace all loop-value in {_num} with ""
if Time_Check({_num}) is true:
set {_length} to "%{_num}% %loop-index%"
exit loop
else:
set {_length} to {_time}
if {_length} is set:
add 1 to {mute.count}
set {mutes::%{mute.count}%::player} to arg-1
set {mutes::%{mute.count}%::staff} to player
set {mutes::%{mute.count}%::reason} to arg-3
set {mutes::%{mute.count}%::time} to {_length}
set {mutes::%{mute.count}%::when} to now
add {mute.count} to {punish::%arg-1's uuid%::mutes::*}
set {mute::%arg-1's uuid%} to {mute.count}
broadcast "%{prefix}% &e%arg-1% &7has been muted by &e%player% &7for &c%arg-3% &7(ID: %{mute.count}%)"
else:
send "&cThe time needs to be in the following format: <amount><sec/min/hour/day> (For example 10min)"
else:
send {@usage.mute}
else:
send {@usage.mute}
else:
send {@usage.mute}
command /unmute [<offline player>] [<text>]:
permission: skript.mute
trigger:
if arg-1 and arg-2 is set:
if {mute::%arg-1's uuid%} is set:
set {_id} to {mute::%arg-1's uuid%}
if {mutes::%{_id}%::time} isn't "perm":
set {_wait} to difference between {mutes::%{_id}%::when} and now
if {_wait} < {mutes::%{_id}%::time} parsed as timespan:
set {_c} to true
else:
delete {mute::%arg-1's uuid%}
else:
set {_c} to true
if {_c} is true:
set {_id} to {mute::%arg-1's uuid%}
set {mutes::%{_id}%::undo.staff} to player
set {mutes::%{_id}%::undo.reason} to arg-2
set {mutes::%{_id}%::undo.when} to now
delete {mute::%arg-1's uuid%}
broadcast "%{prefix}% &e%arg-1% &7has been unmuted by &e%player% &7for &c%arg-2%"
else:
send "%{prefix}% &cThis player isn't muted"
else:
send "%{prefix}% &cThis player isn't muted"
else:
send {@usage.unmute}
on chat:
if {mute::%player's uuid%} is set:
set {_id} to {mute::%player's uuid%}
if {mutes::%{_id}%::time} isn't "perm":
set {_wait} to difference between {mutes::%{_id}%::when} and now
set {_need} to {mutes::%{_id}%::time} parsed as timespan
if {_wait} >= {_need}:
delete {mute::%player's uuid%}
else:
cancel event
send colored "%{prefix}% &cYou can't talk while being muted (time remaining %difference between {_wait} and {_need}%)"
else:
cancel event
send colored "%{prefix}% &cYou can't talk while being muted (Perm muted)"
command /ban [<offline player>] [<text>] [<text>]:
permission: skript.ban
trigger:
if arg-1 is set:
if arg-2 is set:
if arg-3 is set:
set {_time} to arg-2 in lower case
if {_time} isn't "perm":
loop {time.types::*}:
if {_time} contains loop-value:
set {_num} to {_time}
replace all loop-value in {_num} with ""
if Time_Check({_num}) is true:
set {_length} to "%{_num}% %loop-index%"
exit loop
else:
set {_length} to {_time}
if {_length} is set:
add 1 to {ban.count}
set {bans::%{ban.count}%::player} to arg-1
set {bans::%{ban.count}%::staff} to player
set {bans::%{ban.count}%::reason} to arg-3
set {bans::%{ban.count}%::time} to {_length}
set {bans::%{ban.count}%::when} to now
add {ban.count} to {punish::%arg-1's uuid%::bans::*}
set {ban::%arg-1's uuid%} to {ban.count}
if {_length} isn't "perm":
kick arg-1 due to "&cYou are banned! You can rejoin in %{_length} parsed as timespan% &7Staff: &b%{bans::%{ban.count}%::staff}% &7Reason: &b%{bans::%{ban.count}%::reason}%"
else:
kick arg-1 due to "&cYou are perm banned! &7Staff: &b%{bans::%{ban.count}%::staff}% &7Reason: &b%{bans::%{ban.count}%::reason}%"
broadcast "%{prefix}% &e%arg-1% &7has been banned by &e%player% &7for &c%arg-3% &7(ID: %{ban.count}%)"
else:
send {@format.time}
else:
send {@usage.ban}
else:
send {@usage.ban}
else:
send {@usage.ban}
command /unban [<offline player>] [<text>]:
permission: skript.ban
trigger:
if arg-1 is set:
if arg-2 is set:
if {ban::%arg-1's uuid%} is set:
set {_id} to {ban::%arg-1's uuid%}
if {bans::%{_id}%::time} isn't "perm":
set {_wait} to difference between {bans::%{_id}%::when} and now
if {_wait} < {bans::%{_id}%::time} parsed as timespan:
set {_c} to true
else:
delete {ban::%arg-1's uuid%}
else:
set {_c} to true
if {_c} is true:
set {_id} to {ban::%arg-1's uuid%}
set {bans::%{_id}%::undo.staff} to player
set {bans::%{_id}%::undo.reason} to arg-2
set {bans::%{_id}%::undo.when} to now
delete {ban::%arg-1's uuid%}
broadcast "%{prefix}% &e%arg-1% &7has been unbanned by &e%player% &7for &c%arg-2%"
else:
send "%{prefix}% &cThis player isn't banned"
else:
send "%{prefix}% &cThis player isn't banned"
else:
send {@usage.unban}
else:
send {@usage.unban}
on connect:
if {ban::%player's uuid%} is set:
set {_id} to {ban::%player's uuid%}
if {bans::%{_id}%::time} isn't "perm":
set {_wait} to difference between {bans::%{_id}%::when} and now
set {_need} to {bans::%{_id}%::time} parsed as timespan
if {_wait} >= {_need}:
delete {ban::%player's uuid%}
else:
kick player due to "&cYou are banned! You can rejoin in %difference between {_wait} and {_need}% &7Since: &b%{bans::%{_id}%::when}% &7Staff: &b%{bans::%{_id}%::staff}% &7Reason: &b%{bans::%{_id}%::reason}%"
else:
kick player due to "&cYou are perm banned! &7Since: &b%{bans::%{_id}%::when}% &7Staff: &b%{bans::%{_id}%::staff}% &7Reason: &b%{bans::%{_id}%::reason}%"