public function onEnable() { // Custom API Setup :3 $this->getServer()->getPluginManager()->callEvent($ev = new CreateAPIEvent($this, BaseAPI::class)); $class = $ev->getClass(); $this->api = new $class($this); // Other startup code... if (!is_dir($this->getDataFolder())) { mkdir($this->getDataFolder()); } $this->checkConfig(); $this->getLogger()->info(TextFormat::YELLOW . "Loading..."); $this->registerEvents(); $this->registerCommands(); if (count($l = $this->getServer()->getOnlinePlayers()) > 0) { $this->getAPI()->createSession($l); } if ($this->getAPI()->isUpdaterEnabled()) { $this->getAPI()->fetchEssentialsPEUpdate(false); } $this->getAPI()->scheduleAutoAFKSetter(); }
public function onLoad() { $this->getServer()->getPluginManager()->callEvent($ev = new CreateAPIEvent($this, BaseAPI::class)); $class = $ev->getClass(); $this->api = new $class($this); }