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();
|
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) {
|
String getChatType(final User user, final String message) {
|
||||||
if (message.length() == 0) {
|
if (message.length() == 0) {
|
||||||
//Ignore empty chat events generated by plugins
|
//Ignore empty chat events generated by plugins
|
||||||
|
@ -54,7 +54,7 @@ public class ChatProcessingCache {
|
|||||||
return getProcessedChat(player);
|
return getProcessedChat(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static abstract class Chat {
|
public abstract static class Chat {
|
||||||
private final User user;
|
private final User user;
|
||||||
private final String type;
|
private final String type;
|
||||||
private final String originalMessage;
|
private final String originalMessage;
|
||||||
@ -96,6 +96,7 @@ public class ChatProcessingCache {
|
|||||||
super(sourceChat.getUser(), sourceChat.getType(), sourceChat.getOriginalMessage());
|
super(sourceChat.getUser(), sourceChat.getType(), sourceChat.getOriginalMessage());
|
||||||
this.message = sourceChat.messageResult;
|
this.message = sourceChat.messageResult;
|
||||||
this.format = sourceChat.formatResult;
|
this.format = sourceChat.formatResult;
|
||||||
|
this.radius = sourceChat.radius;
|
||||||
this.charge = new Trade(getLongType(), ess);
|
this.charge = new Trade(getLongType(), ess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public class SignedChatHandler extends AbstractChatHandler {
|
|||||||
|
|
||||||
private void handleChatApplyPreview(AsyncPlayerChatEvent event) {
|
private void handleChatApplyPreview(AsyncPlayerChatEvent event) {
|
||||||
final ChatProcessingCache.ProcessedChat chat = cache.getProcessedChat(event.getPlayer());
|
final ChatProcessingCache.ProcessedChat chat = cache.getProcessedChat(event.getPlayer());
|
||||||
if (chat == null) {
|
if (!isPlayerChat(event) || chat == null) {
|
||||||
handleChatFormat(event);
|
handleChatFormat(event);
|
||||||
handleChatPostFormat(event);
|
handleChatPostFormat(event);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user