mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
82 lines
6.0 KiB
Diff
82 lines
6.0 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/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index 479fe0a14736a2eec61a7d50b7afbacc548c06e2..1acac1e6288e67db00599f98fbdf8ba12702c11a 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -589,7 +589,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
}
|
|
// Paper end - Prevent moving into unloaded chunks
|
|
|
|
- if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
|
|
+ if (!org.dreeam.leaf.config.modules.gameplay.DisableMovedWronglyThreshold.enabled && d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { // Leaves - disable can
|
|
// CraftBukkit end
|
|
ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8});
|
|
this.send(new ClientboundMoveVehiclePacket(entity));
|
|
@@ -625,7 +625,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
d10 = d6 * d6 + d7 * d7 + d8 * d8;
|
|
boolean flag2 = false;
|
|
|
|
- if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot
|
|
+ if (!org.dreeam.leaf.config.modules.gameplay.DisableMovedWronglyThreshold.enabled && d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot // Leaves - disable can
|
|
flag2 = true; // Paper - diff on change, this should be moved wrongly
|
|
ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", new Object[]{entity.getName().getString(), this.player.getName().getString(), Math.sqrt(d10)});
|
|
}
|
|
@@ -1486,7 +1486,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
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 (!org.dreeam.leaf.config.modules.gameplay.DisableMovedWronglyThreshold.enabled && event.getLogWarning()) // Leaves - disable can
|
|
ServerGamePacketListenerImpl.LOGGER.warn("{} moved too quickly! {},{},{}", new Object[]{this.player.getName().getString(), d6, d7, d8});
|
|
this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot());
|
|
return;
|
|
@@ -1556,7 +1556,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
d10 = d6 * d6 + d7 * d7 + d8 * d8;
|
|
boolean movedWrongly = false; // Paper - Add fail move event; rename
|
|
|
|
- if (!this.player.isChangingDimension() && d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot
|
|
+ if (!org.dreeam.leaf.config.modules.gameplay.DisableMovedWronglyThreshold.enabled && !this.player.isChangingDimension() && d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot // Leaves - disable can
|
|
// Paper start - Add fail move event
|
|
io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.MOVED_WRONGLY,
|
|
toX, toY, toZ, toYaw, toPitch, true);
|
|
diff --git a/src/main/java/org/dreeam/leaf/config/modules/gameplay/DisableMovedWronglyThreshold.java b/src/main/java/org/dreeam/leaf/config/modules/gameplay/DisableMovedWronglyThreshold.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..c5afec3c21be35cb69905069a82acfc208a80e92
|
|
--- /dev/null
|
|
+++ b/src/main/java/org/dreeam/leaf/config/modules/gameplay/DisableMovedWronglyThreshold.java
|
|
@@ -0,0 +1,27 @@
|
|
+package org.dreeam.leaf.config.modules.gameplay;
|
|
+
|
|
+import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
|
+import org.dreeam.leaf.config.ConfigInfo;
|
|
+import org.dreeam.leaf.config.EnumConfigCategory;
|
|
+import org.dreeam.leaf.config.IConfigModule;
|
|
+
|
|
+public class DisableMovedWronglyThreshold implements IConfigModule {
|
|
+
|
|
+ @Override
|
|
+ public EnumConfigCategory getCategory() {
|
|
+ return EnumConfigCategory.GAMEPLAY;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public String getBaseName() {
|
|
+ return "disable_moved_wrongly_threshold";
|
|
+ }
|
|
+
|
|
+ @ConfigInfo(baseName = "enabled")
|
|
+ public static boolean enabled = false;
|
|
+
|
|
+ @Override
|
|
+ public void onLoaded(CommentedFileConfig config) {
|
|
+ config.setComment("gameplay.disable_moved_wrongly_threshold", "Disable moved quickly/wrongly checks");
|
|
+ }
|
|
+}
|