dvchest:
type: world
events:
on dvchest command:
- determine passively fulfilled
- inject locally loadYAML
- define dvchest <player.uuid>dvchest
- note in@generic[title=<&c>dv<&9>Chest;size=9;] 'as:%dvchest%'
- inventory add 'd:in@%dvchest%' 'o:<yaml[dvchestkey].read[<player.uuid>]>'
- narrate <yaml[dvchestkey].read[<player.uuid>]>
- inventory open 'd:in@%dvchest%'
on player clicks in inventory:
- if <context.inventory.replace[<player.uuid>].is[!=].to[in@dvchest]> queue clear
- - if <context.inventory.replace[dvchest].is[!=].to[in@<player.uuid]> {
+ - if <context.inventory.replace[dvchest].is[!=].to[in@<player.uuid>]> {
- inventory close 'd:in@<player.uuid>dvchest'
}
on player closes inventory:
- if <context.inventory.replace[<player.uuid>].is[!=].to[in@dvchest]> queue clear
- define dvlist <c.inventory.list_contents>
- narrate %dvlist%
- yaml set 'id:dvchestkey' <player.uuid>:%dvlist%
- narrate "set"
- yaml 'savefile:dvchest/dvchestkey.yml' 'id:dvchestkey'
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'
}