Package org.bukkit.block

Examples of org.bukkit.block.Dispenser


                      // Dispensers set
                      worldBlock.setType(Material.getMaterial(diskBlockType));
                      worldBlock.setData(diskBlockData);
                      BlockState state = worldBlock.getState();
                      if (state instanceof Dispenser) {
                        Dispenser dispenser = (Dispenser) state;
                        if (items != null) {
                          int ii = 0;
                          dispenser.getInventory().clear();
                          for (ItemStack item : items) {
                            if (item != null) {
                              dispenser.getInventory().setItem(ii, item);
                              ii++;
                            }
                          }
                          dispenser.update(true);
                        }
                      }
                    } else if (diskBlockType == Material.WOODEN_DOOR.getId() || diskBlockType == Material.IRON_DOOR_BLOCK.getId()) {
                      // Door blocks
                      deferred.add(new DeferredBlockReset(x, y, z, diskBlockType, diskBlockData));
View Full Code Here


                  List<ItemStack> items = VolumeMapper.getItemListFromInv(inv);
                  invsWriter.write(VolumeMapper.buildInventoryStringFromItemList(items));
                  invsWriter.newLine();
                } else if (state instanceof Dispenser) {
                  // Dispensers
                  Dispenser dispenser = (Dispenser) state;
                  Inventory inv = dispenser.getInventory();
                  List<ItemStack> items = VolumeMapper.getItemListFromInv(inv);
                  invsWriter.write(VolumeMapper.buildInventoryStringFromItemList(items));
                  invsWriter.newLine();
                }
                noOfSavedBlocks++;
View Full Code Here

                          // Dispensers set
                          worldBlock.setType(Material.getMaterial(diskBlockType));
                          worldBlock.setData(diskBlockData);
                          BlockState state = worldBlock.getState();
                          if (state instanceof Dispenser) {
                            Dispenser dispenser = (Dispenser) state;
                            if (items != null) {
                              int ii = 0;
                              dispenser.getInventory().clear();
                              for (ItemStack item : items) {
                                if (item != null) {
                                  dispenser.getInventory().setItem(ii, item);
                                  ii++;
                                }
                              }
                              dispenser.update(true);
                            }
                          }
                        } else if (diskBlockType == Material.WOODEN_DOOR.getId() || diskBlockType == Material.IRON_DOOR_BLOCK.getId()) {
                          // Door blocks
View Full Code Here

                        break;
                    }
                }
            }
        } else if (bl.getType() == Material.DISPENSER) {
            Dispenser c = (Dispenser) bl.getState();
            for (ItemStack it : c.getInventory().getContents()) {
                if (ItemUtil.isStackValid(it)) {
                    if(item == null || ItemUtil.areItemsIdentical(it, item)) {
                        stack = it;
                        inv = c.getInventory();
                        break;
                    }
                }
            }
        }
View Full Code Here

    public void onBlockDispense(BlockDispenseEvent event) {

        if(!EventUtil.passesFilter(event)) return;

        if (!(event.getBlock().getState() instanceof Dispenser)) return; // Heh? Isn't this just for dispensers?
        Dispenser dis = (Dispenser) event.getBlock().getState();
        if (dispenseNew(dis, event.getItem(), event.getVelocity(), event)) {
            event.setCancelled(true);
        }
    }
View Full Code Here

TOP

Related Classes of org.bukkit.block.Dispenser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.