Skip to content
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

Server-Authoritative Movement causes incorrect player movement rollback. #263

Open
Mcayear opened this issue May 11, 2024 · 2 comments
Open

Comments

@Mcayear
Copy link
Contributor

Mcayear commented May 11, 2024

🐞 Bug Feedback | BUG反馈

📝 Bug Description | BUG描述

Enable creative mode and fly quickly.

The server will display warnings like this:
image

Additionally, the server-authoritative-movement setting in server.properties is not functioning as intended.

Even changing from server-auth to client-auth does not disable the rollback.

📸 Screenshots / Video

45733f6-32c-a414-ee74-eeaf87f102a3.mp4
@Shiiyuko
Copy link
Contributor

Shiiyuko commented Jul 5, 2024

set player.setCheckMovement(false); and cancel PlayerInvalidMoveEvent

@Mcayear
Copy link
Contributor Author

Mcayear commented Jul 5, 2024

在 PlayerInvalidMoveEvent 之前有一个 if (invalidMotion) 判断

可以看下面这段从 Player.java 摘录的片段。

    protected void handleMovement(Vector3 clientPos) {
        if (!this.isAlive() || !this.spawned || this.teleportPosition != null || this.isSleeping()) {
            return;
        }

        boolean invalidMotion = false;
        Location revertPos = this.getLocation().clone();
        double distance = clientPos.distanceSquared(this);

        if (!this.level.isChunkGenerated(clientPos.getChunkX(), clientPos.getChunkZ())) {
            invalidMotion = true;
            this.nextChunkOrderRun = 0;
        } else if (distance > 128) {
            invalidMotion = true;
            getServer().getLogger().warning(String.format("%s moved too far (%.2f)", this.getName(), distance));
        }

        if (invalidMotion) {
            this.revertClientMotion(revertPos);
            return;
        }
// more code...

@Mcayear Mcayear changed the title 服务器权威移动误判 Server-Authoritative Movement causes incorrect player movement rollback. Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants