Paste #340: Untitled Paste

Date: 2013/11/24 19:39:11 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


"RPcmds":
  type: world
  events:
    on linkup command:
    - if <context.arg.get[1]> == add {
      - if <player.has_permission[linkup.edit]> == false {
        - narrate "<&c>You do not have the permission to do this."
        - determine fulfilled
        - queue clear
        }
      - if <context.arg.get[2]> == null {
        - narrate "<&c>You must specify a channel name!"
        - narrate "<&9> /linkup add <&lt>channel<&gt>"
        - determine fulfilled
        - queue clear
        }
      - if <player.location.cursor_on.material> == wood_button || <player.location.cursor_on.material> == stone_button || <player.location.cursor_on.material> == wood_pressureplate || <player.location.cursor_on.material> == stone_pressureplate || <player.location.cursor_on.material> == lever {
        - flag global linkup<context.arg.get[2]>:+:<player.location.cursor_on>
        - flag global:linkupchannels:+:<context.arg.get[2]>
        - narrate "<&9>Your device has been stored to channel '<context.arg.get[2]>'"
        - determine fulfilled
        - queue clear
        } else {
        - narrate "<&c>You must be targeting a switch."
        - determine fulfilled
        - queue clear
        }
      }
    - if <context.arg.get[1]> == remove {
      - if <player.has_permission[linkup.edit]> == false {
        - narrate "<&c>You do not have the permission to do this."
        - determine fulfilled
        - queue clear
        }
      - if <context.arg.get[2]> == null {
        - narrate "<&c>You must specify a channel name or '-all' for all channels"
        - narrate "<&9> /linkup add <&lt>channel/-all<&gt>"
        - determine fulfilled
        - queue clear
        }
      - if <player.location.cursor_on.material> == wood_button || <player.location.cursor_on.material> == stone_button || <player.location.cursor_on.material> == wood_pressureplate || <player.location.cursor_on.material> == stone_pressureplate || <player.location.cursor_on.material> == lever {
        - if contect.arg.get[2] == -all {
          - foreach <server.flag[linkupchannels]> {
            - flag global linkup%value%:-:<player.location.cursor_on>
            }
          - determine fulfileld
          - queue clear
          } else {
          - flag global linkup<context.arg.get[2]>:-:<player.location.cursor_on>
          - narrate "<&9>Your device has been removed from channel '<context.arg.get[2]>'"
          - determine fulfilled
          - queue clear
          }
        } else {
        - narrate "<&c>You must be targeting a switch."
        - determine fulfilled
        - queue clear
        }
      }
    - if <context.arg.get[1]> == check {
      - if <player.has_permission[linkup.check]> == false {
        - narrate "<&c>You do not have the permission to do this."
        - determine fulfilled
        - queue clear
        }
      - foreach <server.flag[linkupchannels]> {
        - if <server.flag[linkup%value%]> contains <player.location.cursor_on> narrate "<&9>This button is linked to channel '%value%'"
        }
      - determine fulfilled
      - queue clear
    } else {
    - narrate ""
    - narrate "<&c>usage<&co> /linkup add <&gt>channel<&lt>"
    - narrate "<&9>description<&co> Adds the switch you're looking at to the specified channel."
    - narrate "<&c>usage<&co> /linkup remove <&gt>channel/-all<&lt>"
    - narrate "<&9>description<&co> removes the switch you're looking at from the specified channel or all channels."
    - narrate "<&c>usage<&co> /linkup check"
    - narrate "<&9>description<&co> Returns which channels the switch you're looking at is linked to."
    - determine fulfilled
    - queue clear
    }