Exemplo n.º 1
0
  public static void updateSettings() {
    String version = Main.getSettings().getStringProperty("general.version");

    if (version == null) version = "1.8.7";

    if (version.equals("1.8.7")) version = updateUserSettings_1_8_7_to_2_0_0();

    if (version.equals("2.0.0")) version = updateUserSettings_2_0_0_to_2_0_1();

    if (version.equals("2.0.1")) version = updateUserSettings_2_0_1_to_2_1_0();

    if (version.equals("2.1.0")) version = updateUserSettings_2_1_0_to_2_1_1();

    if (version.equals("2.1.1")) version = updateUserSettings_2_1_1_to_2_2_0();

    if (version.equals("2.2.0")) version = updateUserSettings_2_2_0_to_2_3_0();

    if (version.equals("2.3.0")) version = updateUserSettings_2_3_0_to_2_3_1();

    if (version.equals("2.3.1")) version = updateUserSettings_2_3_1_to_2_3_2();

    if (version.equals("2.3.2")) version = updateUserSettings_2_3_2_to_2_4_0();

    cleanSettings();
    Main.saveUserSettings();
  }
Exemplo n.º 2
0
  private static String updateUserSettings_1_8_7_to_2_0_0() {
    GuiLogger.getLogger().info("Update user settings from version 1.8.7 to 2.0.0");

    Main.getUserSettings().setStringProperty("general.user.name", "Default");

    return "2.0.0";
  }
Exemplo n.º 3
0
  private static String updateUserSettings_2_0_1_to_2_1_0() {
    GuiLogger.getLogger().info("Update user settings from version 2.0.1 to 2.1.0");

    Main.getUserSettings().replaceKey("api.id", "plugin.synchronizer.id");

    return "2.1.0";
  }
Exemplo n.º 4
0
  private static void cleanSettings() {
    try {
      Properties defaultProperties = new Properties();
      defaultProperties.load(
          Resources.class.getResourceAsStream("default_user_settings.properties"));

      for (String key : defaultProperties.stringPropertyNames()) {
        String value = defaultProperties.getProperty(key);

        if (value == null || value.length() == 0) continue;

        if (Main.getUserSettings().getStringProperty(key) == null) {
          GuiLogger.getLogger().warning("Clean user settings: " + key);
          Main.getUserSettings().remove(key);
        }
      }
    } catch (Throwable t) {

    }
  }