Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom tablist display name #79

Open
iimrudy opened this issue Jul 7, 2022 · 6 comments
Open

Custom tablist display name #79

iimrudy opened this issue Jul 7, 2022 · 6 comments
Labels
enhancement New feature or request (not a bug) priority/medium Medium priority task question Further information is requested

Comments

@iimrudy
Copy link

iimrudy commented Jul 7, 2022

Hi, i wanted to ask if it is possible to change a player's display name on the tablist for everyone or create a team and add suffix and/or prefix to it, in order to always change the tablist, because i would like to add global prefixes/suffixes for a custom ranks and permissions system.

Thanks in advance, have a nice day

@robinbraemer robinbraemer changed the title is it possible to chagne a player's displayname on the tablist for everyone. Custom tablist display name Jul 7, 2022
@robinbraemer
Copy link
Member

robinbraemer commented Jul 9, 2022

Yes, this functionality is supported.
Every player has it's own TabList.
Then you can modify the display name for every player. I haven't tried it yet but I think you should set the display names for a player on the ServerPostConnectEvent.

@robinbraemer robinbraemer added the question Further information is requested label Jul 9, 2022
@robinbraemer
Copy link
Member

robinbraemer commented Jul 9, 2022

There is currently no other straight forward way to modify the player entries packet sent from the server to the proxy so right now the player would receive the normal tablist and then receive your display name update packets shortly after.

@iimrudy
Copy link
Author

iimrudy commented Jul 9, 2022

thank you, ill try that asap

@iimrudy
Copy link
Author

iimrudy commented Jul 9, 2022

it works! but i must wait for like 100/200 milliseconds after the ServerPostConnect event otherwise the player's Entries() list it's empty

p.Proxy().Event().Subscribe(&proxy.ServerPostConnectEvent{}, 0, func(ev event.Event) {
    e := ev.(*proxy.ServerPostConnectEvent)
    go func() {
	time.Sleep(time.Second) // i've pute a second just to be sure to find elments inside the  e.Player().Entries()
	// change display names here 
    }()
}

@robinbraemer
Copy link
Member

Let me know if that's enough or you want smth like a "TabListEvent" to do it properly.

@iimrudy
Copy link
Author

iimrudy commented Jul 9, 2022

actually i think that a proper event might be the best way and it could be very useful to me, but right now it's not critical as "ServerPostConnectEvent" doesn't seem to cause much trouble.

@robinbraemer robinbraemer added the enhancement New feature or request (not a bug) label Aug 26, 2022
@robinbraemer robinbraemer added the priority/medium Medium priority task label Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request (not a bug) priority/medium Medium priority task question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants