1
0

Add MC|ItemName plugin message.

This commit is contained in:
Howaner
2014-05-01 01:25:04 +02:00
parent 3c102870f6
commit 6ac332cd06
6 changed files with 51 additions and 8 deletions

View File

@@ -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",