Пример #1
1
 /**
  * When the player join
  * @param PlayerJoinEvent $event
  */
 public function onPlayerJoin(PlayerJoinEvent $event)
 {
     $player = $event->getPlayer();
     // If the user exist
     if (User::exist($player->getName())) {
         $user = User::get($player->getName());
         // Get the login timeout from the config
         $minutes = Config::get("config.loginProtection.loginTimeout");
         // If is not an integer, set default value and write an error in the logs
         if (!is_int($minutes)) {
             $minutes = 5;
             Config::getLogger()->error("The LoginProtection loginTimeout is not and integer and will be the default time (5 minutes)");
         }
         // Add $minutes to the last_disconnection time
         $maxTime = date('Y-m-d H:i:s', strtotime($user->last_disconnection . ' + ' . $minutes . ' minute'));
         $now = date('Y-m-d H:i:s');
         // If he is logged and the maxTime is < than the actual time, then logout him.
         if ($user->isLogged() && $maxTime < $now) {
             $user->logout();
         }
     }
     // If he is disconnected, tell him to log in
     if (isset($user) && !$user->isLogged()) {
         $player->sendMessage(TextFormat::GOLD . "Welcome, you need to login before playing");
     } else {
         if (isset($user) && $user->isLogged()) {
             $player->sendMessage(TextFormat::GREEN . "Welcome back {$user->username}");
         }
     }
 }
Пример #2
0
 public function onJoin(PlayerJoinEvent $event)
 {
     if (!$event->getPlayer() instanceof Player) {
         return;
     }
     $event->getPlayer()->setDataProperty(Entity::DATA_SHOW_NAMETAG, Entity::DATA_TYPE_BYTE, 0);
 }
 public function onJoin(PlayerJoinEvent $event)
 {
     $this->sessions[$id = $event->getPlayer()->getId()] = new Session($this, $event->getPlayer());
     if ($this->defaultEnable) {
         $this->sessions[$id]->enable();
     }
 }
Пример #4
0
 public function onJoin(PlayerJoinEvent $event)
 {
     $player = $event->getPlayer();
     $cfg = $this->plugin->getConfig()->getAll();
     if ($cfg["show-join-message"]) {
         $player->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["join-message"]));
     }
     if (ServerAuth::getAPI()->isPlayerAuthenticated($player)) {
         //IP Authentication
         if ($cfg["IPLogin"]) {
             $playerdata = ServerAuth::getAPI()->getPlayerData($player->getName());
             if ($playerdata["ip"] == $player->getAddress()) {
                 ServerAuth::getAPI()->authenticatePlayer($player, $playerdata["password"], false);
                 $player->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["login"]["ip-login"]));
             } else {
                 ServerAuth::getAPI()->deauthenticatePlayer($event->getPlayer());
             }
         } else {
             ServerAuth::getAPI()->deauthenticatePlayer($event->getPlayer());
         }
     }
     if (!ServerAuth::getAPI()->isPlayerRegistered($player->getName()) && ServerAuth::getAPI()->areRegisterMessagesEnabled()) {
         if ($cfg["register"]["password-confirm-required"]) {
             $player->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["register"]["message-conf"]));
         } else {
             $player->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["register"]["message"]));
         }
     } else {
         if (!ServerAuth::getAPI()->isPlayerAuthenticated($player) && ServerAuth::getAPI()->areLoginMessagesEnabled()) {
             $player->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["login"]["message"]));
         }
     }
 }
Пример #5
0
 public function onPlayerJoin(PlayerJoinEvent $event)
 {
     $player = $event->getPlayer();
     if ($player instanceof Player) {
         $this->plugin->petOwnerRegister($player, $event->getPlayer()->getPosition()->getLevel()->getName());
     }
 }
 public function onJoin(PlayerJoinEvent $event)
 {
     $x = $this->plugin->getServer()->getDefaultLevel()->getSafeSpawn()->getX();
     $y = $this->plugin->getServer()->getDefaultLevel()->getSafeSpawn()->getY();
     $z = $this->plugin->getServer()->getDefaultLevel()->getSafeSpawn()->getZ();
     $event->getPlayer()->teleport($event->getPlayer()->getLevel()->getSafeSpawn());
     $this->debug->onDebug('Zum Start teleportiert');
 }
