Commit 3ee00912 authored by superblaubeere27's avatar superblaubeere27

LiquidLauncher v1.2 RELEASE

parent a5c75e02
......@@ -6,7 +6,7 @@
<groupId>net.ccbluex</groupId>
<artifactId>LiquidLauncher</artifactId>
<version>1.1</version>
<version>1.2</version>
<build>
<plugins>
<plugin>
......@@ -17,7 +17,18 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
......@@ -127,6 +138,11 @@
<artifactId>lzma-java</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.4.Final</version>
</dependency>
</dependencies>
......
......@@ -17,6 +17,8 @@ import net.ccbluex.LiquidLauncher.utils.*;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
......@@ -44,7 +46,7 @@ public class LiquidLauncher {
public static final boolean DEVEL_VERSION = true;
public static final Logger LOGGER = Logger.getLogger(LAUNCHER_NAME);
public static final String LAUNCHER_OPENSOURCE_PROJECT = "https://git.liquidbounce.net/CCBlueX/LiquidLauncherV2";
private static final double LAUNCHER_VERSION = 1.1;
public static final double LAUNCHER_VERSION = 1.2;
public static final String LAUNCHER_VERSION_STRING = "v" + LAUNCHER_VERSION + "-SNAPSHOT";
private static final String LIQUIDLAUNCHER_DOWNLOAD = "https://ci.liquidbounce.net/job/LiquidLauncher/";
public static LiquidLauncher liquidLauncher;
......@@ -92,6 +94,7 @@ public class LiquidLauncher {
public AssetManager assetManager;
public AuthenticationUtils.AuthenticationResponse account = AuthenticationUtils.login("CrackedUser");
public ImageIcon icon;
public boolean showReleaseNotes = false;
private URL versionsUrl;
public LiquidLauncher() throws MalformedURLException {
......@@ -118,6 +121,12 @@ public class LiquidLauncher {
return; // <---- To prevent bugs
}
public static void report(Throwable e) {
LOGGER.severe(e.toString());
e.printStackTrace();
JOptionPane.showMessageDialog(menuInterface, e.toString(), "ERROR", JOptionPane.ERROR_MESSAGE);
}
public void start() {
liquidLauncher = this;
LOGGER.info("Starting LiquidLauncher...");
......@@ -222,6 +231,8 @@ public class LiquidLauncher {
menuInterface.setVisible(true);
LOGGER.info("Ready");
startScreen.dispose();
if (showReleaseNotes)
showReleaseNotes();
}
public List<String> getMinecraftVersions() {
......@@ -385,7 +396,7 @@ public class LiquidLauncher {
gameProcessBuilder.appendArgument("--height", String.valueOf(menuInterface.clientHeight.getValue()));
LOGGER.info("[" + clientBuild.getMinecraftVersion() + ": " + clientBuild.getLiquidBounceVersion() + "] Executing client with command " + gameProcessBuilder.getArguments());
menuInterface.progress.setString("Launching...");
addProcessListener(gameProcessBuilder.execute());
launched = true;
......@@ -448,6 +459,31 @@ public class LiquidLauncher {
}
}
private void showReleaseNotes() {
try {
String s = NetworkUtils.readContent("https://raw.githubusercontent.com/CCBlueX/FileCloud/master/LiquidLauncher/releaseNotesLink");
JLabel label = new JLabel("<html>Link to the release notes: <br/><a color=\"#0000EE\">" + s + "</a></html>");
label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
label.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
try {
if (Desktop.isDesktopSupported()) {
Desktop.getDesktop().browse(new URL(s).toURI());
} else {
throw new IllegalStateException("java.awt.Desktop is not supported!");
}
} catch (Exception e1) {
report(e1);
}
}
});
JOptionPane.showMessageDialog(menuInterface, label, "Release notes", JOptionPane.PLAIN_MESSAGE);
} catch (Exception e) {
report(e);
}
}
private String getMCJson(final String minecraftVersion) throws Exception {
final String s = new String(ByteStreams.toByteArray(new URL("https://launchermeta.mojang.com/mc/game/version_manifest.json").openStream()));
final JsonArray versions = jsonParser.parse(s).getAsJsonObject().getAsJsonArray("versions");
......@@ -507,6 +543,8 @@ public class LiquidLauncher {
}
}
}
// File path = new File();
JOptionPane.showMessageDialog(menuInterface, "Failed to find the launcher JRE", "Warning", JOptionPane.WARNING_MESSAGE);
return "java";
......
......@@ -20,14 +20,14 @@ public class Main {
}
// JavaFX installed check
// try {
// Class.forName("com.sun.javafx.application.PlatformImpl");
// Class.forName("javafx.embed.swing.JFXPanel");
// } catch (ClassNotFoundException e) {
// JOptionPane.showMessageDialog(null, "Install JavaFX!", "JavaFX not found. Download the latest Java version from https://java.com/", JOptionPane.ERROR_MESSAGE);
// System.exit(-1);
// return;
// }
try {
Class.forName("com.sun.javafx.application.PlatformImpl");
Class.forName("javafx.embed.swing.JFXPanel");
} catch (ClassNotFoundException e) {
JOptionPane.showMessageDialog(null, "Install JavaFX!", "JavaFX not found. Download the latest Java version from https://java.com/", JOptionPane.ERROR_MESSAGE);
System.exit(-1);
return;
}
try {
final LiquidLauncher liquidLauncher = new LiquidLauncher();
......
......@@ -8,7 +8,7 @@ import com.google.gson.JsonParser;
import net.ccbluex.LiquidLauncher.LiquidLauncher;
import net.ccbluex.LiquidLauncher.launch.mods.Mod;
import net.ccbluex.LiquidLauncher.ui.MenuInterface;
import net.ccbluex.LiquidLauncher.utils.AuthenticationUtils;
import net.ccbluex.LiquidLauncher.utils.Alt;
import java.io.*;
import java.util.ArrayList;
......@@ -42,7 +42,7 @@ public class Settings {
private static final String CUSTOM_FOLDER = "customFolder";
public static void save(final File file) {
final MenuInterface menuInterface = LiquidLauncher.liquidLauncher.menuInterface;
final MenuInterface menuInterface = LiquidLauncher.menuInterface;
if (!file.exists()) {
try {
......@@ -88,18 +88,31 @@ public class Settings {
}
jsonObject.add("versions", versions);
if (menuInterface.getRememberMeCheckBox().isSelected()) {
// TODO Only save session
final JsonObject accountObject = new JsonObject();
accountObject.addProperty("clientToken", LiquidLauncher.liquidLauncher.account.getClientToken());
accountObject.addProperty("accessToken", LiquidLauncher.liquidLauncher.account.getAccessToken());
accountObject.addProperty("uuid", LiquidLauncher.liquidLauncher.account.getUUID());
accountObject.addProperty("name", LiquidLauncher.liquidLauncher.account.getName());
accountObject.addProperty("legacy", LiquidLauncher.liquidLauncher.account.isLegacy());
jsonObject.add(ACCOUNT, accountObject);
// if (menuInterface.getRememberMeCheckBox().isSelected()) {
// // TODO Only save session
// final JsonObject accountObject = new JsonObject();
//
// accountObject.addProperty("clientToken", LiquidLauncher.liquidLauncher.account.getClientToken());
// accountObject.addProperty("accessToken", LiquidLauncher.liquidLauncher.account.getAccessToken());
// accountObject.addProperty("uuid", LiquidLauncher.liquidLauncher.account.getUUID());
// accountObject.addProperty("name", LiquidLauncher.liquidLauncher.account.getName());
// accountObject.addProperty("legacy", LiquidLauncher.liquidLauncher.account.isLegacy());
//
// jsonObject.add(ACCOUNT, accountObject);
// }
{
JsonArray alts = new JsonArray();
for (Alt alt :
LiquidLauncher.menuInterface.alts) {
JsonObject altObject = new JsonObject();
altObject.addProperty("username", alt.getUsername());
altObject.addProperty("password", alt.getPassword());
altObject.addProperty("name", alt.getName());
alts.add(altObject);
}
jsonObject.add(ACCOUNT, alts);
}
jsonObject.addProperty("lastVersion", LiquidLauncher.LAUNCHER_VERSION);
try {
GZIPOutputStream outStream = new GZIPOutputStream(new FileOutputStream(file));
......@@ -107,13 +120,13 @@ public class Settings {
outStream.close();
// Files.write(file.toPath(), jsonObject.toString().getBytes());
} catch (final IOException e) {
LiquidLauncher.liquidLauncher.LOGGER.severe("Failed to save settings:");
LiquidLauncher.LOGGER.severe("Failed to save settings:");
e.printStackTrace();
}
}
public static void load(final File file) {
final MenuInterface menuInterface = LiquidLauncher.liquidLauncher.menuInterface;
final MenuInterface menuInterface = LiquidLauncher.menuInterface;
try {
if (!file.exists())
......@@ -142,6 +155,10 @@ public class Settings {
menuInterface.getFolderType().setSelectedIndex(jsonObject.get(FOLDER_TYPE).getAsInt());
if (jsonObject.has(CUSTOM_FOLDER))
menuInterface.getCustomFolderSelection().setText(jsonObject.get(CUSTOM_FOLDER).getAsString());
boolean showRelaseNotes = true;
if (jsonObject.has("lastVersion") && jsonObject.get("lastVersion").getAsDouble() >= LiquidLauncher.LAUNCHER_VERSION)
showRelaseNotes = false;
LiquidLauncher.liquidLauncher.showReleaseNotes = showRelaseNotes;
menuInterface.updateEnabled();
menuInterface.updatePaths();
if (jsonObject.has("versions")) {
......@@ -200,18 +217,17 @@ public class Settings {
menuInterface.getRememberMeCheckBox().setSelected(jsonObject.get(REMEMBER_ME).getAsBoolean());
if (jsonObject.has(ACCOUNT)) {
// TODO: LOAD SESSION
final JsonObject accountObject = jsonObject.get(ACCOUNT).getAsJsonObject();
final String name = accountObject.get("name").getAsString();
final String uuid = accountObject.get("uuid").getAsString();
final String accessToken = accountObject.get("accessToken").getAsString();
final String clientToken = accountObject.get("clientToken").getAsString();
final boolean legacy = accountObject.get("legacy").getAsBoolean();
LiquidLauncher.liquidLauncher.account = new AuthenticationUtils.AuthenticationResponse(clientToken, accessToken, uuid, name, legacy);
JsonArray alts = jsonObject.getAsJsonArray(ACCOUNT);
for (JsonElement element :
alts) {
JsonObject altObject = (JsonObject) element;
Alt alt = new Alt(altObject.get("username").getAsString(), altObject.get("password").getAsString(), altObject.get("name").getAsString());
LiquidLauncher.menuInterface.alts.add(alt);
}
LiquidLauncher.menuInterface.updateAltList();
}
} catch (Exception e) {
LiquidLauncher.liquidLauncher.LOGGER.severe("Failed to load settings: ");
LiquidLauncher.LOGGER.severe("Failed to load settings: ");
e.printStackTrace();
}
}
......
......@@ -56,7 +56,7 @@ public class AddModDialog extends JDialog {
// call onCancel() on ESCAPE
contentPane.registerKeyboardAction(e -> onCancel(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
browseButton.addActionListener(e -> {
String f = Utils.chooseFile(LiquidLauncher.liquidLauncher.minecraftDirectory, LiquidLauncher.liquidLauncher.menuInterface);
String f = Utils.chooseFile(LiquidLauncher.minecraftDirectory, LiquidLauncher.menuInterface);
if (f != null) {
modPath.setText(f);
}
......
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="net.ccbluex.LiquidLauncher.ui.AltDialog">
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<xy x="48" y="54" width="436" height="297"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="94766" layout-manager="GridLayoutManager" row-count="1" 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>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<hspacer id="98af6">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<grid id="9538f" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="true" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="e7465" class="javax.swing.JButton" binding="buttonOK">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="OK"/>
</properties>
</component>
<component id="5723f" class="javax.swing.JButton" binding="buttonCancel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Cancel"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
<grid id="e3588" layout-manager="GridLayoutManager" row-count="7" 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>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="56c98" class="javax.swing.JLabel">
<constraints>
<grid row="0" 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 value="Username / E-Mail:"/>
</properties>
</component>
<vspacer id="82ebc">
<constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="6a938" class="javax.swing.JTextField" binding="userNameField">
<constraints>
<grid row="1" column="0" row-span="1" col-span="2" 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/>
</component>
<component id="e7639" class="javax.swing.JLabel">
<constraints>
<grid row="2" 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 value="Password (Leave blank for cracked):"/>
</properties>
</component>
<component id="f98d5" class="javax.swing.JPasswordField" binding="passwordField">
<constraints>
<grid row="3" column="0" row-span="1" col-span="2" 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/>
</component>
<component id="5ac8a" 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 value="E-Mail:Password:"/>
</properties>
</component>
<component id="c5b3c" class="javax.swing.JTextField" binding="emailPassword">
<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/>
</component>
<component id="a84f3" class="javax.swing.JButton" binding="fromClipboardButton" default-binding="true">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="From clipboard"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
</form>
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="net.ccbluex.LiquidLauncher.ui.BanCheckerInterface">
<grid id="27dc6" binding="panel" layout-manager="GridLayoutManager" row-count="8" 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>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="fff97" class="javax.swing.JTextField" binding="ipTextField">
<constraints>
<grid row="1" 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/>
</component>
<vspacer id="e0770">
<constraints>
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="36a09" class="javax.swing.JSpinner" binding="portSpinner">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="2039a" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" 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 value="Port:"/>
</properties>
</component>
<component id="70ce8" class="javax.swing.JLabel">
<constraints>
<grid row="0" 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 value="IP:"/>
</properties>
</component>
<component id="7489d" class="javax.swing.JButton" binding="checkButton" default-binding="true">
<constraints>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Check"/>
</properties>
</component>
<component id="cd3d7" class="javax.swing.JProgressBar" binding="progressBar">
<constraints>
<grid row="4" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="c9224" class="javax.swing.JLabel" binding="statusLabel">
<constraints>
<grid row="5" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font size="26" style="1"/>
<text value="IDLE..."/>
</properties>
</component>
<component id="50d37" class="javax.swing.JLabel" binding="messageLabel">
<constraints>