diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 5260c3887..cb9a2f578 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -3177,6 +3177,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ public function kick(string $reason = "", bool $isAdmin = true) : bool{ $this->server->getPluginManager()->callEvent($ev = new PlayerKickEvent($this, $reason, $this->getLeaveMessage())); if(!$ev->isCancelled()){ + $reason = $ev->getReason(); $message = $reason; if($isAdmin){ if(!$this->isBanned()){ diff --git a/src/pocketmine/event/player/PlayerKickEvent.php b/src/pocketmine/event/player/PlayerKickEvent.php index 0f3d7e27d..d696825c8 100644 --- a/src/pocketmine/event/player/PlayerKickEvent.php +++ b/src/pocketmine/event/player/PlayerKickEvent.php @@ -50,6 +50,13 @@ class PlayerKickEvent extends PlayerEvent implements Cancellable{ $this->reason = $reason; } + /** + * @param string $reason + */ + public function setReason(string $reason) : void{ + $this->reason = $reason; + } + public function getReason() : string{ return $this->reason; }