private function starting() { $pk = new UpdateAttributesPacket(); $pk->minValue = 0; $pk->maxValue = 1000; $pk->value = $this->startTime; $pk->name = UpdateAttributesPacket::EXPERIENCE_LEVEL; foreach ($this->plugin->players as $p) { $p["ins"]->dataPacket($pk); } if ($this->startTime <= 0) { $this->startTime = SurvivalGames::$cfg["auto_start_time"]; $this->plugin->startGame(); return; } elseif ($this->startTime === 30 || $this->startTime <= 5) { $msg = Messages::getMsg("countdown", ["%TIME", $this->startTime]); foreach ($this->plugin->players as $p) { $p["ins"]->sendMessage($msg); } } $this->startTime--; }
public function onDisable() { $this->getLogger()->info(TextFormat::DARK_RED . Messages::getMsg("plugin-disable")); }
public function startGame() { $this->game = 2; $msg = Messages::getMsg("started", ["%NAME", $this->name]); $sound = new AnvilUseSound(new Vector3()); foreach ($this->players as $p) { /** @var Player $pl */ $pl = $p["ins"]; $pl->sendMessage($msg); $sound->setComponents($pl->x, $pl->y, $pl->z); $this->level->addSound($sound, [$pl]); } }