use of au.com.mineauz.minigames.menu.MenuItemBack in project Minigames by AddstarMC.
the class MinigameStats method createStatFieldSelectMenu.
/**
* Creates a menu that allows you to select a statistic field
* @param parent The parent menu
* @param format The format to define the fields available
* @param callback The callback to be invoked when the field is chosen. Note: only the setValue() method will be called.
* @return The menu to display
*/
public static Menu createStatFieldSelectMenu(final Menu parent, StatFormat format, final Callback<StatValueField> callback) {
final Menu submenu = new Menu(6, "Select Statistic Field", parent.getViewer());
for (final StatValueField field : format.getFields()) {
MenuItemCustom item = new MenuItemCustom(WordUtils.capitalizeFully(field.name()), Material.PAPER);
item.setClick(new InteractionInterface() {
@Override
public Object interact(Object object) {
callback.setValue(field);
parent.displayMenu(submenu.getViewer());
return null;
}
});
submenu.addItem(item);
}
submenu.addItem(new MenuItemBack(parent), submenu.getSize() - 9);
return submenu;
}
use of au.com.mineauz.minigames.menu.MenuItemBack in project Minigames by AddstarMC.
the class HierarchyRewardScheme method showRewardsMenu.
private void showRewardsMenu(TreeMap<T, Rewards> rewards, MinigamePlayer player, Menu parent) {
Menu submenu = new Menu(6, "Rewards", player);
for (T key : rewards.keySet()) {
submenu.addItem(new MenuItemRewardPair(rewards, key, Material.CHEST));
}
submenu.addItem(new MenuItemAddReward(rewards, "Add Reward Set", Material.ITEM_FRAME), submenu.getSize() - 2);
submenu.addItem(new MenuItemBack(parent), submenu.getSize() - 1);
submenu.setPreviousPage(parent);
submenu.displayMenu(player);
}
use of au.com.mineauz.minigames.menu.MenuItemBack in project Minigames by AddstarMC.
the class MenuItemRegionExecutorAdd method onClick.
@Override
public ItemStack onClick() {
Menu m = new Menu(6, "Select Trigger", getContainer().getViewer());
List<String> triggers = new ArrayList<String>(Triggers.getAllRegionTriggers());
Collections.sort(triggers);
for (String trig : triggers) {
m.addItem(new MenuItemTrigger(Triggers.getTrigger(trig), region, getContainer()));
}
m.addItem(new MenuItemBack(getContainer()), m.getSize() - 9);
m.displayMenu(getContainer().getViewer());
return null;
}
use of au.com.mineauz.minigames.menu.MenuItemBack in project Minigames by AddstarMC.
the class RewardsModule method createSubMenu.
private Menu createSubMenu(final Menu parent) {
final Menu submenu = new Menu(6, "Reward Settings", parent.getViewer());
scheme.addMenuItems(submenu);
submenu.addItem(RewardSchemes.newMenuItem("Reward Scheme", Material.PAPER, new Callback<Class<? extends RewardScheme>>() {
@Override
public void setValue(Class<? extends RewardScheme> value) {
scheme = RewardSchemes.createScheme(value);
// Update the menu
Menu menu = createSubMenu(parent);
menu.displayMenu(submenu.getViewer());
}
@Override
public Class<? extends RewardScheme> getValue() {
return scheme.getClass();
}
}), submenu.getSize() - 1);
submenu.addItem(new MenuItemBack(parent), submenu.getSize() - 9);
return submenu;
}
use of au.com.mineauz.minigames.menu.MenuItemBack in project Minigames by AddstarMC.
the class MenuItemNodeExecutorAdd method onClick.
@Override
public ItemStack onClick() {
Menu m = new Menu(6, "Select Trigger", getContainer().getViewer());
List<String> triggers = new ArrayList<String>(Triggers.getAllNodeTriggers());
Collections.sort(triggers);
for (String trig : triggers) {
m.addItem(new MenuItemTrigger(Triggers.getTrigger(trig), node, getContainer()));
}
m.addItem(new MenuItemBack(getContainer()), m.getSize() - 9);
m.displayMenu(getContainer().getViewer());
return null;
}
Aggregations