diff options
author | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-05-15 21:27:54 +0000 |
---|---|---|
committer | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-05-15 21:27:54 +0000 |
commit | 7a50ed8179d7f3822763cefefa42a24b3aa8ff63 (patch) | |
tree | c3f8833473559d7f37bf1ddd743345476f3a8e18 | |
parent | 0d39f9225ae79430c4ed92f82b762190313fb35c (diff) | |
download | Essentials-7a50ed8179d7f3822763cefefa42a24b3aa8ff63.tar Essentials-7a50ed8179d7f3822763cefefa42a24b3aa8ff63.tar.gz Essentials-7a50ed8179d7f3822763cefefa42a24b3aa8ff63.tar.lz Essentials-7a50ed8179d7f3822763cefefa42a24b3aa8ff63.tar.xz Essentials-7a50ed8179d7f3822763cefefa42a24b3aa8ff63.zip |
Fix /home player for offline players
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1497 e251c2fe-e539-e718-e476-b85c1f46cddb
4 files changed, 5 insertions, 5 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java index 97b0ac30d..9b16dd6b9 100644 --- a/Essentials/src/com/earth2me/essentials/Teleport.java +++ b/Essentials/src/com/earth2me/essentials/Teleport.java @@ -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()) diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java index 319509abc..782995159 100644 --- a/Essentials/src/com/earth2me/essentials/UserData.java +++ b/Essentials/src/com/earth2me/essentials/UserData.java @@ -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)) { diff --git a/Essentials/test/com/earth2me/essentials/UserTest.java b/Essentials/test/com/earth2me/essentials/UserTest.java index 1acaeb55a..d6e04cc17 100644 --- a/Essentials/test/com/earth2me/essentials/UserTest.java +++ b/Essentials/test/com/earth2me/essentials/UserTest.java @@ -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()); diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index ea60a490f..ace8cd50b 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -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(); } |