ProtocolLib

3M Downloads

(1.19+) TinyProtocol cannot locate the EntityPlayer class, wich is used on instatiation

SrDum opened this issue ยท 3 comments

commented
  • This issue is not solved in a development build

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:
1-Create a TinyProtocol instance
2-profit

Expected behavior
Proeperly find EntityPlayer when instantiated

Log
[11:07:05] [Server thread/ERROR]: Error occurred while enabling MyPlugin v1.0.0 (Is it up to date?) java.lang.ExceptionInInitializerError: null at net.myplugin.bukkit.MyPlugin.onEnable(MyPlugin.java:29) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[bukkit-1.19-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:334) ~[bukkit-1.19-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:479) ~[bukkit-1.19-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:509) ~[craftbukkit-1.19-R0.1-SNAPSHOT.jar:3553-Bukkit-ef09464] at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:435) ~[craftbukkit-1.19-R0.1-SNAPSHOT.jar:3553-Bukkit-ef09464] at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:219) ~[craftbukkit-1.19-R0.1-SNAPSHOT.jar:3553-Bukkit-ef09464] at net.minecraft.server.MinecraftServer.v(MinecraftServer.java:945) ~[craftbukkit-1.19-R0.1-SNAPSHOT.jar:3553-Bukkit-ef09464] at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:283) ~[craftbukkit-1.19-R0.1-SNAPSHOT.jar:3553-Bukkit-ef09464] at java.lang.Thread.run(Thread.java:833) [?:?] Caused by: java.lang.IllegalArgumentException: Cannot find net.minecraft.server.v1_19_R1.EntityPlayer at com.comphenix.tinyprotocol.Reflection.getCanonicalClass(Reflection.java:366) ~[?:?] at com.comphenix.tinyprotocol.Reflection.getClass(Reflection.java:333) ~[?:?] at com.comphenix.tinyprotocol.Reflection.getField(Reflection.java:109) ~[?:?] at com.comphenix.tinyprotocol.TinyProtocol.<clinit>(TinyProtocol.java:44) ~[?:?] ... 10 more Caused by: java.lang.ClassNotFoundException: net.minecraft.server.v1_19_R1.EntityPlayer at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:147) ~[bukkit-1.19-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:99) ~[bukkit-1.19-R0.1-SNAPSHOT.jar:?] at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?] at java.lang.Class.forName0(Native Method) ~[?:?] at java.lang.Class.forName(Class.java:375) ~[?:?] at com.comphenix.tinyprotocol.Reflection.getCanonicalClass(Reflection.java:364) ~[?:?] at com.comphenix.tinyprotocol.Reflection.getClass(Reflection.java:333) ~[?:?] at com.comphenix.tinyprotocol.Reflection.getField(Reflection.java:109) ~[?:?] at com.comphenix.tinyprotocol.TinyProtocol.<clinit>(TinyProtocol.java:44) ~[?:?]
Version Info
TinyProtocol

commented

I had the exact same thing happen to me. This is caused by the fact that Minecraft server classes used to be under "net.minecraft.server", so to find any class all that was necessary was to prepend "net.minecraft.server" to the beginning of each class and the plugin would find it. More recently, these classes got split up into different folders and subfolders, leading it to be much more organized but it completely ruins TinyProtocol, which used the fact that all classes were under "net.minecraft.server" to locate the target classes.

To fix this, one would have to go into the Reflection.java file for TinyProtocol and fix the incorrect class lookup, which is easier said than done as there are so many classes. It might be possible to have a fix that uses the classpath to search for the desired class, but I'm not really sure.

Honestly, I would just use the normal version of ProtocolLib, which is what I ended up doing.

commented

TinyProtocol is currently not under active development, but maybe we will maintain that as well when we've improved & fixed everything which is a pain in ProtocolLib itself currently :)

commented

If you need to use TinyProtocol desperately, you can use my scuffed, very untested version of it on my gist.