Search in sources :

Example 1 with ServerboundCustomQueryPacketAccessor

use of org.spongepowered.common.accessor.network.protocol.login.ServerboundCustomQueryPacketAccessor in project SpongeCommon by SpongePowered.

the class PacketUtil method createLoginPayloadResponse.

public static net.minecraft.network.protocol.Packet<?> createLoginPayloadResponse(@Nullable final ChannelBuf payload, final int transactionId) {
    final ServerboundCustomQueryPacket packet = new ServerboundCustomQueryPacket();
    final ServerboundCustomQueryPacketAccessor accessor = (ServerboundCustomQueryPacketAccessor) packet;
    accessor.accessor$transactionId(transactionId);
    accessor.accessor$data((FriendlyByteBuf) payload);
    return packet;
}
Also used : ServerboundCustomQueryPacketAccessor(org.spongepowered.common.accessor.network.protocol.login.ServerboundCustomQueryPacketAccessor) ServerboundCustomQueryPacket(net.minecraft.network.protocol.login.ServerboundCustomQueryPacket)

Example 2 with ServerboundCustomQueryPacketAccessor

use of org.spongepowered.common.accessor.network.protocol.login.ServerboundCustomQueryPacketAccessor in project SpongeCommon by SpongePowered.

the class SpongeChannelManager method handleLoginResponsePayload.

public void handleLoginResponsePayload(final EngineConnection connection, final ServerboundCustomQueryPacket packet) {
    // Client -> Server response
    final ServerboundCustomQueryPacketAccessor accessor = (ServerboundCustomQueryPacketAccessor) packet;
    final int transactionId = accessor.accessor$transactionId();
    final ChannelBuf payload = (ChannelBuf) accessor.accessor$data();
    try {
        this.handleLoginResponsePayload(connection, transactionId, payload);
    } finally {
        if (payload != null) {
            ChannelBuffers.release(payload);
        }
    }
}
Also used : ServerboundCustomQueryPacketAccessor(org.spongepowered.common.accessor.network.protocol.login.ServerboundCustomQueryPacketAccessor) ChannelBuf(org.spongepowered.api.network.channel.ChannelBuf)

Aggregations

ServerboundCustomQueryPacketAccessor (org.spongepowered.common.accessor.network.protocol.login.ServerboundCustomQueryPacketAccessor)2 ServerboundCustomQueryPacket (net.minecraft.network.protocol.login.ServerboundCustomQueryPacket)1 ChannelBuf (org.spongepowered.api.network.channel.ChannelBuf)1