mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 03:47:16 +00:00
Slightly simplify Player->kick()
This commit is contained in:
parent
6facd8b50f
commit
81fe00a0a5
@ -3118,17 +3118,14 @@ 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()){
|
||||
$message = $reason;
|
||||
if($isAdmin){
|
||||
if(!$this->isBanned()){
|
||||
$message = "Kicked by admin." . ($reason !== "" ? " Reason: " . $reason : "");
|
||||
}else{
|
||||
$message = $reason;
|
||||
}
|
||||
}else{
|
||||
if($reason === ""){
|
||||
$message = "disconnectionScreen.noReason";
|
||||
}else{
|
||||
$message = $reason;
|
||||
}
|
||||
}
|
||||
$this->close($ev->getQuitMessage(), $message);
|
||||
|
Loading…
x
Reference in New Issue
Block a user