public void onBlockBreak(BlockBreakEvent event) { if (event.isCancelled()) return; Block block = event.getBlock(); if (block.getType() == Material.BOOKSHELF) { AdvShelf shelf = new AdvShelf(block.getLocation()); shelf.delete(); ItemStack stack = new ItemStack(block.getType(), 1); block.getWorld().dropItemNaturally(block.getLocation(), stack); } }
public void onBlockPlace(BlockPlaceEvent event) { if (event.isCancelled()) return; Player player = event.getPlayer(); Block block = event.getBlockPlaced(); if (block.getType() == Material.BOOKSHELF) { AdvShelf shelf = new AdvShelf(block.getLocation()); shelf.setOwner(player.getName()); shelf.setModifier(player.getName()); shelf.save(); } }