diff --git a/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchApp.java b/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchApp.java index 685d59c7..e83e8ac8 100644 --- a/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchApp.java +++ b/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchApp.java @@ -94,7 +94,7 @@ public class PLaunchApp { if (AccountJNI.CURRENT_ACCOUNT.accessToken.equals("0")) { if (!new File(verJsonDir).exists()) { // Local account: disallow install new version - UIKit.showError("Error", "Minecraft couldn't be legally installed when logged in with a local account. Please switch to an online account to continue.", false); + UIKit.showError("Error", "Minecraft can't be legally installed when logged in with a local account. Please switch to an online account to continue.", false); return; } else { // Local account: jump to launch Minecraft, not download anything diff --git a/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchJFXApp.java.z b/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchJFXApp.java.z deleted file mode 100644 index 7007b6e5..00000000 --- a/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchJFXApp.java.z +++ /dev/null @@ -1,25 +0,0 @@ -package net.kdt.pojavlaunch; - -import java.io.*; - -import javafx.application.Application; -import javafx.scene.Group; -import javafx.scene.Scene; -import javafx.scene.shape.Circle; -import javafx.stage.Stage; - -public class PLaunchJFXApp extends Application { - public void start(Stage stage) { -/* - Circle circ = new Circle(40, 40, 30); - Group root = new Group(circ); - Scene scene = new Scene(root, 400, 300); - stage.setTitle("JavaFX Application"); - stage.setScene(scene); - stage.show(); -*/ - System.setProperty("os.name", "Mac OS X"); - - PLaunchApp.launchMinecraft(); - } -} diff --git a/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/BaseInstaller.java.todo b/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/BaseInstaller.java.todo deleted file mode 100644 index 879aa53c..00000000 --- a/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/BaseInstaller.java.todo +++ /dev/null @@ -1,24 +0,0 @@ -package net.kdt.pojavlaunch.installers; - -import java.io.*; -import java.util.zip.*; -import net.kdt.pojavlaunch.*; - -public class BaseInstaller { - protected File mFile; - protected ZipFile mJarFile; - - public void setInput(File file) throws IOException { - mFile = file; - mJarFile = new ZipFile(file); - } - - public int install(JavaGUILauncherActivity ctx) throws IOException { - return 0; - } - - public void from(BaseInstaller base) { - mFile = base.mFile; - mJarFile = base.mJarFile; - } -} diff --git a/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/FabricInstaller.java.todo b/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/FabricInstaller.java.todo deleted file mode 100644 index a34e7adc..00000000 --- a/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/FabricInstaller.java.todo +++ /dev/null @@ -1,29 +0,0 @@ -package net.kdt.pojavlaunch.installers; - -import android.content.*; -import java.io.*; -import java.util.jar.*; -import net.kdt.pojavlaunch.*; -import java.nio.charset.*; -import net.kdt.pojavlaunch.value.*; -import org.apache.commons.io.*; -import com.google.gson.*; -import java.util.zip.*; - -public class FabricInstaller extends BaseInstaller { - public FabricInstaller(BaseInstaller i) { - from(i); - } - - @Override - public int install(JavaGUILauncherActivity ctx) throws IOException { - // Unused ZipFile - mJarFile.close(); - - String mcversion = ctx.dialogInput("Fabric installer", R.string.main_version); - - ctx.appendlnToLog("Launching JVM"); - return ctx.launchJavaRuntime(null, - "-jar " + mFile.getAbsolutePath() + " client -dir . -mcversion " + mcversion); - } -} diff --git a/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/InstallerDetector.java.todo b/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/InstallerDetector.java.todo deleted file mode 100644 index 98af7ac9..00000000 --- a/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/InstallerDetector.java.todo +++ /dev/null @@ -1,31 +0,0 @@ -package net.kdt.pojavlaunch.installers; - -import java.io.*; -import com.google.gson.*; -import net.kdt.pojavlaunch.value.*; - -public class InstallerDetector -{ - public static boolean isFabric(BaseInstaller installer) { - return installer.mJarFile.getEntry("net/fabricmc/installer/Main.class") != null; - } - - // Forge Legacy: for 1.12.1 and below - public static boolean isForgeLegacy(BaseInstaller installer) throws IOException, JsonSyntaxException { - ForgeInstallProfile profile = LegacyForgeInstaller.readInstallProfile(installer); - return profile != null && profile.versionInfo != null; - } - - // Forge for 1.12.2 only - public static boolean isForge1p12p2(BaseInstaller installer) throws IOException, JsonSyntaxException { - ForgeInstallProfile profile = LegacyForgeInstaller.readInstallProfile(installer); - // Forge 1.12.2 install_profile.json has same format as Forge 1.13+ - return isForgeNew(installer) && profile.minecraft.equals("1.12.2"); - } - - // Forge New: for 1.13 and above - public static boolean isForgeNew(BaseInstaller installer) throws IOException, JsonSyntaxException { - ForgeInstallProfile profile = LegacyForgeInstaller.readInstallProfile(installer); - return profile != null && profile.version != null; - } -} diff --git a/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/Legacy1p12p2ForgeInstaller.java.todo b/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/Legacy1p12p2ForgeInstaller.java.todo deleted file mode 100644 index 41e9d1e0..00000000 --- a/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/Legacy1p12p2ForgeInstaller.java.todo +++ /dev/null @@ -1,60 +0,0 @@ -package net.kdt.pojavlaunch.installers; - -import android.content.*; -import java.io.*; -import java.util.jar.*; -import net.kdt.pojavlaunch.*; -import java.nio.charset.*; -import net.kdt.pojavlaunch.value.*; -import org.apache.commons.io.*; -import com.google.gson.*; -import java.util.zip.*; - -public class Legacy1p12p2ForgeInstaller extends BaseInstaller { - public Legacy1p12p2ForgeInstaller(BaseInstaller i) { - from(i); - } - - @Override - public int install(JavaGUILauncherActivity ctx) throws IOException { - String target; - - ctx.appendlnToLog("Reading install_profile.json"); - ForgeInstallProfile profile = readInstallProfile(this); - - // Write the json file - File versionFile = new File(Tools.DIR_HOME_VERSION, profile.version); - versionFile.mkdir(); - target = versionFile.getAbsolutePath() + "/" + profile.version + ".json"; - ctx.appendlnToLog("Writing " + target + " from " + profile.json); - ZipEntry versionJson = mJarFile.getEntry(profile.json==null ? "version.json" : profile.json.substring(profile.json.indexOf("/")+1,profile.json.length())); - Tools.write( - target, - Tools.convertStream(mJarFile.getInputStream(versionJson)) - ); - - // Forge 1.12.2+ installer does not include universal, so download - // Users are already go throught Forge ads to download installer, so not again. - String[] libInfos = profile.path.split(":"); - File libraryFile = new File(Tools.DIR_HOME_LIBRARY, Tools.artifactToPath(libInfos[0], libInfos[1], libInfos[2])); - libraryFile.getParentFile().mkdirs(); - target = libraryFile.getAbsolutePath(); - String downloadPath = "https://files.minecraftforge.net/maven/" + profile.path.replace(":", "/").replace("net.minecraftforge","net/minecraftforge") + "/forge-" + libInfos[2] + "-universal.jar"; - ctx.appendlnToLog("Downloading " + target); - Tools.downloadFile(downloadPath, target); - - mJarFile.close(); - - return 0; - } - - public static ForgeInstallProfile readInstallProfile(BaseInstaller base) throws IOException, JsonSyntaxException { - ZipEntry entry = base.mJarFile.getEntry("install_profile.json"); - return entry == null ? null : Tools.GLOBAL_GSON.fromJson( - Tools.convertStream( - base.mJarFile.getInputStream(entry) - ), - ForgeInstallProfile.class - ); - } -} diff --git a/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/LegacyForgeInstaller.java.todo b/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/LegacyForgeInstaller.java.todo deleted file mode 100644 index c5c6604c..00000000 --- a/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/LegacyForgeInstaller.java.todo +++ /dev/null @@ -1,61 +0,0 @@ -package net.kdt.pojavlaunch.installers; -import android.content.*; -import java.io.*; -import java.util.jar.*; -import net.kdt.pojavlaunch.*; -import java.nio.charset.*; -import net.kdt.pojavlaunch.value.*; -import org.apache.commons.io.*; -import com.google.gson.*; -import java.util.zip.*; - -public class LegacyForgeInstaller extends BaseInstaller { - public LegacyForgeInstaller(BaseInstaller i) { - from(i); - } - - @Override - public int install(JavaGUILauncherActivity ctx) throws IOException { - String target; - - ctx.appendlnToLog("Reading install_profile.json"); - ForgeInstallProfile profile = readInstallProfile(this); - - // Write the json file - File versionFile = new File(Tools.DIR_HOME_VERSION, profile.install.target); - versionFile.mkdir(); - target = versionFile.getAbsolutePath() + "/" + profile.install.target + ".json"; - ctx.appendlnToLog("Writing " + target); - Tools.write( - target, - Tools.GLOBAL_GSON.toJson(profile.versionInfo) - ); - - // Extract Forge universal - String[] libInfos = profile.install.path.split(":"); - File libraryFile = new File(Tools.DIR_HOME_LIBRARY, Tools.artifactToPath(libInfos[0], libInfos[1], libInfos[2])); - libraryFile.getParentFile().mkdirs(); - target = libraryFile.getAbsolutePath().replace("-universal", ""); - ctx.appendlnToLog("Writing " + target); - InputStream in = mJarFile.getInputStream(mJarFile.getEntry(profile.install.filePath)); - FileOutputStream out = new FileOutputStream(target); - IOUtils.copy(in, out); - in.close(); - out.close(); - - mJarFile.close(); - - return 0; - } - - public static ForgeInstallProfile readInstallProfile(BaseInstaller base) throws IOException, JsonSyntaxException { - ZipEntry entry = base.mJarFile.getEntry("install_profile.json"); - return entry == null ? null : Tools.GLOBAL_GSON.fromJson( - Tools.convertStream( - base.mJarFile.getInputStream(entry), - Charset.forName("UTF-8") - ), - ForgeInstallProfile.class - ); - } -} diff --git a/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/LegacyOptifineInstaller.java.todo b/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/LegacyOptifineInstaller.java.todo deleted file mode 100644 index 99b316bd..00000000 --- a/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/LegacyOptifineInstaller.java.todo +++ /dev/null @@ -1,23 +0,0 @@ -package net.kdt.pojavlaunch.installers; - -import android.content.*; -import java.io.*; -import java.util.jar.*; -import net.kdt.pojavlaunch.*; -import java.nio.charset.*; -import net.kdt.pojavlaunch.value.*; -import org.apache.commons.io.*; -import com.google.gson.*; -import java.util.zip.*; - -public class LegacyOptifineInstaller extends BaseInstaller { - public LegacyOptifineInstaller(BaseInstaller i) { - from(i); - } - - @Override - public int install(JavaGUILauncherActivity ctx) throws IOException { - - return 0; - } -} diff --git a/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/NewForgeInstaller.java.todo b/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/NewForgeInstaller.java.todo deleted file mode 100644 index cb2d107f..00000000 --- a/JavaApp/src/main/java/net/kdt/pojavlaunch/installers/NewForgeInstaller.java.todo +++ /dev/null @@ -1,21 +0,0 @@ -package net.kdt.pojavlaunch.installers; - -import java.io.*; -import net.kdt.pojavlaunch.*; - -public class NewForgeInstaller extends BaseInstaller - { - public NewForgeInstaller(BaseInstaller i) { - from(i); - } - - @Override - public int install(JavaGUILauncherActivity ctx) throws IOException { - // Unused ZipFile - mJarFile.close(); - - ctx.appendlnToLog("Launching JVM"); - return ctx.launchJavaRuntime(null, - "-cp " + Tools.DIR_GAME_NEW + "/config/forge-installer-headless.jar:" + mFile.getAbsolutePath() + " me.xfl03.HeadlessInstaller --installClient ."); - } -}