InvMenu icon indicating copy to clipboard operation
InvMenu copied to clipboard

Bug when trying to open an inventory

Open noxi69 opened this issue 5 months ago • 3 comments

When I try to open an inventory with the latest version of invMenu, the inventory opens but after a few seconds, the inventory closes by itself without any action from the player...

Here is the code i use:

        $inv = InvMenu::create(InvMenuTypeIds::TYPE_DOUBLE_CHEST);
        $inv->getInventory()->setContents($player->getInventory()->getContents());
        $inv->setListener(InvMenu::readonly());
        for ($i = 36; $i < $inv->getInventory()->getSize(); $i++) {
            $inv->getInventory()->setItem($i, VanillaBlocks::STAINED_GLASS_PANE()->setColor(DyeColor::RED())->asItem());
        }
        $inv->getInventory()->setItem(47, $player->getArmorInventory()->getHelmet());
        $inv->getInventory()->setItem(48, $player->getArmorInventory()->getChestplate());
        $inv->getInventory()->setItem(50, $player->getArmorInventory()->getLeggings());
        $inv->getInventory()->setItem(51, $player->getArmorInventory()->getBoots());
        $inv->send($player);

noxi69 avatar Aug 09 '25 16:08 noxi69