Main.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:MimiBot 作者:
public static void main(String[] args) throws Exception {
    config = new Config();
    config.load();

    registerCommands();

    //Setup Logger
    System.setProperty(SimpleLogger.SHOW_DATE_TIME_KEY, "true");
    System.setProperty(SimpleLogger.DATE_TIME_FORMAT_KEY, "[HH:mm:ss]");
    System.setProperty(SimpleLogger.SHOW_THREAD_NAME_KEY, "false");
    System.setProperty(SimpleLogger.LEVEL_IN_BRACKETS_KEY, "true");
    System.setProperty(SimpleLogger.SHOW_LOG_NAME_KEY, "true");
    System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "debug");
    Logger logger = new SimpleLoggerFactory().getLogger(Main.class.getName());
    System.out.println(logger.isDebugEnabled());

    //Setup this bot
    Configuration.Builder builder = new Configuration.Builder();
    builder.setName(config.getBotNickname());
    builder.setRealName(config.getBotRealname());
    builder.setLogin(config.getBotLogin());
    //builder.setNickservPassword(config.getBotPassword());
    builder.setAutoNickChange(true);
    builder.addListener(new BotListener());
    builder.setServer(config.getServerHostname(), config.getServerPort(), config.getServerPassword());
    builder.setSocketFactory(new UtilSSLSocketFactory().trustAllCertificates());
    for(String channel : config.getChannels()){
        builder.addAutoJoinChannel(channel);
    }
    PircBotX bot = new PircBotX(builder.buildConfiguration());

    minecraftLog = new LogTailer(bot, "/home/minecraft/1.7.2/logs/latest.log");
    //Connect to server
    try {
        logger.debug("staring bot");
        bot.startBot();
    } catch (Exception ex) {
        logger.error(null, ex);
        ex.printStackTrace();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号