Paste #11170: Diff note for paste #11169

Date: 2014/11/11 00:49:08 UTC-08:00
Type: Diff Report

View Raw Paste Download This Paste
Copy Link


 dRegions_Events:
   type: world
   debug: false
   events:
     on player clicks block with i@dRegions_Tool:
       - determine passively CANCELLED
       - if !<player.has_permission[dRegions.tool]> {
         - take i@dRegions_Tool
         - run s@dRegions_Msg 'def:<&4><&l>ERROR<&co><&r> <&a>You should not have this!' instantly
         - queue stop
         }
       - define pos '<tern[<c.click_type.is[==].to[LEFT]||false>]:POS1||POS2>'
       - run s@dRegions_Msg 'def:<&a>Set %pos% to <context.location.simple>'
       - flag player dRegionTool%pos%:<context.location>
 
 dRegions_Msg:
   type: item
   material: i@human_skull
   display name: "<&4>[<&6>dRegions<&4>]"
   lore:
   - <&5>Click for Info
   script:
     - ^define text '<&4>[<&6>dRegions<&4>] <&co>'
     - ^define hover '{<i@dRegionsMsg.json>}'
     - ^define click '/dregions'
     - ^define button "text:'%text%',clickEvent:{action:run_command,value:'%click%'},hoverEvent:{action:show_item,value:'%hover%'}"
     - ^define spacer "text:'  '"
     - ^define msg "text:'%1%'"
     - ^execute as_server "tellraw <player.name> {text:'',extra:[{%button%},{%spacer%},{%msg%}]}"
 
 dRegions_Tool:
   type: item
   debug: false
   material: m@wood_axe
   display name: dRegion Selector
   lore:
   - <&7><&o>Left<&7> click to set pos1
   - <&7><&o>Right<&7> click to set pos2
 
 dWE_Commands:
   type: command
   debug: false
   name: dwe
   description: Denizen World Editor
   usage: /dwe
   aliases: ''
   allowed help:
   - determine true
   script:
     - define arg1 '<c.args.get[1].escaped||help>'
     - define args 'li@help|tool|expand|contract|inset|outset|set|undo'
     - if !<def[args].contains[%arg1%]> inject locally help
       else inject locally %arg1%
 
 #
 #  END dWE Command Script Basics
 #--------------------------------------
 #
 #  dWE Command Arguments
 #
 # Each of these subscripts is an argument for the root command.
 #
   help:
     - if <player.has_permission[dRegions.admin]> inject locally msgsHelpAdmin instantly
       else inject locally msgsHelpUser instantly
     - define footerText '<&f><&sp><&sp>Authors<&co> <&7>|Anthony| <&7>calico-kid'
     - inject locally msgsFooter instantly
     - queue stop
 
   tool:
     - if <player.has_permission[dRegions.tool]> {
       - give i@dRestaurantTool
       - run s@dRegions_Msg 'def:<&a>Right click to select pos1'
       - run s@dRegions_Msg 'def:<&a>Left click to select pos2'
       - queue stop
       }
 
   set:
   # Need config options for maxblocks to change
   # Need config option for undo history size
     - define material '<c.args.get[2]||null>'
     - define POS1 '<player.flag[dRegionToolPOS1].as_location||null>'
     - define POS2 '<player.flag[dRegionToolPOS2].as_location||null>'
     - if %material% == null || %material% !matches material run s@dRegions_Msg 'def:<&c>Must specify a valid material.'
       else if <def[POS1].is[==].to[null]> run s@dRegions_Msg 'def:<&c>Must select corner 1 with left-click.'
       else if <def[POS1].is[==].to[null]> run s@dRegions_Msg 'def:<red>Must select corner 2 with right-click.'
       else {
       - define blocks <cu@%POS1%|%POS2%.get_blocks>
       - define undoMaterials <def[blocks].parse[material.full]>
       - modifyblock %blocks% %material%
       - flag player 'dWE_UndoHistory:->:set_blocks;<cu@%1%|%2%>;%undoMaterials%'
       }
 
 
   undo:
     - define last_action '<player.flag[dWE_UndoHistory].as_list.last||null>'
     - if <def[last_action].is[==].to[null]> run s@dRegions_Msg 'def:<&6>Nothing to undo!'
       else {
       - inject locally 'p:undo_<def[last_action].split[;].get[1]>'
-      - flag global 'UndoableActions:<-:%last_action%'
+      - flag player 'dWE_UndoHistory:<-:%last_action%'
       }
 
   undo_set_blocks:
     - define cuboid '<def[last_action].split[;].get[2].as_cuboid.get_blocks||null>'
     - define materials '<def[last_action].split[;].get[3]||li@>'
     - modifyblock %cuboid% %materials%
     - run s@dRegions_Msg 'def:<&a>Undo complete!'
 
 
 
 #
 #  END dWE Command Arguments
 #--------------------------------------
 #
 #  dWE 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>dWorldEditor   <&7>%msgsHeaderTitle%"
 #    - narrate "<&5>|<&sp><&sp><&sp><&e>MineConomy    <&f>Exclusive"
     - narrate "<&5>|<&f>"
 
   msgsFooter:
     - define anthony "text:'<&7>|Anthony|',clickEvent:{action:open_url,value:'http://mineconomy.org'},hoverEvent:{action:show_item,value:'{<i@AnthonyBanner.json>}'}"
     - define morphan "text:'<&7>Morphan1',clickEvent:{action:open_url,value:'http://google.com'},hoverEvent:{action:show_item,value:'{<i@Morphan1Banner.json>}'}"
     - define spacer "text:'  '"
     - define prefix "text:'<&5>|  <&f>Authors:  '"
     - execute as_server "tellraw <player.name> {text:'',extra:[{%prefix%},{%anthony%},{%spacer%},{%morphan%}]}"
     - 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 dWE Command Messages
 #--------------------------------------
-