Solved Not getting full amount of itemstack

Discussion in 'Spigot Plugin Development' started by TheWackyTV, Dec 8, 2017.

Thread Status:
Not open for further replies.
  1. Hi.

    I have a Kit Plugin where I get the items from a config via this method:
    Code (Text):
    private List<ItemStack> getItems(String kit) {
            if (!Core.kits.contains("kits." + kit)) {
                return null;
            }
            List<ItemStack> itemStacks = new ArrayList<>();
            for (String s : Core.kits.getConfigurationSection("kits." + kit + ".items").getKeys(false)) {
                itemStacks.add(Core.kits.getItemStack("kits." + kit + ".items." + s));
            }

            return itemStacks;
        }
    Although when I should get 64 arrows I'm only getting 2 or 3 / another random number, and I can't see why.

    Code (Text):
        items:
          '0':
            ==: org.bukkit.inventory.ItemStack
            type: DIAMOND_SWORD
          '1':
            ==: org.bukkit.inventory.ItemStack
            type: FISHING_ROD
          '2':
            ==: org.bukkit.inventory.ItemStack
            type: BOW
          '3':
            ==: org.bukkit.inventory.ItemStack
            type: ARROW
            amount: 64
          '4':
            ==: org.bukkit.inventory.ItemStack
            type: COOKED_BEEF
            amount: 64
          '5':
            ==: org.bukkit.inventory.ItemStack
            type: DIAMOND_HELMET
          '6':
            ==: org.bukkit.inventory.ItemStack
            type: DIAMOND_CHESTPLATE
          '7':
            ==: org.bukkit.inventory.ItemStack
            type: DIAMOND_LEGGINGS
          '8':
            ==: org.bukkit.inventory.ItemStack
            type: DIAMOND_BOOTS
     
  2. Maybe just your kit plugin not functioning correctly.
     
  3. Well, I think if it did work correctly (s)he wouldn't have made the post in the first place.
     
    • Agree Agree x 1
  4. I am aware of that, but I'm looking for the error.
     
  5. Do you mind posting the Core.kits.getItemStack() method? Something might go wrong in that method when the itemstack is created.
     
  6. It’s exactly how the normal method for getConfig is.
     
  7. Well can you post it? The code in your original post doesn't really show me much about what could go wrong, other than that the keys of the config file could somehow be related to the amount of items in the itemstack.
     
  8. If you can do /give try to do for example /give stone 64. If it only gives you 2 it means the max things you can get in your server is 2.
     
  9. Used your code, seemed to have gotten it fine.
    [​IMG]
     
    • Like Like x 1
  10. Thanks for your help.

    I don't know what was wrong, but it works now.
     
Thread Status:
Not open for further replies.