InGamePacketHandler: added an extra check

This commit is contained in:
Dylan K. Taylor 2024-02-26 14:35:21 +00:00
parent b744e09352
commit 47f0119660
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -869,8 +869,12 @@ class InGamePacketHandler extends PacketHandler{
}
public function handleBookEdit(BookEditPacket $packet) : bool{
$inventory = $this->player->getInventory();
if(!$inventory->slotExists($packet->inventorySlot)){
return false;
}
//TODO: break this up into book API things
$oldBook = $this->player->getInventory()->getItem($packet->inventorySlot);
$oldBook = $inventory->getItem($packet->inventorySlot);
if(!($oldBook instanceof WritableBook)){
return false;
}