Add setReason() method to PlayerKickEvent

This commit is contained in:
TheNewHEROBRINEX
2018-07-08 17:46:16 +02:00
committed by Dylan K. Taylor
parent 2994d0f3ae
commit bfcef2ab6b
2 changed files with 8 additions and 0 deletions

View File

@ -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()){