mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Merge master into brigadier-dev
This commit is contained in:
commit
f2f88ac009
197 changed files with 102227 additions and 3487 deletions
|
|
@ -31,7 +31,7 @@ namespace MinecraftClient
|
|||
//Script compatibility check for handling future versions differently
|
||||
if (lines.Length < 1 || lines[0] != "//MCCScript 1.0")
|
||||
throw new CSharpException(CSErrorType.InvalidScript,
|
||||
new InvalidDataException(Translations.Get("exception.csrunner.invalid_head")));
|
||||
new InvalidDataException(Translations.exception_csrunner_invalid_head));
|
||||
|
||||
//Script hash for determining if it was previously compiled
|
||||
ulong scriptHash = QuickHash(lines);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace MinecraftClient
|
|||
return master.Handler;
|
||||
if (_handler != null)
|
||||
return _handler;
|
||||
throw new InvalidOperationException(Translations.Get("exception.chatbot.init"));
|
||||
throw new InvalidOperationException(Translations.exception_chatbot_init);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -419,7 +419,15 @@ namespace MinecraftClient
|
|||
public virtual void OnPlayerLeave(Guid uuid, string? name) { }
|
||||
|
||||
/// <summary>
|
||||
/// Called when the player deaths
|
||||
/// This method is called when a player has been killed by another entity
|
||||
/// </summary>
|
||||
/// <param name="killerEntity">Killer's entity</param>
|
||||
/// <param name="chatMessage">message sent in chat when player is killed</param>
|
||||
public virtual void OnKilled(Entity killerEntity, string chatMessage) { }
|
||||
|
||||
/// <summary>
|
||||
/// Called when the player dies
|
||||
/// For getting the info about the player/entity who killed the player use OnPlayerKilled
|
||||
/// </summary>
|
||||
public virtual void OnDeath() { }
|
||||
|
||||
|
|
@ -837,7 +845,7 @@ namespace MinecraftClient
|
|||
/// <param name="text">Log text to write</param>
|
||||
protected void LogToConsole(object? text)
|
||||
{
|
||||
string botName = Translations.GetOrNull("botname." + GetType().Name) ?? GetType().Name;
|
||||
string botName = Translations.ResourceManager.GetString("botname." + GetType().Name) ?? GetType().Name;
|
||||
if (_handler == null || master == null)
|
||||
ConsoleIO.WriteLogLine(String.Format("[{0}] {1}", botName, text));
|
||||
else
|
||||
|
|
@ -858,8 +866,9 @@ namespace MinecraftClient
|
|||
}
|
||||
}
|
||||
|
||||
protected static void LogToConsole(string botName, object? text)
|
||||
protected static void LogToConsole(string originBotName, object? text)
|
||||
{
|
||||
string botName = Translations.ResourceManager.GetString(originBotName) ?? originBotName;
|
||||
ConsoleIO.WriteLogLine(String.Format("[{0}] {1}", botName, text));
|
||||
string logfile = Settings.Config.AppVar.ExpandVars(Config.Main.Advanced.ChatbotLogFile);
|
||||
|
||||
|
|
@ -894,7 +903,7 @@ namespace MinecraftClient
|
|||
/// <param name="args"></param>
|
||||
protected void LogToConsoleTranslated(string key, params object[] args)
|
||||
{
|
||||
LogToConsole(Translations.TryGet(key, args));
|
||||
LogToConsole(string.Format(Translations.ResourceManager.GetString(key) ?? key, args));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -904,7 +913,7 @@ namespace MinecraftClient
|
|||
/// <param name="args"></param>
|
||||
protected void LogDebugToConsoleTranslated(string key, params object?[] args)
|
||||
{
|
||||
LogDebugToConsole(Translations.TryGet(key, args));
|
||||
LogDebugToConsole(string.Format(Translations.ResourceManager.GetString(key) ?? key, args));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -917,8 +926,8 @@ namespace MinecraftClient
|
|||
{
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
{
|
||||
string botName = Translations.GetOrNull("botname." + GetType().Name) ?? GetType().Name;
|
||||
ConsoleIO.WriteLogLine(Translations.Get("chatbot.reconnect", botName));
|
||||
string botName = Translations.ResourceManager.GetString("botname." + GetType().Name) ?? GetType().Name;
|
||||
ConsoleIO.WriteLogLine(string.Format(Translations.chatbot_reconnect, botName));
|
||||
}
|
||||
McClient.ReconnectionAttemptsLeft = ExtraAttempts;
|
||||
Program.Restart(delaySeconds);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue