Example #1
0
 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();
             }
         }
     }
 }
Example #2
0
 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.");
             }
         }
     }
 }
Example #3
0
 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();
             if (!isset($args[0])) {
                 $sender->sendMessage("Usege: /buy '[effectID]'");
                 break;
             }
             if (!ctype_digit($args[0])) {
                 $sender->sendMessage("Usege: /buy '[effectID]'");
                 break;
             }
             $cfg = $this->settings->getAll();
             $ecost = $cfg[$args[0]];
             $sender->sendMessage("ID " . $args[0] . ": 値段\$" . $ecost . "を買うのなら/ok");
             if (isset($this->buy[$name])) {
                 unset($this->buy[$name]);
             }
             $this->buy[$name]["time"] = time();
             $this->buy[$name]["id"] = $args[0];
             unset($cfg);
             unset($ecost);
             break;
         case "shop":
             $cfg = $this->settings->getAll();
             if (!isset($args[0])) {
                 $sender->sendMessage("Usege: /shop [effectID] [price]");
                 break;
             }
             if (!ctype_digit($args[0])) {
                 $sender->sendMessage("Usege: /shop '[effectID]' [price]");
                 break;
             }
             if (!isset($args[1])) {
                 $sender->sendMessage("Usege: /shop [effectID] '[price]'");
                 break;
             }
             if (!$this->settings->exists($args[1])) {
                 $sender->sendMessage("EffectID is wrong.");
                 break;
             }
             if (!ctype_digit($args[1])) {
                 $sender->sendMessage("Usege: /shop [effectID] '[price]'");
                 break;
             }
             $this->settings->set($args[0], $args[1]);
             $this->settings->save();
             $sender->sendMessage("You changed EffectID " . $args[0] . " 's price \$" . $args[1]);
             $this->settings->reload();
             break;
             break;
         case "c":
             $name = $sender->getName();
             $players = Server::getInstance()->getOnlinePlayers();
             if (isset($this->team[1][$name])) {
                 foreach ($players as $player) {
                     if (isset($this->team[1][$player->getName()])) {
                         $player->sendMessage(TextFormat::YELLOW . "[SチームC]" . $name . "|" . $args);
                     }
                 }
             } elseif (isset($this->team[2][$name])) {
                 foreach ($players as $player) {
                     if (isset($this->team[2][$player->getName()])) {
                         $player->sendMessage(TextFormat::YELLOW . "[MチームC]" . $name . "|" . $args);
                     }
                 }
             }
             break;
         case "mi":
             $name = $sender->getName();
             if (isset($this->team[1][$name])) {
                 $teamname = "S";
             } elseif (isset($this->team[2][$name])) {
                 $teamname = "M";
             }
             $name = $sender->getName();
             $sender->sendMessage(TextFormat::RED . "//////" . $name . "さんの情報/////");
             if (isset($teamname)) {
                 $sender->sendMessage(TextFormat::RED . "[チーム] " . $teamname . "チーム");
             }
             #		$sender->sendMessage(TextFormat::RED ."[KIT] ".$this->hapi->getkit1($name));
             $sender->sendMessage(TextFormat::RED . "[レベル] " . $this->getServer()->getPluginManager()->getPlugin("hapi")->getlevel($name));
             $sender->sendMessage(TextFormat::RED . "[EXP] " . $this->getServer()->getPluginManager()->getPlugin("hapi")->getexp($name));
             $sender->sendMessage(TextFormat::RED . "[キル数] " . $this->getServer()->getPluginManager()->getPlugin("hapi")->getkill($name) . "回");
             $sender->sendMessage(TextFormat::RED . "[連続キル数] " . $this->getServer()->getPluginManager()->getPlugin("hapi")->getrenkill($name) . "回");
             if ($this->getServer()->getPluginManager()->getPlugin("hapi")->getexp($name) != 0 and $this->getServer()->getPluginManager()->getPlugin("hapi")->getdes($name) != 0) {
                 $sender->sendMessage(TextFormat::RED . "[キルレート] " . $this->getServer()->getPluginManager()->getPlugin("hapi")->getkill($name) / $this->getServer()->getPluginManager()->getPlugin("hapi")->getdes($name));
             }
             $sender->sendMessage(TextFormat::RED . "/////////////////////////////");
             break;
         case "stat":
             $sender->sendMessage(TextFormat::RED . "[WallPVP]各チームの人数です。");
             $sender->sendMessage(TextFormat::RED . "[S]" . count($this->team[1]) . "人、[コア]" . $this->teamcore[1] . "HP");
             $sender->sendMessage(TextFormat::RED . "[M]" . count($this->team[2]) . "人、[コア]" . $this->teamcore[2] . "HP");
     }
 }