aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/Authenticator.java163
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/EventListener.java20
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/a.java (renamed from src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuideMain.java)61
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/b.java161
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/c.java (renamed from src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuideInterface.java)2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/commands/CommandSaveData.java4
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/customurl/DGURLConnection.java42
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/customurl/DGURLStreamHandler.java18
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/customurl/DGURLStreamHandlerFactory.java20
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/d/a.java30
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/d/b.java17
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/d/c.java18
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java34
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java6
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/e.java (renamed from src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java)14
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java5
17 files changed, 298 insertions, 319 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/Authenticator.java b/src/main/java/kr/syeyoung/dungeonsguide/Authenticator.java
deleted file mode 100644
index 493e9542..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/Authenticator.java
+++ /dev/null
@@ -1,163 +0,0 @@
-package kr.syeyoung.dungeonsguide;
-
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import com.mojang.authlib.GameProfile;
-import com.mojang.authlib.exceptions.AuthenticationException;
-import com.mojang.authlib.minecraft.MinecraftSessionService;
-import lombok.Getter;
-import net.minecraft.client.Minecraft;
-import net.minecraft.util.Session;
-import org.apache.commons.io.IOUtils;
-
-import javax.crypto.*;
-import javax.crypto.spec.IvParameterSpec;
-import javax.crypto.spec.SecretKeySpec;
-import javax.xml.bind.DatatypeConverter;
-import java.io.*;
-import java.math.BigInteger;
-import java.net.*;
-import java.security.*;
-import java.util.HashMap;
-import java.util.UUID;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-public class Authenticator {
- @Getter
- private KeyPair keyPair;
- @Getter
- private String token;
- private KeyPair generate1024RSAKey() {
- KeyPairGenerator generator = null;
- try {
- generator = KeyPairGenerator.getInstance("RSA");
- } catch (NoSuchAlgorithmException e) {
- e.printStackTrace();
- }
- generator.initialize(1024);
- keyPair = generator.generateKeyPair();
- return keyPair;
- }
-
- public Authenticator() {
- generate1024RSAKey();
- }
-
- private static final String DOMAIN = "http://localhost:8080/";
-
- public String authenticate() throws IOException, AuthenticationException, NoSuchAlgorithmException, IllegalBlockSizeException, InvalidKeyException, BadPaddingException, InvalidAlgorithmParameterException, NoSuchPaddingException {
- Session session = Minecraft.getMinecraft().getSession();
- String token = session.getToken();
-
- String jwt = requestAuth(session.getProfile());
- MinecraftSessionService yggdrasilMinecraftSessionService = Minecraft.getMinecraft().getSessionService();
- JsonObject jwt2 = parseJWT(jwt);
- String hash = calculateAuthHash(DatatypeConverter.parseBase64Binary(jwt2.get("sharedSecret").getAsString()),
- DatatypeConverter.parseBase64Binary(jwt2.get("publicKey").getAsString()));
- yggdrasilMinecraftSessionService.joinServer(session.getProfile(), token, hash);
- this.token = requestAuth2(jwt, keyPair.getPublic());
- load(this.token);
- return this.token;
- }
-
- public JsonObject parseJWT(String jwt) {
- String payload = jwt.split("\\.")[1].replace("+", "-").replace("/", "_");
- String json = new String(DatatypeConverter.parseBase64Binary(payload));
- return (JsonObject) new JsonParser().parse(json);
- }
-
- private String requestAuth(GameProfile profile) throws IOException {
- HttpURLConnection huc = (HttpURLConnection) new URL(DOMAIN+"auth/requestAuth").openConnection();
- huc.setRequestProperty("User-Agent", "DungeonsGuide/1.0");
- huc.setRequestProperty("Content-Type", "application/json");
- huc.setRequestMethod("POST");
- huc.setDoInput(true);
- huc.setDoOutput(true);
-
- huc.getOutputStream().write(("{\"uuid\":\""+profile.getId().toString()+"\",\"nickname\":\""+profile.getName()+"\"}").getBytes());
- InputStreamReader inputStreamReader = new InputStreamReader(huc.getInputStream());
- JsonObject object = (JsonObject) new JsonParser().parse(inputStreamReader);
- if (!"ok".equals(object.get("status").getAsString())) {
- return null;
- }
- return object.get("data").getAsString();
- }
- private String requestAuth2(String token, PublicKey publicKey) throws IOException {
- HttpURLConnection huc = (HttpURLConnection) new URL(DOMAIN+"auth/authenticate").openConnection();
- huc.setRequestMethod("POST");
- huc.setRequestProperty("User-Agent", "DungeonsGuide/1.0");
- huc.setRequestProperty("Content-Type", "application/json");
- huc.setDoInput(true);
- huc.setDoOutput(true);
-
- huc.getOutputStream().write(("{\"jwt\":\""+token+"\",\"publicKey\":\""+DatatypeConverter.printBase64Binary(publicKey.getEncoded())+"\"}").getBytes());
- InputStreamReader inputStreamReader = new InputStreamReader(huc.getInputStream());
- JsonObject object = (JsonObject) new JsonParser().parse(inputStreamReader);
- if (!"ok".equals(object.get("status").getAsString())) {
- return null;
- }
- return object.get("data").getAsString();
- }
-
- @Getter
- private HashMap<String, byte[]> dynamicResources = new HashMap<String, byte[]>();
-
- private void load(String token) throws IOException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException {
- HttpURLConnection huc = (HttpURLConnection) new URL(DOMAIN + "resource/jar").openConnection();
- huc.setRequestProperty("User-Agent", "DungeonsGuide/1.0");
- huc.setRequestProperty("Content-Type", "application/json");
- huc.setRequestMethod("GET");
- huc.setRequestProperty("Authorization", token);
- huc.setDoInput(true);
- huc.setDoOutput(true);
- System.out.println("Resp Code::" + huc.getResponseCode());
-
- InputStream inputStream = huc.getInputStream();
- byte[] bytes = new byte[4];
- inputStream.read(bytes);
- int len = ((bytes[0] & 0xFF) << 24) |
- ((bytes[1] & 0xFF) << 16) |
- ((bytes[2] & 0xFF) << 8) |
- ((bytes[3] & 0xFF));
- while (inputStream.available() < len) ;
- byte[] pubKey = new byte[len];
- inputStream.read(pubKey);
-
- Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
- byte[] byteEncrypted = pubKey;
- cipher.init(Cipher.DECRYPT_MODE, getKeyPair().getPrivate());
- byte[] bytePlain = cipher.doFinal(byteEncrypted);
-
- cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
- SecretKeySpec keySpec = new SecretKeySpec(bytePlain, "AES");
- IvParameterSpec ivSpec = new IvParameterSpec(bytePlain);
- cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
- CipherInputStream cipherInputStream = new CipherInputStream(inputStream, cipher);
-
- cipherInputStream.read(bytes);
- ZipInputStream inputStream1 = new ZipInputStream(cipherInputStream);
- ZipEntry zipEntry;
- while ((zipEntry=inputStream1.getNextEntry()) != null) {
- byte[] buffer = new byte[256];
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- int size = 0;
- while((size = inputStream1.read(buffer)) > 0) {
- baos.write(buffer, 0, size);
- }
-
- System.out.println(zipEntry.getName());
- dynamicResources.put(zipEntry.getName(), baos.toByteArray());
- }
- huc.disconnect();
- }
-
- public String calculateAuthHash(byte[] sharedSecret, byte[] pk) throws NoSuchAlgorithmException {
- MessageDigest md = MessageDigest.getInstance("SHA-1");
- md.update("".getBytes());
- md.update(sharedSecret);
- md.update(pk);
- byte[] result = md.digest();
- return new BigInteger(result).toString(16);
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java b/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java
index a3c2be2c..0d4fa68d 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java
@@ -34,7 +34,7 @@ public class EventListener {
public void onTick(TickEvent.ClientTickEvent e) {
try {
if (e.phase == TickEvent.Phase.START) {
- SkyblockStatus skyblockStatus = (SkyblockStatus) DungeonsGuide.getDungeonsGuide().getSkyblockStatus();
+ SkyblockStatus skyblockStatus = (SkyblockStatus) kr.syeyoung.dungeonsguide.e.getDungeonsGuide().getSkyblockStatus();
{
boolean isOnDungeon = skyblockStatus.isOnDungeon();
skyblockStatus.updateStatus();
@@ -72,9 +72,9 @@ public class EventListener {
public void onRender(RenderGameOverlayEvent.Post postRender) {
try {
if (postRender.type != RenderGameOverlayEvent.ElementType.TEXT) return;
- SkyblockStatus skyblockStatus = (SkyblockStatus) DungeonsGuide.getDungeonsGuide().getSkyblockStatus();
+ SkyblockStatus skyblockStatus = (SkyblockStatus) e.getDungeonsGuide().getSkyblockStatus();
if (!skyblockStatus.isOnDungeon()) return;
- if (DungeonsGuide.DEBUG) {
+ if (e.DEBUG) {
int[] textureData = dynamicTexture.getTextureData();
MapUtils.getImage().getRGB(0, 0, 128, 128, textureData, 0, 128);
dynamicTexture.updateDynamicTexture();
@@ -91,10 +91,10 @@ public class EventListener {
DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt);
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;
if (dungeonRoom == null) {
- if (DungeonsGuide.DEBUG)
+ if (e.DEBUG)
fontRenderer.drawString("Where are you?!", 5, 128, 0xFFFFFF);
} else {
- if (DungeonsGuide.DEBUG) {
+ if (e.DEBUG) {
fontRenderer.drawString("you're in the room... " + dungeonRoom.getColor() + " / " + dungeonRoom.getShape(), 5, 128, 0xFFFFFF);
fontRenderer.drawString("room uuid: " + dungeonRoom.getDungeonRoomInfo().getUuid() + (dungeonRoom.getDungeonRoomInfo().isRegistered() ? "" : " (not registered)"), 5, 138, 0xFFFFFF);
fontRenderer.drawString("room name: " + dungeonRoom.getDungeonRoomInfo().getName(), 5, 148, 0xFFFFFF);
@@ -114,7 +114,7 @@ public class EventListener {
public void onChatReceived(ClientChatReceivedEvent clientChatReceivedEvent) {
try {
if (clientChatReceivedEvent.type == 2) return;
- SkyblockStatus skyblockStatus = (SkyblockStatus) DungeonsGuide.getDungeonsGuide().getSkyblockStatus();
+ SkyblockStatus skyblockStatus = (SkyblockStatus) e.getDungeonsGuide().getSkyblockStatus();
if (!skyblockStatus.isOnDungeon()) return;
DungeonContext context = skyblockStatus.getContext();
@@ -153,12 +153,12 @@ public class EventListener {
@SubscribeEvent
public void onWorldRender(RenderWorldLastEvent renderWorldLastEvent) {
try {
- SkyblockStatus skyblockStatus = (SkyblockStatus) DungeonsGuide.getDungeonsGuide().getSkyblockStatus();
+ SkyblockStatus skyblockStatus = (SkyblockStatus) e.getDungeonsGuide().getSkyblockStatus();
if (!skyblockStatus.isOnDungeon()) return;
DungeonContext context = skyblockStatus.getContext();
if (context == null) return;
- if (DungeonsGuide.DEBUG) {
+ if (e.DEBUG) {
for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) {
for(DungeonDoor door : dungeonRoom.getDoors()) {
RenderUtils.renderDoor(door, renderWorldLastEvent.partialTicks);
@@ -204,10 +204,10 @@ public class EventListener {
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent keyInputEvent) {
- if (DungeonsGuide.DEBUG &&Keybinds.editingSession.isKeyDown() ){
+ if (e.DEBUG &&Keybinds.editingSession.isKeyDown() ){
EditingContext ec = EditingContext.getEditingContext();
if (ec == null) {
- DungeonContext context = DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext();
+ DungeonContext context = e.getDungeonsGuide().getSkyblockStatus().getContext();
if (context == null) {
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Not in dungeons"));
return;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java b/src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java
index 14cd6a9a..22701528 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java
@@ -11,7 +11,7 @@ public class Keybinds
public static void register()
{
- if (DungeonsGuide.DEBUG) {
+ if (e.DEBUG) {
editingSession = new KeyBinding("start editing session", Keyboard.KEY_R, "key.categories.misc");
ClientRegistry.registerKeyBinding(editingSession);
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuideMain.java b/src/main/java/kr/syeyoung/dungeonsguide/a.java
index 029fac8a..e9ca2388 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuideMain.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/a.java
@@ -1,8 +1,7 @@
package kr.syeyoung.dungeonsguide;
import com.mojang.authlib.exceptions.AuthenticationException;
-import kr.syeyoung.dungeonsguide.customurl.DGURLStreamHandlerFactory;
-import lombok.Getter;
+import kr.syeyoung.dungeonsguide.d.c;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiErrorScreen;
@@ -23,43 +22,43 @@ import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
-@Mod(modid = DungeonsGuideMain.MODID, version = DungeonsGuideMain.VERSION)
-public class DungeonsGuideMain
+@Mod(modid = a.b, version = a.c)
+public class a
{
- public static final String MODID = "skyblock_dungeons_guide";
- public static final String VERSION = "1.0";
+ public static final String b = "skyblock_dungeons_guide";
+ public static final String c = "1.0";
- private static DungeonsGuideMain dungeonsGuideMain;
+ private static a a;
- private DungeonsGuideInterface dungeonsGuideInterface;
+ private kr.syeyoung.dungeonsguide.c d;
@EventHandler
- public void init(FMLInitializationEvent event)
+ public void a(FMLInitializationEvent a)
{
- dungeonsGuideMain = this;
- dungeonsGuideInterface.init(event);
+ this.a = this;
+ d.init(a);
}
@EventHandler
- public void pre(FMLPreInitializationEvent event) {
- Authenticator authenticator = new Authenticator();
- String token = null;
+ public void a(FMLPreInitializationEvent a) {
+ b b = new b();
+ String c = 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:///"));
+ c = b.b();
+ if (c != null) {
+ this.a = this;
+ URL.setURLStreamHandlerFactory(new c(b));
+ LaunchClassLoader d = (LaunchClassLoader) a.class.getClassLoader();
+ d.addURL(new URL("z:///"));
try {
- dungeonsGuideInterface = new DungeonsGuide(authenticator);
- dungeonsGuideInterface.pre(event);
+ this.d = new e(b);
+ this.d.pre(a);
} catch (Exception e) {
e.printStackTrace();
- error(new String[]{
+ a(new String[]{
"Couldn't load Dungeons Guide",
"Please contact developer if this problem persists after restart"
});
@@ -84,7 +83,7 @@ public class DungeonsGuideMain
e.printStackTrace();
}
- error(new String[]{
+ a(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",
@@ -107,8 +106,8 @@ public class DungeonsGuideMain
// }
// }
- public void error(final String[] s_msg) {
- final GuiScreen errorGui = new GuiErrorScreen(null, null) {
+ public void a(final String[] a) {
+ final GuiScreen b = new GuiErrorScreen(null, null) {
@Override
public void handleMouseInput() {
@@ -121,8 +120,8 @@ public class DungeonsGuideMain
@Override
public void drawScreen(int par1, int par2, float par3) {
drawDefaultBackground();
- for (int i = 0; i < s_msg.length; ++i) {
- drawCenteredString(fontRendererObj, s_msg[i], width / 2, height / 3 + 12 * i, 0xFFFFFFFF);
+ for (int i = 0; i < a.length; ++i) {
+ drawCenteredString(fontRendererObj, a[i], width / 2, height / 3 + 12 * i, 0xFFFFFFFF);
}
}
};
@@ -130,7 +129,7 @@ public class DungeonsGuideMain
@Override
public void initGui(GuiErrorScreen errorScreen, FontRenderer fontRenderer) {
- Minecraft.getMinecraft().displayGuiScreen(errorGui);
+ Minecraft.getMinecraft().displayGuiScreen(b);
}
@Override
@@ -139,7 +138,7 @@ public class DungeonsGuideMain
};
throw e;
}
- public static DungeonsGuideMain getDungeonsGuideMain() {
- return dungeonsGuideMain;
+ public static a a() {
+ return a;
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/b.java b/src/main/java/kr/syeyoung/dungeonsguide/b.java
new file mode 100644
index 00000000..e786834e
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/b.java
@@ -0,0 +1,161 @@
+package kr.syeyoung.dungeonsguide;
+
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import com.mojang.authlib.GameProfile;
+import com.mojang.authlib.exceptions.AuthenticationException;
+import com.mojang.authlib.minecraft.MinecraftSessionService;
+import lombok.Getter;
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.Session;
+
+import javax.crypto.*;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import javax.xml.bind.DatatypeConverter;
+import java.io.*;
+import java.math.BigInteger;
+import java.net.*;
+import java.security.*;
+import java.util.HashMap;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+public class b {
+ private KeyPair a;
+ private String b;
+
+ public String c() {
+ return b;
+ }
+
+ private KeyPair a() {
+ KeyPairGenerator a = null;
+ try {
+ a = KeyPairGenerator.getInstance("RSA");
+ } catch (NoSuchAlgorithmException b) { }
+ a.initialize(1024);
+ this.a = a.generateKeyPair();
+ return this.a;
+ }
+
+ public b() {
+ a();
+ }
+
+ private static final String DOMAIN = "http://localhost:8080/";
+
+ public String b() throws IOException, AuthenticationException, NoSuchAlgorithmException, IllegalBlockSizeException, InvalidKeyException, BadPaddingException, InvalidAlgorithmParameterException, NoSuchPaddingException {
+ Session a = Minecraft.getMinecraft().getSession();
+ String b = a.getToken();
+
+ String c = a(a.getProfile());
+ MinecraftSessionService yggdrasilMinecraftSessionService = Minecraft.getMinecraft().getSessionService();
+ JsonObject d = a(c);
+ String hash = a(DatatypeConverter.parseBase64Binary(d.get("sharedSecret").getAsString()),
+ DatatypeConverter.parseBase64Binary(d.get("publicKey").getAsString()));
+ yggdrasilMinecraftSessionService.joinServer(a.getProfile(), b, hash);
+ this.b = a(c, this.a.getPublic());
+ b(this.b);
+ return this.b;
+ }
+
+ public JsonObject a(String c) {
+ String a = c.split("\\.")[1].replace("+", "-").replace("/", "_");
+ String b = new String(DatatypeConverter.parseBase64Binary(a));
+ return (JsonObject) new JsonParser().parse(b);
+ }
+
+ private String a(GameProfile d) throws IOException {
+ HttpURLConnection a = (HttpURLConnection) new URL(DOMAIN+"auth/requestAuth").openConnection();
+ a.setRequestProperty("User-Agent", "DungeonsGuide/1.0");
+ a.setRequestProperty("Content-Type", "application/json");
+ a.setRequestMethod("POST");
+ a.setDoInput(true);
+ a.setDoOutput(true);
+
+ a.getOutputStream().write(("{\"uuid\":\""+d.getId().toString()+"\",\"nickname\":\""+d.getName()+"\"}").getBytes());
+ InputStreamReader b = new InputStreamReader(a.getInputStream());
+ JsonObject c = (JsonObject) new JsonParser().parse(b);
+ if (!"ok".equals(c.get("status").getAsString())) {
+ return null;
+ }
+ return c.get("data").getAsString();
+ }
+ private String a(String a, PublicKey b) throws IOException {
+ HttpURLConnection c = (HttpURLConnection) new URL(DOMAIN+"auth/authenticate").openConnection();
+ c.setRequestMethod("POST");
+ c.setRequestProperty("User-Agent", "DungeonsGuide/1.0");
+ c.setRequestProperty("Content-Type", "application/json");
+ c.setDoInput(true);
+ c.setDoOutput(true);
+
+ c.getOutputStream().write(("{\"jwt\":\""+a+"\",\"publicKey\":\""+DatatypeConverter.printBase64Binary(b.getEncoded())+"\"}").getBytes());
+ InputStreamReader d = new InputStreamReader(c.getInputStream());
+ JsonObject e = (JsonObject) new JsonParser().parse(d);
+ if (!"ok".equals(e.get("status").getAsString())) {
+ return null;
+ }
+ return e.get("data").getAsString();
+ }
+
+ private HashMap<String, byte[]> c = new HashMap<String, byte[]>();
+
+ public HashMap<String, byte[]> d() {
+ return c;
+ }
+
+ private void b(String a) throws IOException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException {
+ HttpURLConnection b = (HttpURLConnection) new URL(DOMAIN + "resource/jar").openConnection();
+ b.setRequestProperty("User-Agent", "DungeonsGuide/1.0");
+ b.setRequestProperty("Content-Type", "application/json");
+ b.setRequestMethod("GET");
+ b.setRequestProperty("Authorization", a);
+ b.setDoInput(true);
+ b.setDoOutput(true);
+
+ InputStream c = b.getInputStream();
+ byte[] d = new byte[4];
+ c.read(d);
+ int f = ((d[0] & 0xFF) << 24) |
+ ((d[1] & 0xFF) << 16) |
+ ((d[2] & 0xFF) << 8) |
+ ((d[3] & 0xFF));
+ while (c.available() < f) ;
+ byte[] e = new byte[f];
+ c.read(e);
+
+ Cipher g = Cipher.getInstance("RSA/ECB/PKCS1Padding");
+ g.init(Cipher.DECRYPT_MODE, this.a.getPrivate());
+ byte[] h = g.doFinal(e);
+
+ g = Cipher.getInstance("AES/CBC/PKCS5Padding");
+ SecretKeySpec i = new SecretKeySpec(h, "AES");
+ IvParameterSpec j = new IvParameterSpec(h);
+ g.init(Cipher.DECRYPT_MODE, i, j);
+ CipherInputStream k = new CipherInputStream(c, g);
+
+ k.read(d);
+ ZipInputStream l = new ZipInputStream(k);
+ ZipEntry m;
+ while ((m=l.getNextEntry()) != null) {
+ byte[] n = new byte[256];
+ ByteArrayOutputStream o = new ByteArrayOutputStream();
+ int p = 0;
+ while((p = l.read(n)) > 0) {
+ o.write(n, 0, p);
+ }
+ this.c.put(m.getName(), o.toByteArray());
+ }
+ b.disconnect();
+ }
+
+ public String a(byte[] a, byte[] b) throws NoSuchAlgorithmException {
+ MessageDigest c = MessageDigest.getInstance("SHA-1");
+ c.update("".getBytes());
+ c.update(a);
+ c.update(b);
+ byte[] d = c.digest();
+ return new BigInteger(d).toString(16);
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuideInterface.java b/src/main/java/kr/syeyoung/dungeonsguide/c.java
index 48d58d5b..6e2d8023 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuideInterface.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/c.java
@@ -3,7 +3,7 @@ package kr.syeyoung.dungeonsguide;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
-public interface DungeonsGuideInterface {
+public interface c {
public void init(FMLInitializationEvent event);
public void pre(FMLPreInitializationEvent event);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandSaveData.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandSaveData.java
index 1cdfc791..4d17787c 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandSaveData.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandSaveData.java
@@ -1,6 +1,6 @@
package kr.syeyoung.dungeonsguide.commands;
-import kr.syeyoung.dungeonsguide.DungeonsGuide;
+import kr.syeyoung.dungeonsguide.e;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
@@ -18,7 +18,7 @@ public class CommandSaveData extends CommandBase {
@Override
public void processCommand(ICommandSender sender, String[] args) {
- DungeonRoomInfoRegistry.saveAll(DungeonsGuide.getDungeonsGuide().getConfigDir());
+ DungeonRoomInfoRegistry.saveAll(e.getDungeonsGuide().getConfigDir());
}
@Override
public int getRequiredPermissionLevel() {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/customurl/DGURLConnection.java b/src/main/java/kr/syeyoung/dungeonsguide/customurl/DGURLConnection.java
deleted file mode 100644
index 06aec0d8..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/customurl/DGURLConnection.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package kr.syeyoung.dungeonsguide.customurl;
-
-import kr.syeyoung.dungeonsguide.Authenticator;
-import kr.syeyoung.dungeonsguide.DungeonsGuideMain;
-import lombok.SneakyThrows;
-import net.minecraft.launchwrapper.LaunchClassLoader;
-
-import javax.crypto.Cipher;
-import javax.crypto.CipherInputStream;
-import javax.crypto.spec.IvParameterSpec;
-import javax.crypto.spec.SecretKeySpec;
-import java.io.*;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Set;
-
-public class DGURLConnection extends URLConnection {
- private Authenticator authenticator;
- protected DGURLConnection(URL url, Authenticator authenticator) {
- super(url);
- connected = false;
- this.authenticator = authenticator;
- }
-
- @Override
- public void connect() throws IOException {
- }
- @Override
- public InputStream getInputStream() throws IOException {
- 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());
- }
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/customurl/DGURLStreamHandler.java b/src/main/java/kr/syeyoung/dungeonsguide/customurl/DGURLStreamHandler.java
deleted file mode 100644
index b5d0f861..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/customurl/DGURLStreamHandler.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package kr.syeyoung.dungeonsguide.customurl;
-
-import kr.syeyoung.dungeonsguide.Authenticator;
-import lombok.AllArgsConstructor;
-
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-
-@AllArgsConstructor
-public class DGURLStreamHandler extends URLStreamHandler {
- private Authenticator authenticator;
- @Override
- protected URLConnection openConnection(URL url) throws IOException {
- return new DGURLConnection(url, authenticator);
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/customurl/DGURLStreamHandlerFactory.java b/src/main/java/kr/syeyoung/dungeonsguide/customurl/DGURLStreamHandlerFactory.java
deleted file mode 100644
index 418c55f0..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/customurl/DGURLStreamHandlerFactory.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package kr.syeyoung.dungeonsguide.customurl;
-
-import kr.syeyoung.dungeonsguide.Authenticator;
-import lombok.AllArgsConstructor;
-
-import java.net.URLStreamHandler;
-import java.net.URLStreamHandlerFactory;
-
-@AllArgsConstructor
-public class DGURLStreamHandlerFactory implements URLStreamHandlerFactory {
- private Authenticator authenticator;
- @Override
- public URLStreamHandler createURLStreamHandler(String s) {
- if ("dungeonsguide".equals(s)) {
- return new DGURLStreamHandler(authenticator);
- }
-
- return null;
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/d/a.java b/src/main/java/kr/syeyoung/dungeonsguide/d/a.java
new file mode 100644
index 00000000..9cc4932c
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/d/a.java
@@ -0,0 +1,30 @@
+package kr.syeyoung.dungeonsguide.d;
+
+import kr.syeyoung.dungeonsguide.b;
+
+import java.io.*;
+import java.net.URL;
+import java.net.URLConnection;
+
+public class a extends URLConnection {
+ private b a;
+ protected a(URL b, b a) {
+ super(b);
+ connected = false;
+ this.a = a;
+ }
+
+ @Override
+ public void connect() throws IOException {
+ }
+ @Override
+ public InputStream getInputStream() throws IOException {
+ if (a != null) {
+ String path = url.getPath().substring(1);
+ if (!a.d().containsKey(path)) throw new FileNotFoundException();
+ return new ByteArrayInputStream(a.d().get(path));
+ } else {
+ return a.class.getResourceAsStream(url.getPath());
+ }
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/d/b.java b/src/main/java/kr/syeyoung/dungeonsguide/d/b.java
new file mode 100644
index 00000000..80f69af9
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/d/b.java
@@ -0,0 +1,17 @@
+package kr.syeyoung.dungeonsguide.d;
+
+import lombok.AllArgsConstructor;
+
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+
+@AllArgsConstructor
+public class b extends URLStreamHandler {
+ private kr.syeyoung.dungeonsguide.b a;
+ @Override
+ protected URLConnection openConnection(URL a) throws IOException {
+ return new a(a, this.a);
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/d/c.java b/src/main/java/kr/syeyoung/dungeonsguide/d/c.java
new file mode 100644
index 00000000..5b3a47e3
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/d/c.java
@@ -0,0 +1,18 @@
+package kr.syeyoung.dungeonsguide.d;
+
+import lombok.AllArgsConstructor;
+
+import java.net.URLStreamHandler;
+import java.net.URLStreamHandlerFactory;
+
+@AllArgsConstructor
+public class c implements URLStreamHandlerFactory {
+ private kr.syeyoung.dungeonsguide.b a;
+ @Override
+ public URLStreamHandler createURLStreamHandler(String a) {
+ if ("z".equals(a)) {
+ return new b(this.a);
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java
index 71f74187..62b7a06b 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java
@@ -1,7 +1,7 @@
package kr.syeyoung.dungeonsguide.dungeon;
import com.google.common.collect.Sets;
-import kr.syeyoung.dungeonsguide.DungeonsGuide;
+import kr.syeyoung.dungeonsguide.e;
import kr.syeyoung.dungeonsguide.SkyblockStatus;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DoorFinderRegistry;
@@ -45,7 +45,7 @@ public class MapProcessor {
private void buildMap(final byte[] mapData) {
final Point startroom = MapUtils.findFirstColorWithIn(mapData, (byte) 30, new Rectangle(0,0,128,128));
if (startroom == null){
- DungeonsGuide.sendDebugChat(new ChatComponentText("BUGGED MAP"));
+ e.sendDebugChat(new ChatComponentText("BUGGED MAP"));
bugged = true;
return;
}
@@ -69,7 +69,7 @@ public class MapProcessor {
}
if (doorDir == null) {
- DungeonsGuide.sendDebugChat(new ChatComponentText("BUGGED MAP, no connected door found"));
+ e.sendDebugChat(new ChatComponentText("BUGGED MAP, no connected door found"));
bugged = true;
return;
}
@@ -81,7 +81,7 @@ public class MapProcessor {
int gap = MapUtils.getLengthOfColorExtending(mapData, (byte) 0, basePoint, doorDir);
Point pt = MapUtils.findFirstColorWithInNegate(mapData, (byte)0, new Rectangle(basePoint.x, basePoint.y, (int)Math.abs(doorDir.y) * unitRoomDimension.width + 1, (int)Math.abs(doorDir.x) * unitRoomDimension.height + 1));
if (pt == null) {
- DungeonsGuide.sendDebugChat(new ChatComponentText("BUGGED MAP, can't find door"));
+ e.sendDebugChat(new ChatComponentText("BUGGED MAP, can't find door"));
bugged = true;
return;
}
@@ -98,20 +98,20 @@ public class MapProcessor {
}
// determine door location based on npc, and determine map min from there
{
- StartDoorFinder doorFinder = DoorFinderRegistry.getDoorFinder(((SkyblockStatus) DungeonsGuide.getDungeonsGuide().getSkyblockStatus()).getDungeonName());
+ StartDoorFinder doorFinder = DoorFinderRegistry.getDoorFinder(((SkyblockStatus) e.getDungeonsGuide().getSkyblockStatus()).getDungeonName());
if (doorFinder == null) {
- DungeonsGuide.sendDebugChat(new ChatComponentText("Couldn't find door finder for :: "+((SkyblockStatus) DungeonsGuide.getDungeonsGuide().getSkyblockStatus()).getDungeonName()));
+ e.sendDebugChat(new ChatComponentText("Couldn't find door finder for :: "+((SkyblockStatus) e.getDungeonsGuide().getSkyblockStatus()).getDungeonName()));
bugged = true;
return;
}
BlockPos door = doorFinder.find(context.getWorld());
if (door == null) {
- DungeonsGuide.sendDebugChat(new ChatComponentText("Couldn't find door :: "+((SkyblockStatus) DungeonsGuide.getDungeonsGuide().getSkyblockStatus()).getDungeonName()));
+ e.sendDebugChat(new ChatComponentText("Couldn't find door :: "+((SkyblockStatus) e.getDungeonsGuide().getSkyblockStatus()).getDungeonName()));
bugged = true;
return;
}
- DungeonsGuide.sendDebugChat(new ChatComponentText("door Pos:"+door));
+ e.sendDebugChat(new ChatComponentText("door Pos:"+door));
Point unitPoint = mapPointToRoomPoint(startroom);
unitPoint.translate(unitPoint.x + 1, unitPoint.y + 1);
@@ -127,12 +127,12 @@ public class MapProcessor {
}
- DungeonsGuide.sendDebugChat(new ChatComponentText("Found Green room:"+startroom));
- DungeonsGuide.sendDebugChat(new ChatComponentText("Axis match:"+axisMatch));
- DungeonsGuide.sendDebugChat(new ChatComponentText("World Min:"+context.getDungeonMin()));
- DungeonsGuide.sendDebugChat(new ChatComponentText("Dimension:"+unitRoomDimension));
- DungeonsGuide.sendDebugChat(new ChatComponentText("top Left:"+topLeftMapPoint));
- DungeonsGuide.sendDebugChat(new ChatComponentText("door dimension:"+doorDimension));
+ e.sendDebugChat(new ChatComponentText("Found Green room:"+startroom));
+ e.sendDebugChat(new ChatComponentText("Axis match:"+axisMatch));
+ e.sendDebugChat(new ChatComponentText("World Min:"+context.getDungeonMin()));
+ e.sendDebugChat(new ChatComponentText("Dimension:"+unitRoomDimension));
+ e.sendDebugChat(new ChatComponentText("top Left:"+topLeftMapPoint));
+ e.sendDebugChat(new ChatComponentText("door dimension:"+doorDimension));
}
public Point mapPointToRoomPoint(Point mapPoint) {
@@ -166,8 +166,8 @@ public class MapProcessor {
if (color != 0 && color != 85) {
MapUtils.record(mapData, mapPoint.x, mapPoint.y, new Color(0,255,255,80));
DungeonRoom rooms = buildRoom(mapData, new Point(x,y));
- DungeonsGuide.sendDebugChat(new ChatComponentText("New Map discovered! shape: "+rooms.getShape()+ " color: "+rooms.getColor()+" unitPos: "+x+","+y));
- DungeonsGuide.sendDebugChat(new ChatComponentText("New Map discovered! mapMin: "+rooms.getMin()));
+ e.sendDebugChat(new ChatComponentText("New Map discovered! shape: "+rooms.getShape()+ " color: "+rooms.getColor()+" unitPos: "+x+","+y));
+ e.sendDebugChat(new ChatComponentText("New Map discovered! mapMin: "+rooms.getMin()));
StringBuilder builder = new StringBuilder();
for (int dy =0;dy<4;dy++) {
for (int dx = 0; dx < 4; dx ++) {
@@ -176,7 +176,7 @@ public class MapProcessor {
}
builder.append("\n");
}
- DungeonsGuide.sendDebugChat(new ChatComponentText("Shape visual: "+builder.toString()));
+ e.sendDebugChat(new ChatComponentText("Shape visual: "+builder.toString()));
context.getDungeonRoomList().add(rooms);
for (Point p:rooms.getUnitPoints()) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java
index 03c2cb07..2c5e7978 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java
@@ -1,8 +1,6 @@
package kr.syeyoung.dungeonsguide.dungeon.roomfinder;
-import kr.syeyoung.dungeonsguide.Authenticator;
-import kr.syeyoung.dungeonsguide.DungeonsGuide;
-import kr.syeyoung.dungeonsguide.DungeonsGuideMain;
+import kr.syeyoung.dungeonsguide.e;
import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo;
import org.apache.commons.io.IOUtils;
@@ -52,7 +50,7 @@ public class DungeonRoomInfoRegistry {
}
public static void saveAll(File dir) {
- if (!DungeonsGuide.DEBUG) return;
+ if (!e.DEBUG) return;
dir.mkdirs();
for (DungeonRoomInfo dungeonRoomInfo : registered) {
try {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java b/src/main/java/kr/syeyoung/dungeonsguide/e.java
index ff49bdb8..17d3aa26 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/e.java
@@ -19,17 +19,17 @@ import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
-public class DungeonsGuide implements DungeonsGuideInterface {
+public class e implements c {
private SkyblockStatus skyblockStatus;
- private static DungeonsGuide dungeonsGuide;
+ private static e dungeonsGuide;
- public static boolean DEBUG = false;
+ public static final boolean DEBUG = false;
@Getter
- private Authenticator authenticator;
- public DungeonsGuide(Authenticator authenticator) {
+ private b authenticator;
+ public e(b authenticator) {
this.authenticator = authenticator;
}
@@ -68,7 +68,7 @@ public class DungeonsGuide implements DungeonsGuideInterface {
Keybinds.register();
}
public void pre(FMLPreInitializationEvent event) {
- configDir = new File(event.getModConfigurationDirectory(),"dungeonsguide");
+ configDir = new File(event.getModConfigurationDirectory(),"z");
}
@Getter
@@ -79,7 +79,7 @@ public class DungeonsGuide implements DungeonsGuideInterface {
return (SkyblockStatus) skyblockStatus;
}
- public static DungeonsGuide getDungeonsGuide() {
+ public static e getDungeonsGuide() {
return dungeonsGuide;
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java
index b3c933d9..e097817f 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java
@@ -1,9 +1,8 @@
package kr.syeyoung.dungeonsguide.roomprocessor;
-import kr.syeyoung.dungeonsguide.DungeonsGuide;
+import kr.syeyoung.dungeonsguide.e;
import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
-import kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.RoomProcessorWaterPuzzle;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.util.IChatComponent;
@@ -32,7 +31,7 @@ public class GeneralRoomProcessor implements RoomProcessor {
@Override
public void drawWorld(float partialTicks) {
- if (DungeonsGuide.DEBUG) {
+ if (e.DEBUG) {
for (Map.Entry<String, DungeonMechanic> value : dungeonRoom.getDungeonRoomInfo().getMechanics().entrySet()) {
if (value.getValue() == null) continue;;
value.getValue().highlight(new Color(0,255,255,50), value.getKey(), dungeonRoom, partialTicks);