- D1 Meta Docs - Denizen Script -
Home Page / Pi to one million places / Contact mcmonkey / Donate / Paste Scripts / Denizen Help /
You are browsing as a guest.
Login | Register


Click here to create your own public paste ~ ~ click to duplicate and edit this paste


TitleUntitled Paste
TypeDenizen Script
Date2015/01/01 11:30:49 UTC-08:00
ByAnthony
Other
Paste
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
51200
################################################################################
#
#                                d R e g i o n s
#
#                                 Flag Modules
#
#   Authors: |Anthony|
#   Version: 0.1
#   dScript Version: 0.9.6-DEV_b146
#
#
#
#--- About this script
#
#  Adding new flags /can/ be as easy as making a new module!
#
#
#
################################################################################


dRegions_Flag_Entry:
  type: item
  debug: false
  material: i@paper
  display name"<&4>[<&6>Entry<&4>]"
  lore:
  - <&5>Who can enter a region
  event_hook: regionEnter
  event_priority: 0
  flag_type: state
  flag_takeGroup: true
  script:
    - narrate "A handy container for region flags."
    - narrate "We<&sq>ll have subscripts for various tasks."

  button_click:
    - narrate "This will be useful when it comes time to make the GUI for region management."


  event:
    - define prefix '<&lt>proc<&lb>dRegions_GetInheritedFlag<&rb>.context<&lb>%world%<&pipe>'
    - define suffix '<&pipe>entry<&rb>||null<&gt>'
    - define entryList '<parse:<def[orderedRegions].parse[replace[regex:^()].with[<def[prefix]>]].parse[replace[regex:()$].with[<def[suffix]>]]>>'
#    - define entryList '<parse:<def[orderedRegions].parse[replace[regex:^()].with[<&lt>yaml<&lb>dRegions_%world%_regions<&rb>.read<&lb>regions.]].parse[replace[regex:()$].with[.flags.entry<&rb>||null<&gt>]]>>'
    - foreach %entryList% {
      - if <def[value].split[/].get[1].is[==].to[deny]||false> {
        - define group '<def[value].split[/].get[2]||nonmembers>'
        - define isOwner '<proc[dRegions_IsOwner].context[<def[orderedRegions].get[%loop_index%]>|%world%|<player>]>'
        - define isMember '<proc[dRegions_isMember].context[<def[orderedRegions].get[%loop_index%]>|%world%|<player>]>'

        - if <proc[dRegions_PlayerMatchRegionGroup].context[%group%|%isMember%|%isOwner%]> {
          - if <player.has_flag[dRegions_Message_Cooldown].not> {
            - flag player dRegions_Message_Cooldown duration:3s
            - run s@dRegions_Msg 'def:<&c><&o>You do not have permission to enter this region'
            }
          - determine cancelled
          - queue clear
          }
        }
      }



dRegions_Flag_Greeting:
  type: item
  debug: false
  material: i@paper
  display name"<&4>[<&6>Greeting<&4>]"
  lore:
  - <&5>Message on enter region
  event_hook: regionEnter
  event_priority: 10
  flag_type: string
  flag_takeGroup: false
  script:
    - narrate "A handy container for region flags."
    - narrate "We<&sq>ll have subscripts for various tasks."

  button_click:
    - narrate "This will be useful when it comes time to make the GUI for region management."


  event:
  # Now using GetInheritedFlag procedure
  # I split the tag up into 3 parts so folks could maybe possibly better understand it
  # The original msgList is left commented out. No touchy
    - define prefix '<&lt>proc<&lb>dRegions_GetInheritedFlag<&rb>.context<&lb>%world%<&pipe>'
    - define suffix '<&pipe>greeting<&rb>||null<&gt>'
    - define msgList '<parse:<def[orderedRegions].parse[replace[regex:^()].with[<def[prefix]>]].parse[replace[regex:()$].with[<def[suffix]>]]>>'
#    - define msgList '<parse:<def[orderedRegions].parse[replace[regex:^()].with[<&lt>yaml<&lb>dRegions_%world%_regions<&rb>.read<&lb>regions.]].parse[replace[regex:()$].with[.flags.greeting<&rb>||null<&gt>]]>>'
    - foreach %msgList% {
      - if <def[value].is[!=].to[null]||false> {
        - narrate "<parse:%value%>"
        - foreach stop
        }
      }


