Add callback when message is sent by Maniacontrol

This commit is contained in:
Beu 2022-04-24 10:10:20 +02:00
parent 0efa58f298
commit ae25baabf3

View File

@ -40,6 +40,8 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA
const SETTING_PRIVATE_PREFIX = 'Private Messages Prefix'; const SETTING_PRIVATE_PREFIX = 'Private Messages Prefix';
const CHAT_BUFFER_SIZE = 200; const CHAT_BUFFER_SIZE = 200;
const CB_SERVERCHAT = "Chat.ServerChat";
/* /*
* Private properties * Private properties
*/ */
@ -251,12 +253,14 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA
$login = Player::parseLogin($login); $login = Player::parseLogin($login);
} }
try { try {
$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_SERVERCHAT, [$chatMessage, $login]);
return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, $login, $multiCall); return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, $login, $multiCall);
} catch (UnknownPlayerException $e) { } catch (UnknownPlayerException $e) {
return false; return false;
} }
} }
$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_SERVERCHAT, [$chatMessage, null]);
return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, null, $multiCall); return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, null, $multiCall);
} }