Step to reproduce
Enable SERVER_AUTHORITATIVE_V2_REWIND in StartGamePacket and try to break block
Simple plugin what I used:
<?php
/**
* @name PlayerAuthInputTest
* @author alvin0319
* @main alvin0319\PlayerAuthInputTest\PlayerAuthInputTest
* @version 1.0.0
* @api 4.0.0
*/
declare(strict_types=1);
namespace alvin0319\PlayerAuthInputTest;
use pocketmine\event\EventPriority;
use pocketmine\event\server\DataPacketReceiveEvent;
use pocketmine\event\server\DataPacketSendEvent;
use pocketmine\network\mcpe\protocol\MovePlayerPacket;
use pocketmine\network\mcpe\protocol\PlayerAuthInputPacket;
use pocketmine\network\mcpe\protocol\StartGamePacket;
use pocketmine\network\mcpe\protocol\types\PlayerMovementSettings;
use pocketmine\network\mcpe\protocol\types\PlayerMovementType;
use pocketmine\plugin\PluginBase;
final class PlayerAuthInputTest extends PluginBase{
protected function onEnable() : void{
$this->getServer()->getPluginManager()->registerEvent(DataPacketSendEvent::class, function(DataPacketSendEvent $event) : void{
foreach($event->getPackets() as $packet){
if($packet instanceof StartGamePacket){
$packet->playerMovementSettings = new PlayerMovementSettings(PlayerMovementType::SERVER_AUTHORITATIVE_V2_REWIND, 20, false);
}
}
}, EventPriority::NORMAL, $this);
$this->getServer()->getPluginManager()->registerEvent(DataPacketReceiveEvent::class, function(DataPacketReceiveEvent $event) : void{
$packet = $event->getPacket();
$player = $event->getOrigin()->getPlayer();
if($player === null){
return;
}
if($packet instanceof PlayerAuthInputPacket){
$event->cancel(); // shut up console please
$pk = MovePlayerPacket::simple(
$player->getId(),
$packet->getPosition(),
$packet->getPitch(),
$packet->getYaw(),
$packet->getHeadYaw(),
MovePlayerPacket::MODE_NORMAL,
$player->isOnGround(),
0,
$packet->getTick()
);
if(!$event->getOrigin()->getHandler()?->handleMovePlayer($pk)){
$this->getLogger()->debug("Unhandled MovePlayerPacket");
}
}
}, EventPriority::NORMAL, $this);
}
}
Backtrace
[15:11:45.180] [Server thread/DEBUG]: [NetworkSession: alvin0319] PlayerAuthInputPacket: kAFsagJCAJ35wREFgEP8s4VCjpJ/QwAAAAAAAAAAMGakQ4CAgICAAQECe+O/PLy21cC+6bCZvAQAgASEAYIEBCSABIQBggQE
[15:11:45.180] [Server thread/ERROR]: [NetworkSession: alvin0319] Bad packet (error ID 6498211509ff): Error processing PlayerAuthInputPacket: PlayerAuthInputPacket: No bytes left in buffer
[15:11:45.180] [Server thread/DEBUG]: [NetworkSession: alvin0319] pocketmine\network\PacketHandlingException: "Error processing PlayerAuthInputPacket: PlayerAuthInputPacket: No bytes left in buffer" (EXCEPTION) in "pmsrc/src/network
/PacketHandlingException" at line 33
--- Stack trace ---
#0 pmsrc/src/network/mcpe/NetworkSession(361): pocketmine\network\PacketHandlingException::wrap(object pocketmine\network\PacketHandlingException#103083, string[38] Error processing PlayerAuthInputPacket)
#1 pmsrc/src/network/mcpe/raklib/RakLibInterface(192): pocketmine\network\mcpe\NetworkSession->handleEncoded(string[95] c.abd.b.jF...g..V'....]~....P9.........0..AA...?.[..&...C.A.....`dd.~..f.......0)
#2 pmsrc/vendor/pocketmine/raklib-ipc/src/RakLibToUserThreadMessageReceiver(42): pocketmine\network\mcpe\raklib\RakLibInterface->onPacketReceive(integer 0, string[104] .$.....Y[)P.../....Q1...-.......=.i%.N.xt.....mK*...2.n..&..y}
....._7...q.......)
#3 pmsrc/src/network/mcpe/raklib/RakLibInterface(122): raklib\server\ipc\RakLibToUserThreadMessageReceiver->handle(object pocketmine\network\mcpe\raklib\RakLibInterface#24938)
#4 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(123): pocketmine\network\mcpe\raklib\RakLibInterface->pocketmine\network\mcpe\raklib\{closure}()
#5 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(82): pocketmine\snooze\SleeperHandler->processNotifications()
#6 pmsrc/src/Server(1615): pocketmine\snooze\SleeperHandler->sleepUntil(double 1636787505.2061)
#7 pmsrc/src/Server(1028): pocketmine\Server->tickProcessor()
#8 pmsrc/src/PocketMine(301): pocketmine\Server->__construct(object BaseClassLoader#2, object pocketmine\utils\MainLogger#3, string[47] D:\MCBE\PocketMine-MP-Projects\alvin-workspace\, string[55] D:\MCBE\PocketMine-MP-Projects\alv
in-workspace\plugins\)
#9 pmsrc/src/PocketMine(324): pocketmine\server()
#10 pmsrc(11): require(string[91] phar://D:/MCBE/PocketMine-MP-Projects/alvin-workspace/PocketMine-MP.phar/src/Poc)
--- Previous ---
pocketmine\network\PacketHandlingException: "PlayerAuthInputPacket: No bytes left in buffer" (EXCEPTION) in "pmsrc/src/network/PacketHandlingException" at line 33
#0 pmsrc/src/network/mcpe/NetworkSession(386): pocketmine\network\PacketHandlingException::wrap(object pocketmine\network\mcpe\protocol\PacketDecodeException#103081)
#1 pmsrc/src/network/mcpe/NetworkSession(358): pocketmine\network\mcpe\NetworkSession->handleDataPacket(object pocketmine\network\mcpe\protocol\PlayerAuthInputPacket#103087, string[72] ..lj.B.......C...B...C........0f.C........{..
<..................$.......)
#2 pmsrc/src/network/mcpe/raklib/RakLibInterface(192): pocketmine\network\mcpe\NetworkSession->handleEncoded(string[95] c.abd.b.jF...g..V'....]~....P9.........0..AA...?.[..&...C.A.....`dd.~..f.......0)
#3 pmsrc/vendor/pocketmine/raklib-ipc/src/RakLibToUserThreadMessageReceiver(42): pocketmine\network\mcpe\raklib\RakLibInterface->onPacketReceive(integer 0, string[104] .$.....Y[)P.../....Q1...-.......=.i%.N.xt.....mK*...2.n..&..y}
....._7...q.......)
#4 pmsrc/src/network/mcpe/raklib/RakLibInterface(122): raklib\server\ipc\RakLibToUserThreadMessageReceiver->handle(object pocketmine\network\mcpe\raklib\RakLibInterface#24938)
#5 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(123): pocketmine\network\mcpe\raklib\RakLibInterface->pocketmine\network\mcpe\raklib\{closure}()
#6 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(82): pocketmine\snooze\SleeperHandler->processNotifications()
#7 pmsrc/src/Server(1615): pocketmine\snooze\SleeperHandler->sleepUntil(double 1636787505.2061)
#8 pmsrc/src/Server(1028): pocketmine\Server->tickProcessor()
#9 pmsrc/src/PocketMine(301): pocketmine\Server->__construct(object BaseClassLoader#2, object pocketmine\utils\MainLogger#3, string[47] D:\MCBE\PocketMine-MP-Projects\alvin-workspace\, string[55] D:\MCBE\PocketMine-MP-Projects\alv
in-workspace\plugins\)
#10 pmsrc/src/PocketMine(324): pocketmine\server()
#11 pmsrc(11): require(string[91] phar://D:/MCBE/PocketMine-MP-Projects/alvin-workspace/PocketMine-MP.phar/src/Poc)
--- Previous ---
pocketmine\network\mcpe\protocol\PacketDecodeException: "PlayerAuthInputPacket: No bytes left in buffer" (EXCEPTION) in "pmsrc/vendor/pocketmine/bedrock-protocol/src/PacketDecodeException" at line 29
#0 pmsrc/vendor/pocketmine/bedrock-protocol/src/DataPacket(65): pocketmine\network\mcpe\protocol\PacketDecodeException::wrap(object pocketmine\utils\BinaryDataException#103082, string[21] PlayerAuthInputPacket)
#1 pmsrc/src/network/mcpe/NetworkSession(384): pocketmine\network\mcpe\protocol\DataPacket->decode(object pocketmine\network\mcpe\protocol\serializer\PacketSerializer#103084)
#2 pmsrc/src/network/mcpe/NetworkSession(358): pocketmine\network\mcpe\NetworkSession->handleDataPacket(object pocketmine\network\mcpe\protocol\PlayerAuthInputPacket#103087, string[72] ..lj.B.......C...B...C........0f.C........{..
<..................$.......)
#3 pmsrc/src/network/mcpe/raklib/RakLibInterface(192): pocketmine\network\mcpe\NetworkSession->handleEncoded(string[95] c.abd.b.jF...g..V'....]~....P9.........0..AA...?.[..&...C.A.....`dd.~..f.......0)
#4 pmsrc/vendor/pocketmine/raklib-ipc/src/RakLibToUserThreadMessageReceiver(42): pocketmine\network\mcpe\raklib\RakLibInterface->onPacketReceive(integer 0, string[104] .$.....Y[)P.../....Q1...-.......=.i%.N.xt.....mK*...2.n..&..y}
....._7...q.......)
#5 pmsrc/src/network/mcpe/raklib/RakLibInterface(122): raklib\server\ipc\RakLibToUserThreadMessageReceiver->handle(object pocketmine\network\mcpe\raklib\RakLibInterface#24938)
#6 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(123): pocketmine\network\mcpe\raklib\RakLibInterface->pocketmine\network\mcpe\raklib\{closure}()
#7 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(82): pocketmine\snooze\SleeperHandler->processNotifications()
#8 pmsrc/src/Server(1615): pocketmine\snooze\SleeperHandler->sleepUntil(double 1636787505.2061)
#9 pmsrc/src/Server(1028): pocketmine\Server->tickProcessor()
#10 pmsrc/src/PocketMine(301): pocketmine\Server->__construct(object BaseClassLoader#2, object pocketmine\utils\MainLogger#3, string[47] D:\MCBE\PocketMine-MP-Projects\alvin-workspace\, string[55] D:\MCBE\PocketMine-MP-Projects\al
vin-workspace\plugins\)
#11 pmsrc/src/PocketMine(324): pocketmine\server()
#12 pmsrc(11): require(string[91] phar://D:/MCBE/PocketMine-MP-Projects/alvin-workspace/PocketMine-MP.phar/src/Poc)
--- Previous ---
pocketmine\utils\BinaryDataException: "No bytes left in buffer" (EXCEPTION) in "pmsrc/vendor/pocketmine/binaryutils/src/Binary" at line 350
#0 pmsrc/vendor/pocketmine/binaryutils/src/Binary(334): pocketmine\utils\Binary::readUnsignedVarInt(string[72] ..lj.B.......C...B...C........0f.C........{..<..................$......., integer 72)
#1 pmsrc/vendor/pocketmine/binaryutils/src/BinaryStream(307): pocketmine\utils\Binary::readVarInt(string[72] ..lj.B.......C...B...C........0f.C........{..<..................$......., integer 72)
#2 pmsrc/vendor/pocketmine/bedrock-protocol/src/PlayerAuthInputPacket(207): pocketmine\utils\BinaryStream->getVarInt()
#3 pmsrc/vendor/pocketmine/bedrock-protocol/src/DataPacket(63): pocketmine\network\mcpe\protocol\PlayerAuthInputPacket->decodePayload(object pocketmine\network\mcpe\protocol\serializer\PacketSerializer#103084)
#4 pmsrc/src/network/mcpe/NetworkSession(384): pocketmine\network\mcpe\protocol\DataPacket->decode(object pocketmine\network\mcpe\protocol\serializer\PacketSerializer#103084)
#5 pmsrc/src/network/mcpe/NetworkSession(358): pocketmine\network\mcpe\NetworkSession->handleDataPacket(object pocketmine\network\mcpe\protocol\PlayerAuthInputPacket#103087, string[72] ..lj.B.......C...B...C........0f.C........{..
<..................$.......)
#6 pmsrc/src/network/mcpe/raklib/RakLibInterface(192): pocketmine\network\mcpe\NetworkSession->handleEncoded(string[95] c.abd.b.jF...g..V'....]~....P9.........0..AA...?.[..&...C.A.....`dd.~..f.......0)
#7 pmsrc/vendor/pocketmine/raklib-ipc/src/RakLibToUserThreadMessageReceiver(42): pocketmine\network\mcpe\raklib\RakLibInterface->onPacketReceive(integer 0, string[104] .$.....Y[)P.../....Q1...-.......=.i%.N.xt.....mK*...2.n..&..y}
....._7...q.......)
#8 pmsrc/src/network/mcpe/raklib/RakLibInterface(122): raklib\server\ipc\RakLibToUserThreadMessageReceiver->handle(object pocketmine\network\mcpe\raklib\RakLibInterface#24938)
#9 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(123): pocketmine\network\mcpe\raklib\RakLibInterface->pocketmine\network\mcpe\raklib\{closure}()
#10 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(82): pocketmine\snooze\SleeperHandler->processNotifications()
#11 pmsrc/src/Server(1615): pocketmine\snooze\SleeperHandler->sleepUntil(double 1636787505.2061)
#12 pmsrc/src/Server(1028): pocketmine\Server->tickProcessor()
#13 pmsrc/src/PocketMine(301): pocketmine\Server->__construct(object BaseClassLoader#2, object pocketmine\utils\MainLogger#3, string[47] D:\MCBE\PocketMine-MP-Projects\alvin-workspace\, string[55] D:\MCBE\PocketMine-MP-Projects\al
vin-workspace\plugins\)
#14 pmsrc/src/PocketMine(324): pocketmine\server()
#15 pmsrc(11): require(string[91] phar://D:/MCBE/PocketMine-MP-Projects/alvin-workspace/PocketMine-MP.phar/src/Poc)
--- End of exception information ---
BedrockProtocol version: 5.0.0+bedrock-1.17.40