Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
cClientHandle Class Reference

#include <ClientHandle.h>

Inheritance diagram for cClientHandle:
Inheritance graph
[legend]
Collaboration diagram for cClientHandle:
Collaboration graph
[legend]

Public Member Functions

void AddWantedChunk (int a_ChunkX, int a_ChunkZ)
 Adds the chunk specified to the list of chunks wanted for sending (m_ChunksToSend) More...
 
void Authenticate (AString &&a_Name, const cUUID &a_UUID, Json::Value &&a_Properties)
 Authenticates ourselves, called by cAuthenticator supplying player details from Mojang. More...
 
bool BungeeAuthenticate ()
 Authenticates the specified user with the bungee proxy server. More...
 
 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 distance. More...
 
bool CheckMultiLogin (const AString &a_Username)
 Kicks the client if the same username is already logged in. More...
 
void Destroy (void)
 
void ForgeAugmentServerListPing (Json::Value &a_Response)
 Add the Forge mod list to the server ping response. More...
 
const AStringGetClientBrand (void) const
 Returns the client brand received in the MC|Brand plugin message or set by a plugin. More...
 
const AStringMapGetForgeMods (void) const
 Returns the Forge mods installed on the client. More...
 
const AStringGetIPString (void) const
 
AString GetLocale (void) const
 
short GetPing (void) const
 
cPlayerGetPlayer (void)
 
const Json::Value & GetProperties (void) const
 
UInt32 GetProtocolVersion (void) const
 Returns the protocol version number of the protocol that the client is talking. More...
 
int GetRequestedViewDistance (void) const
 Returns the view distance that the player request, not the used view distance. More...
 
int GetUniqueID (void) const
 
const AStringGetUsername (void) const
 
const cUUIDGetUUID (void) const
 Returns the player's UUID, as used by the protocol. More...
 
int GetViewDistance (void) const
 Returns the view distance that the player currently have. More...
 
void HandleAnimation (bool a_SwingMainHand)
 Called when the protocol receives a (hand swing) animation packet. More...
 
void HandleAnvilItemName (const AString &a_ItemName)
 Called when the protocol receives a MC|ItemName plugin message, indicating that the player named an item in the anvil UI. More...
 
void HandleBeaconSelection (unsigned a_PrimaryEffect, unsigned a_SecondaryEffect)
 Called when the protocol receives a MC|Beacon plugin message, indicating that the player set an effect in the beacon UI. More...
 
void HandleChat (const AString &a_Message)
 Called when the protocol detects a chat packet. More...
 
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 command block UI, for a block-based commandblock. More...
 
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 command block UI, for an entity-based commandblock (minecart?). More...
 
void HandleCraftRecipe (UInt32 a_RecipeId)
 Called when a recipe from the recipe book is selected. More...
 
void HandleCreativeInventory (Int16 a_SlotNum, const cItem &a_HeldItem, eClickAction a_ClickAction)
 Called when the client clicks the creative inventory window. More...
 
void HandleCrouch (bool a_IsCrouching)
 Handles a player sneaking or unsneaking. More...
 
void HandleEnchantItem (UInt8 a_WindowID, UInt8 a_Enchantment)
 Called when the player enchants an Item in the Enchanting table UI. More...
 
bool HandleHandshake (const AString &a_Username)
 Called when the protocol handshake has been received (for protocol versions that support it; otherwise the first instant when a username is received). More...
 
void HandleKeepAlive (UInt32 a_KeepAliveID)
 
void HandleLeaveBed ()
 Handles a player exiting his bed. More...
 
void HandleLeftClick (Vector3i a_BlockPos, eBlockFace a_BlockFace, UInt8 a_Status)
 
bool HandleLogin ()
 Called when the protocol has finished logging the user in. More...
 
void HandleNPCTrade (int a_SlotNum)
 Called when the protocol receives a MC|TrSel packet, indicating that the player used a trade in the NPC UI. More...
 
void HandleOpenHorseInventory ()
 Handles a player opening his inventory while riding a horse. More...
 
void HandlePing (void)
 
void HandlePlayerAbilities (bool a_IsFlying, float FlyingSpeed, float WalkingSpeed)
 
void HandlePlayerLook (float a_Rotation, float a_Pitch, bool a_IsOnGround)
 
void HandlePlayerMove (Vector3d a_Pos, bool a_IsOnGround)
 Verifies and sets player position, performing relevant checks. More...
 
void HandlePlayerMoveLook (Vector3d a_Pos, float a_Rotation, float a_Pitch, bool a_IsOnGround)
 
void HandlePluginMessage (const AString &a_Channel, ContiguousByteBufferView a_Message)
 
void HandleResourcePack (UInt8 a_Status)
 
void HandleRespawn (void)
 
void HandleRightClick (Vector3i a_BlockPos, eBlockFace a_BlockFace, Vector3i a_Cursor, bool a_UsedMainHand)
 
void HandleSlotSelected (Int16 a_SlotNum)
 
void HandleSpectate (const cUUID &a_PlayerUUID)
 
void HandleSprint (bool a_IsSprinting)
 Handles a player sprinting or slowing back down. More...
 
void HandleStartElytraFlight ()
 Handles a player starting elytra flight while falling. More...
 
void HandleSteerVehicle (float Forward, float Sideways)
 
void HandleTabCompletion (const AString &a_Text)
 
void HandleUnmount (void)
 
void HandleUpdateSign (Vector3i a_BlockPos, const AString &a_Line1, const AString &a_Line2, const AString &a_Line3, const AString &a_Line4)
 
void HandleUseEntity (UInt32 a_TargetEntityID, bool a_IsLeftClick)
 
void HandleUseItem (bool a_UsedMainHand)
 
void HandleWindowClick (UInt8 a_WindowID, Int16 a_SlotNum, eClickAction a_ClickAction, const cItem &a_HeldItem)
 
void HandleWindowClose (UInt8 a_WindowID)
 
bool HasPluginChannel (const AString &a_PluginChannel)
 
bool IsDestroyed (void) const
 
bool IsForgeClient (void) const
 Returns true if the client is modded with Forge. More...
 
bool IsLoggedIn (void) const
 
bool IsPlayerChunkSent ()
 
bool IsPlaying (void) const
 
void Kick (const AString &a_Reason)
 
void PacketBufferFull (void)
 
void PacketError (UInt32 a_PacketType)
 
void PacketUnknown (UInt32 a_PacketType)
 
void ProcessProtocolIn (void)
 Processes the data in the network input buffer. More...
 
void ProcessProtocolOut ()
 Flushes all buffered outgoing data to the network. More...
 
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. More...
 
void ProxyInit (const AString &a_IPString, const cUUID &a_UUID, const Json::Value &a_Properties)
 
void RemoveFromWorld (void)
 Called when the player moves into a different world. More...
 
void SendAttachEntity (const cEntity &a_Entity, const cEntity &a_Vehicle)
 
void SendBlockAction (Vector3i a_BlockPos, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType)
 
void SendBlockBreakAnim (UInt32 a_EntityID, Vector3i a_BlockPos, char a_Stage)
 
void SendBlockChange (Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
 
void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector &a_Changes)
 
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)
 
void SendBossBarRemove (UInt32 a_UniqueID)
 
void SendBossBarUpdateFlags (UInt32 a_UniqueID, bool a_DarkenSky, bool a_PlayEndMusic, bool a_CreateFog)
 
void SendBossBarUpdateHealth (UInt32 a_UniqueID, float a_FractionFilled)
 
void SendBossBarUpdateStyle (UInt32 a_UniqueID, BossBarColor a_Color, BossBarDivisionType a_DivisionType)
 
void SendBossBarUpdateTitle (UInt32 a_UniqueID, const cCompositeChat &a_Title)
 
void SendCameraSetTo (const cEntity &a_Entity)
 
void SendChat (const AString &a_Message, eMessageType a_ChatPrefix, const AString &a_AdditionalData="")
 
void SendChat (const cCompositeChat &a_Message)
 
void SendChatAboveActionBar (const AString &a_Message, eMessageType a_ChatPrefix, const AString &a_AdditionalData="")
 
void SendChatAboveActionBar (const cCompositeChat &a_Message)
 
void SendChatRaw (const AString &a_MessageRaw, eChatType a_Type)
 
void SendChatSystem (const AString &a_Message, eMessageType a_ChatPrefix, const AString &a_AdditionalData="")
 
void SendChatSystem (const cCompositeChat &a_Message)
 
void SendChunkData (int a_ChunkX, int a_ChunkZ, ContiguousByteBufferView a_ChunkData)
 
void SendCollectEntity (const cEntity &a_Collected, const cEntity &a_Collector, unsigned a_Count)
 
void SendData (ContiguousByteBufferView a_Data)
 
void SendDestroyEntity (const cEntity &a_Entity)
 
void SendDetachEntity (const cEntity &a_Entity, const cEntity &a_PreviousVehicle)
 
void SendDisconnect (const AString &a_Reason)
 
void SendDisplayObjective (const AString &a_Objective, cScoreboard::eDisplaySlot a_Display)
 
void SendEditSign (Vector3i a_BlockPos)
 
void SendEntityAnimation (const cEntity &a_Entity, EntityAnimation a_Animation)
 
void SendEntityEffect (const cEntity &a_Entity, int a_EffectID, int a_Amplifier, int a_Duration)
 
void SendEntityEquipment (const cEntity &a_Entity, short a_SlotNum, const cItem &a_Item)
 
void SendEntityHeadLook (const cEntity &a_Entity)
 
