From d3998dd03bf50716f0d1e9f51ebe211962d1d74e Mon Sep 17 00:00:00 2001 From: cyberpwn Date: Sat, 21 Aug 2021 05:56:15 -0400 Subject: [PATCH] Config tweaks --- src/main/java/com/volmit/iris/Iris.java | 3 +- .../com/volmit/iris/core/IrisSettings.java | 67 ++----------------- .../methods/HybridPregenMethod.java | 2 +- 3 files changed, 9 insertions(+), 63 deletions(-) diff --git a/src/main/java/com/volmit/iris/Iris.java b/src/main/java/com/volmit/iris/Iris.java index 24b44b73e..7bd1f59ab 100644 --- a/src/main/java/com/volmit/iris/Iris.java +++ b/src/main/java/com/volmit/iris/Iris.java @@ -18,6 +18,7 @@ package com.volmit.iris; +import com.google.gson.Gson; import com.volmit.iris.core.IrisSettings; import com.volmit.iris.core.command.CommandIris; import com.volmit.iris.core.command.PermissionIris; @@ -677,7 +678,7 @@ public class Iris extends VolmitPlugin implements Listener { } public boolean isMCA() { - return !IrisSettings.get().getGenerator().isDisableMCA(); + return IrisSettings.get().getGenerator().isHeadlessPregeneration(); } public static void reportErrorChunk(int x, int z, Throwable e, String extra) { diff --git a/src/main/java/com/volmit/iris/core/IrisSettings.java b/src/main/java/com/volmit/iris/core/IrisSettings.java index 7c72ea270..b69ec5b6c 100644 --- a/src/main/java/com/volmit/iris/core/IrisSettings.java +++ b/src/main/java/com/volmit/iris/core/IrisSettings.java @@ -101,7 +101,6 @@ public class IrisSettings { public static class IrisSettingsGeneral { public boolean commandSounds = true; public boolean debug = false; - public boolean verbose = false; public boolean ignoreWorldEdit = false; public boolean disableNMS = false; public boolean keepProductionOnReload = false; @@ -115,7 +114,6 @@ public class IrisSettings { @Data public static class IrisSettingsGUI { - public boolean useServerLaunchedGuis = true; public boolean maximumPregenGuiFPS = false; public boolean localPregenGui = true; @@ -124,10 +122,8 @@ public class IrisSettings { @Data public static class IrisSettingsGenerator { public String defaultWorldType = "overworld"; - public boolean disableMCA = false; + public boolean headlessPregeneration = false; public boolean systemEffects = true; - public boolean systemEntitySpawnOverrides = true; - public boolean systemEntityInitialSpawns = true; public int maxBiomeChildDepth = 4; public boolean preventLeafDecay = true; } @@ -162,65 +158,14 @@ public class IrisSettings { try { String ss = IO.readAll(s); settings = new Gson().fromJson(ss, IrisSettings.class); - - J.a(() -> - { - try { - JSONObject j = new JSONObject(ss); - boolean u = false; - for (String i : def.keySet()) { - if (!j.has(i)) { - u = true; - j.put(i, def.get(i)); - Iris.warn("Adding new config key: " + i); - } - } - - for (String i : new KSet<>(j.keySet())) { - if (!def.has(i)) { - u = true; - j.remove(i); - Iris.warn("Removing unused config key: " + i); - } - } - - if (u) { - try { - IO.writeAll(s, j.toString(4)); - Iris.info("Updated Configuration Files"); - } catch (Throwable e) { - e.printStackTrace(); - Iris.reportError(e); - } - } - } catch (Throwable ee) { - Iris.reportError(ee); - Iris.error("Configuration Error in settings.json! " + ee.getClass().getSimpleName() + ": " + ee.getMessage()); - Iris.warn("Attempting to fix configuration while retaining valid in-memory settings..."); - - try { - IO.writeAll(s, new JSONObject(new Gson().toJson(settings)).toString(4)); - Iris.info("Configuration Fixed!"); - } catch (IOException e) { - Iris.reportError(e); - e.printStackTrace(); - Iris.error("ERROR! CONFIGURATION IMPOSSIBLE TO READ! Using an unmodifiable configuration from memory. Please delete the settings.json at some point to try to restore configurability!"); - } - } - }); + try { + IO.writeAll(s, new JSONObject(new Gson().toJson(settings)).toString(4)); + } catch (IOException e) { + e.printStackTrace(); + } } catch (Throwable ee) { Iris.reportError(ee); Iris.error("Configuration Error in settings.json! " + ee.getClass().getSimpleName() + ": " + ee.getMessage()); - Iris.warn("Attempting to fix configuration while retaining valid in-memory settings..."); - - try { - IO.writeAll(s, new JSONObject(new Gson().toJson(settings)).toString(4)); - Iris.info("Configuration Fixed!"); - } catch (IOException e) { - Iris.reportError(e); - e.printStackTrace(); - Iris.error("ERROR! CONFIGURATION IMPOSSIBLE TO READ! Using an unmodifiable configuration from memory. Please delete the settings.json at some point to try to restore configurability!"); - } } } diff --git a/src/main/java/com/volmit/iris/core/pregenerator/methods/HybridPregenMethod.java b/src/main/java/com/volmit/iris/core/pregenerator/methods/HybridPregenMethod.java index 1f8b06397..f6e5a6f04 100644 --- a/src/main/java/com/volmit/iris/core/pregenerator/methods/HybridPregenMethod.java +++ b/src/main/java/com/volmit/iris/core/pregenerator/methods/HybridPregenMethod.java @@ -42,7 +42,7 @@ public class HybridPregenMethod implements PregeneratorMethod { } private boolean supportsHeadless(World world) { - return IrisToolbelt.access(world) != null && !IrisSettings.get().getGenerator().isDisableMCA(); + return IrisToolbelt.access(world) != null && IrisSettings.get().getGenerator().isHeadlessPregeneration(); } @Override