Creative Mode limit

Discussion in 'Development' started by sdsd16, Jan 1, 2019.

  1. sdsd16

    sdsd16 Spider

    Messages:
    8
    GitHub:
    Danding1314
    How to limit Creative mode player when they are opening funnel or chest ~
     
  2. Muqsit

    Muqsit Wither Skeleton Verified

    Messages:
    1,441
    GitHub:
    muqsit
    Limit in what way? Opening them, breaking them, placing them...?
     
  3. sdsd16

    sdsd16 Spider

    Messages:
    8
    GitHub:
    Danding1314
    Don't let them open chest or funnel when their gamemode are creative
     
  4. Muqsit

    Muqsit Wither Skeleton Verified

    Messages:
    1,441
    GitHub:
    muqsit
    Handle InventoryOpenEvent.
    Do you mean hopper when you say funnel, or is it a typo for furnace (pocketmine doesn't have hoppers)?
    PHP:
    $inventory $event->getInventory();
    if(
    $inventory instanceof ChestInventory or $inventory instanceof FurnaceInventory){
        
    $event->setCancelled();
    }
     
  5. sdsd16

    sdsd16 Spider

    Messages:
    8
    GitHub:
    Danding1314
    Thanks a lot
     

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.