Remove obsolete update calls
This commit is contained in:
		| @@ -45,7 +45,7 @@ public class LibsDisguises extends JavaPlugin { | |||||||
|     @Getter |     @Getter | ||||||
|     private boolean reloaded; |     private boolean reloaded; | ||||||
|     @Getter |     @Getter | ||||||
|     private final UpdateChecker updateChecker = new UpdateChecker("32453"); |     private final UpdateChecker updateChecker = new UpdateChecker(); | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public void onLoad() { |     public void onLoad() { | ||||||
|   | |||||||
| @@ -26,22 +26,17 @@ import java.util.concurrent.atomic.AtomicBoolean; | |||||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||||
|  |  | ||||||
| public class UpdateChecker { | public class UpdateChecker { | ||||||
|     private final String resourceID; |  | ||||||
|     private final long started = System.currentTimeMillis(); |     private final long started = System.currentTimeMillis(); | ||||||
|     @Getter |     @Getter | ||||||
|     private PluginInformation lastDownload; |     private PluginInformation lastDownload; | ||||||
|     private final AtomicBoolean downloading = new AtomicBoolean(false); |     private final AtomicBoolean downloading = new AtomicBoolean(false); | ||||||
|     @Getter |     @Getter | ||||||
|     private DisguiseUpdate update; |     private DisguiseUpdate update; | ||||||
|     private LDGithub githubUpdater = new LDGithub(); |     private final LDGithub githubUpdater = new LDGithub(); | ||||||
|     private LDJenkins jenkinsUpdater = new LDJenkins(); |     private final LDJenkins jenkinsUpdater = new LDJenkins(); | ||||||
|     @Getter |     @Getter | ||||||
|     private String[] updateMessage = new String[0]; |     private String[] updateMessage = new String[0]; | ||||||
|  |  | ||||||
|     public UpdateChecker(String resourceID) { |  | ||||||
|         this.resourceID = resourceID; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public boolean isServerLatestVersion() { |     public boolean isServerLatestVersion() { | ||||||
|         return isOnLatestUpdate(false); |         return isOnLatestUpdate(false); | ||||||
|     } |     } | ||||||
| @@ -260,36 +255,6 @@ public class UpdateChecker { | |||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * Asks spigot for the version |  | ||||||
|      */ |  | ||||||
|     private String fetchSpigotVersion() { |  | ||||||
|         try { |  | ||||||
|             // We're connecting to spigot's API |  | ||||||
|             URL url = new URL("https://api.spigotmc.org/legacy/update.php?resource=" + resourceID); |  | ||||||
|             // Creating a connection |  | ||||||
|             HttpURLConnection con = (HttpURLConnection) url.openConnection(); |  | ||||||
|             con.setDefaultUseCaches(false); |  | ||||||
|  |  | ||||||
|             // Get the input stream, what we receive |  | ||||||
|             try (InputStream input = con.getInputStream()) { |  | ||||||
|                 // Read it to string |  | ||||||
|                 String version = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)).lines() |  | ||||||
|                         .collect(Collectors.joining("\n")); |  | ||||||
|  |  | ||||||
|                 // If the version is not empty, return it |  | ||||||
|                 if (!version.isEmpty()) { |  | ||||||
|                     return version; |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         catch (Exception ex) { |  | ||||||
|             DisguiseUtilities.getLogger().warning("Failed to check for a update on spigot."); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         return null; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     private boolean isNewerVersion(String currentVersion, String newVersion) { |     private boolean isNewerVersion(String currentVersion, String newVersion) { | ||||||
|         currentVersion = currentVersion.replaceAll("(v)|(-SNAPSHOT)", ""); |         currentVersion = currentVersion.replaceAll("(v)|(-SNAPSHOT)", ""); | ||||||
|         newVersion = newVersion.replaceAll("(v)|(-SNAPSHOT)", ""); |         newVersion = newVersion.replaceAll("(v)|(-SNAPSHOT)", ""); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user