Search in sources :

Example 1 with Dispenser

use of org.bukkit.block.Dispenser in project TotalFreedomMod by TotalFreedom.

the class Command_dispfill method setDispenserContents.

private static void setDispenserContents(final Block targetBlock, final ItemStack[] items) {
    if (targetBlock.getType() == Material.DISPENSER) {
        final Inventory dispenserInv = ((Dispenser) targetBlock.getState()).getInventory();
        dispenserInv.clear();
        dispenserInv.addItem(items);
    }
}
Also used : Dispenser(org.bukkit.block.Dispenser) Inventory(org.bukkit.inventory.Inventory)

Aggregations

Dispenser (org.bukkit.block.Dispenser)1 Inventory (org.bukkit.inventory.Inventory)1