9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-19 14:59:25 +00:00
Files
DivineMC/patches/server/0047-Option-to-disable-moved-wrongly-threshold.patch
2024-11-02 16:43:01 +03:00

65 lines
6.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Sat, 13 Jul 2024 01:44:48 +0300
Subject: [PATCH] Option to disable moved wrongly threshold
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 9aabf8d4a333f96f1431da12cd42766a6d1676bd..d6f414bb93e9ca939fd7278cf4eaabf6fffaec2e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -590,7 +590,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 (!space.bxteam.divinemc.configuration.DivineConfig.disableMovedWronglyThreshold && d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { // DivineMC - Option to disable moved wrongly threshold
// 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));
@@ -626,8 +626,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
d10 = d6 * d6 + d7 * d7 + d8 * d8;
boolean flag2 = false;
- if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot
- flag2 = true; // Paper - diff on change, this should be moved wrongly
+ if (!space.bxteam.divinemc.configuration.DivineConfig.disableMovedWronglyThreshold && d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot // DivineMC - Option to disable moved wrongly threshold
+ 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)});
}
@@ -1482,7 +1482,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 (!space.bxteam.divinemc.configuration.DivineConfig.disableMovedWronglyThreshold && event.getLogWarning()) // DivineMC - Option to disable moved wrongly threshold
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;
@@ -1552,7 +1552,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 (!space.bxteam.divinemc.configuration.DivineConfig.disableMovedWronglyThreshold && !this.player.isChangingDimension() && d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot // DivineMC - Option to disable moved wrongly threshold
// 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/space/bxteam/divinemc/configuration/DivineConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
index f8f84e2856703a78217d0d9572955f33ac0d7776..77c6b40f0d5aa97a1fb71e5704c719f4ee34ba8e 100644
--- a/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
@@ -155,9 +155,11 @@ public class DivineConfig {
public static boolean disableNonEditableSignWarning = true;
public static boolean removeVanillaUsernameCheck = false;
+ public static boolean disableMovedWronglyThreshold = false;
private static void miscSettings() {
disableNonEditableSignWarning = getBoolean("settings.misc.disable-non-editable-sign-warning", disableNonEditableSignWarning);
removeVanillaUsernameCheck = getBoolean("settings.misc.remove-vanilla-username-check", removeVanillaUsernameCheck);
+ disableMovedWronglyThreshold = getBoolean("settings.misc.disable-moved-wrongly-threshold", disableMovedWronglyThreshold);
}
public static boolean biomeManagerOptimization = true;