Fixed reason on kick message

This commit is contained in:
Shoghi Cervantes 2014-06-30 01:17:55 +02:00
parent 3fd18ca4af
commit 692a4fb57b
2 changed files with 3 additions and 7 deletions

View File

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

View File

@ -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.");
}