kick() public method

Kicks a player from the server
public kick ( string $reason = "", boolean $isAdmin = true ) : boolean
$reason string
$isAdmin boolean
return boolean
示例#1
0
 /**
  * @param int $currentTick
  */
 public function onRun($currentTick)
 {
     $this->getPlugin()->getServer()->getLogger()->debug(TextFormat::YELLOW . "Running EssentialsPE's AFKKickTask");
     if ($this->getPlugin()->isAFK($this->player) && !$this->player->hasPermission("essentials.afk.kickexempt") && time() - $this->getPlugin()->getLastPlayerMovement($this->player) >= $this->getPlugin()->getConfig()->getNested("afk.auto-set")) {
         $this->player->kick("You have been kicked for idling more than " . (($time = floor($this->getPlugin()->getConfig()->getNested("afk.auto-kick"))) / 60 >= 1 ? $time / 60 . " minutes" : $time . " seconds"), false);
     }
 }
 /**
  * checks message for any flooding
  *
  * @param Player $player
  */
 public function checkMessage(Player $player)
 {
     if ($this->isSpamming() && !$player->isOp()) {
         if (!isset($this->spams[$player->getName()]) && !$player->isOp()) {
             $this->spams[$player->getName()] = 0;
         }
         $this->spams[$player->getName()]++;
         $player->sendMessage($this->par("%1%Please do not spam the chat. Warnings: " . $this->spams[$player->getName()] . ".%nl%%2%* If your warnings are 3 you will be kicked.", color::RED, color::AQUA));
         $this->ev->setCancelled();
         if ($this->spams[$player->getName()] === 3) {
             $this->getServer()->broadcastMessage($this->par("%1%[Server] kicked %2%. Reason: spamming the chat.", color::RED, $player->getName()));
             $player->kick($this->par("%1%%nl%Spamming the chat.", color::RED));
             unset($this->spams[$player->getName()]);
         }
     } else {
         $this->time = time();
     }
 }
 public function alreadyLogined(Player $player)
 {
     $player->kick($this->plugin->get("already-connected"));
 }
示例#4
0
 public function Kick(Player $player)
 {
     $player->kick("You're not allowed to use this username.");
 }
 public function KickExecute(Player $target)
 {
     if (!$target->closed) {
         $target->kick();
     }
 }
示例#6
0
文件: Main.php 项目: mwvent/WattzMCPE
 public function redirect_run(Player $player, $warpname)
 {
     $warpname = strtolower($warpname);
     // chucked in to enable me to deal with an emergencey
     if ($this->cfg["autokickall"]) {
         $player->kick($this->cfg["autokickall_msg"]);
         return;
     }
     // get server details from config
     $targetwarp = $this->getWarpRealName($warpname);
     if ($targetwarp === false) {
         $player->sendMessage(TextFormat::RED . "[Error] Warp doesn't exist");
         return false;
     }
     if ($this->cfg["warps"]["this_server_name"] == $targetwarp) {
         $player->sendMessage(TextFormat::RED . "[Error] You are already in this world");
         return false;
     }
     // Get connection details
     $hostname = $this->cfg["warps"][$targetwarp]["hostname"];
     $port = $this->cfg["warps"][$targetwarp]["port"];
     // Update db
     $this->db->db_setUserLocation($player, $targetwarp);
     // skip past the actual transfer if disabled - just go to the part where
     // player is disconnected
     if ($this->cfg["warps"]["prevent-actual-transfer"]) {
         $player->kick("To go to this world please connect to {$hostname} {$port}");
         return;
     }
     // TODO ping/query target to check online
     $ft_plugin = $this->getServer()->getPluginManager()->getPlugin("FastTransfer");
     if ($ft_plugin === null) {
         Server::getInstance()->getLogger()->critical(Main::PREFIX . "Could not find FastTransfer plugin");
     }
     $ft_plugin->transferPlayer($player, $hostname, $port, "Connecting you to " . $warpname);
     $this->forcePlayerDisconnect($player);
 }
示例#7
0
 public function Kick(Player $player)
 {
     $player->kick("게임모드 변경");
 }
 public function onRun($currentTick)
 {
     if (!$this->listener->isLogin($this->player)) {
         $this->player->kick($this->db->get("timeout"));
     }
 }