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 me) {
        this.server = minecraftServer;
        this.connection = me;
    }
    
    @Override
    public void handleIntention(final ClientIntentionPacket st) {
        this.connection.setProtocol(st.getIntention());
        this.connection.setListener(new ServerLoginPacketListenerImpl(this.server, this.connection));
    }
    
    @Override
    public void onDisconnect(final Component mr) {
    }
    
    @Override
    public Connection getConnection() {
        return this.connection;
    }
}
