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

Solved InvMenu helpp

Discussion in 'Development' started by Levi, Jul 4, 2018.

  1. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    PHP:

    public function onTap (PlayerInteractEvent $event){

    $player=$event->getPlayer();

    $menu InvMenu::create(InvMenu::TYPE_CHEST);

    $menu->getInventory()->setContents([
        
    Item::get(Item::DIAMOND_SWORD),
        
    Item::get(Item::DIAMOND_PICKAXE)
    ]);

    $menu->readonly();

    $menu->send($player);

    }
    I read the InvMenu doc and readOnly() is supposed to stop players from taking items from the chest but i could still take items from the chest
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    I can't reproduce this under any possible circumstance. Are you sure...
    Screenshot_20180704-193621_Chrome.jpg
     
  3. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    i dont have any plugin listening to inventory stuff.
     
  4. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    In that case,
    Have you registered the InvMenuHandler? Are you using the up-to-date version of InvMenu?
     
  5. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    no i havent registered InvMenuHandler. my goal is only to show players inside the chest. and yes im using up-to-date version of InvMenu
     
  6. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    You will still need to register the InvMenuHandler. There's no way for InvMenu to register an event listeners without a helping hand from a plugin. It needs to register it's InventoryTransactionEvent.
     
    jasonwynn10 and corytortoise like this.
  7. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    This was previously not the case, but due to inaccuracies, it became mandatory to register the InvMenuHandler even for readonly.
     
  8. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    i dont see that in the wiki. where?
     
  9. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    isee it. 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.