use of au.com.mineauz.minigames.menu.MenuItemBack in project Minigames by AddstarMC.
the class MinigameStats method createStatSelectMenu.
/**
* Creates a menu that allows you to select a statistic
* @param parent The parent menu
* @param statCallback The callback to be invoked when the statistic is chosen. Note: only the setValue() method will be called.
* @return The menu to display
*/
public static Menu createStatSelectMenu(final Menu parent, final Callback<MinigameStat> statCallback) {
final Menu submenu = new Menu(6, "Select Statistic", parent.getViewer());
for (final MinigameStat stat : getAllStats().values()) {
MenuItemCustom item = new MenuItemCustom(WordUtils.capitalizeFully(stat.getDisplayName()), Material.BOOK_AND_QUILL);
item.setClick(new InteractionInterface() {
@Override
public Object interact(Object object) {
statCallback.setValue(stat);
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 GiveItemAction method displayMenu.
@Override
public boolean displayMenu(final MinigamePlayer player, Menu previous) {
Menu m = new Menu(3, "Give Item", player);
m.addItem(new MenuItemBack(previous), m.getSize() - 9);
MenuItemString n = (MenuItemString) name.getMenuItem("Name", Material.NAME_TAG);
n.setAllowNull(true);
m.addItem(n);
MenuItemString l = (MenuItemString) lore.getMenuItem("Lore", Material.PAPER, MinigameUtils.stringToList("Separate with semi-colons;for new lines"));
l.setAllowNull(true);
m.addItem(l);
m.addItem(new MenuItemString("Type", Material.STONE, new Callback<String>() {
@Override
public void setValue(String value) {
if (Material.getMaterial(value.toUpperCase()) != null) {
type.setFlag(value.toUpperCase());
} else
player.sendMessage("Invalid item type!", "error");
}
@Override
public String getValue() {
return type.getFlag();
}
}));
m.addItem(count.getMenuItem("Count", Material.STEP, 1, 64));
m.addItem(damage.getMenuItem("Damage", Material.COBBLESTONE, 0, null));
m.displayMenu(player);
return true;
}
use of au.com.mineauz.minigames.menu.MenuItemBack in project Minigames by AddstarMC.
the class SetEnabledAction method displayMenu.
@Override
public boolean displayMenu(MinigamePlayer player, Menu previous) {
Menu m = new Menu(3, "Set Enabled", player);
m.addItem(new MenuItemBack(previous), m.getSize() - 9);
m.addItem(state.getMenuItem("Set Enabled", Material.ENDER_PEARL));
m.displayMenu(player);
return true;
}
Aggregations