MidnightControls

MidnightControls

447k Downloads

Bug: Incorrect "Quick Move" handling leads to kick on Hypixel

Julienraptor01 opened this issue ยท 4 comments

commented

Describe the bug
Using Quick Move in inventory on Hypixel lead to being Kicked

To Reproduce
Install the mod
Go on Hypixel
Use Quick Move in some inv (might need to do it twice or thrice)
Get Kicked

Expected behavior
Not being kicked i guess ?

Screenshots
image

PC (please complete the following information):

  • OS : Windows
  • Minecraft : 1.19.4
  • Fabric : 0.14.19
  • Fabric API : 0.76.0
  • Mods : Fabulously Optimized 4.7.0-beta.4 (can also be reproduced with just MidnightControls)
  • Version : 1.8.1

Additional context
Here are infos
https://hypixel.net/threads/update-regarding-modifications-sending-invalid-clicks.5130489/
https://hypixel.net/threads/update-regarding-modifications-sending-invalid-clicks.5130489/page-8#post-36853060
Content of the post :

To provide a bit of the dev perspective here, there are two mods we were aware of causing this issue namely, NEU (NotEnoughUpdates) and Skytils.
NEU has since fixed the issue on the latest beta builds in their Discord and you should update to avoid being kicked.
Skytils as far as I know still has yet to fix the issue, but you can toggle off their middle click GUIs setting.

Middle Clicking
It is worth noting that whilst the Skytils setting name contains "middle click", this is not an issue with middle clicking itself. You will find that on a vanilla client you cannot be kicked for middle clicking.

What went wrong?
Both of these mods use a feature to make your normal right clicks "act" like a middle click in that when clicking on an item in a GUI, it will not temporarily pick up the item due to ping delay. This feature is a great visual addition, however, until recently, both mods were implementing this incorrectly and thus flagging the kicking system.

The Fix
The fix is super simple. Both mods were directly sending the window (container) click packet to the server. This meant any client side checks Minecraft has were being skipped, which has its own pros and cons but meant that the values being sent to the server could be whatever they wanted.

You can see the current code here on Skytils GitHub but provided they fix it I will also leave an example below of the fix using Forge 1.8.

// Before
mc.playerController.windowClick(chest.windowId, event.slotId, 2, 0, mc.thePlayer)

// After
mc.playerController.windowClick(chest.windowId, event.slotId, 2, 3, mc.thePlayer)

Diagnosis
You can see in the above code block that the only change was swapping the second number from a "0" to a "3".
If you refer to the protocol standard found here, you can see container clicks expect very specific numbers into their "button" and "mode" fields. Skytils' current implementation is trying to provide an invalid left/right click where as when using the mode 3 field the server is expecting the only valid option; mode 2, button 3, resulting in a middle click.

Conclusion
For the mod developers, this is a super easy mistake to make and is only visible upon diving into the protocol spec, IDEs won't flag this and when just sending packets theres no client validation. We're very pleased that NEU moved so quickly to adopt the fix and hope other mods will follow suit soon.
For the players, we apologise about the kicks but it is a necessary evil. The issue mentioned here has been around for a while but we only recently dove into it and started preventing it. This isn't Hypixel trying move the blame to mods or their authors, but rather help them to fix the issue.

Thank you for reading and I apologise for getting rather technical, but hopefully this process has helped some of you understand the decisions behind this choice and the simple fixes for it.

commented

Midnight Controls isn't allowed on hypixel for some reason.

commented

Midnight Controls isn't allowed on hypixel for some reason.

It's not that it isn't allowed, it's that it does some special thing with the click which it is supposed doing in another way from what their article says

commented

Would love if someone were to fix that. As I have a hard time playing on keyboard/mouse so I prefer controller.

commented

i enhanced the additional context part which potentially give a fix because idk where is actually the part to fix in the code (otherwise i would have done a PR)