use chatprefix function from match manager core

This commit is contained in:
Beu 2025-03-16 16:36:13 +01:00
parent 365d2ffbce
commit a7e40750f4
2 changed files with 10 additions and 12 deletions

View File

@ -38,7 +38,7 @@ class MatchManagerPlayersPause implements ManialinkPageAnswerListener, CommandLi
* Constants * Constants
*/ */
const PLUGIN_ID = 159; const PLUGIN_ID = 159;
const PLUGIN_VERSION = 1.4; const PLUGIN_VERSION = 1.5;
const PLUGIN_NAME = 'MatchManager Players Pause'; const PLUGIN_NAME = 'MatchManager Players Pause';
const PLUGIN_AUTHOR = 'Beu'; const PLUGIN_AUTHOR = 'Beu';
@ -59,7 +59,6 @@ class MatchManagerPlayersPause implements ManialinkPageAnswerListener, CommandLi
/** @var ManiaControl $maniaControl */ /** @var ManiaControl $maniaControl */
private $maniaControl = null; private $maniaControl = null;
private $MatchManagerCore = null; private $MatchManagerCore = null;
private $chatprefix = '$<$fc3$w🏆$m$> '; // Would like to create a setting but MC database doesn't support utf8mb4
private $playerspausestate = array(); private $playerspausestate = array();
@ -215,11 +214,11 @@ class MatchManagerPlayersPause implements ManialinkPageAnswerListener, CommandLi
Logger::log('Pause requested by players'); Logger::log('Pause requested by players');
if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MATCH_PAUSE_WAIT_END_ROUND)) { if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MATCH_PAUSE_WAIT_END_ROUND)) {
if ($this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl, MatchManagerCore::SETTING_MATCH_PAUSE_DURATION) <= 0) { if ($this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl, MatchManagerCore::SETTING_MATCH_PAUSE_DURATION) <= 0) {
$this->maniaControl->getChat()->sendInformation($this->chatprefix . 'Ask the admins to resume the match'); $this->maniaControl->getChat()->sendInformation($this->MatchManagerCore->getChatPrefix() . 'Ask the admins to resume the match');
} }
$this->MatchManagerCore->setNadeoPause(); $this->MatchManagerCore->setNadeoPause();
} else { } else {
$this->maniaControl->getChat()->sendInformation($this->chatprefix . 'Pause will start at the end of this round'); $this->maniaControl->getChat()->sendInformation($this->MatchManagerCore->getChatPrefix() . 'Pause will start at the end of this round');
$this->LaunchPauseAtTheEnd = true; $this->LaunchPauseAtTheEnd = true;
} }
return; return;
@ -296,10 +295,10 @@ class MatchManagerPlayersPause implements ManialinkPageAnswerListener, CommandLi
if (isset($this->playerspausestate[$player->login])) { if (isset($this->playerspausestate[$player->login])) {
if ($this->playerspausestate[$player->login] == 0) { if ($this->playerspausestate[$player->login] == 0) {
$this->playerspausestate[$player->login] = 1; $this->playerspausestate[$player->login] = 1;
$this->maniaControl->getChat()->sendInformation($this->chatprefix . 'Player $<$ff0' . $player->nickname . '$> asks a pause'); $this->maniaControl->getChat()->sendInformation($this->MatchManagerCore->getChatPrefix() . 'Player $<$ff0' . $player->nickname . '$> asks a pause');
} elseif ($this->playerspausestate[$player->login] == 1) { } elseif ($this->playerspausestate[$player->login] == 1) {
$this->playerspausestate[$player->login] = 0; $this->playerspausestate[$player->login] = 0;
$this->maniaControl->getChat()->sendInformation($this->chatprefix . 'Player $<$ff0' . $player->nickname . '$> no longer asks for a pause'); $this->maniaControl->getChat()->sendInformation($this->MatchManagerCore->getChatPrefix() . 'Player $<$ff0' . $player->nickname . '$> no longer asks for a pause');
} }
$this->PauseMatchIfNeeded($player); $this->PauseMatchIfNeeded($player);
} }
@ -322,7 +321,7 @@ class MatchManagerPlayersPause implements ManialinkPageAnswerListener, CommandLi
public function handleBeginRoundCallback() { public function handleBeginRoundCallback() {
if ($this->LaunchPauseAtTheEnd) { if ($this->LaunchPauseAtTheEnd) {
if ($this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl, MatchManagerCore::SETTING_MATCH_PAUSE_DURATION) <= 0) { if ($this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl, MatchManagerCore::SETTING_MATCH_PAUSE_DURATION) <= 0) {
$this->maniaControl->getChat()->sendInformation($this->chatprefix . 'Ask the admins to resume the match'); $this->maniaControl->getChat()->sendInformation($this->MatchManagerCore->getChatPrefix() . 'Ask the admins to resume the match');
} }
$this->LaunchPauseAtTheEnd = false; $this->LaunchPauseAtTheEnd = false;

View File

@ -37,7 +37,7 @@ class MatchManagerReadyButton implements ManialinkPageAnswerListener, CommandLis
* Constants * Constants
*/ */
const PLUGIN_ID = 158; const PLUGIN_ID = 158;
const PLUGIN_VERSION = 1.4; const PLUGIN_VERSION = 1.5;
const PLUGIN_NAME = 'MatchManager Ready Button'; const PLUGIN_NAME = 'MatchManager Ready Button';
const PLUGIN_AUTHOR = 'Beu'; const PLUGIN_AUTHOR = 'Beu';
@ -58,7 +58,6 @@ class MatchManagerReadyButton implements ManialinkPageAnswerListener, CommandLis
/** @var ManiaControl $maniaControl */ /** @var ManiaControl $maniaControl */
private $maniaControl = null; private $maniaControl = null;
private $MatchManagerCore = null; private $MatchManagerCore = null;
private $chatprefix = '$<$fc3$w🏆$m$> '; // Would like to create a setting but MC database doesn't support utf8mb4
private $playersreadystate = array(); private $playersreadystate = array();
@ -235,7 +234,7 @@ class MatchManagerReadyButton implements ManialinkPageAnswerListener, CommandLis
} else if (!$player->isSpectator && !isset($this->playersreadystate[$player->login])) { } else if (!$player->isSpectator && !isset($this->playersreadystate[$player->login])) {
$this->playersreadystate[$player->login] = 0; $this->playersreadystate[$player->login] = 0;
$this->maniaControl->getManialinkManager()->sendManialink($this->MLisNotReady, $player->login, ToggleUIFeature: false); $this->maniaControl->getManialinkManager()->sendManialink($this->MLisNotReady, $player->login, ToggleUIFeature: false);
$this->maniaControl->getChat()->sendSuccess($this->chatprefix . 'You can now set you $<$f00Ready$> by clicking on the button', $player); $this->maniaControl->getChat()->sendSuccess($this->MatchManagerCore->getChatPrefix() . 'You can now set you $<$f00Ready$> by clicking on the button', $player);
} else if (!$player->isSpectator && isset($this->playersreadystate[$player->login])) { } else if (!$player->isSpectator && isset($this->playersreadystate[$player->login])) {
if ($this->playersreadystate[$player->login] == 1) { if ($this->playersreadystate[$player->login] == 1) {
$this->maniaControl->getManialinkManager()->sendManialink($this->MLisReady, $player->login, ToggleUIFeature: false); $this->maniaControl->getManialinkManager()->sendManialink($this->MLisReady, $player->login, ToggleUIFeature: false);
@ -283,10 +282,10 @@ class MatchManagerReadyButton implements ManialinkPageAnswerListener, CommandLis
if (isset($this->playersreadystate[$player->login])) { if (isset($this->playersreadystate[$player->login])) {
if ($this->playersreadystate[$player->login] == 0) { if ($this->playersreadystate[$player->login] == 0) {
$this->playersreadystate[$player->login] = 1; $this->playersreadystate[$player->login] = 1;
$this->maniaControl->getChat()->sendInformation($this->chatprefix . 'Player $<$ff0' . $player->nickname . '$> now is $<$z$0f0ready$>'); $this->maniaControl->getChat()->sendInformation($this->MatchManagerCore->getChatPrefix() . 'Player $<$ff0' . $player->nickname . '$> now is $<$z$0f0ready$>');
} elseif ($this->playersreadystate[$player->login] == 1) { } elseif ($this->playersreadystate[$player->login] == 1) {
$this->playersreadystate[$player->login] = 0; $this->playersreadystate[$player->login] = 0;
$this->maniaControl->getChat()->sendInformation($this->chatprefix . 'Player $<$ff0' . $player->nickname . '$> now is $<$z$f00not ready$>'); $this->maniaControl->getChat()->sendInformation($this->MatchManagerCore->getChatPrefix() . 'Player $<$ff0' . $player->nickname . '$> now is $<$z$f00not ready$>');
} }
$this->StartMatchIfNeeded($player); $this->StartMatchIfNeeded($player);
} }