mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-19 04:05:31 +00:00
Fixed reason on kick message
This commit is contained in:
parent
3fd18ca4af
commit
692a4fb57b
@ -1969,9 +1969,9 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
* @return bool
|
||||
*/
|
||||
public function kick($reason = ""){
|
||||
$this->server->getPluginManager()->callEvent($ev = new PlayerKickEvent($this, $reason, "Kicked player " . $this->username . "." . ($reason !== "" ? " With reason: $reason" : "")));
|
||||
$this->server->getPluginManager()->callEvent($ev = new PlayerKickEvent($this, $reason, TextFormat::YELLOW . $this->username . " has left the game"));
|
||||
if(!$ev->isCancelled()){
|
||||
$message = $reason !== "" ? $reason : "Kicked from server";
|
||||
$message = "Kicked by admin.". ($reason !== "" ? " Reason: ". $reason : "");
|
||||
$this->sendMessage($message);
|
||||
$this->close($ev->getQuitMessage(), $message);
|
||||
|
||||
|
@ -51,12 +51,8 @@ class KickCommand extends VanillaCommand{
|
||||
$name = array_shift($args);
|
||||
$reason = trim(implode(" ", $args));
|
||||
|
||||
if($reason === ""){
|
||||
$reason = "Kicked by an operator.";
|
||||
}
|
||||
|
||||
if(($player = $sender->getServer()->getPlayer($name)) instanceof Player){
|
||||
$player->kick("Kicked by admin.");
|
||||
$player->kick($reason);
|
||||
}else{
|
||||
$sender->sendMessage($name . " not found.");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user