refactored phpdoc, return/break statements, uses
This commit is contained in:
parent
b75946e048
commit
acf9053117
@ -213,8 +213,8 @@ class CallbackManager {
|
||||
case 'ManiaPlanet.BeginMatch':
|
||||
if ($this->maniaControl->mapManager->getCurrentMap()->getGame() == 'sm') {
|
||||
$this->triggerCallback($callbackName, $callback);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'ManiaPlanet.BeginMap':
|
||||
$this->maniaControl->mapManager->handleBeginMap($callback);
|
||||
$this->triggerCallback($callbackName, $callback);
|
||||
@ -222,8 +222,8 @@ class CallbackManager {
|
||||
case 'ManiaPlanet.EndMatch': // TODO temporary fix
|
||||
if ($this->maniaControl->mapManager->getCurrentMap()->getGame() == 'sm') {
|
||||
$this->triggerCallback($callbackName, $callback);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'ManiaPlanet.EndMap':
|
||||
$this->maniaControl->mapManager->handleEndMap($callback);
|
||||
$this->triggerCallback($callbackName, $callback);
|
||||
|
@ -45,13 +45,13 @@ interface Callbacks {
|
||||
* param4 int AFKStatus */
|
||||
const PLAYERRANKING = 'Callbacks.PlayerRanking';
|
||||
|
||||
//Shootmania Callbacks
|
||||
//ShootMania Callbacks
|
||||
/** RankingsUpdated Callback, param1 Sorted Rankings */
|
||||
const RANKINGSUPDATED = 'Callbacks.RankingsUpdated';
|
||||
/** RankingsUpdated Callback, returned after LibXmlRpc_PlayerRanking param1 Scores */
|
||||
const SCORES = 'Callbacks.Scores';
|
||||
/** Returns the AFKStatus of an Player, returned after param1 Scores */ //returned after TODO
|
||||
const AFKSTATUS = 'Callbacks.AfkStatus';
|
||||
/** Returns if the GameMode has Warmup aktivated, returned after param1 Scores */ //returned after TODO
|
||||
/** Returns if the GameMode has Warmup activated, returned after param1 Scores */ //returned after TODO
|
||||
const WARMUPSTATUS = 'Callbacks.WarmupStatus';
|
||||
}
|
@ -100,7 +100,7 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle Config Admin Aommand
|
||||
* Handle Config Admin Command
|
||||
*
|
||||
* @param array $callback
|
||||
*/
|
||||
|
@ -111,7 +111,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
|
||||
$y = 0;
|
||||
$index = 1;
|
||||
$prevClass = '';
|
||||
foreach($settings as $id => $setting) {
|
||||
foreach($settings as $setting) {
|
||||
//Don't display Plugin Settings
|
||||
if (array_search($setting->class, $pluginClasses) !== FALSE) {
|
||||
continue;
|
||||
|
@ -373,7 +373,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Toogle a Boolean Setting
|
||||
* Toggle a Boolean Setting
|
||||
*
|
||||
* @param Player $player
|
||||
* @param $setting
|
||||
|
@ -383,7 +383,7 @@ class ManiaControl implements CommandListener, TimerListener {
|
||||
*/
|
||||
private function connect() {
|
||||
// Load remote client
|
||||
$success = $this->server->loadConfig();
|
||||
$this->server->loadConfig();
|
||||
|
||||
$this->log("Connecting to server at {$this->server->config->host}:{$this->server->config->port}...");
|
||||
|
||||
|
@ -24,7 +24,6 @@ use ManiaControl\Manialinks\ManialinkManager;
|
||||
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
||||
use ManiaControl\Maps\MapCommands;
|
||||
use ManiaControl\Maps\MapManager;
|
||||
use ManiaControl\Maps\MapQueue;
|
||||
use ManiaControl\Players\Player;
|
||||
|
||||
/**
|
||||
|
@ -360,7 +360,7 @@ class ManiaExchangeManager{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Current Environemnt by String
|
||||
* Gets the Current Environment by String
|
||||
*
|
||||
* @param $env
|
||||
* @return int
|
||||
|
@ -10,7 +10,6 @@ use ManiaControl\Callbacks\CallbackListener;
|
||||
use ManiaControl\Callbacks\CallbackManager;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Players\Player;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\LoginUnknownException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\NotInScriptModeException;
|
||||
|
||||
|
@ -4,7 +4,6 @@ namespace ManiaControl\Maps;
|
||||
|
||||
use ManiaControl\Admin\AuthenticationManager;
|
||||
use ManiaControl\Callbacks\CallbackListener;
|
||||
use ManiaControl\Callbacks\CallbackManager;
|
||||
use ManiaControl\Commands\CommandListener;
|
||||
use ManiaControl\Formatter;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
@ -377,7 +377,7 @@ class PlayerManager implements CallbackListener, TimerListener {
|
||||
return null;
|
||||
}
|
||||
|
||||
$player = new Player(false);
|
||||
$player = new Player(null);
|
||||
$player->index = $playerIndex;
|
||||
$player->login = $row->login;
|
||||
$player->rawNickname = $row->nickname;
|
||||
@ -412,7 +412,7 @@ class PlayerManager implements CallbackListener, TimerListener {
|
||||
return null;
|
||||
}
|
||||
|
||||
$player = new Player(false);
|
||||
$player = new Player(null);
|
||||
$player->index = $row->index;
|
||||
$player->login = $row->login;
|
||||
$player->rawNickname = $row->nickname;
|
||||
|
@ -76,9 +76,7 @@ class PluginManager {
|
||||
* @return bool
|
||||
*/
|
||||
public function isPluginActive($pluginClass) {
|
||||
if (is_object($pluginClass)) {
|
||||
$pluginClass = get_class($pluginClass);
|
||||
}
|
||||
$pluginClass = $this->getPluginClass($pluginClass);
|
||||
return isset($this->activePlugins[$pluginClass]);
|
||||
}
|
||||
|
||||
@ -89,9 +87,7 @@ class PluginManager {
|
||||
* @return bool
|
||||
*/
|
||||
public function isPluginClass($pluginClass) {
|
||||
if (is_object($pluginClass)) {
|
||||
$pluginClass = get_class($pluginClass);
|
||||
}
|
||||
$pluginClass = $this->getPluginClass($pluginClass);
|
||||
if (!in_array(Plugin::PLUGIN_INTERFACE, class_implements($pluginClass))) {
|
||||
return false;
|
||||
}
|
||||
@ -105,9 +101,7 @@ class PluginManager {
|
||||
* @return bool
|
||||
*/
|
||||
public function addPluginClass($pluginClass) {
|
||||
if (is_object($pluginClass)) {
|
||||
$pluginClass = get_class($pluginClass);
|
||||
}
|
||||
$pluginClass = $this->getPluginClass($pluginClass);
|
||||
if (in_array($pluginClass, $this->pluginClasses)) {
|
||||
return false;
|
||||
}
|
||||
@ -161,9 +155,7 @@ class PluginManager {
|
||||
* @return bool
|
||||
*/
|
||||
public function deactivatePlugin($pluginClass) {
|
||||
if (is_object($pluginClass)) {
|
||||
$pluginClass = get_class($pluginClass);
|
||||
}
|
||||
$pluginClass = $this->getPluginClass($pluginClass);
|
||||
if (!$this->isPluginActive($pluginClass)) {
|
||||
return false;
|
||||
}
|
||||
@ -171,12 +163,11 @@ class PluginManager {
|
||||
/** @var Plugin $plugin */
|
||||
unset($this->activePlugins[$pluginClass]);
|
||||
$plugin->unload();
|
||||
$interfaces = class_implements($pluginClass);
|
||||
if (in_array(CallbackListener::CALLBACKLISTENER_INTERFACE, $interfaces)) {
|
||||
if ($plugin instanceof CallbackListener) {
|
||||
$this->maniaControl->callbackManager->unregisterCallbackListener($plugin);
|
||||
$this->maniaControl->callbackManager->unregisterScriptCallbackListener($plugin);
|
||||
}
|
||||
if (in_array(ManialinkPageAnswerListener::MANIALINKPAGEANSWERLISTENER_INTERFACE, $interfaces)) {
|
||||
if ($plugin instanceof ManialinkPageAnswerListener) {
|
||||
$this->maniaControl->manialinkManager->unregisterManialinkPageAnswerListener($plugin);
|
||||
}
|
||||
$this->savePluginStatus($pluginClass, false);
|
||||
@ -357,4 +348,17 @@ class PluginManager {
|
||||
call_user_func($function, $data, $error);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Class of the Plugin
|
||||
*
|
||||
* @param mixed $pluginClass
|
||||
* @return string
|
||||
*/
|
||||
private function getPluginClass($pluginClass) {
|
||||
if (is_object($pluginClass)) {
|
||||
$pluginClass = get_class($pluginClass);
|
||||
}
|
||||
return (string) $pluginClass;
|
||||
}
|
||||
}
|
||||
|
@ -3,20 +3,15 @@
|
||||
namespace ManiaControl\Update;
|
||||
|
||||
use FML\Controls\Control;
|
||||
use FML\Controls\Entry;
|
||||
use FML\Controls\Frame;
|
||||
use FML\Controls\Label;
|
||||
use FML\Controls\Labels\Label_Button;
|
||||
use FML\Controls\Labels\Label_Text;
|
||||
use FML\Controls\Quads\Quad_Icons128x32_1;
|
||||
use FML\Controls\Quads\Quad_Icons128x128_1;
|
||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||
use FML\Script\Script;
|
||||
use ManiaControl\Admin\AuthenticationManager;
|
||||
use ManiaControl\Callbacks\CallbackListener;
|
||||
use ManiaControl\Callbacks\CallbackManager;
|
||||
use ManiaControl\Configurators\ConfiguratorMenu;
|
||||
use ManiaControl\Formatter;
|
||||
use ManiaControl\Files\FileUtil;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
||||
@ -65,8 +60,6 @@ class PluginInstallMenu implements CallbackListener, ConfiguratorMenu, Manialink
|
||||
$pagesId = 'PluginInstallPages';
|
||||
$frame = new Frame();
|
||||
|
||||
$pluginClasses = $this->maniaControl->pluginManager->getPluginClasses();
|
||||
|
||||
// Config
|
||||
$pagerSize = 9.;
|
||||
$entryHeight = 5.;
|
||||
@ -105,7 +98,7 @@ class PluginInstallMenu implements CallbackListener, ConfiguratorMenu, Manialink
|
||||
$pluginList = json_decode($dataJson);
|
||||
$index = 0;
|
||||
if ($pluginList && isset($pluginList[0])) {
|
||||
$pluginClasses = $this->maniaControl->pluginManager->getPluginClasses();
|
||||
$pluginClasses = $this->maniaControl->pluginManager->getPluginClasses();
|
||||
$pluginIds = array();
|
||||
/** @var Plugin $class */
|
||||
foreach($pluginClasses as $class) {
|
||||
|
@ -501,18 +501,18 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
||||
if (!$bytes || $bytes <= 0) {
|
||||
trigger_error("Couldn't save plugin Zip.");
|
||||
if ($player) {
|
||||
$self->maniaControl->chat->sendError('Update failed: Couldn\'t save plugin zip!', $player->login);
|
||||
$self->maniaControl->chat->sendError("Update failed: Couldn't save plugin zip!", $player->login);
|
||||
}
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
$zip = new \ZipArchive();
|
||||
$result = $zip->open($updateFileName);
|
||||
if ($result !== true) {
|
||||
trigger_error("Couldn't open plugin Zip. ({$result})");
|
||||
if ($player) {
|
||||
$self->maniaControl->chat->sendError('Update failed: Couldn\'t open plugin zip!', $player->login);
|
||||
$self->maniaControl->chat->sendError("Update failed: Couldn't open plugin zip!", $player->login);
|
||||
}
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
$zip->extractTo(ManiaControlDir . '/plugins');
|
||||
@ -559,15 +559,15 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
||||
$bytes = file_put_contents($installFileName, $installFileContent);
|
||||
if (!$bytes || $bytes <= 0) {
|
||||
trigger_error("Couldn't save plugin Zip.");
|
||||
$self->maniaControl->chat->sendError('Install failed: Couldn\'t save plugin zip!', $player->login);
|
||||
return false;
|
||||
$self->maniaControl->chat->sendError("Install failed: Couldn't save plugin zip!", $player->login);
|
||||
return;
|
||||
}
|
||||
$zip = new \ZipArchive();
|
||||
$result = $zip->open($installFileName);
|
||||
if ($result !== true) {
|
||||
trigger_error("Couldn't open plugin Zip. ({$result})");
|
||||
$self->maniaControl->chat->sendError('Install failed: Couldn\'t open plugin zip!', $player->login);
|
||||
return false;
|
||||
$self->maniaControl->chat->sendError("Install failed: Couldn't open plugin zip!", $player->login);
|
||||
return;
|
||||
}
|
||||
|
||||
$zip->extractTo(ManiaControlDir . '/plugins');
|
||||
@ -782,7 +782,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
||||
if (!$bytes || $bytes <= 0) {
|
||||
trigger_error("Couldn't save Update Zip.");
|
||||
if ($player) {
|
||||
$self->maniaControl->chat->sendError('Update failed: Couldn\'t save Update zip!', $player->login);
|
||||
$self->maniaControl->chat->sendError("Update failed: Couldn't save Update zip!", $player->login);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -791,7 +791,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
||||
if ($result !== true) {
|
||||
trigger_error("Couldn't open Update Zip. ({$result})");
|
||||
if ($player) {
|
||||
$self->maniaControl->chat->sendError('Update failed: Couldn\'t open Update zip!', $player->login);
|
||||
$self->maniaControl->chat->sendError("Update failed: Couldn't open Update zip!", $player->login);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -967,6 +967,7 @@ class Dedimania implements CallbackListener, CommandListener, TimerListener, Plu
|
||||
} else if ($scriptName == 'TimeAttack' || $scriptName == 'Laps' || $scriptName == 'TeamAttack' || $scriptName == 'TimeAttackPlus') {
|
||||
return 'TA';
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
case 3:
|
||||
|
@ -218,7 +218,6 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
$karmaGauge->setColor($karmaColor . '7');
|
||||
$karmaLabel->setText(' ' . round($karma * 100.) . '% (' . $voteCount . ')');
|
||||
} else {
|
||||
$karma = 0.;
|
||||
$karmaGauge->setRatio(0.);
|
||||
$karmaGauge->setColor('00fb');
|
||||
$karmaLabel->setText('-');
|
||||
@ -227,7 +226,8 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
// Loop players
|
||||
foreach($players as $login => $player) {
|
||||
// Get player vote
|
||||
//$vote = $this->getPlayerVote($player, $map); //TODO what is this for, vote nowhere used?
|
||||
// TODO: show the player his own vote in some way
|
||||
//$vote = $this->getPlayerVote($player, $map);
|
||||
|
||||
// Adjust manialink for player's vote
|
||||
$votesFrame = $this->manialink->votesFrame;
|
||||
|
@ -359,9 +359,8 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
|
||||
}
|
||||
|
||||
$mysqli = $this->maniaControl->database->mysqli;
|
||||
$removeRecord = $records[$recordId-1];
|
||||
$query = "DELETE FROM `" . self::TABLE_RECORDS . "` WHERE `mapIndex` = ".$currentMap->index." AND `playerIndex` = ".$player->index."";
|
||||
$result = $mysqli->query($query);
|
||||
$mysqli->query($query);
|
||||
if ($mysqli->error) {
|
||||
trigger_error($mysqli->error);
|
||||
return null;
|
||||
|
@ -366,7 +366,7 @@ class QueuePlugin implements CallbackListener, CommandListener, ManialinkPageAns
|
||||
* @return bool
|
||||
*/
|
||||
private function addPlayerToQueue(Player $player) {
|
||||
if($this->maniaControl->client->getServerPassword() != false && $this->maniaControl->settingManager->getSetting($this, self::QUEUE_ACTIVE_ON_PASS) == false) return;
|
||||
if($this->maniaControl->client->getServerPassword() != false && $this->maniaControl->settingManager->getSetting($this, self::QUEUE_ACTIVE_ON_PASS) == false) return false;
|
||||
|
||||
foreach($this->queue as $queuedPlayer) {
|
||||
if($queuedPlayer->login == $player->login) {
|
||||
@ -379,6 +379,8 @@ class QueuePlugin implements CallbackListener, CommandListener, ManialinkPageAns
|
||||
$this->queue[count($this->queue)] = $player;
|
||||
$this->sendChatMessage('$<$fff' . $player->nickname . '$> just joined the queue!');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -319,7 +319,6 @@ class TeamSpeakPlugin implements CallbackListener, CommandListener, ManialinkPag
|
||||
$frame->add($users[$userid]);
|
||||
$y = 17.5 + ($i * 2.5);
|
||||
$users[$userid]->setY($height / 2 - $y);
|
||||
$x = $startx;
|
||||
if ($channel['pid'] != 0) {
|
||||
$x = $startx + 7;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user