use of au.com.mineauz.minigames.menu.MenuItemPage in project Minigames by AddstarMC.
the class TeamPlayerCountCondition method displayMenu.
@Override
public boolean displayMenu(MinigamePlayer player, Menu prev) {
Menu m = new Menu(3, "Player Count", player);
m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, prev), m.getSize() - 9);
m.addItem(min.getMenuItem("Min Player Count", Material.STEP, 1, null));
m.addItem(max.getMenuItem("Max Player Count", Material.STONE, 1, null));
addInvertMenuItem(m);
m.displayMenu(player);
return true;
}
use of au.com.mineauz.minigames.menu.MenuItemPage in project Minigames by AddstarMC.
the class TeamScoreRangeCondition method displayMenu.
@Override
public boolean displayMenu(MinigamePlayer player, Menu prev) {
Menu m = new Menu(3, "Team Score Range", player);
m.addItem(min.getMenuItem("Minimum Score", Material.STEP, 0, null));
m.addItem(max.getMenuItem("Maximum Score", Material.STONE, 0, null));
List<String> teams = new ArrayList<String>();
for (TeamColor t : TeamColor.values()) teams.add(MinigameUtils.capitalize(t.toString().replace("_", " ")));
m.addItem(new MenuItemList("Team Color", Material.WOOL, new Callback<String>() {
@Override
public void setValue(String value) {
team.setFlag(value.toUpperCase().replace(" ", "_"));
}
@Override
public String getValue() {
return MinigameUtils.capitalize(team.getFlag().replace("_", " "));
}
}, teams));
m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, prev), m.getSize() - 9);
addInvertMenuItem(m);
m.displayMenu(player);
return true;
}
use of au.com.mineauz.minigames.menu.MenuItemPage in project Minigames by AddstarMC.
the class MenuItemActionAdd method onClick.
@Override
public ItemStack onClick() {
Menu m = new Menu(6, "Actions", getContainer().getViewer());
m.setPreviousPage(getContainer());
Map<String, Menu> cats = new HashMap<>();
List<String> acts = new ArrayList<>(Actions.getAllActionNames());
Collections.sort(acts);
for (String act : acts) {
if ((Actions.getActionByName(act).useInNodes() && exec != null) || (Actions.getActionByName(act).useInRegions() && exec != null)) {
String catname = Actions.getActionByName(act).getCategory();
if (catname == null)
catname = "misc actions";
catname = catname.toLowerCase();
Menu cat;
if (!cats.containsKey(catname)) {
cat = new Menu(6, MinigameUtils.capitalize(catname), getContainer().getViewer());
cats.put(catname, cat);
m.addItem(new MenuItemPage(MinigameUtils.capitalize(catname), Material.CHEST, cat));
cat.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, m), cat.getSize() - 9);
} else
cat = cats.get(catname);
MenuItemCustom c = new MenuItemCustom(MinigameUtils.capitalize(act), Material.PAPER);
final String fact = act;
c.setClick(new InteractionInterface() {
@Override
public Object interact(Object object) {
ActionInterface action = Actions.getActionByName(fact);
if (exec == null) {
exec.addAction(action);
getContainer().addItem(new MenuItemAction(MinigameUtils.capitalize(fact), Material.PAPER, exec, action));
getContainer().displayMenu(getContainer().getViewer());
} else {
exec.addAction(action);
getContainer().addItem(new MenuItemAction(MinigameUtils.capitalize(fact), Material.PAPER, exec, action));
getContainer().displayMenu(getContainer().getViewer());
}
return null;
}
});
cat.addItem(c);
}
}
m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, getContainer()), m.getSize() - 9);
m.displayMenu(getContainer().getViewer());
return null;
}
use of au.com.mineauz.minigames.menu.MenuItemPage in project Minigames by AddstarMC.
the class MenuItemNode method createMenu.
public static Menu createMenu(MinigamePlayer viewer, Menu previousPage, Node node) {
Menu m = new Menu(3, "Node: " + node.getName(), viewer);
m.setPreviousPage(previousPage);
List<MenuItem> items = new ArrayList<>();
for (NodeExecutor ex : node.getExecutors()) {
items.add(new MenuItemNodeExecutor(node, ex));
}
if (previousPage != null) {
m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, previousPage), m.getSize() - 9);
}
m.addItem(new MenuItemNodeExecutorAdd("Add Executor", Material.ITEM_FRAME, node), m.getSize() - 1);
m.addItems(items);
return m;
}
use of au.com.mineauz.minigames.menu.MenuItemPage in project Minigames by AddstarMC.
the class MenuItemRegion method createMenu.
public static Menu createMenu(MinigamePlayer viewer, Menu previousPage, Region region) {
Menu m = new Menu(3, "Region: " + region.getName(), viewer);
m.setPreviousPage(previousPage);
List<MenuItem> items = new ArrayList<>();
for (RegionExecutor ex : region.getExecutors()) {
items.add(new MenuItemRegionExecutor(region, ex));
}
if (previousPage != null) {
m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, previousPage), m.getSize() - 9);
}
m.addItem(new MenuItemRegionExecutorAdd("Add Executor", Material.ITEM_FRAME, region), m.getSize() - 1);
m.addItems(items);
return m;
}
Aggregations