com.nukkitx.protocol.bedrock.packet.LoginPacket Java Examples

The following examples show how to use com.nukkitx.protocol.bedrock.packet.LoginPacket. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LoginSerializer_v340.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, LoginPacket packet) {
    packet.setProtocolVersion(buffer.readInt());

    ByteBuf jwt = buffer.readSlice(VarInts.readUnsignedInt(buffer)); // Get the JWT.
    packet.setChainData(BedrockUtils.readLEAsciiString(jwt));
    packet.setSkinData(BedrockUtils.readLEAsciiString(jwt));
}
 
Example #2
Source File: LoginSerializer_v291.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, LoginPacket packet) {
    packet.setProtocolVersion(buffer.readInt());

    ByteBuf jwt = buffer.readSlice(VarInts.readUnsignedInt(buffer)); // Get the JWT.
    packet.setChainData(BedrockUtils.readLEAsciiString(jwt));
    packet.setSkinData(BedrockUtils.readLEAsciiString(jwt));
}
 
Example #3
Source File: LoginSerializer_v291.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, LoginPacket packet) {
    buffer.writeInt(packet.getProtocolVersion());

    AsciiString chainData = packet.getChainData();
    AsciiString skinData = packet.getSkinData();

    VarInts.writeUnsignedInt(buffer, chainData.length() + skinData.length() + 8);

    BedrockUtils.writeLEAsciiString(buffer, chainData);
    BedrockUtils.writeLEAsciiString(buffer, skinData);
}
 
Example #4
Source File: LoginSerializer_v332.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, LoginPacket packet) {
    packet.setProtocolVersion(buffer.readInt());

    ByteBuf jwt = buffer.readSlice(VarInts.readUnsignedInt(buffer)); // Get the JWT.
    packet.setChainData(BedrockUtils.readLEAsciiString(jwt));
    packet.setSkinData(BedrockUtils.readLEAsciiString(jwt));
}
 
Example #5
Source File: LoginSerializer_v332.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, LoginPacket packet) {
    buffer.writeInt(packet.getProtocolVersion());

    AsciiString chainData = packet.getChainData();
    AsciiString skinData = packet.getSkinData();

    VarInts.writeUnsignedInt(buffer, chainData.length() + skinData.length() + 8);

    BedrockUtils.writeLEAsciiString(buffer, chainData);
    BedrockUtils.writeLEAsciiString(buffer, skinData);
}
 
Example #6
Source File: LoginSerializer_v361.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, LoginPacket packet) {
    packet.setProtocolVersion(buffer.readInt());

    ByteBuf jwt = buffer.readSlice(VarInts.readUnsignedInt(buffer)); // Get the JWT.
    packet.setChainData(BedrockUtils.readLEAsciiString(jwt));
    packet.setSkinData(BedrockUtils.readLEAsciiString(jwt));
}
 
Example #7
Source File: LoginSerializer_v361.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, LoginPacket packet) {
    buffer.writeInt(packet.getProtocolVersion());

    AsciiString chainData = packet.getChainData();
    AsciiString skinData = packet.getSkinData();

    VarInts.writeUnsignedInt(buffer, chainData.length() + skinData.length() + 8);

    BedrockUtils.writeLEAsciiString(buffer, chainData);
    BedrockUtils.writeLEAsciiString(buffer, skinData);
}
 
Example #8
Source File: LoginSerializer_v313.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, LoginPacket packet) {
    packet.setProtocolVersion(buffer.readInt());

    ByteBuf jwt = buffer.readSlice(VarInts.readUnsignedInt(buffer)); // Get the JWT.
    packet.setChainData(BedrockUtils.readLEAsciiString(jwt));
    packet.setSkinData(BedrockUtils.readLEAsciiString(jwt));
}
 
Example #9
Source File: LoginSerializer_v313.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, LoginPacket packet) {
    buffer.writeInt(packet.getProtocolVersion());

    AsciiString chainData = packet.getChainData();
    AsciiString skinData = packet.getSkinData();

    VarInts.writeUnsignedInt(buffer, chainData.length() + skinData.length() + 8);

    BedrockUtils.writeLEAsciiString(buffer, chainData);
    BedrockUtils.writeLEAsciiString(buffer, skinData);
}
 
