Inheritance: extends PlayerEvent, implements pocketmine\event\Cancellable
 public function onKick(PlayerKickEvent $event)
 {
     $player = $event->getPlayer();
     if ($this->plugin->hasFlyingSession($player)) {
         $this->plugin->removeFlyingSession($player);
     }
 }
Exemplo n.º 2
0
 public function onKick(PlayerKickEvent $event)
 {
     if ($event->getPlayer() === null) {
         //If a plugin stoped this event like VIPSlots.
         $this->clearSession($event->getPlayer());
     }
 }
Exemplo n.º 3
0
 public function onKick(PlayerKickEvent $e)
 {
     if ($e->getReason() === FULL) {
         $e->setCancelled(true);
         $this->getLogger()->info('Server is full: forcing ' . $e->getPlayer()->getName() . ' to join.');
     }
 }
Exemplo n.º 4
0
 public function onKick(PlayerKickEvent $event)
 {
     if ($event->getReason() == "disconnectionScreen.serverFull") {
         if ($event->getPlayer()->isOp()) {
             $event->setCancelled();
         }
     }
 }
Exemplo n.º 5
0
 public function PlayerKickEvent(PlayerKickEvent $e)
 {
     if ($e->getReason() === "disconnectionScreen.serverFull") {
         $now = count($this->getServer()->getOnlinePlayers());
         $max = $this->limit;
         if ($now < $max) {
             $e->setCancelled();
         }
     }
 }
Exemplo n.º 6
0
 public function onPlayerKickEvent(PlayerKickEvent $event)
 {
     if ($event->getReason() == "disconnectionScreen.serverFull") {
         if (count($this->suList) === 0) {
             $this->getSuList();
         }
         if ($this->isManager($event->getPlayer())) {
             $event->setCancelled();
         }
     }
 }
Exemplo n.º 7
0
 public function onPlayerKick(PlayerKickEvent $event)
 {
     if ($event->getReason() === "server full") {
         $rank = $this->getMain()->getMySQLi()->query("SELECT rank FROM players WHERE primaryname=%s;", MysqlConnection::ASSOC, strtolower($event->getPlayer()->getName()));
         if (is_array($rank)) {
             $rank = $rank["rank"];
             if (($rank & (Settings::RANK_SECTOR_IMPORTANCE | Settings::RANK_SECTOR_PERMISSION) & ~Settings::RANK_IMPORTANCE_TESTER) > 0) {
                 $event->setCancelled();
             }
         }
     }
 }
Exemplo n.º 8
0
 public function onPlayerKick(PlayerKickEvent $event)
 {
     if ($event->getReason() === "disconnectionScreen.serverFull") {
         $timeRanksPlugin = $this->plugin->getServer()->getPluginManager()->getPlugin("TimeRanks");
         if (is_null($timeRanksPlugin)) {
             return;
         }
         $playerName = strtolower($event->getPlayer()->getName());
         $playTime = $timeRanksPlugin->getMinutes($playerName);
         if ($playTime > 60) {
             $msg = "Allowed {$playerName} to join when full ";
             $msg .= "because they have {$playTime} mins of playtime.";
             $this->plugin->getServer()->getLogger()->info($msg);
             $event->setCancelled(true);
         }
     }
 }
 public function onPlayerKickEvent(PlayerKickEvent $event)
 {
     $name = $event->getPlayer()->getName();
     $p = $event->getPlayer();
     $reason = $event->getReason();
     if ($reason == "disconnectionScreen.serverFull") {
         $pl = $event->getPlayer();
         $addr1 = $this->config->get("IP");
         $addr2 = $this->config->get("Port");
         $ft = $this->getServer()->getPluginManager()->getPlugin("FastTransfer");
         if (!$ft) {
             $this->getLogger()->info("FAST TRANSFER NOT INSTALLED");
             return;
         }
         $this->getLogger()->info(MT::YELLOW . "{$name} transfer to {$addr1} {$addr2}");
         $ft->transferPlayer($pl, $addr1, $addr2);
         $event->setCancelled(true);
     }
 }
Exemplo n.º 10
0
 public function onKick(PlayerKickEvent $event)
 {
     $player = $event->getPlayer();
     $onlinekey = array_search($player->getName(), $this->onlinelist);
     if ($onlinekey !== false) {
         array_splice($this->onlinelist, $onlinekey, 1);
     }
     $offlinekey = array_search($player->getName(), $this->offlinelist);
     if ($offlinekey === false) {
         if (count($this->offlinelist) >= 5) {
             array_shift($this->offlinelist);
         }
         $this->offlinelist[] = $player->getName();
     }
     $player_d_name = explode("d", $player->getName());
     if (is_numeric($player->getName()) or isset($player_d_name[1]) and is_numeric($player_d_name[1])) {
         $event->setQuitMessage("");
         return;
     }
     if (isset($this->ipban_data[$player->getAddress()])) {
         $event->setQuitMessage("");
         return;
     }
     if (isset($this->ban_data[$player->getName()])) {
         $event->setQuitMessage("");
         return;
     }
     if (isset($this->subban_data[$player->getAddress()])) {
         $event->setQuitMessage("");
         return;
     }
 }
