Skip to content

Commit

Permalink
- Fixed: GLOBAL channelTypes (default: general and local channels) are
Browse files Browse the repository at this point in the history
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: TownyAdvanced/Towny#3568
  • Loading branch information
LlmDl committed Dec 16, 2019
1 parent 068b186 commit 545ae8b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
5 changes: 4 additions & 1 deletion resources/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
- 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
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,15 @@ public void chatProcess(AsyncPlayerChatEvent event) {
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

1 comment on commit 545ae8b

@WalshyDev
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️ ❤️

Please sign in to comment.