mirror of
https://github.com/darksaid98/TownyChat.git
synced 2026-12-04 14:38:58 +00:00
- Added a new mode '/towny spy', or '/res set mode spy'.
This requires you have the permission node 'towny.chat.spy' and be using TownyChat. If you toggle this mode on you will be able to see all town/nation/global, and all custom channel chat. - If a player doesn't have the 'towny.chat.global' permission node, any open chat will pass through for any other plugins to handle.
This commit is contained in:
1 parent
62401fae8c
commit
aaf14506a5
3 files changed
+46
-4
No files matched your search
@@ -59,3 +59,8 @@ v0.10:
|
|||||||
or a local channel that covers 100 blocks range
|
or a local channel that covers 100 blocks range
|
||||||
/l,&f[local],&f,towny.chat.local,100
|
/l,&f[local],&f,towny.chat.local,100
|
||||||
|
|
||||||
|
- Added a new mode '/towny spy', or '/res set mode spy'.
|
||||||
|
This requires you have the permission node 'towny.chat.spy' and be using TownyChat.
|
||||||
|
If you toggle this mode on you will be able to see all town/nation/global, and all custom channel chat.
|
||||||
|
- If a player doesn't have the 'towny.chat.global' permission node, any open chat will pass through for any other plugins to handle.
|
||||||
|
|
||||||
@@ -106,6 +106,7 @@ public class TownyPlayerHighestListener extends PlayerListener {
|
|||||||
|
|
||||||
for (String channel : TownySettings.getChatChannels()) {
|
for (String channel : TownySettings.getChatChannels()) {
|
||||||
if (towny.hasPlayerMode(player, channel.replace("/", ""))) {
|
if (towny.hasPlayerMode(player, channel.replace("/", ""))) {
|
||||||
|
if (!towny.isPermissions() || (towny.isPermissions() && TownyUniverse.getPermissionSource().hasPermission(player, TownySettings.getChatChannelPermission(channel)))) {
|
||||||
// Channel Chat
|
// Channel Chat
|
||||||
// Process the chat
|
// Process the chat
|
||||||
chatProcess(event, channel, player);
|
chatProcess(event, channel, player);
|
||||||
@@ -113,9 +114,27 @@ public class TownyPlayerHighestListener extends PlayerListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TownySettings.isUsingModifyChat()) {
|
||||||
|
try {
|
||||||
|
event.setFormat(TownyUniverse.getDataSource().getWorld(player.getWorld().getName()).getChatGlobalChannelFormat());
|
||||||
|
Resident resident = TownyUniverse.getDataSource().getResident(player.getName());
|
||||||
|
|
||||||
|
TownyChatEvent chatEvent = new TownyChatEvent(event, resident);
|
||||||
|
event.setFormat(TownyChatFormatter.getChatFormat(chatEvent));
|
||||||
|
} catch (NotRegisteredException e) {
|
||||||
|
// World or resident not registered with Towny
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// No modes set so this must be open/global chat.
|
// No modes set so this must be open/global chat.
|
||||||
|
if (!towny.isPermissions() || (towny.isPermissions() && TownyUniverse.getPermissionSource().hasPermission(player, TownySettings.getChatChannelPermission("/g"))))
|
||||||
parseGlobalChannelChatCommand(event, "/g", player);
|
parseGlobalChannelChatCommand(event, "/g", player);
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@@ -155,12 +174,14 @@ public class TownyPlayerHighestListener extends PlayerListener {
|
|||||||
event.setFormat(TownyChatFormatter.getChatFormat(chatEvent));
|
event.setFormat(TownyChatFormatter.getChatFormat(chatEvent));
|
||||||
String msg = chatEvent.getFormat().replace("%1$s", event.getPlayer().getDisplayName()).replace("%2$s", event.getMessage());
|
String msg = chatEvent.getFormat().replace("%1$s", event.getPlayer().getDisplayName()).replace("%2$s", event.getMessage());
|
||||||
|
|
||||||
TownyLogger.log.info(ChatTools.stripColour(msg));
|
//TownyLogger.log.info(ChatTools.stripColour(msg));
|
||||||
|
|
||||||
// Relay to IRC
|
// Relay to IRC
|
||||||
if (ircHander != null)
|
if (ircHander != null)
|
||||||
ircHander.IRCSender(msg);
|
ircHander.IRCSender(msg);
|
||||||
|
|
||||||
|
sendSpy(player, "[Town Msg] " + town.getName() + ": " + msg);
|
||||||
|
|
||||||
TownyMessaging.sendTownMessage(town, msg);
|
TownyMessaging.sendTownMessage(town, msg);
|
||||||
} catch (NotRegisteredException x) {
|
} catch (NotRegisteredException x) {
|
||||||
TownyMessaging.sendErrorMsg(player, x.getError());
|
TownyMessaging.sendErrorMsg(player, x.getError());
|
||||||
@@ -178,12 +199,14 @@ public class TownyPlayerHighestListener extends PlayerListener {
|
|||||||
event.setFormat(TownyChatFormatter.getChatFormat(chatEvent));
|
event.setFormat(TownyChatFormatter.getChatFormat(chatEvent));
|
||||||
String msg = chatEvent.getFormat().replace("%1$s", event.getPlayer().getDisplayName()).replace("%2$s", event.getMessage());
|
String msg = chatEvent.getFormat().replace("%1$s", event.getPlayer().getDisplayName()).replace("%2$s", event.getMessage());
|
||||||
|
|
||||||
TownyLogger.log.info(ChatTools.stripColour(msg));
|
//TownyLogger.log.info(ChatTools.stripColour(msg));
|
||||||
|
|
||||||
// Relay to IRC
|
// Relay to IRC
|
||||||
if (ircHander != null)
|
if (ircHander != null)
|
||||||
ircHander.IRCSender(msg);
|
ircHander.IRCSender(msg);
|
||||||
|
|
||||||
|
sendSpy(player, "[Nation Msg] " + nation.getName() + ": " + msg);
|
||||||
|
|
||||||
TownyMessaging.sendNationMessage(nation, msg);
|
TownyMessaging.sendNationMessage(nation, msg);
|
||||||
} catch (NotRegisteredException x) {
|
} catch (NotRegisteredException x) {
|
||||||
TownyMessaging.sendErrorMsg(player, x.getError());
|
TownyMessaging.sendErrorMsg(player, x.getError());
|
||||||
@@ -207,6 +230,8 @@ public class TownyPlayerHighestListener extends PlayerListener {
|
|||||||
if (ircHander != null)
|
if (ircHander != null)
|
||||||
ircHander.IRCSender(msg);
|
ircHander.IRCSender(msg);
|
||||||
|
|
||||||
|
sendSpy(player, msg);
|
||||||
|
|
||||||
for (Player test : TownyUniverse.getOnlinePlayers()) {
|
for (Player test : TownyUniverse.getOnlinePlayers()) {
|
||||||
if (!towny.isPermissions() || (towny.isPermissions() && TownyUniverse.getPermissionSource().hasPermission(test, TownySettings.getChatChannelPermission(command)))) {
|
if (!towny.isPermissions() || (towny.isPermissions() && TownyUniverse.getPermissionSource().hasPermission(test, TownySettings.getChatChannelPermission(command)))) {
|
||||||
|
|
||||||
@@ -220,6 +245,7 @@ public class TownyPlayerHighestListener extends PlayerListener {
|
|||||||
// Failed to fetch user so ignore.
|
// Failed to fetch user so ignore.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ((testDistance(player, test, TownySettings.getChatChannelRange(command))) && (!towny.hasPlayerMode(test, "spy")))
|
||||||
TownyMessaging.sendMessage(test, msg);
|
TownyMessaging.sendMessage(test, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -248,6 +274,8 @@ public class TownyPlayerHighestListener extends PlayerListener {
|
|||||||
if (ircHander != null)
|
if (ircHander != null)
|
||||||
ircHander.IRCSender(msg);
|
ircHander.IRCSender(msg);
|
||||||
|
|
||||||
|
sendSpy(player, msg);
|
||||||
|
|
||||||
if (dynMap != null)
|
if (dynMap != null)
|
||||||
dynMap.postPlayerMessageToWeb(player, event.getMessage());
|
dynMap.postPlayerMessageToWeb(player, event.getMessage());
|
||||||
|
|
||||||
@@ -264,7 +292,7 @@ public class TownyPlayerHighestListener extends PlayerListener {
|
|||||||
// Failed to fetch user so ignore.
|
// Failed to fetch user so ignore.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (testDistance(player, test, TownySettings.getChatChannelRange(command)))
|
if (testDistance(player, test, TownySettings.getChatChannelRange(command)) && (!towny.hasPlayerMode(test, "spy")))
|
||||||
TownyMessaging.sendMessage(test, msg);
|
TownyMessaging.sendMessage(test, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -275,6 +303,15 @@ public class TownyPlayerHighestListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendSpy(Player player, String msg) {
|
||||||
|
|
||||||
|
for (Player test : TownyUniverse.getOnlinePlayers()) {
|
||||||
|
if (towny.hasPlayerMode(test, "spy")) {
|
||||||
|
TownyMessaging.sendMessage(test, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
private boolean isMuted(Player player) {
|
private boolean isMuted(Player player) {
|
||||||
// Check if essentials has this player muted.
|
// Check if essentials has this player muted.
|
||||||
if (towny.isEssentials()) {
|
if (towny.isEssentials()) {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
name: TownyChat
|
name: TownyChat
|
||||||
main: com.palmergames.bukkit.TownyChat.Chat
|
main: com.palmergames.bukkit.TownyChat.Chat
|
||||||
version: 0.10
|
version: 0.11
|
||||||
author: ElgarL, Shade
|
author: ElgarL, Shade
|
||||||
website: http://code.google.com/a/eclipselabs.org/p/towny/
|
website: http://code.google.com/a/eclipselabs.org/p/towny/
|
||||||
description: >
|
description: >
|
||||||
|
|||||||
Reference in new issue
Block a user