PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
9.98k stars 2.31k forks source link

Player not kicked for flying when adjacent to a block #10362

Closed CuriousCodingCanadian closed 7 months ago

CuriousCodingCanadian commented 7 months ago

Expected behavior

The player would be kicked when floating for over the set value of 80 ticks .

Observed/Actual behavior

The player is not kicked when floating for over 80 ticks .

Steps/models to reproduce

Create a simple client mod that sets player.abilities.allowFlying to true (even indirectly). Join a paper server in the survival gamemode and float for over 80 ticks (4 seconds) next to a block. you will not be kicked. Go 2-3 blocks away from any other blocks and wait for 4 seconds again. You will be kicked with "Flying is not enabled on this server!" and on the server console, for "floating too long".

You can also use a proxy to modify the packet data to float.

Plugin and Datapack List

None

Paper version

This server is running Paper version git-Paper-462 (MC: 1.20.4) (Implementing API version 1.20.4-R0.1-SNAPSHOT) (Git: 00fd87a)

Other

This seems to be due to the check when setting clientIsFloating in the ServerGamePacketListenerImpl.java, there is a check for "&& this.noBlocksAround(this.player)". If this variable is not true, the kick cannot take place.

CuriousCodingCanadian commented 7 months ago

The fly kick occurs exclusively within this if-block: if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger() && !this.player.isDeadOrDying()).

Malfrador commented 7 months ago

This is a weakness of Mojang's "anti-cheat". The same bypass is possible on vanilla servers, and exists most likely because of slime blocks, ladders, or similar blocks.

Paper generally does not fix issues with the vanilla anti-cheat. Even if this specific issue was fixed, there are many other flight cheats that can easily bypass the built-in checks. And it is not really feasible to maintain what would essentially be a Paper Anti-Cheat.

The general recommendation is to simply install one of the many anti-cheat plugins available, as they do a much better job of preventing cheating in general than Vanilla or Paper.