aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung
diff options
context:
space:
mode:
authorsyeyoung <42869671+cyoung06@users.noreply.github.com>2020-12-09 21:25:28 +0900
committersyeyoung <42869671+cyoung06@users.noreply.github.com>2020-12-09 21:25:28 +0900
commitcbd22473c62d076b25543611894da001685f5e21 (patch)
tree699825ef52d752aa7e0cb973f211b94dbd050969 /src/main/java/kr/syeyoung
parent2976b083cbe99626fd815f73c0b904d0f9339b15 (diff)
downloadSkyblock-Dungeons-Guide-cbd22473c62d076b25543611894da001685f5e21.tar.gz
Skyblock-Dungeons-Guide-cbd22473c62d076b25543611894da001685f5e21.tar.bz2
Skyblock-Dungeons-Guide-cbd22473c62d076b25543611894da001685f5e21.zip
exception for development
Diffstat (limited to 'src/main/java/kr/syeyoung')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/Authenticator.java3
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuideMain.java101
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/customurl/DGURLConnection.java10
3 files changed, 65 insertions, 49 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/Authenticator.java b/src/main/java/kr/syeyoung/dungeonsguide/Authenticator.java
index 80f5a94d..493e9542 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/Authenticator.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/Authenticator.java
@@ -146,7 +146,8 @@ public class Authenticator {
baos.write(buffer, 0, size);
}
- dynamicResources.put(zipEntry.getName(), buffer);
+ System.out.println(zipEntry.getName());
+ dynamicResources.put(zipEntry.getName(), baos.toByteArray());
}
huc.disconnect();
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuideMain.java b/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuideMain.java
index 2e21e33e..00d49a96 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuideMain.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuideMain.java
@@ -41,59 +41,70 @@ public class DungeonsGuideMain
dungeonsGuideInterface.init(event);
}
+// @EventHandler
+// public void pre(FMLPreInitializationEvent event) {
+// Authenticator authenticator = new Authenticator();
+// String token = null;
+// try {
+// token = authenticator.authenticate();
+// if (token != null) {
+// dungeonsGuideMain = this;
+// URL.setURLStreamHandlerFactory(new DGURLStreamHandlerFactory(authenticator));
+// LaunchClassLoader launchClassLoader = (LaunchClassLoader) DungeonsGuideMain.class.getClassLoader();
+// launchClassLoader.addURL(new URL("dungeonsguide:///"));
+//
+// try {
+// dungeonsGuideInterface = new DungeonsGuide(authenticator);
+// dungeonsGuideInterface.pre(event);
+// } catch (Exception e) {
+// e.printStackTrace();
+//
+// error(new String[]{
+// "Couldn't load Dungeons Guide",
+// "Please contact developer if this problem persists after restart"
+// });
+// }
+// return;
+// }
+// } catch (IOException e) {
+// e.printStackTrace();
+// } catch (AuthenticationException e) {
+// e.printStackTrace();
+// } catch (NoSuchAlgorithmException e) {
+// e.printStackTrace();
+// } catch (NoSuchPaddingException e) {
+// e.printStackTrace();
+// } catch (InvalidKeyException e) {
+// e.printStackTrace();
+// } catch (InvalidAlgorithmParameterException e) {
+// e.printStackTrace();
+// } catch (IllegalBlockSizeException e) {
+// e.printStackTrace();
+// } catch (BadPaddingException e) {
+// e.printStackTrace();
+// }
+//
+// error(new String[]{
+// "Can't validate current installation of Dungeons Guide",
+// "Steps to fix",
+// "1. check if other people can't join minecraft servers. If they can't it's impossible to validate",
+// "2. restart minecraft launcher",
+// "3. make sure you're on the right account",
+// "4. restart your computer",
+// "If the problem persists after following these steps, please contact developer",
+// "If you haven't purchased the mod, please consider doing so"
+// });
+// }
@EventHandler
public void pre(FMLPreInitializationEvent event) {
- Authenticator authenticator = new Authenticator();
- String token = null;
- try {
- token = authenticator.authenticate();
- if (token != null) {
dungeonsGuideMain = this;
- URL.setURLStreamHandlerFactory(new DGURLStreamHandlerFactory(authenticator));
- LaunchClassLoader launchClassLoader = (LaunchClassLoader) DungeonsGuideMain.class.getClassLoader();
- launchClassLoader.addURL(new URL("dungeonsguide:///"));
-
+ URL.setURLStreamHandlerFactory(new DGURLStreamHandlerFactory(null));
try {
- dungeonsGuideInterface = new DungeonsGuide(authenticator);
+ dungeonsGuideInterface = new DungeonsGuide(null);
dungeonsGuideInterface.pre(event);
} catch (Exception e) {
e.printStackTrace();
-
- error(new String[]{
- "Couldn't load Dungeons Guide",
- "Please contact developer if this problem persists after restart"
- });
}
- return;
- }
- } catch (IOException e) {
- e.printStackTrace();
- } catch (AuthenticationException e) {
- e.printStackTrace();
- } catch (NoSuchAlgorithmException e) {
- e.printStackTrace();
- } catch (NoSuchPaddingException e) {
- e.printStackTrace();
- } catch (InvalidKeyException e) {
- e.printStackTrace();
- } catch (InvalidAlgorithmParameterException e) {
- e.printStackTrace();
- } catch (IllegalBlockSizeException e) {
- e.printStackTrace();
- } catch (BadPaddingException e) {
- e.printStackTrace();
- }
-
- error(new String[]{
- "Can't validate current installation of Dungeons Guide",
- "Steps to fix",
- "1. check if other people can't join minecraft servers. If they can't it's impossible to validate",
- "2. restart minecraft launcher",
- "3. make sure you're on the right account",
- "4. restart your computer",
- "If the problem persists after following these steps, please contact developer",
- "If you haven't purchased the mod, please consider doing so"
- });
}
public void error(final String[] s_msg) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/customurl/DGURLConnection.java b/src/main/java/kr/syeyoung/dungeonsguide/customurl/DGURLConnection.java
index 5f68ad97..06aec0d8 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/customurl/DGURLConnection.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/customurl/DGURLConnection.java
@@ -31,8 +31,12 @@ public class DGURLConnection extends URLConnection {
}
@Override
public InputStream getInputStream() throws IOException {
- String path = url.getPath().substring(1);
- if (!authenticator.getDynamicResources().containsKey(path)) throw new FileNotFoundException();
- return new ByteArrayInputStream(authenticator.getDynamicResources().get(path));
+ if (authenticator != null) {
+ String path = url.getPath().substring(1);
+ if (!authenticator.getDynamicResources().containsKey(path)) throw new FileNotFoundException();
+ return new ByteArrayInputStream(authenticator.getDynamicResources().get(path));
+ } else {
+ return DGURLConnection.class.getResourceAsStream(url.getPath());
+ }
}
}