mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-18 07:07:40 +01:00
Added 'web.github.download-data' in config
This commit is contained in:
parent
e041107df9
commit
1bdb919734
@ -169,6 +169,13 @@ public class Settings implements DataObject {
|
|||||||
@ConfigEntry(path = "web.metrics")
|
@ConfigEntry(path = "web.metrics")
|
||||||
private boolean metrics = true;
|
private boolean metrics = true;
|
||||||
|
|
||||||
|
@ConfigComment("Toggle whether BentoBox can connect to GitHub to get data about updates and addons.")
|
||||||
|
@ConfigComment("Disabling this will result in the deactivation of the update checker and of some other")
|
||||||
|
@ConfigComment("features that rely on the data downloaded from the GitHub API.")
|
||||||
|
@ConfigComment("It does not send any data.")
|
||||||
|
@ConfigEntry(path = "web.github.download-data", since = "1.3.0")
|
||||||
|
private boolean githubDownloadData = true;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------/
|
//---------------------------------------------------------------------------------------/
|
||||||
@ConfigComment("These settings should not be edited")
|
@ConfigComment("These settings should not be edited")
|
||||||
private String uniqueId = "config";
|
private String uniqueId = "config";
|
||||||
@ -445,4 +452,12 @@ public class Settings implements DataObject {
|
|||||||
public void setResetCooldownOnCreate(boolean resetCooldownOnCreate) {
|
public void setResetCooldownOnCreate(boolean resetCooldownOnCreate) {
|
||||||
this.resetCooldownOnCreate = resetCooldownOnCreate;
|
this.resetCooldownOnCreate = resetCooldownOnCreate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isGithubDownloadData() {
|
||||||
|
return githubDownloadData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGithubDownloadData(boolean githubDownloadData) {
|
||||||
|
this.githubDownloadData = githubDownloadData;
|
||||||
|
}
|
||||||
}
|
}
|
@ -6,6 +6,7 @@ import java.util.Map;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
|
|
||||||
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import world.bentobox.bentobox.BentoBox;
|
import world.bentobox.bentobox.BentoBox;
|
||||||
import world.bentobox.bentobox.api.addons.Addon;
|
import world.bentobox.bentobox.api.addons.Addon;
|
||||||
import world.bentobox.bentobox.api.github.GitHubConnector;
|
import world.bentobox.bentobox.api.github.GitHubConnector;
|
||||||
@ -19,13 +20,15 @@ import world.bentobox.bentobox.api.github.GitHubConnector;
|
|||||||
public class WebManager {
|
public class WebManager {
|
||||||
|
|
||||||
private @NonNull BentoBox plugin;
|
private @NonNull BentoBox plugin;
|
||||||
private @NonNull GitHubConnector bentoBoxGitHubConnector;
|
private @Nullable GitHubConnector bentoBoxGitHubConnector;
|
||||||
private @NonNull Map<@NonNull Addon, @NonNull GitHubConnector> gitHubConnectors = new LinkedHashMap<>();
|
private @NonNull Map<@NonNull Addon, @NonNull GitHubConnector> gitHubConnectors = new LinkedHashMap<>();
|
||||||
|
|
||||||
public WebManager(@NonNull BentoBox plugin) {
|
public WebManager(@NonNull BentoBox plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.bentoBoxGitHubConnector = new GitHubConnector("BentoBoxWorld/BentoBox");
|
if (plugin.getSettings().isGithubDownloadData()) {
|
||||||
setupAddonsGitHubConnectors();
|
this.bentoBoxGitHubConnector = new GitHubConnector("BentoBoxWorld/BentoBox");
|
||||||
|
setupAddonsGitHubConnectors();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,7 +44,9 @@ public class WebManager {
|
|||||||
* Connects all the {@link GitHubConnector} to GitHub to retrieve data.
|
* Connects all the {@link GitHubConnector} to GitHub to retrieve data.
|
||||||
*/
|
*/
|
||||||
public void requestGitHubData() {
|
public void requestGitHubData() {
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> bentoBoxGitHubConnector.connect());
|
if (plugin.getSettings().isGithubDownloadData()) {
|
||||||
gitHubConnectors.values().forEach(gitHubConnector -> Bukkit.getScheduler().runTask(plugin, gitHubConnector::connect));
|
Bukkit.getScheduler().runTask(plugin, () -> bentoBoxGitHubConnector.connect());
|
||||||
|
gitHubConnectors.values().forEach(gitHubConnector -> Bukkit.getScheduler().runTask(plugin, gitHubConnector::connect));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user