aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder
diff options
context:
space:
mode:
authorsyeyoung <42869671+cyoung06@users.noreply.github.com>2020-12-08 14:54:17 +0900
committersyeyoung <42869671+cyoung06@users.noreply.github.com>2020-12-08 14:54:17 +0900
commit87e89fd42ca44400a3d3d3d5477cd1525b24d91a (patch)
tree02023a2650c2a9e4fd2d47f64cb91ec614a28556 /src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder
parent055520e1d8313a302f58babc6526d95bf22b471f (diff)
downloadSkyblock-Dungeons-Guide-87e89fd42ca44400a3d3d3d5477cd1525b24d91a.tar.gz
Skyblock-Dungeons-Guide-87e89fd42ca44400a3d3d3d5477cd1525b24d91a.tar.bz2
Skyblock-Dungeons-Guide-87e89fd42ca44400a3d3d3d5477cd1525b24d91a.zip
authentication stuff and network loading
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java23
1 files changed, 19 insertions, 4 deletions
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 d9df6a8d..383aea08 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,17 @@
package kr.syeyoung.dungeonsguide.dungeon.roomfinder;
+import jdk.internal.util.xml.impl.Input;
+import kr.syeyoung.dungeonsguide.Authenticator;
+import kr.syeyoung.dungeonsguide.DungeonsGuide;
import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo;
+import javax.crypto.BadPaddingException;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
import java.io.*;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
import java.util.*;
public class DungeonRoomInfoRegistry {
@@ -41,6 +50,7 @@ public class DungeonRoomInfoRegistry {
}
public static void saveAll(File dir) {
+ if (!DungeonsGuide.DEBUG) return;
dir.mkdirs();
for (DungeonRoomInfo dungeonRoomInfo : registered) {
try {
@@ -53,14 +63,19 @@ public class DungeonRoomInfoRegistry {
}
}
- public static void loadAll(File dir) {
+ public static void loadAll() throws BadPaddingException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException, IllegalBlockSizeException, NoSuchPaddingException, InvalidKeyException {
registered.clear();
shapeMap.clear();
uuidMap.clear();
- for (File f: dir.listFiles()) {
- if (!f.isFile() || !f.getName().endsWith(".roomdata")) continue;
+ Authenticator authenticator = DungeonsGuide.getDungeonsGuide().getAuthenticator();
+ InputStream inputStream = authenticator.getInputStream("roomdata/datas.txt");
+ BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
+ String name;
+ while ((name = br.readLine()) != null) {
+ System.out.println("Trying to load "+name);
+ if (name.endsWith(".roomdata")) continue;
try {
- FileInputStream fis = new FileInputStream(f);
+ InputStream fis = authenticator.getInputStream(name);
ObjectInputStream ois = new ObjectInputStream(fis);
DungeonRoomInfo dri = (DungeonRoomInfo) ois.readObject();
ois.close();