mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 04:17:48 +00:00
Fix for unknown map
This commit is contained in:
parent
9e08e48d83
commit
c97bf236d6
@ -28,7 +28,7 @@ the Free Software Foundation, either version 3 of the License, or
|
||||
require_once("classes/Session.class.php");
|
||||
|
||||
class PocketMinecraftServer{
|
||||
var $seed, $protocol, $gamemode, $name, $maxClients, $clients, $eidCnt, $custom, $description, $motd, $timePerSecond, $responses, $spawn, $entities, $mapDir, $map, $level, $tileEntities;
|
||||
var $seed, $protocol, $gamemode, $name, $maxClients, $clients, $eidCnt, $custom, $description, $motd, $timePerSecond, $responses, $spawn, $entities, $mapDir, $mapName, $map, $level, $tileEntities;
|
||||
private $database, $interface, $cnt, $events, $version, $serverType, $lastTick;
|
||||
function __construct($name, $gamemode = 1, $seed = false, $protocol = CURRENT_PROTOCOL, $port = 19132, $serverID = false, $version = CURRENT_VERSION){
|
||||
$this->port = (int) $port;
|
||||
@ -39,6 +39,7 @@ class PocketMinecraftServer{
|
||||
$this->version = (int) $version;
|
||||
$this->name = $name;
|
||||
$this->mapDir = false;
|
||||
$this->mapName = false;
|
||||
$this->map = false;
|
||||
$this->level = false;
|
||||
$this->tileEntities = array();
|
||||
@ -161,6 +162,7 @@ class PocketMinecraftServer{
|
||||
}
|
||||
|
||||
private function loadMap(){
|
||||
if($this->mapName !== false){
|
||||
$this->level = unserialize(file_get_contents($this->mapDir."level.dat"));
|
||||
console("[INFO] Map: ".$this->level["LevelName"]);
|
||||
$this->time = (int) $this->level["Time"];
|
||||
@ -186,11 +188,18 @@ class PocketMinecraftServer{
|
||||
}
|
||||
console("[DEBUG] Loaded ".count($this->entities)." Entities", true, true, 2);
|
||||
$this->action(1000000 * 60 * 15, '$this->chat(false, "Forcing save...");$this->save();$this->chat(false, "Done");');
|
||||
}else{
|
||||
console("[INFO] Time: ".$this->time);
|
||||
console("[INFO] Seed: ".$this->seed);
|
||||
console("[INFO] Gamemode: ".($this->gamemode === 0 ? "survival":"creative"));
|
||||
}
|
||||
}
|
||||
|
||||
public function save(){
|
||||
if($this->mapName !== false){
|
||||
file_put_contents($this->mapDir."level.dat", serialize($this->level));
|
||||
}
|
||||
}
|
||||
|
||||
public function start(){
|
||||
declare(ticks=15);
|
||||
|
@ -372,6 +372,7 @@ class Session{
|
||||
console("[DEBUG] Chunk X ".$data["x"]." Z ".$data["z"]." requested", true, true, 2);
|
||||
break;
|
||||
case MC_REMOVE_BLOCK:
|
||||
$this->eventHandler("Blocks broken will not be saved", "onChat");
|
||||
console("[DEBUG] EID ".$this->eid." broke block at X ".$data["x"]." Y ".$data["y"]." Z ".$data["z"], true, true, 2);
|
||||
$this->send(0x84, array(
|
||||
$this->counter[0],
|
||||
|
@ -135,6 +135,7 @@ $server->description = $config["description"];
|
||||
$server->motd = $config["motd"];
|
||||
$server->spawn = $config["spawn"];
|
||||
$server->whitelist = $config["white-list"];
|
||||
$server->mapName = $config["level-name"];
|
||||
$server->mapDir = FILE_PATH."data/maps/".$config["level-name"]."/";
|
||||
$server->reloadConfig();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user