prevent to trigger pause twice
This commit is contained in:
parent
ab36a5b20e
commit
66cd4a8430
@ -1590,7 +1590,12 @@ class MatchManagerCore implements CallbackListener, CommandListener, TimerListen
|
|||||||
* @param integer $time
|
* @param integer $time
|
||||||
*/
|
*/
|
||||||
public function setNadeoPause($admin = false, $time = null) {
|
public function setNadeoPause($admin = false, $time = null) {
|
||||||
Logger::log("Nadeo Pause");
|
if ($this->pauseon) {
|
||||||
|
$this->maniaControl->getChat()->sendErrorToAdmins($this->chatprefix . 'Can\'t launch pause, already running');
|
||||||
|
Logger::logError('Can\'t launch pause, already running');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Logger::log("Launching Pause");
|
||||||
|
|
||||||
if ($time === null) {
|
if ($time === null) {
|
||||||
$this->pausetimer = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MATCH_PAUSE_DURATION);
|
$this->pausetimer = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MATCH_PAUSE_DURATION);
|
||||||
@ -2124,27 +2129,36 @@ class MatchManagerCore implements CallbackListener, CommandListener, TimerListen
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($this->matchStarted) && (!in_array($this->currentgmbase, ["Laps", "TimeAttack", "RoyalTimeAttack"]) || ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MATCH_SETTINGS_MODE) != 'All from file' && !empty($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MATCH_CUSTOM_GAMEMODE))))) {
|
if (!$this->getMatchIsRunning()) {
|
||||||
|
$this->maniaControl->getChat()->sendError($this->chatprefix . 'Can\'t start Pause: Match not started', $player);
|
||||||
|
} else if ($this->pauseon) {
|
||||||
|
$this->maniaControl->getChat()->sendError($this->chatprefix . 'Can\'t start Pause: Pause already running', $player);
|
||||||
|
} else if (in_array($this->currentgmbase, ["Laps", "TimeAttack", "RoyalTimeAttack"])) {
|
||||||
|
$this->maniaControl->getChat()->sendError($this->chatprefix . 'Can\'t start Pause: Invalid gamemode base', $player);
|
||||||
|
} else {
|
||||||
$text = $chatCallback[1][2];
|
$text = $chatCallback[1][2];
|
||||||
$text = explode(" ", $text);
|
$text = explode(" ", $text);
|
||||||
if (isset($text[1]) && $text[1] != "") {
|
if (isset($text[1]) && $text[1] != "") {
|
||||||
if (is_numeric($text[1]) && $text[1] > 0) {
|
if (is_numeric($text[1]) && $text[1] > 0) {
|
||||||
$this->maniaControl->getChat()->sendSuccess($this->chatprefix . 'Admin force a break for $<$ff0' . $text[1] . '$> seconds!');
|
$this->maniaControl->getChat()->sendSuccess($this->chatprefix . 'Admin force a pause for $<$ff0' . $text[1] . '$> seconds!');
|
||||||
$this->setNadeoPause(true, $text[1]);
|
$this->setNadeoPause(true, $text[1]);
|
||||||
} elseif (is_numeric($text[1]) && $text[1] == 0) {
|
} elseif (is_numeric($text[1]) && $text[1] == 0) {
|
||||||
$this->maniaControl->getChat()->sendSuccess($this->chatprefix . 'Admin force an unlimited break');
|
$this->maniaControl->getChat()->sendSuccess($this->chatprefix . 'Admin force an unlimited pause');
|
||||||
$this->setNadeoPause(true, $text[1]);
|
$this->setNadeoPause(true, $text[1]);
|
||||||
} else {
|
} else {
|
||||||
$this->maniaControl->getChat()->sendError($this->chatprefix . 'Pause time sent is invalid', $player);
|
$this->maniaControl->getChat()->sendError($this->chatprefix . 'Pause time sent is invalid', $player);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->maniaControl->getChat()->sendSuccess($this->chatprefix . 'Admin force a break for ' . $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MATCH_PAUSE_DURATION) . ' seconds!');
|
$duration = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MATCH_PAUSE_DURATION);
|
||||||
|
if ($duration > 0) {
|
||||||
|
$this->maniaControl->getChat()->sendSuccess($this->chatprefix . 'Admin force a pause for ' . $duration . ' seconds!');
|
||||||
|
} else {
|
||||||
|
$this->maniaControl->getChat()->sendSuccess($this->chatprefix . 'Admin force a pause');
|
||||||
|
}
|
||||||
|
|
||||||
$this->setNadeoPause(true);
|
$this->setNadeoPause(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$this->maniaControl->getChat()->sendError($this->chatprefix . 'Can\'t start Pause, match not started (or TA)', $player);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user