--- miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/chests/AdvancedChest.java 2015/03/09 13:55:54 2432 +++ miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/chests/AdvancedChest.java 2015/03/09 14:00:35 2433 @@ -2,7 +2,6 @@ import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.TreeMap; @@ -41,7 +40,7 @@ public class AdvancedChest implements Listener, CommandExecutor{ - class ItemCount extends TreeMap { + class ItemCount extends TreeMap { private static final long serialVersionUID = 1L; }; @@ -575,13 +574,13 @@ ItemCount content = countItems( event.getInventory().getContents() ); - Set combinedKeyset = new TreeSet(); + Set combinedKeyset = new TreeSet(); combinedKeyset.addAll( savedContent.keySet() ); combinedKeyset.addAll( content.keySet() ); - for (Integer item : combinedKeyset ) { - Integer savedcount = savedContent.get(item); - Integer count = content.get(item); + for (Material material : combinedKeyset ) { + Integer savedcount = savedContent.get(material); + Integer count = content.get(material); if (savedcount == null) savedcount = 0; @@ -592,13 +591,12 @@ int diff = Math.abs( savedcount - count); if (diff > 0) { - String material = Material.getMaterial(item).name(); String msg = null; if (count > savedcount) { - msg = player.getName() + " added " + diff + " units of " + material + "(" +item + ") to " + owner.getName() + "'s chest at " + loc.getWorld().getName() + "," + loc.getBlockX() + "," +loc.getBlockY() + "," + loc.getBlockZ() + chest.getCommentString(); + msg = player.getName() + " added " + diff + " units of " + material + " to " + owner.getName() + "'s chest at " + loc.getWorld().getName() + "," + loc.getBlockX() + "," +loc.getBlockY() + "," + loc.getBlockZ() + chest.getCommentString(); } else { //(count < savedcount) - msg = player.getName() + " removed " + diff + " units of " + material + "(" +item + ") from " + owner.getName() + "'s chest at " + loc.getWorld().getName() + "," + loc.getBlockX() + "," +loc.getBlockY() + "," + loc.getBlockZ() + chest.getCommentString(); + msg = player.getName() + " removed " + diff + " units of " + material + " from " + owner.getName() + "'s chest at " + loc.getWorld().getName() + "," + loc.getBlockX() + "," +loc.getBlockY() + "," + loc.getBlockZ() + chest.getCommentString(); } @@ -619,7 +617,7 @@ if (current == null) continue; - int type = current.getTypeId(); + Material type = current.getType(); Integer amount = output.get(type); if (amount == null)