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


PHP player\PlayerChatEvent类代码示例

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


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

示例1: onChat

 public function onChat(PlayerChatEvent $event)
 {
     $this->badwords = new Config($this->getDataFolder() . "/Badwords/" . ".yml", Config::YAML);
     $msg = $event->getMessage();
     $badwords = $this->cfg->get("badwords");
     $neuersatz = str_ireplace($badwords, "****", $msg);
     $event->setMessage($neuersatz);
 }
开发者ID:Withertube,项目名称:Quicksilver,代码行数:8,代码来源:ChatSafe.php

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

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

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

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

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

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

示例8: onChat

 /**
  * @param PlayerChatEvent $e
  */
 public function onChat(PlayerChatEvent $e)
 {
     $msg = $e->getMessage();
     $this->p = $e->getPlayer();
     $this->ev = $e;
     $this->checkMessage($e->getPlayer());
 }
开发者ID:xBeastModeXD,项目名称:AntiSpammer-1,代码行数:10,代码来源:AntiSpammer.php

示例9: onChat

 public function onChat(PlayerChatEvent $event)
 {
     $cfg = $this->getConfig()->getAll();
     $p = $event->getPlayer();
     $prefix = $cfg["prefix"];
     $type = $cfg["type"];
     $m = $cfg["message"];
     $m = str_replace("{player}", $p->getName(), $m);
     $msg = $event->getMessage();
     $domain = $this->getDomain();
     foreach ($domain as $d) {
         if (preg_match("/^{$d}/i", $msg) || stripos($msg, $d) == true) {
             switch ($type) {
                 case "block":
                     $p->sendMessage(TF::YELLOW . $prefix . TF::RED . " " . $m);
                     $event->setCancelled(true);
                     break;
                 case "broadcast":
                     $this->getServer()->broadcastMessage(TF::YELLOW . $prefix . TF::RED . " " . $m);
                     $event->setCancelled(true);
                     break;
             }
         }
     }
 }
开发者ID:DWWf,项目名称:Small-PocketMine-Plugins,代码行数:25,代码来源:NoAdvertising.php

示例10: onChat

 public function onChat(PlayerChatEvent $event)
 {
     if ($event->getPlayer() instanceof DummyPlayer) {
         $event->setCancelled();
         $this->processMessage($event->getMessage());
     }
 }
开发者ID:n15001,项目名称:Chatty,代码行数:7,代码来源:NetworkInterlocker.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)
 {
     if (!isset($this->configData[$event->getPlayer()->getName()])) {
         return;
     }
     $this->getServer()->broadcastMessage(TextFormat::LIGHT_PURPLE . $this->configData["default-prefix"] . " " . $event->getMessage());
     $event->setCancelled();
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:8,代码来源:adminSay.php

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

示例14: onPlayerChat

 /**
  * @param PlayerChatEvent $event
  * @priority HIGH
  */
 public function onPlayerChat(PlayerChatEvent $event)
 {
     $player = $event->getPlayer();
     $message = $event->getMessage();
     $levelName = $this->plugin->getConfig()->get("enable-multiworld-chat") ? $player->getLevel()->getName() : null;
     $chatFormat = $this->plugin->getChatFormat($player, $message, $levelName);
     $event->setFormat($chatFormat);
 }
开发者ID:mad-hon,项目名称:PureChat,代码行数:12,代码来源:PCListener.php

示例15: onChat

 public function onChat(PlayerChatEvent $event)
 {
     $msg = $event->getMessage();
     foreach ($this->rules as $rule) {
         $rule->process($msg);
     }
     $event->setMessage($msg);
 }
开发者ID:barnseyminesuk,项目名称:Small-ZC-Plugins,代码行数:8,代码来源:Spacefiller.php


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