Solved IF isn't working properly

Discussion in 'Spigot Plugin Development' started by BumseBine, Jul 13, 2018.

  1. Hello,
    I'm trying to do a check if a player has a specific item in his inventory. My if case isn't working
    Code (Java):
    if(p.getInventory().contains(new ItemStack(Material.CLAY_BRICK, 2))) {
    I'm getting no errors and everything else is working. Just this if case skips to the else statements.
     
  2. MiniDigger

    Supporter

    If you want to check the amount, use this method https://hub.spigotmc.org/javadocs/b...#contains-org.bukkit.inventory.ItemStack-int-
     
  3. Thank you very much