summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ClientHandle.h')
-rw-r--r--src/ClientHandle.h45
1 files changed, 39 insertions, 6 deletions
diff --git a/src/ClientHandle.h b/src/ClientHandle.h
index 8366caa16..659c67658 100644
--- a/src/ClientHandle.h
+++ b/src/ClientHandle.h
@@ -18,6 +18,8 @@
#include "ByteBuffer.h"
#include "Scoreboard.h"
#include "Map.h"
+#include "Enchantments.h"
+#include "UI/SlotArea.h"
@@ -37,6 +39,7 @@ class cFallingBlock;
class cItemHandler;
class cWorld;
class cCompositeChat;
+class cStatManager;
@@ -62,8 +65,27 @@ public:
cPlayer* GetPlayer() { return m_Player; } // tolua_export
+ const AString & GetUUID(void) const { return m_UUID; } // tolua_export
+ void SetUUID(const AString & a_UUID) { m_UUID = a_UUID; }
+
+ /** 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.
+ Internally calls the GenerateOfflineUUID static function. */
+ void GenerateOfflineUUID(void);
+
+ /** Generates an UUID based on the player name provided.
+ 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. */
+ static AString GenerateOfflineUUID(const AString & a_Username); // tolua_export
+
+ /** Formats the type of message with the proper color and prefix for sending to the client. **/
+ static AString FormatMessageType(bool ShouldAppendChatPrefixes, eMessageType a_ChatPrefix, const AString & a_AdditionalData);
+
+ static AString FormatChatPrefix(bool ShouldAppendChatPrefixes, AString a_ChatPrefixS, AString m_Color1, AString m_Color2);
+
void Kick(const AString & a_Reason); // tolua_export
- void Authenticate(void); // Called by cAuthenticator when the user passes authentication
+ void Authenticate(const AString & a_Name, const AString & a_UUID); // Called by cAuthenticator when the user passes authentication
void StreamChunks(void);
@@ -139,6 +161,7 @@ public:
void SendSpawnMob (const cMonster & a_Mob);
void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch);
void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType = 0);
+ void SendStatistics (const cStatManager & a_Manager);
void SendTabCompletionResults(const AStringVector & a_Results);
void SendTeleportEntity (const cEntity & a_Entity);
void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ);
@@ -225,16 +248,19 @@ public:
*/
bool HandleLogin(int a_ProtocolVersion, const AString & a_Username);
- void SendData(const char * a_Data, int a_Size);
+ void SendData(const char * a_Data, size_t a_Size);
/** Called when the player moves into a different world; queues sreaming the new chunks */
void MoveToWorld(cWorld & a_World, bool a_SendRespawnPacket);
- /** Handles the block placing packet when it is a real block placement (not block-using, item-using or eating) */
- void HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, cItemHandler & a_ItemHandler);
+ /** Called when the player will enchant a Item */
+ void HandleEnchantItem(Byte & WindowID, Byte & Enchantment);
private:
+ /** Handles the block placing packet when it is a real block placement (not block-using, item-using or eating) */
+ void HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, cItemHandler & a_ItemHandler);
+
/** The type used for storing the names of registered plugin channels. */
typedef std::set<AString> cChannels;
@@ -326,6 +352,7 @@ private:
static int s_ClientCount;
int m_UniqueID;
+ AString m_UUID;
/** Set to true when the chunk where the player is is sent to the client. Used for spawning the player */
bool m_HasSentPlayerChunk;
@@ -349,6 +376,9 @@ private:
/** Handles the DIG_FINISHED dig packet: */
void HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, BLOCKTYPE a_OldBlock, NIBBLETYPE a_OldMeta);
+ /** The clients will receive a finished dig animation */
+ void FinishDigAnimation();
+
/** Converts the protocol-formatted channel list (NUL-separated) into a proper string vector. */
AStringVector BreakApartPluginChannels(const AString & a_PluginChannels);
@@ -359,10 +389,13 @@ private:
void UnregisterPluginChannels(const AStringVector & a_ChannelList);
/** Handles the "MC|AdvCdm" plugin message */
- void HandleCommandBlockMessage(const char * a_Data, unsigned int a_Length);
+ void HandleCommandBlockMessage(const char * a_Data, size_t a_Length);
+
+ /** Handles the "MC|ItemName" plugin message */
+ void HandleAnvilItemName(const char * a_Data, size_t a_Length);
// cSocketThreads::cCallback overrides:
- virtual void DataReceived (const char * a_Data, int a_Size) override; // Data is received from the client
+ virtual bool DataReceived (const char * a_Data, size_t a_Size) override; // Data is received from the client
virtual void GetOutgoingData(AString & a_Data) override; // Data can be sent to client
virtual void SocketClosed (void) override; // The socket has been closed for any reason
}; // tolua_export