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

GameProfile field not found in TinyProtocol #2497

Open
1 task done
gamerover98 opened this issue Aug 5, 2023 · 0 comments · May be fixed by #2499
Open
1 task done

GameProfile field not found in TinyProtocol #2497

gamerover98 opened this issue Aug 5, 2023 · 0 comments · May be fixed by #2499

Comments

@gamerover98
Copy link

gamerover98 commented Aug 5, 2023

  • 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! 🥇

@gamerover98 gamerover98 changed the title authlib GameProfile class not found in TinyProtocol GameProfile field not found in TinyProtocol Aug 5, 2023
@gamerover98 gamerover98 linked a pull request Aug 5, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant