Date: 2021/03/15 14:56:53 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
#Author: Icecapade
#Date: 2021-03-15
#Version: 1.0.1
WGConverter:
    type: command
    debug: false
    name: wgtodenizen
    description: converts worldguard regions to useable notables
    usage: /wgtodenizen [world/all] (regionname)
    permission: wgconverter.admin
    tab complete:
    - choose "<context.raw_args.to_list.count[ ]>":
        - case 0:
            - if <context.args.first||null> != null:
                - determine <server.worlds.parse[name].include[all].filter[starts_with[<context.args.first>]]>
            - else:
                - determine <server.worlds.parse[name].include[all]>
        - case 1:
            - if <world[<context.args.first>]||null> == null:
                - stop
            - if <context.args.first> == all:
                - stop
            - if <context.args.get[2]||null> != null:
                - determine <world[<context.args.first>].list_regions.parse[id].filter[starts_with[<context.args.get[2]>]]>
            - else if <context.args.first> != all:
                - determine <world[<context.args.first>].list_regions.parse[id]>
    script:
    - choose <context.args.first||null>:
        - case all:
            - narrate "Converting all WorldGuard-regions in useable Denizen notables.." format:WGConverter_format
            - foreach <server.worlds> as:world:
                - foreach <[world].list_regions> as:region:
                    - if <[region].cuboid||null> == null:
                        - narrate "The region <gold><[region].id> <gray>is not a cuboid-shaped region and can not be converted yet. Skipping." format:WGConverter_format
                        - foreach next
                    - note <[region].cuboid> as:WG_<[region].id>
                    - narrate "The region <gold><[region].id> <gray>was sucessfully converted to a cuboid notable called <gold>WG_<[region].id>" format:WGConverter_format
                - wait 1t
        - case null:
            - narrate "Syntax: <gold>/wgtodenizen [<<>world_name<>>/all] (<<>region_name<>>)"
        - default:
            - define world <context.args.first>
            - if !<server.worlds.parse[name].contains[<[world]>]>:
                - narrate "This world does not exist." format:WGConverter_format
                - stop
            - define region_name <context.args.get[2]||null>
            - if <[region_name]> == null:
                - narrate "You must specify a region name." format:WGConverter_format
                - stop
            - if !<world[<[world]>].has_region[<[region_name]>]>:
                - narrate "This world does not have a region called <gold><[region_name]>" format:WGConverter_format
                - stop
            - define region <region[<[region_name]>,<[world]>].cuboid||null>
            - if <[region]> == null:
                - narrate "This region is not a cuboid-shaped region and can not be converted yet." format:WGConverter_format
                - stop
            - narrate "The region <gold><[region_name]> <gray>was sucessfully converted to a cuboid notable called <gold>WG_<[region_name]>" format:WGConverter_format
            - note <[region]> as:WG_<[region_name]>
WGConverter_format:
    type: format
    debug: false
    format: <yellow>[WGConverter] <gray><text>