mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-17 04:06:54 +00:00
Fixed request rejecting
This commit is contained in:
@@ -541,7 +541,10 @@ class InGamePacketHandler extends PacketHandler{
|
||||
$this->session->getLogger()->debug(implode("\n", Utils::printableExceptionInfo($e)));
|
||||
}
|
||||
|
||||
return $executor->buildItemStackResponse($result);
|
||||
if(!$result){
|
||||
return new ItemStackResponse(ItemStackResponse::RESULT_ERROR, $request->getRequestId());
|
||||
}
|
||||
return $executor->buildItemStackResponse();
|
||||
}
|
||||
|
||||
public function handleItemStackRequest(ItemStackRequestPacket $packet) : bool{
|
||||
|
@@ -349,12 +349,12 @@ final class ItemStackRequestExecutor{
|
||||
return $transaction;
|
||||
}
|
||||
|
||||
public function buildItemStackResponse(bool $success) : ItemStackResponse{
|
||||
public function buildItemStackResponse() : ItemStackResponse{
|
||||
$builder = new ItemStackResponseBuilder($this->request->getRequestId(), $this->inventoryManager);
|
||||
foreach($this->requestSlotInfos as $requestInfo){
|
||||
$builder->addSlot($requestInfo->getContainerId(), $requestInfo->getSlotId());
|
||||
}
|
||||
|
||||
return $builder->build($success);
|
||||
return $builder->build();
|
||||
}
|
||||
}
|
||||
|
@@ -65,7 +65,7 @@ final class ItemStackResponseBuilder{
|
||||
return [$inventory, $slot];
|
||||
}
|
||||
|
||||
public function build(bool $success) : ItemStackResponse{
|
||||
public function build() : ItemStackResponse{
|
||||
$responseInfosByContainer = [];
|
||||
foreach($this->changedSlots as $containerInterfaceId => $slotIds){
|
||||
if($containerInterfaceId === ContainerUIIds::CREATED_OUTPUT){
|
||||
@@ -107,6 +107,6 @@ final class ItemStackResponseBuilder{
|
||||
$responseContainerInfos[] = new ItemStackResponseContainerInfo($containerInterfaceId, $responseInfos);
|
||||
}
|
||||
|
||||
return new ItemStackResponse($success ? ItemStackResponse::RESULT_OK : ItemStackResponse::RESULT_ERROR, $this->requestId, $responseContainerInfos);
|
||||
return new ItemStackResponse(ItemStackResponse::RESULT_OK, $this->requestId, $responseContainerInfos);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user