gate icon indicating copy to clipboard operation
gate copied to clipboard

Custom tablist display name

Open iimrudy opened this issue 3 years ago • 6 comments

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

iimrudy avatar Jul 07 '22 16:07 iimrudy

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 avatar Jul 09 '22 07:07 robinbraemer

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.

robinbraemer avatar Jul 09 '22 08:07 robinbraemer

thank you, ill try that asap

iimrudy avatar Jul 09 '22 08:07 iimrudy

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 
    }()
}

iimrudy avatar Jul 09 '22 08:07 iimrudy

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

robinbraemer avatar Jul 09 '22 11:07 robinbraemer

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.

iimrudy avatar Jul 09 '22 11:07 iimrudy