Compare commits

...

5 Commits

Author SHA1 Message Date
beu
1ea9abfcda fix error when having one map and no re-order setting value 2025-09-03 09:03:41 +02:00
beu
8796898167 fix error when using only #NAME# only 2025-08-27 21:53:02 +02:00
beu
35495dd547 fix admin not added when loading guestlist 2025-08-27 21:41:01 +02:00
beu
bad46e207f fix kick player 2025-08-27 21:38:22 +02:00
beu
381c91d5e9 fix setting initialization 2025-08-11 22:31:05 +02:00
4 changed files with 87 additions and 85 deletions

View File

@@ -23,7 +23,7 @@ class GuestlistManager implements CommandListener, CallbackListener, TimerListen
* Constants
*/
const PLUGIN_ID = 154;
const PLUGIN_VERSION = 2.4;
const PLUGIN_VERSION = 2.5;
const PLUGIN_NAME = 'Guestlist Manager';
const PLUGIN_AUTHOR = 'Beu';
@@ -321,6 +321,8 @@ class GuestlistManager implements CommandListener, CallbackListener, TimerListen
$this->maniaControl->getChat()->sendError("Can't load guestlist: ". $th->getMessage(), $player);
Logger::logError("Can't load guestlist: ". $th->getMessage());
}
$this->addAdminsToGuestlist();
}
/**
@@ -539,7 +541,7 @@ class GuestlistManager implements CommandListener, CallbackListener, TimerListen
if (!in_array($player->login, $guests)) {
try {
Logger::log('Player "'. $player->nickname .'" kicked from the server as not guestlisted');
$this->maniaControl->getClient()->kick($player->nickname, "You are not guestlisted on the server");
$this->maniaControl->getClient()->kick($player->login, "You are not guestlisted on the server");
$kicked++;
} catch (\Throwable $th) {
Logger::logError("Can't kick ". $player->nickname .": ". $th->getMessage());

View File

@@ -43,7 +43,7 @@ class MatchManagerCore implements CallbackListener, CommandListener, TimerListen
* MARK: Constants
*/
const PLUGIN_ID = 152;
const PLUGIN_VERSION = 6.0;
const PLUGIN_VERSION = 6.1;
const PLUGIN_NAME = 'MatchManager Core';
const PLUGIN_AUTHOR = 'Beu';
@@ -840,7 +840,7 @@ class MatchManagerCore implements CallbackListener, CommandListener, TimerListen
* @param Setting $setting
*/
public function updateSettings(?Setting $setting = null) {
if ($setting === null || !$setting->belongsToClass($this)) return;
if ($setting !== null && $setting->belongsToClass($this)) {
if ($this->matchStarted) {
if ($setting->setting == self::SETTING_MATCH_GAMEMODE_BASE && $setting->value != $this->currentgmbase) {
$setting->value = $this->currentgmbase;
@@ -903,8 +903,9 @@ class MatchManagerCore implements CallbackListener, CommandListener, TimerListen
}
}
}
}
if ($setting->setting === self::SETTING_MATCH_SETTINGS_MODE || $setting->setting === self::SETTING_MATCH_GAMEMODE_BASE || $setting->setting === self::SETTING_MATCH_CUSTOM_GAMEMODE) {
if ($setting === null || $setting->setting === self::SETTING_MATCH_SETTINGS_MODE || $setting->setting === self::SETTING_MATCH_GAMEMODE_BASE || $setting->setting === self::SETTING_MATCH_CUSTOM_GAMEMODE) {
$deletesettings = true;
if (defined("\ManiaControl\ManiaControl::ISTRACKMANIACONTROL") && $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getSettingManager(), SettingManager::SETTING_ALLOW_UNLINK_SERVER)) {
$deletesettings = !$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MATCH_DONT_DELETE_SETTINGS);

View File

@@ -39,7 +39,7 @@ class MatchManagerGSheet implements CallbackListener, TimerListener, CommandLis
* Constants
*/
const PLUGIN_ID = 156;
const PLUGIN_VERSION = 2.4;
const PLUGIN_VERSION = 2.5;
const PLUGIN_NAME = 'MatchManager GSheet';
const PLUGIN_AUTHOR = 'Beu';
@@ -110,11 +110,8 @@ class MatchManagerGSheet implements CallbackListener, TimerListener, CommandLis
private $matchstatus = "";
private $device_code = "";
private $access_token = "";
private $matchid = "";
private $currentdatamode = "";
private $playerlist = array();
/**
* @param \ManiaControl\ManiaControl $maniaControl
* @see \ManiaControl\Plugins\Plugin::prepare()
@@ -592,12 +589,12 @@ class MatchManagerGSheet implements CallbackListener, TimerListener, CommandLis
}
}
private function getSheetName() {
private function getSheetName(string $matchid) {
$sheetname = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MATCHMANAGERGSHEET_SHEETNAME);
$login = $this->maniaControl->getServer()->login;
$server_name = $this->maniaControl->getClient()->getServerName();
$sheetname = str_replace("#MATCHID#", $this->matchid, $sheetname);
$sheetname = str_replace("#MATCHID#", $matchid, $sheetname);
$sheetname = str_replace("#LOGIN#", $login, $sheetname);
$sheetname = str_replace("#NAME#", $server_name, $sheetname);
$sheetname = str_replace("#DATE#", date("Y-m-d"), $sheetname);
@@ -611,7 +608,7 @@ class MatchManagerGSheet implements CallbackListener, TimerListener, CommandLis
$spreadsheetid = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MATCHMANAGERGSHEET_SPREADSHEET);
if ($spreadsheetid === "") return;
$sheetname = $this->getSheetName();
$sheetname = $this->getSheetName($matchid);
if ($sheetname === "") return;
foreach ($currentscore as $key => $score) {
@@ -779,11 +776,10 @@ class MatchManagerGSheet implements CallbackListener, TimerListener, CommandLis
$spreadsheetid = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MATCHMANAGERGSHEET_SPREADSHEET);
if ($spreadsheetid === "") return;
$sheetname = $this->getSheetName();
$sheetname = $this->getSheetName($matchid);
if ($sheetname === "") return;
if ($this->refreshTokenIfNeeded()) {
$this->matchid = $matchid;
$asyncHttpRequest = new AsyncHttpRequest($this->maniaControl, 'https://sheets.googleapis.com/v4/spreadsheets/' . $spreadsheetid);
$asyncHttpRequest->setContentType(AsyncHttpRequest::CONTENT_TYPE_JSON);
$asyncHttpRequest->setHeaders(array("Authorization: Bearer " . $this->access_token));

View File

@@ -37,7 +37,7 @@ class MatchManagerTMWTDuoIntegration implements CallbackListener, ManialinkPageA
* Constants
*/
const PLUGIN_ID = 211;
const PLUGIN_VERSION = 1.2;
const PLUGIN_VERSION = 1.3;
const PLUGIN_NAME = 'MatchManager TMWT Duo Integration';
const PLUGIN_AUTHOR = 'Beu';
@@ -326,9 +326,8 @@ class MatchManagerTMWTDuoIntegration implements CallbackListener, ManialinkPageA
$this->maniaControl->getClient()->setModeScriptSettings(['S_IsMatchmaking' => true], false);
$this->maniaControl->getClient()->restartMap();
} else if ($this->state === self::STATE_PREMATCH) {
$teamsUrl = $this->maniaControl->getSettingManager()->getSettingValue($this->MatchManagerCore, 'S_TeamsUrl');
if ($teamsUrl !== '') {
if ($teamsUrl !== null && $teamsUrl !== '') {
$response = WebReader::getUrl($teamsUrl);
$content = $response->getContent();
$json = json_decode($content);
@@ -416,7 +415,10 @@ class MatchManagerTMWTDuoIntegration implements CallbackListener, ManialinkPageA
$mapUids = array_column($json->playlist, 'uid');
$order = explode(',', $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_PICKANDBAN_OVERRIDEMAPORDER));
$mapOrderSetting = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_PICKANDBAN_OVERRIDEMAPORDER);
if ($mapOrderSetting !== '') {
$order = array_map('trim', explode(',', $mapOrderSetting));
if (count($order) === count($mapUids)) {
$this->log("Re-ordering maps");
@@ -431,6 +433,7 @@ class MatchManagerTMWTDuoIntegration implements CallbackListener, ManialinkPageA
$this->maniaControl->getChat()->sendErrorToAdmins($this->MatchManagerCore->getChatPrefix() ."Invalid Map order setting");
}
}
}
$mapList = [];
foreach ($this->maniaControl->getMapManager()->getMaps() as $map) {