dRegions_Flag_Exit:
  type: item
  debug: false
  material: i@paper
  display name"<&4>[<&6>Exit<&4>]"
  lore:
  - <&5>Who can exit a region
  event_hook: regionExit
  event_priority: 0
  flag_type: state
  flag_takeGroup: true
  script:
    - narrate "A handy container for region flags."
    - narrate "We<&sq>ll have subscripts for various tasks."

  button_click:
    - narrate "This will be useful when it comes time to make the GUI for region management."


  event:
    - define prefix '<&lt>proc<&lb>dRegions_GetInheritedFlag<&rb>.context<&lb>%world%<&pipe>'
    - define suffix '<&pipe>exit<&rb>||null<&gt>'
    - define exitList '<parse:<def[orderedRegions].parse[replace[regex:^()].with[<def[prefix]>]].parse[replace[regex:()$].with[<def[suffix]>]]>>'
#    - define exitList '<parse:<def[orderedRegions].parse[replace[regex:^()].with[<&lt>yaml<&lb>dRegions_%world%_regions<&rb>.read<&lb>regions.]].parse[replace[regex:()$].with[.flags.exit<&rb>||null<&gt>]]>>'
    - foreach %exitList% {
      - if <def[value].split[/].get[1].is[==].to[deny]||false> {
        - define group '<def[value].split[/].get[2]||nonmembers>'
        - define isOwner '<proc[dRegions_IsOwner].context[<def[orderedRegions].get[%loop_index%]>|%world%|<player>]>'
        - define isMember '<proc[dRegions_isMember].context[<def[orderedRegions].get[%loop_index%]>|%world%|<player>]>'

        - if <proc[dRegions_PlayerMatchRegionGroup].context[%group%|%isMember%|%isOwner%]> {
          - if <player.has_flag[dRegions_Message_Cooldown].not> {
            - flag player dRegions_Message_Cooldown duration:3s
            - run s@dRegions_Msg 'def:<&c><&o>You do not have permission to exit this region'
            }
          - determine cancelled
          - queue clear
          }
        }
      }



dRegions_Flag_Farewell:
  type: item
  debug: false
  material: i@paper
  display name"<&4>[<&6>Farewell<&4>]"
  lore:
  - <&5>Message on exit region
  event_hook: regionExit
  event_priority: 10
  flag_type: string
  flag_takeGroup: false
  script:
    - narrate "A handy container for region flags."
    - narrate "We<&sq>ll have subscripts for various tasks."

  button_click:
    - narrate "This will be useful when it comes time to make the GUI for region management."


  event:
    - define prefix '<&lt>proc<&lb>dRegions_GetInheritedFlag<&rb>.context<&lb>%world%<&pipe>'
    - define suffix '<&pipe>farewell<&rb>||null<&gt>'
    - define msgList '<parse:<def[orderedRegions].parse[replace[regex:^()].with[<def[prefix]>]].parse[replace[regex:()$].with[<def[suffix]>]]>>'
#    - define msgList '<parse:<def[orderedRegions].parse[replace[regex:^()].with[<&lt>yaml<&lb>dRegions_%world%_regions<&rb>.read<&lb>regions.]].parse[replace[regex:()$].with[.flags.farewell<&rb>||null<&gt>]]>>'
    - foreach %msgList% {
      - if <def[value].is[!=].to[null]||false> {
        - narrate "<parse:%value%>"
        - foreach stop
        }
      }



