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;
}
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;
}
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;
}
}
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;
}
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;
}
Aggregations