diff --git a/file/lib/system/chat/commands/AbstractCommand.class.php b/file/lib/system/chat/commands/AbstractCommand.class.php index 18d0b61..b5e0427 100644 --- a/file/lib/system/chat/commands/AbstractCommand.class.php +++ b/file/lib/system/chat/commands/AbstractCommand.class.php @@ -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'); } diff --git a/file/lib/system/chat/commands/commands/Away.class.php b/file/lib/system/chat/commands/commands/Away.class.php index 775bc3a..f9c994d 100644 --- a/file/lib/system/chat/commands/commands/Away.class.php +++ b/file/lib/system/chat/commands/commands/Away.class.php @@ -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(); } /** diff --git a/file/lib/system/chat/commands/commands/Color.class.php b/file/lib/system/chat/commands/commands/Color.class.php index b79ce01..5514276 100644 --- a/file/lib/system/chat/commands/commands/Color.class.php +++ b/file/lib/system/chat/commands/commands/Color.class.php @@ -58,6 +58,7 @@ public function __construct(\wcf\system\chat\commands\CommandHandler $commandHan } } \wcf\util\ChatUtil::writeUserData(array('color' => $color)); + $this->didInit(); } /** diff --git a/file/lib/system/chat/commands/commands/Free.class.php b/file/lib/system/chat/commands/commands/Free.class.php index 2ffdfd8..a640a2f 100644 --- a/file/lib/system/chat/commands/commands/Free.class.php +++ b/file/lib/system/chat/commands/commands/Free.class.php @@ -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'; } } diff --git a/file/lib/system/chat/commands/commands/Info.class.php b/file/lib/system/chat/commands/commands/Info.class.php index cdd670c..09143a9 100644 --- a/file/lib/system/chat/commands/commands/Info.class.php +++ b/file/lib/system/chat/commands/commands/Info.class.php @@ -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(); } /** diff --git a/file/lib/system/chat/commands/commands/Me.class.php b/file/lib/system/chat/commands/commands/Me.class.php index dbe734e..64bcdff 100644 --- a/file/lib/system/chat/commands/commands/Me.class.php +++ b/file/lib/system/chat/commands/commands/Me.class.php @@ -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() */