Merge pull request #45 from TownyAdvanced/feature/exclamation_point_option

Make exclamation point shouting optional.
This commit is contained in:
LlmDl authored and GitHub committed 2023-01-22 09:40:15 -06:00
commit 93aa36719c
5 files changed
+18 -2

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@
<groupId>com.palmergames.bukkit</groupId>
<artifactId>TownyChat</artifactId>
<packaging>jar</packaging>
<version>0.102</version>
<version>0.103</version>
<licenses>
<license>
+4
View File
@@ -439,3 +439,7 @@ v0.101:
- 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.
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.)
@@ -168,6 +168,11 @@ public enum ChatConfigNodes {
"true",
"",
"# 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","","");
@@ -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.
*/
@@ -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