diff options
4 files changed, 20 insertions, 29 deletions
diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java index 9df1b0342..d08704484 100644 --- a/Essentials/src/com/earth2me/essentials/UserData.java +++ b/Essentials/src/com/earth2me/essentials/UserData.java @@ -53,7 +53,6 @@ public abstract class UserData extends PlayerExtension implements IConf lastLogout = _getLastLogout(); lastLoginAddress = _getLastLoginAddress(); afk = getAfk(); - newplayer = getNew(); geolocation = _getGeoLocation(); isSocialSpyEnabled = _isSocialSpyEnabled(); isNPC = _isNPC(); @@ -736,22 +735,6 @@ public abstract class UserData extends PlayerExtension implements IConf } private boolean newplayer; - private boolean getNew() - { - return config.getBoolean("newplayer", true); - } - - public boolean isNew() - { - return newplayer; - } - - public void setNew(boolean set) - { - newplayer = set; - config.setProperty("newplayer", set); - config.save(); - } private String geolocation; private String _getGeoLocation() diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index 2254bdbab..877ff0c42 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -253,10 +253,7 @@ register-back-in-listener: false # +------------------------------------------------------+ # ############################################################ -# When users die, should they respawn at their first home, instead of the spawnpoint or bed? -respawn-at-home: false - -# If no home is set send you to bed or spawn when /home is used +# If no home is set, send players to spawn when /home is used spawn-if-no-home: true # Allows people to set their bed at daytime @@ -532,8 +529,11 @@ newbies: spawnpoint: newbies # Set this to lowest, if you want Multiverse to handle the respawning -# Set this to normal, if you want EssentialsSpawn to handle the respawning +# Set this to high, if you want EssentialsSpawn to handle the respawning # Set this to highest, if you want to force EssentialsSpawn to handle the respawning -respawn-listener-priority: normal +respawn-listener-priority: high + +# When users die, should they respawn at their first home or bed, instead of the spawnpoint? +respawn-at-home: false # End of File <-- No seriously, you're done with configuration. diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java index c4cd7c727..813220a16 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java @@ -39,7 +39,7 @@ public class EssentialsSpawn extends JavaPlugin final EssentialsSpawnPlayerListener playerListener = new EssentialsSpawnPlayerListener(ess, spawns); pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, ess.getSettings().getRespawnPriority(), this); - pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Low, this); + pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, ess.getSettings().getRespawnPriority(), this); LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team")); } diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index 530a00faa..2a9efe4b1 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; import java.util.logging.Level; +import java.util.logging.Logger; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.event.player.PlayerJoinEvent; @@ -16,6 +17,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener { private final transient IEssentials ess; private final transient SpawnStorage spawns; + private static final Logger LOGGER = Bukkit.getLogger(); public EssentialsSpawnPlayerListener(final IEssentials ess, final SpawnStorage spawns) { @@ -26,7 +28,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener @Override public void onPlayerRespawn(final PlayerRespawnEvent event) - { + { final User user = ess.getUser(event.getPlayer()); if (ess.getSettings().getRespawnAtHome()) @@ -45,8 +47,12 @@ public class EssentialsSpawnPlayerListener extends PlayerListener final Location spawn = spawns.getSpawn(user.getGroup()); if (spawn != null) { + LOGGER.log(Level.INFO, "setting respawn location"); event.setRespawnLocation(spawn); } + else { + LOGGER.log(Level.INFO, "spawn was null"); + } } @Override @@ -54,20 +60,22 @@ public class EssentialsSpawnPlayerListener extends PlayerListener { final User user = ess.getUser(event.getPlayer()); - if (!user.isNew() || user.getBedSpawnLocation() != null) + if (user.hasPlayedBefore()) { + LOGGER.log(Level.FINE, "Old player join"); return; - } - user.setNew(false); + } if (!"none".equalsIgnoreCase(ess.getSettings().getNewbieSpawn())) { - ess.scheduleSyncDelayedTask(new NewPlayerTeleport(user)); + ess.scheduleSyncDelayedTask(new NewPlayerTeleport(user), 1L); } if (ess.getSettings().getAnnounceNewPlayers()) { ess.broadcastMessage(user, ess.getSettings().getAnnounceNewPlayerFormat(user)); } + + LOGGER.log(Level.FINE, "New player join"); } |