mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-09 13:14:54 +00:00
Merge branch 'release/3.1'
This commit is contained in:
commit
80ebc0bc5f
@ -3171,12 +3171,14 @@ 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();
|
||||||
$message = $reason;
|
$message = $reason;
|
||||||
if($isAdmin){
|
if($isAdmin){
|
||||||
if(!$this->isBanned()){
|
if(!$this->isBanned()){
|
||||||
|
@ -50,6 +50,13 @@ class PlayerKickEvent extends PlayerEvent implements Cancellable{
|
|||||||
$this->reason = $reason;
|
$this->reason = $reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $reason
|
||||||
|
*/
|
||||||
|
public function setReason(string $reason) : void{
|
||||||
|
$this->reason = $reason;
|
||||||
|
}
|
||||||
|
|
||||||
public function getReason() : string{
|
public function getReason() : string{
|
||||||
return $this->reason;
|
return $this->reason;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user