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

Get the item amount from inventory

Comments in 'Plugin Development' started by IcePL, Apr 22, 2016.

  1. IcePL
    Offline

    IcePL New Member

    Joined:
    Feb 16, 2016
    Posts:
    73
    Minecraft User:
    IcePL
    Hi!
    I need help, how to heck if player has get ex. 30 diamonds on inventory (not in hand) and send message like: "you got a 30 diamonds"?
  2. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    PHP:
    Foreach ( $inventory->getContents()  as  $inv ):
    if(
    $inv->getId() == 264 && $inv->getCount() >= 30 ){
    # here code
    }
    endforeach;
    Last edited: Apr 23, 2016
  3. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    End foreach?
  4. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    What !!

Share This Page

Advertisement