From 25ba4dc7eb91914519d0f58966e25bb33d5ca26b Mon Sep 17 00:00:00 2001 From: Alberto Date: Mon, 25 Jan 2021 22:25:29 +0100 Subject: [PATCH 1/2] "Log report to console" config option (#208) * log-report-to-console added to config.yml * logReportToConsole added to ConfigSetting * Check if isLogReportToConsolet to show report * Fix return logReportToConsole --- .../bentobox/level/commands/IslandLevelCommand.java | 2 +- .../world/bentobox/level/config/ConfigSettings.java | 13 +++++++++++++ src/main/resources/config.yml | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/world/bentobox/level/commands/IslandLevelCommand.java b/src/main/java/world/bentobox/level/commands/IslandLevelCommand.java index 7db0584..d2b1a98 100644 --- a/src/main/java/world/bentobox/level/commands/IslandLevelCommand.java +++ b/src/main/java/world/bentobox/level/commands/IslandLevelCommand.java @@ -119,7 +119,7 @@ public class IslandLevelCommand extends CompositeCommand { .filter(u -> !u.equals(user.getUniqueId())) .forEach(m -> User.getInstance(m).sendMessage(ISLAND_LEVEL_IS, LEVEL, addon.getManager().getIslandLevelString(getWorld(), playerUUID))); } - } else { + } else if (this.addon.getSettings().isLogReportToConsole()) { results.getReport().forEach(BentoBox.getInstance()::log); } diff --git a/src/main/java/world/bentobox/level/config/ConfigSettings.java b/src/main/java/world/bentobox/level/config/ConfigSettings.java index cbf2752..a3489ef 100644 --- a/src/main/java/world/bentobox/level/config/ConfigSettings.java +++ b/src/main/java/world/bentobox/level/config/ConfigSettings.java @@ -19,6 +19,11 @@ public class ConfigSettings implements ConfigObject { @ConfigEntry(path = "disabled-game-modes") private List gameModes = Collections.emptyList(); + @ConfigComment("") + @ConfigComment("When executing level command from console, should a report be shown?") + @ConfigEntry(path = "log-report-to-console") + private boolean logReportToConsole = true; + @ConfigComment("") @ConfigComment("Number of concurrent island calculations") @ConfigComment("If your CPU can handle it, you can run parallel island calcs if there are more than one in the queue") @@ -363,5 +368,13 @@ public class ConfigSettings implements ConfigObject { public void setCalculationTimeout(int calculationTimeout) { this.calculationTimeout = calculationTimeout; } + + + /** + * @return logReportToConsole + */ + public boolean isLogReportToConsole() { + return logReportToConsole; + } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index c5527fd..3f911d7 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -6,6 +6,9 @@ disabled-game-modes: - AOneBlock # +# When executing level command from console, should a report be shown? +log-report-to-console: true +# # Number of concurrent island calculations # If your CPU can handle it, you can run parallel island calcs if there are more than one in the queue concurrent-island-calcs: 1 From aeb48c6f3ea43ccbabbb64a447ffd7b9fe971f74 Mon Sep 17 00:00:00 2001 From: Alberto Date: Thu, 28 Jan 2021 16:30:45 +0100 Subject: [PATCH 2/2] setLogReportToConsole to ConfigSettings (#209) --- .../java/world/bentobox/level/config/ConfigSettings.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/world/bentobox/level/config/ConfigSettings.java b/src/main/java/world/bentobox/level/config/ConfigSettings.java index a3489ef..67f7b91 100644 --- a/src/main/java/world/bentobox/level/config/ConfigSettings.java +++ b/src/main/java/world/bentobox/level/config/ConfigSettings.java @@ -376,5 +376,13 @@ public class ConfigSettings implements ConfigObject { public boolean isLogReportToConsole() { return logReportToConsole; } + + + /** + * @param logReportToConsole if logReportToConsole should be shown on console + */ + public void setLogReportToConsole(boolean logReportToConsole) { + this.logReportToConsole = logReportToConsole; + } }