mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
60 lines
4.7 KiB
Diff
60 lines
4.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
|
Date: Thu, 28 Sep 2023 20:30:46 +0800
|
|
Subject: [PATCH] Leaves: Disable moved wrongly threshold
|
|
|
|
Removed since MC 1.21.4, Mojang added it as gamerule,
|
|
use `/gamerule disablePlayerMovementCheck` instead
|
|
|
|
Original license: GPLv3
|
|
Original project: https://github.com/LeavesMC/Leaves
|
|
|
|
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index 95768fcb1f0b480910a1ba4a3dc321b27e5b3782..60385c699c305112ac0bc3f26927e436043d9f72 100644
|
|
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -575,7 +575,7 @@ public class ServerGamePacketListenerImpl
|
|
return;
|
|
}
|
|
// Paper end - Prevent moving into unloaded chunks
|
|
- if (d7 - d6 > Math.max(100.0, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
|
|
+ if (!org.dreeam.leaf.config.modules.gameplay.DisableMovedWronglyThreshold.enabled && d7 - d6 > Math.max(100.0, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { // Leaves - disable can
|
|
// CraftBukkit end
|
|
LOGGER.warn(
|
|
"{} (vehicle of {}) moved too quickly! {},{},{}", rootVehicle.getName().getString(), this.player.getName().getString(), d3, d4, d5
|
|
@@ -605,7 +605,7 @@ public class ServerGamePacketListenerImpl
|
|
d5 = d2 - rootVehicle.getZ();
|
|
d7 = d3 * d3 + d4 * d4 + d5 * d5;
|
|
boolean flag2 = false;
|
|
- if (d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot
|
|
+ if (!org.dreeam.leaf.config.modules.gameplay.DisableMovedWronglyThreshold.enabled && d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot // Leaves - disable can
|
|
flag2 = true; // Paper - diff on change, this should be moved wrongly
|
|
LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", rootVehicle.getName().getString(), this.player.getName().getString(), Math.sqrt(d7));
|
|
}
|
|
@@ -1451,13 +1451,13 @@ public class ServerGamePacketListenerImpl
|
|
|
|
if (this.shouldCheckPlayerMovement(isFallFlying)) {
|
|
float f2 = isFallFlying ? 300.0F : 100.0F;
|
|
- if (d7 - d6 > Math.max(f2, Mth.square(org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed))) {
|
|
+ if (!org.dreeam.leaf.config.modules.gameplay.DisableMovedWronglyThreshold.enabled && d7 - d6 > Math.max(f2, Mth.square(org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed))) { // Leaves - disable can
|
|
// CraftBukkit end
|
|
// Paper start - Add fail move event
|
|
io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.MOVED_TOO_QUICKLY,
|
|
toX, toY, toZ, toYaw, toPitch, true);
|
|
if (!event.isAllowed()) {
|
|
- if (event.getLogWarning()) {
|
|
+ if (event.getLogWarning()) { // Leaves - disable can
|
|
LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName().getString(), d3, d4, d5);
|
|
}
|
|
this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot());
|
|
@@ -1523,7 +1523,8 @@ public class ServerGamePacketListenerImpl
|
|
d5 = d2 - this.player.getZ();
|
|
d7 = d3 * d3 + d4 * d4 + d5 * d5;
|
|
boolean movedWrongly = false; // Paper - Add fail move event; rename
|
|
- if (!this.player.isChangingDimension()
|
|
+ if (!org.dreeam.leaf.config.modules.gameplay.DisableMovedWronglyThreshold.enabled // Leaves - disable can
|
|
+ && !this.player.isChangingDimension()
|
|
&& d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold // Spigot
|
|
&& !this.player.isSleeping()
|
|
&& !this.player.gameMode.isCreative()
|