improved metadata properties of plugin class

This commit is contained in:
Steffen Schröder 2013-12-03 18:50:30 +01:00
parent ad6574b523
commit 35a7232894
6 changed files with 36 additions and 63 deletions

View File

@ -10,15 +10,18 @@ use ManiaControl\ManiaControl;
* @author steeffeen & kremsy * @author steeffeen & kremsy
*/ */
abstract class Plugin { abstract class Plugin {
/**
* Plugin Metadata
*/
public static $name = 'undefined';
public static $version = 'undefined';
public static $author = 'undefined';
public static $description = 'undefined';
/** /**
* Private properties * Protected properties
*/ */
protected $maniaControl = null; protected $maniaControl = null;
protected $name = 'undefined';
protected $version = 'undefined';
protected $author = 'undefined';
protected $description = 'undefined';
/** /**
* Create a new plugin * Create a new plugin
@ -32,45 +35,9 @@ abstract class Plugin {
* *
* @return string * @return string
*/ */
public static function getClass() { public static final function getClass() {
return __CLASS__; return __CLASS__;
} }
/**
* Get plugin author
*
* @return string
*/
public function getAuthor() {
return $this->author;
}
/**
* Get plugin version
*
* @return float
*/
public function getVersion() {
return $this->version;
}
/**
* Get plugin name
*
* @return string
*/
public function getName() {
return $this->name;
}
/**
* Get plugin description
*
* @return string
*/
public function getDescription() {
return $this->description;
}
} }
?> ?>

View File

@ -32,10 +32,11 @@ class ChatlogPlugin extends Plugin implements CallbackListener {
public function __construct(ManiaControl $maniaControl) { public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
$this->name = 'Chatlog Plugin'; // Plugin details
$this->version = self::VERSION; self::$name = 'Chatlog Plugin';
$this->author = 'steeffeen'; self::$version = self::VERSION;
$this->description = 'Plugin logging the chat messages of the server.'; self::$author = 'steeffeen';
self::$description = 'Plugin logging the chat messages of the server.';
// Init settings // Init settings
$this->maniaControl->settingManager->initSetting($this, self::SETTING_FOLDERNAME, 'logs'); $this->maniaControl->settingManager->initSetting($this, self::SETTING_FOLDERNAME, 'logs');

View File

@ -32,14 +32,18 @@ class DonationPlugin extends Plugin implements CallbackListener, CommandListener
public function __construct(ManiaControl $maniaControl) { public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
$this->author = 'steeffeen'; // Plugin details
$this->name = 'Donation Plugin'; self::$author = 'steeffeen';
$this->version = self::VERSION; self::$name = 'Donation Plugin';
$this->description = 'DonationPlugin commands like /donate, /pay and /getplanets and a donation widget.'; self::$version = self::VERSION;
self::$description = 'DonationPlugin commands like /donate, /pay and /getplanets and a donation widget.';
// Register for commands
$this->maniaControl->commandManager->registerCommandListener('donate', $this, 'command_Donate'); $this->maniaControl->commandManager->registerCommandListener('donate', $this, 'command_Donate');
$this->maniaControl->commandManager->registerCommandListener('/pay', $this, 'command_Pay'); $this->maniaControl->commandManager->registerCommandListener('/pay', $this, 'command_Pay');
$this->maniaControl->commandManager->registerCommandListener('/getplanets', $this, 'command_GetPlanets'); $this->maniaControl->commandManager->registerCommandListener('/getplanets', $this, 'command_GetPlanets');
// Register for callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_BILLUPDATED, $this, 'handleBillUpdated'); $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_BILLUPDATED, $this, 'handleBillUpdated');
} }

View File

@ -31,10 +31,10 @@ class EndurancePlugin extends Plugin implements CallbackListener {
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
// Plugin information // Plugin information
$this->name = 'Endurance Plugin'; self::$name = 'Endurance Plugin';
$this->version = self::VERSION; self::$version = self::VERSION;
$this->author = 'steeffeen'; self::$author = 'steeffeen';
$this->description = "Plugin enabling Support for the TM Game Mode 'Endurance' by TGYoshi."; self::$description = "Plugin enabling Support for the TM Game Mode 'Endurance' by TGYoshi.";
// Register for callbacks // Register for callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'callback_OnInit'); $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'callback_OnInit');

View File

@ -47,10 +47,11 @@ class KarmaPlugin extends Plugin implements CallbackListener {
public function __construct(ManiaControl $maniaControl) { public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
$this->name = 'Karma Plugin'; // Plugin details
$this->author = 'steeffeen'; self::$name = 'Karma Plugin';
$this->version = self::VERSION; self::$author = 'steeffeen';
$this->description = 'Plugin offering Karma Voting for Maps.'; self::$version = self::VERSION;
self::$description = 'Plugin offering Karma Voting for Maps.';
// Init database // Init database
$this->initTables(); $this->initTables();

View File

@ -29,10 +29,10 @@ class ObstaclePlugin extends Plugin implements CallbackListener, CommandListener
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
// Plugin details // Plugin details
$this->name = 'Obstacle Plugin'; self::$name = 'Obstacle Plugin';
$this->version = self::VERSION; self::$version = self::VERSION;
$this->author = 'steeffeen'; self::$author = 'steeffeen';
$this->description = 'Plugin offering various Commands for the ShootMania Obstacle Game Mode.'; self::$description = 'Plugin offering various Commands for the ShootMania Obstacle Game Mode.';
// Init settings // Init settings
$this->maniaControl->settingManager->initSetting($this, self::SETTING_JUMPTOAUTHLEVEL, $this->maniaControl->settingManager->initSetting($this, self::SETTING_JUMPTOAUTHLEVEL,