summaryrefslogtreecommitdiffstats
path: root/EssentialsSpawn/src
diff options
context:
space:
mode:
authormd_5 <md_5@bigpond.com>2012-12-09 16:03:00 +1100
committermd_5 <md_5@bigpond.com>2012-12-09 16:03:00 +1100
commitf7daa20be83be4148069bcb2aa4c0a53f674c832 (patch)
tree941efa5eee63981bf5d074662f7c7e3d95f2a635 /EssentialsSpawn/src
parenta9ace1163f7cb94a6aab1f18350a5ffa4f022530 (diff)
downloadEssentials-f7daa20be83be4148069bcb2aa4c0a53f674c832.tar
Essentials-f7daa20be83be4148069bcb2aa4c0a53f674c832.tar.gz
Essentials-f7daa20be83be4148069bcb2aa4c0a53f674c832.tar.lz
Essentials-f7daa20be83be4148069bcb2aa4c0a53f674c832.tar.xz
Essentials-f7daa20be83be4148069bcb2aa4c0a53f674c832.zip
Bukkit should have fixed this issue, so we can now get a better first join player experience by teleporting them at once with no delay.
Diffstat (limited to 'EssentialsSpawn/src')
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java60
1 files changed, 13 insertions, 47 deletions
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
index 6fdd4a6a5..259b9b501 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
@@ -3,7 +3,6 @@ package com.earth2me.essentials.spawn;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.Kit;
-import com.earth2me.essentials.OfflinePlayer;
import com.earth2me.essentials.User;
import com.earth2me.essentials.textreader.IText;
import com.earth2me.essentials.textreader.KeywordReplacer;
@@ -72,18 +71,7 @@ public class EssentialsSpawnPlayerListener implements Listener
public void onPlayerJoin(final PlayerJoinEvent event)
{
- ess.scheduleAsyncDelayedTask(new Runnable()
- {
- @Override
- public void run()
- {
- delayedJoin(event.getPlayer());
- }
- });
- }
-
- public void delayedJoin(Player player)
- {
+ Player player = event.getPlayer();
if (player.hasPlayedBefore())
{
LOGGER.log(Level.FINE, "Old player join");
@@ -94,7 +82,18 @@ public class EssentialsSpawnPlayerListener implements Listener
if (!"none".equalsIgnoreCase(ess.getSettings().getNewbieSpawn()))
{
- ess.scheduleSyncDelayedTask(new NewPlayerTeleport(user), 1L);
+ try
+ {
+ final Location spawn = spawns.getSpawn(ess.getSettings().getNewbieSpawn());
+ if (spawn != null)
+ {
+ user.getTeleport().now(spawn, false, TeleportCause.PLUGIN);
+ }
+ }
+ catch (Exception ex)
+ {
+ Bukkit.getLogger().log(Level.WARNING, _("teleportNewPlayerError"), ex);
+ }
}
//This method allows for multiple line player announce messages using multiline yaml syntax #EasterEgg
@@ -126,37 +125,4 @@ public class EssentialsSpawnPlayerListener implements Listener
LOGGER.log(Level.FINE, "New player join");
}
-
-
- private class NewPlayerTeleport implements Runnable
- {
- private final transient User user;
-
- public NewPlayerTeleport(final User user)
- {
- this.user = user;
- }
-
- @Override
- public void run()
- {
- if (user.getBase() instanceof OfflinePlayer)
- {
- return;
- }
-
- try
- {
- final Location spawn = spawns.getSpawn(ess.getSettings().getNewbieSpawn());
- if (spawn != null)
- {
- user.getTeleport().now(spawn, false, TeleportCause.PLUGIN);
- }
- }
- catch (Exception ex)
- {
- Bukkit.getLogger().log(Level.WARNING, _("teleportNewPlayerError"), ex);
- }
- }
- }
}