mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-09 11:16:57 +00:00
NetworkSession: Fixed InventoryManager nullability disaster
fixes #4277 fixes #4275 fixes #3139
This commit is contained in:
@ -39,6 +39,7 @@ use pocketmine\item\ItemFactory;
|
||||
use pocketmine\item\ItemIds;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\nbt\tag\IntTag;
|
||||
use pocketmine\network\mcpe\InventoryManager;
|
||||
use pocketmine\network\mcpe\protocol\types\GameMode as ProtocolGameMode;
|
||||
use pocketmine\network\mcpe\protocol\types\inventory\ContainerIds;
|
||||
use pocketmine\network\mcpe\protocol\types\inventory\ItemStack;
|
||||
@ -240,7 +241,7 @@ class TypeConverter{
|
||||
/**
|
||||
* @throws \UnexpectedValueException
|
||||
*/
|
||||
public function createInventoryAction(NetworkInventoryAction $action, Player $player) : ?InventoryAction{
|
||||
public function createInventoryAction(NetworkInventoryAction $action, Player $player, InventoryManager $inventoryManager) : ?InventoryAction{
|
||||
if($action->oldItem->getItemStack()->equals($action->newItem->getItemStack())){
|
||||
//filter out useless noise in 1.13
|
||||
return null;
|
||||
@ -276,7 +277,7 @@ class TypeConverter{
|
||||
}
|
||||
[$slot, $window] = $mapped;
|
||||
}else{
|
||||
$window = $player->getNetworkSession()->getInvManager()->getWindow($action->windowId);
|
||||
$window = $inventoryManager->getWindow($action->windowId);
|
||||
$slot = $action->inventorySlot;
|
||||
}
|
||||
if($window !== null){
|
||||
|
Reference in New Issue
Block a user