[Unsolved] ItemStack help...

Discussion in 'Plugin Development' started by ASHninja1997, Aug 1, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    ASHninja1997

    So I made a plugin that stores a ItemStack hashmap that is made up of flint. I renamed the flint to ChatColor.YELLOW + "Ammo" when the player gets it. Then the player is given a hoe. That hoe use's flint for it's power...but the only problem is, is that it's not detecting it, so the hoe won't work. The code below shows how I stored the Flint and how the hoe checks for flint.
    Code:
    List<String> ls2 = new ArrayList<String>();
    ls2.add(ChatColor.BOLD + "SnipeCraft");
    ls2.add(ChatColor.GREEN + "Ammo for Hoes");
    ItemStack f = cname(new ItemStack(Material.FLINT, 128), ChatColor.YELLOW + "Flint", ls2);
    flint.put(p.getName(), f);
    
    How it checks for flint
    Code:
    if (!p.getInventory().containsAtLeast(
                            new ItemStack(Material.FLINT), 1)) {
    //Tell the player they need more flint
    }
    All I am asking for why this won't work and see if it can be fixed. Again the problem is that it won't detect the flint in the player's inventory if it is named something else, in this case Ammo.
     
  2. Offline

    tommycake50

    Code:
    if (!p.getInventory().containsAtLeast(
                            cname(new ItemStack(Material.FLINT, 128), ChatColor.YELLOW + "Flint", ls2)) {
    //Tell the player they need more flint
    }
    its got metadata, i guess it checks that too?
     
Thread Status:
Not open for further replies.

Share This Page