void SendEntityLook (const cEntity &a_Entity)
 
void SendEntityMetadata (const cEntity &a_Entity)
 
void SendEntityPosition (const cEntity &a_Entity)
 
void SendEntityProperties (const cEntity &a_Entity)
 
void SendEntityVelocity (const cEntity &a_Entity)
 
void SendExperience (void)
 
void SendExperienceOrb (const cExpOrb &a_ExpOrb)
 
void SendExplosion (Vector3f a_Position, float a_Power)
 
void SendGameMode (eGameMode a_GameMode)
 
void SendHealth (void)
 
void SendHeldItemChange (int a_ItemIndex)
 
void SendHideTitle (void)
 
void SendInitRecipes (UInt32 a_RecipeId)
 Send already known recipes without notification but visible in the recipe book. More...
 
void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem &a_Item)
 
void SendLeashEntity (const cEntity &a_Entity, const cEntity &a_EntityLeashedTo)
 
void SendMapData (const cMap &a_Map, int a_DataStartX, int a_DataStartY)
 
void SendPaintingSpawn (const cPainting &a_Painting)
 
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)
 
void SendParticleEffect (const AString &a_ParticleName, Vector3f a_Source, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount)
 
void SendPlayerAbilities (void)
 
void SendPlayerListAddPlayer (const cPlayer &a_Player)
 
void SendPlayerListHeaderFooter (const cCompositeChat &a_Header, const cCompositeChat &a_Footer)
 
void SendPlayerListRemovePlayer (const cPlayer &a_Player)
 
void SendPlayerListUpdateDisplayName (const cPlayer &a_Player, const AString &a_CustomName)
 
void SendPlayerListUpdateGameMode (const cPlayer &a_Player)
 
void SendPlayerListUpdatePing ()
 
void SendPlayerMoveLook (Vector3d a_Pos, float a_Yaw, float a_Pitch, bool a_IsRelative)
 
void SendPlayerMoveLook (void)
 
void SendPlayerPermissionLevel (void)
 
void SendPlayerPosition (void)
 
void SendPlayerSpawn (const cPlayer &a_Player)
 
void SendPluginMessage (const AString &a_Channel, ContiguousByteBufferView a_Message)
 
void SendPluginMessage (const AString &a_Channel, std::string_view a_Message)
 
void SendRemoveEntityEffect (const cEntity &a_Entity, int a_EffectID)
 
void SendResetTitle (void)
 
void SendResourcePack (const AString &a_ResourcePackUrl)
 
void SendRespawn (eDimension a_Dimension, bool a_IsRespawningFromDeath)
 
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 SendSetRawSubTitle (const AString &a_SubTitle)
 
void SendSetRawTitle (const AString &a_Title)
 
void SendSetSubTitle (const cCompositeChat &a_SubTitle)
 
void SendSetTitle (const cCompositeChat &a_Title)
 
void SendSoundEffect (const AString &a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch)
 
void SendSoundEffect (const AString &a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch)
 
void SendSoundParticleEffect (const EffectID a_EffectID, Vector3i a_Source, int a_Data)
 
void SendSpawnEntity (const cEntity &a_Entity)
 
void SendSpawnMob (const cMonster &a_Mob)
 
void SendStatistics (const StatisticsManager &a_Manager)
 
void SendTabCompletionResults (const AStringVector &a_Results)
 
void SendThunderbolt (Vector3i a_BlockPos)
 
void SendTimeUpdate (cTickTimeLong a_WorldAge, cTickTimeLong a_WorldDate, bool a_DoDaylightCycle)
 
void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks)
 
void SendUnleashEntity (const cEntity &a_Entity)
 
void SendUnloadChunk (int a_ChunkX, int a_ChunkZ)
 
void SendUnlockRecipe (UInt32 a_RecipeId)
 Send a newly discovered recipe to show the notification and unlock in the recipe book. More...
 
void SendUpdateBlockEntity (cBlockEntity &a_BlockEntity)
 
void SendUpdateSign (Vector3i a_BlockPos, const AString &a_Line1, const AString &a_Line2, const AString &a_Line3, const AString &a_Line4)
 
void SendWeather (eWeather a_Weather)
 
void SendWholeInventory (const cWindow &a_Window)
 
void SendWindowClose (const cWindow &a_Window)
 
void SendWindowOpen (const cWindow &a_Window)
 
void SendWindowProperty (const cWindow &a_Window, size_t a_Property, short a_Value)
 
void ServerTick (float a_Dt)
 Called while the client is being ticked from the cServer object. More...
 
void SetClientBrand (const AString &a_ClientBrand)
 Called by the protocol when it receives the MC|Brand plugin message. More...
 
void SetIPString (const AString &a_IPString)
 Sets the IP string that the client is using. More...
 
void SetIsForgeClient ()
 Mark a client connection as using Forge. More...
 
void SetLocale (const AString &a_Locale)
 
void SetProperties (const Json::Value &a_Properties)
 Sets the player's properties, such as skin image and signature. More...
 
void SetProtocolVersion (UInt32 a_ProtocolVersion)
 Called by the protocol recognizer when the protocol version is known. More...
 
void SetUsername (AString &&a_Username)
 
void SetUUID (const cUUID &a_UUID)
 Sets the player's UUID, as used by the protocol. More...
 
void SetViewDistance (int a_ViewDistance)
 Sets the maximal view distance. More...
 
void StreamNextChunks ()
 Sends a set number of new chunks to the player on every invocation, until all chunks in the view distance have been sent. More...
 
void Tick (std::chrono::milliseconds a_Dt)
 Called while the client is being ticked from the world via its cPlayer object. More...
 
void UnloadOutOfRangeChunks (void)
 Remove all loaded chunks that are no longer in range. More...
 
bool WantsSendChunk (int a_ChunkX, int a_ChunkZ)
 Returns true if the client wants the chunk specified to be sent (in m_ChunksToSend) More...
 
virtual ~cClientHandle () override
 
- Public Member Functions inherited from cTCPLink::cCallbacks
virtual void OnTlsHandshakeCompleted (void)
 Called when the TLS handshake has been completed and communication can continue regularly. More...
 
virtual ~cCallbacks ()
 

Static Public Member Functions

static AString FormatChatPrefix (bool ShouldAppendChatPrefixes, const AString &a_ChatPrefixS, const AString &m_Color1, const AString &m_Color2)
 
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. More...
 
static cUUID GenerateOfflineUUID (const AString &a_Username)
 Generates an UUID based on the player name provided. More...
 
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. More...
 

Static Public Attributes

static const int DEFAULT_VIEW_DISTANCE = 10
 
static float FASTBREAK_PERCENTAGE
 The percentage how much a block has to be broken. More...
 
static const int MAX_VIEW_DISTANCE = 32
 
static const int MIN_VIEW_DISTANCE = 1
 

Private Types

typedef std::set< AStringcChannels
 The type used for storing the names of registered plugin channels. More...
 
enum  eState {
  csConnected , csAuthenticating , csDownloadingWorld , csPlaying ,
  csDestroyed
}
 

Private Member Functions

AStringVector BreakApartPluginChannels (ContiguousByteBufferView a_PluginChannels)
 Converts the protocol-formatted channel list (NUL-separated) into a proper string vector. More...
 
bool CheckBlockInteractionsRate (void)
 Returns true if the rate block interactions is within a reasonable limit (bot protection) More...
 
void FinishAuthenticate ()
 Finish logging the user in after authenticating. More...
 
void FinishDigAnimation ()
 The clients will receive a finished dig animation. More...
 
void HandleBlockDigFinished (Vector3i a_BlockPos, eBlockFace a_BlockFace)
 Handles the DIG_FINISHED dig packet: More...
 
void HandleBlockDigStarted (Vector3i a_BlockPos, eBlockFace a_BlockFace)
 Handles the DIG_STARTED dig packet: More...
 
bool IsWithinReach (Vector3i a_Position) const
 Returns whether the player could in fact reach the position they're attempting to interact with. More...
 
virtual void OnError (int a_ErrorCode, const AString &a_ErrorMsg) override
 Called when an error is detected on the connection. More...
 
virtual void OnLinkCreated (cTCPLinkPtr a_Link) override
 Called when the cTCPLink for the connection is created. More...
 
virtual void OnReceivedData (const char *a_Data, size_t a_Length) override
 Called when there's data incoming from the remote peer. More...
 
virtual void OnRemoteClosed (void) override
 Called when the remote end closes the connection. More...
 
void RegisterPluginChannels (const AStringVector &a_ChannelList)
 Adds all of the channels to the list of current plugin channels. More...
 
bool SetState (eState a_NewState)
 Called to update m_State. More...
 
void SocketClosed (void)
 Called when the network socket has been closed. More...
 
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() More...
 
void UnregisterPluginChannels (const AStringVector &a_ChannelList)
 Removes all of the channels from the list of current plugin channels. More...
 

Private Attributes

Vector3i m_BlockDigAnimPos
 
int m_BlockDigAnimSpeed
 
int m_BlockDigAnimStage
 
float m_BreakProgress
 The fraction between 0 and 1 (or above), of how far through mining the currently mined block is. More...
 
cChunkCoords m_CachedSentChunk
 This is an optimization which saves you an iteration of m_SentChunks if you just want to know whether or not the player is standing at a sent chunk. More...
 
std::unordered_set< cChunkCoords, cChunkCoordsHashm_ChunksToSend
 
AString m_ClientBrand
 The brand identification of the client, as received in the MC|Brand plugin message or set from a plugin. More...
 
cCriticalSection m_CSChunkLists
 
cCriticalSection m_CSIncomingData
 Protects m_IncomingData against multithreaded access. More...
 
cCriticalSection m_CSOutgoingData
 Protects m_OutgoingData against multithreaded access. More...
 
cCriticalSection m_CSState
 
int m_CurrentViewDistance
 The actual view distance used, the minimum of client's requested view distance and world's max view distance. More...
 
cForgeHandshake m_ForgeHandshake
 Forge handshake state machine. More...
 
AStringMap m_ForgeMods
 Forge mods and versions installed on this client. More...
 
bool m_HasSentDC
 True if a Disconnect packet has been sent in either direction. More...
 
bool m_HasSentPlayerChunk
 Set to true when the chunk where the player is is sent to the client. More...
 
bool m_HasStartedDigging
 
ContiguousByteBuffer m_IncomingData
 Queue for the incoming data received on the link until it is processed in ProcessProtocolIn(). More...
 
AString m_IPString
 
Vector3i m_LastDigBlockPos
 
Vector3i m_LastPlacedSign
 The positions from the last sign that the player placed. More...
 
int m_LastStreamedChunkX
 
int m_LastStreamedChunkZ
 
cTCPLinkPtr m_Link
 The link that is used for network communication. More...
 
std::unordered_set< cChunkCoords, cChunkCoordsHashm_LoadedChunks
 
AString m_Locale
 Client Settings. More...
 
int m_NumBlockChangeInteractionsThisTick
 Number of place or break interactions this tick. More...
 
int m_NumExplosionsThisTick
 Number of explosions sent this tick. More...
 
ContiguousByteBuffer m_OutgoingData
 Buffer for storing outgoing data from any thread; will get sent in ProcessProtocolOut() at the end of each tick. More...
 
AString m_Password
 
std::chrono::steady_clock::duration m_Ping
 Duration of the last completed client ping. More...
 
UInt32 m_PingID
 ID of the last ping request sent to the client. More...
 
std::chrono::steady_clock::time_point m_PingStartTime
 Time of the last ping request sent to the client. More...
 
cPlayerm_Player
 A pointer to a World-owned player object, created in FinishAuthenticate when authentication succeeds. More...
 
cChannels m_PluginChannels
 The plugin channels that the client has registered. More...
 
Json::Value m_Properties
 
cMultiVersionProtocol m_Protocol
 
UInt32 m_ProtocolVersion
 The version of the protocol that the client is talking, or 0 if unknown. More...
 
bool m_ProxyConnection
 True if player connected from a proxy (Bungee / Velocity) More...
 
int m_RequestedViewDistance
 The requested view distance from the player. More...
 
cChunkCoordsList m_SentChunks
 
std::atomic< eStatem_State
 The current (networking) state of the client. More...
 
std::atomic< int > m_TicksSinceLastPacket
 Number of ticks since the last network packet was received (increased in Tick(), reset in OnReceivedData()) More...
 
std::chrono::milliseconds m_TimeSinceLastUnloadCheck
 The time since UnloadOutOfRangeChunks was last called. More...
 
int m_UniqueID
 ID used for identification during authenticating. More...
 
AString m_Username
 
cUUID m_UUID
 Contains the UUID used by Mojang to identify the player's account. More...
 

Static Private Attributes

static int s_ClientCount = 0
 
static Vector3i s_IllegalPosition = {0, cChunkDef::Height + 1, 0}
 

Friends

class cForgeHandshake
 

Detailed Description

Definition at line 49 of file ClientHandle.h.

Member Typedef Documentation

◆ cChannels

typedef std::set<AString> cClientHandle::cChannels
private

The type used for storing the names of registered plugin channels.

Definition at line 431 of file ClientHandle.h.

Member Enumeration Documentation

◆ eState

enum cClientHandle::eState
private
Enumerator
csConnected 

The client has just connected, waiting for their handshake / login.

csAuthenticating 

The client has logged in, waiting for external authentication.

csDownloadingWorld 

The client is waiting for chunks, we're waiting for the loader to provide and send them.

csPlaying 

Normal gameplay.

csDestroyed 

The client has been destroyed, the destructor is to be called from the owner thread.

Definition at line 518 of file ClientHandle.h.

Constructor & Destructor Documentation

◆ 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 distance.

Definition at line 71 of file ClientHandle.cpp.

◆ ~cClientHandle()

cClientHandle::~cClientHandle ( )
overridevirtual

Definition at line 109 of file ClientHandle.cpp.

Member Function Documentation

◆ AddWantedChunk()

void cClientHandle::AddWantedChunk ( int  a_ChunkX,
int  a_ChunkZ 
)

Adds the chunk specified to the list of chunks wanted for sending (m_ChunksToSend)

Definition at line 3340 of file ClientHandle.cpp.

◆ Authenticate()

void cClientHandle::Authenticate ( AString &&  a_Name,
const cUUID a_UUID,
Json::Value &&  a_Properties 
)

Authenticates ourselves, called by cAuthenticator supplying player details from Mojang.

Definition at line 366 of file ClientHandle.cpp.

◆ BreakApartPluginChannels()

AStringVector cClientHandle::BreakApartPluginChannels ( ContiguousByteBufferView  a_PluginChannels)
private

Converts the protocol-formatted channel list (NUL-separated) into a proper string vector.

Definition at line 932 of file ClientHandle.cpp.

◆ BungeeAuthenticate()

bool cClientHandle::BungeeAuthenticate ( )

Authenticates the specified user with the bungee proxy server.

Definition at line 318 of file ClientHandle.cpp.

◆ CheckBlockInteractionsRate()

bool cClientHandle::CheckBlockInteractionsRate ( void  )
private

Returns true if the rate block interactions is within a reasonable limit (bot protection)

Definition at line 2075 of file ClientHandle.cpp.

◆ CheckMultiLogin()

bool cClientHandle::CheckMultiLogin ( const AString a_Username)

Kicks the client if the same username is already logged in.

Returns false if the client has been kicked, true otherwise.

Definition at line 1926 of file ClientHandle.cpp.

◆ Destroy()

void cClientHandle::Destroy ( void  )

Definition at line 122 of file ClientHandle.cpp.

◆ FinishAuthenticate()

void cClientHandle::FinishAuthenticate ( )
private

Finish logging the user in after authenticating.

Definition at line 416 of file ClientHandle.cpp.

◆ FinishDigAnimation()

void cClientHandle::FinishDigAnimation ( )
private

The clients will receive a finished dig animation.

Definition at line 1383 of file ClientHandle.cpp.

◆ ForgeAugmentServerListPing()

void cClientHandle::ForgeAugmentServerListPing ( Json::Value &  a_Response)
inline

Add the Forge mod list to the server ping response.

Definition at line 290 of file ClientHandle.h.

◆ FormatChatPrefix()

AString cClientHandle::FormatChatPrefix ( bool  ShouldAppendChatPrefixes,
const AString a_ChatPrefixS,
const AString m_Color1,
const AString m_Color2 
)
static

Definition at line 146 of file ClientHandle.cpp.

◆ FormatMessageType()

AString cClientHandle::FormatMessageType ( bool  ShouldAppendChatPrefixes,
eMessageType  a_ChatPrefix,
const AString a_AdditionalData 
)
static

Formats the type of message with the proper color and prefix for sending to the client.

Definition at line 165 of file ClientHandle.cpp.

◆ GenerateOfflineUUID()

cUUID cClientHandle::GenerateOfflineUUID ( const AString a_Username)
static

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.

Definition at line 198 of file ClientHandle.cpp.

◆ GetClientBrand()

const AString& cClientHandle::GetClientBrand ( void  ) const
inline

Returns the client brand received in the MC|Brand plugin message or set by a plugin.

Definition at line 279 of file ClientHandle.h.

◆ GetForgeMods()

const AStringMap& cClientHandle::GetForgeMods ( void  ) const
inline

Returns the Forge mods installed on the client.

Definition at line 282 of file ClientHandle.h.

◆ GetIPString()

const AString& cClientHandle::GetIPString ( void  ) const
inline

Definition at line 72 of file ClientHandle.h.

◆ GetLocale()

AString cClientHandle::GetLocale ( void  ) const
inline

Definition at line 268 of file ClientHandle.h.

◆ GetPing()

short cClientHandle::GetPing ( void  ) const
inline

Definition at line 256 of file ClientHandle.h.

◆ GetPlayer()

cPlayer* cClientHandle::GetPlayer ( void  )
inline

Definition at line 78 of file ClientHandle.h.

◆ GetProperties()

const Json::Value& cClientHandle::GetProperties ( void  ) const
inline

Definition at line 88 of file ClientHandle.h.

◆ GetProtocolVersion()

UInt32 cClientHandle::GetProtocolVersion ( void  ) const
inline

Returns the protocol version number of the protocol that the client is talking.

Returns zero if the protocol version is not (yet) known.

Definition at line 422 of file ClientHandle.h.

◆ GetRequestedViewDistance()

int cClientHandle::GetRequestedViewDistance ( void  ) const
inline

Returns the view distance that the player request, not the used view distance.

Definition at line 265 of file ClientHandle.h.

◆ GetUniqueID()

int cClientHandle::GetUniqueID ( void  ) const
inline

Definition at line 270 of file ClientHandle.h.

◆ GetUsername()

const AString & cClientHandle::GetUsername ( void  ) const

Definition at line 3277 of file ClientHandle.cpp.

