Implemented floodgate support for ViaProxy

This commit is contained in:
RaphiMC 2023-11-04 17:07:35 +01:00
parent cbb84d91bc
commit 4e490634a3
No known key found for this signature in database
GPG key ID: 0F6BB0657A03AC94
2 changed files with 13 additions and 10 deletions

View file

@ -43,6 +43,7 @@ import org.jetbrains.annotations.NotNull;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.UUID; import java.util.UUID;
@ -73,7 +74,7 @@ public class GeyserViaProxyBootstrap implements GeyserBootstrap {
return; return;
} }
config.getRemote().setAuthType(AuthType.OFFLINE); config.getRemote().setAuthType(Files.isRegularFile(this.config.getFloodgateKeyPath()) ? AuthType.FLOODGATE : AuthType.OFFLINE);
GeyserConfiguration.checkGeyserConfiguration(this.config, this.logger); GeyserConfiguration.checkGeyserConfiguration(this.config, this.logger);
this.geyser = GeyserImpl.load(PlatformType.VIAPROXY, this); this.geyser = GeyserImpl.load(PlatformType.VIAPROXY, this);

View file

@ -308,15 +308,17 @@ public class GeyserImpl implements GeyserApi {
} }
} }
boolean floodgatePresent = bootstrap.testFloodgatePluginPresent(); if (platformType != PlatformType.VIAPROXY) {
if (config.getRemote().authType() == AuthType.FLOODGATE && !floodgatePresent) { boolean floodgatePresent = bootstrap.testFloodgatePluginPresent();
logger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " if (config.getRemote().authType() == AuthType.FLOODGATE && !floodgatePresent) {
+ GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling")); logger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " "
return; + GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
} else if (config.isAutoconfiguredRemote() && floodgatePresent) { return;
// Floodgate installed means that the user wants Floodgate authentication } else if (config.isAutoconfiguredRemote() && floodgatePresent) {
logger.debug("Auto-setting to Floodgate authentication."); // Floodgate installed means that the user wants Floodgate authentication
config.getRemote().setAuthType(AuthType.FLOODGATE); logger.debug("Auto-setting to Floodgate authentication.");
config.getRemote().setAuthType(AuthType.FLOODGATE);
}
} }
} }