Minor code improvement

This commit is contained in:
Chipmunk 2023-05-24 20:49:35 -04:00
parent 702fd1e273
commit 3df79981fd

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();