changed getData().getData() to getDurability()

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1218 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-04-16 14:39:31 +00:00
parent 201ffa4770
commit 4c245dd25b
2 changed files with 9 additions and 3 deletions

View File

@ -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);
}

View File

@ -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();