mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Fix crash when new players join due to attempting to send negative inventory slot
This commit is contained in:
@ -214,16 +214,13 @@ class PlayerInventory extends BaseInventory{
|
||||
|
||||
if(!is_array($target)){
|
||||
$target->dataPacket($pk);
|
||||
if($target === $this->getHolder()){
|
||||
if($this->getHeldItemSlot() !== -1 and $target === $this->getHolder()){
|
||||
$this->sendSlot($this->getHeldItemSlot(), $target);
|
||||
}
|
||||
}else{
|
||||
$this->getHolder()->getLevel()->getServer()->broadcastPacket($target, $pk);
|
||||
foreach($target as $player){
|
||||
if($player === $this->getHolder()){
|
||||
$this->sendSlot($this->getHeldItemSlot(), $player);
|
||||
break;
|
||||
}
|
||||
if($this->getHeldItemSlot() !== -1 and in_array($this->getHolder(), $target)){
|
||||
$this->sendSlot($this->getHeldItemSlot(), $this->getHolder());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user