Search in sources :

Example 16 with Callback

use of au.com.mineauz.minigames.menu.Callback in project Minigames by AddstarMC.

the class MatchTeamCondition method displayMenu.

@Override
public boolean displayMenu(MinigamePlayer player, Menu prev) {
    Menu m = new Menu(3, "Match Team", player);
    m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, prev), m.getSize() - 9);
    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));
    addInvertMenuItem(m);
    m.displayMenu(player);
    return true;
}
Also used : Callback(au.com.mineauz.minigames.menu.Callback) MenuItemList(au.com.mineauz.minigames.menu.MenuItemList) MenuItemPage(au.com.mineauz.minigames.menu.MenuItemPage) ArrayList(java.util.ArrayList) TeamColor(au.com.mineauz.minigames.minigame.TeamColor) Menu(au.com.mineauz.minigames.menu.Menu)

Example 17 with Callback

use of au.com.mineauz.minigames.menu.Callback in project Minigames by AddstarMC.

the class SpawnEntityAction method livingEntitySettings.

private void livingEntitySettings(Menu eSet) {
    settings.put("displayname", "");
    settings.put("displaynamevisible", "false");
    eSet.addItem(new MenuItemString("Display Name", Material.NAME_TAG, new Callback<String>() {

        @Override
        public void setValue(String value) {
            settings.put("displayname", value);
        }

        @Override
        public String getValue() {
            return settings.get("displayname");
        }
    }));
    eSet.addItem(new MenuItemBoolean("Display Name Visible", Material.ENDER_PEARL, new Callback<Boolean>() {

        @Override
        public void setValue(Boolean value) {
            settings.put("displaynamevisible", value.toString());
        }

        @Override
        public Boolean getValue() {
            return Boolean.valueOf(settings.get("displaynamevisible"));
        }
    }));
}
Also used : Callback(au.com.mineauz.minigames.menu.Callback) MenuItemBoolean(au.com.mineauz.minigames.menu.MenuItemBoolean) MenuItemString(au.com.mineauz.minigames.menu.MenuItemString) MenuItemBoolean(au.com.mineauz.minigames.menu.MenuItemBoolean) MenuItemString(au.com.mineauz.minigames.menu.MenuItemString)

Example 18 with Callback

use of au.com.mineauz.minigames.menu.Callback 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;
}
Also used : MinigamePlayer(au.com.mineauz.minigames.MinigamePlayer) MenuItemPage(au.com.mineauz.minigames.menu.MenuItemPage) ArrayList(java.util.ArrayList) MenuItemNewLine(au.com.mineauz.minigames.menu.MenuItemNewLine) MenuItemString(au.com.mineauz.minigames.menu.MenuItemString) MenuItemCustom(au.com.mineauz.minigames.menu.MenuItemCustom) EntityType(org.bukkit.entity.EntityType) Callback(au.com.mineauz.minigames.menu.Callback) MenuItemList(au.com.mineauz.minigames.menu.MenuItemList) InteractionInterface(au.com.mineauz.minigames.menu.InteractionInterface) Menu(au.com.mineauz.minigames.menu.Menu) MenuItemDecimal(au.com.mineauz.minigames.menu.MenuItemDecimal)

Example 19 with Callback

use of au.com.mineauz.minigames.menu.Callback in project Minigames by AddstarMC.

the class AddScoreAction method displayMenu.

@Override
public boolean displayMenu(MinigamePlayer player, Menu previous) {
    Menu m = new Menu(3, "Add Score", player);
    m.addItem(new MenuItemInteger("Add Score Amount", Material.ENDER_PEARL, new Callback<Integer>() {

        @Override
        public void setValue(Integer value) {
            amount.setFlag(value);
        }

        @Override
        public Integer getValue() {
            return amount.getFlag();
        }
    }, null, null));
    m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, previous), m.getSize() - 9);
    m.displayMenu(player);
    return true;
}
Also used : MenuItemInteger(au.com.mineauz.minigames.menu.MenuItemInteger) Callback(au.com.mineauz.minigames.menu.Callback) MenuItemInteger(au.com.mineauz.minigames.menu.MenuItemInteger) MenuItemPage(au.com.mineauz.minigames.menu.MenuItemPage) Menu(au.com.mineauz.minigames.menu.Menu)

