[trunk] Fix bug on upgrade the home locations

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1301 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-05-01 21:58:38 +00:00
parent 224c18348a
commit 088508bd37
2 changed files with 21 additions and 12 deletions

View File

@ -193,7 +193,7 @@ public class EssentialsUpgrade
{
user.setMails(mails);
}
if (user.getHome() == null)
if (!user.hasHome())
{
@SuppressWarnings("unchecked")
List<Object> vals = (List<Object>)usersConfig.getProperty(username + ".home");

View File

@ -87,10 +87,21 @@ public abstract class UserData extends PlayerExtension implements IConf
}
}
public Location getHome()
public boolean hasHome()
{
if (config.hasProperty("home"))
{
return true;
}
return false;
}
public Location getHome()
{
if (!hasHome())
{
return null;
}
World world = getLocation().getWorld();
String worldHome = "home.worlds." + world.getName().toLowerCase();
if (!config.hasProperty(worldHome))
@ -101,8 +112,6 @@ public abstract class UserData extends PlayerExtension implements IConf
Location loc = config.getLocation(worldHome, getServer());
return loc;
}
return null;
}
public void setHome(Location loc, boolean b)
{