Fixed bug when logging in silently

This commit is contained in:
Zarubinator 2013-12-06 21:15:27 -05:00
parent b836b3c041
commit 5fe19dbd83

View File

@ -186,19 +186,30 @@ public class EssentialsPlayerListener implements Listener
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerJoin(final PlayerJoinEvent event)
{
final String joinMessage = event.getJoinMessage();
ess.runTaskAsynchronously(new Runnable()
{
@Override
public void run()
{
delayedJoin(event.getPlayer(), joinMessage);
delayedJoin(event.getPlayer());
}
});
event.setJoinMessage(null);
if (ess.getSettings().allowSilentJoinQuit() && event.getPlayer().hasPermission("essentials.silentjoin"))
{
event.setJoinMessage(null);
}
if (ess.getSettings().isCustomJoinMessage() && event.getJoinMessage() != null)
{
event.setJoinMessage(null);
ess.getServer().broadcastMessage(
ess.getSettings().getCustomJoinMessage()
.replace("{PLAYER}", event.getPlayer().getDisplayName())
.replace("{USERNAME}", event.getPlayer().getName())
);
}
}
public void delayedJoin(final Player player, final String message)
public void delayedJoin(final Player player)
{
if (!player.isOnline())
{
@ -208,7 +219,6 @@ public class EssentialsPlayerListener implements Listener
ess.getBackup().onPlayerJoin();
final User user = ess.getUser(player);
if (user.isNPC())
{
user.setNPC(false);
@ -249,19 +259,6 @@ public class EssentialsPlayerListener implements Listener
user.setSleepingIgnored(true);
}
if (ess.getSettings().isCustomJoinMessage())
{
ess.getServer().broadcastMessage(
ess.getSettings().getCustomJoinMessage()
.replace("{PLAYER}", player.getDisplayName())
.replace("{USERNAME}", player.getName())
);
}
else if (!(ess.getSettings().allowSilentJoinQuit() && user.isAuthorized("esentials.silentjoin")) && message != null)
{
ess.getServer().broadcastMessage(message);
}
if (!ess.getSettings().isCommandDisabled("motd") && user.isAuthorized("essentials.motd"))
{
try