prevent to send admin messages to everyone when no admin is connected

This commit is contained in:
Beu 2023-12-22 18:42:20 +01:00
parent 93423e36af
commit e44dfa0ef2

View File

@ -351,6 +351,7 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA
*/ */
public function sendMessageToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) { public function sendMessageToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
$admins = $this->maniaControl->getAuthenticationManager()->getConnectedAdmins($minLevel); $admins = $this->maniaControl->getAuthenticationManager()->getConnectedAdmins($minLevel);
if (count($admins) === 0) return false;
return $this->sendChat($message, $admins, $prefix); return $this->sendChat($message, $admins, $prefix);
} }