################################################################################ # # # d W o r l d M a n a g e r # # # # # # Authors: |Anthony| # # Version: 0.26 # # dScript Version: 0.9.8-DEV-b646 # # # # For bleeding-edge code, bug reports, code contributions, and feature # # requests, visit the GitHub project: # # - github.com/AnthonyAMC/Public-Denizen-Scripts/blob/master/dWorldManager.yml # # # Has my work helped you in some way? Show your support by clicking the # # Like button. # # Feeling generous? Get me a coffee :D # # https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=NPXKHCNMTGSUG # # #------------------------------------------------------------------------------# # # # # #--- About this script # # # # dWorldManager is a world management system written with the Denizen # # Scripting Engine. It is meant to take the place of existing world # # management plugins such as MultiVerse for those of us who want a pure # # Denizen Server. # # # # dWM is fairly feature rich, providing commands for all the basic world # # operations. More configuration options will come. # # # #______________________________________________________________________________# # # Dependencies: # # - ConfigFileGenerator # - Used to build default config files and data storage. # - https://github.com/AnthonyAMC/Public-Denizen-Scripts/blob/master/ConfigFileGenerator.yml # # - MessageConstructorLibrary # - Used for all message output # - https://github.com/AnthonyAMC/Public-Denizen-Scripts/blob/master/MessageConstructors.yml # # #_______________________________________________________________________________ # # Command Permission Description # # Every command has it's own permission, i'm too lazy to type them all here atm # /dwm help [arg/#] dwm.help Get help. # # # TODO: # # - Better code docs # - level.dat not generated on world creation... must address # ################################################################################ # # dWorldManager Version # # Handles dWM Versioning Checks # dWM_Version: type: version author: Anthony name: dWorldManager version: 0.26 description: Denizen World Manager id: 93 # # END dWorldManager Version #-------------------------------------- # ################################################################################ # # dWorldManager Events # # This should cover all dWM related world events. # dWM_Events: type: world debug: false events: on system time hourly: - if ! { - queue clear } - if !contains 'q@dWM_UpdateCheck' { - run locally delay:1t updateCheck 'id:dWM_UpdateCheck' } - if !contains 'q@dWM_SendMetrics' { - run locally delay:1t sendMetrics 'id:dWM_SendMetrics' } on server prestart: - inject locally loadYaml - foreach { - if ! { - run s@msgPrefixed 'def:dWM|<&3>Adding %value% to the config file...' - yaml set 'worlds.%value%.loaded:true' 'id:dWM_Config' - yaml 'savefile:dWorldManager/config.yml' 'id:dWM_Config' } } - define path '' - foreach '' { - if { - if { - createworld '%value%' 'worldtype:' 'environment:' } } # Maybe we shouldn't do this here and instead remove deleted worlds from the configs with only the purge command? else if { - yaml set 'worlds.%value%:!' 'id:dWM_Config' - yaml 'savefile:dWorldManager/config.yml' 'id:dWM_Config' } } on server start: - if !contains 'q@dWM_UpdateCheck' { - run locally delay:1t updateCheck 'id:dWM_UpdateCheck' } - run locally instantly load_command_list delay:1t on server shutdown: - yaml 'savefile:dWorldManager/config.yml' 'id:dWM_Config' on player quits: - define w '' - define loc '' - run instantly delay:1t s@dWM_SetLL 'def:quit||%w%|%loc%' on player teleports: - define w '' - define loc '' - run instantly delay:1t s@dWM_SetLL 'def:teleport||%w%|%loc%' on player dies: - define w '' - define loc '' - run instantly delay:1t s@dWM_SetLL 'def:death||%w%|%loc%' on player enters bed priority:1000 ignorecancelled:false: - define w '' - define loc '' - run instantly delay:1t s@dWM_SetLL 'def:bed||%w%|%loc%' on world loads: - if !]||false> { - run s@msgPrefixed 'def:dWM|<&3>Adding to the config file...' - yaml set 'worlds..loaded:true' 'id:dWM_Config' - yaml 'savefile:dWorldManager/config.yml' 'id:dWM_Config' } on world initializes: - if !]||false> { - run s@msgPrefixed 'def:dWM|<&3>Adding to the config file...' - yaml set 'worlds..loaded:true' 'id:dWM_Config' - yaml 'savefile:dWorldManager/config.yml' 'id:dWM_Config' } on script reload: - run locally instantly reloadYaml - if !contains 'q@dWM_UpdateCheck' { - run locally delay:1t updateCheck 'id:dWM_UpdateCheck' } - run delay:1t locally instantly load_command_list load_command_list: - flag server 'dWM.Command_List:!' - flag server 'dWM.Command_List:|:' loadYaml: # Reloads the yaml files and generates default files if they don't exist. # Rewrites config files that do not match internal version number! - if ! { - inject locally createConfigFile - run s@msgPrefixed 'def:dWM|<&7><&o>Created config file!' } else { - run s@msgPrefixed 'def:dWM|<&3>Loading system config files...' } - if { - yaml unload 'id:dWM_Config' } - yaml 'load:dWorldManager/config.yml' 'id:dWM_Config' - if ]||true> { - define isUpdate '' - inject locally createConfigFile - define isUpdate:! - run s@msgPrefixed 'def:dWM|<&7><&o>Updated config file!' } - run s@msgPrefixed 'def:dWM|<&a>System config files Loaded!' updateCheck: - ^if ! { - ~webget "https://one.denizenscript.com/denizen/repo/version/" save:page - ^flag server "dWM.Version.Repo:" d:1h } - ^define repoVersion '' - ^define currentVersion '' - ^if '%repoVersion%' == 'unknown' { - run s@msgPrefixed instantly 'def:dWM|<&7>Unable to check for update! <&7><&o>%currentVersion%<&7> is installed!' } else if '%repoVersion%' > '%currentVersion%' { - run s@msgPrefixed instantly 'def:dWM|<&7>Update from version <&o>%currentVersion%<&7> to <&o>%repoVersion%<&7>!' } else if '%repoVersion%' != '%currentVersion%' { - run s@msgPrefixed instantly 'def:dWM|<&7>What happened? You are on version <&o>%currentVersion%<&7> and the repo says <&o>%repoVersion%<&7>!' } sendMetrics: # - run s@msgPrefixed 'def:dWM|<&3>Sending usage metrics...' - ~webget "http://stats.denizenscript.com/tracker?script=&version=&players=&denizen_version=&jenkins_build=&bukkit_version=" 'save:send' - if ! { - run s@msgPrefixed instantly 'def:dWM|<&c>Metrics failed!' } reloadYaml: # A simpler reload - run s@msgPrefixed 'def:dWM|<&7><&o>Reloading system config files...' - if { - yaml unload 'id:dWM_Config' } - yaml 'load:dWorldManager/config.yml' 'id:dWM_Config' - run s@msgPrefixed 'def:dWM|<&7><&o>System config files Loaded!' createConfigFile: - define readID 'dWM_Configurations' - define writeID 'dWM_Config' - if ! { - yaml fix_formatting 'load:' 'id:%readID%' } - define readPath '%readID%.config' - define writePath 'config' - if { - run s@ConfigFileGenerator 'def:%readID%|%writeID%|%readPath%|%writePath%|false|false|true' instantly } else { - yaml create 'id:%writeID%' - run s@ConfigFileGenerator 'def:%readID%|%writeID%|%readPath%|%writePath%|false|false|false' instantly } - yaml unload 'id:%readID%' - yaml 'savefile:dWorldManager/config.yml' 'id:%writeID%' # # END dWorldManager Events #-------------------------------------- # # ################################################################################ # # dWorldManager Commands # # Every command has its own script container. The root command functions mostly # as link to specific commands and provides some initial processing. # # #-------------------------------------- # # dWM Command Script Registrar # # The root command. Validates minor input and sends to command script. # dWM_Commands: type: command debug: false name: dwm description: Denizen World Manager usage: /dworldmanager aliases: 'dworldmanager' allowed help: - determine > script: - define command '' - define commands '' - define args '].escape_contents||li@>' - if ! || !]> { - inject s@dWM_Commands_Help } - inject s@dWM_Commands_%command% tab complete: - define command '' - define commands '' - define args ']||li@>' - define spaces '' - if { - inject s@dWM_Commands_%command% 'p:tab complete' } else { - define commands '' } - foreach %commands% { - if !]> { - define commands '' } } - if { - determine 'li@' } - determine '' # Preprocessors. Does some pre-processing and passes back to the calling command prerun: - if { - define sender 'server' } else { - define sender '' } - if == 'dwm%command%' { - if !]> { - inject s@dWM_Commands_Help p:helpList - queue clear } - define commands '' - define args "" } # # END dWM Command Registrar #-------------------------------------- # # ################################################################################ # # # dWorldManager Command Scripts # # This section holds all of the commands for dWorldManager. The root command /dWM # takes many arguments but most of those arguments can also be run as individual # commands. This results in dWorldManager command args having a shorthand version # in the form of /dwmarg # dWM_Commands_Help: type: command debug: false speed: 0 name: dwmhelp description: Show dWorldManager help usage: /dwmhelp aliases: '' allowed help: - determine > data: description: - ' The help docs provide usage info and examples for all commands.' - ' ' - ' <&6><&l>Clickable page navigation is available!' usage: '/dwm help (<<>arg<>>) (<<><&ns><>>)' examples: - '<&f>To show the <&a>second<&f> page of help for the <&2>help<&f> command' - '<&sp>' - ' <&e>/dwm help <&2>help <&a>2' - ' ' - '<&f>To show the <&a>third<&f> page of the help files' - '<&sp>' - ' <&e>/dwm help <&a>3' permissions: [] tab complete: - if ! { - define commands '' - define args "" } - define command '' - if { - determine 'li@' } else { - define commands '' } - foreach %commands% { - if !]> { - define commands '' } } - if { - determine 'li@' } - determine '' script: - if ! { - define command 'help' } - inject s@dWM_Commands p:prerun - define arg '' - if { - define command '%arg%' - define page ']:||1>' - inject s@dWM_Commands_Help p:helpCommand - queue clear } - define page ']:||1>' - inject s@dWM_Commands_Help p:helpList - queue clear helpList: # Filter the list of commands this player can use # Build the help documentation - define helpDoc 'li@' - foreach %commands% { - if !]> { - define commands '' } else { - define button '<&co>|dwm help %value%|<&a>Click for <&b> <&a>help]>' - define helpDoc '<&7>>|<&e.pad_left[3].with[<&sp>]>>]>]>' } } - run s@msgBoxed instantly 'def:dWM|dWorldManager|dwm about|<&a>Click to learn<&nl><&a>about the project!]>|Help|dwm help|<&a>Go back to main help]> Files|dWM help||52|10|' helpCommand: # Help for a specific command - define short '>' - define desc '>' - define usage '>' - define examples '>' - define entries '<&7>%short%| |%desc%| |<&b><&n>Usage<&co>| |<&e.pad_left[3].with[ ]>%usage%| |<&3><&n>Examples<&co>| |%examples%' - run s@msgBoxed instantly 'def:dWM|dWorldManager|dwm about|<&a>Click to learn<&nl><&a>about the project!]>|Help|dwm help|<&a>Go back to main help]> - |dWM help %command%||52|10|%entries%' dWM_Commands_About: type: command debug: false speed: 0 name: dwmabout description: Details about the project usage: /dwmabout aliases: '' data: description: - ' dWorldManager is a world management system written with the Denizen Scripting Engine. It is meant to take the place of existing world management plugins such as MultiVerse for those of us who want a pure Denizen Server.' - ' ' - ' dWM is fairly feature rich, providing all the familiar commands you would expect from a world manager.' - ' ' - ' Future development will bring more advanced world configuration options. Maybe dWM will even provide world instancing support if that sort of thing is useful to people.' usage: '/dwm about' examples: - 'You<&sq>ve got to be kidding me...' - ' /dwm|data.whicdn.com/images/129295787/large.jpg|If you click this...<&nl>I just don<&sq>t even know...]> about|data.whicdn.com/images/129295787/large.jpg|If you click this...<&nl>I just don<&sq>t even know...]>' - ' ' permissions: [] tab complete: - determine 'li@' script: - if ! { - define command 'about' } - inject s@dWM_Commands p:prerun - run s@msgBoxed instantly 'def:dwm|dWorldManager|dwm help|<&a>Go back to main help]>|<&e>About|dwm about|]:||1>|52|10|<&7>>| |>' dWM_Commands_List: type: command debug: false speed: 0 name: dwmlist description: List all worlds usage: /dwmlist aliases: '' data: description: - ' Lists all worlds known to dWM.' - ' <&a>Green<&f> worlds are loaded' - ' <&7>Gray<&f> worlds are unloaded' - ' <&8>Dark gray<&f> worlds are not registered' usage: '/dwm list' examples: - 'You<&sq>ve got to be kidding me...' - ' /dwm|data.whicdn.com/images/129295787/large.jpg|If you click this...<&nl>I just don<&sq>t even know...]> list|data.whicdn.com/images/129295787/large.jpg|If you click this...<&nl>I just don<&sq>t even know...]>' - ' ' permissions: [] tab complete: - determine 'li@' script: - if ! { - define command 'list' } - inject s@dWM_Commands p:prerun - define path '' - define worlds 'li@' - define n '0' - foreach '': - if ! { - foreach next } - define v '' - choose '%v%': - case '0': - define n '' - define desc '<&b><&b>]||<&5>No Description>' - define worlds '%n%. %value%|%desc%]>]>' - case '4': - define n '' - define desc '<&b><&b>]||<&5>No Description>' - define worlds '%n%. %value%|%desc%]>]>' - case '5': - define n '' - define desc '<&b><&b>]||<&5>No Description>' - define worlds '%n%. %value%|%desc%]>]>' - run s@msgBoxed instantly 'def:dwm|dWorldManager|dwm help|<&a>Go back to main help]>|<&e>World List|dwm list|]:||1>|52|10|' dWM_Commands_Create: type: command debug: false name: dwmcreate description: Create new worlds usage: /dwmcreate aliases: '' data: description: 'Create new worlds' usage: '/dwm create <&lb><<>name<>><&rb> (g<&co><<>generator<>>) (t<&co><<>type<>>) (e<&co><<>environment<>>)' examples: - 'Create a normal world named denizen' - ' <&e>/dwm create denizen' - ' ' - 'Create a nether world named hell' - ' <&e>/dwm create hell e:NETHER' - ' ' - 'Create an amplified end world named megaend' - ' <&e>/dwm create megaend t:AMPLIFIED e:THE_END' - ' ' - 'Create a normal world named city using the CityWorld generator' - ' <&e>/dwm create city g:CityWorld' - ' ' permissions: - admin - create tab complete: - determine 'li@' script: - if ! { - define command 'create' } - inject s@dWM_Commands p:prerun - inject s@dWM_ParseArgs - if ! { - define t 'NORMAL' } - if ! { - define e 'NORMAL' } - define w '' - define v '' - define vval 'li@3' - inject s@dWM_CreateWorldConfigs - run s@msgPrefixed 'def:dWM|<&a>Created <&o>%w%<&a>!' dWM_Commands_Unload: type: command debug: false name: dwmunload description: Unload worlds usage: /dwmunload aliases: '' data: description: 'Unload worlds from the system. Does not delete them!' usage: '/dwm unload <&lb><<>name<>><&rb>' examples: - 'Unload the world named denizen' - ' <&e>/dwm unload denizen' - ' ' permissions: - admin - unload tab complete: - determine 'li@' script: - if ! { - define command 'unload' } - inject s@dWM_Commands p:prerun - inject s@dWM_ParseArgs - define w '' - inject s@dWM_UnloadWorld - run s@msgPrefixed 'def:dWM|<&d><&o>%w% <&d>has been unloaded.' dWM_Commands_Load: type: command debug: false name: dwmload description: Load worlds usage: /dwmload aliases: '' data: description: 'Load registered worlds' usage: '/dwm load <&lb><<>name<>><&rb>' examples: - 'Load the world named denizen' - ' <&e>/dwm load denizen' - ' ' permissions: - admin - load tab complete: - determine 'li@' script: - if ! { - define command 'load' } - inject s@dWM_Commands p:prerun - inject s@dWM_ParseArgs - define w '' - inject s@dWM_LoadWorld - run s@msgPrefixed 'def:dWM|<&a>Loaded <&o>%w%<&a>!' dWM_Commands_Reload: type: command debug: false name: dwmreload description: Reload config file usage: /dwmreload aliases: '' data: description: 'Reload dWM config files.' usage: '/dwm reload' examples: - 'If you<&sq>ve been given access to this command, you<&sq>d better damn well know how to use it!' - ' /dwm|data.whicdn.com/images/129295787/large.jpg|I wonder what happens when i click this...]> reload|data.whicdn.com/images/129295787/large.jpg|I wonder what happens when i click this...]>' - ' ' permissions: - admin - unload tab complete: - determine 'li@' script: - if ! { - define command 'reload' } - inject s@dWM_Commands p:prerun - inject s@dWM_Events p:reloadYaml - inject s@dWM_Events p:load_command_list dWM_Commands_Remove: type: command debug: false name: dwmremove description: Remove worlds usage: /dwmremove aliases: '' data: description: - 'Remove worlds from the system.' - 'This command will DELETE world files, but will keep the dWM configurations for it.' usage: '/dwm remove <&lb><<>name<>><&rb>' examples: - 'Remove the world named denizen' - ' <&e>/dwm remove denizen' - ' ' permissions: - admin - remove tab complete: - determine 'li@' script: - if ! { - define command 'remove' } - inject s@dWM_Commands p:prerun - inject s@dWM_ParseArgs - define w '' - define v '' - if 'li@0|4|5' !contains '%v%' { - run instantly delay:1t 's@dWM_Error' 'def:world|%v%|%sender%|%w%' - queue clear } - if ! { - run s@msgPrefixed 'def:dWM|<&d>Enter command again to confirm removing %w%!' - flag server 'dWM.RemoveWorld.%sender%.%w%' d:100t - queue clear } - flag server 'dWM.RemoveWorld.%sender%.%w%:!' - inject s@dWM_RemoveWorld - run s@msgPrefixed 'def:dWM|<&a>Removed <&o>%w%<&a>!' dWM_Commands_Purge: type: command debug: false name: dwmpurge description: Remove world data usage: /dwmpurge aliases: '' data: description: - 'Remove world data from dWM.' - 'This command will purge all world data from dWM.' usage: '/dwm purge <&lb><<>name<>><&rb>' examples: - 'Purge the world named denizen' - ' <&e>/dwm purge denizen' - ' ' permissions: - admin - purge tab complete: - determine 'li@' script: - if ! { - define command 'purge' } - inject s@dWM_Commands p:prerun - inject s@dWM_ParseArgs - define w '' - define v '' - if 'li@1|2|4' contains '%v%' { - run instantly delay:1t 's@dWM_Error' 'def:world|%v%|%sender%|%w%' - queue clear } - if '%v%' == '0' { - run instantly delay:1t 's@dWM_Error' 'def:purge|1|%sender%|%w%' - queue clear } else if '%v%' == '3' { - if ! { - run instantly delay:1t 's@dWM_Error' 'def:purge|2|%sender%|%w%' - queue clear } } - if ! { - run s@msgPrefixed 'def:dWM|<&d>Enter command again to confirm purging %w%!' - flag server 'dWM.PurgeWorld.%sender%.%w%' d:100t - queue clear } - flag server 'dWM.PurgeWorld.%sender%.%w%:!' - yaml set 'worlds.%w%:!' 'id:dWM_Config' - yaml 'savefile:dWorldManager/config.yml' 'id:dWM_Config' - run s@msgPrefixed 'def:dWM|<&a>Purged <&o>%w%<&a> from config files!' dWM_Commands_Import: type: command debug: false name: dwmimport description: Import an existing world usage: /dwmimport aliases: '' data: description: - 'You can import pre-made worlds by placing them in your world folder and running the importer.' - 'Worlds will not be registered with dWM unless they have been imported!' usage: '/dwm import <&lb><<>name<>><&rb>' examples: - 'Import the world named denizen' - ' <&e>/dwm import denizen' - ' ' permissions: - admin - import tab complete: - determine 'li@' script: - if ! { - define command 'import' } - inject s@dWM_Commands p:prerun - inject s@dWM_ParseArgs - if ! { - define t 'NORMAL' } - if ! { - define e 'NORMAL' } - define w '' # - inject s@dWM_ImportWorld - define v '' - define vval 'li@4' - inject s@dWM_CreateWorldConfigs - run s@msgPrefixed 'def:dWM|<&a>Imported <&o>%w%<&a>!' - if contains 's@dRegions_WG_Importer' { - run s@dRegions_WG_Importer 'def:%w%' } dWM_Commands_Clone: type: command debug: false name: dwmclone description: Clone an existing world usage: /dwmclone aliases: '' data: description: - 'You can clone existing worlds.' - 'Worlds will not be registered with dWM unless they have been imported!' usage: '/dwm clone <&lb><<>oldWorld<>><&rb> <&lb><<>newWorld<>><&rb>' examples: - 'Clone the world named denizen and name it doodlepop' - ' <&e>/dwm clone denizen doodlepop' - ' ' permissions: - admin - clone tab complete: - determine 'li@' script: - if ! { - define command 'clone' } - inject s@dWM_Commands p:prerun - inject s@dWM_ParseArgs - define c '' - define w '' - define v '' - if 'li@0|5' !contains '%v%' { - run instantly delay:1t 's@dWM_Error' 'def:world|%v%|%sender%|%c%' - queue clear } - define t '' - define e '' - define g '' - define vval 'li@3' - define clone '' - inject s@dWM_CreateWorldConfigs - run s@msgPrefixed 'def:dWM|<&a>Cloned <&o>%w%<&a>!' dWM_Commands_Tp: type: command debug: false name: dwmtp description: Teleport anyone anywhere usage: /dwmtp aliases: '' data: description: - 'Teleport anyone anywhere. Teleport everything everywhere.' - ' ' usage: '/dwm tp (-abehnps) (<<>x,y,z<>>) <&lb><<>world<>><&rb>' examples: - '<&d>The following is a list of planned teleport usages. The current implementation only allows for teleporting yourself to a world.' - ' ' - 'Teleport yourself to your last location in the hub world' - ' <&e>/dwm tp hub' - ' ' - 'Teleport mcmonkey and morphan1 to their last location in the hub world' - ' <&e>/dwm tp hub mcmonkey morphan1' - ' ' - 'Teleport mcmonkey and morphan1 to their beds in the dream world' - ' <&e>/dwm tp -b dream mcmonkey morphan1' - ' ' - 'Teleport mcmonkey to the spawn location in hell and teleport all ghasts and zombie pigmen to him' - ' <&e>/dwm tp -es hell mcmonkey ghast zombie_pigmen' - ' ' - 'Teleport mcmonkey and morphan1 to mcmonkeys bed in the whacky world' - ' <&e>/dwm tp -pb whacky mcmonkey morphan1' - ' ' - 'Teleport mcmonkey and morphan1 to you so you can laugh at them' - ' <&e>/dwm tp -ph mcmonkey morphan1' - ' ' - 'Teleport everyone to notch to ask him for some of that 2.5 billion' - ' <&e>/dwm tp -ap notch' - ' ' permissions: - admin - tp tab complete: - determine 'li@' script: - if ! { - define command 'tp' } - inject s@dWM_Commands p:prerun - inject s@dWM_ParseArgs - define prefix '<&lb><&6>dWM<&4><&rb>|dwm help|<&6> dWM<&nl><&d>Click for help]> ' # Determine the destination # World spawn # Player World Bed # Player World last location # Player current location # NPC current location # Determine the entities to teleport - if ! { - run instantly delay:1t 's@dWM_Error' 'def:entity|1|%sender%' } - if ! { - run instantly delay:1t 's@dWM_Error' 'def:npc|1|%sender%' } - if { - if '%sender%' == 'server' { - announce to_console '<&4><&lb><&6>dWM<&4><&rb> <&c>You did not specify an entity to teleport!' - queue clear } - if { - define w } else { - define w '' - define v '' - if '%v%' != '0' { - run instantly delay:1t 's@dWM_Error' 'def:world|%v%|%sender%|%w%' - queue clear } } - define t 'teleport' - define lastLoc '|%w%|%t%]>' - if '%lastLoc%' == '1' { - run instantly delay:1t 's@dWM_Error' 'def:ll|1|%sender%|%w%' - if { - adjust load } - teleport '' - queue clear } else { - if { - adjust load } - teleport '' } } # - if { # - if { # - define targets 'li@%sender%' # - if { # - if { # - run instantly delay:1t 's@dWM_Error' 'def:loc|1|%sender%' # - queue clear # } # else { # - define w '' # - define lastLoc '' # - if lastLoc == '0' { # - run instantly delay:1t 's@dWM_Error' 'def:ll|1|%sender%|%w%' # - queue clear # } # - # } # } # else { # - define l '' # } # - if { # - define w '' # } # else { # - define w '' # } # # Maybe this should be moved to the end? To validate the world /after/ everything else has been parsed. # - define v '' # - if '%v%' != '0' { # - run instantly delay:1t 's@dWM_Error' 'def:world|%v%|%sender%|%w%' # - queue clear # } # - teleport %targets% '' # - queue clear # } # else if == 1 { # - if { # - if { # - teleport %sender% '' # } # else { # - teleport ].as_location> # } # } # else { # - define w '' # - if { # - define object '' # - define lastLoc '' # - if lastLoc == '0' { # - run instantly delay:1t 's@dWM_Error' 'def:ll|1|%sender%|%w%' # - queue clear # } # - teleport %sender% '' # } # else { # - teleport ].as_location> # } # - define l '' # } # - define targets '' # } # else { # - define targets ']>' # } # - if { # - define w '' # } # else { # - define w '' # - define v '' # - if '%v%' != '0' { # - run instantly delay:1t 's@dWM_Error' 'def:world|%v%|%sender%|%w%' # - queue clear # } # } # - if { # - define l '' # - run instantly delay:1t 's@dWM_Error' 'def:loc|1|%sender%|%w%' # - queue clear # } # else { # - define l '' # } # } # # The 'a' switch will teleport all entity types to the target. # - if %switches% contains a { # - # } # else if %switches% contains h { # - # } # else if %switches% contains b { # - # } # else if %switches% contains p { # - # } # else if %switches% contains e { # - # } # else if %switches% contains n { # - # } # else if %switches% contains s { # - if { # - if { # - define error '' # } # else { # - define destination '' # } # } # else { # - define destination '' # } # } # ################################################################################ # # dWorldManager Other Utilities # # Other Utility functions used throughout dWorldManager # #-------------------------------------- # # Command Permission Check Procedure script # - Used to check if a player has permission to use a command. # dWM_HasPerm_Command: # Usage: type: procedure debug: false definitions: command|player script: - if %player% == 'server' || || { - determine true } - define perms "" - if { - determine true } - foreach '%perms%': - define perm '' - if { - determine true } - determine false # # END dWM_HasPerm_Command ##-------------------------------------- ## ## dWorldManager World Creation ## ## Required definitions ## w - The name of the world ## g - The world generator ## e - The environment ## t - the world type ## #dWM_CreateWorld: # type: task # debug: false # script: # - define v '' # - if '%v%' != '3' { # - run instantly delay:1t 's@dWM_Error' 'def:world|%v%|%sender%|%w%' # - define fail '' # } # - if { # - if ! { # - run instantly delay:1t 's@dWM_Error' 'def:gen|1|%sender%|%g%' # - define fail '' # } # else if '' !contains '%g%' { # - run instantly delay:1t 's@dWM_Error' 'def:gen|2|%sender%|%g%' # - define fail '' # } # } # - if ! { # - run instantly delay:1t 's@dWM_Error' 'def:type|1|%sender%|%g%' # - define fail '' # } # - if ! { # - run instantly delay:1t 's@dWM_Error' 'def:env|1|%sender%|%g%' # - define fail '' # } # - if { # - random { # - define msg "You<&sq>re not very good at this." # - define msg "Try that again, but now do it right." # - define msg "Reading the help is helpful" # } # - run s@msgPrefixed 'def:dWM|<&d><&o>%msg%' # } # else { # - if { # - createworld '%w%' 'generator:%g%' 'worldtype:%t%' 'environment:%e%' # } # else { # - createworld '%w%' 'worldtype:%t%' 'environment:%e%' # } # - yaml set 'worlds.%w%.loaded:true' 'id:dWM_Config' # - yaml set 'worlds.%w%.generator:' 'id:dWM_Config' # - yaml set 'worlds.%w%.environment:%e%' 'id:dWM_Config' # - yaml set 'worlds.%w%.spawn:' 'id:dWM_Config' # - yaml 'savefile:dWorldManager/config.yml' 'id:dWM_Config' # } ## ## END dWM_CreateWorld #-------------------------------------- # # dWorldManager World Importer # # Required definitions # w - The name of the world # g - The world generator # e - The environment # t - the world type # dWM_ImportWorld: type: task debug: false script: - define v '' - define vval 'li@4' - inject s@dWM_CreateWorldConfigs # # END dWM_ImportWorld #-------------------------------------- # # dWorldManager Unload World # # Required definitions # w - The name of the world # sender - Either 'server' or '' # dWM_UnloadWorld: type: task debug: false script: - define v '' - if '%v%' != '0' { - run instantly delay:1t 's@dWM_Error' 'def:world|%v%|%sender%|%w%' - queue clear } - event dwm_UnloadWorld 'context:world|%w%' save:return - define rval '' - if { - teleport - adjust '' 'unload' - yaml set 'worlds.%w%.loaded:false' 'id:dWM_Config' - yaml 'savefile:dWorldManager/config.yml' 'id:dWM_Config' } else { - run instantly delay:1t 's@dWM_Error' 'def:unload|1|%sender%|' } # # END dWM_UnloadWorld #-------------------------------------- # # dWorldManager Load World # # Required definitions # w - The name of the world # sender - Either 'server' or '' # dWM_LoadWorld: type: task debug: false script: - define v '' - if '%v%' != '5' { - run instantly delay:1t 's@dWM_Error' 'def:world|%v%|%sender%|%w%' - queue clear } - define t '' - define e '' - define g '' - if '%g%' == 'none' { - createworld '%w%' 'worldtype:%t%' 'environment:%e%' } else { - createworld '%w%' 'worldtype:%t%' 'environment:%e%' 'generator:%g%' } - yaml set 'worlds.%w%.loaded:true' 'id:dWM_Config' - yaml 'savefile:dWorldManager/config.yml' 'id:dWM_Config' - run s@msgPrefixed 'def:dWM|<&d><&o>%w% <&d>has been loaded.' # # END dWM_LoadWorld #-------------------------------------- # # dWorldManager Remove World # # Required definitions # w - The name of the world # sender - Either 'server' or '' # dWM_RemoveWorld: type: task debug: false script: - define v '' - if 'li@0|4|5' !contains '%v%' { - run instantly delay:1t 's@dWM_Error' 'def:world|%v%|%sender%|%w%' - queue clear } - if '%v%' != '0' { - createworld '%w%' } - adjust '' 'destroy' - if { - yaml set 'worlds.%w%:!' 'id:dWM_Config' } else { - yaml set 'worlds.%w%.loaded:false' 'id:dWM_Config' } - yaml 'savefile:dWorldManager/config.yml' 'id:dWM_Config' - define v '' - if '%v%' != '3' { - run instantly delay:1t 's@dWM_Error' 'def:rem|1|%sender%|%w%' - queue clear } # # END dWM_RemoveWorld #-------------------------------------- # # dWorldManager Purge World # # Required definitions # w - The name of the world # sender - Either 'server' or '' # dWM_PurgeWorld: type: task debug: false script: - define v '' - if 'li@1|2|4' contains '%v%' { - run instantly delay:1t 's@dWM_Error' 'def:world|%v%|%sender%|%w%' - queue clear } - if '%v%' == '0' { - run instantly delay:1t 's@dWM_Error' 'def:purge|1|%sender%|%w%' - queue clear } else if '%v%' == '3' { - if ! { - run instantly delay:1t 's@dWM_Error' 'def:purge|2|%sender%|%w%' - queue clear } } - yaml set 'worlds.%w%:!' 'id:dWM_Config' - yaml 'savefile:dWorldManager/config.yml' 'id:dWM_Config' # # END dWM_RemoveWorld #-------------------------------------- # # dWorldManager World Config Writer # # This writes the config file entries # # Required definitions # w - The name of the world # g - The world generator # e - The environment # t - The world type # sender - Either 'server' or '' # vval - The return value(s) of dWM_VW to pass on # dWM_CreateWorldConfigs: type: task debug: false script: - define v '' - if '%vval%' !contains '%v%' { - run instantly delay:1t 's@dWM_Error' 'def:world|%v%|%sender%|%w%' - queue clear } - if && '' != 'none' { - if ! { - run instantly delay:1t 's@dWM_Error' 'def:gen|1|%sender%|%g%' - queue clear } else if '' !contains '%g%' { - run instantly delay:1t 's@dWM_Error' 'def:gen|2|%sender%|%g%' - queue clear } } - if ! { - run instantly delay:1t 's@dWM_Error' 'def:type|1|%sender%|%g%' - queue clear } - if ! { - run instantly delay:1t 's@dWM_Error' 'def:env|1|%sender%|%g%' - queue clear } - yaml set 'worlds.%w%.loaded:true' 'id:dWM_Config' - yaml set 'worlds.%w%.generator:' 'id:dWM_Config' - yaml set 'worlds.%w%.environment:%e%' 'id:dWM_Config' - yaml set 'worlds.%w%.description:|:A nondescriptive description' 'id:dWM_Config' - yaml 'savefile:dWorldManager/config.yml' 'id:dWM_Config' - if { - if && '' != 'none' { - createworld '%w%' 'worldtype:%t%' 'environment:%e%' 'generator:%g%' 'copy_from:%c%' } else { - createworld '%w%' 'worldtype:%t%' 'environment:%e%' 'copy_from:%c%' } } else { - if && '' != 'none' { - createworld '%w%' 'worldtype:%t%' 'environment:%e%' 'generator:%g%' } else { - createworld '%w%' 'worldtype:%t%' 'environment:%e%' } } - yaml set 'worlds.%w%.spawn:' 'id:dWM_Config' - yaml 'savefile:dWorldManager/config.yml' 'id:dWM_Config' # # END dWM_CreateWorldConfigs #-------------------------------------- # # Validate World Names # dWM_VW: # Usage: type: procedure debug: false definitions: w script: - if '%w%' == 'null' { - determine 1 } - if '' { - determine 2 } - if !/%w%/level.dat]> { - determine 3 } - if ! { - determine 4 } - if ! || ( !contains '%w%' ) { - determine 5 } - determine 0 # # END dWM_Validate_World #-------------------------------------- # # Get a players last location in a world # dWM_LL: # Usage: type: procedure debug: false definitions: p|w|t script: - define u '' - if ! { - yaml create 'id:dWM_pd_%u%' - yaml 'savefile:dWorldManager/playerdata/%u%.yml' 'id:dWM_pd_%u%' } - if { - yaml unload 'id:dWM_pd_%u%' } - yaml 'load:dWorldManager/playerdata/%u%.yml' 'id:dWM_pd_%u%' - define l '' - yaml unload 'id:dWM_pd_%u%' - if '%l%' == 'null' { - determine 1 } - determine '%l%' # # END dWM_LL #-------------------------------------- # # Set a players last location in a world # dWM_SetLL: # Usage: run instantly delay:1t s@dWM_SetLL 'def:%type%||%world%|%location%' type: task debug: false definitions: t|p|w|l script: - define u '' - if ! { - yaml create 'id:dWM_pd_%u%' - yaml 'savefile:dWorldManager/playerdata/%u%.yml' 'id:dWM_pd_%u%' } - if { - yaml unload 'id:dWM_pd_%u%' } - yaml 'load:dWorldManager/playerdata/%u%.yml' 'id:dWM_pd_%u%' - yaml set '%w%.lastLoc.%t%:%l%' 'id:dWM_pd_%u%' - yaml 'savefile:dWorldManager/playerdata/%u%.yml' 'id:dWM_pd_%u%' - yaml unload 'id:dWM_pd_%u%' # # END dWM_SetLL #-------------------------------------- # # dWorldManager Arg Parser # # dWM_ParseArgs: type: task debug: false script: - define switches 'li@' - define players 'li@' - define offline 'li@' - define entities 'li@' - define npcs 'li@' - define locations 'li@' - define worlds 'li@' - foreach '': - define a '%value%' - if { - define args '' - foreach '' { - if '%switches%' !contains '%value%' { - define switches '' } } } else if ]> { - define args '' - define ']>' ']>' } else if { - define args '' - if '%players%' !contains '%a%' { - define players ']>' } } else if { - define args '' - if '%offline%' !contains '%a%' { - define offline ']>' } } else if %a% matches entity { - define args '' - if '%entities%' !contains '%a%' { - define entities '' } } else if { - define args '' - if '%npcs%' !contains '%a%' { - define npcs ']>' } } else if >= 3 { - define args '' - if '%locations%' !contains '%a%' { - define locations '' } } else { - define args '' - if '%worlds%' !contains '%a%' { - define worlds '' } } # # END dWM_ParseArgs #-------------------------------------- # # dWorldManager Error Messages # dWM_Error: type: task debug: false msgs: world: 0: - '<&a><&o><&a> is currently loaded.' 1: - '<&c>You didn<&sq>t enter a world name.' - '<&a>Maybe you want to see the list|dwm list|<&c>Click to list world names]> <&a>of worlds?' 2: - '<&c>World name may only contain letters, numbers, hyphen, and underscore!' 3: - '<&c><&o> <&c>does not exist!' - '<&a>Maybe you want to create|dwm create |<&c>Click to create ]> <&a>it?' 4: - '<&c><&o> <&c>is not registered!' - '<&a>Maybe you want to import|dwm import |<&c>Click to import ]> <&a>it?' 5: - '<&c><&o> <&c>is not loaded!' - '<&a>Maybe you want to load|dwm load |<&c>Click to load ]> <&a>it?' loc: 1: - '<&c>You didn<&sq>t enter a location.' ll: 1: - '<&c>No previous location in .' entity: 1: - '<&c>Entity teleportation isn<&sq>t supported at this time.' npc: 1: - '<&c>NPC teleportation isn<&sq>t supported at this time.' gen: 1: - '<&c><&o> <&c>is an unknown generator.' 2: - '<&c><&o> <&c>is not installed.' type: 1: - '<&c><&o> <&c>is an unknown world type.' env: 1: - '<&c><&o> <&c>is an unknown environment.' rem: 1: - '<&c>Unable to remove<&o> !' - '<&c>Check the console for more information.' purge: 1: - '<&c><&o> <&c>is currently loaded!' - '<&a>You must unload|dwm unload |<&c>Click to unload ]> <&a>it first.' 2: - '<&c><&o> <&c>is not in the config file!' unload: 1: - '<&c>World unload cancelled by <&o>!' script: - if '%3%' == 'server' { - announce to_console '<&4><&lb><&6>dWM<&4><&rb> >' } else { - define prefix '<&lb><&6>dWM<&4><&rb>|dwm help|<&6> dWM<&nl><&d>Click for help]> ' - foreach '' { - narrate '%prefix%>' } } # # # END dWM_Error #-------------------------------------- # # dWorldManager Enums # dWM_Enums: type: yaml data debug: false t: - NORMAL - FLAT - LARGE_BIOMES - AMPLIFIED e: - NORMAL - NETHER - THE_END g: - NORMAL # # END dWM_Enums #-------------------------------------- # # dWorldManager Author Banner Items # # Banner items representing the authors # dwm_Author_Anthony: type: item debug: false material: i@human_skull display name: "<&f> &pipeAnthony&pipe" text_name: '|Anthony|' url: 'http://mineconomy.org' lore: - <&7> Owner<&co> <&e>M<&6>ine<&e>C<&6>onomy <&e>N<&6>etwork - <&5>------------------------- - <&7> - <&7> I<&sq>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 # ################################################################################ # # # 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___________________________# #______________________________________________________________________________# dWM_Configurations: type: yaml data config: version: 0.3 worldpath: '../..' remove_deleted: 'false' stats: About: This allows sending basic dWorldManager usage info to the Script Tracker system created by BlackCoyote. Doing this helps me focus my development efforts. Please enable webget in the Denizen config.yml file and here to participate. useStats: true worlds: world: loaded: 'true' description: - 'A non-descriptive description' generator: '' environment: '' worldtype: '' spawn: '' # # END dWorldManager Events #-------------------------------------- # # ################################################################################