Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Check if player has item in his inventory

Comments in 'Plugin Development' started by Flabe, Feb 13, 2016.

  1. Flabe
    Offline

    Flabe Active Member

    Joined:
    Nov 17, 2015
    Posts:
    147
    Minecraft User:
    Flabe231
    Hello guys i have a problem , i wanna check if player has some item in his inventory , can you tell me how to do that? please)))
  2. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    $inventory->contains($item);
    PEMapModder likes this.
  3. Flabe
    Offline

    Flabe Active Member

    Joined:
    Nov 17, 2015
    Posts:
    147
    Minecraft User:
    Flabe231
    but how do i get players inventory as $inventory?
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    There is a $Player->getInventory() function. Maybe try to read the API documentation or source code yourself? Or any modern IDE can help you layout the methods declared in a class.
    PocketKiller likes this.
  5. Flabe
    Offline

    Flabe Active Member

    Joined:
    Nov 17, 2015
    Posts:
    147
    Minecraft User:
    Flabe231
    thanks )))

Share This Page

Advertisement