fix save-player-data

This commit is contained in:
GameHerobrine 2023-07-18 05:03:01 +03:00
parent 274fd6456a
commit 747d87a3a7
2 changed files with 7 additions and 3 deletions

View file

@ -392,12 +392,12 @@ class PlayerAPI{
];
if(!file_exists(DATA_PATH . "players/" . $iname . ".yml")){
if($this->server->extraprops->get("save-player-data") && $create){
if(PocketMinecraftServer::$SAVE_PLAYER_DATA && $create){
console("[NOTICE] Player data not found for \"" . $iname . "\", creating new profile");
$data = new Config(DATA_PATH . "players/" . $iname . ".yml", CONFIG_YAML, $default);
$data->save();
}else{
return false;
return new Config(DATA_PATH . "players/$iname.yml", CONFIG_YAML, $default);
}
}
@ -494,7 +494,7 @@ class PlayerAPI{
}
public function saveOffline(Config $data){
if($this->server->extraprops->get("save-player-data")){
if(PocketMinecraftServer::$SAVE_PLAYER_DATA){
$this->server->handle("player.offline.save", $data);
$data->save();
}

View file

@ -24,6 +24,9 @@ class PocketMinecraftServer{
$this->load();
}
public static $SAVE_PLAYER_DATA = true;
private function load(){
global $dolog;
@ -97,6 +100,7 @@ class PocketMinecraftServer{
Living::$despawnTimer = $this->extraprops->get("mob-despawn-ticks");
Entity::$allowedAI = $this->extraprops->get("enable-mob-ai");
Entity::$updateOnTick = $this->extraprops->get("experemental-mob-features");
PocketMinecraftServer::$SAVE_PLAYER_DATA = $this->extraprops->get("save-player-data");
if(Entity::$updateOnTick){
console("[WARNING] Experemental mob features are enabled. Unpredictable behavior.");
}