- Added an API - Bookshelves exchanging items with hoppers will now fire InventoryMoveItemEvent
Here is a simple method that opens the inventory of a bookshelf for a player without the player to clicking the bookshelf:
Code (Java):
publicvoid openBookshelForPlayer
(Block bookshelfBlock, Player player
){ //Get the location of the bookshelf Block Location location
= bookshelfBlock.
getLocation(); //Check if the bookshelf is loaded through the API if(BookshelfAPI.
isBookshelfLoaded(location
)){ //Get the inventory of that bookshelf through the API Inventory inventory
= BookshelfAPI.
getBookshelfInventory(location
); //Open the bookshelf player.
openInventory(inventory
); } }