Paste #47657: WorldGuard to Notable Cuboids | The 2nd Betterer Update

Date: 2018/06/03 11:45:54 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


# 
# ----| USAGE
# 
# It's easy as running this command:
# /ex run worldguard_regions_to_notable_cuboids
# 
# It will automatically convert all WorldGuard regions to
# notable cuboids, so you can use cuboids with this name
# format:
# 
# wgregion_W_<world name>_R_<region name>
# 
# You can then use these new notable regions in events,
# commands, tags, etc.
# 
# 
# ----| NOTE
# 
# Every time you create, edit, or delete a WorldGuard region,
# you will need to rerun this script to update the notable
# cuboids as well.
# 

worldguard_regions_to_notable_cuboids:
    type: task
    debug: false
    speed: 0
    script:
    - define c_list 'li@'
    - foreach <server.list_worlds> {
        - define w '<def[value]>'
        - foreach <def[w].list_regions> {
            - note <def[value].cuboid> 'as:wgregion_W_<def[w]>_R_<def[value]>'
            - define c_list '<def[c_list].include[cu@wgregion_W_<def[w]>_R_<def[value]>]>'
        }
    }
    - foreach <server.list_notables[cuboids].exclude[<def[c_list]>]> {
        - note remove as:<def[value]>
    }