diff options
author | Torui <44932079+ToruiDev@users.noreply.github.com> | 2022-06-17 11:47:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-17 11:47:51 +0200 |
commit | ed4141ca9116798326856984c40fe355d27d7281 (patch) | |
tree | 446069ace37675eef27bf389b8d6a9247ed40048 | |
parent | af0b91dca38c64f915e666eeaa9c0837a7c91f97 (diff) | |
parent | b8aeecc901fbd587a6ff11e17dc84fea82daaa97 (diff) | |
download | COFL-ed4141ca9116798326856984c40fe355d27d7281.tar.gz COFL-ed4141ca9116798326856984c40fe355d27d7281.tar.bz2 COFL-ed4141ca9116798326856984c40fe355d27d7281.zip |
Merge pull request #66 from Coflnet/fix/json-crash
Fix invalid config crashing minecraft
3 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/de/torui/coflsky/CoflSky.java b/src/main/java/de/torui/coflsky/CoflSky.java index 9811ec7..1274a25 100644 --- a/src/main/java/de/torui/coflsky/CoflSky.java +++ b/src/main/java/de/torui/coflsky/CoflSky.java @@ -28,7 +28,7 @@ import net.minecraftforge.fml.relauncher.Side; public class CoflSky { public static final String MODID = "CoflSky"; - public static final String VERSION = "1.4-Alpha"; + public static final String VERSION = "1.4.2-Alpha"; public static WSClientWrapper Wrapper; public static KeyBinding[] keyBindings; @@ -58,10 +58,10 @@ public class CoflSky configString = new String(Files.readAllBytes(Paths.get(configFile.getPath()))); config = gson.fromJson(configString, LocalConfig.class); } - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } - if (configString == null) { + if (config == null) { config = LocalConfig.createDefaultConfig(); } } diff --git a/src/main/java/de/torui/coflsky/configuration/LocalConfig.java b/src/main/java/de/torui/coflsky/configuration/LocalConfig.java index 5c16fca..749d0bc 100644 --- a/src/main/java/de/torui/coflsky/configuration/LocalConfig.java +++ b/src/main/java/de/torui/coflsky/configuration/LocalConfig.java @@ -30,6 +30,6 @@ public class LocalConfig { } public static LocalConfig createDefaultConfig() { - return new LocalConfig(false,true); + return new LocalConfig(true,true); } } diff --git a/src/main/java/de/torui/coflsky/handlers/DescriptionHandler.java b/src/main/java/de/torui/coflsky/handlers/DescriptionHandler.java index 08eb819..48643bf 100644 --- a/src/main/java/de/torui/coflsky/handlers/DescriptionHandler.java +++ b/src/main/java/de/torui/coflsky/handlers/DescriptionHandler.java @@ -156,7 +156,10 @@ public class DescriptionHandler { return; for (DescModification datum : data) { - if (!(event.toolTip.size() >= datum.line)) return; + if (event.toolTip.size() <= datum.line) { + System.out.println("Skipped line modification " + datum.line + " for " + event.itemStack.getDisplayName()); + continue; + } switch (datum.type) { case "APPEND": event.toolTip.add(datum.value); |