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

服务器权威移动误判 #263

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

服务器权威移动误判 #263

Mcayear opened this issue May 11, 2024 · 3 comments

Comments

@Mcayear
Copy link
Contributor

Mcayear commented May 11, 2024

🐞 Bug Feedback | BUG反馈

📝 Bug Description | BUG描述

开启创造模式,快速的飞行。

服务器会出现此类警告:
image

且 server.properties 配置中的 server-authoritative-movement 项没有实际应用。

即便从 server-auth 更改为 client-auth 也无法关闭拉回。

@Mcayear
Copy link
Contributor Author

Mcayear commented May 11, 2024

补充视频信息:

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...

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