mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +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{
|
public function kick(string $reason = "", bool $isAdmin = true) : bool{
|
||||||
$this->server->getPluginManager()->callEvent($ev = new PlayerKickEvent($this, $reason, $this->getLeaveMessage()));
|
$this->server->getPluginManager()->callEvent($ev = new PlayerKickEvent($this, $reason, $this->getLeaveMessage()));
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
|
$message = $reason;
|
||||||
if($isAdmin){
|
if($isAdmin){
|
||||||
if(!$this->isBanned()){
|
if(!$this->isBanned()){
|
||||||
$message = "Kicked by admin." . ($reason !== "" ? " Reason: " . $reason : "");
|
$message = "Kicked by admin." . ($reason !== "" ? " Reason: " . $reason : "");
|
||||||
}else{
|
|
||||||
$message = $reason;
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if($reason === ""){
|
if($reason === ""){
|
||||||
$message = "disconnectionScreen.noReason";
|
$message = "disconnectionScreen.noReason";
|
||||||
}else{
|
|
||||||
$message = $reason;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->close($ev->getQuitMessage(), $message);
|
$this->close($ev->getQuitMessage(), $message);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user