Fixed player datta not getting saved, use fall distance on fly calculation

This commit is contained in:
Shoghi Cervantes 2014-10-06 12:02:36 +02:00
parent 57bb8f14fa
commit 9db2fe40eb
2 changed files with 4 additions and 5 deletions

View File

@ -1179,7 +1179,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$this->entityBaseTick(); $this->entityBaseTick();
if($this->onGround){ if($this->onGround or $this->fallDistance === 0){
$this->inAirTicks = 0; $this->inAirTicks = 0;
}else{ }else{
if($this->inAirTicks > 100 and $this->isSurvival() and !$this->isSleeping() and $this->spawned and !$this->server->getAllowFlight()){ if($this->inAirTicks > 100 and $this->isSurvival() and !$this->isSleeping() and $this->spawned and !$this->server->getAllowFlight()){
@ -2260,7 +2260,6 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
if($this->connected and !$this->closed){ if($this->connected and !$this->closed){
$this->connected = false; $this->connected = false;
if($this->username != ""){ if($this->username != ""){
$this->server->getPluginManager()->callEvent($ev = new PlayerQuitEvent($this, $message)); $this->server->getPluginManager()->callEvent($ev = new PlayerQuitEvent($this, $message));
if($this->server->getAutoSave() and $this->loggedIn === true){ if($this->server->getAutoSave() and $this->loggedIn === true){
@ -2302,7 +2301,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
parent::saveNBT(); parent::saveNBT();
if($this->getLevel() instanceof Level){ if($this->getLevel() instanceof Level){
$this->namedtag["Level"] = $this->getLevel()->getName(); $this->namedtag->Level = new String("Level", $this->getLevel()->getName());
if($this->spawnPosition instanceof Position and $this->spawnPosition->getLevel() instanceof Level){ if($this->spawnPosition instanceof Position and $this->spawnPosition->getLevel() instanceof Level){
$this->namedtag["SpawnLevel"] = $this->spawnPosition->getLevel()->getName(); $this->namedtag["SpawnLevel"] = $this->spawnPosition->getLevel()->getName();
$this->namedtag["SpawnX"] = (int) $this->spawnPosition->x; $this->namedtag["SpawnX"] = (int) $this->spawnPosition->x;
@ -2317,7 +2316,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$this->namedtag["playerGameType"] = $this->gamemode; $this->namedtag["playerGameType"] = $this->gamemode;
$this->namedtag["lastPlayed"] = floor(microtime(true) * 1000); $this->namedtag["lastPlayed"] = floor(microtime(true) * 1000);
if($this->username != "" and $this->isOnline() and $this->namedtag instanceof Compound){ if($this->username != "" and $this->namedtag instanceof Compound){
$this->server->saveOfflinePlayerData($this->username, $this->namedtag); $this->server->saveOfflinePlayerData($this->username, $this->namedtag);
} }
} }

View File

@ -1502,7 +1502,7 @@ class Server{
} }
$this->maxPlayers = $this->getConfigInt("max-players", 20); $this->maxPlayers = $this->getConfigInt("max-players", 20);
$this->autoSave = $this->getConfigBoolean("auto-save", true); $this->setAutoSave($this->getConfigBoolean("auto-save", true));
if(($memory = str_replace("B", "", strtoupper($this->getConfigString("memory-limit", "256M")))) !== false){ if(($memory = str_replace("B", "", strtoupper($this->getConfigString("memory-limit", "256M")))) !== false){
$value = ["M" => 1, "G" => 1024]; $value = ["M" => 1, "G" => 1024];