public function onLoaded(DynamicHub $hub) { parent::onLoaded($hub); $this->getOwner()->getServer()->getScheduler()->scheduleRepeatingTask(new CallbackPluginTask($this->getOwner(), [$this, "halfSecondTick"]), 10); }
/** * Load a {@link Game} into the plugin * * @param Game $game * * @throws \RuntimeException */ public function loadGame(Game $game) { $owner = $game->getOwner(); if (!in_array($this->getDescription()->getName(), $owner->getDescription()->getDepend())) { throw new \RuntimeException("A Game must be owned by a plugin that depends on DynamicHub"); } if ($this->single and count($this->loadedGames) > 0) { throw new \RuntimeException("Only one Game can be loaded on this server limited in config"); } $this->loadedGames[strtolower($game->getName()->get())] = $game; $game->onLoaded($this); $this->getLogger()->info("Loaded " . $game->getName()); }