private static void startBots() { logger.info("Starting bots"); List<YAMLNode> nodes = ChatBot.getSettingsManager().getMainConfig().getNodeList("bots", null); for (YAMLNode node : nodes) { final String botType = node.getString("type"); logger.info("Starting {} bot", botType); try { BotClassInfo botClassInfo = BOT_INFO.get(botType); if (botClassInfo == null) { logger.error("Cannot start bot '{}': the specified bot doesn't exist!", botType); continue; } Bot bot = botClassInfo.getBotClass().newInstance(); bot.info = botClassInfo; bot.start(); BOTS.add(bot); } catch (Exception e) { logger.error("Failed to start bot '{}'", botType); e.printStackTrace(); } } logger.info("Started {} bot(s)", BOTS.size()); }