im having trouble with my plugin im developing, im not really good with arrays so im wondering if anyone is good with mine-craft and can help me with this :).
so what im having trouble with is adding ItemStacks or combining them. I i want pot to add contents of temp to its ItemStack[].
 ItemStack[] temp;
 ItemStack[] pot;
public void openPot(Player player)
    {   
        player.openInventory(inve());
    }
public Inventory inve()
    {
        Inventory inv = Bukkit.createInventory(null, 45, ChatColor.DARK_GREEN + "Pot");//second parameter is how many slots, divisibile by 9
        inv.setContents(temp);
        pot = inv.getStorageContents();
        inv.setContents(pot);
        temp = null;
        //inv.addItem(items);
        return inv;
    }
public Inventory joinPot()
    {
        Inventory inv = Bukkit.createInventory(null, 45, ChatColor.DARK_GREEN + "Gamble");//second parameter is how many slots, divisibile by 9
        ItemStack cancel = new ItemStack(Material.REDSTONE_BLOCK);
        ItemStack Accept = new ItemStack(Material.EMERALD_BLOCK);
        ItemMeta cancelMeta = cancel.getItemMeta();
        ItemMeta AcceptMeta = Accept.getItemMeta();
        cancelMeta.setDisplayName(ChatColor.RED + "Cancel");
        AcceptMeta.setDisplayName(ChatColor.GREEN + "Accept");
        cancel.setItemMeta(cancelMeta);
        Accept.setItemMeta(AcceptMeta);
        inv.setItem(44,Accept);//setItem(slot location,item);
        inv.setItem(36, cancel);
        return inv;
    }
    //Player chooses item to join current pot
    public void openJoin(Player player)
    {
        player.openInventory(joinPot());
    }
    @EventHandler
    public void onInventoryClick(InventoryClickEvent event)
    {
        if(!ChatColor.stripColor(event.getInventory().getName()).equalsIgnoreCase("Gamble"))
            return;
        Player player = (Player) event.getWhoClicked();
        //event.setCancelled(true);
        if(event.getCurrentItem().getType() == Material.REDSTONE_BLOCK){
            player.closeInventory();
            player.sendMessage(ChatColor.RED + "Canceld Joining pot");
            return;
        }
        else if(event.getCurrentItem().getType() == Material.EMERALD_BLOCK){
**here we setting temps itemstack to whatever i placed in the chest this works**
            temp = event.getInventory().getContents();
            player.closeInventory();
            player.sendMessage(ChatColor.GREEN + "Accepting your request to join");
            //return;
        }
    }
what ends up happening is when i set the chest contents it gets rid of the old data that was there.
i just want to know how to add two ItemStack arrays Pot += temp//temp resets after every call. pot doesnt
