diff options
author | KHobbits <rob@khobbits.co.uk> | 2013-07-17 23:26:26 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2013-07-17 23:26:26 +0100 |
commit | fd6257355f552ee4a8761be2a024a1ab4b81986c (patch) | |
tree | 3a4c743d77c05f76a64367c7b2e3845be9563012 | |
parent | 25b7a91ced74a8a21552f7222faf35af799d7a44 (diff) | |
download | Essentials-fd6257355f552ee4a8761be2a024a1ab4b81986c.tar Essentials-fd6257355f552ee4a8761be2a024a1ab4b81986c.tar.gz Essentials-fd6257355f552ee4a8761be2a024a1ab4b81986c.tar.lz Essentials-fd6257355f552ee4a8761be2a024a1ab4b81986c.tar.xz Essentials-fd6257355f552ee4a8761be2a024a1ab4b81986c.zip |
Log notice when chat ignore is blocked by another plugin.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java | 69 | ||||
-rw-r--r-- | EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java | 3 |
2 files changed, 44 insertions, 28 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 9ae51b9e7..99e07f31c 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -52,7 +52,7 @@ public class EssentialsPlayerListener implements Listener final User user = ess.getUser(event.getPlayer()); updateCompass(user); user.setDisplayNick(); - + if (ess.getSettings().isTeleportInvulnerability()) { user.enableInvulnerabilityAfterTeleport(); @@ -69,15 +69,30 @@ public class EssentialsPlayerListener implements Listener user.sendMessage(_("voiceSilenced")); LOGGER.info(_("mutedUserSpeaks", user.getName())); } - final Iterator<Player> it = event.getRecipients().iterator(); - while (it.hasNext()) + try + { + final Iterator<Player> it = event.getRecipients().iterator(); + while (it.hasNext()) + { + final User u = ess.getUser(it.next()); + if (u.isIgnoredPlayer(user)) + { + it.remove(); + } + } + } + catch (UnsupportedOperationException ex) { - final User u = ess.getUser(it.next()); - if (u.isIgnoredPlayer(user)) + if (ess.getSettings().isDebug()) { - it.remove(); + ess.getLogger().log(Level.INFO, "Ignore could not block chat due to custom chat plugin event.", ex); + } + else + { + ess.getLogger().info("Ignore could not block chat due to custom chat plugin event."); } } + user.updateActivity(true); user.setDisplayNick(); } @@ -494,20 +509,20 @@ public class EssentialsPlayerListener implements Listener ess.scheduleSyncDelayedTask( new Runnable() + { + @Override + public void run() + { + Location loc = user.getLocation(); + loc.setX(otarget.getX()); + loc.setZ(otarget.getZ()); + while (LocationUtil.isBlockDamaging(loc.getWorld(), loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ())) { - @Override - public void run() - { - Location loc = user.getLocation(); - loc.setX(otarget.getX()); - loc.setZ(otarget.getZ()); - while (LocationUtil.isBlockDamaging(loc.getWorld(), loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ())) - { - loc.setY(loc.getY() + 1d); - } - user.getBase().teleport(loc, TeleportCause.PLUGIN); - } - }); + loc.setY(loc.getY() + 1d); + } + user.getBase().teleport(loc, TeleportCause.PLUGIN); + } + }); } catch (Exception ex) { @@ -543,14 +558,14 @@ public class EssentialsPlayerListener implements Listener used = true; ess.scheduleSyncDelayedTask( new Runnable() - { - @Override - public void run() - { - user.getServer().dispatchCommand(user.getBase(), command); - LOGGER.log(Level.INFO, String.format("[PT] %s issued server command: /%s", user.getName(), command)); - } - }); + { + @Override + public void run() + { + user.getServer().dispatchCommand(user.getBase(), command); + LOGGER.log(Level.INFO, String.format("[PT] %s issued server command: /%s", user.getName(), command)); + } + }); } } return used; diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java index f61db1a51..284da0a9b 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java @@ -9,6 +9,7 @@ import java.util.Iterator; import java.util.Locale; import java.util.Map; import java.util.Set; +import java.util.logging.Level; import net.ess3.api.events.LocalChatSpyEvent; import org.bukkit.Location; import org.bukkit.Server; @@ -93,7 +94,7 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer { if (ess.getSettings().isDebug()) { - ess.getLogger().info("Plugin triggered custom chat event, local chat handling aborted."); + ess.getLogger().log(Level.INFO, "Plugin triggered custom chat event, local chat handling aborted.", ex); } return; } |