summaryrefslogtreecommitdiffstats
path: root/EssentialsSpawn/src/com/earth2me
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-06-12 02:47:50 +0200
committersnowleo <schneeleo@gmail.com>2011-06-12 02:47:50 +0200
commitedefb21142e020d1edf7eb6b0bfaac4082a6e192 (patch)
tree53df7aa5c03bf7b6bfc2998b8f2c8fabcaac0534 /EssentialsSpawn/src/com/earth2me
parent26c9b34744760ae8bcaa311f7d55c84e888669db (diff)
downloadEssentials-edefb21142e020d1edf7eb6b0bfaac4082a6e192.tar
Essentials-edefb21142e020d1edf7eb6b0bfaac4082a6e192.tar.gz
Essentials-edefb21142e020d1edf7eb6b0bfaac4082a6e192.tar.lz
Essentials-edefb21142e020d1edf7eb6b0bfaac4082a6e192.tar.xz
Essentials-edefb21142e020d1edf7eb6b0bfaac4082a6e192.zip
Fix for Craftbukkit Bug 912
Diffstat (limited to 'EssentialsSpawn/src/com/earth2me')
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java31
1 files changed, 21 insertions, 10 deletions
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
index e1e804e58..96915bd89 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
@@ -15,7 +15,7 @@ import org.bukkit.event.player.PlayerRespawnEvent;
public class EssentialsSpawnPlayerListener extends PlayerListener
{
@Override
- public void onPlayerRespawn(PlayerRespawnEvent event)
+ public void onPlayerRespawn(final PlayerRespawnEvent event)
{
final IEssentials ess = Essentials.getStatic();
final User user = ess.getUser(event.getPlayer());
@@ -25,7 +25,8 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
if (ess.getSettings().getRespawnAtHome())
{
Location home = user.getHome(user.getLocation());
- if (home == null) {
+ if (home == null)
+ {
throw new Exception();
}
event.setRespawnLocation(home);
@@ -36,28 +37,38 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
{
}
Location spawn = ess.getSpawn().getSpawn(user.getGroup());
- if (spawn == null) {
+ if (spawn == null)
+ {
return;
}
event.setRespawnLocation(spawn);
}
@Override
- public void onPlayerJoin(PlayerJoinEvent event)
+ public void onPlayerJoin(final PlayerJoinEvent event)
{
final IEssentials ess = Essentials.getStatic();
final User user = ess.getUser(event.getPlayer());
-
+
if (!user.isNew())
{
return;
}
user.setNew(false);
- try {
- user.getTeleport().now(ess.getSpawn().getSpawn(ess.getSettings().getNewbieSpawn()));
- } catch (Exception ex) {
- Logger.getLogger("Minecraft").log(Level.WARNING, Util.i18n("teleportNewPlayerError"), ex);
- }
+ ess.scheduleSyncDelayedTask(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ user.getTeleport().now(ess.getSpawn().getSpawn(ess.getSettings().getNewbieSpawn()));
+ }
+ catch (Exception ex)
+ {
+ Logger.getLogger("Minecraft").log(Level.WARNING, Util.i18n("teleportNewPlayerError"), ex);
+ }
+ }
+ });
if (ess.getSettings().getAnnounceNewPlayers())
{