◆ GetUUID()

const cUUID& cClientHandle::GetUUID ( void  ) const
inline

Returns the player's UUID, as used by the protocol.

Definition at line 81 of file ClientHandle.h.

◆ GetViewDistance()

int cClientHandle::GetViewDistance ( void  ) const
inline

Returns the view distance that the player currently have.

Definition at line 262 of file ClientHandle.h.

◆ HandleAnimation()

void cClientHandle::HandleAnimation ( bool  a_SwingMainHand)

Called when the protocol receives a (hand swing) animation packet.

Definition at line 695 of file ClientHandle.cpp.

◆ HandleAnvilItemName()

void cClientHandle::HandleAnvilItemName ( const AString a_ItemName)

Called when the protocol receives a MC|ItemName plugin message, indicating that the player named an item in the anvil UI.

Definition at line 1077 of file ClientHandle.cpp.

◆ HandleBeaconSelection()

void cClientHandle::HandleBeaconSelection ( unsigned  a_PrimaryEffect,
unsigned  a_SecondaryEffect 
)

Called when the protocol receives a MC|Beacon plugin message, indicating that the player set an effect in the beacon UI.

Definition at line 988 of file ClientHandle.cpp.

◆ HandleBlockDigFinished()

void cClientHandle::HandleBlockDigFinished ( Vector3i  a_BlockPos,
eBlockFace  a_BlockFace 
)
private

Handles the DIG_FINISHED dig packet:

Definition at line 1306 of file ClientHandle.cpp.

◆ HandleBlockDigStarted()

void cClientHandle::HandleBlockDigStarted ( Vector3i  a_BlockPos,
eBlockFace  a_BlockFace 
)
private

Handles the DIG_STARTED dig packet:

Definition at line 1239 of file ClientHandle.cpp.

◆ HandleChat()

void cClientHandle::HandleChat ( const AString a_Message)

Called when the protocol detects a chat packet.

Definition at line 1522 of file ClientHandle.cpp.

◆ HandleCommandBlockBlockChange()

void cClientHandle::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 command block UI, for a block-based commandblock.

Definition at line 1037 of file ClientHandle.cpp.

◆ HandleCommandBlockEntityChange()

void cClientHandle::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 command block UI, for an entity-based commandblock (minecart?).

Definition at line 1067 of file ClientHandle.cpp.

◆ HandleCraftRecipe()

void cClientHandle::HandleCraftRecipe ( UInt32  a_RecipeId)

Called when a recipe from the recipe book is selected.

Definition at line 3210 of file ClientHandle.cpp.

◆ HandleCreativeInventory()

void cClientHandle::HandleCreativeInventory ( Int16  a_SlotNum,
const cItem a_HeldItem,
eClickAction  a_ClickAction 
)

Called when the client clicks the creative inventory window.

a_ClickAction specifies whether the click was inside the window or not (caLeftClick or caLeftClickOutside).

Definition at line 784 of file ClientHandle.cpp.

◆ HandleCrouch()

void cClientHandle::HandleCrouch ( bool  a_IsCrouching)

Handles a player sneaking or unsneaking.

Definition at line 805 of file ClientHandle.cpp.

◆ HandleEnchantItem()

void cClientHandle::HandleEnchantItem ( UInt8  a_WindowID,
UInt8  a_Enchantment 
)

Called when the player enchants an Item in the Enchanting table UI.

Definition at line 814 of file ClientHandle.cpp.

◆ HandleHandshake()

bool cClientHandle::HandleHandshake ( const AString a_Username)

Called when the protocol handshake has been received (for protocol versions that support it; otherwise the first instant when a username is received).

Returns true if the player is to be let in, false if they were disconnected

Definition at line 1954 of file ClientHandle.cpp.

◆ HandleKeepAlive()

void cClientHandle::HandleKeepAlive ( UInt32  a_KeepAliveID)

Definition at line 1914 of file ClientHandle.cpp.

◆ HandleLeaveBed()

void cClientHandle::HandleLeaveBed ( )

Handles a player exiting his bed.

Definition at line 1975 of file ClientHandle.cpp.

◆ HandleLeftClick()

void cClientHandle::HandleLeftClick ( Vector3i  a_BlockPos,
eBlockFace  a_BlockFace,
UInt8  a_Status 
)

Definition at line 1094 of file ClientHandle.cpp.

◆ HandleLogin()

bool cClientHandle::HandleLogin ( )

Called when the protocol has finished logging the user in.

Return true to allow the user in; false to kick them.

Definition at line 749 of file ClientHandle.cpp.

◆ HandleNPCTrade()

void cClientHandle::HandleNPCTrade ( int  a_SlotNum)

Called when the protocol receives a MC|TrSel packet, indicating that the player used a trade in the NPC UI.

Definition at line 710 of file ClientHandle.cpp.

◆ HandleOpenHorseInventory()

void cClientHandle::HandleOpenHorseInventory ( )

Handles a player opening his inventory while riding a horse.

Definition at line 720 of file ClientHandle.cpp.

◆ HandlePing()

void cClientHandle::HandlePing ( void  )

Definition at line 729 of file ClientHandle.cpp.

◆ HandlePlayerAbilities()

void cClientHandle::HandlePlayerAbilities ( bool  a_IsFlying,
float  FlyingSpeed,
float  WalkingSpeed 
)

Definition at line 885 of file ClientHandle.cpp.

◆ HandlePlayerLook()

void cClientHandle::HandlePlayerLook ( float  a_Rotation,
float  a_Pitch,
bool  a_IsOnGround 
)

Definition at line 1569 of file ClientHandle.cpp.

◆ HandlePlayerMove()

void cClientHandle::HandlePlayerMove ( Vector3d  a_Pos,
bool  a_IsOnGround 
)

Verifies and sets player position, performing relevant checks.

Calls relevant methods to process movement related statistics. Requires state of previous position and on-ground status, so must be called when these are still intact.

Definition at line 1581 of file ClientHandle.cpp.

◆ HandlePlayerMoveLook()

void cClientHandle::HandlePlayerMoveLook ( Vector3d  a_Pos,
float  a_Rotation,
float  a_Pitch,
bool  a_IsOnGround 
)

Definition at line 1637 of file ClientHandle.cpp.

◆ HandlePluginMessage()

void cClientHandle::HandlePluginMessage ( const AString a_Channel,
ContiguousByteBufferView  a_Message 
)

Definition at line 897 of file ClientHandle.cpp.

◆ HandleResourcePack()

void cClientHandle::HandleResourcePack ( UInt8  a_Status)

Definition at line 1885 of file ClientHandle.cpp.

◆ HandleRespawn()

void cClientHandle::HandleRespawn ( void  )

Definition at line 1898 of file ClientHandle.cpp.

◆ HandleRightClick()

void cClientHandle::HandleRightClick ( Vector3i  a_BlockPos,
eBlockFace  a_BlockFace,
Vector3i  a_Cursor,
bool  a_UsedMainHand 
)

Definition at line 1406 of file ClientHandle.cpp.

◆ HandleSlotSelected()

void cClientHandle::HandleSlotSelected ( Int16  a_SlotNum)

Definition at line 1647 of file ClientHandle.cpp.

◆ HandleSpectate()

void cClientHandle::HandleSpectate ( const cUUID a_PlayerUUID)

Definition at line 1657 of file ClientHandle.cpp.

◆ HandleSprint()

void cClientHandle::HandleSprint ( bool  a_IsSprinting)

Handles a player sprinting or slowing back down.

Definition at line 1676 of file ClientHandle.cpp.

◆ HandleStartElytraFlight()

void cClientHandle::HandleStartElytraFlight ( )

Handles a player starting elytra flight while falling.

Definition at line 1685 of file ClientHandle.cpp.

◆ HandleSteerVehicle()

void cClientHandle::HandleSteerVehicle ( float  Forward,
float  Sideways 
)

Definition at line 1694 of file ClientHandle.cpp.

◆ HandleTabCompletion()

void cClientHandle::HandleTabCompletion ( const AString a_Text)

Definition at line 1994 of file ClientHandle.cpp.

◆ HandleUnmount()

void cClientHandle::HandleUnmount ( void  )

Definition at line 1985 of file ClientHandle.cpp.

◆ HandleUpdateSign()

void cClientHandle::HandleUpdateSign ( Vector3i  a_BlockPos,
const AString a_Line1,
const AString a_Line2,
const AString a_Line3,
const AString a_Line4 
)

Definition at line 1733 of file ClientHandle.cpp.

◆ HandleUseEntity()

void cClientHandle::HandleUseEntity ( UInt32  a_TargetEntityID,
bool  a_IsLeftClick 
)

Definition at line 1750 of file ClientHandle.cpp.

◆ HandleUseItem()

void cClientHandle::HandleUseItem ( bool  a_UsedMainHand)

Definition at line 1821 of file ClientHandle.cpp.

◆ HandleWindowClick()

void cClientHandle::HandleWindowClick ( UInt8  a_WindowID,
Int16  a_SlotNum,
eClickAction  a_ClickAction,
const cItem a_HeldItem 
)

Definition at line 1712 of file ClientHandle.cpp.

◆ HandleWindowClose()

void cClientHandle::HandleWindowClose ( UInt8  a_WindowID)

Definition at line 1703 of file ClientHandle.cpp.

◆ HasPluginChannel()

bool cClientHandle::HasPluginChannel ( const AString a_PluginChannel)

Definition at line 3316 of file ClientHandle.cpp.

◆ IsDestroyed()

