Date: 2016/01/08 20:00:33 UTC-08:00
Type: Denizen Script
Bookshelves:
type: world
Whitelist:
- map
- empty_map
- book
- book_and_quill
- paper
- written_book
events:
on player right clicks bookshelf:
- define shelflocation <context.location.simple>
- define userlist <context.location.find.players.within[5].filter[inventory.is[==].to[in@<def[shelflocation]>]]>
- if <def[userlist].size> > 0 {
- narrate "<&4><def[userlist].get[1].name> is already using that!"
- queue clear
}
- if <server.list_notables[inventories].parse[name].contains[shelf_<def[shelflocation]>].not> {
- note "in@generic[size=27;title=Book Shelf]" as:shelf_<def[shelf_location]>
}
- inventory open d:in@shelf_<def[shelflocation]>
on player breaks bookshelf:
- define brokenshelf shelf_<context.location.simple>
- if <server.list_notables[inventories].parse[name].contains[<def[brokenshelf]>].not> queue clear
- if <def[brokenshelf].as_inventory.list_contents> > 0 {
- determine <def[brokenshelf].as_inventory.list_contents.full>
} else {
- determine i@bookshelf
}
on player clicks in inventory:
- if <context.inventory.notable_name.starts_with[].not||true> queue clear
- if <script.yaml_key[Whitelist].contains[<c.item.material.name>].not> {
- narrate "<&4>You can't place that in a bookshelf!"
- determine CANCELLED
}