Velocity icon indicating copy to clipboard operation
Velocity copied to clipboard

Added ServerUpdateTablistEvent to allow modifications of the player list

Open Joo200 opened this issue 1 year ago • 1 comments

This event is called when the backend server modifies the tablist entries. The entries can be modified but not removed or changed.

This merge request should fix my issue #870 .

Example code to use that event:

@Subscribe
public void onUpdate(ServerUpdateTablistEvent event) {
  switch (event.getAction()) {
    case UPDATE_DISPLAY_NAME, ADD_PLAYER -> {
      event.getEntries().forEach(entry -> 
          entry.setDisplayName(Component.text(entry.getProfile().getName(), NamedTextColor.YELLOW)));
  }
}

It was necessary to change the logic and to not send the backend server's packet directly to the client. This should be no breaking change and it works with the enabled and disabled signing feature.

Joo200 avatar Sep 21 '22 20:09 Joo200