bool cClientHandle::IsDestroyed ( void  ) const
inline

Definition at line 148 of file ClientHandle.h.

◆ IsForgeClient()

bool cClientHandle::IsForgeClient ( void  ) const
inline

Returns true if the client is modded with Forge.

Definition at line 285 of file ClientHandle.h.

◆ IsLoggedIn()

bool cClientHandle::IsLoggedIn ( void  ) const
inline

Definition at line 137 of file ClientHandle.h.

◆ IsPlayerChunkSent()

bool cClientHandle::IsPlayerChunkSent ( )

Definition at line 2066 of file ClientHandle.cpp.

◆ IsPlaying()

bool cClientHandle::IsPlaying ( void  ) const
inline

Definition at line 147 of file ClientHandle.h.

◆ IsUUIDOnline()

bool cClientHandle::IsUUIDOnline ( const cUUID a_UUID)
static

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.

Definition at line 212 of file ClientHandle.cpp.

◆ IsWithinReach()

bool cClientHandle::IsWithinReach ( Vector3i  a_Position) const
private

Returns whether the player could in fact reach the position they're attempting to interact with.

Definition at line 2092 of file ClientHandle.cpp.

◆ Kick()

void cClientHandle::Kick ( const AString a_Reason)

Definition at line 305 of file ClientHandle.cpp.

◆ OnError()

void cClientHandle::OnError ( int  a_ErrorCode,
const AString a_ErrorMsg 
)
overrideprivatevirtual

Called when an error is detected on the connection.

Implements cTCPLink::cCallbacks.

Definition at line 3467 of file ClientHandle.cpp.

◆ OnLinkCreated()

void cClientHandle::OnLinkCreated ( cTCPLinkPtr  a_Link)
overrideprivatevirtual

Called when the cTCPLink for the connection is created.

The callback may store the cTCPLink instance for later use, but it should remove it in OnError(), OnRemoteClosed() or right after Close().

Implements cTCPLink::cCallbacks.

Definition at line 3430 of file ClientHandle.cpp.

◆ OnReceivedData()

void cClientHandle::OnReceivedData ( const char *  a_Data,
size_t  a_Length 
)
overrideprivatevirtual

Called when there's data incoming from the remote peer.

Implements cTCPLink::cCallbacks.

Definition at line 3439 of file ClientHandle.cpp.

◆ OnRemoteClosed()

void cClientHandle::OnRemoteClosed ( void  )
overrideprivatevirtual

Called when the remote end closes the connection.

The link is still available for connection information query (IP / port). Sending data on the link is not an error, but the data won't be delivered.

Implements cTCPLink::cCallbacks.

Definition at line 3453 of file ClientHandle.cpp.

◆ PacketBufferFull()

void cClientHandle::PacketBufferFull ( void  )

Definition at line 3359 of file ClientHandle.cpp.

◆ PacketError()

void cClientHandle::PacketError ( UInt32  a_PacketType)

Definition at line 3381 of file ClientHandle.cpp.

◆ PacketUnknown()

void cClientHandle::PacketUnknown ( UInt32  a_PacketType)

Definition at line 3370 of file ClientHandle.cpp.

◆ ProcessProtocolIn()

void cClientHandle::ProcessProtocolIn ( void  )

Processes the data in the network input buffer.

Called by both cWorld::Tick() and ServerTick().

Definition at line 246 of file ClientHandle.cpp.

◆ ProcessProtocolOut()

void cClientHandle::ProcessProtocolOut ( )

Flushes all buffered outgoing data to the network.

Definition at line 276 of file ClientHandle.cpp.

◆ ProxyInit() [1/2]

void cClientHandle::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 at line 224 of file ClientHandle.cpp.

◆ ProxyInit() [2/2]

void cClientHandle::ProxyInit ( const AString a_IPString,
const cUUID a_UUID,
const Json::Value &  a_Properties 
)

Definition at line 236 of file ClientHandle.cpp.

◆ RegisterPluginChannels()

void cClientHandle::RegisterPluginChannels ( const AStringVector a_ChannelList)
private

Adds all of the channels to the list of current plugin channels.

Handles duplicates gracefully.

Definition at line 964 of file ClientHandle.cpp.

◆ RemoveFromWorld()

void cClientHandle::RemoveFromWorld ( void  )

Called when the player moves into a different world.

Sends an UnloadChunk packet for each loaded chunk and resets the streamed chunks.

Definition at line 2039 of file ClientHandle.cpp.

◆ SendAttachEntity()

void cClientHandle::SendAttachEntity ( const cEntity a_Entity,
const cEntity a_Vehicle 
)

Definition at line 2234 of file ClientHandle.cpp.

◆ SendBlockAction()

void cClientHandle::SendBlockAction ( Vector3i  a_BlockPos,
char  a_Byte1,
char  a_Byte2,
BLOCKTYPE  a_BlockType 
)

Definition at line 2261 of file ClientHandle.cpp.

◆ SendBlockBreakAnim()

void cClientHandle::SendBlockBreakAnim ( UInt32  a_EntityID,
Vector3i  a_BlockPos,
char  a_Stage 
)

Definition at line 2270 of file ClientHandle.cpp.

◆ SendBlockChange()

void cClientHandle::SendBlockChange ( Vector3i  a_BlockPos,
BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)

Definition at line 2279 of file ClientHandle.cpp.

◆ SendBlockChanges()

void cClientHandle::SendBlockChanges ( int  a_ChunkX,
int  a_ChunkZ,
const sSetBlockVector a_Changes 
)

Definition at line 2296 of file ClientHandle.cpp.

◆ SendBossBarAdd()

void cClientHandle::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 at line 2324 of file ClientHandle.cpp.

◆ SendBossBarRemove()

void cClientHandle::SendBossBarRemove ( UInt32  a_UniqueID)

Definition at line 2360 of file ClientHandle.cpp.

◆ SendBossBarUpdateFlags()

void cClientHandle::SendBossBarUpdateFlags ( UInt32  a_UniqueID,
bool  a_DarkenSky,
bool  a_PlayEndMusic,
bool  a_CreateFog 
)

Definition at line 2333 of file ClientHandle.cpp.

◆ SendBossBarUpdateHealth()

void cClientHandle::SendBossBarUpdateHealth ( UInt32  a_UniqueID,
float  a_FractionFilled 
)

Definition at line 2369 of file ClientHandle.cpp.

◆ SendBossBarUpdateStyle()

void cClientHandle::SendBossBarUpdateStyle ( UInt32  a_UniqueID,
BossBarColor  a_Color,
BossBarDivisionType  a_DivisionType 
)

Definition at line 2342 of file ClientHandle.cpp.

◆ SendBossBarUpdateTitle()

void cClientHandle::SendBossBarUpdateTitle ( UInt32  a_UniqueID,
const cCompositeChat a_Title 
)

Definition at line 2351 of file ClientHandle.cpp.

◆ SendCameraSetTo()

void cClientHandle::SendCameraSetTo ( const cEntity a_Entity)

Definition at line 2378 of file ClientHandle.cpp.

◆ SendChat() [1/2]

void cClientHandle::SendChat ( const AString a_Message,
eMessageType  a_ChatPrefix,
const AString a_AdditionalData = "" 
)

Definition at line 2387 of file ClientHandle.cpp.

◆ SendChat() [2/2]

void cClientHandle::SendChat ( const cCompositeChat a_Message)

Definition at line 2408 of file ClientHandle.cpp.

◆ SendChatAboveActionBar() [1/2]

void cClientHandle::SendChatAboveActionBar ( const AString a_Message,
eMessageType  a_ChatPrefix,
const AString a_AdditionalData = "" 
)

Definition at line 2437 of file ClientHandle.cpp.

◆ SendChatAboveActionBar() [2/2]

void cClientHandle::SendChatAboveActionBar ( const cCompositeChat a_Message)

Definition at line 2457 of file ClientHandle.cpp.

◆ SendChatRaw()

void cClientHandle::SendChatRaw ( const AString a_MessageRaw,
eChatType  a_Type 
)

Definition at line 2428 of file ClientHandle.cpp.

◆ SendChatSystem() [1/2]

void cClientHandle::SendChatSystem ( const AString a_Message,
eMessageType  a_ChatPrefix,
const AString a_AdditionalData = "" 
)

Definition at line 2466 of file ClientHandle.cpp.

◆ SendChatSystem() [2/2]

void cClientHandle::SendChatSystem ( const cCompositeChat a_Message)

Definition at line 2487 of file ClientHandle.cpp.

◆ SendChunkData()

void cClientHandle::SendChunkData ( int  a_ChunkX,
int  a_ChunkZ,
ContiguousByteBufferView  a_ChunkData 
)

Definition at line 2496 of file ClientHandle.cpp.

◆ SendCollectEntity()

void cClientHandle::SendCollectEntity ( const cEntity a_Collected,
const cEntity a_Collector,
unsigned  a_Count 
)

Definition at line 2539 of file ClientHandle.cpp.

◆ SendData()

void cClientHandle::SendData ( ContiguousByteBufferView  a_Data)

Definition at line 2023 of file ClientHandle.cpp.

◆ SendDestroyEntity()

void cClientHandle::SendDestroyEntity ( const cEntity a_Entity)

Definition at line 2548 of file ClientHandle.cpp.

◆ SendDetachEntity()

void cClientHandle::SendDetachEntity ( const cEntity a_Entity,
const cEntity a_PreviousVehicle 
)

Definition at line 2557 of file ClientHandle.cpp.

◆ SendDisconnect()

