Skip to content

Commit

Permalink
[2.0.16] Fix Folia & Gradients
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsFlicker committed Mar 16, 2024
1 parent 4342438 commit d5b45a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ public static String parseRainbow(String message) {
char c = chars[i];
if (c == '&' && i + 1 < chars.length) {
char next = chars[i + 1];
org.bukkit.ChatColor color = org.bukkit.ChatColor.getByChar(next);
if (color != null && color.isFormat()) {
if (HexKt.isFormat(next)) {
compoundedFormat += String.valueOf(ChatColor.COLOR_CHAR) + next;
i++; // Skip next character
continue;
Expand Down Expand Up @@ -188,8 +187,7 @@ public static String parseGradients(String message) {
char c = chars[i];
if (c == '&' && i + 1 < chars.length) {
char next = chars[i + 1];
org.bukkit.ChatColor color = org.bukkit.ChatColor.getByChar(next);
if (color != null && color.isFormat()) {
if (HexKt.isFormat(next)) {
compoundedFormat += String.valueOf(ChatColor.COLOR_CHAR) + next;
i++; // Skip next character
continue;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
package me.arasple.mc.trchat.util.color

import org.bukkit.ChatColor
import taboolib.module.nms.MinecraftVersion

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

fun isFormat(char: Char): Boolean {
val color = ChatColor.getByChar(char)
return color != null && color.isFormat
}

fun String.colorify() = HexUtils.colorify(this)

fun String.parseLegacy() = HexUtils.parseLegacy(this)
Expand Down

0 comments on commit d5b45a4

Please sign in to comment.