-
Notifications
You must be signed in to change notification settings - Fork 0
/
Commands.sk
378 lines (366 loc) · 16.1 KB
/
Commands.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
#
# > Command - /islandadmin
# > Actions:
# > This command contains multible of actions which are meant to be used by an administrator for
# > administration and moderation purposes.
command /islandadmin [<text>] [<text>] [<text>] [<text>] [<text>]:
permission: is.admin
aliases: /isadmin
trigger:
#
# > Get the language code of the player and set prefix for messages
set {_lang} to getlangcode(player)
set {_prefix} to getlang("prefix",{_lang})
#
# > Argument: "go" ("home" OR "tp")
# > Teleports the user to the defined player
# > Actions:
# > Teleports the player to the defined player island
if arg-1 is "go" OR "home" OR "tp":
set {_player} to arg-2 parsed as offline player
set {_uuid} to uuid of {_player}
homehandler({_player},"home",arg-3,player)
stop
#
# > If the admin wants to change challenge xp, the changechallengexp function
# > from the SkyBlock/SKYBLOCK.SK/Functions/challenge.sk is being called.
# > Print a message with the changed amount if it worked.
if arg-1 is "challenge":
if arg-2 is "xp":
if arg-3 is "add" or "remove":
#
# > Set a local variable for the player who gets the challenge xp modified.
set {_target} to arg-4 parsed as offline player
#
# > Call the changechallengexp function to change the xp.
set {_changed} to changechallengexp({_target},arg-3,arg-5 parsed as number)
#
# > Send a message depending if something has been added or removed.
if arg-3 is "add":
set {_msg} to getlang("admincmd_addedchallengexp",{_lang})
replace all "<amount>" with "%{_changed}%" in {_msg}
replace all "<player>" with "%{_target}%" in {_msg}
message "%{_prefix}% %{_msg}%"
else if arg-3 is "remove":
set {_msg} to getlang("admincmd_removedchallengexp",{_lang})
replace all "<amount>" with "%{_changed}%" in {_msg}
replace all "<player>" with "%{_target}%" in {_msg}
message "%{_prefix}% %{_msg}%"
stop
#
# > If something should be done with an island, this is the code:
else if arg-1 is "island":
#
# > Argument: "calc"
# > If the user types in /islandadmin island calc, the island level gets calculated
# > Actions:
# > Checks if the defined user has a island and then run the calcisland function.
if arg-2 is "calc":
set {_player} to arg-3 parsed as offline player
set {_uuid} to uuid of {_player}
if {SB::player::%{_uuid}%::island::bedrock} is set:
set {_msg} to getlang("isadmin_fcalc",{_lang})
message "%{_prefix}% %{_msg}%"
$ thread
calcisland({_player})
#
# > Argument: "purge"
# > If the user types in /islandadmin island purge <number>, islands, which have been inactive for the defined
# > number of days are going to be deleted. This is dangerous and a backup should be made prior entering this.
# > Actions:
# > Deleted all islands which have been inactive for more than x days.
if arg-2 is "purge":
if arg-3 is not set:
stop
#
# > Calls purgeislands function, this shortens the size of this file.
purgeislands(player,arg-3,arg-4)
if arg-2 is "delete":
#
# > Calls the admintool-deleteisland function, which is going to handle island deletation by admins.
admintools_deleteisland(player,arg-3,arg-4)
#
# > Argument: "addmember"
# > If the user types in /islandadmin island addmember <player>, the defined player is added to the island.
# > Actions:
# > Adds the player to the island the executor is standing on.
if arg-2 is "addmember":
admintools_addmember(player,arg-3)
#
# > Argument: "kickall"
# > If the user types in /islandadmin island kickall, all players of the current island are kicked.
# > Actions:
# > Kicks everyone on the island the player is currently at without deleting it using the admintools_kickall function.
if arg-2 is "kickall":
admintools_kickall(player,arg-3,arg-4)
#
# > Argument: "changebiome"
# > If the user types in /islandadmin island changebiome <biome>, the biome of the current island is changed.
# > Optional: Define the owner of the island to take it instead of the current island.
# > Actions:
# > Changes the biome of the island the user is standing on or the defined 4nd argument.
if arg-2 is "changebiome":
admintools_changebiome(player,arg-3,arg-4)
#
# > Argument: "changeleader"
# > If the user types in /islandadmin island changeleader <new leader>, the leader is changed to this player on which the admin
# > is currently standing on, works only, if there is already a leader and a member in the island.
# > Actions:
# > Changes the leader using the admintools_changeleader function.
if arg-2 is "changeleader":
admintools_changeleader(player,arg-3,arg-4,arg-5)
#
# > Argument: "invite"
# > Invites a player for the owner of the island
# > Actions:
# > This is going to invite a player, like it would have been done by the owner directly.
# > Use addmember to add a member without asking the user.
if arg-2 is "invite":
admintools_invite(player,arg-3,arg-4)
#
# > Argument: "create"
# > Invites a player for the owner of the island
# > Actions:
# > This argument calls the admintools_create function, which creates a new island at the location
# > of the player, if available.
if arg-2 is "create":
admintools_create(player)
#
# > If no argument has been used, tell the player what is possible:
else:
message "/isadmin island invite <Owner> <New Player> - Invite player to the island"
message "/isadmin island changeleader <New Owner> - Change the leader of the island on which you're standing to the new owner (has to be a member)"
message "/isadmin island changebiome <new biome> [<Owner>] - Changes the biome for the island you're standing on or the defined owner"
message "/isadmin island kickall - kicks everyone from the island you're standing on"
message "/isadmin island delete <player> - Deletes the island of the player"
message "/isadmin island addmember <player> - adds the defined player to the island you're currently at, if no leader is set, the player gets the leader"
message "/isadmin island calc <player> - calculates the island of the defined player"
message "/isadmin challenge xp add/remove <player> <amount> - changes challenge xp"
command /island [<text>] [<text=1>] [<text>]:
aliases: /is, /sb, /skyblock
trigger:
#
# > Set some frequently used variables.
set {_lang} to getlangcode(player)
set {_prefix} to getlang("prefix",{_lang})
#
# > If the player has no argument set, open the skyblock menu.
if arg-1 is not set:
skyblockgui(player)
#
# > Argument "reload"
# > Actions:
# > If the player has the admin permission, make the player execute the
# > skript reload command for the SkyBlock folder.
if arg-1 is "reload":
if player has permission "%{SB::config::buildpermission}%":
set {_msg} to getlang("reloadstarted",{_lang})
message "%{_prefix}% %{_msg}%"
reloadskyblocksk(1)
set {_msg} to getlang("reloadsuccess",{_lang})
message "%{_prefix}% %{_msg}%"
#
# > Argument "create"
# > Actions:
# > Creates a island for the player or opens the island selection menu, if
# > the player has not already choosen a specific island.
if arg-1 is "create":
createisland(player,arg-2)
#
# > Argument "flag" ("flags")
# > Actions:
# > Opens the flag menu using the openflagmenu function.
else if arg-1 is "flag" or "flags":
openflagmenu(player,"")
#
# > Argument: "home"
# > Actions:
# > If the player wants to set, delete or teleport to a home, the homehandler is called here.
# > Example command /island home [<player>] [<name>]
# > Example command /island sethome [<name>]
# > Example command /island delhome [<name>]
else if arg-1 is "home" or "sethome" or "delhome":
#
# > If the player has set a third argument, try to teleport to the home of
# > the specified player.
if arg-1 is "home":
if arg-3 is set:
set {_p} to arg-2 parsed as offline player
homehandler({_p},arg-1,arg-3,player)
stop
#
# > If the player has not set a third argument, just try to teleport.
homehandler(player,arg-1,arg-2,player)
#
# > Argument: "go"
# > Actions:
# > Teleports the player to the bedrock of the island.
else if arg-1 is "go":
if {SB::player::%uuid of player%::island::bedrock} is not set:
set {_msg} to getlang("nois",{_lang})
message "%{_prefix}% %{_msg}%"
else:
set {_loc} to {SB::player::%uuid of player%::island::bedrock}
add 1 to y-coordinate of {_loc}
teleport player to {_loc}
set {_msg} to getlang("tpis",{_lang})
message "%{_prefix}% %{_msg}%"
#
# > Argument: "delete" or "remove"
# > Actions:
# > Deletes the island of the player. Also asks, if the player really wants to delete the island.
else if arg-1 are "delete" or "remove":
#
# > Only call deleteisland function, if player has an island and confirmed the deletation
# > of the island.
if {SB::player::%uuid of player%::island::bedrock} is not set:
set {_msg} to getlang("cantleave",{_lang})
message "%{_prefix}% %{_msg}%"
else:
if arg-2 is "2":
set {_uuid} to uuid of player
set {_loc} to {SB::player::%{_uuid}%::island::bedrock}
set {_bedrockloc} to "%x-coord of {_bedrockloc}%_%y-coord of {_bedrockloc}%_%z-coord of {_bedrockloc}%"
if difference between {SB::island::%{_bedrockloc}%::created} and now < {SB::config::deletecooldown}:
set {_msg} to getlang("cooldown",{_lang})
message "%{_prefix}% %{_msg}%"
else:
deleteisland(player)
else:
set {_msg} to getlang("isdeleteqestion",{_lang})
tellrawmsg1(player,{_prefix},{_msg},"/is delete 2")
else if arg-1 is "calc":
#
# > Only call the calcisland function if the last calculation is some time ago (loger than cooldown time).
if difference between {SB::calcdown::%uuid of player%} and now < {SB::config::calccooldown}:
set {_msg} to getlang("cooldown",{_lang})
message "%{_prefix}% %{_msg}%"
else:
set {SB::calcdown::%uuid of player%} to now
$ thread
calcisland(player)
#
# > Argument: "top"
# > If a player types in /island with the first argument "top",
# > the top list gets shown to the player using the islandtoplist function.
else if arg-1 is "top":
islandtoplist(player,arg-2,false,arg-3)
#
# > Argument: "spawn" or "lobby"
# > Actions:
# > Teleports the player to the configured spawn location.
else if arg-1 is "spawn" or "lobby":
teleport player to {SB::config::spawn}
#
# > Argument: "invite"
# > Actions:
# > The islandmember function gets called to invite the player second argument to the island.
else if arg-1 is "invite":
islandmember(player,"invite",arg-2)
#
# > Argument: "join"
# > Actions:
# > The islandmember function gets called to join the island of the second argument.
else if arg-1 is "join":
islandmember(player,"join",arg-2)
#
# > Argument: "leave"
# > Actions:
# > The islandmember function gets called to leave the island.
else if arg-1 is "leave":
islandmember(player,"leave",arg-2)
#
# > Argument: "kick"
# > Actions:
# > The islandmember function gets called to kick the second argument player.
else if arg-1 is "kick":
islandmember(player,"kick",arg-2)
#
# > Argument: "help"
# > If a player types in /island help, islandhelp function is called.
# > Actions:
# > Calls the islandhelp function with the player and second argument as parameter.
# > This sends the help to the chat of the player.
else if arg-1 is "help":
islandhelp(player,arg-2)
#
# > Argument: "info" ("level" or "lvl")
# > If a player types in /island info, islandinfo function is called.
# > Actions:
# > Calls the islandinfo function with the player, second argument
# > as parameter (target player) and a third as back link command.
else if arg-1 is "info" or "level" or "lvl":
islandinfo(player,arg-2,arg-3)
#
# > Argument: "entity" or "entities"
# > If a player types in /island entity, islandentityinfo function is called.
# > Actions:
# > Calls the islandentityinfo function with the player, second argument
# > as parameter (target player) and a third as back link command.
else if arg-1 is "entity" or "entities":
islandentityinfo(player,arg-2,arg-3)
#
# > Argument: "generator" ("gen" OR "oregen" OR "oregenerator")
# > If a player types in /island generator, his current generator level is displayed
# > Actions:
# > Gets all the broken blocks and calculates the final level the player is currently on and
# > also display a visual appealing status, how far the next level is away. This is done in a function.
else if arg-1 is "generator" OR "gen" OR "oregen" OR "oregenerator":
generatorinfo(player)
#
# > Argument: "ores" ("ore" OR "orechances" OR "chances")
# > If a player types in /island ores, his current chances are displayed
# > Actions:
# > Gets all the ore generator chances for the player
else if arg-1 is "ores" OR "ore" OR "orechances" OR "chances":
orechancesinfo(player)
#
# > Argument: "biome" ("biomes" OR "biom")
# > If a player types in /island biome, a biome select menu is opened.
# > Actions:
# > Opens biome menu
else if arg-1 is "biome" OR "biomes" OR "biom":
biomemenu(player)
#
# > Argument: "trust"
# > If a player types in /island trust, the trusthandler function is called.
# > Actions:
# > Calls the trusthandler function, which either lists all options, adds someone as
# > trusted or removes a trusted user, also can list all trusted users.
else if arg-1 is "trust":
trusthandler(player,arg-2,arg-3)
#
# > Argument: "upgrade" ("upgrades")
# > If a player types in /island upgrade, the islandupgrademenu function is called.
# > Actions:
# > Calls the islandupgrademenu function, which opens the upgrade menu.
else if arg-1 is "upgrade" or "upgrades":
islandupgrademenu(player)
#
# > Argument: "warp" OR "setwarp" OR "delwarp"
# > If a player types in /island warp|setwarp|delwarp, the warphandler function is called.
# > Actions:
# > Calls the warphandler function, which allows to teleport, set and delete warps.
else if arg-1 is "warp" or "setwarp" or "delwarp":
warphandler(player,arg-1,arg-2,arg-3)
#
# > Argument: "lang" OR "language"
# > If a player types in /island lang|language, the selectlanguage function is called.
# > Actions:
# > Calls the selectlanguage function, which opens a menu where the player can change the language.
else if arg-1 is "lang" or "language":
selectlanguage(player)
#
# > Argument: "c" or "challenges" or "challenge"
# > If a player types in /island c|challenges|challenge, the openchallenges function is called.
# > Actions:
# > Calls the openchallenges function, which opens the challenges menu.
else if arg-1 is "c" or "challenges" or "challenge":
openchallenges(player)
#
# > Argument: "loot" or "loots" or "lootbox" or "crate" or "crates"
# > If a player types in /island loot|loots|lootbox|crate|crates, the openlootboxmenu function is called.
# > Actions:
# > Calls the openlootboxmenu function, which opens the lootbox menu.
else if arg-1 is "loot" or "loots" or "lootbox" or "crate" or "crates":
openlootboxmenu(player)