[SOLVED] WHY my Item buy feature don't work?

Discussion in 'Spigot Plugin Development' started by sinnlosername, May 14, 2015.

  1. I get no errors if I use the function. I only get the sound for "You havent enough Items of this typ", but I have enough of this items in my inventory :(

    Code: http://pastebin.com/FPnK5qj2
    (A little bit is on german, but the code is java[english] )
    If you understand anything not, please write me, I will translate it.#

    Thanks in Advance
     
  2. Neither Eclipse nor the Console Report Errors. I know that the code up to the last if statement in Buy void works.
    Code (Text):

    if (p.getInventory().contains(new ItemStack(mat, price))) {
                            p.getPlayer().getWorld().playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
                            p.getInventory().removeItem(new ItemStack(mat, price));
                            p.getInventory().addItem(new ItemStack(get, getwv));
                   } else {
                            p.getPlayer().getWorld().playSound(p.getLocation(), Sound.FIZZ, 1, 1);
                   }
     
    This IF statement is always recognized as wrong, although it should be right actually, when I the respective Item (brick, iron_ingot, gold_ingot) in inventory have.