Don't run calls against bucket api in async login thread

This commit is contained in:
snowleo 2013-01-30 00:26:50 +01:00
parent 12786a260e
commit cef8cf7b75

View file

@ -175,87 +175,87 @@ public class EssentialsPlayerListener implements Listener
updateCompass(user); updateCompass(user);
user.setLastLogin(System.currentTimeMillis()); user.setLastLogin(System.currentTimeMillis());
user.updateActivity(false); user.updateActivity(false);
ess.scheduleSyncDelayedTask(new Runnable()
if (!ess.getVanishedPlayers().isEmpty() && !user.isAuthorized("essentials.vanish.see"))
{ {
for (String p : ess.getVanishedPlayers()) @Override
public void run()
{ {
Player toVanish = ess.getUser(p).getBase(); if (!ess.getVanishedPlayers().isEmpty() && !user.isAuthorized("essentials.vanish.see"))
if (toVanish.isOnline())
{ {
user.hidePlayer(toVanish);
}
}
}
if (user.isAuthorized("essentials.sleepingignored")) for (String p : ess.getVanishedPlayers())
{ {
ess.scheduleSyncDelayedTask(new Runnable() Player toVanish = ess.getServer().getPlayerExact(p);
{ if (toVanish != null && toVanish.isOnline())
@Override {
public void run() user.hidePlayer(toVanish);
}
}
}
if (user.isAuthorized("essentials.sleepingignored"))
{ {
user.setSleepingIgnored(true); user.setSleepingIgnored(true);
} }
});
}
if (!ess.getSettings().isCommandDisabled("motd") && user.isAuthorized("essentials.motd")) 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); 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());
}
}
} }
else
if (!ess.getSettings().isCommandDisabled("mail") && user.isAuthorized("essentials.mail"))
{ {
LOGGER.log(Level.WARNING, ex.getMessage()); 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()));
}
}
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 (!ess.getSettings().isCommandDisabled("mail") && user.isAuthorized("essentials.mail"))
{
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()));
}
}
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()));
}
}
} }
// Makes the compass item ingame always point to the first essentials home. #EasterEgg // Makes the compass item ingame always point to the first essentials home. #EasterEgg