dRegions_Flag_Gamemode:
  type: item
  debug: false
  material: i@paper
  display name"<&4>[<&6>Gamemode<&4>]"
  lore:
  - <&5>Change gamemode inside a region
  event_hook: regionToggle
  event_priority: 20
  flag_type: custom
  flag_type_customVal: creative|survival|adventure
  flag_help: Gamemode flag can be set to creative, survival, or adventure
  flag_takeGroup: true
  script:
    - narrate "A handy container for region flags."
    - narrate "We<&sq>ll have subscripts for various tasks."

  button_click:
    - narrate "This will be useful when it comes time to make the GUI for region management."


  event:
    - define prefix '<&lt>proc<&lb>dRegions_GetInheritedFlag<&rb>.context<&lb>%world%<&pipe>'
    - define suffix '<&pipe>gamemode<&rb>||null<&gt>'
    - define gmList '<parse:<def[orderedRegions].parse[replace[regex:^()].with[<def[prefix]>]].parse[replace[regex:()$].with[<def[suffix]>]]>>'
    - foreach %gmList% {
      - if <def[value].is[!=].to[null]||false> {
        - define gm '<def[value].split[/].get[1]||survival>'
        - define group '<def[value].split[/].get[2]||members>'
        - define isOwner '<proc[dRegions_IsOwner].context[<def[orderedRegions].get[%loop_index%]>|%world%|<player>]>'
        - define isMember '<proc[dRegions_isMember].context[<def[orderedRegions].get[%loop_index%]>|%world%|<player>]>'

        - if <proc[dRegions_PlayerMatchRegionGroup].context[%group%|%isMember%|%isOwner%]> {
          - if <def[isExit].exists> {
            - if <player.flag[dRegions_PreviousGamemode].is[!=].to[<player.gamemode>]||false> {
              - adjust <player> 'gamemode:<player.flag[dRegions_PreviousGamemode]||survival>'
              - run s@dRegions_Msg 'def:<&7><&o>Your gamemode has been updated.'
              }
            - flag <player> 'dRegions_PreviousGamemode:!'
            }
            else if <def[isEnter].exists> {
            - if <def[gm].is[!=].to[<player.gamemode>]> {
              - flag <player> 'dRegions_PreviousGamemode:<player.gamemode>'
              - adjust <player> 'gamemode:%gm%'
              - run s@dRegions_Msg 'def:<&7><&o>Your gamemode has been updated.'
              }
            }
            else {
            - adjust <player> 'gamemode:survival'
            - run s@dRegions_Msg 'def:<&7><&o>Your gamemode has been updated.'
            }
          - foreach stop
          }
        }
      }



dRegions_Flag_Inventory:
  type: item
  debug: true
  material: i@paper
  display name"<&4>[<&6>Inventory<&4>]"
  lore:
  - <&5>Save inventory before going into a region
  event_hook: regionToggle
  event_priority: 20
  flag_type: custom
  flag_type_customVal: unique|kit
  flag_help: Inventory flag can be set to unique or kit. Unique inventories start empty. Kit inventories use your current inventory.
  flag_takeGroup: true
  script:
    - narrate "A handy container for region flags."
    - narrate "We<&sq>ll have subscripts for various tasks."

  button_click:
    - narrate "This will be useful when it comes time to make the GUI for region management."


  command_handler:
    - if <def[flagValue].is[==].to[kit]> {
      - yaml set 'inventories.regions.%region%.entry.kit.equip:<player.equipment>' 'id:dRegions_%world%_inventories'
      - yaml set 'inventories.regions.%region%.entry.kit.inv:<player.inventory.list_contents>' 'id:dRegions_%world%_inventories'
      - yaml set 'inventories.regions.%region%.exit.players:|:' 'id:dRegions_%world%_inventories'
      }
    - if <def[flagValue].is[==].to[unique]> {
      - yaml set 'inventories.regions.%region%.entry.players:|:' 'id:dRegions_%world%_inventories'
      - yaml set 'inventories.regions.%region%.exit.players:|:' 'id:dRegions_%world%_inventories'
      }
    - if <def[flagValue].is[==].to[null]> {
      - yaml set 'inventories.regions.%region%:!' 'id:dRegions_%world%_inventories'
      }
    - yaml 'savefile:dRegions/worlds/%world%/inventories.yml' 'id:dRegions_%world%_inventories'


  event:
    - define prefix '<&lt>proc<&lb>dRegions_GetInheritedFlag<&rb>.context<&lb>%world%<&pipe>'
    - define suffix '<&pipe>inventory<&rb>||null<&gt>'
    - define invList '<parse:<def[orderedRegions].parse[replace[regex:^()].with[<def[prefix]>]].parse[replace[regex:()$].with[<def[suffix]>]]>>'
    - foreach %invList% {
      - define region '<def[orderedRegions].get[%loop_index%]>'
      - if <def[value].is[!=].to[null]||false> {
        - define inv '<def[value].split[/].get[1]||unique>'
        - define group '<def[value].split[/].get[2]||nonmembers>'
        - define isOwner '<proc[dRegions_IsOwner].context[%region%|%world%|<player>]>'
        - define isMember '<proc[dRegions_isMember].context[%region%|%world%|<player>]>'

        - if <proc[dRegions_PlayerMatchRegionGroup].context[%group%|%isMember%|%isOwner%]> {
          - if <def[isEnter].exists> {
            - if <def[inv].is[==].to[kit]||false> {
              - define equipment '<yaml[dRegions_%world%_inventories].read[inventories.regions.%region%.entry.kit.equip]||li@>'
              - yaml set 'inventories.regions.%region%.exit.players.<player.uuid>.equip:<player.equipment>' 'id:dRegions_%world%_inventories'
              - yaml set 'inventories.regions.%region%.exit.players.<player.uuid>.inv:<player.inventory.list_contents>' 'id:dRegions_%world%_inventories'
              - inventory set 'd:<player.inventory>' 'o:<yaml[dRegions_%world%_inventories].read[inventories.regions.%region%.entry.kit.inv]||li@>'
              - equip <player> 'boots:<def[equipment].get[1]||i@air>' 'legs:<def[equipment].get[2]||i@air>' 'chest:<def[equipment].get[3]||i@air>' 'head:<def[equipment].get[4]||i@air>'
              }
              else if <def[inv].is[==].to[unique]||false> {
              - define equipment '<yaml[dRegions_%world%_inventories].read[inventories.regions.%region%.entry.players.<player.uuid>.equip]||li@>'
              - yaml set 'inventories.regions.%region%.exit.players.<player.uuid>.equip:<player.equipment>' 'id:dRegions_%world%_inventories'
              - yaml set 'inventories.regions.%region%.exit.players.<player.uuid>.inv:<player.inventory.list_contents||li@i@air>' 'id:dRegions_%world%_inventories'
              - inventory set 'd:<player.inventory>' 'o:<yaml[dRegions_%world%_inventories].read[inventories.regions.%region%.entry.players.<player.uuid>.inv]||li@>'
              - equip <player> 'boots:<def[equipment].get[1]||i@air>' 'legs:<def[equipment].get[2]||i@air>' 'chest:<def[equipment].get[3]||i@air>' 'head:<def[equipment].get[4]||i@air>'
              }
            - run s@dRegions_Msg 'def:<&7><&o>Your inventory has been updated.'
            }
            else if <def[isExit].exists> {
            - define equipment '<yaml[dRegions_%world%_inventories].read[inventories.regions.%region%.exit.players.<player.uuid>.equip]||li@>'
            - inventory set 'd:<player.inventory>' 'o:<yaml[dRegions_%world%_inventories].read[inventories.regions.%region%.exit.players.<player.uuid>.inv]||li@>'
            - equip <player> 'boots:<def[equipment].get[1]||i@air>' 'legs:<def[equipment].get[2]||i@air>' 'chest:<def[equipment].get[3]||i@air>' 'head:<def[equipment].get[4]||i@air>'
            - yaml set 'inventories.regions.%region%.exit.players.<player.uuid>:!' 'id:dRegions_%world%_inventories'
            - run s@dRegions_Msg 'def:<&7><&o>Your inventory has been updated.'
            }
            else {
            - run s@dRegions_Msg 'def:<&7><&o>THIS SHOULD NOT RUN EVER!'
            }
          - yaml 'savefile:dRegions/worlds/%world%/inventories.yml' 'id:dRegions_%world%_inventories'
          - foreach stop
          }
        }
      }


