summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2013-01-30 00:26:50 +0100
committersnowleo <schneeleo@gmail.com>2013-01-30 00:26:50 +0100
commitcef8cf7b75a5412a09cbd77bd7f0fadeb7ad8cb0 (patch)
tree80bb679d0879e15ebfa5b570c3be95d8a79ad7e0
parent12786a260ea2e83007374bc38e5cf4452f308c7d (diff)
downloadEssentials-cef8cf7b75a5412a09cbd77bd7f0fadeb7ad8cb0.tar
Essentials-cef8cf7b75a5412a09cbd77bd7f0fadeb7ad8cb0.tar.gz
Essentials-cef8cf7b75a5412a09cbd77bd7f0fadeb7ad8cb0.tar.lz
Essentials-cef8cf7b75a5412a09cbd77bd7f0fadeb7ad8cb0.tar.xz
Essentials-cef8cf7b75a5412a09cbd77bd7f0fadeb7ad8cb0.zip
Don't run calls against bucket api in async login thread
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java130
1 files changed, 65 insertions, 65 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
index 47672288d..e429304fb 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
@@ -175,87 +175,87 @@ public class EssentialsPlayerListener implements Listener
updateCompass(user);
user.setLastLogin(System.currentTimeMillis());
user.updateActivity(false);
-
- if (!ess.getVanishedPlayers().isEmpty() && !user.isAuthorized("essentials.vanish.see"))
+ ess.scheduleSyncDelayedTask(new Runnable()
{
- for (String p : ess.getVanishedPlayers())
+ @Override
+ public void run()
{
- Player toVanish = ess.getUser(p).getBase();
- if (toVanish.isOnline())
+ if (!ess.getVanishedPlayers().isEmpty() && !user.isAuthorized("essentials.vanish.see"))
{
- user.hidePlayer(toVanish);
+
+ for (String p : ess.getVanishedPlayers())
+ {
+ Player toVanish = ess.getServer().getPlayerExact(p);
+ if (toVanish != null && toVanish.isOnline())
+ {
+ user.hidePlayer(toVanish);
+ }
+ }
}
- }
- }
- if (user.isAuthorized("essentials.sleepingignored"))
- {
- ess.scheduleSyncDelayedTask(new Runnable()
- {
- @Override
- public void run()
+ if (user.isAuthorized("essentials.sleepingignored"))
{
user.setSleepingIgnored(true);
}
- });
- }
- if (!ess.getSettings().isCommandDisabled("motd") && user.isAuthorized("essentials.motd"))
- {
- try
- {
- final IText input = new TextInput(user, "motd", true, ess);
- final IText output = new KeywordReplacer(input, user, ess);
- final TextPager pager = new TextPager(output, true);
- pager.showPage("1", null, "motd", user);
- }
- catch (IOException ex)
- {
- if (ess.getSettings().isDebug())
- {
- LOGGER.log(Level.WARNING, ex.getMessage(), ex);
- }
- else
+ if (!ess.getSettings().isCommandDisabled("motd") && user.isAuthorized("essentials.motd"))
{
- LOGGER.log(Level.WARNING, ex.getMessage());
+ try
+ {
+ final IText input = new TextInput(user, "motd", true, ess);
+ final IText output = new KeywordReplacer(input, user, ess);
+ final TextPager pager = new TextPager(output, true);
+ pager.showPage("1", null, "motd", user);
+ }
+ catch (IOException ex)
+ {
+ if (ess.getSettings().isDebug())
+ {
+ LOGGER.log(Level.WARNING, ex.getMessage(), ex);
+ }
+ else
+ {
+ LOGGER.log(Level.WARNING, ex.getMessage());
+ }
+ }
}
- }
- }
- if (!ess.getSettings().isCommandDisabled("mail") && user.isAuthorized("essentials.mail"))
- {
- final List<String> mail = user.getMails();
- if (mail.isEmpty())
- {
- final String msg = _("noNewMail");
- if (!msg.isEmpty())
+ if (!ess.getSettings().isCommandDisabled("mail") && user.isAuthorized("essentials.mail"))
{
- user.sendMessage(msg);
+ final List<String> mail = user.getMails();
+ if (mail.isEmpty())
+ {
+ final String msg = _("noNewMail");
+ if (!msg.isEmpty())
+ {
+ user.sendMessage(msg);
+ }
+ }
+ else
+ {
+ user.sendMessage(_("youHaveNewMail", mail.size()));
+ }
}
- }
- else
- {
- user.sendMessage(_("youHaveNewMail", mail.size()));
- }
- }
- if (user.isAuthorized("essentials.fly.safelogin"))
- {
- final World world = user.getLocation().getWorld();
- final int x = user.getLocation().getBlockX();
- int y = user.getLocation().getBlockY();
- final int z = user.getLocation().getBlockZ();
- while (Util.isBlockUnsafe(world, x, y, z) && y > -1)
- {
- y--;
- }
+ if (user.isAuthorized("essentials.fly.safelogin"))
+ {
+ final World world = user.getLocation().getWorld();
+ final int x = user.getLocation().getBlockX();
+ int y = user.getLocation().getBlockY();
+ final int z = user.getLocation().getBlockZ();
+ while (Util.isBlockUnsafe(world, x, y, z) && y > -1)
+ {
+ y--;
+ }
- if (user.getLocation().getBlockY() - y > 1 || y < 0)
- {
- user.setAllowFlight(true);
- user.setFlying(true);
- user.sendMessage(_("flyMode", _("enabled"), user.getDisplayName()));
+ if (user.getLocation().getBlockY() - y > 1 || y < 0)
+ {
+ user.setAllowFlight(true);
+ user.setFlying(true);
+ user.sendMessage(_("flyMode", _("enabled"), user.getDisplayName()));
+ }
+ }
}
- }
+ });
}
// Makes the compass item ingame always point to the first essentials home. #EasterEgg