From 545ae8b19d805599df19f6f13c09d1c86efd83e4 Mon Sep 17 00:00:00 2001 From: Llm Dl Date: Mon, 16 Dec 2019 08:40:40 -0600 Subject: [PATCH] - Fixed: GLOBAL channelTypes (default: general and local channels) are no longer formatted by TownyChat if modify_chat.enabled is false. - DEFAULT, TOWN, NATION & ALLIANCE types are still formatted by Towny when modify_chat.enable is false. - Closes: https://github.com/TownyAdvanced/Towny/issues/3568 --- resources/changelog.txt | 5 ++++- .../bukkit/TownyChat/channels/StandardChannel.java | 13 +++++++++---- .../bukkit/TownyChat/config/ChatConfigNodes.java | 6 +++--- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/resources/changelog.txt b/resources/changelog.txt index 64d72b7..8e95895 100644 --- a/resources/changelog.txt +++ b/resources/changelog.txt @@ -287,4 +287,7 @@ v0.65: - Previously using the channel command for the channel you're already speaking in would move you to the next default channel, or if non was found, the next global channel. - Ex: While being in townchat you use "/tc" you could find yourself in globalchat. - - Now you will be told you're already in the channel you just used the command to enter into. \ No newline at end of file + - Now you will be told you're already in the channel you just used the command to enter into. + - Fixed: GLOBAL channelTypes (default: general and local channels) are no longer formatted by TownyChat if modify_chat.enabled is false. + - DEFAULT, TOWN, NATION & ALLIANCE types are still formatted by Towny when modify_chat.enable is false. + - Closes: https://github.com/TownyAdvanced/Towny/issues/3568 \ 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 71d9360..940fbce 100644 --- a/src/com/palmergames/bukkit/TownyChat/channels/StandardChannel.java +++ b/src/com/palmergames/bukkit/TownyChat/channels/StandardChannel.java @@ -124,10 +124,15 @@ public class StandardChannel extends Channel { Format = PlaceholderAPI.setPlaceholders(player, Format); } - event.setFormat(Format.replace("{channelTag}", getChannelTag()).replace("{msgcolour}", getMessageColour())); - - LocalTownyChatEvent chatEvent = new LocalTownyChatEvent(event, resident); - event.setFormat(TownyChatFormatter.getChatFormat(chatEvent)); + /* + * Only modify GLOBAL channelType chat (general and local chat channels) if isModifyChat() is true. + */ + if (!(exec.equals(channelTypes.GLOBAL) && !ChatSettings.isModify_chat())) { + event.setFormat(Format.replace("{channelTag}", getChannelTag()).replace("{msgcolour}", getMessageColour())); + + LocalTownyChatEvent chatEvent = new LocalTownyChatEvent(event, resident); + event.setFormat(TownyChatFormatter.getChatFormat(chatEvent)); + } /* * Set all the listeners for Bukkit to send this message to. diff --git a/src/com/palmergames/bukkit/TownyChat/config/ChatConfigNodes.java b/src/com/palmergames/bukkit/TownyChat/config/ChatConfigNodes.java index ef4813f..01fe172 100644 --- a/src/com/palmergames/bukkit/TownyChat/config/ChatConfigNodes.java +++ b/src/com/palmergames/bukkit/TownyChat/config/ChatConfigNodes.java @@ -137,9 +137,9 @@ public enum ChatConfigNodes { MODIFY_CHAT_ENABLE( "modify_chat.enable", "true", - "# This is used for when you don't have another plugin to format chat.", - "# or you want some other plugin to handle open chat, but want Towny formatting.", - "# It will cause Towny to overwrite any other plugins alterations to the format."), + "# When true Towny will format all ChannelTypes,", + "# When false Towny will only format TOWN, NATION, ALLIANCE, DEFAULT types.", + "# When false Towny will not format GLOBAL types, leaving other chat plugins to do the work."), MODIFY_CHAT_PER_WORLD( "modify_chat.per_world", "false",