From 60850fe3e8da936d5b24460f33a1bf8f4d321ace Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 1 May 2014 15:08:15 +0200 Subject: Fixed crashes in the SSL HTTP connection. --- src/ClientHandle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 9f8d44129..ac44e43dc 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -387,7 +387,7 @@ private: void HandleCommandBlockMessage(const char * a_Data, unsigned int a_Length); // cSocketThreads::cCallback overrides: - virtual void DataReceived (const char * a_Data, size_t 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 -- cgit v1.2.3 From e24bdc9328278b676c7acf83fd9f31b430561b98 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 1 May 2014 23:03:23 +0200 Subject: More ClientHandle fixes. --- src/ClientHandle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 9f8d44129..9fd17ac00 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -384,7 +384,7 @@ 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); // cSocketThreads::cCallback overrides: virtual void DataReceived (const char * a_Data, size_t a_Size) override; // Data is received from the client -- cgit v1.2.3 From 6ac332cd0662f49e30f60ae0b5a3b7f85df8cfb3 Mon Sep 17 00:00:00 2001 From: Howaner Date: Thu, 1 May 2014 01:25:04 +0200 Subject: Add MC|ItemName plugin message. --- src/ClientHandle.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 9fd17ac00..4dc6ab074 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -385,6 +385,9 @@ private: /** Handles the "MC|AdvCdm" plugin message */ 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, size_t a_Size) override; // Data is received from the client -- cgit v1.2.3 From c8631d9a9b924c4c4d030bac3ed4e4a869ec2fd8 Mon Sep 17 00:00:00 2001 From: Howaner Date: Fri, 9 May 2014 23:10:02 +0200 Subject: Add DIG_STATUS_CANCELLED packet and add item resend, when a block can't place/break. --- src/ClientHandle.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 4dc6ab074..03a716657 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -374,6 +374,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); + /** Handles the DIG_CANCELLED dig packet: */ + void HandleBlockDigCancel(); + /** Converts the protocol-formatted channel list (NUL-separated) into a proper string vector. */ AStringVector BreakApartPluginChannels(const AString & a_PluginChannels); -- cgit v1.2.3 From 5c9f89526aeca7b32014cd78e323f74baddf1e36 Mon Sep 17 00:00:00 2001 From: Howaner Date: Sun, 11 May 2014 11:56:15 +0200 Subject: Rename HandleBlockDigCancel to FinishDigAnimtion. --- src/ClientHandle.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 03a716657..85d348eee 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -374,8 +374,8 @@ 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); - /** Handles the DIG_CANCELLED dig packet: */ - void HandleBlockDigCancel(); + /** 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); -- cgit v1.2.3 From c7c3724a3ee0e7a77fe9924ad25c36b6ec8fdd14 Mon Sep 17 00:00:00 2001 From: andrew Date: Sun, 11 May 2014 14:57:06 +0300 Subject: Statistic Manager --- src/ClientHandle.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 4dc6ab074..0236d38fb 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -39,6 +39,7 @@ class cFallingBlock; class cItemHandler; class cWorld; class cCompositeChat; +class cStatManager; @@ -160,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); -- cgit v1.2.3 From 989312c4e7f517ae324e857cb255211e3fd8bb06 Mon Sep 17 00:00:00 2001 From: Howaner Date: Fri, 16 May 2014 22:04:19 +0200 Subject: Add more move checks - Invalid X/Y/Z/Stance check (std::isnan) - Illegal stance - Illegal position (32.000.000 is the world size) --- src/ClientHandle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 85d348eee..940fb786a 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -223,7 +223,7 @@ public: void HandlePing (void); void HandlePlayerAbilities (bool a_CanFly, bool a_IsFlying, float FlyingSpeed, float WalkingSpeed); void HandlePlayerLook (float a_Rotation, float a_Pitch, bool a_IsOnGround); - void HandlePlayerMoveLook (double a_PosX, double a_PosY, double a_PosZ, double a_Stance, float a_Rotation, float a_Pitch, bool a_IsOnGround); // While m_bPositionConfirmed (normal gameplay) + void HandlePlayerMoveLook (double a_PosX, double a_PosY, double a_PosZ, double a_Stance, float a_Yaw, float a_Pitch, bool a_IsOnGround); // While m_bPositionConfirmed (normal gameplay) void HandlePlayerPos (double a_PosX, double a_PosY, double a_PosZ, double a_Stance, bool a_IsOnGround); void HandlePluginMessage (const AString & a_Channel, const AString & a_Message); void HandleRespawn (void); -- cgit v1.2.3 From 3a9543178abb7500aff65e09f054c28200ca6cac Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 19 May 2014 21:16:29 +0100 Subject: cCompositeChat message type is now formatted --- src/ClientHandle.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 9f1245be5..659c67658 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -80,9 +80,9 @@ public: 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. **/ - AString FormatMessageType(bool ShouldAppendChatPrefixes, eMessageType a_ChatPrefix, const AString & a_AdditionalData); + static AString FormatMessageType(bool ShouldAppendChatPrefixes, eMessageType a_ChatPrefix, const AString & a_AdditionalData); - AString FormatChatPrefix(bool ShouldAppendChatPrefixes, AString a_ChatPrefixS, AString m_Color1, AString m_Color2); + static AString FormatChatPrefix(bool ShouldAppendChatPrefixes, AString a_ChatPrefixS, AString m_Color1, AString m_Color2); void Kick(const AString & a_Reason); // tolua_export void Authenticate(const AString & a_Name, const AString & a_UUID); // Called by cAuthenticator when the user passes authentication -- cgit v1.2.3 From 6449b5d11b5a07183812189d5eead0734f9dc191 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 26 May 2014 16:38:14 +0200 Subject: Revert "Add more move checks" This reverts commit 989312c4e7f517ae324e857cb255211e3fd8bb06. --- src/ClientHandle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 04d93e2c0..659c67658 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -225,7 +225,7 @@ public: void HandlePing (void); void HandlePlayerAbilities (bool a_CanFly, bool a_IsFlying, float FlyingSpeed, float WalkingSpeed); void HandlePlayerLook (float a_Rotation, float a_Pitch, bool a_IsOnGround); - void HandlePlayerMoveLook (double a_PosX, double a_PosY, double a_PosZ, double a_Stance, float a_Yaw, float a_Pitch, bool a_IsOnGround); // While m_bPositionConfirmed (normal gameplay) + void HandlePlayerMoveLook (double a_PosX, double a_PosY, double a_PosZ, double a_Stance, float a_Rotation, float a_Pitch, bool a_IsOnGround); // While m_bPositionConfirmed (normal gameplay) void HandlePlayerPos (double a_PosX, double a_PosY, double a_PosZ, double a_Stance, bool a_IsOnGround); void HandlePluginMessage (const AString & a_Channel, const AString & a_Message); void HandleRespawn (void); -- cgit v1.2.3 From b904223b9dbbe7b696dbd30e748bc131742e11ea Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 6 Jun 2014 22:31:16 +0200 Subject: Added queue for adding entities to cWorld. This alone doesn't work properly yet, further changes to cPlayer are needed. --- src/ClientHandle.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 659c67658..3f1cdf55a 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -250,7 +250,8 @@ public: void SendData(const char * a_Data, size_t a_Size); - /** Called when the player moves into a different world; queues sreaming the new chunks */ + /** Called when the player moves into a different world. + Locks the current world, doesn't lock the new world. */ void MoveToWorld(cWorld & a_World, bool a_SendRespawnPacket); /** Called when the player will enchant a Item */ -- cgit v1.2.3 From af4a21ea0689107b377818574cb07dc4a2e8b755 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 8 Jun 2014 21:58:08 +0200 Subject: Fixed deadlock when moving players to other worlds. Fixes #1039, fixes #851 --- src/ClientHandle.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 3f1cdf55a..0d883f3af 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -149,7 +149,7 @@ public: void SendPlayerSpawn (const cPlayer & a_Player); void SendPluginMessage (const AString & a_Channel, const AString & a_Message); // Exported in ManualBindings.cpp void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID); - void SendRespawn (void); + void SendRespawn (const cWorld & a_World); void SendExperience (void); void SendExperienceOrb (const cExpOrb & a_ExpOrb); void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode); @@ -251,8 +251,8 @@ public: void SendData(const char * a_Data, size_t a_Size); /** Called when the player moves into a different world. - Locks the current world, doesn't lock the new world. */ - void MoveToWorld(cWorld & a_World, bool a_SendRespawnPacket); + Sends an UnloadChunk packet for each loaded chunk and resets the streamed chunks. */ + void RemoveFromWorld(void); /** Called when the player will enchant a Item */ void HandleEnchantItem(Byte & WindowID, Byte & Enchantment); -- cgit v1.2.3 From 29567c56107c86b70da130f995564beb2eaf424c Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Thu, 12 Jun 2014 15:21:07 +0100 Subject: Portals animate and delay correctly --- src/ClientHandle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 0d883f3af..99d10c3aa 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -149,7 +149,7 @@ public: void SendPlayerSpawn (const cPlayer & a_Player); void SendPluginMessage (const AString & a_Channel, const AString & a_Message); // Exported in ManualBindings.cpp void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID); - void SendRespawn (const cWorld & a_World); + void SendRespawn (eDimension a_Dimension); void SendExperience (void); void SendExperienceOrb (const cExpOrb & a_ExpOrb); void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode); -- cgit v1.2.3 From 08fed2a213f40e963ef871664439d744faefffba Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 21 Jun 2014 22:13:35 +0200 Subject: Added cClientHandle::IsUUIDOnline function. Ref.: #771 --- src/ClientHandle.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 0d883f3af..3e18cbdad 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -63,7 +63,7 @@ public: const AString & GetIPString(void) const { return m_IPString; } - cPlayer* GetPlayer() { return m_Player; } // tolua_export + cPlayer * GetPlayer(void) { 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; } @@ -76,9 +76,16 @@ public: /** 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. */ + Each username generates a unique and constant UUID, so that when the player reconnects with the same name, their UUID is the same. + Returns a 36-char UUID (with dashes). */ static AString GenerateOfflineUUID(const AString & a_Username); // tolua_export + /** Returns true if the UUID is generated by online auth, false if it is an offline-generated UUID. + We use Version-3 UUIDs for offline UUIDs, online UUIDs are Version-4, thus we can tell them apart. + Accepts both 32-char and 36-char UUIDs (with and without dashes). + If the string given is not a valid UUID, returns false. */ + static bool IsUUIDOnline(const AString & a_UUID); // 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); -- cgit v1.2.3 From 9926abd4f55d668dec9e06c2ba23fa3bb9209eeb Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 27 Jun 2014 20:56:29 +0200 Subject: Added generic entity-collecting. Now any cEntity can be collected, not only cPickups. This should help PR #1098. --- src/ClientHandle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 3e18cbdad..02bc0c719 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -123,7 +123,7 @@ public: void SendChat (const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData = ""); void SendChat (const cCompositeChat & a_Message); void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer); - void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player); + void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player); void SendDestroyEntity (const cEntity & a_Entity); void SendDisconnect (const AString & a_Reason); void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ); -- cgit v1.2.3 From b9d4431f6f2b60802d66da03f0b915bbd2c846cb Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 29 Jun 2014 22:44:01 +0100 Subject: Fixed respawning * Fixes #1103 --- src/ClientHandle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 02bc0c719..6f2c86b27 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -156,7 +156,7 @@ public: void SendPlayerSpawn (const cPlayer & a_Player); void SendPluginMessage (const AString & a_Channel, const AString & a_Message); // Exported in ManualBindings.cpp void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID); - void SendRespawn (const cWorld & a_World); + void SendRespawn (const cWorld & a_World, bool a_ShouldIgnoreDimensionChecks = false); void SendExperience (void); void SendExperienceOrb (const cExpOrb & a_ExpOrb); void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode); -- cgit v1.2.3 From e11f41d04821c9c00796066b45c4ace86415beb3 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 13 Jul 2014 00:12:32 +0100 Subject: Revert failed fix for #31 This reverts commit 69dc9b4c9aea58ebd95e2dbd0205701dfc4ce54e. --- src/ClientHandle.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 6f2c86b27..b0bbda19e 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -325,9 +325,6 @@ private: int m_LastDigBlockX; int m_LastDigBlockY; int m_LastDigBlockZ; - - /** Used while csDestroyedWaiting for counting the ticks until the connection is closed */ - int m_TicksSinceDestruction; enum eState { @@ -338,7 +335,6 @@ private: csConfirmingPos, ///< The client has been sent the position packet, waiting for them to repeat the position back csPlaying, ///< Normal gameplay csDestroying, ///< The client is being destroyed, don't queue any more packets / don't add to chunks - csDestroyedWaiting, ///< The client has been destroyed, but is still kept so that the Kick packet is delivered (#31) csDestroyed, ///< The client has been destroyed, the destructor is to be called from the owner thread // TODO: Add Kicking here as well -- cgit v1.2.3 From d529971e279609ae928d9077404b95bd595b5e52 Mon Sep 17 00:00:00 2001 From: Howaner Date: Sun, 13 Jul 2014 02:08:02 +0200 Subject: Changed BroadcastSoundEffect function to take floating pos. --- src/ClientHandle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index b0bbda19e..922740b11 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -162,7 +162,7 @@ public: void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode); void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode); void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display); - void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch); // a_Src coords are Block * 8 + void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch); // tolua_export void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data); void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock); void SendSpawnMob (const cMonster & a_Mob); -- cgit v1.2.3 From 4e24f711abd3d6a93f01ee7c297eb67c8aedbd37 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 14 Jul 2014 19:49:31 +0100 Subject: Player properties are now retrieved --- src/ClientHandle.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index b0bbda19e..478da5b3c 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -67,6 +67,8 @@ public: const AString & GetUUID(void) const { return m_UUID; } // tolua_export void SetUUID(const AString & a_UUID) { m_UUID = a_UUID; } + + const AString & GetProperties(void) const { return m_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. @@ -92,7 +94,7 @@ public: static AString FormatChatPrefix(bool ShouldAppendChatPrefixes, AString a_ChatPrefixS, AString m_Color1, AString m_Color2); void Kick(const AString & a_Reason); // tolua_export - void Authenticate(const AString & a_Name, const AString & a_UUID); // Called by cAuthenticator when the user passes authentication + void Authenticate(const AString & a_Name, const AString & a_UUID, const AString & a_Properties); // Called by cAuthenticator when the user passes authentication void StreamChunks(void); @@ -280,6 +282,7 @@ private: AString m_Username; AString m_Password; + AString m_Properties; cCriticalSection m_CSChunkLists; cChunkCoordsList m_LoadedChunks; // Chunks that the player belongs to -- cgit v1.2.3 From 1f6854792cdd6792b27c4f9f3d7d857df9dd64bf Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 16 Jul 2014 00:03:47 +0100 Subject: Store properties as Json::Value --- src/ClientHandle.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 478da5b3c..7bd286a05 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -20,6 +20,7 @@ #include "Map.h" #include "Enchantments.h" #include "UI/SlotArea.h" +#include "json/json.h" @@ -68,7 +69,7 @@ public: const AString & GetUUID(void) const { return m_UUID; } // tolua_export void SetUUID(const AString & a_UUID) { m_UUID = a_UUID; } - const AString & GetProperties(void) const { return m_Properties; } + const Json::Value & GetProperties(void) const { return m_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. @@ -93,8 +94,10 @@ public: static AString FormatChatPrefix(bool ShouldAppendChatPrefixes, AString a_ChatPrefixS, AString m_Color1, AString m_Color2); - void Kick(const AString & a_Reason); // tolua_export - void Authenticate(const AString & a_Name, const AString & a_UUID, const AString & a_Properties); // Called by cAuthenticator when the user passes authentication + void Kick(const AString & a_Reason); // tolua_export + + /** Authenticates the specified user, called by cAuthenticator */ + void Authenticate(const AString & a_Name, const AString & a_UUID, const Json::Value & a_Properties); void StreamChunks(void); @@ -282,7 +285,7 @@ private: AString m_Username; AString m_Password; - AString m_Properties; + Json::Value m_Properties; cCriticalSection m_CSChunkLists; cChunkCoordsList m_LoadedChunks; // Chunks that the player belongs to -- cgit v1.2.3 From 993fd14ddfc881cf5be951df77da0338124d68cc Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 16:33:09 +0200 Subject: Fixed basic whitespace problems. Indenting by spaces and alignment by spaces, as well as trailing whitespace on non-empty lines. --- src/ClientHandle.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index ca39a01cd..d02b83cfe 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -48,7 +48,7 @@ class cStatManager; class cClientHandle : // tolua_export public cSocketThreads::cCallback -{ // tolua_export +{ // tolua_export public: #if defined(ANDROID_NDK) @@ -64,9 +64,9 @@ public: const AString & GetIPString(void) const { return m_IPString; } - cPlayer * GetPlayer(void) { return m_Player; } // tolua_export + cPlayer * GetPlayer(void) { return m_Player; } // tolua_export - const AString & GetUUID(void) const { return m_UUID; } // tolua_export + const AString & GetUUID(void) const { return m_UUID; } // tolua_export void SetUUID(const AString & a_UUID) { m_UUID = a_UUID; } const Json::Value & GetProperties(void) const { return m_Properties; } @@ -246,8 +246,8 @@ public: void HandleSteerVehicle (float Forward, float Sideways); void HandleTabCompletion (const AString & a_Text); void HandleUpdateSign ( - int a_BlockX, int a_BlockY, int a_BlockZ, - const AString & a_Line1, const AString & a_Line2, + int a_BlockX, int a_BlockY, int a_BlockZ, + const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4 ); void HandleUnmount (void); @@ -338,7 +338,7 @@ private: csAuthenticating, ///< The client has logged in, waiting for external authentication csAuthenticated, ///< The client has been authenticated, will start streaming chunks in the next tick csDownloadingWorld, ///< The client is waiting for chunks, we're waiting for the loader to provide and send them - csConfirmingPos, ///< The client has been sent the position packet, waiting for them to repeat the position back + csConfirmingPos, ///< The client has been sent the position packet, waiting for them to repeat the position back csPlaying, ///< Normal gameplay csDestroying, ///< The client is being destroyed, don't queue any more packets / don't add to chunks csDestroyed, ///< The client has been destroyed, the destructor is to be called from the owner thread @@ -408,7 +408,7 @@ private: 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 +}; // tolua_export -- cgit v1.2.3 From 7fff12bfacbb4bef1c02cea0ec10fdc9a6fb64e4 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 19:13:23 +0200 Subject: Fixed spaces around single-line comments. There should be at least two spaces in front and one space after //-style comments. --- src/ClientHandle.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index d02b83cfe..539e24ef6 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -123,7 +123,7 @@ public: void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle); void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType); void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage); - void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); // tolua_export + void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); // tolua_export void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes); void SendChat (const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData = ""); void SendChat (const cCompositeChat & a_Message); @@ -271,15 +271,14 @@ public: 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 cChannels; - int m_ViewDistance; // Number of chunks the player can see in each direction; 4 is the minimum ( http://wiki.vg/Protocol_FAQ#.E2.80.A6all_connecting_clients_spasm_and_jerk_uncontrollably.21 ) + /** Number of chunks the player can see in each direction; 4 is the minimum ( http://wiki.vg/Protocol_FAQ#.E2.80.A6all_connecting_clients_spasm_and_jerk_uncontrollably.21 ) */ + int m_ViewDistance; - static const int GENERATEDISTANCE = 2; // Server generates this many chunks AHEAD of player sight. 2 is the minimum, since foliage is generated 1 step behind chunk terrain generation + /** Server generates this many chunks AHEAD of player sight. */ + static const int GENERATEDISTANCE = 2; AString m_IPString; @@ -317,7 +316,7 @@ private: int m_PingID; long long m_PingStartTime; long long m_LastPingTime; - static const unsigned short PING_TIME_MS = 1000; //minecraft sends 1 per 20 ticks (1 second or every 1000 ms) + static const unsigned short PING_TIME_MS = 1000; // Vanilla sends 1 per 20 ticks (1 second or every 1000 ms) // Values required for block dig animation int m_BlockDigAnimStage; // Current stage of the animation; -1 if not digging @@ -374,6 +373,9 @@ private: cChannels m_PluginChannels; + /** 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); + /** Returns true if the rate block interactions is within a reasonable limit (bot protection) */ bool CheckBlockInteractionsRate(void); -- cgit v1.2.3 From 719551c31f5ed0d3cbad9797dd81a6bf1ae4e5a2 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 18 Jul 2014 20:12:27 +0100 Subject: Fix failed merge and other issues --- src/ClientHandle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index cb0471421..e3c2b590f 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -161,7 +161,7 @@ public: void SendPlayerSpawn (const cPlayer & a_Player); void SendPluginMessage (const AString & a_Channel, const AString & a_Message); // Exported in ManualBindings.cpp void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID); - void SendRespawn (eDimension a_Dimension); + void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks = false); void SendExperience (void); void SendExperienceOrb (const cExpOrb & a_ExpOrb); void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode); -- cgit v1.2.3 From 93d29555e58df172bafba530afbc593c16ec66a3 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 21 Jul 2014 15:19:48 +0200 Subject: Style: Normalized to no spaces before closing parenthesis. --- src/ClientHandle.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 539e24ef6..538ecdad7 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -181,7 +181,7 @@ public: void SendUnloadChunk (int a_ChunkX, int a_ChunkZ); void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity); void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4); - void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ); + void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ); void SendWeather (eWeather a_Weather); void SendWholeInventory (const cWindow & a_Window); void SendWindowClose (const cWindow & a_Window); @@ -190,7 +190,7 @@ public: // tolua_begin const AString & GetUsername(void) const; - void SetUsername( const AString & a_Username ); + void SetUsername( const AString & a_Username); inline short GetPing(void) const { return m_Ping; } @@ -274,7 +274,7 @@ private: /** The type used for storing the names of registered plugin channels. */ typedef std::set cChannels; - /** Number of chunks the player can see in each direction; 4 is the minimum ( http://wiki.vg/Protocol_FAQ#.E2.80.A6all_connecting_clients_spasm_and_jerk_uncontrollably.21 ) */ + /** Number of chunks the player can see in each direction */ int m_ViewDistance; /** Server generates this many chunks AHEAD of player sight. */ -- cgit v1.2.3 From 4044d0a6e6c586aa483ae19d986c8f12c474d057 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 22 Jul 2014 13:10:12 -0700 Subject: Export SendEntityAnimation to ToLua --- src/ClientHandle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 538ecdad7..c1c4cdff9 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -151,7 +151,7 @@ public: void SendMapInfo (int a_ID, unsigned int a_Scale); void SendPaintingSpawn (const cPainting & a_Painting); void SendPickupSpawn (const cPickup & a_Pickup); - void SendEntityAnimation (const cEntity & a_Entity, char a_Animation); + void SendEntityAnimation (const cEntity & a_Entity, char a_Animation); // tolua_export void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount); void SendPlayerAbilities (void); void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline); -- cgit v1.2.3 From 997a643977ea901a3cd3a3d1d7171d65b82a828c Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Wed, 23 Jul 2014 20:28:56 +0200 Subject: Moar view distance! Let's blow up our computers! :D --- src/ClientHandle.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index c1c4cdff9..50ed596d5 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -56,8 +56,8 @@ public: #else static const int DEFAULT_VIEW_DISTANCE = 10; #endif - static const int MAX_VIEW_DISTANCE = 15; - static const int MIN_VIEW_DISTANCE = 3; + static const int MAX_VIEW_DISTANCE = 32; + static const int MIN_VIEW_DISTANCE = 1; cClientHandle(const cSocket * a_Socket, int a_ViewDistance); virtual ~cClientHandle(); -- cgit v1.2.3