Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Decompiled by Procyon v0.5.30
- //
- package net.minecraft;
- import java.awt.BorderLayout;
- import java.awt.Color;
- import java.awt.Dimension;
- import java.awt.Frame;
- import java.awt.event.WindowAdapter;
- import java.awt.event.WindowEvent;
- import java.io.File;
- import java.io.IOException;
- import java.lang.reflect.Constructor;
- import java.net.Authenticator;
- import java.net.InetSocketAddress;
- import java.net.PasswordAuthentication;
- import java.net.Proxy;
- import java.net.URL;
- import java.net.URLClassLoader;
- import java.util.HashMap;
- import java.util.Map;
- import javax.imageio.ImageIO;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import javax.swing.UIManager;
- import joptsimple.OptionException;
- import joptsimple.OptionParser;
- import joptsimple.OptionSet;
- import joptsimple.OptionSpec;
- public class LauncherFrame extends Frame
- {
- public static final int VERSION = 13;
- private static final long serialVersionUID = 1L;
- public Map<String, String> customParameters;
- public Launcher launcher;
- public LoginForm loginForm;
- public LauncherFrame() {
- super("Minecraft Launcher (fixed by ya boi skoolshooter) OS: " + System.getProperty("os.name"));
- this.customParameters = new HashMap<String, String>();
- this.setBackground(Color.BLACK);
- this.loginForm = new LoginForm(this);
- final JPanel panel = new JPanel();
- panel.setLayout(new BorderLayout());
- panel.add(this.loginForm, "Center");
- panel.setPreferredSize(new Dimension(854, 480));
- this.setLayout(new BorderLayout());
- this.add(panel, "Center");
- this.pack();
- this.setLocationRelativeTo(null);
- try {
- this.setIconImage(ImageIO.read(LauncherFrame.class.getResource("favicon.png")));
- }
- catch (IOException ex) {
- ex.printStackTrace();
- }
- this.addWindowListener(new WindowAdapter() {
- public void windowClosing(final WindowEvent windowEvent) {
- new Thread() {
- public void run() {
- try {
- Thread.sleep(30000L);
- }
- catch (InterruptedException ex) {
- ex.printStackTrace();
- }
- System.out.println("FORCING EXIT!");
- System.exit(0);
- }
- }.start();
- if (LauncherFrame.this.launcher != null) {
- LauncherFrame.this.launcher.stop();
- LauncherFrame.this.launcher.destroy();
- }
- System.exit(0);
- }
- });
- }
- public void playCached(String s, final boolean b) {
- try {
- if (s == null || s.length() <= 0) {
- s = "Player";
- }
- this.launcher = new Launcher();
- this.launcher.customParameters.putAll(this.customParameters);
- this.launcher.customParameters.put("userName", s);
- this.launcher.customParameters.put("demo", "" + b);
- this.launcher.customParameters.put("sessionId", "1");
- this.launcher.init();
- this.removeAll();
- this.add(this.launcher, "Center");
- this.validate();
- this.launcher.start();
- this.loginForm = null;
- this.setTitle("Minecraft");
- }
- catch (Exception ex) {
- ex.printStackTrace();
- this.showError(ex.toString());
- }
- }
- public void login(final String s, final String s2) {
- try {
- /* final HashMap<String, Integer> hashMap = new HashMap<String, Integer>();
- hashMap.put("user", s);
- hashMap.put("password", (Integer)s2);
- hashMap.put("version", 13);
- final String executePost = Util.executePost("https://login.minecraft.net/", (Map<String, Object>)hashMap);
- if (executePost == null) {
- this.showError("Can't connect to minecraft.net");
- this.loginForm.setNoNetwork(false);
- return;
- }
- if (!executePost.contains(":")) {
- boolean noNetwork = false;
- if (executePost.trim().equals("Bad login")) {
- this.showError("Login failed");
- }
- else if (executePost.trim().equals("Old version")) {
- this.loginForm.setOutdated();
- this.showError("Outdated launcher");
- }
- else if (executePost.trim().equals("User not premium")) {
- this.showError(executePost);
- noNetwork = true;
- }
- else {
- this.showError(executePost);
- }
- this.loginForm.setNoNetwork(noNetwork);
- return;
- }
- final String[] split = executePost.split(":");
- this.launcher = new Launcher();
- this.launcher.customParameters.putAll(this.customParameters);
- this.launcher.customParameters.put("userName", split[2].trim());
- this.launcher.customParameters.put("latestVersion", split[0].trim());
- this.launcher.customParameters.put("downloadTicket", split[1].trim());
- this.launcher.customParameters.put("sessionId", split[3].trim());
- this.launcher.init();
- this.removeAll();
- this.add(this.launcher, "Center");
- this.validate();
- this.launcher.start();
- this.loginForm.loginOk();
- this.loginForm = null;
- this.setTitle("Minecraft");
- }
- catch (Exception ex) {
- ex.printStackTrace();
- this.showError(ex.toString());
- this.loginForm.setNoNetwork(false);
- }*/
- System.setProperty("java.net.preferIPv4Stack", "true");
- final OptionParser optionParser = new OptionParser();
- optionParser.allowsUnrecognizedOptions();
- optionParser.accepts("help", "Show help").forHelp();
- final OptionSpec<String> proxyHostOption = optionParser.accepts("proxyHost", "Optional").withRequiredArg();
- final OptionSpec<Integer> proxyPortOption = optionParser.accepts("proxyPort", "Optional").withRequiredArg().defaultsTo("8080", new String[0]).ofType(Integer.class);
- final OptionSpec<String> proxyUserOption = optionParser.accepts("proxyUser", "Optional").withRequiredArg();
- final OptionSpec<String> proxyPassOption = optionParser.accepts("proxyPass", "Optional").withRequiredArg();
- final OptionSpec<File> workingDirectoryOption = optionParser.accepts("workDir", "Optional").withRequiredArg().ofType(File.class).defaultsTo(Util.getWorkingDirectory(), new File[0]);
- final OptionSpec<String> nonOptions = optionParser.nonOptions();
- OptionSet optionSet;
- try {
- optionSet = optionParser.parse("--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userProperties ${user_properties} --userType ${user_type}");
- }
- catch(final OptionException e) {
- optionParser.printHelpOn(System.out);
- System.out.println("(to pass in arguments to minecraft directly use: '--' followed by your arguments");
- return;
- }
- if(optionSet.has("help")) {
- optionParser.printHelpOn(System.out);
- return;
- }
- final String hostName = optionSet.valueOf(proxyHostOption);
- Proxy proxy = Proxy.NO_PROXY;
- if(hostName != null)
- try {
- proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(hostName, optionSet.valueOf(proxyPortOption).intValue()));
- }
- catch(final Exception ignored) {
- }
- final String proxyUser = optionSet.valueOf(proxyUserOption);
- final String proxyPass = optionSet.valueOf(proxyPassOption);
- PasswordAuthentication passwordAuthentication = null;
- // if(!proxy.equals(Proxy.NO_PROXY) && stringHasValue(proxyUser) && stringHasValue(proxyPass)) {
- passwordAuthentication = new PasswordAuthentication(proxyUser, proxyPass.toCharArray());
- final PasswordAuthentication auth = passwordAuthentication;
- Authenticator.setDefault(new Authenticator() {
- @Override
- protected PasswordAuthentication getPasswordAuthentication() {
- launcher = new Launcher();
- launcher.customParameters.putAll(customParameters);
- launcher.customParameters.put("userName", auth.getUserName());
- launcher.customParameters.put("latestVersion", "true");
- System.out.println(auth.getPassword());
- launcher.init();
- removeAll();
- add(launcher, "Center");
- validate();
- launcher.start();
- loginForm.loginOk();
- loginForm = null;
- setTitle("Minecraft");
- return auth;
- }
- //});
- });}catch(Exception e) {
- e.printStackTrace();
- }
- }
- public static boolean stringHasValue(String string)
- {
- return (string != null) && (!string.isEmpty());
- }
- private void showError(final String error) {
- this.removeAll();
- this.add(this.loginForm);
- this.loginForm.setError(error);
- this.validate();
- }
- public boolean canPlayOffline(final String s) {
- final Launcher launcher = new Launcher();
- launcher.customParameters.putAll(this.customParameters);
- launcher.init(s, null, null, "1");
- return launcher.canPlayOffline();
- }
- public static void main(final String[] array) {
- try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- }
- catch (Exception ex) {}
- System.out.println("asdf");
- System.setProperty("java.net.preferIPv4Stack", "true");
- System.setProperty("java.net.preferIPv6Addresses", "false");
- final LauncherFrame launcherFrame = new LauncherFrame();
- launcherFrame.setVisible(true);
- launcherFrame.customParameters.put("stand-alone", "true");
- for (final String s : array) {
- if (s.startsWith("-u=") || s.startsWith("--user=")) {
- final String argValue = getArgValue(s);
- launcherFrame.customParameters.put("username", argValue);
- launcherFrame.loginForm.userName.setText(argValue);
- }
- else if (s.startsWith("-p=") || s.startsWith("--password=")) {
- final String argValue2 = getArgValue(s);
- launcherFrame.customParameters.put("password", argValue2);
- launcherFrame.loginForm.password.setText(argValue2);
- }
- else if (s.startsWith("--noupdate")) {
- launcherFrame.customParameters.put("noupdate", "true");
- }
- }
- if (array.length >= 3) {
- String s2 = array[2];
- String s3 = "25565";
- if (s2.contains(":")) {
- final String[] split = s2.split(":");
- s2 = split[0];
- s3 = split[1];
- }
- launcherFrame.customParameters.put("server", s2);
- launcherFrame.customParameters.put("port", s3);
- }
- }
- private static String getArgValue(final String s) {
- final int index = s.indexOf(61);
- if (index < 0) {
- return "";
- }
- return s.substring(index + 1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement