fix admin ui display when manually enabled

This commit is contained in:
Beu 2024-06-19 11:50:17 +02:00
parent cfa24ff67f
commit 67a7552871

View File

@ -42,7 +42,7 @@ class MatchManagerAdminUI implements CallbackListener, ManialinkPageAnswerListen
* Constants * Constants
*/ */
const PLUGIN_ID = 174; const PLUGIN_ID = 174;
const PLUGIN_VERSION = 1.1; const PLUGIN_VERSION = 1.2;
const PLUGIN_NAME = 'MatchManager Admin UI'; const PLUGIN_NAME = 'MatchManager Admin UI';
const PLUGIN_AUTHOR = 'Beu'; const PLUGIN_AUTHOR = 'Beu';
@ -130,7 +130,7 @@ class MatchManagerAdminUI implements CallbackListener, ManialinkPageAnswerListen
} }
// All callbacks are loaded in handleAfterInit // All callbacks are loaded in handleAfterInit
$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit'); $this->maniaControl->getTimerManager()->registerOneTimeListening($this, 'afterPluginInit', 1);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_POSX, 156., ""); $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_POSX, 156., "");
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_POSY, 24., ""); $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_POSY, 24., "");
@ -146,13 +146,13 @@ class MatchManagerAdminUI implements CallbackListener, ManialinkPageAnswerListen
} }
/** /**
* handleAfterInit * afterPluginInit
*
* Plugins are loaded alphabetically, so we have to we wait they are all loaded before check. * Plugins are loaded alphabetically, so we have to we wait they are all loaded before check.
* We can't use AFTER_INIT Callback to make it visible when enabled manually
* *
* @return void * @return void
*/ */
public function handleAfterInit() { public function afterPluginInit() {
$this->MatchManagerCore = $this->maniaControl->getPluginManager()->getPlugin(self::MATCHMANAGERCORE_PLUGIN); $this->MatchManagerCore = $this->maniaControl->getPluginManager()->getPlugin(self::MATCHMANAGERCORE_PLUGIN);
if ($this->MatchManagerCore === null) { if ($this->MatchManagerCore === null) {
$this->maniaControl->getChat()->sendErrorToAdmins('MatchManager Core is needed to use ' . self::PLUGIN_NAME . ' plugin.'); $this->maniaControl->getChat()->sendErrorToAdmins('MatchManager Core is needed to use ' . self::PLUGIN_NAME . ' plugin.');