diff --git a/files/lib/system/event/listener/JCoinsTeamspeak3AddListener.class.php b/files/lib/system/event/listener/JCoinsTeamspeak3AddListener.class.php index d2060d4..09158c4 100644 --- a/files/lib/system/event/listener/JCoinsTeamspeak3AddListener.class.php +++ b/files/lib/system/event/listener/JCoinsTeamspeak3AddListener.class.php @@ -1,24 +1,34 @@ userID) return; - - if ($eventObj->getActionName() == 'create') { - $paramas = $eventObj->getParameters(); - - UserJCoinsStatementHandler::getInstance()->create('de.wcflabs.jcoins.statement.teamspeak3.start', null, [ - 'userID' => $paramas['data']['userID'] - ]); - } else if ($eventObj->getActionName() == 'delete') { - foreach ($eventObj->getObjects() as $object) { - UserJCoinsStatementHandler::getInstance()->revoke('de.wcflabs.jcoins.statement.teamspeak3.start', $object->getDecoratedObject(), [ - 'userID' => $object->userID - ]); - } - } - } -} \ No newline at end of file +class JCoinsTeamspeak3AddListener implements IParameterizedEventListener +{ + public function execute($eventObj, $className, $eventName, array &$parameters) + { + if (!MODULE_JCOINS || !WCF::getUser()->userID) { + return; + } + + if ($eventObj->getActionName() == 'create') { + $paramas = $eventObj->getParameters(); + + UserJCoinsStatementHandler::getInstance()->create('de.wcflabs.jcoins.statement.teamspeak3.start', null, [ + 'userID' => $paramas['data']['userID'], + ]); + } elseif ($eventObj->getActionName() == 'delete') { + foreach ($eventObj->getObjects() as $object) { + UserJCoinsStatementHandler::getInstance()->revoke( + 'de.wcflabs.jcoins.statement.teamspeak3.start', + $object->getDecoratedObject(), + [ + 'userID' => $object->userID, + ] + ); + } + } + } +}