Пример #7
0
 public function join(pje $e)
 {
     if ($this->isStart()) {
         $this->setOni($e->getPlayer());
     } else {
         $this->setHuman($e->getPlayer());
     }
 }
Пример #8
0
 public function onPlayerJoin(PlayerJoinEvent $event)
 {
     foreach ($this->npc as $npc) {
         if ($npc->getLevel()->getFolderName() === $event->getPlayer()->getLevel()->getFolderName()) {
             $npc->spawnTo($event->getPlayer());
         }
     }
 }
Пример #9
0
 public function onPlayerJoin(PlayerJoinEvent $event)
 {
     if (isset($this->pendingPlayers[$event->getPlayer()->getName()])) {
         $fetch = new CommandFetchTask($this->getOwner(), ["users" => [$event->getPlayer()->getName()], "offlineCommands" => false]);
         $fetch->call();
         unset($this->pendingPlayers[$event->getPlayer()->getName()]);
     }
 }
Пример #10
0
 public function onJoin(PlayerJoinEvent $ev)
 {
     if (!file_exists($this->getDataFolder() . "players/" . $ev->getPlayer()->getName() . ".yml")) {
         $config = new Config($this->getDataFolder() . "players/" . strtolower($ev->getPlayer()->getName()) . ".yml", Config::YAML);
         $config->set("friends", array());
         $config->save();
         echo "made config for " . $ev->getPlayer()->getName();
     }
 }
Пример #11
0
 public function onJoin(PlayerJoinEvent $event)
 {
     if (isset($this->db["IP"][$event->getPlayer()->getAddress()])) {
         $this->message($event->getPlayer(), "자동 로그인 되었습니다 ! (IP로그인)");
         return;
     } else {
         $this->deauthenticatePlayer($player);
     }
 }
Пример #12
0
 public function onPlayerJoin(PlayerJoinEvent $event)
 {
     $this->plugin->log("[HG] StatueListener: onPlayerJoin for player " . $event->getPlayer()->getName());
     $player = $event->getPlayer();
     if (!isset($this->plugin->getStatueManager()->npcsSpawns[$player->getName()])) {
         $this->plugin->getStatueManager->npcsSpawns[$player->getName()] = $player->getName();
         $builder = new StatueBuilder($this->plugin);
         $builder->displayStatues($player, $this->plugin->statueManager->npcs);
     }
 }
Пример #13
0
 public function onJoin(PlayerJoinEvent $event)
 {
     $spawn = $this->plugin->getNextSpawn();
     $event->getPlayer()->teleport($spawn);
     $this->plugin->players = $this->plugin->players + 1;
     $event->setJoinMessage("[HG] " . $event->getPlayer()->getName() . " joined the match!");
     if (!$this->plugin->points->exists($event->getPlayer()->getName())) {
         $this->plugin->points->set($event->getPlayer()->getName(), array("kills" => 0, "deaths" => 0));
     }
 }
Пример #14
0
 public function onPlayerJoin(PlayerJoinEvent $event)
 {
     $this->getServer()->getScheduler()->scheduleRepeatingTask(new Task($this, $this->cfg->get("duration")), 10);
     $type = $this->cfg->get("type");
     $message = $this->cfg->get("message");
     if ($type == "tip") {
         $event->getPlayer()->sendTip($message);
     } elseif ($type == "popup") {
         $event->getPlayer()->sendPopup($message);
     }
 }
Пример #15
0
 /**
  * @param PlayerJoinEvent $event
  *
  * @priority LOWEST
  */
 public function onPlayerJoin(PlayerJoinEvent $event)
 {
     if ($this->plugin->getConfig()->get("authenticateByLastUniqueId") === true and $event->getPlayer()->hasPermission("simpleauth.lastid")) {
         $config = $this->plugin->getDataProvider()->getPlayer($event->getPlayer());
         if ($config !== null and $config["lastip"] === $event->getPlayer()->getUniqueId()->toString()) {
             $this->plugin->authenticatePlayer($event->getPlayer());
             return;
         }
     }
     $this->plugin->deauthenticatePlayer($event->getPlayer());
 }
