mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Add an option for setting Bedrock compression level (#2128)
This commit is contained in:
parent
852d5b050d
commit
bb41c0f9ee
4 changed files with 13 additions and 0 deletions
|
@ -111,6 +111,8 @@ public interface GeyserConfiguration {
|
||||||
|
|
||||||
String getServerName();
|
String getServerName();
|
||||||
|
|
||||||
|
int getCompressionLevel();
|
||||||
|
|
||||||
boolean isEnableProxyProtocol();
|
boolean isEnableProxyProtocol();
|
||||||
|
|
||||||
List<String> getProxyProtocolWhitelistedIPs();
|
List<String> getProxyProtocolWhitelistedIPs();
|
||||||
|
|
|
@ -147,6 +147,13 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
|
||||||
@JsonProperty("server-name")
|
@JsonProperty("server-name")
|
||||||
private String serverName = GeyserConnector.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")
|
@JsonProperty("enable-proxy-protocol")
|
||||||
private boolean enableProxyProtocol = false;
|
private boolean enableProxyProtocol = false;
|
||||||
|
|
||||||
|
|
|
@ -159,6 +159,7 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler {
|
||||||
@Override
|
@Override
|
||||||
public void onSessionCreation(BedrockServerSession bedrockServerSession) {
|
public void onSessionCreation(BedrockServerSession bedrockServerSession) {
|
||||||
bedrockServerSession.setLogging(true);
|
bedrockServerSession.setLogging(true);
|
||||||
|
bedrockServerSession.setCompressionLevel(connector.getConfig().getBedrock().getCompressionLevel());
|
||||||
bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(connector, new GeyserSession(connector, bedrockServerSession)));
|
bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(connector, new GeyserSession(connector, bedrockServerSession)));
|
||||||
// Set the packet codec to default just in case we need to send disconnect packets.
|
// Set the packet codec to default just in case we need to send disconnect packets.
|
||||||
bedrockServerSession.setPacketCodec(BedrockProtocol.DEFAULT_BEDROCK_CODEC);
|
bedrockServerSession.setPacketCodec(BedrockProtocol.DEFAULT_BEDROCK_CODEC);
|
||||||
|
|
|
@ -23,6 +23,9 @@ bedrock:
|
||||||
motd2: "Another Geyser server."
|
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.
|
# 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"
|
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
|
# 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.
|
# in front of your Geyser instance.
|
||||||
enable-proxy-protocol: false
|
enable-proxy-protocol: false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue