1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2025-01-10 00:30:09 +00:00

Fixing didInit event a bit

This commit is contained in:
Tim Düsterhus 2012-03-24 22:29:07 +01:00
parent e2d02dec15
commit 4c05e38d1e
6 changed files with 24 additions and 4 deletions

View File

@ -18,6 +18,9 @@ abstract class AbstractCommand implements ICommand {
public function __construct(CommandHandler $commandHandler) {
EventHandler::getInstance()->fireAction($this, 'shouldInit');
$this->commandHandler = $commandHandler;
}
public function didInit() {
EventHandler::getInstance()->fireAction($this, 'didInit');
}

View File

@ -18,6 +18,7 @@ public function __construct(\wcf\system\chat\commands\CommandHandler $commandHan
parent::__construct($commandHandler);
\wcf\util\ChatUtil::writeUserData(array('away' => $commandHandler->getParameters()));
$this->didInit();
}
/**

View File

@ -58,6 +58,7 @@ public function __construct(\wcf\system\chat\commands\CommandHandler $commandHan
}
}
\wcf\util\ChatUtil::writeUserData(array('color' => $color));
$this->didInit();
}
/**

View File

@ -13,13 +13,20 @@
class Free extends Me {
public $enableSmilies = \wcf\system\chat\commands\ICommand::SMILEY_OFF;
public function __construct(\wcf\system\chat\commands\CommandHandler $commandHandler) {
parent::__construct($commandHandler);
if (\wcf\util\StringUtil::toLowerCase($this->commandHandler->getParameters()) != 'the fish') {
throw new \wcf\system\chat\commands\NotFoundException();
}
$this->didInit();
}
/**
* @see \wcf\system\chat\commands\ICommand::getMessage()
*/
public function getMessage() {
if (\wcf\util\StringUtil::toLowerCase($this->commandHandler->getParameters()) == 'the fish')
return 'freed the fish. OH A NOEZ';
else
throw new \wcf\system\chat\commands\NotFoundException();
return 'freed the fish. OH A NOEZ';
}
}

View File

@ -33,6 +33,8 @@ public function __construct(\wcf\system\chat\commands\CommandHandler $commandHan
if ($room->roomID && $room->canEnter()) {
$this->lines[WCF::getLanguage()->get('wcf.chat.room')] = $room->getTitle();
}
$this->didInit();
}
/**

View File

@ -14,6 +14,12 @@
class Me extends \wcf\system\chat\commands\AbstractCommand {
public $enableSmilies = \wcf\system\chat\commands\ICommand::SMILEY_USER;
public function __construct(\wcf\system\chat\commands\CommandHandler $commandHandler) {
parent::__construct($commandHandler);
$this->didInit();
}
/**
* @see \wcf\system\chat\commands\ICommand::getType()
*/