diff options
Diffstat (limited to 'EssentialsSpawn')
-rw-r--r-- | EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index a5d1efba9..57b842c82 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -15,8 +15,9 @@ public class EssentialsSpawnPlayerListener extends PlayerListener { private final transient IEssentials ess; - public EssentialsSpawnPlayerListener(IEssentials ess) + public EssentialsSpawnPlayerListener(final IEssentials ess) { + super(); this.ess = ess; } @@ -25,28 +26,24 @@ public class EssentialsSpawnPlayerListener extends PlayerListener { final User user = ess.getUser(event.getPlayer()); - try + if (ess.getSettings().getRespawnAtHome()) { - if (ess.getSettings().getRespawnAtHome()) + Location home = user.getHome(user.getLocation()); + if (home == null) + { + home = user.getBedSpawnLocation(); + } + if (home != null) { - Location home = user.getHome(user.getLocation()); - if (home == null) - { - throw new Exception(); - } event.setRespawnLocation(home); return; } } - catch (Throwable ex) + final Location spawn = ess.getSpawn().getSpawn(user.getGroup()); + if (spawn != null) { + event.setRespawnLocation(spawn); } - Location spawn = ess.getSpawn().getSpawn(user.getGroup()); - if (spawn == null) - { - return; - } - event.setRespawnLocation(spawn); } @Override @@ -54,7 +51,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener { final User user = ess.getUser(event.getPlayer()); - if (!user.isNew()) + if (!user.isNew() || user.getBedSpawnLocation() != null) { return; } |