Paste #47692: Repo Script WorldGuard Region to Notable Cuboids

Date: 2018/06/04 15:04:01 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].name>_R_<def[value].id>' 
            - define c_list '<def[c_list].include[cu@wgregion_W_<def[w].name>_R_<def[value].id>]>' 
        } 
    } 
    - foreach <server.list_notables[cuboids].filter[starts_with[cu@wgregion_]].exclude[<def[c_list]>]> { 
        - note remove as:<def[value]> 
    }