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.
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.