GameProfile field not found in TinyProtocol
gamerover98 opened this issue · 0 comments
- 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:
- Add TinyProtocol and Reflection classes into your plugin project
- 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);
}
}
- Add it to the plugin onLoad/onEnable (same behavior)
this.tinyProtocol = new TestTinyProtocol(plugin);
- 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:
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! 🥇