mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Catch exceptions on bot load (#1510)
Also return a copy of ChatBot list inside GetLoadedChatBots() because UnloadBot() must be used to properly unload the bot
This commit is contained in:
parent
c15b071cad
commit
47c19466c3
1 changed files with 3 additions and 8 deletions
|
|
@ -114,12 +114,7 @@ namespace MinecraftClient
|
||||||
public int GetProtocolVersion() { return protocolversion; }
|
public int GetProtocolVersion() { return protocolversion; }
|
||||||
public ILogger GetLogger() { return this.Log; }
|
public ILogger GetLogger() { return this.Log; }
|
||||||
public int GetPlayerEntityID() { return playerEntityID; }
|
public int GetPlayerEntityID() { return playerEntityID; }
|
||||||
|
public List<ChatBot> GetLoadedChatBots() { return new List<ChatBot>(bots); }
|
||||||
// get bots list for unloading them by commands
|
|
||||||
public List<ChatBot> GetLoadedChatBots()
|
|
||||||
{
|
|
||||||
return bots;
|
|
||||||
}
|
|
||||||
|
|
||||||
TcpClient client;
|
TcpClient client;
|
||||||
IMinecraftCom handler;
|
IMinecraftCom handler;
|
||||||
|
|
@ -669,9 +664,9 @@ namespace MinecraftClient
|
||||||
b.SetHandler(this);
|
b.SetHandler(this);
|
||||||
bots.Add(b);
|
bots.Add(b);
|
||||||
if (init)
|
if (init)
|
||||||
b.Initialize();
|
DispatchBotEvent(bot => bot.Initialize(), new ChatBot[] { b });
|
||||||
if (this.handler != null)
|
if (this.handler != null)
|
||||||
b.AfterGameJoined();
|
DispatchBotEvent(bot => bot.AfterGameJoined(), new ChatBot[] { b });
|
||||||
Settings.SingleCommand = "";
|
Settings.SingleCommand = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue