Two more things:
Garkin pointed out that I can use the
three other DisplayName functions to either add or remove the "@" and check for valid return values, but I need to check a bit what exactly they are doing before I can use them for this code.
I also realised that there is at least one more way to get a DisplayName: Player override.
I add a .lua file containing nothing but this and execute it before the main code:
Lua Code:
--define global variable
DisplayNameFixConstants = {
WindowsUserOverride = ""
}
That way any user can modify the file and force a specific display name to be shown.
But since that is not a very good way (it is a static assignement for all people who log in on this windows user) I propably put it as last effort before falling back to the original GetDisplayName().