summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorandrew <xdotftw@gmail.com>2014-01-18 20:27:54 +0100
committerandrew <xdotftw@gmail.com>2014-01-18 20:27:54 +0100
commita037172465932de7d0d7d725c3c8ec5b2fa44029 (patch)
treee59a7444acc471f4cd2e5e834212a2756b97d4ea /src/ClientHandle.cpp
parentMerge branch 'master' of https://github.com/mc-server/MCServer (diff)
downloadcuberite-a037172465932de7d0d7d725c3c8ec5b2fa44029.tar
cuberite-a037172465932de7d0d7d725c3c8ec5b2fa44029.tar.gz
cuberite-a037172465932de7d0d7d725c3c8ec5b2fa44029.tar.bz2
cuberite-a037172465932de7d0d7d725c3c8ec5b2fa44029.tar.lz
cuberite-a037172465932de7d0d7d725c3c8ec5b2fa44029.tar.xz
cuberite-a037172465932de7d0d7d725c3c8ec5b2fa44029.tar.zst
cuberite-a037172465932de7d0d7d725c3c8ec5b2fa44029.zip
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r--src/ClientHandle.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 0a97ba6c8..faf583fbb 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -570,19 +570,26 @@ void cClientHandle::HandleCommandBlockMessage(const char* a_Data, unsigned int a
return;
}
+ cByteBuffer Buffer(a_Length);
+ Buffer.Write(a_Data, a_Length);
+
int BlockX, BlockY, BlockZ;
AString Command;
- switch (a_Data[0])
+ char Mode;
+
+ Buffer.ReadChar(Mode);
+
+ switch (Mode)
{
case 0x00:
{
- BlockX = GetBEInt(a_Data + 1);
- BlockY = GetBEInt(a_Data + 5);
- BlockZ = GetBEInt(a_Data + 9);
+ Buffer.ReadBEInt(BlockX);
+ Buffer.ReadBEInt(BlockY);
+ Buffer.ReadBEInt(BlockZ);
- Command = AString(a_Data + 14, (int)a_Data[13]);
+ Buffer.ReadVarUTF8String(Command);
break;
}