Paste #12688: Untitled Paste

Date: 2015/01/09 11:36:27 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


lumigatecommands:
  type: world
  debug: false
  events:
    on lumigate command:
    - inject locally path:lumigatecommandhandler
    on lg command:
    - inject locally path:lumigatecommandhandler
    on gate command:
    - inject locally path:lumigatecommandhandler
  lumigatecommandhandler:
    - if <context.args.get[1]> == create inject locally path:lumigatecreate
    - if li@delete|remove contains <context.args.get[1]> inject locally path:lumigatedelete
    - if <context.args.get[1]> == redefine inject locally path:lumigateredefine
    - if <context.args.get[1]> == redirect inject locally path:lumigateredirect
    - if <context.args.get[1]> == list inject locally path:lumigatelist
    - if <context.args.get[1]> == locate inject locally path:lumigatelocate
    - if <context.args.get[1]> == help inject locally path:lumigatehelp
    - determine fulfilled
  lumigatehelp:
    - narrate "<&e>/lg create [gatename] <&6>Creates a gate on your world edit selection with your location as destination. (selection must be made by right clicking with wand.)"
    - narrate "<&e>/lg delete [gatename] <&6>Deletes the specified gate entirely."
    - narrate "<&e>/lg redefine [gatename] <&6>Redefines the specified gate area to your current world edit selection."
    - narrate "<&e>/lg redirect [gatename] <&6>Sets the destination of the specified gate to your current location."
    - narrate "<&e>/lg list <&6>Lists the existing gates."
    - narrate "<&e>/lg locate [gatename] <&6>Tells you the locations of the specified gates and temporary highlights them with redstone blocks."
  lumigatecreate:
    - if <player.has_permission[lumigate.create]> {
      - if !<player.has_flag[worldeditcuboid1]> || !<player.has_flag[worldeditcuboid2]> {
        - narrate "<&c>Please make a World Edit selection first."
        } else {
        - if <context.args.size> > 1  {
          - if <yaml[lumigatesaves].list_keys[lumigates]> !contains <context.args.get[2]> {
            - yaml id:lumigatesaves set lumigates.<context.args.get[2]>:->:<player.flag[worldeditcuboid1]>|<player.flag[worldeditcuboid2]>
            - yaml id:lumigatesaves set lumigates.<context.args.get[2]>:->:<player.location>
            - note cu@<yaml[lumigatesaves].read[lumigates.<context.args.get[2]>].as_list.get[1].replace[li@]> as:<context.args.get[2]>
            - narrate "<&6>You created the <&e><context.args.get[2]> <&6>lumigate."
            } else {
            - narrate "<&c>This gate already exists!"
            }
          } else {
          - narrate "<&c>Please specify a gate name."
          }
        }
      } else {
      - narrate "<&c>You do not have the permission to do this."
      }
  lumigatedelete:
    - if <player.has_permission[lumigate.delete]> {
      - if <context.args.size> > 1  {
        - if <yaml[lumigatesaves].list_keys[lumigates]> contains <context.args.get[2]> {
          - yaml id:lumigatesaves set lumigates.<context.args.get[2]>:!
          - narrate "<&6>You deleted the <&e><context.args.get[2]><&6> lumigate."
          } else {
          - narrate "<&c>This gate doesn't exists!"
          }
        } else {
        - narrate "<&c>Please specify a gate name."
        }
      } else {
      - narrate "<&c>You do not have the permission to do this."
      }
  lumigateredefine:
    - if <player.has_permission[lumigate.redefine]> {
      - if !<player.has_flag[worldeditcuboid1]> || !<player.has_flag[worldeditcuboid2]> {
        - narrate "<&c>Please make a World Edit selection first."
        } else {
        - if <context.args.size> > 1  {
          - if <yaml[lumigatesaves].list_keys[lumigates]> contains <context.args.get[2]> {
            - yaml id:lumigatesaves set lumigates.<context.args.get[2]>[1]:<player.flag[worldeditcuboid1]>|<player.flag[worldeditcuboid2]>
            - note cu@<yaml[lumigatesaves].read[lumigates.<context.args.get[2]>].as_list.get[1].replace[li@]> as:<context.args.get[2]>
            - narrate "<&6>You redefined the <&e><context.args.get[2]> <&6>lumigate."
            } else {
            - narrate "<&c>This gate doesn't exists!"
            }
          } else {
          - narrate "<&c>Please specify a gate name."
          }
        }
      } else {
      - narrate "<&c>You do not have the permission to do this."
      }
  lumigateredirect:
    - if <player.has_permission[lumigate.redirect]> {
      - if <context.args.size> > 1  {
        - if <yaml[lumigatesaves].list_keys[lumigates]> contains <context.args.get[2]> {
          - yaml id:lumigatesaves set lumigates.<context.args.get[2]>[2]:<player.location>
          - narrate "<&6>You redirected the <&e><context.args.get[2]> <&6>lumigate."
          } else {
          - narrate "<&c>This gate doesn't exists!"
          }
        } else {
        - narrate "<&c>Please specify a gate name."
        }
      } else {
      - narrate "<&c>You do not have the permission to do this."
      }
  lumigatelist:
    - if <player.has_permission[lumigate.list]> {
      - narrate "<&6>Existing lumigates<&co> <&e><yaml[lumigatesaves].list_keys[lumigates].formatted><&6>."
      } else {
      - narrate "<&c>You do not have the permission to do this."
      }
  lumigatelocate:
    - if <player.has_permission[lumigate.locate]> {
      - if <context.args.size> > 1  {
        - if <yaml[lumigatesaves].list_keys[lumigates]> contains <context.args.get[2]> {
          - narrate "<&e><context.args.get[2]> <&6>is located from <&e><<yaml[lumigatesaves].read[lumigates.<context.args.get[2]>].as_list.get[1].before[|]>.simple.formatted><&6> to <&e><<yaml[lumigatesaves].read[lumigates.<context.args.get[2]>].as_list.get[1].after[|]>.simple.formatted><&6> and leads to <&e><<yaml[lumigatesaves].read[lumigates.<context.args.get[2]>].as_list.get[2]>.simple.formatted><&6>."
          - showfake m@redstone_block <cu@<context.args.get[2]>.get_outline> duration:30s
          - showfake m@redstone_block <yaml[lumigatesaves].read[lumigates.<context.args.get[2]>].as_list.get[2]> duration:30s
          } else {
          - narrate "<&c>This gate doesn't exists!"
          }
        } else {
        - narrate "<&c>Please specify a gate name."
        }
      } else {
      - narrate "<&c>You do not have the permission to do this."
      }
