fix: chatcolor now works when player doesn't use color codes
This commit is contained in:
parent
5c1230bc16
commit
c6442bc88f
1 changed files with 13 additions and 5 deletions
|
|
@ -167,14 +167,22 @@ public class ChatFormatter {
|
|||
// Заменяем смайлики
|
||||
result = replaceEmojis(result, player);
|
||||
|
||||
// Если есть право на цвета - конвертируем
|
||||
if (hasColorPermission) {
|
||||
// Проверяем есть ли цветовые коды в сообщении
|
||||
boolean hasColorCodes = LEGACY_COLOR_PATTERN.matcher(result).find()
|
||||
|| SECTION_COLOR_PATTERN.matcher(result).find()
|
||||
|| HEX_PATTERN.matcher(result).find()
|
||||
|| MINIMESSAGE_HEX_PATTERN.matcher(result).find();
|
||||
|
||||
// Если есть право на цвета И есть цветовые коды - конвертируем
|
||||
if (hasColorPermission && hasColorCodes) {
|
||||
result = convertAllColors(result);
|
||||
} else {
|
||||
// Убираем цветовые коды
|
||||
// Убираем цветовые коды если нет прав
|
||||
if (!hasColorPermission) {
|
||||
result = stripLegacyColors(result);
|
||||
}
|
||||
|
||||
// Применяем цвет чата если установлен
|
||||
// Применяем цвет чата если установлен (когда нет своих цветов)
|
||||
LoChat plugin = LoChat.getInstance();
|
||||
if (plugin != null && plugin.getChatColorManager() != null) {
|
||||
result = plugin.getChatColorManager().applyChatColor(player.getUniqueId(), result);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue