9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00

Add configurable max-UseItem-disance & the warning of NoCom Exploit in config

This commit is contained in:
Dreeam
2023-03-02 00:27:30 -05:00
parent 1f0c2510df
commit ca317277ba
16 changed files with 45 additions and 43 deletions

View File

@@ -7,7 +7,7 @@ This Check is added in 1.17.x -> 1.18.x update by Mojang.
By removing this check, it enable hackers to use some modules of hack clients.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8fd2a0a9f3990742c17d471b143c672163eb76aa..7b1368372b6c167638da18b16803d81cc38e238e 100644
index 8fd2a0a9f3990742c17d471b143c672163eb76aa..4ff68ff8b4e442a6b6a132eefedd88870006052d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -188,6 +188,7 @@ import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions;
@@ -23,27 +23,29 @@ index 8fd2a0a9f3990742c17d471b143c672163eb76aa..7b1368372b6c167638da18b16803d81c
double d0 = 1.0000001D;
- if (Math.abs(vec3d2.x()) < 1.0000001D && Math.abs(vec3d2.y()) < 1.0000001D && Math.abs(vec3d2.z()) < 1.0000001D) {
+ if ((Math.abs(vec3d2.x()) < 1.0000001D && Math.abs(vec3d2.y()) < 1.0000001D && Math.abs(vec3d2.z()) < 1.0000001D) || LeafConfig.removeUseItemOnPacketTooFar) { // Leaf - Remove UseItemOnPacket Too Far Check
+ if ((Math.abs(vec3d2.x()) < LeafConfig.maxUseItemDistance && Math.abs(vec3d2.y()) < LeafConfig.maxUseItemDistance && Math.abs(vec3d2.z()) < LeafConfig.maxUseItemDistance) || LeafConfig.removeUseItemOnPacketTooFar) { // Leaf - Remove UseItemOnPacket Too Far Check and make it configurable
Direction enumdirection = movingobjectpositionblock.getDirection();
this.player.resetLastActionTime();
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 20ea046501763954eb97045d33101e6b043bc84d..d1e7e1163db58feb4e0ab41115bd5f3d5c0d0e39 100644
index 20ea046501763954eb97045d33101e6b043bc84d..344b1a599dab2de022dee0ed26006e7eb7c5c70c 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -139,6 +139,7 @@ public class LeafConfig {
@@ -139,6 +139,8 @@ public class LeafConfig {
public static boolean removeMojangUsernameCheck = true;
public static boolean removeSpigotCheckBungeeConfig = true;
+ public static boolean removeUseItemOnPacketTooFar = false;
+ public static double maxUseItemDistance = 1.0000001D;
private static void removeConfig() {
removeMojangUsernameCheck = getBoolean("remove-Mojang-username-check", removeMojangUsernameCheck,
"Remove username check of Mojang",
@@ -146,5 +147,7 @@ public class LeafConfig {
@@ -146,5 +148,8 @@ public class LeafConfig {
removeSpigotCheckBungeeConfig = getBoolean("remove-Spigot-check-bungee-config", removeSpigotCheckBungeeConfig,
"Enable player enter backend server through proxy",
"without backend server enabling its bungee mode");
+ removeUseItemOnPacketTooFar = getBoolean("remove-UseItemOnPacket-too-far-check", removeUseItemOnPacketTooFar,
+ "To enable this, players can use some packet modules with hack clients");
+ "To enable this, players can use some packet modules with hack clients and the NoCom Exploit!!");
+ maxUseItemDistance = getDouble("max-UseItem-distance", maxUseItemDistance, "The max distance of UseItem for players");
}
}

View File

@@ -182,7 +182,7 @@ index 6035af2cf08353b3d3801220d8116d8611a0cd37..7774ab6a2e553a40def4bb4dceea9e5f
final String commandName;
if (vanillaCommand.getRedirect() == null) {
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index d1e7e1163db58feb4e0ab41115bd5f3d5c0d0e39..d65f0188f824ab9e79e0557c3796aa0098d84d7a 100644
index 344b1a599dab2de022dee0ed26006e7eb7c5c70c..f8b3f9cca444ef457118edc57b3ff08b1ed1ac40 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -1,8 +1,10 @@
@@ -196,9 +196,9 @@ index d1e7e1163db58feb4e0ab41115bd5f3d5c0d0e39..d65f0188f824ab9e79e0557c3796aa00
import org.jetbrains.annotations.Nullable;
import org.simpleyaml.configuration.comments.CommentType;
import org.simpleyaml.configuration.file.YamlFile;
@@ -150,4 +152,30 @@ public class LeafConfig {
removeUseItemOnPacketTooFar = getBoolean("remove-UseItemOnPacket-too-far-check", removeUseItemOnPacketTooFar,
"To enable this, players can use some packet modules with hack clients");
@@ -152,4 +154,30 @@ public class LeafConfig {
"To enable this, players can use some packet modules with hack clients and the NoCom Exploit!!");
maxUseItemDistance = getDouble("max-UseItem-distance", maxUseItemDistance, "The max distance of UseItem for players");
}
+
+ public static String commandTPSBarOutput = "<green>Tpsbar toggled <onoff> for <target>";

View File

@@ -61,10 +61,10 @@ index 39a0bd651736c80cc558775d94794ee020c574a8..09667820e41ef9c4e3aef9e2c8d18eb6
// Purpur end
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index d65f0188f824ab9e79e0557c3796aa0098d84d7a..d0ef118ed2e934a3d8f9e4b0d93b2f68bfa28454 100644
index f8b3f9cca444ef457118edc57b3ff08b1ed1ac40..02272d03d84d1c5c9133d30eb1de58715130d259 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -164,6 +164,11 @@ public class LeafConfig {
@@ -166,6 +166,11 @@ public class LeafConfig {
public static String commandTPSBarTextColorMedium = "<gradient:#ffff55:#ffaa00><text></gradient>";
public static String commandTPSBarTextColorLow = "<gradient:#ff5555:#aa0000><text></gradient>";
public static int commandTPSBarTickInterval = 20;
@@ -76,7 +76,7 @@ index d65f0188f824ab9e79e0557c3796aa0098d84d7a..d0ef118ed2e934a3d8f9e4b0d93b2f68
private static void commandSettings() {
commandTPSBarOutput = getString("command.messages.tpsbar-command-output", commandTPSBarOutput);
@@ -177,5 +182,16 @@ public class LeafConfig {
@@ -179,5 +184,16 @@ public class LeafConfig {
commandTPSBarTextColorMedium = getString("command.tpsbar.text-color.medium", commandTPSBarTextColorMedium);
commandTPSBarTextColorLow = getString("command.tpsbar.text-color.low", commandTPSBarTextColorLow);
commandTPSBarTickInterval = getInt("command.tpsbar.tick-interval", commandTPSBarTickInterval);

View File

@@ -63,10 +63,10 @@ index 09667820e41ef9c4e3aef9e2c8d18eb6aa0bdc1e..05ef07550dae98170a71968673addf9b
// Purpur end
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index d0ef118ed2e934a3d8f9e4b0d93b2f68bfa28454..71f09693fd21908253fd56048be3668704192436 100644
index 02272d03d84d1c5c9133d30eb1de58715130d259..728edf151d248ed9a36cab42e88d68aa398f0569 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -169,6 +169,17 @@ public class LeafConfig {
@@ -171,6 +171,17 @@ public class LeafConfig {
public static BossBar.Color commandCompassBarProgressColor = BossBar.Color.BLUE;
public static float commandCompassBarProgressPercent = 1.0F;
public static int commandCompassBarTickInterval = 5;
@@ -84,7 +84,7 @@ index d0ef118ed2e934a3d8f9e4b0d93b2f68bfa28454..71f09693fd21908253fd56048be36687
private static void commandSettings() {
commandTPSBarOutput = getString("command.messages.tpsbar-command-output", commandTPSBarOutput);
@@ -188,6 +199,18 @@ public class LeafConfig {
@@ -190,6 +201,18 @@ public class LeafConfig {
commandCompassBarProgressColor = BossBar.Color.valueOf(getString("command.compass.progress-color", commandCompassBarProgressColor.name()));
commandCompassBarProgressPercent = (float) getDouble("command.compass.percent", commandCompassBarProgressPercent);
commandCompassBarTickInterval = getInt("command.compass.tick-interval", commandCompassBarTickInterval);

View File

@@ -42,11 +42,11 @@ index b4cb8cdacc822d9bf238fcc2029b21c28ea1753b..8e3d8b34816a4c097fa6a001aae6eaa2
+ // Purpur end
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 71f09693fd21908253fd56048be3668704192436..f74093bd3be900dec53cf927d31fb10dba169214 100644
index 728edf151d248ed9a36cab42e88d68aa398f0569..0d138136cd0b960c8d4e2f1416fae7c2ad81995d 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -153,6 +153,11 @@ public class LeafConfig {
"To enable this, players can use some packet modules with hack clients");
@@ -155,6 +155,11 @@ public class LeafConfig {
maxUseItemDistance = getDouble("max-UseItem-distance", maxUseItemDistance, "The max distance of UseItem for players");
}
+ public static double laggingThreshold = 19.0D;

View File

@@ -25,10 +25,10 @@ index fe25f51ee708c76bcf66e3280bb235713c99f79c..1f3f414ede558f590a5e68256a60d9ca
this.isReady = true;
JvmProfiler.INSTANCE.onServerTick(this.averageTickTime);
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index f74093bd3be900dec53cf927d31fb10dba169214..eaf4438f1d2b4f062f1ff0c591f90adb6e6bd95b 100644
index 0d138136cd0b960c8d4e2f1416fae7c2ad81995d..3e45e996642d8a7b0d1bbcb21993eb4942c577d2 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -154,8 +154,10 @@ public class LeafConfig {
@@ -156,8 +156,10 @@ public class LeafConfig {
}
public static double laggingThreshold = 19.0D;

View File

@@ -70,10 +70,10 @@ index 64206d94a5bf210116d208f9678618b905a61428..fbb06c5db6f80008a54563b7d959e55e
} else {
world.setBlockAndUpdate(pos, Blocks.WATER.defaultBlockState());
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index eaf4438f1d2b4f062f1ff0c591f90adb6e6bd95b..2c870c56752a7c67762684d581cfdb37f11e3ca9 100644
index 3e45e996642d8a7b0d1bbcb21993eb4942c577d2..8c9b0cde5640700c5e74d17fe621bf2180384b41 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -221,7 +221,9 @@ public class LeafConfig {
@@ -223,7 +223,9 @@ public class LeafConfig {
}
public static boolean compassItemShowsBossBar = false;

View File

@@ -46,10 +46,10 @@ index 7304b2659eb45bc4bc9fa7c43e6ca07221d0fc73..35a69bb50bc0575dd4f285cc9499d085
}
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 2c870c56752a7c67762684d581cfdb37f11e3ca9..328347af63b2b6cad67d3c5198bc0ec52daa9a31 100644
index 8c9b0cde5640700c5e74d17fe621bf2180384b41..61852eb1ed63cd809c9079762f2302464fada8c9 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -226,4 +226,11 @@ public class LeafConfig {
@@ -228,4 +228,11 @@ public class LeafConfig {
compassItemShowsBossBar = getBoolean("gameplay-mechanics.item.compass.holding-shows-bossbar", compassItemShowsBossBar);
allowWaterPlacementInTheEnd = getBoolean("gameplay-mechanics.allow-water-placement-in-the-end", allowWaterPlacementInTheEnd);
}

View File

@@ -38,10 +38,10 @@ index 744d91546d1a810f60a43c15ed74b4158f341a4a..460609a50d0f68c191f0fd529a7dc582
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 328347af63b2b6cad67d3c5198bc0ec52daa9a31..69bba6ea56e1c1dbb55fdbcb0686dae6685b2150 100644
index 61852eb1ed63cd809c9079762f2302464fada8c9..251f74d66af010ea13e02efa62c6f62d5b74fe2c 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -229,8 +229,10 @@ public class LeafConfig {
@@ -231,8 +231,10 @@ public class LeafConfig {
public static int spongeAbsorptionArea = 64;
public static int spongeAbsorptionRadius = 6;

View File

@@ -128,10 +128,10 @@ index ce197df36b3746dbd511287ecd78e46eaec3d5e0..b439a6033223269c94e988069c0df3ad
public void sendSystemMessage(Component message) {}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 69bba6ea56e1c1dbb55fdbcb0686dae6685b2150..0cdfab3476fb09ff19fa41dcac2fd27475c83258 100644
index 251f74d66af010ea13e02efa62c6f62d5b74fe2c..d0399e48385e5c69303d3a82b3c221e12d18160d 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -220,6 +220,13 @@ public class LeafConfig {
@@ -222,6 +222,13 @@ public class LeafConfig {
commandRamBarTickInterval = getInt("command.rambar.tick-interval", commandRamBarTickInterval);
}

View File

@@ -198,10 +198,10 @@ index 58986bc0677c5ea1ad54d7d6d4efa5c2ea233aea..59d616137088af46d4494171fe96ba01
+ // Purpur end
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 0cdfab3476fb09ff19fa41dcac2fd27475c83258..540be4932b006cdf9cabf804b49988f26a46b643 100644
index d0399e48385e5c69303d3a82b3c221e12d18160d..5743c5c1cb7fa9fc82fb66ca9efbe2b14ef33f4f 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -229,9 +229,11 @@ public class LeafConfig {
@@ -231,9 +231,11 @@ public class LeafConfig {
public static boolean compassItemShowsBossBar = false;
public static boolean allowWaterPlacementInTheEnd = true;

View File

@@ -110,10 +110,10 @@ index a1a8ac55e572156671e47317ba061855be79e5ac..ec3fb8865211bd7625103c37af7b96df
+ // Purpur end
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 540be4932b006cdf9cabf804b49988f26a46b643..d519349d27c4e405d1ce57b07d89e09bbf7969d1 100644
index 5743c5c1cb7fa9fc82fb66ca9efbe2b14ef33f4f..63e76e000e1056e5bf8ef2214e9dd8b4121af4e5 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -155,9 +155,13 @@ public class LeafConfig {
@@ -157,9 +157,13 @@ public class LeafConfig {
public static double laggingThreshold = 19.0D;
public static boolean tpsCatchup = true;

View File

@@ -7,7 +7,7 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 3bb09b3b53ac0f480fd451871f96631c35ecf3a9..42dc4679e33c5193f0ac1ec8673f0d16ecbf68ae 100644
index ed8c12a221c493657f8bdf3c1cb91b0dc2384699..1aaf511a1f69eae6a83e3d7d2cf4d3f03807728f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2405,7 +2405,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -20,10 +20,10 @@ index 3bb09b3b53ac0f480fd451871f96631c35ecf3a9..42dc4679e33c5193f0ac1ec8673f0d16
} while (!this.lastChatTimeStamp.compareAndSet(instant1, timestamp));
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index d519349d27c4e405d1ce57b07d89e09bbf7969d1..f167937d80b5b83673e60a4814fcee4570eeff32 100644
index 63e76e000e1056e5bf8ef2214e9dd8b4121af4e5..eba534697ad6a2e68947e97883a15ed8ba96622e 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -248,4 +248,9 @@ public class LeafConfig {
@@ -250,4 +250,9 @@ public class LeafConfig {
spongeAbsorptionRadius = getInt("blocks.sponge.absorption.radius", spongeAbsorptionRadius);
pistonBlockPushLimit = getInt("blocks.piston.block-push-limit", pistonBlockPushLimit);
}

View File

@@ -28,10 +28,10 @@ index 7b0374b6e22105e59b29995983a6ac50268c722e..da45ccd3b96158dace1dec4c291aa98f
} else {
ItemEntity.merge(other, itemstack1, this, itemstack);
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index f167937d80b5b83673e60a4814fcee4570eeff32..9f184ae7d61e4a082ceebeb9e6373ecc932e21f6 100644
index eba534697ad6a2e68947e97883a15ed8ba96622e..7fc53776dbe0c57b2639a52f117f33a7cc2f5471 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -157,11 +157,13 @@ public class LeafConfig {
@@ -159,11 +159,13 @@ public class LeafConfig {
public static boolean tpsCatchup = true;
public static boolean villagerLobotomizeEnabled = false;
public static int villagerLobotomizeCheckInterval = 100;

View File

@@ -487,10 +487,10 @@ index 731c7dd15f131dc124be6af8f342b122cb89491b..24a82111a5485da1e3903977d0519e9e
return i;
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 9f184ae7d61e4a082ceebeb9e6373ecc932e21f6..b598b941a86452b663c4997ca5c7b2781f821976 100644
index 7fc53776dbe0c57b2639a52f117f33a7cc2f5471..bec3455fda7da93af1991ce9fd946acfebd0e47e 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -158,12 +158,18 @@ public class LeafConfig {
@@ -160,12 +160,18 @@ public class LeafConfig {
public static boolean villagerLobotomizeEnabled = false;
public static int villagerLobotomizeCheckInterval = 100;
public static boolean useSpigotItemMergingMechanism = true;

View File

@@ -194,10 +194,10 @@ index 0000000000000000000000000000000000000000..bcacccd9d47697bea0405f2544be94fc
+
+}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index b598b941a86452b663c4997ca5c7b2781f821976..bdf5ada9efaf99ceae576e0f9be6e835cfcd74cc 100644
index bec3455fda7da93af1991ce9fd946acfebd0e47e..2513100442d342000908a47ad4b6d75d4fb62680 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -160,6 +160,7 @@ public class LeafConfig {
@@ -162,6 +162,7 @@ public class LeafConfig {
public static boolean useSpigotItemMergingMechanism = true;
public static boolean optimizedRound = true;
public static boolean optimizedHypot = true;
@@ -205,7 +205,7 @@ index b598b941a86452b663c4997ca5c7b2781f821976..bdf5ada9efaf99ceae576e0f9be6e835
private static void performance() {
laggingThreshold = getDouble("performance.lagging-threshold", laggingThreshold);
tpsCatchup = getBoolean("performance.tps-catchup", tpsCatchup);
@@ -170,6 +171,12 @@ public class LeafConfig {
@@ -172,6 +173,12 @@ public class LeafConfig {
"Whether or not Math.round should be replaced by a faster version.");
optimizedHypot = getBoolean("performance.optimize-math-hypot", optimizedHypot,
"Whether or not Math.hypot should be replaced by a faster version.");