@Nullable @Override public ItemStack getItemStack(int amount) { ItemStack newItem = InventoryUtils.getCopy(item); if (newItem == null) { return null; } newItem.setAmount(amount); return newItem; }
@Override public com.elmakers.mine.bukkit.api.wand.Wand duplicate() { ItemStack newItem = InventoryUtils.getCopy(item); Wand newWand = controller.getWand(newItem); newWand.saveState(); return newWand; }
public boolean onItemDuplicate(Player player, ItemStack item) { ItemStack newItem = InventoryUtils.getCopy(item); api.giveItemToPlayer(player, newItem); player.sendMessage(api.getMessages().get("item.duplicated")); return true; }
schematicItem = schematics.get(0); } else if (schematics.size() > 0) { schematicItem = InventoryUtils.getCopy(schematics.get(0)); ItemMeta meta = schematicItem.getItemMeta(); meta.setDisplayName(context.getMessage("schematics_name", "" + ChatColor.AQUA + "Schematics"));
continue; ItemStack item = InventoryUtils.getCopy(shopItem.getItem()); if (item == null) continue;
ItemStack worthItem = getWorthItem(controller); while (amount > 0) { worthItem = InventoryUtils.getCopy(worthItem); worthItem.setAmount(Math.min(amount, 64)); amount -= worthItem.getAmount();
@Override public SpellResult perform(CastContext context) { if (item == null) { return SpellResult.FAIL; } Entity targetEntity = context.getTargetEntity(); if (targetEntity == null) { return SpellResult.NO_TARGET; } if (!(targetEntity instanceof Player)) { return SpellResult.PLAYER_REQUIRED; } MageController controller = context.getController(); Player player = (Player)targetEntity; if (permissionNode != null && !player.hasPermission(permissionNode)) { return SpellResult.INSUFFICIENT_PERMISSION; } if (requireItem != null && !controller.takeItem(player, requireItem)) { context.showMessage("insufficient_resources", "You must have a $requires"); return SpellResult.INSUFFICIENT_RESOURCES; } Mage mage = controller.getMage(player); mage.giveItem(InventoryUtils.getCopy(item)); DeprecatedUtils.updateInventory(player); return SpellResult.CAST; }
ItemStack copy = InventoryUtils.getCopy(item); mage.giveItem(copy, putInHand);
ItemStack copy = InventoryUtils.getCopy(item); if (filterBound && com.elmakers.mine.bukkit.wand.Wand.isBound(copy)) { Wand bindWand = controller.getWand(copy);
wearItem = InventoryUtils.getCopy(item); materialName = context.getController().describeItem(wearItem);