summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r--src/ClientHandle.cpp40
1 files changed, 17 insertions, 23 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 16cfe1aec..efa734b44 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -30,7 +30,7 @@
#include "CompositeChat.h"
#include "Items/ItemSword.h"
-#include "md5/md5.h"
+#include "polarssl/md5.h"
@@ -239,18 +239,16 @@ AString cClientHandle::GenerateOfflineUUID(const AString & a_Username)
// xxxxxxxx-xxxx-3xxx-yxxx-xxxxxxxxxxxx where x is any hexadecimal digit and y is one of 8, 9, A, or B
// Generate an md5 checksum, and use it as base for the ID:
- MD5 Checksum(a_Username);
- AString UUID = Checksum.hexdigest();
- UUID[12] = '3'; // Version 3 UUID
- UUID[16] = '8'; // Variant 1 UUID
-
- // Now the digest doesn't have the UUID slashes, but the client requires them, so add them into the appropriate positions:
- UUID.insert(8, "-");
- UUID.insert(13, "-");
- UUID.insert(18, "-");
- UUID.insert(23, "-");
-
- return UUID;
+ unsigned char MD5[16];
+ md5((const unsigned char *)a_Username.c_str(), a_Username.length(), MD5);
+ MD5[6] &= 0x0f; // Need to trim to 4 bits only...
+ MD5[8] &= 0x0f; // ... otherwise %01x overflows into two chars
+ return Printf("%02x%02x%02x%02x-%02x%02x-3%01x%02x-8%01x%02x-%02x%02x%02x%02x%02x%02x",
+ MD5[0], MD5[1], MD5[2], MD5[3],
+ MD5[4], MD5[5], MD5[6], MD5[7],
+ MD5[8], MD5[9], MD5[10], MD5[11],
+ MD5[12], MD5[13], MD5[14], MD5[15]
+ );
}
@@ -365,6 +363,9 @@ void cClientHandle::Authenticate(const AString & a_Name, const AString & a_UUID)
// Send scoreboard data
World->GetScoreBoard().SendTo(*this);
+ // Send statistics
+ SendStatistics(m_Player->GetStatManager());
+
// Delay the first ping until the client "settles down"
// This should fix #889, "BadCast exception, cannot convert bit to fm" error in client
cTimer t1;
@@ -1085,12 +1086,7 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo
void cClientHandle::FinishDigAnimation()
{
- if (
- !m_HasStartedDigging || // Hasn't received the DIG_STARTED packet
- (m_LastDigBlockX == -1) ||
- (m_LastDigBlockY == -1) ||
- (m_LastDigBlockZ == -1)
- )
+ if (!m_HasStartedDigging) // Hasn't received the DIG_STARTED packet
{
return;
}
@@ -1227,9 +1223,7 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, e
{
// A plugin won't let us eat, abort (send the proper packets to the client, too):
m_Player->AbortEating();
- return;
}
- return;
}
else
{
@@ -2401,9 +2395,9 @@ void cClientHandle::SendRemoveEntityEffect(const cEntity & a_Entity, int a_Effec
-void cClientHandle::SendRespawn(const cWorld & a_World)
+void cClientHandle::SendRespawn(const cWorld & a_World, bool a_ShouldIgnoreDimensionChecks)
{
- m_Protocol->SendRespawn(a_World);
+ m_Protocol->SendRespawn(a_World, a_ShouldIgnoreDimensionChecks);
}