Commit 3dbc1b3a authored by superblaubeere27's avatar superblaubeere27

Add custom folder selection

parent 3d838792
......@@ -49,6 +49,7 @@ public class LiquidLauncher {
private static final String LIQUIDLAUNCHER_DOWNLOAD = "https://ci.liquidbounce.net/job/LiquidLauncher/";
public static LiquidLauncher liquidLauncher;
public static MenuInterface menuInterface;
public static File minecraftDirectory;
private static File configFile;
static {
......@@ -86,7 +87,6 @@ public class LiquidLauncher {
public final JsonParser jsonParser = new JsonParser();
public HashMap<String, List<Mod>> versionMods = new HashMap<>();
public File minecraftDirectory;
public File launcherDirectory;
public List<ClientBuild> clientBuilds;
public AssetManager assetManager;
......@@ -247,7 +247,31 @@ public class LiquidLauncher {
boolean launched = false;
menuInterface.launchButton.setEnabled(false);
try {
final LauncherFolderTree tree = new LauncherFolderTree(launcherDirectory, clientBuild);
File treeFolder = null;
switch (menuInterface.getFolderType().getSelectedIndex()) {
case 0:
treeFolder = minecraftDirectory;
break;
case 1:
treeFolder = launcherDirectory;
break;
case 2:
try {
File f = new File(menuInterface.getCustomFolderSelection().getText());
if (f.exists() && f.isDirectory()) {
treeFolder = f;
break;
}
} catch (Exception e) {
}
treeFolder = minecraftDirectory;
break;
default:
treeFolder = launcherDirectory;
break;
}
final LauncherFolderTree tree = new LauncherFolderTree(FolderType.values()[menuInterface.getFolderArch().getSelectedIndex()], treeFolder, clientBuild);
tree.mkdirs();
if (!tree.getLiquidBounceFile().exists()) {
final String f = AddLiquidBounceDialog.showDialog(clientBuild.getLiquidBounceDownload(), clientBuild.getLiquidBounceHash());
......
......@@ -14,6 +14,7 @@ public class Main {
Thread t = new Thread(() -> {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
// UIManager.setLookAndFeel("com.jtattoo.plaf.noire.NoireLookAndFeel");
} catch (final Exception ignored) {
}
......
......@@ -37,6 +37,9 @@ public class Settings {
private final static String JVM_PATH = "jvmPath";
private final static String VERSIONS = "versions";
private final static String MODS = "mods";
private static final String FOLDER_ARCH = "folderArch";
private static final String FOLDER_TYPE = "folderType";
private static final String CUSTOM_FOLDER = "customFolder";
public static void save(final File file) {
final MenuInterface menuInterface = LiquidLauncher.liquidLauncher.menuInterface;
......@@ -60,6 +63,9 @@ public class Settings {
jsonObject.addProperty(REMEMBER_ME, menuInterface.getRememberMeCheckBox().isSelected());
jsonObject.addProperty(LATEST_VERSION, menuInterface.getAlwaysLatest().isSelected());
jsonObject.addProperty(JVM_PATH, menuInterface.getJvmPath().getText());
jsonObject.addProperty(FOLDER_ARCH, menuInterface.getFolderArch().getSelectedIndex());
jsonObject.addProperty(FOLDER_TYPE, menuInterface.getFolderType().getSelectedIndex());
jsonObject.addProperty(CUSTOM_FOLDER, menuInterface.getCustomFolderSelection().getText());
JsonArray versions = new JsonArray();
for (String s :
......@@ -130,6 +136,13 @@ public class Settings {
menuInterface.getJvmArgumentsField().setText(jsonObject.get(JVM_ARGS).getAsString());
if (jsonObject.has(JVM_PATH))
menuInterface.getJvmPath().setText(jsonObject.get(JVM_PATH).getAsString());
if (jsonObject.has(FOLDER_ARCH))
menuInterface.getFolderArch().setSelectedIndex(jsonObject.get(FOLDER_ARCH).getAsInt());
if (jsonObject.has(FOLDER_TYPE))
menuInterface.getFolderType().setSelectedIndex(jsonObject.get(FOLDER_TYPE).getAsInt());
if (jsonObject.has(CUSTOM_FOLDER))
menuInterface.getCustomFolderSelection().setText(jsonObject.get(CUSTOM_FOLDER).getAsString());
menuInterface.updateEnabled();
if (jsonObject.has("versions")) {
for (JsonElement versionElement :
jsonObject.getAsJsonArray("versions")) {
......
package net.ccbluex.LiquidLauncher.launch;
/**
* Copyright © 2015 - 2017 | CCBlueX | All rights reserved.
* <p>
* Exrief - $ By CCBlueX(superblaubeere27)
*/
public enum FolderType {
MINECRAFT, LIQUIDLAUNCHER;
}
......@@ -23,20 +23,36 @@ public class LauncherFolderTree {
private File forgeJar;
private File modsFolder;
public LauncherFolderTree(final File liquidLauncherFolder, final ClientBuild build) {
assets = new File(liquidLauncherFolder, "assets"); // /assets
minecraftVersionFolder = new File(liquidLauncherFolder, "versions" + File.separator + build.getMinecraftVersion() + File.separator);
versionDir = new File(new File(liquidLauncherFolder, "versions" + File.separator + build.getMinecraftVersion()), build.getLiquidBounceVersion());
minecraftJson = new File(minecraftVersionFolder, build.getMinecraftVersion() + ".json");
minecraftJar = new File(minecraftVersionFolder, build.getMinecraftVersion() + ".jar");
gameDir = new File(liquidLauncherFolder, "gameDir");
libraryFolder = new File(liquidLauncherFolder, "libraries");
modsFolder = new File(gameDir, "mods");
otherFolder = new File(versionDir, "jars");
liquidBounceFile = new File(otherFolder, "liquidBounce.jar");
optifineFile = new File(otherFolder, "optifine.jar");
forgeJson = new File(otherFolder, "forge.json");
forgeJar = new File(otherFolder, "forge.jar");
public LauncherFolderTree(final FolderType type, final File folder, final ClientBuild build) {
if (type == FolderType.LIQUIDLAUNCHER) {
assets = new File(folder, "assets"); // /assets
minecraftVersionFolder = new File(folder, "versions" + File.separator + build.getMinecraftVersion() + File.separator);
versionDir = new File(new File(folder, "versions" + File.separator + build.getMinecraftVersion()), build.getLiquidBounceVersion());
minecraftJson = new File(minecraftVersionFolder, build.getMinecraftVersion() + ".json");
minecraftJar = new File(minecraftVersionFolder, build.getMinecraftVersion() + ".jar");
gameDir = new File(folder, "gameDir");
libraryFolder = new File(folder, "libraries");
modsFolder = new File(gameDir, "mods");
otherFolder = new File(versionDir, "jars");
liquidBounceFile = new File(otherFolder, "liquidBounce.jar");
optifineFile = new File(otherFolder, "optifine.jar");
forgeJson = new File(otherFolder, "forge.json");
forgeJar = new File(otherFolder, "forge.jar");
} else if (type == FolderType.MINECRAFT) {
assets = new File(folder, "assets");
minecraftVersionFolder = new File(folder, "versions" + File.separator + build.getMinecraftVersion() + File.separator);
minecraftJson = new File(minecraftVersionFolder, build.getMinecraftVersion() + ".json");
minecraftJar = new File(minecraftVersionFolder, build.getMinecraftVersion() + ".jar");
gameDir = folder;
libraryFolder = new File(folder, "libraries");
modsFolder = new File(gameDir, "mods");
versionDir = new File(new File(folder, "versions" + File.separator + build.getMinecraftVersion()), build.getLiquidBounceVersion());
otherFolder = new File(versionDir, "LiquidBounce");
liquidBounceFile = new File(otherFolder, "liquidBounce.jar");
optifineFile = new File(otherFolder, "optifine.jar");
forgeJson = new File(otherFolder, "forge.json");
forgeJar = new File(otherFolder, "forge.jar");
}
}
public File getAssets() {
......
......@@ -39,7 +39,7 @@ public class ConfigureModsForm extends JDialog {
super();
this.clientVersion = clientVersion;
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setSize(500, 250);
setSize(750, 375);
setTitle("Configure mods");
setLocationRelativeTo(null);
setAlwaysOnTop(true);
......
......@@ -3,7 +3,7 @@
<grid id="27dc6" binding="payne" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="617" height="415"/>
<xy x="20" y="20" width="617" height="440"/>
</constraints>
<properties/>
<border type="none"/>
......@@ -266,6 +266,88 @@
</component>
</children>
</grid>
<grid id="15acd" layout-manager="GridLayoutManager" row-count="7" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<tabbedpane title-resource-bundle="tanslations" title-key="file_management"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="efeaa" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="tanslations" key="folderArch"/>
</properties>
</component>
<vspacer id="90281">
<constraints>
<grid row="6" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="98096" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="tanslations" key="folder"/>
</properties>
</component>
<component id="41921" class="javax.swing.JButton" binding="browseButton" default-binding="true">
<constraints>
<grid row="5" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<enabled value="false"/>
<text resource-bundle="tanslations" key="browse"/>
</properties>
</component>
<component id="f6764" class="javax.swing.JTextField" binding="customFolderSelection">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<enabled value="false"/>
<text value=""/>
</properties>
</component>
<component id="7aa7b" class="javax.swing.JComboBox" binding="folderArch">
<constraints>
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<model>
<item value="Minecraft"/>
<item value="LiquidLauncher"/>
</model>
</properties>
</component>
<component id="f3fec" class="javax.swing.JComboBox" binding="folderType">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<model>
<item value="Minecraft"/>
<item value="LiquidLauncher"/>
<item value="Custom"/>
</model>
</properties>
</component>
<component id="c210e" class="javax.swing.JLabel">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="tanslations" key="customFolder"/>
</properties>
</component>
</children>
</grid>
<grid id="d6117" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
......@@ -330,4 +412,16 @@
</component>
</children>
</grid>
<buttonGroups>
<group name="folderArch">
<member id="66082"/>
<member id="ec02f"/>
</group>
<group name="folderSelection">
<member id="edb77"/>
<member id="edb77"/>
<member id="7fc5d"/>
<member id="3bbfa"/>
</group>
</buttonGroups>
</form>
......@@ -5,7 +5,7 @@ login=Einloggen
loginmsg_loginsuccesful=Einloggen erfolgreich!
loginmsg_idle=Warten...
news=News
password=Passwort (Leer lassen für Cracked)
password=Passwort (Leer lassen fuer Cracked)
remember_me=Merken
username_email=Name / E-Mail
loginmsg_loginfailed=Einloggen fehlgeschlagen!
......@@ -14,7 +14,7 @@ liquidbounce_version=LiquidBounce Version:
configure_mods=Mods Konfigurieren
waiting=Warten...
latestVersion=Neuste Version
resolution=Auflösung:
resolution=Aufloesung:
jvmArgs=JVM Argumente:
jvmPath=JVM Pfad:
useLauncherJRE=Launcher JRE nutzen
......@@ -22,14 +22,19 @@ keepLauncher=Launcher laufen lassen
settings=Einstellungen
clientLog=Client Log
autoScroll=Automatisch scrollen
clear=Löschen
clear=Loeschen
ok=OK
cancel=Abbrechen
add=Hinzufügen
remove=Löschen
addMod=Mod hinzufügen
add=Hinzufuegen
remove=Loeschen
addMod=Mod hinzufuegen
modJar=Mod Jar
browse=Auswählen
addLiquidBounce=LiquidBounce hinzufügen
browse=Auswaehlen
addLiquidBounce=LiquidBounce hinzufuegen
liquidBounceDownloadLabel=<html>Lade LiquidBounce von dieser Seite herunter: <input value="%download%"></input> Bitte <strong>NICHT</strong> extahieren!</html>
liquidBounceDnD=Oder zieh die Datei in dieses Fenster
\ No newline at end of file
liquidBounceDnD=Oder zieh die Datei in dieses Fenster
file_management=Datei Management
folderArch=Welche Ordner architektur?
custom=Benutzerdefiniert
folder=Welcher Ordner?
customFolder=Benutzerdefinierter Ordner:
\ No newline at end of file
......@@ -32,4 +32,9 @@ modJar=Mod Jar
browse=Browse
addLiquidBounce=Add LiquidBounce
liquidBounceDownloadLabel=<html>Please download LiquidBounce from the download page: <input value="%download%"></input> Please do <strong>NOT</strong> extract the zip file!</html>
liquidBounceDnD=Or drag and drop the file into this frame
\ No newline at end of file
liquidBounceDnD=Or drag and drop the file into this frame
file_management=File management
folderArch=Which folder architecture?
custom=Custom
folder=Which folder?
customFolder=Custom folder:
\ No newline at end of file
package net.ccbluex.LiquidLauncher;
import net.ccbluex.LiquidLauncher.launch.ClientBuild;
import net.ccbluex.LiquidLauncher.launch.FolderType;
import net.ccbluex.LiquidLauncher.launch.LauncherFolderTree;
import org.junit.Test;
......@@ -17,7 +18,7 @@ public class LauncherFolderTreeTest {
@Test
public void testPaths() {
LauncherFolderTree tree = new LauncherFolderTree(new File("/ll"), new ClientBuild("eth", "", "", "1.8.8", "b26.2", ""));
LauncherFolderTree tree = new LauncherFolderTree(FolderType.LIQUIDLAUNCHER, new File("/ll"), new ClientBuild("eth", "", "", "1.8.8", "b26.2", ""));
assertEquals("/ll/assets", tree.getAssets().getAbsolutePath());
assertEquals("/ll/versions/1.8.8", tree.getMinecraftVersionFolder().getAbsolutePath());
assertEquals("/ll/versions/1.8.8/1.8.8.json", tree.getMinecraftJson().getAbsolutePath());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment