Reorder Functions by Name
This commit is contained in:
parent
f91d93ba2a
commit
1071c46b5b
324
core/Chat.php
324
core/Chat.php
@ -67,51 +67,6 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an information message to the given login
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $login
|
||||
* @param string|bool $prefix
|
||||
* @param bool $multiCall
|
||||
* @return bool
|
||||
*/
|
||||
public function sendInformation($message, $login = null, $prefix = true, $multiCall = true) {
|
||||
$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_INFORMATION);
|
||||
return $this->sendChat($format . $message, $login, $prefix, $multiCall);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a chat message to the given login
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $login
|
||||
* @param string|bool $prefix
|
||||
* @param bool $multiCall
|
||||
* @return bool
|
||||
*/
|
||||
public function sendChat($message, $login = null, $prefix = true, $multiCall = true) {
|
||||
if (!$this->maniaControl->getClient()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$prefix = $this->buildPrefix($prefix, $login);
|
||||
$chatMessage = '$<$z$ff0' . $prefix . $message . '$>';
|
||||
|
||||
if ($login) {
|
||||
if (!is_array($login)) {
|
||||
$login = Player::parseLogin($login);
|
||||
}
|
||||
try {
|
||||
return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, $login, $multiCall);
|
||||
} catch (UnknownPlayerException $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, null, $multiCall);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the chat message prefix
|
||||
*
|
||||
@ -134,123 +89,6 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an Error Message to all Connected Admins
|
||||
*
|
||||
* @param string $message
|
||||
* @param int $minLevel
|
||||
* @param bool $prefix
|
||||
*/
|
||||
public function sendErrorToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
|
||||
$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_ERROR);
|
||||
$this->sendMessageToAdmins($format . $message, $minLevel, $prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Message to all connected Admins
|
||||
*
|
||||
* @param string $message
|
||||
* @param int $minLevel
|
||||
* @param bool|string $prefix
|
||||
* @return bool
|
||||
*/
|
||||
public function sendMessageToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
|
||||
$admins = $this->maniaControl->getAuthenticationManager()->getConnectedAdmins($minLevel);
|
||||
return $this->sendChat($message, $admins, $prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a success message to the given login
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $login
|
||||
* @param bool|string $prefix
|
||||
* @return bool
|
||||
*/
|
||||
public function sendSuccess($message, $login = null, $prefix = true) {
|
||||
$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_SUCCESS);
|
||||
return $this->sendChat($format . $message, $login, $prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a Information Message to all connected Admins
|
||||
*
|
||||
* @param string $message
|
||||
* @param int $minLevel
|
||||
* @param bool|string $prefix
|
||||
* @return bool
|
||||
*/
|
||||
public function sendInformationToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
|
||||
$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_INFORMATION);
|
||||
return $this->sendMessageToAdmins($format . $message, $minLevel, $prefix);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sends a Success Message to all connected Admins
|
||||
*
|
||||
* @param string $message
|
||||
* @param int $minLevel
|
||||
* @param bool|string $prefix
|
||||
* @return bool
|
||||
*/
|
||||
public function sendSuccessToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
|
||||
$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_SUCCESS);
|
||||
return $this->sendMessageToAdmins($format . $message, $minLevel, $prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the Exception Information to the Chat
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @param string $login
|
||||
* @return bool
|
||||
*/
|
||||
public function sendException(\Exception $exception, $login = null) {
|
||||
$message = "Exception occurred: '{$exception->getMessage()}' ({$exception->getCode()})";
|
||||
return $this->sendError($message, $login);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an Error Message to the Chat
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $login
|
||||
* @param string|bool $prefix
|
||||
* @return bool
|
||||
*/
|
||||
public function sendError($message, $login = null, $prefix = true) {
|
||||
$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_ERROR);
|
||||
return $this->sendChat($format . $message, $login, $prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Exception Message to all Connected Admins
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @param int $minLevel
|
||||
* @param bool|string $prefix
|
||||
*/
|
||||
public function sendExceptionToAdmins(\Exception $exception, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
|
||||
$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_ERROR);
|
||||
$message = $format . "Exception: '{$exception->getMessage()}' ({$exception->getCode()})";
|
||||
$this->sendMessageToAdmins($message, $minLevel, $prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an usage info message to the given login
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $login
|
||||
* @param string|bool $prefix
|
||||
* @return bool
|
||||
*/
|
||||
public function sendUsageInfo($message, $login = null, $prefix = false) {
|
||||
$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_USAGEINFO);
|
||||
return $this->sendChat($format . $message, $login, $prefix);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handles SendChat Communication Request
|
||||
*
|
||||
@ -318,7 +156,6 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA
|
||||
return new CommunicationAnswer();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Stores the ChatMessage in the Buffer
|
||||
*
|
||||
@ -337,4 +174,165 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA
|
||||
array_shift($this->chatBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a chat message to the given login
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $login
|
||||
* @param string|bool $prefix
|
||||
* @param bool $multiCall
|
||||
* @return bool
|
||||
*/
|
||||
public function sendChat($message, $login = null, $prefix = true, $multiCall = true) {
|
||||
if (!$this->maniaControl->getClient()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$prefix = $this->buildPrefix($prefix, $login);
|
||||
$chatMessage = '$<$z$ff0' . $prefix . $message . '$>';
|
||||
|
||||
if ($login) {
|
||||
if (!is_array($login)) {
|
||||
$login = Player::parseLogin($login);
|
||||
}
|
||||
try {
|
||||
return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, $login, $multiCall);
|
||||
} catch (UnknownPlayerException $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, null, $multiCall);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an Error Message to all Connected Admins
|
||||
*
|
||||
* @param string $message
|
||||
* @param int $minLevel
|
||||
* @param bool $prefix
|
||||
*/
|
||||
public function sendErrorToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
|
||||
$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_ERROR);
|
||||
$this->sendMessageToAdmins($format . $message, $minLevel, $prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an Error Message to the Chat
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $login
|
||||
* @param string|bool $prefix
|
||||
* @return bool
|
||||
*/
|
||||
public function sendError($message, $login = null, $prefix = true) {
|
||||
$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_ERROR);
|
||||
return $this->sendChat($format . $message, $login, $prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the Exception Information to the Chat
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @param string $login
|
||||
* @return bool
|
||||
*/
|
||||
public function sendException(\Exception $exception, $login = null) {
|
||||
$message = "Exception occurred: '{$exception->getMessage()}' ({$exception->getCode()})";
|
||||
return $this->sendError($message, $login);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Exception Message to all Connected Admins
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @param int $minLevel
|
||||
* @param bool|string $prefix
|
||||
*/
|
||||
public function sendExceptionToAdmins(\Exception $exception, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
|
||||
$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_ERROR);
|
||||
$message = $format . "Exception: '{$exception->getMessage()}' ({$exception->getCode()})";
|
||||
$this->sendMessageToAdmins($message, $minLevel, $prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an information message to the given login
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $login
|
||||
* @param string|bool $prefix
|
||||
* @param bool $multiCall
|
||||
* @return bool
|
||||
*/
|
||||
public function sendInformation($message, $login = null, $prefix = true, $multiCall = true) {
|
||||
$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_INFORMATION);
|
||||
return $this->sendChat($format . $message, $login, $prefix, $multiCall);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a Information Message to all connected Admins
|
||||
*
|
||||
* @param string $message
|
||||
* @param int $minLevel
|
||||
* @param bool|string $prefix
|
||||
* @return bool
|
||||
*/
|
||||
public function sendInformationToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
|
||||
$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_INFORMATION);
|
||||
return $this->sendMessageToAdmins($format . $message, $minLevel, $prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Message to all connected Admins
|
||||
*
|
||||
* @param string $message
|
||||
* @param int $minLevel
|
||||
* @param bool|string $prefix
|
||||
* @return bool
|
||||
*/
|
||||
public function sendMessageToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
|
||||
$admins = $this->maniaControl->getAuthenticationManager()->getConnectedAdmins($minLevel);
|
||||
return $this->sendChat($message, $admins, $prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a success message to the given login
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $login
|
||||
* @param bool|string $prefix
|
||||
* @return bool
|
||||
*/
|
||||
public function sendSuccess($message, $login = null, $prefix = true) {
|
||||
$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_SUCCESS);
|
||||
return $this->sendChat($format . $message, $login, $prefix);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sends a Success Message to all connected Admins
|
||||
*
|
||||
* @param string $message
|
||||
* @param int $minLevel
|
||||
* @param bool|string $prefix
|
||||
* @return bool
|
||||
*/
|
||||
public function sendSuccessToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
|
||||
$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_SUCCESS);
|
||||
return $this->sendMessageToAdmins($format . $message, $minLevel, $prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an usage info message to the given login
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $login
|
||||
* @param string|bool $prefix
|
||||
* @return bool
|
||||
*/
|
||||
public function sendUsageInfo($message, $login = null, $prefix = false) {
|
||||
$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_USAGEINFO);
|
||||
return $this->sendChat($format . $message, $login, $prefix);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user