ItemStack different from Material

Discussion in 'Spigot Plugin Development' started by John_H_Smith, Jul 14, 2019 at 12:44 PM.

Thread Status:
Not open for further replies.
  1. Hi guys,
    I've got a strange error:
    after printing the whole ItemStack, it says for example I
    Code (Text):
    ItemStack{STRIPPED_OAK_LOG x 1}
    .
    If I am using
    Code (Text):
    itemStack.getType().toString()
    with exact the same ItemStack, it says AIR.
    How can that be?

    Here is the full code:
    Code (Text):
    @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        Player player = (Player) event.getWhoClicked();    

        ItemStack item = event.getCursor();
        player.sendMessage(item.toString());
        player.sendMessage(item.getType().toString());
    }
     
  2. Show full code pls
     
  3. I just edited the post.
     
  4. Try with item.getType().name()?

    Also, what version do you use?
     
  5. Its just the same.
    Version is latest stable (1.13.2)
     
  6. Everything looks fine here:
    [​IMG]
    Probably non updated code?
     
  7. @MrMaurice211 no, its the right one. Just try with spilled blocks for example.
     
    #7 John_H_Smith, Jul 14, 2019 at 1:11 PM
    Last edited: Jul 14, 2019 at 1:20 PM
  8. You need to set the "api-version" on your plugin yml to get all 1.13 materials
     
  9. You're right! Thank you very much!
     
Thread Status:
Not open for further replies.