Paste #3145: Untitled Paste

Date: 2014/04/04 21:29:58 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


lumihomecommands:
  type: world
  debug: true
  events:
    on lumihome command:
    - inject locally path:lumihomecommandhandler
    on lh command:
    - inject locally path:lumihomecommandhandler
  lumihomecommandhandler:
    - determine fulfilled passively
    - if <context.args.get[1]> == add inject locally path:lumihomeadd
    - if <context.args.get[1]> == delete inject locally path:lumihomedelete
    - if <context.args.get[1]> == remove inject locally path:lumihomedelete
    - if <context.args.get[1]> == list inject locally path:lumihomelist
    - if <context.args.get[1]> == help inject locally path:lumihomehelp
    - if <context.args.get[1]> == teleport inject locally path:lumihomeinitiateteleport
    - if <yaml[lumihomesaves].list_keys[lumihomes.<player.name>]> contains <context.args.get[1]> inject locally path:lumihomeinitiateteleport
  lumihomeadd:
    - if <player.has_permission[lumihome.unlimited]> {
      - if <context.args.get[2]||empty> == empty {
        - narrate "<&c>Please specify a name for your home!"
        - queue clear
        }
      - inject locally path:lumihomeaddinitiate
      } else if <player.has_permission[lumihome.add]> {
      - if <yaml[lumihomesaves].list_keys[lumihomes.<player.name>].size> < 5 {
        - if <context.args.get[2]||empty> == empty {
          - narrate "<&c>Please specify a name for your home!"
          - queue clear
          }
        - inject locally path:lumihomeaddinitiate
        } else {
        - narrate "<&c>You can't have more than 5 homes as a guest!"
        } 
      } else {
      - narrate "<&c>You do not have the permission to do this!"
      }
  lumihomeaddinitiate:
    - if <yaml[lumihomesaves].list_keys[lumihomes.<player.name>]> !contains <context.args.get[2]> {
      - narrate "<&6>You added a home."
      - yaml id:lumihomesaves set lumihomes.<player.name>.<context.args.get[2]>.location:<player.location>
      } else {
      - narrate "<&c>You already have a home with this name!"
      }
  lumihomedelete:
    - if <player.has_permission[lumihome.delete]> {
      - if <context.args.get[2]||empty> == empty {
        - narrate "<&c>Please specify a name for your home!"
        - queue clear
        }
      - if <yaml[lumihomesaves].list_keys[lumihomes.<player.name>]> contains <context.args.get[2]> {
        - narrate "<&6>You deleted a home."
        - yaml id:lumihomesaves set lumihomes.TheBlackCoyote.<context.args.get[2]>:!
        } else {
        - narrate "<&c>You don't have a home with this name yet!"
        }
      } else {
      - narrate "<&c>You do not have the permission to do this!"
      }
  lumihomelist:
    - if <player.has_permission[lumihome.list]> {
      - narrate "<&6>Your homes: <yaml[lumihomesaves].list_keys[lumihomes.<player.name>].formatted||none>."
      }
  lumihomehelp:
    - narrate "notyetpls"
  lumihomeinitiateteleport:
    - if <player.has_permission[lumihome.teleport]> {
      - if <context.args.get[1]> == teleport {
        - define destination <context.args.get[2]>
        } else {
        - define destination <context.args.get[1]>
        }
      - inject locally path:lumihometeleport
      } else {
      - narrate "<&c>You do not have the permission to do this."
      }
  lumihometeleport:
    - if <def[destination]||empty> == empty {
      - narrate "<&c>Please specify a valid home to teleport to!"
      - queue clear
      }
    - narrate "<&6>You teleported to your %destination% home."
    - teleport <yaml[lumihomesaves].read[lumihomes.<player.name>.%destination%.location]>