Search in sources :

Example 1 with GitHubService

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;
    });
}
Also used : GitHubService(io.github.thebusybiscuit.slimefun4.core.services.github.GitHubService) NumberUtils(io.github.thebusybiscuit.slimefun4.utils.NumberUtils) SlimefunUtils(io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils) ChestMenuUtils(io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils) GitHubService(io.github.thebusybiscuit.slimefun4.core.services.github.GitHubService) Sound(org.bukkit.Sound) Player(org.bukkit.entity.Player) Research(io.github.thebusybiscuit.slimefun4.api.researches.Research) ParametersAreNonnullByDefault(javax.annotation.ParametersAreNonnullByDefault) ChatUtils(io.github.thebusybiscuit.slimefun4.utils.ChatUtils) ArrayList(java.util.ArrayList) ItemStack(org.bukkit.inventory.ItemStack) List(java.util.List) Language(io.github.thebusybiscuit.slimefun4.core.services.localization.Language) LocalizationService(io.github.thebusybiscuit.slimefun4.core.services.LocalizationService) Slimefun(io.github.thebusybiscuit.slimefun4.implementation.Slimefun) SlimefunGuideMode(io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode) Optional(java.util.Optional) ChestMenu(me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu) ChatColor(org.bukkit.ChatColor) SlimefunGuide(io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide) Nonnull(javax.annotation.Nonnull) CustomItemStack(io.github.bakedlibs.dough.items.CustomItemStack) Material(org.bukkit.Material) Bukkit(org.bukkit.Bukkit) LocalizationService(io.github.thebusybiscuit.slimefun4.core.services.LocalizationService) CustomItemStack(io.github.bakedlibs.dough.items.CustomItemStack) ArrayList(java.util.ArrayList) ParametersAreNonnullByDefault(javax.annotation.ParametersAreNonnullByDefault)

Aggregations

CustomItemStack (io.github.bakedlibs.dough.items.CustomItemStack)1 Research (io.github.thebusybiscuit.slimefun4.api.researches.Research)1 SlimefunGuide (io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide)1 SlimefunGuideMode (io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode)1 LocalizationService (io.github.thebusybiscuit.slimefun4.core.services.LocalizationService)1 GitHubService (io.github.thebusybiscuit.slimefun4.core.services.github.GitHubService)1 Language (io.github.thebusybiscuit.slimefun4.core.services.localization.Language)1 Slimefun (io.github.thebusybiscuit.slimefun4.implementation.Slimefun)1 ChatUtils (io.github.thebusybiscuit.slimefun4.utils.ChatUtils)1 ChestMenuUtils (io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils)1 NumberUtils (io.github.thebusybiscuit.slimefun4.utils.NumberUtils)1 SlimefunUtils (io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Optional (java.util.Optional)1 Nonnull (javax.annotation.Nonnull)1 ParametersAreNonnullByDefault (javax.annotation.ParametersAreNonnullByDefault)1 ChestMenu (me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu)1 Bukkit (org.bukkit.Bukkit)1 ChatColor (org.bukkit.ChatColor)1