diff options
author | syeyoung <cyong06@naver.com> | 2021-05-04 13:13:43 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-05-04 13:13:43 +0900 |
commit | eaecce86d73dd6810168f418c36155422f67addc (patch) | |
tree | 4d71113c2ba6834ad1b72cc09f59a2dc014edc87 /src/main/java/kr/syeyoung/dungeonsguide/url | |
parent | caf765b632ce859861bce5e2018a31a93ce7695c (diff) | |
download | Skyblock-Dungeons-Guide-eaecce86d73dd6810168f418c36155422f67addc.tar.gz Skyblock-Dungeons-Guide-eaecce86d73dd6810168f418c36155422f67addc.tar.bz2 Skyblock-Dungeons-Guide-eaecce86d73dd6810168f418c36155422f67addc.zip |
deobfuscate
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/url')
3 files changed, 122 insertions, 0 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/url/DGConnection.java b/src/main/java/kr/syeyoung/dungeonsguide/url/DGConnection.java new file mode 100755 index 00000000..2fb35638 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/url/DGConnection.java @@ -0,0 +1,49 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.url; + +import kr.syeyoung.dungeonsguide.Authenticator; + +import java.io.*; +import java.net.URL; +import java.net.URLConnection; + +public class DGConnection extends URLConnection { + private final Authenticator authenticator; + protected DGConnection(URL url, Authenticator a) { + super(url); + connected = false; + this.authenticator = a; + } + + @Override + public void connect() throws IOException { + } + @Override + public InputStream getInputStream() throws IOException { + if (authenticator != null) { + String path = url.getPath().substring(1); + if (!authenticator.getResources().containsKey(path)) throw new FileNotFoundException(); + return new ByteArrayInputStream(authenticator.getResources().get(path)); + } else if (url.getPath().contains("roomdata")){ + return DGConnection.class.getResourceAsStream(url.getPath()); + } + throw new FileNotFoundException(); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandler.java b/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandler.java new file mode 100755 index 00000000..bc6fa10d --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandler.java @@ -0,0 +1,36 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.url; + +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 DGStreamHandler extends URLStreamHandler { + private final Authenticator auth; + @Override + protected URLConnection openConnection(URL url) throws IOException { + return new DGConnection(url, this.auth); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandlerFactory.java b/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandlerFactory.java new file mode 100755 index 00000000..9f574a86 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandlerFactory.java @@ -0,0 +1,37 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.url; + +import kr.syeyoung.dungeonsguide.Authenticator; +import lombok.AllArgsConstructor; + +import java.net.URLStreamHandler; +import java.net.URLStreamHandlerFactory; + +@AllArgsConstructor +public class DGStreamHandlerFactory implements URLStreamHandlerFactory { + private final Authenticator auth; + @Override + public URLStreamHandler createURLStreamHandler(String protocol) { + if ("z".equals(protocol)) { + return new DGStreamHandler(this.auth); + } + return null; + } +} |