Compare commits
No commits in common. "cfa24ff67fe291af05377a7a484e248088a38104" and "edbe75c39ec4c2d7d3a4ec694654178b04a0410a" have entirely different histories.
cfa24ff67f
...
edbe75c39e
@ -25,6 +25,9 @@ use ManiaControl\Callbacks\CallbackManager;
|
||||
use ManiaControl\Players\Player;
|
||||
use ManiaControl\Players\PlayerManager;
|
||||
|
||||
use ManiaControl\Script\InvokeScriptCallback;
|
||||
|
||||
|
||||
if (!class_exists('MatchManagerSuite\MatchManagerCore')) {
|
||||
$this->maniaControl->getChat()->sendErrorToAdmins('MatchManager Core is required to use one of MatchManager plugin. Install it and restart Maniacontrol');
|
||||
Logger::logError('MatchManager Core is required to use one of MatchManager plugin. Install it and restart Maniacontrol');
|
||||
@ -42,7 +45,7 @@ class MatchManagerAdminUI implements CallbackListener, ManialinkPageAnswerListen
|
||||
* Constants
|
||||
*/
|
||||
const PLUGIN_ID = 174;
|
||||
const PLUGIN_VERSION = 1.1;
|
||||
const PLUGIN_VERSION = 1;
|
||||
const PLUGIN_NAME = 'MatchManager Admin UI';
|
||||
const PLUGIN_AUTHOR = 'Beu';
|
||||
|
||||
@ -129,40 +132,22 @@ class MatchManagerAdminUI implements CallbackListener, ManialinkPageAnswerListen
|
||||
throw new \Exception('MatchManager Core is needed to use ' . self::PLUGIN_NAME);
|
||||
}
|
||||
|
||||
// All callbacks are loaded in handleAfterInit
|
||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit');
|
||||
|
||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_POSX, 156., "");
|
||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_POSY, 24., "");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \ManiaControl\Plugins\Plugin::unload()
|
||||
*/
|
||||
public function unload() {
|
||||
$this->maniaControl->getManialinkManager()->hideManialink(self::MLID_ADMINUI_SIDEMENU);
|
||||
}
|
||||
|
||||
/**
|
||||
* handleAfterInit
|
||||
*
|
||||
* Plugins are loaded alphabetically, so we have to we wait they are all loaded before check.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handleAfterInit() {
|
||||
$this->MatchManagerCore = $this->maniaControl->getPluginManager()->getPlugin(self::MATCHMANAGERCORE_PLUGIN);
|
||||
if ($this->MatchManagerCore === null) {
|
||||
$this->maniaControl->getChat()->sendErrorToAdmins('MatchManager Core is needed to use ' . self::PLUGIN_NAME . ' plugin.');
|
||||
$this->maniaControl->getPluginManager()->deactivatePlugin((get_class()));
|
||||
return;
|
||||
if ($this->maniaControl->getPluginManager()->getSavedPluginStatus(self::MATCHMANAGERCORE_PLUGIN)) {
|
||||
// plugin are loaded in alphabetic order, just wait 1 sec before trying to load MatchManager Core
|
||||
$this->maniaControl->getTimerManager()->registerOneTimeListening($this, function () {
|
||||
$this->MatchManagerCore = $this->maniaControl->getPluginManager()->getPlugin(self::MATCHMANAGERCORE_PLUGIN);
|
||||
if ($this->MatchManagerCore === null) {
|
||||
$this->maniaControl->getChat()->sendErrorToAdmins('MatchManager Core is needed to use ' . self::PLUGIN_NAME . ' plugin.');
|
||||
$this->maniaControl->getPluginManager()->deactivatePlugin((get_class()));
|
||||
} else {
|
||||
$this->generateManialink();
|
||||
$this->displayManialink();
|
||||
}
|
||||
}, 1000);
|
||||
} else {
|
||||
throw new \Exception('MatchManager Core is needed to use ' . self::PLUGIN_NAME);
|
||||
}
|
||||
|
||||
$this->generateManialink();
|
||||
$this->displayManialink();
|
||||
|
||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(PluginManager::CB_PLUGIN_LOADED, $this, 'handlePluginLoaded');
|
||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(PluginManager::CB_PLUGIN_UNLOADED, $this, 'handlePluginUnloaded');
|
||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'updateSettings');
|
||||
@ -174,6 +159,18 @@ class MatchManagerAdminUI implements CallbackListener, ManialinkPageAnswerListen
|
||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(MatchManagerCore::CB_MATCHMANAGER_STOPMATCH, $this, 'generateManialink');
|
||||
|
||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
|
||||
|
||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_POSX, 156., "");
|
||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_POSY, 24., "");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \ManiaControl\Plugins\Plugin::unload()
|
||||
*/
|
||||
public function unload() {
|
||||
$this->maniaControl->getManialinkManager()->hideManialink(self::MLID_ADMINUI_SIDEMENU);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,7 +38,7 @@ use ManiaControl\Callbacks\TimerListener; // for pause
|
||||
class MatchManagerCore implements CallbackListener, CommandListener, TimerListener, CommunicationListener, Plugin {
|
||||
|
||||
const PLUGIN_ID = 152;
|
||||
const PLUGIN_VERSION = 5.3;
|
||||
const PLUGIN_VERSION = 5.2;
|
||||
const PLUGIN_NAME = 'MatchManager Core';
|
||||
const PLUGIN_AUTHOR = 'Beu';
|
||||
|
||||
@ -745,7 +745,6 @@ class MatchManagerCore implements CallbackListener, CommandListener, TimerListen
|
||||
public function resetMatchVariables() {
|
||||
$this->matchStarted = false;
|
||||
$this->matchrecover = false;
|
||||
$this->pauseon = false;
|
||||
$this->pointstorecover = array();
|
||||
$this->currentscore = array();
|
||||
$this->preendroundscore = array();
|
||||
@ -1126,11 +1125,6 @@ class MatchManagerCore implements CallbackListener, CommandListener, TimerListen
|
||||
|
||||
$this->maniaControl->getChat()->sendError($this->chatprefix . 'Match stopped by an Admin!');
|
||||
|
||||
// Cancel pause if match stopped during a pause
|
||||
if ($this->pauseon) {
|
||||
$this->unsetNadeoPause();
|
||||
}
|
||||
|
||||
// Load TimeAttack gamemode if possible
|
||||
$maplist = 'MatchSettings' . DIRECTORY_SEPARATOR . $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MATCH_POST_MATCH_MAPLIST);
|
||||
if (is_file($this->maniaControl->getServer()->getDirectory()->getMapsFolder() . $maplist)) {
|
||||
|
@ -42,7 +42,7 @@ class MatchManagerMultipleConfigManager implements ManialinkPageAnswerListener,
|
||||
* Constants
|
||||
*/
|
||||
const PLUGIN_ID = 171;
|
||||
const PLUGIN_VERSION = 1.3;
|
||||
const PLUGIN_VERSION = 1.2;
|
||||
const PLUGIN_NAME = 'MatchManager Multiple Config Manager';
|
||||
const PLUGIN_AUTHOR = 'Beu';
|
||||
|
||||
@ -224,7 +224,7 @@ class MatchManagerMultipleConfigManager implements ManialinkPageAnswerListener,
|
||||
case self::ML_ACTION_SAVE_CONFIG:
|
||||
if ($callback[1][3][0]["Value"]) {
|
||||
$this->showConfigListUI(array(), $player);
|
||||
$this->saveCurrentConfig($callback[1][3]);
|
||||
$this->saveConfig($callback[1][3]);
|
||||
$this->showConfigListUI(array(), $player);
|
||||
}
|
||||
break;
|
||||
@ -295,12 +295,12 @@ class MatchManagerMultipleConfigManager implements ManialinkPageAnswerListener,
|
||||
}
|
||||
|
||||
/**
|
||||
* saveCurrentConfig
|
||||
* saveConfig
|
||||
*
|
||||
* @param array $fields
|
||||
* @return void
|
||||
*/
|
||||
public function saveCurrentConfig(array $fields) {
|
||||
public function saveConfig(array $fields) {
|
||||
Logger::log("[MatchManagerMultipleConfigManager] Saving current config");
|
||||
$result = array();
|
||||
$configname = "";
|
||||
@ -331,7 +331,15 @@ class MatchManagerMultipleConfigManager implements ManialinkPageAnswerListener,
|
||||
return;
|
||||
}
|
||||
|
||||
$this->saveConfig($configname, $gamemodebase, json_encode($result));
|
||||
$config = json_encode($result);
|
||||
|
||||
$mysqli = $this->maniaControl->getDatabase()->getMysqli();
|
||||
$query = $mysqli->prepare('INSERT INTO `' . self::DB_MATCHCONFIG . '` (`name`,`gamemodebase`,`config`) VALUES (?, ?, ?);');
|
||||
$query->bind_param('sss', $configname, $gamemodebase, $config);
|
||||
if (!$query->execute()) {
|
||||
trigger_error('Error executing MySQL query: ' . $query->error);
|
||||
}
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_LOADCONFIG, $configname);
|
||||
}
|
||||
|
||||
public function getSavedConfigs() {
|
||||
@ -345,15 +353,6 @@ class MatchManagerMultipleConfigManager implements ManialinkPageAnswerListener,
|
||||
return $result->fetch_all(MYSQLI_ASSOC);
|
||||
}
|
||||
|
||||
public function saveConfig($configname, $gamemodebase, $config) {
|
||||
$mysqli = $this->maniaControl->getDatabase()->getMysqli();
|
||||
$query = $mysqli->prepare('INSERT INTO `' . self::DB_MATCHCONFIG . '` (`name`,`gamemodebase`,`config`) VALUES (?, ?, ?);');
|
||||
$query->bind_param('sss', $configname, $gamemodebase, $config);
|
||||
if (!$query->execute()) {
|
||||
trigger_error('Error executing MySQL query: ' . $query->error);
|
||||
}
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_SAVECONFIG, $configname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a ManiaLink list with the local records.
|
||||
@ -473,7 +472,7 @@ class MatchManagerMultipleConfigManager implements ManialinkPageAnswerListener,
|
||||
self::ML_ACTION_SAVE_CONFIG_PAGE
|
||||
);
|
||||
$frame->addChild($mapNameButton);
|
||||
$mapNameButton->setPosition(-$width / 2 + 110, -$height / 2 + 6);
|
||||
$mapNameButton->setPosition(-$width / 2 + 110, -36);
|
||||
|
||||
// Render and display xml
|
||||
$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $player, self::ML_ID);
|
||||
@ -581,13 +580,13 @@ class MatchManagerMultipleConfigManager implements ManialinkPageAnswerListener,
|
||||
self::ML_ACTION_SAVE_CONFIG
|
||||
);
|
||||
$frame->addChild($mapNameButton);
|
||||
$mapNameButton->setPosition(-$width / 2 + 60, -$height / 2 + 5);
|
||||
$mapNameButton->setPosition(-$width / 2 + 60, -35);
|
||||
|
||||
$entry = new Entry();
|
||||
$frame->addChild($entry);
|
||||
$entry->setStyle(Label_Text::STYLE_TextValueSmall);
|
||||
$entry->setHorizontalAlign($entry::LEFT);
|
||||
$entry->setPosition(-$width / 2 + 80, -$height / 2 + 5);
|
||||
$entry->setPosition(-$width / 2 + 80, -35);
|
||||
$entry->setTextSize(1);
|
||||
$entry->setSize($width * 0.25, 4);
|
||||
$entry->setName(self::ML_NAME_CONFIGNAME);
|
||||
|
Loading…
Reference in New Issue
Block a user