how i check if the item I dropped had a specific display name

Discussion in 'Spigot Plugin Development' started by SandroSF, Jul 6, 2019.

  1. Code (Java):

       //Exemple(this not found)

        if(e.getItemDrop().getItemStack().getItemMeta().getDisplayName().equals("1 M$")){

  2. What's the problem here?
  3. Use ItemDropEvent?
    • Agree Agree x 1
  4. yes
  5. ???
    Whats your current error or what doesnt work?
  6. not found, this if return false
  7. Your item name contains colors? If so use ChatColor#stripColor
    • Like Like x 1
  8. You had already forgotten the power, thank you, do you know how to verify the enchantment?
  9. Strahan


    #9 Strahan, Jul 7, 2019
    Last edited: Jul 7, 2019
  10. Isn't ItemStack#getEnchantments() the right one to use? I feel like i remember editing enchantments using the ItemMeta doesn't work, or something like that.
    • Agree Agree x 1
  11. Strahan


    Ah, I forgot ItemStack had a get enchantments option. That'd be easier for sure.