diff options
author | syeyoung <cyong06@naver.com> | 2021-05-08 21:38:35 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-05-08 21:38:35 +0900 |
commit | 8dca95f49f14f7e2af945b12f569d83368823085 (patch) | |
tree | d4db33e841f31fc135305a914e30f25acd7939f4 /src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder | |
parent | 252f6533235dee8d5c6138009111c380acd3b50b (diff) | |
download | Skyblock-Dungeons-Guide-8dca95f49f14f7e2af945b12f569d83368823085.tar.gz Skyblock-Dungeons-Guide-8dca95f49f14f7e2af945b12f569d83368823085.tar.bz2 Skyblock-Dungeons-Guide-8dca95f49f14f7e2af945b12f569d83368823085.zip |
fix crashing when opensource
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder')
-rwxr-xr-x | src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java | 30 |
1 files changed, 17 insertions, 13 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 2bdc4206..479762cb 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java @@ -19,6 +19,7 @@ package kr.syeyoung.dungeonsguide.dungeon.roomfinder; import com.google.common.io.Files; +import kr.syeyoung.dungeonsguide.Main; import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo; import net.minecraft.client.Minecraft; import org.apache.commons.io.IOUtils; @@ -106,19 +107,22 @@ public class DungeonRoomInfoRegistry { registered.clear(); shapeMap.clear(); uuidMap.clear(); - URL url = new URL("z:///roomdata/datas.txt"); - List<String> lines = IOUtils.readLines(url.openConnection().getInputStream()); - for (String name : lines) { - if (!name.endsWith(".roomdata")) continue; - try { - InputStream fis = new URL("z:///"+name).openStream(); - ObjectInputStream ois = new ObjectInputStream(fis); - DungeonRoomInfo dri = (DungeonRoomInfo) ois.readObject(); - ois.close(); - fis.close(); - register(dri); - } catch (Exception e) {e.printStackTrace();} - } + try { + List<String> lines = IOUtils.readLines(Main.class.getResourceAsStream("/roomdata/datas.txt")); + for (String name : lines) { + if (!name.endsWith(".roomdata")) continue; + try { + InputStream fis = Main.class.getResourceAsStream("/"+name); + ObjectInputStream ois = new ObjectInputStream(fis); + DungeonRoomInfo dri = (DungeonRoomInfo) ois.readObject(); + ois.close(); + fis.close(); + register(dri); + } catch (Exception e) { + e.printStackTrace(); + } + } + } catch (Exception e) {e.printStackTrace();} for (File f : dir.listFiles()) { if (!f.getName().endsWith(".roomdata")) continue; try { |