mirror of
https://github.com/darksaid98/TownyChat.git
synced 2026-12-03 14:38:56 +00:00
v0.35:
- Fix chat spy.
This commit is contained in:
1 parent
ccecd056fa
commit
d997c909ab
5 files changed
+44
-16
No files matched your search
+10
-1
@@ -125,4 +125,13 @@ v0.30:
|
||||
- Stop adding extra logs now that chat is being passed back to bukkit.
|
||||
v0.31:
|
||||
- Update for the Bukkit move to AsyncPlayerChatEvent.
|
||||
- Fix in onPlayerCommandPreprocess for an empty message error.
|
||||
- Fix in onPlayerCommandPreprocess for an empty message error.
|
||||
v0.32:
|
||||
- Don't check version of CraftIRC. Will work with all versions post 3.1.
|
||||
- Fix for not colouring resident titles.
|
||||
v0.33:
|
||||
- Only modify the chat format if modify_chat = true for all channels.
|
||||
v0.34:
|
||||
- Make sure craftIRC is loaded first (if using)
|
||||
v0.35:
|
||||
- Fix chat spy.
|
||||
@@ -129,15 +129,8 @@ public class Chat extends JavaPlugin {
|
||||
*/
|
||||
test = pm.getPlugin("CraftIRC");
|
||||
if (test != null) {
|
||||
try {
|
||||
if (Double.valueOf(test.getDescription().getVersion()) >= 3.1) {
|
||||
craftIRC = (CraftIRC) test;
|
||||
irc = new CraftIRCHandler(this, craftIRC, "towny");
|
||||
} else
|
||||
getLogger().warning("TownyChat requires CraftIRC version 3.1 or higher to relay chat.");
|
||||
} catch (NumberFormatException e) {
|
||||
getLogger().warning("Non number format found for craftIRC version string!");
|
||||
}
|
||||
craftIRC = (CraftIRC) test;
|
||||
irc = new CraftIRCHandler(this, craftIRC, "towny");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -131,7 +131,7 @@ public class TownyChatFormatter {
|
||||
replacer.registerFormatReplacement(Pattern.quote("{townycolor}"), new TownyChatReplacerCallable() {
|
||||
@Override
|
||||
public String call(String match, LocalTownyChatEvent event) throws Exception {
|
||||
return event.getResident().isMayor() ? (event.getResident().isKing() ? ChatSettings.getKingColour() : ChatSettings.getMayorColour()) : "";
|
||||
return event.getResident().isMayor() ? (event.getResident().isKing() ? ChatSettings.getKingColour() : ChatSettings.getMayorColour()) : ChatSettings.getResidentColour();
|
||||
}
|
||||
});
|
||||
replacer.registerFormatReplacement(Pattern.quote("{group}"), new TownyChatReplacerCallable() {
|
||||
|
||||
@@ -77,6 +77,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:
|
||||
@@ -86,6 +87,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:
|
||||
@@ -107,7 +109,9 @@ public class StandardChannel extends Channel {
|
||||
/*
|
||||
* Perform all replace functions on this format
|
||||
*/
|
||||
event.setFormat(Format.replace("{channelTag}", getChannelTag()).replace("{msgcolour}", getMessageColour()));
|
||||
if (ChatSettings.isModify_chat())
|
||||
event.setFormat(Format.replace("{channelTag}", getChannelTag()).replace("{msgcolour}", getMessageColour()));
|
||||
|
||||
LocalTownyChatEvent chatEvent = new LocalTownyChatEvent(event, resident);
|
||||
event.setFormat(TownyChatFormatter.getChatFormat(chatEvent));
|
||||
|
||||
@@ -171,7 +175,6 @@ public class StandardChannel extends Channel {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check the distance between players and return a result based upon the range setting
|
||||
* -1 = no limit
|
||||
@@ -257,4 +260,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;
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
name: TownyChat
|
||||
main: com.palmergames.bukkit.TownyChat.Chat
|
||||
version: 0.31
|
||||
version: 0.35
|
||||
author: ElgarL, Shade, phrstbrn
|
||||
website: http://code.google.com/a/eclipselabs.org/p/towny/
|
||||
description: >
|
||||
TownyChat plugin which hooks Towny.
|
||||
|
||||
softdepend: [Towny]
|
||||
softdepend: [Towny, craftIRC]
|
||||
|
||||
############################################################
|
||||
# +------------------------------------------------------+ #
|
||||
|
||||
Reference in new issue
Block a user