diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml
index 4299f4ea..32b3d3c1 100644
--- a/.idea/codeStyleSettings.xml
+++ b/.idea/codeStyleSettings.xml
@@ -50,7 +50,6 @@
-
diff --git a/application/core/Chat.php b/application/core/Chat.php
index 9137036b..0b2f3f01 100644
--- a/application/core/Chat.php
+++ b/application/core/Chat.php
@@ -38,16 +38,11 @@ class Chat {
$this->maniaControl = $maniaControl;
// Settings
- $this->maniaControl->getSettingManager()
- ->initSetting($this, self::SETTING_PREFIX, '» ');
- $this->maniaControl->getSettingManager()
- ->initSetting($this, self::SETTING_FORMAT_INFORMATION, '$fff');
- $this->maniaControl->getSettingManager()
- ->initSetting($this, self::SETTING_FORMAT_SUCCESS, '$0f0');
- $this->maniaControl->getSettingManager()
- ->initSetting($this, self::SETTING_FORMAT_ERROR, '$f30');
- $this->maniaControl->getSettingManager()
- ->initSetting($this, self::SETTING_FORMAT_USAGEINFO, '$f80');
+ $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_PREFIX, '» ');
+ $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_FORMAT_INFORMATION, '$fff');
+ $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_FORMAT_SUCCESS, '$0f0');
+ $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_FORMAT_ERROR, '$f30');
+ $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_FORMAT_USAGEINFO, '$f80');
}
/**
@@ -59,8 +54,7 @@ class Chat {
* @return bool
*/
public function sendInformation($message, $login = null, $prefix = true) {
- $format = $this->maniaControl->getSettingManager()
- ->getSettingValue($this, self::SETTING_FORMAT_INFORMATION);
+ $format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_INFORMATION);
return $this->sendChat($format . $message, $login, $prefix);
}
@@ -78,18 +72,23 @@ class Chat {
}
if (!$login) {
- $prefix = $this->getPrefix($prefix);
- $chatMessage = '$<$z$ff0' . str_replace(' ', '', $prefix) . $prefix . $message . '$>';
- $this->maniaControl->getClient()
- ->chatSendServerMessage($chatMessage);
+ if ($prefix === true) {
+ //use double prefix
+ $prefix = $this->getPrefix($prefix);
+ $chatMessage = '$<$z$ff0' . str_replace(' ', '', $prefix) . $prefix . $message . '$>';
+ } else {
+ //don't use double Prefix, when a custom Prefix is set
+ $prefix = $this->getPrefix($prefix);
+ $chatMessage = '$<$z$ff0' . $prefix . $message . '$>';
+ }
+ $this->maniaControl->getClient()->chatSendServerMessage($chatMessage);
} else {
$chatMessage = '$<$z$ff0' . $this->getPrefix($prefix) . $message . '$>';
if (!is_array($login)) {
$login = Player::parseLogin($login);
}
try {
- $this->maniaControl->getClient()
- ->chatSendServerMessage($chatMessage, $login);
+ $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, $login);
} catch (UnknownPlayerException $e) {
}
}
@@ -107,8 +106,7 @@ class Chat {
return $prefix;
}
if ($prefix === true) {
- return $this->maniaControl->getSettingManager()
- ->getSettingValue($this, self::SETTING_PREFIX);
+ return $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_PREFIX);
}
return '';
}
@@ -121,8 +119,7 @@ class Chat {
* @param bool $prefix
*/
public function sendErrorToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
- $format = $this->maniaControl->getSettingManager()
- ->getSettingValue($this, self::SETTING_FORMAT_ERROR);
+ $format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_ERROR);
$this->sendMessageToAdmins($format . $message, $minLevel, $prefix);
}
@@ -135,8 +132,7 @@ class Chat {
* @return bool
*/
public function sendMessageToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
- $admins = $this->maniaControl->getAuthenticationManager()
- ->getConnectedAdmins($minLevel);
+ $admins = $this->maniaControl->getAuthenticationManager()->getConnectedAdmins($minLevel);
return $this->sendChat($message, $admins, $prefix);
}
@@ -149,8 +145,7 @@ class Chat {
* @return bool
*/
public function sendSuccess($message, $login = null, $prefix = true) {
- $format = $this->maniaControl->getSettingManager()
- ->getSettingValue($this, self::SETTING_FORMAT_SUCCESS);
+ $format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_SUCCESS);
return $this->sendChat($format . $message, $login, $prefix);
}
@@ -163,8 +158,7 @@ class Chat {
* @return bool
*/
public function sendSuccessToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
- $format = $this->maniaControl->getSettingManager()
- ->getSettingValue($this, self::SETTING_FORMAT_SUCCESS);
+ $format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_SUCCESS);
return $this->sendMessageToAdmins($format . $message, $minLevel, $prefix);
}
@@ -189,8 +183,7 @@ class Chat {
* @return bool
*/
public function sendError($message, $login = null, $prefix = true) {
- $format = $this->maniaControl->getSettingManager()
- ->getSettingValue($this, self::SETTING_FORMAT_ERROR);
+ $format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_ERROR);
return $this->sendChat($format . $message, $login, $prefix);
}
@@ -203,8 +196,7 @@ class Chat {
*/
public function sendExceptionToAdmins(\Exception $exception, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR,
$prefix = true) {
- $format = $this->maniaControl->getSettingManager()
- ->getSettingValue($this, self::SETTING_FORMAT_ERROR);
+ $format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_ERROR);
$message = $format . "Exception: '{$exception->getMessage()}' ({$exception->getCode()})";
$this->sendMessageToAdmins($message, $minLevel, $prefix);
}
@@ -218,8 +210,7 @@ class Chat {
* @return bool
*/
public function sendUsageInfo($message, $login = null, $prefix = false) {
- $format = $this->maniaControl->getSettingManager()
- ->getSettingValue($this, self::SETTING_FORMAT_USAGEINFO);
+ $format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_USAGEINFO);
return $this->sendChat($format . $message, $login, $prefix);
}
}