mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 06:06:45 +01:00
Add ability to change party chat colour
This commit is contained in:
parent
30ac82181e
commit
ea1b1d04b7
@ -3,6 +3,7 @@ package com.gmail.nossr50.chat.mailer;
|
|||||||
import com.gmail.nossr50.chat.author.Author;
|
import com.gmail.nossr50.chat.author.Author;
|
||||||
import com.gmail.nossr50.chat.message.ChatMessage;
|
import com.gmail.nossr50.chat.message.ChatMessage;
|
||||||
import com.gmail.nossr50.chat.message.PartyChatMessage;
|
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.chat.ChatChannel;
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.events.chat.McMMOChatEvent;
|
import com.gmail.nossr50.events.chat.McMMOChatEvent;
|
||||||
@ -31,7 +32,8 @@ public class PartyChatMailer extends AbstractChatMailer {
|
|||||||
* @param canColor whether or not the author can use colors in chat
|
* @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) {
|
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);
|
McMMOChatEvent chatEvent = new McMMOPartyChatEvent(pluginRef, chatMessage, party, isAsync);
|
||||||
Bukkit.getPluginManager().callEvent(chatEvent);
|
Bukkit.getPluginManager().callEvent(chatEvent);
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.config;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.chat.ChatChannel;
|
import com.gmail.nossr50.datatypes.chat.ChatChannel;
|
||||||
import com.gmail.nossr50.util.text.StringUtils;
|
import com.gmail.nossr50.util.text.StringUtils;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ChatConfig extends BukkitConfig {
|
public class ChatConfig extends BukkitConfig {
|
||||||
@ -51,6 +52,11 @@ public class ChatConfig extends BukkitConfig {
|
|||||||
return config.getBoolean(key, true);
|
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() {
|
public boolean isSpyingAutomatic() {
|
||||||
return config.getBoolean("Chat.Channels.Party.Spies.Automatically_Enable_Spying", false);
|
return config.getBoolean("Chat.Channels.Party.Spies.Automatically_Enable_Spying", false);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ Chat:
|
|||||||
Party:
|
Party:
|
||||||
# Enable or disable party chat
|
# Enable or disable party chat
|
||||||
Enable: true
|
Enable: true
|
||||||
|
Chat_Color: ''&f'
|
||||||
# Whether or not to use the current display name of a player
|
# Whether or not to use the current display name of a player
|
||||||
Use_Display_Names: true
|
Use_Display_Names: true
|
||||||
Spies:
|
Spies:
|
||||||
|
Loading…
Reference in New Issue
Block a user