Refactoring of Code, Comments and Spelling

This commit is contained in:
Steffen Schröder 2013-12-09 13:45:58 +01:00
parent 5339b6766f
commit c97b4166f2
26 changed files with 1834 additions and 1833 deletions

View File

@ -4,7 +4,6 @@ namespace ManiaControl\Admin;
use ManiaControl\ManiaControl;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use FML\ManiaLink;
use FML\Controls\Control;
use FML\Controls\Frame;
@ -136,7 +135,7 @@ class AdminMenu implements CallbackListener {
// Add items
$x = 0.5 * $itemSize * $itemMarginFactorX;
foreach ($this->menuItems as $itemOrder => $menuItems) {
foreach ($this->menuItems as $menuItems) {
foreach ($menuItems as $menuItem) {
$menuItem->setSize($itemSize, $itemSize);
$itemsFrame->add($menuItem);

View File

@ -6,6 +6,11 @@ use ManiaControl\ManiaControl;
use ManiaControl\Commands\CommandListener;
use ManiaControl\Players\Player;
/**
* Class offering commands to grant authorizations to players
*
* @author steeffeen & kremsy
*/
class AuthCommands implements CommandListener {
/**
* Private properties
@ -50,7 +55,7 @@ class AuthCommands implements CommandListener {
}
$success = $this->maniaControl->authenticationManager->grantAuthLevel($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN);
if (!$success) {
$this->maniaControl->chat->sendError('Error occured.', $player->login);
$this->maniaControl->chat->sendError('Error occurred.', $player->login);
return;
}
$message = '$<' . $player->nickname . '$> added $<' . $target->nickname . '$> as SuperAdmin!';
@ -81,7 +86,7 @@ class AuthCommands implements CommandListener {
}
$success = $this->maniaControl->authenticationManager->grantAuthLevel($player, AuthenticationManager::AUTH_LEVEL_ADMIN);
if (!$success) {
$this->maniaControl->chat->sendError('Error occured.', $player->login);
$this->maniaControl->chat->sendError('Error occurred.', $player->login);
return;
}
$message = '$<' . $player->nickname . '$> added $<' . $target->nickname . '$> as Admin!';
@ -112,7 +117,7 @@ class AuthCommands implements CommandListener {
}
$success = $this->maniaControl->authenticationManager->grantAuthLevel($player, AuthenticationManager::AUTH_LEVEL_OPERATOR);
if (!$success) {
$this->maniaControl->chat->sendError('Error occured.', $player->login);
$this->maniaControl->chat->sendError('Error occurred.', $player->login);
return;
}
$message = '$<' . $player->nickname . '$> added $<' . $target->nickname . '$> as Operator!';
@ -127,7 +132,7 @@ class AuthCommands implements CommandListener {
*/
private function sendAddSuperAdminUsageInfo(Player $player) {
$message = "Usage Example: '//addsuperadmin login'";
return $this->maniaControl->chat->sendUsageInfo($message);
return $this->maniaControl->chat->sendUsageInfo($message, $player->login);
}
/**
@ -138,7 +143,7 @@ class AuthCommands implements CommandListener {
*/
private function sendAddAdminUsageInfo(Player $player) {
$message = "Usage Example: '//addadmin login'";
return $this->maniaControl->chat->sendUsageInfo($message);
return $this->maniaControl->chat->sendUsageInfo($message, $player->login);
}
/**
@ -149,7 +154,7 @@ class AuthCommands implements CommandListener {
*/
private function sendAddOperatorUsageInfo(Player $player) {
$message = "Usage Example: '//addop login'";
return $this->maniaControl->chat->sendUsageInfo($message);
return $this->maniaControl->chat->sendUsageInfo($message, $player->login);
}
}

View File

@ -133,9 +133,9 @@ class AuthenticationManager {
}
/**
* Sends an error message to the login
* Sends an error message to the player
*
* @param string $login
* @param Player $player
* @return bool
*/
public function sendNotAllowed(Player $player) {
@ -148,7 +148,7 @@ class AuthenticationManager {
/**
* Check if the player has enough rights
*
* @param \ManiaControl\Players\Player $login
* @param Player $player
* @param int $neededAuthLevel
* @return bool
*/

View File

@ -115,7 +115,7 @@ class CallbackManager {
* Trigger a specific callback
*
* @param string $callbackName
* @param array $data
* @param array $callback
*/
public function triggerCallback($callbackName, array $callback) {
if (!array_key_exists($callbackName, $this->callbackListeners)) {
@ -159,7 +159,7 @@ class CallbackManager {
}
// Handle callbacks
foreach ($callbacks as $index => $callback) {
foreach ($callbacks as $callback) {
$callbackName = $callback[0];
switch ($callbackName) {
case 'ManiaPlanet.BeginMap':

View File

@ -3,7 +3,7 @@
namespace ManiaControl;
/**
* Utitlity class offering methods to convert and use ManiaPlanet colors
* Utility class offering methods to convert and use ManiaPlanet colors
*
* @author steeffeen
*/
@ -45,7 +45,7 @@ abstract class ColorUtil {
$value = 1.;
}
$value *= 15.;
$value = round($value);
$value = (int) round($value);
if ($value < 10) {
return (string) $value;
}

View File

@ -3,10 +3,8 @@
namespace ManiaControl\Commands;
use ManiaControl\ManiaControl;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Players\Player;
/**
* Class for handling chat commands

View File

@ -8,7 +8,6 @@ use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use ManiaControl\Players\Player;
use FML\ManiaLink;
use FML\Controls\Control;
use FML\Controls\Frame;
use FML\Controls\Label;
use FML\Controls\Labels\Label_Text;

View File

@ -8,7 +8,6 @@ use FML\Controls\Label;
use FML\Script\Pages;
use FML\Script\Tooltips;
use FML\Controls\Control;
use FML\Controls\Quad;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Controls\Labels\Label_Text;
use FML\Controls\Entry;
@ -99,6 +98,7 @@ class ScriptSettings implements ConfiguratorMenu {
// Setting pages
$pageFrames = array();
$y = 0.;
foreach ($scriptParams as $index => $scriptParam) {
$settingName = $scriptParam['Name'];
if (!isset($scriptSettings[$settingName])) continue;
@ -135,16 +135,16 @@ class ScriptSettings implements ConfiguratorMenu {
}
$entry->setDefault($settingValue);
$decriptionLabel = new Label();
$pageFrame->add($decriptionLabel);
$decriptionLabel->setHAlign(Control::LEFT);
$decriptionLabel->setPosition($width * -0.45, $height * -0.44);
$decriptionLabel->setSize($width * 0.7, $settingHeight);
$decriptionLabel->setStyle($labelStyleDescription);
$decriptionLabel->setTranslate(true);
$decriptionLabel->setTextPrefix('Desc: ');
$decriptionLabel->setText($scriptParam['Desc']);
$tooltips->add($nameLabel, $decriptionLabel);
$descriptionLabel = new Label();
$pageFrame->add($descriptionLabel);
$descriptionLabel->setHAlign(Control::LEFT);
$descriptionLabel->setPosition($width * -0.45, $height * -0.44);
$descriptionLabel->setSize($width * 0.7, $settingHeight);
$descriptionLabel->setStyle($labelStyleDescription);
$descriptionLabel->setTranslate(true);
$descriptionLabel->setTextPrefix('Desc: ');
$descriptionLabel->setText($scriptParam['Desc']);
$tooltips->add($nameLabel, $descriptionLabel);
$y -= $settingHeight;
if ($index % $pageMaxCount == $pageMaxCount - 1) {

View File

@ -76,15 +76,15 @@ class Database {
* @return bool
*/
private function initDatabase() {
$dbname = $this->config->xpath('database');
if (!$dbname) {
$dbName = $this->config->xpath('database');
if (!$dbName) {
trigger_error("Invalid database configuration (database).", E_USER_ERROR);
return false;
}
$dbname = (string) $dbname[0];
$dbName = (string) $dbName[0];
// Try to connect
$result = $this->mysqli->select_db($dbname);
$result = $this->mysqli->select_db($dbName);
if ($result) {
return true;
}
@ -96,7 +96,7 @@ class Database {
trigger_error($this->mysqli->error, E_USER_ERROR);
return false;
}
$databaseStatement->bind_param('s', $dbname);
$databaseStatement->bind_param('s', $dbName);
$databaseStatement->execute();
if ($databaseStatement->error) {
trigger_error($databaseStatement->error, E_USER_ERROR);
@ -105,9 +105,9 @@ class Database {
$databaseStatement->close();
// Connect to new database
$this->mysqli->select_db($dbname);
$this->mysqli->select_db($dbName);
if ($this->mysqli->error) {
trigger_error("Couldn't select database '{$dbname}'. " . $this->mysqli->error, E_USER_ERROR);
trigger_error("Couldn't select database '{$dbName}'. " . $this->mysqli->error, E_USER_ERROR);
return false;
}
return true;

View File

@ -260,7 +260,7 @@ class GBXBaseFetcher
// XML parser functions
private function startTag($parser, $name, $attribs)
{
foreach ($attribs as $key => &$val)
foreach ($attribs as &$val)
$val = utf8_decode($val);
//echo 'startTag: ' . $name . "\n"; print_r($attribs);
array_push($this->_parsestack, $name);

View File

@ -120,6 +120,7 @@ class ManiaControl implements CommandListener {
* Send ManiaControl version
*
* @param array $chat
* @param Player $player
* @return bool
*/
public function command_Version(array $chat, Player $player) {
@ -129,10 +130,10 @@ class ManiaControl implements CommandListener {
/**
* Quit ManiaControl and log the given message
*test
*
* @param string $message
*/
public function quit($message = false) {
public function quit($message = '') {
if ($this->client) {
// Announce quit
$this->chat->sendInformation('ManiaControl shutting down.');
@ -248,7 +249,7 @@ class ManiaControl implements CommandListener {
}
// Connect finished
error_log("Server connection succesfully established!");
error_log("Server connection successfully established!");
// Enable script callbacks if needed
if ($this->server->getGameMode() === 0) {

View File

@ -52,7 +52,7 @@ class Map {
if (!$rpc_infos) {
return;
}
$this->name = $rpc_infos['Name']; // in aseco stripped new lines on name
$this->name = $rpc_infos['Name'];
$this->uid = $rpc_infos['UId'];
$this->fileName = $rpc_infos['FileName'];
$this->authorLogin = $rpc_infos['Author'];
@ -69,7 +69,7 @@ class Map {
try {
$this->mapFetcher->processFile($mapsDirectory . $this->fileName);
}
catch (Exception $e) {
catch (\Exception $e) {
trigger_error($e->getMessage(), E_USER_WARNING);
}
$this->authorNick = $this->mapFetcher->authorNick;

View File

@ -73,7 +73,7 @@ class MapCommands implements CommandListener {
$this->maniaControl->authenticationManager->sendNotAllowed($player);
return false;
}
// TODO: mx fetcher nutzen?
// TODO: user mx fetcher
$params = explode(' ', $chatCallback[1][2], 2);
if (count($params) < 2) {
$this->maniaControl->chat->sendUsageInfo('Usage example: //addmap 1234', $player->login);
@ -138,7 +138,7 @@ class MapCommands implements CommandListener {
}
$response = $this->maniaControl->client->getResponse();
if (!$response) {
// Inalid map type
// Invalid map type
$this->maniaControl->chat->sendError("Invalid map type.", $player->login);
return false;
}

View File

@ -5,7 +5,6 @@ namespace ManiaControl\Players;
use ManiaControl\ManiaControl;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Commands\CommandListener;
use ManiaControl\Players\Player;
/**
* Class offering various admin commands related to players
@ -51,7 +50,7 @@ class PlayerCommands implements CommandListener {
}
$success = $this->maniaControl->client->query('AutoTeamBalance');
if (!$success) {
$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return;
}
$this->maniaControl->chat->sendInformation('$<' . $player->nickname . '$> balanced Teams!');
@ -85,7 +84,7 @@ class PlayerCommands implements CommandListener {
}
$success = $this->maniaControl->client->query('Kick', $target->login, $message);
if (!$success) {
$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return;
}
$this->maniaControl->chat->sendInformation('$<' . $player->nickname . '$> kicked $<' . $target->nickname . '$>!');
@ -119,7 +118,7 @@ class PlayerCommands implements CommandListener {
}
$success = $this->maniaControl->client->query('ForceSpectator', $target->login, $type);
if (!$success) {
$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return;
}
if ($type != 1) {
@ -156,7 +155,7 @@ class PlayerCommands implements CommandListener {
}
$success = $this->maniaControl->client->query('ForceSpectator', $target->login, 2);
if (!$success) {
$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return;
}
if ($type != 1) {
@ -188,7 +187,7 @@ class PlayerCommands implements CommandListener {
}
}
if (!$success) {
$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return;
}
$this->maniaControl->chat->sendSuccess('Fake players connected!', $player->login);
@ -207,7 +206,7 @@ class PlayerCommands implements CommandListener {
}
$success = $this->maniaControl->client->query('DisconnectFakePlayer', '*');
if (!$success) {
$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return;
}
$this->maniaControl->chat->sendSuccess('Fake players disconnected!', $player->login);

View File

@ -122,7 +122,7 @@ class PlayerManager implements CallbackListener {
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_JOIN_LEAVE_MESSAGES)) {
$string = array(0 => 'New Player', 1 => '$0f0Operator', 2 => '$0f0Admin', 3 => '$0f0MasterAdmin', 4 => '$0f0MasterAdmin');
$nickname = Formatter::stripCodes($player->nickname); //TODO strip codes without colour codes like in serverviewer
$nickname = Formatter::stripCodes($player->nickname); // TODO: strip codes without colour codes like in serverviewer
$this->maniaControl->chat->sendChat(
'$ff0' . $string[$player->authLevel] . ': $fff' . $nickname . '$z $ff0Nation:$fff ' . $player->getCountry() .
' $ff0Ladder: $fff' . $player->ladderRank);

View File

@ -4,6 +4,7 @@ namespace ManiaControl\Server;
use ManiaControl\FileUtil;
use ManiaControl\ManiaControl;
use ManiaControl\Players\Player;
require_once __DIR__ . '/ServerCommands.php';
@ -159,7 +160,7 @@ class Server {
*/
public function getSystemInfo() {
if (!$this->maniaControl->client->query('GetSystemInfo')) {
trigger_error("Couldn't fetch server system info. " . $this->maniaControl->getClientErrorText($client));
trigger_error("Couldn't fetch server system info. " . $this->maniaControl->getClientErrorText($this->maniaControl->client));
return null;
}
return $this->maniaControl->client->getResponse();
@ -252,7 +253,7 @@ class Server {
$map = $this->getMap();
$gameMode = $this->getGameMode();
$time = time();
$fileName = "GhostReplays/Ghost.{$login}.{$gameMode}.{$time}.{$map['UId']}.Replay.Gbx";
$fileName = "GhostReplays/Ghost.{$player->login}.{$gameMode}.{$time}.{$map['UId']}.Replay.Gbx";
// Save ghost replay
if (!$this->maniaControl->client->query('SaveBestGhostsReplay', $player->login, $fileName)) {

View File

@ -161,7 +161,7 @@ class ServerCommands implements CallbackListener, CommandListener {
}
$serverName = $params[1];
if (!$this->maniaControl->client->query('SetServerName', $serverName)) {
$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return;
}
$this->maniaControl->chat->sendSuccess("Server name changed to: '{$serverName}'!", $player->login);
@ -187,7 +187,7 @@ class ServerCommands implements CallbackListener, CommandListener {
}
$success = $this->maniaControl->client->query('SetServerPassword', $password);
if (!$success) {
$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return;
}
$this->maniaControl->chat->sendSuccess($successMessage, $player->login);
@ -213,7 +213,7 @@ class ServerCommands implements CallbackListener, CommandListener {
}
$success = $this->maniaControl->client->query('SetServerPasswordForSpectator', $password);
if (!$success) {
$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return;
}
$this->maniaControl->chat->sendSuccess($successMessage, $player->login);
@ -246,7 +246,7 @@ class ServerCommands implements CallbackListener, CommandListener {
}
$success = $this->maniaControl->client->query('SetMaxPlayers', $amount);
if (!$success) {
$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return;
}
$this->maniaControl->chat->sendSuccess("Changed max players to: {$amount}", $player->login);
@ -279,7 +279,7 @@ class ServerCommands implements CallbackListener, CommandListener {
}
$success = $this->maniaControl->client->query('SetMaxSpectators', $amount);
if (!$success) {
$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return;
}
$this->maniaControl->chat->sendSuccess("Changed max spectators to: {$amount}", $player->login);
@ -298,7 +298,7 @@ class ServerCommands implements CallbackListener, CommandListener {
}
$success = $this->maniaControl->client->query('SetHideServer', 1);
if (!$success) {
$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return;
}
$this->maniaControl->chat->sendSuccess('Server is now hidden!', $player->login);
@ -317,7 +317,7 @@ class ServerCommands implements CallbackListener, CommandListener {
}
$success = $this->maniaControl->client->query('SetHideServer', 0);
if (!$success) {
$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return;
}
$this->maniaControl->chat->sendSuccess('Server is now visible!', $player->login);
@ -336,7 +336,7 @@ class ServerCommands implements CallbackListener, CommandListener {
}
$success = $this->maniaControl->client->query('AllowMapDownload', true);
if (!$success) {
$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return;
}
$this->maniaControl->chat->sendSuccess('Map Download is now enabled!', $player->login);
@ -355,7 +355,7 @@ class ServerCommands implements CallbackListener, CommandListener {
}
$success = $this->maniaControl->client->query('AllowMapDownload', false);
if (!$success) {
$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return;
}
$this->maniaControl->chat->sendSuccess('Map Download is now disabled!', $player->login);
@ -374,7 +374,7 @@ class ServerCommands implements CallbackListener, CommandListener {
}
$success = $this->maniaControl->client->query('DisableHorns', false);
if (!$success) {
$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return;
}
$this->maniaControl->chat->sendSuccess('Horns enabled!', $player->login);
@ -393,7 +393,7 @@ class ServerCommands implements CallbackListener, CommandListener {
}
$success = $this->maniaControl->client->query('DisableHorns', true);
if (!$success) {
$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return;
}
$this->maniaControl->chat->sendSuccess('Horns disabled!', $player->login);

View File

@ -282,7 +282,7 @@ class SettingManager {
* Reset a setting to its default value
*
* @param object $object
* @param string $settingname
* @param string $settingName
* @return bool
*/
public function resetSetting($object, $settingName) {
@ -312,7 +312,7 @@ class SettingManager {
* Delete a setting from the database
*
* @param object $object
* @param string $settingname
* @param string $settingName
* @return bool
*/
public function deleteSetting($object, $settingName) {

View File

@ -28,7 +28,7 @@ class ChatlogPlugin implements CallbackListener, Plugin {
private $logServerMessages = true;
/**
* Constuct chatlog plugin
* Construct chatlog plugin
*
* @param ManiaControl $maniaControl
*/
@ -129,7 +129,7 @@ class ChatlogPlugin implements CallbackListener, Plugin {
/**
* Log the given message
*
* @param string $message
* @param string $text
* @param string $login
*/
private function logText($text, $login = null) {

View File

@ -168,7 +168,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
/**
* Handle //getplanets command
*
* @param array $chat
* @param array $chatCallback
* @param Player $player
* @return bool
*/

View File

@ -3,12 +3,10 @@ use ManiaControl\ColorUtil;
use ManiaControl\ManiaControl;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Manialinks\ManialinkUtil;
use ManiaControl\Maps\Map;
use ManiaControl\Players\Player;
use ManiaControl\Plugins\Plugin;
use FML\ManiaLink;
use FML\Controls\Control;
use FML\Controls\Frame;
use FML\Controls\Label;
use FML\Controls\Quad;
@ -226,7 +224,7 @@ class KarmaPlugin implements CallbackListener, Plugin {
$vote -= substr_count($message, '-');
$success = $this->handleVote($player, $vote);
if (!$success) {
$this->maniaControl->chat->sendError('Error occured.', $player->login);
$this->maniaControl->chat->sendError('Error occurred.', $player->login);
return;
}
$this->maniaControl->chat->sendSuccess('Vote updated!', $player->login);
@ -296,7 +294,7 @@ class KarmaPlugin implements CallbackListener, Plugin {
PRIMARY KEY (`index`),
UNIQUE KEY `player_map_vote` (`mapIndex`, `playerIndex`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Save players map votes' AUTO_INCREMENT=1;";
$result = $mysqli->query($query);
$mysqli->query($query);
if ($mysqli->error) {
trigger_error($mysqli->error, E_USER_ERROR);
}
@ -362,6 +360,7 @@ class KarmaPlugin implements CallbackListener, Plugin {
* Get the current karma of the map
*
* @param Map $map
* @return float | bool
*/
private function getMapKarma(Map $map) {
$mysqli = $this->maniaControl->database->mysqli;
@ -387,9 +386,10 @@ class KarmaPlugin implements CallbackListener, Plugin {
}
/**
* Get the current votings for the map
* Get the current Votes for the Map
*
* @param Map $map
* @return array
*/
private function getMapVotes(Map $map) {
$mysqli = $this->maniaControl->database->mysqli;

View File

@ -1,5 +1,4 @@
<?php
use ManiaControl\Database;
use ManiaControl\Formatter;
use ManiaControl\ManiaControl;
use ManiaControl\Callbacks\CallbackListener;
@ -13,7 +12,6 @@ use FML\Controls\Control;
use FML\Controls\Frame;
use FML\Controls\Label;
use FML\Controls\Quad;
use FML\Controls\Labels\Label_Text;
/**
* ManiaControl Local Records Plugin
@ -214,7 +212,7 @@ class LocalRecordsPlugin implements CallbackListener, Plugin {
{$time}
) ON DUPLICATE KEY UPDATE
`time` = VALUES(`time`);";
$result = $mysqli->query($query);
$mysqli->query($query);
if ($mysqli->error) {
trigger_error($mysqli->error);
return;
@ -222,8 +220,8 @@ class LocalRecordsPlugin implements CallbackListener, Plugin {
$this->updateManialink = true;
// Announce record
// TODO: setting für nur-zum-spieler senden
// TODO: setting für nur-besten-x-announcen
// TODO: setting to send notification only to the player
// TODO: setting to send notifications only for x best records
$newRecord = $this->getLocalRecord($map, $player);
if (!$oldRecord || $newRecord->rank < $oldRecord->rank) {
$improvement = 'gained the';
@ -257,7 +255,7 @@ class LocalRecordsPlugin implements CallbackListener, Plugin {
/**
* Handle ClientUpdated callback
*
* @param array $data
* @param array $callback
*/
public function handleClientUpdated(array $callback) {
$this->updateManialink = true;

View File

@ -85,6 +85,7 @@ class ObstaclePlugin implements CallbackListener, CommandListener, Plugin {
* Handle JumpTo command
*
* @param array $chatCallback
* @param Player $player
* @return bool
*/
public function command_JumpTo(array $chatCallback, Player $player) {
@ -133,7 +134,7 @@ class ObstaclePlugin implements CallbackListener, CommandListener, Plugin {
return;
}
$time = $data->Run->Time;
// Trigger trackmania player finish callback
// Trigger Trackmania player finish callback
$finishCallback = array($player->pid, $player->login, $time);
$finishCallback = array(CallbackManager::CB_TM_PLAYERCHECKPOINT, $finishCallback);
$this->maniaControl->callbackManager->triggerCallback(CallbackManager::CB_TM_PLAYERCHECKPOINT, $finishCallback);

View File

@ -22,7 +22,7 @@ SETUP:
Enter your mysql server information.
2.3 Open the file 'configs/authentication.xml'.
Add the player logins of administrators.
Add the Player Logins of Administrators.
3. Run the tool via the shell script 'ManiaControl.sh' (UNIX) or the batch file 'ManiaControl.bat' (Windows)