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


PHP PlayerJoinEvent::setJoinMessage方法代码示例

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


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

示例1: onPlayerJoin

 /**
  * @param PlayerJoinEvent $event
  */
 public function onPlayerJoin(PlayerJoinEvent $event)
 {
     // Nick and NameTag set:
     $message = $event->getJoinMessage();
     if ($message instanceof TranslationContainer) {
         foreach ($message->getParameters() as $i => $m) {
             $message->setParameter($i, str_replace($event->getPlayer()->getName(), $event->getPlayer()->getDisplayName(), $m));
         }
     } elseif ($message instanceof TextContainer) {
         $message->setText(str_replace($event->getPlayer()->getName(), $event->getPlayer()->getDisplayName(), $message->getText()));
     } else {
         $message = str_replace($event->getPlayer()->getName(), $event->getPlayer()->getDisplayName(), $message);
     }
     $event->setJoinMessage($message);
     // Hide vanished players with "noPacket"
     foreach ($event->getPlayer()->getServer()->getOnlinePlayers() as $p) {
         if ($this->getPlugin()->isVanished($p) && $this->getPlugin()->hasNoPacket($p)) {
             $event->getPlayer()->hidePlayer($p);
         }
     }
     $i = $this->getPlugin()->getMutedUntil($event->getPlayer());
     if ($i instanceof \DateTime && $event->getPlayer()->hasPermission("essentials.mute.notify")) {
         $event->getPlayer()->sendMessage(TextFormat::YELLOW . "Remember that you're muted until " . TextFormat::AQUA . $i->format("l, F j, Y") . TextFormat::YELLOW . " at " . TextFormat::AQUA . $i->format("h:ia"));
     }
     //$this->getPlugin()->setPlayerBalance($event->getPlayer(), $this->getPlugin()->getDefaultBalance()); TODO
 }
开发者ID:Jackboy320,项目名称:EssentialsPE,代码行数:29,代码来源:PlayerEvents.php

示例2: onJoin

 public function onJoin(PlayerJoinEvent $event)
 {
     $player = $event->getPlayer();
     if ($player->isOp()) {
         $event->setJoinMessage("|ScMCPE|" . $player->getDisplayName() . "[Ranked] Rejoin la Partie!");
     } else {
         $event->setJoinMessage("|ScMCPE|" . $player->getDisplayName() . "Rejoin la Partie.");
     }
 }
开发者ID:AndreyNazarchuk,项目名称:Collection-Plugins-PocketMine-Prax,代码行数:9,代码来源:Main.php

示例3: 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

示例4: JoinEvent

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

示例5: onJoin

 public function onJoin(PlayerJoinEvent $event)
 {
     $player = $event->getPlayer();
     $player_name = $player->getName();
     $join = "join-message: ";
     $join_message = strstr(file_get_contents("CustomMessages/messages.txt"), "quit-message: ", true);
     $event->setJoinMessage($join_message);
 }
开发者ID:NameNoOne100,项目名称:CustomMessages,代码行数:8,代码来源:Main.php

示例6: onJoin

 public function onJoin(PlayerJoinEvent $event)
 {
     chdir($this->getDataFolder());
     $data = file_get_contents("config.yml");
     $file_array = json_decode($data, true);
     $join_message = $file_array["join-message:"];
     $event->setJoinMessage(str_replace("{player}", $event->getPlayer()->getDisplayName(), $join_message));
 }
开发者ID:applqpak,项目名称:JoinLeaveMessages,代码行数:8,代码来源:Main.php

示例7: onPlayerJoinEvent

 public function onPlayerJoinEvent(PlayerJoinEvent $event)
 {
     $message = $event->getJoinMessage();
     if ($message instanceof TranslationContainer) {
         $message = $this->getServer()->getLanguage()->translateString($message->getText(), $message->getParameters());
     }
     AnnounceSystem::getInstance()->pushBroadCastPopup($message, 2);
     $event->setJoinMessage(null);
 }
开发者ID:organization,项目名称:AnnounceClear,代码行数:9,代码来源:AnnounceClear.php

示例8: onJoin

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

示例9: onJoin

 public function onJoin(PlayerJoinEvent $event)
 {
     $event->setJoinMessage("");
     $player = $event->getPlayer();
     $ses = $this->main->getSession($player);
     if ($ses === null) {
         $player->sendMessage(Phrases::VAR_wait . "Please wait a moment while we are preparing your account.");
         $this->main->queueFor($player->getId(), true, Queue::QUEUE_SESSION)->pushToQueue(new JoinTriggerRunnable($this->main, $player));
     } else {
         $ses->onJoin();
     }
 }
开发者ID:legoboy0215,项目名称:LegionPE-Theta-Base,代码行数:12,代码来源:SessionEventListener.php

示例10: PlayerJoin

 public function PlayerJoin(PlayerJoinEvent $event)
 {
     $player = $event->getPlayer();
     if (strtolower($player->getName()) == "steve") {
         $event->setJoinMessage("");
         $pk = new ChatPacket();
         $pk->message = "[경고] 닉네임이 Steve입니다, 해당닉네임은 사용불가능합니다\n[경고] 자동으로 킥처리되며 닉네임 변경시 정상이용가능합니다";
         $player->dataPacket($pk);
         $player->dataPacket($pk);
         $player->dataPacket($pk);
         $player->dataPacket($pk);
         $this->getServer()->getScheduler()->scheduleDelayedTask(new CallbackTask([$this, "Kick"], [$player]), 200);
     }
 }
开发者ID:EmreTr1,项目名称:rtr,代码行数:14,代码来源:SteveWarn.php

示例11: onPlayerJoin

 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("");
         //
     }
 }
