mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-16 08:25:29 +00:00
Added packet exception handling, updated RakLib
This commit is contained in:
parent
01ffb14e39
commit
ae06681b60
@ -74,6 +74,7 @@ use pocketmine\network\protocol\UpdateBlockPacket;
|
||||
use pocketmine\network\protocol\UseItemPacket;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\utils\MainLogger;
|
||||
use pocketmine\utils\TextFormat;
|
||||
use raklib\protocol\EncapsulatedPacket;
|
||||
use raklib\RakLib;
|
||||
@ -175,9 +176,19 @@ class RakLibInterface implements ServerInstance, SourceInterface{
|
||||
|
||||
public function handleEncapsulated($identifier, EncapsulatedPacket $packet, $flags){
|
||||
if(isset($this->players[$identifier])){
|
||||
$pk = $this->getPacket($packet->buffer);
|
||||
$pk->decode();
|
||||
$this->players[$identifier]->handleDataPacket($pk);
|
||||
try{
|
||||
$pk = $this->getPacket($packet->buffer);
|
||||
$pk->decode();
|
||||
$this->players[$identifier]->handleDataPacket($pk);
|
||||
}catch (\Exception $e){
|
||||
if(\pocketmine\DEBUG > 1){
|
||||
$logger = $this->server->getLogger();
|
||||
if($logger instanceof MainLogger){
|
||||
$logger->logException($e);
|
||||
$logger->debug("Packet ".get_class($pk)." 0x".bin2hex($packet->buffer));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 9a041749f3b8bba460ae413e7fa89f488dd7b652
|
||||
Subproject commit cb3c3efd9cc8b04b686788a3a3450731f9ff97e4
|
Loading…
x
Reference in New Issue
Block a user