diff options
author | Mattes D <github@xoft.cz> | 2014-05-06 21:46:50 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-05-06 21:46:50 +0200 |
commit | 66c5c81e02dd9350542e1dd65b8e33c2f45a011b (patch) | |
tree | e719f55d50354e881c8ace1ca83516596519abaf /src/ClientHandle.cpp | |
parent | Merge pull request #927 from mc-server/fixes (diff) | |
parent | Rename CanRepairWithItem to CanRepairWithRawMaterial and rename Size() to Count() (diff) | |
download | cuberite-66c5c81e02dd9350542e1dd65b8e33c2f45a011b.tar cuberite-66c5c81e02dd9350542e1dd65b8e33c2f45a011b.tar.gz cuberite-66c5c81e02dd9350542e1dd65b8e33c2f45a011b.tar.bz2 cuberite-66c5c81e02dd9350542e1dd65b8e33c2f45a011b.tar.lz cuberite-66c5c81e02dd9350542e1dd65b8e33c2f45a011b.tar.xz cuberite-66c5c81e02dd9350542e1dd65b8e33c2f45a011b.tar.zst cuberite-66c5c81e02dd9350542e1dd65b8e33c2f45a011b.zip |
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r-- | src/ClientHandle.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index d414c3178..94f031ed6 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,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", |