Package org.bukkit.inventory

Examples of org.bukkit.inventory.PlayerInventory.addItem()


    if (result != null){
      // Check that the player has the correct amount of items
      if (inv.contains(itemHand.getTypeId())){
        // Remove the item using the type id, amount and durability (damage value)
        inv.removeItem(new ItemStack(itemHand.getTypeId(), amount, itemHand.getDurability()));
        inv.addItem(new ItemStack(result.getTypeId(), amount));
        LogHelper.showInfo("smeltSuccess#####[ " + Utils.userFriendlyNames(itemHand.getType().name()), player, ChatColor.GREEN);
      } else {
        LogHelper.showInfo("smeltNotEnough#####[ " + Utils.userFriendlyNames(itemHand.getType().name()), player, ChatColor.RED);
      }
    } else {
View Full Code Here


      } else if (slot == 103) {
        playerInv.setHelmet(loadout.get(slot).clone());
      } else {
        ItemStack item = loadout.get(slot);
        if (item != null) {
          playerInv.addItem(item.clone());
        }
      }
    }
    if (this.getWarzoneConfig().getBoolean(WarzoneConfig.BLOCKHEADS)) {
      playerInv.setHelmet(team.getKind().getHat());
View Full Code Here

    public void grantItems(Player p) {
        PlayerInventory inv = p.getInventory();

        // Fork over the items.
        for (ItemStack stack : items) {
            inv.addItem(stack);
        }
       
        // Check for legacy armor-node items
        if (!armor.isEmpty()) {
            for (ItemStack piece : armor) {
View Full Code Here

              || item.getItemMeta().getDisplayName()
                  .contains(ChatColor.MAGIC.toString())) {
            item = plugin.getDropAPI().getItem(tool);
          }
          pi.removeItem(tool);
          pi.addItem(item);
          p.sendMessage(ChatColor.GREEN
              + "You have identified an item!");
          p.updateInventory();
          e.setUseItemInHand(Result.DENY);
          e.setCancelled(true);
View Full Code Here

      }
    }

    // Copy
        for(int i = quantity; i > 0; i--){
            inv.addItem(player.getItemInHand().clone());
        }
               
    String msg = "&aタイトル'&6" + handBook.getTitle() + "&a'の本を" + quantity + "冊コピーしました!";
    if (paid) msg = msg + " &c(-" + Actions.getCurrencyString(cost) + ")";
    Actions.message(null, player, msg);
View Full Code Here

        if (player != null) {
            final ItemStack stack = new ItemStack(aID, aAmount, (short) 0, data);
            final PlayerInventory inventory = player.getInventory();
            final int maxStackSize = stack.getMaxStackSize();
            if (stack.getAmount() <= maxStackSize)
                inventory.addItem(stack);
                final int amount = stack.getAmount();
                final int quotient = amount / maxStackSize;
                final int remainder = amount % maxStackSize;
                for (int i = 0; i < quotient; i++)
                    inventory.addItem(new ItemStack(aID, maxStackSize, (short) 0, data));
View Full Code Here

                inventory.addItem(stack);
                final int amount = stack.getAmount();
                final int quotient = amount / maxStackSize;
                final int remainder = amount % maxStackSize;
                for (int i = 0; i < quotient; i++)
                    inventory.addItem(new ItemStack(aID, maxStackSize, (short) 0, data));
                if (remainder > 0)
                    inventory.addItem(new ItemStack(aID, remainder, (short) 0, data));
                return true;
            }
        return false;
View Full Code Here

                final int quotient = amount / maxStackSize;
                final int remainder = amount % maxStackSize;
                for (int i = 0; i < quotient; i++)
                    inventory.addItem(new ItemStack(aID, maxStackSize, (short) 0, data));
                if (remainder > 0)
                    inventory.addItem(new ItemStack(aID, remainder, (short) 0, data));
                return true;
            }
        return false;
    }
View Full Code Here

    pinv.setLeggings(getLeggings() == null ? null : cloneItem(apl, getLeggings()));
    pinv.setBoots(getBoots() == null ? null : cloneItem(apl, getBoots()));

    // give items (cloned, adjusted)
    for (ItemStack item : getGear())
      pinv.addItem(cloneItem(apl, item));

    // assign potion effects
    for (PotionEffect effect : getPotionEffects())
      pl.addPotionEffect(effect, true);
  }
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.