void cClientHandle::SendDisconnect ( const AString a_Reason)

Definition at line 2566 of file ClientHandle.cpp.

◆ SendDisplayObjective()

void cClientHandle::SendDisplayObjective ( const AString a_Objective,
cScoreboard::eDisplaySlot  a_Display 
)

Definition at line 3017 of file ClientHandle.cpp.

◆ SendEditSign()

void cClientHandle::SendEditSign ( Vector3i  a_BlockPos)

Definition at line 2579 of file ClientHandle.cpp.

◆ SendEntityAnimation()

void cClientHandle::SendEntityAnimation ( const cEntity a_Entity,
EntityAnimation  a_Animation 
)

Definition at line 2784 of file ClientHandle.cpp.

◆ SendEntityEffect()

void cClientHandle::SendEntityEffect ( const cEntity a_Entity,
int  a_EffectID,
int  a_Amplifier,
int  a_Duration 
)

Definition at line 2589 of file ClientHandle.cpp.

◆ SendEntityEquipment()

void cClientHandle::SendEntityEquipment ( const cEntity a_Entity,
short  a_SlotNum,
const cItem a_Item 
)

Definition at line 2598 of file ClientHandle.cpp.

◆ SendEntityHeadLook()

void cClientHandle::SendEntityHeadLook ( const cEntity a_Entity)

Definition at line 2607 of file ClientHandle.cpp.

◆ SendEntityLook()

void cClientHandle::SendEntityLook ( const cEntity a_Entity)

Definition at line 2618 of file ClientHandle.cpp.

◆ SendEntityMetadata()

void cClientHandle::SendEntityMetadata ( const cEntity a_Entity)

Definition at line 2629 of file ClientHandle.cpp.

◆ SendEntityPosition()

void cClientHandle::SendEntityPosition ( const cEntity a_Entity)

Definition at line 2638 of file ClientHandle.cpp.

◆ SendEntityProperties()

void cClientHandle::SendEntityProperties ( const cEntity a_Entity)

Definition at line 2647 of file ClientHandle.cpp.

◆ SendEntityVelocity()

void cClientHandle::SendEntityVelocity ( const cEntity a_Entity)

Definition at line 2656 of file ClientHandle.cpp.

◆ SendExperience()

void cClientHandle::SendExperience ( void  )

Definition at line 2972 of file ClientHandle.cpp.

◆ SendExperienceOrb()

void cClientHandle::SendExperienceOrb ( const cExpOrb a_ExpOrb)

Definition at line 2981 of file ClientHandle.cpp.

◆ SendExplosion()

void cClientHandle::SendExplosion ( Vector3f  a_Position,
float  a_Power 
)

Definition at line 2665 of file ClientHandle.cpp.

◆ SendGameMode()

void cClientHandle::SendGameMode ( eGameMode  a_GameMode)

Definition at line 2703 of file ClientHandle.cpp.

◆ SendHealth()

void cClientHandle::SendHealth ( void  )

Definition at line 2712 of file ClientHandle.cpp.

◆ SendHeldItemChange()

void cClientHandle::SendHeldItemChange ( int  a_ItemIndex)

Definition at line 2721 of file ClientHandle.cpp.

◆ SendHideTitle()

void cClientHandle::SendHideTitle ( void  )

Definition at line 2730 of file ClientHandle.cpp.

◆ SendInitRecipes()

void cClientHandle::SendInitRecipes ( UInt32  a_RecipeId)

Send already known recipes without notification but visible in the recipe book.

Definition at line 3201 of file ClientHandle.cpp.

◆ SendInventorySlot()

void cClientHandle::SendInventorySlot ( char  a_WindowID,
short  a_SlotNum,
const cItem a_Item 
)

Definition at line 2739 of file ClientHandle.cpp.

◆ SendLeashEntity()

void cClientHandle::SendLeashEntity ( const cEntity a_Entity,
const cEntity a_EntityLeashedTo 
)

Definition at line 2243 of file ClientHandle.cpp.

◆ SendMapData()

void cClientHandle::SendMapData ( const cMap a_Map,
int  a_DataStartX,
int  a_DataStartY 
)

Definition at line 2748 of file ClientHandle.cpp.

◆ SendPaintingSpawn()

void cClientHandle::SendPaintingSpawn ( const cPainting a_Painting)

Definition at line 2775 of file ClientHandle.cpp.

◆ SendParticleEffect() [1/2]

void cClientHandle::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 
)

Definition at line 2766 of file ClientHandle.cpp.

◆ SendParticleEffect() [2/2]

void cClientHandle::SendParticleEffect ( const AString a_ParticleName,
Vector3f  a_Source,
Vector3f  a_Offset,
float  a_ParticleData,
int  a_ParticleAmount 
)

Definition at line 2757 of file ClientHandle.cpp.

◆ SendPlayerAbilities()

void cClientHandle::SendPlayerAbilities ( void  )

Definition at line 2793 of file ClientHandle.cpp.

◆ SendPlayerListAddPlayer()

void cClientHandle::SendPlayerListAddPlayer ( const cPlayer a_Player)

Definition at line 2802 of file ClientHandle.cpp.

◆ SendPlayerListHeaderFooter()

void cClientHandle::SendPlayerListHeaderFooter ( const cCompositeChat a_Header,
const cCompositeChat a_Footer 
)

Definition at line 2811 of file ClientHandle.cpp.

◆ SendPlayerListRemovePlayer()

void cClientHandle::SendPlayerListRemovePlayer ( const cPlayer a_Player)

Definition at line 2820 of file ClientHandle.cpp.

◆ SendPlayerListUpdateDisplayName()

void cClientHandle::SendPlayerListUpdateDisplayName ( const cPlayer a_Player,
const AString a_CustomName 
)

Definition at line 2829 of file ClientHandle.cpp.

◆ SendPlayerListUpdateGameMode()

void cClientHandle::SendPlayerListUpdateGameMode ( const cPlayer a_Player)

Definition at line 2838 of file ClientHandle.cpp.

◆ SendPlayerListUpdatePing()

void cClientHandle::SendPlayerListUpdatePing ( )

Definition at line 2847 of file ClientHandle.cpp.

◆ SendPlayerMoveLook() [1/2]

void cClientHandle::SendPlayerMoveLook ( Vector3d  a_Pos,
float  a_Yaw,
float  a_Pitch,
bool  a_IsRelative 
)

Definition at line 2856 of file ClientHandle.cpp.

◆ SendPlayerMoveLook() [2/2]

void cClientHandle::SendPlayerMoveLook ( void  )

Definition at line 2865 of file ClientHandle.cpp.

◆ SendPlayerPermissionLevel()

void cClientHandle::SendPlayerPermissionLevel ( void  )

Definition at line 2879 of file ClientHandle.cpp.

◆ SendPlayerPosition()

void cClientHandle::SendPlayerPosition ( void  )

Definition at line 2888 of file ClientHandle.cpp.

◆ SendPlayerSpawn()

void cClientHandle::SendPlayerSpawn ( const cPlayer a_Player)

Definition at line 2897 of file ClientHandle.cpp.

◆ SendPluginMessage() [1/2]

void cClientHandle::SendPluginMessage ( const AString a_Channel,
ContiguousByteBufferView  a_Message 
)

Definition at line 2925 of file ClientHandle.cpp.

◆ SendPluginMessage() [2/2]

void cClientHandle::SendPluginMessage ( const AString a_Channel,
std::string_view  a_Message 
)

Definition at line 2916 of file ClientHandle.cpp.

◆ SendRemoveEntityEffect()

void cClientHandle::SendRemoveEntityEffect ( const cEntity a_Entity,
int  a_EffectID 
)

Definition at line 2934 of file ClientHandle.cpp.

◆ SendResetTitle()

void cClientHandle::SendResetTitle ( void  )

Definition at line 2943 of file ClientHandle.cpp.

◆ SendResourcePack()

void cClientHandle::SendResourcePack ( const AString a_ResourcePackUrl)

Definition at line 2990 of file ClientHandle.cpp.

◆ SendRespawn()

void cClientHandle::SendRespawn ( eDimension  a_Dimension,
bool  a_IsRespawningFromDeath 
)

Definition at line 2952 of file ClientHandle.cpp.

◆ SendScoreboardObjective()

void cClientHandle::SendScoreboardObjective ( const AString a_Name,
const AString a_DisplayName,
Byte  a_Mode 
)

Definition at line 2999 of file ClientHandle.cpp.

◆ SendScoreUpdate()

void cClientHandle::SendScoreUpdate ( const AString a_Objective,
const AString a_Player,
cObjective::Score  a_Score,
Byte  a_Mode 
)

Definition at line 3008 of file ClientHandle.cpp.

◆ SendSetRawSubTitle()

void cClientHandle::SendSetRawSubTitle ( const AString a_SubTitle)

Definition at line 3035 of file ClientHandle.cpp.

◆ SendSetRawTitle()

void cClientHandle::SendSetRawTitle ( const AString a_Title)

Definition at line 3053 of file ClientHandle.cpp.

◆ SendSetSubTitle()

void cClientHandle::SendSetSubTitle ( const cCompositeChat a_SubTitle)

Definition at line 3026 of file ClientHandle.cpp.

◆ SendSetTitle()

void cClientHandle::SendSetTitle ( const cCompositeChat a_Title)

Definition at line 3044 of file ClientHandle.cpp.

◆ SendSoundEffect() [1/2]

