Skip to content

Bug when trying to open an inventory #261

Description

@etandelabie

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);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions