summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Bindings/PluginManager.cpp4
-rw-r--r--src/Blocks/BlockBed.cpp2
-rw-r--r--src/ClientHandle.cpp14
-rw-r--r--src/Entities/Player.cpp10
4 files changed, 13 insertions, 17 deletions
diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp
index a20583550..c6c8c081e 100644
--- a/src/Bindings/PluginManager.cpp
+++ b/src/Bindings/PluginManager.cpp
@@ -248,7 +248,7 @@ bool cPluginManager::CallHookChat(cPlayer * a_Player, AString & a_Message)
{
AStringVector Split(StringSplit(a_Message, " "));
ASSERT(!Split.empty()); // This should not happen - we know there's at least one char in the message so the split needs to be at least one item long
- a_Player->SendMessage(Printf("%s[INFO] %sUnknown command: \"%s\"", cChatColor::Yellow.c_str(), cChatColor::White.c_str(), Split[0].c_str()));
+ a_Player->SendMessageInfo(Printf("Unknown command: \"%s\"", Split[0].c_str()));
LOGINFO("Player %s issued an unknown command: \"%s\"", a_Player->GetName().c_str(), a_Message.c_str());
return true; // Cancel sending
}
@@ -1392,7 +1392,7 @@ bool cPluginManager::HandleCommand(cPlayer * a_Player, const AString & a_Command
!a_Player->HasPermission(cmd->second.m_Permission)
)
{
- a_Player->SendMessage(Printf("%s[INFO] %sForbidden command; insufficient privileges: \"%s\"", cChatColor::Rose.c_str(), cChatColor::White.c_str(), Split[0].c_str()));
+ a_Player->SendMessageFailure(Printf("Forbidden command; insufficient privileges: \"%s\"", Split[0].c_str()));
LOGINFO("Player %s tried to execute forbidden command: \"%s\"", a_Player->GetName().c_str(), Split[0].c_str());
a_WasCommandForbidden = true;
return false;
diff --git a/src/Blocks/BlockBed.cpp b/src/Blocks/BlockBed.cpp
index 65d397b36..8f291ad1f 100644
--- a/src/Blocks/BlockBed.cpp
+++ b/src/Blocks/BlockBed.cpp
@@ -78,7 +78,7 @@ void cBlockBedHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface
}
}
} else {
- a_Player->SendMessage("You can only sleep at night");
+ a_Player->SendMessageFailure("You can only sleep at night");
}
}
}
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 439f980ce..f7c6cb734 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -225,9 +225,7 @@ void cClientHandle::Authenticate(void)
if (!cRoot::Get()->GetPluginManager()->CallHookPlayerJoined(*m_Player))
{
- AString JoinMessage;
- AppendPrintf(JoinMessage, "%s[JOIN] %s%s has joined the game", cChatColor::Yellow.c_str(), cChatColor::White.c_str(), GetUsername().c_str());
- cRoot::Get()->BroadcastChat(JoinMessage);
+ cRoot::Get()->BroadcastChatJoin(Printf("%s has joined the game", GetUsername().c_str()));
LOGINFO("Player %s has joined the game.", m_Username.c_str());
}
@@ -568,7 +566,7 @@ void cClientHandle::HandleCommandBlockMessage(const char* a_Data, unsigned int a
{
if (a_Length < 14)
{
- SendChat(Printf("%s[INFO]%s Failure setting command block command; bad request", cChatColor::Red.c_str(), cChatColor::White.c_str()));
+ SendChat(AppendChatEpithet("Failure setting command block command; bad request", mtFailure));
LOGD("Malformed MC|AdvCdm packet.");
return;
}
@@ -598,7 +596,7 @@ void cClientHandle::HandleCommandBlockMessage(const char* a_Data, unsigned int a
default:
{
- SendChat(Printf("%s[INFO]%s Failure setting command block command; unhandled mode", cChatColor::Red.c_str(), cChatColor::White.c_str()));
+ SendChat(AppendChatEpithet("Failure setting command block command; unhandled mode", mtFailure));
LOGD("Unhandled MC|AdvCdm packet mode.");
return;
}
@@ -609,12 +607,12 @@ void cClientHandle::HandleCommandBlockMessage(const char* a_Data, unsigned int a
if (World->AreCommandBlocksEnabled())
{
World->SetCommandBlockCommand(BlockX, BlockY, BlockZ, Command);
-
- SendChat(Printf("%s[INFO]%s Successfully set command block command", cChatColor::Green.c_str(), cChatColor::White.c_str()));
+
+ SendChat(AppendChatEpithet("Successfully set command block command", mtSuccess));
}
else
{
- SendChat(Printf("%s[INFO]%s Command blocks are not enabled on this server", cChatColor::Yellow.c_str(), cChatColor::White.c_str()));
+ SendChat(AppendChatEpithet("Command blocks are not enabled on this server", mtFailure));
}
}
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index c0466fa66..385e28c28 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -132,9 +132,7 @@ cPlayer::~cPlayer(void)
{
if (!cRoot::Get()->GetPluginManager()->CallHookPlayerDestroyed(*this))
{
- AString DisconnectMessage;
- AppendPrintf(DisconnectMessage, "%s[LEAVE] %s%s has left the game", cChatColor::Yellow.c_str(), cChatColor::White.c_str(), GetName().c_str());
- cRoot::Get()->BroadcastChat(DisconnectMessage);
+ cRoot::Get()->BroadcastChatLeave(Printf("%s has left the game", GetName().c_str()));
LOGINFO("Player %s has left the game.", GetName().c_str());
}
@@ -847,18 +845,18 @@ void cPlayer::KilledBy(cEntity * a_Killer)
if (a_Killer == NULL)
{
- GetWorld()->BroadcastChat(Printf("%s[DEATH] %s%s was killed by environmental damage", cChatColor::Red.c_str(), cChatColor::White.c_str(), GetName().c_str()));
+ GetWorld()->BroadcastChatDeath(Printf("%s was killed by environmental damage", GetName().c_str()));
}
else if (a_Killer->IsPlayer())
{
- GetWorld()->BroadcastChat(Printf("%s[DEATH] %s%s was killed by %s", cChatColor::Red.c_str(), cChatColor::White.c_str(), GetName().c_str(), ((cPlayer *)a_Killer)->GetName().c_str()));
+ GetWorld()->BroadcastChatDeath(Printf("%s was killed by %s", GetName().c_str(), ((cPlayer *)a_Killer)->GetName().c_str()));
}
else
{
AString KillerClass = a_Killer->GetClass();
KillerClass.erase(KillerClass.begin()); // Erase the 'c' of the class (e.g. "cWitch" -> "Witch")
- GetWorld()->BroadcastChat(Printf("%s[DEATH] %s%s was killed by a %s", cChatColor::Red.c_str(), cChatColor::White.c_str(), GetName().c_str(), KillerClass.c_str()));
+ GetWorld()->BroadcastChatDeath(Printf("%s was killed by a %s", GetName().c_str(), KillerClass.c_str()));
}
class cIncrementCounterCB