Lots and Lots of work done
This commit is contained in:
		
							parent
							
								
									d2a524a6fe
								
							
						
					
					
						commit
						f994a5a419
					
				
							
								
								
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -142,3 +142,8 @@ fabric.properties
 | 
				
			|||||||
config.yml
 | 
					config.yml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
src/test
 | 
					src/test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.classpath
 | 
				
			||||||
 | 
					.project
 | 
				
			||||||
 | 
					bin/
 | 
				
			||||||
 | 
					.settings/
 | 
				
			||||||
@ -3,7 +3,7 @@
 | 
				
			|||||||
    <option name="myName" value="Project Default" />
 | 
					    <option name="myName" value="Project Default" />
 | 
				
			||||||
    <inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
 | 
					    <inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
 | 
				
			||||||
      <Languages>
 | 
					      <Languages>
 | 
				
			||||||
        <language minSize="88" name="Java" />
 | 
					        <language minSize="108" name="Java" />
 | 
				
			||||||
      </Languages>
 | 
					      </Languages>
 | 
				
			||||||
    </inspection_tool>
 | 
					    </inspection_tool>
 | 
				
			||||||
  </profile>
 | 
					  </profile>
 | 
				
			||||||
 | 
				
			|||||||
@ -4,7 +4,8 @@ plugins {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
group 'tech.nevets.jaml'
 | 
					group 'tech.nevets.jaml'
 | 
				
			||||||
version '0.5.0'
 | 
					version '0.6.0'
 | 
				
			||||||
 | 
					def build = 'stable'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
repositories {
 | 
					repositories {
 | 
				
			||||||
    mavenCentral()
 | 
					    mavenCentral()
 | 
				
			||||||
 | 
				
			|||||||
@ -1,77 +0,0 @@
 | 
				
			|||||||
package tech.nevets.jaml;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.simpleyaml.configuration.file.YamlFile;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.io.IOException;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class Config {
 | 
					 | 
				
			||||||
    private static final YamlFile YML_FILE = new YamlFile(JAML.path + "\\config.yml");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public static void loadConfig() {
 | 
					 | 
				
			||||||
        try {
 | 
					 | 
				
			||||||
            if (!YML_FILE.exists()) {
 | 
					 | 
				
			||||||
                System.out.println("Config file not found, creating new one...");
 | 
					 | 
				
			||||||
                YML_FILE.createNewFile(true);
 | 
					 | 
				
			||||||
                System.out.println("Config file created!");
 | 
					 | 
				
			||||||
            } else {
 | 
					 | 
				
			||||||
                System.out.println("Loading Config file...");
 | 
					 | 
				
			||||||
                YML_FILE.loadWithComments();
 | 
					 | 
				
			||||||
                System.out.println("Config file loaded!");
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        } catch (final Exception e) {
 | 
					 | 
				
			||||||
            System.out.println("Error while loading config file!");
 | 
					 | 
				
			||||||
            e.printStackTrace();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        YML_FILE.setComment("java",
 | 
					 | 
				
			||||||
                "\n"
 | 
					 | 
				
			||||||
                + "            JJJJJJJJJJJ           AAA                MMMMMMMM               MMMMMMMM LLLLLLLLLLL             \n"
 | 
					 | 
				
			||||||
                + "            J:::::::::J          A:::A               M:::::::M             M:::::::M L:::::::::L             \n"
 | 
					 | 
				
			||||||
                + "            J:::::::::J         A:::::A              M::::::::M           M::::::::M L:::::::::L             \n"
 | 
					 | 
				
			||||||
                + "            JJ:::::::JJ        A:::::::A             M:::::::::M         M:::::::::M LL:::::::LL             \n"
 | 
					 | 
				
			||||||
                + "              J:::::J         A:::::::::A            M::::::::::M       M::::::::::M   L:::::L               \n"
 | 
					 | 
				
			||||||
                + "              J:::::J        A:::::A:::::A           M:::::::::::M     M:::::::::::M   L:::::L               \n"
 | 
					 | 
				
			||||||
                + "              J:::::J       A:::::A A:::::A          M:::::::M::::M   M::::M:::::::M   L:::::L               \n"
 | 
					 | 
				
			||||||
                + "              J:::::j      A:::::A   A:::::A         M::::::M M::::M M::::M M::::::M   L:::::L               \n"
 | 
					 | 
				
			||||||
                + "              J:::::J     A:::::A     A:::::A        M::::::M  M::::M::::M  M::::::M   L:::::L               \n"
 | 
					 | 
				
			||||||
                + "  JJJJJJJ     J:::::J    A:::::AAAAAAAAA:::::A       M::::::M   M:::::::M   M::::::M   L:::::L               \n"
 | 
					 | 
				
			||||||
                + "  J:::::J     J:::::J   A:::::::::::::::::::::A      M::::::M    M:::::M    M::::::M   L:::::L               \n"
 | 
					 | 
				
			||||||
                + "  J::::::J   J::::::J  A:::::AAAAAAAAAAAAA:::::A     M::::::M     MMMMM     M::::::M   L:::::L         LLLLLL\n"
 | 
					 | 
				
			||||||
                + "  J:::::::JJJ:::::::J A:::::A             A:::::A    M::::::M               M::::::M LL:::::::LLLLLLLLL:::::L\n"
 | 
					 | 
				
			||||||
                + "   JJ:::::::::::::JJ A:::::A               A:::::A   M::::::M               M::::::M L::::::::::::::::::::::L\n"
 | 
					 | 
				
			||||||
                + "     JJ:::::::::JJ  A:::::A                 A:::::A  M::::::M               M::::::M L::::::::::::::::::::::L\n"
 | 
					 | 
				
			||||||
                + "       JJJJJJJJJ   AAAAAAA                   AAAAAAA MMMMMMMM               MMMMMMMM LLLLLLLLLLLLLLLLLLLLLLLL\n"
 | 
					 | 
				
			||||||
        );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        YML_FILE.addDefault("java.jdk8", "");
 | 
					 | 
				
			||||||
        YML_FILE.setComment("java.jdk8", "Set these to the bin directory of each JDK version");
 | 
					 | 
				
			||||||
        YML_FILE.addDefault("java.jdk16", "");
 | 
					 | 
				
			||||||
        YML_FILE.addDefault("java.jdk17", "");
 | 
					 | 
				
			||||||
        YML_FILE.addDefault("launcher.default-profile", "default");
 | 
					 | 
				
			||||||
        YML_FILE.setComment("launcher.default-profile", "Set's the profile that will be loaded automatically");
 | 
					 | 
				
			||||||
        YML_FILE.addDefault("launcher.path","default");
 | 
					 | 
				
			||||||
        YML_FILE.setComment("launcher.path","Path to JAML files\n" + "default: " + JAML.path.toString());
 | 
					 | 
				
			||||||
        YML_FILE.addDefault("launcher.first-launch", true);
 | 
					 | 
				
			||||||
        YML_FILE.setComment("launcher.first-launch", "Do Not Change, will regenerate files");
 | 
					 | 
				
			||||||
        YML_FILE.addDefault("launcher.verbose", false);
 | 
					 | 
				
			||||||
        YML_FILE.setComment("launcher.verbose", "If true, will print out all the messages");
 | 
					 | 
				
			||||||
        YML_FILE.addDefault("launcher.version", "0.1.0");
 | 
					 | 
				
			||||||
        YML_FILE.setComment("launcher.version", "Jaml version, don't change it!");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        try {
 | 
					 | 
				
			||||||
            YML_FILE.save();
 | 
					 | 
				
			||||||
        } catch (IOException e) {
 | 
					 | 
				
			||||||
            e.printStackTrace();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public static YamlFile getConfig() {
 | 
					 | 
				
			||||||
        return YML_FILE;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public static void reloadConfig() {
 | 
					 | 
				
			||||||
        CONFIG = getConfig();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public static YamlFile CONFIG = getConfig();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,16 +0,0 @@
 | 
				
			|||||||
package tech.nevets.jaml;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.io.IOException;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class FirstLaunch {
 | 
					 | 
				
			||||||
    public FirstLaunch() {
 | 
					 | 
				
			||||||
        System.out.println("First Launch!");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        Config.CONFIG.set("launcher.first-launch", false);
 | 
					 | 
				
			||||||
        try {
 | 
					 | 
				
			||||||
            Config.CONFIG.save();
 | 
					 | 
				
			||||||
        } catch (IOException e) {
 | 
					 | 
				
			||||||
            e.printStackTrace();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,28 +1,26 @@
 | 
				
			|||||||
package tech.nevets.jaml;
 | 
					package tech.nevets.jaml;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.apache.commons.io.FileUtils;
 | 
					 | 
				
			||||||
import org.simpleyaml.configuration.file.YamlFile;
 | 
					import org.simpleyaml.configuration.file.YamlFile;
 | 
				
			||||||
import tech.nevets.jaml.gui.GuiHandler;
 | 
					import tech.nevets.jaml.gui.GuiHandler;
 | 
				
			||||||
 | 
					import tech.nevets.jaml.util.Config;
 | 
				
			||||||
 | 
					import tech.nevets.jaml.util.DiscordRP;
 | 
				
			||||||
 | 
					import tech.nevets.jaml.util.LoaderUtils;
 | 
				
			||||||
import tech.nevets.jaml.util.ProfileUtils;
 | 
					import tech.nevets.jaml.util.ProfileUtils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.File;
 | 
					 | 
				
			||||||
import java.io.IOException;
 | 
					 | 
				
			||||||
import java.net.URISyntaxException;
 | 
					 | 
				
			||||||
import java.net.URL;
 | 
					 | 
				
			||||||
import java.nio.file.Path;
 | 
					import java.nio.file.Path;
 | 
				
			||||||
import java.nio.file.Paths;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class JAML {
 | 
					public class JAML {
 | 
				
			||||||
    public static YamlFile config = Config.CONFIG;
 | 
					    //public static YamlFile config = Config.getConfig();
 | 
				
			||||||
    public static Path path;
 | 
					    public static Path path;
 | 
				
			||||||
    public static GuiHandler guiHandler;
 | 
					    public static GuiHandler guiHandler;
 | 
				
			||||||
    public static Profile activeProfile;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static void main(String[] args) {
 | 
					    public static void main(String[] args) {
 | 
				
			||||||
        DiscordRP.start();
 | 
					        DiscordRP.start();
 | 
				
			||||||
        makeDirs();
 | 
					        makeDirs();
 | 
				
			||||||
        Config.loadConfig();
 | 
					        Config.loadConfig();
 | 
				
			||||||
 | 
					        ProfileUtils.getProfileList();
 | 
				
			||||||
 | 
					        ProfileUtils.getActiveProfile();
 | 
				
			||||||
 | 
					        LoaderUtils.getLoaders();
 | 
				
			||||||
        DiscordRP.update("", "");
 | 
					        DiscordRP.update("", "");
 | 
				
			||||||
        guiHandler = new GuiHandler();
 | 
					        guiHandler = new GuiHandler();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -31,13 +29,6 @@ public class JAML {
 | 
				
			|||||||
//        } catch (IOException e) {
 | 
					//        } catch (IOException e) {
 | 
				
			||||||
//            e.printStackTrace();
 | 
					//            e.printStackTrace();
 | 
				
			||||||
//        }
 | 
					//        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
        try {
 | 
					 | 
				
			||||||
            activeProfile = ProfileUtils.loadProfile(config.getString("launcher.default-profile"));
 | 
					 | 
				
			||||||
        } catch (IOException e) {
 | 
					 | 
				
			||||||
            System.out.println("Unable to load default profile: " + e.getMessage());
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static void makeDirs() {
 | 
					    private static void makeDirs() {
 | 
				
			||||||
@ -81,20 +72,5 @@ public class JAML {
 | 
				
			|||||||
        } catch (Exception e) {
 | 
					        } catch (Exception e) {
 | 
				
			||||||
            e.printStackTrace();
 | 
					            e.printStackTrace();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
        try {
 | 
					 | 
				
			||||||
            copyAssets();
 | 
					 | 
				
			||||||
        } catch (Exception e) {
 | 
					 | 
				
			||||||
            e.printStackTrace();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public static void copyAssets() throws IOException, URISyntaxException {
 | 
					 | 
				
			||||||
        URL resource = JAML.class.getResource("/assets/");
 | 
					 | 
				
			||||||
        File assets = Paths.get(resource.toURI()).toFile();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (!Path.of(path + "\\data\\").toFile().exists()) {
 | 
					 | 
				
			||||||
            FileUtils.copyDirectory(assets, new File(path + "\\assets\\"));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -1,94 +0,0 @@
 | 
				
			|||||||
package tech.nevets.jaml;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.nio.file.Path;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class Profile {
 | 
					 | 
				
			||||||
    private String profileName;
 | 
					 | 
				
			||||||
    private String email;
 | 
					 | 
				
			||||||
    private String hashedPassword;
 | 
					 | 
				
			||||||
    private String key;
 | 
					 | 
				
			||||||
    private String salt;
 | 
					 | 
				
			||||||
    private String gamePath;
 | 
					 | 
				
			||||||
    private String version;
 | 
					 | 
				
			||||||
    private String loader;
 | 
					 | 
				
			||||||
    private Boolean offlineMode;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public Profile(){
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public String getProfileName() {
 | 
					 | 
				
			||||||
        return profileName;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setProfileName(String profileName) {
 | 
					 | 
				
			||||||
        this.profileName = profileName.toLowerCase();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public String getEmail() {
 | 
					 | 
				
			||||||
        return email;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setEmail(String email) {
 | 
					 | 
				
			||||||
        this.email = email;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public String getHashedPassword() {
 | 
					 | 
				
			||||||
        return hashedPassword;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setHashedPassword(String hashedPassword) {
 | 
					 | 
				
			||||||
        this.hashedPassword = hashedPassword;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public String getKey() {
 | 
					 | 
				
			||||||
        return key;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setKey(String key) {
 | 
					 | 
				
			||||||
        this.key = key;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public String getSalt() {
 | 
					 | 
				
			||||||
        return salt;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setSalt(String salt) {
 | 
					 | 
				
			||||||
        this.salt = salt;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public Path getGamePath() {
 | 
					 | 
				
			||||||
        return Path.of(gamePath);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setGamePath(Path gamePath) {
 | 
					 | 
				
			||||||
        this.gamePath = String.valueOf(gamePath);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public String getVersion() {
 | 
					 | 
				
			||||||
        return version;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setVersion(String version) {
 | 
					 | 
				
			||||||
        this.version = version;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public String getLoader() {
 | 
					 | 
				
			||||||
        return loader;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setLoader (String loader) {
 | 
					 | 
				
			||||||
        this.loader = loader;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public Boolean getOfflineMode() {
 | 
					 | 
				
			||||||
        return offlineMode;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setOfflineMode(Boolean offlineMode) {
 | 
					 | 
				
			||||||
        this.offlineMode = offlineMode;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public String toString() {
 | 
					 | 
				
			||||||
        return "{ profileName: " + profileName + ", email: " + email + ", hashedPassword: " + hashedPassword + ", key: " + key + ", salt: " + salt + ", gamePath: " + gamePath + ", version: " + version + ", loader: " + loader + ", offlineMode: " + offlineMode + " }";
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,8 +1,8 @@
 | 
				
			|||||||
package tech.nevets.jaml.gui;
 | 
					package tech.nevets.jaml.gui;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import tech.nevets.jaml.FirstLaunch;
 | 
					import tech.nevets.jaml.util.FirstLaunch;
 | 
				
			||||||
import tech.nevets.jaml.JAML;
 | 
					import tech.nevets.jaml.JAML;
 | 
				
			||||||
import tech.nevets.jaml.Profile;
 | 
					import tech.nevets.jaml.objects.Profile;
 | 
				
			||||||
import tech.nevets.jaml.util.ProfileUtils;
 | 
					import tech.nevets.jaml.util.ProfileUtils;
 | 
				
			||||||
import tech.nevets.jaml.util.Encryptor;
 | 
					import tech.nevets.jaml.util.Encryptor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -10,16 +10,14 @@ import javax.swing.*;
 | 
				
			|||||||
import java.awt.*;
 | 
					import java.awt.*;
 | 
				
			||||||
import java.awt.event.ActionEvent;
 | 
					import java.awt.event.ActionEvent;
 | 
				
			||||||
import java.awt.event.ActionListener;
 | 
					import java.awt.event.ActionListener;
 | 
				
			||||||
 | 
					import java.io.File;
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
import java.nio.file.Path;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class FirstLaunchGui implements Runnable, ActionListener {
 | 
					public class FirstLaunchGui implements Runnable, ActionListener {
 | 
				
			||||||
    //TODO Formatting
 | 
					    //TODO Formatting
 | 
				
			||||||
    private JFrame frame;
 | 
					    private JFrame frame;
 | 
				
			||||||
    private JPanel panel;
 | 
					    private JPanel panel;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private JTextField emailField;
 | 
					 | 
				
			||||||
    private JPasswordField passwordField;
 | 
					 | 
				
			||||||
    private JTextField gamePathField;
 | 
					    private JTextField gamePathField;
 | 
				
			||||||
    private JTextField versionField;
 | 
					    private JTextField versionField;
 | 
				
			||||||
    private JTextField loaderField;
 | 
					    private JTextField loaderField;
 | 
				
			||||||
@ -28,14 +26,6 @@ public class FirstLaunchGui implements Runnable, ActionListener {
 | 
				
			|||||||
    public void startGui() {
 | 
					    public void startGui() {
 | 
				
			||||||
        frame = new JFrame("Create First Profile");
 | 
					        frame = new JFrame("Create First Profile");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        JLabel emailLabel = new JLabel("Email:");
 | 
					 | 
				
			||||||
        emailLabel.setBounds(10, 50, 80, 25);
 | 
					 | 
				
			||||||
        emailField = new JTextField(20);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        JLabel passwordLabel = new JLabel("Password:");
 | 
					 | 
				
			||||||
        passwordLabel.setBounds(100, 50, 165, 25);
 | 
					 | 
				
			||||||
        passwordField = new JPasswordField(20);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        JLabel gamePathLabel = new JLabel("Game Path:");
 | 
					        JLabel gamePathLabel = new JLabel("Game Path:");
 | 
				
			||||||
        gamePathLabel.setBounds(10, 80, 80, 25);
 | 
					        gamePathLabel.setBounds(10, 80, 80, 25);
 | 
				
			||||||
        gamePathField = new JTextField(20);
 | 
					        gamePathField = new JTextField(20);
 | 
				
			||||||
@ -69,10 +59,6 @@ public class FirstLaunchGui implements Runnable, ActionListener {
 | 
				
			|||||||
        panel = new JPanel();
 | 
					        panel = new JPanel();
 | 
				
			||||||
        panel.setBorder(BorderFactory.createEmptyBorder(300, 300, 100, 300));
 | 
					        panel.setBorder(BorderFactory.createEmptyBorder(300, 300, 100, 300));
 | 
				
			||||||
        panel.setLayout(new GridLayout(0, 1));
 | 
					        panel.setLayout(new GridLayout(0, 1));
 | 
				
			||||||
        panel.add(emailLabel);
 | 
					 | 
				
			||||||
        panel.add(emailField);
 | 
					 | 
				
			||||||
        panel.add(passwordLabel);
 | 
					 | 
				
			||||||
        panel.add(passwordField);
 | 
					 | 
				
			||||||
        panel.add(gamePathLabel);
 | 
					        panel.add(gamePathLabel);
 | 
				
			||||||
        panel.add(gamePathField);
 | 
					        panel.add(gamePathField);
 | 
				
			||||||
        panel.add(gamePathButton);
 | 
					        panel.add(gamePathButton);
 | 
				
			||||||
@ -97,15 +83,8 @@ public class FirstLaunchGui implements Runnable, ActionListener {
 | 
				
			|||||||
    public void actionPerformed(ActionEvent ae) {
 | 
					    public void actionPerformed(ActionEvent ae) {
 | 
				
			||||||
        Profile profile = new Profile();
 | 
					        Profile profile = new Profile();
 | 
				
			||||||
        profile.setProfileName("default");
 | 
					        profile.setProfileName("default");
 | 
				
			||||||
        profile.setEmail(emailField.getText());
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (passwordField.getPassword().length > 0){
 | 
					        profile.setGamePath(new File(gamePathField.getText()));
 | 
				
			||||||
            profile.setHashedPassword(Encryptor.encrypt(String.valueOf(passwordField.getPassword())).getData());
 | 
					 | 
				
			||||||
            profile.setKey(Encryptor.encrypt(String.valueOf(passwordField.getPassword())).getKey());
 | 
					 | 
				
			||||||
            profile.setSalt(Encryptor.encrypt(String.valueOf(passwordField.getPassword())).getSalt());
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        profile.setGamePath(Path.of(gamePathField.getText()));
 | 
					 | 
				
			||||||
        profile.setVersion(versionField.getText());
 | 
					        profile.setVersion(versionField.getText());
 | 
				
			||||||
        profile.setLoader(loaderField.getText());
 | 
					        profile.setLoader(loaderField.getText());
 | 
				
			||||||
        profile.setOfflineMode(Boolean.parseBoolean(offlineModeField.getText()));
 | 
					        profile.setOfflineMode(Boolean.parseBoolean(offlineModeField.getText()));
 | 
				
			||||||
 | 
				
			|||||||
@ -1,24 +1,36 @@
 | 
				
			|||||||
package tech.nevets.jaml.gui;
 | 
					package tech.nevets.jaml.gui;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import tech.nevets.jaml.Config;
 | 
					import tech.nevets.jaml.util.Config;
 | 
				
			||||||
 | 
					import tech.nevets.jaml.JAML;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.swing.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class GuiHandler {
 | 
					public class GuiHandler {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public GuiHandler() {
 | 
					    public GuiHandler() {
 | 
				
			||||||
        if (Config.CONFIG.getBoolean("launcher.first-launch")) {
 | 
					        if (Config.getConfig().getBoolean("launcher.first-launch")) {
 | 
				
			||||||
            FirstLaunchGui firstLaunchGui = new FirstLaunchGui();
 | 
					            FirstLaunchGui firstLaunchGui = new FirstLaunchGui();
 | 
				
			||||||
            Thread firstLaunchThread = new Thread(firstLaunchGui);
 | 
					            Thread firstLaunchThread = new Thread(firstLaunchGui);
 | 
				
			||||||
            firstLaunchThread.start();
 | 
					            firstLaunchThread.start();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        HomeGui homeGui = new HomeGui();
 | 
					        Thread homeGuiThread = new Thread(() -> {
 | 
				
			||||||
        Thread homeGuiThread = new Thread(homeGui);
 | 
					            HomeGui frame = new HomeGui();
 | 
				
			||||||
 | 
					            frame.setTitle("JAML");
 | 
				
			||||||
 | 
					            frame.setIconImage(new ImageIcon(JAML.path + "\\assets\\icon.png").getImage());
 | 
				
			||||||
 | 
					            frame.setVisible(true);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
        homeGuiThread.start();
 | 
					        homeGuiThread.start();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void startNewProfileGui() {
 | 
					    public void startNewProfileGui() {
 | 
				
			||||||
        NewProfileGui newProfileGui = new NewProfileGui();
 | 
					        Thread newProfileGuiThread = new Thread(() -> {
 | 
				
			||||||
        Thread newProfileGuiThread = new Thread(newProfileGui);
 | 
					            NewProfileGui frame = new NewProfileGui();
 | 
				
			||||||
 | 
					            frame.setTitle("Create New Profile");
 | 
				
			||||||
 | 
					            frame.setIconImage(new ImageIcon(JAML.path + "\\assets\\icon.png").getImage());
 | 
				
			||||||
 | 
					            frame.setVisible(true);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
        newProfileGuiThread.start();
 | 
					        newProfileGuiThread.start();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,44 +1,75 @@
 | 
				
			|||||||
package tech.nevets.jaml.gui;
 | 
					package tech.nevets.jaml.gui;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import tech.nevets.jaml.JAML;
 | 
					import tech.nevets.jaml.JAML;
 | 
				
			||||||
 | 
					import tech.nevets.jaml.listeners.RightClickListener;
 | 
				
			||||||
 | 
					import tech.nevets.jaml.util.ImageUtils;
 | 
				
			||||||
 | 
					import tech.nevets.jaml.util.ProfileUtils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.swing.*;
 | 
					import javax.swing.*;
 | 
				
			||||||
import java.awt.*;
 | 
					import javax.swing.border.EmptyBorder;
 | 
				
			||||||
import java.awt.event.ActionEvent;
 | 
					 | 
				
			||||||
import java.awt.event.ActionListener;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class HomeGui implements Runnable, ActionListener {
 | 
					public class HomeGui extends JFrame {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private JFrame frame;
 | 
					    //private JPanel contentPane;
 | 
				
			||||||
    private JPanel panel;
 | 
					    private JTabbedPane tabPanel;
 | 
				
			||||||
 | 
					    private JPanel homePanel;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void startGui() {
 | 
					    //private JPanel contentPane;
 | 
				
			||||||
        frame = new JFrame();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        JButton button = new JButton("Create New Profile");
 | 
					    public HomeGui() {
 | 
				
			||||||
        button.addActionListener(this);
 | 
					        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 | 
				
			||||||
 | 
					        setBounds(100, 100, 1280, 720);
 | 
				
			||||||
 | 
					        SpringLayout springLayout = new SpringLayout();
 | 
				
			||||||
 | 
					        getContentPane().setLayout(springLayout);
 | 
				
			||||||
 | 
					        addMouseListener(new RightClickListener());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        panel = new JPanel();
 | 
					        tabPanel = new JTabbedPane();
 | 
				
			||||||
        panel.setBorder(BorderFactory.createEmptyBorder(300, 300, 100, 300));
 | 
					        springLayout.putConstraint(SpringLayout.NORTH, tabPanel, 0, SpringLayout.NORTH, getContentPane());
 | 
				
			||||||
        panel.setLayout(new GridLayout(0, 1));
 | 
					        springLayout.putConstraint(SpringLayout.WEST, tabPanel, 0, SpringLayout.WEST, getContentPane());
 | 
				
			||||||
 | 
					        springLayout.putConstraint(SpringLayout.SOUTH, tabPanel, 720, SpringLayout.NORTH, getContentPane());
 | 
				
			||||||
 | 
					        springLayout.putConstraint(SpringLayout.EAST, tabPanel, 1280, SpringLayout.WEST, getContentPane());
 | 
				
			||||||
 | 
					        tabPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
 | 
				
			||||||
 | 
					        //setContentPane(tabPanel);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        panel.add(button);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        frame.add(panel, BorderLayout.CENTER);
 | 
					        homePanel = new JPanel();
 | 
				
			||||||
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 | 
					        tabPanel.add("Home", homePanel);
 | 
				
			||||||
        frame.setTitle("JAML");
 | 
					        getContentPane().add(tabPanel);
 | 
				
			||||||
        frame.setIconImage(new ImageIcon(JAML.path + "\\assets\\icon.png").getImage());
 | 
					 | 
				
			||||||
        frame.pack();
 | 
					 | 
				
			||||||
        frame.setVisible(true);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					        JButton newProfileButton = new JButton("Create New Profile");
 | 
				
			||||||
    public void actionPerformed(ActionEvent e) {
 | 
					        newProfileButton.setBounds(920, 601, 134, 36);
 | 
				
			||||||
        JAML.guiHandler.startNewProfileGui();
 | 
					        newProfileButton.addActionListener(al -> {
 | 
				
			||||||
    }
 | 
					            JAML.guiHandler.startNewProfileGui();
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        homePanel.add(newProfileButton);
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        JButton launchButton = new JButton("Launch");
 | 
				
			||||||
 | 
					        launchButton.setBounds(512, 619, 196, 51);
 | 
				
			||||||
 | 
					        homePanel.add(launchButton);
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        JComboBox activeProfileDropdown = new JComboBox(ProfileUtils.profileList);
 | 
				
			||||||
 | 
					        activeProfileDropdown.setBounds(858, 648, 196, 22);
 | 
				
			||||||
 | 
					        homePanel.add(activeProfileDropdown);
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        JButton reloadProfileButton = new JButton("Reload Profiles");
 | 
				
			||||||
 | 
					        reloadProfileButton.setBounds(800, 608, 106, 23);
 | 
				
			||||||
 | 
					        reloadProfileButton.addActionListener(al -> {
 | 
				
			||||||
 | 
					            ProfileUtils.getProfileList();
 | 
				
			||||||
 | 
					            activeProfileDropdown.removeAllItems();
 | 
				
			||||||
 | 
					            for (int i = 0; i < ProfileUtils.profileList.length; i++) {
 | 
				
			||||||
 | 
					                activeProfileDropdown.addItem(ProfileUtils.profileList[i]);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        homePanel.add(reloadProfileButton);
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        JLabel backgroundIcon = new JLabel("");
 | 
				
			||||||
 | 
					        backgroundIcon.setBounds(0, 25, 1264, 542);
 | 
				
			||||||
 | 
					        ImageIcon backgroundImg = new ImageIcon(JAML.path + "\\assets\\background.png");
 | 
				
			||||||
 | 
					        backgroundImg = ImageUtils.resizeIcon(backgroundImg, backgroundIcon.getWidth(), backgroundIcon.getHeight());
 | 
				
			||||||
 | 
					        backgroundIcon.setIcon(backgroundImg);
 | 
				
			||||||
 | 
					        homePanel.add(backgroundIcon);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        tabPanel.addMouseListener(new RightClickListener());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public void run() {
 | 
					 | 
				
			||||||
        startGui();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,51 +1,43 @@
 | 
				
			|||||||
package tech.nevets.jaml.gui;
 | 
					package tech.nevets.jaml.gui;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import tech.nevets.jaml.JAML;
 | 
					import tech.nevets.jaml.objects.Profile;
 | 
				
			||||||
import tech.nevets.jaml.Profile;
 | 
					import tech.nevets.jaml.util.LoaderUtils;
 | 
				
			||||||
import tech.nevets.jaml.util.ProfileUtils;
 | 
					import tech.nevets.jaml.util.ProfileUtils;
 | 
				
			||||||
import tech.nevets.jaml.util.Encryptor;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.swing.*;
 | 
					import javax.swing.*;
 | 
				
			||||||
import java.awt.*;
 | 
					import javax.swing.border.EmptyBorder;
 | 
				
			||||||
import java.awt.event.ActionEvent;
 | 
					import java.io.File;
 | 
				
			||||||
import java.awt.event.ActionListener;
 | 
					 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
import java.nio.file.Path;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class NewProfileGui implements Runnable, ActionListener {
 | 
					public class NewProfileGui extends JFrame {
 | 
				
			||||||
    //TODO Formatting
 | 
					 | 
				
			||||||
    private JFrame frame;
 | 
					 | 
				
			||||||
    private JPanel panel;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private JTextField profileNameField;
 | 
					    private JPanel contentPane;
 | 
				
			||||||
    private JTextField emailField;
 | 
					 | 
				
			||||||
    private JPasswordField passwordField;
 | 
					 | 
				
			||||||
    private JTextField gamePathField;
 | 
					 | 
				
			||||||
    private JTextField versionField;
 | 
					 | 
				
			||||||
    private JTextField loaderField;
 | 
					 | 
				
			||||||
    private JTextField offlineModeField;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void startGui() {
 | 
					    public NewProfileGui() {
 | 
				
			||||||
        frame = new JFrame("New Profile");
 | 
					    	setResizable(false);
 | 
				
			||||||
 | 
					        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
 | 
				
			||||||
 | 
					        setBounds(100, 100, 360, 330);
 | 
				
			||||||
 | 
					        contentPane = new JPanel();
 | 
				
			||||||
 | 
					        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
 | 
				
			||||||
 | 
					        setContentPane(contentPane);
 | 
				
			||||||
 | 
					        contentPane.setLayout(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        JLabel profileNameLabel = new JLabel("Profile Name:");
 | 
					        JLabel profileNameLabel = new JLabel("Profile Name:");
 | 
				
			||||||
        profileNameLabel.setBounds(10, 20, 80, 25);
 | 
					        profileNameLabel.setBounds(10, 14, 84, 31);
 | 
				
			||||||
        profileNameField = new JTextField(20);
 | 
					        contentPane.add(profileNameLabel);
 | 
				
			||||||
 | 
					        JTextField profileNameField = new JTextField(20);
 | 
				
			||||||
        JLabel emailLabel = new JLabel("Email:");
 | 
					        profileNameField.setBounds(94, 18, 231, 23);
 | 
				
			||||||
        emailLabel.setBounds(10, 50, 80, 25);
 | 
					        contentPane.add(profileNameField);
 | 
				
			||||||
        emailField = new JTextField(20);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        JLabel passwordLabel = new JLabel("Password:");
 | 
					 | 
				
			||||||
        passwordLabel.setBounds(100, 50, 165, 25);
 | 
					 | 
				
			||||||
        passwordField = new JPasswordField(20);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        JLabel gamePathLabel = new JLabel("Game Path:");
 | 
					        JLabel gamePathLabel = new JLabel("Game Path:");
 | 
				
			||||||
        gamePathLabel.setBounds(10, 80, 80, 25);
 | 
					        gamePathLabel.setBounds(10, 56, 84, 31);
 | 
				
			||||||
        gamePathField = new JTextField(20);
 | 
					        contentPane.add(gamePathLabel);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        JButton gamePathButton = new JButton("Choose Path");
 | 
					        JButton gamePathButton = new JButton("...");
 | 
				
			||||||
        gamePathButton.setBounds(200, 80, 25, 25);
 | 
					        gamePathButton.setBounds(302, 60, 23, 23);
 | 
				
			||||||
 | 
					        JTextField gamePathField = new JTextField(20);
 | 
				
			||||||
 | 
					        gamePathField.setBounds(94, 60, 209, 23);
 | 
				
			||||||
        gamePathButton.addActionListener(ae -> {
 | 
					        gamePathButton.addActionListener(ae -> {
 | 
				
			||||||
            JFileChooser fileChooser = new JFileChooser(System.getenv("APPDATA") + "\\.minecraft\\");
 | 
					            JFileChooser fileChooser = new JFileChooser(System.getenv("APPDATA") + "\\.minecraft\\");
 | 
				
			||||||
            fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
 | 
					            fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
 | 
				
			||||||
@ -54,78 +46,53 @@ public class NewProfileGui implements Runnable, ActionListener {
 | 
				
			|||||||
            gamePathField.setText(fileChooser.getSelectedFile().toString());
 | 
					            gamePathField.setText(fileChooser.getSelectedFile().toString());
 | 
				
			||||||
            fileChooser.setVisible(false);
 | 
					            fileChooser.setVisible(false);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					        contentPane.add(gamePathField);
 | 
				
			||||||
 | 
					        contentPane.add(gamePathButton);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        JLabel versionLabel = new JLabel("Version:");
 | 
					        JLabel versionLabel = new JLabel("Version:");
 | 
				
			||||||
        versionLabel.setBounds(100, 80, 165, 25);
 | 
					        versionLabel.setBounds(10, 98, 84, 31);
 | 
				
			||||||
        versionField = new JTextField(20);
 | 
					        contentPane.add(versionLabel);
 | 
				
			||||||
 | 
					        JTextField versionField = new JTextField(20);
 | 
				
			||||||
 | 
					        versionField.setBounds(94, 102, 231, 23);
 | 
				
			||||||
 | 
					        contentPane.add(versionField);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        JLabel loaderLabel = new JLabel("Loader:");
 | 
					        JLabel loaderLabel = new JLabel("Loader:");
 | 
				
			||||||
        loaderLabel.setBounds(10, 110, 80, 25);
 | 
					        loaderLabel.setBounds(10, 140, 84, 31);
 | 
				
			||||||
        loaderField = new JTextField(20);
 | 
					        contentPane.add(loaderLabel);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        JComboBox loaderDropdown = new JComboBox(LoaderUtils.loaders);
 | 
				
			||||||
 | 
					        loaderDropdown.setBounds(94, 144, 231, 23);
 | 
				
			||||||
 | 
					        contentPane.add(loaderDropdown);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        JLabel offlineModeLabel = new JLabel("Offline Mode:");
 | 
					        JLabel offlineModeLabel = new JLabel("Offline Mode:");
 | 
				
			||||||
        offlineModeLabel.setBounds(100, 110, 165, 25);
 | 
					        offlineModeLabel.setBounds(10, 182, 84, 31);
 | 
				
			||||||
        offlineModeField = new JTextField(20);
 | 
					        contentPane.add(offlineModeLabel);
 | 
				
			||||||
 | 
					        JCheckBox offlineModeBox = new JCheckBox("");
 | 
				
			||||||
 | 
					        offlineModeBox.setBounds(94, 185, 21, 23);
 | 
				
			||||||
 | 
					        contentPane.add(offlineModeBox);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        JButton button = new JButton("Create Profile");
 | 
					        JButton button = new JButton("Create Profile");
 | 
				
			||||||
        button.addActionListener(this);
 | 
					        button.setBounds(64, 234, 217, 37);
 | 
				
			||||||
 | 
					        button.addActionListener(al -> {
 | 
				
			||||||
 | 
					            Profile profile = new Profile();
 | 
				
			||||||
 | 
					            profile.setProfileName(profileNameField.getText());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        panel = new JPanel();
 | 
					            profile.setGamePath(new File(gamePathField.getText()));
 | 
				
			||||||
        panel.setBorder(BorderFactory.createEmptyBorder(300, 300, 100, 300));
 | 
					            profile.setVersion(versionField.getText());
 | 
				
			||||||
        panel.setLayout(new GridLayout(0, 1));
 | 
					            profile.setLoader(loaderDropdown.getSelectedItem().toString());
 | 
				
			||||||
        panel.add(profileNameLabel);
 | 
					            profile.setOfflineMode(offlineModeBox.isSelected());
 | 
				
			||||||
        panel.add(profileNameField);
 | 
					            try {
 | 
				
			||||||
        panel.add(emailLabel);
 | 
					                ProfileUtils.createProfile(profile);
 | 
				
			||||||
        panel.add(emailField);
 | 
					            } catch (IOException e) {
 | 
				
			||||||
        panel.add(passwordLabel);
 | 
					                e.printStackTrace();
 | 
				
			||||||
        panel.add(passwordField);
 | 
					            }
 | 
				
			||||||
        panel.add(gamePathLabel);
 | 
					            ProfileUtils.getProfileList();
 | 
				
			||||||
        panel.add(gamePathField);
 | 
					 | 
				
			||||||
        panel.add(gamePathButton);
 | 
					 | 
				
			||||||
        panel.add(versionLabel);
 | 
					 | 
				
			||||||
        panel.add(versionField);
 | 
					 | 
				
			||||||
        panel.add(loaderLabel);
 | 
					 | 
				
			||||||
        panel.add(loaderField);
 | 
					 | 
				
			||||||
        panel.add(offlineModeLabel);
 | 
					 | 
				
			||||||
        panel.add(offlineModeField);
 | 
					 | 
				
			||||||
        panel.add(button);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        frame.add(panel, BorderLayout.CENTER);
 | 
					            this.dispose();
 | 
				
			||||||
        frame.setSize(500, 500);
 | 
					        });
 | 
				
			||||||
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
 | 
					 | 
				
			||||||
        frame.setTitle("JAML");
 | 
					 | 
				
			||||||
        frame.setIconImage(new ImageIcon(JAML.path + "\\assets\\icon.png").getImage());
 | 
					 | 
				
			||||||
        frame.pack();
 | 
					 | 
				
			||||||
        frame.setVisible(true);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					        contentPane.add(button);
 | 
				
			||||||
    public void actionPerformed(ActionEvent ae) {
 | 
					 | 
				
			||||||
        Profile profile = new Profile();
 | 
					 | 
				
			||||||
        profile.setProfileName(profileNameField.getText());
 | 
					 | 
				
			||||||
        profile.setEmail(emailField.getText());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (passwordField.getPassword().length > 0){
 | 
					 | 
				
			||||||
            profile.setHashedPassword(Encryptor.encrypt(String.valueOf(passwordField.getPassword())).getData());
 | 
					 | 
				
			||||||
            profile.setKey(Encryptor.encrypt(String.valueOf(passwordField.getPassword())).getKey());
 | 
					 | 
				
			||||||
            profile.setSalt(Encryptor.encrypt(String.valueOf(passwordField.getPassword())).getSalt());
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        profile.setGamePath(Path.of(gamePathField.getText()));
 | 
					 | 
				
			||||||
        profile.setVersion(versionField.getText());
 | 
					 | 
				
			||||||
        profile.setLoader(loaderField.getText());
 | 
					 | 
				
			||||||
        profile.setOfflineMode(Boolean.parseBoolean(offlineModeField.getText()));
 | 
					 | 
				
			||||||
        try {
 | 
					 | 
				
			||||||
            ProfileUtils.createProfile(profile);
 | 
					 | 
				
			||||||
        } catch (IOException e) {
 | 
					 | 
				
			||||||
            e.printStackTrace();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        frame.dispose();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public void run() {
 | 
					 | 
				
			||||||
        startGui();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										15
									
								
								src/main/java/tech/nevets/jaml/gui/RightClickGui.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								src/main/java/tech/nevets/jaml/gui/RightClickGui.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,15 @@
 | 
				
			|||||||
 | 
					package tech.nevets.jaml.gui;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.swing.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class RightClickGui extends JPopupMenu {
 | 
				
			||||||
 | 
					    JMenuItem test;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public RightClickGui() {
 | 
				
			||||||
 | 
					        test = new JMenuItem("This works");
 | 
				
			||||||
 | 
					        test.addActionListener(al -> {
 | 
				
			||||||
 | 
					            System.out.println("This worked!");
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        add(test);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,15 @@
 | 
				
			|||||||
 | 
					package tech.nevets.jaml.gui.panels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import tech.nevets.jaml.JAML;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.swing.*;
 | 
				
			||||||
 | 
					import java.awt.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class BackgroundPanel extends JPanel {
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    protected void paintComponent(Graphics g) {
 | 
				
			||||||
 | 
					        super.paintComponent(g);
 | 
				
			||||||
 | 
					        ImageIcon img = new ImageIcon(JAML.path + "\\assets\\background.png");
 | 
				
			||||||
 | 
					        g.drawImage(img.getImage(), 0, 0, this.getWidth(), this.getHeight(), null);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,26 @@
 | 
				
			|||||||
 | 
					package tech.nevets.jaml.listeners;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import tech.nevets.jaml.gui.RightClickGui;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.awt.*;
 | 
				
			||||||
 | 
					import java.awt.event.MouseAdapter;
 | 
				
			||||||
 | 
					import java.awt.event.MouseEvent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class RightClickListener extends MouseAdapter {
 | 
				
			||||||
 | 
					    public void mousePressed(MouseEvent e) {
 | 
				
			||||||
 | 
					        if (e.isPopupTrigger()) {
 | 
				
			||||||
 | 
					            doPop(e);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void mouseReleased(MouseEvent e) {
 | 
				
			||||||
 | 
					        if (e.isPopupTrigger()) {
 | 
				
			||||||
 | 
					            doPop(e);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private void doPop(MouseEvent e) {
 | 
				
			||||||
 | 
					        RightClickGui menu = new RightClickGui();
 | 
				
			||||||
 | 
					        menu.show(e.getComponent(), e.getX(), e.getY());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										13
									
								
								src/main/java/tech/nevets/jaml/objects/Loader.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								src/main/java/tech/nevets/jaml/objects/Loader.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					package tech.nevets.jaml.objects;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class Loader {
 | 
				
			||||||
 | 
					    private String id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setId(String id) {
 | 
				
			||||||
 | 
					        this.id = id;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getId() {
 | 
				
			||||||
 | 
					        return id;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										58
									
								
								src/main/java/tech/nevets/jaml/objects/Profile.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								src/main/java/tech/nevets/jaml/objects/Profile.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,58 @@
 | 
				
			|||||||
 | 
					package tech.nevets.jaml.objects;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.File;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class Profile {
 | 
				
			||||||
 | 
					    private String profileName;
 | 
				
			||||||
 | 
					    private String gamePath;
 | 
				
			||||||
 | 
					    private String version;
 | 
				
			||||||
 | 
					    private String loader;
 | 
				
			||||||
 | 
					    private Boolean offlineMode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Profile(){
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getProfileName() {
 | 
				
			||||||
 | 
					        return profileName;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setProfileName(String profileName) {
 | 
				
			||||||
 | 
					        this.profileName = profileName.toLowerCase();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public File getGamePath() {
 | 
				
			||||||
 | 
					        return new File(gamePath);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setGamePath(File gamePath) {
 | 
				
			||||||
 | 
					        this.gamePath = String.valueOf(gamePath);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getVersion() {
 | 
				
			||||||
 | 
					        return version;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setVersion(String version) {
 | 
				
			||||||
 | 
					        this.version = version;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getLoader() {
 | 
				
			||||||
 | 
					        return loader;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setLoader (String loader) {
 | 
				
			||||||
 | 
					        this.loader = loader;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Boolean getOfflineMode() {
 | 
				
			||||||
 | 
					        return offlineMode;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setOfflineMode(Boolean offlineMode) {
 | 
				
			||||||
 | 
					        this.offlineMode = offlineMode;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String toString() {
 | 
				
			||||||
 | 
					        return "{ profileName: " + profileName + ", gamePath: " + gamePath + ", version: " + version + ", loader: " + loader + ", offlineMode: " + offlineMode + " }";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										35
									
								
								src/main/java/tech/nevets/jaml/objects/User.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								src/main/java/tech/nevets/jaml/objects/User.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					package tech.nevets.jaml.objects;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.UUID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class User {
 | 
				
			||||||
 | 
					    private String username;
 | 
				
			||||||
 | 
					    private UUID uuid;
 | 
				
			||||||
 | 
					    private String accessToken;
 | 
				
			||||||
 | 
					    private String key;
 | 
				
			||||||
 | 
					    private String salt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getAccessToken() {
 | 
				
			||||||
 | 
					        return accessToken;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setAccessToken(String accessToken) {
 | 
				
			||||||
 | 
					        this.accessToken = accessToken;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getKey() {
 | 
				
			||||||
 | 
					        return key;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setKey(String key) {
 | 
				
			||||||
 | 
					        this.key = key;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getSalt() {
 | 
				
			||||||
 | 
					        return salt;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setSalt(String salt) {
 | 
				
			||||||
 | 
					        this.salt = salt;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package tech.nevets.jaml;
 | 
					package tech.nevets.jaml.objects;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.net.URL;
 | 
					import java.net.URL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										180
									
								
								src/main/java/tech/nevets/jaml/util/Config.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										180
									
								
								src/main/java/tech/nevets/jaml/util/Config.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,180 @@
 | 
				
			|||||||
 | 
					package tech.nevets.jaml.util;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.simpleyaml.configuration.file.YamlFile;
 | 
				
			||||||
 | 
					import tech.nevets.jaml.JAML;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class Config {
 | 
				
			||||||
 | 
					    private static final YamlFile YML_FILE = new YamlFile(JAML.path + "\\config.yml");
 | 
				
			||||||
 | 
					//    private static final YamlFile YML_FILE = new YamlFile("C:\\Users\\svtra\\AppData\\Roaming\\.jaml");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static void loadConfig() {
 | 
				
			||||||
 | 
					        YML_FILE.setConfigurationFile("C:\\Users\\svtra\\AppData\\Roaming\\.jaml\\config.yml");
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            if (!YML_FILE.exists()) {
 | 
				
			||||||
 | 
					                System.out.println("Config file not found, creating new one...");
 | 
				
			||||||
 | 
					                YML_FILE.createNewFile(true);
 | 
				
			||||||
 | 
					                System.out.println("Config file created!");
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                System.out.println("Loading Config file...");
 | 
				
			||||||
 | 
					                YML_FILE.loadWithComments();
 | 
				
			||||||
 | 
					                System.out.println("Config file loaded!");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        } catch (final Exception e) {
 | 
				
			||||||
 | 
					            System.out.println("Error while loading config file!");
 | 
				
			||||||
 | 
					            e.printStackTrace();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        YML_FILE.setComment("java",
 | 
				
			||||||
 | 
					                "\n"
 | 
				
			||||||
 | 
					                        + "            JJJJJJJJJJJ           AAA                MMMMMMMM               MMMMMMMM LLLLLLLLLLL             \n"
 | 
				
			||||||
 | 
					                        + "            J:::::::::J          A:::A               M:::::::M             M:::::::M L:::::::::L             \n"
 | 
				
			||||||
 | 
					                        + "            J:::::::::J         A:::::A              M::::::::M           M::::::::M L:::::::::L             \n"
 | 
				
			||||||
 | 
					                        + "            JJ:::::::JJ        A:::::::A             M:::::::::M         M:::::::::M LL:::::::LL             \n"
 | 
				
			||||||
 | 
					                        + "              J:::::J         A:::::::::A            M::::::::::M       M::::::::::M   L:::::L               \n"
 | 
				
			||||||
 | 
					                        + "              J:::::J        A:::::A:::::A           M:::::::::::M     M:::::::::::M   L:::::L               \n"
 | 
				
			||||||
 | 
					                        + "              J:::::J       A:::::A A:::::A          M:::::::M::::M   M::::M:::::::M   L:::::L               \n"
 | 
				
			||||||
 | 
					                        + "              J:::::j      A:::::A   A:::::A         M::::::M M::::M M::::M M::::::M   L:::::L               \n"
 | 
				
			||||||
 | 
					                        + "              J:::::J     A:::::A     A:::::A        M::::::M  M::::M::::M  M::::::M   L:::::L               \n"
 | 
				
			||||||
 | 
					                        + "  JJJJJJJ     J:::::J    A:::::AAAAAAAAA:::::A       M::::::M   M:::::::M   M::::::M   L:::::L               \n"
 | 
				
			||||||
 | 
					                        + "  J:::::J     J:::::J   A:::::::::::::::::::::A      M::::::M    M:::::M    M::::::M   L:::::L               \n"
 | 
				
			||||||
 | 
					                        + "  J::::::J   J::::::J  A:::::AAAAAAAAAAAAA:::::A     M::::::M     MMMMM     M::::::M   L:::::L         LLLLLL\n"
 | 
				
			||||||
 | 
					                        + "  J:::::::JJJ:::::::J A:::::A             A:::::A    M::::::M               M::::::M LL:::::::LLLLLLLLL:::::L\n"
 | 
				
			||||||
 | 
					                        + "   JJ:::::::::::::JJ A:::::A               A:::::A   M::::::M               M::::::M L::::::::::::::::::::::L\n"
 | 
				
			||||||
 | 
					                        + "     JJ:::::::::JJ  A:::::A                 A:::::A  M::::::M               M::::::M L::::::::::::::::::::::L\n"
 | 
				
			||||||
 | 
					                        + "       JJJJJJJJJ   AAAAAAA                   AAAAAAA MMMMMMMM               MMMMMMMM LLLLLLLLLLLLLLLLLLLLLLLL\n"
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        YML_FILE.addDefault("java.jdk8", "");
 | 
				
			||||||
 | 
					        YML_FILE.setComment("java.jdk8", "Set these to the bin directory of each JDK version");
 | 
				
			||||||
 | 
					        YML_FILE.addDefault("java.jdk16", "");
 | 
				
			||||||
 | 
					        YML_FILE.addDefault("java.jdk17", "");
 | 
				
			||||||
 | 
					        YML_FILE.addDefault("launcher.default-profile", "default");
 | 
				
			||||||
 | 
					        YML_FILE.setComment("launcher.default-profile", "Set's the profile that will be loaded automatically");
 | 
				
			||||||
 | 
					        YML_FILE.addDefault("launcher.path","default");
 | 
				
			||||||
 | 
					        YML_FILE.setComment("launcher.path","Path to JAML files\n" + "default: " + JAML.path.toString());
 | 
				
			||||||
 | 
					        YML_FILE.addDefault("launcher.first-launch", true);
 | 
				
			||||||
 | 
					        YML_FILE.setComment("launcher.first-launch", "Do Not Change, will regenerate files");
 | 
				
			||||||
 | 
					        YML_FILE.addDefault("launcher.verbose", false);
 | 
				
			||||||
 | 
					        YML_FILE.setComment("launcher.verbose", "If true, will print out all the messages");
 | 
				
			||||||
 | 
					        YML_FILE.addDefault("launcher.version", "0.1.0");
 | 
				
			||||||
 | 
					        YML_FILE.setComment("launcher.version", "Jaml version, don't change it!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            YML_FILE.save();
 | 
				
			||||||
 | 
					        } catch (IOException e) {
 | 
				
			||||||
 | 
					            e.printStackTrace();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static YamlFile getConfig() {
 | 
				
			||||||
 | 
					        return YML_FILE;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static void reloadConfig() {
 | 
				
			||||||
 | 
					        CONFIG = getConfig();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static YamlFile CONFIG = getConfig();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static void saveConfig() {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            YML_FILE.save();
 | 
				
			||||||
 | 
					        } catch (IOException e) {
 | 
				
			||||||
 | 
					            e.printStackTrace();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static void setValue(String path, Object data) {
 | 
				
			||||||
 | 
					        YML_FILE.set(path, data);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//package tech.nevets.jaml.util;
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//import org.simpleyaml.configuration.file.YamlFile;
 | 
				
			||||||
 | 
					//import tech.nevets.jaml.JAML;
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//import java.io.IOException;
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//public class Config {
 | 
				
			||||||
 | 
					//    private static final YamlFile YML_FILE = new YamlFile(JAML.path + "\\config.yml");
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//    public static void loadConfig() {
 | 
				
			||||||
 | 
					//        try {
 | 
				
			||||||
 | 
					//            if (!YML_FILE.exists()) {
 | 
				
			||||||
 | 
					//                System.out.println("Config file not found, creating new one...");
 | 
				
			||||||
 | 
					//                YML_FILE.createNewFile(true);
 | 
				
			||||||
 | 
					//                System.out.println("Config file created!");
 | 
				
			||||||
 | 
					//            } else {
 | 
				
			||||||
 | 
					//                System.out.println("Loading Config file...");
 | 
				
			||||||
 | 
					//                YML_FILE.loadWithComments();
 | 
				
			||||||
 | 
					//                System.out.println("Config file loaded!");
 | 
				
			||||||
 | 
					//            }
 | 
				
			||||||
 | 
					//        } catch (final Exception e) {
 | 
				
			||||||
 | 
					//            System.out.println("Error while loading config file!");
 | 
				
			||||||
 | 
					//            e.printStackTrace();
 | 
				
			||||||
 | 
					//        }
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//        YML_FILE.setComment("java",
 | 
				
			||||||
 | 
					//                "\n"
 | 
				
			||||||
 | 
					//                + "            JJJJJJJJJJJ           AAA                MMMMMMMM               MMMMMMMM LLLLLLLLLLL             \n"
 | 
				
			||||||
 | 
					//                + "            J:::::::::J          A:::A               M:::::::M             M:::::::M L:::::::::L             \n"
 | 
				
			||||||
 | 
					//                + "            J:::::::::J         A:::::A              M::::::::M           M::::::::M L:::::::::L             \n"
 | 
				
			||||||
 | 
					//                + "            JJ:::::::JJ        A:::::::A             M:::::::::M         M:::::::::M LL:::::::LL             \n"
 | 
				
			||||||
 | 
					//                + "              J:::::J         A:::::::::A            M::::::::::M       M::::::::::M   L:::::L               \n"
 | 
				
			||||||
 | 
					//                + "              J:::::J        A:::::A:::::A           M:::::::::::M     M:::::::::::M   L:::::L               \n"
 | 
				
			||||||
 | 
					//                + "              J:::::J       A:::::A A:::::A          M:::::::M::::M   M::::M:::::::M   L:::::L               \n"
 | 
				
			||||||
 | 
					//                + "              J:::::j      A:::::A   A:::::A         M::::::M M::::M M::::M M::::::M   L:::::L               \n"
 | 
				
			||||||
 | 
					//                + "              J:::::J     A:::::A     A:::::A        M::::::M  M::::M::::M  M::::::M   L:::::L               \n"
 | 
				
			||||||
 | 
					//                + "  JJJJJJJ     J:::::J    A:::::AAAAAAAAA:::::A       M::::::M   M:::::::M   M::::::M   L:::::L               \n"
 | 
				
			||||||
 | 
					//                + "  J:::::J     J:::::J   A:::::::::::::::::::::A      M::::::M    M:::::M    M::::::M   L:::::L               \n"
 | 
				
			||||||
 | 
					//                + "  J::::::J   J::::::J  A:::::AAAAAAAAAAAAA:::::A     M::::::M     MMMMM     M::::::M   L:::::L         LLLLLL\n"
 | 
				
			||||||
 | 
					//                + "  J:::::::JJJ:::::::J A:::::A             A:::::A    M::::::M               M::::::M LL:::::::LLLLLLLLL:::::L\n"
 | 
				
			||||||
 | 
					//                + "   JJ:::::::::::::JJ A:::::A               A:::::A   M::::::M               M::::::M L::::::::::::::::::::::L\n"
 | 
				
			||||||
 | 
					//                + "     JJ:::::::::JJ  A:::::A                 A:::::A  M::::::M               M::::::M L::::::::::::::::::::::L\n"
 | 
				
			||||||
 | 
					//                + "       JJJJJJJJJ   AAAAAAA                   AAAAAAA MMMMMMMM               MMMMMMMM LLLLLLLLLLLLLLLLLLLLLLLL\n"
 | 
				
			||||||
 | 
					//        );
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//        YML_FILE.addDefault("java.jdk8", "");
 | 
				
			||||||
 | 
					//        YML_FILE.setComment("java.jdk8", "Set these to the bin directory of each JDK version");
 | 
				
			||||||
 | 
					//        YML_FILE.addDefault("java.jdk16", "");
 | 
				
			||||||
 | 
					//        YML_FILE.addDefault("java.jdk17", "");
 | 
				
			||||||
 | 
					//        YML_FILE.addDefault("game.skin", "");
 | 
				
			||||||
 | 
					//        YML_FILE.setComment("game.skin", "Current skin being used, DO NOT change this");
 | 
				
			||||||
 | 
					//        YML_FILE.addDefault("launcher.default-profile", "default");
 | 
				
			||||||
 | 
					//        YML_FILE.setComment("launcher.default-profile", "Set's the profile that will be loaded automatically");
 | 
				
			||||||
 | 
					//        YML_FILE.addDefault("launcher.path","default");
 | 
				
			||||||
 | 
					//        YML_FILE.setComment("launcher.path","Path to JAML files\n" + "default: " + JAML.path.toString());
 | 
				
			||||||
 | 
					//        YML_FILE.addDefault("launcher.first-launch", true);
 | 
				
			||||||
 | 
					//        YML_FILE.setComment("launcher.first-launch", "Do Not Change, will regenerate files");
 | 
				
			||||||
 | 
					//        YML_FILE.addDefault("launcher.verbose", false);
 | 
				
			||||||
 | 
					//        YML_FILE.setComment("launcher.verbose", "If true, will print out all the messages");
 | 
				
			||||||
 | 
					//        YML_FILE.addDefault("launcher.version", "0.1.0");
 | 
				
			||||||
 | 
					//        YML_FILE.setComment("launcher.version", "Jaml version, don't change it!");
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//        try {
 | 
				
			||||||
 | 
					//            YML_FILE.save();
 | 
				
			||||||
 | 
					//        } catch (IOException e) {
 | 
				
			||||||
 | 
					//            e.printStackTrace();
 | 
				
			||||||
 | 
					//        }
 | 
				
			||||||
 | 
					//    }
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//    public static YamlFile getConfig() {
 | 
				
			||||||
 | 
					//        return YML_FILE;
 | 
				
			||||||
 | 
					//    }
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//    public static void saveConfig() {
 | 
				
			||||||
 | 
					//        try {
 | 
				
			||||||
 | 
					//            YML_FILE.save();
 | 
				
			||||||
 | 
					//        } catch (IOException e) {
 | 
				
			||||||
 | 
					//            e.printStackTrace();
 | 
				
			||||||
 | 
					//        }
 | 
				
			||||||
 | 
					//    }
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//    public static void setValue(String path, Object data) {
 | 
				
			||||||
 | 
					//        YML_FILE.set(path, data);
 | 
				
			||||||
 | 
					//    }
 | 
				
			||||||
 | 
					//}
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package tech.nevets.jaml;
 | 
					package tech.nevets.jaml.util;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import net.arikia.dev.drpc.DiscordEventHandlers;
 | 
					import net.arikia.dev.drpc.DiscordEventHandlers;
 | 
				
			||||||
import net.arikia.dev.drpc.DiscordRPC;
 | 
					import net.arikia.dev.drpc.DiscordRPC;
 | 
				
			||||||
							
								
								
									
										34
									
								
								src/main/java/tech/nevets/jaml/util/FirstLaunch.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								src/main/java/tech/nevets/jaml/util/FirstLaunch.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,34 @@
 | 
				
			|||||||
 | 
					package tech.nevets.jaml.util;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.apache.commons.io.FileUtils;
 | 
				
			||||||
 | 
					import tech.nevets.jaml.JAML;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.File;
 | 
				
			||||||
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					import java.net.URISyntaxException;
 | 
				
			||||||
 | 
					import java.net.URL;
 | 
				
			||||||
 | 
					import java.nio.file.Path;
 | 
				
			||||||
 | 
					import java.nio.file.Paths;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class FirstLaunch {
 | 
				
			||||||
 | 
					    public FirstLaunch() {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            copyAssets();
 | 
				
			||||||
 | 
					        } catch (IOException | URISyntaxException e) {
 | 
				
			||||||
 | 
					            e.printStackTrace();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        System.out.println("First Launch!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Config.setValue("launcher.first-launch", false);
 | 
				
			||||||
 | 
					        Config.saveConfig();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static void copyAssets() throws IOException, URISyntaxException {
 | 
				
			||||||
 | 
					        URL resource = JAML.class.getResource("/assets/");
 | 
				
			||||||
 | 
					        File assets = Paths.get(resource.toURI()).toFile();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (!Path.of(JAML.path + "\\assets\\").toFile().exists()) {
 | 
				
			||||||
 | 
					            FileUtils.copyDirectory(assets, new File(JAML.path + "\\assets\\"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										14
									
								
								src/main/java/tech/nevets/jaml/util/ImageUtils.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/main/java/tech/nevets/jaml/util/ImageUtils.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					package tech.nevets.jaml.util;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.swing.*;
 | 
				
			||||||
 | 
					import java.awt.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class ImageUtils {
 | 
				
			||||||
 | 
					    public static ImageIcon resizeIcon(ImageIcon icon, int width, int height) {
 | 
				
			||||||
 | 
					        Image image = icon.getImage();
 | 
				
			||||||
 | 
					        Image newImg = image.getScaledInstance(width, height,  java.awt.Image.SCALE_SMOOTH);
 | 
				
			||||||
 | 
					        return new ImageIcon(newImg);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package tech.nevets.jaml;
 | 
					package tech.nevets.jaml.util;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.BufferedReader;
 | 
					import java.io.BufferedReader;
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
@ -7,7 +7,8 @@ import java.util.ArrayList;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public class Launch {
 | 
					public class Launch {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public Launch(ArrayList<String> commandArray, boolean printConsole) throws IOException {
 | 
					    public Launch(int jdkVersion, int memoryAmount, String garbageCollection, boolean printConsole) throws IOException {
 | 
				
			||||||
 | 
					        ArrayList<String> commandArray = parseCommand(jdkVersion, memoryAmount, garbageCollection);
 | 
				
			||||||
        StringBuilder sb = new StringBuilder();
 | 
					        StringBuilder sb = new StringBuilder();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (String commandString : commandArray) {
 | 
					        for (String commandString : commandArray) {
 | 
				
			||||||
@ -19,23 +20,26 @@ public class Launch {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        System.out.println(command);
 | 
					        System.out.println(command);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Process process = Runtime.getRuntime().exec(command);
 | 
					        ProcessBuilder process = new ProcessBuilder();
 | 
				
			||||||
 | 
					        process.directory(ProfileUtils.activeProfile.getGamePath());
 | 
				
			||||||
 | 
					        process.command(command);
 | 
				
			||||||
 | 
					        Process processVar = process.start();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (printConsole) {
 | 
					        if (printConsole) {
 | 
				
			||||||
            printResults(process);
 | 
					            printResults(processVar);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        process.destroy();
 | 
					        processVar.destroy();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static ArrayList<String> parseCommand(int jdkVersion, int memoryAmount, String garbageCollection) {
 | 
					    public static ArrayList<String> parseCommand(int jdkVersion, int memoryAmount, String garbageCollection) {
 | 
				
			||||||
        ArrayList<String> cmd = new ArrayList<String>();
 | 
					        ArrayList<String> cmd = new ArrayList<String>();
 | 
				
			||||||
        if (jdkVersion == 8) {
 | 
					        if (jdkVersion == 8) {
 | 
				
			||||||
            cmd.add(("\"" + Config.CONFIG.getString("java.jdk8") + "\\javaw.exe\""));
 | 
					            cmd.add(("\"" + Config.getConfig().getString("java.jdk8") + "\\javaw.exe\""));
 | 
				
			||||||
        } else if (jdkVersion == 16) {
 | 
					        } else if (jdkVersion == 16) {
 | 
				
			||||||
            cmd.add(("\"" + Config.CONFIG.getString("java.jdk16") + "\\javaw.exe\""));
 | 
					            cmd.add(("\"" + Config.getConfig().getString("java.jdk16") + "\\javaw.exe\""));
 | 
				
			||||||
        } else if (jdkVersion == 17) {
 | 
					        } else if (jdkVersion == 17) {
 | 
				
			||||||
            cmd.add(("\"" + Config.CONFIG.getString("java.jdk17") + "\\java.exe\""));
 | 
					            cmd.add(("\"" + Config.getConfig().getString("java.jdk17") + "\\java.exe\""));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        cmd.add(("-Xmx" + memoryAmount + "M"));
 | 
					        cmd.add(("-Xmx" + memoryAmount + "M"));
 | 
				
			||||||
							
								
								
									
										38
									
								
								src/main/java/tech/nevets/jaml/util/LoaderUtils.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								src/main/java/tech/nevets/jaml/util/LoaderUtils.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,38 @@
 | 
				
			|||||||
 | 
					package tech.nevets.jaml.util;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.google.gson.Gson;
 | 
				
			||||||
 | 
					import com.google.gson.JsonArray;
 | 
				
			||||||
 | 
					import com.google.gson.JsonObject;
 | 
				
			||||||
 | 
					import org.apache.commons.io.FileUtils;
 | 
				
			||||||
 | 
					import tech.nevets.jaml.JAML;
 | 
				
			||||||
 | 
					import tech.nevets.jaml.objects.Loader;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.File;
 | 
				
			||||||
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					import java.nio.charset.StandardCharsets;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class LoaderUtils {
 | 
				
			||||||
 | 
					    public static String[] loaders;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static String[] getLoaders() {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            Gson gson = new Gson();
 | 
				
			||||||
 | 
					            File loadersFile = new File(JAML.path + "\\data\\loaders.json");
 | 
				
			||||||
 | 
					            JsonObject loadersJson = gson.fromJson(FileUtils.readFileToString(loadersFile, StandardCharsets.UTF_8), JsonObject.class);
 | 
				
			||||||
 | 
					            JsonArray loadersJsonArray = loadersJson.getAsJsonArray("loaders");
 | 
				
			||||||
 | 
					            Loader[] loadersArray = gson.fromJson(loadersJsonArray, Loader[].class);
 | 
				
			||||||
 | 
					            String[] loadersArrayList = new String[loadersArray.length];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            for (int i = 0; i < loadersArrayList.length; i++) {
 | 
				
			||||||
 | 
					                loadersArrayList[i] = loadersArray[i].getId();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            loaders = loadersArrayList;
 | 
				
			||||||
 | 
					            return loadersArrayList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        } catch (IOException e) {
 | 
				
			||||||
 | 
					            e.printStackTrace();
 | 
				
			||||||
 | 
					            return new String[]{"Vanilla", "Fabric", "Forge"}; // Fallback variable
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,14 +1,17 @@
 | 
				
			|||||||
package tech.nevets.jaml.util;
 | 
					package tech.nevets.jaml.util;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.google.gson.*;
 | 
					import com.google.gson.*;
 | 
				
			||||||
 | 
					import org.apache.commons.io.FilenameUtils;
 | 
				
			||||||
import tech.nevets.jaml.JAML;
 | 
					import tech.nevets.jaml.JAML;
 | 
				
			||||||
import tech.nevets.jaml.Profile;
 | 
					import tech.nevets.jaml.objects.Profile;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.*;
 | 
					import java.io.*;
 | 
				
			||||||
import java.nio.file.Path;
 | 
					import java.nio.file.Path;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class ProfileUtils {
 | 
					public class ProfileUtils {
 | 
				
			||||||
    private static final Path PROFILE_PATH = Path.of(JAML.path + "\\profiles\\");
 | 
					    private static final Path PROFILE_PATH = Path.of(JAML.path + "\\profiles\\");
 | 
				
			||||||
 | 
					    public static Profile activeProfile;
 | 
				
			||||||
 | 
					    public static String[] profileList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static void createProfile(Profile profile) throws IOException {
 | 
					    public static void createProfile(Profile profile) throws IOException {
 | 
				
			||||||
        String profileName = profile.getProfileName();
 | 
					        String profileName = profile.getProfileName();
 | 
				
			||||||
@ -29,4 +32,24 @@ public class ProfileUtils {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        return new Gson().fromJson(reader, Profile.class);
 | 
					        return new Gson().fromJson(reader, Profile.class);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static String[] getProfileList() {
 | 
				
			||||||
 | 
					        File profileDir = new File(JAML.path + "\\profiles\\");
 | 
				
			||||||
 | 
					        String[] profileFiles = profileDir.list();
 | 
				
			||||||
 | 
					        String[] profileNames = new String[profileFiles.length];
 | 
				
			||||||
 | 
					        for (int i = 0; i < profileFiles.length; i++) {
 | 
				
			||||||
 | 
					            profileNames[i] = FilenameUtils.removeExtension(profileFiles[i]);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        profileList = profileNames;
 | 
				
			||||||
 | 
					        return profileNames;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static Profile getActiveProfile() {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            activeProfile = ProfileUtils.loadProfile(Config.getConfig().getString("launcher.default-profile"));
 | 
				
			||||||
 | 
					        } catch (IOException e) {
 | 
				
			||||||
 | 
					            System.out.println("Unable to load default profile: " + e.getMessage());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return activeProfile;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										18
									
								
								src/main/java/tech/nevets/jaml/util/SkinUtils.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/main/java/tech/nevets/jaml/util/SkinUtils.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					package tech.nevets.jaml.util;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.File;
 | 
				
			||||||
 | 
					import java.net.MalformedURLException;
 | 
				
			||||||
 | 
					import java.net.URL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class SkinUtils {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static File getSkinImage() {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            URL imageUrl = new URL("https://minotar.net/armor/body/");
 | 
				
			||||||
 | 
					        } catch (MalformedURLException e) {
 | 
				
			||||||
 | 
					            e.printStackTrace();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return null;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -5,11 +5,12 @@ import com.google.gson.JsonArray;
 | 
				
			|||||||
import com.google.gson.JsonObject;
 | 
					import com.google.gson.JsonObject;
 | 
				
			||||||
import org.apache.commons.io.FileUtils;
 | 
					import org.apache.commons.io.FileUtils;
 | 
				
			||||||
import tech.nevets.jaml.JAML;
 | 
					import tech.nevets.jaml.JAML;
 | 
				
			||||||
import tech.nevets.jaml.Version;
 | 
					import tech.nevets.jaml.objects.Version;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.File;
 | 
					import java.io.File;
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
import java.net.URL;
 | 
					import java.net.URL;
 | 
				
			||||||
 | 
					import java.nio.charset.StandardCharsets;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class VersionFetcher {
 | 
					public class VersionFetcher {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -20,8 +21,6 @@ public class VersionFetcher {
 | 
				
			|||||||
        Version[] versionArray = gson.fromJson(versionsJsonArray, Version[].class);
 | 
					        Version[] versionArray = gson.fromJson(versionsJsonArray, Version[].class);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (Version value : versionArray) {
 | 
					        for (Version value : versionArray) {
 | 
				
			||||||
            System.out.println(value.getId());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (value.getId().equalsIgnoreCase(version)) {
 | 
					            if (value.getId().equalsIgnoreCase(version)) {
 | 
				
			||||||
                return value;
 | 
					                return value;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@ -66,7 +65,7 @@ public class VersionFetcher {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            File versionManifestFile = new File(JAML.path + "\\data\\version.json");
 | 
					            File versionManifestFile = new File(JAML.path + "\\data\\version.json");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return new Gson().fromJson(FileUtils.readFileToString(versionManifestFile), JsonObject.class);
 | 
					            return new Gson().fromJson(FileUtils.readFileToString(versionManifestFile, StandardCharsets.UTF_8), JsonObject.class);
 | 
				
			||||||
        } catch (IOException e) {
 | 
					        } catch (IOException e) {
 | 
				
			||||||
            e.printStackTrace();
 | 
					            e.printStackTrace();
 | 
				
			||||||
            return null;
 | 
					            return null;
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								src/main/resources/assets/background.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								src/main/resources/assets/background.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 538 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								src/main/resources/assets/icon.ico
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								src/main/resources/assets/icon.ico
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 210 KiB  | 
		Loading…
	
		Reference in New Issue
	
	Block a user