A cClientHandle represents the technical aspect of a connected player - their game client
connection. Internally, it handles all the incoming and outgoing packets, the chunks that are to be
sent to the client, ping times etc.
Name | Parameters | Return value | Notes |
GenerateOfflineUUID |
Username |
string |
(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. Returns a 32-char UUID (no dashes). |
GetClientBrand |
|
string |
Returns the brand that the client has sent in their MC|Brand plugin message. |
GetIPString |
|
string |
Returns the IP address of the connection, as a string. Only the address part is returned, without the port number. |
GetLocale |
|
Locale |
Returns the locale string that the client sends as part of the protocol handshake. Can be used to provide localized strings. |
GetPing |
|
number |
Returns the ping time, in ms |
GetPlayer |
|
cPlayer |
Returns the player object connected to this client. Note that this may be nil, for example if the player object is not yet spawned. |
GetProtocolVersion |
|
number |
Returns the protocol version number of the protocol that the client is talking. Returns zero if the protocol version is not (yet) known. |
GetRequestedViewDistance |
|
number |
Returns the view distance that the player request, not the used view distance. |
GetUUID |
|
string |
Returns the authentication-based UUID of the client. This UUID should be used to identify the player when persisting any player-related data. Returns a 32-char UUID (no dashes) |
GetUniqueID |
|
number |
Returns the UniqueID of the client used to identify the client in the server |
GetUsername |
|
string |
Returns the username that the client has provided |
GetViewDistance |
|
number |
Returns the viewdistance (number of chunks loaded for the player in each direction) |
HasPluginChannel |
ChannelName |
bool |
Returns true if the client has registered to receive messages on the specified plugin channel. |
IsUUIDOnline |
UUID |
bool |
(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. Accepts both 32-char and 36-char UUIDs (with and without dashes). If the string given is not a valid UUID, returns false. |
Kick |
Reason |
|
Kicks the user with the specified reason |
SendBlockChange |
BlockX, BlockY, BlockZ, BlockType, BlockMeta |
|
Sends a BlockChange packet to the client. This can be used to create fake blocks only for that player. |
SendEntityAnimation |
Entity, AnimationNumber |
|
Sends the specified animation of the specified entity to the client. The AnimationNumber is protocol-specific. |
SendPluginMessage |
Channel, Message |
|
Sends the plugin message on the specified channel. |
SendSoundEffect |
SoundName, X, Y, Z, Volume, Pitch |
|
Sends a sound effect request to the client. The sound is played at the specified coords, with the specified volume (a float, 1.0 is full volume, can be more) and pitch (0-255, 63 is 100%) |
SendTimeUpdate |
WorldAge, TimeOfDay, DoDaylightCycle |
|
Sends the specified time update to the client. WorldAge is the total age of the world, in ticks. TimeOfDay is the current day's time, in ticks (0 - 24000). DoDaylightCycle is a bool that specifies whether the client should automatically move the sun (true) or keep it in the same place (false). |
SetClientBrand |
ClientBrand |
|
Sets the value of the client's brand. Normally this value is received from the client by a MC|Brand plugin message, this function lets plugins overwrite the value. |
SetLocale |
Locale |
|
Sets the locale that Cuberite keeps on record. Initially the locale is initialized in protocol handshake, this function allows plugins to override the stored value (but only server-side and only until the user disconnects). |
SetUsername |
Name |
|
Sets the username |
SetViewDistance |
ViewDistance |
|
Sets the viewdistance (number of chunks loaded for the player in each direction) |