1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Disable Chest break if it has items in it

Discussion in 'Plugin Help' started by Mr174, Feb 2, 2020.

  1. Mr174

    Mr174 Baby Zombie

    Messages:
    187
    GitHub:
    mr174
    I honesty don't know if this is possible but does anyone have an idea where to start?
     
  2. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    something like this should work
    PHP:
    //BlockBreakEvent $event
    $chestTile $event->getBlock()->getLevel()->getTile($event->getBlock());
    if(
    $chestTile instanceof \pocketmine\tile\Chest && count($chestTile->getInventory()->getContents()) > 0)
        
    $event->setCancelled();
     
    HimbeersaftLP and Mr174 like this.
  3. Mr174

    Mr174 Baby Zombie

    Messages:
    187
    GitHub:
    mr174
    Ill check it out! thanks
     
  4. Mr174

    Mr174 Baby Zombie

    Messages:
    187
    GitHub:
    mr174
    It worked! Thanks!
     
  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.