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
200 stars 75 forks source link

removeWindow() Crashes minecraft #84

Closed Itzdvbravo closed 4 years ago

Itzdvbravo commented 4 years ago
public function firstCheck(Player $player, Item $itemTakenOut, Item $itemPutIn, SlotChangeAction $inventoryAction){  
        if (!$itemTakenOut->isNull()){  
            var_dump($inventoryAction->getSlot());  
            if ($inventoryAction->getSlot() !== 22 && $inventoryAction->getSlot() !== 23){  
                return false;  
            } elseif ($inventoryAction->getSlot() === 22) {  
                unset($this->player[$player->getName()]);  
            } elseif ($inventoryAction->getSlot() === 23 && !isset($this->player[$player->getName()])){  
                $player->removeWindow($inventoryAction->getInventory());  
                $player->sendMessage(TextFormat::RED."Add an item to tinker");  
            } else {  
                $player->sendMessage("OK");  
            }  
        }  
        if (!$itemPutIn->isNull()){  
            if (!Utils::itemMatchesItemType($itemPutIn, CustomEnchants::ITEM_TYPE_WEAPON) &&  
                !Utils::itemMatchesItemType($itemPutIn, CustomEnchants::ITEM_TYPE_ARMOR) &&  
                !Utils::itemMatchesItemType($itemPutIn, CustomEnchants::ITEM_TYPE_TOOLS)){  
                var_dump((!Utils::itemMatchesItemType($itemPutIn, CustomEnchants::ITEM_TYPE_WEAPON) &&  
                    !Utils::itemMatchesItemType($itemPutIn, CustomEnchants::ITEM_TYPE_ARMOR) &&   
                    !Utils::itemMatchesItemType($itemPutIn, CustomEnchants::ITEM_TYPE_TOOLS)));  
                return false;  
            }  
            $this->player[$player->getName()] = $itemPutIn;  
        }  
        return true;  
    }

the $player->removeWindow($inventoryAction->getInventory()); part, the message is send in the part and then after 1 second, the minecraft just freezes and it closes.

Muqsit commented 4 years ago

Yeah its an issue with the game, InvCrashFix may fix it