void cClientHandle::SendSoundEffect ( const AString a_SoundName,
double  a_X,
double  a_Y,
double  a_Z,
float  a_Volume,
float  a_Pitch 
)

Definition at line 3062 of file ClientHandle.cpp.

◆ SendSoundEffect() [2/2]

void cClientHandle::SendSoundEffect ( const AString a_SoundName,
Vector3d  a_Position,
float  a_Volume,
float  a_Pitch 
)

Definition at line 3072 of file ClientHandle.cpp.

◆ SendSoundParticleEffect()

void cClientHandle::SendSoundParticleEffect ( const EffectID  a_EffectID,
Vector3i  a_Source,
int  a_Data 
)

Definition at line 3081 of file ClientHandle.cpp.

◆ SendSpawnEntity()

void cClientHandle::SendSpawnEntity ( const cEntity a_Entity)

Definition at line 3090 of file ClientHandle.cpp.

◆ SendSpawnMob()

void cClientHandle::SendSpawnMob ( const cMonster a_Mob)

Definition at line 3099 of file ClientHandle.cpp.

◆ SendStatistics()

void cClientHandle::SendStatistics ( const StatisticsManager a_Manager)

Definition at line 3108 of file ClientHandle.cpp.

◆ SendTabCompletionResults()

void cClientHandle::SendTabCompletionResults ( const AStringVector a_Results)

Definition at line 3117 of file ClientHandle.cpp.

◆ SendThunderbolt()

void cClientHandle::SendThunderbolt ( Vector3i  a_BlockPos)

Definition at line 3126 of file ClientHandle.cpp.

◆ SendTimeUpdate()

void cClientHandle::SendTimeUpdate ( cTickTimeLong  a_WorldAge,
cTickTimeLong  a_WorldDate,
bool  a_DoDaylightCycle 
)

Definition at line 3144 of file ClientHandle.cpp.

◆ SendTitleTimes()

void cClientHandle::SendTitleTimes ( int  a_FadeInTicks,
int  a_DisplayTicks,
int  a_FadeOutTicks 
)

Definition at line 3135 of file ClientHandle.cpp.

◆ SendUnleashEntity()

void cClientHandle::SendUnleashEntity ( const cEntity a_Entity)

Definition at line 2252 of file ClientHandle.cpp.

◆ SendUnloadChunk()

void cClientHandle::SendUnloadChunk ( int  a_ChunkX,
int  a_ChunkZ 
)

Definition at line 3153 of file ClientHandle.cpp.

◆ SendUnlockRecipe()

void cClientHandle::SendUnlockRecipe ( UInt32  a_RecipeId)

Send a newly discovered recipe to show the notification and unlock in the recipe book.

Definition at line 3192 of file ClientHandle.cpp.

◆ SendUpdateBlockEntity()

void cClientHandle::SendUpdateBlockEntity ( cBlockEntity a_BlockEntity)

Definition at line 3168 of file ClientHandle.cpp.

◆ SendUpdateSign()

void cClientHandle::SendUpdateSign ( Vector3i  a_BlockPos,
const AString a_Line1,
const AString a_Line2,
const AString a_Line3,
const AString a_Line4 
)

Definition at line 3177 of file ClientHandle.cpp.

◆ SendWeather()

void cClientHandle::SendWeather ( eWeather  a_Weather)

Definition at line 3232 of file ClientHandle.cpp.

◆ SendWholeInventory()

void cClientHandle::SendWholeInventory ( const cWindow a_Window)

Definition at line 3241 of file ClientHandle.cpp.

◆ SendWindowClose()

void cClientHandle::SendWindowClose ( const cWindow a_Window)

Definition at line 3250 of file ClientHandle.cpp.

◆ SendWindowOpen()

void cClientHandle::SendWindowOpen ( const cWindow a_Window)

Definition at line 3259 of file ClientHandle.cpp.

◆ SendWindowProperty()

void cClientHandle::SendWindowProperty ( const cWindow a_Window,
size_t  a_Property,
short  a_Value 
)

Definition at line 3268 of file ClientHandle.cpp.

◆ ServerTick()

void cClientHandle::ServerTick ( float  a_Dt)

Called while the client is being ticked from the cServer object.

Definition at line 2218 of file ClientHandle.cpp.

◆ SetClientBrand()

void cClientHandle::SetClientBrand ( const AString a_ClientBrand)
inline

Called by the protocol when it receives the MC|Brand plugin message.

Also callable by plugins. Simply stores the string value.

Definition at line 276 of file ClientHandle.h.

◆ SetIPString()

void cClientHandle::SetIPString ( const AString a_IPString)
inline

Sets the IP string that the client is using.

Overrides the IP string that was read from the socket. Used mainly by BungeeCord compatibility code.

Definition at line 76 of file ClientHandle.h.

◆ SetIsForgeClient()

void cClientHandle::SetIsForgeClient ( )
inline

Mark a client connection as using Forge.

Set by the protocol.

Definition at line 296 of file ClientHandle.h.

◆ SetLocale()

void cClientHandle::SetLocale ( const AString a_Locale)
inline

Definition at line 267 of file ClientHandle.h.

◆ SetProperties()

void cClientHandle::SetProperties ( const Json::Value &  a_Properties)
inline

Sets the player's properties, such as skin image and signature.

Used mainly by BungeeCord compatibility code - property querying is done on the BungeeCord server and the results are passed to MCS running in offline mode.

Definition at line 93 of file ClientHandle.h.

◆ SetProtocolVersion()

void cClientHandle::SetProtocolVersion ( UInt32  a_ProtocolVersion)
inline

Called by the protocol recognizer when the protocol version is known.

Definition at line 419 of file ClientHandle.h.

◆ SetState()

bool cClientHandle::SetState ( eState  a_NewState)
private

Called to update m_State.

Only succeeds if a_NewState > m_State, otherwise returns false.

Definition at line 3415 of file ClientHandle.cpp.

◆ SetUsername()

void cClientHandle::SetUsername ( AString &&  a_Username)

Definition at line 3286 of file ClientHandle.cpp.

◆ SetUUID()

void cClientHandle::SetUUID ( const cUUID a_UUID)
inline

Sets the player's UUID, as used by the protocol.

Used mainly by BungeeCord compatibility code - when authenticating is done on the BungeeCord server and the results are passed to MCS running in offline mode.

Definition at line 86 of file ClientHandle.h.

◆ SetViewDistance()

void cClientHandle::SetViewDistance ( int  a_ViewDistance)

Sets the maximal view distance.

Definition at line 3295 of file ClientHandle.cpp.

◆ SocketClosed()

void cClientHandle::SocketClosed ( void  )
private

Called when the network socket has been closed.

Definition at line 3391 of file ClientHandle.cpp.

◆ StreamChunk()

void cClientHandle::StreamChunk ( int  a_ChunkX,
int  a_ChunkZ,
cChunkSender::Priority  a_Priority 
)
private

Adds a single chunk to be streamed to the client; used by StreamChunks()

Definition at line 675 of file ClientHandle.cpp.

◆ StreamNextChunks()

void cClientHandle::StreamNextChunks ( void  )

Sends a set number of new chunks to the player on every invocation, until all chunks in the view distance have been sent.

Definition at line 502 of file ClientHandle.cpp.

◆ Tick()

void cClientHandle::Tick ( std::chrono::milliseconds  a_Dt)

Called while the client is being ticked from the world via its cPlayer object.

Definition at line 2105 of file ClientHandle.cpp.

◆ UnloadOutOfRangeChunks()

void cClientHandle::UnloadOutOfRangeChunks ( void  )

Remove all loaded chunks that are no longer in range.

Definition at line 626 of file ClientHandle.cpp.

◆ UnregisterPluginChannels()

void cClientHandle::UnregisterPluginChannels ( const AStringVector a_ChannelList)
private

Removes all of the channels from the list of current plugin channels.

Ignores channels that are not found.

Definition at line 976 of file ClientHandle.cpp.

◆ WantsSendChunk()

bool cClientHandle::WantsSendChunk ( int  a_ChunkX,
int  a_ChunkZ 
)

Returns true if the client wants the chunk specified to be sent (in m_ChunksToSend)

Definition at line 3325 of file ClientHandle.cpp.

Friends And Related Function Documentation

◆ cForgeHandshake

friend class cForgeHandshake
friend

Definition at line 428 of file ClientHandle.h.

Member Data Documentation

◆ DEFAULT_VIEW_DISTANCE

const int cClientHandle::DEFAULT_VIEW_DISTANCE = 10
static

Definition at line 57 of file ClientHandle.h.

◆ FASTBREAK_PERCENTAGE

float cClientHandle::FASTBREAK_PERCENTAGE
static

The percentage how much a block has to be broken.

Should be a value between 0.7 (70% broken) and 1 (100% broken) depending on lag. Can be set in settings.ini [AntiCheat] FastBreakPercentage=(from 0 to 100)

Definition at line 65 of file ClientHandle.h.

◆ m_BlockDigAnimPos

Vector3i cClientHandle::m_BlockDigAnimPos
private

Definition at line 512 of file ClientHandle.h.

◆ m_BlockDigAnimSpeed

int cClientHandle::m_BlockDigAnimSpeed
private

Definition at line 511 of file ClientHandle.h.

◆ m_BlockDigAnimStage

int cClientHandle::m_BlockDigAnimStage
private

Definition at line 510 of file ClientHandle.h.

◆ m_BreakProgress

float cClientHandle::m_BreakProgress
private

The fraction between 0 and 1 (or above), of how far through mining the currently mined block is.

