remove some chat stuff

i will implement it later because i am lazy
This commit is contained in:
Chipmunk 2022-12-16 22:23:43 -05:00
parent f381e05418
commit 3960bb64df
6 changed files with 0 additions and 91 deletions

View file

@ -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));
}
}

View file

@ -1,7 +0,0 @@
package land.chipmunk.chipmunkbot.chat;
import net.kyori.adventure.text.Component;
public interface ChatParser {
public PlayerMessage parseMessage(ChatMessage message);
}

View file

@ -1,8 +0,0 @@
package land.chipmunk.chipmunkbot.chat;
public enum MessageType {
TEXT,
ANNOUNCEMENT,
EMOTE,
WHISPER
}

View file

@ -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<Component> args = component.args();
// Component displayName = args.get(0);
Component contents = args.get(1);
return new PlayerMessage(null, contents, type); // TODO: Use player list
}
}

View file

@ -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;
}

View file

@ -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) {