mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Fix Script bots accumulating on reconnect by unloading on disconnect
Script ChatBots were persisted in the static botsOnHold list across reconnects. When ScriptScheduler triggered new scripts on login, the old Script bots were still running, causing duplicate commands to be sent simultaneously. This led to command spam and crashes. Adding OnDisconnect to the Script ChatBot ensures scripts are removed from the bots list before they can be saved to botsOnHold, preventing accumulation of duplicate script instances on reconnect.
This commit is contained in:
parent
2b05b7420e
commit
8757533fb9
1 changed files with 6 additions and 0 deletions
|
|
@ -149,6 +149,12 @@ namespace MinecraftClient.ChatBots
|
|||
}
|
||||
}
|
||||
|
||||
public override bool OnDisconnect(DisconnectReason reason, string message)
|
||||
{
|
||||
UnloadBot();
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if (csharp) //C# compiled script
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue