Only update config, if there are worth values.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1504 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-05-16 21:43:43 +00:00
parent 139a3a128a
commit a805c5425c

View File

@ -42,16 +42,21 @@ public class EssentialsUpgrade
EssentialsConf conf = new EssentialsConf(configFile);
conf.load();
Worth w = new Worth(ess.getDataFolder());
boolean found = false;
for (Material mat : Material.values())
{
int id = mat.getId();
double value = conf.getDouble("worth-" + id, Double.NaN);
if (!Double.isNaN(value))
{
found = true;
w.setPrice(new ItemStack(mat, 1, (short)0, (byte)0), value);
}
}
removeLinesFromConfig(configFile, "\\s*#?\\s*worth-[0-9]+.*", "# Worth values have been moved to worth.yml");
if (found)
{
removeLinesFromConfig(configFile, "\\s*#?\\s*worth-[0-9]+.*", "# Worth values have been moved to worth.yml");
}
}
catch (Throwable e)
{