summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-09-17 11:07:42 +0200
committermadmaxoft <github@xoft.cz>2014-09-17 11:07:42 +0200
commit82317709f8645642069c1ddf3428a0341302fcd4 (patch)
tree01ad749dbee855238a9083617241afaa7d935462
parentInitial BungeeCord support. (diff)
downloadcuberite-82317709f8645642069c1ddf3428a0341302fcd4.tar
cuberite-82317709f8645642069c1ddf3428a0341302fcd4.tar.gz
cuberite-82317709f8645642069c1ddf3428a0341302fcd4.tar.bz2
cuberite-82317709f8645642069c1ddf3428a0341302fcd4.tar.lz
cuberite-82317709f8645642069c1ddf3428a0341302fcd4.tar.xz
cuberite-82317709f8645642069c1ddf3428a0341302fcd4.tar.zst
cuberite-82317709f8645642069c1ddf3428a0341302fcd4.zip
-rw-r--r--src/ClientHandle.h14
-rw-r--r--src/Protocol/Protocol17x.cpp4
2 files changed, 17 insertions, 1 deletions
diff --git a/src/ClientHandle.h b/src/ClientHandle.h
index 74e89deee..3d0995636 100644
--- a/src/ClientHandle.h
+++ b/src/ClientHandle.h
@@ -64,15 +64,27 @@ public:
const AString & GetIPString(void) const { return m_IPString; } // tolua_export
+ /** Sets the IP string that the client is using. Overrides the IP string that was read from the socket.
+ Used mainly by BungeeCord compatibility code. */
+ void SetIPString(const AString & a_IPString) { m_IPString = a_IPString; }
+
cPlayer * GetPlayer(void) { return m_Player; } // tolua_export
/** Returns the player's UUID, as used by the protocol, in the short form (no dashes) */
const AString & GetUUID(void) const { return m_UUID; } // tolua_export
- void SetUUID(const AString & a_UUID) { m_UUID = a_UUID; }
+ /** Sets the player's UUID, as used by the protocol. Short UUID form (no dashes) is expected.
+ Used mainly by BungeeCord compatibility code - when authenticating is done on the BungeeCord server
+ and the results are passed to MCS running in offline mode. */
+ void SetUUID(const AString & a_UUID) { ASSERT(a_UUID.size() == 32); m_UUID = a_UUID; }
const Json::Value & GetProperties(void) const { return m_Properties; }
+ /** Sets the player's properties, such as skin image and signature.
+ Used mainly by BungeeCord compatibility code - property querying is done on the BungeeCord server
+ and the results are passed to MCS running in offline mode. */
+ void SetProperties(const Json::Value & a_Properties) { m_Properties = a_Properties; }
+
/** Generates an UUID based on the username stored for this client, and stores it in the m_UUID member.
This is used for the offline (non-auth) mode, when there's no UUID source.
Each username generates a unique and constant UUID, so that when the player reconnects with the same name, their UUID is the same.
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index 9ebb6b4b0..4f71b53b0 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -106,7 +106,11 @@ cProtocol172::cProtocol172(cClientHandle * a_Client, const AString & a_ServerAdd
AStringVector Params;
if (SplitZeroTerminatedStrings(a_ServerAddress, Params) && (Params.size() == 4))
{
+ LOGD("Player at %s connected via BungeeCord", Params[1].c_str());
m_ServerAddress = Params[0];
+ m_Client->SetIPString(Params[1]);
+ m_Client->SetUUID(cMojangAPI::MakeUUIDShort(Params[2]));
+ m_Client->SetProperties(Params[3]);
}
// Create the comm log file, if so requested: