summaryrefslogtreecommitdiffstats
path: root/EssentialsSpawn
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-01-13 22:41:47 +0000
committerKHobbits <rob@khobbits.co.uk>2012-01-13 22:41:47 +0000
commit256d202d50db621eb9b89fc29291fe9d111072c6 (patch)
tree14953ae0b4ac946e458600d237511547cba75d34 /EssentialsSpawn
parent4884bed11777cb3fe3e6dfb7c9f328e7cfeb23d4 (diff)
downloadEssentials-256d202d50db621eb9b89fc29291fe9d111072c6.tar
Essentials-256d202d50db621eb9b89fc29291fe9d111072c6.tar.gz
Essentials-256d202d50db621eb9b89fc29291fe9d111072c6.tar.lz
Essentials-256d202d50db621eb9b89fc29291fe9d111072c6.tar.xz
Essentials-256d202d50db621eb9b89fc29291fe9d111072c6.zip
Adjusting default spawn behavior.
Moving option in config file.
Diffstat (limited to 'EssentialsSpawn')
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java2
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java18
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");
}