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

Solved InvMenu

Discussion in 'Development' started by FELQQZ, Jan 31, 2019.

  1. FELQQZ

    FELQQZ Spider

    Messages:
    6
    My code :
    <?php
    namespace Test;

    use muqsit\invmenu\{InvMenu, InvMenuHandler};
    use pocketmine\command\{Command, CommandSender};
    use pocketmine\item\Item;
    use pocketmine\nbt\BigEndianNBTStream;
    use pocketmine\nbt\tag\{CompoundTag, ListTag};
    use pocketmine\Player;
    use pocketmine\plugin\PluginBase;
    use pocketmine\utils\{Config, TextFormat as TF};

    class Main extends PluginBase{

    public function onEnable() : void{

    if(!InvMenuHandler::isRegistered()){
    InvMenuHandler::register($this);
    }

    $menu = InvMenu::create(InvMenu::TYPE_CHEST)
    ->readonly()
    ->setName("The Inventory's Name")
    ->setListener([$this, "handleMenuSelection"]);

    $inv = $menu->getInventory();
    $item = Item::get(Item::STONE);
    $item->setCustomName("Click ME!");
    $inv->setItem(0, $item);
    }

    public function handleMenuSelection(Player $player, Item $itemClicked) : bool{
    if($itemClicked->getId() === Item::STONE){
    $player->getServer()->dispatchCommand($player, "say Hi");
    }
    return true;
    }

    public function onCommand(CommandSender $sender, Command $cmd, string $label, array $args) : bool {

    switch($cmd->getName()){

    case "menu":
    $menu->send($player);
    break;
    }
    }
    }

    My problem :

    [16:49:02] [Server thread/CRITICAL]: Error: "Class 'muqsit\invmenu\InvMenuHandler' not found" (EXCEPTION) in "plugins/Test_v1/src/Test/Main" at line 17
    [16:49:02] [Server thread/DEBUG]: #0 src/pocketmine/plugin/PluginBase(123): Test\Main->onEnable()
    [16:49:02] [Server thread/DEBUG]: #1 src/pocketmine/plugin/PluginManager(587): pocketmine\plugin\PluginBase->setEnabled(boolean 1)
    [16:49:02] [Server thread/DEBUG]: #2 src/pocketmine/Server(2003): pocketmine\plugin\PluginManager->enablePlugin(Test\Main object)
    [16:49:02] [Server thread/DEBUG]: #3 src/pocketmine/Server(1989): pocketmine\Server->enablePlugin(Test\Main object)
    [16:49:02] [Server thread/DEBUG]: #4 src/pocketmine/Server(1783): pocketmine\Server->enablePlugins(integer 1)
    [16:49:02] [Server thread/DEBUG]: #5 src/pocketmine/PocketMine(249): pocketmine\Server->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, string C:\Users\leora\Desktop\D..veloppement\PocketMine-MP\, string C:\Users\leora\Desktop\D..veloppement\PocketMine-MP\plugins\)
    [16:49:02] [Server thread/DEBUG]: #6 (1): require(string phar://C:/Users/leora/Desktop/D..veloppement/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/PocketMine.php)
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Are you running the virion from source?
     
    FELQQZ likes this.
  3. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    Is the "InvMenu" plugin loaded?
     
    FELQQZ likes this.
  4. FELQQZ

    FELQQZ Spider

    Messages:
    6
    No the plugin does not load but the API is good.
     
  5. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    FELQQZ likes this.
  6. FELQQZ

    FELQQZ Spider

    Messages:
    6
  7. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    @Muqsit
     
    FELQQZ likes this.
  8. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    Download https://poggit.pmmp.io/r/34000/DEVirion.phar put it in plugins/
    Put this https://poggit.pmmp.io/r/50229/InvMenu_dev-45.phar on virions/

    I think that how it works(I don’t use that virions)
     
    FELQQZ and Muqsit like this.
  9. FELQQZ

    FELQQZ Spider

    Messages:
    6
    xXNiceAssassinlo YT likes this.
  10. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    By the way, if you want to use InvMenu in your plugin that's in .phar format, you can run the following:
    Code:
    bin/php7/bin/php virions/InvMenu.phar /path/to/your/plugin.phar
    
    That will inject the InvMenu virion into your phar plugin.
     
    FELQQZ and xXNiceAssassinlo YT like this.
  11. FELQQZ

    FELQQZ Spider

    Messages:
    6
    Okay, thanks ^^
     
    Muqsit and xXNiceAssassinlo YT like 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.