[BUG] Fix MessageBroadcastEvent using the wrong thread context (SDLink)
This commit is contained in:
@@ -11,11 +11,13 @@ public class MessageBroadcastEvent extends CraterEvent {
|
||||
private final Component component;
|
||||
private final UUID uuid;
|
||||
private final ChatType bl;
|
||||
private final String threadName;
|
||||
|
||||
public MessageBroadcastEvent(Component component, UUID uuid, ChatType bl) {
|
||||
public MessageBroadcastEvent(Component component, UUID uuid, ChatType bl, String threadName) {
|
||||
this.component = component;
|
||||
this.uuid = uuid;
|
||||
this.bl = bl;
|
||||
this.threadName = threadName;
|
||||
}
|
||||
|
||||
public Component getComponent() {
|
||||
@@ -30,6 +32,10 @@ public class MessageBroadcastEvent extends CraterEvent {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public String getThreadName() {
|
||||
return threadName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCancel() {
|
||||
return false;
|
||||
|
@@ -24,7 +24,8 @@ public class PlayerListMixin {
|
||||
|
||||
@Inject(method = "broadcastMessage(Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/ChatType;Ljava/util/UUID;)V", at = @At("HEAD"))
|
||||
private void injectBroadcast(Component component, ChatType chatType, UUID uUID, CallbackInfo ci) {
|
||||
MessageBroadcastEvent event = new MessageBroadcastEvent(component, uUID, chatType);
|
||||
String thread = Thread.currentThread().getStackTrace()[3].getClassName();
|
||||
MessageBroadcastEvent event = new MessageBroadcastEvent(component, uUID, chatType, thread);
|
||||
CraterEventBus.INSTANCE.postEvent(event);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user