0 for just started, 1 and above for broken. Used for anti-cheat.

Definition at line 577 of file ClientHandle.h.

◆ m_CachedSentChunk

cChunkCoords cClientHandle::m_CachedSentChunk
private

This is an optimization which saves you an iteration of m_SentChunks if you just want to know whether or not the player is standing at a sent chunk.

If this is equal to the coordinates of the chunk the player is currrently standing at, then this must be a sent chunk and a member of m_SentChunks. Otherwise, this contains an arbitrary value which should not be used.

Definition at line 484 of file ClientHandle.h.

◆ m_ChunksToSend

std::unordered_set<cChunkCoords, cChunkCoordsHash> cClientHandle::m_ChunksToSend
private

Definition at line 453 of file ClientHandle.h.

◆ m_ClientBrand

AString cClientHandle::m_ClientBrand
private

The brand identification of the client, as received in the MC|Brand plugin message or set from a plugin.

Definition at line 566 of file ClientHandle.h.

◆ m_CSChunkLists

cCriticalSection cClientHandle::m_CSChunkLists
private

Definition at line 451 of file ClientHandle.h.

◆ m_CSIncomingData

cCriticalSection cClientHandle::m_CSIncomingData
private

Protects m_IncomingData against multithreaded access.

Definition at line 459 of file ClientHandle.h.

◆ m_CSOutgoingData

cCriticalSection cClientHandle::m_CSOutgoingData
private

Protects m_OutgoingData against multithreaded access.

Definition at line 466 of file ClientHandle.h.

◆ m_CSState

cCriticalSection cClientHandle::m_CSState
private

Definition at line 528 of file ClientHandle.h.

◆ m_CurrentViewDistance

int cClientHandle::m_CurrentViewDistance
private

The actual view distance used, the minimum of client's requested view distance and world's max view distance.

Definition at line 440 of file ClientHandle.h.

◆ m_ForgeHandshake

cForgeHandshake cClientHandle::m_ForgeHandshake
private

Forge handshake state machine.

Definition at line 434 of file ClientHandle.h.

◆ m_ForgeMods

AStringMap cClientHandle::m_ForgeMods
private

Forge mods and versions installed on this client.

Definition at line 437 of file ClientHandle.h.

◆ m_HasSentDC

bool cClientHandle::m_HasSentDC
private

True if a Disconnect packet has been sent in either direction.

Definition at line 488 of file ClientHandle.h.

◆ m_HasSentPlayerChunk

bool cClientHandle::m_HasSentPlayerChunk
private

Set to true when the chunk where the player is is sent to the client.

Used for spawning the player

Definition at line 554 of file ClientHandle.h.

◆ m_HasStartedDigging

bool cClientHandle::m_HasStartedDigging
private

Definition at line 515 of file ClientHandle.h.

◆ m_IncomingData

ContiguousByteBuffer cClientHandle::m_IncomingData
private

Queue for the incoming data received on the link until it is processed in ProcessProtocolIn().

Protected by m_CSIncomingData.

Definition at line 463 of file ClientHandle.h.

◆ m_IPString

AString cClientHandle::m_IPString
private

Definition at line 445 of file ClientHandle.h.

◆ m_LastDigBlockPos

Vector3i cClientHandle::m_LastDigBlockPos
private

Definition at line 516 of file ClientHandle.h.

◆ m_LastPlacedSign

Vector3i cClientHandle::m_LastPlacedSign
private

The positions from the last sign that the player placed.

It's needed to verify the sign text change.

Definition at line 560 of file ClientHandle.h.

◆ m_LastStreamedChunkX

int cClientHandle::m_LastStreamedChunkX
private

Definition at line 491 of file ClientHandle.h.

◆ m_LastStreamedChunkZ

int cClientHandle::m_LastStreamedChunkZ
private

Definition at line 492 of file ClientHandle.h.

◆ m_Link

cTCPLinkPtr cClientHandle::m_Link
private

The link that is used for network communication.

m_CSOutgoingData is used to synchronize access for sending data.

Definition at line 573 of file ClientHandle.h.

◆ m_LoadedChunks

std::unordered_set<cChunkCoords, cChunkCoordsHash> cClientHandle::m_LoadedChunks
private

Definition at line 452 of file ClientHandle.h.

◆ m_Locale

AString cClientHandle::m_Locale
private

Client Settings.

Definition at line 557 of file ClientHandle.h.

◆ m_NumBlockChangeInteractionsThisTick

int cClientHandle::m_NumBlockChangeInteractionsThisTick
private

Number of place or break interactions this tick.

Definition at line 541 of file ClientHandle.h.

◆ m_NumExplosionsThisTick

int cClientHandle::m_NumExplosionsThisTick
private

Number of explosions sent this tick.

Definition at line 538 of file ClientHandle.h.

◆ m_OutgoingData

ContiguousByteBuffer cClientHandle::m_OutgoingData
private

Buffer for storing outgoing data from any thread; will get sent in ProcessProtocolOut() at the end of each tick.

Protected by m_CSOutgoingData.

Definition at line 470 of file ClientHandle.h.

◆ m_Password

AString cClientHandle::m_Password
private

Definition at line 448 of file ClientHandle.h.

◆ m_Ping

std::chrono::steady_clock::duration cClientHandle::m_Ping
private

Duration of the last completed client ping.

Definition at line 501 of file ClientHandle.h.

◆ m_PingID

UInt32 cClientHandle::m_PingID
private

ID of the last ping request sent to the client.

Definition at line 504 of file ClientHandle.h.

◆ m_PingStartTime

std::chrono::steady_clock::time_point cClientHandle::m_PingStartTime
private

Time of the last ping request sent to the client.

Definition at line 507 of file ClientHandle.h.

◆ m_Player

cPlayer* cClientHandle::m_Player
private

A pointer to a World-owned player object, created in FinishAuthenticate when authentication succeeds.

The player should only be accessed from the tick thread of the World that owns him. After the player object is handed off to the World, its lifetime is managed automatically, and strongly owns this client handle. The player self-destructs some time after the client handle enters the Destroyed state. We are therefore guaranteed that while m_State < Destroyed, that is when when we need to access m_Player, m_Player is valid.

Definition at line 477 of file ClientHandle.h.

◆ m_PluginChannels

cChannels cClientHandle::m_PluginChannels
private

The plugin channels that the client has registered.

Definition at line 563 of file ClientHandle.h.

◆ m_Properties

Json::Value cClientHandle::m_Properties
private

Definition at line 449 of file ClientHandle.h.

◆ m_Protocol

cMultiVersionProtocol cClientHandle::m_Protocol
private

Definition at line 456 of file ClientHandle.h.

◆ m_ProtocolVersion

UInt32 cClientHandle::m_ProtocolVersion
private

The version of the protocol that the client is talking, or 0 if unknown.

Definition at line 569 of file ClientHandle.h.

◆ m_ProxyConnection

bool cClientHandle::m_ProxyConnection
private

True if player connected from a proxy (Bungee / Velocity)

Definition at line 486 of file ClientHandle.h.

◆ m_RequestedViewDistance

int cClientHandle::m_RequestedViewDistance
private

The requested view distance from the player.

It isn't clamped with 1 and the max view distance of the world.

Definition at line 443 of file ClientHandle.h.

◆ m_SentChunks

cChunkCoordsList cClientHandle::m_SentChunks
private

Definition at line 454 of file ClientHandle.h.

◆ m_State

std::atomic<eState> cClientHandle::m_State
private

The current (networking) state of the client.

Protected from concurrent writes by m_CSState; but may be read by other threads concurrently. If a function depends on m_State or wants to change m_State, it needs to lock m_CSState. However, if it only uses m_State for a quick bail out, or it doesn't break if the client disconnects in the middle of it, it may just read m_State without locking m_CSState.

Definition at line 535 of file ClientHandle.h.

◆ m_TicksSinceLastPacket

std::atomic<int> cClientHandle::m_TicksSinceLastPacket
private

Number of ticks since the last network packet was received (increased in Tick(), reset in OnReceivedData())

Definition at line 495 of file ClientHandle.h.

◆ m_TimeSinceLastUnloadCheck

std::chrono::milliseconds cClientHandle::m_TimeSinceLastUnloadCheck
private

The time since UnloadOutOfRangeChunks was last called.

Definition at line 498 of file ClientHandle.h.

◆ m_UniqueID

int cClientHandle::m_UniqueID
private

ID used for identification during authenticating.

Assigned sequentially for each new instance.

Definition at line 548 of file ClientHandle.h.

◆ m_Username

AString cClientHandle::m_Username
private

Definition at line 447 of file ClientHandle.h.

◆ m_UUID

cUUID cClientHandle::m_UUID
private

Contains the UUID used by Mojang to identify the player's account.

Definition at line 551 of file ClientHandle.h.

◆ MAX_VIEW_DISTANCE

const int cClientHandle::MAX_VIEW_DISTANCE = 32
static

Definition at line 59 of file ClientHandle.h.

◆ MIN_VIEW_DISTANCE

const int cClientHandle::MIN_VIEW_DISTANCE = 1
static

Definition at line 60 of file ClientHandle.h.

◆ s_ClientCount

int cClientHandle::s_ClientCount = 0
staticprivate

Definition at line 543 of file ClientHandle.h.

◆ s_IllegalPosition

Vector3i cClientHandle::s_IllegalPosition = {0, cChunkDef::Height + 1, 0}
staticprivate

Definition at line 545 of file ClientHandle.h.


The documentation for this class was generated from the following files: