Java 类org.bukkit.block.Dropper 实例源码

项目:ExilePearl    文件:PlayerListener.java   
/**
 * Updates the pearl holder
 * @param pearl The pearl to update
 * @param holder The pearl holder
 * @param event The event
 */
private void updatePearlHolder(ExilePearl pearl, InventoryHolder holder, Cancellable event) {

    if (holder instanceof Chest) {
        updatePearl(pearl, (Chest)holder);
    } else if (holder instanceof DoubleChest) {
        updatePearl(pearl, (Chest) ((DoubleChest) holder).getLeftSide());
    } else if (holder instanceof Furnace) {
        updatePearl(pearl, (Furnace) holder);
    } else if (holder instanceof Dispenser) {
        updatePearl(pearl, (Dispenser) holder);
    } else if (holder instanceof Dropper) {
        updatePearl(pearl, (Dropper) holder);
    } else if (holder instanceof Hopper) {
        updatePearl(pearl, (Hopper) holder);
    } else if (holder instanceof BrewingStand) {
        updatePearl(pearl, (BrewingStand) holder);
    } else if (holder instanceof Player) {
        updatePearl(pearl, (Player) holder);
    }else {
        event.setCancelled(true);
    }
}
项目:StarQuestCode    文件:Drill.java   
/**
 * Detects if a dropper or furnace is placed in the correct position and returns the Block or null if no correct Block was found.
 * @param base the GuiBlock
 * @param forward the forward BlockFace of the drill
 * @return the dropper or furnace Block
 */
public Block detectFuelInventory(Block base, BlockFace forward)
{
    for(BlockFace bf : diamond)
    {
        if(base.getRelative(bf).getState() instanceof Dropper || base.getRelative(bf).getState() instanceof Furnace)
            return base.getRelative(bf);
    }

    Block relativePossibleLoc = base.getRelative(BlockFace.DOWN).getRelative(getBlockFaceBack(forward));

    if(relativePossibleLoc.getState() instanceof Dropper || relativePossibleLoc.getState() instanceof Furnace)
            return relativePossibleLoc;

    return null;
}
项目:sensibletoolbox    文件:TrashCan.java   
/**
 * Empty this trash can, permanently destroying its contents.
 *
 * @param noisy if true, play a sound effect if any items were destroyed
 */
