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

Wrong client version #1024

Open
vytskalt opened this issue Oct 12, 2024 · 9 comments
Open

Wrong client version #1024

vytskalt opened this issue Oct 12, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@vytskalt
Copy link
Contributor

Describe the bug
PacketEvents incorrectly identifies the client version of a 1.20.4 client on a 1.8.8 server as V_1_8.

Software brand
SportPaper 1.8

Plugins
ViaVersion 5.0.3 and test plugin

How To Reproduce

@EventHandler
public void join(PlayerJoinEvent event) {
  event.getPlayer().sendMessage("Your client version: " + PacketEvents.getAPI().getPlayerManager().getClientVersion(event.getPlayer()));
}

Expected behavior
It should say Your client version: V_1_20_3

Screenshots
image

Additional context
n/a

@vytskalt vytskalt added the bug Something isn't working label Oct 12, 2024
@retrooper
Copy link
Owner

Use the UserLoginEvent from packetevents to ensure correct client version at the right time.

@vytskalt
Copy link
Contributor Author

Thanks, but that isn't possible in my case. I need it to be available in PlayerJoinEvent. Is that really not possible?

@AbhigyaKrishna
Copy link
Collaborator

Packetevents doesn't track client versions on spigot servers.

@jonesdevelopment
Copy link

Use the ViaVersion API for determining the client version of a player:

version = serverIsUsingViaVersion
        ? ClientVersion.getById(Via.getAPI().getPlayerVersion(user.getUUID()))
        : user.getClientVersion();

@vytskalt
Copy link
Contributor Author

Packetevents doesn't track client versions on spigot servers.

Really? I see code for it in PlayerManagerImpl:
image

@vytskalt
Copy link
Contributor Author

@EventHandler
public void join(PlayerJoinEvent event) {
  Player player = event.getPlayer();
  ClientVersion viaVersion = ClientVersion.getById(Via.getAPI().getPlayerVersion(player.getUniqueId()));
  ClientVersion packetEvents = PacketEvents.getAPI().getPlayerManager().getClientVersion(player);

  player.sendMessage("Your client version (PacketEvents): " + packetEvents);
  player.sendMessage("Your client version (ViaVersion): " + viaVersion);
}

image
Looks like a bug in PacketEvents to me.

@retrooper
Copy link
Owner

retrooper commented Oct 12, 2024

Thanks, but that isn't possible in my case. I need it to be available in PlayerJoinEvent. Is that really not possible?

UserLoginEvent is powered by the PlayerJoinEvent.

@retrooper
Copy link
Owner

I'll look at it in a moment again.

@vytskalt
Copy link
Contributor Author

Thanks, but that isn't possible in my case. I need it to be available in PlayerJoinEvent. Is that really not possible?

UserLoginEvent is powered by the PlayerJoinEvent.

The reason I need it in PlayerJoinEvent is because I want to use getClientVersion inside a library but don't want to force users to switch to UserLoginEvent. It would be unintuitive and also a breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants