From 1ca38195bc1a1d199b06ead9ccdeb305109be232 Mon Sep 17 00:00:00 2001 From: ORelio Date: Sat, 20 Jul 2013 21:27:50 +0200 Subject: [PATCH] Small adjustments to Bots.cs Added DisconnectAndExit() to bot API Scripting bot now unloads on script end --- MinecraftClient/Bots.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/MinecraftClient/Bots.cs b/MinecraftClient/Bots.cs index c7312724..11797727 100644 --- a/MinecraftClient/Bots.cs +++ b/MinecraftClient/Bots.cs @@ -217,6 +217,15 @@ namespace MinecraftClient Program.Restart(); } + /// + /// Disconnect from the server and exit the program + /// + + protected void DisconnectAndExit() + { + Program.Exit(); + } + /// /// Unload the chatbot, and release associated memory. /// @@ -899,7 +908,7 @@ namespace MinecraftClient sleepticks = ticks; break; case "disconnect": - Program.Exit(); + DisconnectAndExit(); break; case "exit": //Exit bot & stay connected to the server UnloadBot(); @@ -911,6 +920,7 @@ namespace MinecraftClient else { //No more instructions to interpret + UnloadBot(); } } }