Closes gh-17. (Wow, War finally has classes) You can now delete extra loadouts. Can't shoot arrows when still standing inside spawn (to prevent arrow spam by class switchers).

This commit is contained in:
taoneill 2011-09-18 16:18:55 -04:00
parent 9cc39281d7
commit dc4b770aaa
2 changed files with 35 additions and 1 deletions

View File

@ -370,6 +370,20 @@ public class War extends JavaPlugin {
}
returnMessage.append(" " + loadoutName + " respawn loadout updated.");
}
if (namedParams.containsKey("deleteloadout")) {
String loadoutName = namedParams.get("deleteloadout");
if (loadoutName.equals("default")) {
returnMessage.append(" Can't remove default loadout.");
} else {
HashMap<Integer, ItemStack> extraLoadout = warzone.getExtraLoadouts().get(loadoutName);
if (warzone.getExtraLoadouts().keySet().contains(loadoutName)) {
warzone.getExtraLoadouts().remove(loadoutName);
returnMessage.append(" " + loadoutName + " loadout removed.");
} else {
returnMessage.append(" " + loadoutName + " loadout not found.");
}
}
}
if (namedParams.containsKey("reward")) {
this.inventoryToLoadout(player, warzone.getReward());
returnMessage.append(" game end reward updated.");
@ -522,6 +536,20 @@ public class War extends JavaPlugin {
}
returnMessage.append(loadoutName + " respawn loadout updated.");
}
if (namedParams.containsKey("deleteloadout")) {
String loadoutName = namedParams.get("deleteloadout");
if (loadoutName.equals("default")) {
returnMessage.append(" Can't remove default loadout.");
} else {
HashMap<Integer, ItemStack> extraLoadout = this.getDefaultExtraLoadouts().get(loadoutName);
if (this.getDefaultExtraLoadouts().keySet().contains(loadoutName)) {
this.getDefaultExtraLoadouts().remove(loadoutName);
returnMessage.append(" " + loadoutName + " loadout removed.");
} else {
returnMessage.append(" " + loadoutName + " loadout not found.");
}
}
}
if (namedParams.containsKey("reward")) {
this.inventoryToLoadout(player, this.getDefaultReward());
returnMessage.append(" game end reward updated.");

View File

@ -223,6 +223,12 @@ public class WarPlayerListener extends PlayerListener {
event.setUseItemInHand(Result.ALLOW);
}
}
Warzone zone = Warzone.getZoneByPlayerName(player.getName());
if (zone != null && zone.getNewlyRespawned().containsKey(player.getName()) && player.getItemInHand().getType() == Material.BOW) {
event.setUseItemInHand(Result.DENY);
War.war.badMsg(player, "Can't shoot from inside the spawn.");
}
}
}
@ -479,7 +485,7 @@ public class WarPlayerListener extends PlayerListener {
if (War.war.isLoaded() && event.isSneaking()) {
Warzone playerWarzone = Warzone.getZoneByLocation(event.getPlayer());
Team playerTeam = Team.getTeamByPlayerName(event.getPlayer().getName());
if (playerWarzone != null && playerTeam.getSpawnVolume().contains(event.getPlayer().getLocation())) {
if (playerWarzone != null && playerWarzone.getExtraLoadouts().keySet().size() > 0 && playerTeam.getSpawnVolume().contains(event.getPlayer().getLocation())) {
if (playerWarzone.getNewlyRespawned().keySet().contains(event.getPlayer().getName())) {
Integer currentIndex = playerWarzone.getNewlyRespawned().get(event.getPlayer().getName());
currentIndex = (currentIndex + 1) % (playerWarzone.getExtraLoadouts().keySet().size() + 1);