Skip to content

Commit

Permalink
Fix exception sending a chat with discord module (#6075)
Browse files Browse the repository at this point in the history
We do not want or need to set the renderer, EssXChat or the server will do that.
  • Loading branch information
JRoy authored Mar 1, 2025
1 parent b5748eb commit 1531cf4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class PaperChatListener extends PaperChatListenerProvider {
private final JDADiscordService jda;

public PaperChatListener(JDADiscordService jda) {
super(false);
this.jda = jda;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@
import java.util.Map;

public abstract class PaperChatListenerProvider implements Listener {
private final boolean formatParsing;
private final LegacyComponentSerializer serializer;
private final Map<AsyncChatEvent, PaperChatEvent> eventMap = new IdentityHashMap<>();

public PaperChatListenerProvider() {
this(true);
}

public PaperChatListenerProvider(final boolean formatParsing) {
this.formatParsing = formatParsing;
this.serializer = LegacyComponentSerializer.builder()
.flattener(ComponentFlattener.basic())
.extractUrls(AbstractChatEvent.URL_PATTERN)
Expand Down Expand Up @@ -59,6 +65,10 @@ public final void onHighest(final AsyncChatEvent event) {
return;
}

if (!formatParsing) {
return;
}

final TextComponent format = serializer.deserialize(paperChatEvent.getFormat());
final TextComponent eventMessage = serializer.deserialize(paperChatEvent.getMessage());

Expand Down

0 comments on commit 1531cf4

Please sign in to comment.