diff --git a/betacraft/build.gradle b/betacraft/build.gradle index 3cb927b..fabc3f4 100644 --- a/betacraft/build.gradle +++ b/betacraft/build.gradle @@ -19,5 +19,5 @@ dependencies { } tasks.withType(Jar) { - exclude('org/betacraft/*') + exclude('org/*') } \ No newline at end of file diff --git a/client/src/main/java/com/fox2code/foxloader/loader/ClientModLoader.java b/client/src/main/java/com/fox2code/foxloader/loader/ClientModLoader.java index 42a884e..51c3374 100644 --- a/client/src/main/java/com/fox2code/foxloader/loader/ClientModLoader.java +++ b/client/src/main/java/com/fox2code/foxloader/loader/ClientModLoader.java @@ -4,6 +4,7 @@ import com.fox2code.foxloader.launcher.LauncherType; import com.fox2code.foxloader.launcher.utils.NetUtils; import com.fox2code.foxloader.launcher.utils.Platform; +import com.fox2code.foxloader.launcher.utils.SourceUtil; import com.fox2code.foxloader.loader.packet.ClientHello; import com.fox2code.foxloader.loader.packet.ServerHello; import com.fox2code.foxloader.network.NetworkPlayer; @@ -87,10 +88,20 @@ void loaderHandleDoFoxLoaderUpdate(String version, String url) throws IOExceptio switch (launcherType) { default: return; + case BETA_CRAFT: + File betacraftSource = SourceUtil.getSourceFile(ClientModLoader.class).getParentFile(); + String endPath = ".betacraft/versions"; + String path = betacraftSource.getPath(); + if (!path.replace('\\', '/').endsWith(endPath)) { + this.getLogger().warning("Not BetaCraft?"); + return; + } + args = new String[]{null, "-jar", null, "--update", launcherType.name(), + path.substring(0, path.length() - endPath.length())}; + break; case MMC_LIKE: File libraries = ModLoader.foxLoader.file.getParentFile(); dest = new File(libraries, "foxloader-" + version + ".jar"); - case BETA_CRAFT: case VANILLA_LIKE: args = new String[]{null, "-jar", null, "--update", launcherType.name()}; } diff --git a/final/src/main/java/com/fox2code/foxloader/installer/InstallerGUI.java b/final/src/main/java/com/fox2code/foxloader/installer/InstallerGUI.java index 53397f1..4fabe19 100644 --- a/final/src/main/java/com/fox2code/foxloader/installer/InstallerGUI.java +++ b/final/src/main/java/com/fox2code/foxloader/installer/InstallerGUI.java @@ -272,10 +272,20 @@ public void installMineCraft() { } public void installBetaCraft() { + File betacraft = Platform.getAppDir("betacraft"); + if (!betacraft.exists()) { + File betacraftPortable = new File(".betacraft").getAbsoluteFile(); + if (betacraftPortable.exists()) { + betacraft = betacraftPortable; + } + } + this.installBetaCraftEx(betacraft); + } + + public void installBetaCraftEx(File betaCraft) { if (this.checkInstaller()) { return; } - File betaCraft = Platform.getAppDir("betacraft"); File versions = new File(betaCraft, "versions"); File versionsJsons = new File(versions, "jsons"); File launchMethods = new File(betaCraft, @@ -383,7 +393,7 @@ public void extractMMCInstance() { "installer.multimc.text.*", BuildConfig.FOXLOADER_VERSION, BuildConfig.REINDEV_VERSION), false); } - public void doSilentInstall() throws IOException { + public void doSilentInstall(String arg) throws IOException { if (this.checkInstaller()) { return; } @@ -393,7 +403,11 @@ public void doSilentInstall() throws IOException { return; } case BETA_CRAFT: { - this.installBetaCraft(); + if (arg == null) { + this.installBetaCraft(); + } else { + this.installBetaCraftEx(new File(arg)); + } if (progressBar.getValue() != PROGRESS_BAR_MAX) { System.exit(-1); return; diff --git a/final/src/main/java/com/fox2code/foxloader/installer/Main.java b/final/src/main/java/com/fox2code/foxloader/installer/Main.java index 00965b0..c10129b 100644 --- a/final/src/main/java/com/fox2code/foxloader/installer/Main.java +++ b/final/src/main/java/com/fox2code/foxloader/installer/Main.java @@ -87,7 +87,8 @@ public static void main(String[] args) throws ReflectiveOperationException, Malf LauncherType.valueOf(args[1].toUpperCase(Locale.ROOT)); try { System.out.println("Updating..."); - new InstallerGUI(installerPlatform, launcherType).doSilentInstall(); + new InstallerGUI(installerPlatform, launcherType) + .doSilentInstall(args.length >= 3 ? args[2] : null); } catch (IOException e) { e.printStackTrace(); System.exit(-1); diff --git a/gradle.properties b/gradle.properties index 7aee658..bb83a97 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.parallel=true org.gradle.jvmargs=-Xmx1024m -XX:-UseGCOverheadLimit -Dfile.encoding=UTF-8 # FoxLoader properties -foxloader.version=1.2.10 +foxloader.version=1.2.11 foxloader.lastReIndevTransformerChanges=1.2.4 # ReIndev properties