mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-02 22:47:41 +01:00
Fix issues with chat preview refactor (#5062)
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
This commit is contained in:
parent
1c22edbb1b
commit
2f4f555923
@ -260,6 +260,11 @@ public abstract class AbstractChatHandler {
|
||||
return event.isCancelled();
|
||||
}
|
||||
|
||||
boolean isPlayerChat(final AsyncPlayerChatEvent event) {
|
||||
// Used to distinguish chats from Player#chat (sync) from chats sent by the player (async)
|
||||
return event.isAsynchronous();
|
||||
}
|
||||
|
||||
String getChatType(final User user, final String message) {
|
||||
if (message.length() == 0) {
|
||||
//Ignore empty chat events generated by plugins
|
||||
|
@ -54,7 +54,7 @@ public class ChatProcessingCache {
|
||||
return getProcessedChat(player);
|
||||
}
|
||||
|
||||
public static abstract class Chat {
|
||||
public abstract static class Chat {
|
||||
private final User user;
|
||||
private final String type;
|
||||
private final String originalMessage;
|
||||
@ -96,6 +96,7 @@ public class ChatProcessingCache {
|
||||
super(sourceChat.getUser(), sourceChat.getType(), sourceChat.getOriginalMessage());
|
||||
this.message = sourceChat.messageResult;
|
||||
this.format = sourceChat.formatResult;
|
||||
this.radius = sourceChat.radius;
|
||||
this.charge = new Trade(getLongType(), ess);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class SignedChatHandler extends AbstractChatHandler {
|
||||
|
||||
private void handleChatApplyPreview(AsyncPlayerChatEvent event) {
|
||||
final ChatProcessingCache.ProcessedChat chat = cache.getProcessedChat(event.getPlayer());
|
||||
if (chat == null) {
|
||||
if (!isPlayerChat(event) || chat == null) {
|
||||
handleChatFormat(event);
|
||||
handleChatPostFormat(event);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user