- D1 Meta Docs - Denizen Script -
Home Page / Pi to one million places / Contact mcmonkey / Donate / Paste Scripts / Denizen Help /
You are browsing as a guest.
Login | Register








The script repo is an archive of historical scripts. For modern scripts, or to post your own, please use the Scripts forum section.





Staff Pick: DVChest


By zozer_firehood
Created: 2015/12/10 14:16:55 UTC-08:00 (9 years and 14 days ago)
Edited: 2016/08/24 14:25:51 UTC-07:00 (8 years and 121 days ago)
Likes: 0

Staff pick as of: 2015/12/14 20:11:59 UTC-08:00 (9 years and 10 days ago)
Denizen Version: DEV 632
Script Version: 1.2
Description:

DVChest is a virtual chest that a player can access at anytime anywhere.
Initially the player only gets one line for their DVChest, but it can be incremented.

Simply put this in the script folder and reload, no other setup necessary.

All data is stored in /dvchest/dvchestkey.yml, don't erase that

**Update**
I don't know why the previous version worked when I made it, but here is one that works.


Download script | View raw script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
12800

#------------------------#
#dvchest                 #
#Author:zozer_firehood   #
#   _______              #
#  /       \             #
# /  ____   \            #
#|  / ___    |           #
#| / / __    |           #
# \ / /     /            #
#  \_______/             #
#------------------------#
# usage /dvc or /dvchest without args will open the chest, the player. perms required: dvchest
# /dvc addLimit <player> will increment the lines for the chest for a given player. perms required: dvchest.admin
# /dvc add <player> will allow that player to use dvchest. perms required: dvchest.admin
DVChest_version:
  type: version
  name: DVChest
  id: 68
  description: a private safe chest you can access at any time.
  version: 1.2
DVChest:
  type: command
  debug: true
  name: dvchest
  aliases:
  - dvc
  tab complete:
    - define list li@about
    - if <player.has_permission[dvchest.admin]> {
      - if <c.args.size.is[==].to[1]> {
        - define list <def[list].include[add|addlimit]>
        }
      }
    - determine <def[list].filter[starts_with[<context.args.last>]]>
  script:
    - define arg <c.args.get[1]||null>
    - choose %arg%:
      - case add:
        - if <c.server.or[<player.has_permission[dvchest.admin]>]> {
          - define player <c.args.get[2].as_player||null>
          - if <def[player].is[==].to[null]> {
            - narrate 'format:dvchest_format' "<&c>That is not a valid player!"
            - queue clear
            }
          - if <def[player].has_permission[dvchest]> {
            - narrate 'format:dvchest_format' "<def[player].name> already has dvchest"
            - queue clear
            }
          - 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><def[player].name> can now use dvchest" to_console
          - queue clear
          } else {
          - narrate 'format:dvchest_format' "You do not have permission to use this command"
          }
      - case addlimit:
        - if <c.server.or[<player.has_permission[dvchest.admin]>]> {
          - define player <c.args.get[2].as_player||null>
          - if <def[player].is[==].to[null]> {
            - narrate 'format:dvchest_format' "<&c>That is not a valid player!"
            - queue clear
            }
          - if <player.flag[dvchestLimit].is[==].to[6]> {
            - narrate 'format:dvchest_format' "The maximum amount of lines hav been reached"
            - queue clear
            }
          - flag %player% 'dvchestLimit:++:1'
          - narrate 'format:dvchest_format' "<&6>You can now have <&f><def[player].flag[dvchestLimit].as_int> <&6>lines in your dvchest!" 'targets:%player%'
          - announce 'format:dvchest_format' "<&a><def[player].name> line limit set to <def[player].flag[dvchestLimit]>" to_console
          } else {
          - narrate 'format:dvchest_format' "You do not have permission to use this command"
          }
      - case about:
        - determine passively fulfilled
        - 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"
      - default:
        #checks perms
        - if !<player.has_permission[dvchest]> && !<c.server> && %arg% == null {
          - narrate 'format:dvchest_format' "<red>you havn't unlocked dvchest!"
          - queue clear
          }
        #check for extra args
        - if !<def[arg].is[==].to[null]> {
          - narrate format:dvchest_format "<gold>%arg%<&8> is an unkown argument, use <gold>/dvc <&8>or <gold>/dvchest <&8>to access your dvchest"
          - queue clear
          }     
        - run locally loadYAML
        - define lines <player.flag[dvchestLimit]>
        - if <def[lines].is[==].to[null]> {
          - define lines '1'
          - flag player dvchestLimit:1
          }
        - define dvchest <player.uuid>dvchest
        - note in@generic[title=<&c>dv<&9>Chest;size=<def[lines].mul_int[9]>;] 'as:%dvchest%'
        - inventory add 'd:in@%dvchest%' 'o:<yaml[dvchestkey].read[<player.uuid>]>'
        - inventory open 'd:in@%dvchest%'
  loadYAML:
    - if !<yaml.list.contains[dvchestkey]> {
      - if !<server.has_file[dvchest/dvchestkey.yml]> {
        - yaml create 'id:dvchestkey'
        - yaml 'savefile:dvchest/dvchestkey.yml' 'id:dvchestkey'
        }
        else {
        - yaml 'load:dvchest/dvchestkey.yml' 'id:dvchestkey'
        }
      }        
DVChestHandler:
  type: world
  debug: true
  events:
    on player closes inventory:
    - if <context.inventory.replace[<player.uuid>].is[!=].to[in@dvchest]> queue clear
    - define dvlist <c.inventory.list_contents>
    - yaml set 'id:dvchestkey' <player.uuid>:%dvlist%
    - yaml 'savefile:dvchest/dvchestkey.yml' 'id:dvchestkey'
dvchest_format:
  type: format
  format<&4><&l>Dv<&8>chest <text>






View History