diff --git a/.gitignore b/.gitignore index 39c197e..b1ba644 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,9 @@ build/ in/ out/ .idea +.gradle +*.iml +.project +.settings +.classpath -*.iml \ No newline at end of file diff --git a/build.gradle b/build.gradle index 7e887a2..1a07f4e 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,7 @@ jar { dependencies { compile group: 'com.google.code.gson', name: 'gson', version: '2.2.4' compile group: 'com.mojang', name: 'authlib', version: '1.5.16' - compile group: 'io.netty', name: 'netty-all', version: '4.0.10.Final' + compile group: 'io.netty', name: 'netty-all', version: '4.1.13.Final' compile group: 'org.ow2.asm', name: 'asm-debug-all', version: '5.0.2' compile group: 'com.google.guava', name: 'guava', version: '17.0' testCompile group: 'junit', name: 'junit', version: '4.11' diff --git a/src/main/java/uk/co/thinkofdeath/vanillacord/Main.java b/src/main/java/uk/co/thinkofdeath/vanillacord/Main.java index 25dcf9a..647d300 100644 --- a/src/main/java/uk/co/thinkofdeath/vanillacord/Main.java +++ b/src/main/java/uk/co/thinkofdeath/vanillacord/Main.java @@ -21,26 +21,15 @@ public class Main { public static void main(String[] args) throws IOException { if (args.length != 1) { - System.out.println("Args: "); + System.out.println("Args: "); return; } - String version = args[0]; - - String url = String.format("http://s3.amazonaws.com/Minecraft.Download/versions/%1$s/minecraft_server.%1$s.jar", version); - - File in = new File("in/" + version + ".jar"); - in.getParentFile().mkdirs(); - if (!in.exists()) { - System.out.println("Downloading"); - try (FileOutputStream fin = new FileOutputStream(in)) { - Resources.copy(new URL(url), fin); - } - } + String filename = args[0]; + File in = new File(filename); addURL(in.toURI().toURL()); - File out = new File("out/" + version + "-bungee.jar"); - out.getParentFile().mkdirs(); + File out = new File(in.getName().replace(".jar","")+"-bungee.jar"); if (out.exists()) out.delete(); try (ZipInputStream zip = new ZipInputStream(new FileInputStream(in)); diff --git a/src/main/java/uk/co/thinkofdeath/vanillacord/TypeChecker.java b/src/main/java/uk/co/thinkofdeath/vanillacord/TypeChecker.java index 40df396..bfe124c 100644 --- a/src/main/java/uk/co/thinkofdeath/vanillacord/TypeChecker.java +++ b/src/main/java/uk/co/thinkofdeath/vanillacord/TypeChecker.java @@ -21,7 +21,7 @@ public MethodVisitor visitMethod(int access, final String name, final String des @Override public void visitLdcInsn(Object cst) { - if (cst instanceof String && ((String) cst).startsWith("Outdated client! Please use")) { + if (cst instanceof String && ((String) cst).startsWith("multiplayer.disconnect.outdated_server")) { handshakeListener = true; hsName = name; hsDesc = desc; diff --git a/src/main/java/uk/co/thinkofdeath/vanillacord/util/BungeeHelper.java b/src/main/java/uk/co/thinkofdeath/vanillacord/util/BungeeHelper.java index 57e01e8..77b8cf1 100644 --- a/src/main/java/uk/co/thinkofdeath/vanillacord/util/BungeeHelper.java +++ b/src/main/java/uk/co/thinkofdeath/vanillacord/util/BungeeHelper.java @@ -14,8 +14,8 @@ public class BungeeHelper { private static final Gson gson = new Gson(); - public static AttributeKey UUID_KEY = new AttributeKey<>("spoofed-uuid"); - public static AttributeKey PROPERTIES_KEY = new AttributeKey<>("spoofed-props"); + public static AttributeKey UUID_KEY = AttributeKey.valueOf("spoofed-uuid"); + public static AttributeKey PROPERTIES_KEY = AttributeKey.valueOf("spoofed-props"); public static void parseHandshake(Object networkManager, Object handshake) { try {