mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-03 11:06:08 +00:00
[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:
parent
224c18348a
commit
088508bd37
2 changed files with 21 additions and 12 deletions
|
@ -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");
|
||||||
|
|
|
@ -87,21 +87,30 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getHome()
|
public boolean hasHome()
|
||||||
{
|
{
|
||||||
if (config.hasProperty("home"))
|
if (config.hasProperty("home"))
|
||||||
{
|
{
|
||||||
World world = getLocation().getWorld();
|
return true;
|
||||||
String worldHome = "home.worlds." + world.getName().toLowerCase();
|
|
||||||
if (!config.hasProperty(worldHome))
|
|
||||||
{
|
|
||||||
String defaultWorld = config.getString("home.default");
|
|
||||||
worldHome = "home.worlds." + defaultWorld;
|
|
||||||
}
|
|
||||||
Location loc = config.getLocation(worldHome, getServer());
|
|
||||||
return loc;
|
|
||||||
}
|
}
|
||||||
return null;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getHome()
|
||||||
|
{
|
||||||
|
if (!hasHome())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
World world = getLocation().getWorld();
|
||||||
|
String worldHome = "home.worlds." + world.getName().toLowerCase();
|
||||||
|
if (!config.hasProperty(worldHome))
|
||||||
|
{
|
||||||
|
String defaultWorld = config.getString("home.default");
|
||||||
|
worldHome = "home.worlds." + defaultWorld;
|
||||||
|
}
|
||||||
|
Location loc = config.getLocation(worldHome, getServer());
|
||||||
|
return loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHome(Location loc, boolean b)
|
public void setHome(Location loc, boolean b)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue