mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-31 21:48:31 +01:00
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:
parent
0d39f9225a
commit
7a50ed8179
@ -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())
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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());
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user