Merge remote-tracking branch 'original/main'

This commit is contained in:
Chayapak 2023-05-28 15:14:34 +07:00
commit ac0437ab48

View file

@ -20,8 +20,6 @@ public class KaboomChatParser implements SystemChatParser {
public KaboomChatParser (ChipmunkBot client) { public KaboomChatParser (ChipmunkBot client) {
this.client = client; this.client = client;
} }
private static Style empty = Style.empty();
private static Component SEPERATOR_COLON = Component.text(":"); private static Component SEPERATOR_COLON = Component.text(":");
private static Component SEPERATOR_SPACE = Component.space(); private static Component SEPERATOR_SPACE = Component.space();
@ -33,14 +31,14 @@ public class KaboomChatParser implements SystemChatParser {
} }
public PlayerMessage parse (TranslatableComponent message) { public PlayerMessage parse (TranslatableComponent message) {
if (message.key().equals("%s") && message.args() != null && message.args().size() == 1 && message.style().equals(empty)) return parse(message.args().get(0)); 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;
} }
public PlayerMessage parse (TextComponent message) { public PlayerMessage parse (TextComponent message) {
List<Component> children = message.children(); List<Component> children = message.children();
if (!message.content().equals("") || !message.style().equals(empty) || children == null || children.size() < 3) return null; if (!message.content().equals("") || !message.style().isEmpty() || children == null || children.size() < 3) return null;
final Component prefix = children.get(0); final Component prefix = children.get(0);
Component displayName = Component.empty(); Component displayName = Component.empty();