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

Creative Mode limit

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

  1. sdsd16

    sdsd16 Spider Jockey

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

    Muqsit Chicken

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

    sdsd16 Spider Jockey

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

    Muqsit Chicken

    Messages:
    1,548
    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 Jockey

    Messages:
    41
    GitHub:
    Danding1314
    Thanks a lot
     
  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.