Closed morko closed 5 years ago
Okay, I will change the default to false
, but I'm not sure what you mean with room.getPlayerList
, the player objects returned by that function are the same as the ones from getPlayer
, so they also contain the ID.
Sorry. You are right about room.getPlayerList
returning the post fixed names. What I was supposed to write about is the situation when you want to match the names in the chat against the playerlist to find the player. Because the name might be post fixed or not post fixed it would make the following function more complex and confused me for a while because by default it added the id there.
function getPlayerWithName(pName) {
pName = pName.startsWith('@') ? pName.slice(1) : pName;
let player = room.getPlayerList().find((p) => p.name === pName);
return player;
}
Ah yeah, I see. Maybe the whole idea is bad, I think I will remove this feature and make it an option for the chat display only. I could of course add a pre-event handler hook which automatically fixes names in incoming messages, but… nah, let's not go there. :D
Adding id to the player name is great idea but modifying the player objects name property by default is not.
When developing it is expected that the name property does not contain any extra markup and unexpected errors can happen when e.g. when comparing names with the names in
room.getPlayerList
(where names do not contain id).In my opinion
addPlayerIdToNickname
should befalse
by default and iftrue
, then id should be added to the players inroom.getPlayerList()
aswell.