diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-09-08 14:55:37 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-09-08 14:55:37 +0100 |
commit | 684e6c06fb08ed839c1dff9af0e7b6982d83c6f4 (patch) | |
tree | 4e45dfc9a151b992d56ea63eaf99d31ce2be0f04 /EssentialsSpawn | |
parent | c3228f1bd6b59ed7a60d7edb6025e2a327e3a3b5 (diff) | |
download | Essentials-684e6c06fb08ed839c1dff9af0e7b6982d83c6f4.tar Essentials-684e6c06fb08ed839c1dff9af0e7b6982d83c6f4.tar.gz Essentials-684e6c06fb08ed839c1dff9af0e7b6982d83c6f4.tar.lz Essentials-684e6c06fb08ed839c1dff9af0e7b6982d83c6f4.tar.xz Essentials-684e6c06fb08ed839c1dff9af0e7b6982d83c6f4.zip |
Async EssentialsSpawn join event, like the others.
Diffstat (limited to 'EssentialsSpawn')
-rw-r--r-- | EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index ba71c176f..52567de41 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -1,7 +1,10 @@ package com.earth2me.essentials.spawn; -import com.earth2me.essentials.*; 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; import com.earth2me.essentials.textreader.SimpleTextPager; @@ -13,6 +16,7 @@ import java.util.logging.Logger; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.entity.Player; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerRespawnEvent; @@ -68,13 +72,25 @@ public class EssentialsSpawnPlayerListener implements Listener public void onPlayerJoin(final PlayerJoinEvent event) { - if (event.getPlayer().hasPlayedBefore()) + ess.scheduleAsyncDelayedTask(new Runnable() + { + @Override + public void run() + { + delayedJoin(event.getPlayer()); + } + }); + } + + public void delayedJoin(Player player) + { + if (player.hasPlayedBefore()) { LOGGER.log(Level.FINE, "Old player join"); return; } - final User user = ess.getUser(event.getPlayer()); + final User user = ess.getUser(player); if (!"none".equalsIgnoreCase(ess.getSettings().getNewbieSpawn())) { |