fetchUpdates(String url) throws UpdateCheckException {
- try {
- return fetchUpdatesAsync(url).join();
- } catch (CompletionException e) {
- try {
- throw e.getCause();
- } catch (UpdateCheckException e1) {
- throw e1;
- } catch (Throwable e1) {
- throw new UpdateCheckException("Failed to check for updates!", e1);
- }
- }
- }
- //endregion
-}
diff --git a/src/main/java/com/falsepattern/lib/internal/proxy/CommonProxy.java b/src/main/java/com/falsepattern/lib/internal/proxy/CommonProxy.java
index c5219f6..6c3212a 100644
--- a/src/main/java/com/falsepattern/lib/internal/proxy/CommonProxy.java
+++ b/src/main/java/com/falsepattern/lib/internal/proxy/CommonProxy.java
@@ -52,29 +52,8 @@ public class CommonProxy {
public void preInit(FMLPreInitializationEvent e) {
CommonEventHandlerPre.registerBus();
- if (LibraryConfig.ENABLE_UPDATE_CHECKER) {
- Share.LOG.info("Launching asynchronous update check.");
- UpdateChecker.fetchUpdatesAsyncV2(FalsePatternLib.UPDATE_URL).thenApplyAsync(updates -> {
- if (updates == null) {
- updates = Collections.emptyList();
- }
- if (updates.isEmpty()) {
- Share.LOG.info("No updates found.");
- } else {
- Share.LOG.info("Found {} updates.", updates.size());
- for (val update : updates) {
- update.log(Share.LOG);
- }
- }
- return updates;
- }).exceptionally(ex -> {
- Share.LOG.error("Failed to check for updates!", ex);
- return Collections.emptyList();
- });
- }
}
- @Mod.EventHandler
public void init(FMLInitializationEvent e) {
}
diff --git a/src/main/java/com/falsepattern/lib/updates/ModUpdateInfo.java b/src/main/java/com/falsepattern/lib/updates/ModUpdateInfo.java
index df0d7dc..6fc4fc1 100644
--- a/src/main/java/com/falsepattern/lib/updates/ModUpdateInfo.java
+++ b/src/main/java/com/falsepattern/lib/updates/ModUpdateInfo.java
@@ -20,16 +20,21 @@
*/
package com.falsepattern.lib.updates;
+import com.falsepattern.lib.DeprecationDetails;
import com.falsepattern.lib.StableAPI;
import lombok.Data;
import lombok.NonNull;
import org.apache.logging.log4j.Logger;
/**
- * Information about a new version of a mod.
+ * Obsolete, marked for removal.
*/
@Data
@StableAPI(since = "0.8.0")
+@DeprecationDetails(deprecatedSince = "1.0.0",
+ replacement = "None, the update checker system is being removed.")
+@DeprecationDetails.RemovedInVersion("1.1.0")
+@Deprecated
public class ModUpdateInfo {
@NonNull
@StableAPI.Expose
diff --git a/src/main/java/com/falsepattern/lib/updates/UpdateCheckException.java b/src/main/java/com/falsepattern/lib/updates/UpdateCheckException.java
index 00fce9a..a8c1f1c 100644
--- a/src/main/java/com/falsepattern/lib/updates/UpdateCheckException.java
+++ b/src/main/java/com/falsepattern/lib/updates/UpdateCheckException.java
@@ -20,13 +20,17 @@
*/
package com.falsepattern.lib.updates;
+import com.falsepattern.lib.DeprecationDetails;
import com.falsepattern.lib.StableAPI;
/**
- * Exception only thrown by methods of {@link UpdateChecker}.
- * Please don't throw this in your own code, only catch/handle it.
+ * Obsolete, marked for removal.
*/
@StableAPI(since = "0.8.3")
+@DeprecationDetails(deprecatedSince = "1.0.0",
+ replacement = "None, the update checker system is being removed.")
+@DeprecationDetails.RemovedInVersion("1.1.0")
+@Deprecated
public class UpdateCheckException extends Exception {
@StableAPI.Internal
public UpdateCheckException(String message) {
diff --git a/src/main/java/com/falsepattern/lib/updates/UpdateChecker.java b/src/main/java/com/falsepattern/lib/updates/UpdateChecker.java
index 9cfdc37..fefc398 100644
--- a/src/main/java/com/falsepattern/lib/updates/UpdateChecker.java
+++ b/src/main/java/com/falsepattern/lib/updates/UpdateChecker.java
@@ -23,124 +23,46 @@ package com.falsepattern.lib.updates;
import com.falsepattern.lib.DeprecationDetails;
import com.falsepattern.lib.StableAPI;
import com.falsepattern.lib.internal.Share;
-import com.falsepattern.lib.internal.impl.updates.UpdateCheckerImpl;
import net.minecraft.util.IChatComponent;
+import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
+/**
+ * Obsolete, marked for removal.
+ */
@StableAPI(since = "0.8.0")
+@DeprecationDetails(deprecatedSince = "1.0.0",
+ replacement = "None, the update checker system is being removed.")
+@DeprecationDetails.RemovedInVersion("1.1.0")
+@Deprecated
public final class UpdateChecker {
/**
- * Checks for updates. The URL should be a JSON file that contains a list of mods, each with a mod ID, and one or more
- * versions. The JSON file must have the following format:
- * {@code
- * [
- * {
- * "modid": "modid",
- * "versions": [
- * {
- * ...version object...
- * },
- * {
- * ...version object...
- * }
- * ]
- * },
- * {
- * "modid": "modid2",
- * "versions": {
- * ...version object...
- * },
- * "updateURL": "https://example.com/mods/mymod2"
- * },
- * ...etc, one json object per mod.
- * ]
- * }
- * The currently supported version object formats are:
- *
- * Raw version entry:
- *
{@code
- * {
- * "type": "raw",
- * "version": "1.0.0",
- * "updateURL": "https://example.com/mods/mymod"
- * }
- * }
- *
- * GitHub version entry:
- *
{@code
- * {
- * "type": "github",
- * "repo": "Example/ExampleMod"
- * }
- * }
- *
- * The GitHub version entry will automatically fetch the latest release from the specified repository using the GitHub API.
- *
- * @param url The URL to check
- *
- * @return A list of mods that were both available on the URL and installed
+ * Obsolete, marked for removal.
*/
@StableAPI.Expose(since = "0.11.0")
public static CompletableFuture> fetchUpdatesAsyncV2(String url) {
- return UpdateCheckerImpl.fetchUpdatesAsyncV2(url);
+ Share.deprecatedWarning(new Throwable());
+ return CompletableFuture.completedFuture(Collections.emptyList());
}
/**
- * Same this as {@link #fetchUpdatesAsyncV2(String)}, but returns the result in a blocking fashion.
- *
- * @param url The URL to check
- *
- * @return A future that will contain the update info about mods that were both available on the URL and installed
- *
- * @throws UpdateCheckException If the update checker is disabled in config, the URL is invalid, or
+ * Obsolete, marked for removal.
*/
@StableAPI.Expose(since = "0.11.0")
public static List fetchUpdatesV2(String url) throws UpdateCheckException {
- return UpdateCheckerImpl.fetchUpdatesV2(url);
+ Share.deprecatedWarning(new Throwable());
+ return Collections.emptyList();
}
/**
- * Formats the raw list of updates into lines of chat messages you can send to players.
- *
- * @param initiator Who/what/which mod did this update check
- * @param updates The list of updates to convert
- *
- * @return A list of chat messages that can be sent to players
+ * Obsolete, marked for removal.
*/
@StableAPI.Expose
public static List updateListToChatMessages(String initiator, List updates) {
- return UpdateCheckerImpl.updateListToChatMessages(initiator, updates);
- }
-
- //region deprecated
-
- /**
- * DEPRECATED: Use the V2 API instead. This is kept for backwards compatibility.
- */
- @Deprecated
- @DeprecationDetails(deprecatedSince = "0.11.0",
- replacement = "fetchUpdatesV2")
- @DeprecationDetails.RemovedInVersion("0.13")
- @StableAPI.Expose
- public static List fetchUpdates(String url) throws UpdateCheckException {
Share.deprecatedWarning(new Throwable());
- return UpdateCheckerImpl.fetchUpdates(url);
+ return Collections.emptyList();
}
-
- /**
- * DEPRECATED: Use the V2 API instead. This is kept for backwards compatibility.
- */
- @StableAPI.Expose
- @Deprecated
- @DeprecationDetails(deprecatedSince = "0.11.0",
- replacement = "fetchUpdatesAsyncV2")
- @DeprecationDetails.RemovedInVersion("0.13")
- public static CompletableFuture> fetchUpdatesAsync(String url) {
- Share.deprecatedWarning(new Throwable());
- return UpdateCheckerImpl.fetchUpdatesAsync(url);
- }
- //endregion
}
diff --git a/src/main/java/com/falsepattern/lib/updates/package-info.java b/src/main/java/com/falsepattern/lib/updates/package-info.java
new file mode 100644
index 0000000..8e8ae48
--- /dev/null
+++ b/src/main/java/com/falsepattern/lib/updates/package-info.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022-2023 FalsePattern
+ * All Rights Reserved
+ *
+ * The above copyright notice and this permission notice
+ * shall be included in all copies or substantial portions of the Software.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * This package used to contain a system for checking for updates to mods.
+ * This system is being removed, and this package is being kept for backwards compatibility.
+ * Reasons for removal:
+ * - In older versions of the mod, this used to show a message in chat when an update was available. This was annoying and
+ * not very useful, so it was removed.
+ * - In 0.12, the updates were shown only in the console, which is not very visible, so people didn't notice them.
+ * - The update checker system was very complicated and hard to maintain, and required externally hosted JSON files.
+ *
+ * For anyone who wants to implement their own update checker, don't. Nobody cares about mod updates anyway,
+ * they will keep playing on ancient versions of the mod no matter what you do or how many critical bugs you fix.
+ */
+@DeprecationDetails(deprecatedSince = "1.0.0",
+ replacement = "None, the update checker system is being removed.")
+@DeprecationDetails.RemovedInVersion("1.1.0")
+@Deprecated
+package com.falsepattern.lib.updates;
+
+import com.falsepattern.lib.DeprecationDetails;
\ No newline at end of file