package launcher.request.uuid; import launcher.Launcher.Config; import launcher.LauncherAPI; import launcher.client.PlayerProfile; import launcher.helper.VerifyHelper; import launcher.request.Request; import launcher.serialize.HInput; import launcher.serialize.HOutput; import java.io.IOException; public final class ProfileByUsernameRequest extends Request<PlayerProfile> { private final String username; @LauncherAPI public ProfileByUsernameRequest(Config config, String username) { super(config); this.username = VerifyHelper.verifyUsername(username); } @LauncherAPI public ProfileByUsernameRequest(String username) { this(null, username); } @Override public Type getType() { return Type.PROFILE_BY_USERNAME; } @Override protected PlayerProfile requestDo(HInput input, HOutput output) throws IOException { output.writeString(username, 64); output.flush(); // Return profile return input.readBoolean() ? new PlayerProfile(input) : null; } }