This commit is contained in:
Chipmunk 2023-06-21 14:53:34 -04:00
parent b5f1a29d89
commit 2d0771add8

View file

@ -21,17 +21,12 @@ public class KaboomChatParser implements SystemChatParser {
this.client = client; this.client = client;
} }
private static Component SEPERATOR_COLON = Component.text(":"); private static Component SEPERATOR_COLON = Component.text(":");
private static Component SEPERATOR_COLON_RACCOON = Component.text("\u00a7f:"); // https://github.com/raccoonserver/extras/commit/315f704075db2f00e3e1bfbf55f858469c22880f
private static Component SEPERATOR_SPACE = Component.space(); private static Component SEPERATOR_SPACE = Component.space();
@Override @Override
public PlayerMessage parse (Component message) { public PlayerMessage parse (Component message) {
if (message instanceof TextComponent) return parse((TextComponent) message); if (message instanceof TextComponent) return parse((TextComponent) message);
if (message instanceof TranslatableComponent) return parse((TranslatableComponent) message);
return null;
}
public PlayerMessage parse (TranslatableComponent message) {
if (message.key().equals("%s") && message.args() != null && message.args().size() == 1 && message.style().isEmpty()) return parse(message.args().get(0));
return null; return null;
} }
@ -59,6 +54,6 @@ public class KaboomChatParser implements SystemChatParser {
} }
private boolean isSeperatorAt (List<Component> children, int start) { private boolean isSeperatorAt (List<Component> children, int start) {
return children.get(start).equals(SEPERATOR_COLON) && children.get(start + 1).equals(SEPERATOR_SPACE); return (children.get(start).equals(SEPERATOR_COLON) || children.get(start).equals(SEPERATOR_COLON_RACCOON)) && children.get(start + 1).equals(SEPERATOR_SPACE);
} }
} }