mirror of
https://github.com/Nan1t/NanoLimbo.git
synced 2026-02-11 03:16:14 +01:00
BungeeCord and Velocity info forwarding support
This commit is contained in:
@@ -66,7 +66,7 @@ public class ByteMessage extends ByteBuf {
|
||||
return readString(readVarInt());
|
||||
}
|
||||
|
||||
private String readString(int length) {
|
||||
public String readString(int length) {
|
||||
String str = buf.toString(buf.readerIndex(), length, StandardCharsets.UTF_8);
|
||||
buf.skipBytes(length);
|
||||
return str;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package ru.nanit.limbo.protocol.packets.login;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import ru.nanit.limbo.protocol.ByteMessage;
|
||||
import ru.nanit.limbo.protocol.PacketOut;
|
||||
|
||||
public class PacketLoginPluginRequest implements PacketOut {
|
||||
|
||||
private int messageId;
|
||||
private String channel;
|
||||
private ByteBuf data;
|
||||
|
||||
public void setMessageId(int messageId) {
|
||||
this.messageId = messageId;
|
||||
}
|
||||
|
||||
public void setChannel(String channel) {
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
public void setData(ByteBuf data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteMessage msg) {
|
||||
msg.writeVarInt(messageId);
|
||||
msg.writeString(channel);
|
||||
msg.writeBytes(data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package ru.nanit.limbo.protocol.packets.login;
|
||||
|
||||
import ru.nanit.limbo.protocol.ByteMessage;
|
||||
import ru.nanit.limbo.protocol.PacketIn;
|
||||
|
||||
public class PacketLoginPluginResponse implements PacketIn {
|
||||
|
||||
private int messageId;
|
||||
private boolean successful;
|
||||
private ByteMessage data;
|
||||
|
||||
public int getMessageId() {
|
||||
return messageId;
|
||||
}
|
||||
|
||||
public boolean isSuccessful() {
|
||||
return successful;
|
||||
}
|
||||
|
||||
public ByteMessage getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteMessage msg) {
|
||||
messageId = msg.readVarInt();
|
||||
successful = msg.readBoolean();
|
||||
|
||||
if (msg.readableBytes() > 0){
|
||||
int i = msg.readableBytes();
|
||||
data = new ByteMessage(msg.readBytes(i));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,5 +41,4 @@ public class PacketDecoder extends MessageToMessageDecoder<ByteBuf> {
|
||||
public void updateState(State state){
|
||||
this.mappings = state.serverBound;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,8 +30,10 @@ public enum State {
|
||||
LOGIN(2){
|
||||
{
|
||||
serverBound.register(0x00, PacketLoginStart::new);
|
||||
serverBound.register(0x02, PacketLoginPluginResponse::new);
|
||||
clientBound.register(0x00, PacketDisconnect::new);
|
||||
clientBound.register(0x02, PacketLoginSuccess::new);
|
||||
clientBound.register(0x04, PacketLoginPluginRequest::new);
|
||||
}
|
||||
},
|
||||
PLAY(3){
|
||||
|
||||
Reference in New Issue
Block a user