test_class.file: RecipeManager-base/src/test/java/haveric/recipeManager/UpdaterTest.java
test_class.identifier: UpdaterTest
test_case.body: @Test
      public void testVersionEquals() {
          assertEquals(0, Updater.isVersionNewerThan("2.10.0", "RecipeManager v2.10.0"));
          assertEquals(0, Updater.isVersionNewerThan("2.10.0 alpha", "RecipeManager v2.10.0 alpha"));
          assertEquals(0, Updater.isVersionNewerThan("2.10.0 beta", "v2.10.0 beta"));
      }
test_case.class_method_signature: UpdaterTest.testVersionEquals()
test_case.full_signature: @Test public void testVersionEquals()
test_case.identifier: testVersionEquals
test_case.invocations: assertEquals isVersionNewerThan assertEquals isVersionNewerThan assertEquals isVersionNewerThan
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testVersionEquals()
focal_class.declarator: projectID
focal_class.modifier: private static
focal_class.original_string: private static int projectID;
focal_class.type: int
focal_class.var_name: projectID
focal_class.declarator: apiKey
focal_class.modifier: private static
focal_class.original_string: private static String apiKey;
focal_class.type: String
focal_class.var_name: apiKey
focal_class.declarator: API_NAME_VALUE = "name"
focal_class.modifier: private static final
focal_class.original_string: private static final String API_NAME_VALUE = "name";
focal_class.type: String
focal_class.var_name: API_NAME_VALUE
focal_class.declarator: API_LINK_VALUE = "downloadUrl"
focal_class.modifier: private static final
focal_class.original_string: private static final String API_LINK_VALUE = "downloadUrl";
focal_class.type: String
focal_class.var_name: API_LINK_VALUE
focal_class.declarator: API_QUERY = "/servermods/files?projectIds="
focal_class.modifier: private static final
focal_class.original_string: private static final String API_QUERY = "/servermods/files?projectIds=";
focal_class.type: String
focal_class.var_name: API_QUERY
focal_class.declarator: API_HOST = "https://api.curseforge.com"
focal_class.modifier: private static final
focal_class.original_string: private static final String API_HOST = "https://api.curseforge.com";
focal_class.type: String
focal_class.var_name: API_HOST
focal_class.declarator: urlFiles
focal_class.modifier: private static
focal_class.original_string: private static String urlFiles;
focal_class.type: String
focal_class.var_name: urlFiles
focal_class.declarator: plugin
focal_class.modifier: private static
focal_class.original_string: private static RecipeManager plugin;
focal_class.type: RecipeManager
focal_class.var_name: plugin
focal_class.declarator: pluginName
focal_class.modifier: private static
focal_class.original_string: private static String pluginName;
focal_class.type: String
focal_class.var_name: pluginName
focal_class.declarator: latestVersion
focal_class.modifier: private static
focal_class.original_string: private static String latestVersion;
focal_class.type: String
focal_class.var_name: latestVersion
focal_class.declarator: latestLink
focal_class.modifier: private static
focal_class.original_string: private static String latestLink;
focal_class.type: String
focal_class.var_name: latestLink
focal_class.declarator: task = null
focal_class.modifier: private static
focal_class.original_string: private static BukkitTask task = null;
focal_class.type: BukkitTask
focal_class.var_name: task
focal_class.file: RecipeManager-base/src/main/java/haveric/recipeManager/Updater.java
focal_class.identifier: Updater
focal_class.class_method_signature: Updater.Updater()
focal_class.full_signature: private  Updater()
focal_class.identifier: Updater
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  Updater()
focal_class.class_method_signature: Updater.init(RecipeManager newPlugin, int newProjectID, String newApiKey)
focal_class.full_signature: public static void init(RecipeManager newPlugin, int newProjectID, String newApiKey)
focal_class.identifier: init
focal_class.modifiers: public static
focal_class.parameters: (RecipeManager newPlugin, int newProjectID, String newApiKey)
focal_class.return: void
focal_class.signature: void init(RecipeManager newPlugin, int newProjectID, String newApiKey)
focal_class.class_method_signature: Updater.updateOnce(final CommandSender sender)
focal_class.full_signature: public static void updateOnce(final CommandSender sender)
focal_class.identifier: updateOnce
focal_class.modifiers: public static
focal_class.parameters: (final CommandSender sender)
focal_class.return: void
focal_class.signature: void updateOnce(final CommandSender sender)
focal_class.class_method_signature: Updater.stop()
focal_class.full_signature: public static void stop()
focal_class.identifier: stop
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void stop()
focal_class.class_method_signature: Updater.getCurrentVersion()
focal_class.full_signature: public static String getCurrentVersion()
focal_class.identifier: getCurrentVersion
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getCurrentVersion()
focal_class.class_method_signature: Updater.getLatestVersion()
focal_class.full_signature: public static String getLatestVersion()
focal_class.identifier: getLatestVersion
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getLatestVersion()
focal_class.class_method_signature: Updater.isVersionNewerThan(String version, String check)
focal_class.full_signature: public static int isVersionNewerThan(String version, String check)
focal_class.identifier: isVersionNewerThan
focal_class.modifiers: public static
focal_class.parameters: (String version, String check)
focal_class.return: int
focal_class.signature: int isVersionNewerThan(String version, String check)
focal_class.class_method_signature: Updater.isVersionOlderThan(String version, String check)
focal_class.full_signature: public static int isVersionOlderThan(String version, String check)
focal_class.identifier: isVersionOlderThan
focal_class.modifiers: public static
focal_class.parameters: (String version, String check)
focal_class.return: int
focal_class.signature: int isVersionOlderThan(String version, String check)
focal_class.class_method_signature: Updater.getLatestLink()
focal_class.full_signature: public static String getLatestLink()
focal_class.identifier: getLatestLink
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getLatestLink()
focal_class.class_method_signature: Updater.query(CommandSender sender)
focal_class.full_signature: public static void query(CommandSender sender)
focal_class.identifier: query
focal_class.modifiers: public static
focal_class.parameters: (CommandSender sender)
focal_class.return: void
focal_class.signature: void query(CommandSender sender)
focal_method.body: public static int isVersionNewerThan(String version, String check) {
          // If version starts with RecipeManager, remove it
          if (version.startsWith("RecipeManager")) {
              version = version.substring("RecipeManager".length()).trim();
          }
  
          if (check.startsWith("RecipeManager")) {
              check = check.substring("RecipeManager".length()).trim();
          }
  
          // Remove initial "v". Ex: v1.0.0 -> 1.0.0
          if (version.startsWith("v")) {
              version = version.substring(1).trim();
          }
  
          if (check.startsWith("v")) {
              check = check.substring(1).trim();
          }
  
          if (version.equals(check)) {
              return 0;
          }
  
          String[] versionSplit = version.split("[ -]");
          String[] checkSplit = check.split("[ -]");
  
          int compare = -2;
          String[] currentArray = versionSplit[0].split("\\.");
          String[] latestArray = checkSplit[0].split("\\.");
  
          int shortest = currentArray.length;
          int latestLength = latestArray.length;
          if (latestLength < shortest) {
              shortest = latestLength;
          }
  
          for (int i = 0; i < shortest; i++) {
              int c = Integer.parseInt(currentArray[i]);
              int l = Integer.parseInt(latestArray[i]);
  
              if (c > l) {
                  compare = 1;
                  break;
              } else if (l > c) {
                  compare = -1;
                  break;
              }
          }
  
          if (compare == -2) {
              boolean versionHasBeta = versionSplit.length > 1;
              boolean checkHasBeta = checkSplit.length > 1;
              if (versionHasBeta && checkHasBeta) {
                  String versionBeta = versionSplit[1];
                  versionBeta = versionBeta.replace("dev", "0.");
                  versionBeta = versionBeta.replace("alpha", "1.");
                  versionBeta = versionBeta.replace("beta", "2.");
  
                  String checkBeta = checkSplit[1];
                  checkBeta = checkBeta.replace("dev", "0.");
                  checkBeta = checkBeta.replace("alpha", "1.");
                  checkBeta = checkBeta.replace("beta", "2.");
  
                  try {
                      double versionDouble = Double.parseDouble(versionBeta);
                      double checkDouble = Double.parseDouble(checkBeta);
                      if (versionDouble > checkDouble) {
                          compare = 1;
                      } else if (versionDouble < checkDouble) {
                          compare = -1;
                      }
                  } catch (NumberFormatException e) {
                      // Versions aren't doubles, fail quietly
                  }
              } else if (versionHasBeta) {
                  // Only beta status on version means it's newer
                  compare = 1;
              } else if (checkHasBeta) {
                  // Only beta status on check means version is older
                  compare = -1;
              }
          }
  
          return compare;
      }
focal_method.class_method_signature: Updater.isVersionNewerThan(String version, String check)
focal_method.full_signature: public static int isVersionNewerThan(String version, String check)
focal_method.identifier: isVersionNewerThan
focal_method.invocations: startsWith trim substring length startsWith trim substring length startsWith trim substring startsWith trim substring equals split split split split parseInt parseInt replace replace replace replace replace replace parseDouble parseDouble
focal_method.modifiers: public static
focal_method.parameters: (String version, String check)
focal_method.return: int
focal_method.signature: int isVersionNewerThan(String version, String check)