package net.minecraft.server.network;

import net.minecraft.network.chat.Component;
import net.minecraft.network.PacketListener;
import net.minecraft.network.protocol.handshake.ClientIntentionPacket;
import net.minecraft.network.Connection;
import net.minecraft.server.MinecraftServer;
import net.minecraft.network.protocol.handshake.ServerHandshakePacketListener;

public class MemoryServerHandshakePacketListenerImpl implements ServerHandshakePacketListener {
    private final MinecraftServer server;
    private final Connection connection;
    
    public MemoryServerHandshakePacketListenerImpl(final MinecraftServer minecraftServer, final Connection kt) {
        this.server = minecraftServer;
        this.connection = kt;
    }
    
    @Override
    public void handleIntention(final ClientIntentionPacket re) {
        this.connection.setProtocol(re.getIntention());
        this.connection.setListener(new ServerLoginPacketListenerImpl(this.server, this.connection));
    }
    
    @Override
    public void onDisconnect(final Component lf) {
    }
    
    @Override
    public Connection getConnection() {
        return this.connection;
    }
}
