added try-catch to prevent crash in modes without the setting

This commit is contained in:
Steffen Schröder 2014-05-27 11:36:59 +02:00
parent ffd2387591
commit 7d9c1b5fde

View File

@ -139,17 +139,17 @@ class DynamicPointLimitPlugin implements CallbackListener, CommandListener, Plug
} }
$pointLimit = (int)$pointLimit; $pointLimit = (int)$pointLimit;
if ($this->lastPointLimit != $pointLimit) { if ($this->lastPointLimit !== $pointLimit) {
$newSettings = array('S_MapPointsLimit' => $pointLimit); try {
$this->maniaControl->client->setModeScriptSettings($newSettings); $this->maniaControl->client->setModeScriptSettings(array('S_MapPointsLimit' => $pointLimit));
$message = "Dynamic PointLimit changed to: {$pointLimit}!";
$message = "Dynamic PointLimit changed to: {$pointLimit}!"; if ($this->lastPointLimit !== null) {
if ($this->lastPointLimit !== null) { $message .= " (From {$this->lastPointLimit})";
$message .= " (From {$this->lastPointLimit})"; }
$this->maniaControl->chat->sendInformation($message);
$this->lastPointLimit = $pointLimit;
} catch (GameModeException $exception) {
} }
$this->maniaControl->chat->sendChat($message);
$this->lastPointLimit = $pointLimit;
} }
} }