Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <ClientHandle.h>
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 AString & | GetClientBrand (void) const |
Returns the client brand received in the MC|Brand plugin message or set by a plugin. More... | |
const AStringMap & | GetForgeMods (void) const |
Returns the Forge mods installed on the client. More... | |
const AString & | GetIPString (void) const |
AString | GetLocale (void) const |
short | GetPing (void) const |
cPlayer * | GetPlayer (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 AString & | GetUsername (void) const |
const cUUID & | GetUUID (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< AString > | cChannels |
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, cChunkCoordsHash > | m_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, cChunkCoordsHash > | m_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... | |
cPlayer * | m_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< eState > | m_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 |
Definition at line 49 of file ClientHandle.h.
|
private |
The type used for storing the names of registered plugin channels.
Definition at line 431 of file ClientHandle.h.
|
private |
Definition at line 518 of file ClientHandle.h.
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.
|
overridevirtual |
Definition at line 109 of file ClientHandle.cpp.
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.
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.
|
private |
Converts the protocol-formatted channel list (NUL-separated) into a proper string vector.
Definition at line 932 of file ClientHandle.cpp.
bool cClientHandle::BungeeAuthenticate | ( | ) |
Authenticates the specified user with the bungee proxy server.
Definition at line 318 of file ClientHandle.cpp.
|
private |
Returns true if the rate block interactions is within a reasonable limit (bot protection)
Definition at line 2075 of file ClientHandle.cpp.
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.
void cClientHandle::Destroy | ( | void | ) |
Definition at line 122 of file ClientHandle.cpp.
|
private |
Finish logging the user in after authenticating.
Definition at line 416 of file ClientHandle.cpp.
|
private |
The clients will receive a finished dig animation.
Definition at line 1383 of file ClientHandle.cpp.
|
inline |
Add the Forge mod list to the server ping response.
Definition at line 290 of file ClientHandle.h.
|
static |
Definition at line 146 of file ClientHandle.cpp.
|
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.
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.
|
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.
|
inline |
Returns the Forge mods installed on the client.
Definition at line 282 of file ClientHandle.h.
|
inline |
Definition at line 72 of file ClientHandle.h.
|
inline |
Definition at line 268 of file ClientHandle.h.
|
inline |
Definition at line 256 of file ClientHandle.h.
|
inline |
Definition at line 78 of file ClientHandle.h.
|
inline |
Definition at line 88 of file ClientHandle.h.
|
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.
|
inline |
Returns the view distance that the player request, not the used view distance.
Definition at line 265 of file ClientHandle.h.
|
inline |
Definition at line 270 of file ClientHandle.h.
const AString & cClientHandle::GetUsername | ( | void | ) | const |
Definition at line 3277 of file ClientHandle.cpp.
|
inline |
Returns the player's UUID, as used by the protocol.
Definition at line 81 of file ClientHandle.h.
|
inline |
Returns the view distance that the player currently have.
Definition at line 262 of file ClientHandle.h.
void cClientHandle::HandleAnimation | ( | bool | a_SwingMainHand | ) |
Called when the protocol receives a (hand swing) animation packet.
Definition at line 695 of file ClientHandle.cpp.
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.
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.
|
private |
Handles the DIG_FINISHED dig packet:
Definition at line 1306 of file ClientHandle.cpp.
|
private |
Handles the DIG_STARTED dig packet:
Definition at line 1239 of file ClientHandle.cpp.
void cClientHandle::HandleChat | ( | const AString & | a_Message | ) |
Called when the protocol detects a chat packet.
Definition at line 1522 of file ClientHandle.cpp.
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.
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.
void cClientHandle::HandleCraftRecipe | ( | UInt32 | a_RecipeId | ) |
Called when a recipe from the recipe book is selected.
Definition at line 3210 of file ClientHandle.cpp.
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.
void cClientHandle::HandleCrouch | ( | bool | a_IsCrouching | ) |
Handles a player sneaking or unsneaking.
Definition at line 805 of file ClientHandle.cpp.
Called when the player enchants an Item in the Enchanting table UI.
Definition at line 814 of file ClientHandle.cpp.
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.
void cClientHandle::HandleKeepAlive | ( | UInt32 | a_KeepAliveID | ) |
Definition at line 1914 of file ClientHandle.cpp.
void cClientHandle::HandleLeaveBed | ( | ) |
Handles a player exiting his bed.
Definition at line 1975 of file ClientHandle.cpp.
void cClientHandle::HandleLeftClick | ( | Vector3i | a_BlockPos, |
eBlockFace | a_BlockFace, | ||
UInt8 | a_Status | ||
) |
Definition at line 1094 of file ClientHandle.cpp.
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.
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.
void cClientHandle::HandleOpenHorseInventory | ( | ) |
Handles a player opening his inventory while riding a horse.
Definition at line 720 of file ClientHandle.cpp.
void cClientHandle::HandlePing | ( | void | ) |
Definition at line 729 of file ClientHandle.cpp.
void cClientHandle::HandlePlayerAbilities | ( | bool | a_IsFlying, |
float | FlyingSpeed, | ||
float | WalkingSpeed | ||
) |
Definition at line 885 of file ClientHandle.cpp.
void cClientHandle::HandlePlayerLook | ( | float | a_Rotation, |
float | a_Pitch, | ||
bool | a_IsOnGround | ||
) |
Definition at line 1569 of file ClientHandle.cpp.
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.
void cClientHandle::HandlePlayerMoveLook | ( | Vector3d | a_Pos, |
float | a_Rotation, | ||
float | a_Pitch, | ||
bool | a_IsOnGround | ||
) |
Definition at line 1637 of file ClientHandle.cpp.
void cClientHandle::HandlePluginMessage | ( | const AString & | a_Channel, |
ContiguousByteBufferView | a_Message | ||
) |
Definition at line 897 of file ClientHandle.cpp.
void cClientHandle::HandleResourcePack | ( | UInt8 | a_Status | ) |
Definition at line 1885 of file ClientHandle.cpp.
void cClientHandle::HandleRespawn | ( | void | ) |
Definition at line 1898 of file ClientHandle.cpp.
void cClientHandle::HandleRightClick | ( | Vector3i | a_BlockPos, |
eBlockFace | a_BlockFace, | ||
Vector3i | a_Cursor, | ||
bool | a_UsedMainHand | ||
) |
Definition at line 1406 of file ClientHandle.cpp.
void cClientHandle::HandleSlotSelected | ( | Int16 | a_SlotNum | ) |
Definition at line 1647 of file ClientHandle.cpp.
void cClientHandle::HandleSpectate | ( | const cUUID & | a_PlayerUUID | ) |
Definition at line 1657 of file ClientHandle.cpp.
void cClientHandle::HandleSprint | ( | bool | a_IsSprinting | ) |
Handles a player sprinting or slowing back down.
Definition at line 1676 of file ClientHandle.cpp.
void cClientHandle::HandleStartElytraFlight | ( | ) |
Handles a player starting elytra flight while falling.
Definition at line 1685 of file ClientHandle.cpp.
void cClientHandle::HandleSteerVehicle | ( | float | Forward, |
float | Sideways | ||
) |
Definition at line 1694 of file ClientHandle.cpp.
void cClientHandle::HandleTabCompletion | ( | const AString & | a_Text | ) |
Definition at line 1994 of file ClientHandle.cpp.
void cClientHandle::HandleUnmount | ( | void | ) |
Definition at line 1985 of file ClientHandle.cpp.
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.
void cClientHandle::HandleUseEntity | ( | UInt32 | a_TargetEntityID, |
bool | a_IsLeftClick | ||
) |
Definition at line 1750 of file ClientHandle.cpp.
void cClientHandle::HandleUseItem | ( | bool | a_UsedMainHand | ) |
Definition at line 1821 of file ClientHandle.cpp.
void cClientHandle::HandleWindowClick | ( | UInt8 | a_WindowID, |
Int16 | a_SlotNum, | ||
eClickAction | a_ClickAction, | ||
const cItem & | a_HeldItem | ||
) |
Definition at line 1712 of file ClientHandle.cpp.
void cClientHandle::HandleWindowClose | ( | UInt8 | a_WindowID | ) |
Definition at line 1703 of file ClientHandle.cpp.
bool cClientHandle::HasPluginChannel | ( | const AString & | a_PluginChannel | ) |
Definition at line 3316 of file ClientHandle.cpp.
|
inline |
Definition at line 148 of file ClientHandle.h.
|
inline |
Returns true if the client is modded with Forge.
Definition at line 285 of file ClientHandle.h.
|
inline |
Definition at line 137 of file ClientHandle.h.
bool cClientHandle::IsPlayerChunkSent | ( | ) |
Definition at line 2066 of file ClientHandle.cpp.
|
inline |
Definition at line 147 of file ClientHandle.h.
|
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.
|
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.
void cClientHandle::Kick | ( | const AString & | a_Reason | ) |
Definition at line 305 of file ClientHandle.cpp.
|
overrideprivatevirtual |
Called when an error is detected on the connection.
Implements cTCPLink::cCallbacks.
Definition at line 3467 of file ClientHandle.cpp.
|
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.
|
overrideprivatevirtual |
Called when there's data incoming from the remote peer.
Implements cTCPLink::cCallbacks.
Definition at line 3439 of file ClientHandle.cpp.
|
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.
void cClientHandle::PacketBufferFull | ( | void | ) |
Definition at line 3359 of file ClientHandle.cpp.
void cClientHandle::PacketError | ( | UInt32 | a_PacketType | ) |
Definition at line 3381 of file ClientHandle.cpp.
void cClientHandle::PacketUnknown | ( | UInt32 | a_PacketType | ) |
Definition at line 3370 of file ClientHandle.cpp.
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.
void cClientHandle::ProcessProtocolOut | ( | ) |
Flushes all buffered outgoing data to the network.
Definition at line 276 of file ClientHandle.cpp.
Function to mark bungee / proxy connection on this client, and to add proxy-related data.
Definition at line 224 of file ClientHandle.cpp.
void cClientHandle::ProxyInit | ( | const AString & | a_IPString, |
const cUUID & | a_UUID, | ||
const Json::Value & | a_Properties | ||
) |
Definition at line 236 of file ClientHandle.cpp.
|
private |
Adds all of the channels to the list of current plugin channels.
Handles duplicates gracefully.
Definition at line 964 of file ClientHandle.cpp.
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.
Definition at line 2234 of file ClientHandle.cpp.
void cClientHandle::SendBlockAction | ( | Vector3i | a_BlockPos, |
char | a_Byte1, | ||
char | a_Byte2, | ||
BLOCKTYPE | a_BlockType | ||
) |
Definition at line 2261 of file ClientHandle.cpp.
Definition at line 2270 of file ClientHandle.cpp.
void cClientHandle::SendBlockChange | ( | Vector3i | a_BlockPos, |
BLOCKTYPE | a_BlockType, | ||
NIBBLETYPE | a_BlockMeta | ||
) |
Definition at line 2279 of file ClientHandle.cpp.
void cClientHandle::SendBlockChanges | ( | int | a_ChunkX, |
int | a_ChunkZ, | ||
const sSetBlockVector & | a_Changes | ||
) |
Definition at line 2296 of file ClientHandle.cpp.
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.
void cClientHandle::SendBossBarRemove | ( | UInt32 | a_UniqueID | ) |
Definition at line 2360 of file ClientHandle.cpp.
void cClientHandle::SendBossBarUpdateFlags | ( | UInt32 | a_UniqueID, |
bool | a_DarkenSky, | ||
bool | a_PlayEndMusic, | ||
bool | a_CreateFog | ||
) |
Definition at line 2333 of file ClientHandle.cpp.
void cClientHandle::SendBossBarUpdateHealth | ( | UInt32 | a_UniqueID, |
float | a_FractionFilled | ||
) |
Definition at line 2369 of file ClientHandle.cpp.
void cClientHandle::SendBossBarUpdateStyle | ( | UInt32 | a_UniqueID, |
BossBarColor | a_Color, | ||
BossBarDivisionType | a_DivisionType | ||
) |
Definition at line 2342 of file ClientHandle.cpp.
void cClientHandle::SendBossBarUpdateTitle | ( | UInt32 | a_UniqueID, |
const cCompositeChat & | a_Title | ||
) |
Definition at line 2351 of file ClientHandle.cpp.
void cClientHandle::SendCameraSetTo | ( | const cEntity & | a_Entity | ) |
Definition at line 2378 of file ClientHandle.cpp.
void cClientHandle::SendChat | ( | const AString & | a_Message, |
eMessageType | a_ChatPrefix, | ||
const AString & | a_AdditionalData = "" |
||
) |
Definition at line 2387 of file ClientHandle.cpp.
void cClientHandle::SendChat | ( | const cCompositeChat & | a_Message | ) |
Definition at line 2408 of file ClientHandle.cpp.
void cClientHandle::SendChatAboveActionBar | ( | const AString & | a_Message, |
eMessageType | a_ChatPrefix, | ||
const AString & | a_AdditionalData = "" |
||
) |
Definition at line 2437 of file ClientHandle.cpp.
void cClientHandle::SendChatAboveActionBar | ( | const cCompositeChat & | a_Message | ) |
Definition at line 2457 of file ClientHandle.cpp.
Definition at line 2428 of file ClientHandle.cpp.
void cClientHandle::SendChatSystem | ( | const AString & | a_Message, |
eMessageType | a_ChatPrefix, | ||
const AString & | a_AdditionalData = "" |
||
) |
Definition at line 2466 of file ClientHandle.cpp.
void cClientHandle::SendChatSystem | ( | const cCompositeChat & | a_Message | ) |
Definition at line 2487 of file ClientHandle.cpp.
void cClientHandle::SendChunkData | ( | int | a_ChunkX, |
int | a_ChunkZ, | ||
ContiguousByteBufferView | a_ChunkData | ||
) |
Definition at line 2496 of file ClientHandle.cpp.
void cClientHandle::SendCollectEntity | ( | const cEntity & | a_Collected, |
const cEntity & | a_Collector, | ||
unsigned | a_Count | ||
) |
Definition at line 2539 of file ClientHandle.cpp.
void cClientHandle::SendData | ( | ContiguousByteBufferView | a_Data | ) |
Definition at line 2023 of file ClientHandle.cpp.
void cClientHandle::SendDestroyEntity | ( | const cEntity & | a_Entity | ) |
Definition at line 2548 of file ClientHandle.cpp.
void cClientHandle::SendDetachEntity | ( | const cEntity & | a_Entity, |
const cEntity & | a_PreviousVehicle | ||
) |
Definition at line 2557 of file ClientHandle.cpp.
void cClientHandle::SendDisconnect | ( | const AString & | a_Reason | ) |
Definition at line 2566 of file ClientHandle.cpp.
void cClientHandle::SendDisplayObjective | ( | const AString & | a_Objective, |
cScoreboard::eDisplaySlot | a_Display | ||
) |
Definition at line 3017 of file ClientHandle.cpp.
void cClientHandle::SendEditSign | ( | Vector3i | a_BlockPos | ) |
Definition at line 2579 of file ClientHandle.cpp.
void cClientHandle::SendEntityAnimation | ( | const cEntity & | a_Entity, |
EntityAnimation | a_Animation | ||
) |
Definition at line 2784 of file ClientHandle.cpp.
void cClientHandle::SendEntityEffect | ( | const cEntity & | a_Entity, |
int | a_EffectID, | ||
int | a_Amplifier, | ||
int | a_Duration | ||
) |
Definition at line 2589 of file ClientHandle.cpp.
void cClientHandle::SendEntityEquipment | ( | const cEntity & | a_Entity, |
short | a_SlotNum, | ||
const cItem & | a_Item | ||
) |
Definition at line 2598 of file ClientHandle.cpp.
void cClientHandle::SendEntityHeadLook | ( | const cEntity & | a_Entity | ) |
Definition at line 2607 of file ClientHandle.cpp.
void cClientHandle::SendEntityLook | ( | const cEntity & | a_Entity | ) |
Definition at line 2618 of file ClientHandle.cpp.
void cClientHandle::SendEntityMetadata | ( | const cEntity & | a_Entity | ) |
Definition at line 2629 of file ClientHandle.cpp.
void cClientHandle::SendEntityPosition | ( | const cEntity & | a_Entity | ) |
Definition at line 2638 of file ClientHandle.cpp.
void cClientHandle::SendEntityProperties | ( | const cEntity & | a_Entity | ) |
Definition at line 2647 of file ClientHandle.cpp.
void cClientHandle::SendEntityVelocity | ( | const cEntity & | a_Entity | ) |
Definition at line 2656 of file ClientHandle.cpp.
void cClientHandle::SendExperience | ( | void | ) |
Definition at line 2972 of file ClientHandle.cpp.
void cClientHandle::SendExperienceOrb | ( | const cExpOrb & | a_ExpOrb | ) |
Definition at line 2981 of file ClientHandle.cpp.
void cClientHandle::SendExplosion | ( | Vector3f | a_Position, |
float | a_Power | ||
) |
Definition at line 2665 of file ClientHandle.cpp.
void cClientHandle::SendGameMode | ( | eGameMode | a_GameMode | ) |
Definition at line 2703 of file ClientHandle.cpp.
void cClientHandle::SendHealth | ( | void | ) |
Definition at line 2712 of file ClientHandle.cpp.
void cClientHandle::SendHeldItemChange | ( | int | a_ItemIndex | ) |
Definition at line 2721 of file ClientHandle.cpp.
void cClientHandle::SendHideTitle | ( | void | ) |
Definition at line 2730 of file ClientHandle.cpp.
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.
void cClientHandle::SendInventorySlot | ( | char | a_WindowID, |
short | a_SlotNum, | ||
const cItem & | a_Item | ||
) |
Definition at line 2739 of file ClientHandle.cpp.
Definition at line 2243 of file ClientHandle.cpp.
void cClientHandle::SendMapData | ( | const cMap & | a_Map, |
int | a_DataStartX, | ||
int | a_DataStartY | ||
) |
Definition at line 2748 of file ClientHandle.cpp.
void cClientHandle::SendPaintingSpawn | ( | const cPainting & | a_Painting | ) |
Definition at line 2775 of file ClientHandle.cpp.
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.
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.
void cClientHandle::SendPlayerAbilities | ( | void | ) |
Definition at line 2793 of file ClientHandle.cpp.
void cClientHandle::SendPlayerListAddPlayer | ( | const cPlayer & | a_Player | ) |
Definition at line 2802 of file ClientHandle.cpp.
void cClientHandle::SendPlayerListHeaderFooter | ( | const cCompositeChat & | a_Header, |
const cCompositeChat & | a_Footer | ||
) |
Definition at line 2811 of file ClientHandle.cpp.
void cClientHandle::SendPlayerListRemovePlayer | ( | const cPlayer & | a_Player | ) |
Definition at line 2820 of file ClientHandle.cpp.
void cClientHandle::SendPlayerListUpdateDisplayName | ( | const cPlayer & | a_Player, |
const AString & | a_CustomName | ||
) |
Definition at line 2829 of file ClientHandle.cpp.
void cClientHandle::SendPlayerListUpdateGameMode | ( | const cPlayer & | a_Player | ) |
Definition at line 2838 of file ClientHandle.cpp.
void cClientHandle::SendPlayerListUpdatePing | ( | ) |
Definition at line 2847 of file ClientHandle.cpp.
void cClientHandle::SendPlayerMoveLook | ( | Vector3d | a_Pos, |
float | a_Yaw, | ||
float | a_Pitch, | ||
bool | a_IsRelative | ||
) |
Definition at line 2856 of file ClientHandle.cpp.
void cClientHandle::SendPlayerMoveLook | ( | void | ) |
Definition at line 2865 of file ClientHandle.cpp.
void cClientHandle::SendPlayerPermissionLevel | ( | void | ) |
Definition at line 2879 of file ClientHandle.cpp.
void cClientHandle::SendPlayerPosition | ( | void | ) |
Definition at line 2888 of file ClientHandle.cpp.
void cClientHandle::SendPlayerSpawn | ( | const cPlayer & | a_Player | ) |
Definition at line 2897 of file ClientHandle.cpp.
void cClientHandle::SendPluginMessage | ( | const AString & | a_Channel, |
ContiguousByteBufferView | a_Message | ||
) |
Definition at line 2925 of file ClientHandle.cpp.
void cClientHandle::SendPluginMessage | ( | const AString & | a_Channel, |
std::string_view | a_Message | ||
) |
Definition at line 2916 of file ClientHandle.cpp.
void cClientHandle::SendRemoveEntityEffect | ( | const cEntity & | a_Entity, |
int | a_EffectID | ||
) |
Definition at line 2934 of file ClientHandle.cpp.
void cClientHandle::SendResetTitle | ( | void | ) |
Definition at line 2943 of file ClientHandle.cpp.
void cClientHandle::SendResourcePack | ( | const AString & | a_ResourcePackUrl | ) |
Definition at line 2990 of file ClientHandle.cpp.
void cClientHandle::SendRespawn | ( | eDimension | a_Dimension, |
bool | a_IsRespawningFromDeath | ||
) |
Definition at line 2952 of file ClientHandle.cpp.
void cClientHandle::SendScoreboardObjective | ( | const AString & | a_Name, |
const AString & | a_DisplayName, | ||
Byte | a_Mode | ||
) |
Definition at line 2999 of file ClientHandle.cpp.
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.
void cClientHandle::SendSetRawSubTitle | ( | const AString & | a_SubTitle | ) |
Definition at line 3035 of file ClientHandle.cpp.
void cClientHandle::SendSetRawTitle | ( | const AString & | a_Title | ) |
Definition at line 3053 of file ClientHandle.cpp.
void cClientHandle::SendSetSubTitle | ( | const cCompositeChat & | a_SubTitle | ) |
Definition at line 3026 of file ClientHandle.cpp.
void cClientHandle::SendSetTitle | ( | const cCompositeChat & | a_Title | ) |
Definition at line 3044 of file ClientHandle.cpp.
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.
void cClientHandle::SendSoundEffect | ( | const AString & | a_SoundName, |
Vector3d | a_Position, | ||
float | a_Volume, | ||
float | a_Pitch | ||
) |
Definition at line 3072 of file ClientHandle.cpp.
void cClientHandle::SendSoundParticleEffect | ( | const EffectID | a_EffectID, |
Vector3i | a_Source, | ||
int | a_Data | ||
) |
Definition at line 3081 of file ClientHandle.cpp.
void cClientHandle::SendSpawnEntity | ( | const cEntity & | a_Entity | ) |
Definition at line 3090 of file ClientHandle.cpp.
void cClientHandle::SendSpawnMob | ( | const cMonster & | a_Mob | ) |
Definition at line 3099 of file ClientHandle.cpp.
void cClientHandle::SendStatistics | ( | const StatisticsManager & | a_Manager | ) |
Definition at line 3108 of file ClientHandle.cpp.
void cClientHandle::SendTabCompletionResults | ( | const AStringVector & | a_Results | ) |
Definition at line 3117 of file ClientHandle.cpp.
void cClientHandle::SendThunderbolt | ( | Vector3i | a_BlockPos | ) |
Definition at line 3126 of file ClientHandle.cpp.
void cClientHandle::SendTimeUpdate | ( | cTickTimeLong | a_WorldAge, |
cTickTimeLong | a_WorldDate, | ||
bool | a_DoDaylightCycle | ||
) |
Definition at line 3144 of file ClientHandle.cpp.
void cClientHandle::SendTitleTimes | ( | int | a_FadeInTicks, |
int | a_DisplayTicks, | ||
int | a_FadeOutTicks | ||
) |
Definition at line 3135 of file ClientHandle.cpp.
void cClientHandle::SendUnleashEntity | ( | const cEntity & | a_Entity | ) |
Definition at line 2252 of file ClientHandle.cpp.
void cClientHandle::SendUnloadChunk | ( | int | a_ChunkX, |
int | a_ChunkZ | ||
) |
Definition at line 3153 of file ClientHandle.cpp.
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.
void cClientHandle::SendUpdateBlockEntity | ( | cBlockEntity & | a_BlockEntity | ) |
Definition at line 3168 of file ClientHandle.cpp.
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.
void cClientHandle::SendWeather | ( | eWeather | a_Weather | ) |
Definition at line 3232 of file ClientHandle.cpp.
void cClientHandle::SendWholeInventory | ( | const cWindow & | a_Window | ) |
Definition at line 3241 of file ClientHandle.cpp.
void cClientHandle::SendWindowClose | ( | const cWindow & | a_Window | ) |
Definition at line 3250 of file ClientHandle.cpp.
void cClientHandle::SendWindowOpen | ( | const cWindow & | a_Window | ) |
Definition at line 3259 of file ClientHandle.cpp.
void cClientHandle::SendWindowProperty | ( | const cWindow & | a_Window, |
size_t | a_Property, | ||
short | a_Value | ||
) |
Definition at line 3268 of file ClientHandle.cpp.
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.
|
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.
|
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.
|
inline |
Mark a client connection as using Forge.
Set by the protocol.
Definition at line 296 of file ClientHandle.h.
|
inline |
Definition at line 267 of file ClientHandle.h.
|
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.
|
inline |
Called by the protocol recognizer when the protocol version is known.
Definition at line 419 of file ClientHandle.h.
|
private |
Called to update m_State.
Only succeeds if a_NewState > m_State, otherwise returns false.
Definition at line 3415 of file ClientHandle.cpp.
void cClientHandle::SetUsername | ( | AString && | a_Username | ) |
Definition at line 3286 of file ClientHandle.cpp.
|
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.
void cClientHandle::SetViewDistance | ( | int | a_ViewDistance | ) |
Sets the maximal view distance.
Definition at line 3295 of file ClientHandle.cpp.
|
private |
Called when the network socket has been closed.
Definition at line 3391 of file ClientHandle.cpp.
|
private |
Adds a single chunk to be streamed to the client; used by StreamChunks()
Definition at line 675 of file ClientHandle.cpp.
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.
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.
void cClientHandle::UnloadOutOfRangeChunks | ( | void | ) |
Remove all loaded chunks that are no longer in range.
Definition at line 626 of file ClientHandle.cpp.
|
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.
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.
|
friend |
Definition at line 428 of file ClientHandle.h.
|
static |
Definition at line 57 of file ClientHandle.h.
|
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.
|
private |
Definition at line 512 of file ClientHandle.h.
|
private |
Definition at line 511 of file ClientHandle.h.
|
private |
Definition at line 510 of file ClientHandle.h.
|
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.
|
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.
|
private |
Definition at line 453 of file ClientHandle.h.
|
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.
|
private |
Definition at line 451 of file ClientHandle.h.
|
private |
Protects m_IncomingData against multithreaded access.
Definition at line 459 of file ClientHandle.h.
|
private |
Protects m_OutgoingData against multithreaded access.
Definition at line 466 of file ClientHandle.h.
|
private |
Definition at line 528 of file ClientHandle.h.
|
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.
|
private |
Forge handshake state machine.
Definition at line 434 of file ClientHandle.h.
|
private |
Forge mods and versions installed on this client.
Definition at line 437 of file ClientHandle.h.
|
private |
True if a Disconnect packet has been sent in either direction.
Definition at line 488 of file ClientHandle.h.
|
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.
|
private |
Definition at line 515 of file ClientHandle.h.
|
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.
|
private |
Definition at line 445 of file ClientHandle.h.
|
private |
Definition at line 516 of file ClientHandle.h.
|
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.
|
private |
Definition at line 491 of file ClientHandle.h.
|
private |
Definition at line 492 of file ClientHandle.h.
|
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.
|
private |
Definition at line 452 of file ClientHandle.h.
|
private |
Client Settings.
Definition at line 557 of file ClientHandle.h.
|
private |
Number of place or break interactions this tick.
Definition at line 541 of file ClientHandle.h.
|
private |
Number of explosions sent this tick.
Definition at line 538 of file ClientHandle.h.
|
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.
|
private |
Definition at line 448 of file ClientHandle.h.
|
private |
Duration of the last completed client ping.
Definition at line 501 of file ClientHandle.h.
|
private |
ID of the last ping request sent to the client.
Definition at line 504 of file ClientHandle.h.
|
private |
Time of the last ping request sent to the client.
Definition at line 507 of file ClientHandle.h.
|
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.
|
private |
The plugin channels that the client has registered.
Definition at line 563 of file ClientHandle.h.
|
private |
Definition at line 449 of file ClientHandle.h.
|
private |
Definition at line 456 of file ClientHandle.h.
|
private |
The version of the protocol that the client is talking, or 0 if unknown.
Definition at line 569 of file ClientHandle.h.
|
private |
True if player connected from a proxy (Bungee / Velocity)
Definition at line 486 of file ClientHandle.h.
|
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.
|
private |
Definition at line 454 of file ClientHandle.h.
|
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.
|
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.
|
private |
The time since UnloadOutOfRangeChunks was last called.
Definition at line 498 of file ClientHandle.h.
|
private |
ID used for identification during authenticating.
Assigned sequentially for each new instance.
Definition at line 548 of file ClientHandle.h.
|
private |
Definition at line 447 of file ClientHandle.h.
|
private |
Contains the UUID used by Mojang to identify the player's account.
Definition at line 551 of file ClientHandle.h.
|
static |
Definition at line 59 of file ClientHandle.h.
|
static |
Definition at line 60 of file ClientHandle.h.
|
staticprivate |
Definition at line 543 of file ClientHandle.h.
|
staticprivate |
Definition at line 545 of file ClientHandle.h.