This repository was archived by the owner on May 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Pascal edited this page Jun 30, 2022
·
5 revisions
SquareTree is a Java library to create packet traffic of customized nodes and modules at the server-side. The application consists of several parts.
- SquareTree-Connector (client connect to server)
- SqareTree-Network (network library)
- SqareTree-Server (Server application)

//require packet link
//the type must not be used in any other packet
@PacketLink(type = 3000)
public class PacketChatMessage extends Packet<EmptyResponse> {
private String message;
//it require empty constructor
public PacketChatMessage() {
}
public PacketChatMessage(String message) {
this.message = message;
}
@Override
public void serialize(DataSerializer serializer) {
serializer.writeString(message, StandardCharsets.UTF_8);
}
@Override
public void deserialize(DataDeserializer deserializer) {
message = deserializer.readString(StandardCharsets.UTF_8);
}
@Override
public EmptyResponse getDefaultResponse() {
return new EmptyResponse();
}
}