mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
InGamePacketHandler: added an extra check
This commit is contained in:
@ -869,8 +869,12 @@ class InGamePacketHandler extends PacketHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function handleBookEdit(BookEditPacket $packet) : bool{
|
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
|
//TODO: break this up into book API things
|
||||||
$oldBook = $this->player->getInventory()->getItem($packet->inventorySlot);
|
$oldBook = $inventory->getItem($packet->inventorySlot);
|
||||||
if(!($oldBook instanceof WritableBook)){
|
if(!($oldBook instanceof WritableBook)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user