mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-04 15:41:40 +00:00
50 lines
3.9 KiB
Diff
50 lines
3.9 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
|
|
|
|
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 7e656b426aafc2581e13e8a1ae9e304530f3d05b..465e34eb906ec78f49ff1183b635e77a1fcaa758 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));
|
|
}
|
|
@@ -1450,7 +1450,7 @@ public class ServerGamePacketListenerImpl
|
|
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());
|
|
@@ -1516,7 +1516,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()
|