mirror of
https://github.com/Nan1t/NanoLimbo.git
synced 2025-07-10 12:00:12 +02:00
40 lines
941 B
Java
40 lines
941 B
Java
package ru.nanit.limbo.protocol.packets;
|
|
|
|
import ru.nanit.limbo.protocol.ByteMessage;
|
|
import ru.nanit.limbo.protocol.Packet;
|
|
import ru.nanit.limbo.protocol.PacketIn;
|
|
import ru.nanit.limbo.protocol.registry.State;
|
|
import ru.nanit.limbo.protocol.registry.Version;
|
|
|
|
public class PacketHandshake implements PacketIn {
|
|
|
|
private Version version;
|
|
private String host;
|
|
private int port;
|
|
private State nextState;
|
|
|
|
public Version getVersion() {
|
|
return version;
|
|
}
|
|
|
|
public String getHost() {
|
|
return host;
|
|
}
|
|
|
|
public int getPort() {
|
|
return port;
|
|
}
|
|
|
|
public State getNextState() {
|
|
return nextState;
|
|
}
|
|
|
|
@Override
|
|
public void decode(ByteMessage msg, Version version) {
|
|
this.version = Version.of(msg.readVarInt());
|
|
this.host = msg.readString();
|
|
this.port = msg.readUnsignedShort();
|
|
this.nextState = State.getById(msg.readVarInt());
|
|
}
|
|
}
|