mirror of
https://github.com/darksaid98/TownyChat.git
synced 2026-12-04 22:21:52 +00:00
v0.35:
- Fix chat spy.
This commit is contained in:
1 parent
ccecd056fa
commit
d997c909ab
5 files changed
+42
-14
No files matched your search
@@ -126,3 +126,12 @@ v0.30:
|
|||||||
v0.31:
|
v0.31:
|
||||||
- Update for the Bukkit move to AsyncPlayerChatEvent.
|
- 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");
|
test = pm.getPlugin("CraftIRC");
|
||||||
if (test != null) {
|
if (test != null) {
|
||||||
try {
|
craftIRC = (CraftIRC) test;
|
||||||
if (Double.valueOf(test.getDescription().getVersion()) >= 3.1) {
|
irc = new CraftIRCHandler(this, craftIRC, "towny");
|
||||||
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!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ public class TownyChatFormatter {
|
|||||||
replacer.registerFormatReplacement(Pattern.quote("{townycolor}"), new TownyChatReplacerCallable() {
|
replacer.registerFormatReplacement(Pattern.quote("{townycolor}"), new TownyChatReplacerCallable() {
|
||||||
@Override
|
@Override
|
||||||
public String call(String match, LocalTownyChatEvent event) throws Exception {
|
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() {
|
replacer.registerFormatReplacement(Pattern.quote("{group}"), new TownyChatReplacerCallable() {
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ public class StandardChannel extends Channel {
|
|||||||
}
|
}
|
||||||
Format = ChatSettings.getRelevantFormatGroup(player).getTOWN();
|
Format = ChatSettings.getRelevantFormatGroup(player).getTOWN();
|
||||||
recipients = new HashSet<Player>(findRecipients(player, TownyUniverse.getOnlinePlayers(town)));
|
recipients = new HashSet<Player>(findRecipients(player, TownyUniverse.getOnlinePlayers(town)));
|
||||||
|
recipients = checkSpying(recipients);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NATION:
|
case NATION:
|
||||||
@@ -86,6 +87,7 @@ public class StandardChannel extends Channel {
|
|||||||
}
|
}
|
||||||
Format = ChatSettings.getRelevantFormatGroup(player).getNATION();
|
Format = ChatSettings.getRelevantFormatGroup(player).getNATION();
|
||||||
recipients = new HashSet<Player>(findRecipients(player, TownyUniverse.getOnlinePlayers(nation)));
|
recipients = new HashSet<Player>(findRecipients(player, TownyUniverse.getOnlinePlayers(nation)));
|
||||||
|
recipients = checkSpying(recipients);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEFAULT:
|
case DEFAULT:
|
||||||
@@ -107,7 +109,9 @@ public class StandardChannel extends Channel {
|
|||||||
/*
|
/*
|
||||||
* Perform all replace functions on this format
|
* 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);
|
LocalTownyChatEvent chatEvent = new LocalTownyChatEvent(event, resident);
|
||||||
event.setFormat(TownyChatFormatter.getChatFormat(chatEvent));
|
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
|
* Check the distance between players and return a result based upon the range setting
|
||||||
* -1 = no limit
|
* -1 = no limit
|
||||||
@@ -257,4 +260,27 @@ public class StandardChannel extends Channel {
|
|||||||
|
|
||||||
return recipients;
|
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
|
name: TownyChat
|
||||||
main: com.palmergames.bukkit.TownyChat.Chat
|
main: com.palmergames.bukkit.TownyChat.Chat
|
||||||
version: 0.31
|
version: 0.35
|
||||||
author: ElgarL, Shade, phrstbrn
|
author: ElgarL, Shade, phrstbrn
|
||||||
website: http://code.google.com/a/eclipselabs.org/p/towny/
|
website: http://code.google.com/a/eclipselabs.org/p/towny/
|
||||||
description: >
|
description: >
|
||||||
TownyChat plugin which hooks Towny.
|
TownyChat plugin which hooks Towny.
|
||||||
|
|
||||||
softdepend: [Towny]
|
softdepend: [Towny, craftIRC]
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
|
|||||||
Reference in new issue
Block a user