public void emptyTrash(boolean noisy) {
    Location l = getLocation();
    if (l != null && l.getBlock().getType() == getMaterialData().getItemType()) {
        Dropper d = (Dropper) l.getBlock().getState();
        if (noisy) {
            for (ItemStack stack : d.getInventory()) {
                if (stack != null) {
                    d.getLocation().getWorld().playSound(d.getLocation(), Sound.EAT, 1.0f, 1.0f);
                    break;
                }
            }
        }
        Debugger.getInstance().debug(this + ": trash emptied");
        d.getInventory().clear();
    }
}
项目:SuperiorCraft    文件:CustomCrafter.java   
@Override
public void craft(InventoryCloseEvent e) {
    //e.getWhoClicked().closeInventory();
    e.getPlayer().sendMessage(name + "&r created!".replace('&', '�'));
    Dropper a = (Dropper) e.getInventory().getLocation().getBlock().getState();
    a.setCustomName(name);
    a.update();
    e.getInventory().clear();
}
项目:SuperiorCraft    文件:FoodCrafter.java   
@Override
public void craft(InventoryClickEvent e) {
    e.getWhoClicked().closeInventory();
    e.getWhoClicked().sendMessage("Bacon pancakes, makin' bacon pancakes (Milhorn)".replace('&', '�'));
    Dropper a = (Dropper) e.getInventory().getLocation().getBlock().getState();
    a.setCustomName(name);
    a.update();
    e.getInventory().clear();
}
项目:NeverLag    文件:WorldInfo.java   
public WorldInfo(World world) {
    this.worldName = world.getName();
    this.totalOnline = world.getPlayers().size();
    for (Entity entity : world.getEntities()) {
        this.totalEntity++;
        if (entity instanceof Animals) {
            this.totalAnimals++;
        } else if (entity instanceof Monster) {
            this.totalMonsters++;
        } else if (entity instanceof Item) {
            this.totalDropItem++;
        }
    }
    for (Chunk loadedChunk : world.getLoadedChunks()) {
        this.totalChunk++;
        for (BlockState tiles : loadedChunk.getTileEntities()) {
            this.totalTiles++;
            if (tiles instanceof Hopper) {
                this.totalHopper++;
            } else if (tiles instanceof Chest) {
                this.totalChest++;
            } else if (tiles instanceof Dispenser) {
                this.totalDispenser++;
            } else if (tiles instanceof Dropper) {
                this.totalDropper++;
            } else if (tiles instanceof BrewingStand) {
                this.totalBrewingStand++;
            }
        }

    }
}
项目:SuperiorCraft    文件:CustomCrafter.java   
@Override
public void craft(InventoryCloseEvent e) {
    //e.getWhoClicked().closeInventory();
    e.getPlayer().sendMessage(name + "&r created!".replace('&', '�'));
    Dropper a = (Dropper) e.getInventory().getLocation().getBlock().getState();
    a.setCustomName(name);
    a.update();
    e.getInventory().clear();
}
项目:SuperiorCraft    文件:FoodCrafter.java   
@Override
public void craft(InventoryClickEvent e) {
    e.getWhoClicked().closeInventory();
    e.getWhoClicked().sendMessage("Bacon pancakes, makin' bacon pancakes (Milhorn)".replace('&', '�'));
    Dropper a = (Dropper) e.getInventory().getLocation().getBlock().getState();
    a.setCustomName(name);
    a.update();
    e.getInventory().clear();
}
项目:civcraft    文件:WarRegen.java   
public static void destroyThisBlock(Block blk, Town town) {

    WarRegen.saveBlock(blk, town.getName(), false);

    switch (blk.getType()) {
    case TRAPPED_CHEST:
        ((Chest)blk.getState()).getBlockInventory().clear();
        break;
    case CHEST:
        ((Chest)blk.getState()).getBlockInventory().clear();
        break;
    case DISPENSER:
        ((Dispenser)blk.getState()).getInventory().clear();
        break;
    case BURNING_FURNACE:
    case FURNACE:
        ((Furnace)blk.getState()).getInventory().clear();
        break;
    case DROPPER:
        ((Dropper)blk.getState()).getInventory().clear();
        break;
    case HOPPER:
        ((Hopper)blk.getState()).getInventory().clear();
        break;
    default:
        break;
    }

    ItemManager.setTypeId(blk, CivData.AIR);
    ItemManager.setData(blk, 0x0, true);

}
项目:SyncChest    文件:SyncManager.java   
public Inventory getInventory(Location loc) {

if (loc.getBlock().getState() instanceof MainChest) {
    return ((MainChest) loc.getBlock().getState()).getInventory();
}

if (loc.getBlock().getState() instanceof RelatedChest) {
    return ((RelatedChest) loc.getBlock().getState()).getInventory();
}

if (loc.getBlock().getState() instanceof Chest) {
    return ((Chest) loc.getBlock().getState()).getInventory();
}

if (loc.getBlock().getState() instanceof DoubleChest) {
    return ((DoubleChest) loc.getBlock().getState()).getInventory();
}

if (loc.getBlock().getState() instanceof BrewingStand) {
    return ((BrewingStand) loc.getBlock().getState()).getInventory();
}

if (loc.getBlock().getState() instanceof Dispenser) {
    return ((Dispenser) loc.getBlock().getState()).getInventory();
}

if (loc.getBlock().getState() instanceof Dropper) {
    return ((Dropper) loc.getBlock().getState()).getInventory();
}
return null;
   }
