fix & improvement of dynamic point limit command

This commit is contained in:
Steffen Schröder 2014-05-27 11:45:17 +02:00
parent 7d9c1b5fde
commit 615010e824

View File

@ -161,7 +161,7 @@ class DynamicPointLimitPlugin implements CallbackListener, CommandListener, Plug
*/ */
public function commandSetPointlimit(array $chatCallback, Player $player) { public function commandSetPointlimit(array $chatCallback, Player $player) {
$commandParts = explode(' ', $chatCallback[1][2]); $commandParts = explode(' ', $chatCallback[1][2]);
if ($commandParts < 2) { if (count($commandParts) < 2) {
$this->maniaControl->chat->sendUsageInfo('Example: //setpointlimit auto', $player); $this->maniaControl->chat->sendUsageInfo('Example: //setpointlimit auto', $player);
return; return;
} }
@ -180,9 +180,13 @@ class DynamicPointLimitPlugin implements CallbackListener, CommandListener, Plug
try { try {
$this->maniaControl->client->setModeScriptSettings(array('S_MapPointsLimit' => $value)); $this->maniaControl->client->setModeScriptSettings(array('S_MapPointsLimit' => $value));
$this->staticMode = true; $this->staticMode = true;
$this->lastPointLimit = $value;
$this->maniaControl->chat->sendInformation("PointLimit changed to: {$value} (Fixed)"); $this->maniaControl->chat->sendInformation("PointLimit changed to: {$value} (Fixed)");
} catch (GameModeException $e) { } catch (GameModeException $exception) {
$this->maniaControl->chat->sendException($exception, $player);
} }
} else {
$this->maniaControl->chat->sendUsageInfo('Example: //setpointlimit 150', $player);
} }
} }
} }