Example #10
Source File: LoginSerializer_v340.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, LoginPacket packet) {
    buffer.writeInt(packet.getProtocolVersion());

    AsciiString chainData = packet.getChainData();
    AsciiString skinData = packet.getSkinData();

    VarInts.writeUnsignedInt(buffer, chainData.length() + skinData.length() + 8);

    BedrockUtils.writeLEAsciiString(buffer, chainData);
    BedrockUtils.writeLEAsciiString(buffer, skinData);
}
 
Example #11
Source File: LoginSerializer_v388.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, LoginPacket packet) {
    packet.setProtocolVersion(buffer.readInt());

    ByteBuf jwt = buffer.readSlice(VarInts.readUnsignedInt(buffer)); // Get the JWT.
    packet.setChainData(BedrockUtils.readLEAsciiString(jwt));
    packet.setSkinData(BedrockUtils.readLEAsciiString(jwt));
}
 
Example #12
Source File: LoginSerializer_v388.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, LoginPacket packet) {
    buffer.writeInt(packet.getProtocolVersion());

    AsciiString chainData = packet.getChainData();
    AsciiString skinData = packet.getSkinData();

    VarInts.writeUnsignedInt(buffer, chainData.length() + skinData.length() + 8);

    BedrockUtils.writeLEAsciiString(buffer, chainData);
    BedrockUtils.writeLEAsciiString(buffer, skinData);
}
 
Example #13
Source File: LoginSerializer_v354.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, LoginPacket packet) {
    packet.setProtocolVersion(buffer.readInt());

    ByteBuf jwt = buffer.readSlice(VarInts.readUnsignedInt(buffer)); // Get the JWT.
    packet.setChainData(BedrockUtils.readLEAsciiString(jwt));
    packet.setSkinData(BedrockUtils.readLEAsciiString(jwt));
}
 
Example #14
Source File: LoginSerializer_v354.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, LoginPacket packet) {
    buffer.writeInt(packet.getProtocolVersion());

    AsciiString chainData = packet.getChainData();
    AsciiString skinData = packet.getSkinData();

    VarInts.writeUnsignedInt(buffer, chainData.length() + skinData.length() + 8);

    BedrockUtils.writeLEAsciiString(buffer, chainData);
    BedrockUtils.writeLEAsciiString(buffer, skinData);
}
 
Example #15
Source File: LoginSerializerCompat.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, LoginPacket packet) {
    int index = buffer.readerIndex();
    int protocol = buffer.readInt();
    if (protocol == 0) {
        buffer.readerIndex(index + 2);
        protocol = buffer.readInt();
    }
    packet.setProtocolVersion(protocol);

    ByteBuf jwt = buffer.readSlice(VarInts.readUnsignedInt(buffer)); // Get the JWT.
    packet.setChainData(readLEAsciiString(jwt));
    packet.setSkinData(readLEAsciiString(jwt));
}
 
Example #16
Source File: LoginEncryptionUtils.java    From Geyser with MIT License 5 votes vote down vote up
public static void encryptPlayerConnection(GeyserConnector connector, GeyserSession session, LoginPacket loginPacket) {
    JsonNode certData;
    try {
        certData = JSON_MAPPER.readTree(loginPacket.getChainData().toByteArray());
    } catch (IOException ex) {
        throw new RuntimeException("Certificate JSON can not be read.");
    }

    JsonNode certChainData = certData.get("chain");
    if (certChainData.getNodeType() != JsonNodeType.ARRAY) {
        throw new RuntimeException("Certificate data is not valid");
    }

    encryptConnectionWithCert(connector, session, loginPacket.getSkinData().toString(), certChainData);
}
 
Example #17
Source File: ClientPacketHandler.java    From BedrockConnect with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean handle(LoginPacket packet) {
    System.out.println(packet.toString());
    return true;
}
 
Example #18
Source File: LoginSerializerCompat.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, LoginPacket packet) {
    throw new UnsupportedOperationException();
}