当前位置: 首页>>代码示例>>PHP>>正文


PHP player\PlayerJoinEvent类代码示例

本文整理汇总了PHP中pocketmine\event\player\PlayerJoinEvent的典型用法代码示例。如果您正苦于以下问题:PHP PlayerJoinEvent类的具体用法?PHP PlayerJoinEvent怎么用?PHP PlayerJoinEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PlayerJoinEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onJoin

 public function onJoin(PlayerJoinEvent $event)
 {
     $player = $event->getPlayer();
     $name = $player->getDisplayname();
     if ($name == "iAnonymous28") {
         $this->getServer()->broadcastPopup(Color::GOLD . "Owner iAnonymous28 Has Joined The Server!");
     }
 }
开发者ID:xXCyrerXx,项目名称:CyberPopUp,代码行数:8,代码来源:Main.php

示例2: onJoin

 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)));
     }
 }
开发者ID:Pocket-GAD,项目名称:PocketMine-MP-Plugins,代码行数:7,代码来源:Main.php

示例3: onPlayerJoin

 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);
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:30,代码来源:JoinMgr.php

示例4: onJoin

 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);
         }
     }
 }
开发者ID:NameNoOne100,项目名称:GeoProtection_v2.0.0,代码行数:25,代码来源:Main.php

示例5: onJoin

 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"];
     }
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:7,代码来源:PSYCHOPASS_API.php

示例6: onJoin

 public function onJoin(\pocketmine\event\player\PlayerJoinEvent $event)
 {
     $player = $event->getPlayer();
     $name = $player->getName();
     $player->sendMessage(Colour::GREEN . "Welcome, " . Colour::YELLOW . $name . Colour::GREEN . ". I made my server awesome with the CommandAliases Plugin by applqpak! Check him out on Twitter @applqpak1");
     $player->sendTip(Colour::GREEN . "Hello, " . Colour::YELLOW . $name . Colour::GREEN . "!");
 }
开发者ID:betausing,项目名称:CommandAliases_VERSION_2_0_0,代码行数:7,代码来源:CommandAliases.php

示例7: onJoin

 public function onJoin(PlayerJoinEvent $event)
 {
     $this->sessions[$id = $event->getPlayer()->getId()] = new Session($this, $event->getPlayer());
     if ($this->defaultEnable) {
         $this->sessions[$id]->enable();
     }
 }
开发者ID:barnseyminesuk,项目名称:Small-ZC-Plugins,代码行数:7,代码来源:ThirdPersonDiscour.php

示例8: onJoin

 public function onJoin(PlayerJoinEvent $event)
 {
     $player = $event->getPlayer();
     foreach ($this->getConfig()->get("joinmessages") as $message) {
         $player->sendMessage($message);
     }
 }
开发者ID:ChiefArtz,项目名称:JoinMOTD,代码行数:7,代码来源:Main.php

示例9: onPlayerJoin

 public function onPlayerJoin(PlayerJoinEvent $event)
 {
     if (strpos($n = strtolower($event->getPlayer()->getName()), "") !== false || preg_match('#^[a-zA-Z0-9_]{3,16}$#', $n) == 0 || $n === "" || $n === "rcon" || $n === "console" || $n === "steve" || strlen($n) > 16 || strlen($n) < 3) {
         $event->setCancelled();
         $event->setJoinMessage("");
     }
 }
开发者ID:Skull3x,项目名称:MineBlock,代码行数:7,代码来源:BadName.php

示例10: onPlayerJoin

 public function onPlayerJoin(PlayerJoinEvent $event)
 {
     $player = $event->getPlayer();
     if ($player instanceof Player) {
         $this->plugin->petOwnerRegister($player, $event->getPlayer()->getPosition()->getLevel()->getName());
     }
 }
开发者ID:flaxues,项目名称:BuddyPets,代码行数:7,代码来源:EventListener.php

示例11: onPlayerJoin

 public function onPlayerJoin(PlayerJoinEvent $event)
 {
     $player = $event->getPlayer();
     $level = $player->getLevel();
     $vector = new Vector3(109.5, 15, 126.5);
     $level->addParticle(new FloatingTextParticle($vector, "TakeTwo\nParkour"));
 }
开发者ID:TuffDev,项目名称:TTText,代码行数:7,代码来源:Main.php

示例12: onPlayerJoin

 /**
  * 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}");
         }
     }
 }
开发者ID:Vavaballz,项目名称:BallzAuth,代码行数:34,代码来源:LoginProtection.php

示例13: onJoin

 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));
 }
开发者ID:TonyDroidd,项目名称:HideAllPlayers,代码行数:7,代码来源:Main.php

示例14: onJoin

 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"]));
         }
     }
 }
开发者ID:RedstoneAlmeida,项目名称:SliceAuth,代码行数:33,代码来源:EventListener.php

示例15: JoinEvent

 public function JoinEvent(PlayerJoinEvent $ev)
 {
     $player = $ev->getPlayer();
     if ($player->isop()) {
         $ev->setJoinMessage("GM [" . $player->getName() . "] 님께서 SAO 데이터베이스에 로그인하셨습니다 ");
     }
 }
开发者ID:junknight,项目名称:SAOjoin,代码行数:7,代码来源:SAOjoin.php


注:本文中的pocketmine\event\player\PlayerJoinEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。