public async Task Process(KickFromServer kick) { if (!IsLoggedIn) { return; } ConnectedUser connectedUser; if (server.ConnectedUsers.TryGetValue(kick.Name, out connectedUser)) { if (!User.IsAdmin) { await Respond("No rights to execute kick"); return; } await server.KickFromServer(Name, kick.Name, kick.Reason); } }
private async Task Process(KickFromServer kick) { if (!IsLoggedIn) { return; } Client client; if (state.Clients.TryGetValue(kick.Name, out client)) { if (!User.IsAdmin) { await Respond("No rights to execute kick"); return; } await client.Respond(string.Format("You were kicked by {0} : {1}", Name, kick.Reason)); client.RequestClose(); } }