ProtocolLib

3M Downloads

TinyProtocol Broken on 1.18.2 (and 1.16+)?

Coops0 opened this issue ยท 0 comments

commented

Make sure you're doing the following

  • You're using the latest build for your server version
  • This isn't an issue caused by another plugin
  • You've checked for duplicate issues
  • You didn't use /reload

Describe the question
A clear and concise description of what your question is.
I'm trying to use TinyProtocol on 1.18.2, and I'm getting an error "Cannot find net.minecraft.server.v1_18_R2.PacketPlayInChat".
I've searched all the server jars (not the bundler) for the net.minecraft.server.V1_18_R2 package, and I can't find anything. I also have been researching this for a few hours. Did the NMS package name for 1.16+ get broken/reverted to obfuscation or the mojang mapped names? I was reading some of the spigot patch notes and I saw in 1.16.2 that the fields were reverted to obfuscated names, but that shouldn't effect class names. I'm stumped.

I used build tools and build a 1.13.2 jar, and I found the server package very easily, is TinyProtocol broken right now or am I using the wrong class path?

API method(s) used
List what API method(s) you're using
This is the line causing issues:
Reflection.getField("{nms}.PacketPlayInChat", String::class.java, 0)

Expected behavior
A clear and concise description of what you expected to happen.
For that method to not throw an error and instead return Reflection.FieldAccessor, as the example plugin displayed.

Code
If applicable, add relevant code from your project

class PacketHandler {
    // PROBLEMATIC LINE
    val CHAT_MESSAGE: Reflection.FieldAccessor<String> = Reflection.getField(
        "{nms}.PacketPlayInChat",
        String::class.java, 0
    )

    var protocol: TinyProtocol = object : TinyProtocol(Main.instance) {
        override fun onPacketInAsync(sender: Player, channel: Channel, packet: Any) =
            packetInAsync(sender, channel, packet)

        override fun onPacketOutAsync(receiver: Player, channel: Channel, packet: Any) =
            packetOutAsync(receiver, channel, packet)
    }

    fun packetInAsync(sender: Player, channel: Channel, packet: Any): Any? {
        ...
    }

    fun packetOutAsync(receiver: Player, channel: Channel, packet: Any): Any? {
        ...
    }
}

Additional context
Add any other context about the problem here.
Using kotlin, paper 1.18.2, java 17.