Check player inv and check level enchant

Discussion in 'Development' started by ZackyVN, Nov 26, 2018.

  1. ZackyVN

    ZackyVN Silverfish

    Messages:
    24
    How to check player inv. If inside a player inv has a item with level enchant > 10 it will automatic delete it?
     
  2. wolfdale

    wolfdale Baby Zombie

    Messages:
    148
    PHP:
    foreach($player->getInventory()->getContents() as $index => $item)
    foreach(
    $item->getEnchantments() as $enchant)
    if(
    $enchant->getLevel() > 10){
    $player->getInventory()->clear($index);
    break;
    }
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.