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") @ConfigEntry(path = "panel.close-on-click-outside")
private boolean closePanelOnClickOutside = true; private boolean closePanelOnClickOutside = true;
/*
* Logs
*/
@ConfigComment("Toggle whether superflat chunks regeneration should be logged in the server logs or not.") @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("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("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") @ConfigEntry(path = "logs.clean-super-flat-chunks", since = "1.2.0")
private boolean logCleanSuperFlatChunks = true; 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 * Island
*/ */
@ -183,8 +190,7 @@ public class Settings implements ConfigObject {
@ConfigComment("Time in minutes between each connection to the GitHub API.") @ConfigComment("Time in minutes between each connection to the GitHub API.")
@ConfigComment("This allows for up-to-the-minute information gathering.") @ConfigComment("This allows for up-to-the-minute information gathering.")
@ConfigComment("However, as the GitHub API data does not get updated instantly,") @ConfigComment("However, as the GitHub API data does not get updated instantly, this value cannot be set less than 15 minutes.")
@ConfigComment("this value cannot be set less than 15 minutes.")
@ConfigComment("Setting this to 0 will make BentoBox download data only at startup.") @ConfigComment("Setting this to 0 will make BentoBox download data only at startup.")
@ConfigEntry(path = "web.github.connection-interval", since = "1.5.0") @ConfigEntry(path = "web.github.connection-interval", since = "1.5.0")
private int githubConnectionInterval = 60; private int githubConnectionInterval = 60;
@ -483,4 +489,12 @@ public class Settings implements ConfigObject {
public void setCheckAddonsUpdates(boolean checkAddonsUpdates) { public void setCheckAddonsUpdates(boolean checkAddonsUpdates) {
this.checkAddonsUpdates = 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(); this.gamemodesCatalog.clear();
} }
plugin.log("Updating data from GitHub..."); if (plugin.getSettings().isLogGithubDownloadData()) {
plugin.log("Downloading data from GitHub...");
}
try { try {
String catalogContent = new GitHubGist(gh, "bccabc20bce17f358d0f94bbbe83babd").getRawResponseAsJson() String catalogContent = new GitHubGist(gh, "bccabc20bce17f358d0f94bbbe83babd").getRawResponseAsJson()
.getAsJsonObject().getAsJsonObject("files").getAsJsonObject("catalog.json").get("content").getAsString() .getAsJsonObject().getAsJsonObject("files").getAsJsonObject("catalog.json").get("content").getAsString()