mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-13 13:25:16 +00:00
Player: added locking variable to prevent reentry into respawn() while awaiting spawn terrain generation
This commit is contained in:
parent
34ee1c2354
commit
42e915b902
@ -229,6 +229,8 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
|||||||
/** @var Position|null */
|
/** @var Position|null */
|
||||||
private $spawnPosition = null;
|
private $spawnPosition = null;
|
||||||
|
|
||||||
|
private bool $respawnLocked = false;
|
||||||
|
|
||||||
//TODO: Abilities
|
//TODO: Abilities
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
protected $autoJump = true;
|
protected $autoJump = true;
|
||||||
@ -2115,6 +2117,10 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function respawn() : void{
|
public function respawn() : void{
|
||||||
|
if($this->respawnLocked){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->respawnLocked = true;
|
||||||
if($this->server->isHardcore()){
|
if($this->server->isHardcore()){
|
||||||
if($this->kick("You have been banned because you died in hardcore mode")){ //this allows plugins to prevent the ban by cancelling PlayerKickEvent
|
if($this->kick("You have been banned because you died in hardcore mode")){ //this allows plugins to prevent the ban by cancelling PlayerKickEvent
|
||||||
$this->server->getNameBans()->addBan($this->getName(), "Died in hardcore mode");
|
$this->server->getNameBans()->addBan($this->getName(), "Died in hardcore mode");
|
||||||
@ -2156,6 +2162,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
|||||||
$this->scheduleUpdate();
|
$this->scheduleUpdate();
|
||||||
|
|
||||||
$this->getNetworkSession()->onServerRespawn();
|
$this->getNetworkSession()->onServerRespawn();
|
||||||
|
$this->respawnLocked = false;
|
||||||
},
|
},
|
||||||
function() : void{
|
function() : void{
|
||||||
if($this->isConnected()){
|
if($this->isConnected()){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user