prevent to use the plugin without Core
This commit is contained in:
parent
f7c6056828
commit
5e0e801a95
@ -23,6 +23,12 @@ use ManiaControl\Plugins\Plugin;
|
|||||||
use ManiaControl\Settings\Setting;
|
use ManiaControl\Settings\Setting;
|
||||||
use ManiaControl\Settings\SettingManager;
|
use ManiaControl\Settings\SettingManager;
|
||||||
use ManiaControl\Utils\Formatter;
|
use ManiaControl\Utils\Formatter;
|
||||||
|
|
||||||
|
if (! class_exists('MatchManagerSuite\MatchManagerCore')) {
|
||||||
|
$this->maniaControl->getChat()->sendErrorToAdmins('MatchManager Core is needed to use MatchManager Widget plugin. Install it and restart Maniacontrol');
|
||||||
|
Logger::logError('MatchManager Core is needed to use MatchManager Widget plugin. Install it and restart Maniacontrol');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
use MatchManagerSuite\MatchManagerCore;
|
use MatchManagerSuite\MatchManagerCore;
|
||||||
|
|
||||||
|
|
||||||
@ -37,7 +43,7 @@ class MatchManagerWidget implements ManialinkPageAnswerListener, CallbackListene
|
|||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
const PLUGIN_ID = 153;
|
const PLUGIN_ID = 153;
|
||||||
const PLUGIN_VERSION = 1.0;
|
const PLUGIN_VERSION = 1.1;
|
||||||
const PLUGIN_NAME = 'MatchManager Widget';
|
const PLUGIN_NAME = 'MatchManager Widget';
|
||||||
const PLUGIN_AUTHOR = 'Beu';
|
const PLUGIN_AUTHOR = 'Beu';
|
||||||
|
|
||||||
@ -120,6 +126,10 @@ class MatchManagerWidget implements ManialinkPageAnswerListener, CallbackListene
|
|||||||
$this->maniaControl = $maniaControl;
|
$this->maniaControl = $maniaControl;
|
||||||
$this->MatchManagerCore = $this->maniaControl->getPluginManager()->getPlugin(self::MATCHMANAGERCORE_PLUGIN);
|
$this->MatchManagerCore = $this->maniaControl->getPluginManager()->getPlugin(self::MATCHMANAGERCORE_PLUGIN);
|
||||||
|
|
||||||
|
if ($this->MatchManagerCore == Null) {
|
||||||
|
throw new \Exception('MatchManager Core is needed to use MatchManager Widget plugin');
|
||||||
|
}
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect');
|
$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect');
|
||||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'updateSettings');
|
$this->maniaControl->getCallbackManager()->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'updateSettings');
|
||||||
@ -502,3 +512,4 @@ class MatchManagerWidget implements ManialinkPageAnswerListener, CallbackListene
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user