General question but why do you want to implement an in-server friend list? Isn't the steam one sufficient? I understand that standalone users cannot benefit from the steam one but still think it is too much effort with no real benefit for most users.
Or is the in-server friend list benefiting your users in some way? Like adding custom waypoints to the map where their friends are or having a compass or an arrow point to the direction a friend is at?
If I had to implement an in-server friend list I would do it this way:
1) /addfriend Name (when friend player is online)
This would save in my own database the server unique ID of the player. My db would look like this:
Int primary key autoincrement | ID of player who added the other | ID of player who was added |
1 | 10 | 15 |
2 | 15 | 10 |
meaning player with server ID 10 (e.g. Minotorious) has added player with server ID 15 (e.g. yahwho) as their friend. (you can add a confirm command before this is saved to the db for the other player e.g. once I use /addfriend yahwho you get a chat message and need to type /confirm for the entry to be added to the db. Then ofc the reverse entry would be added too see line 2 above of you adding me as a friend)
2) /friendlist or /listfriends
shows all friends of a player querying the world db for their current names using the Server UDs from my DB.
e.g steps: query my db for all IDs (in column 3 above) that have my number as the ID who added them (column 2 above), then query the world db for each of the numbers to get the name, and finally output the results.
e.g. output in chat:
Friend List:
Name ID
Minotorious 10
yahgiggle 5
red51 2
etc.
3) /removefriend ServerID (serverID obtained easily from /friendlist or /listfriends)
using an sql query removes the friends from my db without the need to obtain the player names or get mixed up with changed names and try to figure out when they were changed.
Hope this helps