files should have the same name as their classes

who renamed this class?..
This commit is contained in:
Steffen Schröder 2014-04-28 17:54:25 +02:00
parent cf78a2a141
commit 5cac6b4cd1

View File

@ -32,7 +32,7 @@ use ManiaControl\Plugins\Plugin;
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerListener, Plugin { class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerListener, Plugin {
/** /*
* Constants * Constants
*/ */
const ID = 7; const ID = 7;
@ -56,6 +56,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
* Private Properties * Private Properties
*/ */
/** /**
*
* @var maniaControl $maniaControl * @var maniaControl $maniaControl
*/ */
private $maniaControl = null; private $maniaControl = null;
@ -73,6 +74,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
} }
/** /**
*
* @see \ManiaControl\Plugins\Plugin::load() * @see \ManiaControl\Plugins\Plugin::load()
*/ */
public function load(ManiaControl $maniaControl) { public function load(ManiaControl $maniaControl) {
@ -107,12 +109,12 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
} }
/** /**
*
* @see \ManiaControl\Plugins\Plugin::unload() * @see \ManiaControl\Plugins\Plugin::unload()
*/ */
public function unload() { public function unload() {
$this->maniaControl->callbackManager->unregisterCallbackListener($this); $this->maniaControl->callbackManager->unregisterCallbackListener($this);
$this->maniaControl->timerManager->unregisterTimerListenings($this); $this->maniaControl->timerManager->unregisterTimerListenings($this);
unset($this->maniaControl);
} }
/** /**
@ -143,6 +145,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
} }
/** /**
*
* @see \ManiaControl\Plugins\Plugin::getId() * @see \ManiaControl\Plugins\Plugin::getId()
*/ */
public static function getId() { public static function getId() {
@ -150,6 +153,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
} }
/** /**
*
* @see \ManiaControl\Plugins\Plugin::getName() * @see \ManiaControl\Plugins\Plugin::getName()
*/ */
public static function getName() { public static function getName() {
@ -157,6 +161,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
} }
/** /**
*
* @see \ManiaControl\Plugins\Plugin::getVersion() * @see \ManiaControl\Plugins\Plugin::getVersion()
*/ */
public static function getVersion() { public static function getVersion() {
@ -164,6 +169,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
} }
/** /**
*
* @see \ManiaControl\Plugins\Plugin::getAuthor() * @see \ManiaControl\Plugins\Plugin::getAuthor()
*/ */
public static function getAuthor() { public static function getAuthor() {
@ -171,6 +177,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
} }
/** /**
*
* @see \ManiaControl\Plugins\Plugin::getDescription() * @see \ManiaControl\Plugins\Plugin::getDescription()
*/ */
public static function getDescription() { public static function getDescription() {
@ -201,14 +208,14 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
} }
} }
public function handleSettingsChanged($class, $settingName, $value) { public function handleSettingsChanged($class, $settingName, $value) {
if (!$class = get_class()) { if (!$class = get_class()) {
return; return;
} }
if ($settingName == 'Enable Local Records Widget' && $value == true) { if ($settingName == 'Enable Local Records Widget' && $value == true) {
$this->updateManialink = true; $this->updateManialink = true;
} elseif ($settingName == 'Enable Local Records Widget' && $value == false) { }
elseif ($settingName == 'Enable Local Records Widget' && $value == false) {
$ml = new ManiaLink(self::MLID_RECORDS); $ml = new ManiaLink(self::MLID_RECORDS);
$mltext = $ml->render()->saveXML(); $mltext = $ml->render()->saveXML();
$this->maniaControl->manialinkManager->sendManialink($mltext); $this->maniaControl->manialinkManager->sendManialink($mltext);
@ -323,7 +330,8 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
if ($oldRecord) $oldRank = ($improvement == 'improved your') ? '' : $oldRecord->rank . '. '; if ($oldRecord) $oldRank = ($improvement == 'improved your') ? '' : $oldRecord->rank . '. ';
if ($oldRecord) $message .= '$> ($<$ff0' . $oldRank . '$>$<$fff-' . Formatter::formatTime(($oldRecord->time - $newRecord->time)) . '$>)!'; if ($oldRecord) $message .= '$> ($<$ff0' . $oldRank . '$>$<$fff-' . Formatter::formatTime(($oldRecord->time - $newRecord->time)) . '$>)!';
$this->maniaControl->chat->sendInformation('$3c0' . $message, $player->login); $this->maniaControl->chat->sendInformation('$3c0' . $message, $player->login);
} else { }
else {
$improvement = ((!$oldRecord || $newRecord->rank < $oldRecord->rank) ? 'gained the' : 'improved the'); $improvement = ((!$oldRecord || $newRecord->rank < $oldRecord->rank) ? 'gained the' : 'improved the');
$message = '$<' . $player->nickname . '$> ' . $improvement . ' $<$ff0' . $newRecord->rank . '.$> Local Record: $<$fff' . Formatter::formatTime($newRecord->time); $message = '$<' . $player->nickname . '$> ' . $improvement . ' $<$ff0' . $newRecord->rank . '.$> Local Record: $<$fff' . Formatter::formatTime($newRecord->time);
if ($oldRecord) $oldRank = ($improvement == 'improved the') ? '' : $oldRecord->rank . '. '; if ($oldRecord) $oldRank = ($improvement == 'improved the') ? '' : $oldRecord->rank . '. ';
@ -348,6 +356,12 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
} }
} }
/**
* Delete a Player's record
*
* @param array $chat
* @param Player $player
*/
public function deleteRecord(array $chat, Player $player) { public function deleteRecord(array $chat, Player $player) {
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MASTERADMIN)) { if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MASTERADMIN)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
@ -369,12 +383,13 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
$mysqli->query($query); $mysqli->query($query);
if ($mysqli->error) { if ($mysqli->error) {
trigger_error($mysqli->error); trigger_error($mysqli->error);
return null; return;
} }
$this->maniaControl->callbackManager->triggerCallback(self::CB_LOCALRECORDS_CHANGED, null); $this->maniaControl->callbackManager->triggerCallback(self::CB_LOCALRECORDS_CHANGED, null);
$this->maniaControl->chat->sendInformation('Record no. $<$fff' . $recordId . '$> has been removed!'); $this->maniaControl->chat->sendInformation('Record no. $<$fff' . $recordId . '$> has been removed!');
} else { }
else {
$this->maniaControl->chat->sendError('Cannot remove record $<$fff' . $recordId . '$>, because it\'s not an integer!', $player); $this->maniaControl->chat->sendError('Cannot remove record $<$fff' . $recordId . '$>, because it\'s not an integer!', $player);
} }
} }
@ -450,7 +465,8 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
} }
if (strlen($listRecord->nickname) < 2) $listRecord->nickname = $listRecord->login; if (strlen($listRecord->nickname) < 2) $listRecord->nickname = $listRecord->login;
$array = array($listRecord->rank => $x + 5, '$fff'.$listRecord->nickname => $x + 18, $listRecord->login => $x + 70, Formatter::formatTime($listRecord->time) => $x + 101); $array = array($listRecord->rank => $x + 5, '$fff' . $listRecord->nickname => $x + 18, $listRecord->login => $x + 70,
Formatter::formatTime($listRecord->time) => $x + 101);
$this->maniaControl->manialinkManager->labelLine($recordFrame, $array); $this->maniaControl->manialinkManager->labelLine($recordFrame, $array);
$recordFrame->setY($y); $recordFrame->setY($y);
@ -549,10 +565,9 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
$frame->add($recordFrame); $frame->add($recordFrame);
$recordFrame->setPosition(0, $y); $recordFrame->setPosition(0, $y);
/*$backgroundQuad = new Quad(); /*
$recordFrame->add($backgroundQuad); * $backgroundQuad = new Quad(); $recordFrame->add($backgroundQuad); $backgroundQuad->setSize($width * 1.04, $lineHeight * 1.4); $backgroundQuad->setStyles($quadStyle, $quadSubstyle);
$backgroundQuad->setSize($width * 1.04, $lineHeight * 1.4); */
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);*/
$rankLabel = new Label(); $rankLabel = new Label();
$recordFrame->add($rankLabel); $recordFrame->add($rankLabel);
@ -640,4 +655,3 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
return $record; return $record;
} }
} }