dRegions_Flag_Build:
  type: item
  debug: true
  material: i@paper
  display name"<&4>[<&6>Build<&4>]"
  lore:
  - <&5>Override default build perms
  event_hook: build
  event_priority: 0
  flag_type: state
  flag_help: By default, all members and owners can build in their regions. Setting this flag can over ride that behavior. Can be set to allow, deny, or none and accepts the -g group switch.
  flag_takeGroup: true
  script:
    - narrate "A handy container for region flags."
    - narrate "We<&sq>ll have subscripts for various tasks."

  button_click:
    - narrate "This will be useful when it comes time to make the GUI for region management."

  event:
    - define region '<def[orderedRegions].get[1]>'
    - define flagVal '<proc[dRegions_GetInheritedFlag].context[%world%|%region%|build]||null>'
    - if <def[flagVal].is[==].to[null]||true> {
      - define flagVal 'deny/nonmembers'
      }
    - define flag '<def[flagVal].split[/].get[1]>'
    - define group '<def[flagVal].split[/].get[2]||nonmembers>'
    - define isOwner '<proc[dRegions_IsOwner].context[<def[orderedRegions].get[%loop_index%]>|%world%|<player>]>'
    - define isMember '<proc[dRegions_isMember].context[<def[orderedRegions].get[%loop_index%]>|%world%|<player>]>'

    - if <def[flag].is[==].to[deny]||false> {
      - if <proc[dRegions_PlayerMatchRegionGroup].context[%group%|%isMember%|%isOwner%]> {
        - if <player.has_flag[dRegions_Message_Cooldown].not> {
          - flag player dRegions_Message_Cooldown duration:3s
          - run s@dRegions_Msg 'def:<&c><&o>You do not have permission to build in this region'
          }
        - determine cancelled
        - queue clear
        }
      }

    - if <def[flag].is[==].to[allow]||false> {
      - if <proc[dRegions_PlayerMatchRegionGroup].context[%group%|%isMember%|%isOwner%].not> {
        - if <player.has_flag[dRegions_Message_Cooldown].not> {
          - flag player dRegions_Message_Cooldown duration:3s
          - run s@dRegions_Msg 'def:<&c><&o>You do not have permission to build in this region'
          }
        - determine cancelled
        - queue clear
        }
      }


dRegions_Flag_Mob-Targeting:
  type: item
  debug: false
  material: i@paper
  display name"<&4>[<&6>Mob-Targeting<&4>]"
  lore:
  - <&5>Can mobs target players
  event_hook: ENTITY_Target_Player
  event_priority: 0
  flag_type: state
  flag_takeGroup: true
  flag_help: State flag controlling whether mobs will be able to target players in this region. Defaults to allow all. Use mob-targeting flag to specify mob types. Takes the -g group switch.
  script:
    - narrate "A handy container for region flags."
    - narrate "We<&sq>ll have subscripts for various tasks."

  button_click:
    - narrate "This will be useful when it comes time to make the GUI for region management."


  event:
    - define prefix '<&lt>proc<&lb>dRegions_GetInheritedFlag<&rb>.context<&lb>%world%<&pipe>'
    - define suffix '<&pipe>mob-target<&rb>||null<&gt>'
    - define InheritedMobs '<parse:<def[orderedRegions].parse[replace[regex:^()].with[<def[prefix]>]].parse[replace[regex:()$].with[<def[suffix]>]]>>'
    - define suffix '<&pipe>mob-targeting<&rb>||null<&gt>'
    - define InheritedFlags '<parse:<def[orderedRegions].parse[replace[regex:^()].with[<def[prefix]>]].parse[replace[regex:()$].with[<def[suffix]>]]>>'
    - foreach %InheritedFlags% {
      - define mobList '<def[InheritedMobs].get[%loop_index%].replace[, ].with[|].as_list||all>'
      - if <def[mobList].is[==].to[all]||false>
        || <def[moblist].contains[<c.entity.entity_type>]||false> {
        - define flagVal '<def[value]>'
        - if <def[flagVal].is[==].to[null]||true> {
          - define flagVal 'allow/all'
          }
        - define flag '<def[flagVal].split[/].get[1]>'
        - define group '<def[flagVal].split[/].get[2]||all>'
        - define region '<def[orderedRegions].get[%loop_index%]>'
        - define isOwner '<proc[dRegions_IsOwner].context[%region%|%world%|<player>]>'
        - define isMember '<proc[dRegions_isMember].context[%region%|%world%|<player>]>'

        - if <def[flag].is[==].to[allow]||false> {
          - if <proc[dRegions_PlayerMatchRegionGroup].context[%group%|%isMember%|%isOwner%].not> {
            - if <player.has_flag[dRegions_Message_Cooldown].not> {
              - flag player dRegions_Message_Cooldown duration:3s
              - run s@dRegions_Msg 'def:<&c><&o>You have been ignored by a mob!'
              }
            - determine cancelled
            - queue clear
            }
          }

        - if <def[flag].is[==].to[deny]||false> {
          - if <proc[dRegions_PlayerMatchRegionGroup].context[%group%|%isMember%|%isOwner%]> {
            - if <player.has_flag[dRegions_Message_Cooldown].not> {
              - flag player dRegions_Message_Cooldown duration:3s
              - run s@dRegions_Msg 'def:<&c><&o>You have been ignored by a mob!'
              }
            - determine cancelled
            - queue clear
            }
          }
        }
      }



