use of au.com.mineauz.minigames.PlayerLoadout in project Minigames by AddstarMC.
the class EquipLoadoutAction method executeRegionAction.
@Override
public void executeRegionAction(MinigamePlayer player, Region region) {
debug(player, region);
if (player == null || !player.isInMinigame())
return;
LoadoutModule lmod = LoadoutModule.getMinigameModule(player.getMinigame());
if (lmod.hasLoadout(loadout.getFlag())) {
PlayerLoadout pLoadOut = lmod.getLoadout(loadout.getFlag());
player.setLoadout(pLoadOut);
pLoadOut.equiptLoadout(player);
}
}
use of au.com.mineauz.minigames.PlayerLoadout in project Minigames by AddstarMC.
the class LoadoutModule method displaySelectionMenu.
public void displaySelectionMenu(MinigamePlayer player, final boolean equip) {
Menu m = new Menu(6, "Select Loadout", player);
final MinigamePlayer fply = player;
for (PlayerLoadout loadout : extraLoadouts.values()) {
if (loadout.isDisplayedInMenu()) {
if (!loadout.getUsePermissions() || player.getPlayer().hasPermission("minigame.loadout." + loadout.getName(false).toLowerCase())) {
if (!player.getMinigame().isTeamGame() || loadout.getTeamColor() == null || player.getTeam().getColor() == loadout.getTeamColor()) {
MenuItemCustom c = new MenuItemCustom(loadout.getName(true), Material.GLASS);
if (!loadout.getItems().isEmpty()) {
ItemStack item = loadout.getItem(new ArrayList<>(loadout.getItems()).get(0));
c.setItem(item);
}
final PlayerLoadout floadout2 = loadout;
c.setClick(object -> {
fply.setLoadout(floadout2);
fply.getPlayer().closeInventory();
if (!equip)
fply.sendMessage(MinigameUtils.getLang("player.loadout.nextSpawn"), MinigameMessageType.INFO);
else {
fply.sendMessage(MinigameUtils.formStr("player.loadout.equipped", floadout2.getName(true)), MinigameMessageType.INFO);
floadout2.equiptLoadout(fply);
}
return null;
});
m.addItem(c);
}
}
}
}
m.displayMenu(player);
}
use of au.com.mineauz.minigames.PlayerLoadout in project Minigames by AddstarMC.
the class MenuItemLoadoutAdd method checkValidEntry.
@Override
public void checkValidEntry(String entry) {
entry = entry.replace(" ", "_");
if (!loadouts.keySet().contains(entry)) {
for (int i = 0; i < 45; i++) {
if (!getContainer().hasMenuItem(i)) {
PlayerLoadout loadout = new PlayerLoadout(entry);
loadouts.put(entry, loadout);
List<String> des = new ArrayList<>();
des.add("Shift + Right Click to Delete");
if (minigame != null)
getContainer().addItem(new MenuItemDisplayLoadout(entry, des, Material.DIAMOND_SWORD, loadout, minigame), i);
else
getContainer().addItem(new MenuItemDisplayLoadout(entry, des, Material.DIAMOND_SWORD, loadout), i);
break;
}
}
getContainer().cancelReopenTimer();
getContainer().displayMenu(getContainer().getViewer());
return;
}
getContainer().cancelReopenTimer();
getContainer().displayMenu(getContainer().getViewer());
getContainer().getViewer().sendMessage("A Loadout already exists by the name \"" + entry + "\".", MinigameMessageType.ERROR);
}
use of au.com.mineauz.minigames.PlayerLoadout in project Minigames by AddstarMC.
the class EquipLoadoutAction method executeNodeAction.
@Override
public void executeNodeAction(MinigamePlayer player, Node node) {
debug(player, node);
if (player == null || !player.isInMinigame())
return;
LoadoutModule lmod = LoadoutModule.getMinigameModule(player.getMinigame());
if (lmod.hasLoadout(loadout.getFlag())) {
PlayerLoadout pLoadOut = lmod.getLoadout(loadout.getFlag());
player.setLoadout(pLoadOut);
pLoadOut.equiptLoadout(player);
}
}
Aggregations