prepare method

This commit is contained in:
kremsy 2014-01-27 20:39:10 +01:00 committed by Steffen Schröder
parent 053649600d
commit be86717c0b
13 changed files with 571 additions and 448 deletions

View File

@ -15,6 +15,14 @@ interface Plugin {
*/ */
const PLUGIN_INTERFACE = __CLASS__; const PLUGIN_INTERFACE = __CLASS__;
/**
* Prepares the Plugin
*
* @param ManiaControl $maniaControl
* @return mixed
*/
public static function prepare(ManiaControl $maniaControl);
/** /**
* Load the plugin * Load the plugin
* *

View File

@ -30,6 +30,16 @@ class ChatMessagePlugin implements CommandListener, Plugin {
*/ */
private $maniaControl = null; private $maniaControl = null;
/**
* Prepares the Plugin
*
* @param ManiaControl $maniaControl
* @return mixed
*/
public static function prepare(ManiaControl $maniaControl) {
// TODO: Implement prepare() method.
}
/** /**
* Load the plugin * Load the plugin
* *

View File

@ -1,8 +1,8 @@
<?php <?php
use ManiaControl\FileUtil;
use ManiaControl\ManiaControl;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\FileUtil;
use ManiaControl\ManiaControl;
use ManiaControl\Plugins\Plugin; use ManiaControl\Plugins\Plugin;
/** /**
@ -31,7 +31,16 @@ class ChatlogPlugin implements CallbackListener, Plugin {
private $logServerMessages = true; private $logServerMessages = true;
/** /**
* Prepares the Plugin
* *
* @param ManiaControl $maniaControl
* @return mixed
*/
public static function prepare(ManiaControl $maniaControl) {
// TODO: Implement prepare() method.
}
/**
* @see \ManiaControl\Plugins\Plugin::load() * @see \ManiaControl\Plugins\Plugin::load()
*/ */
public function load(ManiaControl $maniaControl) { public function load(ManiaControl $maniaControl) {
@ -61,8 +70,7 @@ class ChatlogPlugin implements CallbackListener, Plugin {
$pIdPart = '_' . getmypid(); $pIdPart = '_' . getmypid();
if ($dotIndex !== false && $dotIndex >= 0) { if ($dotIndex !== false && $dotIndex >= 0) {
$fileName = substr($fileName, 0, $dotIndex) . $pIdPart . substr($fileName, $dotIndex); $fileName = substr($fileName, 0, $dotIndex) . $pIdPart . substr($fileName, $dotIndex);
} } else {
else {
$fileName .= $pIdPart; $fileName .= $pIdPart;
} }
} }
@ -70,14 +78,12 @@ class ChatlogPlugin implements CallbackListener, Plugin {
$this->logServerMessages = $this->maniaControl->settingManager->getSetting($this, self::SETTING_LOGSERVERMESSAGES); $this->logServerMessages = $this->maniaControl->settingManager->getSetting($this, self::SETTING_LOGSERVERMESSAGES);
// Register for callbacks // Register for callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERCHAT, $this, $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERCHAT, $this, 'handlePlayerChatCallback');
'handlePlayerChatCallback');
return true; return true;
} }
/** /**
*
* @see \ManiaControl\Plugins\Plugin::unload() * @see \ManiaControl\Plugins\Plugin::unload()
*/ */
public function unload() { public function unload() {
@ -86,7 +92,6 @@ class ChatlogPlugin implements CallbackListener, Plugin {
} }
/** /**
*
* @see \ManiaControl\Plugins\Plugin::getId() * @see \ManiaControl\Plugins\Plugin::getId()
*/ */
public static function getId() { public static function getId() {
@ -94,7 +99,6 @@ class ChatlogPlugin implements CallbackListener, Plugin {
} }
/** /**
*
* @see \ManiaControl\Plugins\Plugin::getName() * @see \ManiaControl\Plugins\Plugin::getName()
*/ */
public static function getName() { public static function getName() {
@ -102,7 +106,6 @@ class ChatlogPlugin implements CallbackListener, Plugin {
} }
/** /**
*
* @see \ManiaControl\Plugins\Plugin::getVersion() * @see \ManiaControl\Plugins\Plugin::getVersion()
*/ */
public static function getVersion() { public static function getVersion() {
@ -110,7 +113,6 @@ class ChatlogPlugin implements CallbackListener, Plugin {
} }
/** /**
*
* @see \ManiaControl\Plugins\Plugin::getAuthor() * @see \ManiaControl\Plugins\Plugin::getAuthor()
*/ */
public static function getAuthor() { public static function getAuthor() {
@ -118,7 +120,6 @@ class ChatlogPlugin implements CallbackListener, Plugin {
} }
/** /**
*
* @see \ManiaControl\Plugins\Plugin::getDescription() * @see \ManiaControl\Plugins\Plugin::getDescription()
*/ */
public static function getDescription() { public static function getDescription() {

View File

@ -84,6 +84,16 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
/** @var Player $voter */ /** @var Player $voter */
private $voter = null; private $voter = null;
/**
* Prepares the Plugin
*
* @param ManiaControl $maniaControl
* @return mixed
*/
public static function prepare(ManiaControl $maniaControl) {
// TODO: Implement prepare() method.
}
/** /**
* Load the plugin * Load the plugin
* *

View File

@ -43,6 +43,16 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
const SETTING_DONATION_VALUES = 'Donation Values'; const SETTING_DONATION_VALUES = 'Donation Values';
const SETTING_MIN_AMOUNT_SHOWN = 'Minimum Donation amount to get shown'; const SETTING_MIN_AMOUNT_SHOWN = 'Minimum Donation amount to get shown';
/**
* Prepares the Plugin
*
* @param ManiaControl $maniaControl
* @return mixed
*/
public static function prepare(ManiaControl $maniaControl) {
// TODO: Implement prepare() method.
}
/** /**
* Private properties * Private properties
*/ */

View File

@ -27,6 +27,16 @@ class DynamicPointlimitPlugin implements CallbackListener, CommandListener, Plug
const DYNPNT_MIN = 'Minimum pointlimit'; const DYNPNT_MIN = 'Minimum pointlimit';
const DYNPNT_MAX = 'Maximum pointlimit'; const DYNPNT_MAX = 'Maximum pointlimit';
/**
* Prepares the Plugin
*
* @param ManiaControl $maniaControl
* @return mixed
*/
public static function prepare(ManiaControl $maniaControl) {
// TODO: Implement prepare() method.
}
/** /**
* Private properties * Private properties
*/ */

View File

@ -25,6 +25,16 @@ class EndurancePlugin implements CallbackListener, Plugin {
private $currentMap = null; private $currentMap = null;
private $playerLapTimes = array(); private $playerLapTimes = array();
/**
* Prepares the Plugin
*
* @param ManiaControl $maniaControl
* @return mixed
*/
public static function prepare(ManiaControl $maniaControl) {
// TODO: Implement prepare() method.
}
/** /**
* *
* @see \ManiaControl\Plugins\Plugin::load() * @see \ManiaControl\Plugins\Plugin::load()

View File

@ -45,6 +45,16 @@ class KarmaPlugin implements CallbackListener, Plugin {
private $updateManialink = false; private $updateManialink = false;
private $manialink = null; private $manialink = null;
/**
* Prepares the Plugin
*
* @param ManiaControl $maniaControl
* @return mixed
*/
public static function prepare(ManiaControl $maniaControl) {
// TODO: Implement prepare() method.
}
/** /**
* *
* @see \ManiaControl\Plugins\Plugin::load() * @see \ManiaControl\Plugins\Plugin::load()

View File

@ -45,6 +45,16 @@ class LocalRecordsPlugin implements CallbackListener, Plugin {
private $maniaControl = null; private $maniaControl = null;
private $updateManialink = false; private $updateManialink = false;
/**
* Prepares the Plugin
*
* @param ManiaControl $maniaControl
* @return mixed
*/
public static function prepare(ManiaControl $maniaControl) {
// TODO: Implement prepare() method.
}
/** /**
* *
* @see \ManiaControl\Plugins\Plugin::load() * @see \ManiaControl\Plugins\Plugin::load()

View File

@ -29,6 +29,16 @@ class ObstaclePlugin implements CallbackListener, CommandListener, Plugin {
/** @var maniaControl $maniaControl */ /** @var maniaControl $maniaControl */
private $maniaControl = null; private $maniaControl = null;
/**
* Prepares the Plugin
*
* @param ManiaControl $maniaControl
* @return mixed
*/
public static function prepare(ManiaControl $maniaControl) {
// TODO: Implement prepare() method.
}
/** /**
* *
* @see \ManiaControl\Plugins\Plugin::load() * @see \ManiaControl\Plugins\Plugin::load()

View File

@ -45,6 +45,16 @@ class QueuePlugin implements CallbackListener, CommandListener, ManialinkPageAns
private $spectators = array(); private $spectators = array();
private $showPlay = array(); private $showPlay = array();
/**
* Prepares the Plugin
*
* @param ManiaControl $maniaControl
* @return mixed
*/
public static function prepare(ManiaControl $maniaControl) {
// TODO: Implement prepare() method.
}
/** /**
* Load the plugin * Load the plugin
* *

View File

@ -5,13 +5,12 @@ use FML\Controls\Labels\Label_Text;
use FML\Controls\Quad; use FML\Controls\Quad;
use FML\Controls\Quads\Quad_Icons64x64_1; use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\ManiaLink; use FML\ManiaLink;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Commands\CommandListener; use ManiaControl\Commands\CommandListener;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use ManiaControl\Manialinks\ManialinkManager; use ManiaControl\Manialinks\ManialinkManager;
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use ManiaControl\Plugins\Plugin; use ManiaControl\Plugins\Plugin;
@ -22,7 +21,6 @@ use ManiaControl\Plugins\Plugin;
* *
* @author TheM * @author TheM
*/ */
class TeamSpeakPlugin implements CallbackListener, CommandListener, ManialinkPageAnswerListener, Plugin { class TeamSpeakPlugin implements CallbackListener, CommandListener, ManialinkPageAnswerListener, Plugin {
/** /**
* Constants * Constants
@ -53,6 +51,16 @@ class TeamSpeakPlugin implements CallbackListener, CommandListener, ManialinkPag
private $refreshTime = 0; private $refreshTime = 0;
private $refreshInterval = 90; private $refreshInterval = 90;
/**
* Prepares the Plugin
*
* @param ManiaControl $maniaControl
* @return mixed
*/
public static function prepare(ManiaControl $maniaControl) {
// TODO: Implement prepare() method.
}
/** /**
* Load the plugin * Load the plugin
* *
@ -258,7 +266,9 @@ class TeamSpeakPlugin implements CallbackListener, CommandListener, ManialinkPag
$channels->setTextSize(1); $channels->setTextSize(1);
$nochannels = 0; $nochannels = 0;
foreach($this->serverData['channels'] as $channel) { foreach($this->serverData['channels'] as $channel) {
if($channel['channel_maxclients'] == 0 || strpos($channel['channel_name'], 'spacer') > 0) continue; if ($channel['channel_maxclients'] == 0 || strpos($channel['channel_name'], 'spacer') > 0) {
continue;
}
$nochannels++; $nochannels++;
} }
$channels->setText('$oChannels:$o ' . $nochannels); $channels->setText('$oChannels:$o ' . $nochannels);
@ -288,7 +298,9 @@ class TeamSpeakPlugin implements CallbackListener, CommandListener, ManialinkPag
$i = 0; $i = 0;
$startx = -69.5; $startx = -69.5;
foreach($this->serverData['channels'] as $channel) { foreach($this->serverData['channels'] as $channel) {
if($channel['channel_maxclients'] == 0 || strpos($channel['channel_name'], 'spacer') > 0) continue; if ($channel['channel_maxclients'] == 0 || strpos($channel['channel_name'], 'spacer') > 0) {
continue;
}
$channels[$i] = new Label_Text(); $channels[$i] = new Label_Text();
$frame->add($channels[$i]); $frame->add($channels[$i]);
$y = 17.5 + ($i * 2.5); $y = 17.5 + ($i * 2.5);
@ -302,7 +314,9 @@ class TeamSpeakPlugin implements CallbackListener, CommandListener, ManialinkPag
$channels[$i]->setHAlign('left'); $channels[$i]->setHAlign('left');
$channels[$i]->setTextSize(1); $channels[$i]->setTextSize(1);
$channels[$i]->setScale(0.9); $channels[$i]->setScale(0.9);
if($channel['channel_flag_default'] == 1) $channel['total_clients'] = ($channel['total_clients']-1); // remove query client if ($channel['channel_flag_default'] == 1) {
$channel['total_clients'] = ($channel['total_clients'] - 1);
} // remove query client
$channels[$i]->setText('$o' . $channel['channel_name'] . '$o (' . $channel['total_clients'] . ')'); $channels[$i]->setText('$o' . $channel['channel_name'] . '$o (' . $channel['total_clients'] . ')');
$channels[$i]->setTextColor('fff'); $channels[$i]->setTextColor('fff');
@ -354,10 +368,8 @@ class TeamSpeakPlugin implements CallbackListener, CommandListener, ManialinkPag
/** /**
* TeamSpeak related functions * TeamSpeak related functions
*
* The functions are based upon tsstatus.php from http://tsstatus.sebastien.me/ * The functions are based upon tsstatus.php from http://tsstatus.sebastien.me/
* and were optimized by SilentStorm. * and were optimized by SilentStorm.
*
* Functions originally from the TeamSpeakInfo plugin made by undef.de for XAseco(2) and MPAseco. * Functions originally from the TeamSpeakInfo plugin made by undef.de for XAseco(2) and MPAseco.
*/ */
@ -432,6 +444,7 @@ class TeamSpeakPlugin implements CallbackListener, CommandListener, ManialinkPag
/** /**
* TS Function to send a command to the TeamSpeak server. * TS Function to send a command to the TeamSpeak server.
*
* @param $socket * @param $socket
* @param $cmd * @param $cmd
* @return string * @return string
@ -460,6 +473,7 @@ class TeamSpeakPlugin implements CallbackListener, CommandListener, ManialinkPag
/** /**
* TS Function used to parse lines in the serverresponse. * TS Function used to parse lines in the serverresponse.
*
* @param $rawLine * @param $rawLine
* @return array * @return array
*/ */
@ -501,4 +515,5 @@ class TeamSpeakPlugin implements CallbackListener, CommandListener, ManialinkPag
private function ts3_unescape($str) { private function ts3_unescape($str) {
return str_replace(array('\\\\', "\/", "\s", "\p", "\a", "\b", "\f", "\n", "\r", "\t", "\v"), array(chr(92), chr(47), chr(32), chr(124), chr(7), chr(8), chr(12), chr(10), chr(3), chr(9), chr(11)), $str); return str_replace(array('\\\\', "\/", "\s", "\p", "\a", "\b", "\f", "\n", "\r", "\t", "\v"), array(chr(92), chr(47), chr(32), chr(124), chr(7), chr(8), chr(12), chr(10), chr(3), chr(9), chr(11)), $str);
} }
} }

View File

@ -72,6 +72,15 @@ class WidgetPlugin implements CallbackListener, Plugin {
*/ */
private $maniaControl = null; private $maniaControl = null;
/**
* Prepares the Plugin
*
* @param ManiaControl $maniaControl
* @return mixed
*/
public static function prepare(ManiaControl $maniaControl) {
// TODO: Implement prepare() method.
}
/** /**
* Load the plugin * Load the plugin