-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathdWorldManager.yml
More file actions
1706 lines (1596 loc) · 56.8 KB
/
dWorldManager.yml
File metadata and controls
1706 lines (1596 loc) · 56.8 KB
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
################################################################################
# #
# d W o r l d M a n a g e r #
# #
# #
# Authors: |Anthony| #
# Version: 0.26 #
# dScript Version: 0.9.8-DEV-b646 #
# #
# For bleeding-edge code, bug reports, code contributions, and feature #
# requests, visit the GitHub project: #
# - github.com/AnthonyAMC/Public-Denizen-Scripts/blob/master/dWorldManager.yml
# #
# Has my work helped you in some way? Show your support by clicking the #
# Like button. #
# Feeling generous? Get me a coffee :D #
# https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=NPXKHCNMTGSUG
# #
#------------------------------------------------------------------------------#
# #
# #
#--- About this script #
# #
# dWorldManager is a world management system written with the Denizen #
# Scripting Engine. It is meant to take the place of existing world #
# management plugins such as MultiVerse for those of us who want a pure #
# Denizen Server. #
# #
# dWM is fairly feature rich, providing commands for all the basic world #
# operations. More configuration options will come. #
# #
#______________________________________________________________________________#
#
# Dependencies:
#
# - ConfigFileGenerator
# - Used to build default config files and data storage.
# - https://github.com/AnthonyAMC/Public-Denizen-Scripts/blob/master/ConfigFileGenerator.yml
#
# - MessageConstructorLibrary
# - Used for all message output
# - https://github.com/AnthonyAMC/Public-Denizen-Scripts/blob/master/MessageConstructors.yml
#
#
#_______________________________________________________________________________
#
# Command Permission Description
#
# Every command has it's own permission, i'm too lazy to type them all here atm
# /dwm help [arg/#] dwm.help Get help.
#
#
# TODO:
#
# - Better code docs
# - level.dat not generated on world creation... must address
#
################################################################################
#
# dWorldManager Version
#
# Handles dWM Versioning Checks
#
dWM_Version:
type: version
author: Anthony
name: dWorldManager
version: 0.26
description: Denizen World Manager
id: 93
#
# END dWorldManager Version
#--------------------------------------
#
################################################################################
#
# dWorldManager Events
#
# This should cover all dWM related world events.
#
dWM_Events:
type: world
debug: false
events:
on system time hourly:
- if !<yaml[dWM_config].read[config.stats.useStats]||true> {
- queue clear
}
- if <queue.list> !contains 'q@dWM_UpdateCheck' {
- run locally delay:1t updateCheck 'id:dWM_UpdateCheck'
}
- if <queue.list> !contains 'q@dWM_SendMetrics' {
- run locally delay:1t sendMetrics 'id:dWM_SendMetrics'
}
on server prestart:
- inject locally loadYaml
- foreach <server.list_worlds.parse[name]> {
- if !<yaml[dWM_Config].list_keys[worlds].contains[%value%]||false> {
- run s@msgPrefixed 'def:dWM|<&3>Adding %value% to the config file...'
- yaml set 'worlds.%value%.loaded:true' 'id:dWM_Config'
- yaml 'savefile:dWorldManager/config.yml' 'id:dWM_Config'
}
}
- define path '<yaml[dWM_Config].read[config.worldpath]||../..>'
- foreach '<yaml[dWM_Config].list_keys[worlds]||li@>' {
- if <server.has_file[%path%/%value%]> {
- if <yaml[dWM_Config].read[worlds.%value%.loaded]||true> {
- createworld '%value%' 'worldtype:<yaml[dWM_Config].read[worlds.%value%.worldtype]||NORMAL>' 'environment:<yaml[dWM_Config].read[worlds.%value%.environment]||NORMAL>'
}
}
# Maybe we shouldn't do this here and instead remove deleted worlds from the configs with only the purge command?
else if <yaml[dWM_Config].read[config.remove_deleted]||false> {
- yaml set 'worlds.%value%:!' 'id:dWM_Config'
- yaml 'savefile:dWorldManager/config.yml' 'id:dWM_Config'
}
}
on server start:
- if <queue.list> !contains 'q@dWM_UpdateCheck' {
- run locally delay:1t updateCheck 'id:dWM_UpdateCheck'
}
- run locally instantly load_command_list delay:1t
on server shutdown:
- yaml 'savefile:dWorldManager/config.yml' 'id:dWM_Config'
on player quits:
- define w '<player.location.world.name>'
- define loc '<player.location.before[,%w%].after[l@]>'
- run instantly delay:1t s@dWM_SetLL 'def:quit|<player>|%w%|%loc%'
on player teleports:
- define w '<c.origin.world.name>'
- define loc '<c.origin.before[,%w%].after[l@]>'
- run instantly delay:1t s@dWM_SetLL 'def:teleport|<player>|%w%|%loc%'
on player dies:
- define w '<player.location.world.name>'
- define loc '<player.location.before[,%w%].after[l@]>'
- run instantly delay:1t s@dWM_SetLL 'def:death|<player>|%w%|%loc%'
on player enters bed priority:1000 ignorecancelled:false:
- define w '<c.location.world.name>'
- define loc '<c.location.before[,%w%].after[l@]>'
- run instantly delay:1t s@dWM_SetLL 'def:bed|<player>|%w%|%loc%'
on world loads:
- if !<yaml[dWM_Config].list_keys[worlds].contains[<context.world.name>]||false> {
- run s@msgPrefixed 'def:dWM|<&3>Adding <context.world.name> to the config file...'
- yaml set 'worlds.<context.world.name>.loaded:true' 'id:dWM_Config'
- yaml 'savefile:dWorldManager/config.yml' 'id:dWM_Config'
}
on world initializes:
- if !<yaml[dWM_Config].list_keys[worlds].contains[<context.world.name>]||false> {
- run s@msgPrefixed 'def:dWM|<&3>Adding <context.world.name> to the config file...'
- yaml set 'worlds.<context.world.name>.loaded:true' 'id:dWM_Config'
- yaml 'savefile:dWorldManager/config.yml' 'id:dWM_Config'
}
on script reload:
- run locally instantly reloadYaml
- if <queue.list> !contains 'q@dWM_UpdateCheck' {
- run locally delay:1t updateCheck 'id:dWM_UpdateCheck'
}
- run delay:1t locally instantly load_command_list
load_command_list:
- flag server 'dWM.Command_List:!'
- flag server 'dWM.Command_List:|:<server.list_scripts.filter[starts_with[s@dWM_Commands_]].parse[after[s@dWM_Commands_]].alphanumeric.to_lowercase||li@>'
loadYaml:
# Reloads the yaml files and generates default files if they don't exist.
# Rewrites config files that do not match internal version number!
- if !<server.has_file[dWorldManager/config.yml]> {
- inject locally createConfigFile
- run s@msgPrefixed 'def:dWM|<&7><&o>Created config file!'
}
else {
- run s@msgPrefixed 'def:dWM|<&3>Loading system config files...'
}
- if <yaml.list.contains[dWM_Config]> {
- yaml unload 'id:dWM_Config'
}
- yaml 'load:dWorldManager/config.yml' 'id:dWM_Config'
- if <yaml[dWM_Config].read[config.version].is[!=].to[<s@dWM_Configurations.yaml_key[config.version]>]||true> {
- define isUpdate ''
- inject locally createConfigFile
- define isUpdate:!
- run s@msgPrefixed 'def:dWM|<&7><&o>Updated config file!'
}
- run s@msgPrefixed 'def:dWM|<&a>System config files Loaded!'
updateCheck:
- ^if !<server.has_flag[dWM.Version.Repo]> {
- ~webget "https://one.denizenscript.com/denizen/repo/version/<s@dWM_Version.yaml_key[id]>" save:page
- ^flag server "dWM.Version.Repo:<entry[page].result||unknown>" d:1h
}
- ^define repoVersion '<server.flag[dWM.Version.Repo]||unknown>'
- ^define currentVersion '<s@dWM_Version.yaml_key[version]>'
- ^if '%repoVersion%' == 'unknown' {
- run s@msgPrefixed instantly 'def:dWM|<&7>Unable to check for update! <&7><&o>%currentVersion%<&7> is installed!'
}
else if '%repoVersion%' > '%currentVersion%' {
- run s@msgPrefixed instantly 'def:dWM|<&7>Update from version <&o>%currentVersion%<&7> to <&o>%repoVersion%<&7>!'
}
else if '%repoVersion%' != '%currentVersion%' {
- run s@msgPrefixed instantly 'def:dWM|<&7>What happened? You are on version <&o>%currentVersion%<&7> and the repo says <&o>%repoVersion%<&7>!'
}
sendMetrics:
# - run s@msgPrefixed 'def:dWM|<&3>Sending usage metrics...'
- ~webget "http://stats.denizenscript.com/tracker?script=<s@dWM_Version.yaml_key[id]>&version=<s@dWM_Version.yaml_key[version]>&players=<server.list_online_players.size>&denizen_version=<server.denizen_version.replace[-SNAPSHOT].before[ ]>&jenkins_build=<server.denizen_version.after[(build ].before[)]>&bukkit_version=<server.bukkit_version>" 'save:send'
- if !<entry[send].result.starts_with[SUCCESS]||false> {
- run s@msgPrefixed instantly 'def:dWM|<&c>Metrics failed!'
}
reloadYaml:
# A simpler reload
- run s@msgPrefixed 'def:dWM|<&7><&o>Reloading system config files...'
- if <yaml.list.contains[dWM_Config]> {
- yaml unload 'id:dWM_Config'
}
- yaml 'load:dWorldManager/config.yml' 'id:dWM_Config'
- run s@msgPrefixed 'def:dWM|<&7><&o>System config files Loaded!'
createConfigFile:
- define readID 'dWM_Configurations'
- define writeID 'dWM_Config'
- if !<yaml.list.contains[%readID%]> {
- yaml fix_formatting 'load:<script.relative_filename>' 'id:%readID%'
}
- define readPath '%readID%.config'
- define writePath 'config'
- if <def[isUpdate].exists||false> {
- run s@ConfigFileGenerator 'def:%readID%|%writeID%|%readPath%|%writePath%|false|false|true' instantly
}
else {
- yaml create 'id:%writeID%'
- run s@ConfigFileGenerator 'def:%readID%|%writeID%|%readPath%|%writePath%|false|false|false' instantly
}
- yaml unload 'id:%readID%'
- yaml 'savefile:dWorldManager/config.yml' 'id:%writeID%'
#
# END dWorldManager Events
#--------------------------------------
#
#
################################################################################
#
# dWorldManager Commands
#
# Every command has its own script container. The root command functions mostly
# as link to specific commands and provides some initial processing.
#
#
#--------------------------------------
#
# dWM Command Script Registrar
#
# The root command. Validates minor input and sends to command script.
#
dWM_Commands:
type: command
debug: false
name: dwm
description: Denizen World Manager
usage: /dworldmanager
aliases: 'dworldmanager'
allowed help:
- determine <player.has_permission[dwm.basic]||<player.is_op>>
script:
- define command '<c.args.get[1].escaped||help>'
- define commands '<server.flag[dWM.Command_List].as_list||li@>'
- define args '<c.args.get[2].to[<c.args.size>].escape_contents||li@>'
- if !<def[commands].contains[%command%]> || !<proc[dWM_HasPerm_Command].context[%command%|<player||server>]> {
- inject s@dWM_Commands_Help
}
- inject s@dWM_Commands_%command%
tab complete:
- define command '<c.args.get[1]||>'
- define commands '<server.flag[dWM.Command_List].as_list||li@>'
- define args '<c.args.get[2].to[<c.args.size>]||li@>'
- define spaces '<c.raw_args.to_list.count[ ]||0>'
- if <def[commands].contains[%command%]> {
- inject s@dWM_Commands_%command% 'p:tab complete'
}
else {
- define commands '<def[commands].filter[starts_with[%command%]]||%commands%>'
}
- foreach %commands% {
- if !<proc[dWM_HasPerm_Command].context[%command%|<player||server>]> {
- define commands '<def[commands].exclude[%value%]||%commands%>'
}
}
- if <def[commands].is_empty||true> {
- determine 'li@'
}
- determine '<def[commands]||li@>'
# Preprocessors. Does some pre-processing and passes back to the calling command
prerun:
- if <c.server||false> {
- define sender 'server'
}
else {
- define sender '<player>'
}
- if <c.alias> == 'dwm%command%' {
- if !<proc[dWM_HasPerm_Command].context[%command%|<player>]> {
- inject s@dWM_Commands_Help p:helpList
- queue clear
}
- define commands '<server.flag[dWM.Command_List].as_list||li@>'
- define args "<c.args.escape_contents>"
}
#
# END dWM Command Registrar
#--------------------------------------
#
#
################################################################################
#
#
# dWorldManager Command Scripts
#
# This section holds all of the commands for dWorldManager. The root command /dWM
# takes many arguments but most of those arguments can also be run as individual
# commands. This results in dWorldManager command args having a shorthand version
# in the form of /dwmarg
#
dWM_Commands_Help:
type: command
debug: false
speed: 0
name: dwmhelp
description: Show dWorldManager help
usage: /dwmhelp
aliases: ''
allowed help:
- determine <player.has_permission[dWM.basic]||<player.is_op>>
data:
description:
- ' The help docs provide usage info and examples for all commands.'
- ' '
- ' <&6><&l>Clickable page navigation is available!'
usage: '/dwm help (<<>arg<>>) (<<><&ns><>>)'
examples:
- '<&f>To show the <&a>second<&f> page of help for the <&2>help<&f> command'
- '<&sp>'
- ' <&e>/dwm help <&2>help <&a>2'
- ' '
- '<&f>To show the <&a>third<&f> page of the help files'
- '<&sp>'
- ' <&e>/dwm help <&a>3'
permissions: []
tab complete:
- if !<def[command].exists> {
- define commands '<server.flag[dWM.Command_List].as_list||li@>'
- define args "<c.args>"
}
- define command '<def[args].get[1].escaped||>'
- if <def[commands].contains[%command%]> {
- determine 'li@'
}
else {
- define commands '<def[commands].filter[starts_with[%command%]]||%commands%>'
}
- foreach %commands% {
- if !<proc[dWM_HasPerm_Command].context[%command%|<player||server>]> {
- define commands '<def[commands].exclude[%value%]||%commands%>'
}
}
- if <def[commands].is_empty||true> {
- determine 'li@'
}
- determine '<def[commands]||li@>'
script:
- if !<def[command].exists> {
- define command 'help'
}
- inject s@dWM_Commands p:prerun
- define arg '<def[args].get[1].escaped||1>'
- if <def[commands].contains[%arg%]||false> {
- define command '%arg%'
- define page '<tern[<def[args].get[2].is[matches].to[number]||false>]:<def[args].get[2].abs.round>||1>'
- inject s@dWM_Commands_Help p:helpCommand
- queue clear
}
- define page '<tern[<def[arg].is[matches].to[number]||false>]:<def[arg].abs.round>||1>'
- inject s@dWM_Commands_Help p:helpList
- queue clear
helpList:
# Filter the list of commands this player can use
# Build the help documentation
- define helpDoc 'li@'
- foreach %commands% {
- if !<proc[dWM_HasPerm_Command].context[%value%|<player||server>]> {
- define commands '<def[commands].exclude[%value%]>'
}
else {
- define button '<proc[msgCommand].context[<def[value].to_titlecase><&co>|dwm help %value%|<&a>Click for <&b><def[value].to_titlecase> <&a>help]>'
- define helpDoc '<def[helpDoc].include[%button%<&sp><&7><parse:<s@dWM_Commands_%value%.yaml_key[description]||Short Description>>|<&e.pad_left[3].with[<&sp>]><proc[msgTrim].context[48|<parse:<s@dWM_Commands_%value%.yaml_key[data.usage]||No usage info available!>>]>]>'
}
}
- run s@msgBoxed instantly 'def:dWM|<proc[msgCommand].context[<&6>dWorldManager|dwm about|<&a>Click to learn<&nl><&a>about the project!]>|<proc[msgCommand].context[<&e>Help|dwm help|<&a>Go back to main help]> Files|dWM help|<def[page]||1>|52|10|<def[helpDoc].separated_by[|]>'
helpCommand:
# Help for a specific command
- define short '<parse:<s@dWM_Commands_%command%.yaml_key[description]||A not so useless description should be here!>>'
- define desc '<parse:<s@dWM_Commands_%command%.yaml_key[data.description]||A not so useless description should be here!>>'
- define usage '<parse:<s@dWM_Commands_%command%.yaml_key[data.usage]||No help for you!>>'
- define examples '<parse:<s@dWM_Commands_%command%.yaml_key[data.examples]||No help for you!>>'
- define entries '<&7>%short%| |%desc%| |<&b><&n>Usage<&co>| |<&e.pad_left[3].with[ ]>%usage%| |<&3><&n>Examples<&co>| |%examples%'
- run s@msgBoxed instantly 'def:dWM|<proc[msgCommand].context[<&6>dWorldManager|dwm about|<&a>Click to learn<&nl><&a>about the project!]>|<proc[msgCommand].context[<&e>Help|dwm help|<&a>Go back to main help]> - <def[command].to_titlecase>|dWM help %command%|<def[page]||1>|52|10|%entries%'
dWM_Commands_About:
type: command
debug: false
speed: 0
name: dwmabout
description: Details about the project
usage: /dwmabout
aliases: ''
data:
description:
- ' dWorldManager is a world management system written with the Denizen Scripting Engine. It is meant to take the place of existing world management plugins such as MultiVerse for those of us who want a pure Denizen Server.'
- ' '
- ' dWM is fairly feature rich, providing all the familiar commands you would expect from a world manager.'
- ' '
- ' Future development will bring more advanced world configuration options. Maybe dWM will even provide world instancing support if that sort of thing is useful to people.'
usage: '/dwm about'
examples:
- 'You<&sq>ve got to be kidding me...'
- ' <proc[msgUrl].context[<&e>/dwm|data.whicdn.com/images/129295787/large.jpg|If you click this...<&nl>I just don<&sq>t even know...]> <proc[msgUrl].context[<&e>about|data.whicdn.com/images/129295787/large.jpg|If you click this...<&nl>I just don<&sq>t even know...]>'
- ' '
permissions: []
tab complete:
- determine 'li@'
script:
- if !<def[command].exists> {
- define command 'about'
}
- inject s@dWM_Commands p:prerun
- run s@msgBoxed instantly 'def:dwm|<proc[msgCommand].context[<&6>dWorldManager|dwm help|<&a>Go back to main help]>|<&e>About|dwm about|<tern[<def[args].get[1].is[matches].to[number]||false>]:<def[args].get[1].abs.round>||1>|52|10|<&7><parse:<s@dWM_Commands_%command%.yaml_key[description]>>| |<parse:<s@dWM_Commands_%command%.yaml_key[data.description]>>'
dWM_Commands_List:
type: command
debug: false
speed: 0
name: dwmlist
description: List all worlds
usage: /dwmlist
aliases: ''
data:
description:
- ' Lists all worlds known to dWM.'
- ' <&a>Green<&f> worlds are loaded'
- ' <&7>Gray<&f> worlds are unloaded'
- ' <&8>Dark gray<&f> worlds are not registered'
usage: '/dwm list'
examples:
- 'You<&sq>ve got to be kidding me...'
- ' <proc[msgUrl].context[<&e>/dwm|data.whicdn.com/images/129295787/large.jpg|If you click this...<&nl>I just don<&sq>t even know...]> <proc[msgUrl].context[<&e>list|data.whicdn.com/images/129295787/large.jpg|If you click this...<&nl>I just don<&sq>t even know...]>'
- ' '
permissions: []
tab complete:
- determine 'li@'
script:
- if !<def[command].exists> {
- define command 'list'
}
- inject s@dWM_Commands p:prerun
- define path '<yaml[dWM_Config].read[config.worldpath]||../..>'
- define worlds 'li@'
- define n '0'
- foreach '<server.list_files[%path%]>':
- if !<server.has_file[%path%/%value%/level.dat]> {
- foreach next
}
- define v '<proc[dWM_VW].context[%value%]>'
- choose '%v%':
- case '0':
- define n '<def[n].add[1].as_int>'
- define desc '<&b><yaml[dWM_Config].read[worlds.%value%.description].as_list.separated_by[<&nl><&b>]||<&5>No Description>'
- define worlds '<def[worlds].include[<&e>%n%. <proc[msgHover].context[<&a>%value%|%desc%]>]>'
- case '4':
- define n '<def[n].add[1].as_int>'
- define desc '<&b><yaml[dWM_Config].read[worlds.%value%.description].as_list.separated_by[<&nl><&b>]||<&5>No Description>'
- define worlds '<def[worlds].include[<&e>%n%. <proc[msgHover].context[<&8>%value%|%desc%]>]>'
- case '5':
- define n '<def[n].add[1].as_int>'
- define desc '<&b><yaml[dWM_Config].read[worlds.%value%.description].as_list.separated_by[<&nl><&b>]||<&5>No Description>'
- define worlds '<def[worlds].include[<&e>%n%. <proc[msgHover].context[<&7>%value%|%desc%]>]>'
- run s@msgBoxed instantly 'def:dwm|<proc[msgCommand].context[<&6>dWorldManager|dwm help|<&a>Go back to main help]>|<&e>World List|dwm list|<tern[<def[args].get[1].is[matches].to[number]||false>]:<def[args].get[1].abs.round>||1>|52|10|<def[worlds].separated_by[|]>'
dWM_Commands_Create:
type: command
debug: false
name: dwmcreate
description: Create new worlds
usage: /dwmcreate
aliases: ''
data:
description: 'Create new worlds'
usage: '/dwm create <&lb><<>name<>><&rb> (g<&co><<>generator<>>) (t<&co><<>type<>>) (e<&co><<>environment<>>)'
examples:
- 'Create a normal world named denizen'
- ' <&e>/dwm create denizen'
- ' '
- 'Create a nether world named hell'
- ' <&e>/dwm create hell e:NETHER'
- ' '
- 'Create an amplified end world named megaend'
- ' <&e>/dwm create megaend t:AMPLIFIED e:THE_END'
- ' '
- 'Create a normal world named city using the CityWorld generator'
- ' <&e>/dwm create city g:CityWorld'
- ' '
permissions:
- admin
- create
tab complete:
- determine 'li@'
script:
- if !<def[command].exists> {
- define command 'create'
}
- inject s@dWM_Commands p:prerun
- inject s@dWM_ParseArgs
- if !<def[t].exists> {
- define t 'NORMAL'
}
- if !<def[e].exists> {
- define e 'NORMAL'
}
- define w '<def[worlds].get[1].escaped.to_lowercase||null>'
- define v '<proc[dWM_VW].context[%w%]>'
- define vval 'li@3'
- inject s@dWM_CreateWorldConfigs
- run s@msgPrefixed 'def:dWM|<&a>Created <&o>%w%<&a>!'
dWM_Commands_Unload:
type: command
debug: false
name: dwmunload
description: Unload worlds
usage: /dwmunload
aliases: ''
data:
description: 'Unload worlds from the system. Does not delete them!'
usage: '/dwm unload <&lb><<>name<>><&rb>'
examples:
- 'Unload the world named denizen'
- ' <&e>/dwm unload denizen'
- ' '
permissions:
- admin
- unload
tab complete:
- determine 'li@'
script:
- if !<def[command].exists> {
- define command 'unload'
}
- inject s@dWM_Commands p:prerun
- inject s@dWM_ParseArgs
- define w '<def[worlds].get[1].escaped||null>'
- inject s@dWM_UnloadWorld
- run s@msgPrefixed 'def:dWM|<&d><&o>%w% <&d>has been unloaded.'
dWM_Commands_Load:
type: command
debug: false
name: dwmload
description: Load worlds
usage: /dwmload
aliases: ''
data:
description: 'Load registered worlds'
usage: '/dwm load <&lb><<>name<>><&rb>'
examples:
- 'Load the world named denizen'
- ' <&e>/dwm load denizen'
- ' '
permissions:
- admin
- load
tab complete:
- determine 'li@'
script:
- if !<def[command].exists> {
- define command 'load'
}
- inject s@dWM_Commands p:prerun
- inject s@dWM_ParseArgs
- define w '<def[worlds].get[1].escaped||null>'
- inject s@dWM_LoadWorld
- run s@msgPrefixed 'def:dWM|<&a>Loaded <&o>%w%<&a>!'
dWM_Commands_Reload:
type: command
debug: false
name: dwmreload
description: Reload config file
usage: /dwmreload
aliases: ''
data:
description: 'Reload dWM config files.'
usage: '/dwm reload'
examples:
- 'If you<&sq>ve been given access to this command, you<&sq>d better damn well know how to use it!'
- ' <proc[msgUrl].context[<&e>/dwm|data.whicdn.com/images/129295787/large.jpg|I wonder what happens when i click this...]> <proc[msgUrl].context[<&e>reload|data.whicdn.com/images/129295787/large.jpg|I wonder what happens when i click this...]>'
- ' '
permissions:
- admin
- unload
tab complete:
- determine 'li@'
script:
- if !<def[command].exists> {
- define command 'reload'
}
- inject s@dWM_Commands p:prerun
- inject s@dWM_Events p:reloadYaml
- inject s@dWM_Events p:load_command_list
dWM_Commands_Remove:
type: command
debug: false
name: dwmremove
description: Remove worlds
usage: /dwmremove
aliases: ''
data:
description:
- 'Remove worlds from the system.'
- 'This command will DELETE world files, but will keep the dWM configurations for it.'
usage: '/dwm remove <&lb><<>name<>><&rb>'
examples:
- 'Remove the world named denizen'
- ' <&e>/dwm remove denizen'
- ' '
permissions:
- admin
- remove
tab complete:
- determine 'li@'
script:
- if !<def[command].exists> {
- define command 'remove'
}
- inject s@dWM_Commands p:prerun
- inject s@dWM_ParseArgs
- define w '<def[worlds].get[1].escaped||null>'
- define v '<proc[dWM_VW].context[%w%]>'
- if 'li@0|4|5' !contains '%v%' {
- run instantly delay:1t 's@dWM_Error' 'def:world|%v%|%sender%|%w%'
- queue clear
}
- if !<server.has_flag[dWM.RemoveWorld.%sender%.%w%]> {
- run s@msgPrefixed 'def:dWM|<&d>Enter command again to confirm removing %w%!'
- flag server 'dWM.RemoveWorld.%sender%.%w%' d:100t
- queue clear
}
- flag server 'dWM.RemoveWorld.%sender%.%w%:!'
- inject s@dWM_RemoveWorld
- run s@msgPrefixed 'def:dWM|<&a>Removed <&o>%w%<&a>!'
dWM_Commands_Purge:
type: command
debug: false
name: dwmpurge
description: Remove world data
usage: /dwmpurge
aliases: ''
data:
description:
- 'Remove world data from dWM.'
- 'This command will purge all world data from dWM.'
usage: '/dwm purge <&lb><<>name<>><&rb>'
examples:
- 'Purge the world named denizen'
- ' <&e>/dwm purge denizen'
- ' '
permissions:
- admin
- purge
tab complete:
- determine 'li@'
script:
- if !<def[command].exists> {
- define command 'purge'
}
- inject s@dWM_Commands p:prerun
- inject s@dWM_ParseArgs
- define w '<def[worlds].get[1].escaped||null>'
- define v '<proc[dWM_VW].context[%w%]>'
- if 'li@1|2|4' contains '%v%' {
- run instantly delay:1t 's@dWM_Error' 'def:world|%v%|%sender%|%w%'
- queue clear
}
- if '%v%' == '0' {
- run instantly delay:1t 's@dWM_Error' 'def:purge|1|%sender%|%w%'
- queue clear
}
else if '%v%' == '3' {
- if !<yaml[dWM_Config].contains[worlds.%w%]> {
- run instantly delay:1t 's@dWM_Error' 'def:purge|2|%sender%|%w%'
- queue clear
}
}
- if !<server.has_flag[dWM.PurgeWorld.%sender%.%w%]> {
- run s@msgPrefixed 'def:dWM|<&d>Enter command again to confirm purging %w%!'
- flag server 'dWM.PurgeWorld.%sender%.%w%' d:100t
- queue clear
}
- flag server 'dWM.PurgeWorld.%sender%.%w%:!'
- yaml set 'worlds.%w%:!' 'id:dWM_Config'
- yaml 'savefile:dWorldManager/config.yml' 'id:dWM_Config'
- run s@msgPrefixed 'def:dWM|<&a>Purged <&o>%w%<&a> from config files!'
dWM_Commands_Import:
type: command
debug: false
name: dwmimport
description: Import an existing world
usage: /dwmimport
aliases: ''
data:
description:
- 'You can import pre-made worlds by placing them in your world folder and running the importer.'
- 'Worlds will not be registered with dWM unless they have been imported!'
usage: '/dwm import <&lb><<>name<>><&rb>'
examples:
- 'Import the world named denizen'
- ' <&e>/dwm import denizen'
- ' '
permissions:
- admin
- import
tab complete:
- determine 'li@'
script:
- if !<def[command].exists> {
- define command 'import'
}
- inject s@dWM_Commands p:prerun
- inject s@dWM_ParseArgs
- if !<def[t].exists> {
- define t 'NORMAL'
}
- if !<def[e].exists> {
- define e 'NORMAL'
}
- define w '<def[worlds].get[1].escaped||null>'
# - inject s@dWM_ImportWorld
- define v '<proc[dWM_VW].context[%w%]>'
- define vval 'li@4'
- inject s@dWM_CreateWorldConfigs
- run s@msgPrefixed 'def:dWM|<&a>Imported <&o>%w%<&a>!'
- if <server.list_scripts> contains 's@dRegions_WG_Importer' {
- run s@dRegions_WG_Importer 'def:%w%'
}
dWM_Commands_Clone:
type: command
debug: false
name: dwmclone
description: Clone an existing world
usage: /dwmclone
aliases: ''
data:
description:
- 'You can clone existing worlds.'
- 'Worlds will not be registered with dWM unless they have been imported!'
usage: '/dwm clone <&lb><<>oldWorld<>><&rb> <&lb><<>newWorld<>><&rb>'
examples:
- 'Clone the world named denizen and name it doodlepop'
- ' <&e>/dwm clone denizen doodlepop'
- ' '
permissions:
- admin
- clone
tab complete:
- determine 'li@'
script:
- if !<def[command].exists> {
- define command 'clone'
}
- inject s@dWM_Commands p:prerun
- inject s@dWM_ParseArgs
- define c '<def[worlds].get[1].escaped||null>'
- define w '<def[worlds].get[2].escaped||null>'
- define v '<proc[dWM_VW].context[%c%]>'
- if 'li@0|5' !contains '%v%' {
- run instantly delay:1t 's@dWM_Error' 'def:world|%v%|%sender%|%c%'
- queue clear
}
- define t '<yaml[dWM_Config].read[worlds.%w%.worldtype]||NORMAL>'
- define e '<yaml[dWM_Config].read[worlds.%w%.environment]||NORMAL>'
- define g '<yaml[dWM_Config].read[worlds.%w%.generator]||none>'
- define vval 'li@3'
- define clone ''
- inject s@dWM_CreateWorldConfigs
- run s@msgPrefixed 'def:dWM|<&a>Cloned <&o>%w%<&a>!'
dWM_Commands_Tp:
type: command
debug: false
name: dwmtp
description: Teleport anyone anywhere
usage: /dwmtp
aliases: ''
data:
description:
- 'Teleport anyone anywhere. Teleport everything everywhere.'
- ' '
usage: '/dwm tp (-abehnps) (<<>x,y,z<>>) <&lb><<>world<>><&rb>'
examples:
- '<&d>The following is a list of planned teleport usages. The current implementation only allows for teleporting yourself to a world.'
- ' '
- 'Teleport yourself to your last location in the hub world'
- ' <&e>/dwm tp hub'
- ' '
- 'Teleport mcmonkey and morphan1 to their last location in the hub world'
- ' <&e>/dwm tp hub mcmonkey morphan1'
- ' '
- 'Teleport mcmonkey and morphan1 to their beds in the dream world'
- ' <&e>/dwm tp -b dream mcmonkey morphan1'
- ' '
- 'Teleport mcmonkey to the spawn location in hell and teleport all ghasts and zombie pigmen to him'
- ' <&e>/dwm tp -es hell mcmonkey ghast zombie_pigmen'
- ' '
- 'Teleport mcmonkey and morphan1 to mcmonkeys bed in the whacky world'
- ' <&e>/dwm tp -pb whacky mcmonkey morphan1'
- ' '
- 'Teleport mcmonkey and morphan1 to you so you can laugh at them'
- ' <&e>/dwm tp -ph mcmonkey morphan1'
- ' '
- 'Teleport everyone to notch to ask him for some of that 2.5 billion'
- ' <&e>/dwm tp -ap notch'
- ' '
permissions:
- admin
- tp
tab complete:
- determine 'li@'
script:
- if !<def[command].exists> {
- define command 'tp'
}
- inject s@dWM_Commands p:prerun
- inject s@dWM_ParseArgs
- define prefix '<proc[msgCommand].context[<&4><&lb><&6>dWM<&4><&rb>|dwm help|<&6> dWM<&nl><&d>Click for help]> '
# Determine the destination
# World spawn
# Player World Bed
# Player World last location
# Player current location
# NPC current location
# Determine the entities to teleport
- if !<def[entities].is_empty> {
- run instantly delay:1t 's@dWM_Error' 'def:entity|1|%sender%'
}
- if !<def[npcs].is_empty> {
- run instantly delay:1t 's@dWM_Error' 'def:npc|1|%sender%'
}
- if <def[players].is_empty> {
- if '%sender%' == 'server' {
- announce to_console '<&4><&lb><&6>dWM<&4><&rb> <&c>You did not specify an entity to teleport!'
- queue clear
}
- if <def[worlds].is_empty> {
- define w <player.world.name>
}
else {
- define w '<def[worlds].get[1]>'
- define v '<proc[dWM_VW].context[%w%]>'
- if '%v%' != '0' {
- run instantly delay:1t 's@dWM_Error' 'def:world|%v%|%sender%|%w%'
- queue clear
}
}
- define t 'teleport'
- define lastLoc '<proc[dWM_LL].context[<player>|%w%|%t%]>'
- if '%lastLoc%' == '1' {
- run instantly delay:1t 's@dWM_Error' 'def:ll|1|%sender%|%w%'
- if <def[w].as_world.spawn_location.chunk.is_loaded.not> {
- adjust <def[w].as_world.spawn_location.chunk> load
}
- teleport <player> '<def[w].as_world.spawn_location>'
- queue clear
}
else {
- if <el@val[%lastLoc%,%w%].as_location.chunk.is_loaded.not> {
- adjust <el@val[%lastLoc%,%w%].as_location.chunk> load
}
- teleport <player> '<el@val[%lastLoc%,%w%].as_location>'
}
}
# - if <def[switches].is_empty> {
# - if <def[players].is_empty> {
# - define targets 'li@%sender%'
# - if <def[locations].is_empty> {
# - if <def[worlds].is_empty> {
# - run instantly delay:1t 's@dWM_Error' 'def:loc|1|%sender%'
# - queue clear
# }
# else {
# - define w '<def[worlds].get[1]>'
# - define lastLoc '<proc[dWM_LL].context[%object%|%w%]>'
# - if lastLoc == '0' {
# - run instantly delay:1t 's@dWM_Error' 'def:ll|1|%sender%|%w%'
# - queue clear
# }
# -
# }
# }
# else {
# - define l '<def[locations].get[1].as_location>'
# }
# - if <def[worlds].is_empty> {
# - define w '<def[sender].world.name>'
# }
# else {
# - define w '<def[worlds].get[1]>'
# }
# # Maybe this should be moved to the end? To validate the world /after/ everything else has been parsed.
# - define v '<proc[dWM_VW].context[%w%]>'
# - if '%v%' != '0' {
# - run instantly delay:1t 's@dWM_Error' 'def:world|%v%|%sender%|%w%'
# - queue clear
# }
# - teleport %targets% '<el@val[%l%,%w%].as_location>'
# - queue clear
# }
# else if <def[players].size> == 1 {
# - if <def[worlds].is_empty> {
# - if <def[locations].is_empty> {
# - teleport %sender% '<def[players].get[1].location>'