Skip to content

Commit

Permalink
Configurable move warning
Browse files Browse the repository at this point in the history
  • Loading branch information
HaHaWTH committed Apr 12, 2024
1 parent fd27f40 commit 865d1a7
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion patches/api/0024-friendly-missing-dependency-error.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] friendly-missing-dependency-error


diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 081b57231ca88e48a49dd808677de6e4bb1880b4..019842fd93ef76c8a7b1ac6de9a3a79517d0b92b 100644
index 081b57231ca88e48a49dd808677de6e4bb1880b4..263ac8763609f4537125bd1eebd13cefaa315335 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -214,8 +214,7 @@ public final class SimplePluginManager implements PluginManager {
Expand Down
46 changes: 46 additions & 0 deletions patches/server/0167-configurable-movement-warnings.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: HaHaWTH <[email protected]>
Date: Fri, 12 Apr 2024 17:26:20 +0800
Subject: [PATCH] configurable-movement-warnings


diff --git a/src/main/java/com/homomc/beast/BeastConfig.java b/src/main/java/com/homomc/beast/BeastConfig.java
index 85e777c8dd89e99abe55aa4785546f4e6aec565b..52807051abe14e33e07b2cfcf0426927d4f798e7 100644
--- a/src/main/java/com/homomc/beast/BeastConfig.java
+++ b/src/main/java/com/homomc/beast/BeastConfig.java
@@ -197,9 +197,12 @@ public class BeastConfig {
}

public static boolean emptyMessageWarning;
-
+ public static boolean movedWronglyWarning;
+ public static boolean movedTooQuicklyWarning;
private static void logMessages() {
emptyMessageWarning = getBoolean("log.empty-messages-warning", false);
+ movedWronglyWarning = getBoolean("log.moved-wrongly-warning", true);
+ movedTooQuicklyWarning = getBoolean("log.moved-too-quickly-warning", true);
}

public static boolean pauseServerWhenEmpty;
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 92ae80f58bbfd58750bfec2f41789cf4d9a1de65..08d307724983d2c9e7923c773482109f7ff371ab 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -609,7 +609,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {

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
// CraftBukkit end
- PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName(), Double.valueOf(d7), Double.valueOf(d8), Double.valueOf(d9));
+ if (com.homomc.beast.BeastConfig.movedTooQuicklyWarning) PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName(), Double.valueOf(d7), Double.valueOf(d8), Double.valueOf(d9));
this.a(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch);
return;
}
@@ -670,7 +670,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {

if (!this.player.L() && d11 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative() && this.player.playerInteractManager.getGameMode() != EnumGamemode.SPECTATOR) { // Spigot
flag1 = true;
- PlayerConnection.LOGGER.warn("{} moved wrongly!", this.player.getName());
+ if (com.homomc.beast.BeastConfig.movedWronglyWarning) PlayerConnection.LOGGER.warn("{} moved wrongly!", this.player.getName());
}

this.player.setLocation(d4, d5, d6, f, f1);

0 comments on commit 865d1a7

Please sign in to comment.