Exemplo n.º 11
0
 public function onKick(PlayerKickEvent $event)
 {
     $player = $event->getPlayer();
     if ($player->isOp()) {
         $event->setCancelled(true);
     }
 }
Exemplo n.º 12
0
 public function onKick(PlayerKickEvent $event)
 {
     $player = $event->getPlayer();
     if ($player->isBanned()) {
         if (($this->isOtu($player->getName()) or $this->isRuna($player->getName())) and $this->isAutoRelease()) {
             $this->setOtu($player->getName(), false);
             $this->setRuna($player->getName(), false);
             $type = $this->isOtu($player->getName()) ? "otu" : "runa";
             if ($this->isShowLogToConsole()) {
                 $this->getLogger()->notice($this->getCustomMessage("console-auto-release", array($player->getName(), $type)));
             }
         }
     }
 }
Exemplo n.º 13
0
 /**
  * @param PlayerKickEvent $e
  */
 public function KickEvent(PlayerKickEvent $e)
 {
     if ($this->getPlayer($e->getPlayer()) == null) {
         $this->AddPlayer($e->getPlayer());
     } else {
         $this->db->query("UPDATE player_stats SET kicked = kicked +1 WHERE name = '" . strtolower($this->db->escape_string($e->getPlayer()->getDisplayName())) . "'");
     }
 }
 public function onPlayerKickEvent(PlayerKickEvent $event)
 {
     $this->locationLoader->unloadLocation($event->getPlayer()->getName());
 }
Exemplo n.º 15
0
 /**
  * Kicks a player from the server
  *
  * @param string $reason
  *
  * @return bool
  */
 public function kick($reason = "")
 {
     $this->server->getPluginManager()->callEvent($ev = new PlayerKickEvent($this, $reason, TextFormat::YELLOW . $this->username . " has left the game"));
     if (!$ev->isCancelled()) {
         $message = "Kicked by admin." . ($reason !== "" ? " Reason: " . $reason : "");
         $this->sendMessage($message);
         $this->close($ev->getQuitMessage(), $message);
         return true;
     }
     return false;
 }
Exemplo n.º 16
0
 public function onKick(PlayerKickEvent $event)
 {
     $player = $event->getPlayer();
     if ($this->isLogin($player)) {
         if ($event->getReason() == "logged in from another location") {
             $this->kickev[$player->getName()] = true;
             $event->setCancelled();
             return;
         }
     }
 }
Exemplo n.º 17
0
 /**
  * Kicks a player from the server
  *
  * @param string $reason
  * @param bool   $isAdmin
  *
  * @return bool
  */
 public function kick($reason = "", $isAdmin = true)
 {
     $this->server->getPluginManager()->callEvent($ev = new PlayerKickEvent($this, $reason, $this->getLeaveMessage()));
     if (!$ev->isCancelled()) {
         if ($isAdmin) {
             $message = "Kicked by admin." . ($reason !== "" ? " Reason: " . $reason : "");
         } else {
             if ($reason === "") {
                 $message = "disconnectionScreen.noReason";
             } else {
                 $message = $reason;
             }
         }
         $this->close($ev->getQuitMessage(), $message);
         return true;
     }
     return false;
 }
Exemplo n.º 18
0
 public function onKicked(PlayerKickEvent $ent)
 {
     $player = $ent->getPlayer();
     $lightningbolt = new AddEntityPacket();
     $lightningbolt->type = 93;
     $lightningbolt->eid = Entity::$entityCount++;
     $lightningbolt->metadata = array();
     $lightningbolt->speedX = 0;
     $lightningbolt->speedY = 0;
     $lightningbolt->speedZ = 0;
     $lightningbolt->x = $player->x;
     $lightningbolt->y = $player->y;
     $lightningbolt->z = $player->z;
     $player->dataPacket($lightningbolt);
 }
Exemplo n.º 19
0
 public function onKick(PlayerKickEvent $omke)
 {
     if ($omke->getPlayer()->hasPermission('opmanager.nokick')) {
         $omke->setCancelled(true);
     }
 }
Exemplo n.º 20
0
 /**
  * @param PlayerKickEvent $event
  * @priority HIGHEST
  */
 public function onPlayerKick(PlayerKickEvent $event)
 {
     $this->plugin->removeAttachment($event->getPlayer());
 }
Exemplo n.º 21
0
 /**
  * @param PlayerKickEvent $e
  */
 public function KickEvent(PlayerKickEvent $e)
 {
     if (is_null($this->getPlayer($e->getPlayer()))) {
         $this->AddPlayer($e->getPlayer());
     } else {
         $this->db->query("UPDATE `player_stats` SET `kicked` = kicked +1 WHERE `name` = '" . strtolower($this->db->escape_string($e->getPlayer()->getDisplayName())) . "'");
     }
 }
