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

Solved InvMenu

Discussion in 'Plugin Help' started by dygecogy, Jun 23, 2021.

  1. dygecogy

    dygecogy Spider

    Messages:
    14
    How do I turn off getting items from the GUI in the InvMenu plugin?
     
  2. Axon

    Axon Zombie

    Messages:
    276
    I believe you are trying to cancel a transaction.
    An example from InvMenu could work
    PHP:
    $menu->setListener(function(InvMenuTransaction $transaction) : InvMenuTransactionResult{
        if(
    $transaction->getItemClicked()->getId() === ItemIds::APPLE){
            
    $player->sendMessage("You cannot take apples out of that inventory.");
            return 
    $transaction->discard();
        }
        return 
    $transaction->continue();
    });
     
    Agent likes this.
  3. Axon

    Axon Zombie

    Messages:
    276
    Source: https://github.com/Muqsit/InvMenu
     
    Agent likes this.
  4. dygecogy

    dygecogy Spider

    Messages:
    14
    I want the GUI to be read only.
     
  5. Axon

    Axon Zombie

    Messages:
    276
    Agent likes this.
  6. dygecogy

    dygecogy Spider

    Messages:
    14
    SOLVED :)

    PHP:
    $menu->setListener(InvMenu::readonly());
     
    Axon likes this.
  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.