From ae25baabf36dcf09d00b0d7a10e7c86f428b5e83 Mon Sep 17 00:00:00 2001 From: beu Date: Sun, 24 Apr 2022 10:10:20 +0200 Subject: [PATCH] Add callback when message is sent by Maniacontrol --- core/Chat.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/Chat.php b/core/Chat.php index edf3bbdc..ee06ae9e 100644 --- a/core/Chat.php +++ b/core/Chat.php @@ -40,6 +40,8 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA const SETTING_PRIVATE_PREFIX = 'Private Messages Prefix'; const CHAT_BUFFER_SIZE = 200; + const CB_SERVERCHAT = "Chat.ServerChat"; + /* * Private properties */ @@ -251,12 +253,14 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA $login = Player::parseLogin($login); } try { + $this->maniaControl->getCallbackManager()->triggerCallback(self::CB_SERVERCHAT, [$chatMessage, $login]); return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, $login, $multiCall); } catch (UnknownPlayerException $e) { return false; } } + $this->maniaControl->getCallbackManager()->triggerCallback(self::CB_SERVERCHAT, [$chatMessage, null]); return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, null, $multiCall); }