Package org.bukkit.inventory

Examples of org.bukkit.inventory.ItemStack.clone()


    stack = player.getInventory().getChestplate();
    if (stack != null)
      copiedInventory.add(new InventoryEntry(CHESTPLATE, stack.clone()));
    stack = player.getInventory().getLeggings();
    if (stack != null)
      copiedInventory.add(new InventoryEntry(LEGGINGS, stack.clone()));
    stack = player.getInventory().getBoots();
    if (stack != null)
      copiedInventory.add(new InventoryEntry(BOOTS, stack.clone()));
   
    // remove old entry, if needed
View Full Code Here


    stack = player.getInventory().getLeggings();
    if (stack != null)
      copiedInventory.add(new InventoryEntry(LEGGINGS, stack.clone()));
    stack = player.getInventory().getBoots();
    if (stack != null)
      copiedInventory.add(new InventoryEntry(BOOTS, stack.clone()));
   
    // remove old entry, if needed
    if (playerInventories.containsKey(player))
      playerInventories.remove(player);
   
View Full Code Here

            if (toAdd > 0) {
                // Look for empty slots to add to
                for (int j = 0; toAdd > 0 && j < getSize(); ++j) {
                    if (slots[j] == null) {
                        int num = toAdd > maxStackSize ? maxStackSize : toAdd;
                        slots[j] = item.clone();
                        slots[j].setAmount(num);
                        toAdd -= num;
                    }
                }
            }
View Full Code Here

                }
            }

            if (toAdd > 0) {
                // Still couldn't stash them all.
                result.put(i, item.clone());
            }
        }

        return result;
    }
View Full Code Here

     * Update the given slot with the current value from the inventory.
     * @param slot The slot to update.
     */
    private void updateItem(int slot) {
        ItemStack source = getItem(slot);
        slots[slot] = source == null ? null : source.clone();
    }

    /**
     * Check for changes in the inventory view.
     * @return The list of changed items.
View Full Code Here

     * Update the given slot with the current value from the view.
     * @param slot The slot to update.
     */
    private void updateItem(int slot) {
        ItemStack source = view.getItem(slot);
        slots[slot] = source == null ? null : source.clone();
    }

    /**
     * Check for changes in the inventory view.
     * @return The list of changed items.
View Full Code Here

        if (is == null || is.getTypeId() == 0) {
          throw new MissingOrIncorrectArgumentException (Term.ITEM_MISSING.get());
        }

        // if the id already exists, the ShopHandler will set a new one
        DisplayShop  shop  = new DisplayShop(UUID.randomUUID(), player.getName(), null, is.clone());
       
        shop.setAmount  (0);
        shop.setPrice  (0);
       
        scs.addTodo(player, new Todo(player, Type.CREATE, shop, 0, null));
View Full Code Here

        if (is == null || is.getTypeId() == 0) {
          throw new MissingOrIncorrectArgumentException (Term.ITEM_MISSING.get());
        }

        // if the id already exists, the ShopHandler will set a new one
        SellShop  shop  = new SellShop(UUID.randomUUID(), player.getName(), null, is.clone());
       
        shop.setAmount    (amount);
        shop.setUnlimited  (unlimited);
        shop.setPrice    (price);
View Full Code Here

          throw new MissingOrIncorrectArgumentException (Term.ITEM_MISSING.get()+",is="+is+",ex="+ex);
        }
       

        // if the id already exists, the ShopHandler will set a new one
        ExchangeShop  shop  = new ExchangeShop(UUID.randomUUID(), player.getName(), null, is.clone(), ex.clone());
       
        shop.setAmount    (amount);
        shop.setUnlimited  (unlimited);
        shop.setPrice    (price);
View Full Code Here

        if (is == null || is.getTypeId() == 0) {
          throw new MissingOrIncorrectArgumentException (Term.ITEM_MISSING.get());
        }

        // if the id already exists, the ShopHandler will set a new one
        BuyShop  shop  = new BuyShop(UUID.randomUUID(), player.getName(), null, is.clone());
       
        shop.setMaxAmount  (amount);
        shop.setUnlimited  (unlimited);
        shop.setPrice    (price);
       
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.