Changed Plugin Class to Interface! (Final)

-> static methods for Name, Version, Author, Description
This commit is contained in:
Steffen Schröder
2013-12-03 22:21:17 +01:00
parent 35a7232894
commit 6c247f0519
8 changed files with 247 additions and 63 deletions

View File

@ -19,11 +19,11 @@ use FML\Controls\Gauge;
*
* @author steeffeen
*/
class KarmaPlugin extends Plugin implements CallbackListener {
class KarmaPlugin implements CallbackListener, Plugin {
/**
* Constants
*/
const VERSION = '1.0';
const VERSION = 1.0;
const MLID_KARMA = 'KarmaPlugin.MLID';
const TABLE_KARMA = 'mc_karma';
const SETTING_AVAILABLE_VOTES = 'Available Votes (X-Y: Comma separated)';
@ -33,6 +33,14 @@ class KarmaPlugin extends Plugin implements CallbackListener {
const SETTING_WIDGET_WIDTH = 'Widget-Size: Width';
const SETTING_WIDGET_HEIGHT = 'Widget-Size: Height';
/**
* Plugin metadata
*/
public static $name = 'Karma Plugin';
public static $author = 'steeffeen';
public static $version = '1.0';
public static $description = 'Plugin offering Karma Voting for Maps.';
/**
* Private properties
*/
@ -47,12 +55,6 @@ class KarmaPlugin extends Plugin implements CallbackListener {
public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl;
// Plugin details
self::$name = 'Karma Plugin';
self::$author = 'steeffeen';
self::$version = self::VERSION;
self::$description = 'Plugin offering Karma Voting for Maps.';
// Init database
$this->initTables();
@ -73,6 +75,38 @@ class KarmaPlugin extends Plugin implements CallbackListener {
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERCHAT, $this, 'handlePlayerChat');
}
/**
*
* @see \ManiaControl\Plugins\Plugin::getName()
*/
public static function getName() {
return 'Karma Plugin';
}
/**
*
* @see \ManiaControl\Plugins\Plugin::getVersion()
*/
public static function getVersion() {
return self::VERSION;
}
/**
*
* @see \ManiaControl\Plugins\Plugin::getAuthor()
*/
public static function getAuthor() {
return 'steeffeen';
}
/**
*
* @see \ManiaControl\Plugins\Plugin::getDescription()
*/
public static function getDescription() {
return 'Plugin offering Karma Voting for Maps.';
}
/**
* Handle ManiaControl 1 Second callback
*