From feadc9f231c4bd0772da95d0aa739a99371a6935 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sun, 10 May 2020 16:54:33 +0200 Subject: [PATCH] Some refactoring and documentation --- .../guide/options/SlimefunGuideSettings.java | 2 +- .../core/services/github/GitHubService.java | 59 ++++++++++++++++--- 2 files changed, 53 insertions(+), 8 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/SlimefunGuideSettings.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/SlimefunGuideSettings.java index 6ad707cb1..45e7c5593 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/SlimefunGuideSettings.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/SlimefunGuideSettings.java @@ -100,7 +100,7 @@ public final class SlimefunGuideSettings { }); if (SlimefunPlugin.getUpdater().getBranch().isOfficial()) { - menu.addItem(49, new CustomItem(Material.REDSTONE_TORCH, "&4" + SlimefunPlugin.getLocal().getMessage(p, "guide.title.bugs"), "", "&7&oBug reports have to be made in English!", "", "&7Open Issues: &a" + SlimefunPlugin.getGitHubService().getIssues(), "&7Pending Pull Requests: &a" + SlimefunPlugin.getGitHubService().getPullRequests(), "", "&7\u21E8 &eClick to go to the Slimefun4 Bug Tracker"), (pl, slot, item, action) -> { + menu.addItem(49, new CustomItem(Material.REDSTONE_TORCH, "&4" + SlimefunPlugin.getLocal().getMessage(p, "guide.title.bugs"), "", "&7&oBug reports have to be made in English!", "", "&7Open Issues: &a" + SlimefunPlugin.getGitHubService().getOpenissues(), "&7Pending Pull Requests: &a" + SlimefunPlugin.getGitHubService().getPendingPullRequests(), "", "&7\u21E8 &eClick to go to the Slimefun4 Bug Tracker"), (pl, slot, item, action) -> { pl.closeInventory(); ChatUtils.sendURL(pl, "https://github.com/TheBusyBiscuit/Slimefun4/issues"); return false; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubService.java index 3ac5b14a4..b8822be33 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubService.java @@ -35,6 +35,12 @@ public class GitHubService { private int stars = 0; private LocalDateTime lastUpdate = LocalDateTime.now(); + /** + * This creates a new {@link GitHubService} for the given repository. + * + * @param repository + * The repository to create this {@link GitHubService} for + */ public GitHubService(String repository) { this.repository = repository; @@ -103,35 +109,74 @@ public class GitHubService { }); } - public Set getConnectors() { + protected Set getConnectors() { return connectors; } + protected boolean isLoggingEnabled() { + return logging; + } + + /** + * This returns the {@link Contributor Contributors} to this project. + * + * @return A {@link ConcurrentMap} containing all {@link Contributor Contributors} + */ public ConcurrentMap getContributors() { return contributors; } + /** + * This returns the amount of forks of our repository + * + * @return The amount of forks + */ public int getForks() { return forks; } + /** + * This method returns the amount of stargazers of the repository. + * + * @return The amount of people who starred the repository + */ public int getStars() { return stars; } - public int getIssues() { + /** + * This returns the amount of open Issues on our repository. + * + * @return The amount of open issues + */ + public int getOpenissues() { return issues; } - public int getPullRequests() { + /** + * Returns the id of Slimefun's GitHub Repository. (e.g. "TheBusyBiscuit/Slimefun4"). + * + * @return The id of our GitHub Repository + */ + public String getRepository() { + return repository; + } + + /** + * This method returns the amount of pending pull requests. + * + * @return The amount of pending pull requests + */ + public int getPendingPullRequests() { return pullRequests; } + /** + * This returns the date and time of the last commit to this repository. + * + * @return A {@link LocalDateTime} object representing the date and time of the latest commit + */ public LocalDateTime getLastUpdate() { return lastUpdate; } - - public boolean isLoggingEnabled() { - return logging; - } }