Fix /home player for offline players

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1497 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-05-15 21:27:54 +00:00
parent 0d39f9225a
commit 7a50ed8179
4 changed files with 5 additions and 5 deletions

View File

@ -241,7 +241,7 @@ public class Teleport implements Runnable
public void home(User user, String chargeFor) throws Exception
{
Location loc = user.getHome();
Location loc = user.getHome(this.user.getLocation());
if (loc == null)
{
if (ess.getSettings().spawnIfNoHome())

View File

@ -95,13 +95,13 @@ public abstract class UserData extends PlayerExtension implements IConf
return false;
}
public Location getHome()
public Location getHome(Location location)
{
if (!hasHome())
{
return null;
}
World world = getLocation().getWorld();
World world = location.getWorld();
String worldHome = "home.worlds." + world.getName().toLowerCase();
if (!config.hasProperty(worldHome))
{

View File

@ -54,7 +54,7 @@ public class UserTest extends TestCase
user.setHome();
OfflinePlayer base2 = server.createPlayer(base1.getName());
User user2 = ess.getUser(base2);
Location home = user2.getHome();
Location home = user2.getHome(loc);
assertEquals(loc.getWorld().getName(), home.getWorld().getName());
assertEquals(loc.getX(), home.getX());
assertEquals(loc.getY(), home.getY());

View File

@ -22,7 +22,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
{
if (Essentials.getStatic().getSettings().getRespawnAtHome())
{
Location home = user.getHome();
Location home = user.getHome(user.getLocation());
if (home == null) {
throw new Exception();
}