From 6668f829af8c3304ee869f060e8e4fe2b0baf8cf Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 26 Jun 2021 11:44:50 +0200 Subject: [PATCH] Fix RegionLoader Signed-off-by: yoyosource --- .../src/de/steamwar/bausystem/BauSystem.java | 2 +- .../steamwar/bausystem/region/loader/RegionLoader.java | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index 3d94cf0c..437db7f6 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -91,7 +91,7 @@ public class BauSystem extends JavaPlugin implements Listener { private StringBuilder current = new StringBuilder(); @Override - public void write(int b) { + public void write(int b) throws IOException { if (b == '\n') { String logging = current.toString(); if (logging.contains("SLF4J")) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/loader/RegionLoader.java b/BauSystem_Main/src/de/steamwar/bausystem/region/loader/RegionLoader.java index cbe1b3f4..ddf861d5 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/loader/RegionLoader.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/loader/RegionLoader.java @@ -66,10 +66,12 @@ public class RegionLoader { File optionsFile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "options.yapion"); optionsYapionObject = new YAPIONObject(); - try (BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(optionsFile))) { - optionsYapionObject = YAPIONParser.parse(bufferedInputStream); - } catch (IOException e) { - // Ignored + if (optionsFile.length() != 0) { + try (BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(optionsFile))) { + optionsYapionObject = YAPIONParser.parse(bufferedInputStream); + } catch (IOException e) { + // Ignored + } } yapionObject.forEach((key, yapionAnyType) -> {