How Can I Eject a Player from a Multiplayer App?

I'm developing a multiplayer VR app for the Oculus Quest using Bolt in Unity 2019.4.4f1. I want the host to be able to eject "misbehaving" players. Can someone suggest a procedure or provide code for doing that? I tried using this code from the LobbyPlayer script from the Photon lobby demo in a script I created, but the code causes compiler errors.

public void OnRemovePlayerClick()
{
if (BoltNetwork.IsServer)
{
LobbyPlayerKick.Create(entity, EntityTargets.OnlyController).Send();
}
}

public override void OnEvent(LobbyPlayerKick evnt)
{
BoltNetwork.Shutdown();
}

Answers