- Fix chat spy.
This commit is contained in:
ElgarL committed 2012-12-05 17:36:35 +00:00
1 parent 3ada8dd4ec
commit bc4fd7d887
3 files changed
+28 -3

No files matched your search

+3 -1
View File
@@ -132,4 +132,6 @@ v0.32:
v0.33:
- Only modify the chat format if modify_chat = true for all channels.
v0.34:
- Make sure craftIRC is loaded first (if using)
- Make sure craftIRC is loaded first (if using)
v0.35:
- Fix chat spy.
@@ -66,6 +66,7 @@ public class StandardChannel extends Channel {
}
Format = ChatSettings.getRelevantFormatGroup(player).getTOWN();
recipients = new HashSet<Player>(findRecipients(player, TownyUniverse.getOnlinePlayers(town)));
recipients = checkSpying(recipients);
break;
case NATION:
@@ -75,6 +76,7 @@ public class StandardChannel extends Channel {
}
Format = ChatSettings.getRelevantFormatGroup(player).getNATION();
recipients = new HashSet<Player>(findRecipients(player, TownyUniverse.getOnlinePlayers(nation)));
recipients = checkSpying(recipients);
break;
case DEFAULT:
@@ -145,7 +147,6 @@ public class StandardChannel extends Channel {
}
/**
* Check the distance between players and return a result based upon the range setting
* -1 = no limit
@@ -224,5 +225,27 @@ public class StandardChannel extends Channel {
return recipients;
}
/**
* Add all spying players to the recipients list.
*
* @param recipients
* @return new recipients including spying.
*/
private Set<Player> checkSpying(Set<Player> recipients) {
List<Player> allOnline = new ArrayList<Player>(Arrays.asList(BukkitTools.getOnlinePlayers()));
// Compile the list of recipients with spy perms
for (Player test : allOnline) {
if ((plugin.getTowny().hasPlayerMode(test, "spy")) && !(recipients.contains(test))) {
recipients.add(test);
}
}
return recipients;
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
name: TownyChat
main: com.palmergames.bukkit.TownyChat.Chat
version: 0.34
version: 0.35
author: ElgarL, Shade, phrstbrn
website: http://code.google.com/a/eclipselabs.org/p/towny/
description: >