package net.minecraft.network.protocol.login;

import net.minecraft.network.PacketListener;
import java.io.IOException;
import java.util.UUID;
import net.minecraft.network.FriendlyByteBuf;
import com.mojang.authlib.GameProfile;
import net.minecraft.network.protocol.Packet;

public class ServerboundHelloPacket implements Packet<ServerLoginPacketListener> {
    private GameProfile gameProfile;
    
    public ServerboundHelloPacket() {
    }
    
    public ServerboundHelloPacket(final GameProfile gameProfile) {
        this.gameProfile = gameProfile;
    }
    
    @Override
    public void read(final FriendlyByteBuf mg) throws IOException {
        this.gameProfile = new GameProfile((UUID)null, mg.readUtf(16));
    }
    
    @Override
    public void write(final FriendlyByteBuf mg) throws IOException {
        mg.writeUtf(this.gameProfile.getName());
    }
    
    @Override
    public void handle(final ServerLoginPacketListener tc) {
        tc.handleHello(this);
    }
    
    public GameProfile getGameProfile() {
        return this.gameProfile;
    }
}
