Couple config fixes (#7975)

This commit is contained in:
Jake Potrebic 2022-06-13 15:29:44 -07:00 committed by GitHub
parent 8bae82db21
commit 3d37b42a89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -416,7 +416,7 @@ index 0000000000000000000000000000000000000000..13d7d1c24ec9192d0163f6eedeac8fca
+}
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..5a808a09291da691cbee75a55f6aa1b70ac9f018
index 0000000000000000000000000000000000000000..3e7086d31b2f101b2d6e982f3935922886cadc77
--- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -0,0 +1,264 @@
@ -631,7 +631,7 @@ index 0000000000000000000000000000000000000000..5a808a09291da691cbee75a55f6aa1b7
+ public Map<Class<? extends Packet<?>>, PacketLimit> overrides = Map.of(ServerboundPlaceRecipePacket.class, new PacketLimit(4.0, 5.0, PacketLimit.ViolateAction.DROP));
+
+ @ConfigSerializable
+ public record PacketLimit(@Constraint(Constraints.Positive.class) @Required double interval, @Constraint(Constraints.Positive.class) @Required double maxPacketRate, ViolateAction action) {
+ public record PacketLimit(@Required double interval, @Required double maxPacketRate, ViolateAction action) {
+ public PacketLimit(final double interval, final double maxPacketRate, final @Nullable ViolateAction action) {
+ this.interval = interval;
+ this.maxPacketRate = maxPacketRate;
@ -1308,10 +1308,10 @@ index 0000000000000000000000000000000000000000..518a00886f7bde1de95150366541fc99
+}
diff --git a/src/main/java/io/papermc/paper/configuration/RemovedConfigurations.java b/src/main/java/io/papermc/paper/configuration/RemovedConfigurations.java
new file mode 100644
index 0000000000000000000000000000000000000000..d69d203eea014fc9fb40a556f0771dba15fcd2ea
index 0000000000000000000000000000000000000000..1bb16fc7598cd53e822d84b69d6a9727b37f484f
--- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/RemovedConfigurations.java
@@ -0,0 +1,61 @@
@@ -0,0 +1,63 @@
+package io.papermc.paper.configuration;
+
+import org.spongepowered.configurate.NodePath;
@ -1354,6 +1354,8 @@ index 0000000000000000000000000000000000000000..d69d203eea014fc9fb40a556f0771dba
+ path("use-hopper-check"),
+ path("use-async-lighting"),
+ path("tnt-explosion-volume"),
+ path("entities", "spawning", "despawn-ranges", "soft"),
+ path("entities", "spawning", "despawn-ranges", "hard")
+ };
+
+ NodePath[] REMOVED_GLOBAL_PATHS = {
@ -4236,7 +4238,7 @@ index a96cb7a5f7c94cd9a46b31cf8ec90b544221557b..7c35d86eac0d69ba4be48faf364fd6dc
for ( Method method : clazz.getDeclaredMethods() )
{
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index a04da0a7d690fe3fcf10810b4e8c92a8ae027b86..feef74e3a6d50344245c4a61ece5b2194af1072f 100644
index bd0bf398f900302187f3436119c754592d575416..d139cbcf0b159372f229bef6ae49b45a74c163ad 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -58,8 +58,14 @@ public class SpigotWorldConfig

View File

@ -24,7 +24,7 @@ and an action can be defined: DROP or KICK
If interval or rate are less-than 0, the limit is ignored
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 05a15b2da76a6d246b705e682b61a7c40c5dade7..8c6e2aa1a5e98456684f74d677ac0af24aa90246 100644
index 05a15b2da76a6d246b705e682b61a7c40c5dade7..1d98e328982255b6dab8e24223c97eaea2612a45 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -135,6 +135,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -73,7 +73,7 @@ index 05a15b2da76a6d246b705e682b61a7c40c5dade7..8c6e2aa1a5e98456684f74d677ac0af2
+ for (Class<?> check = packet.getClass(); check != Object.class; check = check.getSuperclass()) {
+ io.papermc.paper.configuration.GlobalConfiguration.PacketLimiter.PacketLimit packetSpecificLimit =
+ io.papermc.paper.configuration.GlobalConfiguration.get().packetLimiter.overrides.get(check);
+ if (packetSpecificLimit == null) {
+ if (packetSpecificLimit == null || !packetSpecificLimit.isEnabled()) {
+ continue;
+ }
+ io.papermc.paper.util.IntervalledCounter counter = this.packetSpecificLimits.computeIfAbsent((Class)check, (clazz) -> {