summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-05-01 01:25:04 +0200
committerHowaner <franzi.moos@googlemail.com>2014-05-05 17:34:24 +0200
commit6ac332cd0662f49e30f60ae0b5a3b7f85df8cfb3 (patch)
tree06e89343c2e64b757b47862f4eb2e5f4bf37dde9 /src/ClientHandle.cpp
parentAdd anvil window and slot area. (diff)
downloadcuberite-6ac332cd0662f49e30f60ae0b5a3b7f85df8cfb3.tar
cuberite-6ac332cd0662f49e30f60ae0b5a3b7f85df8cfb3.tar.gz
cuberite-6ac332cd0662f49e30f60ae0b5a3b7f85df8cfb3.tar.bz2
cuberite-6ac332cd0662f49e30f60ae0b5a3b7f85df8cfb3.tar.lz
cuberite-6ac332cd0662f49e30f60ae0b5a3b7f85df8cfb3.tar.xz
cuberite-6ac332cd0662f49e30f60ae0b5a3b7f85df8cfb3.tar.zst
cuberite-6ac332cd0662f49e30f60ae0b5a3b7f85df8cfb3.zip
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",