Skip to content

Commit d5b45a4

Browse files
committed
[2.0.16] Fix Folia & Gradients
1 parent 4342438 commit d5b45a4

File tree

2 files changed

+8
-4
lines changed
  • project/runtime-bukkit/src/main

2 files changed

+8
-4
lines changed

project/runtime-bukkit/src/main/java/me/arasple/mc/trchat/util/color/HexUtils.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ public static String parseRainbow(String message) {
126126
char c = chars[i];
127127
if (c == '&' && i + 1 < chars.length) {
128128
char next = chars[i + 1];
129-
org.bukkit.ChatColor color = org.bukkit.ChatColor.getByChar(next);
130-
if (color != null && color.isFormat()) {
129+
if (HexKt.isFormat(next)) {
131130
compoundedFormat += String.valueOf(ChatColor.COLOR_CHAR) + next;
132131
i++; // Skip next character
133132
continue;
@@ -188,8 +187,7 @@ public static String parseGradients(String message) {
188187
char c = chars[i];
189188
if (c == '&' && i + 1 < chars.length) {
190189
char next = chars[i + 1];
191-
org.bukkit.ChatColor color = org.bukkit.ChatColor.getByChar(next);
192-
if (color != null && color.isFormat()) {
190+
if (HexKt.isFormat(next)) {
193191
compoundedFormat += String.valueOf(ChatColor.COLOR_CHAR) + next;
194192
i++; // Skip next character
195193
continue;

project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/util/color/Hex.kt

+6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
package me.arasple.mc.trchat.util.color
22

3+
import org.bukkit.ChatColor
34
import taboolib.module.nms.MinecraftVersion
45

56
fun isHigherOrEqual11600() = MinecraftVersion.isHigherOrEqual(MinecraftVersion.V1_16)
67

8+
fun isFormat(char: Char): Boolean {
9+
val color = ChatColor.getByChar(char)
10+
return color != null && color.isFormat
11+
}
12+
713
fun String.colorify() = HexUtils.colorify(this)
814

915
fun String.parseLegacy() = HexUtils.parseLegacy(this)

0 commit comments

Comments
 (0)