summaryrefslogtreecommitdiffstats
path: root/EssentialsSpawn/src/com/earth2me
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-11-26 22:30:40 +0100
committersnowleo <schneeleo@gmail.com>2011-11-26 22:30:40 +0100
commitb21b7b7e155a45227f9c629d51ee50ecbed1ca73 (patch)
treee1d56ae72dfe7654f2cbabc017432ee7633e40bc /EssentialsSpawn/src/com/earth2me
parentf9d14697b6aaa62df4ee63fdafa2660e487402eb (diff)
downloadEssentials-b21b7b7e155a45227f9c629d51ee50ecbed1ca73.tar
Essentials-b21b7b7e155a45227f9c629d51ee50ecbed1ca73.tar.gz
Essentials-b21b7b7e155a45227f9c629d51ee50ecbed1ca73.tar.lz
Essentials-b21b7b7e155a45227f9c629d51ee50ecbed1ca73.tar.xz
Essentials-b21b7b7e155a45227f9c629d51ee50ecbed1ca73.zip
New behavior of the /home command and beds
- The behavior has been altered to match the vanilla server. - Using a bed will no longer create a home in the users file, if config option bed-sethome is set - The config option bed-sethome has been removed - It's now possible to go to /home bed or /home playername:bed - Bed locations stored before installing Essentials will be used - Players respawn at their bed location (if set) instead of the spawn, if respawn-at-home is set to false - The default value of spawn-if-no-home is set to true - If spawn-if-no-home is set and the player has not set a home, he will be either teleported to his bed location (if set) or the spawn, when he uses the /home command
Diffstat (limited to 'EssentialsSpawn/src/com/earth2me')
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java29
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;
}