From 6c6f5d1158f04909fcb3dfa06f1a392a4fd80b9f Mon Sep 17 00:00:00 2001 From: Moresteck Date: Tue, 10 Sep 2024 21:31:30 +0000 Subject: [PATCH] Further cleanup --- .../java/org/betacraft/Classic12aWrapper.java | 20 +++++++++++++------ .../java/org/betacraft/Classic15aWrapper.java | 4 ++-- src/main/java/org/betacraft/launcher/BC.java | 2 +- .../java/org/betacraft/launcher/Launcher.java | 2 +- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/betacraft/Classic12aWrapper.java b/src/main/java/org/betacraft/Classic12aWrapper.java index 43fea08..c2f1c19 100644 --- a/src/main/java/org/betacraft/Classic12aWrapper.java +++ b/src/main/java/org/betacraft/Classic12aWrapper.java @@ -160,11 +160,15 @@ public void stop() { runningField.set(run, false); } } - Method real12a = clazz.getDeclaredMethod("a", null); - if (real12a == null) { + + Method real12a; + try { + real12a = clazz.getDeclaredMethod("a"); + } catch (NoSuchMethodException noSuchMethodException) { // 12a-dev - real12a = clazz.getDeclaredMethod("stop", null); + real12a = clazz.getDeclaredMethod("stop"); } + real12a.invoke(run); } } @@ -188,11 +192,15 @@ public void destroy() { if (name.contains("mojang")) { final Class clazz = classLoader.loadClass(name); mcField.setAccessible(true); - Method real12a = clazz.getDeclaredMethod("a", null); - if (real12a == null) { + + Method real12a; + try { + real12a = clazz.getDeclaredMethod("a"); + } catch (NoSuchMethodException noSuchMethodException) { // 12a-dev - real12a = clazz.getDeclaredMethod("destroy", null); + real12a = clazz.getDeclaredMethod("destroy"); } + real12a.invoke(run); } } diff --git a/src/main/java/org/betacraft/Classic15aWrapper.java b/src/main/java/org/betacraft/Classic15aWrapper.java index 3ba6763..4e33b4c 100644 --- a/src/main/java/org/betacraft/Classic15aWrapper.java +++ b/src/main/java/org/betacraft/Classic15aWrapper.java @@ -162,7 +162,7 @@ public void stop() { runningField.set(run, false); } } - clazz.getDeclaredMethod("b", null).invoke(run); + clazz.getDeclaredMethod("b").invoke(run); } } } catch (Exception ex) { @@ -185,7 +185,7 @@ public void destroy() { if (name.contains("mojang")) { final Class clazz = classLoader.loadClass(name); mcField.setAccessible(true); - clazz.getDeclaredMethod("a", null).invoke(run); + clazz.getDeclaredMethod("a").invoke(run); } } } diff --git a/src/main/java/org/betacraft/launcher/BC.java b/src/main/java/org/betacraft/launcher/BC.java index 13a264b..cf0e9c7 100644 --- a/src/main/java/org/betacraft/launcher/BC.java +++ b/src/main/java/org/betacraft/launcher/BC.java @@ -12,7 +12,7 @@ public class BC { public static PropertyFile SETTINGS; // TODO better check this before release - public static boolean prerelease = true; + public static boolean prerelease = false; public static boolean nightly = false; public static boolean portable = false; diff --git a/src/main/java/org/betacraft/launcher/Launcher.java b/src/main/java/org/betacraft/launcher/Launcher.java index 8170bc8..0f2c4df 100644 --- a/src/main/java/org/betacraft/launcher/Launcher.java +++ b/src/main/java/org/betacraft/launcher/Launcher.java @@ -47,7 +47,7 @@ /** Main class */ public class Launcher { - public static String VERSION = "1.09_17-rc3"; // TODO Always update this + public static String VERSION = "1.09_17"; // TODO Always update this public static Instance currentInstance; public static boolean forceUpdate = false;