Search in sources :

Example 31 with GuiItem

use of com.github.stefvanschie.inventoryframework.gui.GuiItem in project EmployMe by DavidTheExplorer.

the class ItemsRewardOfferGUI method createConfirmationButton.

/*
	 * Buttons
	 */
private GuiItem createConfirmationButton() {
    ItemStack buttonItem = new ItemBuilder(Material.GREEN_TERRACOTTA).named(this.messageService.getMessage(INVENTORY_ITEMS_REWARD_OFFER_CONFIRMATION_ITEM_NAME).first()).withLore(this.messageService.getMessage(INVENTORY_ITEMS_REWARD_OFFER_CONFIRMATION_ITEM_LORE).toArray()).createCopy();
    this.confirmationButton = buttonItem;
    return new GuiItem(buttonItem, event -> {
        Player player = (Player) event.getWhoClicked();
        List<ItemStack> offeredItems = getOfferedItems();
        // block confirming if the player didn't offer anything
        if (offeredItems.isEmpty())
            return;
        // disable the item return mechanism
        setOnClose(closeEvent -> {
        });
        // open the Goal Customization GUI
        ItemsReward itemsReward = new ItemsReward(offeredItems, this.playerContainerService);
        GoalCustomizationGUI goalCustomizationGUI = new GoalCustomizationGUI(this.messageService, this.rewardService, this.jobBoard, itemsReward);
        Bukkit.getScheduler().runTask(EmployMe.getInstance(), () -> goalCustomizationGUI.show(player));
    });
}
Also used : ItemsReward(dte.employme.job.rewards.ItemsReward) ItemBuilder(dte.employme.utils.items.ItemBuilder) GuiItem(com.github.stefvanschie.inventoryframework.gui.GuiItem) Player(org.bukkit.entity.Player) ItemStack(org.bukkit.inventory.ItemStack)

Example 32 with GuiItem

use of com.github.stefvanschie.inventoryframework.gui.GuiItem in project EmployMe by DavidTheExplorer.

the class JobBoardGUI method createPersonalJobsItem.

private GuiItem createPersonalJobsItem() {
    ItemStack item = new ItemBuilder(Material.PLAYER_HEAD).named(this.messageService.getMessage(INVENTORY_JOB_BOARD_PERSONAL_JOBS_ITEM_NAME).first()).withItemMeta(SkullMeta.class, meta -> meta.setOwningPlayer(this.player)).withLore(this.messageService.getMessage(INVENTORY_JOB_BOARD_PERSONAL_JOBS_ITEM_LORE).toArray()).createCopy();
    return new GuiItem(item, event -> {
        List<Job> playerJobs = this.jobBoard.getJobsOfferedBy(this.player.getUniqueId());
        new PlayerJobsGUI(this, this.messageService, playerJobs, this.orderComparator, this.jobIconFactory).show(this.player);
    });
}
Also used : ItemBuilder(dte.employme.utils.items.ItemBuilder) GuiItem(com.github.stefvanschie.inventoryframework.gui.GuiItem) ItemStack(org.bukkit.inventory.ItemStack) Job(dte.employme.job.Job)

Example 33 with GuiItem

use of com.github.stefvanschie.inventoryframework.gui.GuiItem in project EmployMe by DavidTheExplorer.

the class GoalCustomizationGUI method createAmountItem.

private GuiItem createAmountItem() {
    return new GuiItem(new ItemBuilder(Material.ARROW).named(this.messageService.getMessage(INVENTORY_GOAL_CUSTOMIZATION_AMOUNT_ITEM_NAME).inject(GOAL_AMOUNT, String.valueOf(this.amount)).first()).withLore(this.messageService.getMessage(INVENTORY_GOAL_CUSTOMIZATION_AMOUNT_ITEM_LORE).toArray()).glowing().createCopy(), event -> {
        HumanEntity player = event.getWhoClicked();
        closeWithoutRefund(player);
        new GoalAmountGUI(this, this.messageService).show(player);
    });
}
Also used : GuiItem(com.github.stefvanschie.inventoryframework.gui.GuiItem) ItemBuilder(dte.employme.utils.items.ItemBuilder) HumanEntity(org.bukkit.entity.HumanEntity)

