Paste #76412: Untitled Paste

Date: 2020/10/13 20:46:25 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


admin_quick_teleports:
  type: command
  name: quick_teleports
  usage: /quick_teleports
  description: teleports you across the maps
  tab complete:
    - define args <list[add|remove|teleport]>
    - determine <[args]>

  script:
    - if <context.args.is_empty>:
      - give <player> written_book
      - stop
    - if <context.args.size> != 2:
      - inject command_syntax

    - define arg2 <context.args.get[2]>
    - if <server.has_flag[behr.essentials.teleport.locations]>:
      - define locations <server.flag[behr.essentials.teleport.locations].as_map>
    - else:
      - define locations <list>

    - choose <context.args.first>:
      - case add:
        - if <[locations].contains[<[arg2]>]>:
          - define reason "Nothing interesting happens."
          - inject command_error
        - flag server behr.essentials.teleport.locations:<[locations].with[<[arg2].as[<player.location>]>]>
        - narrate "Added <[arg2].to_titlecase>"

      - case remove:
        - if !<[locations].contains[<[arg2]>]>:
          - define reason "Nothing interesting happens."
          - inject command_error
        - flag server behr.essentials.teleport.locations:<[locations].exclude[<[arg2]>]>
        - narrate "Removed <[arg2].to_titlecase>"

      - case teleport:
        - if !<[locations].contains[<[arg2]>]>:
          - define reason "Nothing interesting happens."
          - inject command_error
        - teleport <[locations].get[<[arg2]>]>
        - narrate "teleported to <[arg2].to_titlecase>"

      - default:
        - inject command_syntax