Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dries-c committed Aug 24, 2023
1 parent 2f04c7c commit 36321a6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ProxyListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
use pocketmine\event\server\DataPacketReceiveEvent;
use pocketmine\network\mcpe\protocol\NetworkSettingsPacket;
use pocketmine\network\mcpe\protocol\NetworkStackLatencyPacket;
use pocketmine\network\mcpe\protocol\ProtocolInfo;
use pocketmine\network\mcpe\protocol\RequestNetworkSettingsPacket;
use pocketmine\network\mcpe\protocol\types\CompressionAlgorithm;
use function in_array;
use function method_exists;

class ProxyListener implements Listener
Expand All @@ -37,6 +39,11 @@ public function onDataPacketReceive(DataPacketReceiveEvent $event): void
break;
case RequestNetworkSettingsPacket::NETWORK_ID:
/** @var RequestNetworkSettingsPacket $packet USED TO SIMULATE VANILLA BEHAVIOUR, SINCE IT'S NOT USED BY US */
if (!in_array($protocolVersion = $packet->getProtocolVersion(), ProtocolInfo::ACCEPTED_PROTOCOL, true)) {
$origin->disconnectIncompatibleProtocol($protocolVersion);
return;
}

if (method_exists($origin, 'setProtocolId')) {
$origin->setProtocolId($packet->getProtocolVersion());
}
Expand Down

0 comments on commit 36321a6

Please sign in to comment.