mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-03-12 14:49:46 +01:00
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:
parent
139a3a128a
commit
a805c5425c
@ -42,16 +42,21 @@ public class EssentialsUpgrade
|
|||||||
EssentialsConf conf = new EssentialsConf(configFile);
|
EssentialsConf conf = new EssentialsConf(configFile);
|
||||||
conf.load();
|
conf.load();
|
||||||
Worth w = new Worth(ess.getDataFolder());
|
Worth w = new Worth(ess.getDataFolder());
|
||||||
|
boolean found = false;
|
||||||
for (Material mat : Material.values())
|
for (Material mat : Material.values())
|
||||||
{
|
{
|
||||||
int id = mat.getId();
|
int id = mat.getId();
|
||||||
double value = conf.getDouble("worth-" + id, Double.NaN);
|
double value = conf.getDouble("worth-" + id, Double.NaN);
|
||||||
if (!Double.isNaN(value))
|
if (!Double.isNaN(value))
|
||||||
{
|
{
|
||||||
|
found = true;
|
||||||
w.setPrice(new ItemStack(mat, 1, (short)0, (byte)0), value);
|
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)
|
catch (Throwable e)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user