mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-15 14:13:56 +01:00
compression level change with config option (#9711)
This commit is contained in:
parent
f4883a8c07
commit
9466e0d55a
2 changed files with 7 additions and 2 deletions
|
@ -449,6 +449,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+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..00000000000000000000000000000000
|
|||
+ public boolean useAlternativeLuckFormula = false;
|
||||
+ public boolean useDimensionTypeForCustomSpawners = false;
|
||||
+ public boolean strictAdvancementDimensionCheck = false;
|
||||
+ public IntOr.Default compressionLevel = IntOr.Default.USE_DEFAULT;
|
||||
+ }
|
||||
+
|
||||
+ public BlockUpdates blockUpdates;
|
||||
|
@ -1129,7 +1131,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ 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
|
||||
|
|
|
@ -308,7 +308,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
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 {
|
||||
|
|
Loading…
Reference in a new issue