gatestonotables:
  type: task
  debug: true
  script:
  - foreach <yaml[lumigatesaves].list_keys[lumigates]> {
    - note cu@<yaml[lumigatesaves].read[lumigates.%value%].as_list.get[1].replace[li@]> as:%value%
    }
lumigateotherevents:
  type: world
  debug: true
  events:
    on server start:
    - run gatestonotables delay:1s instantly
    on player right clicks with i@wood_axe:
    - if li@m@air|m@water !contains <player.location.cursor_on[5].material> {
      - flag worldeditcuboid2:<player.location.cursor_on[5]>
      }
    on player left clicks with i@wood_axe:
    - if li@m@air|m@water !contains <player.location.cursor_on[5].material> {
      - flag worldeditcuboid1:<player.location.cursor_on[5]>
      }
    on /pos1 command:
    - flag worldeditcuboid1:<player.location>
    on /pos2 command:
    - flag worldeditcuboid2:<player.location>
    on /sel command:
    - flag worldeditcuboid2:!
    - flag worldeditcuboid1:!
    on player enters notable cuboid:
    #- if <player.location.cuboids.size> < 1 queue clear
    - foreach <context.cuboids> {
      - if <yaml[lumigatesaves].list_keys[lumigates]> contains <el@val[%value%].replace[cu@]> {
        - define location %value%
        - teleport <yaml[lumigatesaves].read[lumigates.<el@val[%location%].replace[cu@]>].as_list.get[2]>
        - if <player.is_inside_vehicle> teleport <player.get_vehicle>|<player> <yaml[lumigatesaves].read[lumigates.<el@val[%location%].replace[cu@]>].as_list.get[2]>
        - foreach <%value%.list_entities> {
          - teleport %value% <yaml[lumigatesaves].read[lumigates.<el@val[%location%].replace[cu@]>].as_list.get[2]>
          }
        - narrate "<&6>You travelled through a Lumigate!"
        - playeffect <player.location.sub[0,0.5,0]> effect:ENDER_SIGNAL qty:5
        - playsound <player.location> sound:enderman_teleport
        }
      }