diff options
author | Iaccidentally <coryhuckaby@gmail.com> | 2013-12-06 18:17:06 -0800 |
---|---|---|
committer | Iaccidentally <coryhuckaby@gmail.com> | 2013-12-06 18:17:06 -0800 |
commit | fed250fd7471defac2d3cc268db1fdd93fdb0b6c (patch) | |
tree | 4b69eb342e1bb3759dab625c7da0378fc5447e6f | |
parent | b836b3c0419d8454137acf48642b92c1c7eb3889 (diff) | |
parent | 5fe19dbd8321beaec20d359cc85371b6320c33ec (diff) | |
download | Essentials-fed250fd7471defac2d3cc268db1fdd93fdb0b6c.tar Essentials-fed250fd7471defac2d3cc268db1fdd93fdb0b6c.tar.gz Essentials-fed250fd7471defac2d3cc268db1fdd93fdb0b6c.tar.lz Essentials-fed250fd7471defac2d3cc268db1fdd93fdb0b6c.tar.xz Essentials-fed250fd7471defac2d3cc268db1fdd93fdb0b6c.zip |
Merge pull request #605 from Phryxiil/2.x
Fixed bug when logging in silently
-rw-r--r-- | Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 4547ead88..ddc0cd950 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -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 |