Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ protected IoEventLoop newChild(Executor executor, IoHandlerFactory ioHandlerFact
listenerInfo.isPingPassthrough(),
listenerInfo.getQueryPort(),
listenerInfo.isQueryEnabled(),
bootstrap.config().java().useHaproxyProtocol() // If Geyser is expecting HAProxy, so should the Bungee end
bootstrap.config().advanced().java().useHaproxyProtocol() // If Geyser is expecting HAProxy, so should the Bungee end
);

// The field that stores all listeners in BungeeCord
Expand Down Expand Up @@ -191,7 +191,7 @@ protected void initChannel(@NonNull Channel ch) throws Exception {
}
initChannel.invoke(channelInitializer, ch);

if (bootstrap.config().disableCompression()) {
if (bootstrap.config().advanced().java().disableCompression()) {
ch.pipeline().addAfter(PipelineUtils.PACKET_ENCODER, "geyser-compression-disabler",
new GeyserBungeeCompressionDisabler());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void onGeyserEnable() {

GeyserImpl.start();

if (!geyserConfig.integratedPingPassthrough()) {
if (!geyserConfig.motd().integratedPingPassthrough()) {
this.geyserBungeePingPassthrough = GeyserLegacyPingPassthrough.init(geyser);
} else {
this.geyserBungeePingPassthrough = new GeyserBungeePingPassthrough(getProxy());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void onGeyserEnable() {

GeyserImpl.start();

if (!geyserConfig.integratedPingPassthrough()) {
if (!geyserConfig.motd().integratedPingPassthrough()) {
this.geyserPingPassthrough = GeyserLegacyPingPassthrough.init(geyser);
} else {
this.geyserPingPassthrough = new ModPingPassthrough(server, geyserLogger);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected void initChannel(@NonNull Channel ch) throws Exception {
int index = ch.pipeline().names().indexOf("encoder");
String baseName = index != -1 ? "encoder" : "outbound_config";

if (bootstrap.config().disableCompression()) {
if (bootstrap.config().advanced().java().disableCompression()) {
ch.pipeline().addAfter(baseName, "geyser-compression-disabler", new GeyserModCompressionDisabler());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ protected void initChannel(@NonNull Channel ch) throws Exception {
int index = ch.pipeline().names().indexOf("encoder");
String baseName = index != -1 ? "encoder" : "outbound_config";

if (bootstrap.config().disableCompression() && GeyserSpigotCompressionDisabler.ENABLED) {
if (bootstrap.config().advanced().java().disableCompression() && GeyserSpigotCompressionDisabler.ENABLED) {
ch.pipeline().addAfter(baseName, "geyser-compression-disabler", new GeyserSpigotCompressionDisabler());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public void onGeyserEnable() {

GeyserImpl.start();

if (!geyserConfig.integratedPingPassthrough()) {
if (!geyserConfig.motd().integratedPingPassthrough()) {
this.geyserSpigotPingPassthrough = GeyserLegacyPingPassthrough.init(geyser);
} else {
if (ReflectedNames.checkPaperPingEvent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ public void onGeyserEnable() {

@Override
public <T extends GeyserConfig> T loadConfig(Class<T> configClass) {
return new ConfigLoader(this, configFilename)
return new ConfigLoader(this)
.configFile(new File(getConfigFolder().toFile(), configFilename))
.transformer(this::handleArgsConfigOptions)
.load(configClass);
}
Expand Down Expand Up @@ -298,7 +299,7 @@ public boolean testFloodgatePluginPresent() {

@Override
public Path getFloodgateKeyPath() {
return Path.of(geyserConfig.floodgateKeyFile());
return Path.of(geyserConfig.advanced().floodgateKeyFile());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ protected IoEventLoop newChild(Executor executor, IoHandlerFactory ioHandlerFact
protected void initChannel(@NonNull Channel ch) throws Exception {
initChannel.invoke(channelInitializer, ch);

if (bootstrap.config().disableCompression() && GeyserVelocityCompressionDisabler.ENABLED) {
if (bootstrap.config().advanced().java().disableCompression() && GeyserVelocityCompressionDisabler.ENABLED) {
ch.pipeline().addAfter("minecraft-encoder", "geyser-compression-disabler",
new GeyserVelocityCompressionDisabler());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public void onGeyserEnable() {

GeyserImpl.start();

if (!geyserConfig.integratedPingPassthrough()) {
if (!geyserConfig.motd().integratedPingPassthrough()) {
this.geyserPingPassthrough = GeyserLegacyPingPassthrough.init(geyser);
} else {
this.geyserPingPassthrough = new GeyserVelocityPingPassthrough(proxyServer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public boolean testFloodgatePluginPresent() {

@Override
public Path getFloodgateKeyPath() {
return new File(ROOT_FOLDER, geyserConfig.floodgateKeyFile()).toPath();
return new File(ROOT_FOLDER, geyserConfig.advanced().floodgateKeyFile()).toPath();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static Path getKeyPath(GeyserConfig config, Path floodgateDataFolder, Pat
}
}

Path floodgateKey = geyserDataFolder.resolve(config.floodgateKeyFile());
Path floodgateKey = geyserDataFolder.resolve(config.advanced().floodgateKeyFile());

if (!Files.exists(floodgateKey)) {
logger.error(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed"));
Expand Down
30 changes: 15 additions & 15 deletions core/src/main/java/org/geysermc/geyser/GeyserImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ private GeyserImpl(GeyserBootstrap bootstrap) {

public void initialize() {
// Setup encryption early so we don't start if we can't auth
if (!config().disableXboxAuth()) {
if (config().advanced().bedrock().validateBedrockLogin()) {
try {
EncryptionUtils.getMojangPublicKey();
} catch (Throwable t) {
Expand Down Expand Up @@ -316,20 +316,20 @@ private void startInstance() {
Registries.RESOURCE_PACKS.load();

// Warnings to users who enable options that they might not need.
if (config.bedrock().useHaproxyProtocol()) {
if (config.advanced().bedrock().useHaproxyProtocol()) {
logger.warning("Geyser is configured to expect HAProxy protocol for incoming Bedrock connections.");
logger.warning("If you do not know what this is, open the Geyser config, and set \"use-haproxy-protocol\" under the \"bedrock\" section to \"false\".");
logger.warning("If you do not know what this is, open the Geyser config, and set \"use-haproxy-protocol\" under the \"advanced/bedrock\" section to \"false\".");
}

if (config.java().useHaproxyProtocol()) {
if (config.advanced().java().useHaproxyProtocol()) {
logger.warning("Geyser is configured to use proxy protocol when connecting to the Java server.");
logger.warning("If you do not know what this is, open the Geyser config, and set \"use-haproxy-protocol\" under the \"java\" section to \"false\".");
logger.warning("If you do not know what this is, open the Geyser config, and set \"use-haproxy-protocol\" under the \"advanced/java\" section to \"false\".");
}

if (config.disableXboxAuth()) {
if (!config.advanced().bedrock().validateBedrockLogin()) {
logger.error("XBOX AUTHENTICATION IS DISABLED ON THIS GEYSER INSTANCE!");
logger.error("While this allows using Bedrock edition proxies, it also opens up the ability for hackers to connect with any username they choose.");
logger.error("To change this, set \"disable-xbox-auth\" to \"false\" in Geyser's config-advanced.yml file.");
logger.error("To change this, set \"disable-xbox-auth\" to \"false\" in Geyser's config file.");
}

String geyserUdpPort = System.getProperty("geyserUdpPort", "");
Expand Down Expand Up @@ -416,16 +416,16 @@ private void startInstance() {
if (parsedPort < 1 || parsedPort > 65535) {
throw new NumberFormatException("The broadcast port must be between 1 and 65535 inclusive!");
}
config.bedrock().broadcastPort(parsedPort);
config.advanced().bedrock().broadcastPort(parsedPort);
logger.info("Broadcast port set from system property: " + parsedPort);
} catch (NumberFormatException e) {
logger.error(String.format("Invalid broadcast port from system property: %s! Defaulting to configured port.", broadcastPort + " (" + e.getMessage() + ")"));
}
}

// It's set to 0 only if no system property or manual config value was set
if (config.bedrock().broadcastPort() == 0) {
config.bedrock().broadcastPort(config.bedrock().port());
if (config.advanced().bedrock().broadcastPort() == 0) {
config.advanced().bedrock().broadcastPort(config.bedrock().port());
}

if (!(config instanceof GeyserPluginConfig)) {
Expand All @@ -440,7 +440,7 @@ private void startInstance() {
logger.debug("Found SRV record \"" + remoteAddress + ":" + remotePort + "\"");
}
}
} else if (!config.useDirectConnection()) {
} else if (!config.advanced().java().useDirectConnection()) {
logger.warning("The use-direct-connection config option is deprecated. Please reach out to us on Discord if there's a reason it needs to be disabled.");
}

Expand All @@ -456,9 +456,9 @@ private void startInstance() {
logger.debug("Epoll is not available; Erosion's Unix socket handling will not work.");
}

BedrockDimension.changeBedrockNetherId(config.netherRoofWorkaround()); // Apply End dimension ID workaround to Nether
BedrockDimension.changeBedrockNetherId(config.gameplay().netherRoofWorkaround()); // Apply End dimension ID workaround to Nether

int bedrockThreadCount = Integer.getInteger("Geyser.BedrockNetworkThreads", config.bedrockNetworkThreadCount());
int bedrockThreadCount = Integer.getInteger("Geyser.BedrockNetworkThreads", -1);
if (bedrockThreadCount == -1) {
// Copy the code from Netty's default thread count fallback
bedrockThreadCount = Math.max(1, SystemPropertyUtil.getInt("io.netty.eventLoopThreads", NettyRuntime.availableProcessors() * 2));
Expand Down Expand Up @@ -546,8 +546,8 @@ private void startInstance() {

metrics.addCustomChart(new SimplePie("defaultLocale", GeyserLocale::getDefaultLocale));
metrics.addCustomChart(new SimplePie("version", () -> GeyserImpl.VERSION));
metrics.addCustomChart(new SimplePie("javaHaProxyProtocol", () -> String.valueOf(config.java().useHaproxyProtocol())));
metrics.addCustomChart(new SimplePie("bedrockHaProxyProtocol", () -> String.valueOf(config.bedrock().useHaproxyProtocol())));
metrics.addCustomChart(new SimplePie("javaHaProxyProtocol", () -> String.valueOf(config.advanced().java().useHaproxyProtocol())));
metrics.addCustomChart(new SimplePie("bedrockHaProxyProtocol", () -> String.valueOf(config.advanced().bedrock().useHaproxyProtocol())));
metrics.addCustomChart(new AdvancedPie("playerPlatform", () -> {
Map<String, Integer> valueMap = new HashMap<>();
for (GeyserSession session : sessionManager.getAllSessions()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void execute(CommandContext<GeyserCommandSource> context) {

// Replace "<" and ">" symbols if they are present to avoid the common issue of people including them
final String ip = ipArgument.replace("<", "").replace(">", "");
final int port = portArgument != null ? portArgument : geyser.config().bedrock().broadcastPort(); // default bedrock port
final int port = portArgument != null ? portArgument : geyser.config().advanced().bedrock().broadcastPort(); // default bedrock port

// Issue: people commonly checking placeholders
if (ip.equals("ip")) {
Expand Down Expand Up @@ -109,7 +109,7 @@ public void execute(CommandContext<GeyserCommandSource> context) {
GeyserConfig config = geyser.config();

// Issue: do the ports not line up? We only check this if players don't override the broadcast port - if they do, they (hopefully) know what they're doing
if (config.bedrock().broadcastPort() == config.bedrock().port()) {
if (config.advanced().bedrock().broadcastPort() == config.bedrock().port()) {
if (port != config.bedrock().port()) {
if (portArgument != null) {
source.sendMessage("The port you are testing with (" + port + ") is not the same as you set in your Geyser configuration ("
Expand All @@ -126,9 +126,9 @@ public void execute(CommandContext<GeyserCommandSource> context) {
}
}
} else {
if (config.bedrock().broadcastPort() != port) {
if (config.advanced().bedrock().broadcastPort() != port) {
source.sendMessage("The port you are testing with (" + port + ") is not the same as the broadcast port set in your Geyser configuration ("
+ config.bedrock().broadcastPort() + "). ");
+ config.advanced().bedrock().broadcastPort() + "). ");
source.sendMessage("You ONLY need to change the broadcast port if clients connects with a port different from the port Geyser is running on.");
source.sendMessage("Re-run the command with the port in the config, or change the `bedrock` `broadcast-port` in the config.");
}
Expand All @@ -140,7 +140,7 @@ public void execute(CommandContext<GeyserCommandSource> context) {
}

// Issue: did someone turn on enable-proxy-protocol, and they didn't mean it?
if (config.bedrock().useHaproxyProtocol()) {
if (config.advanced().bedrock().useHaproxyProtocol()) {
source.sendMessage("You have the `use-haproxy-protocol` setting enabled. " +
"Unless you're deliberately using additional software that REQUIRES this setting, you may not need it enabled.");
}
Expand Down
Loading