Paste #70835: DVChest

Date: 2020/06/15 08:49:56 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


DVChestTab:
  type: data
  dvchest:
    _*permLocked:
      _*player: end
    about: end
    help: end
DVChestTab_permLocked:
  type: procedure
  debug: false
  script:
    - if <player.has_permission[dvchest.admin]>:
      - determine <list[add|addLimit]>
    - determine <list[]>
DVChestTab_player:
  type: procedure
  debug: false
  script:
    - if <player.has_permission[dvchest.admin]>:
      - determine <server.players.parse[name]>
    - determine <list[]>
DVChest:
  type: command
  debug: false
  name: dvchest
  description: access a personal virtual chest
  usage: /dvchest
  aliases:
  - dvc
  tab complete:
    - if <script[TabComplete]||null> == null:
      - determine <list[]>
    - determine <proc[TabComplete].context[<list[dvchest|DVChestTab].include_single[<context.raw_args.escaped>]>]>
  script:
    - define arg <context.args.get[1]||null>
    - define name <context.args.get[2]||null>
    - choose <[arg]>:
      - case add:
        - if <context.server> || <player.has_permission[dvchest.admin]>:
          - if <context.args.size> > 2:
            - narrate format:dvchest_format "<&c>Too many arguments! Expected <gold>/dvchest add <&lb>player<&rb>"
            - stop
          - if <[name]> == null:
            - narrate format:dvchest_format "<&c>Missing player!"
            - stop
          - define player <server.match_offline_player[<[name]>]||null>
          - if <[player]> == null:
            - narrate format:dvchest_format "<&c>Could not find player named <[name]>!"
            - stop
          - if <[player].has_permission[dvchest]>:
            - narrate format:dvchest_format "<[player].name> already has dvchest"
            - stop
          - permission add dvchest player:<[player]>
          - flag <[player]> dvchestLimit:1
          - narrate format:dvchest_format "<&6>You can now use <&4><&l>Dv<&8>chest!" targets:<[player]>
          - announce format:dvchest_format "<&a><[player].name> can now use dvchest" to_console
          - stop
        - else:
          - narrate format:dvchest_format "You do not have permission to use this command"
      - case addlimit:
        - if <context.server> || <player.has_permission[dvchest.admin]>:
          - if <context.args.size> > 2:
            - narrate format:dvchest_format "<&c>Too many arguments! Expected <gold>/dvchest add <&lb>player<&rb>"
            - stop
          - if <[name]> == null:
            - narrate format:dvchest_format "<&c>Missing player!"
            - stop
          - define player <server.match_offline_player[<[name]>]||null>
          - if <[player]> == null:
            - narrate format:dvchest_format "<&c>Could not find player named <[name]>!"
            - stop
          - if <player.flag[dvchestLimit]> == 6:
            - narrate format:dvchest_format "The maximum amount of lines hav been reached"
            - stop
          - flag <[player]> dvchestLimit:++
          - define dvchest <inventory[<[player].uuid>dvchest]||null>
          - if <[dvchest]> != null:
            - adjust <[dvchest]> size:<player.flag[dvchestLimit].mul_int[9]>
          - narrate format:dvchest_format "<&6>You can now have <&f><[player].flag[dvchestLimit]> <&6>lines in your dvchest!" targets:<[player]>
          - announce format:dvchest_format "<&a><[player].name> line limit set to <[player].flag[dvchestLimit]>" to_console
        - else:
          - narrate format:dvchest_format "You do not have permission to use this command"
      - case about:
        - narrate "<green>#-----------------------------# "
        - narrate "<green>#<&4><&l>Dv<&8>chest "
        - narrate "<green>#Author: <red>zozer_firehood"
        - narrate "<green>#-----------------------------# "
        - narrate format:dvchest_format "by utilising 4th dimension space,dvchest allows you to have a safe inventory that you can access at any time"
        - narrate format:dvchest_format "to access it, just type <&6>/dvchest"
        - narrate format:dvchest_format "disclaimer: we are not responsible for any infestation that may apear in your dvchest."
        - narrate format:dvchest_format "this includes, but not limited to: square bacteriaum, time travling rats,random broken glass, and gophers"
      - case help:
        - narrate "<green>---------DVChest help------------<green>"
        - narrate "<gold>/dvchest <green>Access your personal dvchest"
        - if <player.has_permission[dvchest.admin]>:
          - narrate "<gold>/dvchest add <&lb>player<&rb> <green>Allow a player to use dvchest"
          - narrate "<gold>/dvchest addLimit <&lb>player<&rb> <green>Increment the size of a players dvchest by a line"
      - default:
        - if !<player.has_permission[dvchest]> && !<context.server> && <[arg]> == null:
          - narrate format:dvchest_format "<red>you havn't unlocked dvchest!"
          - stop
        - if <[arg]> != null:
          - narrate format:dvchest_format "<gold><[arg]><&8> is an unkown argument, use <gold>/dvc <&8>or <gold>/dvchest <&8>to access your dvchest"
          - stop
        - define lines <player.flag[dvchestLimit]||null>
        - if <[lines]> == null:
          - define lines 1
          - flag player dvchestLimit:1
        - define id <player.uuid>dvchest
        - define dvchest <inventory[<[id]>]||null>
        - if <[dvchest]> == null:
            - note <inventory[generic[title=<&c>dv<&9>Chest;size=<[lines].mul_int[9]>]]> as:<[id]>
            - define dvchest <inventory[<[id]>]>
        - inventory open d:<[dvchest]>
dvchest_format:
  type: format
  debug: false
  format: <&4><&l>Dv<&8>chest <text>