use of au.com.mineauz.minigames.menu.MenuItemToolMode in project Minigames by AddstarMC.
the class MinigameTool method openMenu.
public void openMenu(MinigamePlayer player) {
Menu men = new Menu(2, "Set Tool Mode", player);
final MenuItemCustom miselect = new MenuItemCustom("Select", MinigameUtils.stringToList("Selects and area;or points visually"), Material.DIAMOND_BLOCK);
final MenuItemCustom mideselect = new MenuItemCustom("Deselect", MinigameUtils.stringToList("Deselects an;area or points"), Material.GLASS);
final MinigamePlayer fply = player;
miselect.setClick(new InteractionInterface() {
@Override
public Object interact(Object object) {
if (mode != null) {
mode.select(fply, minigame, TeamsModule.getMinigameModule(minigame).getTeam(team));
}
return miselect.getItem();
}
});
mideselect.setClick(new InteractionInterface() {
@Override
public Object interact(Object object) {
if (mode != null) {
mode.deselect(fply, minigame, TeamsModule.getMinigameModule(minigame).getTeam(team));
}
return mideselect.getItem();
}
});
men.addItem(mideselect, men.getSize() - 1);
men.addItem(miselect, men.getSize() - 2);
List<String> teams = new ArrayList<String>(TeamColor.values().length + 1);
for (TeamColor col : TeamColor.values()) teams.add(MinigameUtils.capitalize(col.toString().replace("_", " ")));
teams.add("None");
men.addItem(new MenuItemToolTeam("Team", Material.PAPER, new Callback<String>() {
@Override
public void setValue(String value) {
setTeam(TeamColor.matchColor(value.replace(" ", "_")));
}
@Override
public String getValue() {
if (getTeam() != null)
return MinigameUtils.capitalize(getTeam().toString().replace("_", " "));
return "None";
}
}, teams), men.getSize() - 3);
for (ToolMode m : ToolModes.getToolModes()) {
men.addItem(new MenuItemToolMode(m.getDisplayName(), MinigameUtils.stringToList(m.getDescription()), m.getIcon(), m));
}
men.displayMenu(player);
}
Aggregations