mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-03 16:49:53 +00:00
InGamePacketHandler: added an extra check
This commit is contained in:
parent
b744e09352
commit
47f0119660
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user