Merge branch 'stable'

# Conflicts:
#	resources/vanilla
#	src/pocketmine/Server.php
#	src/pocketmine/item/Item.php
#	src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter.php
#	src/pocketmine/network/mcpe/RakLibInterface.php
#	src/pocketmine/network/query/QueryHandler.php
#	src/pocketmine/utils/Utils.php
This commit is contained in:
Dylan K. Taylor
2019-06-06 15:04:05 +01:00
3 changed files with 21 additions and 12 deletions

View File

@ -29,7 +29,7 @@ namespace pocketmine\network;
use pocketmine\event\server\NetworkInterfaceRegisterEvent;
use pocketmine\event\server\NetworkInterfaceUnregisterEvent;
use pocketmine\network\mcpe\protocol\PacketPool;
use function bin2hex;
use function base64_encode;
use function get_class;
use function preg_match;
use function spl_object_id;
@ -248,7 +248,7 @@ class Network{
}
}
if(!$handled){
$this->logger->debug("Unhandled raw packet from /$address:$port: " . bin2hex($packet));
$this->logger->debug("Unhandled raw packet from /$address:$port: " . base64_encode($packet));
}
}
}

View File

@ -80,6 +80,7 @@ use pocketmine\utils\BinaryDataException;
use pocketmine\utils\Utils;
use pocketmine\world\Position;
use function array_map;
use function base64_encode;
use function bin2hex;
use function count;
use function get_class;
@ -265,7 +266,7 @@ class NetworkSession{
try{
$payload = $this->cipher->decrypt($payload);
}catch(\UnexpectedValueException $e){
$this->logger->debug("Encrypted packet: " . bin2hex($payload));
$this->logger->debug("Encrypted packet: " . base64_encode($payload));
throw new BadPacketException("Packet decryption error: " . $e->getMessage(), 0, $e);
}finally{
Timings::$playerNetworkReceiveDecryptTimer->stopTiming();
@ -276,7 +277,7 @@ class NetworkSession{
try{
$stream = new PacketBatch(NetworkCompression::decompress($payload));
}catch(\ErrorException $e){
$this->logger->debug("Failed to decompress packet: " . bin2hex($payload));
$this->logger->debug("Failed to decompress packet: " . base64_encode($payload));
//TODO: this isn't incompatible game version if we already established protocol version
throw new BadPacketException("Compressed packet batch decode error: " . $e->getMessage(), 0, $e);
}finally{
@ -291,14 +292,14 @@ class NetworkSession{
try{
$pk = $stream->getPacket();
}catch(BinaryDataException $e){
$this->logger->debug("Packet batch: " . bin2hex($stream->getBuffer()));
$this->logger->debug("Packet batch: " . base64_encode($stream->getBuffer()));
throw new BadPacketException("Packet batch decode error: " . $e->getMessage(), 0, $e);
}
try{
$this->handleDataPacket($pk);
}catch(BadPacketException $e){
$this->logger->debug($pk->getName() . ": " . bin2hex($pk->getBuffer()));
$this->logger->debug($pk->getName() . ": " . base64_encode($pk->getBuffer()));
throw new BadPacketException("Error processing " . $pk->getName() . ": " . $e->getMessage(), 0, $e);
}
}
@ -327,7 +328,7 @@ class NetworkSession{
$ev = new DataPacketReceiveEvent($this, $packet);
$ev->call();
if(!$ev->isCancelled() and !$packet->handle($this->handler)){
$this->logger->debug("Unhandled " . $packet->getName() . ": " . bin2hex($packet->getBuffer()));
$this->logger->debug("Unhandled " . $packet->getName() . ": " . base64_encode($packet->getBuffer()));
}
}finally{
$timings->stopTiming();