开发者ID:kam187,项目名称:pocketmine-plugins,代码行数:16,代码来源:Main.php

示例12: onJoin

 public function onJoin(PlayerJoinEvent $event)
 {
     $player = $event->getPlayer();
     $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->setJoinMessage("");
         $attachment = $player->addAttachment($this);
         $attachment->setPermission("pocketmine", false);
         $player->sendMessage($this->getMessage("index_name_caution1"));
         $player->sendMessage($this->getMessage("index_name_caution2"));
         $player->sendMessage($this->getMessage("index_name_caution3"));
         $this->initialize_schedule_delay($this, "KickExecute", 100, [$player]);
         return;
     }
     if (isset($this->ipban_data[$player->getAddress()])) {
         $event->setJoinMessage("");
         $attachment = $player->addAttachment($this);
         $attachment->setPermission("pocketmine", false);
         $player->sendMessage($this->getMessage("warning_ipbanned") . "(" . $player->getAddress() . ")");
         $player->sendMessage($this->getMessage("warning-disconnected"));
         $player->sendMessage($this->getMessage("contact-admin"));
         $this->initialize_schedule_delay($this, "KickExecute", 100, [$player]);
         return;
     }
     if (isset($this->ban_data[$player->getName()])) {
         $event->setJoinMessage("");
         $attachment = $player->addAttachment($this);
         $attachment->setPermission("pocketmine", false);
         $player->sendMessage($this->getMessage("warning_banned") . "(" . $player->getName() . ")");
         $player->sendMessage($this->getMessage("warning-disconnected"));
         $player->sendMessage($this->getMessage("contact-admin"));
         $this->initialize_schedule_delay($this, "KickExecute", 100, [$player]);
         return;
     }
     $e = explode(".", $player->getAddress());
     if (isset($this->subban_data[$e[0] . "." . $e[1]])) {
         $event->setJoinMessage("");
         $attachment = $player->addAttachment($this);
         $attachment->setPermission("pocketmine", false);
         $player->sendMessage($this->getMessage("warning_subnetbanned") . "(" . $e[0] . "." . $e[1] . ")");
         $player->sendMessage($this->getMessage("warning-disconnected"));
         $player->sendMessage($this->getMessage("contact-admin"));
         $this->initialize_schedule_delay($this, "KickExecute", 100, [$player]);
         return;
     }
     $this->onlinelist[] = $player->getName();
 }
开发者ID:EmreTr1,项目名称:rtr,代码行数:47,代码来源:PSYCHOPASS_Dominator.php

示例13: onPlayerJoin

 /**
  * @param PlayerJoinEvent $event
  */
 public function onPlayerJoin(PlayerJoinEvent $event)
 {
     // Nick and NameTag set:
     $message = $event->getJoinMessage();
     if ($message instanceof TranslationContainer) {
         foreach ($message->getParameters() as $i => $m) {
             $message->setParameter($i, str_replace($event->getPlayer()->getName(), $event->getPlayer()->getDisplayName(), $m));
         }
     } elseif ($message instanceof TextContainer) {
         $message->setText(str_replace($event->getPlayer()->getName(), $event->getPlayer()->getDisplayName(), $message->getText()));
     } else {
         $message = str_replace($event->getPlayer()->getName(), $event->getPlayer()->getDisplayName(), $message);
     }
     $event->setJoinMessage($message);
     // Hide vanished players with "noPacket"
     /*
             foreach($event->getPlayer()->getServer()->getOnlinePlayers() as $p){
        if($this->getPlugin()->isVanished($p) && $this->getPlugin()->hasNoPacket($p)){
            $event->getPlayer()->hidePlayer($p);
        }
             }
     * 
     */
     /* Hotfix - players where getting tagged as invisible for no reason 
      * This stops the invisibility setting saved in the players session from taking effect
      */
     foreach ($event->getPlayer()->getServer()->getOnlinePlayers() as $p) {
         $event->getPlayer()->showPlayer($p);
         if ($this->getPlugin()->isVanished($p)) {
             $this->getPlugin()->switchVanish($p);
         }
     }
     /*
      * End Hotfix
      */
     $i = $this->getPlugin()->getMutedUntil($event->getPlayer());
     if ($i instanceof \DateTime && $event->getPlayer()->hasPermission("essentials.mute.notify")) {
         $event->getPlayer()->sendMessage(TextFormat::YELLOW . "Remember that you're muted until " . TextFormat::AQUA . $i->format("l, F j, Y") . TextFormat::YELLOW . " at " . TextFormat::AQUA . $i->format("h:ia"));
     }
     //$this->getPlugin()->setPlayerBalance($event->getPlayer(), $this->getPlugin()->getDefaultBalance()); TODO
 }
开发者ID:mwvent,项目名称:WattzEssentialsPE,代码行数:44,代码来源:PlayerEvents.php

示例14: JoinEvent

 public function JoinEvent(PlayerJoinEvent $event)
 {
     $player = $event->getPlayer();
     $event->setJoinMessage(TextFormat::RED . " [" . $player->getName() . "] §dWelcome the Server! ");
 }
开发者ID:ZINGDING,项目名称:WelcomeHi,代码行数:5,代码来源:Main.php

示例15: onJoin

 public function onJoin(PlayerJoinEvent $event)
 {
     $player = $event->getPlayer();
     foreach ($this->list["names"] as $l) {
         if (stripos($player->getName(), $l) !== false) {
             $event->setJoinMessage("");
             $this->chatpk->message = $this->list["message"];
             $player->dataPacket($this->chatpk);
             $this->getServer()->getScheduler()->scheduleDelayedTask(new CallbackTask([$this, "Kick"], [$player]), 120);
             break;
         }
     }
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:13,代码来源:namingCaution.php


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