From 284de9e28884ed4fcc0562144666d4da41d35a22 Mon Sep 17 00:00:00 2001 From: Florian CUNY Date: Sun, 9 Jun 2019 09:18:30 +0200 Subject: [PATCH] Added config option 'logs.github-download-data' --- .../java/world/bentobox/bentobox/Settings.java | 18 ++++++++++++++++-- .../bentobox/bentobox/managers/WebManager.java | 4 +++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/java/world/bentobox/bentobox/Settings.java b/src/main/java/world/bentobox/bentobox/Settings.java index 29248394f..1f0930630 100644 --- a/src/main/java/world/bentobox/bentobox/Settings.java +++ b/src/main/java/world/bentobox/bentobox/Settings.java @@ -85,6 +85,9 @@ public class Settings implements ConfigObject { @ConfigEntry(path = "panel.close-on-click-outside") private boolean closePanelOnClickOutside = true; + /* + * Logs + */ @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") @@ -92,6 +95,10 @@ public class Settings implements ConfigObject { @ConfigEntry(path = "logs.clean-super-flat-chunks", since = "1.2.0") private boolean logCleanSuperFlatChunks = true; + @ConfigComment("Toggle whether downloading data from GitHub should be logged in the server logs or not.") + @ConfigEntry(path = "logs.github-download-data", since = "1.5.0") + private boolean logGithubDownloadData = true; + /* * Island */ @@ -183,8 +190,7 @@ public class Settings implements ConfigObject { @ConfigComment("Time in minutes between each connection to the GitHub API.") @ConfigComment("This allows for up-to-the-minute information gathering.") - @ConfigComment("However, as the GitHub API data does not get updated instantly,") - @ConfigComment("this value cannot be set less than 15 minutes.") + @ConfigComment("However, as the GitHub API data does not get updated instantly, this value cannot be set less than 15 minutes.") @ConfigComment("Setting this to 0 will make BentoBox download data only at startup.") @ConfigEntry(path = "web.github.connection-interval", since = "1.5.0") private int githubConnectionInterval = 60; @@ -483,4 +489,12 @@ public class Settings implements ConfigObject { public void setCheckAddonsUpdates(boolean checkAddonsUpdates) { this.checkAddonsUpdates = checkAddonsUpdates; } + + public boolean isLogGithubDownloadData() { + return logGithubDownloadData; + } + + public void setLogGithubDownloadData(boolean logGithubDownloadData) { + this.logGithubDownloadData = logGithubDownloadData; + } } \ No newline at end of file diff --git a/src/main/java/world/bentobox/bentobox/managers/WebManager.java b/src/main/java/world/bentobox/bentobox/managers/WebManager.java index 1cf4c85db..c97019703 100644 --- a/src/main/java/world/bentobox/bentobox/managers/WebManager.java +++ b/src/main/java/world/bentobox/bentobox/managers/WebManager.java @@ -56,7 +56,9 @@ public class WebManager { this.gamemodesCatalog.clear(); } - plugin.log("Updating data from GitHub..."); + if (plugin.getSettings().isLogGithubDownloadData()) { + plugin.log("Downloading data from GitHub..."); + } try { String catalogContent = new GitHubGist(gh, "bccabc20bce17f358d0f94bbbe83babd").getRawResponseAsJson() .getAsJsonObject().getAsJsonObject("files").getAsJsonObject("catalog.json").get("content").getAsString()