forked from chipmunkmc/chipmunkbot
remove some chat stuff
i will implement it later because i am lazy
This commit is contained in:
parent
f381e05418
commit
3960bb64df
6 changed files with 0 additions and 91 deletions
|
@ -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));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
package land.chipmunk.chipmunkbot.chat;
|
|
||||||
|
|
||||||
import net.kyori.adventure.text.Component;
|
|
||||||
|
|
||||||
public interface ChatParser {
|
|
||||||
public PlayerMessage parseMessage(ChatMessage message);
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
package land.chipmunk.chipmunkbot.chat;
|
|
||||||
|
|
||||||
public enum MessageType {
|
|
||||||
TEXT,
|
|
||||||
ANNOUNCEMENT,
|
|
||||||
EMOTE,
|
|
||||||
WHISPER
|
|
||||||
}
|
|
|
@ -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
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -17,13 +17,6 @@ import java.time.Instant;
|
||||||
public class ChatPlugin extends Plugin {
|
public class ChatPlugin extends Plugin {
|
||||||
public ChatPlugin (Client client) {
|
public ChatPlugin (Client client) {
|
||||||
super(client, "chat");
|
super(client, "chat");
|
||||||
|
|
||||||
/* client.session().addListener(new SessionAdapter () {
|
|
||||||
@Override
|
|
||||||
packetReceived (Session session, Packet packet) {
|
|
||||||
if (packet instanceof Server)
|
|
||||||
}
|
|
||||||
}); */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void message (String message) {
|
public void message (String message) {
|
||||||
|
|
Loading…
Reference in a new issue