public void OnPlayerLeaveGame(PlayerLeaveEventArgs playerLeaveEvent) { IPlayer player = playerLeaveEvent.Player; using var packet = new PlayerInfoPacket(PlayerInfoActionType.Remove, player); using var removePlayerPacket = new DestroyEntitiesPacket(player); IEnumerable <IMinecraftUser> players = _server.ConnectedPlayers.Where(x => x.Player.Id != player.Id); _server.SendTo(players, packet); _server.SendTo(players, removePlayerPacket); }
public void Kill(bool remove = true) { Alive = false; if (remove) { TheWorld.Clients.Remove(this); } if (ID >= 0) { DestroyEntitiesPacket packet = StateManager.FindState("play").GetSendPacket(0x13) as DestroyEntitiesPacket; packet.Entities.Add(ID); AddBroadCast(packet, this); Server.ViewModel.RemoveClient(this); } }