use of au.com.mineauz.minigames.minigame.modules.LoadoutModule 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.minigame.modules.LoadoutModule in project Minigames by AddstarMC.
the class LoadoutSign method signUse.
@Override
public boolean signUse(Sign sign, MinigamePlayer player) {
if (player.getPlayer().getInventory().getItemInMainHand().getType() == Material.AIR && player.isInMinigame()) {
Minigame mgm = player.getMinigame();
LoadoutModule loadout = LoadoutModule.getMinigameModule(mgm);
if (mgm == null || mgm.isSpectator(player)) {
return false;
}
if (sign.getLine(2).equals(ChatColor.GREEN + "Menu")) {
boolean nores = true;
if (sign.getLine(3).equalsIgnoreCase("respawn"))
nores = false;
LoadoutModule.getMinigameModule(mgm).displaySelectionMenu(player, nores);
} else if (loadout.hasLoadout(sign.getLine(2))) {
if (!loadout.getLoadout(sign.getLine(2)).getUsePermissions() || player.getPlayer().hasPermission("minigame.loadout." + sign.getLine(2).toLowerCase())) {
if (player.setLoadout(loadout.getLoadout(sign.getLine(2)))) {
player.sendInfoMessage(MinigameUtils.formStr("sign.loadout.equipped", sign.getLine(2)));
if (mgm.getType() == MinigameType.SINGLEPLAYER || mgm.hasStarted()) {
if (sign.getLine(3).equalsIgnoreCase("respawn")) {
player.sendInfoMessage(MinigameUtils.getLang("sign.loadout.nextRespawn"));
} else {
loadout.getLoadout(sign.getLine(2)).equiptLoadout(player);
}
}
}
return true;
} else {
player.sendMessage(MinigameUtils.formStr("sign.loadout.noPermisson", sign.getLine(2)), MinigameMessageType.ERROR);
}
} else if (plugin.getMinigameManager().hasLoadout(sign.getLine(2))) {
if (!plugin.getMinigameManager().getLoadout(sign.getLine(2)).getUsePermissions() || player.getPlayer().hasPermission("minigame.loadout." + sign.getLine(2).toLowerCase())) {
if (player.setLoadout(plugin.getMinigameManager().getLoadout(sign.getLine(2)))) {
player.sendInfoMessage(MinigameUtils.formStr("sign.loadout.equipped", sign.getLine(2)));
if (mgm.getType() == MinigameType.SINGLEPLAYER || mgm.hasStarted()) {
if (sign.getLine(3).equalsIgnoreCase("respawn")) {
player.sendInfoMessage(MinigameUtils.getLang("sign.loadout.nextRespawn"));
} else {
plugin.getMinigameManager().getLoadout(sign.getLine(2)).equiptLoadout(player);
}
}
}
return true;
} else {
player.sendMessage(MinigameUtils.formStr("sign.loadout.noPermission", sign.getLine(2)), MinigameMessageType.ERROR);
}
} else {
player.sendMessage(MinigameUtils.getLang("sign.loadout.noLoadout"), MinigameMessageType.ERROR);
}
} else if (player.getPlayer().getInventory().getItemInMainHand().getType() != Material.AIR)
player.sendMessage(MinigameUtils.getLang("sign.emptyHand"), MinigameMessageType.ERROR);
return false;
}
use of au.com.mineauz.minigames.minigame.modules.LoadoutModule 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);
}
}
use of au.com.mineauz.minigames.minigame.modules.LoadoutModule in project Minigames by AddstarMC.
the class SetLoadoutCommand method onCommand.
@Override
public boolean onCommand(CommandSender sender, Minigame minigame, String label, String[] args) {
MinigamePlayer player = Minigames.getPlugin().getPlayerManager().getMinigamePlayer((Player) sender);
Menu loadouts = new Menu(6, getName(), player);
List<MenuItem> mi = new ArrayList<>();
LoadoutModule mod = LoadoutModule.getMinigameModule(minigame);
List<String> des = new ArrayList<>();
des.add("Shift + Right Click to Delete");
Material item = Material.WHITE_STAINED_GLASS_PANE;
for (String ld : mod.getLoadouts()) {
item = Material.WHITE_STAINED_GLASS_PANE;
if (mod.getLoadout(ld).getItems().size() != 0) {
item = mod.getLoadout(ld).getItem((Integer) mod.getLoadout(ld).getItems().toArray()[0]).getType();
}
MenuItemDisplayLoadout mil = new MenuItemDisplayLoadout(ld, des, item, mod.getLoadout(ld), minigame);
mil.setAllowDelete(mod.getLoadout(ld).isDeleteable());
mi.add(mil);
}
loadouts.addItem(new MenuItemLoadoutAdd("Add Loadout", Material.ITEM_FRAME, mod.getLoadoutMap(), minigame), 53);
loadouts.addItems(mi);
loadouts.displayMenu(player);
return true;
}
Aggregations