Fixed Script Scheduler bug

This commit is contained in:
Anon 2026-06-06 12:09:36 +02:00
parent 5b13e740ef
commit a5423211ad
6 changed files with 131 additions and 55 deletions

View file

@ -25,6 +25,7 @@ namespace MinecraftClient.ChatBots
private bool csharp;
private Thread? thread;
private readonly Dictionary<string, object>? localVars;
private readonly string? scriptOwnerKey;
public Script(string filename)
{
@ -38,6 +39,13 @@ namespace MinecraftClient.ChatBots
this.localVars = localVars;
}
internal Script(string filename, string? ownername, Dictionary<string, object>? localVars, string? scriptOwnerKey)
: this(filename, ownername, localVars)
{
this.scriptOwnerKey = scriptOwnerKey;
SetScriptOwnerKey(scriptOwnerKey);
}
private void ParseArguments(string argstr)
{
List<string> args = new();
@ -166,7 +174,7 @@ namespace MinecraftClient.ChatBots
{
try
{
CSharpRunner.Run(this, lines, args, localVars, scriptName: file!);
CSharpRunner.Run(this, lines, args, localVars, scriptName: file!, scriptOwnerKey: scriptOwnerKey);
}
catch (CSharpException e)
{