diff --git a/.classpath b/.classpath
index 59db0c5..5503245 100644
--- a/.classpath
+++ b/.classpath
@@ -2,11 +2,6 @@
-
-
-
-
-
@@ -17,5 +12,6 @@
+
diff --git a/src/ChatConfig.yml b/src/ChatConfig.yml
index e781518..13c20a1 100644
--- a/src/ChatConfig.yml
+++ b/src/ChatConfig.yml
@@ -84,5 +84,8 @@
# If true the chat formats will be read from below to allow per world formatting.
# These can then be altered individually.
per_world: '[modify_per_world]'
-
+ # If true any player who speaks in a channel in which he cannot be heard,
+ # either by being along in the channel or out-of-range of another player in his chat channel,
+ # that player will see a message saying they cannot be heard.
+ alone_message: '[modify_alone_message]'
worlds:
diff --git a/src/changelog.txt b/src/changelog.txt
index befa2ec..86cffb7 100644
--- a/src/changelog.txt
+++ b/src/changelog.txt
@@ -178,4 +178,11 @@ v0.38:
v0.39:
- Ignore cancelled commands and chat.
v0.40:
- - Allow global chat to pass through un-changed if there are no channels to talk in (requires setting modify_chat: false).
\ No newline at end of file
+ - Allow global chat to pass through un-changed if there are no channels to talk in (requires setting modify_chat: false).
+v0.41:
+ - Adapt to Bukkit API Change.
+v0.42:
+ - Re-add message for when players chat but no one can hear them. Affects mostly localchat but can also been seen when players are the only one in a channel.
+v0.43:
+ - add a new chatconfig.yml option:
+ - modify_chat.alone_message: (default: false) - If true any player who speaks in a channel in which he cannot be heard, either by being along in the channel or out-of-range of another player in his chat channel, that player will see a message saying they cannot be heard.
\ No newline at end of file
diff --git a/src/com/palmergames/bukkit/TownyChat/channels/StandardChannel.java b/src/com/palmergames/bukkit/TownyChat/channels/StandardChannel.java
index d6e2b97..d70175e 100644
--- a/src/com/palmergames/bukkit/TownyChat/channels/StandardChannel.java
+++ b/src/com/palmergames/bukkit/TownyChat/channels/StandardChannel.java
@@ -1,7 +1,6 @@
package com.palmergames.bukkit.TownyChat.channels;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -24,7 +23,6 @@ import com.palmergames.bukkit.towny.object.Nation;
import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.TownyUniverse;
-import com.palmergames.bukkit.util.BukkitTools;
import com.palmergames.bukkit.util.Colors;
public class StandardChannel extends Channel {
@@ -92,17 +90,17 @@ public class StandardChannel extends Channel {
case DEFAULT:
Format = ChatSettings.getRelevantFormatGroup(player).getDEFAULT();
- recipients = new HashSet(findRecipients(player, new ArrayList(Arrays.asList(BukkitTools.getOnlinePlayers()))));
+ recipients = new HashSet(findRecipients(player, new ArrayList(event.getRecipients())));
break;
case GLOBAL:
Format = ChatSettings.getRelevantFormatGroup(player).getGLOBAL();
- recipients = new HashSet(findRecipients(player, new ArrayList(Arrays.asList(BukkitTools.getOnlinePlayers()))));
+ recipients = new HashSet(findRecipients(player, new ArrayList(event.getRecipients())));
break;
case PRIVATE:
Format = ChatSettings.getRelevantFormatGroup(player).getGLOBAL();
- recipients = new HashSet(findRecipients(player, new ArrayList(Arrays.asList(BukkitTools.getOnlinePlayers()))));
+ recipients = new HashSet(findRecipients(player, new ArrayList(event.getRecipients())));
break;
}
@@ -257,8 +255,8 @@ public class StandardChannel extends Channel {
}
}
- //if (recipients.size() <= 1)
- // sender.sendMessage(TownySettings.parseSingleLineString("&cYou feel so lonely."));
+ if ((recipients.size() <= 1) && (ChatSettings.isUsingAloneMessage()))
+ sender.sendMessage("No one in range can hear you or you are alone in this channel.");
return recipients;
}
@@ -271,10 +269,9 @@ public class StandardChannel extends Channel {
*/
private Set checkSpying(Set recipients) {
- List allOnline = new ArrayList(Arrays.asList(BukkitTools.getOnlinePlayers()));
-
+
// Compile the list of recipients with spy perms
- for (Player test : allOnline) {
+ for (Player test : plugin.getServer().getOnlinePlayers()) {
if ((plugin.getTowny().hasPlayerMode(test, "spy")) && !(recipients.contains(test))) {
recipients.add(test);
diff --git a/src/com/palmergames/bukkit/TownyChat/config/ChatSettings.java b/src/com/palmergames/bukkit/TownyChat/config/ChatSettings.java
index 6c23c63..126bdd6 100644
--- a/src/com/palmergames/bukkit/TownyChat/config/ChatSettings.java
+++ b/src/com/palmergames/bukkit/TownyChat/config/ChatSettings.java
@@ -15,6 +15,7 @@ public class ChatSettings extends tag_formats {
private static Double spam_time;
private static boolean modify_chat;
private static boolean per_world;
+ private static boolean alone_message;
private static boolean heroicDeathToIRC = true;
private static String heroicDeathTags ="admin";
@@ -100,6 +101,20 @@ public class ChatSettings extends tag_formats {
ChatSettings.modify_chat = modify_chat;
}
+ /**
+ * @return the alone_message
+ */
+ public static boolean isUsingAloneMessage() {
+ return alone_message;
+ }
+
+ /**
+ * @param alone_message
+ */
+ public static boolean setUsingAloneMessage(boolean alone_message) {
+ return ChatSettings.alone_message = alone_message;
+ }
+
/**
* @return the per_world
*/
diff --git a/src/com/palmergames/bukkit/TownyChat/config/ConfigurationHandler.java b/src/com/palmergames/bukkit/TownyChat/config/ConfigurationHandler.java
index 16497ae..758a256 100644
--- a/src/com/palmergames/bukkit/TownyChat/config/ConfigurationHandler.java
+++ b/src/com/palmergames/bukkit/TownyChat/config/ConfigurationHandler.java
@@ -197,6 +197,9 @@ public class ConfigurationHandler {
if (element.equalsIgnoreCase("per_world"))
ChatSettings.setPer_world(Boolean.valueOf(subNodes.get(element).toString()));
+
+ if (element.equalsIgnoreCase("alone_message"))
+ ChatSettings.setUsingAloneMessage(Boolean.valueOf(subNodes.get(element).toString()));
}
}
@@ -369,6 +372,7 @@ public class ConfigurationHandler {
newConfig = newConfig.replace("[modify_enable]", (defaults)? "true" : Boolean.toString(ChatSettings.isModify_chat()));
newConfig = newConfig.replace("[modify_per_world]", (defaults)? "false" : Boolean.toString(ChatSettings.isPer_world()));
+ newConfig = newConfig.replace("[modify_alone_message]", (defaults)? "false" : Boolean.toString(ChatSettings.isUsingAloneMessage()));
for (String key : ChatSettings.getFormatGroups().keySet()) {
if (!key.equalsIgnoreCase("channel_formats")) {
diff --git a/src/plugin.yml b/src/plugin.yml
index 532f7d9..5703997 100644
--- a/src/plugin.yml
+++ b/src/plugin.yml
@@ -1,6 +1,6 @@
name: TownyChat
main: com.palmergames.bukkit.TownyChat.Chat
-version: {BUILD_VER}
+version: 0.43
author: ElgarL, Shade, phrstbrn
website: http://code.google.com/a/eclipselabs.org/p/towny/
description: >