From 4c245dd25b66d13cd1f45ac8a0247091d721f76f Mon Sep 17 00:00:00 2001 From: snowleo Date: Sat, 16 Apr 2011 14:39:31 +0000 Subject: [PATCH] [trunk] Bukkit-Bug: http://leaky.bukkit.org/issues/668 changed getData().getData() to getDurability() git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1218 e251c2fe-e539-e718-e476-b85c1f46cddb --- .../src/com/earth2me/essentials/EssentialsConf.java | 3 ++- Essentials/src/com/earth2me/essentials/Worth.java | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) 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();