diff --git a/.classpath b/.classpath
index 07ca123..789484a 100644
--- a/.classpath
+++ b/.classpath
@@ -1,6 +1,6 @@
-
+
diff --git a/.gitignore b/.gitignore
index 772c861..93b5637 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
*.jar
*.class
bin/
-.settings/
\ No newline at end of file
+debug.txt
\ No newline at end of file
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index 54e493c..060c5ee 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -1,11 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/Build.jardesc b/Build.jardesc
new file mode 100644
index 0000000..5a721d5
--- /dev/null
+++ b/Build.jardesc
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build_client.bat b/build_client.bat
deleted file mode 100644
index 4b2d882..0000000
--- a/build_client.bat
+++ /dev/null
@@ -1,5 +0,0 @@
-del Util.class
-del Mineshafter-proxy.jar
-javac Util.java
-jar cfe Mineshafter-proxy.jar mineshafter.MineClient Util.class -C bin/ mineshafter/
-pause
\ No newline at end of file
diff --git a/build_server.bat b/build_server.bat
deleted file mode 100644
index eb3a7e1..0000000
--- a/build_server.bat
+++ /dev/null
@@ -1,3 +0,0 @@
-del Mineshafter-server.jar
-jar cfe Mineshafter-server.jar mineshafter.MineServer -C bin/ mineshafter/
-pause
\ No newline at end of file
diff --git a/debug.bat b/debug.bat
deleted file mode 100644
index c60fde4..0000000
--- a/debug.bat
+++ /dev/null
@@ -1,2 +0,0 @@
-java -jar Mineshafter-proxy.jar
-pause
\ No newline at end of file
diff --git a/src/mineshafter/MineClient.java b/src/mineshafter/MineClient.java
index f63ffda..cb2c57e 100644
--- a/src/mineshafter/MineClient.java
+++ b/src/mineshafter/MineClient.java
@@ -27,7 +27,7 @@
public class MineClient extends Applet {
private static final long serialVersionUID = 1L;
- protected static float VERSION = 3.6f;
+ protected static float VERSION = 3.7f;
protected static String launcherDownloadURL = "https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft.jar"; // "http://www.minecraft.net/download/minecraft.jar";
protected static String normalLauncherFilename = "minecraft.jar";
@@ -70,10 +70,11 @@ public static void main(String[] args) {
proxy.start();
int proxyPort = proxy.getPort();
+ System.setErr(System.out);
+
System.setProperty("http.proxyHost", "127.0.0.1");
System.setProperty("http.proxyPort", Integer.toString(proxyPort));
- //System.setProperty("https.proxyHost", "127.0.0.1");
- //System.setProperty("https.proxyPort", Integer.toString(proxyPort));
+ System.setProperty("java.net.preferIPv4Stack", "true");
// Make sure we have a fresh launcher every time
File hackedFile = new File(hackedLauncherFilename);
@@ -136,10 +137,15 @@ public static void editLauncher() {
InputStream dataSource;
while((entry = in.getNextEntry()) != null) {
n = entry.getName();
- if(n.contains(".svn") || n.equals("META-INF/MOJANG_C.SF") || n.equals("META-INF/MOJANG_C.DSA") || n.equals("net/minecraft/minecraft.key") || n.equals("net/minecraft/Util$OS.class")) continue;
+ if(n.contains(".svn")
+ || n.equals("META-INF/MOJANG_C.SF")
+ || n.equals("META-INF/MOJANG_C.DSA")
+ || n.equals("net/minecraft/minecraft.key")
+ || n.equals("net/minecraft/Util$OS.class")) continue;
+
out.putNextEntry(entry);
if(n.equals("META-INF/MANIFEST.MF")) dataSource = new ByteArrayInputStream(MANIFEST_TEXT.getBytes());
- else if(n.equals("net/minecraft/Util.class")) dataSource = Resources.load("Util.class");
+ else if(n.equals("net/minecraft/Util.class")) dataSource = Resources.load("net/minecraft/Util.class");
else dataSource = in;
Streams.pipeStreams(dataSource, out);
out.flush();
diff --git a/src/mineshafter/proxy/MineProxyHandler.java b/src/mineshafter/proxy/MineProxyHandler.java
index ad5ab66..2cc3ddf 100644
--- a/src/mineshafter/proxy/MineProxyHandler.java
+++ b/src/mineshafter/proxy/MineProxyHandler.java
@@ -278,12 +278,14 @@ public void run() {
public static byte[] getRequest(String url) {
try {
- HttpURLConnection c = (HttpURLConnection) new URL(url).openConnection(Proxy.NO_PROXY);
- c.setInstanceFollowRedirects(false);
- int code = c.getResponseCode();
+ HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection(Proxy.NO_PROXY);
+ conn.setInstanceFollowRedirects(false);
+ Map> requestHeaders = conn.getRequestProperties();
+ int code = conn.getResponseCode();
+
if(code == 301 || code == 302 || code == 303) {
System.out.println("Java didn't redirect automatically, going manual: " + Integer.toString(code));
- String l = c.getHeaderField("location").trim();
+ String l = conn.getHeaderField("location").trim();
System.out.println("Manual redirection to: " + l);
return getRequest(l);
}
@@ -291,33 +293,33 @@ public static byte[] getRequest(String url) {
System.out.println("Response: " + code);
if(code == 403) {
String s = "403 from req to " + url + "\nRequest headers:\n";
- java.util.Map> h = c.getRequestProperties();
- for (String k : h.keySet()) {
+
+ for (String k : requestHeaders.keySet()) {
if(k == null) continue;
- java.util.List vals = h.get(k);
+ java.util.List vals = requestHeaders.get(k);
for(String v : vals) {
s += k + ": " + v + "\n";
}
}
s += "Response headers:\n";
- h = c.getHeaderFields();
- for (String k : h.keySet()) {
+ Map> responseHeaders = conn.getHeaderFields();
+ for (String k : responseHeaders.keySet()) {
if(k == null) continue;
- java.util.List vals = h.get(k);
+ java.util.List vals = responseHeaders.get(k);
for(String v : vals) {
s += k + ": " + v + "\n";
}
}
System.out.println(s);
- System.out.println("Contents:\n" + new String(grabData(c.getErrorStream())));
+ System.out.println("Contents:\n" + new String(grabData(conn.getErrorStream())));
}
if(code / 100 == 4) {
return new byte[0];
}
- BufferedInputStream in = new BufferedInputStream(c.getInputStream());
+ BufferedInputStream in = new BufferedInputStream(conn.getInputStream());
return grabData(in);
} catch (MalformedURLException e) {
diff --git a/src/mineshafter/util/Resources.java b/src/mineshafter/util/Resources.java
index 7264ba0..c0a9dd7 100644
--- a/src/mineshafter/util/Resources.java
+++ b/src/mineshafter/util/Resources.java
@@ -8,14 +8,13 @@
public class Resources
{
- public static InputStream load(String filename) throws FileNotFoundException
- {
- InputStream in=Thread.currentThread().getContextClassLoader().getResourceAsStream(filename);
- if(in==null) in=new FileInputStream(filename);
+ public static InputStream load(String filename) throws FileNotFoundException {
+ InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(filename);
+ if(in == null) in = new FileInputStream(filename);
return in;
}
- public static String loadString(String filename)
- {
+
+ public static String loadString(String filename) {
try{
char[] b=new char[4096];
int read=0;
diff --git a/Util.java b/src/net/minecraft/Util.java
similarity index 93%
rename from Util.java
rename to src/net/minecraft/Util.java
index 9752a93..d54518d 100644
--- a/Util.java
+++ b/src/net/minecraft/Util.java
@@ -1,7 +1,6 @@
package net.minecraft;
import java.io.BufferedOutputStream;
-import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.InputStream;
@@ -12,9 +11,6 @@
import java.net.URLEncoder;
import java.net.HttpURLConnection;
import java.util.Map;
-import javax.net.ssl.HttpsURLConnection;
-
-import org.omg.CORBA_2_3.portable.OutputStream;
public class Util {
private static File workDir=null;
@@ -60,7 +56,7 @@ private static int getPlatform() {
public static String buildQuery(Map paramMap) {
StringBuilder localStringBuilder = new StringBuilder();
- for(Map.Entry localEntry : paramMap.entrySet()) {
+ for(Map.Entry localEntry : paramMap.entrySet()) {
if(localStringBuilder.length() > 0) {
localStringBuilder.append('&');
}