mirror of
https://github.com/craftycodie/OnlineModeFix.git
synced 2025-08-03 08:55:56 -04:00
Appveyor'd
This commit is contained in:
parent
76452bfc83
commit
9722b99b7a
@ -1,7 +1,7 @@
|
|||||||
<component name="libraryTable">
|
<component name="libraryTable">
|
||||||
<library name="json">
|
<library name="CanaryMod">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$PROJECT_DIR$/lib/json.jar!/" />
|
<root url="jar://$PROJECT_DIR$/lib/CanaryMod.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES />
|
<SOURCES />
|
@ -1,10 +0,0 @@
|
|||||||
<component name="libraryTable">
|
|
||||||
<library name="JDA-4.2.0_168-withDependencies-min">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$PROJECT_DIR$/lib/JDA-4.2.0_168-withDependencies-min.jar!/" />
|
|
||||||
<root url="jar://$PROJECT_DIR$/lib/discord-webhooks-0.5.0.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
</component>
|
|
9
.idea/libraries/Minecraft_Mod.xml
generated
9
.idea/libraries/Minecraft_Mod.xml
generated
@ -1,9 +0,0 @@
|
|||||||
<component name="libraryTable">
|
|
||||||
<library name="Minecraft_Mod">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$PROJECT_DIR$/lib/Minecraft_Mod.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
</component>
|
|
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="azul-1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -8,9 +8,7 @@
|
|||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" name="json" level="project" />
|
|
||||||
<orderEntry type="library" name="craftbukkit" level="project" />
|
<orderEntry type="library" name="craftbukkit" level="project" />
|
||||||
<orderEntry type="library" exported="" name="JDA-4.2.0_168-withDependencies-min" level="project" />
|
<orderEntry type="library" name="CanaryMod" level="project" />
|
||||||
<orderEntry type="library" name="Minecraft_Mod" level="project" />
|
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
Binary file not shown.
Binary file not shown.
BIN
lib/json.jar
BIN
lib/json.jar
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
name: OnlineModeFix
|
name: OnlineModeFix
|
||||||
version: 1.1.3
|
version: 1.1.4
|
||||||
description: Fixes online-mode authentication.
|
description: Fixes online-mode authentication.
|
||||||
author: craftycodie
|
author: craftycodie
|
||||||
authors: [Codie]
|
authors: [Codie]
|
||||||
|
@ -2,14 +2,30 @@ package gg.codie.mineonline.protocol;
|
|||||||
|
|
||||||
import gg.codie.mineonline.protocol.http.Handler;
|
import gg.codie.mineonline.protocol.http.Handler;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
import java.net.URLStreamHandler;
|
import java.net.URLStreamHandler;
|
||||||
import java.net.URLStreamHandlerFactory;
|
import java.net.URLStreamHandlerFactory;
|
||||||
|
|
||||||
public class MineOnlineURLStreamHandlerFactory implements URLStreamHandlerFactory {
|
public class MineOnlineURLStreamHandlerFactory implements URLStreamHandlerFactory {
|
||||||
|
private final Class<? extends URLConnection> defaultHttpConnectionClass;
|
||||||
|
|
||||||
|
public MineOnlineURLStreamHandlerFactory() {
|
||||||
|
try {
|
||||||
|
URL foo = new URL("http://example.com");
|
||||||
|
// Doesn't actually establish a connection
|
||||||
|
defaultHttpConnectionClass = foo.openConnection().getClass();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// this should never happen as the URL is hardcoded, shouldn't be invalid.
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URLStreamHandler createURLStreamHandler(String protocol) {
|
public URLStreamHandler createURLStreamHandler(String protocol) {
|
||||||
if ("http".equals(protocol)) {
|
if ("http".equals(protocol)) {
|
||||||
return new Handler();
|
return new Handler(defaultHttpConnectionClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -4,17 +4,41 @@ import gg.codie.mineonline.protocol.CheckServerURLConnection;
|
|||||||
import sun.net.www.protocol.http.HttpURLConnection;
|
import sun.net.www.protocol.http.HttpURLConnection;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.Proxy;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
import java.net.URLStreamHandler;
|
import java.net.URLStreamHandler;
|
||||||
|
|
||||||
public class Handler extends URLStreamHandler {
|
public class Handler extends URLStreamHandler {
|
||||||
|
private final Class<? extends URLConnection> defaultHttpConnectionClass;
|
||||||
|
|
||||||
|
public Handler() {
|
||||||
|
// Necessary for vanilla servers which don't use the factory.
|
||||||
|
defaultHttpConnectionClass = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Handler(Class<? extends URLConnection> _defaultHttpConnectionClass) {
|
||||||
|
defaultHttpConnectionClass = _defaultHttpConnectionClass;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
protected URLConnection openConnection(URL url) throws IOException {
|
protected URLConnection openConnection(URL url) throws IOException {
|
||||||
// Online-Mode fix
|
// Online-Mode fix
|
||||||
if (url.toString().contains("/game/checkserver.jsp"))
|
if (url.toString().contains("/game/checkserver.jsp"))
|
||||||
return new CheckServerURLConnection(url);
|
return new CheckServerURLConnection(url);
|
||||||
else
|
else if (defaultHttpConnectionClass != null) {
|
||||||
return new HttpURLConnection(url, null);
|
try {
|
||||||
|
return defaultHttpConnectionClass.getConstructor(URL.class, Proxy.class).newInstance(url, null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// If the constructor isn't found, you can log that out. It's not expected.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
Class sunHttpConnection = ClassLoader.getSystemClassLoader().loadClass("sun.net.www.protocol.http.HttpURLConnection");
|
||||||
|
return (URLConnection) sunHttpConnection.getConstructor(URL.class, Proxy.class).newInstance(url, null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user