use of io.github.thebusybiscuit.slimefun4.core.services.github.GitHubService in project Slimefun4 by Slimefun.
the class SlimefunGuideSettings method addHeader.
@ParametersAreNonnullByDefault
private static void addHeader(Player p, ChestMenu menu, ItemStack guide) {
LocalizationService locale = Slimefun.getLocalization();
// @formatter:off
menu.addItem(0, new CustomItemStack(SlimefunGuide.getItem(SlimefunGuideMode.SURVIVAL_MODE), "&e\u21E6 " + locale.getMessage(p, "guide.back.title"), "", "&7" + locale.getMessage(p, "guide.back.guide")));
// @formatter:on
menu.addMenuClickHandler(0, (pl, slot, item, action) -> {
SlimefunGuide.openGuide(pl, guide);
return false;
});
GitHubService github = Slimefun.getGitHubService();
List<String> contributorsLore = new ArrayList<>();
contributorsLore.add("");
contributorsLore.addAll(locale.getMessages(p, "guide.credits.description", msg -> msg.replace("%contributors%", String.valueOf(github.getContributors().size()))));
contributorsLore.add("");
contributorsLore.add("&7\u21E8 &e" + locale.getMessage(p, "guide.credits.open"));
// @formatter:off
menu.addItem(2, new CustomItemStack(SlimefunUtils.getCustomHead("e952d2b3f351a6b0487cc59db31bf5f2641133e5ba0006b18576e996a0293e52"), "&c" + locale.getMessage(p, "guide.title.credits"), contributorsLore.toArray(new String[0])));
// @formatter:on
menu.addMenuClickHandler(2, (pl, slot, action, item) -> {
ContributorsMenu.open(pl, 0);
return false;
});
// @formatter:off
menu.addItem(4, new CustomItemStack(Material.WRITABLE_BOOK, ChatColor.GREEN + locale.getMessage(p, "guide.title.versions"), "&7&o" + locale.getMessage(p, "guide.tooltips.versions-notice"), "", "&fMinecraft: &a" + Bukkit.getBukkitVersion(), "&fSlimefun: &a" + Slimefun.getVersion()), ChestMenuUtils.getEmptyClickHandler());
// @formatter:on
// @formatter:off
menu.addItem(6, new CustomItemStack(Material.COMPARATOR, "&e" + locale.getMessage(p, "guide.title.source"), "", "&7Last Activity: &a" + NumberUtils.getElapsedTime(github.getLastUpdate()) + " ago", "&7Forks: &e" + github.getForks(), "&7Stars: &e" + github.getStars(), "", "&7&oSlimefun 4 is a community project,", "&7&othe source code is available on GitHub", "&7&oand if you want to keep this Plugin alive,", "&7&othen please consider contributing to it", "", "&7\u21E8 &eClick to go to GitHub"));
// @formatter:on
menu.addMenuClickHandler(6, (pl, slot, item, action) -> {
pl.closeInventory();
ChatUtils.sendURL(pl, "https://github.com/Slimefun/Slimefun4");
return false;
});
// @formatter:off
menu.addItem(8, new CustomItemStack(Material.KNOWLEDGE_BOOK, "&3" + locale.getMessage(p, "guide.title.wiki"), "", "&7Do you need help with an Item or machine?", "&7You cannot figure out what to do?", "&7Check out our community-maintained Wiki", "&7and become one of our Editors!", "", "&7\u21E8 &eClick to go to the official Slimefun Wiki"));
// @formatter:on
menu.addMenuClickHandler(8, (pl, slot, item, action) -> {
pl.closeInventory();
ChatUtils.sendURL(pl, "https://github.com/Slimefun/Slimefun4/wiki");
return false;
});
// @formatter:off
menu.addItem(47, new CustomItemStack(Material.BOOKSHELF, "&3" + locale.getMessage(p, "guide.title.addons"), "", "&7Slimefun is huge. But its addons are what makes", "&7this plugin truly shine. Go check them out, some", "&7of them may be exactly what you were missing out on!", "", "&7Installed on this Server: &b" + Slimefun.getInstalledAddons().size(), "", "&7\u21E8 &eClick to see all available addons for Slimefun4"));
// @formatter:on
menu.addMenuClickHandler(47, (pl, slot, item, action) -> {
pl.closeInventory();
ChatUtils.sendURL(pl, "https://github.com/Slimefun/Slimefun4/wiki/Addons");
return false;
});
if (Slimefun.getUpdater().getBranch().isOfficial()) {
// @formatter:off
menu.addItem(49, new CustomItemStack(Material.REDSTONE_TORCH, "&4" + locale.getMessage(p, "guide.title.bugs"), "", "&7&oBug reports have to be made in English!", "", "&7Open Issues: &a" + github.getOpenIssues(), "&7Pending Pull Requests: &a" + github.getPendingPullRequests(), "", "&7\u21E8 &eClick to go to the Slimefun4 Bug Tracker"));
// @formatter:on
menu.addMenuClickHandler(49, (pl, slot, item, action) -> {
pl.closeInventory();
ChatUtils.sendURL(pl, "https://github.com/Slimefun/Slimefun4/issues");
return false;
});
} else {
menu.addItem(49, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
}
menu.addItem(51, new CustomItemStack(Material.TOTEM_OF_UNDYING, ChatColor.RED + locale.getMessage(p, "guide.work-in-progress")), (pl, slot, item, action) -> {
// Add something here
return false;
});
}
Aggregations