summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.h
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-12-13 20:10:23 +0100
committerHowaner <franzi.moos@googlemail.com>2014-12-13 20:10:23 +0100
commita595a4a842123f10a4b27ae082794bad0250a307 (patch)
treeb0f50e06e6f7a55a8d5a18cfb37a53234f527236 /src/ClientHandle.h
parentAdded cocoa pod. (diff)
parentMerge pull request #1663 from mc-server/APIDumpSize (diff)
downloadcuberite-a595a4a842123f10a4b27ae082794bad0250a307.tar
cuberite-a595a4a842123f10a4b27ae082794bad0250a307.tar.gz
cuberite-a595a4a842123f10a4b27ae082794bad0250a307.tar.bz2
cuberite-a595a4a842123f10a4b27ae082794bad0250a307.tar.lz
cuberite-a595a4a842123f10a4b27ae082794bad0250a307.tar.xz
cuberite-a595a4a842123f10a4b27ae082794bad0250a307.tar.zst
cuberite-a595a4a842123f10a4b27ae082794bad0250a307.zip
Diffstat (limited to 'src/ClientHandle.h')
-rw-r--r--src/ClientHandle.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/ClientHandle.h b/src/ClientHandle.h
index f195b6be7..25dd250d9 100644
--- a/src/ClientHandle.h
+++ b/src/ClientHandle.h
@@ -215,7 +215,7 @@ public:
const AString & GetUsername(void) const;
void SetUsername( const AString & a_Username);
- inline short GetPing(void) const { return m_Ping; }
+ inline short GetPing(void) const { return static_cast<short>(std::chrono::duration_cast<std::chrono::milliseconds>(m_Ping).count()); }
/** Sets the maximal view distance. */
void SetViewDistance(int a_ViewDistance);
@@ -280,6 +280,10 @@ public:
void HandleEntityLeaveBed (int a_EntityID);
void HandleEntitySprinting (int a_EntityID, bool a_IsSprinting);
+ /** Kicks the client if the same username is already logged in.
+ Returns false if the client has been kicked, true otherwise. */
+ bool CheckMultiLogin(const AString & a_Username);
+
/** Called when the protocol handshake has been received (for protocol versions that support it;
otherwise the first instant when a username is received).
Returns true if the player is to be let in, false if they were disconnected
@@ -378,12 +382,15 @@ private:
/** Seconds since the last packet data was received (updated in Tick(), reset in DataReceived()) */
float m_TimeSinceLastPacket;
- short m_Ping;
- int m_PingID;
- long long m_PingStartTime;
- long long m_LastPingTime;
- static const unsigned short PING_TIME_MS = 1000; // Vanilla sends 1 per 20 ticks (1 second or every 1000 ms)
-
+ /** Duration of the last completed client ping. */
+ std::chrono::steady_clock::duration m_Ping;
+
+ /** ID of the last ping request sent to the client. */
+ int m_PingID;
+
+ /** Time of the last ping request sent to the client. */
+ std::chrono::steady_clock::time_point m_PingStartTime;
+
// Values required for block dig animation
int m_BlockDigAnimStage; // Current stage of the animation; -1 if not digging
int m_BlockDigAnimSpeed; // Current speed of the animation (units ???)