OnPlayerLeave: keep username before deleting (#1181)

This commit is contained in:
ORelio 2020-08-06 16:01:14 +02:00
parent 4a8fb08f4b
commit 2034729f74

View file

@ -1769,12 +1769,16 @@ namespace MinecraftClient
/// <param name="uuid">UUID of the player</param>
public void OnPlayerLeave(Guid uuid)
{
string username = null;
if (onlinePlayers.ContainsKey(uuid))
username = onlinePlayers[uuid];
lock (onlinePlayers)
{
onlinePlayers.Remove(uuid);
}
DispatchBotEvent(bot => bot.OnPlayerLeave(uuid, onlinePlayers[uuid]));
DispatchBotEvent(bot => bot.OnPlayerLeave(uuid, username));
}
/// <summary>