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