diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-01-13 22:41:47 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-01-13 22:41:47 +0000 |
commit | d242de8cc83d36a6d092a12b1c7bea85348f7288 (patch) | |
tree | 94e1ce2c5a9e4b12ebab2c1f92c1fa56da9ad917 /EssentialsSpawn | |
parent | 9006183de4aa7ac69f77ad3bbd88995f7307b89d (diff) | |
download | Essentials-d242de8cc83d36a6d092a12b1c7bea85348f7288.tar Essentials-d242de8cc83d36a6d092a12b1c7bea85348f7288.tar.gz Essentials-d242de8cc83d36a6d092a12b1c7bea85348f7288.tar.lz Essentials-d242de8cc83d36a6d092a12b1c7bea85348f7288.tar.xz Essentials-d242de8cc83d36a6d092a12b1c7bea85348f7288.zip |
Adjusting default spawn behavior.
Moving option in config file.
Diffstat (limited to 'EssentialsSpawn')
-rw-r--r-- | EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java | 2 | ||||
-rw-r--r-- | EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java | 18 |
2 files changed, 14 insertions, 6 deletions
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"); } |