diff --git a/Essentials/src/com/earth2me/essentials/EssentialsConf.java b/Essentials/src/com/earth2me/essentials/EssentialsConf.java index f01ceea90..054fd1840 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsConf.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsConf.java @@ -170,7 +170,8 @@ public class EssentialsConf extends Configuration map.put("type", stack.getType().toString()); map.put("amount", stack.getAmount()); map.put("damage", stack.getDurability()); - map.put("data", stack.getData().getData()); + // getData().getData() is broken + map.put("data", stack.getDurability()); setProperty(path, map); } diff --git a/Essentials/src/com/earth2me/essentials/Worth.java b/Essentials/src/com/earth2me/essentials/Worth.java index 3c074657f..d95f264ee 100644 --- a/Essentials/src/com/earth2me/essentials/Worth.java +++ b/Essentials/src/com/earth2me/essentials/Worth.java @@ -19,7 +19,10 @@ public class Worth implements IConf public double getPrice(ItemStack itemStack) { - double result = config.getDouble("worth."+itemStack.getType().toString().toLowerCase().replace("_", "")+"."+itemStack.getData().getData(), Double.NaN); + double result = config.getDouble("worth."+itemStack.getType().toString().toLowerCase().replace("_", "")+"."+itemStack.getDurability(), Double.NaN); + if (Double.isNaN(result)) { + result = config.getDouble("worth."+itemStack.getType().toString().toLowerCase().replace("_", "")+".0", Double.NaN); + } if (Double.isNaN(result)) { result = config.getDouble("worth."+itemStack.getType().toString().toLowerCase().replace("_", ""), Double.NaN); } @@ -34,7 +37,9 @@ public class Worth implements IConf if (itemStack.getType().getData() == null) { config.setProperty("worth." + itemStack.getType().toString().toLowerCase().replace("_", ""), price); } else { - config.setProperty("worth." + itemStack.getType().toString().toLowerCase().replace("_", "")+"."+itemStack.getData().getData(), price); + // Bukkit-bug: getDurability still contains the correct value, while getData().getData() is 0. + itemStack.getData(); + config.setProperty("worth." + itemStack.getType().toString().toLowerCase().replace("_", "")+"."+itemStack.getDurability(), price); } config.removeProperty("worth-"+itemStack.getTypeId()); config.save();