-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Cannot register new packet in states.go
#67
Comments
You cannot register a packet with the same ID on the same registry.
Are you creating a custom Does this solve your issue? |
I will try it later, thanks |
Seems like I have no time to test, sorry. I will close this due to inactivity. |
No, I'm really trying to listen for 0x03 packet from protocol 47. |
I will try to use another packed instead of |
Unfortunately, the same packet ID which I have choice is already registered in protocol |
I think we could add a one more check at here about the |
Yes, we already check entries per-protocol version here gate/pkg/edition/java/proto/state/registry.go Line 139 in 6c8ba60
|
I don't think type checking wouldn't work because on the wire the packet ID matters, not the Go type. Otherwise, when receiving a packet with an ID that has two packet types registered in the same state & protocol version, Gate wouldn't know which type to choose. |
This is the bit that matters to you I think gate/pkg/edition/java/proto/codec/decoder.go Lines 192 to 208 in 6c8ba60
|
Could you explain your use case why you want to register two packet types for the same id? Maybe I can help you better understand what your goal is and or what confusion you might have. |
Sorry for late response. I'm working on a client-side world for the player to check about what packets he's sending to the server. Basically, I want to listen for alot of specific packets to ensure if a player is a BOT or however. But, when I was trying to register some packets like |
I got an example video here. |
Fun fact: The same idea was commented in #47 |
I understand. If I were to do this I would go with a different approach and make Gate again more aware of the state of the player. I suggest registering a "virtual server/client-side world" hosted by a Gate plugin that moves every joining player to it. Use event listeners to restrict the boundaries of the player (e.g. cannot switch servers, chat or use commands until the player did the cracked authentication and so on). This way Gate works much more predictable and as is used as intended, by plugins. After joining handshake on the "virtual server" your code can do everything you want with packets. My plan is to sort out Minecraft packet processing from Gate into a reusable library for writing highly composable Minecraft servers into another repository. But until then, I cannot give much support for very hacky stuff ;D. |
Alright then, I will make it as plugin if possible. |
Currently, I'm working on a different session handler after login state to listen incoming
Flying
packets.But for some reason, I cannot register some packets in
Server
andClient
bounds due to duplicate packet id.I made a
FallStatus
packet which is designed with ID0x03
inPlay
state for Protocol Version 47 (1.8.8), but when I try to register it, gate crashs and a panic message is sent with a specific message about a duplicate ID from Protocol Version 335 (1.12) ofPacket.Chat
.Can not register packet type packet.Chat with id 0x33 for protocol 335 because another packet is already registered
I'm registering those packets like that:
The text was updated successfully, but these errors were encountered: