[SPIGOT-6799] Some sort of API for Packet plugins to inject into channel pipelines Created: 22/Nov/21 Updated: 22/Nov/21 Resolved: 22/Nov/21 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | New Feature | Priority: | Minor |
Reporter: | retrooper | Assignee: | Unassigned |
Resolution: | Won't Fix | Votes: | 0 |
Labels: | injector, nms, packet, packetevents, protocollib, spigot, update, viaversion | ||
Environment: |
Spigot pre 15 on Java 17? |
Version: | 1.18 (latest, i dont think this is relevant for me to check) |
Guidelines Read: | Yes |
Description |
I think it could be amazing if Spigot could have some sort of API to help packet plugins inject into the channel pipelines as soon as they are created. Right now every packet plugin has to use some very hacky reflection and every plugin uses a different approach, forcing us to add compatibility for each other. It’s getting painful, and could be that we need to adjust our injectors after some minecraft updates. I recently read your statement on your Spigot 9 year anniversary (Great work btw), you mentioned plugin owners should use the API if possible or suggest one to avoid breakages on updates. I think this idea could help in that direction too. I believe this could help plugins such as ProtocolLib, ViaVersion, ProtocolSupport, and my own project clean up our own injectors. I could attempt a PR at something like this, I wanted to see md_5’s opinion first, and could use some mentoring on how to design such a feature of the API. Would be amazing if we could push this out before the first stable 1.18 Spigot jar releases.
|
Comments |
Comment by retrooper [ 22/Nov/21 ] |
That is kind of what my project is, but also a bit more than that. Thank you though. |
Comment by md_5 [ 22/Nov/21 ] |
You should consider if it might be possible to make a general purpose API that achieves your goal instead. |
Comment by retrooper [ 22/Nov/21 ] |
👍 |
Comment by md_5 [ 22/Nov/21 ] |
Ignoring the other issues with such an API (an API that has no usage except to bypass the API), it's not even guaranteed from an API perspective that the server is Netty-based (and why should it be — eg, there were Netty implementations of the server back when Vanilla wasn't using Netty). The focus should be on eliminating the need for packets entirely, that's what API development is. |
Comment by retrooper [ 22/Nov/21 ] |
Or we could have an event which would provide us with the client’s channel allowing us to inject much easier. |
Comment by retrooper [ 22/Nov/21 ] |
I understand your concern, nothing wrong with it. The thing is we need to hack into a list of the server’s server channels which handle connecting clients using reflection, and since our approach at this could change through out the updates, I thought it could be useful to have abstraction. |
Comment by md_5 [ 22/Nov/21 ] |
But NMS objects are going to break each release regardless of whether you can 'inject into the pipeline'? |
Comment by retrooper [ 22/Nov/21 ] |
I just want Spigot to have an abstraction that makes injecting into the pipeline easier. |
Comment by retrooper [ 22/Nov/21 ] |
I don’t need a packet api, i think you might misunderstand me. I want to deal with the NMS objects or potentially byte bufs myself. |
Comment by md_5 [ 22/Nov/21 ] |
You can't make packets API. An API is an abstraction, see, eg, https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/6c45a80e2ea268983d5a98b9f98b17e67496ca5a |