1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-16 03:24:31 +02:00

Show file name, if there is an exception in the user upgrade code.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1533 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo
2011-05-23 10:59:26 +00:00
parent a7217b5f03
commit 70c84083c4

View File

@@ -137,39 +137,47 @@ public class EssentialsUpgrade
continue; continue;
} }
EssentialsConf config = new EssentialsConf(file); EssentialsConf config = new EssentialsConf(file);
config.load(); try
if (config.hasProperty("home") && !config.hasProperty("home.default"))
{ {
@SuppressWarnings("unchecked") config.load();
List<Object> vals = (List<Object>)config.getProperty("home"); if (config.hasProperty("home") && !config.hasProperty("home.default"))
if (vals == null) {
continue;
}
World world = ess.getServer().getWorlds().get(0);
if (vals.size() > 5)
{ {
world = ess.getServer().getWorld((String)vals.get(5)); @SuppressWarnings("unchecked")
} List<Object> vals = (List<Object>)config.getProperty("home");
if (world != null) if (vals == null) {
{ continue;
Location loc = new Location( }
world, World world = ess.getServer().getWorlds().get(0);
((Number)vals.get(0)).doubleValue(), if (vals.size() > 5)
((Number)vals.get(1)).doubleValue(),
((Number)vals.get(2)).doubleValue(),
((Number)vals.get(3)).floatValue(),
((Number)vals.get(4)).floatValue());
String worldName = world.getName().toLowerCase();
if (worldName != null && !worldName.isEmpty())
{ {
config.removeProperty("home"); world = ess.getServer().getWorld((String)vals.get(5));
config.setProperty("home.default", worldName); }
config.setProperty("home.worlds." + worldName, loc); if (world != null)
config.save(); {
Location loc = new Location(
world,
((Number)vals.get(0)).doubleValue(),
((Number)vals.get(1)).doubleValue(),
((Number)vals.get(2)).doubleValue(),
((Number)vals.get(3)).floatValue(),
((Number)vals.get(4)).floatValue());
String worldName = world.getName().toLowerCase();
if (worldName != null && !worldName.isEmpty())
{
config.removeProperty("home");
config.setProperty("home.default", worldName);
config.setProperty("home.worlds." + worldName, loc);
config.save();
}
} }
} }
} }
catch (RuntimeException ex)
{
logger.log(Level.INFO, "File: "+file.toString());
throw ex;
}
} }
} }