0.42 + 0.43

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.
This commit is contained in:
LlmDl committed 2015-04-26 22:56:37 -05:00
1 parent b283f972b3
commit 68286f3427
7 files changed
+40 -18

No files matched your search

+1 -5
View File
@@ -2,11 +2,6 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="../lib/bukkit.jar">
<attributes>
<attribute name="javadoc_location" value="http://jd.bukkit.org/apidocs/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="../lib/Towny.jar"> <classpathentry kind="lib" path="../lib/Towny.jar">
<attributes> <attributes>
<attribute name="javadoc_location" value="http://palmergames.com/javadoc"/> <attribute name="javadoc_location" value="http://palmergames.com/javadoc"/>
@@ -17,5 +12,6 @@
<classpathentry kind="lib" path="../lib/dynmap-api.jar"/> <classpathentry kind="lib" path="../lib/dynmap-api.jar"/>
<classpathentry kind="lib" path="../lib/HeroicDeath.jar"/> <classpathentry kind="lib" path="../lib/HeroicDeath.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/Towny"/> <classpathentry combineaccessrules="false" kind="src" path="/Towny"/>
<classpathentry kind="lib" path="D:/MCSERVER/Bukkit 1.8/Bukkit/target/bukkit-1.8-R0.1-SNAPSHOT.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>
+4 -1
View File
@@ -84,5 +84,8 @@
# If true the chat formats will be read from below to allow per world formatting. # If true the chat formats will be read from below to allow per world formatting.
# These can then be altered individually. # These can then be altered individually.
per_world: '[modify_per_world]' 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: worlds:
+8 -1
View File
@@ -178,4 +178,11 @@ v0.38:
v0.39: v0.39:
- Ignore cancelled commands and chat. - Ignore cancelled commands and chat.
v0.40: v0.40:
- Allow global chat to pass through un-changed if there are no channels to talk in (requires setting modify_chat: false). - 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.
@@ -1,7 +1,6 @@
package com.palmergames.bukkit.TownyChat.channels; package com.palmergames.bukkit.TownyChat.channels;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; 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.Resident;
import com.palmergames.bukkit.towny.object.Town; import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.TownyUniverse; import com.palmergames.bukkit.towny.object.TownyUniverse;
import com.palmergames.bukkit.util.BukkitTools;
import com.palmergames.bukkit.util.Colors; import com.palmergames.bukkit.util.Colors;
public class StandardChannel extends Channel { public class StandardChannel extends Channel {
@@ -92,17 +90,17 @@ public class StandardChannel extends Channel {
case DEFAULT: case DEFAULT:
Format = ChatSettings.getRelevantFormatGroup(player).getDEFAULT(); Format = ChatSettings.getRelevantFormatGroup(player).getDEFAULT();
recipients = new HashSet<Player>(findRecipients(player, new ArrayList<Player>(Arrays.asList(BukkitTools.getOnlinePlayers())))); recipients = new HashSet<Player>(findRecipients(player, new ArrayList<Player>(event.getRecipients())));
break; break;
case GLOBAL: case GLOBAL:
Format = ChatSettings.getRelevantFormatGroup(player).getGLOBAL(); Format = ChatSettings.getRelevantFormatGroup(player).getGLOBAL();
recipients = new HashSet<Player>(findRecipients(player, new ArrayList<Player>(Arrays.asList(BukkitTools.getOnlinePlayers())))); recipients = new HashSet<Player>(findRecipients(player, new ArrayList<Player>(event.getRecipients())));
break; break;
case PRIVATE: case PRIVATE:
Format = ChatSettings.getRelevantFormatGroup(player).getGLOBAL(); Format = ChatSettings.getRelevantFormatGroup(player).getGLOBAL();
recipients = new HashSet<Player>(findRecipients(player, new ArrayList<Player>(Arrays.asList(BukkitTools.getOnlinePlayers())))); recipients = new HashSet<Player>(findRecipients(player, new ArrayList<Player>(event.getRecipients())));
break; break;
} }
@@ -257,8 +255,8 @@ public class StandardChannel extends Channel {
} }
} }
//if (recipients.size() <= 1) if ((recipients.size() <= 1) && (ChatSettings.isUsingAloneMessage()))
// sender.sendMessage(TownySettings.parseSingleLineString("&cYou feel so lonely.")); sender.sendMessage("No one in range can hear you or you are alone in this channel.");
return recipients; return recipients;
} }
@@ -271,10 +269,9 @@ public class StandardChannel extends Channel {
*/ */
private Set<Player> checkSpying(Set<Player> recipients) { 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 // 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))) { if ((plugin.getTowny().hasPlayerMode(test, "spy")) && !(recipients.contains(test))) {
recipients.add(test); recipients.add(test);
@@ -15,6 +15,7 @@ public class ChatSettings extends tag_formats {
private static Double spam_time; private static Double spam_time;
private static boolean modify_chat; private static boolean modify_chat;
private static boolean per_world; private static boolean per_world;
private static boolean alone_message;
private static boolean heroicDeathToIRC = true; private static boolean heroicDeathToIRC = true;
private static String heroicDeathTags ="admin"; private static String heroicDeathTags ="admin";
@@ -100,6 +101,20 @@ public class ChatSettings extends tag_formats {
ChatSettings.modify_chat = modify_chat; 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 * @return the per_world
*/ */
@@ -197,6 +197,9 @@ public class ConfigurationHandler {
if (element.equalsIgnoreCase("per_world")) if (element.equalsIgnoreCase("per_world"))
ChatSettings.setPer_world(Boolean.valueOf(subNodes.get(element).toString())); 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_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_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()) { for (String key : ChatSettings.getFormatGroups().keySet()) {
if (!key.equalsIgnoreCase("channel_formats")) { if (!key.equalsIgnoreCase("channel_formats")) {
+1 -1
View File
@@ -1,6 +1,6 @@
name: TownyChat name: TownyChat
main: com.palmergames.bukkit.TownyChat.Chat main: com.palmergames.bukkit.TownyChat.Chat
version: {BUILD_VER} version: 0.43
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: >