Skip to content

Commit

Permalink
feat: JoinRequestPacket
Browse files Browse the repository at this point in the history
  • Loading branch information
LapisBerry committed May 22, 2024
1 parent c43f9ee commit 17994ba
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/com/lapisberry/net/packets/ClientPacket.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.lapisberry.net.packets;

import java.io.Serial;
import java.io.Serializable;

/**
* The {@code ClientPacket} class is a packet sending from client to server.
*/
public class ClientPacket implements Serializable {
@Serial
private static final long serialVersionUID = -2286074370601221667L;
}
24 changes: 24 additions & 0 deletions src/main/java/com/lapisberry/net/packets/JoinRequestPacket.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.lapisberry.net.packets;

import java.io.Serial;
import java.io.Serializable;

/**
* The {@code JoinRequestPacket} class is the first packet sending from client to server to join the server.
*/
public class JoinRequestPacket extends ClientPacket implements Serializable {
@Serial
private static final long serialVersionUID = -3120924882895484001L;
// Fields
private final String username;

// Constructors
public JoinRequestPacket(String username) {
this.username = username;
}

// Getters
public String getUsername() {
return username;
}
}
12 changes: 12 additions & 0 deletions src/main/java/com/lapisberry/net/packets/ServerPacket.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.lapisberry.net.packets;

import java.io.Serial;
import java.io.Serializable;

/**
* The {@code ServerPacket} class is a packet sending from server to client.
*/
public class ServerPacket implements Serializable {
@Serial
private static final long serialVersionUID = 726935260428407157L;
}

0 comments on commit 17994ba

Please sign in to comment.