Пример #16
0
 public function onDonateJoinINV(PlayerJoinEvent $inv)
 {
     $p = $inv->getPlayer();
     $p->getName();
     if ($inv->getPlayer()->hasPermission("inv.vip")) {
         $p->getInventory()->setSize(50);
     } elseif ($inv->getPlayer()->hasPermission("inv.creative")) {
         $p->getInventory()->setSize(70);
     } elseif ($inv->getPlayer()->hasPermission("inv.admin")) {
         $p->getInventory()->setSize(100);
     } else {
         $p->getInventory()->setSize(39);
     }
 }
Пример #17
0
 public function onJoinEvent(PlayerJoinEvent $event)
 {
     $config = $this->getConfig();
     foreach ($this->getServer()->getOnlinePlayers() as $players) {
         $playerName = $event->getPlayer()->getName();
         $msg2 = $config->get("Announce-Join");
         $msg2 = str_replace("{PLAYER}", $playerName, $msg2);
         $msg = $config->get("Message-Join");
         $msg = str_replace("{PLAYER}", $playerName, $msg);
         $p = $event->getPlayer();
         $players->sendTip($msg2);
         $p->sendTip($msg);
     }
 }
Пример #18
0
 public function onPlayerJoin(PlayerJoinEvent $event)
 {
     /*
      * Kick players with bad words in name
      */
     $name = strtolower($event->getPlayer()->getName());
     $regex = "((f.{0,3}u.{0,3}k)|(s(e|3){1,5}x)|bit*ch|penis|boob|dick|t**s)";
     if (preg_match($regex, $name) > 0) {
         $event->getPlayer()->kick("Name not allowed.");
         return;
     }
     $this->plugin->skinSaver($event->getPlayer());
     $this->plugin->redirector($event->getPlayer());
     // See if player has a rank in ranks file
     $pRank = $this->plugin->readFromRanksFile($event->getPlayer()->getName());
     // If nothing in ranks file tell timeranks to update the rank
     if ($pRank == "") {
         // tell pureperms to use basic group
         $ppPlugin = $this->plugin->getServer()->getPluginManager()->getPlugin("PurePerms");
         $pureGroup = $ppPlugin->getDefaultGroup();
         $ppPlugin->getUserDataMgr()->setGroup($event->getPlayer(), $pureGroup, null);
         // do timeranks rankup (sets buddyChannels)
         $timeRanksPlugin = $this->plugin->getServer()->getPluginManager()->getPlugin("TimeRanks");
         $playerName = strtolower($event->getPlayer()->getName());
         $playTime = $timeRanksPlugin->getMinutes($playerName);
         $timeRank = $timeRanksPlugin->getRankFromMinutes($playTime);
         $timeRanksPlugin->checkRankUp($playerName, 0, $playTime);
         $pRank = $timeRank->getRankName();
         // and set BuddyChannels direct
         $buddyChannelsPlugin = $this->plugin->getServer()->getPluginManager()->getPlugin("BuddyChannels");
         $buddyChannelsPlugin->setBaseRank($event->getPlayer()->getName(), $pRank);
         // debug
         $msg = $event->getPlayer()->getName() . " loaded time-based rank " . $pRank;
         $this->plugin->getServer()->getLogger()->debug($msg);
     } else {
         $msg = $event->getPlayer()->getName() . " loaded manual rank " . $pRank;
         $this->plugin->getServer()->getLogger()->debug($msg);
         // otherwise tell pureperms to use rank found in ranks file
         $ppPlugin = $this->plugin->getServer()->getPluginManager()->getPlugin("PurePerms");
         $pureGroup = $ppPlugin->getGroup($pRank);
         $ppPlugin->getUserDataMgr()->setGroup($event->getPlayer(), $pureGroup, null);
         $levels = $this->plugin->getServer()->getLevels();
         foreach ($levels as $level) {
             $ppPlugin->getUserDataMgr()->setGroup($event->getPlayer(), $pureGroup, $level->getName());
         }
         // and set BuddyChannels direct
         $buddyChannelsPlugin = $this->plugin->getServer()->getPluginManager()->getPlugin("BuddyChannels");
         $buddyChannelsPlugin->setBaseRank($event->getPlayer()->getName(), $pRank);
     }
 }
