From 9969c928a84ac58a9409b7ddeeca4430ada68402 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 27 Nov 2020 18:37:42 +0000 Subject: [PATCH] Player: Improved hardcore death handling it's now possible to cancel the banning by cancelling PlayerKickEvent. In addition, the disconnect message will now properly explain why the player is banned instead of just saying 'You have been banned', and also banned-players.txt will show 'Died in hardcore mode' as the reason instead of being completely blank (seriously, we couldn't tell the difference between real bans and hardcore bans????) --- src/player/Player.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/player/Player.php b/src/player/Player.php index 766929296..46fc4385e 100644 --- a/src/player/Player.php +++ b/src/player/Player.php @@ -2174,7 +2174,9 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ public function respawn() : void{ if($this->server->isHardcore()){ - $this->setBanned(true); + 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"); + } return; }