mirror of
https://github.com/Nan1t/NanoLimbo.git
synced 2025-07-16 22:20:14 +02:00
Fix PacketLoginSuccess
This commit is contained in:
parent
788c9ba4f2
commit
ac8eda05ad
@ -166,7 +166,8 @@ public class ByteMessage extends ByteBuf {
|
|||||||
for (CompoundBinaryTag tag : compoundTags) {
|
for (CompoundBinaryTag tag : compoundTags) {
|
||||||
BinaryTagIO.writer().write(tag, (OutputStream) stream);
|
BinaryTagIO.writer().write(tag, (OutputStream) stream);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
}
|
||||||
|
catch (IOException e) {
|
||||||
throw new EncoderException("Cannot write NBT CompoundTag");
|
throw new EncoderException("Cannot write NBT CompoundTag");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -174,7 +175,8 @@ public class ByteMessage extends ByteBuf {
|
|||||||
public CompoundBinaryTag readCompoundTag() {
|
public CompoundBinaryTag readCompoundTag() {
|
||||||
try (ByteBufInputStream stream = new ByteBufInputStream(buf)) {
|
try (ByteBufInputStream stream = new ByteBufInputStream(buf)) {
|
||||||
return BinaryTagIO.reader().read((InputStream) stream);
|
return BinaryTagIO.reader().read((InputStream) stream);
|
||||||
} catch (IOException thrown) {
|
}
|
||||||
|
catch (IOException thrown) {
|
||||||
throw new DecoderException("Cannot read NBT CompoundTag");
|
throw new DecoderException("Cannot read NBT CompoundTag");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,11 +184,27 @@ public class ByteMessage extends ByteBuf {
|
|||||||
public void writeCompoundTag(CompoundBinaryTag compoundTag) {
|
public void writeCompoundTag(CompoundBinaryTag compoundTag) {
|
||||||
try (ByteBufOutputStream stream = new ByteBufOutputStream(buf)) {
|
try (ByteBufOutputStream stream = new ByteBufOutputStream(buf)) {
|
||||||
BinaryTagIO.writer().write(compoundTag, (OutputStream) stream);
|
BinaryTagIO.writer().write(compoundTag, (OutputStream) stream);
|
||||||
} catch (IOException e) {
|
}
|
||||||
|
catch (IOException e) {
|
||||||
throw new EncoderException("Cannot write NBT CompoundTag");
|
throw new EncoderException("Cannot write NBT CompoundTag");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void writeProperties(Property[] properties) {
|
||||||
|
writeVarInt(properties.length);
|
||||||
|
for (Property prop : properties) {
|
||||||
|
writeString(prop.getName());
|
||||||
|
writeString(prop.getValue());
|
||||||
|
if (prop.getSignature() != null) {
|
||||||
|
buf.writeBoolean(true);
|
||||||
|
writeString(prop.getSignature());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
buf.writeBoolean(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Delegated methods */
|
/* Delegated methods */
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
38
src/main/java/ru/nanit/limbo/protocol/Property.java
Normal file
38
src/main/java/ru/nanit/limbo/protocol/Property.java
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package ru.nanit.limbo.protocol;
|
||||||
|
|
||||||
|
public class Property {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String value;
|
||||||
|
private String signature;
|
||||||
|
|
||||||
|
public Property(String name, String value, String signature) {
|
||||||
|
this.name = name;
|
||||||
|
this.value = value;
|
||||||
|
this.signature = signature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSignature() {
|
||||||
|
return signature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSignature(String signature) {
|
||||||
|
this.signature = signature;
|
||||||
|
}
|
||||||
|
}
|
@ -19,6 +19,7 @@ package ru.nanit.limbo.protocol.packets.login;
|
|||||||
|
|
||||||
import ru.nanit.limbo.protocol.ByteMessage;
|
import ru.nanit.limbo.protocol.ByteMessage;
|
||||||
import ru.nanit.limbo.protocol.PacketOut;
|
import ru.nanit.limbo.protocol.PacketOut;
|
||||||
|
import ru.nanit.limbo.protocol.Property;
|
||||||
import ru.nanit.limbo.protocol.registry.Version;
|
import ru.nanit.limbo.protocol.registry.Version;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -44,6 +45,9 @@ public class PacketLoginSuccess implements PacketOut {
|
|||||||
msg.writeString(uuid.toString());
|
msg.writeString(uuid.toString());
|
||||||
}
|
}
|
||||||
msg.writeString(username);
|
msg.writeString(username);
|
||||||
|
if (version.moreOrEqual(Version.V1_19)) {
|
||||||
|
msg.writeProperties(new Property[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user