/** * * @param Player|string $player * @return boolean */ public function leaveWar($player) { if (!$player instanceof Player) { $player = $this->plugin->getServer()->getPlayer($player); } if ($this->getSoldier($player) == null) { return false; } else { $this->getSoldier($player)->getPlayer()->teleport($this->getLobby()); $player->getInventory()->clearAll(); $color = $this->getSoldier($player)->getTeam()->getTeamName() == "레드팀" ? TextFormat::RED : TextFormat::BLUE; RankProvider::getInstance()->getRank($player)->deletePrefixs([$color . $this->getSoldier($player)->getTeam()->getTeamName() . TextFormat::GOLD]); unset($this->eventlistener->touchinfo[$player->getName()]); unset($this->getSoldier($player)->getTeam()->soldiers[$player->getName()]); unset($this->soldiers[$player->getName()]); } return true; }
public function onRespawn(PlayerRespawnEvent $event) { $player = $event->getPlayer(); $soldier = $this->plugin->war->getSoldier($player); if ($soldier != null) { if ($soldier->getTeam()->getTeamName() == "레드팀") { $color = TextFormat::RED; } else { $color = TextFormat::BLUE; } $prefix = $color . $soldier->getTeam()->getTeamName() . TextFormat::GOLD; $rank = RankProvider::getInstance()->getRank($player); $rank->addPrefixs([$prefix]); $rank->setPrefix($prefix); $this->plugin->getServer()->getScheduler()->scheduleDelayedTask(new TeleportTask($this->plugin, $player, $soldier->getTeam()->getSpawnPoint()), 10); } else { if (isset($this->plugin->warDB["spawn"]["lobby"])) { $this->plugin->getServer()->getScheduler()->scheduleDelayedTask(new TeleportTask($this->plugin, $player, $this->plugin->war->getLobby()), 10); } } }