mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Basic support for 1.19.2
This commit is contained in:
parent
af1485c753
commit
c34dd46067
14 changed files with 703 additions and 129 deletions
74
MinecraftClient/Protocol/Message/ChatMessage.cs
Normal file
74
MinecraftClient/Protocol/Message/ChatMessage.cs
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MinecraftClient.Protocol.Message
|
||||
{
|
||||
public class ChatMessage
|
||||
{
|
||||
// in 1.19 and above, isSignedChat = true
|
||||
public readonly bool isSignedChat;
|
||||
|
||||
public readonly string content;
|
||||
|
||||
public readonly bool isJson;
|
||||
|
||||
// 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar), 3: say command,
|
||||
// 4: msg command, 5: team msg command, 6: emote command, 7: tellraw command
|
||||
public readonly int chatTypeId;
|
||||
|
||||
public readonly Guid senderUUID;
|
||||
|
||||
public readonly bool isSystemChat;
|
||||
|
||||
public readonly string? unsignedContent;
|
||||
|
||||
public readonly string? displayName;
|
||||
|
||||
public readonly string? teamName;
|
||||
|
||||
public readonly DateTime? timestamp;
|
||||
|
||||
public readonly byte[]? signature;
|
||||
|
||||
public readonly bool? isSignatureLegal;
|
||||
|
||||
public ChatMessage(string content, bool isJson, int chatType, Guid senderUUID, string? unsignedContent, string displayName, string? teamName, long timestamp, byte[] signature, bool isSignatureLegal)
|
||||
{
|
||||
isSignedChat = true;
|
||||
isSystemChat = false;
|
||||
this.content = content;
|
||||
this.isJson = isJson;
|
||||
this.chatTypeId = chatType;
|
||||
this.senderUUID = senderUUID;
|
||||
this.unsignedContent = unsignedContent;
|
||||
this.displayName = displayName;
|
||||
this.teamName = teamName;
|
||||
this.timestamp = DateTimeOffset.FromUnixTimeMilliseconds(timestamp).DateTime;
|
||||
this.signature = signature;
|
||||
this.isSignatureLegal = isSignatureLegal;
|
||||
}
|
||||
|
||||
public ChatMessage(string content, bool isJson, int chatType, Guid senderUUID, bool isSystemChat = false)
|
||||
{
|
||||
isSignedChat = isSystemChat;
|
||||
this.isSystemChat = isSystemChat;
|
||||
this.content = content;
|
||||
this.isJson = isJson;
|
||||
this.chatTypeId = chatType;
|
||||
this.senderUUID = senderUUID;
|
||||
}
|
||||
|
||||
public LastSeenMessageList.Entry? toLastSeenMessageEntry()
|
||||
{
|
||||
return signature != null ? new LastSeenMessageList.Entry(senderUUID, signature) : null;
|
||||
}
|
||||
|
||||
public bool lacksSender()
|
||||
{
|
||||
return this.senderUUID == Guid.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue