mercredi 19 août 2015

IllegalArgumentException: Bound must be positive

I got this error saying that my bound must be positive. Here is the line I get the error on:

                inv.setItem(i, items.get(r.nextInt(items.size())));

As far as I know, it comes from the part where I request a random integer from the list of items. This is how I defined the list:

        List<ItemStack> items = getAllItems(level);

where the getAllItems method looks like:

    public List<ItemStack> getAllItems(int level) {
        List<ItemStack> items = new ArrayList<ItemStack>();
        for (String item : settings.getChests().getStringList("chestitems." + level)) {
            ItemStack toAdd = parseItem(item);
            items.add(toAdd);
        }
        return items;
    }

FYI, this is the stacktrace I am getting: http://ift.tt/1Nli7dU




Aucun commentaire:

Enregistrer un commentaire