Removed Closing PHP Tags

This commit is contained in:
Steffen Schröder 2013-12-15 09:00:30 +01:00
parent 40e7b45b9c
commit 43b46aaf01
26 changed files with 36 additions and 88 deletions

View File

@ -147,5 +147,3 @@ class AdminMenu implements CallbackListener {
$this->manialink = $manialink;
}
}
?>

View File

@ -157,5 +157,3 @@ class AuthCommands implements CommandListener {
return $this->maniaControl->chat->sendUsageInfo($message, $player->login);
}
}
?>

View File

@ -202,5 +202,3 @@ class AuthenticationManager {
return self::AUTH_LEVEL_PLAYER;
}
}
?>

View File

@ -13,5 +13,3 @@ interface CallbackListener {
*/
const CALLBACKLISTENER_INTERFACE = __CLASS__;
}
?>

View File

@ -126,5 +126,3 @@ class Chat {
return $this->sendChat($format . $message, $login);
}
}
?>

View File

@ -53,5 +53,3 @@ abstract class ColorUtil {
return $codes[$value];
}
}
?>

View File

@ -9,5 +9,3 @@ namespace ManiaControl\Commands;
*/
interface CommandListener {
}
?>

View File

@ -281,5 +281,3 @@ class Configurator implements CallbackListener, ManialinkPageAnswerListener {
$this->maniaControl->adminMenu->addMenuItem($itemQuad, 5);
}
}
?>

View File

@ -39,5 +39,3 @@ interface ConfiguratorMenu {
*/
public function saveConfigData(array $configData, Player $player);
}
?>

View File

@ -173,5 +173,3 @@ class ScriptSettings implements ConfiguratorMenu {
}
}
}
?>

View File

@ -148,5 +148,3 @@ class Database {
return true;
}
}
?>

View File

@ -86,5 +86,3 @@ abstract class FileUtil {
return str_replace(array('\\', '/', ':', '*', '?', '"', '<', '>', '|'), '_', $fileName);
}
}
?>

View File

@ -85,5 +85,3 @@ abstract class Formatter {
return preg_replace('/(?<!\$)((?:\$\$)*)\$(?:g|[0-9a-f][^\$]{0,2})/iu', '$1', $string);
}
}
?>

View File

@ -285,5 +285,3 @@ class ManiaControl implements CommandListener {
logMessage('Script callbacks successfully enabled.');
}
}
?>

View File

@ -161,5 +161,3 @@ class ManialinkManager implements CallbackListener {
return $this->maniaControl->client->query('TriggerModeScriptEvent', 'LibXmlRpc_DisableAltMenu', $player->login);
}
}
?>

View File

@ -13,5 +13,3 @@ interface ManialinkPageAnswerListener {
*/
const MANIALINKPAGEANSWERLISTENER_INTERFACE = __CLASS__;
}
?>

View File

@ -63,5 +63,3 @@ class StyleManager {
return $this->maniaControl->settingManager->getSetting($this, self::SETTING_QUAD_DEFAULT_SUBSTYLE);
}
}
?>

View File

