diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/MinecraftChatParser.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/MinecraftChatParser.java index 235deb3..105bfd1 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/MinecraftChatParser.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/MinecraftChatParser.java @@ -9,22 +9,18 @@ import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TranslatableComponent; import net.kyori.adventure.text.event.HoverEvent; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import java.util.*; public class MinecraftChatParser implements ChatParser { private final Bot bot; - // ? Is such a mapping necessary? - private static final Map typeMap = new HashMap<>(); + private static final List keys = new ArrayList<>(); static { - typeMap.put("chat.type.text", "minecraft:chat"); - typeMap.put("chat.type.announcement", "minecraft:say_command"); - typeMap.put("commands.message.display.incoming", "minecraft:msg_command"); - typeMap.put("chat.type.team.text", "minecraft:team_msg_command"); - typeMap.put("chat.type.emote", "minecraft:emote_command"); + keys.add("chat.type.text"); + keys.add("chat.type.announcement"); + keys.add("commands.message.display.incoming"); + keys.add("chat.type.team.text"); + keys.add("chat.type.emote"); } public MinecraftChatParser (Bot bot) { @@ -40,7 +36,7 @@ public class MinecraftChatParser implements ChatParser { public PlayerMessage parse (TranslatableComponent message) { final List args = message.args(); final String key = message.key(); - if (args.size() < 2 || !typeMap.containsKey(key)) return null; + if (args.size() < 2 || !keys.contains(key)) return null; final Component senderComponent = args.get(0); final Component contents = args.get(1); diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/ChomeNSCustomChatParser.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/U203aChatParser.java similarity index 87% rename from src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/ChomeNSCustomChatParser.java rename to src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/U203aChatParser.java index bba21f5..16acd96 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/ChomeNSCustomChatParser.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/U203aChatParser.java @@ -12,12 +12,11 @@ import net.kyori.adventure.text.event.HoverEvent; import java.util.List; import java.util.UUID; -// Might be a confusing name, but I mean the [Chat] chayapak custom chat thing or any other -// custom chat that uses the `[%s] %s › %s` translation or %s %s › %s -public class ChomeNSCustomChatParser implements ChatParser { +// parses `[%s] %s › %s` translation or `%s %s › %s` +public class U203aChatParser implements ChatParser { private final Bot bot; - public ChomeNSCustomChatParser (Bot bot) { + public U203aChatParser(Bot bot) { this.bot = bot; } diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java index ed0cc6a..57c6730 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java @@ -8,7 +8,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCh import com.github.steveice10.packetlib.Session; import com.github.steveice10.packetlib.packet.Packet; import land.chipmunk.chayapak.chomens_bot.Bot; -import land.chipmunk.chayapak.chomens_bot.chatParsers.ChomeNSCustomChatParser; +import land.chipmunk.chayapak.chomens_bot.chatParsers.U203aChatParser; import land.chipmunk.chayapak.chomens_bot.chatParsers.CreayunChatParser; import land.chipmunk.chayapak.chomens_bot.chatParsers.KaboomChatParser; import land.chipmunk.chayapak.chomens_bot.chatParsers.MinecraftChatParser; @@ -54,7 +54,7 @@ public class ChatPlugin extends Bot.Listener { chatParsers = new ArrayList<>(); chatParsers.add(new MinecraftChatParser(bot)); chatParsers.add(new KaboomChatParser(bot)); - chatParsers.add(new ChomeNSCustomChatParser(bot)); + chatParsers.add(new U203aChatParser(bot)); chatParsers.add(new CreayunChatParser(bot)); bot.executor().scheduleAtFixedRate(this::sendChatTick, 0, queueDelay, TimeUnit.MILLISECONDS);