forked from ChomeNS/chomens-bot-java
actually fix /say messages from command blocks
This commit is contained in:
parent
ef8f2be4cf
commit
ac0e77de74
1 changed files with 18 additions and 18 deletions
|
@ -135,24 +135,25 @@ 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();
|
||||||
|
|
||||||
|
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) {
|
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);
|
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 {
|
||||||
|
|
Loading…
Reference in a new issue