From 3960bb64df5301c764398dc1c1387f2bb8e5a0d1 Mon Sep 17 00:00:00 2001 From: Chip <65827213+ChipmunkMC@users.noreply.github.com> Date: Fri, 16 Dec 2022 22:23:43 -0500 Subject: [PATCH] remove some chat stuff i will implement it later because i am lazy --- .../chipmunkbot/chat/ChatMessage.java | 18 --------- .../chipmunk/chipmunkbot/chat/ChatParser.java | 7 ---- .../chipmunkbot/chat/MessageType.java | 8 ---- .../chipmunkbot/chat/MinecraftChatParser.java | 37 ------------------- .../chipmunkbot/chat/PlayerMessage.java | 14 ------- .../chipmunkbot/plugins/ChatPlugin.java | 7 ---- 6 files changed, 91 deletions(-) delete mode 100644 src/main/java/land/chipmunk/chipmunkbot/chat/ChatMessage.java delete mode 100644 src/main/java/land/chipmunk/chipmunkbot/chat/ChatParser.java delete mode 100644 src/main/java/land/chipmunk/chipmunkbot/chat/MessageType.java delete mode 100644 src/main/java/land/chipmunk/chipmunkbot/chat/MinecraftChatParser.java delete mode 100644 src/main/java/land/chipmunk/chipmunkbot/chat/PlayerMessage.java diff --git a/src/main/java/land/chipmunk/chipmunkbot/chat/ChatMessage.java b/src/main/java/land/chipmunk/chipmunkbot/chat/ChatMessage.java deleted file mode 100644 index 3ce4b00..0000000 --- a/src/main/java/land/chipmunk/chipmunkbot/chat/ChatMessage.java +++ /dev/null @@ -1,18 +0,0 @@ -package land.chipmunk.chipmunkbot.chat; - -import net.kyori.adventure.text.Component; -import java.util.UUID; -import lombok.Data; -import lombok.AllArgsConstructor; - -@Data -@AllArgsConstructor -public class ChatMessage { - // * I do not really care about signatures, they were likely made for the sussy wussy chat reporting system anyway, but I still include the sender as it really helps with stuff such as commands. - private Component component; - private UUID sender; - - public ChatMessage (Component component) { - this(component, new UUID(0, 0)); - } -} diff --git a/src/main/java/land/chipmunk/chipmunkbot/chat/ChatParser.java b/src/main/java/land/chipmunk/chipmunkbot/chat/ChatParser.java deleted file mode 100644 index e6c4a8d..0000000 --- a/src/main/java/land/chipmunk/chipmunkbot/chat/ChatParser.java +++ /dev/null @@ -1,7 +0,0 @@ -package land.chipmunk.chipmunkbot.chat; - -import net.kyori.adventure.text.Component; - -public interface ChatParser { - public PlayerMessage parseMessage(ChatMessage message); -} diff --git a/src/main/java/land/chipmunk/chipmunkbot/chat/MessageType.java b/src/main/java/land/chipmunk/chipmunkbot/chat/MessageType.java deleted file mode 100644 index 7addf21..0000000 --- a/src/main/java/land/chipmunk/chipmunkbot/chat/MessageType.java +++ /dev/null @@ -1,8 +0,0 @@ -package land.chipmunk.chipmunkbot.chat; - -public enum MessageType { - TEXT, - ANNOUNCEMENT, - EMOTE, - WHISPER -} diff --git a/src/main/java/land/chipmunk/chipmunkbot/chat/MinecraftChatParser.java b/src/main/java/land/chipmunk/chipmunkbot/chat/MinecraftChatParser.java deleted file mode 100644 index 77b196f..0000000 --- a/src/main/java/land/chipmunk/chipmunkbot/chat/MinecraftChatParser.java +++ /dev/null @@ -1,37 +0,0 @@ -package land.chipmunk.chipmunkbot.chat; - -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.TranslatableComponent; -import java.util.UUID; -import java.util.List; - -public class MinecraftChatParser implements ChatParser { - private MessageType getMessageType (TranslatableComponent component) { - String key = component.key(); - if (key.equals("chat.type.text")) return MessageType.TEXT; - if (key.equals("chat.type.announcement")) return MessageType.ANNOUNCEMENT; - if (key.equals("chat.type.emote")) return MessageType.EMOTE; - if (key.equals("chat.type.command")) return MessageType.WHISPER; - return null; - } - - public PlayerMessage parseMessage (ChatMessage message) { - Component component = message.component(); - if (component instanceof TranslatableComponent) return parseTranslatable((TranslatableComponent) component, message.sender()); - return null; - } - - public PlayerMessage parseTranslatable (TranslatableComponent component, UUID providedSender) { - TranslatableComponent translate = (TranslatableComponent) component; - MessageType type = getMessageType(translate); - if (type == null) return null; - - List args = component.args(); - - // Component displayName = args.get(0); - Component contents = args.get(1); - - return new PlayerMessage(null, contents, type); // TODO: Use player list - } -} diff --git a/src/main/java/land/chipmunk/chipmunkbot/chat/PlayerMessage.java b/src/main/java/land/chipmunk/chipmunkbot/chat/PlayerMessage.java deleted file mode 100644 index 5caba38..0000000 --- a/src/main/java/land/chipmunk/chipmunkbot/chat/PlayerMessage.java +++ /dev/null @@ -1,14 +0,0 @@ -package land.chipmunk.chipmunkbot.chat; - -import net.kyori.adventure.text.Component; -import com.github.steveice10.mc.protocol.data.game.PlayerListEntry; -import lombok.Data; -import lombok.AllArgsConstructor; - -@Data -@AllArgsConstructor -public class PlayerMessage { - private PlayerListEntry sender; - private Component contents; - private MessageType type; -} diff --git a/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java b/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java index 7d2d8a8..8f655cc 100644 --- a/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java +++ b/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java @@ -17,13 +17,6 @@ import java.time.Instant; public class ChatPlugin extends Plugin { public ChatPlugin (Client client) { super(client, "chat"); - - /* client.session().addListener(new SessionAdapter () { - @Override - packetReceived (Session session, Packet packet) { - if (packet instanceof Server) - } - }); */ } public void message (String message) {