mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-04-06 13:30:43 +08:00
Fix exception sending a chat with discord module (#6075)
We do not want or need to set the renderer, EssXChat or the server will do that.
This commit is contained in:
parent
b5748eb32f
commit
1531cf4146
@ -12,6 +12,7 @@ public class PaperChatListener extends PaperChatListenerProvider {
|
||||
private final JDADiscordService jda;
|
||||
|
||||
public PaperChatListener(JDADiscordService jda) {
|
||||
super(false);
|
||||
this.jda = jda;
|
||||
}
|
||||
|
||||
|
@ -14,10 +14,16 @@ import java.util.IdentityHashMap;
|
||||
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)
|
||||
@ -59,6 +65,10 @@ public abstract class PaperChatListenerProvider implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!formatParsing) {
|
||||
return;
|
||||
}
|
||||
|
||||
final TextComponent format = serializer.deserialize(paperChatEvent.getFormat());
|
||||
final TextComponent eventMessage = serializer.deserialize(paperChatEvent.getMessage());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user