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


PHP PlayerChatEvent::getPlayer方法代码示例

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


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

示例1: onChat

 public function onChat(PlayerChatEvent $event)
 {
     $player = $event->getPlayer();
     $message = "<{$player->getName()}> : {$event->getMessage()}";
     if ($this->config["show-chat"] == false) {
         $event->setCancelled();
     }
     $pos = new Position($player->getX(), $player->getY() + 3, $player->getZ(), $player->getLevel());
     TAGSystem::getInstance()->addInstanceTag($pos, $message, $this->config["show-time"] * 20);
 }
开发者ID:wsj7178,项目名称:WordBallon,代码行数:10,代码来源:WordBallon.php

示例2: onChat

 public function onChat(PlayerChatEvent $event)
 {
     if (isset($this->continue[strtolower($event->getPlayer()->getName())])) {
         $event->setCancelled();
         $this->message($event->getPlayer(), $this->get("please-read-the-sign"));
     }
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:7,代码来源:tutorialMode.php

示例3: onCommand

 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($cmd->getName() != "as") {
         return false;
     }
     if (count($args) < 2) {
         $sender->sendMessage(mc::_("Must specified a player and a command"));
         return false;
     }
     $player = $this->owner->getServer()->getPlayer($n = array_shift($args));
     if (!$player) {
         $sender->sendMessage(mc::_("Player %1% not found", $n));
         return true;
     }
     if ($args[0] == 'chat' || $args[0] == 'say') {
         array_shift($args);
         $chat = implode(" ", $args);
         $this->owner->getServer()->getPluginManager()->callEvent($ev = new PlayerChatEvent($player, $chat));
         if (!$ev->isCancelled()) {
             if (MPMU::apiVersion("1.12.0")) {
                 $s = $this->owner->getServer();
                 $s->broadcastMessage($s->getLanguage()->translateString($ev->getFormat(), [$ev->getPlayer()->getDisplayName(), $ev->getMessage()]), $ev->getRecipients());
             } else {
                 $this->owner->getServer()->broadcastMessage(sprintf($ev->getFormat(), $ev->getPlayer()->getDisplayName(), $ev->getMessage()), $ev->getRecipients());
             }
         }
     } else {
         $cmdline = implode(' ', $args);
         $sender->sendMessage(mc::_("Running command as %1%", $n));
         $this->owner->getServer()->dispatchCommand($player, $cmdline);
     }
     return true;
 }
开发者ID:0-DevMatthew-0,项目名称:pocketmine-plugins,代码行数:33,代码来源:CmdAs.php

示例4: onPlayerChatEvent

 public function onPlayerChatEvent(PlayerChatEvent $event)
 {
     if (isset(explode("바보", $event->getMessage())[1])) {
         $event->setcancelled();
         $event->getPlayer()->setBanned(true);
         $event->getPlayer()->kick("욕사용 금지!");
     }
 }
开发者ID:sJimin,项目名称:PHPTEST,代码行数:8,代码来源:Main.php

示例5: onChat

 public function onChat(PlayerChatEvent $event)
 {
     $this->plugin->event = $event;
     $extensions = $this->getAllExtensions();
     foreach ($extensions as $get) {
         if ($this->plugin->getServer()->getPluginManager()->getPlugin($get) && method_exists($this->plugin->getServer()->getPluginManager()->getPlugin($get), "onRegisterPrefix")) {
             $this->plugin->getServer()->getPluginManager()->getPlugin($get)->onRegisterPrefix();
         }
     }
     // ===========
     //	Format
     // ===========
     $this->plugin->replaceTag("{WORLD}", $event->getPlayer()->getLevel()->getName());
     //Level Tag
     $this->plugin->replaceTag("{PLAYER}", $event->getPlayer()->getName());
     //Player Tag
     $this->plugin->replaceTag("{PREFIX}", $this->plugin->getConfig()->get("prefix"));
     //Prefix Tag
     $this->plugin->replaceTag("{SUFFIX}", $this->plugin->getConfig()->get("suffix"));
     //Suffix Tag
     $this->plugin->replaceTag("{MESSAGE}", $event->getMessage());
     //Message Tag
     //Custom tags
     $tags = new Config($this->plugin->getDataFolder() . "tags.yml", Config::YAML);
     foreach ($tags->getAll() as $tag => $value) {
         $this->plugin->replaceTag("{" . strtoupper($tag) . "}", $value);
     }
     $event->setFormat($this->getFormattedMessage($this->plugin->getConfig()->get("chat-format")));
     // ===========
     //	Player Mute
     // ===========
     $mhut = $event->getRecipients();
     for ($lol = 0; $i < count($mhut); $lol++) {
         if (isset($this->leave[$mhut[$lol]->getName()])) {
             unset($mhut[$lol]);
         }
     }
     $event->setRecipients($mhut);
     $allowChat = $this->plugin->getConfig()->get("disablechat");
     if ($allowChat) {
         $event->setCancelled(true);
         return;
     }
     if (!$allowChat || $allowChat == null) {
         $player = $event->getPlayer();
         $perm = "chatmute";
         if ($player->isPermissionSet($perm)) {
             $event->setCancelled(true);
             return;
         }
         $format = $this->getFormattedMessage($player, $event->getMessage());
         $config_node = $this->plugin->getConfig()->get("enable-formatter");
         if (isset($config_node) and $config_node === true) {
             $event->setFormat($format);
         }
         return;
     }
 }