项目:StarQuestCode    文件:BlockTranslation.java   
public BlockTranslation(List<Block> blocks, final BlockFace direction)
{
    this.blocks = blocks;
    this.direction = direction;

    blocksData = new ArrayList<BlockData>();

    for(Block b : blocks)
    {
        blocksData.add(new BlockData(b));
        if(b.getType() == Material.CHEST || b.getType() == Material.TRAPPED_CHEST)
        {
            this.chestItems = ((Chest) b.getState()).getInventory().getContents().clone();
            ((Chest) b.getState()).getInventory().clear();
        }
        else if(b.getState() instanceof Dropper)
        {
            this.dropperItems = ((Dropper) b.getState()).getInventory().getContents().clone();
            ((Dropper) b.getState()).getInventory().clear();
        }
        else if(b.getState() instanceof Furnace)
        {
            this.furnaceFuel = ((Furnace) b.getState()).getInventory().getFuel();
            this.furnaceBurnMaterial = ((Furnace) b.getState()).getInventory().getSmelting();
            this.furnaceResult = ((Furnace) b.getState()).getInventory().getResult();
            this.furnaceBurnTime = ((Furnace) b.getState()).getBurnTime();
            ((Furnace) b.getState()).getInventory().clear();
        }
    }
}
项目:StarQuestCode    文件:Util.java   
public static boolean isValid(Location sign)
{
    Block block = sign.getBlock().getRelative(((org.bukkit.material.Sign) sign.getBlock().getState().getData()).getAttachedFace());

    if (block.getType().equals(Material.DROPPER))
    {
        Dropper dropper = (Dropper) block.getState();
        ArrayList<ItemStack> inv = new ArrayList<ItemStack>(Arrays.asList(dropper.getInventory().getContents()));

        while (inv.remove(null));

        if (inv.size() > 0)
        {
            ItemStack testStack = inv.get(0);
            for (ItemStack stack : inv)
            {
                if (!stack.getType().equals(testStack.getType()))
                    return false;
                if (stack.hasItemMeta() != testStack.hasItemMeta())
                    return false;
                if (stack.hasItemMeta() && testStack.hasItemMeta())
                    if (!stack.getItemMeta().equals(testStack.getItemMeta()))
                        return false;

            }
            return true;
        }
    }
    return false;
}
项目:sensibletoolbox    文件:TrashCan.java   
public static TrashCan getTrashCan(Inventory inv) {
    InventoryHolder holder = inv.getHolder();
    if (holder instanceof Dropper) {
        return SensibleToolbox.getBlockAt(((Dropper) holder).getLocation(), TrashCan.class, false);
    }
    return null;
}
项目:sensibletoolbox    文件:TrashCan.java   
@Override
public Inventory getInventory() {
    Location l = getLocation();
    if (l != null && l.getBlock().getType() == getMaterialData().getItemType()) {
        Dropper d = (Dropper) getLocation().getBlock().getState();
        return d.getInventory();
    } else {
        return null;
    }
}
项目:GrandVide    文件:GVEventListener.java   
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onInventoryOpen(InventoryOpenEvent e)
{
    if (e.getInventory().getType() == InventoryType.DROPPER
            && e.getInventory().getHolder() instanceof Dropper
            && DropperManager.getSpecialDropper(((Dropper)e.getInventory().getHolder()).getBlock()) != null)
    {
        e.setCancelled(true);
    }
}
项目:GrandVide    文件:EventDropper.java   
public boolean fire()
{
    if (stopped || block.getType() != Material.DROPPER)
        return false;

    Dropper dropper = (Dropper)block.getState();
    dropper.getInventory().addItem(current.getItem().clone());
    dropper.drop();
    dropper.update();

    current = seq.getNextTimedItem();

    return current != null;
}
项目:GrandVide    文件:ScheduledDropper.java   
public boolean fire()
{
    if (stopped || block.getType() != Material.DROPPER)
        return false;

    Dropper dropper = (Dropper)block.getState();
    dropper.getInventory().addItem(item.clone());
    dropper.drop();
    dropper.update();

    return true;
}
项目:SharpSK    文件:ArmorEquipListener.java   
@EventHandler
public void dispenserFireEvent(BlockDispenseEvent e) {
    ArmorType type = ArmorType.matchType(e.getItem());
    if (e.getBlock() instanceof Dropper)
        return;
    if (ArmorType.matchType(e.getItem()) != null) {
        Location loc = e.getBlock().getLocation();
        for (Player p : loc.getWorld().getPlayers()) {
            if (loc.getBlockY() - p.getLocation().getBlockY() >= -1
                    && loc.getBlockY() - p.getLocation().getBlockY() <= 1) {
                if (p.getInventory().getHelmet() == null && type.equals(ArmorType.HELMET)
                        || p.getInventory().getChestplate() == null && type.equals(ArmorType.CHESTPLATE)
                        || p.getInventory().getLeggings() == null && type.equals(ArmorType.LEGGINGS)
                        || p.getInventory().getBoots() == null && type.equals(ArmorType.BOOTS)) {
                    org.bukkit.block.Dispenser dispenser = (org.bukkit.block.Dispenser) e.getBlock().getState();
                    org.bukkit.material.Dispenser dis = (org.bukkit.material.Dispenser) dispenser.getData();
                    BlockFace directionFacing = dis.getFacing();
                    // Someone told me not to do big if checks because it's hard to read, look at me
                    // doing it -_-
                    if (directionFacing == BlockFace.EAST && p.getLocation().getBlockX() != loc.getBlockX()
                            && p.getLocation().getX() <= loc.getX() + 2.3 && p.getLocation().getX() >= loc.getX()
                            || directionFacing == BlockFace.WEST && p.getLocation().getX() >= loc.getX() - 1.3
                                    && p.getLocation().getX() <= loc.getX()
                            || directionFacing == BlockFace.SOUTH && p.getLocation().getBlockZ() != loc.getBlockZ()
                                    && p.getLocation().getZ() <= loc.getZ() + 2.3
                                    && p.getLocation().getZ() >= loc.getZ()
                            || directionFacing == BlockFace.NORTH && p.getLocation().getZ() >= loc.getZ() - 1.3
                                    && p.getLocation().getZ() <= loc.getZ()) {
                        ArmorEquipEvent armorEquipEvent = new ArmorEquipEvent(p, EquipMethod.DISPENSER,
                                ArmorType.matchType(e.getItem()), e.getItem());
                        Bukkit.getServer().getPluginManager().callEvent(armorEquipEvent);
                        if (armorEquipEvent.isCancelled()) {
                            e.setCancelled(true);
                        }
                        return;
                    }
                }
            }
        }
    }
}
项目:ExilePearl    文件:ExileListenerTest.java   
@Test
public void testOnInventoryMoveTnt() {
    when(player.getGameMode()).thenReturn(GameMode.SURVIVAL);
    ItemStack item = new ItemStack(Material.TNT, 1);


    Inventory top = mock(Inventory.class);
    when(top.getHolder()).thenReturn(mock(Dropper.class));
    when(top.getSize()).thenReturn(9);

    Inventory bottom = mock(Inventory.class);
    when(bottom.getHolder()).thenReturn(mock(Player.class));
    when(bottom.getSize()).thenReturn(45);

    InventoryView view = mock(InventoryView.class);
    when(view.getPlayer()).thenReturn(player);
    when(view.getTopInventory()).thenReturn(top);
    when(view.getBottomInventory()).thenReturn(bottom);
    when(view.getCursor()).thenReturn(item);
    when(view.getItem(eq(5))).thenReturn(item);
    when(view.getItem(eq(40))).thenReturn(item);

    InventoryClickEvent e = new InventoryClickEvent(view, null, 5, ClickType.LEFT, InventoryAction.PLACE_SOME);
    when(config.canPerform(ExileRule.PLACE_TNT)).thenReturn(true);
    dut.onInventoryClick(e);
    assertFalse(e.isCancelled());

    e = new InventoryClickEvent(view, null, 5, ClickType.LEFT, InventoryAction.PLACE_SOME);
    when(config.canPerform(ExileRule.PLACE_TNT)).thenReturn(false);
    dut.onInventoryClick(e);
    assertFalse(e.isCancelled());

    e = new InventoryClickEvent(view, null, 5, ClickType.LEFT, InventoryAction.PLACE_SOME);
    when(config.canPerform(ExileRule.PLACE_TNT)).thenReturn(true);
    when(pearlApi.isPlayerExiled(uid)).thenReturn(true);
    dut.onInventoryClick(e);
    assertFalse(e.isCancelled());

    e = new InventoryClickEvent(view, null, 5, ClickType.LEFT, InventoryAction.PLACE_SOME);
    when(config.canPerform(ExileRule.PLACE_TNT)).thenReturn(false);
    dut.onInventoryClick(e);
    assertTrue(e.isCancelled());

    e = new InventoryClickEvent(view, null, 5, ClickType.LEFT, InventoryAction.PLACE_SOME);
    when(top.getHolder()).thenReturn(mock(Chest.class));
    dut.onInventoryClick(e);
    assertFalse(e.isCancelled());

    e = new InventoryClickEvent(view, null, 5, ClickType.LEFT, InventoryAction.PLACE_ALL);
    when(top.getHolder()).thenReturn(mock(Hopper.class));
    dut.onInventoryClick(e);
    assertTrue(e.isCancelled());

    e = new InventoryClickEvent(view, null, 5, ClickType.LEFT, InventoryAction.PLACE_ONE);
    when(top.getHolder()).thenReturn(mock(Dispenser.class));
    dut.onInventoryClick(e);
    assertTrue(e.isCancelled());

    e = new InventoryClickEvent(view, null, 5, ClickType.SHIFT_LEFT, InventoryAction.MOVE_TO_OTHER_INVENTORY);
    dut.onInventoryClick(e);
    assertFalse(e.isCancelled());

    e = new InventoryClickEvent(view, null, 40, ClickType.LEFT, InventoryAction.PLACE_SOME);
    dut.onInventoryClick(e);
    assertFalse(e.isCancelled());

    e = new InventoryClickEvent(view, null, 40, ClickType.SHIFT_LEFT, InventoryAction.MOVE_TO_OTHER_INVENTORY);
    when(view.getType()).thenReturn(InventoryType.DISPENSER);
    assertEquals(e.getCurrentItem(), item);
    dut.onInventoryClick(e);
    assertTrue(e.isCancelled());

}
项目:civcraft    文件:WarRegen.java   
private static String blockToString(Block blk, boolean save_as_air) {
    if (save_as_air) { 
        return blockAsAir(blk);
    }
    else {
        String str = blockBasicString(blk);

        Inventory inv = null;
        switch (blk.getType()) {
        case TRAPPED_CHEST:
        case CHEST:
            inv = ((Chest)blk.getState()).getBlockInventory();
            str += blockInventoryString(inv);
            break;
        case DISPENSER:
            inv = ((Dispenser)blk.getState()).getInventory();
            str += blockInventoryString(inv);
            break;
        case BURNING_FURNACE:
        case FURNACE:
            inv = ((Furnace)blk.getState()).getInventory();
            str += blockInventoryString(inv);
            break;
        case DROPPER:
            inv = ((Dropper)blk.getState()).getInventory();
            str += blockInventoryString(inv);
            break;
        case HOPPER:
            inv = ((Hopper)blk.getState()).getInventory();
            str += blockInventoryString(inv);
            break;
        case SIGN:
        case SIGN_POST:
        case WALL_SIGN:
            Sign sign = (Sign)blk.getState();
            str += blockSignString(sign);
            break;
        default:
            break;
        }

        return str;
    }
}
项目:civcraft    文件:WarRegen.java   
private static void restoreBlockFromString(String line) {
    String[] split = line.split(":");

    int type = Integer.valueOf(split[0]);
    byte data = Byte.valueOf(split[1]);
    int x = Integer.valueOf(split[2]);
    int y = Integer.valueOf(split[3]);
    int z = Integer.valueOf(split[4]);
    String world = split[5];

    Block block = BukkitObjects.getWorld(world).getBlockAt(x,y,z);

    ItemManager.setTypeId(block, type);
    ItemManager.setData(block, data, false);

    // End of basic block info, try to get more now.
    Inventory inv = null;
    switch (block.getType()) {
    case TRAPPED_CHEST:
        inv = ((Chest)block.getState()).getBlockInventory();
        InventorySerializer.StringToInventory(inv, split[6]);
        break;
    case CHEST:
        inv = ((Chest)block.getState()).getBlockInventory();
        InventorySerializer.StringToInventory(inv, split[6]);
        break;
    case DISPENSER:         
        inv = ((Dispenser)block.getState()).getInventory();
        InventorySerializer.StringToInventory(inv, split[6]);
        break;
    case BURNING_FURNACE:
    case FURNACE:
        inv = ((Furnace)block.getState()).getInventory();
        InventorySerializer.StringToInventory(inv, split[6]);
        break;
    case DROPPER:
        inv = ((Dropper)block.getState()).getInventory();
        InventorySerializer.StringToInventory(inv, split[6]);
        break;
    case HOPPER:
        inv = ((Hopper)block.getState()).getInventory();
        InventorySerializer.StringToInventory(inv, split[6]);
        break;
    case SIGN:
    case SIGN_POST:
    case WALL_SIGN:
        Sign sign = (Sign)block.getState();
        String[] messages = split[6].split(",");
        for (int i = 0; i < 4; i++) {
            if (messages[i] != null) {
                sign.setLine(i, messages[i]);
            }
        }
        sign.update();
        break;
    default:
        break;
    }


}
项目:StarQuestCode    文件:RecyclerListener.java   
@EventHandler
public void onBlockInteraction(PlayerInteractEvent e){
    player = e.getPlayer();
    Block clickedBlock = e.getClickedBlock();
if(clickedBlock != null){
    if(clickedBlock.getType() == Material.WALL_SIGN){
        Block MiddleBlock = clickedBlock.getRelative(getGateDirection(clickedBlock));
        Block TopBlock = MiddleBlock.getRelative(BlockFace.UP);
        Block BottomBlock = MiddleBlock.getRelative(BlockFace.DOWN);
        Sign recyclerSign = (Sign) clickedBlock.getState();
        if(MiddleBlock.getType() == Material.FURNACE){
            if(TopBlock.getType() == Material.DROPPER){
                if(BottomBlock.getType() == Material.DROPPER){
                    if(recyclerSign.getLine(0).equalsIgnoreCase("[recycler]")){
                        recyclerSign.setLine(0, ChatColor.GREEN + "Recycler");
                        recyclerSign.setLine(1, ChatColor.RED + "INACTIVE");
                        recyclerSign.update(true);
                    }
                    else if(recyclerSign.getLine(0).equals(ChatColor.GREEN + "Recycler")){
                        if(recyclerSign.getLine(1).equals(ChatColor.RED + "INACTIVE")){
                            recyclerSign.setLine(1, ChatColor.GREEN + "ACTIVE");
                            Furnace middleFurnace = (Furnace) MiddleBlock.getState();
                            Dropper topDropper = (Dropper) TopBlock.getState();
                            Dropper bottomDropper = (Dropper) BottomBlock.getState();
                            RecyclerMachine recyclerOne = new RecyclerMachine(topDropper, middleFurnace, bottomDropper, recyclerSign, recyclerSign.getLocation());
                            plugin.activeRecyclerList.put(recyclerSign.getLocation(), recyclerOne);
                            plugin.recyclerLocationList.add(recyclerSign.getLocation());
                        }
                        else if(recyclerSign.getLine(1).equals(ChatColor.GREEN + "ACTIVE")){
                            recyclerSign.setLine(1, ChatColor.RED + "INACTIVE");
                            if(plugin.activeRecyclerList != null){
                                if(plugin.activeRecyclerList.size() > 0){
                                    plugin.activeRecyclerList.remove(recyclerSign.getLocation());
                                    plugin.recyclerLocationList.remove(recyclerSign.getLocation());
                                }
                            }
                            else{
                            }
                        }
                        recyclerSign.update(true);
                    }
                }
            }
        }
    }   
}
}
项目:StarQuestCode    文件:RecyclerMachine.java   
public RecyclerMachine(Dropper topDropper, Furnace recyclerFurnace, Dropper bottomDropper, Sign machineSign, Location recyclerSignLocation){
    inputDropper = topDropper;
    processorFurnace = recyclerFurnace;
    outputDropper = bottomDropper;
    recyclerSign = machineSign;
}
项目:StarQuestCode    文件:RecyclerMachine.java   
public Dropper getInputDropper(){
    return inputDropper;
}
项目:StarQuestCode    文件:RecyclerMachine.java   
public Dropper getOutputDropper(){
    return outputDropper;
}
项目:StarQuestCode    文件:Util.java   
public static Dropper getDropper(Location sign)
{
    Block block = sign.getBlock().getRelative(((org.bukkit.material.Sign) sign.getBlock().getState().getData()).getAttachedFace());
    return (Dropper) block.getState();
}
项目:CardinalPGM    文件:ObserverModule.java   
@EventHandler
public void onInteraction(PlayerInteractEvent event) {
    if (testObserver(event.getPlayer())) {
        event.setCancelled(true);
        if ((event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) && (event.getPlayer().getInventory().getItemInMainHand() != null && event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.WRITTEN_BOOK))){
            event.setUseInteractedBlock(Event.Result.DENY);
            event.setUseItemInHand(Event.Result.ALLOW);
        }
        if (event.getClickedBlock() != null && !event.getPlayer().isSneaking() && event.getAction() == Action.RIGHT_CLICK_BLOCK) {
            if (event.getClickedBlock().getType().equals(Material.CHEST) || event.getClickedBlock().getType().equals(Material.TRAPPED_CHEST)) {
                Inventory chest = Bukkit.createInventory(null, ((Chest) event.getClickedBlock().getState()).getInventory().getSize());
                for (int i = 0; i < ((Chest) event.getClickedBlock().getState()).getInventory().getSize(); i++) {
                    chest.setItem(i, ((Chest) event.getClickedBlock().getState()).getInventory().getItem(i));
                }
                event.getPlayer().openInventory(chest);
            }
            if (event.getClickedBlock().getType().equals(Material.FURNACE) || event.getClickedBlock().getType().equals(Material.BURNING_FURNACE)) {
                Inventory furnace = Bukkit.createInventory(null, InventoryType.FURNACE);
                for (int i = 0; i < ((Furnace) event.getClickedBlock().getState()).getInventory().getSize(); i++) {
                    furnace.setItem(i, ((Furnace) event.getClickedBlock().getState()).getInventory().getItem(i));
                }
                event.getPlayer().openInventory(furnace);
            }
            if (event.getClickedBlock().getType().equals(Material.DISPENSER)) {
                Inventory dispenser = Bukkit.createInventory(null, InventoryType.DISPENSER);
                for (int i = 0; i < ((Dispenser) event.getClickedBlock().getState()).getInventory().getSize(); i++) {
                    dispenser.setItem(i, ((Dispenser) event.getClickedBlock().getState()).getInventory().getItem(i));
                }
                event.getPlayer().openInventory(dispenser);
            }
            if (event.getClickedBlock().getType().equals(Material.DROPPER)) {
                Inventory dropper = Bukkit.createInventory(null, InventoryType.DROPPER);
                for (int i = 0; i < ((Dropper) event.getClickedBlock().getState()).getInventory().getSize(); i++) {
                    dropper.setItem(i, ((Dropper) event.getClickedBlock().getState()).getInventory().getItem(i));
                }
                event.getPlayer().openInventory(dropper);
            }
            if (event.getClickedBlock().getType().equals(Material.HOPPER)) {
                Inventory hopper = Bukkit.createInventory(null, InventoryType.HOPPER);
                for (int i = 0; i < ((Hopper) event.getClickedBlock().getState()).getInventory().getSize(); i++) {
                    hopper.setItem(i, ((Hopper) event.getClickedBlock().getState()).getInventory().getItem(i));
                }
                event.getPlayer().openInventory(hopper);
            }
            if (event.getClickedBlock().getType().equals(Material.BREWING_STAND)) {
                Inventory brewingStand = Bukkit.createInventory(null, InventoryType.BREWING);
                for (int i = 0; i < ((BrewingStand) event.getClickedBlock().getState()).getInventory().getSize(); i++) {
                    brewingStand.setItem(i, ((BrewingStand) event.getClickedBlock().getState()).getInventory().getItem(i));
                }
                event.getPlayer().openInventory(brewingStand);
            }
            if (event.getClickedBlock().getType().equals(Material.BEACON)) {
                Inventory beacon = Bukkit.createInventory(null, InventoryType.BEACON);
                for (int i = 0; i < ((Beacon) event.getClickedBlock().getState()).getInventory().getSize(); i++) {
                    beacon.setItem(i, ((Beacon) event.getClickedBlock().getState()).getInventory().getItem(i));
                }
                event.getPlayer().openInventory(beacon);
            }
        }
    }
}