From 238b3cb45aca0399ec6b4b7eaaf77a33531f28bb Mon Sep 17 00:00:00 2001 From: LlmDl Date: Sun, 22 Jan 2023 09:38:43 -0600 Subject: [PATCH] - New Config Option: allow_exclamation_point_to_shout - Default: true - If true players that say !somewords will have their message sent to a global type channel with unlimited range (usually your general chat.) --- pom.xml | 2 +- resources/changelog.txt | 6 +++++- .../bukkit/TownyChat/config/ChatConfigNodes.java | 7 ++++++- .../palmergames/bukkit/TownyChat/config/ChatSettings.java | 7 +++++++ .../bukkit/TownyChat/listener/TownyChatPlayerListener.java | 2 +- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 1aee88e..e3239ef 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ com.palmergames.bukkit TownyChat jar - 0.102 + 0.103 diff --git a/resources/changelog.txt b/resources/changelog.txt index 6187082..0711776 100644 --- a/resources/changelog.txt +++ b/resources/changelog.txt @@ -438,4 +438,8 @@ v0.101: - Update min. Towny version to 0.98.5.0 & replace deprecated methods. - Fix permission test backing /channel join {channelname}. v0.102: - - Parse placeholders when we're unable to find a channel to speak into, but modify_chat is true. \ No newline at end of file + - Parse placeholders when we're unable to find a channel to speak into, but modify_chat is true. +v0.103: + - New Config Option: allow_exclamation_point_to_shout + - Default: true + - If true players that say !somewords will have their message sent to a global type channel with unlimited range (usually your general chat.) \ No newline at end of file diff --git a/src/com/palmergames/bukkit/TownyChat/config/ChatConfigNodes.java b/src/com/palmergames/bukkit/TownyChat/config/ChatConfigNodes.java index cd3d9cc..6b526c8 100644 --- a/src/com/palmergames/bukkit/TownyChat/config/ChatConfigNodes.java +++ b/src/com/palmergames/bukkit/TownyChat/config/ChatConfigNodes.java @@ -167,7 +167,12 @@ public enum ChatConfigNodes { "display_channel_join_message_on_joining_the_server", "true", "", - "# If true players will see You have joined channel {channel} message on joining the server."), + "# If true players will see You have joined channel {channel} message on joining the server."), + ALLOW_EXCLAMATION_POINT_SHOUTS( + "allow_exclamation_point_to_shout", + "true", + "", + "# If true players that say !somewords will have their message sent to a global type channel with unlimited range (usually your general chat.)"), WORLDS("worlds","",""); diff --git a/src/com/palmergames/bukkit/TownyChat/config/ChatSettings.java b/src/com/palmergames/bukkit/TownyChat/config/ChatSettings.java index a914511..a2a27e8 100644 --- a/src/com/palmergames/bukkit/TownyChat/config/ChatSettings.java +++ b/src/com/palmergames/bukkit/TownyChat/config/ChatSettings.java @@ -177,6 +177,13 @@ public class ChatSettings { return getBoolean(ChatConfigNodes.DISPLAY_CHANNEL_JOIN_MESSAGE_ON_JOIN); } + /** + * @return true if preceding exclamation points shouts into global channel with unlimited range. + */ + public static boolean isExclamationPoint() { + return getBoolean(ChatConfigNodes.ALLOW_EXCLAMATION_POINT_SHOUTS); + } + /* * Get Tags formats. */ diff --git a/src/com/palmergames/bukkit/TownyChat/listener/TownyChatPlayerListener.java b/src/com/palmergames/bukkit/TownyChat/listener/TownyChatPlayerListener.java index 9cd4a8c..22e1f6c 100644 --- a/src/com/palmergames/bukkit/TownyChat/listener/TownyChatPlayerListener.java +++ b/src/com/palmergames/bukkit/TownyChat/listener/TownyChatPlayerListener.java @@ -75,7 +75,7 @@ public class TownyChatPlayerListener implements Listener { // Check if essentials has this player muted. if (!isEssentialsMuted(player)) { - boolean forceGlobal = event.getMessage().startsWith("!"); + boolean forceGlobal = ChatSettings.isExclamationPoint() && event.getMessage().startsWith("!"); /* * If this was directed chat send it via the relevant channel