/// <summary> /// Completely removes the entity and data of the bot. /// </summary> public void removeBot() { thread.Stop(); isMoving = false; Server.Bots.Remove(this); Server.Players.Send(PacketWriter.MakeRemoveEntity(ID)); }
// Remove player from the list, and notify remaining players public void UnregisterPlayer(Player player) { if (player == null) { log.Log("World.UnregisterPlayer: Trying to unregister a non-existent (null) player.", LogType.Debug); return; } lock ( playerListLock ) { if (players[player.id] == player) { log.Log("{0} left the server.", LogType.UserActivity, player.name); db.ProcessLogout(player); db.Save(); players[player.id] = null; playerCount--; SendToAll(PacketWriter.MakeRemoveEntity(player.id), null); SendToAll(PacketWriter.MakeMessage(Color.Sys + player.name + " left the server."), null); UpdatePlayerList(); } else { log.Log("World.UnregisterPlayer: Trying to unregister a non-existent (unknown id) player.", LogType.Warning); } } }
internal void UpdatePlayer(Player updatedPlayer) { Player player; for (int i = 1; i < players.Length; i++) { player = players[i]; if (player != null && player != updatedPlayer) { player.Send(PacketWriter.MakeRemoveEntity(updatedPlayer.id)); player.Send(PacketWriter.MakeAddEntity(updatedPlayer, updatedPlayer.pos)); } } }
void Hide(Player player, Command cmd) { if (player.Can(Permissions.Hide)) { if (!player.isHidden) { world.SendToAll(PacketWriter.MakeRemoveEntity(player.id), null); world.SendToAll(PacketWriter.MakeMessage(Color.Sys + player.name + " left the server."), null); player.isHidden = true; player.Message(Color.Gray, "You are now hidden."); } else { player.Message("You are already hidden."); } } else { world.NoAccessMessage(player); } }
/// <summary> /// Removes the bot entity, however the bot data remains. Intended as for temp bot changes. /// </summary> public void tempRemoveBot() { Server.Players.Send(PacketWriter.MakeRemoveEntity(ID)); }