Unknown packets are always discarded even if they have been processed

This commit is contained in:
Shoghi Cervantes Pueyo 2013-04-22 23:46:34 +02:00
parent e428b4cfc4
commit be7e5cd67a
2 changed files with 15 additions and 13 deletions

View File

@ -28,7 +28,7 @@ the Free Software Foundation, either version 3 of the License, or
class PocketMinecraftServer{
public $tCnt;
public $version, $invisible, $api, $tickMeasure, $preparedSQL, $seed, $gamemode, $name, $maxClients, $clients, $eidCnt, $custom, $description, $motd, $timePerSecond, $spawn, $entities, $mapDir, $mapName, $map, $levelData, $tileEntities;
private $serverip, $database, $interface, $evCnt, $handCnt, $events, $eventsID, $handlers, $serverType, $lastTick;
private $port, $serverip, $database, $interface, $evCnt, $handCnt, $events, $eventsID, $handlers, $serverType, $lastTick;
private function load(){
$this->version = new VersionString();

View File

@ -82,18 +82,20 @@ class MinecraftInterface{
}
$pid = ord($buf{0});
$struct = $this->getStruct($pid);
if($struct === false and ServerAPI::request()->api->dhandle("server.unknownpacket", array(
"pid" => $pid,
"data" => array(),
"raw" => $buf,
"ip" => $source,
"port" => $port
)) !== true){
console("[ERROR] Unknown Packet ID 0x".Utils::strToHex(chr($pid)), true, true, 0);
$p = "[".(microtime(true) - $this->start)."] [".((($origin === "client" and $this->client === true) or ($origin === "server" and $this->client === false)) ? "CLIENT->SERVER":"SERVER->CLIENT")." ".$ip.":".$port."]: Error, bad packet id 0x".Utils::strToHex(chr($pid))." [length ".strlen($buf)."]".PHP_EOL;
$p .= Utils::hexdump($buf);
$p .= PHP_EOL;
logg($p, "packets", true, 2);
if($struct === false){
if(ServerAPI::request()->api->dhandle("server.unknownpacket", array(
"pid" => $pid,
"data" => array(),
"raw" => $buf,
"ip" => $source,
"port" => $port
)) !== true){
console("[ERROR] Unknown Packet ID 0x".Utils::strToHex(chr($pid)), true, true, 0);
$p = "[".(microtime(true) - $this->start)."] [".((($origin === "client" and $this->client === true) or ($origin === "server" and $this->client === false)) ? "CLIENT->SERVER":"SERVER->CLIENT")." ".$ip.":".$port."]: Error, bad packet id 0x".Utils::strToHex(chr($pid))." [length ".strlen($buf)."]".PHP_EOL;
$p .= Utils::hexdump($buf);
$p .= PHP_EOL;
logg($p, "packets", true, 2);
}
return false;
}