From 02200e57932199583db25e81da008fa1c91ac27e Mon Sep 17 00:00:00 2001 From: Brettflan Date: Sat, 25 Feb 2012 04:44:28 -0600 Subject: [PATCH] UNTESTED: fix for chatspy not working with CAPI chat integration If it's still not working correctly, let me know --- .../integration/capi/PluginCapiListener.java | 12 ++++++++++-- .../listeners/FactionsChatEarlyListener.java | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/com/massivecraft/factions/integration/capi/PluginCapiListener.java b/src/com/massivecraft/factions/integration/capi/PluginCapiListener.java index 85d5e765..c1a04273 100644 --- a/src/com/massivecraft/factions/integration/capi/PluginCapiListener.java +++ b/src/com/massivecraft/factions/integration/capi/PluginCapiListener.java @@ -77,6 +77,13 @@ public class PluginCapiListener implements Listener if (event.getChannel().getId().equals("faction") && myFaction.isNormal()) { event.getThem().addAll(myFaction.getOnlinePlayers()); + + // Send to any players who are spying chat... could probably be implemented better than this + for (FPlayer fplayer : FPlayers.i.getOnline()) + { + if(fplayer.isSpyingChat() && fplayer.getFaction() != myFaction) + fplayer.sendMessage("[FCspy] "+myFaction.getTag()+": "+event.getMessage()); + } } else if (event.getChannel().getId().equals("allies")) { @@ -84,9 +91,10 @@ public class PluginCapiListener implements Listener { FPlayer someFPlayer = FPlayers.i.get(somePlayer); if (someFPlayer.getRelationTo(fme).isAtLeast(Rel.ALLY)) - { event.getThem().add(somePlayer); - } + // Send to any players who are spying chat + else if(someFPlayer.isSpyingChat()) + someFPlayer.sendMessage("[ACspy]: " + event.getMessage()); } } } diff --git a/src/com/massivecraft/factions/listeners/FactionsChatEarlyListener.java b/src/com/massivecraft/factions/listeners/FactionsChatEarlyListener.java index 40e569c3..458eb8d2 100644 --- a/src/com/massivecraft/factions/listeners/FactionsChatEarlyListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsChatEarlyListener.java @@ -59,7 +59,7 @@ public class FactionsChatEarlyListener implements Listener for (FPlayer fplayer : FPlayers.i.getOnline()) { if(fplayer.isSpyingChat() && fplayer.getFaction() != myFaction) - fplayer.sendMessage("[FCspy] "+myFaction.getTag()+": "+message); + fplayer.sendMessage("[FCspy] "+myFaction.getTag()+": "+message); } event.setCancelled(true);