Date: 2023/08/28 08:51:55 UTC-07:00
Type: Denizen Script
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
#+----------------+
#- World Manager
#+----------------+
#- @@@ Server Databse
serverDatabase_worldmanager:
type: data
prefix: <empty>
#- @@@ WRM Events
wrmEvent_load:
type: world
debug: false
events:
on server prestart:
- foreach <server.flag[worlds].if_null[<map>]> as:world_info key:world_name:
- createworld <[world_name]> if:<[world_info].get[auto_load]>
- wait 1s
after player clicks item in wrmInventory_worlds:
- define world <world[<context.item.name.strip_color>].if_null[Null]>
- define prefix <script[serverdatabase_worldmanager].parsed_key[prefix]>
- if <[world]> == Null:
- narrate "<&c>Tento svet... neexistuje?"
- stop
- define loc <[world].spawn_location>
- if !<proc[locationhelper_issafe].context[<player>|<[loc]>]>:
- narrate "<&c>Tento svet ma nebezpecny spawn!"
- stop
- teleport <player> <[loc]> relative
- narrate "<&7>Teleportujem na spawn sveta <&f><[world].name><&7>."
#- @@@ WRM
adminCommand_wrm:
type: command
debug: false
name: wrm
description: World Manager.
usage: /wrm [create|unload|info|menu|set] [args...]
permission: admin.wrm
permission message: <&c>Na toto nemas opravnenie
tab completions:
1: create|unload|info|menu|set
2: <proc[wrmProcedure_tabcomplete].context[1|<context.args>]>
3: <proc[wrmProcedure_tabcomplete].context[2|<context.args>]>
4: <proc[wrmProcedure_tabcomplete].context[3|<context.args>]>
#tab complete:
# - determine cs|aho
script:
- define prefix <script[serverdatabase_worldmanager].parsed_key[prefix]>
- choose <context.args.first.to_lowercase.if_null[Null]>:
#.@ Create Argument
- case create:
- define nazov <context.args.get[2].if_null[Null]>
- if <[nazov]> == Null:
- narrate "<[prefix]> <&c>Nezadal si nazov sveta!"
- stop
- if !<[nazov].regex_matches[^[a-zA-Z]*$]>:
- narrate "<[prefix]> <&c>Nazov musi obsahovat iba pismena bez diakritiky a inych znamienok..."
- stop
- if <[nazov]> in <server.worlds.parse[name]> or <[nazov]> in <server.flag[worlds].keys.if_null[<list>]>:
- narrate "<[prefix]> <&c>Svet s tymto nazvom uz existuje!"
- stop
- define env <context.args.get[3].to_uppercase.if_null[Null]>
- if <[env]> == Null:
- narrate "<[prefix]> <&c>Nezadal si environment pre tento svet!"
- stop
- if <[env]> !in THE_END|NETHER|NORMAL:
- narrate "<[prefix]> <&c>Neplatny environemnt, platne: THE_END NETHER NORMAL"
- stop
- define type <context.args.get[4].to_uppercase.if_null[Null]>
- if <[type]> !in <server.world_types>:
- narrate "<[prefix]> <&c>Neplatny typ, platne: <server.world_types.space_separated>"
- stop
- wait 2t
- createworld <[nazov]> environment:<[env]> worldtype:<[type]>
- flag server worlds:->:<map[<[nazov]>=<map[auto_load=true]>]>
- wait 2t
- narrate "<[prefix]> <&7>Uspesne si vytvoril svet <&f><[nazov]><&7>. Svet sa bude automaticky pri starte nacitavat. Pre zmenu nastaveni sveta pouzi <&f>/wrm set<&7>."
#.@ Unload Argument
- case unload:
- define world <world[<context.args.get[2]>].if_null[Null]>
- if <[world]> == Null:
- narrate "<[prefix]> <&c>Svet s tymto nazvom neexistuje!"
- stop
- if !<[world].players.is_empty>:
- narrate "<[prefix]> <&c>Svet nemoze byt odnacitany pretoze su tam hraci!"
- stop
- adjust <[world]> unload
- wait 2t
- narrate "<[prefix]> <&7>Uspesne si odnacital svet <&f><[world].name><&7>."
#.@ Info Argument
- case info:
- define world <world[<context.args.get[2]>].if_null[Null]>
- if <[world]> == Null:
- narrate "<[prefix]> <&c>Svet s tymto nazvom neexistuje!"
- stop
- define world_players <[world].players.size>
- definemap message:
1: <&7>-> <&f><&l><[world].name> <&7>(<&f>Auto load: <server.flag[worlds].get[<[world].name>].get[auto_load].if_null[-]> <&7>)
2: <&7>- <&f>Seed: <&color[#43db69]><[world].seed> <&7>(<&f><[world].environment><&7>)
3: <&7>- <&f>View dis: <&color[#dbb043]><[world].view_distance> <&7>| <&f>Simulation dis: <&color[#9cdb43]><[world].simulation_distance> <&7>| <&f>Chunky: <&color[#43dbd1]><[world].loaded_chunks.size>
4: <&7>- <&f>Hraci: <&color[#43db80]><[world_players]> <&7>| <&f>Entity: <&color[#b543db]><[world].living_entities.size.sub[<[world_players]>]>
5: <&7>- <&f>Spawn loc: <[world].spawn_location.format[<&color[#4399db]>bx by bz]> <&7>| <&f>Spawn load: <[world].keep_spawn.if_true[<&a>ano].if_false[<&c>nie]>
- wait 1t
- narrate <[message].values.separated_by[<n>]>
#.@ Set Argument
- case set:
- define world <world[<context.args.get[2]>].if_null[Null]>
- if <[world]> == Null:
- narrate "<[prefix]> Tento svet neexistuje alebo nie je nacitany!"
- stop
- choose <context.args.get[3].if_null[Null]>:
# Auto Load setting
- case auto_load:
- define param <context.args.get[3].if_null[Null]>
- if !<[param].is_boolean>:
- narrate "<[prefix]> <&c>Toto nastavenie vyzaduje boolean argument! (true/false)"
- stop
- flag server <server.flag[worlds.<[world].name>].with[auto_load].as[<[param]>]>
- narrate "<[prefix]> <&7>Uspesne si vo svete <&f><[world].name> <&7>zmenil nastavenie <&f>auto_load <&7>na <&f><[param]><&7>."
# View Distance setting
- case view_distance:
- define param <context.args.get[3].if_null[Null]>
- if !<[param].is_integer>:
- narrate "<[prefix]> <&c>Toto nastavenie vyzaduje integer argument!"
- stop
- if <[param]> < 2 or <[param]> > 10:
- narrate "<[prefix]> <&c>Argument nie je v bezpecnostnom limite. (2-10)"
- stop
- adjust <[world]> view_distance:<[param]>
- narrate "<[prefix]> <&7>Uspesne si vo svete <&f><[world].name> <&7>zmenil nastavenie <&f>view_distance <&7>na <&f><[param]><&7>."
# Simulation Distance setting
- case simulation_distance:
- define param <context.args.get[3].if_null[Null]>
- if !<[param].is_integer>:
- narrate "<[prefix]> <&c>Toto nastavenie vyzaduje integer argument!"
- stop
- if <[param]> < 2 or <[param]> > 10:
- narrate "<[prefix]> <&c>Argument nie je v bezpecnostnom limite. (2-10)"
- stop
- adjust <[world]> simulation_distance:<[param]>
- narrate "<[prefix]> <&7>Uspesne si vo svete <&f><[world].name> <&7>zmenil nastavenie <&f>simulation_distance <&7>na <&f><[param]><&7>."
# Keep Spawn setting
- case keep_spawn:
- define param <context.args.get[3].if_null[Null]>
- if !<[param].is_boolean>:
- narrate "<[prefix]> <&c>Toto nastavenie vyzaduje boolean argument! (true/false)"
- stop
- adjust <[world]> keep_spawn:<[param]>
- narrate "<[prefix]> <&7>Uspesne si vo svete <&f><[world].name> <&7>zmenil nastavenie <&f>keep_spawn <&7>na <&f><[param]><&7>."
# Difficulty setting
- case difficulty:
- define param <context.args.get[3].to_sentence_case.if_null[Null]>
- if <[param]> !in Peaceful|Easy|Normal|Hard:
- narrate "<[prefix]> <&c>Toto nastavenie vyzaduje jeden z tychto argumentov: Peaceful Easy Normal Hard"
- stop
- adjust <[world]> difficulty:<[param]>
- narrate "<[prefix]> <&7>Uspesne si vo svete <&f><[world].name> <&7>zmenil nastavenie <&f>difficulty <&7>na <&f><[param]><&7>."
- default:
- narrate "<[prefix]> <&c>Neplatne nastavenie!"
#.@ Menu Argument
- case menu:
- inventory open destination:wrmInventory_worlds
#.@ Invalid Argument
- default:
- narrate "<[prefix]> <&c>Neplatny argument!"
#- @@@ WRM Inventory
wrmInventory_worlds:
type: inventory
debug: true
inventory: chest
gui: true
size: <proc[inventoryhelper_chestsize].context[<server.worlds.size>]>
procedural items:
- foreach <server.worlds> as:world:
- define world_players <[world].players.size>
- definemap mechanisms:
skull_skin: 20eea7ea-2e50-41a3-bade-27e37a45d526|eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNDM4Y2YzZjhlNTRhZmMzYjNmOTFkMjBhNDlmMzI0ZGNhMTQ4NjAwN2ZlNTQ1Mzk5MDU1NTI0YzE3OTQxZjRkYyJ9fX0=
display: <&a><&l><[world].name>
lore:
- <&f>Typ: <[world].environment>
- <&f>Hraci: <&color[#43db80]><[world_players]> <&7>| <&f>Entity: <&color[#b543db]><[world].living_entities.size.sub[<[world_players]>]>
- <&f>View dis: <&color[#dbb043]><[world].view_distance> <&7>| <&f>Simulation dis: <&color[#9cdb43]><[world].simulation_distance> <&7>| <&f>Chunky: <&color[#43dbd1]><[world].loaded_chunks.size>
- <&f>
- <&e>Klikni pre teleport!
- define list:->:<item[player_head].with_map[<[mechanisms]>]>
- determine <[list]>
#- @@@ WRM Procedure
wrmProcedure_tabcomplete:
type: procedure
debug: true
definitions: index[ElementTag]
script:
- choose <[index]>:
- case 1:
- choose <[2].first>:
- case unload info set:
- determine <server.worlds.parse[name]>
- case create:
- determine Nazov
- case menu:
- determine <list>
- determine <list>
- case 2:
- choose <[2].first>:
- case create:
- determine <list[THE_END|NETHER|NORMAL]>
- case set:
- determine <list[auto_load|view_distance|simulation_distance|keep_spawn|difficulty]>
- determine <list>
- case 3:
- if <[2].first> == create:
- determine <server.world_types>
- if <[2].first> != set:
- determine <list>
- choose <[4]>:
- case auto_load keep_spawn:
- determine <list[true|false]>
- case view_distance simulation_distance:
- determine <util.list_numbers[from=2;to=10]>
- case difficulty:
- determine <list[Peaceful|Easy|Normal|Hard]>
- determine <list>