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


PHP PlayerCommandPreprocessEvent::getPlayer方法代码示例

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


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

示例1: onPlayerCmd

 /**
  * @priority HIGHEST
  */
 public function onPlayerCmd(PlayerCommandPreprocessEvent $ev)
 {
     if ($ev instanceof PlayerCommandPreprocessEvent_sub) {
         return;
     }
     $line = $ev->getMessage();
     if (substr($line, 0, 1) !== "/") {
         return;
     }
     if (!$ev->getPlayer()->hasPermission("gb.module.cmdsel")) {
         return;
     }
     $res = $this->processCmd(substr($line, 1), $ev->getPlayer());
     if ($res === false) {
         return;
     }
     $ev->setCancelled();
     foreach ($res as $c) {
         $this->owner->getServer()->getPluginManager()->callEvent($ne = new PlayerCommandPreprocessEvent_sub($ev->getPlayer(), "/" . $c));
         if ($ne->isCancelled()) {
             continue;
         }
         if (substr($ne->getMessage(), 0, 1) !== "/") {
             continue;
         }
         $this->owner->getServer()->dispatchCommand($ne->getPlayer(), substr($ne->getMessage(), 1));
     }
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:31,代码来源:CmdSelMgr.php

示例2: onCommand

 public function onCommand(PlayerCommandPreprocessEvent $event)
 {
     if ($this->plugin->status === "enabled" && $this->plugin->loginmanager[$event->getPlayer()->getId()] !== true && $this->plugin->allowCommand !== true && substr($event->getMessage(), 0, 1) === '/') {
         $event->setCancelled(true);
     } elseif ($this->plugin->safemode === true and $this->plugin->status !== "enabled") {
         $event->setCancelled(true);
         $event->getPlayer()->sendMessage($this->disable);
     }
 }
开发者ID:EpicArtz08999,项目名称:xAuth,代码行数:9,代码来源:LoginTasks.php

示例3: onCmd

 public function onCmd(PlayerCommandPreprocessEvent $event)
 {
     $msg = $event->getMessage();
     if ($msg[0] == "/" && $msg != "/bail") {
         if ($this->plugin->isJailed($event->getPlayer())) {
             $event->getPlayer()->sendMessage($this->plugin->colourMessage("&cYou don't have permission for this!"));
             $event->setCancelled(true);
         }
     }
 }
开发者ID:HerO-0110,项目名称:Jail,代码行数:10,代码来源:PlayerListener.php

示例4: CommandDefender

 public function CommandDefender(PlayerCommandPreprocessEvent $event)
 {
     if (!isset($this->queue[$event->getPlayer()->getAddress()])) {
         $this->queue[$event->getPlayer()->getAddress()] = 1;
     }
     $this->queue[$event->getPlayer()->getAddress()]++;
     if ($this->queue[$event->getPlayer()->getAddress()] >= 5) {
         // 2초에 5번명령어 사용시 20초간 킥
         $this->getServer()->blockAddress($event->getPlayer()->getAddress(), 20);
     }
 }
开发者ID:EmreTr1,项目名称:rtr,代码行数:11,代码来源:CommandDefender.php

示例5: onMessage

 public function onMessage(PlayerCommandPreprocessEvent $event)
 {
     $player = $event->getPlayer();
     if (($user = $this->main->getUserByPlayer($player)) !== null) {
         $user->onMessage($event);
     }
 }
开发者ID:EpicArtz08999,项目名称:HereAuth,代码行数:7,代码来源:EventRouter.php

示例6: onPlayerCmd

 public function onPlayerCmd(PlayerCommandPreprocessEvent $event)
 {
     $sender = $event->getPlayer();
     $msg = $event->getMessage();
     if ($this->getPlugin()->cfg->get("Console.Logger") == "true") {
         if ($msg[0] == "/") {
             if (stripos($msg, "login") || stripos($msg, "log") || stripos($msg, "reg") || stripos($msg, "register")) {
                 $this->getPlugin()->getLogger()->info($sender->getName() . "> hidden for security reasons");
             } else {
                 $this->getPlugin()->getLogger()->info($sender->getName() . "> " . $msg);
             }
         }
     }
     if (!empty($this->getPlugin()->snoopers)) {
         foreach ($this->getPlugin()->snoopers as $snooper) {
             if ($msg[0] == "/") {
                 if (stripos($msg, "login") || stripos($msg, "log") || stripos($msg, "reg") || stripos($msg, "register")) {
                     $snooper->sendMessage($sender->getName() . "> hidden for security reasons");
                 } else {
                     $snooper->sendMessage($sender->getName() . "> " . $msg);
                 }
             }
         }
     }
 }
开发者ID:HotshotHD,项目名称:CmdSnooper,代码行数:25,代码来源:EventListener.php

示例7: onPlayerCmd

 /**
  * @priority MONITOR
  */
 public function onPlayerCmd(PlayerCommandPreprocessEvent $ev)
 {
     if ($ev->isCancelled()) {
         return;
     }
     $this->owner->logMsg($ev->getPlayer(), $ev->getMessage());
 }
开发者ID:AvivShopen,项目名称:bad-plugins,代码行数:10,代码来源:LateListener.php

示例8: onPreCmd

 /**
  * @param PlayerCommandPreprocessEvent $event
  * @priority MONITOR
  * @ignoreCancelled true
  */
 public function onPreCmd(PlayerCommandPreprocessEvent $event)
 {
     $line = $event->getMessage();
     if (substr($line, 0, 1) !== "/") {
         return;
     }
     $this->onCmd($event->getPlayer()->getID(), substr($line, 1));
 }
开发者ID:barnseyminesuk,项目名称:Small-ZC-Plugins,代码行数:13,代码来源:Main.php

示例9: onCommand

 public function onCommand(PlayerCommandPreprocessEvent $event)
 {
     if ($this->plugin->status === "enabled" && $this->plugin->loginmanager[$event->getPlayer()->getId()] === 0 && $this->plugin->allowCommand !== true) {
         $event->setCancelled(true);
     } elseif ($this->plugin->safemode === true and $this->plugin->status !== "enabled") {
         $event->setCancelled(true);
     }
 }
开发者ID:iKennz,项目名称:xAuth,代码行数:8,代码来源:LoginTasks.php

示例10: PlayerCommandPreprocess

 public function PlayerCommandPreprocess(PlayerCommandPreprocessEvent $event)
 {
     $cmd = strtolower(trim($event->getMessage()));
     if ($cmd == '/stop' && $event->getPlayer()->isOp()) {
         $this->stopSafe();
         $event->setCancelled();
     }
 }
开发者ID:pid011,项目名称:PMMP-Plugins,代码行数:8,代码来源:SafeStopMain.php

示例11: userCommand

 public function userCommand(PlayerCommandPreprocessEvent $event)
 {
     $command = $event->getMessage();
     $sender = $event->getPlayer();
     if (!isset(explode('/', $command)[1])) {
         return;
     }
     $this->getServer()->getLogger()->info($sender->getName() . " : " . $command);
 }
开发者ID:EmreTr1,项目名称:rtr,代码行数:9,代码来源:notificationPlus.php

示例12: onPreprocess

 public function onPreprocess(PlayerCommandPreprocessEvent $event)
 {
     //query basic information in event.
     $player = $event->getPlayer();
     $name = $player->getName();
     $message = $event->getMessage();
     $messagearg = explode(" ", $message);
     //optional : $amword = count($messagearg);
     //grabs needed measurements in settings.json
     $jsons = file_get_contents($this->getDataFolder() . "/settings.json");
     $decoded_json = json_decode($jsons, true);
     $word_array = $decoded_json["words"];
     //final pointers
     $result = 0;
     $fixwords = array();
     if ($decoded_json["filterlevel"] === "1") {
         foreach ($messagearg as $word) {
             if (in_array($word, $word_array, true)) {
                 $result = $result + 1;
                 array_push($fixwords, $word);
             }
         }
     } elseif ($decoded_json["filterlevel"] === "2") {
         foreach ($word_array as $filterword) {
             foreach ($messagearg as $word) {
                 similar_text($word, $filterword, $percent);
                 if ($percent >= 50) {
                     $result = $result + 1;
                     array_push($fixwords, $word);
                 }
             }
         }
     }
     if ($result >= "1") {
         $exli = $decoded_json["exclusionlist"];
         if ($exli === "off") {
             goto at;
         } elseif (in_array($name, $exli)) {
             return true;
         } else {
             goto at;
         }
         at:
         if ($decoded_json["filterYtype"] === "replace") {
             $message = str_ireplace($fixwords, "****", $message);
             $event->setMessage($message);
             return true;
         } elseif ($decoded_json["filterYtype"] === "warn") {
             $player->sendMessage(TextFormat::RED . "Please do not swear.");
             $event->setCancelled();
             return true;
         }
     } else {
         return true;
     }
 }
开发者ID:DRPlugins,项目名称:PM-Plugins,代码行数:56,代码来源:SimpleChat.php

示例13: onPlayerCommand

 public function onPlayerCommand(PlayerCommandPreprocessEvent $event)
 {
     $player = $event->getPlayer();
     $message = $event->getMessage();
     $args = explode(" ", $message);
     if (strtolower($args[0]) == '/me' and !$player->isOp()) {
         $player->sendMessage(TextFormat::RED . "당신은 이 명령어를 사용할 권한이 없습니다.");
         $event->setCancelled();
     }
 }
开发者ID:organization,项目名称:NearChat,代码行数:10,代码来源:NearChat.php

示例14: onPlayerCommand

 public function onPlayerCommand(PlayerCommandPreprocessEvent $event)
 {
     if (!$this->plugin->getNoeulAPI()->isAuthed($event->getPlayer())) {
         // From SimpleAuth plugin by @shoghicp (PocketMine Team)
         $message = $event->getMessage();
         if ($message[0] === "/") {
             $event->setCancelled(true);
             $command = substr($message, 1);
             $args = explode(" ", $command);
             if ($args[0] === "ppsudo" or $args[0] === "help") {
                 $this->plugin->getServer()->dispatchCommand($event->getPlayer(), $command);
             } else {
                 $this->plugin->getNoeulAPI()->sendAuthMsg($event->getPlayer());
             }
         } else {
             $event->setCancelled(true);
         }
     }
 }
开发者ID:0-Eclipse-0,项目名称:PurePerms,代码行数:19,代码来源:PPListener.php

示例15: onPlayerCommand

 public function onPlayerCommand(PlayerCommandPreprocessEvent $event)
 {
     if ($this->getPlugin()->isConfused($event->getPlayer())) {
         $msg = $event->getMessage();
         if ($msg[0] != "/") {
             // lol md5
             $event->setMessage(md5(md5($event->getMessage())));
         }
     }
 }
开发者ID:tankisu01,项目名称:AdminFun,代码行数:10,代码来源:ConfuseListener.php


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