This repository was archived by the owner on Jul 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path!skToolBox.sk
2373 lines (2146 loc) · 89.8 KB
/
!skToolBox.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
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# _ _______ _ ____
# | |__ __| | | _ \
# ___| | _| | ___ ___ | | |_) | _____ __TM
# / __| |/ / |/ _ \ / _ \| | _ < / _ \ \/ /
# \__ \ <| | (_) | (_) | | |_) | (_) > <
# |___/_|\_\_|\___/ \___/|_|____/ \___/_/\_\
#
# Requirements:
# Skript (Tested with 2.5-beta2)
# skript-reflect 2.1.0
# ThatPacketAddon (Tested with 1.0-BETA.3)
# Tested on Paper 1.16.2
# If you encountered any issue, feel free to open an issue on GitHub:
# https://github.com/Mr-Darth/skToolBox/issues
options:
update-checker: true
# !!! [ Warning ] !!!
# Do not change anything below unless or no support will be given!
# Do not change anything below unless or no support will be given!
# Do not change anything below unless or no support will be given!
# !!! [ Warning ] !!!
version: 1.0.1
option nms:
get:
return 4th element of split "%class of server.getServer()%" by "."
import:
java.lang.Math
java.text.DecimalFormat
java.lang.StringBuilder
java.io.BufferedReader
java.io.InputStreamReader
java.net.URL
java.util.UUID
java.lang.Integer as JavaInteger
java.util.Calendar
java.util.regex.Pattern as RegexPattern
java.util.regex.Matcher
java.lang.management.ManagementFactory
java.lang.management.RuntimeMXBean
java.io.File
java.lang.Runnable
java.util.Base64
org.bukkit.Bukkit
org.bukkit.map.MinecraftFont
org.bukkit.block.data.Ageable as BlockDataAgeable
org.bukkit.inventory.meta.EnchantmentStorageMeta
org.bukkit.block.data.Levelled
org.bukkit.Raid
org.bukkit.Statistic
org.bukkit.inventory.ItemFlag
org.bukkit.Art
org.bukkit.Rotation
org.bukkit.entity.Horse$Color as HorseColor
org.bukkit.entity.Horse$Style as HorseStyle
org.bukkit.event.player.PlayerFishEvent$State as FishingState
org.bukkit.event.player.PlayerLoginEvent$Result as LoginResult
org.bukkit.Raid$RaidStatus
org.bukkit.block.PistonMoveReaction as PistonReactions
org.bukkit.inventory.ShapelessRecipe
org.bukkit.inventory.ShapedRecipe
org.bukkit.inventory.CookingRecipe
org.bukkit.inventory.MerchantRecipe
org.bukkit.inventory.StonecuttingRecipe
org.bukkit.inventory.meta.Repairable
org.bukkit.entity.ThrowableProjectile
com.destroystokyo.paper.entity.Pathfinder$PathResult
ch.njol.skript.Skript
ch.njol.skript.util.Timespan
ch.njol.skript.lang.Effect
ch.njol.skript.lang.TriggerItem
ch.njol.skript.ScriptLoader
ch.njol.skript.lang.Condition
ch.njol.skript.classes.Changer$ChangeMode
ch.njol.skript.classes.Changer$ChangerUtils
ch.njol.skript.lang.Variable
ch.njol.skript.util.Utils
ch.njol.skript.log.ErrorQuality
ch.njol.skript.util.SkriptColor
ch.njol.skript.util.EnchantmentType
ch.njol.skript.variables.Variables
ch.njol.skript.ServerPlatform
ch.njol.skript.lang.VariableString
ch.njol.skript.registrations.Classes
com.google.common.base.Splitter
org.apache.commons.lang3.RandomStringUtils
org.apache.commons.codec.language.Soundex
com.boydti.fawe.FaweAPI
com.boydti.fawe.util.EditSessionBuilder
com.sk89q.worldedit.world.block.BaseBlock
com.sk89q.worldedit.math.BlockVector3
com.sk89q.worldedit.regions.CuboidRegion
com.sk89q.worldedit.bukkit.BukkitAdapter
com.sk89q.worldedit.function.pattern.BlockPattern
com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats
com.sk89q.worldedit.bukkit.BukkitWorld
org.bukkit.craftbukkit.{@nms}.entity.CraftEntity
net.minecraft.server.{@nms}.EnumHand
org.bukkit.craftbukkit.{@nms}.inventory.CraftItemStack
#
# _ _ _ _
# | | | | | | | |
# __| | ___ _ __ ___ _ __ __| | ___ _ __ ___ _ _ ___| |__ ___ ___| | _____ _ __ TM
# / _` |/ _ \ '_ \ / _ \ '_ \ / _` |/ _ \ '_ \ / __| | | | / __| '_ \ / _ \/ __| |/ / _ \ '__|
# | (_| | __/ |_) | __/ | | | (_| | __/ | | | (__| |_| | | (__| | | | __/ (__| < __/ |
# \__,_|\___| .__/ \___|_| |_|\__,_|\___|_| |_|\___|\__, | \___|_| |_|\___|\___|_|\_\___|_|
# | | __/ |
# |_| |___/
#
on load:
loop "skript-reflect" and "ThatPacketAddon":
if server.getServer().getPluginManager().getPlugin(loop-value) is not set:
Skript.error("&7[&6Dependency Checker&7] &fMissing addon: &c&n%loop-value%&r!")
#
# _ _ _ _
# | | | | | | | |
# _ _ _ __ __| | __ _| |_ ___ ___| |__ ___ ___| | _____ _ __ TM
# | | | | '_ \ / _` |/ _` | __/ _ \ / __| '_ \ / _ \/ __| |/ / _ \ '__|
# | |_| | |_) | (_| | (_| | || __/ | (__| | | | __/ (__| < __/ |
# \__,_| .__/ \__,_|\__,_|\__\___| \___|_| |_|\___|\___|_|\_\___|_|
# | |
# |_|
#
on load:
if {@update-checker} = true:
set {_br} to new BufferedReader(new InputStreamReader(new URL("https://raw.githubusercontent.com/Mr-Darth/skToolBox/master/version.txt?token=AP657WROCHRANAG5R2QBTZC7EF7BM").openStream()))
set {_v} to first element of ...{_br}.lines()
{_br}.close()
if "%{_v}%" != "{@version}":
Skript.error("&7[&6Update Checker&7] &fYou are currently running an outdated version of skToolBox! Current version: &c&n{@version}&r. Latest version: &a&n%{_v}%&r.")
#
# ___ _ __ _ _ _ __ ___ ___ TM
# / _ \ '_ \| | | | '_ ` _ \/ __|
# | __/ | | | |_| | | | | | \__ \
# \___|_| |_|\__,_|_| |_| |_|___/
#
# Name: Fishing states
expression [[fishing] state] (0¦fishing|1¦caught fish|2¦caught entity|3¦in ground|4¦failed attempt|5¦reel in|6¦bite):
return type: object
get:
return FishingState.values()[parse mark]
# Name: Horse colors
expression [horse color] (0¦white|1¦creamy|2¦chestnut|3¦brown|4¦black|5¦gray|6¦dark brown):
return type: object
get:
return HorseColor.values()[parse mark]
# Name: Horse styles
expression [horse style] (0¦none|1¦white|2¦white field|3¦white dots|4¦black dots):
return type: object
get:
return HorseStyle.values()[parse mark]
# Name: Login results
expression [[(connect|login)] result] (0¦allow[ed]|1¦[(kick|server)] full|2¦[kick] ban[ned]|3¦[kick] whitelist|4¦[kick] other):
return type: object
get:
return LoginResult.values()[parse mark]
# Name: Rotations
expression [rotation] (0¦none|1¦clockwise 45|2¦clockwise|3¦counter clockwise 135|4¦flipped|5¦flipped 45|6¦counter clockwise|7¦counter clockwise 45):
return type: object
get:
return Rotation.values()[parse mark]
# Name: Painting arts
expression:
return type: object
patterns:
[[painting] art] (0¦kebab|1¦aztec|2¦alban|3¦aztec[ ]2|4¦bomb|5¦plant|6¦wasteland|7¦pool|8¦courbet|9¦sea|10¦sunset|11¦creebet|12¦wanderer|13¦graham|14¦match|15¦bust|16|stage|17¦void|18¦skull and roses|19¦wither|20¦fighters|21¦pointer|22¦pigscene|23¦burning skull|24¦skeleton|25¦donkey kong)
get:
return Art.values()[parse mark]
# Name: Item flags
expression [[item] flag[s]] (hide|hidden) (0¦enchant[ment]s|1¦attributes|2¦unbreakable|3¦destroys|4¦placed on|5¦potion[ effect]s):
return type: object
get:
return ItemFlag.values()[parse mark]
# Name: Raid statuses
expression [raid status] (0¦ongoing|1¦victory|2¦loss|3¦stopped):
return type: object
get:
return RaidStatus.values()[parse mark]
# Name: Piston reactions
expression [piston [mov(e|ing)] reaction] (0¦move|1¦(destroy|break)|2¦(block|resist)|3¦ignore[d]|4¦push only):
return type: object
get:
return PistonReactions.values()[parse mark]
#
# (_)
# _____ ___ __ _ __ ___ ___ ___ _ ___ _ __ ___ TM
# / _ \ \/ / '_ \| '__/ _ \/ __/ __| |/ _ \| '_ \/ __|
# | __/> <| |_) | | | __/\__ \__ \ | (_) | | | \__ \
# \___/_/\_\ .__/|_| \___||___/___/_|\___/|_| |_|___/
# | |
# |_|
#
# Name: Opposite numbers
# Description: Returns the opposite value of the inputted numbers.
# Inputting (-1 and 29.3) will return (1 and -29.3).
# Usage: set {_opposite} to opposite number of 10
plural expression [the] (opposite|reverse) [number[s] [(of|from)]] %numbers%:
return type: numbers
get:
loop exprs-1:
add 1 to {_i}
set {_value} to loop-expression
set {_r::%{_i}%} to {_value} * -1
return {_r::*}
# Name: Opposite boolean
# Description: Returns the opposite value of the inputted boolean.
# Inputting true will return false.
# Usage: set {afk::%player%} to !{afk::%player%}
expression ([the] (opposite|toggled) [boolean ]|not |!)%boolean%:
return type: boolean
get:
return (false if expr-1 is true, else true)
# Name: All plugins
# Description: Returns a list with the name of all the running plugins on the server.
# Usage: send "Plugins: %plugins%"
plural expression [(all [[of] the]|the)] [(installed|running|loaded)] plugins [on [the] server]:
loop of: plugin
return type: strings
get:
loop ...server.getServer().getPluginManager().getPlugins():
set {_r::%loop-value%} to loop-value.getName()
return {_r::*}
# Name: All Skript addons
# Description: Returns a list with the name of all the running addons on the server.
# Usage: send "Installed Skript Addons: %addons%"
plural expression [(all [[of] the]|the)] [(installed|running|loaded)] [skript] addons [on [the] server]:
loop of: addon
return type: strings
get:
loop ...Skript.getAddons():
set {_r::%loop-value%} to loop-value.getName()
return {_r::*}
# Name: Dismounted entity
# Description: Returns the dismounted entity in the dismount event.
# Usage: kill dismounted entity
expression [the] [event-]dismounted(-| )entity:
return type: entity
parse:
continue if ScriptLoader.isCurrentEvent(class "org.spigotmc.event.entity.EntityDismountEvent") = true
Skript.error("Cannot use 'dismounted entity' outside of the dismount event" and ErrorQuality.SEMANTIC_ERROR)
get:
return event.getDismounted()
delete:
event.getDismounted().remove()
# Name: Timespan to seconds, ticks and milliseconds
# Description: Returns the amount of seconds/ticks/milliseconds in a given timespan.
# Usage: send "10 days to seconds = %10 days to seconds%"
expression %timespan% (to|in) (0¦tick[s]|1¦(millisecond[s]|ms)|1000¦second[s]):
return type: number
get:
return (expr-1.getMilliSeconds() / (parse mark) if parse mark != 0, else expr-1.getTicks_i())
# Name: Fishing state
# Description: Returns the fishing state in a fishing event.
# Usage: send "%fishing state%"
expression [the] [event-]fish[ing] state:
return type: object
parse:
continue if ScriptLoader.isCurrentEvent(class "org.bukkit.event.player.PlayerFishEvent") = true
Skript.error("Cannot use 'fishing state' outside of the fish event" and ErrorQuality.SEMANTIC_ERROR)
get:
return FishingState.values()[FishingState.ordinal(event.getState())]
# Name: Caught item/entity
# Description: Returns the caught item/entity in a fishing event.
# Usage: set caught item to diamond
expression [the] [event-]caught (1¦(item|loot)|2¦entity):
return type: itemtype/entity
parse:
continue if ScriptLoader.isCurrentEvent(class "org.bukkit.event.player.PlayerFishEvent") = true
Skript.error("Cannot use 'caught item/entity' outside of the fish event" and ErrorQuality.SEMANTIC_ERROR)
get:
return (new ItemType(event.getCaught().getItemStack()) if parse mark != 2, else event.getCaught())
set itemtype:
try event.getCaught().setItemStack(random item of change value)
delete:
event.getCaught().remove()
# Name: Hook
# Description: Returns the fishing hook in a fishing event.
# Usage: kill fishing hook
expression [the] [event-][fish[ing]] hook:
return type: entity
parse:
continue if ScriptLoader.isCurrentEvent(class "org.bukkit.event.player.PlayerFishEvent") = true
Skript.error("Cannot use 'fishing hook' outside of the fish event" and ErrorQuality.SEMANTIC_ERROR)
get:
return event.getHook()
delete:
event.getHook().remove()
# Name: Special numbers
# Description: Returns the value of pi/Euler's number/the golden ratio.
# Usage: set {_variable} to pi*2
expression:
return type: number
patterns:
[the] [value of] (1¦pi|2¦e[uler['s] number]|3¦(phi|[the] golden ratio))
(1¦pi|2¦e[uler['s] number]|3¦(phi|[the] golden ratio))['s value]
get:
return (parse mark)th element of (3.141592653589793, 2.718281828459045 and 1.618033988749895)
# Name: Degrees to radians
# Description: Converts degrees to radians.
# Usage: set {_rad} to 180 degrees to radians
expression %number% [degrees] (in|to|as) rad[ians]:
return type: number
get:
return (expr-1 * 3.141592653589793) / 180
# Name: Radians to degrees
# Description: Converts radians to degrees.
# Usage: set {_dg} to 3.14 radians to degrees
expression %number% [rad[ians]] (in|to|as) degrees:
return type: number
get:
return (expr-1 * 180) / 3.141592653589793
# Name: Midpoint
# Description: Gets the midpoint of multiple locations.
# Usage: set block at midpoint of player and targeted player to diamond block
locations property (midpoint|center):
return type: location
get:
set {_f} to 1 / (size of exprs-1)
loop exprs-1:
set {_l} to loop-expression
set {_v} to vector from {_l}
set {_midpoint} to vector ((x of {_midpoint}) + ((x of {_v}) * {_f})), ((y of {_midpoint}) + ((y of {_v}) * {_f})), ((z of {_midpoint}) + ((z of {_v}) * {_f}))
return (location at 0, 0, 0 in (first element of exprs-1)'s world) ~ {_midpoint}
# Name: Average value
# Description: Returns the average value of a list of numbers.
# Usage: set {_rating} to average value of {ratings::*}
expression [the] (average value|arithmetic mean) (of|from) %numbers%:
return type: number
get:
return sum(exprs-1) / size of exprs-1
# Name: All potion effects of entity
# Description: Returns a list with the active potion effects of an entity.
# Usage: remove all active potion effects of player from player
plural livingentity property [(all [[of] the]|the)] [active] potion[s] [effect[s]]:
loop of: potion
return type: potion effect types
get:
loop ...expr-1.getActivePotionEffects():
set {_r::%loop-value.getType()%} to loop-value.getType()
return {_r::*}
remove potion effect type:
remove change value from random entity of expr-1
delete:
remove (all active potion effects of expr-1) from random entity of expr-1
reset:
remove (all active potion effects of expr-1) from random entity of expr-1
# Name: Duration of potion effect
# Description: Returns the duration of a potion effect.
# Usage: send "You have speed for %duration of speed of player%"
livingentity property duration of %potion effect type%:
return type: timespan
get:
return try new Timespan(expr-1.getPotionEffect(expr-2).getDuration() * 50)
# Name: Tier of potion effect
# Description: Returns the amplifier of a potion effect.
# Usage: send "You have speed of tier %tier of speed of player%"
livingentity property (tier|amplifier) of %potion effect type%:
return type: integer
get:
return expr-1.getPotionEffect(expr-2).getAmplifier()
# Name: Age
# Description: Get or change the age of an entity.
# Usage: set age of last spawned sheep to -10000
livingentity property age:
return type: integer
get:
return try expr-1.getAge()
set number:
try expr-1.setAge(change value)
add number:
try expr-1.setAge((try expr-1.getAge()) + (change value))
remove number:
try expr-1.setAge((try expr-1.getAge()) - (change value))
# Name: Split string every x characters
# Description: Splits a string by every x characters.
# Usage: set {_split::*} to "01029482094" split every 2 chars
plural expression:
return type: strings
patterns:
%string% split [(by|at)] every %number% char[acter][s]
split %string% [(by|at)] every %number% char[acter][s]
get:
return expr-1 if expr-2 <= 0
return ...Splitter.fixedLength(expr-2).split(expr-1)
# Name: Formatted numbers
# Description: Formats the given numbers using a given decimal format.
# Usage: send "Money: %formatted player's balance%"
expression format[ted] %numbers% [(from|with|using) [decimal] format %-string%]:
return type: strings
get:
loop exprs-1:
add 1 to {_i}
set {_r::%{_i}%} to try new DecimalFormat(expr-2 ? "######,######.######").format(loop-expression)
return {_r::*}
# Name: Reversed strings
# Description: Reverses the given strings.
# Usage: broadcast "%reversed ""abcdef""%"
expression (reverse|backwards) [(string|text)] %strings%:
return type: strings
get:
loop exprs-1:
add 1 to {_i}
set {_r::%{_i}%} to try new StringBuilder(loop-expression.toString()).reverse().toString()
return {_r::*}
# Name: Rainbow string
# Description: Returns a string colored differently every X characters.
# Usage: broadcast rainbow "PARTY TIMEEEEE"
# Note: Requires the 'Split string every x characters' expression.
expression rainbow %string% [every %-int% char[acter]s] [[colo[u]red] [(with|by|from)] %-colors%]:
return type: string
get:
set {_c::*} to (exprs-3 ? (pink, gold, yellow, lime, light blue, indigo and purple))
set {_i} to 1
loop (split expr-1 every (expr-2 ? 1) characters):
set {_index} to {_index} + 1
if loop-value is " ":
set {_r::%{_index}%} to " "
continue
set {_r::%{_index}%} to "<%{_i}th element out of {_c::*}%>%loop-value%"
set {_i} to (1 + {_i} if {_i} < (size of {_c::*}), else 1)
return colored join {_r::*}
# Name: Border slots of inventory
# Description: Returns the border slots of an inventory
# Usage: set border of player's inventory to diamond
# Credits: blue
plural inventory property border [slots]:
return type: integers
get:
set {_r::*} to (integers between 0 and 8) and (integers between ((rows of expr-1) * 9) - 9 and ((rows of expr-1) * 9) - 1) if (rows of expr-1) > 2
loop integers from 1 to (rows of expr-1):
add (loop-value * 9) and (loop-value * 9 + 8) to {_r::*}
return {_r::*}
set itemtype:
set slots (border of expr-1) of expr-1 to (random item of change value)
delete:
set slots (border of expr-1) of expr-1 to air
reset:
set slots (border of expr-1) of expr-1 to air
# Name: Ordinal number
# Description: The ordinal value of a number.
# Usage: send "You are the %ordinal of {pos::%player%}% person in the queue."
integer property ordinal [value]:
return type: string
get:
return "%expr-1%%(((mod(expr-1, 10))th element out of (split ""st,nd,rd,th,th,th,th,th,th"" at "","") if expr-1 != 11, 12 or 13, else ""th"") ? ""th"") if expr-1 != 0, else """"%"
# Name: Text from URL
# Description: Returns the text from a URL.
# Usage: send "Current version: %text from ""{@url}""%"
plural expression [the] (text|content[s]) (of|from) [(url|link|[web]site)] %string%:
return type: strings
get:
set {_br} to try new BufferedReader(try new InputStreamReader(try new URL(expr-1).openStream()))
set {_r::*} to ...try {_br}.lines()
try {_br}.close()
return {_r::*}
# Name: Horse color
# Description: Returns the color of a horse.
# Usage: set horse color of player's vehicle to black
entity property horse colo[u]r:
return type: object
get:
return if expr-1 is not a horse
return HorseColor.values()[HorseColor.ordinal(expr-1.getColor())]
set object:
expr-1 is a horse
change value is instance of HorseColor
expr-1.setColor(change value)
# Name: Horse style
# Description: Returns the color of a horse.
# Usage: set horse style of event-entity to none
entity property horse style:
return type: object
get:
return if expr-1 is not a horse
return HorseStyle.values()[HorseStyle.ordinal(expr-1.getStyle())]
set object:
expr-1 is a horse
change value is instance of HorseStyle
expr-1.setStyle(change value)
# Name: Statistic
# Description: Returns the value of a statistic from a player.
# Usage: send "Deaths: %statistic ""deaths"" of player%"
plural player property statistic[s] [value[s]] %strings%:
return type: objects
get:
loop exprs-2:
set {_i} to {_i} + 1
set {_r::%{_i}%} to try expr-1.getStatistic(try Statistic.valueOf(loop-expression.toString().toUpperCase().replace(" " and "_")))
return {_r::*}
# Name: Square corners
# Description: Returns the corners of a square from its center and size.
# Usage: set {_c::*} to corners of square from event-location and size 3
plural expression:
loop of: corner
return type: locations
patterns:
[the] corners of [a] square (at|from) [center] %location% [(with|and)] size %int%
[the] square corners (at|from) [center] %location% [(with|and)]] size %int%
get:
set {_l::*} to (((x-coord of expr-1) - (expr-2)), ((x-coord of expr-1) + (expr-2)), ((z-coord of expr-1) - (expr-2)) and ((z-coord of expr-1) + (expr-2)))
set {_c::*} to ((location at {_l::1}, (y-coord of expr-1), {_l::4} in (expr-1's world)), (location at {_l::1}, (y-coord of expr-1), {_l::3} in (expr-1's world)), (location at {_l::2}, (y-coord of expr-1), {_l::3} in (expr-1's world)) and (location at {_l::2}, (y-coord of expr-1), {_l::4} in (expr-1's world)))
return {_c::*}
# Name: Expressible conditions
# Description: Returns the result of a condition.
# Usage: broadcast "YAY" if ((player is alive?) and ({hi} = {yay}?)) is (true and true)
# Credits: Donut
expression:
return type: boolean
patterns:
[if] <(.+)>?
check [if] <(.+)>
output (from|of) [[the] condition] <(.+)>
whether <(.+)>
parse:
set {_condition} to Condition.parse("%regex-1%" and "Can't understand this condition: %regex-1%")
continue if {_condition} is set
get:
return {_condition}.check(event)
# Name: Rounded numbers to N decimal places
# Description: Rounds the given numbers to a certain amount of decimal places smaller
# than or equal to the number accuracy option in config.
# Usage: set {_rnd} to rounded {_xp} with 1 decimal place
expression [the] round[ed] %numbers% (at|with|by|to) %number% decimal[s] [place[s]]:
return type: numbers
get:
loop exprs-1:
add 1 to {_i}
set {_n} to loop-expression
set {_r::%{_i}%} to (round({_n} * 10^floor(expr-2))) / 10^floor(expr-2)
return {_r::*}
# Name: Random UUID
# Description: Returns a random UUID.
# Usage: set {_} to random uuid
expression [a] (random[i(z|s)ed]|new) uuid [(1¦without (dashes|hyphens))]:
return type: string
get:
return (UUID.randomUUID().toString() if parse mark != 1, else UUID.randomUUID().toString().replace("-" and ""))
# Name: Character at
# Description: Get, set or delete the character at a certain index in a string.
# Usage: set {_char} to char at 1 in message
expression [the] char[acter] at [(index|position)] %number% in %string%:
return type: string
get:
return try expr-2.charAt((expr-1) - 1).toString()
set string:
set {_sb} to try new StringBuilder(expr-2)
try {_sb}.setCharAt((expr-1) - 1 and "%change value%")
set raw expr-2 to {_sb}.toString()
delete:
set {_sb} to try new StringBuilder(expr-2).deleteCharAt((expr-1) - 1)
set raw expr-2 to {_sb}.toString()
# Name: Integers with base
# Description: Returns the values of the given integers in a system with radix N.
# Usage: set {_binary} to 10924 to base 2
expression %integers% (in|to|using|with) (base|radix) %number%:
return type: strings
get:
loop exprs-1:
set {_i} to {_i} + 1
set {_n} to loop-expression
set {_r::%{_i}%} to try JavaInteger.toString({_n} and expr-2)
return {_r::*}
# Name: Random string
# Description: Returns a random string with a specified length.
# The string can be alphabetic, alphanumeric, numeric or ascii.
# Usage: set {code::%player%} to random alphanumeric string of length 16
expression random [(alphabetic[al]|1¦alphanumeric[al]|2¦ascii|3¦numeric)] [(string|text)] (of|with) length %number%:
return type: string
get:
return RandomStringUtils.randomAlphanumeric(expr-1) if parse mark = 1
return RandomStringUtils.randomAscii(expr-1) if parse mark = 2
return RandomStringUtils.randomNumeric(expr-1) if parse mark = 3
return RandomStringUtils.randomAlphabetic(expr-1)
# Name: Midnight
# Description: Returns the date of midnight.
# Usage: set {_midnight} to midnight
expression midnight:
return type: date
get:
set {_c} to Calendar.getInstance()
return date(({_c}.get(Calendar.YEAR)), ({_c}.get(Calendar.MONTH) + 1), ({_c}.get(Calendar.DAY_OF_MONTH) + 1), 0, 0, 0, 0)
# Name: Regex split
# Description: Splits a string by a regex.
# Usage: set {_i} to regex split {info} at "\d{5}"
plural expression:
return type: strings
patterns:
regex split %string% (at|by|using) [[the] pattern] %string%
%string% regex split (at|by|using) [[the] pattern] %string%
get:
return ...try expr-1.split(expr-2)
# Name: Protocol version
# Description: Gets the protocol version of a player. (https://wiki.vg/Protocol_version_numbers)
# Usage: kick player due to "Nope..." if protocol version of player <= 578
# Note: Requires ProtocolLib
player property protocol version:
return type: integer
get:
return expr-1.getProtocolVersion()
# Name: Regex matcher
# Description: Gets the Matcher object that can be used to get capturing groups.
# Usage: set {_matcher} to macther of "(\d)" in message
expression [the] [regex] matcher of [pattern] %string% (in|for) %string%:
return type: object
get:
return try RegexPattern.compile(expr-1).matcher(expr-2)
# Name: Capturing group
# Description: Gets a capturing group from a Matcher object.
# Usage: set {_groupOne} to regex group 1 of {_matcher}
expression [the] [regex] [(captur(e|ing)|matching)] group %number% of %object%:
return type: string
get:
expr-2 is instance of Matcher
expr-2.reset()
expr-2.find() is true
return try expr-2.group(expr-1)
# Name: Glowing item
# Description: Returns a glowing version of an item.
# Usage: give player shiny wooden axe
expression [a] (glowing|shiny) %item/itemtype%:
return type: itemtype
get:
set {_r} to expr-1
set {_meta} to {_r}.getItemMeta()
{_meta}.addItemFlags([ItemFlag.HIDE_ENCHANTS])
{_r}.setItemMeta({_meta})
enchant {_r} with (lure 1 if expr-1 is not a fishing rod, else infinity 1)
return {_r}
# Name: Direction of location
# Description: Set or get the direction of a location.
# Usage: set direction of {_location} to vector from {_target} -- vector from player
location property direction:
return type: direction
get:
return new Direction(expr-1.getDirection())
set vector:
expr-1.setDirection(change value)
# Name: Roman numeral
# Description: Get the roman numeral of an integer.
# Usage: send "Sharpness level: %roman numeral of (level of sharpness of player's tool)%"
# Credits: EWS
integer property roman numeral:
return type: string
get:
set {_n} to expr-1
set {_roman::*} to split "M|CM|D|CD|C|XC|L|XL|X|IX|V|IV|I" at "|"
loop 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4 and 1:
add 1 to {_i}
while {_n} >= loop-value:
add 1 to {_next}
remove loop-value from {_n}
set {_r} to "%{_r} ? """"%%{_roman::%{_i}%}%"
return {_r} ? "0"
# Name: Formatted timespan
# Description: Returns a formatted timespan.
# Usage: send "Time played: %(time played of player) formatted ""dd days hh hours mm minutes and ss seconds""%"
expression %timespan% (with format|formatted [as]) %string%:
return type: string
get:
set {_v::seconds} to expr-1.getMilliSeconds() / 1000
set {_format} to expr-2
set {_m::*} to 86400, 3600 and 60
set {_n::*} to "days", "hours" and "minutes"
loop {_n::*}:
set {_v::%loop-value%} to floor({_v::seconds} / {_m::%loop-index%})
set {_v::seconds} to round({_v::seconds} - ({_v::%loop-value%} * {_m::%loop-index%}))
loop {_v::*}:
replace all "%first character of loop-index%%first character of loop-index%" with "%loop-value%" in {_format}
return {_format}
# Name: Compacted number
# Description: Returns the compacted version of a number.
# Usage: send "Balance: %compacted (player's balance)%"
expression compact[ed] %number%:
return type: string
get:
return "%expr-1%" if expr-1 < 1000
set {_s::*} to split "k|M|B|T|Qd|Qi|Sx|Sp|O|N|Dc|U|Du" at "|"
set {_s} to {_s::%floor(log(expr-1) / 3)%}
return "%expr-1 / (1000^floor(log(expr-1) /3) if {_s} is set, else 1000^(size of {_s::*}))%%{_s} ? last element of {_s::*}%"
# Name: Decompacted number
# Description: Returns the decompacted version of a compacted number.
# Usage: set {_ac} to decompacted {_input}
expression (un|de)compact[ed] %string%:
return type: number
get:
loop split "k|M|B|T|Qd|Qi|Sx|Sp|O|N|Dc|U|Du" at "|":
add 1 to {_i}
set {_p} to 1000^{_i}
expr-1 ends with loop-value
exit loop
return ((substring of expr-1 from indices 1 to (length of expr-1)-1) parsed as number) * {_p}
# Name: Factorial
# Description: Returns the factorial of an integer.
# Usage: set {_combinations} to factorial {elements}
expression:
return type: integer
patterns:
factorial [of] %integer%
%integer%(!| factorial)
get:
return (product(all integers from 1 to expr-1) if expr-1 is not 0, else 1)
# Name: Trimmed string
# Description: Removes excess spaces from a string.
# Usage: set message to trimmed message
expression trim[med] %string%:
return type: string
get:
return try expr-1.replaceAll("\s{2,}" and " ").replaceAll("^\s*" and "").replaceAll("\s*$" and "")
# Name: English plural
# Description: Returns the English plural of a word.
# Usage: set {_} to english plural of arg-1
# Note: Can be inaccurate.
string property [english] plural:
return type: string
get:
return Utils.toEnglishPlural(expr-1)
# Name: Entity ID
# Description: Returns the entity id of the given entities.
# Usage: set int field 0 of {_packet} to entity id of {_t}
entities property e[ntity][ ]id[entifier][s]:
return type: integers
get:
loop exprs-1:
set {_eid} to loop-expression.getEntityId()
set {_r::%{_eid}%} to {_eid}
return {_r::*}
# Name: Pixel width
# Description: Returns the pixel width of a given string.
# Usage: set {_px} to pixel width of {_input}
string property pixel (width|size|length):
return type: integer
get:
return new MinecraftFont().getWidth(expr-1)
# Name: Direction from two locations
# Description: Returns the direction from a location to another.
# Usage: push player (direction from player to targeted entity of player) at speed 10
expression [the] direction from %location% to %location%:
return type: direction
get:
return try new Direction(vector from expr-2 to expr-1)
# Name: Dyed item
# Description: Returns a dyed version of an item.
# Usage: give player leather helmet colored rgb(20, 20, 90)
expression %item/itemtype% (colo[u]red|dyed|painted) %color%:
return type: item
get:
set {_r} to expr-1
dye {_r} expr-2
return {_r}
# Name: Moon phase
# Description: Returns the moon phase in a world.
# Usage: broadcast "%moon phase in player's world%"
expression [the] moon phase (of|in) [[the] world] %world%:
return type: string
get:
set {_phase} to mod(floor(expr-1.getFullTime() / 24000), 8) + 1
set {_phases::*} to split "full moon|waning gibbous|third quarter|waning crescent|new moon|waxing crescent|first quarter|waxing gibbous" at "|"
return {_phases::%{_phase}%}
# Name: Collar color
# Description: Get or set the collar color of an entity (wolf/cat).
# Usage: set collar color of (player's targeted entity) to red
livingentity property collar colo[u]r:
return type: color
get:
return if expr-1 is not a wolf or a cat
return SkriptColor.fromDyeColor(expr-1.getCollarColor())
set color:
expr-1 is a wolf or a cat
expr-1.setCollarColor((change value).asDyeColor())
# Name: Item frame rotation
# Description: Get or set the rotation of an item frame.
# Usage: set rotation of {_if} to flipped
entity property rotation:
return type: object
get:
return if expr-1 is not an item frame
return Rotation.values()[Rotation.ordinal(expr-1.getRotation())]
set object:
expr-1 is an item frame
change value is instance of Rotation
expr-1.setRotation(change value)
# Name: Server operators
# Description: Returns the all of the opped players on the server.
# Usage: loop all operators:
plural expression [(all [[of] the]|the)] (op[ped] players|op[erator]s):
loop of: player
return type: offline players
get:
return ...server.getServer().getOperators()
# Name: Banned players
# Description: Returns all of the banned players on the server.
# Usage: broadcast "%banned players%"
plural expression [(all [[of] the]|the)] banned players:
loop of: player
return type: offline players
get:
return ...server.getServer().getBannedPlayers()
# Name: Maximum age
# Description: Returns the maximum age of a block.
# Usage: set {_tG} to maximum age of {_b}
block property max[imum] age:
return type: integer
get:
return if try expr-1.getBlockData() is not instance of BlockDataAgeable
return expr-1.getBlockData().getMaximumAge()
# Name: Item with item flags
# Description: Returns an item with the given itemflags.
# Usage: set {_i} to diamond sword with flags "hide attributes"
expression %item/itemtype% with [item[ ]]flag[s] %objects%:
return type: item
get:
set {_r} to expr-1
set {_m} to {_r}.getItemMeta()
loop exprs-2:
loop-expression is instance of ItemFlag
{_m}.addItemFlags([loop-expression])
{_r}.setItemMeta({_m})
return {_r}
# Name: Item flags of item
# Description: Returns a list with the item flags of an item.
# Usage: set {_flags::*} to item flags of player's tool
plural object property [item[ ]]flag[s]:
return type: objects
get:
return ...(random item of expr-1).getItemMeta().getItemFlags()
# Name: Progress bar
# Description: Creates a progress bar of a given length from the total and current values.
# Usage: send progress bar of size 10 from (player's balance) to {rankup::prices::%{_nextRank}%} using the character "|" and colors yellow and pink
expression [a] progress bar of (size|length) %integer% from %number% to %number% (using|with) [[the] char[acter][s]] %string% [[[and [the]] colo[u]rs %-color%[( and|,[ ])]%-color%]:
return type: string
get:
loop expr-1 times:
set {_bar} to "%{_bar} ? """"%%expr-4%"
set {_c} to (expr-2 / expr-3) * expr-1 * (length of expr-4)
return ("<%expr-5 ? lime%>%(subtext of {_bar} from indices 1 to {_c}) ? """"%<%expr-6 ? light gray%>%(subtext of {_bar} from indices {_c} + 1 to (length of {_bar})) ? """"%")
# Name: Soundex value
# Description: Returns the soundex value of a string.
# Usage: send "Use `command` not `%arg-1%`" if soundex value of "command" is soundex value of arg-1
string property soundex [value]:
return type: string
get:
return new Soundex().encode(expr-1)
# Name: Centered string
# Description: Returns the string and spaces to make it centered.
# Usage: send centered "ooooooo hiiii"
# Note: Can be slightly inaccurate.
# Bold color codes will mess up the centering.
expression center[ed] %string% [(with|from) [a] size [of] %-integer%]:
return type: string
get:
set {_total} to (expr-2 ? 323)
set {_center} to floor({_totalSize} / 2)
set {_inputpx} to pixel length of uncolored expr-1
set {_remainingpx} to {_total} - {_inputpx}
set {_tospacepx} to floor({_remainingpx} / 2)
while ({_spacedpx} ? 0) < {_tospacepx}:
set {_r} to "%{_r} ? """"% "
set {_spacedpx} to {_spacedpx} + (pixel width of " ") + 2 - (1 if {_i} is not set, else 0)
set {_i} to {_i} + 1
return "%{_r} ? """"%%expr-1%"
# Name: Nth root
# Description: Returns the Nth root of a number.
# Usage: send "%cube root of 125%"
# Note: Can be inaccurate when dealing with high numbers.
# Does not work with negative numbers.
number property (%-number%(st|nd|rd|th)|2¦square|3¦cube) root:
return type: number
get:
return 0 if expr-1 < 0
return expr-1 ^ (1 / (expr-2 ? parse mark))
# Name: Absorption hearts
# Description: Get or set the absorption hearts of an entity.
# Usage: set player's absorption hearts to 1
living entity property absorption (heart[s]|amount|points):
return type: number
get:
return expr-1.getAbsorptionAmount() / 2
set number:
try expr-1.setAbsorptionAmount((change value) * 2)
add number:
try expr-1.setAbsorptionAmount((expr-1.getAbsorptionAmount()) + ((change value) * 2))
remove number:
try expr-1.setAbsorptionAmount((expr-1.getAbsorptionAmount()) - ((change value) * 2))
delete:
expr-1.setAbsorptionAmount(0)
# Name: World border center
# Description: Get or set the center of the world border of a world.
# Usage: set world border center of event-world to player
world property world[(-| )]border (center|middle):
return type: location
get:
return expr-1.getWorldBorder().getCenter()
set location:
expr-1.getWorldBorder().setCenter(change value)
# Name: World border size
# Description: Get or change the size of the world border of a world.
# Usage: remove 1 from worldborder size of event-world