if an inventory contains an item..

Discussion in 'Plugin Development' started by Relentless_x, Feb 28, 2011.

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

    Relentless_x

    i feel like an idiot asking this but this code:
    Code:
           public boolean hasItem(String item, int amount, Player player) {
                int id;
                boolean contains = contains(id, amount);
                if (contains == true){
                    return true;
                }
            }
    doesn't recognise contains() method i sort of know why but how do i get it to work?
     
  2. Offline

    WMisiedjan

    public boolean hasItem(String item, int amount, Player player) { int id; boolean contains = player.getInventory().contains(id,amount); if (contains == true){ return true; } }

    contains() isn't a function itself. it's in getInventory(). See the highlighted line!
     
  3. Offline

    Relentless_x

    thanks a lot <3 thats what i thought to do but i didnt know the "path" to use (player.getInventory() ) hpw can i find this out for future reference?
     
Thread Status:
Not open for further replies.

Share This Page