mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-14 07:25:31 +00:00
Do not show playerNotFound notice if player data should not be saved
This commit is contained in:
parent
d6fd9259cf
commit
2a07638af3
@ -696,18 +696,20 @@ class Server{
|
|||||||
public function getOfflinePlayerData($name){
|
public function getOfflinePlayerData($name){
|
||||||
$name = strtolower($name);
|
$name = strtolower($name);
|
||||||
$path = $this->getDataPath() . "players/";
|
$path = $this->getDataPath() . "players/";
|
||||||
if($this->shouldSavePlayerData() and file_exists($path . "$name.dat")){
|
if($this->shouldSavePlayerData()){
|
||||||
try{
|
if(file_exists($path . "$name.dat")){
|
||||||
$nbt = new NBT(NBT::BIG_ENDIAN);
|
try{
|
||||||
$nbt->readCompressed(file_get_contents($path . "$name.dat"));
|
$nbt = new NBT(NBT::BIG_ENDIAN);
|
||||||
|
$nbt->readCompressed(file_get_contents($path . "$name.dat"));
|
||||||
|
|
||||||
return $nbt->getData();
|
return $nbt->getData();
|
||||||
}catch(\Throwable $e){ //zlib decode error / corrupt data
|
}catch(\Throwable $e){ //zlib decode error / corrupt data
|
||||||
rename($path . "$name.dat", $path . "$name.dat.bak");
|
rename($path . "$name.dat", $path . "$name.dat.bak");
|
||||||
$this->logger->notice($this->getLanguage()->translateString("pocketmine.data.playerCorrupted", [$name]));
|
$this->logger->notice($this->getLanguage()->translateString("pocketmine.data.playerCorrupted", [$name]));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$this->logger->notice($this->getLanguage()->translateString("pocketmine.data.playerNotFound", [$name]));
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
$this->logger->notice($this->getLanguage()->translateString("pocketmine.data.playerNotFound", [$name]));
|
|
||||||
}
|
}
|
||||||
$spawn = $this->getDefaultLevel()->getSafeSpawn();
|
$spawn = $this->getDefaultLevel()->getSafeSpawn();
|
||||||
$nbt = new CompoundTag("", [
|
$nbt = new CompoundTag("", [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user