當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CommandSender::setNameTag方法代碼示例

本文整理匯總了PHP中pocketmine\command\CommandSender::setNameTag方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommandSender::setNameTag方法的具體用法?PHP CommandSender::setNameTag怎麽用?PHP CommandSender::setNameTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pocketmine\command\CommandSender的用法示例。


在下文中一共展示了CommandSender::setNameTag方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: onCommand

 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if (strtolower($cmd->getName()) === "megajoin") {
         if (isset($args[0])) {
             if ($sender instanceof Player) {
                 $status = $args[0];
                 $sender->setNameTag(implode("<-*->"));
                 $sender->sendMessage("You Joined the match!");
                 $sender->OnStart();
             }
         }
     }
 }
開發者ID:EmreTr1,項目名稱:MegaPVP,代碼行數:13,代碼來源:Main.php

示例2: onCommand

 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if (strtolower($cmd->getName()) == "disguise") {
         if ($sender instanceof Player) {
             if ($sender->hasPermission("disguise.command")) {
                 $list = array("Apple", "Orange", "Banana", "Pear");
                 $nick = array_rand($list, 1);
                 $sender->setNameTag($nick);
                 return true;
             } else {
                 $sender->sendMessage(TextFormat::RED . "You don't have permissions to use this command.");
             }
         }
     }
 }
開發者ID:TheGoldenPickle,項目名稱:Disguise,代碼行數:15,代碼來源:Main.php

示例3: onCommand

 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     switch ($command->getName()) {
         case "pvp":
             $name = $sender->getName();
             echo 1;
             if (isset($this->joinedpvp[$name])) {
                 echo 2;
                 if ($this->joinedpvp[$name] == 1) {
                     $sender->sendMessage(TextFormat::RED . "[WallPVP]あなたはすでにpvpに參加しています。");
                     break;
                 }
             }
             if (time() - @$this->teamc[1][$name] <= 30 * 1) {
                 echo "a2";
                 $this->team[1][$name] = 1;
                 $teamname = "S";
                 $tcolor = TextFormat::LIGHT_PURPLE;
                 $pos1 = new Position(73, 72, 132);
                 //座標を指定
                 $sender->sendMessage(TextFormat::LIGHT_PURPLE . "[WallPVP]あなたは" . $teamname . "チームです。");
             } elseif (time() - @$this->teamc[2][$name] <= 30 * 1) {
                 echo "b1";
                 $this->team[2][$name] = 1;
                 $teamname = "M";
                 $tcolor = TextFormat::AQUA;
                 $pos1 = new Position(64, 76, 28);
                 //座標を指定
                 $sender->sendMessage(TextFormat::AQUA . "[WallPVP]あなたは" . $teamname . "チームです。");
             } else {
                 echo 3;
                 $this->joinedpvp[$name] = 1;
                 if (count($this->team[1]) <= count($this->team[2])) {
                     $this->team[1][$name] = 1;
                     $teamname = "S";
                     $tcolor = TextFormat::LIGHT_PURPLE;
                     $pos1 = new Position(73, 72, 132);
                     //座標を指定
                     $sender->sendMessage(TextFormat::LIGHT_PURPLE . "[WallPVP]あなたは" . $teamname . "チームです。");
                 } else {
                     $this->team[2][$name] = 1;
                     $teamname = "M";
                     $tcolor = TextFormat::AQUA;
                     $pos1 = new Position(64, 76, 28);
                     //座標を指定
                     $sender->sendMessage(TextFormat::AQUA . "[WallPVP]あなたは" . $teamname . "チームです。");
                 }
             }
             if (isset($this->team[1][$name])) {
                 $teamname = "[S]";
                 $tcolor = TextFormat::LIGHT_PURPLE;
             } elseif (isset($this->team[2][$name])) {
                 $teamname = "[M]";
                 $tcolor = TextFormat::AQUA;
             } else {
                 $teamname = null;
                 $tcolor = null;
             }
             if ($sender->isOp()) {
                 $op = "[OP]";
             } else {
                 $op = null;
             }
             $sender->setDisPlayName($tcolor . $op . $teamname . $name . "[" . $this->hapi->getkill($name) . "kill]");
             $sender->setNameTag($tcolor . $op . $teamname . $name . "[" . $this->hapi->getkill($name) . "kill]");
             $sender->teleport($pos1);
             $effect = Effect::getEffect(11);
             //Effect ID
             $effect->setVisible(true);
             //Particles
             $effect->setAmplifier(1000);
             $effect->setDuration(100);
             //Ticks
             $sender->addEffect($effect);
             break;
         case "rekit":
             $this->setKit($sender);
             break;
         case "ok":
             $cfg = $this->settings->getAll();
             $name = $sender->getName();
             if (isset($this->buy[$name])) {
                 if (time() - $this->buy[$name]["time"] <= 20) {
                     $amount = $cfg[$this->buy[$name]["id"]];
                     if ($this->hapi->getkit1($name) == $this->buy[$name]["id"]) {
                         $sender->sendMessage(TextFormat::RED . "[WallPVP]購入済みです。");
                     } else {
                         if ($this->hapi->useexp($name, $amount)) {
                             $this->hapi->setkit1($name, $this->buy[$name]["id"]);
                             $this->setKit($sender);
                             $sender->sendMessage(TextFormat::RED . "[WallPVP]" . $amount . "EXPの" . $this->buy[$name]["id"] . "を購入しました。");
                         } else {
                             $sender->sendMessage(TextFormat::RED . "[WallPVP]EXPが足りません。");
                         }
                     }
                 }
             }
             break;
         case "buy":
             $name = $sender->getName();
//.........這裏部分代碼省略.........
開發者ID:haniokasai,項目名稱:Recycle-Bin,代碼行數:101,代碼來源:Acpvp.php


注:本文中的pocketmine\command\CommandSender::setNameTag方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。