public function onPlayerInteract(PlayerInteractEvent $event) { $player = $event->getPlayer(); $block = $event->getBlock(); if ($player instanceof Player) { if (round($this->plugin->vipSignPos->x) === round($block->x) and round($this->plugin->vipSignPos->y) === round($block->y) and round($this->plugin->vipSignPos->z) === round($block->z)) { if ($this->plugin->vipenforceaccess) { $vip = $this->checkInVIP($event->getPlayer()); if (!$vip) { $message = TextFormat::YELLOW . "[HG] Require " . TextFormat::RED . "VIP+ " . TextFormat::YELLOW . "membership."; $event->getPlayer()->sendMessage($message); return; } } MapPortal::teleportingToLobby($player, $this->plugin->vipLevelName, $this->plugin->vipSpawnPos); $this->plugin->log("[HG] teleporting to VIP lodge " . $this->plugin->vipSpawnPos->x . " " . $this->plugin->vipSpawnPos->y . " " . $this->plugin->vipSpawnPos->z); $player->sendTip(TextFormat::BOLD . TextFormat::WHITE . "Welcome to " . TextFormat::RED . "[V.I.P.+ " . TextFormat::GOLD . "Lodge]"); return; } if (round($this->plugin->vipExitSignPos->x) === round($block->x) and round($this->plugin->vipExitSignPos->y) === round($block->y) and round($this->plugin->vipExitSignPos->z) === round($block->z)) { MapPortal::teleportingToLobby($player, $this->plugin->hubLevelName, $this->plugin->hubSpawnPos); $this->plugin->log("[HG] teleporting to HG lobby " . $this->plugin->hubSpawnPos->x . " " . $this->plugin->hubSpawnPos->y . " " . $this->plugin->hubSpawnPos->z); $player->sendTip(TextFormat::BOLD . TextFormat::WHITE . "Welcome to " . TextFormat::RED . "HG " . TextFormat::GOLD . "Lobby"); return; } } }
/** * onCommand * * @param CommandSender $sender * @param Command $command * @param unknown $label * @param array $args * @return boolean */ public function onCommand(CommandSender $sender, Command $command, $label, array $args) { $output = TextFormat::GRAY . $this->plugin->version . "\n"; $output .= TextFormat::GRAY . "--------------------------------------\n"; if (strtolower($command->getName()) === "hg" && isset($args[0]) || $command->getName() === "hg2") { /** * PLAYER COMMANDS */ if (strtolower($args[0]) == "help") { $this->showPlayerHelpCommands($sender); return true; } if (strtolower($args[0]) == "adminhelp") { if (!$sender->isOp()) { $output = TextFormat::YELLOW . "You are not authorized to run this command.\n"; $sender->sendMessage($output); return; } $this->showAdminHelpCommands($sender); return true; } if (strtolower($args[0]) == "maphelp") { if (!$sender->isOp()) { $output = TextFormat::YELLOW . "You are not authorized to run this command.\n"; $sender->sendMessage($output); return; } $this->showAdminMapHelpCommands($sender); return true; } if (strtolower($args[0]) == "levelhelp") { if (!$sender->isOp()) { $output = TextFormat::YELLOW . "You are not authorized to run this command.\n"; $sender->sendMessage($output); return; } $this->showAdminLevelSetupHelpCommands($sender); return true; } if (strtolower($args[0]) == "arenahelp") { if (!$sender->isOp()) { $output = TextFormat::YELLOW . "You are not authorized to run this command.\n"; $sender->sendMessage($output); return; } $this->showAdminArenaSetupHelpCommands($sender); return true; } if (strtolower($args[0]) === "parkour") { if ($sender instanceof Player) { if ($sender->getLevel()->getName() != $this->plugin->hubLevelName) { $sender->sendMessage("[HG] You are not at Lobby!"); return; } if (!empty($this->plugin->hubLobbyParkourPos)) { $sender->sendMessage(TextFormat::GRAY . "[HG] TP to Parkour..."); $sender->teleport($this->plugin->hubLobbyParkourPos); } } return; } if (strtolower($args[0]) === "players") { if ($sender instanceof Player) { $sender->sendMessage("[HG] online players " . TextFormat::AQUA . count($this->plugin->getServer()->getOnlinePlayers())); } return; } // player lobby if (strtolower($args[0]) === "exit" || strtolower($args[0]) === "lobby" || strtolower($args[0]) === "home") { $sender->sendMessage(TextFormat::GRAY . "[HG] TP to Lobby..."); if ($sender instanceof Player) { if ($sender instanceof Player) { MapPortal::teleportingToLobby($sender, $this->plugin->hubLevelName, $this->plugin->hubSpawnPos); $this->plugin->gameLevelManager->handlePlayerLeaveTheGame($sender); } } return; } // player VIP+ lobby if (strtolower($args[0]) === "vip" || strtolower($args[0]) === "viplodge" || strtolower($args[0]) === "lodge") { if ($sender instanceof Player) { if ($sender instanceof Player) { if ($this->plugin->vipenforceaccess) { $vip = $this->plugin->profileManager->isPlayerVIP($sender->getName()); if (!$vip) { $sender->sendMessage(TextFormat::YELLOW . "[HG] Required" . TextFormat::RED . " VIP+ " . TextFormat::YELLOW . "membership!"); return; } $sender->sendMessage(TextFormat::GRAY . "[HG] TP to VIP+ lodge..."); MapPortal::teleportingToLobby($sender, $this->plugin->vipLevelName, $this->plugin->vipSpawnPos); $this->plugin->gameLevelManager->handlePlayerLeaveTheGame($sender); } else { $sender->sendMessage(TextFormat::GRAY . "[HG] TP to VIP+ lodge..."); MapPortal::teleportingToLobby($sender, $this->plugin->vipLevelName, $this->plugin->vipSpawnPos); $this->plugin->gameLevelManager->handlePlayerLeaveTheGame($sender); } } } return; } if (strtolower($args[0]) === "mybalance") { $data = $this->plugin->profileManager->retrievePlayerBalance($sender->getName()); if ($data == null || count($data) === 0) { $sender->sendMessage(TextFormat::GRAY . "[HG] No profile found"); } else { $sender->sendMessage(TextFormat::WHITE . "[HG] My balance is " . TextFormat::GOLD . $data[0]["balance"] . TextFormat::WHITE . " coins."); } return; } if (strtolower($args[0]) === "toprank") { $topWinners = $this->plugin->profileManager->retrieveTopPlayers(); if (is_null($topWinners)) { $sender->sendMessage(TextFormat::GRAY . "[HG] No record found!"); return; } $message = TextFormat::BOLD . TextFormat::DARK_RED . "HALL OF FAME\n"; $message = TextFormat::BOLD . TextFormat::AQUA . "BEST OF THE BEST\n"; if (count($topWinners) == 1) { $goldPlayerName = $topWinners[0]["pname"]; $goldPlayerWins = $topWinners[0]["wins"]; $message .= TextFormat::GOLD . "Top #1 "; $message .= TextFormat::GOLD . " " . $goldPlayerWins . TextFormat::WHITE . " Wins " . TextFormat::LIGHT_PURPLE . $goldPlayerName; $sender->sendMessage($message); } elseif (count($topWinners) == 2) { $goldPlayerName = $topWinners[0]["pname"]; $goldPlayerWins = $topWinners[0]["wins"]; $silverPlayerName = $topWinners[1]["pname"]; $silverPlayerWins = $topWinners[1]["wins"]; $message .= TextFormat::GOLD . "Top #1 "; $message .= TextFormat::GOLD . " " . $goldPlayerWins . TextFormat::WHITE . " Wins " . TextFormat::LIGHT_PURPLE . $goldPlayerName; $message .= TextFormat::GOLD . "\nTop #2 "; $message .= TextFormat::GOLD . " " . $silverPlayerWins . TextFormat::WHITE . " Wins " . TextFormat::LIGHT_PURPLE . $silverPlayerName; $sender->sendMessage($message); } elseif (count($topWinners) == 3) { $goldPlayerName = $topWinners[0]["pname"]; $goldPlayerWins = $topWinners[0]["wins"]; $silverPlayerName = $topWinners[1]["pname"]; $silverPlayerWins = $topWinners[1]["wins"]; $brownsePlayerName = $topWinners[2]["pname"]; $brownsePlayerNameWins = $topWinners[2]["wins"]; $message .= TextFormat::GOLD . "Top #1 "; $message .= TextFormat::GOLD . " " . $goldPlayerWins . TextFormat::WHITE . " Wins " . TextFormat::LIGHT_PURPLE . $goldPlayerName; $message .= TextFormat::GOLD . "\nTop #2 "; $message .= TextFormat::GOLD . " " . $silverPlayerWins . TextFormat::WHITE . " Wins " . TextFormat::LIGHT_PURPLE . $silverPlayerName; $message .= TextFormat::GOLD . "\nTop #3 "; $message .= TextFormat::GOLD . " " . $brownsePlayerNameWins . TextFormat::WHITE . " Wins " . TextFormat::LIGHT_PURPLE . $brownsePlayerName; $sender->sendMessage($message); } $data = $this->plugin->profileManager->retrievePlayerStats($sender->getName()); if (count($data) > 0) { $output = TextFormat::GREEN . "\nMy Wins: " . $data[0]["wins"]; $sender->sendMessage($output); } return; } if (strtolower($args[0]) === "myprofile") { $data = $this->plugin->profileManager->retrievePlayerByName($sender->getName()); if ($data == null || count($data) == 0) { $output = "[HG] No profile found"; } else { $output = ""; $output .= TextFormat::BOLD . "[HG] Profile Information> \n"; $output .= " balance: " . $data[0]["balance"] . "\n"; $output .= " wins: " . $data[0]["wins"] . "\n"; $output .= " loss: " . $data[0]["loss"] . "\n"; } $sender->sendMessage(TextFormat::GRAY . $output); return; } if (strtolower($args[0]) === "mywins") { // $data = $this->plugin->storyManager->retrievePlayerWinsByLevelMap ( $sender->getName () ); // if ($data == null || count ( $data ) == 0) { // $output = "[HG] No level record found"; // } else { // $output= TextFormat::BOLD.TextFormat::AQUA."MY WINS BY LEVEL\n"; // $output .= TextFormat::GRAY ."| level | wins | loss | points | map |\n"; // foreach ( $data as $record ) { // $output.="| "; // $output .= TextFormat::GREEN .$record ["level"] . TextFormat::GRAY . " | "; // $output .= TextFormat::GOLD .$record ["wins"] . TextFormat::GRAY . " | "; // $output .= TextFormat::WHITE .$record ["loss"] . TextFormat::GRAY . " | "; // $output .= TextFormat::BLUE . $record ["points"] .TextFormat::GRAY." | "; // $output .= TextFormat::ITALIC.TextFormat::WHITE .$record ["map"] . TextFormat::GRAY . " \n"; // } // $output .= TextFormat::GRAY . "\n"; // } // $sender->sendMessage ( TextFormat::GRAY . $output ); $this->showMyWins($sender, $args); return; } if (strtolower($args[0]) === "mypoints") { $data = $this->plugin->storyManager->retrievePlayerWinsByPoints($sender->getName()); if ($data == null || count($data) == 0) { $output = "[HG] No level record found"; } else { $output = TextFormat::BOLD . TextFormat::AQUA . "MY POINTS BY MAP\n"; $output .= TextFormat::GRAY . "| level | wins | loss | points | map |\n"; foreach ($data as $record) { $output .= "| "; $output .= TextFormat::WHITE . $record["level"] . TextFormat::GRAY . " | "; $output .= TextFormat::BLUE . $record["wins"] . TextFormat::GRAY . " | "; $output .= TextFormat::WHITE . $record["loss"] . TextFormat::GRAY . " | "; $output .= TextFormat::GOLD . $record["points"] . TextFormat::GRAY . " | "; $output .= TextFormat::UNDERLINE . TextFormat::GREEN . $record["map"] . TextFormat::GRAY . " \n"; } $output .= TextFormat::GRAY . "\n"; } $sender->sendMessage(TextFormat::GRAY . $output); return; } if (strtolower($args[0]) === "topwins") { if (count($args) != 2) { $message = "[HG]-Usage: /hg topwins [level|map]"; $sender->sendMessage($message); return; } if ($args[1] != "level" && $args[1] != "map") { $message = "[HG] Usage: /hg topwins [level|map]"; $sender->sendMessage($message); return; } $data = []; $output = ""; if ($args[1] === "level") { $output = TextFormat::BOLD . TextFormat::BLUE . "TOP WINS BY [LEVEL]\n"; $data = $this->plugin->storyManager->retrieveTopLevelPlayers(); } if ($args[1] === "map") { $output = TextFormat::BOLD . TextFormat::BLUE . "TOP WINS BY [MAP]\n"; $data = $this->plugin->storyManager->retrieveTopMapPlayers(); } if ($data === null || count($data) === 0) { $output = "[HG] No records found"; } else { if ($args[1] === "map") { $output .= TextFormat::GRAY . "| level | wins | loss | points | map | player |\n"; } else { $output .= TextFormat::GRAY . "| level | wins | loss | points | player |\n"; } foreach ($data as $record) { $output .= "| "; if ($args[1] === "map") { $output .= TextFormat::WHITE . $record["level"] . TextFormat::GRAY . " | "; } else { $output .= TextFormat::GREEN . $record["level"] . TextFormat::GRAY . " | "; } $output .= TextFormat::GOLD . $record["wins"] . TextFormat::GRAY . " | "; $output .= TextFormat::WHITE . $record["loss"] . TextFormat::GRAY . " | "; $output .= TextFormat::WHITE . $record["points"] . " | "; if ($args[1] === "map") { $output .= TextFormat::GREEN . $record["map"] . TextFormat::GRAY . " | "; } $output .= TextFormat::AQUA . $record["pname"] . TextFormat::GRAY . " \n"; } $output .= TextFormat::GRAY . "\n"; } $sender->sendMessage(TextFormat::GRAY . $output); return; } /* * MAP ADMINISTRATION */ // player admin panel if (strtolower($args[0]) === "adminpanel" || strtolower($args[0]) === "admin") { if (!$sender->isOp()) { $output = TextFormat::YELLOW . "You are not authorized to run this command.\n"; $sender->sendMessage($output); return; } $sender->sendMessage(TextFormat::GRAY . "[HG] TP to admin panel..."); if ($sender instanceof Player) { MapPortal::teleportingToLobby($sender, $this->plugin->hubAdminPanelLevelName, $this->plugin->hubAdminPanelPos); $this->plugin->gameLevelManager->handlePlayerLeaveTheGame($sender); } return; } // player admin panel if (strtolower($args[0]) === "vipadminpanel" || strtolower($args[0]) === "vipadmin") { if (!$sender->isOp()) { $output = TextFormat::YELLOW . "You are not authorized to run this command.\n"; $sender->sendMessage($output); return; } $sender->sendMessage(TextFormat::GRAY . "[HG] TP to VIP admin panel..."); if ($sender instanceof Player) { MapPortal::teleportingToLobby($sender, $this->plugin->hubAdminVIPPanelLevelName, $this->plugin->hubAdminVIPPanelPos); $this->plugin->gameLevelManager->handlePlayerLeaveTheGame($sender); } return; } // teleport to arenas if (strtolower($args[0]) === "tpa") { if (!$sender->isOp()) { $output = TextFormat::YELLOW . "You are not authorized to run this command.\n"; $sender->sendMessage($output); return; } $sender->sendMessage(TextFormat::GRAY . "[HG] TP to arena..."); if ($sender instanceof Player) { if (count($args) != 2) { $sender->sendMessage("usage: /hg tpa [arena name]"); return; } if (!isset($this->plugin->arenaManager->arenas[$args[1]])) { $sender->sendMessage("[HG] Arena name not found: " . $args[1]); return; } $arena = $this->plugin->arenaManager->arenas[$args[1]]; if (empty($arena)) { $sender->sendMessage("[HG] Arena not found: " . $args[1]); return; } if ($arena instanceof MapArenaModel) { if (empty($arena->enterLevelName) || empty($arena->arenaEnterPos)) { $sender->sendMessage("[HG] Missing Arena level configuration: " . $args[1]); return; } $sender->sendMessage(TextFormat::GRAY . "[HG] TP to VIP+ lodge..."); MapPortal::teleportingToLobby($sender, $arena->enterLevelName, $arena->arenaEnterPos); } } return; } /* * PLAYER PROFILE ADMINISTRATION */ if (strtolower($args[0]) === "setbalance") { if (!$sender->isOp()) { $output = TextFormat::YELLOW . "You are not authorized to run this command.\n"; $sender->sendMessage($output); return; } if (count($args) != 3) { $sender->sendMessage("usage: /hg setbalance [player name] [amount]"); return; } // check if player exit in the server $playerName = $args[1]; $olp = Server::getInstance()->getPlayerExact($playerName); if (empty($olp)) { $offp = Server::getInstance()->getOfflinePlayer($playerName); if (empty($offp)) { $sender->sendMessage(TextFormat::YELLOW . "[HG] Player Not Found! "); return; } } $rs = $this->plugin->profileManager->setBalance($args[1], $args[2]); $sender->sendMessage(TextFormat::GREEN . "[HG] player [" . $playerName . "] balance updated | " . $rs); return; } if (strtolower($args[0]) === "addvip") { if (!$sender->isOp()) { $output = TextFormat::YELLOW . "You are not authorized to run this command.\n"; $sender->sendMessage($output); return; } if (count($args) != 2) { $sender->sendMessage(TextFormat::GREEN . "usage: /hg addvip [player name]"); return; } $playerName = $args[1]; $rs = $this->plugin->profileManager->upsetVIP($playerName, "true"); $sender->sendMessage(TextFormat::GREEN . "[HG] VIP [" . TextFormat::GOLD . $playerName . TextFormat::GREEN . "] Added (" . $rs . ")!"); return; } if (strtolower($args[0]) === "getvip") { if (!$sender->isOp()) { $output = TextFormat::YELLOW . "You are not authorized to run this command.\n"; $sender->sendMessage($output); return; } if (count($args) != 2) { $sender->sendMessage(TextFormat::GREEN . "usage: /hg getvip [player name]"); return; } $playerName = $args[1]; $data = $this->plugin->profileManager->retrievePlayerVIP($playerName); if (empty($data) || count($data) === 0) { $sender->sendMessage(TextFormat::YELLOW . "[HG] VIP profile Not Found!"); return; } $output = ""; $output .= TextFormat::BOLD . "[HG] VIP Player Profile: \n"; $output .= TextFormat::DARK_GREEN . "- player: " . TextFormat::AQUA . $data[0]["pname"] . "\n"; $output .= TextFormat::DARK_GREEN . "- vip: " . TextFormat::GOLD . $data[0]["vip"] . "\n"; $output .= TextFormat::DARK_GREEN . "- balance: " . TextFormat::WHITE . $data[0]["balance"] . "\n"; $output .= TextFormat::DARK_GREEN . "- wins: " . TextFormat::WHITE . $data[0]["wins"] . "\n"; $output .= TextFormat::DARK_GREEN . "- loss: " . TextFormat::WHITE . $data[0]["loss"] . "\n"; $output .= TextFormat::DARK_GREEN . "- ludt: " . TextFormat::WHITE . $data[0]["lupt"] . "\n"; $sender->sendMessage($output); return; } if (strtolower($args[0]) === "delvip") { if (!$sender->isOp()) { $output = TextFormat::YELLOW . "You are not authorized to run this command.\n"; $sender->sendMessage($output); return; } if (count($args) != 2) { $sender->sendMessage("usage: /hg delvip [player name]"); return; } // check if player exit in the server $playerName = $args[1]; $olp = Server::getInstance()->getPlayerExact($playerName); if (empty($olp)) { $offp = Server::getInstance()->getOfflinePlayer($playerName); if (empty($offp)) { $sender->sendMessage(TextFormat::YELLOW . "[HG] Player Not Found! "); return; } } $rs = $this->plugin->profileManager->upsetVIP($playerName, "false"); $sender->sendMessage(TextFormat::GREEN . "[HG] VIP [" . TextFormat::GOLD . $playerName . TextFormat::GREEN . "] delete (" . $rs . ")!"); return; } if (strtolower($args[0]) === "createprofile") { if (!$sender->isOp()) { $output = TextFormat::YELLOW . "You are not authorized to run this command.\n"; $sender->sendMessage($output); return; } if (count($args) != 2) { $sender->sendMessage("usage: /hg createprofile [player name]"); return; } $rs = $this->plugin->profileManager->addPlayer($args[1]); $sender->sendMessage(TextFormat::GREEN . "[HG] player profile created! " . $rs); return; } if (strtolower($args[0]) === "changename") { if (!$sender->isOp()) { $output = TextFormat::YELLOW . "You are not authorized to run this command.\n"; $sender->sendMessage($output); return; } if (count($args) != 3) { $sender->sendMessage("usage: /hg changename [old name] [new name]"); return; } $pname = $args[1]; $newname = $args[2]; $rs1 = $this->plugin->profileManager->isPlayerExist($pname); if (empty($rs1) || count($rs1) === 0) { $sender->sendMessage(TextFormat::GREEN . "[HG] player profile record not found!"); return; } $rs2 = $this->plugin->profileManager->isPlayerExist($pname); if (empty($rs2) || count($rs2) === 0) { $sender->sendMessage(TextFormat::GREEN . "[HG] player story record not found!"); return; } try { $this->plugin->profileManager->changePlayerName($pname, $newname); $this->plugin->storyManager->changePlayerName($pname, $newname); $sender->sendMessage(TextFormat::GREEN . "[HG] Success! change from [" . $pname . "] to [" . $newname . "]"); } catch (Exception $e) { $this->plugin->printError($e); $sender->sendMessage(TextFormat::GREEN . "[HG] Failed! " . $e->getMessage()); } return; } /** * ADMIN COMMANDS */ if (strtolower($args[0]) === "setgamelobby") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleSetGameLobbyCommand($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "setserverlobby") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleSetServerLobbyCommand($sender->getPlayer(), $args); return; } /** * SETUP ARENA COMMANDS */ if (strtolower($args[0]) === "newarena") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] In-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->createArena($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "arenawand") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleArenaWandCommand($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "setarenapos1") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleSetArenaPosition1Command($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "setarenapos2") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleSetArenaPosition2Command($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "setarenawall") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleSetArenaWallCommand($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "setarenaspawn") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleSetArenaPlayerSpawnCommand($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "startspawnwand") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleArenaWandPlayerSpawnPointCommand($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "stopspawnwand") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $session =& $this->plugin->arenaManager->session($sender); if ($session != null && $session["wand-usage"] === true) { $session["wand-usage"] = false; if (!isset($session["spawn-pos"])) { unset($session["spawn-pos"]); } } $output = TextFormat::GREEN . "[HG] Player Spawn Wand Stopped!"; $sender->sendMessage($output); return; } if (strtolower($args[0]) === "listspawns") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->ListArenaPlayerSpawnCommand($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "clearspawns") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->clearArenaPlayerSpawnPointsCommand($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "setarenaenter") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleSetArenaEntranceCommand($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "setarenaexit") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleSetArenaExitCommand($sender->getPlayer(), $args); return; } /** * SETUP DEATH-MATCH ARENA COMMANDS */ if (strtolower($args[0]) === "matchwand") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleArenaDeathMatchWandCommand($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "setmatchpos1") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleSetArenaDeathMatchPosition1Command($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "setmatchpos2") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleSetArenaDeathMatchPosition2Command($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "setmatchenter") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleSetArenaDeathMatchEntranceCommand($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "setmatchwall") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleSetDeathMatchWallsCommand($sender->getPlayer(), $args); return; } /** * Arena Publishing */ if (strtolower($args[0]) === "publish") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleActivateArenaCommand($sender->getPlayer(), $args); $this->plugin->arenaManager->preloadArenas(); return; } if (strtolower($args[0]) === "unpublish") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleDeActivateArenaCommand($sender->getPlayer(), $args); $this->plugin->arenaManager->preloadArenas(); return; } /** * Level Management */ if (strtolower($args[0]) === "addlevelarena") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->gameLevelManager->handleAdditionOfLevelArenaCommand($sender->getPlayer(), $args); $this->plugin->gameLevelManager->preloadArenas(); return; } if (strtolower($args[0]) === "dellevelarena") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->gameLevelManager->handleRemovalOfLevelArenaCommand($sender->getPlayer(), $args); $this->plugin->gameLevelManager->preloadArenas(); return; } /** * SETUP GAME LEVEL */ if (strtolower($args[0]) === "levelwand") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->gameLevelManager->handleLevelWandCommand($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "setlevelpos1") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleSetGamePortalPosition1Command($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "setlevelpos2") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleSetGamePortalPosition2Command($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "levelgatewand") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->gameLevelManager->handleLevelGateWandCommand($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "setlevelgatepos1") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleSetGamePortalGate1Command($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "setlevelgatepos2") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->arenaManager->handleSetGamePortalGate2Command($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "setlevelenter") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->gameLevelManager->handleSetLevelEntranceCommand($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "setlevelexit") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if (!$sender instanceof Player) { $output .= "[HG] in-game command only!"; $sender->sendMessage($output); return; } $this->plugin->gameLevelManager->handleSetLevelExitCommand($sender->getPlayer(), $args); return; } if (strtolower($args[0]) === "blockon") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } $this->plugin->blockhud = true; $sender->sendMessage("[HG] Admin Block Location Display " . TextFormat::GREEN . "[ON]"); return; } if (strtolower($args[0]) === "blockoff") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } $this->plugin->blockhud = false; $sender->sendMessage("[HG] Admin Block Location Display " . TextFormat::RED . "[OFF]"); return; } if (strtolower($args[0]) === "xyz") { if (!$sender->isOp()) { $sender->sendMessage("[HG] No authorization!"); return; } if ($sender instanceof Player) { $portalLevel = $sender->level->getName(); $sender->sendMessage("You are in world [" . $portalLevel . "] at \n[ " . round($sender->x) . " " . round($sender->y) . " " . round($sender->z) . " ]"); } return; } } }