Cuberite
A lightweight, fast and extensible game server for Minecraft
ClientHandle.h
Go to the documentation of this file.
1 
2 // cClientHandle.h
3 
4 // Interfaces to the cClientHandle class representing a client connected to this server. The client need not be a player yet
5 
6 
7 
8 
9 
10 #pragma once
11 
12 #include "OSSupport/Network.h"
13 #include "Defines.h"
14 #include "Scoreboard.h"
15 #include "UI/SlotArea.h"
16 #include "json/json.h"
17 #include "ChunkSender.h"
18 #include "EffectID.h"
21 #include "UUID.h"
22 
23 
24 
25 
26 
27 // fwd:
29 class cMonster;
30 class cExpOrb;
31 class cPainting;
32 class cPickup;
33 class cPlayer;
34 class cProtocol;
35 class cWindow;
36 class cFallingBlock;
37 class cCompositeChat;
38 class cMap;
39 class cClientHandle;
40 
42 
43 typedef std::shared_ptr<cClientHandle> cClientHandlePtr;
44 
45 
46 
47 
48 
49 class cClientHandle // tolua_export
50  : public cTCPLink::cCallbacks, public std::enable_shared_from_this<cClientHandle>
51 { // tolua_export
52 public: // tolua_export
53 
54  #if defined(ANDROID)
55  static const int DEFAULT_VIEW_DISTANCE = 4; // The default ViewDistance (used when no value is set in Settings.ini)
56  #else
57  static const int DEFAULT_VIEW_DISTANCE = 10;
58  #endif
59  static const int MAX_VIEW_DISTANCE = 32;
60  static const int MIN_VIEW_DISTANCE = 1;
61 
65  static float FASTBREAK_PERCENTAGE;
66 
68  cClientHandle(const AString & a_IPString, int a_ViewDistance);
69 
70  virtual ~cClientHandle() override;
71 
72  const AString & GetIPString(void) const { return m_IPString; } // tolua_export
73 
76  void SetIPString(const AString & a_IPString) { m_IPString = a_IPString; }
77 
78  cPlayer * GetPlayer(void) { return m_Player; } // tolua_export
79 
81  const cUUID & GetUUID(void) const { return m_UUID; } // Exported in ManualBindings.cpp
82 
86  void SetUUID(const cUUID & a_UUID) { ASSERT(!a_UUID.IsNil()); m_UUID = a_UUID; }
87 
88  const Json::Value & GetProperties(void) const { return m_Properties; }
89 
93  void SetProperties(const Json::Value & a_Properties) { m_Properties = a_Properties; }
94 
98  static cUUID GenerateOfflineUUID(const AString & a_Username); // Exported in ManualBindings.cpp
99 
102  static bool IsUUIDOnline(const cUUID & a_UUID); // Exported in ManualBindings.cpp
103 
105  void ProxyInit(const AString & a_IPString, const cUUID & a_UUID);
106  void ProxyInit(const AString & a_IPString, const cUUID & a_UUID, const Json::Value & a_Properties);
107 
110  void ProcessProtocolIn(void);
111 
113  void ProcessProtocolOut();
114 
116  static AString FormatMessageType(bool ShouldAppendChatPrefixes, eMessageType a_ChatPrefix, const AString & a_AdditionalData);
117 
118  static AString FormatChatPrefix(
119  bool ShouldAppendChatPrefixes, const AString & a_ChatPrefixS,
120  const AString & m_Color1, const AString & m_Color2
121  );
122 
123  void Kick(const AString & a_Reason); // tolua_export
124 
126  bool BungeeAuthenticate();
127 
129  void Authenticate(AString && a_Name, const cUUID & a_UUID, Json::Value && a_Properties);
130 
132  void StreamNextChunks();
133 
135  void UnloadOutOfRangeChunks(void);
136 
137  inline bool IsLoggedIn(void) const { return (m_State >= csAuthenticating); }
138 
140  void Tick(std::chrono::milliseconds a_Dt);
141 
143  void ServerTick(float a_Dt);
144 
145  void Destroy(void);
146 
147  bool IsPlaying (void) const { return (m_State == csPlaying); }
148  bool IsDestroyed (void) const { return (m_State == csDestroyed); }
149 
150  // The following functions send the various packets:
151  // (Please keep these alpha-sorted)
152  void SendAttachEntity (const cEntity & a_Entity, const cEntity & a_Vehicle);
153  void SendBlockAction (Vector3i a_BlockPos, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType);
154  void SendBlockBreakAnim (UInt32 a_EntityID, Vector3i a_BlockPos, char a_Stage); // tolua_export
155  void SendBlockChange (Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); // tolua_export
156  void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes);
157  void SendBossBarAdd (UInt32 a_UniqueID, const cCompositeChat & a_Title, float a_FractionFilled, BossBarColor a_Color, BossBarDivisionType a_DivisionType, bool a_DarkenSky, bool a_PlayEndMusic, bool a_CreateFog); // tolua_export
158  void SendBossBarUpdateFlags (UInt32 a_UniqueID, bool a_DarkenSky, bool a_PlayEndMusic, bool a_CreateFog); // tolua_export
159  void SendBossBarUpdateStyle (UInt32 a_UniqueID, BossBarColor a_Color, BossBarDivisionType a_DivisionType); // tolua_export
160  void SendBossBarUpdateTitle (UInt32 a_UniqueID, const cCompositeChat & a_Title); // tolua_export
161  void SendBossBarRemove (UInt32 a_UniqueID); // tolua_export
162  void SendBossBarUpdateHealth (UInt32 a_UniqueID, float a_FractionFilled); // tolua_export
163  void SendCameraSetTo (const cEntity & a_Entity);
164  void SendChat (const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData = "");
165  void SendChat (const cCompositeChat & a_Message);
166  void SendChatRaw (const AString & a_MessageRaw, eChatType a_Type);
167  void SendChatAboveActionBar (const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData = "");
168  void SendChatAboveActionBar (const cCompositeChat & a_Message);
169  void SendChatSystem (const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData = "");
170  void SendChatSystem (const cCompositeChat & a_Message);
171  void SendChunkData (int a_ChunkX, int a_ChunkZ, ContiguousByteBufferView a_ChunkData);
172  void SendCollectEntity (const cEntity & a_Collected, const cEntity & a_Collector, unsigned a_Count); // tolua_export
173  void SendDestroyEntity (const cEntity & a_Entity); // tolua_export
174  void SendDetachEntity (const cEntity & a_Entity, const cEntity & a_PreviousVehicle); // tolua_export
175  void SendDisconnect (const AString & a_Reason);
176  void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display);
177  void SendEditSign (Vector3i a_BlockPos); // tolua_export
178  void SendEntityAnimation (const cEntity & a_Entity, EntityAnimation a_Animation); // tolua_export
179  void SendEntityEffect (const cEntity & a_Entity, int a_EffectID, int a_Amplifier, int a_Duration);
180  void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item);
181  void SendEntityHeadLook (const cEntity & a_Entity);
182  void SendEntityLook (const cEntity & a_Entity);
183  void SendEntityMetadata (const cEntity & a_Entity);
184  void SendEntityPosition (const cEntity & a_Entity);
185  void SendEntityProperties (const cEntity & a_Entity);
186  void SendEntityVelocity (const cEntity & a_Entity);
187  void SendExperience (void);
188  void SendExperienceOrb (const cExpOrb & a_ExpOrb);
189  void SendExplosion (Vector3f a_Position, float a_Power);
190  void SendGameMode (eGameMode a_GameMode);
191  void SendHealth (void);
192  void SendHeldItemChange (int a_ItemIndex);
193  void SendHideTitle (void); // tolua_export
194  void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item);
195  void SendLeashEntity (const cEntity & a_Entity, const cEntity & a_EntityLeashedTo); // tolua_export
196  void SendMapData (const cMap & a_Map, int a_DataStartX, int a_DataStartY);
197  void SendPaintingSpawn (const cPainting & a_Painting);
198  void SendParticleEffect (const AString & a_ParticleName, Vector3f a_Source, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount);
199  void SendParticleEffect (const AString & a_ParticleName, const Vector3f a_Src, const Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data);
200  void SendPlayerAbilities (void);
201  void SendPlayerListAddPlayer (const cPlayer & a_Player);
202  void SendPlayerListHeaderFooter (const cCompositeChat & a_Header, const cCompositeChat & a_Footer); // tolua_export
203  void SendPlayerListRemovePlayer (const cPlayer & a_Player);
204  void SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName);
205  void SendPlayerListUpdateGameMode (const cPlayer & a_Player);
206  void SendPlayerListUpdatePing ();
207  void SendPlayerMoveLook (Vector3d a_Pos, float a_Yaw, float a_Pitch, bool a_IsRelative);
208  void SendPlayerMoveLook (void);
209  void SendPlayerPermissionLevel (void);
210  void SendPlayerPosition (void);
211  void SendPlayerSpawn (const cPlayer & a_Player);
212  void SendPluginMessage (const AString & a_Channel, std::string_view a_Message); // Exported in ManualBindings.cpp
213  void SendPluginMessage (const AString & a_Channel, ContiguousByteBufferView a_Message);
214  void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID);
215  void SendResourcePack (const AString & a_ResourcePackUrl); // tolua_export
216  void SendResetTitle (void); // tolua_export
217  void SendRespawn (eDimension a_Dimension, bool a_IsRespawningFromDeath);
218  void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode);
219  void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode);
220  void SendSetSubTitle (const cCompositeChat & a_SubTitle); // tolua_export
221  void SendSetRawSubTitle (const AString & a_SubTitle); // tolua_export
222  void SendSetTitle (const cCompositeChat & a_Title); // tolua_export
223  void SendSetRawTitle (const AString & a_Title); // tolua_export
224  void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch); // tolua_export
225  void SendSoundEffect (const AString & a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch); // tolua_export
226  void SendSoundParticleEffect (const EffectID a_EffectID, Vector3i a_Source, int a_Data);
227  void SendSpawnEntity (const cEntity & a_Entity);
228  void SendSpawnMob (const cMonster & a_Mob);
229  void SendStatistics (const StatisticsManager & a_Manager);
230  void SendTabCompletionResults (const AStringVector & a_Results);
231  void SendThunderbolt (Vector3i a_BlockPos); // tolua_export
232  void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks); // tolua_export
233  void SendTimeUpdate (cTickTimeLong a_WorldAge, cTickTimeLong a_WorldDate, bool a_DoDaylightCycle);
234  void SendUnleashEntity (const cEntity & a_Entity); // tolua_export
235  void SendUnloadChunk (int a_ChunkX, int a_ChunkZ);
236  void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity);
237  void SendUpdateSign (Vector3i a_BlockPos, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4);
238 
240  void SendUnlockRecipe (UInt32 a_RecipeId);
241 
243  void SendInitRecipes (UInt32 a_RecipeId);
244 
245  void SendWeather (eWeather a_Weather);
246  void SendWholeInventory (const cWindow & a_Window);
247  void SendWindowClose (const cWindow & a_Window);
248  void SendWindowOpen (const cWindow & a_Window);
249  void SendWindowProperty (const cWindow & a_Window, size_t a_Property, short a_Value);
250 
251  const AString & GetUsername(void) const; // tolua_export
252  void SetUsername(AString && a_Username);
253 
254  // tolua_begin
255 
256  inline short GetPing(void) const { return static_cast<short>(std::chrono::duration_cast<std::chrono::milliseconds>(m_Ping).count()); }
257 
259  void SetViewDistance(int a_ViewDistance);
260 
262  int GetViewDistance(void) const { return m_CurrentViewDistance; }
263 
266 
267  void SetLocale(const AString & a_Locale) { m_Locale = a_Locale; }
268  AString GetLocale(void) const { return m_Locale; }
269 
270  int GetUniqueID(void) const { return m_UniqueID; }
271 
272  bool HasPluginChannel(const AString & a_PluginChannel);
273 
276  void SetClientBrand(const AString & a_ClientBrand) { m_ClientBrand = a_ClientBrand; }
277 
279  const AString & GetClientBrand(void) const { return m_ClientBrand; }
280 
282  const AStringMap & GetForgeMods(void) const { return m_ForgeMods; }
283 
285  bool IsForgeClient(void) const { return m_ForgeHandshake.IsForgeClient; }
286 
287  // tolua_end
288 
290  void ForgeAugmentServerListPing(Json::Value & a_Response)
291  {
292  m_ForgeHandshake.AugmentServerListPing(*this, a_Response);
293  }
294 
297  {
299  }
300 
302  bool WantsSendChunk(int a_ChunkX, int a_ChunkZ);
303 
305  void AddWantedChunk(int a_ChunkX, int a_ChunkZ);
306 
307  // Calls that cProtocol descendants use to report state:
308  void PacketBufferFull(void);
309  void PacketUnknown(UInt32 a_PacketType);
310  void PacketError(UInt32 a_PacketType);
311 
313  void HandleAnimation(bool a_SwingMainHand);
314 
317  void HandleAnvilItemName(const AString & a_ItemName);
318 
321  void HandleBeaconSelection(unsigned a_PrimaryEffect, unsigned a_SecondaryEffect);
322 
324  void HandleChat(const AString & a_Message);
325 
328  void HandleCommandBlockBlockChange(Vector3i a_BlockPos, const AString & a_NewCommand);
329 
332  void HandleCommandBlockEntityChange(UInt32 a_EntityID, const AString & a_NewCommand);
333 
336  void HandleCreativeInventory(Int16 a_SlotNum, const cItem & a_HeldItem, eClickAction a_ClickAction);
337 
339  void HandleCrouch(bool a_IsCrouching);
340 
342  void HandleEnchantItem(UInt8 a_WindowID, UInt8 a_Enchantment);
343 
346  bool CheckMultiLogin(const AString & a_Username);
347 
352  bool HandleHandshake (const AString & a_Username);
353 
355  void HandleLeaveBed();
356 
357  void HandleKeepAlive (UInt32 a_KeepAliveID);
358  void HandleLeftClick (Vector3i a_BlockPos, eBlockFace a_BlockFace, UInt8 a_Status);
359 
362  void HandleNPCTrade(int a_SlotNum);
363 
366 
367  void HandlePing (void);
368  void HandlePlayerAbilities (bool a_IsFlying, float FlyingSpeed, float WalkingSpeed);
369  void HandlePlayerLook (float a_Rotation, float a_Pitch, bool a_IsOnGround);
370 
374  void HandlePlayerMove(Vector3d a_Pos, bool a_IsOnGround);
375 
376  void HandlePlayerMoveLook(Vector3d a_Pos, float a_Rotation, float a_Pitch, bool a_IsOnGround);
377 
378 
379  void HandlePluginMessage (const AString & a_Channel, ContiguousByteBufferView a_Message);
380  void HandleResourcePack (UInt8 a_Status);
381  void HandleRespawn (void);
382  void HandleRightClick (Vector3i a_BlockPos, eBlockFace a_BlockFace, Vector3i a_Cursor, bool a_UsedMainHand);
383  void HandleSlotSelected (Int16 a_SlotNum);
384  void HandleSpectate (const cUUID & a_PlayerUUID);
385 
387  void HandleSprint(bool a_IsSprinting);
388 
391 
392  void HandleSteerVehicle (float Forward, float Sideways);
393  void HandleTabCompletion (const AString & a_Text);
394  void HandleUpdateSign (
395  Vector3i a_BlockPos,
396  const AString & a_Line1, const AString & a_Line2,
397  const AString & a_Line3, const AString & a_Line4
398  );
399  void HandleUnmount (void);
400  void HandleUseEntity (UInt32 a_TargetEntityID, bool a_IsLeftClick);
401  void HandleUseItem (bool a_UsedMainHand);
402  void HandleWindowClick (UInt8 a_WindowID, Int16 a_SlotNum, eClickAction a_ClickAction, const cItem & a_HeldItem);
403  void HandleWindowClose (UInt8 a_WindowID);
404 
406  void HandleCraftRecipe (UInt32 a_RecipeId);
407 
410  bool HandleLogin();
411 
412  void SendData(ContiguousByteBufferView a_Data);
413 
416  void RemoveFromWorld(void);
417 
419  void SetProtocolVersion(UInt32 a_ProtocolVersion) { m_ProtocolVersion = a_ProtocolVersion; }
420 
422  UInt32 GetProtocolVersion(void) const { return m_ProtocolVersion; } // tolua_export
423 
424  bool IsPlayerChunkSent();
425 
426 private:
427 
428  friend class cForgeHandshake; // Needs access to FinishAuthenticate()
429 
431  typedef std::set<AString> cChannels;
432 
435 
438 
441 
444 
446 
449  Json::Value m_Properties;
450 
452  std::unordered_set<cChunkCoords, cChunkCoordsHash> m_LoadedChunks; // Chunks that the player belongs to
453  std::unordered_set<cChunkCoords, cChunkCoordsHash> m_ChunksToSend; // Chunks that need to be sent to the player (queued because they weren't generated yet or there's not enough time to send them)
454  cChunkCoordsList m_SentChunks; // Chunks that are currently sent to the client
455 
457 
460 
464 
467 
471 
478 
485 
487 
488  bool m_HasSentDC;
489 
490  // Chunk position when the last StreamChunks() was called; used to avoid re-streaming while in the same chunk
493 
495  std::atomic<int> m_TicksSinceLastPacket;
496 
498  std::chrono::milliseconds m_TimeSinceLastUnloadCheck;
499 
501  std::chrono::steady_clock::duration m_Ping;
502 
505 
507  std::chrono::steady_clock::time_point m_PingStartTime;
508 
509  // Values required for block dig animation
510  int m_BlockDigAnimStage; // Current stage of the animation; -1 if not digging
511  int m_BlockDigAnimSpeed; // Current speed of the animation (units ???)
513 
514  // To avoid dig / aim bug in the client, store the last position given in a DIG_START packet and compare to that when processing the DIG_FINISH packet:
517 
518  enum eState
519  {
525  } ;
526 
527  /* Mutex protecting m_State from concurrent writes. */
529 
535  std::atomic<eState> m_State;
536 
539 
542 
543  static int s_ClientCount;
544 
546 
549 
552 
555 
558 
561 
564 
567 
570 
574 
578 
580  void FinishAuthenticate();
581 
583  bool CheckBlockInteractionsRate(void);
584 
586  bool IsWithinReach(Vector3i a_Position) const;
587 
589  void StreamChunk(int a_ChunkX, int a_ChunkZ, cChunkSender::Priority a_Priority);
590 
592  void HandleBlockDigStarted (Vector3i a_BlockPos, eBlockFace a_BlockFace);
593 
595  void HandleBlockDigFinished(Vector3i a_BlockPos, eBlockFace a_BlockFace);
596 
598  void FinishDigAnimation();
599 
602 
604  void RegisterPluginChannels(const AStringVector & a_ChannelList);
605 
607  void UnregisterPluginChannels(const AStringVector & a_ChannelList);
608 
610  void SocketClosed(void);
611 
614  bool SetState(eState a_NewState);
615 
616  // cTCPLink::cCallbacks overrides:
617  virtual void OnLinkCreated(cTCPLinkPtr a_Link) override;
618  virtual void OnReceivedData(const char * a_Data, size_t a_Length) override;
619  virtual void OnRemoteClosed(void) override;
620  virtual void OnError(int a_ErrorCode, const AString & a_ErrorMsg) override;
621 }; // tolua_export
cClientHandle::m_ForgeMods
AStringMap m_ForgeMods
Forge mods and versions installed on this client.
Definition: ClientHandle.h:437
cClientHandle::m_NumBlockChangeInteractionsThisTick
int m_NumBlockChangeInteractionsThisTick
Number of place or break interactions this tick.
Definition: ClientHandle.h:541
cClientHandle::m_Username
AString m_Username
Definition: ClientHandle.h:447
cClientHandle::HandleHandshake
bool HandleHandshake(const AString &a_Username)
Called when the protocol handshake has been received (for protocol versions that support it; otherwis...
Definition: ClientHandle.cpp:1956
cClientHandlePtr
std::shared_ptr< cClientHandle > cClientHandlePtr
Definition: ClientHandle.h:41
cClientHandle::SendData
void SendData(ContiguousByteBufferView a_Data)
Definition: ClientHandle.cpp:2025
cClientHandle
Definition: ClientHandle.h:49
cClientHandle::FASTBREAK_PERCENTAGE
static float FASTBREAK_PERCENTAGE
The percentage how much a block has to be broken.
Definition: ClientHandle.h:65
cClientHandle::RemoveFromWorld
void RemoveFromWorld(void)
Called when the player moves into a different world.
Definition: ClientHandle.cpp:2041
cClientHandle::SendUnloadChunk
void SendUnloadChunk(int a_ChunkX, int a_ChunkZ)
Definition: ClientHandle.cpp:3155
cClientHandle::SendCameraSetTo
void SendCameraSetTo(const cEntity &a_Entity)
Definition: ClientHandle.cpp:2380
cClientHandle::SendEntityMetadata
void SendEntityMetadata(const cEntity &a_Entity)
Definition: ClientHandle.cpp:2631
cClientHandle::HandleSlotSelected
void HandleSlotSelected(Int16 a_SlotNum)
Definition: ClientHandle.cpp:1649
cClientHandle::SendEntityVelocity
void SendEntityVelocity(const cEntity &a_Entity)
Definition: ClientHandle.cpp:2658
cClientHandle::GetPing
short GetPing(void) const
Definition: ClientHandle.h:256
eClickAction
eClickAction
Individual actions sent in the WindowClick packet.
Definition: Defines.h:81
cClientHandle::m_Locale
AString m_Locale
Client Settings.
Definition: ClientHandle.h:557
cClientHandle::HandleCreativeInventory
void HandleCreativeInventory(Int16 a_SlotNum, const cItem &a_HeldItem, eClickAction a_ClickAction)
Called when the client clicks the creative inventory window.
Definition: ClientHandle.cpp:786
cUUID
Definition: UUID.h:10
sSetBlockVector
std::vector< sSetBlock > sSetBlockVector
Definition: ChunkDef.h:424
cClientHandle::SendInitRecipes
void SendInitRecipes(UInt32 a_RecipeId)
Send already known recipes without notification but visible in the recipe book.
Definition: ClientHandle.cpp:3203
cClientHandle::Tick
void Tick(std::chrono::milliseconds a_Dt)
Called while the client is being ticked from the world via its cPlayer object.
Definition: ClientHandle.cpp:2107
cClientHandle::HandleCraftRecipe
void HandleCraftRecipe(UInt32 a_RecipeId)
Called when a recipe from the recipe book is selected.
Definition: ClientHandle.cpp:3212
cClientHandle::m_Properties
Json::Value m_Properties
Definition: ClientHandle.h:449
cClientHandle::OnReceivedData
virtual void OnReceivedData(const char *a_Data, size_t a_Length) override
Called when there's data incoming from the remote peer.
Definition: ClientHandle.cpp:3443
cClientHandle::SendGameMode
void SendGameMode(eGameMode a_GameMode)
Definition: ClientHandle.cpp:2705
cCompositeChat
Container for a single chat message composed of multiple functional parts.
Definition: CompositeChat.h:33
cClientHandle::m_Protocol
cMultiVersionProtocol m_Protocol
Definition: ClientHandle.h:456
ProtocolRecognizer.h
cClientHandle::GetIPString
const AString & GetIPString(void) const
Definition: ClientHandle.h:72
cClientHandle::OnLinkCreated
virtual void OnLinkCreated(cTCPLinkPtr a_Link) override
Called when the cTCPLink for the connection is created.
Definition: ClientHandle.cpp:3434
ContiguousByteBuffer
std::basic_string< std::byte > ContiguousByteBuffer
Definition: Globals.h:372
cClientHandle::s_ClientCount
static int s_ClientCount
Definition: ClientHandle.h:543
cClientHandle::SendWeather
void SendWeather(eWeather a_Weather)
Definition: ClientHandle.cpp:3234
cClientHandle::HandleBlockDigFinished
void HandleBlockDigFinished(Vector3i a_BlockPos, eBlockFace a_BlockFace)
Handles the DIG_FINISHED dig packet:
Definition: ClientHandle.cpp:1308
cClientHandle::IsWithinReach
bool IsWithinReach(Vector3i a_Position) const
Returns whether the player could in fact reach the position they're attempting to interact with.
Definition: ClientHandle.cpp:2094
cClientHandle::RegisterPluginChannels
void RegisterPluginChannels(const AStringVector &a_ChannelList)
Adds all of the channels to the list of current plugin channels.
Definition: ClientHandle.cpp:966
AStringMap
std::map< AString, AString > AStringMap
A string dictionary, used for key-value pairs.
Definition: StringUtils.h:16
cClientHandle::m_UniqueID
int m_UniqueID
ID used for identification during authenticating.
Definition: ClientHandle.h:548
cClientHandle::SendAttachEntity
void SendAttachEntity(const cEntity &a_Entity, const cEntity &a_Vehicle)
Definition: ClientHandle.cpp:2236
cClientHandle::m_LastStreamedChunkZ
int m_LastStreamedChunkZ
Definition: ClientHandle.h:492
cClientHandle::SendBlockChanges
void SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockVector &a_Changes)
Definition: ClientHandle.cpp:2298
cClientHandle::SendChatSystem
void SendChatSystem(const AString &a_Message, eMessageType a_ChatPrefix, const AString &a_AdditionalData="")
Definition: ClientHandle.cpp:2468
cMultiVersionProtocol
Meta-protocol that recognizes multiple protocol versions, creates the specific protocol version insta...
Definition: ProtocolRecognizer.h:20
cClientHandle::m_State
std::atomic< eState > m_State
The current (networking) state of the client.
Definition: ClientHandle.h:535
UUID.h
cWindow
Represents a UI window.
Definition: Window.h:53
StatisticsManager
Class that manages the statistics and achievements of a single player.
Definition: StatisticsManager.h:32
cClientHandle::SendPlayerAbilities
void SendPlayerAbilities(void)
Definition: ClientHandle.cpp:2795
cClientHandle::SendLeashEntity
void SendLeashEntity(const cEntity &a_Entity, const cEntity &a_EntityLeashedTo)
Definition: ClientHandle.cpp:2245
cClientHandle::SendCollectEntity
void SendCollectEntity(const cEntity &a_Collected, const cEntity &a_Collector, unsigned a_Count)
Definition: ClientHandle.cpp:2541
cClientHandle::m_LoadedChunks
std::unordered_set< cChunkCoords, cChunkCoordsHash > m_LoadedChunks
Definition: ClientHandle.h:452
EffectID.h
cClientHandle::m_HasSentPlayerChunk
bool m_HasSentPlayerChunk
Set to true when the chunk where the player is is sent to the client.
Definition: ClientHandle.h:554
cClientHandle::m_CSOutgoingData
cCriticalSection m_CSOutgoingData
Protects m_OutgoingData against multithreaded access.
Definition: ClientHandle.h:466
cClientHandle::HandleBeaconSelection
void HandleBeaconSelection(unsigned a_PrimaryEffect, unsigned a_SecondaryEffect)
Called when the protocol receives a MC|Beacon plugin message, indicating that the player set an effec...
Definition: ClientHandle.cpp:990
cChunkCoordsList
std::list< cChunkCoords > cChunkCoordsList
Definition: ChunkDef.h:426
cClientHandle::SendTimeUpdate
void SendTimeUpdate(cTickTimeLong a_WorldAge, cTickTimeLong a_WorldDate, bool a_DoDaylightCycle)
Definition: ClientHandle.cpp:3146
cClientHandle::s_IllegalPosition
static Vector3i s_IllegalPosition
Definition: ClientHandle.h:545
cClientHandle::SendPlayerPosition
void SendPlayerPosition(void)
Definition: ClientHandle.cpp:2890
cClientHandle::SocketClosed
void SocketClosed(void)
Called when the network socket has been closed.
Definition: ClientHandle.cpp:3395
cForgeHandshake::IsForgeClient
bool IsForgeClient
True if the client advertised itself as a Forge client.
Definition: ForgeHandshake.h:28
cClientHandle::IsPlayerChunkSent
bool IsPlayerChunkSent()
Definition: ClientHandle.cpp:2068
cClientHandle::DEFAULT_VIEW_DISTANCE
static const int DEFAULT_VIEW_DISTANCE
Definition: ClientHandle.h:57
cClientHandle::PacketUnknown
void PacketUnknown(UInt32 a_PacketType)
Definition: ClientHandle.cpp:3372
cClientHandle::SetUUID
void SetUUID(const cUUID &a_UUID)
Sets the player's UUID, as used by the protocol.
Definition: ClientHandle.h:86
cClientHandle::HandleTabCompletion
void HandleTabCompletion(const AString &a_Text)
Definition: ClientHandle.cpp:1996
cClientHandle::OnError
virtual void OnError(int a_ErrorCode, const AString &a_ErrorMsg) override
Called when an error is detected on the connection.
Definition: ClientHandle.cpp:3471
cClientHandle::HandleRightClick
void HandleRightClick(Vector3i a_BlockPos, eBlockFace a_BlockFace, Vector3i a_Cursor, bool a_UsedMainHand)
Definition: ClientHandle.cpp:1408
cTCPLinkPtr
std::shared_ptr< cTCPLink > cTCPLinkPtr
Definition: Network.h:25
cClientHandle::SendEntityAnimation
void SendEntityAnimation(const cEntity &a_Entity, EntityAnimation a_Animation)
Definition: ClientHandle.cpp:2786
cClientHandle::SendPlayerListUpdatePing
void SendPlayerListUpdatePing()
Definition: ClientHandle.cpp:2849
ChunkSender.h
cClientHandle::OnRemoteClosed
virtual void OnRemoteClosed(void) override
Called when the remote end closes the connection.
Definition: ClientHandle.cpp:3457
cClientHandle::m_NumExplosionsThisTick
int m_NumExplosionsThisTick
Number of explosions sent this tick.
Definition: ClientHandle.h:538
cClientHandle::HandleChat
void HandleChat(const AString &a_Message)
Called when the protocol detects a chat packet.
Definition: ClientHandle.cpp:1524
cClientHandle::HandleRespawn
void HandleRespawn(void)
Definition: ClientHandle.cpp:1900
cClientHandle::SendEntityLook
void SendEntityLook(const cEntity &a_Entity)
Definition: ClientHandle.cpp:2620
UInt32
unsigned int UInt32
Definition: Globals.h:154
cClientHandle::HandleUseEntity
void HandleUseEntity(UInt32 a_TargetEntityID, bool a_IsLeftClick)
Definition: ClientHandle.cpp:1752
cClientHandle::SendPlayerListAddPlayer
void SendPlayerListAddPlayer(const cPlayer &a_Player)
Definition: ClientHandle.cpp:2804
cClientHandle::SendChunkData
void SendChunkData(int a_ChunkX, int a_ChunkZ, ContiguousByteBufferView a_ChunkData)
Definition: ClientHandle.cpp:2498
cClientHandle::SendTabCompletionResults
void SendTabCompletionResults(const AStringVector &a_Results)
Definition: ClientHandle.cpp:3119
ForgeHandshake.h
eChatType
eChatType
Definition: Defines.h:148
cClientHandle::GetRequestedViewDistance
int GetRequestedViewDistance(void) const
Returns the view distance that the player request, not the used view distance.
Definition: ClientHandle.h:265
cClientHandle::HandleSteerVehicle
void HandleSteerVehicle(float Forward, float Sideways)
Definition: ClientHandle.cpp:1696
cClientHandle::HandleResourcePack
void HandleResourcePack(UInt8 a_Status)
Definition: ClientHandle.cpp:1887
ASSERT
#define ASSERT(x)
Definition: Globals.h:273
cClientHandle::HandleUpdateSign
void HandleUpdateSign(Vector3i a_BlockPos, const AString &a_Line1, const AString &a_Line2, const AString &a_Line3, const AString &a_Line4)
Definition: ClientHandle.cpp:1735
cClientHandle::BungeeAuthenticate
bool BungeeAuthenticate()
Authenticates the specified user with the bungee proxy server.
Definition: ClientHandle.cpp:317
cClientHandle::SendWholeInventory
void SendWholeInventory(const cWindow &a_Window)
Definition: ClientHandle.cpp:3243
cClientHandle::ForgeAugmentServerListPing
void ForgeAugmentServerListPing(Json::Value &a_Response)
Add the Forge mod list to the server ping response.
Definition: ClientHandle.h:290
cClientHandle::ServerTick
void ServerTick(float a_Dt)
Called while the client is being ticked from the cServer object.
Definition: ClientHandle.cpp:2220
NIBBLETYPE
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:44
cClientHandle::SendBlockBreakAnim
void SendBlockBreakAnim(UInt32 a_EntityID, Vector3i a_BlockPos, char a_Stage)
Definition: ClientHandle.cpp:2272
Scoreboard.h
cClientHandle::m_Password
AString m_Password
Definition: ClientHandle.h:448
cClientHandle::ProcessProtocolOut
void ProcessProtocolOut()
Flushes all buffered outgoing data to the network.
Definition: ClientHandle.cpp:275
cClientHandle::StreamChunk
void StreamChunk(int a_ChunkX, int a_ChunkZ, cChunkSender::Priority a_Priority)
Adds a single chunk to be streamed to the client; used by StreamChunks()
Definition: ClientHandle.cpp:674
eGameMode
eGameMode
Definition: Defines.h:124
cClientHandle::m_IPString
AString m_IPString
Definition: ClientHandle.h:445
cClientHandle::SendSetRawSubTitle
void SendSetRawSubTitle(const AString &a_SubTitle)
Definition: ClientHandle.cpp:3037
cExpOrb
Definition: ExpOrb.h:11
cClientHandle::SendEntityProperties
void SendEntityProperties(const cEntity &a_Entity)
Definition: ClientHandle.cpp:2649
cClientHandle::SendHealth
void SendHealth(void)
Definition: ClientHandle.cpp:2714
cClientHandle::MIN_VIEW_DISTANCE
static const int MIN_VIEW_DISTANCE
Definition: ClientHandle.h:60
cClientHandle::SendSetRawTitle
void SendSetRawTitle(const AString &a_Title)
Definition: ClientHandle.cpp:3055
cClientHandle::GetPlayer
cPlayer * GetPlayer(void)
Definition: ClientHandle.h:78
cClientHandle::SendTitleTimes
void SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks)
Definition: ClientHandle.cpp:3137
cClientHandle::IsDestroyed
bool IsDestroyed(void) const
Definition: ClientHandle.h:148
cClientHandle::SendBossBarUpdateHealth
void SendBossBarUpdateHealth(UInt32 a_UniqueID, float a_FractionFilled)
Definition: ClientHandle.cpp:2371
cClientHandle::SendPlayerListRemovePlayer
void SendPlayerListRemovePlayer(const cPlayer &a_Player)
Definition: ClientHandle.cpp:2822
cClientHandle::Destroy
void Destroy(void)
Definition: ClientHandle.cpp:121
cClientHandle::GetUUID
const cUUID & GetUUID(void) const
Returns the player's UUID, as used by the protocol.
Definition: ClientHandle.h:81
cPainting
Definition: Painting.h:11
cClientHandle::SendBossBarUpdateStyle
void SendBossBarUpdateStyle(UInt32 a_UniqueID, BossBarColor a_Color, BossBarDivisionType a_DivisionType)
Definition: ClientHandle.cpp:2344
cClientHandle::GetClientBrand
const AString & GetClientBrand(void) const
Returns the client brand received in the MC|Brand plugin message or set by a plugin.
Definition: ClientHandle.h:279
cClientHandle::SendEntityEquipment
void SendEntityEquipment(const cEntity &a_Entity, short a_SlotNum, const cItem &a_Item)
Definition: ClientHandle.cpp:2600
cClientHandle::HandleSprint
void HandleSprint(bool a_IsSprinting)
Handles a player sprinting or slowing back down.
Definition: ClientHandle.cpp:1678
cClientHandle::HandleEnchantItem
void HandleEnchantItem(UInt8 a_WindowID, UInt8 a_Enchantment)
Called when the player enchants an Item in the Enchanting table UI.
Definition: ClientHandle.cpp:816
cObjective::Score
int Score
Definition: Scoreboard.h:35
cForgeHandshake::AugmentServerListPing
void AugmentServerListPing(cClientHandle &a_Client, Json::Value &ResponseValue)
Add the registered Forge mods to the server ping list packet.
Definition: ForgeHandshake.cpp:67
cClientHandle::m_CurrentViewDistance
int m_CurrentViewDistance
The actual view distance used, the minimum of client's requested view distance and world's max view d...
Definition: ClientHandle.h:440
cClientHandle::SendSoundEffect
void SendSoundEffect(const AString &a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch)
Definition: ClientHandle.cpp:3064
cClientHandle::SetUsername
void SetUsername(AString &&a_Username)
Definition: ClientHandle.cpp:3288
cClientHandle::SendBossBarRemove
void SendBossBarRemove(UInt32 a_UniqueID)
Definition: ClientHandle.cpp:2362
cClientHandle::SendHideTitle
void SendHideTitle(void)
Definition: ClientHandle.cpp:2732
cClientHandle::SendScoreboardObjective
void SendScoreboardObjective(const AString &a_Name, const AString &a_DisplayName, Byte a_Mode)
Definition: ClientHandle.cpp:3001
cClientHandle::HandleCommandBlockBlockChange
void HandleCommandBlockBlockChange(Vector3i a_BlockPos, const AString &a_NewCommand)
Called when the protocol receives a message, indicating that the player set a new command in the comm...
Definition: ClientHandle.cpp:1039
cClientHandle::HandlePluginMessage
void HandlePluginMessage(const AString &a_Channel, ContiguousByteBufferView a_Message)
Definition: ClientHandle.cpp:899
cClientHandle::GetProtocolVersion
UInt32 GetProtocolVersion(void) const
Returns the protocol version number of the protocol that the client is talking.
Definition: ClientHandle.h:422
cClientHandle::SendEntityPosition
void SendEntityPosition(const cEntity &a_Entity)
Definition: ClientHandle.cpp:2640
cClientHandle::PacketBufferFull
void PacketBufferFull(void)
Definition: ClientHandle.cpp:3361
cClientHandle::SendPaintingSpawn
void SendPaintingSpawn(const cPainting &a_Painting)
Definition: ClientHandle.cpp:2777
BossBarDivisionType
BossBarDivisionType
Definition: Defines.h:441
cClientHandle::SetLocale
void SetLocale(const AString &a_Locale)
Definition: ClientHandle.h:267
cClientHandle::HandleUseItem
void HandleUseItem(bool a_UsedMainHand)
Definition: ClientHandle.cpp:1823
cClientHandle::HandleCrouch
void HandleCrouch(bool a_IsCrouching)
Handles a player sneaking or unsneaking.
Definition: ClientHandle.cpp:807
cClientHandle::IsPlaying
bool IsPlaying(void) const
Definition: ClientHandle.h:147
cClientHandle::SendDisconnect
void SendDisconnect(const AString &a_Reason)
Definition: ClientHandle.cpp:2568
cClientHandle::m_ChunksToSend
std::unordered_set< cChunkCoords, cChunkCoordsHash > m_ChunksToSend
Definition: ClientHandle.h:453
cClientHandle::BreakApartPluginChannels
AStringVector BreakApartPluginChannels(ContiguousByteBufferView a_PluginChannels)
Converts the protocol-formatted channel list (NUL-separated) into a proper string vector.
Definition: ClientHandle.cpp:934
cClientHandle::SendHeldItemChange
void SendHeldItemChange(int a_ItemIndex)
Definition: ClientHandle.cpp:2723
cClientHandle::SendPlayerListUpdateGameMode
void SendPlayerListUpdateGameMode(const cPlayer &a_Player)
Definition: ClientHandle.cpp:2840
cClientHandle::m_SentChunks
cChunkCoordsList m_SentChunks
Definition: ClientHandle.h:454
cClientHandle::SendPlayerPermissionLevel
void SendPlayerPermissionLevel(void)
Definition: ClientHandle.cpp:2881
cClientHandle::m_UUID
cUUID m_UUID
Contains the UUID used by Mojang to identify the player's account.
Definition: ClientHandle.h:551
cClientHandle::HandleLeftClick
void HandleLeftClick(Vector3i a_BlockPos, eBlockFace a_BlockFace, UInt8 a_Status)
Definition: ClientHandle.cpp:1096
EntityAnimation
EntityAnimation
Definition: Defines.h:456
cClientHandle::SetProtocolVersion
void SetProtocolVersion(UInt32 a_ProtocolVersion)
Called by the protocol recognizer when the protocol version is known.
Definition: ClientHandle.h:419
cClientHandle::SendResetTitle
void SendResetTitle(void)
Definition: ClientHandle.cpp:2945
cClientHandle::m_ClientBrand
AString m_ClientBrand
The brand identification of the client, as received in the MC|Brand plugin message or set from a plug...
Definition: ClientHandle.h:566
cMonster
Definition: Monster.h:16
cItem
Definition: Item.h:36
cClientHandle::HandleBlockDigStarted
void HandleBlockDigStarted(Vector3i a_BlockPos, eBlockFace a_BlockFace)
Handles the DIG_STARTED dig packet:
Definition: ClientHandle.cpp:1241
cClientHandle::CheckBlockInteractionsRate
bool CheckBlockInteractionsRate(void)
Returns true if the rate block interactions is within a reasonable limit (bot protection)
Definition: ClientHandle.cpp:2077
ContiguousByteBufferView
std::basic_string_view< std::byte > ContiguousByteBufferView
Definition: Globals.h:373
cClientHandle::m_CSChunkLists
cCriticalSection m_CSChunkLists
Definition: ClientHandle.h:451
cClientHandle::m_LastPlacedSign
Vector3i m_LastPlacedSign
The positions from the last sign that the player placed.
Definition: ClientHandle.h:560
cClientHandle::m_ForgeHandshake
cForgeHandshake m_ForgeHandshake
Forge handshake state machine.
Definition: ClientHandle.h:434
cClientHandle::m_HasStartedDigging
bool m_HasStartedDigging
Definition: ClientHandle.h:515
cUUID::IsNil
bool IsNil() const
Returns true if this contains the "nil" UUID with all bits set to 0.
Definition: UUID.h:30
eWeather
eWeather
Definition: Defines.h:159
cClientHandle::HandleUnmount
void HandleUnmount(void)
Definition: ClientHandle.cpp:1987
cClientHandle::SendPluginMessage
void SendPluginMessage(const AString &a_Channel, std::string_view a_Message)
Definition: ClientHandle.cpp:2918
cChunkDataSerializer
Serializes one chunk's data to (possibly multiple) protocol versions.
Definition: ChunkDataSerializer.h:22
cTCPLink::cCallbacks
Definition: Network.h:46
cClientHandle::SendPlayerListHeaderFooter
void SendPlayerListHeaderFooter(const cCompositeChat &a_Header, const cCompositeChat &a_Footer)
Definition: ClientHandle.cpp:2813
cClientHandle::m_PluginChannels
cChannels m_PluginChannels
The plugin channels that the client has registered.
Definition: ClientHandle.h:563
cClientHandle::SetViewDistance
void SetViewDistance(int a_ViewDistance)
Sets the maximal view distance.
Definition: ClientHandle.cpp:3297
cClientHandle::SendScoreUpdate
void SendScoreUpdate(const AString &a_Objective, const AString &a_Player, cObjective::Score a_Score, Byte a_Mode)
Definition: ClientHandle.cpp:3010
cClientHandle::SendEditSign
void SendEditSign(Vector3i a_BlockPos)
Definition: ClientHandle.cpp:2581
cClientHandle::m_LastStreamedChunkX
int m_LastStreamedChunkX
Definition: ClientHandle.h:491
cClientHandle::csConnected
@ csConnected
The client has just connected, waiting for their handshake / login.
Definition: ClientHandle.h:520
cClientHandle::cClientHandle
cClientHandle(const AString &a_IPString, int a_ViewDistance)
Creates a new client with the specified IP address in its description and the specified initial view ...
Definition: ClientHandle.cpp:71
cClientHandle::m_CSState
cCriticalSection m_CSState
Definition: ClientHandle.h:528
cClientHandle::SendDetachEntity
void SendDetachEntity(const cEntity &a_Entity, const cEntity &a_PreviousVehicle)
Definition: ClientHandle.cpp:2559
cClientHandle::csDestroyed
@ csDestroyed
The client has been destroyed, the destructor is to be called from the owner thread.
Definition: ClientHandle.h:524
cClientHandle::SendResourcePack
void SendResourcePack(const AString &a_ResourcePackUrl)
Definition: ClientHandle.cpp:2992
cProtocol
Definition: Protocol.h:40
cClientHandle::MAX_VIEW_DISTANCE
static const int MAX_VIEW_DISTANCE
Definition: ClientHandle.h:59
cClientHandle::m_Link
cTCPLinkPtr m_Link
The link that is used for network communication.
Definition: ClientHandle.h:573
cClientHandle::m_Ping
std::chrono::steady_clock::duration m_Ping
Duration of the last completed client ping.
Definition: ClientHandle.h:501
cClientHandle::m_BlockDigAnimPos
Vector3i m_BlockDigAnimPos
Definition: ClientHandle.h:512
cClientHandle::SendSetTitle
void SendSetTitle(const cCompositeChat &a_Title)
Definition: ClientHandle.cpp:3046
cClientHandle::SendRemoveEntityEffect
void SendRemoveEntityEffect(const cEntity &a_Entity, int a_EffectID)
Definition: ClientHandle.cpp:2936
cClientHandle::m_PingStartTime
std::chrono::steady_clock::time_point m_PingStartTime
Time of the last ping request sent to the client.
Definition: ClientHandle.h:507
cClientHandle::AddWantedChunk
void AddWantedChunk(int a_ChunkX, int a_ChunkZ)
Adds the chunk specified to the list of chunks wanted for sending (m_ChunksToSend)
Definition: ClientHandle.cpp:3342
cClientHandle::SendPlayerMoveLook
void SendPlayerMoveLook(void)
Definition: ClientHandle.cpp:2867
cClientHandle::SendSpawnEntity
void SendSpawnEntity(const cEntity &a_Entity)
Definition: ClientHandle.cpp:3092
cClientHandle::HandleLeaveBed
void HandleLeaveBed()
Handles a player exiting his bed.
Definition: ClientHandle.cpp:1977
Byte
unsigned char Byte
Definition: Globals.h:158
cClientHandle::m_OutgoingData
ContiguousByteBuffer m_OutgoingData
Buffer for storing outgoing data from any thread; will get sent in ProcessProtocolOut() at the end of...
Definition: ClientHandle.h:470
cClientHandle::SendExperience
void SendExperience(void)
Definition: ClientHandle.cpp:2974
Defines.h
cClientHandle::Kick
void Kick(const AString &a_Reason)
Definition: ClientHandle.cpp:304
cClientHandle::SendInventorySlot
void SendInventorySlot(char a_WindowID, short a_SlotNum, const cItem &a_Item)
Definition: ClientHandle.cpp:2741
cClientHandle::HandlePlayerLook
void HandlePlayerLook(float a_Rotation, float a_Pitch, bool a_IsOnGround)
Definition: ClientHandle.cpp:1571
BLOCKTYPE
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:41
cClientHandle::SetIsForgeClient
void SetIsForgeClient()
Mark a client connection as using Forge.
Definition: ClientHandle.h:296
cClientHandle::SendWindowOpen
void SendWindowOpen(const cWindow &a_Window)
Definition: ClientHandle.cpp:3261
cMap
Encapsulates an in-game world map.
Definition: Map.h:82
cClientHandle::SendDestroyEntity
void SendDestroyEntity(const cEntity &a_Entity)
Definition: ClientHandle.cpp:2550
eDimension
eDimension
Dimension of a world.
Definition: Defines.h:230
cClientHandle::SendEntityEffect
void SendEntityEffect(const cEntity &a_Entity, int a_EffectID, int a_Amplifier, int a_Duration)
Definition: ClientHandle.cpp:2591
cClientHandle::GenerateOfflineUUID
static cUUID GenerateOfflineUUID(const AString &a_Username)
Generates an UUID based on the player name provided.
Definition: ClientHandle.cpp:197
cForgeHandshake
Definition: ForgeHandshake.h:23
cClientHandle::SendUnleashEntity
void SendUnleashEntity(const cEntity &a_Entity)
Definition: ClientHandle.cpp:2254
cClientHandle::SendWindowProperty
void SendWindowProperty(const cWindow &a_Window, size_t a_Property, short a_Value)
Definition: ClientHandle.cpp:3270
cClientHandle::StreamNextChunks
void StreamNextChunks()
Sends a set number of new chunks to the player on every invocation, until all chunks in the view dist...
Definition: ClientHandle.cpp:501
cClientHandle::m_LastDigBlockPos
Vector3i m_LastDigBlockPos
Definition: ClientHandle.h:516
cClientHandle::HandleCommandBlockEntityChange
void HandleCommandBlockEntityChange(UInt32 a_EntityID, const AString &a_NewCommand)
Called when the protocol receives a message, indicating that the player set a new command in the comm...
Definition: ClientHandle.cpp:1069
cChunkSender::Priority
Priority
Tag indicating urgency of chunk to be sent.
Definition: ChunkSender.h:63
cClientHandle::m_TicksSinceLastPacket
std::atomic< int > m_TicksSinceLastPacket
Number of ticks since the last network packet was received (increased in Tick(), reset in OnReceivedD...
Definition: ClientHandle.h:495
cClientHandle::SendBossBarAdd
void SendBossBarAdd(UInt32 a_UniqueID, const cCompositeChat &a_Title, float a_FractionFilled, BossBarColor a_Color, BossBarDivisionType a_DivisionType, bool a_DarkenSky, bool a_PlayEndMusic, bool a_CreateFog)
Definition: ClientHandle.cpp:2326
cClientHandle::m_ProxyConnection
bool m_ProxyConnection
True if player connected from a proxy (Bungee / Velocity)
Definition: ClientHandle.h:486
cClientHandle::SetState
bool SetState(eState a_NewState)
Called to update m_State.
Definition: ClientHandle.cpp:3419
cClientHandle::SendBossBarUpdateTitle
void SendBossBarUpdateTitle(UInt32 a_UniqueID, const cCompositeChat &a_Title)
Definition: ClientHandle.cpp:2353
eBlockFace
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc.
Definition: Defines.h:37
cCriticalSection
Definition: CriticalSection.h:8
cClientHandle::HandleKeepAlive
void HandleKeepAlive(UInt32 a_KeepAliveID)
Definition: ClientHandle.cpp:1916
cClientHandle::HandlePlayerMove
void HandlePlayerMove(Vector3d a_Pos, bool a_IsOnGround)
Verifies and sets player position, performing relevant checks.
Definition: ClientHandle.cpp:1583
cClientHandle::GetViewDistance
int GetViewDistance(void) const
Returns the view distance that the player currently have.
Definition: ClientHandle.h:262
cClientHandle::GetUsername
const AString & GetUsername(void) const
Definition: ClientHandle.cpp:3279
cClientHandle::HandlePlayerMoveLook
void HandlePlayerMoveLook(Vector3d a_Pos, float a_Rotation, float a_Pitch, bool a_IsOnGround)
Definition: ClientHandle.cpp:1639
cEntity
Definition: Entity.h:75
cClientHandle::SendPlayerSpawn
void SendPlayerSpawn(const cPlayer &a_Player)
Definition: ClientHandle.cpp:2899
cChunkCoords
Definition: ChunkDef.h:55
cClientHandle::IsLoggedIn
bool IsLoggedIn(void) const
Definition: ClientHandle.h:137
cClientHandle::SendParticleEffect
void SendParticleEffect(const AString &a_ParticleName, Vector3f a_Source, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount)
Definition: ClientHandle.cpp:2759
cPlayer
Definition: Player.h:27
cClientHandle::SendEntityHeadLook
void SendEntityHeadLook(const cEntity &a_Entity)
Definition: ClientHandle.cpp:2609
cClientHandle::m_BreakProgress
float m_BreakProgress
The fraction between 0 and 1 (or above), of how far through mining the currently mined block is.
Definition: ClientHandle.h:577
cClientHandle::SetClientBrand
void SetClientBrand(const AString &a_ClientBrand)
Called by the protocol when it receives the MC|Brand plugin message.
Definition: ClientHandle.h:276
cClientHandle::SendSetSubTitle
void SendSetSubTitle(const cCompositeChat &a_SubTitle)
Definition: ClientHandle.cpp:3028
cClientHandle::HasPluginChannel
bool HasPluginChannel(const AString &a_PluginChannel)
Definition: ClientHandle.cpp:3318
cClientHandle::Authenticate
void Authenticate(AString &&a_Name, const cUUID &a_UUID, Json::Value &&a_Properties)
Authenticates ourselves, called by cAuthenticator supplying player details from Mojang.
Definition: ClientHandle.cpp:365
cClientHandle::SendChatRaw
void SendChatRaw(const AString &a_MessageRaw, eChatType a_Type)
Definition: ClientHandle.cpp:2430
cClientHandle::SendSoundParticleEffect
void SendSoundParticleEffect(const EffectID a_EffectID, Vector3i a_Source, int a_Data)
Definition: ClientHandle.cpp:3083
cClientHandle::SetIPString
void SetIPString(const AString &a_IPString)
Sets the IP string that the client is using.
Definition: ClientHandle.h:76
cTickTimeLong
std::chrono::duration< signed long long int, cTickTime::period > cTickTimeLong
Definition: Globals.h:364
cClientHandle::SetProperties
void SetProperties(const Json::Value &a_Properties)
Sets the player's properties, such as skin image and signature.
Definition: ClientHandle.h:93
cClientHandle::CheckMultiLogin
bool CheckMultiLogin(const AString &a_Username)
Kicks the client if the same username is already logged in.
Definition: ClientHandle.cpp:1928
cClientHandle::HandlePlayerAbilities
void HandlePlayerAbilities(bool a_IsFlying, float FlyingSpeed, float WalkingSpeed)
Definition: ClientHandle.cpp:887
cClientHandle::HandleLogin
bool HandleLogin()
Called when the protocol has finished logging the user in.
Definition: ClientHandle.cpp:751
cClientHandle::HandleOpenHorseInventory
void HandleOpenHorseInventory()
Handles a player opening his inventory while riding a horse.
Definition: ClientHandle.cpp:719
cClientHandle::SendBlockChange
void SendBlockChange(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Definition: ClientHandle.cpp:2281
cClientHandle::cChannels
std::set< AString > cChannels
The type used for storing the names of registered plugin channels.
Definition: ClientHandle.h:431
cClientHandle::m_Player
cPlayer * m_Player
A pointer to a World-owned player object, created in FinishAuthenticate when authentication succeeds.
Definition: ClientHandle.h:477
cFallingBlock
Definition: FallingBlock.h:11
cClientHandle::GetLocale
AString GetLocale(void) const
Definition: ClientHandle.h:268
cClientHandle::SendMapData
void SendMapData(const cMap &a_Map, int a_DataStartX, int a_DataStartY)
Definition: ClientHandle.cpp:2750
cClientHandle::SendDisplayObjective
void SendDisplayObjective(const AString &a_Objective, cScoreboard::eDisplaySlot a_Display)
Definition: ClientHandle.cpp:3019
cClientHandle::UnloadOutOfRangeChunks
void UnloadOutOfRangeChunks(void)
Remove all loaded chunks that are no longer in range.
Definition: ClientHandle.cpp:625
UInt8
unsigned char UInt8
Definition: Globals.h:156
cClientHandle::GetForgeMods
const AStringMap & GetForgeMods(void) const
Returns the Forge mods installed on the client.
Definition: ClientHandle.h:282
cClientHandle::SendBossBarUpdateFlags
void SendBossBarUpdateFlags(UInt32 a_UniqueID, bool a_DarkenSky, bool a_PlayEndMusic, bool a_CreateFog)
Definition: ClientHandle.cpp:2335
cClientHandle::m_CachedSentChunk
cChunkCoords m_CachedSentChunk
This is an optimization which saves you an iteration of m_SentChunks if you just want to know whether...
Definition: ClientHandle.h:484
eMessageType
eMessageType
Definition: Defines.h:350
cClientHandle::FormatChatPrefix
static AString FormatChatPrefix(bool ShouldAppendChatPrefixes, const AString &a_ChatPrefixS, const AString &m_Color1, const AString &m_Color2)
Definition: ClientHandle.cpp:145
cClientHandle::m_CSIncomingData
cCriticalSection m_CSIncomingData
Protects m_IncomingData against multithreaded access.
Definition: ClientHandle.h:459
cClientHandle::ProxyInit
void ProxyInit(const AString &a_IPString, const cUUID &a_UUID)
Function to mark bungee / proxy connection on this client, and to add proxy-related data.
Definition: ClientHandle.cpp:223
cClientHandle::SendUpdateBlockEntity
void SendUpdateBlockEntity(cBlockEntity &a_BlockEntity)
Definition: ClientHandle.cpp:3170
SlotArea.h
cClientHandle::FinishAuthenticate
void FinishAuthenticate()
Finish logging the user in after authenticating.
Definition: ClientHandle.cpp:415
EffectID
EffectID
Definition: EffectID.h:5
cClientHandle::PacketError
void PacketError(UInt32 a_PacketType)
Definition: ClientHandle.cpp:3385
cClientHandle::HandleSpectate
void HandleSpectate(const cUUID &a_PlayerUUID)
Definition: ClientHandle.cpp:1659
cClientHandle::FormatMessageType
static AString FormatMessageType(bool ShouldAppendChatPrefixes, eMessageType a_ChatPrefix, const AString &a_AdditionalData)
Formats the type of message with the proper color and prefix for sending to the client.
Definition: ClientHandle.cpp:164
cClientHandle::csAuthenticating
@ csAuthenticating
The client has logged in, waiting for external authentication.
Definition: ClientHandle.h:521
cClientHandle::m_TimeSinceLastUnloadCheck
std::chrono::milliseconds m_TimeSinceLastUnloadCheck
The time since UnloadOutOfRangeChunks was last called.
Definition: ClientHandle.h:498
cClientHandle::GetUniqueID
int GetUniqueID(void) const
Definition: ClientHandle.h:270
cClientHandle::m_IncomingData
ContiguousByteBuffer m_IncomingData
Queue for the incoming data received on the link until it is processed in ProcessProtocolIn().
Definition: ClientHandle.h:463
cClientHandle::eState
eState
Definition: ClientHandle.h:518
cClientHandle::SendUnlockRecipe
void SendUnlockRecipe(UInt32 a_RecipeId)
Send a newly discovered recipe to show the notification and unlock in the recipe book.
Definition: ClientHandle.cpp:3194
cClientHandle::GetProperties
const Json::Value & GetProperties(void) const
Definition: ClientHandle.h:88
cClientHandle::csPlaying
@ csPlaying
Normal gameplay.
Definition: ClientHandle.h:523
cClientHandle::HandlePing
void HandlePing(void)
Definition: ClientHandle.cpp:728
cClientHandle::~cClientHandle
virtual ~cClientHandle() override
Definition: ClientHandle.cpp:108
BossBarColor
BossBarColor
Definition: Defines.h:426
cClientHandle::SendThunderbolt
void SendThunderbolt(Vector3i a_BlockPos)
Definition: ClientHandle.cpp:3128
AString
std::string AString
Definition: StringUtils.h:11
cClientHandle::SendStatistics
void SendStatistics(const StatisticsManager &a_Manager)
Definition: ClientHandle.cpp:3110
Vector3
Definition: Vector3.h:10
cClientHandle::m_ProtocolVersion
UInt32 m_ProtocolVersion
The version of the protocol that the client is talking, or 0 if unknown.
Definition: ClientHandle.h:569
cClientHandle::IsForgeClient
bool IsForgeClient(void) const
Returns true if the client is modded with Forge.
Definition: ClientHandle.h:285
cClientHandle::SendExplosion
void SendExplosion(Vector3f a_Position, float a_Power)
Definition: ClientHandle.cpp:2667
cClientHandle::HandleWindowClose
void HandleWindowClose(UInt8 a_WindowID)
Definition: ClientHandle.cpp:1705
cClientHandle::ProcessProtocolIn
void ProcessProtocolIn(void)
Processes the data in the network input buffer.
Definition: ClientHandle.cpp:245
cClientHandle::WantsSendChunk
bool WantsSendChunk(int a_ChunkX, int a_ChunkZ)
Returns true if the client wants the chunk specified to be sent (in m_ChunksToSend)
Definition: ClientHandle.cpp:3327
cScoreboard::eDisplaySlot
eDisplaySlot
Definition: Scoreboard.h:203
cClientHandle::csDownloadingWorld
@ csDownloadingWorld
The client is waiting for chunks, we're waiting for the loader to provide and send them.
Definition: ClientHandle.h:522
cClientHandle::SendPlayerListUpdateDisplayName
void SendPlayerListUpdateDisplayName(const cPlayer &a_Player, const AString &a_CustomName)
Definition: ClientHandle.cpp:2831
cPickup
Definition: Pickup.h:18
cClientHandle::HandleWindowClick
void HandleWindowClick(UInt8 a_WindowID, Int16 a_SlotNum, eClickAction a_ClickAction, const cItem &a_HeldItem)
Definition: ClientHandle.cpp:1714
cClientHandle::HandleNPCTrade
void HandleNPCTrade(int a_SlotNum)
Called when the protocol receives a MC|TrSel packet, indicating that the player used a trade in the N...
Definition: ClientHandle.cpp:709
cClientHandle::HandleAnimation
void HandleAnimation(bool a_SwingMainHand)
Called when the protocol receives a (hand swing) animation packet.
Definition: ClientHandle.cpp:694
cClientHandle::SendRespawn
void SendRespawn(eDimension a_Dimension, bool a_IsRespawningFromDeath)
Definition: ClientHandle.cpp:2954
cClientHandle::SendBlockAction
void SendBlockAction(Vector3i a_BlockPos, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType)
Definition: ClientHandle.cpp:2263
cClientHandle::m_RequestedViewDistance
int m_RequestedViewDistance
The requested view distance from the player.
Definition: ClientHandle.h:443
cClientHandle::m_BlockDigAnimSpeed
int m_BlockDigAnimSpeed
Definition: ClientHandle.h:511
cClientHandle::HandleAnvilItemName
void HandleAnvilItemName(const AString &a_ItemName)
Called when the protocol receives a MC|ItemName plugin message, indicating that the player named an i...
Definition: ClientHandle.cpp:1079
cBlockEntity
Definition: BlockEntity.h:24
cClientHandle::SendChat
void SendChat(const AString &a_Message, eMessageType a_ChatPrefix, const AString &a_AdditionalData="")
Definition: ClientHandle.cpp:2389
cClientHandle::SendUpdateSign
void SendUpdateSign(Vector3i a_BlockPos, const AString &a_Line1, const AString &a_Line2, const AString &a_Line3, const AString &a_Line4)
Definition: ClientHandle.cpp:3179
Int16
signed short Int16
Definition: Globals.h:150
cClientHandle::IsUUIDOnline
static bool IsUUIDOnline(const cUUID &a_UUID)
Returns true if the UUID is generated by online auth, false if it is an offline-generated UUID.
Definition: ClientHandle.cpp:211
cClientHandle::SendSpawnMob
void SendSpawnMob(const cMonster &a_Mob)
Definition: ClientHandle.cpp:3101
cClientHandle::HandleStartElytraFlight
void HandleStartElytraFlight()
Handles a player starting elytra flight while falling.
Definition: ClientHandle.cpp:1687
cClientHandle::SendChatAboveActionBar
void SendChatAboveActionBar(const AString &a_Message, eMessageType a_ChatPrefix, const AString &a_AdditionalData="")
Definition: ClientHandle.cpp:2439
cClientHandle::UnregisterPluginChannels
void UnregisterPluginChannels(const AStringVector &a_ChannelList)
Removes all of the channels from the list of current plugin channels.
Definition: ClientHandle.cpp:978
cClientHandle::m_PingID
UInt32 m_PingID
ID of the last ping request sent to the client.
Definition: ClientHandle.h:504
cClientHandle::FinishDigAnimation
void FinishDigAnimation()
The clients will receive a finished dig animation.
Definition: ClientHandle.cpp:1385
cClientHandle::m_HasSentDC
bool m_HasSentDC
True if a Disconnect packet has been sent in either direction.
Definition: ClientHandle.h:488
cClientHandle::SendExperienceOrb
void SendExperienceOrb(const cExpOrb &a_ExpOrb)
Definition: ClientHandle.cpp:2983
AStringVector
std::vector< AString > AStringVector
Definition: StringUtils.h:12
cClientHandle::m_BlockDigAnimStage
int m_BlockDigAnimStage
Definition: ClientHandle.h:510
Network.h
cClientHandle::SendWindowClose
void SendWindowClose(const cWindow &a_Window)
Definition: ClientHandle.cpp:3252