exception handling improvements
This commit is contained in:
parent
3e06870f12
commit
d701daeed7
@ -104,7 +104,13 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
$map = $nextQueued[1];
|
$map = $nextQueued[1];
|
||||||
$this->maniaControl->chat->sendInformation("Next map is $<" . $map->name . "$> from $<" . $map->authorNick . "$> requested by $<" . $requester->nickname . "$>.", $player->login);
|
$this->maniaControl->chat->sendInformation("Next map is $<" . $map->name . "$> from $<" . $map->authorNick . "$> requested by $<" . $requester->nickname . "$>.", $player->login);
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
$mapIndex = $this->maniaControl->client->getNextMapIndex();
|
$mapIndex = $this->maniaControl->client->getNextMapIndex();
|
||||||
|
} catch(\Exception $e) {
|
||||||
|
trigger_error("Error while Reading the next Map Index");
|
||||||
|
$this->maniaControl->chat->sendError("Error while Reading next Map Inde");
|
||||||
|
return;
|
||||||
|
}
|
||||||
$maps = $this->maniaControl->mapManager->getMaps();
|
$maps = $this->maniaControl->mapManager->getMaps();
|
||||||
$map = $maps[$mapIndex];
|
$map = $maps[$mapIndex];
|
||||||
$this->maniaControl->chat->sendInformation("Next map is $<" . $map->name . "$> from $<" . $map->authorNick . "$>.", $player->login);
|
$this->maniaControl->chat->sendInformation("Next map is $<" . $map->name . "$> from $<" . $map->authorNick . "$>.", $player->login);
|
||||||
@ -181,10 +187,17 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->maniaControl->client->nextMap();
|
||||||
|
} catch(\Exception $e) {
|
||||||
|
$this->maniaControl->chat->sendError("Error while Skipping the Map");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$message = '$<' . $player->nickname . '$> skipped the current Map!';
|
$message = '$<' . $player->nickname . '$> skipped the current Map!';
|
||||||
$this->maniaControl->chat->sendSuccess($message);
|
$this->maniaControl->chat->sendSuccess($message);
|
||||||
$this->maniaControl->log($message, true);
|
$this->maniaControl->log($message, true);
|
||||||
$this->maniaControl->client->nextMap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -201,7 +214,11 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
$message = '$<' . $player->nickname . '$> restarted the current Map!';
|
$message = '$<' . $player->nickname . '$> restarted the current Map!';
|
||||||
$this->maniaControl->chat->sendSuccess($message);
|
$this->maniaControl->chat->sendSuccess($message);
|
||||||
$this->maniaControl->log($message, true);
|
$this->maniaControl->log($message, true);
|
||||||
|
try {
|
||||||
$this->maniaControl->client->restartMap();
|
$this->maniaControl->client->restartMap();
|
||||||
|
} catch(\Exception $e) {
|
||||||
|
//do nothing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user