public function execute(CommandSender $sender, $label, array $params) { if (!$this->plugin->isEnabled()) { return false; } if (!$sender instanceof Player) { $sender->sendMessage("Please use the command in-game"); return true; } // Get current op location $playerLocation = $sender->getLocation(); $this->plugin->getLogger()->info("location" . $sender->getLocation()); // Add the arena $this->arenaManager->referenceNewArena($playerLocation); // Notify the op $sender->sendMessage("[1vs1] A new arena has been created at your position ! There are " . $this->arenaManager->getNumberOfArenas() . " arenas."); return true; }
public function onCommand(CommandSender $sender, Command $command, $label, array $args) { switch ($command->getName()) { case "prison": if ($sender instanceof Player) { if (count($args) == "help") { // prison random // prison exit // prison arena // prison kit // prison info $sender->sendMessage(TextFormat::GREEN . "Prison command" . TextFormat::YELLOW . "\n" . "use /prison random -> teleport to random cell" . "\n" . "/prison exit -> teleport to lobby" . "/n" . "/prison arena -> teleport to arena pvp" . "/n" . "/prison kit <name> -> give kit for survival" . "/n" . "/prison info <kit> -> give info in chat a player"); } else { if (count($args) == "random") { $event->getPlayer()->teleport($this->getRandomLocation()); } else { if (count($args) == "exit") { $this->getServer()->getPlayer()->teleport(new Vector3($this->yml["lobby_x"], $this->yml["lobby_y"], $this->yml["lobby_z"])); } else { if (count($args) == "arena") { $this->getServer()->getPlayer()->teleport(new Vector3($this->yml["arena_x"], $this->yml["arena_y"], $this->yml["arena_z"])); } else { if (count($args) == "kit") { if ($this->getServer()->getPlayer() == "robozeri" || "owner" || "altro") { $sword = Item::get(276, 1, 1); $armor1 = Item::get(310, 1, 1); $armor2 = Item::get(311, 1, 1); $armor3 = Item::get(312, 1, 1); $armor4 = Item::get(313, 1, 1); $player->getInventory()->addItem($sword); $player->getInventory()->addItem($armor1); $player->getInventory()->addItem($armor2); $player->getInventory()->addItem($armor3); $player->getInventory()->addItem($armor4); } else { $sword = Item::get(276, 1, 1); $armor1n = Item::get(310, 1, 1); $armor2n = Item::get(311, 1, 1); $armor3n = Item::get(312, 1, 1); $armor4n = Item::get(313, 1, 1); $player->getInventory()->addItem($sword); $player->getInventory()->addItem($armor1n); $player->getInventory()->addItem($armor2n); $player->getInventory()->addItem($armor3n); $player->getInventory()->addItem($armor4n); } } } } } } return true; } break; case "setcell": $this->addNewLocation($sender->getLocation()); $sender->sendMessage("added the xyz!"); $sender->sendMessage("" . $this->getNumberOfPositions() . "POS."); return true; break; } }
/** =+=+=+=+=+=+=+= >>>>> COMMANDS =+=+=+=+=+=+=+= **/ public function onCommand(CommandSender $sender, Command $command, $label, array $args) { switch ($command->getName()) { //rtpset command to set a random spawn position case "mtpset": $this->addNewLocation($sender->getLocation()); $sender->sendMessage("[MultiTP] A new teleportation target was added at your position !"); $sender->sendMessage("[MultiTP] There are : " . $this->getNumberOfPositions() . " teleportation targets."); return true; //rtpreset command to reset all random spawn positions //rtpreset command to reset all random spawn positions case "mtpreset": $this->resetPositions(); $sender->sendMessage("[MultiTP] All random spawn positions have been removed!"); return true; //rtpinfo to have all informations about the plugin :) //rtpinfo to have all informations about the plugin :) case "mtpinfo": $sender->sendMessage("[MultiTP] This plugin was created by Minifixio. I've got a Youtube channel, you can subscribe :)"); $sender->sendMessage("[MultiTP] Commands : /mtpset ( to set a random spawn position ) and /mtpreset ( to reset all random spawn positions."); $sender->sendMessage("[MultiTP] The default teleporting block is the sponge block, but you can change this in the code of the plugin."); $sender->sendMessage("[MultiTP] Perhaps there will be an update to modify the block of teleportation."); return true; $sender->sendMessage("[MultiTP] If you have suggestions or bugs, please report this to me !"); default: return false; } }