Muqsit / InvMenu

A PocketMine-MP virion to create and manage virtual inventories!
https://poggit.pmmp.io/ci/Muqsit/InvMenu/~
GNU General Public License v3.0
201 stars 75 forks source link

Window does not appear after removed. #135

Closed ghost closed 3 years ago

ghost commented 3 years ago

The first time the player runs a command and is sent the inventory window, it works with no problem. After the window is removed, whenever the player runs the command again, the window does not appear. A chest also appears behind them, and when interacted with, disappears.

https://user-images.githubusercontent.com/60823817/111855257-33f7a000-88fa-11eb-8dc8-99aad349d61c.mp4

Muqsit commented 3 years ago

@Dapro718 Share InvMenu listener code

ghost commented 3 years ago
        $menu->setListener(InvMenu::readonly(function(DeterministicInvMenuTransaction $transaction):void{
            if($transaction->getItemClicked()->getId() === ItemIds::BOOK) {
                $transaction->getPlayer()->removeWindow($transaction->getAction()->getInventory());
                FormUI::sendHelpForm($transaction->getPlayer());
            } elseif($transaction->getItemClicked()->getId() === BlockIds::CONCRETE && $transaction->getItemClicked()->getDamage() === 14){
                $transaction->getPlayer()->removeWindow($transaction->getAction()->getInventory());
            } elseif($transaction->getItemClicked()->getId() === BlockIds::CONCRETE && $transaction->getItemClicked()->getDamage() === 15){
                $transaction->getPlayer()->removeWindow($transaction->getAction()->getInventory());
                Forms::getDatabase()->updatePlayerSetting($transaction->getPlayer(), "formui");
                $transaction->getPlayer()->sendMessage(C::colorize(
                    str_replace(["{prev_setting}". "{new_setting}"],
                        ["Inventory UI", "Form UI"],
                        Forms::getMessage("setting-changed"))
                ));
            }
        }));
Muqsit commented 3 years ago

Can you open your player inventory after clicking the red concrete?

ghost commented 3 years ago

No. This problem happens with all the items. It can be fixed by having the player leave then rejoin.

Muqsit commented 3 years ago

This sounds like a client issue likely introduced in v1.16.210

ghost commented 3 years ago

PHPStorm shows that the namespace: Ds\Queue is not found. Not sure if this effects anything.

ghost commented 3 years ago

Do you have any intentions to fix this bug?

ghost commented 3 years ago

When I use InvMenu->onClose(), the window works as expected, and players can receive more windows. The only time this issue occurs is when Player->removeWindow() is used.