mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 11:57:10 +00:00
Fixed request rejecting
This commit is contained in:
parent
eece6c4433
commit
4e55433ed8
@ -37,7 +37,7 @@
|
|||||||
"pocketmine/bedrock-block-upgrade-schema": "~1.1.1+bedrock-1.19.70",
|
"pocketmine/bedrock-block-upgrade-schema": "~1.1.1+bedrock-1.19.70",
|
||||||
"pocketmine/bedrock-data": "~2.1.1+bedrock-1.19.70",
|
"pocketmine/bedrock-data": "~2.1.1+bedrock-1.19.70",
|
||||||
"pocketmine/bedrock-item-upgrade-schema": "~1.1.0+bedrock-1.19.70",
|
"pocketmine/bedrock-item-upgrade-schema": "~1.1.0+bedrock-1.19.70",
|
||||||
"pocketmine/bedrock-protocol": "~20.0.0+bedrock-1.19.70",
|
"pocketmine/bedrock-protocol": "~20.1.0+bedrock-1.19.70",
|
||||||
"pocketmine/binaryutils": "^0.2.1",
|
"pocketmine/binaryutils": "^0.2.1",
|
||||||
"pocketmine/callback-validator": "^1.0.2",
|
"pocketmine/callback-validator": "^1.0.2",
|
||||||
"pocketmine/classloader": "^0.2.0",
|
"pocketmine/classloader": "^0.2.0",
|
||||||
|
16
composer.lock
generated
16
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "1d0c1d2fe668d85ae87110a1e3cfac05",
|
"content-hash": "01afa65b40f95ad9378c8cd999e6098d",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "adhocore/json-comment",
|
"name": "adhocore/json-comment",
|
||||||
@ -328,16 +328,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pocketmine/bedrock-protocol",
|
"name": "pocketmine/bedrock-protocol",
|
||||||
"version": "20.0.0+bedrock-1.19.70",
|
"version": "20.1.0+bedrock-1.19.70",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/pmmp/BedrockProtocol.git",
|
"url": "https://github.com/pmmp/BedrockProtocol.git",
|
||||||
"reference": "4892a5020187da805d7b46ab522d8185b0283726"
|
"reference": "91d67c8b1bced3c82d0841b1041c0c1f4e93eb68"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/4892a5020187da805d7b46ab522d8185b0283726",
|
"url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/91d67c8b1bced3c82d0841b1041c0c1f4e93eb68",
|
||||||
"reference": "4892a5020187da805d7b46ab522d8185b0283726",
|
"reference": "91d67c8b1bced3c82d0841b1041c0c1f4e93eb68",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -351,7 +351,7 @@
|
|||||||
"ramsey/uuid": "^4.1"
|
"ramsey/uuid": "^4.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpstan/phpstan": "1.10.1",
|
"phpstan/phpstan": "1.10.7",
|
||||||
"phpstan/phpstan-phpunit": "^1.0.0",
|
"phpstan/phpstan-phpunit": "^1.0.0",
|
||||||
"phpstan/phpstan-strict-rules": "^1.0.0",
|
"phpstan/phpstan-strict-rules": "^1.0.0",
|
||||||
"phpunit/phpunit": "^9.5"
|
"phpunit/phpunit": "^9.5"
|
||||||
@ -369,9 +369,9 @@
|
|||||||
"description": "An implementation of the Minecraft: Bedrock Edition protocol in PHP",
|
"description": "An implementation of the Minecraft: Bedrock Edition protocol in PHP",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/pmmp/BedrockProtocol/issues",
|
"issues": "https://github.com/pmmp/BedrockProtocol/issues",
|
||||||
"source": "https://github.com/pmmp/BedrockProtocol/tree/20.0.0+bedrock-1.19.70"
|
"source": "https://github.com/pmmp/BedrockProtocol/tree/20.1.0+bedrock-1.19.70"
|
||||||
},
|
},
|
||||||
"time": "2023-03-14T17:06:38+00:00"
|
"time": "2023-03-20T01:17:00+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pocketmine/binaryutils",
|
"name": "pocketmine/binaryutils",
|
||||||
|
@ -541,7 +541,10 @@ class InGamePacketHandler extends PacketHandler{
|
|||||||
$this->session->getLogger()->debug(implode("\n", Utils::printableExceptionInfo($e)));
|
$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{
|
public function handleItemStackRequest(ItemStackRequestPacket $packet) : bool{
|
||||||
|
@ -349,12 +349,12 @@ final class ItemStackRequestExecutor{
|
|||||||
return $transaction;
|
return $transaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildItemStackResponse(bool $success) : ItemStackResponse{
|
public function buildItemStackResponse() : ItemStackResponse{
|
||||||
$builder = new ItemStackResponseBuilder($this->request->getRequestId(), $this->inventoryManager);
|
$builder = new ItemStackResponseBuilder($this->request->getRequestId(), $this->inventoryManager);
|
||||||
foreach($this->requestSlotInfos as $requestInfo){
|
foreach($this->requestSlotInfos as $requestInfo){
|
||||||
$builder->addSlot($requestInfo->getContainerId(), $requestInfo->getSlotId());
|
$builder->addSlot($requestInfo->getContainerId(), $requestInfo->getSlotId());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $builder->build($success);
|
return $builder->build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ final class ItemStackResponseBuilder{
|
|||||||
return [$inventory, $slot];
|
return [$inventory, $slot];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function build(bool $success) : ItemStackResponse{
|
public function build() : ItemStackResponse{
|
||||||
$responseInfosByContainer = [];
|
$responseInfosByContainer = [];
|
||||||
foreach($this->changedSlots as $containerInterfaceId => $slotIds){
|
foreach($this->changedSlots as $containerInterfaceId => $slotIds){
|
||||||
if($containerInterfaceId === ContainerUIIds::CREATED_OUTPUT){
|
if($containerInterfaceId === ContainerUIIds::CREATED_OUTPUT){
|
||||||
@ -107,6 +107,6 @@ final class ItemStackResponseBuilder{
|
|||||||
$responseContainerInfos[] = new ItemStackResponseContainerInfo($containerInterfaceId, $responseInfos);
|
$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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user