Vanish development - tablist, ServerListPing and packet level hiding

Whassup. I’m making my own vanish plugin and I want to ask about a few things.
First, I need to remvoe vanished players from tablists. Since you can edit every player’s tablist it would be nice to remove player only from ones who shouldn’t see vanished staff. But I didn’t understand how to manage these tablists, so I need a good example of removing a player and then adding it (in case some of the staff switched vanish)

Next thing is ServerListPing. I tweaked LegacyPing using ASM and I’m interested is there a cleaner way to manage ServerListPing. Like using ProtocolLib in Bukkit or even eaiser.

And the last - the packet level. Actually, when a player joins the server, some extra packets are sent, and they can be used to determine is there any staff or not. I want to hide these packets completely, so it will be impossible to detect any joining/leaving stuff. If the player is near to you the server sends you entity information packets and if it’s far there are some SPacketPlayerListItem.

soo… for the Server-List-Ping there is a ClientPingServerEvent where you can modify the response :slight_smile:

Can you tell me how? :wink: I can’t find any method that can change players in the event object.

ClientPingEvent.Reponse event;
event.getPlayers().ifPresent(p -> {

//Userwill see it as 1/2

1 Like

ClientPingServerEvent.Response.Players lets you get a List of GameProfile that you can modify, thus allowing you to remove those players.

1 Like

Sorry for a bit of abandonment. Tried all your answers and it’s working! So now I need to fix packets and TabList.
It seems that removing player from tab and using vanish keys on join event will not help. It will hide the player, however, all the packets are still being sent. I need to find a way to tell server NOT send anything on player join.

Sponge Is a bit strange with network packets and canceling them. I think its just not supported by sponge, thats not to say you can not do it.

Sponge was designed with multiple implementations in mind. This includes Lantern Powered that may not have the exact packets that regular mc has.

Anyway, as far as im aware there is a netty wrapper interface found in sponge common however I’m not sure that allows for packet overriding. So you will probably need to deep dive into nms to cancel the packets.

As you may tell im not 100% on this front, not really something i played around with considering i use sponge vanilla so there maybe a way without nms

I’ve found a plugin for managing packets - PacketGate. It allows you to listen for specific packets. So, the packet problem is solved.
The only thing I need now is an example of tablist api. Really. I don’t understand how to remove player from tab temporary, until the player will switch vanish off.

don’t understand how to remove player from tab

What part of that dont you get?

How to add the player back.

Player playerYouWishToAdd;
TabList tabList;
TabListEntry entry = TabListEntry.builder()
    .latency(playerYouWishToAdd.getConnection().getLaten y())

That is one of the ways. Im going off memory so some of it maybe wrong. Also some plugins do change the display names of the player to something else such as the players chat display name, if you want to support those plugins you can always get the entry of the player before removing it and store it to one side and then reapply it when needed

1 Like

Now everyting is solved. Thank you for your help!

1 Like