summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r--src/ClientHandle.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index d414c3178..c0ddd1770 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -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,34 @@ void cClientHandle::HandleCommandBlockMessage(const char * a_Data, size_t a_Leng
+void cClientHandle::HandleAnvilItemName(const char * a_Data, unsigned int a_Length)
+{
+ if (a_Length < 1)
+ {
+ return;
+ }
+
+ if ((m_Player->GetWindow() == NULL) || (m_Player->GetWindow()->GetWindowType() != cWindow::wtAnvil))
+ {
+ return;
+ }
+
+ cByteBuffer Buffer(a_Length);
+ Buffer.Write(a_Data, a_Length);
+
+ AString Name;
+ Buffer.ReadAll(Name);
+
+ if (Name.length() <= 30)
+ {
+ ((cAnvilWindow&)*m_Player->GetWindow()).SetRepairedItemName(Name);
+ }
+}
+
+
+
+
+
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",