use of au.com.mineauz.minigames.menu.InteractionInterface in project Minigames by AddstarMC.
the class SpawnEntityAction method displayMenu.
@Override
public boolean displayMenu(MinigamePlayer player, Menu previous) {
Menu m = new Menu(3, "Spawn Entity", player);
m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, previous), m.getSize() - 9);
List<String> options = new ArrayList<>();
for (EntityType type : EntityType.values()) {
if (type != EntityType.ITEM_FRAME && type != EntityType.LEASH_HITCH && type != EntityType.PLAYER && type != EntityType.COMPLEX_PART && type != EntityType.WEATHER && type != EntityType.LIGHTNING && type != EntityType.PAINTING && type != EntityType.UNKNOWN && type != EntityType.DROPPED_ITEM)
options.add(MinigameUtils.capitalize(type.toString().replace("_", " ")));
}
m.addItem(new MenuItemList("Entity Type", Material.SKULL_ITEM, new Callback<String>() {
@Override
public void setValue(String value) {
type.setFlag(value.toUpperCase().replace(" ", "_"));
settings.clear();
addBaseSettings();
}
@Override
public String getValue() {
return MinigameUtils.capitalize(type.getFlag().replace("_", " "));
}
}, options));
m.addItem(new MenuItemDecimal("X Velocity", Material.ARROW, new Callback<Double>() {
@Override
public void setValue(Double value) {
settings.put("velocityx", value.toString());
}
@Override
public Double getValue() {
return Double.valueOf(settings.get("velocityx"));
}
}, 0.5, 1, null, null));
m.addItem(new MenuItemDecimal("Y Velocity", Material.ARROW, new Callback<Double>() {
@Override
public void setValue(Double value) {
settings.put("velocityy", value.toString());
}
@Override
public Double getValue() {
return Double.valueOf(settings.get("velocityy"));
}
}, 0.5, 1, null, null));
m.addItem(new MenuItemDecimal("Z Velocity", Material.ARROW, new Callback<Double>() {
@Override
public void setValue(Double value) {
settings.put("velocityz", value.toString());
}
@Override
public Double getValue() {
return Double.valueOf(settings.get("velocityz"));
}
}, 0.5, 1, null, null));
m.addItem(new MenuItemNewLine());
final Menu eSet = new Menu(3, "Settings", player);
final MenuItemPage backButton = new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, m);
final MenuItemCustom cus = new MenuItemCustom("Entity Settings", Material.CHEST);
final MinigamePlayer fply = player;
cus.setClick(new InteractionInterface() {
@Override
public Object interact(Object object) {
if (type.getFlag().equals("ZOMBIE")) {
eSet.clearMenu();
eSet.addItem(backButton, eSet.getSize() - 9);
livingEntitySettings(eSet);
eSet.displayMenu(fply);
return null;
}
return cus.getItem();
}
});
m.addItem(cus);
m.displayMenu(player);
return true;
}
use of au.com.mineauz.minigames.menu.InteractionInterface in project Minigames by AddstarMC.
the class RegionToolMode method onSetMode.
@Override
public void onSetMode(final MinigamePlayer player, MinigameTool tool) {
tool.addSetting("Region", "None");
final Menu m = new Menu(2, "Region Selection", player);
if (player.isInMenu()) {
m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, player.getMenu()), m.getSize() - 9);
}
final MinigameTool ftool = tool;
m.addItem(new MenuItemString("Region Name", Material.PAPER, new Callback<String>() {
@Override
public void setValue(String value) {
ftool.changeSetting("Region", value);
}
@Override
public String getValue() {
return ftool.getSetting("Region");
}
}));
if (tool.getMinigame() != null) {
// Node selection menu
RegionModule module = RegionModule.getMinigameModule(tool.getMinigame());
Menu regionMenu = new Menu(6, "Regions", player);
List<MenuItem> items = new ArrayList<MenuItem>();
for (final Region region : module.getRegions()) {
MenuItemCustom item = new MenuItemCustom(region.getName(), Material.CHEST);
// Set the node and go back to the main menu
item.setClick(new InteractionInterface() {
@Override
public Object interact(Object object) {
ftool.changeSetting("Region", region.getName());
m.displayMenu(player);
return object;
}
});
items.add(item);
}
regionMenu.addItems(items);
regionMenu.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, m), regionMenu.getSize() - 9);
m.addItem(new MenuItemPage("Edit Region", Material.CHEST, regionMenu));
}
m.displayMenu(player);
}
use of au.com.mineauz.minigames.menu.InteractionInterface in project Minigames by AddstarMC.
the class MenuItemRegionExecutor method onClick.
@Override
public ItemStack onClick() {
final MinigamePlayer fviewer = getContainer().getViewer();
Menu m = new Menu(3, "Executor", fviewer);
final Menu ffm = m;
MenuItemCustom ca = new MenuItemCustom("Actions", Material.CHEST);
ca.setClick(new InteractionInterface() {
@Override
public Object interact(Object object) {
Actions.displayMenu(fviewer, ex, ffm);
return null;
}
});
m.addItem(ca);
MenuItemCustom c2 = new MenuItemCustom("Conditions", Material.CHEST);
c2.setClick(new InteractionInterface() {
@Override
public Object interact(Object object) {
Conditions.displayMenu(fviewer, ex, ffm);
return null;
}
});
m.addItem(c2);
m.addItem(new MenuItemNewLine());
m.addItem(new MenuItemInteger("Trigger Count", MinigameUtils.stringToList("Number of times this;node can be;triggered"), Material.STONE, ex.getTriggerCountCallback(), 0, null));
m.addItem(new MenuItemBoolean("Trigger Per Player", MinigameUtils.stringToList("Whether this node;is triggered per player;or just on count"), Material.ENDER_PEARL, ex.getIsTriggerPerPlayerCallback()));
m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, getContainer()), m.getSize() - 9);
m.displayMenu(fviewer);
return null;
}
Aggregations