· 7 years ago · Dec 25, 2018, 01:10 PM
1script options:
2 $ db url jdbc:mysql://127.0.01:3306/banter
3 $ db username banter
4 $ db password lUp7uGMctFGS2YmQ
5options:
6 Logo: &cElysian&7 »
7 BanHeader: &4✖ &cElysian &4✖
8 KickHeader: &4✖ &cElysian &4✖
9 Activated: &7The &aBan Manager&7 has been loaded.
10
11 Format_Days: days
12 Format_Day: day
13 Format_Hours: hours
14 Format_Hour: hour
15 Format_Minutes: minutes
16 Format_Minute: minute
17 Format_Seconds: seconds
18 Format_Second: second
19
20 Ban_Perm_Line1: &cYou've been banned from &aElysian &4PERMANENTLY&c.
21 Ban_Perm_Line2: &7Reason: &c%{_getReason}%
22 Ban_Perm_Line3: &6» &7Send your appeal to /u/doyouevenbanter_ &6«
23
24 Ban_Temp_Line1: &cYou've been banned from &aElysian&c for &a%{_parameter}%&c.
25 Ban_Temp_Line2: &7Reason: &c%{_getReason}%
26 Ban_Temp_Line3: %nl%&7Remaining time: &a%{_getUNIXTime}%
27 Ban_Temp_Line4: %nl%&6» &7Send your appeal to /u/doyouevenbanter_ &6«
28
29 Kick_Line1: &cYou've been kicked by &a%player%&c.
30 Kick_Line2: &cYou've been kicked by &aCONSOLE&c.
31 Kick_Reason: &7Reason: &c%arg-2%
32
33 Mute_Perm: &6» &cYou've been muted &4PERMANENTLY&c.
34 Mute_Reason: &6» &7Reason: &c%{_getReason}%
35
36 Mute_Temp: &6» &cYou've been muted for &e%{_parameter}%&c.
37 Mute_Reason: &6» &7Reason: &c%{_getReason}%
38 Mute_TimeEnd: &6» &7Remaining time: &a%{_getUNIXTime}%
39
40 ConsoleName: CONSOLE
41 NoPermission: &fYou do not have permissions to use this command!
42 NoName: &cPlease enter a vaild player name
43 NotAllowedSize: &cPlease select an integer between 1 and 12
44 NoSelfKick: &cYou can't kick yourself
45 NoSelfBan: &cYou can't ban yourself
46 NoSelfMute: &cYou can't mute yourself
47 AlreadyBanned: &cThis player has been already banned
48 AlreadyMuted: &cThis player has been already muted
49 PlayerNotBanned: &cThis player isn't banned
50 PlayerNotMuted: &cThis player isn't muted
51 NoInteger: &cPlease enter an integer
52 NoTime: &cPlease enter a vaild parameter (seconds, minutes, hours, days)
53 NoReason: &cPlease enter a reason
54 PlayerNotFound: &cThat player couldn't be found
55 IPNotFound: &cThat IP address couldn't be found
56 PlayerWasUnbanned: &aThe player has been unbanned
57 PlayerWasUnmuted: &aThe player has been unmuted
58
59 NoHistory: &7No logs were found from that player
60
61# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
62
63on load:
64 $ thread
65 update "CREATE TABLE if NOT EXISTS `Ban` (`Player` varchar(255),`Time` varchar(255),`Executed` varchar(255),`Reason` varchar(255),`FromPlayer` varchar(255))"
66 $ thread
67 update "CREATE TABLE if NOT EXISTS `Mute` (`Player` varchar(255),`Time` varchar(255),`Executed` varchar(255),`Reason` varchar(255),`FromPlayer` varchar(255))"
68 $ thread
69 update "CREATE TABLE if NOT EXISTS `IP` (`Player` varchar(255),`IP` varchar(255),`UUID` varchar(255))"
70 $ thread
71 update "CREATE TABLE if NOT EXISTS `History` (`Player` varchar(255),`Log` varchar(255))"
72 $ thread
73 update "CREATE TABLE if NOT EXISTS `Presets` (`Name` varchar(255),`Command` varchar(255))"
74 if {Bans.Tables.Alter} is not set:
75 set {Bans.Tables.Alter} to true
76 $ thread
77 update "ALTER TABLE Ban ADD UNIQUE (Player, Time, Executed, Reason, FromPlayer)"
78 $ thread
79 update "ALTER TABLE Mute ADD UNIQUE (Player, Time, Executed, Reason, FromPlayer)"
80 $ thread
81 update "ALTER TABLE IP ADD UNIQUE (Player, UUID)"
82 $ thread
83 update "ALTER TABLE History ADD UNIQUE (Player, Log)"
84 $ thread
85 update "ALTER TABLE Presets ADD UNIQUE (Name, Command)"
86 broadcast "{@Logo} {@Activated}"
87
88function getIP(p_name:text) :: text:
89 set {_SetResult::*} to objects in column "IP" from result of query "SELECT * FROM IP WHERE Player = '%{_p_name}%'"
90 set {_getResult} to false
91 loop {_SetResult::*}:
92 set {_getResult} to true
93 if {_getResult} is true:
94 return "%{_SetResult::*}%"
95 else:
96 return "false"
97
98function getUUID(p_name:text) :: text:
99 set {_SetResult::*} to objects in column "UUID" from result of query "SELECT * FROM IP WHERE Player = '%{_p_name}%'"
100 set {_getResult} to false
101 loop {_SetResult::*}:
102 set {_getResult} to true
103 if {_getResult} is true:
104 return "%{_SetResult::*}%"
105 else:
106 return "false"
107
108function getAccounts(p_name: text) :: text:
109 if {_p_name} does not contain ".":
110 set {_ip} to getIP({_p_name})
111 else:
112 set {_ip} to {_p_name}
113 set {_SetResult::*} to objects in column "Player" from result of query "SELECT Player FROM IP WHERE IP = '%{_ip}%'"
114 return "%{_SetResult::*}%"
115
116function getPlayers(p_name: text = "") :: texts:
117 set {_SetResult::*} to objects in column "Player" from result of query "SELECT Player FROM IP WHERE Player LIKE '%%%{_p_name}%%%'"
118 if {_SetResult::*} is set:
119 return {_SetResult::*}
120
121function RemoveBannedPlayer(p_name:text):
122 set {_SetResult::*} to objects in column "Player" from result of query "SELECT * FROM Ban WHERE Player = '%{_p_name}%'"
123 set {_getResult} to false
124 loop {_SetResult::*}:
125 if loop-value is {_p_name}:
126 set {_getResult} to true
127 if {_getResult} is true:
128 update "DELETE FROM Ban WHERE Player = '%{_p_name}%'"
129
130function getBannedPlayer(p_name:text, column:text) :: text:
131 set {_SetResult::*} to objects in column "%{_column}%" from result of query "SELECT * FROM Ban WHERE Player = '%{_p_name}%'"
132 if {_column} is not "Player":
133 return "%{_SetResult::*}%"
134 else:
135 set {_getResult} to false
136 loop {_SetResult::*}:
137 if loop-value is {_p_name}:
138 set {_getResult} to true
139 if {_getResult} is true:
140 return "true"
141 else:
142 return "false"
143
144function MutePlayer(p_name:text, p_time:text, p_reason:text, from:text):
145 set {_SetResult::*} to objects in column "Player" from result of query "SELECT * FROM Mute WHERE Player = '%{_p_name}%'"
146 set {_getResult} to false
147 loop {_SetResult::*}:
148 if loop-value is {_p_name}:
149 set {_getResult} to true
150 if {_getResult} is false:
151 update "INSERT INTO `Mute` (`Player`,`Time`,`Executed`,`Reason`,`FromPlayer`) VALUES ('%{_p_name}%', '%{_p_time}%', '%unix time%', '%{_p_reason}%', '%{_from}%')"
152
153function getMutedPlayer(p_name:text, column:text) :: text:
154 set {_SetResult::*} to objects in column "%{_column}%" from result of query "SELECT * FROM Mute WHERE Player = '%{_p_name}%'"
155 if {_column} is not "Player":
156 return "%{_SetResult::*}%"
157 else:
158 set {_getResult} to false
159 loop {_SetResult::*}:
160 if loop-value is {_p_name}:
161 set {_getResult} to true
162 if {_getResult} is true:
163 return "true"
164 else:
165 return "false"
166
167function RemoveMutedPlayer(p_name:text):
168 set {_SetResult::*} to objects in column "Player" from result of query "SELECT * FROM Mute WHERE Player = '%{_p_name}%'"
169 set {_getResult} to false
170 loop {_SetResult::*}:
171 if loop-value is {_p_name}:
172 set {_getResult} to true
173 if {_getResult} is true:
174 update "DELETE FROM Mute WHERE Player = '%{_p_name}%'"
175
176# UNIX algorithm calculation in Skript - isn't it awesome? ã‚·
177# This calculation method may take some performance while calculating big numbers but it's the easiest way.
178# I've already used this method in an Java algorithm.
179function UNIX_Algorithm(executed:text, time:text, parameter:text) :: text:
180 set {_executed} to {_executed} parsed as number
181 if {_parameter} contains "second":
182 set {_time} to {_time} parsed as number
183 else:
184 if {_parameter} contains "minute":
185 set {_time} to {_time} parsed as number
186 set {_time} to ({_time}*60)
187 else:
188 if {_parameter} contains "hour":
189 set {_time} to {_time} parsed as number
190 set {_time} to ((({_time}*60)*60))
191 else:
192 if {_parameter} contains "day":
193 set {_time} to {_time} parsed as number
194 set {_time} to (((({_time}*24)*60)*60))
195 set {_Calculate.UNIX} to ({_executed}+{_time})
196 set {_Calculate.Now.UNIX} to unix time
197 set {_Calculate.Result} to ({_Calculate.UNIX}-{_Calculate.Now.UNIX})
198 set {_UNIX.DAYS} to 0
199 set {_UNIX.HOURS} to 0
200 set {_UNIX.MINUTES} to 0
201 set {_UNIX.SECONDS} to 0
202 while {_Calculate.Result} is bigger or equal to 86400:
203 set {_UNIX.DAYS} to ({_UNIX.DAYS}+1)
204 set {_Calculate.Result} to ({_Calculate.Result}-86400)
205 if {_Calculate.Result} is smaller than 86400:
206 while {_Calculate.Result} is bigger or equal to 3600:
207 set {_UNIX.HOURS} to ({_UNIX.HOURS}+1)
208 set {_Calculate.Result} to ({_Calculate.Result}-3600)
209 if {_Calculate.Result} is smaller than 3600:
210 while {_Calculate.Result} is bigger or equal to 60:
211 set {_UNIX.MINUTES} to ({_UNIX.MINUTES}+1)
212 set {_Calculate.Result} to ({_Calculate.Result}-60)
213 if {_Calculate.Result} is smaller than 60:
214 set {_UNIX.SECONDS} to {_Calculate.Result}
215 if "%{_UNIX.DAYS}%", "%{_UNIX.HOURS}%", "%{_UNIX.MINUTES}%" or "%{_UNIX.SECONDS}%" contains "-":
216 return "false"
217 else:
218 return "%{_UNIX.DAYS}%'d %{_UNIX.HOURS}%'h %{_UNIX.MINUTES}%'m %{_UNIX.SECONDS}%'s"
219
220function CheckMutedPlayer(p_name:text) :: text:
221 set {_uuid} to getUUID("%{_p_name}%")
222 set {_getReason} to getMutedPlayer("%{_uuid}%", "Reason")
223 set {_getMuteState} to getMutedPlayer("%{_uuid}%", "Time")
224 if {_getMuteState} is "permanently":
225 set {_p_name} to "%{_p_name}%" parsed as player
226 send "" to {_p_name}
227 send " {@Mute_Perm}" to {_p_name}
228 send " {@Mute_Reason}" to {_p_name}
229 send "" to {_p_name}
230 return "true"
231 else:
232 add {_getMuteState} split at " " to {_Cache::*}
233 set {_Cache::1} to "%{_Cache::1}%" parsed as number
234 set {_Cache::2} to "%{_Cache::2}%" parsed as text
235 if {_Cache::2} contains "day":
236 if {_Cache::1} is bigger than 1:
237 set {_parameter} to "%{_Cache::1}% {@Format_Days}"
238 else:
239 set {_parameter} to "%{_Cache::1}% {@Format_Day}"
240 if {_Cache::2} contains "hour":
241 if {_Cache::1} is bigger than 1:
242 set {_parameter} to "%{_Cache::1}% {@Format_Hours}"
243 else:
244 set {_parameter} to "%{_Cache::1}% {@Format_Hour}"
245 if {_Cache::2} contains "minute":
246 if {_Cache::1} is bigger than 1:
247 set {_parameter} to "%{_Cache::1}% {@Format_Minutes}"
248 else:
249 set {_parameter} to "%{_Cache::1}% {@Format_Minute}"
250 if {_Cache::2} contains "second":
251 if {_Cache::1} is bigger than 1:
252 set {_parameter} to "%{_Cache::1}% {@Format_Seconds}"
253 else:
254 set {_parameter} to "%{_Cache::1}% {@Format_Second}"
255 set {_uuid} to getUUID("%{_p_name}%")
256 set {_getExecuted} to getMutedPlayer("%{_uuid}%", "Executed")
257 set {_getTime} to getMutedPlayer("%{_uuid}%", "Time")
258 add {_getTime} split at " " to {_Parameter::*}
259 set {_getUNIXTime} to UNIX_Algorithm({_getExecuted}, {_Parameter::1}, {_Parameter::2})
260 if {_getUNIXTime} is "false":
261 set {_uuid} to getUUID("%{_p_name}%")
262 RemoveMutedPlayer("%{_uuid}%")
263 else:
264 set {_p_name} to "%{_p_name}%" parsed as player
265 send "" to {_p_name}
266 send " {@Mute_Temp}" to {_p_name}
267 send " {@Mute_Reason}" to {_p_name}
268 send " {@Mute_TimeEnd}" to {_p_name}
269 send "" to {_p_name}
270 return "true"
271
272function KickPlayer(p_name:text):
273 set {_uuid} to getUUID("%{_p_name}%")
274 set {_getReason} to getBannedPlayer("%{_uuid}%", "Reason")
275 set {_getBanState} to getBannedPlayer("%{_uuid}%", "Time")
276 if {_getBanState} is "permanently":
277 set {_p_name} to {_p_name} parsed as player
278 kick {_p_name} due to "{@BanHeader}%nl%&f%nl%{@Ban_Perm_Line1}%nl%{@Ban_Perm_Line2}%nl%&f%nl%{@Ban_Perm_Line3}"
279 else:
280 add {_getBanState} split at " " to {_Cache::*}
281 set {_Cache::1} to "%{_Cache::1}%" parsed as number
282 set {_Cache::2} to "%{_Cache::2}%" parsed as text
283 if {_Cache::2} contains "day":
284 if {_Cache::1} is bigger than 1:
285 set {_parameter} to "%{_Cache::1}% {@Format_Days}"
286 else:
287 set {_parameter} to "%{_Cache::1}% {@Format_Day}"
288 if {_Cache::2} contains "hour":
289 if {_Cache::1} is bigger than 1:
290 set {_parameter} to "%{_Cache::1}% {@Format_Hours}"
291 else:
292 set {_parameter} to "%{_Cache::1}% {@Format_Hour}"
293 if {_Cache::2} contains "minute":
294 if {_Cache::1} is bigger than 1:
295 set {_parameter} to "%{_Cache::1}% {@Format_Minutes}"
296 else:
297 set {_parameter} to "%{_Cache::1}% {@Format_Minute}"
298 if {_Cache::2} contains "second":
299 if {_Cache::1} is bigger than 1:
300 set {_parameter} to "%{_Cache::1}% {@Format_Seconds}"
301 else:
302 set {_parameter} to "%{_Cache::1}% {@Format_Second}"
303 set {_uuid} to getUUID("%{_p_name}%")
304 set {_getExecuted} to getBannedPlayer("%{_uuid}%", "Executed")
305 set {_getTime} to getBannedPlayer("%{_uuid}%", "Time")
306 add {_getTime} split at " " to {_Parameter::*}
307 set {_getUNIXTime} to UNIX_Algorithm({_getExecuted}, {_Parameter::1}, {_Parameter::2})
308 if {_getUNIXTime} is "false":
309 set {_uuid} to getUUID("%{_p_name}%")
310 RemoveBannedPlayer("%{_uuid}%")
311 else:
312 set {_p_name} to {_p_name} parsed as player
313 kick {_p_name} due to "{@BanHeader}%nl%&f%nl%{@Ban_Temp_Line1}%nl%{@Ban_Temp_Line2}%nl%{@Ban_Temp_Line3}%nl%&f%nl%{@Ban_Temp_Line4}"
314
315function BanPlayer(p_name:text, p_time:text, p_reason:text, from:text):
316 set {_SetResult::*} to objects in column "Player" from result of query "SELECT * FROM Ban WHERE Player = '%{_p_name}%'"
317 set {_getResult} to false
318 loop {_SetResult::*}:
319 if loop-value is {_p_name}:
320 set {_getResult} to true
321 if {_getResult} is false:
322 update "INSERT INTO `Ban` (`Player`,`Time`,`Executed`,`Reason`,`FromPlayer`) VALUES ('%{_p_name}%', '%{_p_time}%', '%unix time%', '%{_p_reason}%', '%{_from}%')"
323 $ thread
324 set {_player} to value of sql var "pn::%{_p_name}%"
325 set {_player} to {_player} parsed as offlineplayer
326 {_player} is online
327 KickPlayer("%{_player}%")
328
329function AddHistoryLog(p_name:text, p_log:text):
330 update "INSERT INTO `History` (`Player`,`Log`) VALUES ('%{_p_name}%', '%{_p_log}%')"
331
332function setIPofPlayer(p_name:text, ip:text, uuid:text):
333 if {_uuid} is not "-":
334 set {_SetResult::*} to objects in column "UUID" from result of query "SELECT * FROM IP WHERE UUID = '%{_uuid}%'"
335 set {_GetResult} to false
336 loop {_SetResult::*}:
337 set {_GetResult} to true
338 if {_GetResult} is true:
339 update "UPDATE `IP` SET `IP` = '%{_ip}%' WHERE `IP`.`UUID` = '%{_uuid}%'"
340 update "UPDATE `IP` SET `Player` = '%{_p_name}%' WHERE `IP`.`UUID` = '%{_uuid}%'"
341 else:
342 set {_SetResult::*} to objects in column "Player" from result of query "SELECT * FROM IP WHERE Player = '%{_p_name}%'"
343 set {_GetResult} to false
344 loop {_SetResult::*}:
345 set {_GetResult} to true
346 if {_GetResult} is true:
347 update "UPDATE `IP` SET `IP` = '%{_ip}%' WHERE `IP`.`Player` = '%{_p_name}%'"
348 update "UPDATE `IP` SET `UUID` = '-' WHERE `IP`.`Player` = '%{_p_name}%'"
349 set {_SetResult2::*} to objects in column "IP" from result of query "SELECT * FROM IP WHERE IP = '%{_ip}%'"
350 set {_GetResult2} to false
351 loop {_SetResult2::*}:
352 set {_GetResult2} to true
353 if {_GetResult2} is false:
354 update "INSERT INTO `IP` (`IP`,`Player`,`UUID`) VALUES ('%{_ip}%', '%{_p_name}%', '%{_uuid}%')"
355 else:
356 if {_uuid} is not "-":
357 $ thread
358 set {_SetResult2::*} to objects in column "UUID" from result of query "SELECT * FROM IP WHERE UUID = '%{_uuid}%'"
359 set {_GetResult2} to false
360 loop {_SetResult2::*}:
361 if loop-value is {_uuid}:
362 set {_GetResult2} to true
363 else:
364 set {_SetResult2::*} to objects in column "Player" from result of query "SELECT * FROM IP WHERE Player = '%{_p_name}%'"
365 set {_GetResult2} to false
366 loop {_SetResult2::*}:
367 if loop-value is {_p_name}:
368 set {_GetResult2} to true
369 if {_GetResult2} is false:
370 update "INSERT INTO `IP` (`IP`,`Player`,`UUID`) VALUES ('%{_ip}%', '%{_p_name}%', '%{_uuid}%')"
371
372function ipExists(ip:text) :: boolean:
373 set {_SetResult::*} to objects in column "IP" from result of query "SELECT * FROM IP WHERE IP = '%{_ip}%'"
374 set {_getResult} to false
375 loop {_SetResult::*}:
376 if loop-value is "%{_ip}%":
377 set {_getResult} to true
378 return {_getResult}
379
380function WasPlayerAlreadyOnline(p_name:text) :: text:
381 set {_SetResult::*} to objects in column "Player" from result of query "SELECT * FROM IP WHERE Player = '%{_p_name}%'"
382 set {_getResult} to false
383 loop {_SetResult::*}:
384 if loop-value is "%{_p_name}%":
385 set {_getResult} to true
386 if {_getResult} is true:
387 return "true"
388 else:
389 return "false"
390
391function getPreset(name: text) :: text:
392 set {_SetResult::*} to objects in column "Name" from result of query "SELECT * FROM Presets WHERE Name = '%{_name}%'"
393 set {_getResult} to false
394 loop {_SetResult::*}:
395 if loop-value is "%{_name}%":
396 set {_getResult} to true
397 if {_getResult} is true:
398 return "true"
399 else:
400 return "false"
401
402function addPreset(name: text, cmd: text):
403 update "INSERT INTO `Presets` (`Name`,`Command`) VALUES ('%{_name}%', '%{_cmd}%')"
404
405function deletePreset(name: text):
406 update "DELETE FROM Presets WHERE Name = '%{_name}%'"
407
408command /punish [<text>]:
409 executable by: players
410 trigger:
411 if player does not have permission "punishments.punish":
412 send "{@Logo} {@NoPermission}"
413 else:
414 if arg-1 is not set:
415 send "{@Logo} {@NoName}"
416 send "{@Logo} &a/punish &c<player>"
417 else:
418 if arg-1 is player:
419 send "{@Logo} &cYou can't punish yourself!"
420 else:
421 $ thread
422 set {_getIP} to WasPlayerAlreadyOnline("%arg-1%")
423 if {_getIP} is "false":
424 send "{@Logo} {@PlayerNotFound}"
425 else:
426 $ thread
427 set {_punishmentnames::*} to objects in column "Name" from result of query "SELECT * FROM Presets"
428 $ thread
429 set {_punishmentcommands::*} to objects in column "Command" from result of query "SELECT * FROM Presets"
430 if size of {_punishmentnames::*} is 0:
431 send "{@Logo} &cThere are currently no presets made!"
432 else:
433 open chest with ceil(size of {_punishmentnames::*}/9) rows named "&aPreset Punishments" to sender
434 loop {_punishmentnames::*}:
435 set {_cmd} to {_punishmentcommands::%loop-index%}
436 set {_name} to "%loop-value%"
437 replace all "_" with " " in {_name}
438 replace all "%%player%%" with "%arg-1%" in {_cmd}
439 add 1 to {_slot}
440 evaluate "format slot {_slot} - 1 of sender with a redstone block named ""&a%{_name}%"" with lore ""&7&o%{_cmd}%"" to close then run [sender command ""%{_cmd}%""]"
441
442command /presets [<text>] [<text>] [<text>]:
443 aliases: /preset
444 trigger:
445 if player does not have permission "punishments.presets":
446 send "{@Logo} {@NoPermission}"
447 else if arg-1 is "add":
448 if arg-2 is not set:
449 send "{@Logo} &cYou are missing a punishment name!"
450 else if arg-3 is not set:
451 send "{@Logo} &cYou are missing a command!"
452 else if getPreset(arg-2) is "true":
453 send "{@Logo} &cThe preset punishment &a%arg-2%&7 is already made! Do /preset delete %arg-2% then remake it."
454 else:
455 $ thread
456 addPreset(arg-2, arg-3)
457 send "{@Logo} &7Added punishment &a%arg-2%&7 to run &a%arg-3%"
458 else if arg-1 is "delete":
459 if arg-2 is not set:
460 send "{@Logo} &cYou are missing a punishment name!"
461 else if arg-3 is set:
462 send "{@Logo} &cUnexpected argument: &a%arg-3%"
463 else if getPreset(arg-2) is "false":
464 send "{@Logo} &cThere is no preset punishment named &a%arg-2%"
465 else:
466 $ thread
467 deletePreset(arg-2)
468 send "{@Logo} &7Deleted preset punishment &a%arg-2%"
469 else:
470 send "{@Logo} &7/presets add &c<punishment name> <command>"
471 send "{@Logo} &7/presets delete &c<punishment name>"
472 send "{@Logo} &7&oUse %%player%% to represent a player in the command."
473 send "{@Logo} &7&oUse a _ to represent a space in a punishment name."
474
475on connect:
476 set {_ban} to getBannedPlayer("%player's uuid%", "Player")
477 if {_ban} is not "true":
478 $ thread
479 set {_ip} to getIP("%player%")
480 if {_ip} is not set:
481 wait 1 second
482 $ thread
483 set {_accounts} to getAccounts("%player%")
484 replace all " and " with ", " in {_accounts}
485 set {_accounts::*} to {_accounts} split at ", "
486 size of {_accounts::*} is greater than 1
487 loop {_accounts::*}:
488 "%loop-value%" is not "%player%"
489 if {ubldata::playertouuid::%loop-value%} is set:
490 set {_uuid} to {ubldata::playertouuid::%loop-value%}
491 {ubl::exempt::%{_uuid}%} is not set
492 send "&a%player%&7 is a alt of &a%loop-value%&7 who is UBLed!" to all ops
493 $ thread
494 set {_ip} to getIP("%loop-value%")
495 send "&7IP:&a %{_ip}%%nl%&7&oScreenshot this and send it to the courtroom to get their alt UBLed for alting!" to all ops
496 command "/tempban %player% 7 days UBL Evasion of %loop-value%"
497 stop loop
498 set {_ban::%loop-value%} to getBannedPlayer("%{_uuid}%", "Player")
499 {_ban::%loop-value%} is "true"
500 $ thread
501 set {_type} to getBannedPlayer("%{_uuid}%", "Time")
502 $ thread
503 set {_reason} to getBannedPlayer("%{_uuid}%", "Reason")
504 $ thread
505 set {_executor} to getBannedPlayer("%{_uuid}%", "Executed")
506 if {_type} is "permanently":
507 $ thread
508 BanPlayer("%player's uuid%", "%{_type}%", "%{_reason}%" , "%{_executor}%")
509 $ thread
510 AddHistoryLog("%player's uuid%", "&c[%now%] %player% has been banned by %{_executor}% due to ""%{_reason}%"". He is also a alt of %loop-value% who is banned.")
511 else:
512 set {_time} to getBannedPlayer("%{_uuid}%", "Time")
513 $ thread
514 BanPlayer("%player's uuid%", "%{_time}%", "%{_reason}%" , "%{_executor}%")
515 $ thread
516 AddHistoryLog("%player's uuid%", "&c[%now%] %player% has been tempbanned by %{_executor}% due to ""%{_reason}%"" for %{_time}%. He is also a alt of %loop-value% who is banned.")
517 set {_player} to "%loop-value%"
518 set {_ban} to true
519 stop loop
520 else:
521 set {_uuid} to player's uuid
522 if {_ban} is "true":
523 set {_getReason} to getBannedPlayer("%{_uuid}%", "Reason")
524 set {_getBanState} to getBannedPlayer("%{_uuid}%", "Time")
525 if {_getBanState} is "permanently":
526 kick player due to "{@BanHeader}%nl%&f%nl%{@Ban_Perm_Line1}%nl%{@Ban_Perm_Line2}%nl%&f%nl%{@Ban_Perm_Line3}"
527 else:
528 add {_getBanState} split at " " to {_Cache::*}
529 set {_Cache::1} to "%{_Cache::1}%" parsed as number
530 set {_Cache::2} to "%{_Cache::2}%" parsed as text
531 if {_Cache::2} contains "day":
532 if {_Cache::1} is bigger than 1:
533 set {_parameter} to "%{_Cache::1}% {@Format_Days}"
534 else:
535 set {_parameter} to "%{_Cache::1}% {@Format_Day}"
536 if {_Cache::2} contains "hour":
537 if {_Cache::1} is bigger than 1:
538 set {_parameter} to "%{_Cache::1}% {@Format_Hours}"
539 else:
540 set {_parameter} to "%{_Cache::1}% {@Format_Hour}"
541 if {_Cache::2} contains "minute":
542 if {_Cache::1} is bigger than 1:
543 set {_parameter} to "%{_Cache::1}% {@Format_Minutes}"
544 else:
545 set {_parameter} to "%{_Cache::1}% {@Format_Minute}"
546 if {_Cache::2} contains "second":
547 if {_Cache::1} is bigger than 1:
548 set {_parameter} to "%{_Cache::1}% {@Format_Seconds}"
549 else:
550 set {_parameter} to "%{_Cache::1}% {@Format_Second}"
551 set {_getExecuted} to getBannedPlayer("%{_uuid}%", "Executed")
552 set {_getTime} to getBannedPlayer("%{_uuid}%", "Time")
553 add {_getTime} split at " " to {_Parameter::*}
554 set {_getUNIXTime} to UNIX_Algorithm({_getExecuted}, {_Parameter::1}, {_Parameter::2})
555 if {_getUNIXTime} is "false":
556 RemoveBannedPlayer("%{_uuid}%")
557 else:
558 kick player due to "{@BanHeader}%nl%&f%nl%{@Ban_Temp_Line1}%nl%{@Ban_Temp_Line2}%nl%{@Ban_Temp_Line3}%nl%&f%nl%{@Ban_Temp_Line4}"
559
560on join:
561 $ thread
562 setIPofPlayer("%player%", "%player's ip%", "%player's uuid%")
563 if "%ip of player%" contains "151.80.11.", "164.132.80.", "176.31.75.", "178.33.27.", "91.121.231.", "69.130." or "82.31.16":
564 kick player due to "&cCompromised account detected.%nl%&c&oIf you believe this is in error, contact a staff member."
565 $ thread
566 set {_text} to text from "https://api.mojang.com/users/profiles/minecraft/%player%"
567 if {_text} does not contain "id":
568 kick player due to "&cCompromised account detected.%nl%&c&oIf you believe this is in error, contact a staff member."
569
570command /history [<text>]:
571 aliases: lookup
572 trigger:
573 if player does not have permission "punishments.history":
574 send "{@Logo} {@NoPermission}"
575 else:
576 if arg-1 is not set:
577 send "{@Logo} {@NoName}"
578 send "{@Logo} &a/history &c<player>"
579 else:
580 $ thread
581 set {_getIP} to WasPlayerAlreadyOnline("%arg-1%")
582 if {_getIP} is "false":
583 send "{@Logo} {@PlayerNotFound}"
584 else:
585 set {_BannedMoreInfo} to ""
586 set {_MutedMoreInfo} to ""
587 $ thread
588 set {_uuid} to getUUID("%arg-1%")
589 $ thread
590 set {_Banned?} to getBannedPlayer("%{_uuid}%", "Player")
591 if {_Banned?} is "true":
592 set {_Banned?} to "&a&l✔"
593 else:
594 set {_Banned?} to "&c&l✖"
595 $ thread
596 set {_uuid} to getUUID(arg-1)
597 $ thread
598 set {_Muted?} to getMutedPlayer("%{_uuid}%", "Player")
599 if {_Muted?} is "true":
600 set {_Muted?} to "&a&l✔"
601 else:
602 set {_Muted?} to "&c&l✖"
603 $ thread
604 set {_uuid} to getUUID(arg-1)
605 $ thread
606 set {_SetResult::*} to objects in column "Log" from result of query "SELECT * FROM History WHERE Player = '%{_uuid}%'"
607 set {_getResult} to false
608 loop {_SetResult::*}:
609 set {_getResult} to true
610 send ""
611 if {_getResult} is true:
612 loop 150 times:
613 if {_SetResult::%loop-number%} is set:
614 send "%{_SetResult::%loop-number%}%"
615 else:
616 stop loop
617 else:
618 send "{@NoHistory}"
619 $ thread
620 set {_ip} to getIP("%arg-1%")
621 send "&f&m=====================&6&l HISTORY &f&m====================="
622 send " &eCurrently banned: %{_Banned?}% &7|| &eCurrently muted: %{_Muted?}%"
623 send " &7IP: &a%{_ip}%"
624 send ""
625
626command /accounts [<text>]:
627 aliases: whois
628 trigger:
629 if player does not have permission "punishments.accounts":
630 send "{@Logo} {@NoPermission}"
631 else:
632 if arg-1 is not set:
633 send "{@Logo} {@NoName}"
634 send "{@Logo} &a/accounts &c<player/ip>"
635 else if arg-1 contains ".":
636 $ thread
637 set {_getIP} to ipExists(arg-1)
638 if {_getIP} is false:
639 send "{@Logo} {@IPNotFound}"
640 else:
641 $ thread
642 set {_accounts} to getAccounts("%arg-1%")
643 send "{@Logo} &7Accounts under the IP &a%arg-1%&7: &c%{_accounts}%"
644 else:
645 $ thread
646 set {_getIP} to WasPlayerAlreadyOnline("%arg-1%")
647 if {_getIP} is "false":
648 send "{@Logo} {@PlayerNotFound}"
649 else:
650 $ thread
651 set {_accounts} to getAccounts("%arg-1%")
652 send "{@Logo} &a%arg-1%'s&7 accounts: &c%{_accounts}%"
653
654command /players [<text>]:
655 trigger:
656 if player does not have permission "punishments.players":
657 send "{@Logo} {@NoPermission}"
658 else:
659 if arg-1 is not set:
660 $ thread
661 set {_players::*} to getPlayers()
662 else if arg-1 is set:
663 $ thread
664 set {_players::*} to getPlayers("%arg-1%")
665 if {_players::*} is not set:
666 send "{@Logo} &cNo players were found containing %arg-1%"
667 else:
668 if arg-1 is set:
669 send "{@Logo} &7Accounts containg &a%arg-1%&7: &c%{_players::*}% &7&o(%size of {_players::*}%&7 accounts)"
670 else:
671 send "{@Logo} &a%size of {_players::*}%&7 total accounts"
672
673command /mute [<text>] [<text>]:
674 aliases: mute
675 trigger:
676 if player does not have permission "punishments.mute":
677 send "{@Logo} {@NoPermission}"
678 else:
679 if arg-1 is not set:
680 send "{@Logo} {@NoName}"
681 send "{@Logo} &a/mute &c<player> <reason>"
682 else:
683 if arg-1 is player:
684 send "{@Logo} {@NoSelfMute}"
685 else:
686 $ thread
687 set {_getIP} to WasPlayerAlreadyOnline("%arg-1%")
688 if {_getIP} is "false":
689 send "{@Logo} {@PlayerNotFound}"
690 else:
691 $ thread
692 set {_uuid} to getUUID("%arg-1%")
693 $ thread
694 set {_getResult} to getMutedPlayer("%{_uuid}%", "Player")
695 if {_getResult} is "true":
696 send "{@Logo} {@AlreadyMuted}"
697 else:
698 if arg 2 is not set:
699 send "{@Logo} {@NoReason}"
700 send "{@Logo} &a/mute &e%arg-1% &c<reason>"
701 else:
702 if sender is player:
703 set {_String.From} to "%player%"
704 else:
705 set {_String.From} to "{@ConsoleName}"
706 $ thread
707 set {_uuid} to getUUID("%arg-1%")
708 $ thread
709 MutePlayer("%{_uuid}%", "permanently", arg-2, {_String.From})
710 $ thread
711 AddHistoryLog("%{_uuid}%", "&e[%now%] %arg-1% has been muted by %{_String.From}% due to ""%arg-2%"".")
712 broadcast "{@Logo} &a%arg-1%&7 was muted by &a%{_String.From}% &7due to &c%arg-2%"
713
714command /tempmute [<text>] [<integer>] [<text>] [<text>]:
715 aliases: tempmute
716 trigger:
717 if player does not have permission "punishments.tempmute":
718 send "{@Logo} {@NoPermission}"
719 else:
720 if arg-1 is not set:
721 send "{@Logo} {@NoName}"
722 send "{@Logo} &a/tempmute &c<player> <integer> <parameter> <reason>"
723 else:
724 if arg-1 is player:
725 send "{@Logo} {@NoSelfMute}"
726 else:
727 $ thread
728 set {_getIP} to WasPlayerAlreadyOnline("%arg-1%")
729 if {_getIP} is "false":
730 send "{@Logo} {@PlayerNotFound}"
731 else:
732 $ thread
733 set {_uuid} to getUUID("%arg-1%")
734 $ thread
735 set {_getResult} to getMutedPlayer("%{_uuid}%", "Player")
736 if {_getResult} is "true":
737 send "{@Logo} {@AlreadyMuted}"
738 else:
739 if arg-2 is not set:
740 send "{@Logo} {@NoInteger}"
741 send "{@Logo} &a/tempmute &e%arg-1% &c<integer> <parameter> <reason>"
742 else:
743 if arg-2 is bigger than 12000:
744 send "{@Logo} {@NotAllowedSize}"
745 else:
746 if arg-2 is smaller than 1:
747 send "{@Logo} {@NotAllowedSize}"
748 else:
749 if arg-3 is not set:
750 send "{@Logo} {@NoTime}"
751 send "{@Logo} &a/tempmute &e%arg-1% %arg-2% &c<parameter> <reason>"
752 else:
753 if arg-3 is not "second", "seconds", "minute", "minutes", "hour", "hours", "day" or "days":
754 send "{@Logo} {@NoTime}"
755 send "{@Logo} &a/tempmute &e%arg-1% %arg-2% &c<parameter> <reason>"
756 else:
757 if arg-4 is not set:
758 send "{@Logo} {@NoReason}"
759 send "{@Logo} &a/tempmute &e%arg-1% %arg-2% %arg-3% &c<reason>"
760 else:
761 if sender is player:
762 set {_String.From} to "%player%"
763 else:
764 set {_String.From} to "{@ConsoleName}"
765 $ thread
766 set {_uuid} to getUUID("%arg-1%")
767 $ thread
768 MutePlayer("%{_uuid}%", "%arg-2% %arg-3%", arg-4, {_String.From})
769 $ thread
770 AddHistoryLog("%{_uuid}%", "&e[%now%] %arg-1% has been tempmuted by %{_String.From}% due to ""%arg-4%"" for %arg-2% %arg-3%.")
771 broadcast "{@Logo} &a%arg-1%&7 has been tempmuted by &a%{_String.From}%&7 due to &c%arg-4%&7 for &a%arg-2% %arg-3%"
772
773command /kick [<player>] [<text>]:
774 aliases: kick
775 trigger:
776 if player does not have permission "punishments.kick":
777 send "{@Logo} {@NoPermission}"
778 else:
779 if arg-1 is not set:
780 send "{@Logo} {@NoName}"
781 send "{@Logo} &a/kick &c<player> <reason>"
782 else:
783 if arg-player is player:
784 send "{@Logo} {@NoSelfKick}"
785 else:
786 if arg-2 is not set:
787 send "{@Logo} {@NoReason}"
788 send "{@Logo} &a/kick &e%arg-1% &c<reason>"
789 else:
790 if sender is player:
791 kick arg-player due to "{@KickHeader}%nl%&f%nl%{@Kick_Line1}%nl%{@Kick_Reason}"
792 $ thread
793 set {_uuid} to getUUID("%arg-1%")
794 $ thread
795 AddHistoryLog("%{_uuid}%", "&b[%now%] %arg-player% has been kicked by %player% due to ""%arg-2%"".")
796 broadcast "{@Logo} &a%arg-1%&7 was kicked by &a%player%&7 due to &c%arg-2%"
797 else:
798 kick arg-player due to "{@KickHeader}%nl%&f%nl%{@Kick_Line2}%nl%{@Kick_Reason}"
799 $ thread
800 set {_uuid} to getUUID("%arg-1%")
801 $ thread
802 AddHistoryLog("%{_uuid}%", "&b[%now%] %arg-player% has been kicked by {@ConsoleName} due to ""%arg-2%"".")
803 broadcast "{@Logo} &a%arg-1%&7 was kicked by &a{@ConsoleName}&7 due to &c%arg-2%"
804
805command /ban [<text>] [<text>]:
806 aliases: ban
807 trigger:
808 if player does not have permission "punishments.ban":
809 send "{@Logo} {@NoPermission}"
810 else:
811 if arg-1 is not set:
812 send "{@Logo} {@NoName}"
813 send "{@Logo} &a/ban &c<player> <reason>"
814 else:
815 if arg-1 is player:
816 send "{@Logo} {@NoSelfBan}"
817 else:
818 $ thread
819 set {_getIP} to WasPlayerAlreadyOnline("%arg-1%")
820 if {_getIP} is "false":
821 send "{@Logo} {@PlayerNotFound}"
822 else:
823 $ thread
824 set {_uuid} to getUUID("%arg-1%")
825 $ thread
826 set {_getResult} to getBannedPlayer("%{_uuid}%", "Player")
827 if {_getResult} is "true":
828 send "{@Logo} {@AlreadyBanned}"
829 else:
830 if arg-2 is not set:
831 send "{@Logo} {@NoReason}"
832 send "{@Logo} &a/ban &e%arg-1% &c<reason>"
833 else:
834 if sender is player:
835 set {_String.From} to "%player%"
836 else:
837 set {_String.From} to "{@ConsoleName}"
838 BanPlayer("%{_uuid}%", "permanently", arg-2, {_String.From})
839 $ thread
840 AddHistoryLog("%{_uuid}%", "&c[%now%] %arg-1% has been banned by %{_String.From}% due to ""%arg-2%"".")
841 broadcast "{@Logo} &a%arg-1%&7 has been banned permanently by &a%{_String.From}%&7 due to&c %arg-2%"
842
843command /tempban [<text>] [<integer>] [<text>] [<text>]:
844 aliases: tempban
845 trigger:
846 if player does not have permission "punishments.tempban":
847 send "{@Logo} {@NoPermission}"
848 else:
849 if arg-1 is not set:
850 send "{@Logo} {@NoName}"
851 send "{@Logo} &a/tempban &c<player> <integer> <parameter> <reason>"
852 else:
853 if arg-1 is player:
854 send "{@Logo} {@NoSelfBan}"
855 else:
856 $ thread
857 set {_getIP} to WasPlayerAlreadyOnline("%arg-1%")
858 if {_getIP} is "false":
859 send "{@Logo} {@PlayerNotFound}"
860 else:
861 $ thread
862 set {_uuid} to getUUID("%arg-1%")
863 $ thread
864 set {_getResult} to getBannedPlayer("%{_uuid}%", "Player")
865 if {_getResult} is "true":
866 send "{@Logo} {@AlreadyBanned}"
867 else:
868 if arg-2 is not set:
869 send "{@Logo} {@NoInteger}"
870 send "{@Logo} &a/tempban &e%arg-1% &c<integer> <parameter> <reason>"
871 else:
872 if arg-2 is bigger than 12000:
873 send "{@Logo} {@NotAllowedSize}"
874 else:
875 if arg-2 is smaller than 1:
876 send "{@Logo} {@NotAllowedSize}"
877 else:
878 if arg-3 is not set:
879 send "{@Logo} {@NoTime}"
880 send "{@Logo} &a/tempban &e%arg-1% %arg-2% &c<parameter> <reason>"
881 else:
882 if arg-3 is not "second", "seconds", "minute", "minutes", "hour", "hours", "day" or "days":
883 send "{@Logo} {@NoTime}"
884 send "{@Logo} &a/tempban &e%arg-1% %arg-2% &c<parameter> <reason>"
885 else:
886 if arg-4 is not set:
887 send "{@Logo} {@NoReason}"
888 send "{@Logo} &a/tempban &e%arg-1% %arg-2% %arg-3% &c<reason>"
889 else:
890 if sender is player:
891 set {_String.From} to "%player%"
892 else:
893 set {_String.From} to "{@ConsoleName}"
894 $ thread
895 set {_uuid} to getUUID("%arg-1%")
896 $ thread
897 BanPlayer("%{_uuid}%", "%arg-2% %arg-3%", "%arg-4%", {_String.From})
898 $ thread
899 AddHistoryLog("%{_uuid}%", "&c[%now%] %arg-1% has been tempbanned by %{_String.From}% due to ""%arg-4%"" for %arg-2% %arg-3%.")
900 broadcast "{@Logo} &a%arg-1%&7 has been tempbanned by &a%{_String.From}%&7 due to&c %arg-4%&7 for &a%arg-2% %arg-3%"
901
902command /pardon [<text>]:
903 aliases: unban, pardon
904 trigger:
905 if player does not have permission "punishments.unban":
906 send "{@Logo} {@NoPermission}"
907 else:
908 if arg-1 is not set:
909 send "{@Logo} {@NoName}"
910 send "{@Logo} &a/unban &c<player>"
911 else:
912 set {_getIP} to WasPlayerAlreadyOnline("%arg-1%")
913 if {_getIP} is "false":
914 send "{@Logo} {@PlayerNotFound}"
915 else:
916 set {_accounts} to getAccounts("%arg-1%")
917 replace all " and " with ", " in {_accounts}
918 set {_accounts::*} to {_accounts} split at ", "
919 loop {_accounts::*}:
920 set {_uuid} to getUUID("%loop-value%")
921 set {_ban} to getBannedPlayer("%{_uuid}%", "Player")
922 {_ban} is "true"
923 set {_ban::%loop-value%} to {_uuid}
924 if {_ban::*} is not set:
925 send "{@Logo} {@PlayerNotBanned}"
926 else:
927 if sender is player:
928 set {_String.From} to "%player%"
929 else:
930 set {_String.From} to "{@ConsoleName}"
931 loop {_ban::*}:
932 $ thread
933 RemoveBannedPlayer("%loop-value%")
934 $ thread
935 AddHistoryLog("%loop-value%", "&c[%now%] %loop-index% has been unbanned by %{_String.From}%.")
936 broadcast "{@Logo} &a%arg-1%&7&o (and all accounts under their ip)&7 were unbanned by &7%{_String.From}%"
937
938command /unmute [<text>]:
939 aliases: unmute
940 trigger:
941 if player does not have permission "punishments.unmute":
942 send "{@Logo} {@NoPermission}"
943 else:
944 if arg-1 is not set:
945 send "{@Logo} {@NoName}"
946 send "{@Logo} &a/unmute &c<player>"
947 else:
948 $ thread
949 set {_getIP} to WasPlayerAlreadyOnline("%arg-1%")
950 if {_getIP} is "false":
951 send "{@Logo} {@PlayerNotFound}"
952 else:
953 $ thread
954 set {_uuid} to getUUID("%arg-1%")
955 $ thread
956 set {_getResult} to getMutedPlayer("%{_uuid}%", "Player")
957 if {_getResult} is "false":
958 send "{@Logo} {@PlayerNotMuted}"
959 else:
960 if sender is player:
961 set {_String.From} to "%player%"
962 else:
963 set {_String.From} to "{@ConsoleName}"
964 $ thread
965 set {_uuid} to getUUID("%arg-1%")
966 $ thread
967 RemoveMutedPlayer("%{_uuid}%")
968 $ thread
969 AddHistoryLog("%{_uuid}%", "&e[%now%] %arg-1% has been unmuted by %{_String.From}%.")
970 broadcast "{@Logo} &a%arg-1%&7 was unmuted by &a%{_String.From}%"
971
972on chat:
973 set {_getResult} to getMutedPlayer("%player's uuid%", "Player")
974 if {_getResult} is "true":
975 set {_CheckMuteState} to CheckMutedPlayer("%player%")
976 if {_CheckMuteState} is "true":
977 set {nochat::%player%} to true
978 else:
979 #{dead::%player%} is true
980 #set {nochat::%player%} to true
981 #loop all players:
982 # if {spec::%loop-player%} is true:
983 # send "&5[Dead] &8%player%&7:&3 %message%" to loop-player
984 # else if {dead::%loop-player%} is true:
985 # send "&5[Dead] &8%player%&7:&3 %message%" to loop-player