dRegions_Flag_Mob-Target:
  type: item
  debug: false
  material: i@paper
  display name"<&4>[<&6>Mob-Target<&4>]"
  lore:
  - <&5>List of mobs used by mob-targeting flag
  flag_type: list
  flag_takeGroup: false
  flag_help: List flag used with mob-targeting flag. To add to the list, use the -a switch. To remove from list use the -r switch. Provide a space separated list of mobs.
  script:
    - narrate "A handy container for region flags."
    - narrate "We<&sq>ll have subscripts for various tasks."

  button_click:
    - narrate "This will be useful when it comes time to make the GUI for region management."

  command_handler:
    - if <def[flagValue].is[==].to[null]||false> {
      - yaml set 'regions.%region%.flags.%flag%:!' 'id:dRegions_%world%_regions'
      - yaml 'savefile:dRegions/worlds/%world%/regions.yml' 'id:dRegions_%world%_regions'
      - run s@dRegions_Msg 'def:<&c>Cleared %flag% list for region %region%'
      - queue clear
      }
      else {
      - define mobs '<def[flagValue].split[ ].get[2].to[<def[flagValue].split[ ].size>].parse[to_lowercase].deduplicate||li@>'
      - if <def[mobs].get[1].is[==].to[all]> {
        - if '<def[flagValue].split[ ].get[1].is[==].to[-a]||false>' {
          - yaml set 'regions.%region%.flags.%flag%:all' 'id:dRegions_%world%_regions'
          - yaml 'savefile:dRegions/worlds/%world%/regions.yml' 'id:dRegions_%world%_regions'
          - run s@dRegions_Msg 'def:<&f><&o>%region%<&7><&o> set %flag% flag to <&f><&o>%flagValue%'
          - queue clear
          }
        - if '<def[flagValue].split[ ].get[1].is[==].to[-r]||false>' {
          - yaml set 'regions.%region%.flags.%flag%:!' 'id:dRegions_%world%_regions'
          - yaml 'savefile:dRegions/worlds/%world%/regions.yml' 'id:dRegions_%world%_regions'
          - run s@dRegions_Msg 'def:<&c>Cleared %flag% list for region %region%'
          - queue clear
          }
        }
      - foreach %mobs% {
        - if <def[value].is[matches].to[entity].not> {
          - define mobs '<def[mobs].exclude[%value%]||li@>'
          - run  s@dRegions_Msg 'def:<&c><&o>%value% is not a valid a mob!'
          }
        }
      - if <def[mobs].is_empty||true> {
        - run  s@dRegions_Msg 'def:<&c><&o>No valid mobs specified!'
        - define lines '<proc[dRegions_LineWrap].context[<s@dRegions_Flag_%Flag%.yaml_key[flag_help]||<&c>%flag% flag requires a %type% value!>|45]>'
        - foreach <def[lines]> {
          - run s@dRegions_Msg 'def:<&c><def[value]>'
          }
        - queue clear
        }

      - define currentMobs '<yaml[dRegions_%world%_regions].read[regions.%region%.flags.%flag%].replace[, ].with[|].as_list||li@>'
      - if '<def[flagValue].split[ ].get[1].is[==].to[-a]||false>' {
        - define flagValue '<def[currentMobs].include[<def[mobs].replace[li@]>].deduplicate||li@>'
        }
      - if '<def[flagValue].split[ ].get[1].is[==].to[-r]||false>' {
        - define flagValue '<def[currentMobs].exclude[<def[mobs].replace[li@]>].deduplicate||li@>'
        }
      - if <def[flagValue].is_empty||true> {
        - yaml set 'regions.%region%.flags.%flag%:!' 'id:dRegions_%world%_regions'
        - yaml 'savefile:dRegions/worlds/%world%/regions.yml' 'id:dRegions_%world%_regions'
        - run s@dRegions_Msg 'def:<&c>Cleared %flag% list for region %region%'
        - queue clear
        }
      - define flagValue '<def[flagValue].comma_separated>'
      }




#



RawRaw



Pastes made: 79782