Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-113 Fix plugin compatibility setting message color #113

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.eternalcode.formatter;

import com.eternalcode.formatter.adventure.ComponentUtil;
import static net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection;

import com.eternalcode.formatter.adventure.TextColorTagResolver;
import com.eternalcode.formatter.legacy.Legacy;
import com.eternalcode.formatter.legacy.LegacyPostMessageProcessor;
Expand Down Expand Up @@ -107,11 +108,11 @@ private TagResolver createTags(ChatMessage chatMessage) {
Player sender = chatMessage.sender();

Component message = GSON.deserialize(chatMessage.jsonMessage());
String rawMessage = ComponentUtil.toRawContent(message);
String serialize = legacySection().serialize(message);

TagResolver.Single displayNamePlaceholder = displayNamePlaceholder(sender);
TagResolver.Single namePlaceholder = namePlaceholder(sender);
TagResolver.Single messagePlaceholder = messagePlaceholder(sender, rawMessage);
TagResolver.Single messagePlaceholder = messagePlaceholder(sender, serialize);

return TagResolver.resolver(displayNamePlaceholder, namePlaceholder, messagePlaceholder);
}
Expand Down