diff options
Diffstat (limited to '')
-rw-r--r-- | src/ClientHandle.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 29213ca2d..94f031ed6 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -202,7 +202,7 @@ AString cClientHandle::FormatMessageType(bool ShouldAppendChatPrefixes, eMessage { switch (a_ChatPrefix) { - case mtCustom: return AString(); + case mtCustom: return ""; case mtFailure: return FormatChatPrefix(ShouldAppendChatPrefixes, "INFO", cChatColor::Rose, cChatColor::White); case mtInformation: return FormatChatPrefix(ShouldAppendChatPrefixes, "INFO", cChatColor::Yellow, cChatColor::White); case mtSuccess: return FormatChatPrefix(ShouldAppendChatPrefixes, "INFO", cChatColor::Green, cChatColor::White); @@ -224,7 +224,7 @@ AString cClientHandle::FormatMessageType(bool ShouldAppendChatPrefixes, eMessage } } ASSERT(!"Unhandled chat prefix type!"); - return AString(); + return ""; } @@ -633,6 +633,10 @@ void cClientHandle::HandlePluginMessage(const AString & a_Channel, const AString // Client <-> Server branding exchange SendPluginMessage("MC|Brand", "MCServer"); } + else if (a_Channel == "MC|ItemName") + { + HandleAnvilItemName(a_Message.c_str(), a_Message.size()); + } else if (a_Channel == "REGISTER") { if (HasPluginChannel(a_Channel)) @@ -774,6 +778,29 @@ void cClientHandle::HandleCommandBlockMessage(const char * a_Data, size_t a_Leng +void cClientHandle::HandleAnvilItemName(const char * a_Data, size_t a_Length) +{ + if (a_Length < 1) + { + return; + } + + if ((m_Player->GetWindow() == NULL) || (m_Player->GetWindow()->GetWindowType() != cWindow::wtAnvil)) + { + return; + } + + AString Name(a_Data, a_Length); + if (Name.length() <= 30) + { + ((cAnvilWindow *)m_Player->GetWindow())->SetRepairedItemName(Name, m_Player); + } +} + + + + + void cClientHandle::HandleLeftClick(int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, char a_Status) { LOGD("HandleLeftClick: {%i, %i, %i}; Face: %i; Stat: %i", |