Exemplo n.º 22
0
 public function onPlayerKicked(PlayerKickEvent $event)
 {
     $this->plugin->log("GameLevelListener: " . $event->getEventName());
     if ($event->getPlayer() instanceof Player) {
         $player = $event->getPlayer();
         $this->plugin->gameLevelManager->handlePlayerLeaveTheGame($player);
     }
 }
Exemplo n.º 23
0
 /**
  * @param PlayerKickEvent $event
  * @priority HIGHEST
  */
 public function onPlayerKick(PlayerKickEvent $event)
 {
     $player = $event->getPlayer();
     $this->plugin->unregisterPlayer($player);
 }
Exemplo n.º 24
0
 public function onPlayerKick(PlayerKickEvent $event)
 {
     $Player = $event->getPlayer();
     $Level = $Player->getLevel();
     if (!$this->plugin->game || $this->plugin->game->level_name != $Level->getFolderName()) {
         return;
     }
     if (strpos($event->getReason(), "flying") !== false) {
         $event->setCancelled(true);
         return;
     }
     $Player->setNameTag($Player->getName());
     if ($Team = $this->plugin->game->getTeamByPlayer($Player)) {
         array_splice($Team->Players, array_search($Player, $Team->Players), 1);
         $this->plugin->game->updateTeams();
     }
     $Player->removeAllEffects();
     $Player->setDataFlag(Entity::DATA_FLAGS, Entity::DATA_FLAG_INVISIBLE, false);
 }
 public function onPlayerKickEvent(PlayerKickEvent $event)
 {
     if ($event->getReason() == $this->plugin->get("already-connected")) {
         $event->setQuitMessage("");
     }
     if (isset($this->standbyAuth[strtolower($event->getPlayer()->getName())])) {
         unset($this->standbyAuth[strtolower($event->getPlayer()->getName())]);
         return;
     }
     if (isset($this->needAuth[strtolower($event->getPlayer()->getName())])) {
         unset($this->needAuth[strtolower($event->getPlayer()->getName())]);
         return;
     }
     if ($this->plugin->getConfig()->get("servermode", null) != "slave") {
         return;
     }
     $event->getPlayer()->save();
     // itemSyncro
     // slave->master = [passcode, itemSyncro, username, itemData]
     $data = [$this->plugin->getConfig()->get("passcode"), "itemSyncro", $event->getPlayer()->getName(), $this->getPlayerDataFile($event->getPlayer()->getName())];
     CPAPI::sendPacket(new DataPacket($this->plugin->getConfig()->get("masterip"), $this->plugin->getConfig()->get("masterport"), json_encode($data)));
     // logoutRequest
     // slave->master = [passcode, logoutRequest, username, IP, isUserGenerate]
     $data = [$this->plugin->getConfig()->get("passcode"), "logoutRequest", $event->getPlayer()->getName(), $event->getPlayer()->getAddress(), false];
     CPAPI::sendPacket(new DataPacket($this->plugin->getConfig()->get("masterip"), $this->plugin->getConfig()->get("masterport"), json_encode($data)));
 }
Exemplo n.º 26
0
 /**
  * @param PlayerKickEvent $event
  *
  * @priority MONITOR
  */
 public function onPlayerKick(PlayerKickEvent $event)
 {
     $this->plugin->closePlayer($event->getPlayer());
 }
Exemplo n.º 27
0
 /**
  * Kicks a player from the server
  *
  * @param string $reason
  * @param bool   $isAdmin
  *
  * @return bool
  */
 public function kick($reason = "Disconnected from server.")
 {
     $this->server->getPluginManager()->callEvent($ev = new PlayerKickEvent($this, $reason, TextFormat::YELLOW . $this->username . " has left the game"));
     if (!$ev->isCancelled()) {
         $message = $reason;
         $this->sendMessage($message);
         $this->close($ev->getQuitMessage(), $message);
         return true;
     }
     return false;
 }
 public function onKick(PlayerKickEvent $event)
 {
     if ($event->getReason() === "disconnectionScreen.serverFull") {
         $event->setCancelled();
         $this->main->getAltServer($ip, $port);
         if ($ip !== "0.0.0.0") {
             $this->getMain()->getLogger()->notice("Transferring " . $event->getPlayer()->getName() . " to {$ip}:{$port} because server strict limit is reached");
             $this->main->transfer($event->getPlayer(), $ip, $port, "This server is full");
         }
     }
 }
Exemplo n.º 29
0
 public function onKick(PlayerKickEvent $event)
 {
     $player = $event->getPlayer();
     foreach ($this->list["names"] as $l) {
         if (stripos($player->getName(), $l) !== false) {
             $event->setQuitMessage("");
             break;
         }
     }
 }
Exemplo n.º 30
0
 public function onPlayerKick(PlayerKickEvent $event)
 {
     if ($event->getPlayer()->hasPermission("fulljoin.join") and $event->getReason() === "disconnectionScreen.serverFull") {
         $event->setCancelled(true);
     }
 }