Here is my code to change the players name and respawn them
Code: Select all
private string _DisplayName;
/// <summary> When changed spawns the player with a new name </summary>
public string DisplayName
{
get {
if (!String.IsNullOrEmpty(_DisplayName))
return _DisplayName;
else
return ListName;
}
set
{
_DisplayName = value;
if (HasFullyConnected)
{
RemoveEntity(this);
AddEntity(this);
}
}
}
On line 1369 of Player.Networking.cs: KeyNotFoundException "The given key was not present in the dictionary."
Code: Select all
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at fCraft.Player.RemoveEntity(Player player) in C:\Users\Me\FCraft\fCraft\Network\Player.Networking.cs:line 1369
at fCraft.Player.set_DisplayName(String value) in C:\Users\Me\FCraft\fCraft\Player\Player.cs:line 159
at fCraft.Mod.Main.ChangeName(Player e) in C:\Users\Me\FCraft\fCraft\Mod\Main.cs:line 208
at fCraft.Scheduler.MainLoop() in C:\Users\Me\FCraft\fCraft\System\Scheduler.cs:line 72
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Thanks for any help.