mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Trim
This commit is contained in:
parent
c8cecabc5c
commit
684dcb3fc6
2 changed files with 14 additions and 8 deletions
|
|
@ -1018,14 +1018,20 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
string name = dataTypes.ReadNextString(packetData); // Player name
|
||||
int propNum = dataTypes.ReadNextVarInt(packetData); // Number of properties in the following array
|
||||
|
||||
Tuple<string, string, string>[]? property = null; // Property: Tuple<Name, Value, Signature(empty if there is no signature)
|
||||
// Property: Tuple<Name, Value, Signature(empty if there is no signature)
|
||||
// The Property field looks as in the response of https://wiki.vg/Mojang_API#UUID_to_Profile_and_Skin.2FCape
|
||||
const bool useProperty = false;
|
||||
Tuple<string, string, string?>[]? properties = useProperty ?
|
||||
new Tuple<string, string, string?>[propNum] : null;
|
||||
for (int p = 0; p < propNum; p++)
|
||||
{
|
||||
string key = dataTypes.ReadNextString(packetData); // Name
|
||||
string val = dataTypes.ReadNextString(packetData); // Value
|
||||
|
||||
string propertyName = dataTypes.ReadNextString(packetData); // Name: String (32767)
|
||||
string val = dataTypes.ReadNextString(packetData); // Value: String (32767)
|
||||
string? propertySignature = null;
|
||||
if (dataTypes.ReadNextBool(packetData)) // Is Signed
|
||||
dataTypes.ReadNextString(packetData); // Signature
|
||||
propertySignature = dataTypes.ReadNextString(packetData); // Signature: String (32767)
|
||||
if (useProperty)
|
||||
properties![p] = new(propertyName, val, propertySignature);
|
||||
}
|
||||
|
||||
int gameMode = dataTypes.ReadNextVarInt(packetData); // Gamemode
|
||||
|
|
@ -1056,7 +1062,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
}
|
||||
|
||||
handler.OnPlayerJoin(new PlayerInfo(uuid, name, property, gameMode, ping, displayName, keyExpiration, publicKey, signature));
|
||||
handler.OnPlayerJoin(new PlayerInfo(uuid, name, properties, gameMode, ping, displayName, keyExpiration, publicKey, signature));
|
||||
break;
|
||||
case 0x01: //Update gamemode
|
||||
handler.OnGamemodeUpdate(uuid, dataTypes.ReadNextVarInt(packetData));
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace MinecraftClient.Protocol
|
|||
public readonly string Name;
|
||||
|
||||
// Tuple<Name, Value, Signature(empty if there is no signature)
|
||||
public readonly Tuple<string, string, string>[]? Property;
|
||||
public readonly Tuple<string, string, string?>[]? Property;
|
||||
|
||||
public int Gamemode;
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ namespace MinecraftClient.Protocol
|
|||
|
||||
private byte[]? precedingSignature;
|
||||
|
||||
public PlayerInfo(Guid uuid, string name, Tuple<string, string, string>[]? property, int gamemode, int ping, string? displayName, long? timeStamp, byte[]? publicKey, byte[]? signature)
|
||||
public PlayerInfo(Guid uuid, string name, Tuple<string, string, string?>[]? property, int gamemode, int ping, string? displayName, long? timeStamp, byte[]? publicKey, byte[]? signature)
|
||||
{
|
||||
Uuid = uuid;
|
||||
Name = name;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue