The constructor ItemStack(int, int, byte) is undefined

Discussion in 'Spigot Plugin Development' started by Invaerne, Jul 22, 2018.

Thread Status:
Not open for further replies.
  1. Hi guys, could someone help me with the following error please?
    • The constructor ItemStack(int, int, byte) is undefined
    The error occurs one the following line: ItemStack stack = new ItemStack(material.getId(), amount, data);

    Code (Text):
            @SuppressWarnings("deprecation")
            public ItemStack newItemStack(int amount) {
                ItemStack stack = new ItemStack(material.getId(), amount, data);
                return stack;
            }
           
     
    • Funny Funny x 1
  2. Don't be shy and please do feel free to consider wider explanation.
     
  3. What more do you want? i gave you a link to the javadocs that explain everything
     
    • Funny Funny x 2
  4. The JavaDocs don't show a constructor that matches ItemStack(int, int, byte). Either you're not using the correct version of the BukkitAPI, or that constructor has never existed. Since you already have a variable named "material" which is of the Material type, the simplest solution would be to just use the constructor ItemStack(Material type, int amount, short damage, java.lang.Byte data) or ItemStack(Material type, int amount, short damage).
     
    • Informative Informative x 3
  5. - Excuse me, which way is it to London?
    - Look at the map, figure it out yourself.

    Thanks buddy.
     
    • Funny Funny x 1
    • Friendly Friendly x 1
Thread Status:
Not open for further replies.