mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-11 22:15:30 +00:00
Temporal fix for player crashing
This commit is contained in:
parent
03062c4e54
commit
b8834890b6
@ -61,9 +61,10 @@ class ServerAPI{
|
||||
"server-name" => "Minecraft PE Server",
|
||||
"description" => "Server made using PocketMine-MP",
|
||||
"motd" => "Welcome @player to this server!",
|
||||
"server-invisible" => false,
|
||||
"server-ip" => "",
|
||||
"server-port" => 19132,
|
||||
"server-type" => "normal",
|
||||
"server-invisible" => false,
|
||||
"memory-limit" => "128M",
|
||||
"last-update" => false,
|
||||
"white-list" => false,
|
||||
@ -72,7 +73,6 @@ class ServerAPI{
|
||||
"max-players" => 20,
|
||||
"allow-flight" => false,
|
||||
"item-enforcement" => false,
|
||||
"server-type" => "normal",
|
||||
"gamemode" => SURVIVAL,
|
||||
"pvp" => true,
|
||||
"difficulty" => 1,
|
||||
@ -81,7 +81,7 @@ class ServerAPI{
|
||||
"level-name" => "world",
|
||||
"level-seed" => "",
|
||||
"level-type" => "FLAT",
|
||||
"enable-query" => false,
|
||||
"enable-query" => true,
|
||||
"enable-rcon" => false,
|
||||
"rcon.password" => substr(base64_encode(Utils::getRandomBytes(20, false)), 3, 10),
|
||||
"send-usage" => true,
|
||||
|
@ -701,7 +701,8 @@ class Player{
|
||||
case 0xa0: //NACK
|
||||
foreach($data[0] as $count){
|
||||
if(isset($this->recovery[$count])){
|
||||
$this->directDataPacket($this->recovery[$count]["id"], $this->recovery[$count], $count, $this->recovery[$count]["pid"]);
|
||||
$this->directDataPacket($this->recovery[$count]["id"], $this->recovery[$count], $this->recovery[$count]["pid"]);
|
||||
unset($this->recovery[$count]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -710,14 +711,14 @@ class Player{
|
||||
if($count > $this->counter[2]){
|
||||
$this->counter[2] = $count;
|
||||
}
|
||||
$this->recovery[$count] = null;
|
||||
unset($this->recovery[$count]);
|
||||
}
|
||||
$limit = microtime(true) - 2; //max lag
|
||||
$limit = microtime(true) - 8; //max lag
|
||||
foreach($this->recovery as $count => $d){
|
||||
$diff = $this->counter[2] - $count;
|
||||
if($diff > 16 and $d["sendtime"] < $limit){
|
||||
$this->directDataPacket($d["id"], $d, $count, $d["pid"]);
|
||||
$this->directDataPacket($d["id"], $d, $d["pid"]);
|
||||
unset($this->recovery[$count]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1376,7 +1377,6 @@ class Player{
|
||||
if(count($this->recovery) >= PLAYER_RECOVERY_BUFFER){
|
||||
reset($this->recovery);
|
||||
$k = key($this->recovery);
|
||||
$this->recovery[$k] = null;
|
||||
unset($this->recovery[$k]);
|
||||
end($this->recovery);
|
||||
}
|
||||
@ -1389,24 +1389,22 @@ class Player{
|
||||
}
|
||||
}
|
||||
|
||||
public function directDataPacket($id, $data = array(), $count = false, $pid = 0x00){
|
||||
public function directDataPacket($id, $data = array(), $pid = 0x00){
|
||||
if($this->connected === false){
|
||||
return false;
|
||||
}
|
||||
$data["id"] = $id;
|
||||
$data["pid"] = $pid;
|
||||
$data["sendtime"] = microtime(true);
|
||||
if($count === false){
|
||||
$count = $this->counter[0]++;
|
||||
if(count($this->recovery) >= PLAYER_RECOVERY_BUFFER){
|
||||
reset($this->recovery);
|
||||
$k = key($this->recovery);
|
||||
$this->recovery[$k] = null;
|
||||
unset($this->recovery[$k]);
|
||||
end($this->recovery);
|
||||
}
|
||||
$this->recovery[$count] = $data;
|
||||
$count = $this->counter[0]++;
|
||||
if(count($this->recovery) >= PLAYER_RECOVERY_BUFFER){
|
||||
reset($this->recovery);
|
||||
$k = key($this->recovery);
|
||||
unset($this->recovery[$k]);
|
||||
end($this->recovery);
|
||||
}
|
||||
$this->recovery[$count] = $data;
|
||||
|
||||
$this->send(0x80, array(
|
||||
$count,
|
||||
$pid,
|
||||
|
@ -56,7 +56,12 @@ class MinecraftInterface{
|
||||
$p .= Utils::hexdump($raw);
|
||||
if(is_array($data)){
|
||||
foreach($data as $i => $d){
|
||||
$p .= $i ." => ".(!is_array($d) ? Protocol::$raknet[$pid][$i]."(".((Protocol::$raknet[$pid][$i] === "magic" or substr(Protocol::$raknet[$pid][$i], 0, 7) === "special" or is_int(Protocol::$raknet[$pid][$i])) ? Utils::strToHex($d):Utils::printable($d)).")":Protocol::$raknet[$pid][$i]."(\"".serialize(array_map("Utils::printable", $d))."\")").PHP_EOL;
|
||||
if(!isset(Protocol::$raknet[$pid][$i])){
|
||||
$ty = "special";
|
||||
}else{
|
||||
$ty = Protocol::$raknet[$pid][$i];
|
||||
}
|
||||
$p .= $i ." => ".(!is_array($d) ? $ty."(".(($ty === "magic" or substr($ty, 0, 7) === "special" or is_int($ty)) ? Utils::strToHex($d):Utils::printable((string) $d)).")":$ty."(\"".serialize(array_map("Utils::printable", $d))."\")").PHP_EOL;
|
||||
}
|
||||
}
|
||||
$p .= PHP_EOL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user