@ -28,13 +28,14 @@ class MapCommands implements CommandListener {
public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl;
$this->maniaControl->commandManager->registerCommandListener('nextmap', $this, 'command_NextMap',true);
$this->maniaControl->commandManager->registerCommandListener('restartmap', $this, 'command_RestartMap',true);
$this->maniaControl->commandManager->registerCommandListener('addmap', $this, 'command_AddMap',true);
$this->maniaControl->commandManager->registerCommandListener('removemap', $this, 'command_RemoveMap',true);
// Register for player commands
$this->maniaControl->commandManager->registerCommandListener('list', $this, 'command_list');
$this->maniaControl->commandManager->registerCommandListener('nextmap', $this, 'command_NextMap', true);
$this->maniaControl->commandManager->registerCommandListener('restartmap', $this, 'command_RestartMap', true);
$this->maniaControl->commandManager->registerCommandListener('addmap', $this, 'command_AddMap', true);
$this->maniaControl->commandManager->registerCommandListener('removemap', $this, 'command_RemoveMap', true);
// Register for chat commands
$this->maniaControl->commandManager->registerCommandListener('list', $this, 'command_List');
$this->maniaControl->commandManager->registerCommandListener('maps', $this, 'command_List');
}
/**
@ -42,27 +43,25 @@ class MapCommands implements CommandListener {
*
* @param array $chat
* @param \ManiaControl\Players\Player $player
* @return bool
*/
public function command_RemoveMap(array $chat, Player $player) {
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player);
return false;
return;
}
// Get map
$map = $this->maniaControl->mapManager->getCurrentMap();
if (!$map) {
$this->maniaControl->chat->sendError("Couldn't remove map.", $player->login);
return false;
return;
}
// Remove map
if (!$this->maniaControl->client->query('RemoveMap', $map->fileName)) {
trigger_error("Couldn't remove current map. " . $this->maniaControl->getClientErrorText());
$this->maniaControl->chat->sendError("Couldn't remove map.", $player->login);
return false;
return;
}
$this->maniaControl->chat->sendSuccess('Map removed.', $player->login);
return true;
}
/**
@ -70,37 +69,36 @@ class MapCommands implements CommandListener {
*
* @param array $chatCallback
* @param \ManiaControl\Players\Player $player
* @return bool
*/
public function command_AddMap(array $chatCallback, Player $player) {
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player);
return false;
return;
}
// TODO: user mx fetcher
$params = explode(' ', $chatCallback[1][2], 2);
if (count($params) < 2) {
$this->maniaControl->chat->sendUsageInfo('Usage example: //addmap 1234', $player->login);
return false;
return;
}
// Check if ManiaControl can even write to the maps dir
if (!$this->maniaControl->client->query('GetMapsDirectory')) {
trigger_error("Couldn't get map directory. " . $this->maniaControl->getClientErrorText());
$this->maniaControl->chat->sendError("ManiaControl couldn't retrieve the maps directory.", $player->login);
return false;
return;
}
$mapDir = $this->maniaControl->client->getResponse();
if (!is_dir($mapDir)) {
trigger_error("ManiaControl doesn't have have access to the maps directory in '{$mapDir}'.");
$this->maniaControl->chat->sendError("ManiaControl doesn't have access to the maps directory.", $player->login);
return false;
return;
}
$downloadDirectory = $this->maniaControl->settingManager->getSetting($this, 'MapDownloadDirectory', 'MX');
// Create download directory if necessary
if (!is_dir($mapDir . $downloadDirectory) && !mkdir($mapDir . $downloadDirectory)) {
trigger_error("ManiaControl doesn't have to rights to save maps in '{$mapDir}{$downloadDirectory}'.");
$this->maniaControl->chat->sendError("ManiaControl doesn't have the rights to save maps.", $player->login);
return false;
return;
}
$mapDir .= $downloadDirectory . '/';
// Download the map
@ -115,7 +113,7 @@ class MapCommands implements CommandListener {
if (!$mapInfo || strlen($mapInfo) <= 0) {
// Invalid id
$this->maniaControl->chat->sendError('Invalid MX-Id!', $player->login);
return false;
return;
}
$mapInfo = json_decode($mapInfo, true);
$url = "http://{$title}.mania-exchange.com/tracks/download/{$mapId}";
@ -123,7 +121,7 @@ class MapCommands implements CommandListener {
if (!$file) {
// Download error
$this->maniaControl->chat->sendError('Download failed!', $player->login);
return false;
return;
}
// Save map
$fileName = $mapInfo['TrackID'] . '_' . $mapInfo['Name'] . '.Map.Gbx';
@ -131,31 +129,30 @@ class MapCommands implements CommandListener {
if (!file_put_contents($mapDir . $fileName, $file)) {
// Save error
$this->maniaControl->chat->sendError('Saving map failed!', $player->login);
return false;
return;
}
// Check for valid map
$mapFileName = $downloadDirectory . '/' . $fileName;
if (!$this->maniaControl->client->query('CheckMapForCurrentServerParams', $mapFileName)) {
trigger_error("Couldn't check if map is valid ('{$mapFileName}'). " . $this->maniaControl->getClientErrorText());
$this->maniaControl->chat->sendError('Error checking map!', $player->login);
return false;
return;
}
$response = $this->maniaControl->client->getResponse();
if (!$response) {
// Invalid map type
$this->maniaControl->chat->sendError("Invalid map type.", $player->login);
return false;
return;
}
// Add map to map list
if (!$this->maniaControl->client->query('InsertMap', $mapFileName)) {
$this->maniaControl->chat->sendError("Couldn't add map to match settings!", $player->login);
return false;
return;
}
$this->maniaControl->chat->sendSuccess('Map $<' . $mapInfo['Name'] . '$> added!');
return true;
return;
}
// TODO: add local map by filename
return false;
}
/**
@ -163,37 +160,38 @@ class MapCommands implements CommandListener {
*
* @param array $chat
* @param \ManiaControl\Players\Player $player
* @return bool
*/
public function command_NextMap(array $chat, Player $player) {
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player);
return false;
return;
}
return $this->maniaControl->client->query('NextMap');
$this->maniaControl->client->query('NextMap');
}
/**
* Handle retartmap command
* Handle restartmap command
*
* @param array $chat
* @param \ManiaControl\Players\Player $player
* @return bool
*/
public function command_RestartMap(array $chat, Player $player) {
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player);
return false;
return;
}
return $this->maniaControl->client->query('RestartMap');
$this->maniaControl->client->query('RestartMap');
}
public function command_list(array $chatCallback, Player $player){
// var_dump($chatCallback);
/**
* Handle list maps command
*
* @param array $chatCallback
* @param Player $player
*/
public function command_List(array $chatCallback, Player $player) {
// var_dump($chatCallback);
$mapList = new MapList($this->maniaControl);
$mapList->showMapList($player);
}
}
?>

View File

@ -106,5 +106,3 @@ class Player {
return $this->path;
}
}
?>

View File

@ -213,5 +213,3 @@ class PlayerCommands implements CommandListener {
$this->maniaControl->chat->sendSuccess('Fake players disconnected!', $player->login);
}
}
?>

View File

@ -63,5 +63,3 @@ interface Plugin {
*/
public static function getDescription();
}
?>

View File

@ -291,5 +291,3 @@ class PluginManager {
return $active;
}
}
?>

View File

@ -214,5 +214,3 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu {
}
}
}
?>

View File

@ -308,5 +308,3 @@ class Server {
return true;
}
}
?>

View File

@ -414,5 +414,3 @@ class ServerCommands implements CallbackListener, CommandListener {
return true;
}
}
?>

View File

@ -359,5 +359,3 @@ class SettingManager {
return $settings;
}
}
?>