|
| 1 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | +From: HaHaWTH <id_cn00@outlook.com> |
| 3 | +Date: Fri, 12 Apr 2024 17:26:20 +0800 |
| 4 | +Subject: [PATCH] configurable-movement-warnings |
| 5 | + |
| 6 | + |
| 7 | +diff --git a/src/main/java/com/homomc/beast/BeastConfig.java b/src/main/java/com/homomc/beast/BeastConfig.java |
| 8 | +index 85e777c8dd89e99abe55aa4785546f4e6aec565b..52807051abe14e33e07b2cfcf0426927d4f798e7 100644 |
| 9 | +--- a/src/main/java/com/homomc/beast/BeastConfig.java |
| 10 | ++++ b/src/main/java/com/homomc/beast/BeastConfig.java |
| 11 | +@@ -197,9 +197,12 @@ public class BeastConfig { |
| 12 | + } |
| 13 | + |
| 14 | + public static boolean emptyMessageWarning; |
| 15 | +- |
| 16 | ++ public static boolean movedWronglyWarning; |
| 17 | ++ public static boolean movedTooQuicklyWarning; |
| 18 | + private static void logMessages() { |
| 19 | + emptyMessageWarning = getBoolean("log.empty-messages-warning", false); |
| 20 | ++ movedWronglyWarning = getBoolean("log.moved-wrongly-warning", true); |
| 21 | ++ movedTooQuicklyWarning = getBoolean("log.moved-too-quickly-warning", true); |
| 22 | + } |
| 23 | + |
| 24 | + public static boolean pauseServerWhenEmpty; |
| 25 | +diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java |
| 26 | +index 92ae80f58bbfd58750bfec2f41789cf4d9a1de65..08d307724983d2c9e7923c773482109f7ff371ab 100644 |
| 27 | +--- a/src/main/java/net/minecraft/server/PlayerConnection.java |
| 28 | ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java |
| 29 | +@@ -609,7 +609,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { |
| 30 | + |
| 31 | + if (d11 - d10 > Math.max(f2, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) /*&& (!this.minecraftServer.R() || !this.minecraftServer.Q().equals(this.player.getName()))*/) { // Spigot // Beast - Remove singleplayer code |
| 32 | + // CraftBukkit end |
| 33 | +- PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName(), Double.valueOf(d7), Double.valueOf(d8), Double.valueOf(d9)); |
| 34 | ++ if (com.homomc.beast.BeastConfig.movedTooQuicklyWarning) PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName(), Double.valueOf(d7), Double.valueOf(d8), Double.valueOf(d9)); |
| 35 | + this.a(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch); |
| 36 | + return; |
| 37 | + } |
| 38 | +@@ -670,7 +670,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { |
| 39 | + |
| 40 | + if (!this.player.L() && d11 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative() && this.player.playerInteractManager.getGameMode() != EnumGamemode.SPECTATOR) { // Spigot |
| 41 | + flag1 = true; |
| 42 | +- PlayerConnection.LOGGER.warn("{} moved wrongly!", this.player.getName()); |
| 43 | ++ if (com.homomc.beast.BeastConfig.movedWronglyWarning) PlayerConnection.LOGGER.warn("{} moved wrongly!", this.player.getName()); |
| 44 | + } |
| 45 | + |
| 46 | + this.player.setLocation(d4, d5, d6, f, f1); |
0 commit comments