ProtocolLib

3M Downloads

getProtocolVersion returning wrong number for 1.20 - 1.21

FroostySnoowman opened this issue · 2 comments

commented
  • This issue is not solved in a development build

Describe the bug
getProtocolVersion is giving me "766" despite joining from a variety of different versions. (1.20.X - 1.21.X)

To Reproduce

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        int playerProtocolVersion = protocolManager.getProtocolVersion(event.getPlayer());
        System.out.println(playerProtocolVersion);

        if (playerProtocolVersion < MIN_PROTOCOL_VERSION) {
            event.getPlayer().sendMessage(ChatColor.RED + "Warning: You are using an outdated version of Minecraft. Please update to 1.20.6 or higher for the best experience.");
            event.getPlayer().sendMessage(ChatColor.RED + "Shops will not work properly. Click on the empty box to receive the shop item if it doesn't display!");
        }
    }

Failing to give me the correct protocol version.

Expected behavior
It should give me the correct version based on: https://wiki.vg/Protocol_version_numbers

Screenshots
N/A

Version Info
https://pastebin.com/eSD0dhdY

Additional context
N/A

commented

As another test, it still persists with 1.19.4. There's something very wrong here 🤔

commented

Turns out this might be related to a compatibility issue with ViaVersion. Using their API instead works.