- 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: PlayerVaults


By Mwthorn
Created: 2018/08/06 16:29:15 UTC-07:00 (5 years and 261 days ago)
Edited: 2018/08/06 16:29:15 UTC-07:00 (5 years and 261 days ago)
Likes: 0

Staff pick as of: 2019/02/15 00:05:52 UTC-08:00 (5 years and 69 days ago)
Denizen Version: 1.0.2
Script Version: 1.0
Description:

A virtual chest system to store items, just like having multiple enderchests.

Commands:
/pv
/pv (number)

Give players the permission:
- playervaults.vault.(number)
Example:
- playervaults.vault.1
- playervaults.vault.3
This will give a player acess to vault 1 and 3 but NOT 2.

Known Issues:
- Items with custom NBT are not supported, however everything else like lore, display, enchantments and script items are fine.


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
6100

PlayerVault_Events:
    type: world
    events:
        
        on server start:
        - inject PlayerVault_Load_Config_Task
        
        on reload scripts:
        - inject PlayerVault_Load_Config_Task
        
        on player closes inventory:
        - if <context.inventory.replace[<player.uuid>].starts_with[in@pvault].not||true> {
            - queue clear
        }
        - define vault_id <context.inventory.after[_]>
        - define dvlist <context.inventory.list_contents>
        - yaml set id:pvaultkey "<player.uuid>.<def[vault_id]>:<def[dvlist]>"
        - yaml "savefile:data/pvault/pvaultkey.yml" "id:pvaultkey"
        - define id "<player.uuid>pvault_<def[vault_id]>"
        - note remove as:<def[id]>
        
PlayerVault_Load_Config_Task:
    type: task
    script:
    - if <server.has_file[data/pvault/pvaultkey.yml].not> {
        - yaml create "id:pvaultkey"
        - yaml "savefile:data/pvault/pvaultkey.yml" "id:pvaultkey"
    }
    else {
        - yaml "load:data/pvault/pvaultkey.yml" "id:pvaultkey"
    }
        
PlayerVault_Command:
    type: command
    name: playervault
    aliases:
    - vc
    - pv
    - pvs
    - playervaults
    script:
    - if <context.args.size> > 0 {
        - define vault_id <context.args.get[1].as_int||1>
    }
    else {
        - define vault_id 1
    }
    - if <player.has_permission[playervaults.vault.<def[vault_id]>].global.not> {
         - narrate "<&c>Sorry, no access to PV <def[vault_id]>"
         - queue clear
    }
    - define lines 6
    - define pvault <player.uuid>pvault_<def[vault_id]>
    - define title "<&3>PV <&co> <def[vault_id]>"
    - note "in@generic[title=<def[title]>;size=<def[lines].mul_int[9]>]" as:<def[pvault]>
    - define items <yaml[pvaultkey].read[<player.uuid>.<def[vault_id]>]||null>
    - if <def[items]> != null {
        - inventory set d:in@<def[pvault]> o:<def[items]>
    }
    - inventory open d:in@<def[pvault]>





View History