本文整理汇总了Java中org.bukkit.block.Dropper类的典型用法代码示例。如果您正苦于以下问题:Java Dropper类的具体用法?Java Dropper怎么用?Java Dropper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Dropper类属于org.bukkit.block包,在下文中一共展示了Dropper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updatePearlHolder
import org.bukkit.block.Dropper; //导入依赖的package包/类
/**
* 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);
}
}
示例2: detectFuelInventory
import org.bukkit.block.Dropper; //导入依赖的package包/类
/**
* 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;
}
示例3: emptyTrash
import org.bukkit.block.Dropper; //导入依赖的package包/类
/**
* 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();
}
}
示例4: craft
import org.bukkit.block.Dropper; //导入依赖的package包/类
@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();
}
示例5: craft
import org.bukkit.block.Dropper; //导入依赖的package包/类
@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();
}
示例6: WorldInfo
import org.bukkit.block.Dropper; //导入依赖的package包/类
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++;
}
}
}
}
示例7: destroyThisBlock
import org.bukkit.block.Dropper; //导入依赖的package包/类
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);
}
示例8: getInventory
import org.bukkit.block.Dropper; //导入依赖的package包/类
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;
}
示例9: BlockTranslation
import org.bukkit.block.Dropper; //导入依赖的package包/类
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();
}
}
}
示例10: isValid
import org.bukkit.block.Dropper; //导入依赖的package包/类
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;
}
示例11: getTrashCan
import org.bukkit.block.Dropper; //导入依赖的package包/类
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;
}
示例12: getInventory
import org.bukkit.block.Dropper; //导入依赖的package包/类
@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;
}
}
示例13: onInventoryOpen
import org.bukkit.block.Dropper; //导入依赖的package包/类
@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);
}
}
示例14: fire
import org.bukkit.block.Dropper; //导入依赖的package包/类
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;
}
示例15: fire
import org.bukkit.block.Dropper; //导入依赖的package包/类
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;
}