################################################################################ # # d R e g i o n s # # # Authors: |Anthony| # Version: 0.1 # dScript Version: 0.9.6-DEV_b146 # # # #--- About this script # # This is a basic recreation of WorldGuard in denizen # # # ################################################################################ # # dRegions World Events Script # # This should cover all dRegions related world events. # dRegions: type: world debug: false events: on player clicks block: - if queue clear - determine passively CANCELLED - inject instantly on server start: - run locally start delay:2t start: - inject locally loadYaml loadYaml: # Reloads the yaml files and generates default files if they don't exist. - announce "<&b>dRegions<&co><&3> Loading system config files..." to_console - if ! { - define world 'GLOBAL' - define file 'config' - if { - flag ConfigFileGeneratorNotify:true - inject locally createConfigFile - flag ConfigFileGeneratorNotify:! - run s@dRegions_Msg 'def:<&7><&o>Created <&f><&o>%world%<&7><&o> config file!' } else inject locally createConfigFile - announce "<&b>dRegions<&co> <&7><&o>Created <&f><&o>%world%<&7><&o> config file!" to_console } - if yaml unload 'id:dRegions_GLOBAL_config' - yaml 'load:dRegions/config.yml' 'id:dRegions_GLOBAL_config' - foreach { - define world '' - define file 'worlds/%world%/config' - if ! { - if { - flag ConfigFileGeneratorNotify:true - inject locally createConfigFile - flag ConfigFileGeneratorNotify:! - run s@dRegions_Msg 'def:<&7><&o>Created <&f><&o>%world%<&7><&o> config file!' } else inject locally createConfigFile - announce "<&b>dRegions<&co> <&7><&o>Created <&f><&o>%world%<&7><&o> config file!" to_console } - if yaml unload 'id:dRegions_%world%_config' - yaml 'load:dRegions/%file%.yml' 'id:dRegions_%world%_config' - define file 'worlds/%world%/regions' - if ! { - define region '__global__' - if { - flag ConfigFileGeneratorNotify:true - inject locally createRegionFile - flag ConfigFileGeneratorNotify:! - run s@dRegions_Msg 'def:<&7><&o>Created <&f><&o>%world%<&7><&o> regions file!' } else inject locally createRegionFile - announce "<&b>dRegions<&co> <&7><&o>Created <&f><&o>%world%<&7><&o> regions file!" to_console } - if yaml unload 'id:dRegions_%world%_regions' - yaml 'load:dRegions/%file%.yml' 'id:dRegions_%world%_regions' } - announce "<&b>dRegions<&co><&a> System config files Loaded!" to_console reloadYaml: - announce "<&b>dRegions<&co><&3> Reloading system config files..." to_console - run s@dRegions_Msg 'def:<&7><&o>Reloading system config files...' - if yaml unload 'id:dRegions_GLOBAL_config' - yaml 'load:dRegions/config.yml' 'id:dRegions_GLOBAL_config' - foreach { - define world '' - if yaml unload 'id:dRegions_%world%_config' - yaml 'load:dRegions/worlds/%world%/config.yml' 'id:dRegions_%world%_config' - if yaml unload 'id:dRegions_%world%_regions' - yaml 'load:dRegions/worlds/%world%/regions.yml' 'id:dRegions_%world%_regions' } - announce "<&b>dRegions<&co><&a> System config files Loaded!" to_console - run s@dRegions_Msg 'def:<&7><&o>System config files Loaded!' createConfigFile: - define readID 'dRegions_Configurations' - define writeID 'dRegions_%world%_config' - if ! yaml 'load:' 'id:%readID%' - yaml create 'id:%writeID%' - define readPath '%readID%.config' - define writePath 'config' - run s@ConfigFileGenerator def:%readID%|%writeID%|%readPath%|%writePath%|false|false|false instantly - yaml unload 'id:%readID%' - yaml 'savefile:dRegions/%file%.yml' 'id:%writeID%' createRegionFile: - define readID 'dRegions_Configurations' - define writeID 'dRegions_%world%_regions' - if ! yaml 'load:' 'id:%readID%' - yaml create 'id:%writeID%' - define readPath '%readID%.regions.__global__' - define writePath 'regions.%region%' - run s@ConfigFileGenerator def:%readID%|%writeID%|%readPath%|%writePath%|false|false|false instantly - yaml unload 'id:%readID%' - yaml 'savefile:dRegions/%file%.yml' 'id:%writeID%' createRegionEntry: - if ! yaml 'load:dRegions/worlds/%world%/regions.yml' 'id:dRegions_%world%_regions' - yaml set 'regions.%name%.type:cuboid' 'id:dRegions_%world%_regions' - yaml set 'regions.%name%.min:' 'id:dRegions_%world%_regions' - yaml set 'regions.%name%.max:' 'id:dRegions_%world%_regions' - yaml set 'regions.%name%.priority:0' 'id:dRegions_%world%_regions' - yaml set 'regions.%name%.flags:|:' 'id:dRegions_%world%_regions' - yaml set 'regions.%name%.owners:|:' 'id:dRegions_%world%_regions' - foreach { - yaml set 'regions.%name%.owners.groups:->:%value%' 'id:dRegions_%world%_regions' } - foreach { - yaml set 'regions.%name%.owners.players:->:%value%' 'id:dRegions_%world%_regions' } - yaml set 'regions.%name%.members:|:' 'id:dRegions_%world%_regions' - yaml 'savefile:dRegions/worlds/%world%/regions.yml' 'id:dRegions_%world%_regions' - note cu@| 'as:dregions_%world%_%name%' dRegions_Msg: type: item debug: false material: i@human_skull display name: "<&4>[<&6>dRegions<&4>]" lore: - <&5>Click for Help script: - ^define text '<&4>[<&6>dRegions<&4>]' - ^define hover '<&chr[007B]><&chr[007D]>' - ^define click '/dregions help' - ^define button "text:'%text%',clickEvent:<&chr[007B]>action:run_command,value:'%click%'<&chr[007D]>,hoverEvent:<&chr[007B]>action:show_item,value:'%hover%'<&chr[007d]>" - ^define spacer "text:' '" - ^define msg "text:'%1%'" - ^execute as_server "tellraw <&chr[007B]>text:'',extra:[<&chr[007B]>%button%<&chr[007D]>,<&chr[007B]>%spacer%<&chr[007D]>,<&chr[007B]>%msg%<&chr[007D]>]<&chr[007D]>" ################################################################################ # # dRegions Command Script Container # # This script covers all dRegions commands # # # #-------------------------------------- # # dRegions Command Script Basics # # The basic stuff required in a command script container # dRegions_Commands: type: command debug: true name: dregions description: Denizen Regions Manager usage: /dregions aliases: - drg allowed help: - determine true tab complete: - define argList 'li@help|reload|define|redefine|claim|select|info|addowner|removeowner|addmember|removemember|list|flag|setpriority|setparent|teleport|remove' - define arg '' - if || ! { - inject locally tab_arg_1 } else inject locally tab_%arg% - determine '' script: - define command '' - define args 'li@help|reload|define' - if ! inject locally help instantly else inject locally %command% instantly # # END dRegions Command Script Basics #-------------------------------------- # # dRegions Command TAB Completion # # Each of these subscripts handles TAB completion for the positional argument. # # # tab_arg_1: # # This builds a new resultSet list for the possible args # - define resultSet li@ # - foreach %argList% { # - if define resultSet '' # } # - if { # - define result '' # } # else { # - define result '' # - if define result %resultset% tab_arg_1: # This Excludes args from the original argList - foreach %argList% { - if ! define argList '' } - if define result 'li@' else { - define result ' ' - if define result '%argList%' } tab_help: - define result 'li@' tab_reload: - define result 'li@' tab_define: # /drg define [ID] (g:group) (player) - if { - define spaces '' - if define result 'define [ID]' else if { - if define result '[ID] (g:group) (player)' else define result ' (g:group) (player)' } else if { - define owners '' - if { - define owners '|]||li@>' } - define owner '' - if { - define group '' - define groups '' - if define groups '' - define result '' } else { - define result '' - if define result '' } } else define result 'li@' } else define result 'li@' tab_redefine: # /drg redefine [ID] - if { - define spaces '' - define world '].escaped.as_world.name||>' - define regions 'A|List|Of|Regions|You|Own|In|A|World' - if define result 'redefine %regions%' else if define result '%regions%' else define result 'li@' } else define result 'li@' tab_claim: - define result 'li@' tab_select: - define result 'li@' tab_info: - define result 'li@' tab_addowner: - define result 'li@' tab_removeowner: - define result 'li@' tab_addmember: - define result 'li@' tab_removemember: - define result 'li@' tab_list: - define result 'li@' tab_flag: - define result 'li@' tab_setpriority: - define result 'li@' tab_setparent: - define result 'li@' tab_teleport: - define result 'li@' tab_remove: # /drg remove [ID] -w world - if { - define spaces '' - if define result 'remove [ID] -w world' else if { - if define result '[ID]' else if define result '' else if { - define regions '_regions].list_keys[regions].exclude[__global__]||li@>' - define result ']]||li@>' - if define result '%regions%' } else define result 'li@' } else if { - if { - if define result ']]||li@>' - if define result '' } else define result '' } else if { - if { - if { - define regions '_regions].list_keys[regions].exclude[__global__]||li@>' - define result ']]||li@>' - if define result '%regions%' } else define result '_regions].list_keys[regions].exclude[__global__]||li@>' } else { - if define result ']]||li@>' else define result '' - if define result '' } } else define result 'li@' } else define result 'li@' # # END dRegions Command Script Basics #-------------------------------------- # # dRegions Command Arguments # # Each of these subscripts is an argument for the root command. # help: - if > inject locally msgsHelpAdmin instantly else inject locally msgsHelpUser instantly - inject locally msgsFooter instantly - queue clear reload: - if !>> { - inject locally help - queue clear } - inject s@dRegions p:reloadYaml instantly - run s@dRegions_Msg 'def:<&7><&o>System files loaded!' define: # /drg define [ID] (g:group) (player) - inject locally prerun instantly # Check for existing region - define exists '' - if { - run s@dRegions_Msg 'def:<&c>There is an orphaned region by this name!' - run s@dRegions_Msg 'def:<&c>Please notify an admin!' - queue clear } else if { - run s@dRegions_Msg 'def:<&c>There is already a region by this name!' - queue clear } # Check for overlapping regions - if ! { - if ]> { - run s@dRegions_Msg 'def:<&c>Region selection contains unowned regions!' - queue clear } } # Parse any declaired owners - define owners '' - if { - define owners '|]||li@>' } - define ownerGroups li@ - define ownerPlayers li@ - foreach %owners% { - if define ownerGroups ']||%ownerGroups%>' else { - if foreach next - define ownerPlayers ']||%ownerPlayers%>' } } # Create the region - inject s@dRegions p:createRegionEntry instantly - run s@dRegions_Msg 'def:<&7><&o>Created %name% in %world%' redefine: # /drg redefine [ID] - inject locally prerun instantly # Check if region exists - define exists '' - if { - run s@dRegions_Msg 'def:<&c>There is an orphaned region by this name!' - run s@dRegions_Msg 'def:<&c>Please notify an admin!' - queue clear } else if { - run s@dRegions_Msg 'def:<&c>There is no region by this name!' - queue clear } # Check if is owner - if ! { - if ].not> { - run s@dRegions_Msg 'def:<&c>You are not an owner of this region!' - queue clear } } # Check for overlapping regions - if ! { - if ]> { - run s@dRegions_Msg 'def:<&c>Region selection contains unowned regions!' - queue clear } } # Update the region - narrate "Stub" claim: - narrate "Stub" select: - narrate "Stub" info: - narrate "Stub" addowner: - narrate "Stub" removeowner: - narrate "Stub" addmember: - narrate "Stub" removeemember: - narrate "Stub" list: - narrate "Stub" flag: - narrate "Stub" setpriority: - narrate "Stub" setparent: - narrate "Stub" teleport: - narrate "Stub" remove: # /drg remove [ID] -w world - inject locally prerun instantly # Check if region exists - define exists '' - if { - run s@dRegions_Msg 'def:<&c>There is an orphaned region by this name!' - run s@dRegions_Msg 'def:<&c>Please notify an admin!' - queue clear } else if { - run s@dRegions_Msg 'def:<&c>There is no region by this name!' - queue clear } else run s@dRegions_Msg 'def:<&3>Preparing to remove %name%' # Check if is owner - if ! { - if ].not> { - run s@dRegions_Msg 'def:<&c>You are not an owner of this region!' - queue clear } else narrate "You are allowed to remove the region!" } # Check for child regions and unset parent - define regions '' - foreach %regions% { - if { - yaml set 'regions.%value%.parent:<-:%name%' 'id:dRegions_%world%_regions' } } # Remove the region - yaml set 'regions.%name%:!' 'id:dRegions_%world%_regions' - note remove 'as:dregions_%world%_%name%' - yaml 'savefile:dRegions/worlds/%world%/regions.yml' 'id:dRegions_%world%_regions' - run s@dRegions_Msg 'def:<&f><&o>%name%<&7><&o>has been removed from <&f><&o>%world%' # # END dRegions Command Arguments #-------------------------------------- # # dRegions Command Utilities # # Just some commonly used code blocks # prerun: # Block of checks run before /most/ commands - if !> { - inject locally help - queue clear } - if { - define world '].escaped.as_world.name||null>' - if { - run s@dRegions_Msg 'def:<&c>Invalid world specfied!' - queue clear } - define args ']>' - define name '' } else define world '' - if { - define wandType '' - if { - run s@dRegions_Msg 'def:<&c>You must select a cuboid type region!' - queue clear } - define pos1 '' - define pos2 '' - if || { - run s@dRegions_Msg 'def:<&c>No region selected!' - queue clear } - if || { - run s@dRegions_Msg 'def:<&c>Selected region not within specified world!' - queue clear } - define selectedCuboid '' } - define name '>' - if { - run s@dRegions_Msg 'def:<&c>You must specify a name!' - queue stop } # - inject s@dRegions_Commands p:selection_Size instantly # - define oldSize '%size%' # # dRegions dRegions Command Utilities #-------------------------------------- # # dRegions Command Messages # # These are not complete! They are mostly just stubs till the rest is fleshed out! # msgsHeader: - narrate "<&5>|----------------------------------------|" - narrate "<&5>|<&sp><&sp><&sp><&6>dRegions <&7>%msgsHeaderTitle%" - narrate "<&5>|<&f>" msgsFooter: - define anthony "text<&co>'<&7>|Anthony|',clickEvent<&co><&chr[007B]>action<&co>open_url,value<&co>'http<&co>//mineconomy.org'<&chr[007D]>,hoverEvent<&co><&chr[007B]>action<&co>show_item,value<&co>'<&chr[007B]><&chr[007D]>'<&chr[007D]>" - define spacer "text<&co>' '" - define prefix "text<&co>'<&5>| <&f>Authors<&co> '" - execute as_server "tellraw <&chr[007B]>text<&co>'',extra<&co>[<&chr[007B]>%prefix%<&chr[007D]>,<&chr[007B]>%anthony%<&chr[007D]>]<&chr[007D]>" - narrate "<&d>|-----------S-c-r-o-l-l---U-p-------------|" msgsHelpAdmin: - define msgsHeaderTitle 'Admin Help' - inject locally msgsHeader instantly - narrate "<&5>|<&sp><&sp><&sp><&f>" - narrate "<&5>|<&sp><&sp><&f>" - narrate "<&5>|<&sp><&sp><&f>" - narrate "<&5>|<&sp><&sp><&f>" - narrate "<&5>|<&sp><&sp><&f>" - narrate "<&5>|<&sp><&sp><&f>" - narrate "<&5>|<&sp><&f>" msgsHelpUser: - define msgsHeaderTitle 'User Help' - inject locally msgsHeader instantly - narrate "<&5>|<&sp><&sp><&sp><&sp><&f>" - narrate "<&5>|<&sp><&sp><&f>" - narrate "<&5>|<&sp><&sp><&f>" - narrate "<&5>|<&sp><&f>" # # END dRegions Command Messages #-------------------------------------- # # dRegions Other Utilities # # Other Utility functions used throughout dRegions # ##dRegions_HasPerm: ## I have to think about this more... ## # A procedure script to check if a player has any of the required permissions for a command ## # ## type: procedure ## definition: command ## constants: ## define: ## - admin ## - define ## redefine: ## - admin ## - redefine ## - redefine.own.* ## - redefine.own.%region% ## - redefine.member.* ## - redefine.member.%region% ## ## script: ## - if '' determine false ## - define perms dRegions_IsOwner: # A procedure script to check if a player is a region owner # type: procedure definitions: region|world|player script: - define ownerPlayers '' - define ownerGroups '' - if ].not||false> && ].not||false> determine false else determine true dRegions_RegionExists: # A procedure script to check if a region exists # type: procedure definitions: region|world script: - define notables '' - define regions '' - if %notables% && %regions% determine false else if %notables% || %regions% determine orphan else determine true dRegions_RegionOverlaps: # A procedure script to check if a region overlaps other (un)owned regions # # NOTE: We have the ability to return %overlaps% and %unowned% if we want type: procedure definitions: region|world|player script: - define regions '' - define notables '' - define overlaps '' - define unowned '].not>]||li@>' - if determine true else determine false # # END other utilities #-------------------------------------- # # dRegions author banner items # # Banner items representing the authors # dRegions_Author_Anthony: type: item material: i@human_skull display name: "<&f> |Anthony|" lore: - <&7> Owner<&co> <&e>M<&6>ine<&e>C<&6>onomy <&e>N<&6>etwork - <&5>------------------------- - <&7> - <&7> I`ve been playing minecraft - <&7> and running a server since - <&7> 2010. I have fun and share - <&7> what I do. - <&7> - <&9> Click To Visit # # END dRegions author banner items #-------------------------------------- ################################################################################ # # # Configuration Files # # # # These are the default config files. They will be used to build the default # # configuration and data storage files. # # # #______________________________________________________________________________# # # #______________________________DO_NOT_EDIT_THIS_DATA___________________________# #______________________________________________________________________________# dRegions_Configurations: type: yaml data config: version: 0.1 regions: enable: true invincibility-removes-mobs: false wand: dWE_Wand claim: max-volume: 0 only-inside-existing-regions: true max-region-count-per-player: default: 7 auto-invincible: false protection: item-durability: true remove-infinite-stacks: false disable-xp-orb-drops: false disable-obsidian-generators: true physics: no-physics-gravel: false no-physics-sand: false allow-portal-anywhere: false disable-water-damage-blocks: [] ignition: block-tnt: false block-tnt-block-damage: false block-lighter: false fire: disable-lava-fire-spread: false disable-all-fire-spread: false disable-fire-spread-blocks: [] lava-spread-blocks: [] mobs: block-creeper-explosions: false block-creeper-block-damage: false block-wither-explosions: false block-wither-block-damage: false block-wither-skull-explosions: false block-wither-skull-block-damage: false block-enderdragon-block-damage: false block-fireball-explosions: false block-fireball-block-damage: false disable-enderman-griefing: false block-painting-destroy: false block-item-frame-destroy: false block-creature-spawn: [] player-damage: disable-fall-damage: false disable-lava-damage: false disable-fire-damage: false disable-lightning-damage: false disable-drowning-damage: false disable-suffocation-damage: false disable-contact-damage: false teleport-on-suffocation: false disable-void-damage: false teleport-on-void-falling: false disable-explosion-damage: false disable-mob-damage: false disable-death-messages: false crops: disable-creature-trampling: false disable-player-trampling: false weather: prevent-lightning-strike-blocks: [] disable-lightning-strike-fire: false disable-thunderstorm: false disable-weather: false disable-pig-zombification: false disable-powered-creepers: false always-raining: false always-thundering: false dynamics: disable-mushroom-spread: false disable-ice-melting: false disable-snow-melting: false disable-snow-formation: false disable-ice-formation: false disable-leaf-decay: false disable-grass-growth: false disable-mycelium-spread: false regions: __global__: type: global priority: 0 flags: [] owners: [] members: [] #