Missing extraLoadouts stuff. Kind of broken. Need more testing.

This commit is contained in:
taoneill 2011-09-16 00:27:04 -04:00
parent c6a8bc555c
commit 1ba2fa2e06
2 changed files with 15 additions and 5 deletions

View File

@ -361,10 +361,10 @@ public class War extends JavaPlugin {
if (loadoutName.equals("default")) {
this.inventoryToLoadout(player, warzone.getLoadout());
} else {
HashMap<Integer, ItemStack> extraLoadout = this.getDefaultExtraLoadouts().get(loadoutName);
HashMap<Integer, ItemStack> extraLoadout = warzone.getExtraLoadouts().get(loadoutName);
if (extraLoadout == null) {
HashMap<Integer, ItemStack> newLoadout = new HashMap<Integer, ItemStack>();
this.getDefaultExtraLoadouts().put(loadoutName, newLoadout);
warzone.getExtraLoadouts().put(loadoutName, newLoadout);
}
this.inventoryToLoadout(player, extraLoadout);
}
@ -509,8 +509,18 @@ public class War extends JavaPlugin {
if (commandSender instanceof Player) {
Player player = (Player) commandSender;
if (namedParams.containsKey("loadout")) {
this.inventoryToLoadout(player, this.getDefaultLoadout());
returnMessage.append(" respawn loadout updated.");
String loadoutName = namedParams.get("loadout");
if (loadoutName.equals("default")) {
this.inventoryToLoadout(player, this.getDefaultLoadout());
} else {
HashMap<Integer, ItemStack> extraLoadout = this.getDefaultExtraLoadouts().get(loadoutName);
if (extraLoadout == null) {
HashMap<Integer, ItemStack> newLoadout = new HashMap<Integer, ItemStack>();
this.getDefaultExtraLoadouts().put(loadoutName, newLoadout);
}
this.inventoryToLoadout(player, extraLoadout);
}
returnMessage.append(loadoutName + " respawn loadout updated.");
}
if (namedParams.containsKey("reward")) {
this.inventoryToLoadout(player, this.getDefaultReward());

View File

@ -468,7 +468,7 @@ public class WarPlayerListener extends PlayerListener {
@Override
public void onPlayerToggleSneak(PlayerToggleSneakEvent event) {
if (War.war.isLoaded()) {
if (War.war.isLoaded() && event.isSneaking()) {
Warzone playerWarzone = Warzone.getZoneByLocation(event.getPlayer());
if (playerWarzone != null && playerWarzone.getNewlyRespawned().keySet().contains(event.getPlayer().getName())) {
Integer currentIndex = playerWarzone.getNewlyRespawned().get(event.getPlayer().getName());