Search in sources :

Example 96 with MinigamePlayer

use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.

the class ContainsOneTeamCondition method checkRegionCondition.

@Override
public boolean checkRegionCondition(MinigamePlayer player, Region region) {
    boolean ret = true;
    Team last = player.getTeam();
    if (last == null)
        return true;
    for (MinigamePlayer p : region.getPlayers()) {
        if (last != p.getTeam()) {
            ret = false;
            break;
        }
    }
    return ret;
}
Also used : MinigamePlayer(au.com.mineauz.minigames.objects.MinigamePlayer) Team(au.com.mineauz.minigames.minigame.Team)

Example 97 with MinigamePlayer

use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.

the class MatchBlockCondition method displayMenu.

@Override
public boolean displayMenu(MinigamePlayer player, Menu prev) {
    Menu m = new Menu(3, "Match Block", player);
    m.addItem(new MenuItemPage("Back", MenuUtility.getBackMaterial(), prev), m.getSize() - 9);
    final MenuItemCustom c = new MenuItemCustom("Auto Set Block", MinigameUtils.stringToList("Click here with a;block you wish to;match to."), Material.ITEM_FRAME);
    m.addItem(c, m.getSize() - 1);
    final MinigamePlayer ply = m.getViewer();
    final MenuItemBlockData btype = new MenuItemBlockData("Block Type", Material.STONE, new Callback<BlockData>() {

        @Override
        public void setValue(BlockData value) {
            type.setFlag(value);
        }

        @Override
        public BlockData getValue() {
            return type.getFlag();
        }
    });
    m.addItem(btype);
    final MenuItemBoolean busedur = (MenuItemBoolean) useBlockData.getMenuItem("Use Data Values", Material.ENDER_PEARL);
    m.addItem(busedur);
    c.setClickItem(object -> {
        ItemStack i = (ItemStack) object;
        try {
            type.setFlag(i.getType().createBlockData());
            useBlockData.setFlag(true);
        } catch (IllegalArgumentException e) {
            c.getContainer().getViewer().sendMessage("That item is not a block", MinigameMessageType.ERROR);
        }
        useBlockData.setFlag(true);
        busedur.updateDescription();
        btype.update();
        return c.getItem();
    });
    addInvertMenuItem(m);
    m.displayMenu(player);
    return true;
}
Also used : MinigamePlayer(au.com.mineauz.minigames.objects.MinigamePlayer) BlockData(org.bukkit.block.data.BlockData) ItemStack(org.bukkit.inventory.ItemStack)

Example 98 with MinigamePlayer

use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.

the class PlayerFoodRangeCondition method checkCondition.

private boolean checkCondition(MinigamePlayer player) {
    if (player == null || !player.isInMinigame()) {
        return false;
    }
    Player p = player.getPlayer();
    int food = p.getFoodLevel();
    if (food >= min.getFlag() && food <= max.getFlag()) {
        return true;
    } else {
        return true;
    }
}
Also used : Player(org.bukkit.entity.Player) MinigamePlayer(au.com.mineauz.minigames.objects.MinigamePlayer)

Example 99 with MinigamePlayer

use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.

the class MenuItemNodeExecutor 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(object -> {
        Actions.displayMenu(fviewer, ex, ffm);
        return null;
    });
    m.addItem(ca);
    MenuItemCustom c2 = new MenuItemCustom("Conditions", Material.CHEST);
    c2.setClick(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", MenuUtility.getBackMaterial(), getContainer()), m.getSize() - 9);
    m.displayMenu(fviewer);
    return null;
}
Also used : MinigamePlayer(au.com.mineauz.minigames.objects.MinigamePlayer) MenuItemInteger(au.com.mineauz.minigames.menu.MenuItemInteger) MenuItemPage(au.com.mineauz.minigames.menu.MenuItemPage) MenuItemNewLine(au.com.mineauz.minigames.menu.MenuItemNewLine) MenuItemBoolean(au.com.mineauz.minigames.menu.MenuItemBoolean) Menu(au.com.mineauz.minigames.menu.Menu) MenuItemCustom(au.com.mineauz.minigames.menu.MenuItemCustom)

Example 100 with MinigamePlayer

use of au.com.mineauz.minigames.objects.MinigamePlayer 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(object -> {
        Actions.displayMenu(fviewer, ex, ffm);
        return null;
    });
    m.addItem(ca);
    MenuItemCustom c2 = new MenuItemCustom("Conditions", Material.CHEST);
    c2.setClick(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", MenuUtility.getBackMaterial(), getContainer()), m.getSize() - 9);
    m.displayMenu(fviewer);
    return null;
}
Also used : MinigamePlayer(au.com.mineauz.minigames.objects.MinigamePlayer) MenuItemInteger(au.com.mineauz.minigames.menu.MenuItemInteger) MenuItemPage(au.com.mineauz.minigames.menu.MenuItemPage) MenuItemNewLine(au.com.mineauz.minigames.menu.MenuItemNewLine) MenuItemBoolean(au.com.mineauz.minigames.menu.MenuItemBoolean) Menu(au.com.mineauz.minigames.menu.Menu) MenuItemCustom(au.com.mineauz.minigames.menu.MenuItemCustom)

Aggregations

MinigamePlayer (au.com.mineauz.minigames.objects.MinigamePlayer)134 EventHandler (org.bukkit.event.EventHandler)46 Minigame (au.com.mineauz.minigames.minigame.Minigame)40 ArrayList (java.util.ArrayList)25 Team (au.com.mineauz.minigames.minigame.Team)24 OfflineMinigamePlayer (au.com.mineauz.minigames.objects.OfflineMinigamePlayer)15 Player (org.bukkit.entity.Player)15 Location (org.bukkit.Location)11 ItemStack (org.bukkit.inventory.ItemStack)8 MinigameTool (au.com.mineauz.minigames.tool.MinigameTool)7 Menu (au.com.mineauz.minigames.menu.Menu)5 TeamColor (au.com.mineauz.minigames.minigame.TeamColor)5 List (java.util.List)5 PotionEffect (org.bukkit.potion.PotionEffect)5 ResourcePack (au.com.mineauz.minigames.objects.ResourcePack)4 Material (org.bukkit.Material)4 Sign (org.bukkit.block.Sign)4 MenuItemCustom (au.com.mineauz.minigames.menu.MenuItemCustom)3 MenuItem (au.com.mineauz.minigames.menu.MenuItem)2 MenuItemBoolean (au.com.mineauz.minigames.menu.MenuItemBoolean)2