diff --git a/war/src/main/java/bukkit/tommytony/war/War.java b/war/src/main/java/bukkit/tommytony/war/War.java index 2d51f32..6f02981 100644 --- a/war/src/main/java/bukkit/tommytony/war/War.java +++ b/war/src/main/java/bukkit/tommytony/war/War.java @@ -88,7 +88,7 @@ public class War extends JavaPlugin { this.defaultLifepool = 7; this.defaultFriendlyFire = false; this.defaultAutoAssignOnly = false; - getLogger().info("Loading War secrets..."); + getLogger().info("Loading War files..."); WarMapper.load(this, this.getServer().getWorlds()[0]); getLogger().info("War v" + version + " is on."); } diff --git a/war/src/main/java/com/tommytony/war/Warzone.java b/war/src/main/java/com/tommytony/war/Warzone.java index f5843c7..ca5c920 100644 --- a/war/src/main/java/com/tommytony/war/Warzone.java +++ b/war/src/main/java/com/tommytony/war/Warzone.java @@ -36,7 +36,7 @@ public class Warzone { private HashMap loadout; private boolean drawZoneOutline; - private HashMap> inventories = new HashMap>(); + private HashMap inventories = new HashMap(); private World world; private Material[] originalSoutheastBlocks; private Material[] originalNorthwestBlocks; @@ -343,11 +343,7 @@ public class Warzone { private void handleRespawn(Team team, Player player){ // Reset inventory to loadout PlayerInventory playerInv = player.getInventory(); - // BUKKIT -// for(int i = 0; i < playerInv.getSize(); i++){ -// playerInv.setItem(index, new ItemStack(Material.)) -// playerInv.setItem(i, null); -// } + playerInv.clear(); for(Integer slot : loadout.keySet()) { // if(slot == 101) { // playerInv.setLeggings(loadout.get(slot)); @@ -367,7 +363,6 @@ public class Warzone { } else if (team.getMaterial() == Material.IRON_BLOCK) { playerInv.setHelmet(new ItemStack(Material.IRON_BOOTS)); } - //player.setHealth(20); } @@ -439,23 +434,18 @@ public class Warzone { public void keepPlayerInventory(Player player) { PlayerInventory inventory = player.getInventory(); - List invToStore = new ArrayList(); - for(int i=0; i < inventory.getSize(); i++) { - invToStore.add(i, inventory.getItem(i)); - } - inventories.put(player.getName(), invToStore); + ItemStack[] contents = inventory.getContents(); + inventories.put(player.getName(), contents); } public void restorePlayerInventory(Player player) { - List originalContents = inventories.remove(player.getName()); + ItemStack[] originalContents = inventories.remove(player.getName()); PlayerInventory playerInv = player.getInventory(); - // BUKKIT -// for(int i = 0; i < playerInv.getSize(); i++) { -// playerInv.setItem(i, new ItemStack(Material.AIR)); -// } -// for(int i = 0; i < playerInv.getSize(); i++) { -// playerInv.setItem(i, originalContents.get(i)); -// } + playerInv.clear(); + playerInv.remove(Material.DIAMOND_BOOTS.getId()); + playerInv.remove(Material.GOLD_BOOTS.getId()); + playerInv.remove(Material.IRON_BOOTS.getId()); + playerInv.setContents(originalContents); } public boolean hasMonument(String monumentName) {