mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-15 16:05:28 +00:00
Force despawn of players on quit
This commit is contained in:
parent
1f902d814e
commit
9c95441402
@ -2099,10 +2099,10 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
*/
|
*/
|
||||||
public function close($message = "", $reason = "generic reason"){
|
public function close($message = "", $reason = "generic reason"){
|
||||||
if($this->connected === true){
|
if($this->connected === true){
|
||||||
|
parent::close();
|
||||||
if($this->username != ""){
|
if($this->username != ""){
|
||||||
$this->server->getPluginManager()->callEvent($ev = new PlayerQuitEvent($this, $message));
|
$this->server->getPluginManager()->callEvent($ev = new PlayerQuitEvent($this, $message));
|
||||||
if($this->loggedIn === true){
|
if($this->loggedIn === true){
|
||||||
parent::close();
|
|
||||||
$this->save();
|
$this->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1042,6 +1042,7 @@ abstract class Entity extends Position implements Metadatable{
|
|||||||
|
|
||||||
public function close(){
|
public function close(){
|
||||||
if($this->closed === false){
|
if($this->closed === false){
|
||||||
|
$this->server->getPluginManager()->callEvent(new EntityDespawnEvent($this));
|
||||||
$this->closed = true;
|
$this->closed = true;
|
||||||
unset(Entity::$needUpdate[$this->id]);
|
unset(Entity::$needUpdate[$this->id]);
|
||||||
if($this->chunk instanceof FullChunk){
|
if($this->chunk instanceof FullChunk){
|
||||||
@ -1049,7 +1050,6 @@ abstract class Entity extends Position implements Metadatable{
|
|||||||
}
|
}
|
||||||
$this->getLevel()->removeEntity($this);
|
$this->getLevel()->removeEntity($this);
|
||||||
$this->despawnFromAll();
|
$this->despawnFromAll();
|
||||||
$this->server->getPluginManager()->callEvent(new EntityDespawnEvent($this));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user