fixed chat prefix for private notifications

This commit is contained in:
kremsy 2017-05-06 15:14:58 +02:00
parent 6078507a46
commit 59d0ebdf9b
2 changed files with 9 additions and 8 deletions

View File

@ -22,11 +22,12 @@ use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
*/ */
class Chat implements CallbackListener, CommunicationListener, UsageInformationAble { class Chat implements CallbackListener, CommunicationListener, UsageInformationAble {
use UsageInformationTrait; use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */
const SETTING_PREFIX = 'Messages Prefix'; const SETTING_PUBLIC_PREFIX = 'Public Messages Prefix';
const SETTING_PRIVATE_PREFIX = 'Privat Messages Prefix';
const SETTING_FORMAT_INFORMATION = 'Information Format'; const SETTING_FORMAT_INFORMATION = 'Information Format';
const SETTING_FORMAT_SUCCESS = 'Success Format'; const SETTING_FORMAT_SUCCESS = 'Success Format';
const SETTING_FORMAT_ERROR = 'Error Format'; const SETTING_FORMAT_ERROR = 'Error Format';
@ -48,7 +49,8 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
// Settings // Settings
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_PREFIX, '» '); $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_PUBLIC_PREFIX, '» ');
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_PRIVATE_PREFIX, '»» ');
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_FORMAT_INFORMATION, '$fff'); $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_SUCCESS, '$0f0');
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_FORMAT_ERROR, '$f30'); $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_FORMAT_ERROR, '$f30');
@ -119,11 +121,10 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA
return $prefixParam; return $prefixParam;
} }
if ($prefixParam === true) { if ($prefixParam === true) {
$prefix = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_PREFIX);
if ($login) { if ($login) {
// Private - Doubled default prefix $prefix = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_PRIVATE_PREFIX);
$prefix .= $prefix; } else {
// TODO: validate whether to use specific private & public prefixes instead of just doubling a default one $prefix = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_PUBLIC_PREFIX);
} }
return $prefix; return $prefix;
} }

View File

@ -52,7 +52,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
/* /*
* Constants * Constants
*/ */
const VERSION = '0.205'; const VERSION = '0.206';
const API_VERSION = '2013-04-16'; const API_VERSION = '2013-04-16';
const MIN_DEDIVERSION = '2017-05-03_21_00'; const MIN_DEDIVERSION = '2017-05-03_21_00';
const SCRIPT_TIMEOUT = 10; const SCRIPT_TIMEOUT = 10;