PaperMC/paper-server/patches/sources/net/minecraft/ChatFormatting.java.patch

23 lines
684 B
Diff
Raw Normal View History

--- a/net/minecraft/ChatFormatting.java
+++ b/net/minecraft/ChatFormatting.java
2024-12-14 19:06:52 +01:00
@@ -112,6 +_,19 @@
return friendlyName == null ? null : FORMATTING_BY_NAME.get(cleanName(friendlyName));
}
+ // Paper start - add method to get by hex value
2024-12-14 19:06:52 +01:00
+ @Nullable
+ public static ChatFormatting getByHexValue(int i) {
+ for (ChatFormatting value : values()) {
+ if (value.getColor() != null && value.getColor() == i) {
+ return value;
+ }
+ }
+
+ return null;
+ }
+ // Paper end - add method to get by hex value
+
@Nullable
2024-12-14 19:06:52 +01:00
public static ChatFormatting getById(int index) {
if (index < 0) {