diff options
author | snowleo <schneeleo@gmail.com> | 2013-02-08 21:16:21 +0100 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2013-02-08 21:16:21 +0100 |
commit | 61d53a3347e9381d2291fec7da9f53d9868d1660 (patch) | |
tree | 459a0e82d39951c39863a816a27baf6d033867f8 /EssentialsSpawn | |
parent | 28a04d34605e77d8bac2a35e0af54a24f7396506 (diff) | |
download | Essentials-61d53a3347e9381d2291fec7da9f53d9868d1660.tar Essentials-61d53a3347e9381d2291fec7da9f53d9868d1660.tar.gz Essentials-61d53a3347e9381d2291fec7da9f53d9868d1660.tar.lz Essentials-61d53a3347e9381d2291fec7da9f53d9868d1660.tar.xz Essentials-61d53a3347e9381d2291fec7da9f53d9868d1660.zip |
Fix async access to bukkit code
Diffstat (limited to 'EssentialsSpawn')
-rw-r--r-- | EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java | 56 |
1 files changed, 31 insertions, 25 deletions
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index 391b6cf58..0ff6a8cb2 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -15,7 +15,6 @@ import java.util.logging.Level; 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; @@ -97,34 +96,41 @@ public class EssentialsSpawnPlayerListener implements Listener ess.scheduleSyncDelayedTask(new NewPlayerTeleport(user), 1L); } - //This method allows for multiple line player announce messages using multiline yaml syntax #EasterEgg - if (ess.getSettings().getAnnounceNewPlayers()) + ess.scheduleSyncDelayedTask(new Runnable() { - final IText output = new KeywordReplacer(ess.getSettings().getAnnounceNewPlayerFormat(), user, ess); - final SimpleTextPager pager = new SimpleTextPager(output); - - for (String line : pager.getLines()) + @Override + public void run() { - ess.broadcastMessage(user, line); - } - } + //This method allows for multiple line player announce messages using multiline yaml syntax #EasterEgg + if (ess.getSettings().getAnnounceNewPlayers()) + { + final IText output = new KeywordReplacer(ess.getSettings().getAnnounceNewPlayerFormat(), user, ess); + final SimpleTextPager pager = new SimpleTextPager(output); - final String kitName = ess.getSettings().getNewPlayerKit(); - if (!kitName.isEmpty()) - { - try - { - final Map<String, Object> kit = ess.getSettings().getKit(kitName.toLowerCase(Locale.ENGLISH)); - final List<String> items = Kit.getItems(user, kit); - Kit.expandItems(ess, user, items); - } - catch (Exception ex) - { - LOGGER.log(Level.WARNING, ex.getMessage()); - } - } + for (String line : pager.getLines()) + { + ess.broadcastMessage(user, line); + } + } - LOGGER.log(Level.FINE, "New player join"); + final String kitName = ess.getSettings().getNewPlayerKit(); + if (!kitName.isEmpty()) + { + try + { + final Map<String, Object> kit = ess.getSettings().getKit(kitName.toLowerCase(Locale.ENGLISH)); + final List<String> items = Kit.getItems(user, kit); + Kit.expandItems(ess, user, items); + } + catch (Exception ex) + { + LOGGER.log(Level.WARNING, ex.getMessage()); + } + } + + LOGGER.log(Level.FINE, "New player join"); + } + }); } |