Example 34 with GuiItem

use of com.github.stefvanschie.inventoryframework.gui.GuiItem in project EmployMe by DavidTheExplorer.

the class GoalCustomizationGUI method updateCurrentItem.

private void updateCurrentItem(UnaryOperator<ItemStack> update) {
    GuiItem updatedItem = new GuiItem(update.apply(getCurrentItem()));
    this.itemPane.addItem(this.currentItem = updatedItem, 1, 1);
    update();
}
Also used : GuiItem(com.github.stefvanschie.inventoryframework.gui.GuiItem)

Example 35 with GuiItem

use of com.github.stefvanschie.inventoryframework.gui.GuiItem in project Nodewar by Rosstail.

the class PlayerAdminEmpireGUIs method initGUI.

public static void initGUI(Player player, fr.rosstail.nodewar.Nodewar plugin, ChestGui previousGui, Player target) {
    int invSize = 6;
    String display = target.getName() + "'s Empires - Page 1";
    ChestGui gui = new ChestGui(invSize, AdaptMessage.playerMessage(player, display));
    PaginatedPane paginatedPane = new PaginatedPane(0, 0, 9, invSize);
    OutlinePane background = new OutlinePane(0, 0, 9, gui.getRows(), Pane.Priority.LOWEST);
    background.addItem(new GuiItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE)));
    background.setRepeat(true);
    gui.addPane(background);
    int page = 0;
    while (true) {
        StaticPane staticPane = initPane(player, plugin, gui, previousGui, paginatedPane, target, page);
        paginatedPane.addPane(page, staticPane);
        if (staticPane.getItems().size() < 47) {
            // 9 * 5 lines + 2 buttons
            break;
        }
        page++;
    }
    gui.setOnGlobalClick(event -> {
        event.setCancelled(true);
    });
    gui.addPane(paginatedPane);
    gui.show(player);
}
Also used : ChestGui(com.github.stefvanschie.inventoryframework.gui.type.ChestGui) GuiItem(com.github.stefvanschie.inventoryframework.gui.GuiItem) PaginatedPane(com.github.stefvanschie.inventoryframework.pane.PaginatedPane) OutlinePane(com.github.stefvanschie.inventoryframework.pane.OutlinePane) StaticPane(com.github.stefvanschie.inventoryframework.pane.StaticPane) ItemStack(org.bukkit.inventory.ItemStack)

Aggregations

GuiItem (com.github.stefvanschie.inventoryframework.gui.GuiItem)46 ItemStack (org.bukkit.inventory.ItemStack)34 ChestGui (com.github.stefvanschie.inventoryframework.gui.type.ChestGui)28 OutlinePane (com.github.stefvanschie.inventoryframework.pane.OutlinePane)25 StaticPane (com.github.stefvanschie.inventoryframework.pane.StaticPane)21 Player (org.bukkit.entity.Player)20 Material (org.bukkit.Material)18 PaginatedPane (com.github.stefvanschie.inventoryframework.pane.PaginatedPane)15 Pane (com.github.stefvanschie.inventoryframework.pane.Pane)11 ItemBuilder (dte.employme.utils.items.ItemBuilder)11 GUIs (fr.rosstail.nodewar.guis.GUIs)9 AdaptMessage (fr.rosstail.nodewar.lang.AdaptMessage)9 Nodewar (fr.rosstail.nodewar.Nodewar)7 YamlConfiguration (org.bukkit.configuration.file.YamlConfiguration)7 HumanEntity (org.bukkit.entity.HumanEntity)7 ArrayList (java.util.ArrayList)6 List (java.util.List)5 ChatColor (org.bukkit.ChatColor)5 NotNull (org.jetbrains.annotations.NotNull)5 Main (com.gmail.stefvanschiedev.buildinggame.Main)4