diff options
author | syeyoung <cyoung06@naver.com> | 2023-02-24 23:48:19 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2023-02-24 23:48:19 +0900 |
commit | e221cb797b194e3440f08f6868f71af51c5c286f (patch) | |
tree | 15b573b4e499eecb2e8694e05e969fc7d9516ec5 | |
parent | 6d5207fbd21003fc958df5a66ebc0edcb923bfe2 (diff) | |
download | Skyblock-Dungeons-Guide-e221cb797b194e3440f08f6868f71af51c5c286f.tar.gz Skyblock-Dungeons-Guide-e221cb797b194e3440f08f6868f71af51c5c286f.tar.bz2 Skyblock-Dungeons-Guide-e221cb797b194e3440f08f6868f71af51c5c286f.zip |
- update check
Signed-off-by: syeyoung <cyoung06@naver.com>
-rw-r--r-- | mod/src/main/java/kr/syeyoung/dungeonsguide/mod/VersionInfo.java | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/VersionInfo.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/VersionInfo.java index 6f535038..f0c30c7b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/VersionInfo.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/VersionInfo.java @@ -72,22 +72,22 @@ public class VersionInfo { private static final Logger logger = LogManager.getLogger("OutdatedVersionWarning"); public static void checkAndOpen() { try { -// if (VersionInfo.getCurrentLoader() instanceof DevEnvLoader) return; -// -// if (VersionInfo.getCurrentLoader() instanceof RemoteLoader) { -// RemoteLoader loader = (RemoteLoader) VersionInfo.getCurrentLoader(); -// Update latestUpdate = UpdateRetrieverUtil.getLatestUpdates(loader.getBranchId(), 0).get(0); -// if (latestUpdate.getId() == loader.getUpdateId()) return; -// -// Scaler scaler = new Scaler(); -// scaler.scale.setValue((double) new ScaledResolution(Minecraft.getMinecraft()).getScaleFactor()); -// scaler.child.setValue(new WidgetUpdateLog( -// latestUpdate.getName(), latestUpdate.getUpdateLog() -// )); -// GuiDisplayer.INSTANCE.displayGui(new GuiScreenAdapter(scaler)); -// -// logger.info("Update Required!!"); -// } else if (VersionInfo.getCurrentLoader() instanceof JarLoader || VersionInfo.getCurrentLoader() instanceof LocalLoader) { + if (VersionInfo.getCurrentLoader() instanceof DevEnvLoader) return; + + if (VersionInfo.getCurrentLoader() instanceof RemoteLoader) { + RemoteLoader loader = (RemoteLoader) VersionInfo.getCurrentLoader(); + Update latestUpdate = UpdateRetrieverUtil.getLatestUpdates(loader.getBranchId(), 0).get(0); + if (latestUpdate.getId() == loader.getUpdateId()) return; + + Scaler scaler = new Scaler(); + scaler.scale.setValue((double) new ScaledResolution(Minecraft.getMinecraft()).getScaleFactor()); + scaler.child.setValue(new WidgetUpdateLog( + latestUpdate.getName(), latestUpdate.getUpdateLog() + )); + GuiDisplayer.INSTANCE.displayGui(new GuiScreenAdapter(scaler)); + + logger.info("Update Required!!"); + } else if (VersionInfo.getCurrentLoader() instanceof JarLoader || VersionInfo.getCurrentLoader() instanceof LocalLoader) { UpdateBranch requiredUpdateBranch = UpdateRetrieverUtil.getUpdateBranches().stream().filter(a -> Optional.ofNullable(a.getMetadata()) .filter(b -> b.has("additionalMeta")) @@ -120,9 +120,9 @@ public class VersionInfo { latestUpdate.getName(), latestUpdate.getUpdateLog() )); GuiDisplayer.INSTANCE.displayGui(new GuiScreenAdapter(scaler)); -// } else { -// logger.error("Failed to check version: Unknown Loader: " + VersionInfo.getLoaderInfo() + " / " + VersionInfo.getCurrentLoader().getClass().getName()); -// } + } else { + logger.error("Failed to check version: Unknown Loader: " + VersionInfo.getLoaderInfo() + " / " + VersionInfo.getCurrentLoader().getClass().getName()); + } } catch (Exception e) { logger.error("Error while checking for updates: ",e); } |