add packet structure
This commit is contained in:
40
ChatApp/src/network/protocol/packets/ChatMessagePacket.java
Normal file
40
ChatApp/src/network/protocol/packets/ChatMessagePacket.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package network.protocol.packets;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
import network.protocol.Packet;
|
||||
import network.protocol.PacketVisitor;
|
||||
import network.protocol.Packets;
|
||||
|
||||
public class ChatMessagePacket extends Packet {
|
||||
|
||||
static private final long serialVersionUID = Packets.Login.ordinal();
|
||||
|
||||
private final Instant time;
|
||||
private final String chatter;
|
||||
private final String content;
|
||||
|
||||
public ChatMessagePacket(Instant time, String chatter, String content) {
|
||||
this.time = time;
|
||||
this.chatter = chatter;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Instant getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public String getChatter() {
|
||||
return chatter;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(PacketVisitor packetVisitor) {
|
||||
packetVisitor.visitPacket(this);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user