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));
});
}
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);
});
}
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);
});
}
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();
}
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);
}
Aggregations