Make max interaction range configurable (#11164)
The server validates incoming interaction packets by ensuring the player sending them is inside their interaction range. For this, the server adds a magic value, by default 1.0, to the original interaction range to account for latency issues. This value however may be too low in high latency environments. The patch exposes a new configuration option to configure said value.
This commit is contained in:
parent
e1462a9253
commit
645a677122
5 changed files with 42 additions and 12 deletions
|
@ -487,15 +487,16 @@ index 0000000000000000000000000000000000000000..d9502ba028a96f9cc846f9ed428bd806
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e8694dbb348e23efbe00df9b333b9dc012367aa2
|
||||
index 0000000000000000000000000000000000000000..e727414d784debd276dcc42aabf588d6fcbccc91
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -0,0 +1,320 @@
|
||||
@@ -0,0 +1,323 @@
|
||||
+package io.papermc.paper.configuration;
|
||||
+
|
||||
+import co.aikar.timings.MinecraftTimings;
|
||||
+import com.mojang.logging.LogUtils;
|
||||
+import io.papermc.paper.configuration.constraint.Constraints;
|
||||
+import io.papermc.paper.configuration.type.number.DoubleOr;
|
||||
+import io.papermc.paper.configuration.type.number.IntOr;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||
|
@ -800,6 +801,8 @@ index 0000000000000000000000000000000000000000..e8694dbb348e23efbe00df9b333b9dc0
|
|||
+ public boolean useDimensionTypeForCustomSpawners = false;
|
||||
+ public boolean strictAdvancementDimensionCheck = false;
|
||||
+ public IntOr.Default compressionLevel = IntOr.Default.USE_DEFAULT;
|
||||
+ @Comment("Defines the leniency distance added on the server to the interaction range of a player when validating interact packets.")
|
||||
+ public DoubleOr.Default clientInteractionLeniencyDistance = DoubleOr.Default.USE_DEFAULT;
|
||||
+ }
|
||||
+
|
||||
+ public BlockUpdates blockUpdates;
|
||||
|
@ -851,10 +854,10 @@ index 0000000000000000000000000000000000000000..69add4a7f1147015806bc9b63a8340d1
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..83a726bcf8b7dce73a361b0d79dbd63a0afc7a12
|
||||
index 0000000000000000000000000000000000000000..783eac6e458c6f1a0584301fb84a2fe341868f34
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
@@ -0,0 +1,465 @@
|
||||
@@ -0,0 +1,466 @@
|
||||
+package io.papermc.paper.configuration;
|
||||
+
|
||||
+import com.google.common.base.Suppliers;
|
||||
|
@ -1050,6 +1053,7 @@ index 0000000000000000000000000000000000000000..83a726bcf8b7dce73a361b0d79dbd63a
|
|||
+ .serializers(builder -> builder
|
||||
+ .register(new PacketClassSerializer())
|
||||
+ .register(IntOr.Default.SERIALIZER)
|
||||
+ .register(DoubleOr.Default.SERIALIZER)
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
|
|
|
@ -22,10 +22,10 @@ is actually processed, this is honestly really just exposed for the misnomers or
|
|||
who just wanna ensure that this won't grow over a specific size if chat gets stupidly active
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
index e8694dbb348e23efbe00df9b333b9dc012367aa2..5a101cb6dc7f266ddc20688121ebe2403e9145f1 100644
|
||||
index e727414d784debd276dcc42aabf588d6fcbccc91..b2031483a327e22116e2584b278c3f0d59bf90a6 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -294,7 +294,18 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -295,7 +295,18 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
|
||||
@PostProcess
|
||||
private void postProcess() {
|
||||
|
|
|
@ -17,10 +17,10 @@ index d9502ba028a96f9cc846f9ed428bd8066b857ca3..87e5f614ba988547a827486740db217e
|
|||
node = loader.load();
|
||||
this.verifyGlobalConfigVersion(node);
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
index 701196635f9c08d62d785fa1b448313937259c76..5160dc617cc5037cd3f10479454159f2a9984169 100644
|
||||
index b2031483a327e22116e2584b278c3f0d59bf90a6..9db431ddb43e94d5e8dc3875d8d9c6fa5a05bbea 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -25,6 +25,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -26,6 +26,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
static final int CURRENT_VERSION = 29; // (when you change the version, change the comment, so it conflicts on rebases): <insert changes here>
|
||||
private static GlobalConfiguration instance;
|
||||
|
|
|
@ -22226,10 +22226,10 @@ index 0000000000000000000000000000000000000000..85950a1aa732ab8c01ad28bec9e0de14
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
index 8a05be0d203404e8d06d9a80de2e35e473f7f936..d20969e18984c9b93483477f31b079686977b1db 100644
|
||||
index 9db431ddb43e94d5e8dc3875d8d9c6fa5a05bbea..214ea75502d4abf9ebbc99a3811e4d2f8465227e 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -29,6 +29,45 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -30,6 +30,45 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
public static GlobalConfiguration get() {
|
||||
return instance;
|
||||
}
|
||||
|
@ -22275,7 +22275,7 @@ index 8a05be0d203404e8d06d9a80de2e35e473f7f936..d20969e18984c9b93483477f31b07968
|
|||
static void set(GlobalConfiguration instance) {
|
||||
GlobalConfiguration.instance = instance;
|
||||
}
|
||||
@@ -137,21 +176,6 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -138,21 +177,6 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
public int incomingPacketThreshold = 300;
|
||||
}
|
||||
|
||||
|
@ -22297,7 +22297,7 @@ index 8a05be0d203404e8d06d9a80de2e35e473f7f936..d20969e18984c9b93483477f31b07968
|
|||
public UnsupportedSettings unsupportedSettings;
|
||||
|
||||
public class UnsupportedSettings extends ConfigurationPart {
|
||||
@@ -210,7 +234,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -211,7 +235,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
|
||||
@PostProcess
|
||||
private void postProcess() {
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Newwind <support@newwindserver.com>
|
||||
Date: Thu, 25 Jul 2024 13:00:37 +0200
|
||||
Subject: [PATCH] Make interaction leniency distance configurable
|
||||
|
||||
The server validates incoming interaction packets by ensuring the player
|
||||
sending them is inside their interaction range. For this, the server adds
|
||||
a magic value, by default 1.0, to the original interaction range to
|
||||
account for latency issues.
|
||||
|
||||
This value however may be too low in high latency environments.
|
||||
The patch exposes a new configuration option to configure said value.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 7796e191747be545e744564a2b0b65790f69114d..624b80c796e9c95040d71d1595d11f98e2899cf3 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2703,7 +2703,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
|
||||
AABB axisalignedbb = entity.getBoundingBox();
|
||||
|
||||
- if (this.player.canInteractWithEntity(axisalignedbb, 1.0D)) {
|
||||
+ if (this.player.canInteractWithEntity(axisalignedbb, io.papermc.paper.configuration.GlobalConfiguration.get().misc.clientInteractionLeniencyDistance.or(1.0D))) { // Paper - configurable lenience value for interact range
|
||||
packet.dispatch(new ServerboundInteractPacket.Handler() {
|
||||
private void performInteraction(InteractionHand enumhand, ServerGamePacketListenerImpl.EntityInteraction playerconnection_a, PlayerInteractEntityEvent event) { // CraftBukkit
|
||||
ItemStack itemstack = ServerGamePacketListenerImpl.this.player.getItemInHand(enumhand);
|
Loading…
Reference in a new issue