Package org.bukkit.inventory

Examples of org.bukkit.inventory.Inventory.first()


                   
                inv.setItem(inv.firstEmpty(), handitem);
            }
       
            if (inv.contains(item)) {
                Integer slotId = inv.first(item);
                ItemStack stack = inv.getItem(slotId);
                Integer stackAmount = stack.getAmount();

                if (stackAmount > 1 ) {
                    stack.setAmount( stackAmount - 1 );
View Full Code Here


        player.getWorld().dropItem(player.getLocation(), stack);
      else inv.setItem(first, stack);
    }

    //If they aren't holding a tool, move the tool to their hand
    int first = inv.first(BlockUtil.getIdFromString(Config.ToolBlock));
    if (!BlockUtil.getItemString(player.getItemInHand()).equals(Config.ToolBlock) && first != -1){
      ItemStack back = player.getItemInHand().clone();
      player.setItemInHand(inv.getItem(first));
      if (back.getAmount() == 0) inv.clear(first);
      else inv.setItem(first, back);
View Full Code Here

  private void getCaneFromChest(Chest chest) {
    if (cane < 3) {
      Inventory inventory = chest.getInventory();
      while (cane < 3) {
        int position = inventory.first(Material.SUGAR_CANE);
        if (position < 0) {
          break;
        }
        ItemStack stack = inventory.getItem(position);
        cane += stack.getAmount();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.