3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 19:10:09 +01:00

compression level change with config option (#9711)

Dieser Commit ist enthalten in:
leguan 2023-09-14 13:11:19 +02:00 committet von GitHub
Ursprung 6378792a99
Commit 7145f41b6e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
4 geänderte Dateien mit 17 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -440,15 +440,16 @@ index 0000000000000000000000000000000000000000..9ef6712c70fcd8912a79f3f61e351aac
+}
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..45f1436cdd4b81b621ab71e4336c2aa666572105
index 0000000000000000000000000000000000000000..4b3bb5fad1d80c9baea20ca224663b1ebc2b83e9
--- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -0,0 +1,292 @@
@@ -0,0 +1,294 @@
+package io.papermc.paper.configuration;
+
+import co.aikar.timings.MinecraftTimings;
+import io.papermc.paper.configuration.constraint.Constraint;
+import io.papermc.paper.configuration.constraint.Constraints;
+import io.papermc.paper.configuration.type.IntOr;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.minecraft.network.protocol.Packet;
@ -725,6 +726,7 @@ index 0000000000000000000000000000000000000000..45f1436cdd4b81b621ab71e4336c2aa6
+ public boolean useAlternativeLuckFormula = false;
+ public boolean useDimensionTypeForCustomSpawners = false;
+ public boolean strictAdvancementDimensionCheck = false;
+ public IntOr.Default compressionLevel = IntOr.Default.USE_DEFAULT;
+ }
+
+ public BlockUpdates blockUpdates;
@ -949,10 +951,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..e471960e0443392f6f54732b052a4debf2a8fd97
index 0000000000000000000000000000000000000000..2d3068b7748032342edd81e6ea4a7c08988fb28d
--- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
@@ -0,0 +1,442 @@
@@ -0,0 +1,445 @@
+package io.papermc.paper.configuration;
+
+import com.google.common.base.Suppliers;
@ -1129,7 +1131,10 @@ index 0000000000000000000000000000000000000000..e471960e0443392f6f54732b052a4deb
+ private static ConfigurationOptions defaultGlobalOptions(ConfigurationOptions options) {
+ return options
+ .header(GLOBAL_HEADER)
+ .serializers(builder -> builder.register(new PacketClassSerializer()));
+ .serializers(builder -> builder
+ .register(new PacketClassSerializer())
+ .register(IntOr.Default.SERIALIZER)
+ );
+ }
+
+ @Override

Datei anzeigen

@ -15704,10 +15704,10 @@ index 0000000000000000000000000000000000000000..962d3cae6340fc11607b59355e291629
+
+}
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 45f1436cdd4b81b621ab71e4336c2aa666572105..622684f50a12ddd412e2d6ff305407e7c13684bf 100644
index 4b3bb5fad1d80c9baea20ca224663b1ebc2b83e9..3a5abb89d3742a6f38799c183a098947686e16ab 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -24,6 +24,45 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -25,6 +25,45 @@ public class GlobalConfiguration extends ConfigurationPart {
public static GlobalConfiguration get() {
return instance;
}
@ -15753,7 +15753,7 @@ index 45f1436cdd4b81b621ab71e4336c2aa666572105..622684f50a12ddd412e2d6ff305407e7
static void set(GlobalConfiguration instance) {
GlobalConfiguration.instance = instance;
}
@@ -116,21 +155,6 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -117,21 +156,6 @@ public class GlobalConfiguration extends ConfigurationPart {
public int incomingPacketThreshold = 300;
}

Datei anzeigen

@ -268,7 +268,7 @@ index 792883afe53d2b7989c25a81c2f9a639d5e21d20..c04379ca8a4db0f4de46ad2b3b338431
return this.threshold;
}
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 15798ed13488b8b8b16ebee557dce18e3dc51708..cf20f0983fc25b26cf92b9d3a28746b1909fc56b 100644
index 15798ed13488b8b8b16ebee557dce18e3dc51708..52cb6476604c98465f81ff9e8d8344d7536a8868 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -727,11 +727,28 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -308,7 +308,7 @@ index 15798ed13488b8b8b16ebee557dce18e3dc51708..cf20f0983fc25b26cf92b9d3a28746b1
public void setupCompression(int compressionThreshold, boolean rejectsBadPackets) {
if (compressionThreshold >= 0) {
+ com.velocitypowered.natives.compression.VelocityCompressor compressor = com.velocitypowered.natives.util.Natives.compress.get().create(-1); // Paper
+ com.velocitypowered.natives.compression.VelocityCompressor compressor = com.velocitypowered.natives.util.Natives.compress.get().create(io.papermc.paper.configuration.GlobalConfiguration.get().misc.compressionLevel.or(-1)); // Paper
if (this.channel.pipeline().get("decompress") instanceof CompressionDecoder) {
((CompressionDecoder) this.channel.pipeline().get("decompress")).setThreshold(compressionThreshold, rejectsBadPackets);
} else {

Datei anzeigen

@ -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 622684f50a12ddd412e2d6ff305407e7c13684bf..019d3bbd78fb0b06861979d223915fedb6c99442 100644
index 3a5abb89d3742a6f38799c183a098947686e16ab..3bc7230ca62ebe3426da293e436a962bb0134f85 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -285,13 +285,26 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -286,13 +286,26 @@ public class GlobalConfiguration extends ConfigurationPart {
public Misc misc;
public class Misc extends ConfigurationPart {