Skip to content

GameProfile field not found in TinyProtocol #2497

Description

@gamerover98
  • This issue is not solved in a development build

Describe the bug
When using the TinyProtocol class, at line 67 the Cannot find field with type class com.mojang.authlib.GameProfile has occurred.

To Reproduce
Steps to reproduce the behavior:

  1. Add TinyProtocol and Reflection classes into your plugin project
  2. Add a simple implementation like the following one:
package it.test.protocol;

import io.netty.channel.Channel;
import it.test.protocol.TinyProtocol;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

public class TestTinyProtocol extends TinyProtocol {

    public TestTinyProtocol(Plugin plugin) {
        super(plugin);
    }

    @Override
    public Object onPacketOutAsync(Player receiver, Channel channel, Object packet) {
        plugin.getLogger().info("OUT: " + packet.toString());
        return super.onPacketOutAsync(receiver, channel, packet);
    }

    @Override
    public Object onPacketInAsync(Player sender, Channel channel, Object packet) {
        plugin.getLogger().info("IN: " + packet.toString());
        return super.onPacketInAsync(sender, channel, packet);
    }
}
  1. Add it to the plugin onLoad/onEnable (same behavior)
    this.tinyProtocol = new TestTinyProtocol(plugin);
  2. Start the server and wait until the error occurred.

Exception

Caused by: java.lang.IllegalArgumentException: Cannot find field with type class com.mojang.authlib.GameProfile
        at it.test.protocol.Reflection.getField(Reflection.java:179) ~[ParadiseLand.jar:?]
        at it.test.protocol.Reflection.getField(Reflection.java:177) ~[ParadiseLand.jar:?]
        at it.test.protocol.Reflection.getField(Reflection.java:177) ~[ParadiseLand.jar:?]
        at it.test.protocol.Reflection.getField(Reflection.java:123) ~[ParadiseLand.jar:?]
        at it.test.protocol.TinyProtocol.<clinit>(TinyProtocol.java:67) ~[ParadiseLand.jar:?]
        ... 14 more

This is because the net.minecraft.network.protocol.login.PacketLoginInStart from Spigot 1.19 no longer has a GameProfile field:
image

Expected behavior
Correct TinyProtocol loading.

Version Info
ProtocolLib: not used in this case
TinyProtocol: the latest available class from the GitHub master branch.

Additional context
TinyProtocol works from 1.8.8 to 1.18.2 and does not work from: 1.19

Thanks! 🥇

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions