improved metadata properties of plugin class
This commit is contained in:
		| @@ -10,15 +10,18 @@ use ManiaControl\ManiaControl; | ||||
|  * @author steeffeen & kremsy | ||||
|  */ | ||||
| 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 $name = 'undefined'; | ||||
| 	protected $version = 'undefined'; | ||||
| 	protected $author = 'undefined'; | ||||
| 	protected $description = 'undefined'; | ||||
|  | ||||
| 	/** | ||||
| 	 * Create a new plugin | ||||
| @@ -29,48 +32,12 @@ abstract class Plugin { | ||||
|  | ||||
| 	/** | ||||
| 	 * Get class name as string | ||||
| 	 *  | ||||
| 	 * | ||||
| 	 * @return string | ||||
| 	 */ | ||||
| 	public static function getClass() { | ||||
| 	public static final function getClass() { | ||||
| 		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; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| ?> | ||||
|   | ||||
| @@ -32,10 +32,11 @@ class ChatlogPlugin extends Plugin implements CallbackListener { | ||||
| 	public function __construct(ManiaControl $maniaControl) { | ||||
| 		$this->maniaControl = $maniaControl; | ||||
| 		 | ||||
| 		$this->name = 'Chatlog Plugin'; | ||||
| 		$this->version = self::VERSION; | ||||
| 		$this->author = 'steeffeen'; | ||||
| 		$this->description = 'Plugin logging the chat messages of the server.'; | ||||
| 		// Plugin details | ||||
| 		self::$name = 'Chatlog Plugin'; | ||||
| 		self::$version = self::VERSION; | ||||
| 		self::$author = 'steeffeen'; | ||||
| 		self::$description = 'Plugin logging the chat messages of the server.'; | ||||
| 		 | ||||
| 		// Init settings | ||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_FOLDERNAME, 'logs'); | ||||
|   | ||||
| @@ -32,14 +32,18 @@ class DonationPlugin extends Plugin implements CallbackListener, CommandListener | ||||
| 	public function __construct(ManiaControl $maniaControl) { | ||||
| 		$this->maniaControl = $maniaControl; | ||||
| 		 | ||||
| 		$this->author = 'steeffeen'; | ||||
| 		$this->name = 'Donation Plugin'; | ||||
| 		$this->version = self::VERSION; | ||||
| 		$this->description = 'DonationPlugin commands like /donate, /pay and /getplanets and a donation widget.'; | ||||
| 		// Plugin details | ||||
| 		self::$author = 'steeffeen'; | ||||
| 		self::$name = 'Donation Plugin'; | ||||
| 		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('/pay', $this, 'command_Pay'); | ||||
| 		$this->maniaControl->commandManager->registerCommandListener('/getplanets', $this, 'command_GetPlanets'); | ||||
| 		 | ||||
| 		// Register for callbacks | ||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_BILLUPDATED, $this, 'handleBillUpdated'); | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -31,10 +31,10 @@ class EndurancePlugin extends Plugin implements CallbackListener { | ||||
| 		$this->maniaControl = $maniaControl; | ||||
| 		 | ||||
| 		// Plugin information | ||||
| 		$this->name = 'Endurance Plugin'; | ||||
| 		$this->version = self::VERSION; | ||||
| 		$this->author = 'steeffeen'; | ||||
| 		$this->description = "Plugin enabling Support for the TM Game Mode 'Endurance' by TGYoshi."; | ||||
| 		self::$name = 'Endurance Plugin'; | ||||
| 		self::$version = self::VERSION; | ||||
| 		self::$author = 'steeffeen'; | ||||
| 		self::$description = "Plugin enabling Support for the TM Game Mode 'Endurance' by TGYoshi."; | ||||
| 		 | ||||
| 		// Register for callbacks | ||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'callback_OnInit'); | ||||
|   | ||||
| @@ -47,10 +47,11 @@ class KarmaPlugin extends Plugin implements CallbackListener { | ||||
| 	public function __construct(ManiaControl $maniaControl) { | ||||
| 		$this->maniaControl = $maniaControl; | ||||
| 		 | ||||
| 		$this->name = 'Karma Plugin'; | ||||
| 		$this->author = 'steeffeen'; | ||||
| 		$this->version = self::VERSION; | ||||
| 		$this->description = 'Plugin offering Karma Voting for Maps.'; | ||||
| 		// 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(); | ||||
|   | ||||
| @@ -29,10 +29,10 @@ class ObstaclePlugin extends Plugin implements CallbackListener, CommandListener | ||||
| 		$this->maniaControl = $maniaControl; | ||||
| 		 | ||||
| 		// Plugin details | ||||
| 		$this->name = 'Obstacle Plugin'; | ||||
| 		$this->version = self::VERSION; | ||||
| 		$this->author = 'steeffeen'; | ||||
| 		$this->description = 'Plugin offering various Commands for the ShootMania Obstacle Game Mode.'; | ||||
| 		self::$name = 'Obstacle Plugin'; | ||||
| 		self::$version = self::VERSION; | ||||
| 		self::$author = 'steeffeen'; | ||||
| 		self::$description = 'Plugin offering various Commands for the ShootMania Obstacle Game Mode.'; | ||||
| 		 | ||||
| 		// Init settings | ||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_JUMPTOAUTHLEVEL,  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user