fix wrong Better Chat documentation

This commit is contained in:
Beu 2021-12-26 13:04:19 +01:00
parent 0c1b5b7a9a
commit fe32137c09
3 changed files with 24 additions and 5 deletions

View File

@ -22,7 +22,7 @@ class SimpleChatColorer implements CommandListener, CallbackListener, Plugin {
* Constants * Constants
*/ */
const PLUGIN_ID = 161; const PLUGIN_ID = 161;
const PLUGIN_VERSION = 1.1; const PLUGIN_VERSION = 1.2;
const PLUGIN_NAME = 'SimpleChatColorer'; const PLUGIN_NAME = 'SimpleChatColorer';
const PLUGIN_AUTHOR = 'Beu'; const PLUGIN_AUTHOR = 'Beu';
@ -211,7 +211,7 @@ class SimpleChatColorer implements CommandListener, CallbackListener, Plugin {
if (!in_array($player->login, $this->betterchatlogins)) { if (!in_array($player->login, $this->betterchatlogins)) {
array_push($this->betterchatlogins, $player->login); array_push($this->betterchatlogins, $player->login);
} }
} else if (isset($argument[1]) && $argument[1] == "default") { } else if (isset($argument[1]) && $argument[1] == "text") {
if (($key = array_search($player->login, $this->betterchatlogins)) !== false) { if (($key = array_search($player->login, $this->betterchatlogins)) !== false) {
unset($this->betterchatlogins[$key]); unset($this->betterchatlogins[$key]);
} }

View File

@ -1312,7 +1312,7 @@ class MatchManagerCore implements CallbackListener, CommandListener, TimerListen
* Handle Maniacontrol callback "BeginMatch" * Handle Maniacontrol callback "BeginMatch"
*/ */
public function handleBeginMatchCallback() { public function handleBeginMatchCallback() {
Logger::log("handleStartMatchStartCallback"); Logger::log("handleBeginMatchCallback");
if ($this->matchStarted && !$this->settingsloaded) { if ($this->matchStarted && !$this->settingsloaded) {
Logger::log("Restarting map to restart match data"); Logger::log("Restarting map to restart match data");
$this->maniaControl->getClient()->restartMap(); $this->maniaControl->getClient()->restartMap();

View File

@ -47,9 +47,20 @@ class MatchManagerGSheet implements CallbackListener, CommandListener, Plugin {
const SETTING_MATCHMANAGERGSHEET_CLIENT_ID = 'Google API Client_ID:'; const SETTING_MATCHMANAGERGSHEET_CLIENT_ID = 'Google API Client_ID:';
const SETTING_MATCHMANAGERGSHEET_CLIENT_SECRET = 'Google API Client_Secret:'; const SETTING_MATCHMANAGERGSHEET_CLIENT_SECRET = 'Google API Client_Secret:';
const SETTING_MATCHMANAGERGSHEET_SPREADSHEET = 'GSheet Spreadsheet ID:'; const SETTING_MATCHMANAGERGSHEET_SPREADSHEET = 'GSheet Spreadsheet ID:';
const SETTING_MATCHMANAGERGSHEET_DATA_MODE = 'Data Storage Mode';
const SETTING_MATCHMANAGERGSHEET_SHEETNAME = 'GSheet Sheet name:'; const SETTING_MATCHMANAGERGSHEET_SHEETNAME = 'GSheet Sheet name:';
const MODE_SPECIFICS_SETTINGS = [
"Last Round Only" => [
"ScoreTable_endColumnIndex" => 15
],
"All Rounds Data"=> [
"ScoreTable_endColumnIndex" => 15
]
];
/* /*
* Private properties * Private properties
@ -60,6 +71,7 @@ class MatchManagerGSheet implements CallbackListener, CommandListener, Plugin {
private $device_code = ""; private $device_code = "";
private $access_token = ""; private $access_token = "";
private $matchid = ""; private $matchid = "";
private $currentdatamode = "";
private $playerlist = array(); private $playerlist = array();
@ -132,6 +144,7 @@ class MatchManagerGSheet implements CallbackListener, CommandListener, Plugin {
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MATCHMANAGERGSHEET_SPREADSHEET, "", "Spreadsheet ID from the URL"); $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MATCHMANAGERGSHEET_SPREADSHEET, "", "Spreadsheet ID from the URL");
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MATCHMANAGERGSHEET_SHEETNAME, "#NAME# Finals", "Variables available: #MATCHID# #NAME# #LOGIN# #DATE#"); $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MATCHMANAGERGSHEET_SHEETNAME, "#NAME# Finals", "Variables available: #MATCHID# #NAME# #LOGIN# #DATE#");
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MATCHMANAGERGSHEET_DATA_MODE, ["Last Round Only", "All Rounds Data"], "Mode how the data are send to Google Sheet");
$this->maniaControl->getCommandManager()->registerCommandListener('matchgsheet', $this, 'onCommandMatchGSheet', true, 'All MatchManager GSheet plugin commands'); $this->maniaControl->getCommandManager()->registerCommandListener('matchgsheet', $this, 'onCommandMatchGSheet', true, 'All MatchManager GSheet plugin commands');
@ -181,6 +194,11 @@ class MatchManagerGSheet implements CallbackListener, CommandListener, Plugin {
$this->saveSecretSetting("client_secret",$setting->value); $this->saveSecretSetting("client_secret",$setting->value);
$this->maniaControl->getSettingManager()->setSetting($this, self::SETTING_MATCHMANAGERGSHEET_CLIENT_SECRET, "hidden"); $this->maniaControl->getSettingManager()->setSetting($this, self::SETTING_MATCHMANAGERGSHEET_CLIENT_SECRET, "hidden");
} }
if (($this->matchstatus == "running" || $this->matchstatus == "starting") && $setting->setting == self::SETTING_MATCHMANAGERGSHEET_DATA_MODE && $setting->value != $this->currentdatamode) {
$setting->value = $this->currentdatamode;
$this->maniaControl->getSettingManager()->saveSetting($setting);
$this->maniaControl->getChat()->sendErrorToAdmins($this->chatprefix . 'You can\'t change data mode during a Match');
}
} }
} }
@ -492,6 +510,7 @@ class MatchManagerGSheet implements CallbackListener, CommandListener, Plugin {
} }
} }
$this->matchstatus = "starting"; $this->matchstatus = "starting";
$this->currentdatamode = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MATCHMANAGERGSHEET_DATA_MODE);
$this->PrepareSheet($sheetname, $sheetexists, $sheetsid ); $this->PrepareSheet($sheetname, $sheetexists, $sheetsid );
} }
@ -589,7 +608,7 @@ class MatchManagerGSheet implements CallbackListener, CommandListener, Plugin {
$data->requests[$i]->repeatCell->range->startRowIndex = 0; $data->requests[$i]->repeatCell->range->startRowIndex = 0;
$data->requests[$i]->repeatCell->range->endRowIndex = 1; $data->requests[$i]->repeatCell->range->endRowIndex = 1;
$data->requests[$i]->repeatCell->range->startColumnIndex = 3; $data->requests[$i]->repeatCell->range->startColumnIndex = 3;
$data->requests[$i]->repeatCell->range->endColumnIndex = 15; $data->requests[$i]->repeatCell->range->endColumnIndex = self::MODE_SPECIFICS_SETTINGS[$this->currentdatamode]["ScoreTable_endColumnIndex"];
$data->requests[$i]->repeatCell->cell = new \stdClass; $data->requests[$i]->repeatCell->cell = new \stdClass;
$data->requests[$i]->repeatCell->cell->userEnteredFormat = new \stdClass; $data->requests[$i]->repeatCell->cell->userEnteredFormat = new \stdClass;
$data->requests[$i]->repeatCell->cell->userEnteredFormat->backgroundColor = new \stdClass; $data->requests[$i]->repeatCell->cell->userEnteredFormat->backgroundColor = new \stdClass;