Merge branch 'release/3.1'

This commit is contained in:
Dylan K. Taylor 2018-07-09 18:44:55 +01:00
commit 80ebc0bc5f
2 changed files with 11 additions and 2 deletions

View File

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

View File

@ -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;
}