mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Added option to change the DATA_PATH via CLI argument data-path=<directory>
This commit is contained in:
parent
c60e15a682
commit
a3e141672a
6 changed files with 34 additions and 33 deletions
|
|
@ -265,7 +265,7 @@ class PlayerAPI{
|
|||
}
|
||||
|
||||
public function getOffline($name){
|
||||
if(!file_exists(FILE_PATH."players/".$name.".dat")){
|
||||
if(!file_exists(DATA_PATH."players/".$name.".dat")){
|
||||
console("[NOTICE] Player data not found for \"".$name."\", creating new profile");
|
||||
$data = array(
|
||||
"spawn" => array(
|
||||
|
|
@ -281,7 +281,7 @@ class PlayerAPI{
|
|||
);
|
||||
$this->saveOffline($name, $data);
|
||||
}else{
|
||||
$data = unserialize(file_get_contents(FILE_PATH."players/".$name.".dat"));
|
||||
$data = unserialize(file_get_contents(DATA_PATH."players/".$name.".dat"));
|
||||
}
|
||||
if($this->server->gamemode === 1){
|
||||
$data["health"] = 20;
|
||||
|
|
@ -292,6 +292,6 @@ class PlayerAPI{
|
|||
|
||||
public function saveOffline($name, $data){
|
||||
$this->server->handle("api.player.offline.save", $data);
|
||||
file_put_contents(FILE_PATH."players/".str_replace("/", "", $name).".dat", serialize($data));
|
||||
file_put_contents(DATA_PATH."players/".str_replace("/", "", $name).".dat", serialize($data));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue