mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 22:45:28 +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",
|
"server-name" => "Minecraft PE Server",
|
||||||
"description" => "Server made using PocketMine-MP",
|
"description" => "Server made using PocketMine-MP",
|
||||||
"motd" => "Welcome @player to this server!",
|
"motd" => "Welcome @player to this server!",
|
||||||
"server-invisible" => false,
|
|
||||||
"server-ip" => "",
|
"server-ip" => "",
|
||||||
"server-port" => 19132,
|
"server-port" => 19132,
|
||||||
|
"server-type" => "normal",
|
||||||
|
"server-invisible" => false,
|
||||||
"memory-limit" => "128M",
|
"memory-limit" => "128M",
|
||||||
"last-update" => false,
|
"last-update" => false,
|
||||||
"white-list" => false,
|
"white-list" => false,
|
||||||
@ -72,7 +73,6 @@ class ServerAPI{
|
|||||||
"max-players" => 20,
|
"max-players" => 20,
|
||||||
"allow-flight" => false,
|
"allow-flight" => false,
|
||||||
"item-enforcement" => false,
|
"item-enforcement" => false,
|
||||||
"server-type" => "normal",
|
|
||||||
"gamemode" => SURVIVAL,
|
"gamemode" => SURVIVAL,
|
||||||
"pvp" => true,
|
"pvp" => true,
|
||||||
"difficulty" => 1,
|
"difficulty" => 1,
|
||||||
@ -81,7 +81,7 @@ class ServerAPI{
|
|||||||
"level-name" => "world",
|
"level-name" => "world",
|
||||||
"level-seed" => "",
|
"level-seed" => "",
|
||||||
"level-type" => "FLAT",
|
"level-type" => "FLAT",
|
||||||
"enable-query" => false,
|
"enable-query" => true,
|
||||||
"enable-rcon" => false,
|
"enable-rcon" => false,
|
||||||
"rcon.password" => substr(base64_encode(Utils::getRandomBytes(20, false)), 3, 10),
|
"rcon.password" => substr(base64_encode(Utils::getRandomBytes(20, false)), 3, 10),
|
||||||
"send-usage" => true,
|
"send-usage" => true,
|
||||||
|
@ -701,7 +701,8 @@ class Player{
|
|||||||
case 0xa0: //NACK
|
case 0xa0: //NACK
|
||||||
foreach($data[0] as $count){
|
foreach($data[0] as $count){
|
||||||
if(isset($this->recovery[$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;
|
break;
|
||||||
@ -710,14 +711,14 @@ class Player{
|
|||||||
if($count > $this->counter[2]){
|
if($count > $this->counter[2]){
|
||||||
$this->counter[2] = $count;
|
$this->counter[2] = $count;
|
||||||
}
|
}
|
||||||
$this->recovery[$count] = null;
|
|
||||||
unset($this->recovery[$count]);
|
unset($this->recovery[$count]);
|
||||||
}
|
}
|
||||||
$limit = microtime(true) - 2; //max lag
|
$limit = microtime(true) - 8; //max lag
|
||||||
foreach($this->recovery as $count => $d){
|
foreach($this->recovery as $count => $d){
|
||||||
$diff = $this->counter[2] - $count;
|
$diff = $this->counter[2] - $count;
|
||||||
if($diff > 16 and $d["sendtime"] < $limit){
|
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;
|
break;
|
||||||
@ -1376,7 +1377,6 @@ class Player{
|
|||||||
if(count($this->recovery) >= PLAYER_RECOVERY_BUFFER){
|
if(count($this->recovery) >= PLAYER_RECOVERY_BUFFER){
|
||||||
reset($this->recovery);
|
reset($this->recovery);
|
||||||
$k = key($this->recovery);
|
$k = key($this->recovery);
|
||||||
$this->recovery[$k] = null;
|
|
||||||
unset($this->recovery[$k]);
|
unset($this->recovery[$k]);
|
||||||
end($this->recovery);
|
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){
|
if($this->connected === false){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$data["id"] = $id;
|
$data["id"] = $id;
|
||||||
$data["pid"] = $pid;
|
$data["pid"] = $pid;
|
||||||
$data["sendtime"] = microtime(true);
|
$data["sendtime"] = microtime(true);
|
||||||
if($count === false){
|
$count = $this->counter[0]++;
|
||||||
$count = $this->counter[0]++;
|
if(count($this->recovery) >= PLAYER_RECOVERY_BUFFER){
|
||||||
if(count($this->recovery) >= PLAYER_RECOVERY_BUFFER){
|
reset($this->recovery);
|
||||||
reset($this->recovery);
|
$k = key($this->recovery);
|
||||||
$k = key($this->recovery);
|
unset($this->recovery[$k]);
|
||||||
$this->recovery[$k] = null;
|
end($this->recovery);
|
||||||
unset($this->recovery[$k]);
|
|
||||||
end($this->recovery);
|
|
||||||
}
|
|
||||||
$this->recovery[$count] = $data;
|
|
||||||
}
|
}
|
||||||
|
$this->recovery[$count] = $data;
|
||||||
|
|
||||||
$this->send(0x80, array(
|
$this->send(0x80, array(
|
||||||
$count,
|
$count,
|
||||||
$pid,
|
$pid,
|
||||||
|
@ -56,7 +56,12 @@ class MinecraftInterface{
|
|||||||
$p .= Utils::hexdump($raw);
|
$p .= Utils::hexdump($raw);
|
||||||
if(is_array($data)){
|
if(is_array($data)){
|
||||||
foreach($data as $i => $d){
|
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;
|
$p .= PHP_EOL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user