aboutsummaryrefslogtreecommitdiff
path: root/loader/src
diff options
context:
space:
mode:
Diffstat (limited to 'loader/src')
-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
3 files changed, 17 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();
}