3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-07 08:40:09 +01:00

Add an option for setting Bedrock compression level (#2128)

Dieser Commit ist enthalten in:
Camotoy 2021-04-19 22:18:18 -04:00 committet von GitHub
Ursprung 852d5b050d
Commit bb41c0f9ee
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
4 geänderte Dateien mit 13 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -111,6 +111,8 @@ public interface GeyserConfiguration {
String getServerName();
int getCompressionLevel();
boolean isEnableProxyProtocol();
List<String> getProxyProtocolWhitelistedIPs();

Datei anzeigen

@ -147,6 +147,13 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
@JsonProperty("server-name")
private String serverName = GeyserConnector.NAME;
@JsonProperty("compression-level")
private int compressionLevel = 6;
public int getCompressionLevel() {
return Math.max(-1, Math.min(compressionLevel, 9));
}
@JsonProperty("enable-proxy-protocol")
private boolean enableProxyProtocol = false;

Datei anzeigen

@ -159,6 +159,7 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler {
@Override
public void onSessionCreation(BedrockServerSession bedrockServerSession) {
bedrockServerSession.setLogging(true);
bedrockServerSession.setCompressionLevel(connector.getConfig().getBedrock().getCompressionLevel());
bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(connector, new GeyserSession(connector, bedrockServerSession)));
// Set the packet codec to default just in case we need to send disconnect packets.
bedrockServerSession.setPacketCodec(BedrockProtocol.DEFAULT_BEDROCK_CODEC);

Datei anzeigen

@ -23,6 +23,9 @@ bedrock:
motd2: "Another Geyser server."
# The Server Name that will be sent to Minecraft: Bedrock Edition clients. This is visible in both the pause menu and the settings menu.
server-name: "Geyser"
# How much to compress network traffic to the Bedrock client. The higher the number, the more CPU usage used, but
# the smaller the bandwidth used. Does not have any effect below -1 or above 9. Set to -1 to disable.
compression-level: 6
# Whether to enable PROXY protocol or not for clients. You DO NOT WANT this feature unless you run UDP reverse proxy
# in front of your Geyser instance.
enable-proxy-protocol: false