p = $main; $this->lvl = $level; $this->maxplayers = $maxplayers; $this->players = []; $this->cfg = $main->getConfig(); $this->radius = $radius; $this->scenarioManager = new ScenarioManager($this->p, $this); } public function getLevel() { return $this->lvl; } public function getPlayers() { return $this->players; } public function getName() { return $this->lvl->getName(); } public function getMaxPlayers() { return $this->maxplayers; } public function setPlayers(array $players) { foreach($players as $player) { if(!in_array($player, $this->players)){ foreach($this->players as $pl) { $pl->sendMessage(Main::PREFIX . C::YELLOW . "{$player->getName()} left the game."); } } } foreach($this->players as $player) { if(!in_array($player, $players)){ foreach($this->players as $pl) { $pl->sendMessage(Main::PREFIX . C::YELLOW . "{$player->getName()} joined the game."); $this->getLevel()->addParticle($part = new FloatingTextParticle(new Vector3($this->getLevel()->getSafeSpawn()->x, $this->getLevel()->getSafeSpawn()->y, $this->getLevel()->getSafeSpawn()->z), C::GREEN . "Welcome to the UHC game, {$player->getName()}!\n" . C::GREEN . "Need help? Use /uhc howtoplay.", C::YELLOW . "-==-"), [$pl]); } } } $this->players = $players; return true; } }