aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2022-12-27 20:20:13 +0900
committersyeyoung <cyoung06@naver.com>2022-12-27 20:20:13 +0900
commit7ed9fe3de0f9091937ad97b3d76e7b1e1baac02d (patch)
tree8b0f2ddb4fd1de962004dba865ae05f9c60267fd
parent998021eb4cd13045ac15dcadf6184c7577e95954 (diff)
downloadSkyblock-Dungeons-Guide-7ed9fe3de0f9091937ad97b3d76e7b1e1baac02d.tar.gz
Skyblock-Dungeons-Guide-7ed9fe3de0f9091937ad97b3d76e7b1e1baac02d.tar.bz2
Skyblock-Dungeons-Guide-7ed9fe3de0f9091937ad97b3d76e7b1e1baac02d.zip
- Versioning
Signed-off-by: syeyoung <cyoung06@naver.com>
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/LoaderMeta.java5
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiChooseVersion.java6
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/RemoteLoader.java8
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/VersionInfo.java16
4 files changed, 33 insertions, 2 deletions
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/LoaderMeta.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/LoaderMeta.java
new file mode 100644
index 00000000..df7e1406
--- /dev/null
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/LoaderMeta.java
@@ -0,0 +1,5 @@
+package kr.syeyoung.dungeonsguide.launcher;
+
+public class LoaderMeta {
+ public static final int LOADER_VERSION = 1;
+}
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiChooseVersion.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiChooseVersion.java
index e1e91003..e268e7a2 100644
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiChooseVersion.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiChooseVersion.java
@@ -1,5 +1,6 @@
package kr.syeyoung.dungeonsguide.launcher.gui.screen;
+import kr.syeyoung.dungeonsguide.launcher.LoaderMeta;
import kr.syeyoung.dungeonsguide.launcher.Main;
import kr.syeyoung.dungeonsguide.launcher.branch.Update;
import kr.syeyoung.dungeonsguide.launcher.branch.UpdateBranch;
@@ -115,7 +116,10 @@ public class GuiChooseVersion extends SpecialGuiScreen {
k = 0;
for (Update update : updates) {
- this.buttonList.add(new GuiButton(branchList.size() + 10 + k++, tenth+210, 70+ 20 * k, update.getName()));
+ this.buttonList.add(button = new GuiButton(branchList.size() + 10 + k++, tenth+210, 70+ 20 * k, update.getName()));
+ if (update.getMetadata().has("loaderVersion") && update.getMetadata().getInt("loaderVersion") > LoaderMeta.LOADER_VERSION) {
+ button.enabled = false;
+ }
}
}
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/RemoteLoader.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/RemoteLoader.java
index 26e1a6d4..ed83404c 100644
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/RemoteLoader.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/RemoteLoader.java
@@ -19,6 +19,7 @@
package kr.syeyoung.dungeonsguide.launcher.loader;
import kr.syeyoung.dungeonsguide.launcher.DGInterface;
+import kr.syeyoung.dungeonsguide.launcher.LoaderMeta;
import kr.syeyoung.dungeonsguide.launcher.branch.Update;
import kr.syeyoung.dungeonsguide.launcher.branch.UpdateRetrieverUtil;
import kr.syeyoung.dungeonsguide.launcher.exceptions.DungeonsGuideLoadingException;
@@ -90,6 +91,11 @@ public class RemoteLoader implements IDGLoader {
target = UpdateRetrieverUtil.getUpdate(branchId, updateId);
ProgressStateHolder.step("Getting Update Meta");
friendlyVersionName = target.getName();
+
+ if (target.getMetadata().has("loaderVersion") && target.getMetadata().getInt("loaderVersion") > LoaderMeta.LOADER_VERSION) {
+ throw new DungeonsGuideLoadingException("This version of Dungeons Guide requires loader version: " + target.getMetadata().getInt("loaderVersion") +" But current loader version: "+ LoaderMeta.LOADER_VERSION);
+ }
+
} catch (Exception e) {
throw new NoVersionFoundException(friendlyBranchName, friendlyVersionName, branchId+"@"+updateId, e);
}
@@ -112,7 +118,7 @@ public class RemoteLoader implements IDGLoader {
return dgInterface;
} catch (Throwable e) { // the reason why I am catching throwable here: in case NoClassDefFoundError.
- throw new DungeonsGuideLoadingException(e);
+ throw new DungeonsGuideLoadingException("Version: "+branchId+" / "+updateId,e);
} finally {
ProgressStateHolder.pop();
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/VersionInfo.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/VersionInfo.java
new file mode 100644
index 00000000..5f5b6dd5
--- /dev/null
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/VersionInfo.java
@@ -0,0 +1,16 @@
+package kr.syeyoung.dungeonsguide.mod;
+
+import kr.syeyoung.dungeonsguide.launcher.Main;
+import kr.syeyoung.dungeonsguide.launcher.loader.IDGLoader;
+
+public class VersionInfo {
+ public static final String VERSION = "4.0.0-beta-1.0.0";
+
+ public static IDGLoader getCurrentLoader() {
+ return Main.getMain().getCurrentLoader();
+ }
+
+ public static String getLoaderInfo() {
+ return getCurrentLoader().loaderName();
+ }
+}