mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Add TAB / KiteBoard style RGB support
This commit is contained in:
1 parent
59511c037f
commit
267ebc4ca9
1 file changed
+6
@@ -16,11 +16,17 @@ public class LegacyFormatHandler {
|
||||
private final @NonNull Pattern pattern =
|
||||
Pattern.compile("[§&]x[§&]([0-9a-f])[§&]([0-9a-f])[§&]([0-9a-f])[§&]([0-9a-f])[§&]([0-9a-f])[§&]([0-9a-f])");
|
||||
|
||||
private final @NonNull Pattern altPattern =
|
||||
Pattern.compile("[§&]#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])");
|
||||
|
||||
public LegacyFormatHandler() {
|
||||
CarbonEvents.register(PreChatFormatEvent.class, PostOrders.FIRST, false, event -> {
|
||||
// Legacy RGB
|
||||
event.format(this.pattern.matcher(event.format()).replaceAll("<#$1$2$3$4$5$6>"));
|
||||
|
||||
// Alternate RGB, TAB (neznamy) && KiteBoard
|
||||
event.format(this.altPattern.matcher(event.format()).replaceAll("<#$1$2$3$4$5$6>"));
|
||||
|
||||
// Legacy Colors
|
||||
for (final char c : "0123456789abcdef".toCharArray()) {
|
||||
final LegacyFormat format = LegacyComponentSerializer.parseChar(c);
|
||||
|
||||
Reference in new issue
Block a user