fixed plugin unload method

This commit is contained in:
Steffen Schröder 2013-12-31 15:08:51 +01:00
parent fe3ca728bc
commit 07818a4ba9

View File

@ -19,13 +19,15 @@ class ChatMessagePlugin implements CommandListener, Plugin {
const PLUGIN_VERSION = 0.1;
const PLUGIN_NAME = 'ChatMessagePlugin';
const PLUGIN_AUTHOR = 'kremsy';
const SETTING_AFK_FORCE_SPEC = 'AFK command forces spec';
/**
* Private properties
*/
/** @var maniaControl $maniaControl */
/**
*
* @var maniaControl $maniaControl
*/
private $maniaControl = null;
/**
@ -66,13 +68,13 @@ class ChatMessagePlugin implements CommandListener, Plugin {
* Unload the plugin and its resources
*/
public function unload() {
$this->maniaControl->callbackManager->unregisterCallbackListener($this);
$this->maniaControl->commandManager->unregisterCommandListener($this);
unset($this->maniaControl);
}
/**
* Builds a chat message starting with the player's nickname, can used to express emotions
*
* @param array $chat
* @param Player $player
*/
@ -85,16 +87,17 @@ class ChatMessagePlugin implements CommandListener, Plugin {
/**
* Hello Message
*
* @param array $chat
* @param Player $player
*/
public function chat_hi(array $chat, Player $player) {
$command = explode(" ", $chat[1][2]);
if (isset($command[1])) {
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iHello $z$<' . $this->getTarget($command[1]) . '$>$i!';
}else{
}
else {
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iHello All!';
}
// TODO why not italic?
@ -103,6 +106,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
/**
* Bye Message
*
* @param array $chat
* @param Player $player
*/
@ -111,16 +115,17 @@ class ChatMessagePlugin implements CommandListener, Plugin {
if (isset($command[1])) {
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iBye $z$<' . $this->getTarget($command[1]) . '$>$i!';
}else{
}
else {
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iI have to go... Bye All!';
}
$this->maniaControl->chat->sendChat($msg, null, false);
}
/**
* Thx Message
*
* @param array $chat
* @param Player $player
*/
@ -129,7 +134,8 @@ class ChatMessagePlugin implements CommandListener, Plugin {
if (isset($command[1])) {
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iThanks $z$<' . $this->getTarget($command[1]) . '$>$i!';
}else{
}
else {
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iThanks All!';
}
@ -138,6 +144,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
/**
* Good Game Message
*
* @param array $chat
* @param Player $player
*/
@ -146,7 +153,8 @@ class ChatMessagePlugin implements CommandListener, Plugin {
if (isset($command[1])) {
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iGood Game $z$<' . $this->getTarget($command[1]) . '$>$i!';
}else{
}
else {
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iGood Game All!';
}
@ -155,6 +163,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
/**
* Good Luck Message
*
* @param array $chat
* @param Player $player
*/
@ -163,7 +172,8 @@ class ChatMessagePlugin implements CommandListener, Plugin {
if (isset($command[1])) {
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iGood Luck $z$<' . $this->getTarget($command[1]) . '$>$i!';
}else{
}
else {
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iGood Luck All!';
}
@ -172,6 +182,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
/**
* Have Fun Message
*
* @param array $chat
* @param Player $player
*/
@ -180,7 +191,8 @@ class ChatMessagePlugin implements CommandListener, Plugin {
if (isset($command[1])) {
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iHave Fun $z$<' . $this->getTarget($command[1]) . '$>$i!';
}else{
}
else {
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iHave Fun All!';
}
@ -189,6 +201,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
/**
* Good Luck and Have Fun Message
*
* @param array $chat
* @param Player $player
*/
@ -197,7 +210,8 @@ class ChatMessagePlugin implements CommandListener, Plugin {
if (isset($command[1])) {
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iGood Luck and Have Fun $z$<' . $this->getTarget($command[1]) . '$>$i!';
}else{
}
else {
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iGood Luck and Have Fun All!';
}
@ -206,6 +220,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
/**
* Nice Shot Message
*
* @param array $chat
* @param Player $player
*/
@ -214,7 +229,8 @@ class ChatMessagePlugin implements CommandListener, Plugin {
if (isset($command[1])) {
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iNice Shot $z$<' . $this->getTarget($command[1]) . '$>$i!';
}else{
}
else {
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iNice Shot!';
}
@ -223,6 +239,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
/**
* Nice one Message
*
* @param array $chat
* @param Player $player
*/
@ -231,7 +248,8 @@ class ChatMessagePlugin implements CommandListener, Plugin {
if (isset($command[1])) {
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iNice One $z$<' . $this->getTarget($command[1]) . '$>$i!';
}else{
}
else {
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iNice One!';
}
@ -240,6 +258,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
/**
* Lol! Message
*
* @param array $chat
* @param Player $player
*/
@ -250,6 +269,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
/**
* LooOOooL! Message
*
* @param array $chat
* @param Player $player
*/
@ -260,6 +280,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
/**
* Be right back Message
*
* @param array $chat
* @param Player $player
*/
@ -270,6 +291,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
/**
* Bad game for me Message
*
* @param array $chat
* @param Player $player
*/
@ -280,6 +302,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
/**
* Leave the server with an Bootme Message
*
* @param array $chat
* @param Player $player
*/
@ -297,6 +320,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
/**
* Leave the server with an Ragequit
*
* @param array $chat
* @param Player $player
*/
@ -312,9 +336,9 @@ class ChatMessagePlugin implements CommandListener, Plugin {
}
}
/**
* Afk Message and force player to spec
*
* @param array $chat
* @param Player $player
*/
@ -336,7 +360,9 @@ class ChatMessagePlugin implements CommandListener, Plugin {
}
/**
* Checks if a Player is in the PlayerList and returns the nickname if he is, can be called per login, pid or nickname or lj for (last joined)
* Checks if a Player is in the PlayerList and returns the nickname if he is, can be called per login, pid or nickname or lj for
* (last joined)
*
* @param $login
* @return mixed
*/
@ -350,8 +376,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
$pid++;
}
if($login == 'lj')
return $player->nickname;
if ($login == 'lj') return $player->nickname;
return $login;
}
@ -400,5 +425,4 @@ class ChatMessagePlugin implements CommandListener, Plugin {
public static function getDescription() {
return null;
}
}