Server internally uses new functions
This commit is contained in:
parent
3450f0ca42
commit
aa8b46e947
@ -248,7 +248,7 @@ bool cPluginManager::CallHookChat(cPlayer * a_Player, AString & a_Message)
|
|||||||
{
|
{
|
||||||
AStringVector Split(StringSplit(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
|
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());
|
LOGINFO("Player %s issued an unknown command: \"%s\"", a_Player->GetName().c_str(), a_Message.c_str());
|
||||||
return true; // Cancel sending
|
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->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());
|
LOGINFO("Player %s tried to execute forbidden command: \"%s\"", a_Player->GetName().c_str(), Split[0].c_str());
|
||||||
a_WasCommandForbidden = true;
|
a_WasCommandForbidden = true;
|
||||||
return false;
|
return false;
|
||||||
|
@ -78,7 +78,7 @@ void cBlockBedHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
a_Player->SendMessage("You can only sleep at night");
|
a_Player->SendMessageFailure("You can only sleep at night");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,9 +225,7 @@ void cClientHandle::Authenticate(void)
|
|||||||
|
|
||||||
if (!cRoot::Get()->GetPluginManager()->CallHookPlayerJoined(*m_Player))
|
if (!cRoot::Get()->GetPluginManager()->CallHookPlayerJoined(*m_Player))
|
||||||
{
|
{
|
||||||
AString JoinMessage;
|
cRoot::Get()->BroadcastChatJoin(Printf("%s has joined the game", GetUsername().c_str()));
|
||||||
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);
|
|
||||||
LOGINFO("Player %s has joined the game.", m_Username.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)
|
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.");
|
LOGD("Malformed MC|AdvCdm packet.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -598,7 +596,7 @@ void cClientHandle::HandleCommandBlockMessage(const char* a_Data, unsigned int a
|
|||||||
|
|
||||||
default:
|
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.");
|
LOGD("Unhandled MC|AdvCdm packet mode.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -609,12 +607,12 @@ void cClientHandle::HandleCommandBlockMessage(const char* a_Data, unsigned int a
|
|||||||
if (World->AreCommandBlocksEnabled())
|
if (World->AreCommandBlocksEnabled())
|
||||||
{
|
{
|
||||||
World->SetCommandBlockCommand(BlockX, BlockY, BlockZ, Command);
|
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
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,9 +132,7 @@ cPlayer::~cPlayer(void)
|
|||||||
{
|
{
|
||||||
if (!cRoot::Get()->GetPluginManager()->CallHookPlayerDestroyed(*this))
|
if (!cRoot::Get()->GetPluginManager()->CallHookPlayerDestroyed(*this))
|
||||||
{
|
{
|
||||||
AString DisconnectMessage;
|
cRoot::Get()->BroadcastChatLeave(Printf("%s has left the game", GetName().c_str()));
|
||||||
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);
|
|
||||||
LOGINFO("Player %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)
|
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())
|
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
|
else
|
||||||
{
|
{
|
||||||
AString KillerClass = a_Killer->GetClass();
|
AString KillerClass = a_Killer->GetClass();
|
||||||
KillerClass.erase(KillerClass.begin()); // Erase the 'c' of the class (e.g. "cWitch" -> "Witch")
|
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
|
class cIncrementCounterCB
|
||||||
|
Loading…
Reference in New Issue
Block a user