Пример #19
0
 /**
  *
  * @param PlayerJoinEvent $event        	
  */
 public function onPlayerJoin(PlayerJoinEvent $event)
 {
     if ($this->plugin->vipenforceaccess) {
         if ($event->getPlayer() instanceof Player) {
             if ($event->getPlayer()->getLevel()->getName() === $this->plugin->vipLevelName) {
                 $vip = $this->checkInVIP($event->getPlayer());
                 if (!$vip) {
                     $event->getPlayer()->kick(TextFormat::YELLOW . "[HG] Require VIP+ membership!");
                     return;
                 }
             }
         }
         $this->plugin->log("[HG] VIPPlayerListener->onPlayerJoin: " . $event->getPlayer()->getName());
     }
 }
Пример #20
0
 public function onJoin(PlayerJoinEvent $event)
 {
     $player = $event->getPlayer();
     if (!isset($this->crime_con[$player->getName()])) {
         $this->crime_con[$player->getName()] = ["crime_coefficient" => 0, "color" => "A"];
     }
 }
Пример #21
0
 public function onJoin(PlayerJoinEvent $ev)
 {
     $player = $ev->getPlayer();
     $this->load($player);
     $n = trim(strtolower($player->getName()));
     $this->setNick($player, $this->players[$n]["nick"]);
 }
Пример #22
0
 public function onJoin(PlayerJoinEvent $event)
 {
     $player = $event->getPlayer();
     $player_name = $player->getName();
     $player_ip = $player->getAddress();
     $file = file_get_contents("users.txt");
     $token = '#####';
     $file = str_replace("\n", $token, $file);
     if (preg_match('/(?P<match>user:(.)*)(' . $token . '){1}[^ ]+/Uu', $file, $matches)) {
         $match = str_replace($token, "\n", $matches['match']);
     }
     $file = str_replace($token, "\n", $file);
     $user = str_replace("user:"******"", $match);
     $player_geo = json_decode(file_get_contents("http://ipinfo.io/{$player_ip}"));
     $player_city = $player_geo->city;
     $city = substr(strstr(file_get_contents("users.txt"), "city:"), strlen("city:"));
     $kick_reason = substr(strstr(file_get_contents("reason.txt"), "reason:"), strlen("reason:"));
     $message = substr(strstr(file_get_contents("message.txt"), "message:"), strlen("message:"));
     if ($player_name == $user) {
         if ($player_city != $city) {
             $player->kick($kick_reason);
             $this->getServer()->broadcastMessage($message);
         }
     }
 }
Пример #23
0
 public function onJoin(PlayerJoinEvent $event)
 {
     $p = $event->getPlayer();
     $level = $p->getLevel();
     $light = new AddEntityPacket();
     $light->type = 93;
     $light->eid = Entity::$entityCount++;
     $light->metadata = array();
     $light->speedX = 9;
     $light->speedY = 0;
     $light->speedZ = -9;
     $light->yaw = $p->getYaw();
     $light->pitch = $p->getPitch();
     $light->x = $p->x;
     $light->y = $p->y;
     $light->z = $p->z;
     foreach ($level->getPlayers() as $pl) {
         $pl->dataPacket($light);
         $pl->addEffect(Effect::getEffect(Effect::SPEED)->setAmplifier(3)->setDuration(30000));
         $pl->setGamemode(2);
         $pl->getInventory()->addItem(new Item(Item::COOKIE, 0, 64));
         $pl->getInventory()->addItem(new Item(Item::SLIMEBALL, 0, 1));
         $pl->getInventory()->addItem(new Item(Item::COAL, 0, 1));
         $pl->getInventory()->addItem(new Item(Item::GUNPOWDER, 0, 1));
     }
 }
Пример #24
0
 public function onPlayerJoin(PlayerJoinEvent $ev)
 {
     if ($this->cfg["login-timeout"] !== 0) {
         $n = $ev->getPlayer()->getName();
         $this->getServer()->getScheduler()->scheduleDelayedTask(new PluginCallbackTask($this, [$this, "checkTimeout"], [$n]), $this->cfg["login-timeout"] * 20);
     }
     if ($this->cfg["hide-unauth"]) {
         $p = $ev->getPlayer();
         foreach ($this->getServer()->getOnlinePlayers() as $online) {
             $online->hidePlayer($p);
             $p->hidePlayer($online);
         }
         $ev->setJoinMessage("");
         //
     }
 }
 public function onJoin(PlayerJoinEvent $event)
 {
     $player = $event->getPlayer();
     $this->energy = new Config($this->getDataFolder() . "Players/" . strtolower($player->getName()), Config::YAML, array("Energy" => 30));
     $this->resetEnergy($player);
     $this->showEnergy($player);
 }
Пример #26
0
 public function pLogin(PlayerJoinEvent $event)
 {
     $laeng = $event->getPlayer();
     $rLaeng = strtolower($laeng);
     $set = $this->setting;
     if ($set->get("rb-auto-stop") && $this->rbASC <= 5) {
         if (empty($this->notice[$rLaeng])) {
             if ($this->rbASC > 0) {
                 $this->popup($laeng, $this->lang->get("message-auto-stop-01"));
             } else {
                 $this->popup($laeng, str_replace("%1", $this->rbASC, $this->lang->get("message-auto-stop-02")));
             }
         }
     }
     if ($setting->get("rb-daily-offer")) {
         $end = $set->get("rb-daily-offer-endDay");
         if (strlen($end) != 6 || $end >= date("ymd")) {
             $event->setCancelled(true);
         }
         $log = new Config($this->getDataFolder() . "RandomBox.log", Config::JSON);
         if ($log->get($rLaeng) === "") {
             $log->set($rLaeng, date("ymd") - 1);
             $log->save();
         }
         if ($log->get($rLaeng) == date("ymd")) {
             return;
         }
         $this->giveRB($laeng, $set->get("rb-daily-offer-unit"));
         $log->set($rLaneg, date("ymd"));
         $log->save();
         $this->message($laeng, $this->lang->get("message-free-offer-01"));
     }
 }
Пример #27
0
 public function onJoin(PlayerJoinEvent $e)
 {
     $cfg = $this->getConfig();
     $player = $e->getPlayer();
     $player->getInventory()->setItem(25, Item::get($cfg->get("HidePlayers-Item"), 0, 1));
     $player->getInventory()->setItem(26, Item::get($cfg->get("ShowPlayers-Item"), 0, 1));
 }
Пример #28
0
 public function JoinEvent(PlayerJoinEvent $ev)
 {
     $player = $ev->getPlayer();
     if ($player->isop()) {
         $ev->setJoinMessage("GM [" . $player->getName() . "] 님께서 SAO 데이터베이스에 로그인하셨습니다 ");
     }
 }
Пример #29
0
 public function onJoin(PlayerJoinEvent $event)
 {
     $this->clearjoin = $this->getConfig()->get("Clear on Join");
     if ($this->clearjoin == true) {
         $event->getPlayer()->getInventory()->setContents(array(Item::get(0, 0, 0)));
     }
 }
Пример #30
-3
 public function onPlayerJoin(PlayerJoinEvent $e)
 {
     $pl = $e->getPlayer();
     if ($pl == null) {
         return;
     }
     if ($this->reserved > 0 && !$pl->hasPermission("gb.join.reserved")) {
         // Check if we should kick this player...
         if (count($this->owner->getServer()->getOnlinePlayers()) + $this->reserved >= $this->owner->getServer()->getMaxPlayers()) {
             $this->owner->getServer()->getScheduler()->scheduleDelayedTask(new PluginCallbackTask($this->owner, [$this, "serverFull"], [$pl->getName()]), 5);
             return;
         }
     }
     if ($this->srvmotd) {
         $pl->sendMessage($this->owner->getServer()->getMotd());
     }
     if ($this->admjoin && $pl->isOp()) {
         $pn = $pl->getDisplayName();
         $this->owner->getServer()->broadcastMessage(mc::_("Server op {$pn} joined."));
     }
     if (!$pl->isCreative()) {
         if (count($this->items) && $pl->hasPermission("gb.join.giveitems")) {
             $this->giveItems($pl);
         }
         if (count($this->armor) && $pl->hasPermission("gb.join.givearmor")) {
             $this->giveArmor($pl);
         }
     }
     $this->alwaysSpawn($pl);
 }