Skip to content

Commit 3d9af05

Browse files
committed
docs: mark old chat color & formatting permissions as deprecated
1 parent 05bb294 commit 3d9af05

5 files changed

Lines changed: 15 additions & 9 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ A simple and customizable chat plugin for Hytale servers.
8686
- `herochat.chat.style.bold` - Permission to use bold on the chat
8787
- `herochat.chat.style.italic` - Permission to use italic on the chat
8888
- `herochat.chat.style.monospaced` - Permission to use monospaced on the chat
89-
- `herochat.chat.message.formatting` - Permission for player to use formatting tags on chat
89+
- `herochat.chat.message.colors` - `Deprecated - Will be removed soon!` Permission for player to use colors on chat
90+
- `herochat.chat.message.formatting` - `Deprecated - Will be removed soon!` Permission for player to use formatting tags on chat
91+
- `herochat.chat.message-color` - Permission for player to change the default message color on chat
9092
- `herochat.bypass.cooldown` - Permission to bypass the cooldown checks
9193
- `herochat.bypass.spam` - Permission to bypass the spam checks
9294
- `herochat.bypass.capslock` - Permission to bypass the capslock spam checks

src/main/kotlin/com/github/heroslender/herochat/Permissions.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ object Permissions {
77
const val SETTINGS_MUTE_CHANNEL = "herochat.chat.mute-channels"
88
const val SETTINGS_MESSAGE_COLOR = "herochat.chat.message-color"
99
const val CHAT_MESSAGE_STYLE = "herochat.chat.style"
10+
@Deprecated("To be removed on a future update")
11+
const val CHAT_COLOR = "herochat.chat.message.colors"
12+
@Deprecated("To be removed on a future update")
13+
const val CHAT_FORMATTING = "herochat.chat.message.formatting"
1014
const val BYPASS_COOLDOWN = "herochat.bypass.cooldown"
1115
const val BYPASS_SPAM = "herochat.bypass.spam"
1216
const val BYPASS_CAPSLOCK = "herochat.bypass.capslock"

src/main/kotlin/com/github/heroslender/herochat/listeners/ChatListener.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ChatListener(
3939
fun handleDefaultUserColor(e: ChannelChatEvent) {
4040
val settings = e.sender.settings
4141
if (settings.messageColor != null
42-
&& e.sender.hasPermission(Permissions.CHAT_MESSAGE_STYLE + ".colors")
42+
&& (e.sender.hasPermission(Permissions.CHAT_MESSAGE_STYLE + ".colors") || e.sender.hasPermission(Permissions.CHAT_COLOR))
4343
&& e.sender.hasPermission(Permissions.SETTINGS_MESSAGE_COLOR)
4444
) {
4545
e.message = "{${settings.messageColor}}${e.message}"

src/main/kotlin/com/github/heroslender/herochat/message/ComponentParser.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ class ComponentParser(
3636
remove: Boolean = false,
3737
): String = validateFormat(
3838
message = message,
39-
formatColors = user.hasPermission("$basePermission.colors"),
39+
formatColors = user.hasPermission("$basePermission.colors") || user.hasPermission(Permissions.CHAT_COLOR),
4040
formatRainbow = user.hasPermission("$basePermission.$RAINBOW"),
4141
formatGradient = user.hasPermission("$basePermission.gradient"),
42-
formatBold = user.hasPermission("$basePermission.$BOLD"),
43-
formatItalic = user.hasPermission("$basePermission.$ITALIC"),
44-
formatMonospaced = user.hasPermission("$basePermission.$MONOSPACED"),
42+
formatBold = user.hasPermission("$basePermission.$BOLD") || user.hasPermission(Permissions.CHAT_FORMATTING),
43+
formatItalic = user.hasPermission("$basePermission.$ITALIC") || user.hasPermission(Permissions.CHAT_FORMATTING),
44+
formatMonospaced = user.hasPermission("$basePermission.$MONOSPACED") || user.hasPermission(Permissions.CHAT_FORMATTING),
4545
formatPlaceholders = formatPlaceholders,
4646
remove = remove,
4747
)
@@ -268,9 +268,9 @@ class ComponentParser(
268268
} else null
269269

270270
if (text != null) {
271-
parsePlaceholders(sender, text, components, buffer = buffer)
271+
parsePlaceholders(sender, text, components, buffer = buffer)
272272
}
273-
} else{
273+
} else {
274274
buffer.append(message, start, suffixIndex + 1)
275275
}
276276

src/main/kotlin/com/github/heroslender/herochat/ui/pages/usersettings/UserSettingsPage.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class UserSettingsPage(
117117

118118
val settings = previewUser.settings
119119
if (settings.messageColor != null
120-
&& user.hasPermission(Permissions.CHAT_MESSAGE_STYLE + ".colors")
120+
&& (user.hasPermission(Permissions.CHAT_MESSAGE_STYLE + ".colors") || user.hasPermission(Permissions.CHAT_COLOR))
121121
&& user.hasPermission(Permissions.SETTINGS_MESSAGE_COLOR)
122122
) {
123123
message = "{${settings.messageColor}}${message}"

0 commit comments

Comments
 (0)