Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to change party chat colour #4835

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.gmail.nossr50.chat.author.Author;
import com.gmail.nossr50.chat.message.ChatMessage;
import com.gmail.nossr50.chat.message.PartyChatMessage;
import com.gmail.nossr50.config.ChatConfig;
import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.events.chat.McMMOChatEvent;
Expand Down Expand Up @@ -31,7 +32,8 @@ public PartyChatMailer(@NotNull Plugin pluginRef) {
* @param canColor whether or not the author can use colors in chat
*/
public void processChatMessage(@NotNull Author author, @NotNull String rawString, @NotNull Party party, boolean isAsync, boolean canColor, boolean isLeader) {
PartyChatMessage chatMessage = new PartyChatMessage(pluginRef, author, constructPartyAudience(party), rawString, addStyle(author, rawString, canColor, isLeader), party);
String coloredMessage = ChatConfig.getInstance().colorChatMessage(rawString);
PartyChatMessage chatMessage = new PartyChatMessage(pluginRef, author, constructPartyAudience(party), rawString, addStyle(author, coloredMessage, canColor, isLeader), party);

McMMOChatEvent chatEvent = new McMMOPartyChatEvent(pluginRef, chatMessage, party, isAsync);
Bukkit.getPluginManager().callEvent(chatEvent);
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/gmail/nossr50/config/ChatConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.util.text.StringUtils;
import org.bukkit.ChatColor;
import org.jetbrains.annotations.NotNull;

public class ChatConfig extends BukkitConfig {
Expand Down Expand Up @@ -51,6 +52,11 @@ public boolean useDisplayNames(@NotNull ChatChannel chatChannel) {
return config.getBoolean(key, true);
}

public String colorChatMessage(String message) {
return ChatColor.translateAlternateColorCodes('&',
config.getString("Chat.Channels.Party.Chat_Color", "&f") + message);
}

public boolean isSpyingAutomatic() {
return config.getBoolean("Chat.Channels.Party.Spies.Automatically_Enable_Spying", false);
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/chat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Chat:
Party:
# Enable or disable party chat
Enable: true
Chat_Color: ''&f'
# Whether or not to use the current display name of a player
Use_Display_Names: true
Spies:
Expand Down