[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); user.setMails(mails);
} }
if (user.getHome() == null) if (!user.hasHome())
{ {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<Object> vals = (List<Object>)usersConfig.getProperty(username + ".home"); 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")) if (config.hasProperty("home"))
{ {
return true;
}
return false;
}
public Location getHome()
{
if (!hasHome())
{
return null;
}
World world = getLocation().getWorld(); World world = getLocation().getWorld();
String worldHome = "home.worlds." + world.getName().toLowerCase(); String worldHome = "home.worlds." + world.getName().toLowerCase();
if (!config.hasProperty(worldHome)) if (!config.hasProperty(worldHome))
@ -101,8 +112,6 @@ public abstract class UserData extends PlayerExtension implements IConf
Location loc = config.getLocation(worldHome, getServer()); Location loc = config.getLocation(worldHome, getServer());
return loc; return loc;
} }
return null;
}
public void setHome(Location loc, boolean b) public void setHome(Location loc, boolean b)
{ {