mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-10 05:34:54 +00:00
Throw exception when saving an already-closed player, closes #1981
This commit is contained in:
parent
bf5630dc0d
commit
e0fc3784ad
@ -2163,6 +2163,10 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
* Handles player data saving
|
* Handles player data saving
|
||||||
*/
|
*/
|
||||||
public function save(){
|
public function save(){
|
||||||
|
if($this->closed){
|
||||||
|
throw new \Exception("Tried to save closed player");
|
||||||
|
}
|
||||||
|
|
||||||
parent::saveNBT();
|
parent::saveNBT();
|
||||||
$this->namedtag["Level"] = $this->getLevel()->getName();
|
$this->namedtag["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){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user