Added config option 'logs.github-download-data'

This commit is contained in:
Florian CUNY 2019-06-09 09:18:30 +02:00
parent 2340b1991c
commit 284de9e288
2 changed files with 19 additions and 3 deletions

View File

@ -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;
}
}

View File

@ -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()