开发者ID:AndreyNazarchuk,项目名称:Collection-Plugins-PocketMine-Prax,代码行数:58,代码来源:EventListener.php

示例6: onChat

 public function onChat(PlayerChatEvent $event)
 {
     if (!$event->getPlayer()->hasPermission("disablechat.chat")) {
         if ($this->disableChat) {
             $event->setCancelled(true);
             $event->getPlayer()->sendMessage(TF::YELLOW . "The Chat Is Disabled.");
         }
     }
 }
开发者ID:applqpak,项目名称:DisableChat,代码行数:9,代码来源:Main.php

示例7: onChat

 public function onChat(PlayerChatEvent $event)
 {
     $message = $event->getMessage();
     if ($this->plugin->status === "enabled" && $this->plugin->loginmanager[$event->getPlayer()->getId()] === 0 && $this->plugin->chatprotection[$event->getPlayer()->getId()] === $this->plugin->proccessPassword($message, 1)) {
         $event->setCancelled(true);
         //Sharing is caring, but don't share passwords!
     } elseif ($this->plugin->safemode === true and $this->plugin->status !== "enabled") {
         $event->setCancelled(true);
     }
 }
开发者ID:Jackboy320,项目名称:xAuth,代码行数:10,代码来源:LoginTasks.php

示例8: onChat

 public function onChat(PlayerChatEvent $event)
 {
     $message = $event->getMessage();
     if ($this->plugin->status === "enabled" and $this->plugin->loginmanager[$event->getPlayer()->getId()] !== 1) {
         if ($this->plugin->provider === "yml") {
             if ($this->plugin->loginmanager[$event->getPlayer()->getId()] === 0) {
                 $event->getPlayer()->sendMessage("Thanks! Please re-type your wanted password in chat.");
                 $this->plugin->loginmanager[$event->getPlayer()->getId()] = $message;
             } elseif ($this->plugin->loginmanager[$event->getPlayer()->getId()] === $message) {
                 $this->proccessPassword($message, 0, $event->getPlayer());
                 $event->getPlayer()->sendMessage("You are now registered.");
                 unset($this->plugin->proccessmanager[$event->getPlayer()->getId()]);
             }
         } elseif ($this->owner->provider === "mysql") {
             $event->getPlayer()->sendMessage("> Connecting to MySQL server..Please wait.");
             //Manage login/register for provider.
         }
     } else {
         $ecr = $this->proccessPassword($event->getMessage(), 1);
         if ($myuser->get("password") === $ecr) {
             $event->getPlayer()->sendMessage("You are now logged in.");
             $name = $event->getPlayer()->getName();
             $p->sendTip("Welcome, {$name} to the server!");
         } else {
             $event->getPlayer()->sendMessage("Login failed.");
         }
     }
 }
开发者ID:ChiefArtz,项目名称:xAuth,代码行数:28,代码来源:LoginAndRegister.php

示例9: factionChat

 public function factionChat(PlayerChatEvent $PCE)
 {
     $faction = $this->plugin->getSession($PCE->getPlayer())->getFaction();
     if ($faction == null) {
         $PCE->setFormat($PCE->getPlayer()->getName() . ": " . $PCE->getMessage());
     } else {
         $PCE->setFormat("[" . $faction->getName() . "] " . $PCE->getPlayer()->getName() . ": " . $PCE->getMessage());
     }
     return true;
     $player = strtolower($PCE->getPlayer()->getName());
 }
开发者ID:GamerXzavier,项目名称:Party-remake,代码行数:11,代码来源:FactionListener.php

示例10: onPlayerChat

 public function onPlayerChat(PlayerChatEvent $event)
 {
     $chat = $this->chat;
     $p = $event->getPlayer();
     $n = $p->getName();
     if (!isset($chat[$n])) {
         $chat[$n] = true;
     }
     if (!$chat[$n]) {
         $p->sendMessage("[ChatSwitch] " . ($this->isKorean() ? "당신은 채팅을 받지않습니다." : "You are not receive the chat"));
         $event->setCancelled();
         return;
     }
     $recipients = $event->getRecipients();
     foreach ($recipients as $k => $v) {
         $n = $v->getName();
         if (!isset($chat[$n])) {
             $chat[$n] = true;
         }
         if (!$chat[$n]) {
             unset($recipients[$k]);
         }
     }
     if ($this->chat !== $chat) {
         $this->chat = $chat;
         $this->saveYml();
     }
     $event->setRecipients($recipients);
 }
开发者ID:Skull3x,项目名称:MineBlock,代码行数:29,代码来源:ChatSwitch.php

示例11: onChat

 /**
  * @priority high
  */
 public function onChat(PlayerChatEvent $ev)
 {
     $id = sprintf("%02x", $this->last_id);
     $this->last_chat[$this->last_id] = $ev->getPlayer()->getDisplayName() . ($hooked = ": {" . $id . "} " . $ev->getMessage());
     ++$this->last_id > 255 ? $this->last_id -= 256 : false;
     $ev->setMessage($hooked);
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:10,代码来源:Main.php

示例12: onChat

 public function onChat(PlayerChatEvent $event)
 {
     $event->setCancelled();
     $player = $event->getPlayer();
     $sub = $this->playerSubs[$player->getID()];
     $sub->onChatEvent($event->getMessage());
 }
开发者ID:barnseyminesuk,项目名称:Small-ZC-Plugins,代码行数:7,代码来源:SessionControl.php

示例13: onChat

 public function onChat(PlayerChatEvent $event)
 {
     $message = $event->getMessage();
     if ($this->plugin->loginmanager[$event->getPlayer()->getId()] !== true) {
         $event->setCancelled(true);
         //Don't allow chat when not authenticated.
     }
     if ($this->plugin->status === "enabled" && $this->plugin->loginmanager[$event->getPlayer()->getId()] === true && $this->plugin->chatprotection[$event->getPlayer()->getId()] === md5($message) && $this->plugin->passBlock === true) {
         $event->setCancelled(true);
         //Sharing is caring, but don't share passwords!
         $event->getPlayer()->sendMessage($this->plugin->prefix . " " . $this->plugin->getConfig()->get("sharing"));
     } elseif ($this->plugin->safemode === true and $this->plugin->status !== "enabled") {
         $event->setCancelled(true);
         $event->getPlayer()->sendMessage($this->disable);
     }
 }
开发者ID:EpicArtz08999,项目名称:xAuth,代码行数:16,代码来源:LoginTasks.php

示例14: onChat

 public function onChat(PlayerChatEvent $event)
 {
     if ($event->getPlayer() instanceof DummyPlayer) {
         $event->setCancelled();
         $this->processMessage($event->getMessage());
     }
 }
开发者ID:n15001,项目名称:Chatty,代码行数:7,代码来源:NetworkInterlocker.php

示例15: onChat

 public function onChat(PlayerChatEvent $ev)
 {
     $p = $ev->getPlayer();
     $badwords = array("fuck", "pussy", "bitch", "nigga", "cunt", "whore", "asshole", "bitch nigga", "dick", "pene", "penis", "cock");
     $msg = explode(" ", $ev->getMessage());
     foreach ($msg as $word) {
         foreach ($badwords as $m) {
             if (strtolower($word) === $m) {
                 $ev->setCancelled();
                 $p->sendMessage("You can't say that youngster!");
             }
         }
     }
     foreach ($msg as $word) {
         $word = "op";
         $search = strpos($msg, $word);
         if ($search === false) {
             return false;
         } else {
             //  $ev->setCancelled();
             $ev->setMessage(str_replace("op", "noob"));
         }
     }
     /* muting chat if($this->isActive[$p->getName()]{
            $p->sendMessage($ev->getMessage(null));
            
        } */
 }
开发者ID:gitter-badger,项目名称:ChatSystem,代码行数:28,代码来源:Main.php


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