Example 20 with Callback

use of au.com.mineauz.minigames.menu.Callback in project Minigames by AddstarMC.

the class ApplyPotionAction method displayMenu.

@Override
public boolean displayMenu(MinigamePlayer player, Menu previous) {
    Menu m = new Menu(3, "Apply Potion", player);
    m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, previous), m.getSize() - 9);
    List<String> pots = new ArrayList<>(PotionEffectType.values().length);
    for (PotionEffectType type : PotionEffectType.values()) {
        if (type != null) {
            pots.add(MinigameUtils.capitalize(type.getName().replace("_", " ")));
        }
    }
    m.addItem(new MenuItemList("Potion Type", Material.POTION, new Callback<String>() {

        @Override
        public void setValue(String value) {
            type.setFlag(value.toUpperCase().replace(" ", "_"));
        }

        @Override
        public String getValue() {
            return MinigameUtils.capitalize(type.getFlag().replace("_", " "));
        }
    }, pots));
    m.addItem(new MenuItemTime("Duration", Material.WATCH, new Callback<Integer>() {

        @Override
        public void setValue(Integer value) {
            dur.setFlag(value);
        }

        @Override
        public Integer getValue() {
            return dur.getFlag();
        }
    }, 0, 86400));
    m.addItem(new MenuItemInteger("Level", Material.STONE, new Callback<Integer>() {

        @Override
        public void setValue(Integer value) {
            amp.setFlag(value);
        }

        @Override
        public Integer getValue() {
            return amp.getFlag();
        }
    }, 0, 100));
    m.displayMenu(player);
    return true;
}
Also used : MenuItemInteger(au.com.mineauz.minigames.menu.MenuItemInteger) Callback(au.com.mineauz.minigames.menu.Callback) MenuItemList(au.com.mineauz.minigames.menu.MenuItemList) MenuItemInteger(au.com.mineauz.minigames.menu.MenuItemInteger) PotionEffectType(org.bukkit.potion.PotionEffectType) MenuItemPage(au.com.mineauz.minigames.menu.MenuItemPage) MenuItemTime(au.com.mineauz.minigames.menu.MenuItemTime) ArrayList(java.util.ArrayList) Menu(au.com.mineauz.minigames.menu.Menu)

Aggregations

Callback (au.com.mineauz.minigames.menu.Callback)23 Menu (au.com.mineauz.minigames.menu.Menu)22 MenuItemPage (au.com.mineauz.minigames.menu.MenuItemPage)17 MenuItemString (au.com.mineauz.minigames.menu.MenuItemString)12 ArrayList (java.util.ArrayList)12 MenuItemList (au.com.mineauz.minigames.menu.MenuItemList)11 InteractionInterface (au.com.mineauz.minigames.menu.InteractionInterface)6 MenuItemCustom (au.com.mineauz.minigames.menu.MenuItemCustom)6 MinigamePlayer (au.com.mineauz.minigames.MinigamePlayer)5 MenuItemInteger (au.com.mineauz.minigames.menu.MenuItemInteger)5 TeamColor (au.com.mineauz.minigames.minigame.TeamColor)5 MenuItemNewLine (au.com.mineauz.minigames.menu.MenuItemNewLine)4 MenuItem (au.com.mineauz.minigames.menu.MenuItem)3 MenuItemBack (au.com.mineauz.minigames.menu.MenuItemBack)3 MenuItemBoolean (au.com.mineauz.minigames.menu.MenuItemBoolean)3 MenuItemDecimal (au.com.mineauz.minigames.menu.MenuItemDecimal)2 MenuItemTime (au.com.mineauz.minigames.menu.MenuItemTime)2 MinigameTool (au.com.mineauz.minigames.tool.MinigameTool)2 FutureCallback (com.google.common.util.concurrent.FutureCallback)2 MinigameType (au.com.mineauz.minigames.gametypes.MinigameType)1