public function __construct(DynamicHub $hub, string $name, string $gameName, array $aliases) { parent::__construct($name, "Join {$gameName}", "/{$name}", $aliases); $this->hub = $hub; $this->gameName = $gameName; $hub->getServer()->getCommandMap()->register("join", $this); }
public static function defaultInstance(DynamicHub $hub, string $username) : GamerData { $data = new GamerData(strtolower($username)); $data->lastModule = HubModule::NAME; $data->inventories = [strtolower(HubModule::NAME) => $hub->getConfig()->getNested("hub.defaultItems")]; return $data; }
public function __construct(DynamicHub $hub) { if ($hub->isSingle()) { return; } $this->hub = $hub; $hub->getServer()->getPluginManager()->registerEvents($this, $hub); }
public function __construct(DynamicHub $hub) { $this->hub = $hub; $this->dir = $hub->getDataFolder() . "data/json/"; $this->playerDir = $this->dir . "players/"; $this->nextIdFile = $this->dir . "nextId.txt"; $this->nextId = is_file($this->dir) ? Binary::readLong(file_get_contents($this->dir . $this->nextIdFile)) : 0; }
public function __construct(DynamicHub $hub) { $this->hub = $hub; $this->sa = $hub->getServer()->getPluginManager()->getPlugin("ServerAuth"); if (!$this->sa instanceof ServerAuth) { throw new \RuntimeException("ServerAuth is not loaded"); } $hub->getServer()->getPluginManager()->registerEvents($this, $hub); }
public function onCompletion(Server $server) { $hub = DynamicHub::getInstance($server); if ($hub !== null) { $game = $hub->getLoadedGame($this->gameName); if ($game instanceof MatchBasedGame) { $match = $game->getMatchById($this->matchId); if ($match !== null) { $match->onMapLoaded($this->getResult()); } } } }
public function onEnable() { $hub = DynamicHub::getInstance($this->getServer()); $hub->loadGame($this->game = new CTFGame($this)); }