actually fix /say messages from command blocks

This commit is contained in:
Chayapak 2023-05-05 18:26:16 +07:00
parent ef8f2be4cf
commit ac0e77de74

View file

@ -135,24 +135,25 @@ public class ChatPlugin extends Bot.Listener {
final Component name = packet.getName();
final Component content = packet.getMessage();
String translate = null;
switch (type) {
case 1 -> translate = "chat.type.emote";
case 4 -> translate = "chat.type.announcement";
case 2 -> translate = "commands.message.display.incoming";
}
final Component component = Component.translatable(
translate,
name,
content
);
for (Listener listener : listeners) {
listener.systemMessageReceived(component);
}
for (ChatParser parser : chatParsers) {
String translate;
switch (type) {
case 1 -> translate = "chat.type.emote";
case 4 -> translate = "chat.type.announcement";
case 2 -> translate = "commands.message.display.incoming";
default -> {
continue;
}
}
final Component component = Component.translatable(
translate,
name,
content
);
final PlayerMessage parsed = parser.parse(component);
if (parsed == null) continue;
@ -161,7 +162,6 @@ public class ChatPlugin extends Bot.Listener {
for (Listener listener : listeners) {
listener.playerMessageReceived(playerMessage);
listener.systemMessageReceived(component);
}
}
} else {