Add quitMessage parameter to Player::kick()

This commit is contained in:
TheNewHEROBRINEX 2018-07-08 17:26:16 +02:00 committed by Dylan K. Taylor
parent bfcef2ab6b
commit 0c350f2f57

View File

@ -3171,11 +3171,12 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* *
* @param string $reason * @param string $reason
* @param bool $isAdmin * @param bool $isAdmin
* @param TextContainer|string $quitMessage
* *
* @return bool * @return bool
*/ */
public function kick(string $reason = "", bool $isAdmin = true) : bool{ public function kick(string $reason = "", bool $isAdmin = true, $quitMessage = null) : bool{
$this->server->getPluginManager()->callEvent($ev = new PlayerKickEvent($this, $reason, $this->getLeaveMessage())); $this->server->getPluginManager()->callEvent($ev = new PlayerKickEvent($this, $reason, $quitMessage ?? $this->getLeaveMessage()));
if(!$ev->isCancelled()){ if(!$ev->isCancelled()){
$reason = $ev->getReason(); $reason = $ev->getReason();
$message = $reason; $message = $reason;