Trying the Sonatype version of the 2.0 snapshot you recommended per email, I found that I was unable to get the java application using the bot to shut down at all. System.exit(0) somehow was blocked by some code in the 2.0 bot, and both bot.shutdown() as well as bot.shutdown(true) stall as far as I can tell forever. The bot leaves IRC, but the JVM never terminates. I demonstrated this in a short SSCEE:
import org.pircbotx.Configuration;
import org.pircbotx.PircBotX;
import org.pircbotx.hooks.ListenerAdapter;
import org.pircbotx.hooks.events.MessageEvent;
public class SSCEE {
public static void main(String[] args) {
Configuration<PircBotX> configuration = new Configuration.Builder<>().setName("PircBotX")
.addListener(new ListenerAdapter<PircBotX>() {
public void onMessage(MessageEvent<PircBotX> event) {
if ("!restart".equalsIgnoreCase(event.getMessage())) {
System.out.println("Restart command issues by " + event.getUser());
event.getBot().shutdown(true);
System.exit(0);
}
}
}).setServerHostname("
irc.freenode.net").addAutoJoinChannel("#pircbotx").buildConfiguration();
PircBotX bot = new PircBotX(configuration);
try {
bot.startBot();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}