mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Bug fix
This commit is contained in:
parent
d3cf0f4adf
commit
e9f227ca5b
4 changed files with 45 additions and 11 deletions
|
|
@ -408,12 +408,12 @@ namespace MinecraftClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
InternalConfig.Username = InternalConfig.Login;
|
InternalConfig.Username = InternalConfig.Login;
|
||||||
if (string.IsNullOrEmpty(Config.Main.General.Account.Password) && !useBrowser &&
|
if (string.IsNullOrEmpty(Config.Main.General.Account.Password) && string.IsNullOrEmpty(InternalConfig.Password) && !useBrowser &&
|
||||||
(Config.Main.Advanced.SessionCache == CacheType.none || !SessionCache.Contains(Settings.ToLowerIfNeed(InternalConfig.Login))))
|
(Config.Main.Advanced.SessionCache == CacheType.none || !SessionCache.Contains(Settings.ToLowerIfNeed(InternalConfig.Login))))
|
||||||
{
|
{
|
||||||
RequestPassword();
|
RequestPassword();
|
||||||
}
|
}
|
||||||
else
|
else if (string.IsNullOrEmpty(InternalConfig.Password))
|
||||||
{
|
{
|
||||||
InternalConfig.Password = Config.Main.General.Account.Password;
|
InternalConfig.Password = Config.Main.General.Account.Password;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2236,7 +2236,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
byte[] fields = dataTypes.GetAcknowledgment(acknowledgment, isOnlineMode);
|
byte[] fields = dataTypes.GetAcknowledgment(acknowledgment, isOnlineMode && Config.Signature.LoginWithSecureProfile);
|
||||||
|
|
||||||
SendPacket(PacketTypesOut.MessageAcknowledgment, fields);
|
SendPacket(PacketTypesOut.MessageAcknowledgment, fields);
|
||||||
|
|
||||||
|
|
@ -2298,7 +2298,8 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
fields.AddRange(dataTypes.GetLong(timeNow.ToUnixTimeMilliseconds()));
|
fields.AddRange(dataTypes.GetLong(timeNow.ToUnixTimeMilliseconds()));
|
||||||
|
|
||||||
List<Tuple<string, string>>? needSigned = null; // List< Argument Name, Argument Value >
|
List<Tuple<string, string>>? needSigned = null; // List< Argument Name, Argument Value >
|
||||||
if (playerKeyPair != null && isOnlineMode && Config.Signature.SignMessageInCommand && protocolVersion >= MC_1_19_Version)
|
if (playerKeyPair != null && isOnlineMode && protocolVersion >= MC_1_19_Version
|
||||||
|
&& Config.Signature.LoginWithSecureProfile && Config.Signature.SignMessageInCommand)
|
||||||
needSigned = DeclareCommands.CollectSignArguments(command);
|
needSigned = DeclareCommands.CollectSignArguments(command);
|
||||||
|
|
||||||
if (needSigned == null || needSigned!.Count == 0)
|
if (needSigned == null || needSigned!.Count == 0)
|
||||||
|
|
@ -2329,7 +2330,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
if (protocolVersion >= MC_1_19_2_Version)
|
if (protocolVersion >= MC_1_19_2_Version)
|
||||||
{
|
{
|
||||||
// Message Acknowledgment
|
// Message Acknowledgment
|
||||||
fields.AddRange(dataTypes.GetAcknowledgment(acknowledgment!, isOnlineMode));
|
fields.AddRange(dataTypes.GetAcknowledgment(acknowledgment!, isOnlineMode && Config.Signature.LoginWithSecureProfile));
|
||||||
}
|
}
|
||||||
|
|
||||||
SendPacket(PacketTypesOut.ChatCommand, fields);
|
SendPacket(PacketTypesOut.ChatCommand, fields);
|
||||||
|
|
@ -2371,7 +2372,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
DateTimeOffset timeNow = DateTimeOffset.UtcNow;
|
DateTimeOffset timeNow = DateTimeOffset.UtcNow;
|
||||||
fields.AddRange(dataTypes.GetLong(timeNow.ToUnixTimeMilliseconds()));
|
fields.AddRange(dataTypes.GetLong(timeNow.ToUnixTimeMilliseconds()));
|
||||||
|
|
||||||
if (!isOnlineMode || playerKeyPair == null || !Config.Signature.SignChat)
|
if (!isOnlineMode || playerKeyPair == null || !Config.Signature.LoginWithSecureProfile || !Config.Signature.SignChat)
|
||||||
{
|
{
|
||||||
fields.AddRange(dataTypes.GetLong(0)); // Salt: Long
|
fields.AddRange(dataTypes.GetLong(0)); // Salt: Long
|
||||||
fields.AddRange(dataTypes.GetVarInt(0)); // Signature Length: VarInt
|
fields.AddRange(dataTypes.GetVarInt(0)); // Signature Length: VarInt
|
||||||
|
|
@ -2397,7 +2398,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
if (protocolVersion >= MC_1_19_2_Version)
|
if (protocolVersion >= MC_1_19_2_Version)
|
||||||
{
|
{
|
||||||
// Message Acknowledgment
|
// Message Acknowledgment
|
||||||
fields.AddRange(dataTypes.GetAcknowledgment(acknowledgment!, isOnlineMode));
|
fields.AddRange(dataTypes.GetAcknowledgment(acknowledgment!, isOnlineMode && Config.Signature.LoginWithSecureProfile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SendPacket(PacketTypesOut.ChatMessage, fields);
|
SendPacket(PacketTypesOut.ChatMessage, fields);
|
||||||
|
|
|
||||||
|
|
@ -568,7 +568,7 @@ namespace MinecraftClient
|
||||||
//User-defined regex for private chat messages
|
//User-defined regex for private chat messages
|
||||||
if (Config.ChatFormat.UserDefined && !string.IsNullOrWhiteSpace(Config.ChatFormat.Private))
|
if (Config.ChatFormat.UserDefined && !string.IsNullOrWhiteSpace(Config.ChatFormat.Private))
|
||||||
{
|
{
|
||||||
Match regexMatch = new Regex(Config.ChatFormat.Private).Match(text);
|
Match regexMatch = Regex.Match(text, Config.ChatFormat.Private);
|
||||||
if (regexMatch.Success && regexMatch.Groups.Count >= 3)
|
if (regexMatch.Success && regexMatch.Groups.Count >= 3)
|
||||||
{
|
{
|
||||||
sender = regexMatch.Groups[1].Value;
|
sender = regexMatch.Groups[1].Value;
|
||||||
|
|
@ -679,7 +679,7 @@ namespace MinecraftClient
|
||||||
//User-defined regex for public chat messages
|
//User-defined regex for public chat messages
|
||||||
if (Config.ChatFormat.UserDefined && !string.IsNullOrWhiteSpace(Config.ChatFormat.Public))
|
if (Config.ChatFormat.UserDefined && !string.IsNullOrWhiteSpace(Config.ChatFormat.Public))
|
||||||
{
|
{
|
||||||
Match regexMatch = new Regex(Config.ChatFormat.Public).Match(text);
|
Match regexMatch = Regex.Match(text, Config.ChatFormat.Public);
|
||||||
if (regexMatch.Success && regexMatch.Groups.Count >= 3)
|
if (regexMatch.Success && regexMatch.Groups.Count >= 3)
|
||||||
{
|
{
|
||||||
sender = regexMatch.Groups[1].Value;
|
sender = regexMatch.Groups[1].Value;
|
||||||
|
|
@ -782,7 +782,7 @@ namespace MinecraftClient
|
||||||
//User-defined regex for teleport requests
|
//User-defined regex for teleport requests
|
||||||
if (Config.ChatFormat.UserDefined && !string.IsNullOrWhiteSpace(Config.ChatFormat.TeleportRequest))
|
if (Config.ChatFormat.UserDefined && !string.IsNullOrWhiteSpace(Config.ChatFormat.TeleportRequest))
|
||||||
{
|
{
|
||||||
Match regexMatch = new Regex(Config.ChatFormat.TeleportRequest).Match(text);
|
Match regexMatch = Regex.Match(text, Config.ChatFormat.TeleportRequest);
|
||||||
if (regexMatch.Success && regexMatch.Groups.Count >= 2)
|
if (regexMatch.Success && regexMatch.Groups.Count >= 2)
|
||||||
{
|
{
|
||||||
sender = regexMatch.Groups[1].Value;
|
sender = regexMatch.Groups[1].Value;
|
||||||
|
|
|
||||||
|
|
@ -969,7 +969,40 @@ namespace MinecraftClient
|
||||||
|
|
||||||
public string TeleportRequest = @"^([a-zA-Z0-9_]+) has requested (?:to|that you) teleport to (?:you|them)\.$";
|
public string TeleportRequest = @"^([a-zA-Z0-9_]+) has requested (?:to|that you) teleport to (?:you|them)\.$";
|
||||||
|
|
||||||
public void OnSettingUpdate() { }
|
public void OnSettingUpdate()
|
||||||
|
{
|
||||||
|
if (UserDefined)
|
||||||
|
{
|
||||||
|
bool checkResult = true;
|
||||||
|
|
||||||
|
try { _ = new Regex(Public); }
|
||||||
|
catch (ArgumentException)
|
||||||
|
{
|
||||||
|
checkResult = false;
|
||||||
|
ConsoleIO.WriteLineFormatted("§cIllegal regular expression: ChatFormat.Public = " + Public);
|
||||||
|
}
|
||||||
|
|
||||||
|
try { _ = new Regex(Private); }
|
||||||
|
catch (ArgumentException)
|
||||||
|
{
|
||||||
|
checkResult = false;
|
||||||
|
ConsoleIO.WriteLineFormatted("§cIllegal regular expression: ChatFormat.Private = " + Private);
|
||||||
|
}
|
||||||
|
|
||||||
|
try { _ = new Regex(TeleportRequest); }
|
||||||
|
catch (ArgumentException)
|
||||||
|
{
|
||||||
|
checkResult = false;
|
||||||
|
ConsoleIO.WriteLineFormatted("§cIllegal regular expression: ChatFormat.TeleportRequest = " + TeleportRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!checkResult)
|
||||||
|
{
|
||||||
|
UserDefined = false;
|
||||||
|
ConsoleIO.WriteLineFormatted("§cChatFormat: User-defined regular expressions are disabled.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue