Пример #1
0
  @Subscribe
  public void preInit(FMLPreInitializationEvent ev) {
    bukkitLogger = ev.getModLog();
    bukkitLogger.setParent(FMLCommonHandler.instance().getFMLLogger());

    // ServerGUI.logger = bukkitLogger;
    if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {

      FMLCommonHandler.instance()
          .getFMLLogger()
          .warning("Bukkit For Vanilla is currently only a server-side mod.");
      return;
    } else if (FMLCommonHandler.instance().getEffectiveSide() == Side.BUKKIT) {
      FMLCommonHandler.instance()
          .getFMLLogger()
          .severe("The bukkit API as a forge mod on bukkit? *mind blown*");
      return;
    }
    this.bukkitLogger.info("Initializing configuration...");
    myConfigurationFile = ev.getSuggestedConfigurationFile();

    Configuration config = new Configuration(myConfigurationFile);
    config.addCustomCategoryComment("consoleConfig", "Configuration for the server console");
    config.addCustomCategoryComment("dontTouchThis", "Things which are best left untouched");

    Property colour =
        config.get(
            "consoleConfig",
            "enablecolour",
            DedicatedServer.getServer().getGuiEnabled() ? false : true);
    colour.comment = "Enable coloured ANSI console output";
    this.allowAnsi = colour.getBoolean(false);

    Property plugins = config.get(Configuration.CATEGORY_GENERAL, "pluginDir", "plugins");
    plugins.comment = "The folder to look for plugins in.";
    this.pluginFolder = plugins.value;

    Property suuid = config.get("dontTouchThis", "serverUUID", this.genUUID());
    bukkitLogger.info("Set UUID to " + suuid.value);
    suuid.comment = "The UUID of the server. Don't touch this or it might break your plugins.";
    this.serverUUID = suuid.value;

    /*Property showAllLogs = config.get(Configuration.CATEGORY_GENERAL, "printForgeLogToGui", false);
    showAllLogs.comment = "Print stuff that's outputted to the logs to the GUI as it happens.";
    this.showAllLogs = showAllLogs.getBoolean(false);*/

    config.save();
  }