From 4958304aa5d49a7b485dac1d607149299f7658e5 Mon Sep 17 00:00:00 2001 From: Florian CUNY Date: Tue, 22 Jan 2019 14:39:44 +0100 Subject: [PATCH] Added "logs.clean-super-flat-chunks" to config Closes #483 --- .../java/world/bentobox/bentobox/Settings.java | 15 +++++++++++++++ .../listeners/flags/CleanSuperFlatListener.java | 4 +++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/java/world/bentobox/bentobox/Settings.java b/src/main/java/world/bentobox/bentobox/Settings.java index 5dc1da22c..7b90aaeb7 100644 --- a/src/main/java/world/bentobox/bentobox/Settings.java +++ b/src/main/java/world/bentobox/bentobox/Settings.java @@ -86,6 +86,13 @@ public class Settings implements DataObject { @ConfigEntry(path = "panel.close-on-click-outside") private boolean closePanelOnClickOutside = true; + @ConfigComment("Toggle whether superflat chunks regeneration should be logged in the server logs or not.") + @ConfigComment("It can be spammy if there are a lot of superflat chunks to regenerate.") + @ConfigComment("However, as superflat chunks regeneration can be performance-intensive, it is recommended to keep") + @ConfigComment("this setting set to true, as it will help you know if there are regenerations taking place.") + @ConfigEntry(path = "logs.clean-super-flat-chunks", since = "1.1") + private boolean logCleanSuperFlatChunks = true; + /* * Island */ @@ -418,4 +425,12 @@ public class Settings implements DataObject { public void setUniqueId(String uniqueId) { this.uniqueId = uniqueId; } + + public boolean isLogCleanSuperFlatChunks() { + return logCleanSuperFlatChunks; + } + + public void setLogCleanSuperFlatChunks(boolean logCleanSuperFlatChunks) { + this.logCleanSuperFlatChunks = logCleanSuperFlatChunks; + } } \ No newline at end of file diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/CleanSuperFlatListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/CleanSuperFlatListener.java index 7fcafbc23..81f5e9834 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/CleanSuperFlatListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/CleanSuperFlatListener.java @@ -75,7 +75,9 @@ public class CleanSuperFlatListener extends FlagListener { if (!chunkQueue.isEmpty()) { Pair chunkXZ = chunkQueue.poll(); world.regenerateChunk(chunkXZ.x, chunkXZ.z); // NOSONAR - the deprecation doesn't cause any issues to us - plugin.log(chunkQueue.size() + " Regenerating superflat chunk " + world.getName() + " " + chunkXZ.x + ", " + chunkXZ.z); + if (plugin.getSettings().isLogCleanSuperFlatChunks()) { + plugin.log(chunkQueue.size() + " Regenerating superflat chunk " + world.getName() + " " + chunkXZ.x + ", " + chunkXZ.z); + } } }, 0L, 1L); }