Fixed auto-setting auth-type to Floodgate

This commit is contained in:
Tim203 2023-04-26 18:52:12 +02:00
parent d4ffecb500
commit 7c1100b830
No known key found for this signature in database
GPG key ID: 736F3CD49EF01DBF
9 changed files with 51 additions and 45 deletions

View file

@ -169,4 +169,6 @@ public interface GeyserBootstrap {
* @return the listening port being used by the Java server. -1 if can't be found
*/
int getServerPort();
boolean isFloodgatePluginPresent();
}

View file

@ -81,7 +81,6 @@ import org.geysermc.geyser.skin.ProvidedSkins;
import org.geysermc.geyser.skin.SkinProvider;
import org.geysermc.geyser.text.GeyserLocale;
import org.geysermc.geyser.text.MinecraftLocale;
import org.geysermc.geyser.translator.inventory.item.ItemTranslator;
import org.geysermc.geyser.translator.text.MessageTranslator;
import org.geysermc.geyser.util.*;
@ -324,7 +323,18 @@ public class GeyserImpl implements GeyserApi {
logger.info("Port set from system property: " + port);
}
}
if (config.getRemote().authType() == AuthType.FLOODGATE && !bootstrap.isFloodgatePluginPresent()) {
logger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " "
+ GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
return;
} else if (config.isAutoconfiguredRemote() && bootstrap.isFloodgatePluginPresent()) {
// Floodgate installed means that the user wants Floodgate authentication
logger.debug("Auto-setting to Floodgate authentication.");
config.getRemote().setAuthType(AuthType.FLOODGATE);
}
}
String remoteAddress = config.getRemote().address();
// Filters whether it is not an IP address or localhost, because otherwise it is not possible to find out an SRV entry.
if (!remoteAddress.matches(IP_REGEX) && !remoteAddress.equalsIgnoreCase("localhost")) {

View file

@ -27,6 +27,7 @@ package org.geysermc.geyser.configuration;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.geysermc.geyser.GeyserLogger;
import org.geysermc.geyser.api.network.AuthType;
import org.geysermc.geyser.api.network.BedrockListener;
import org.geysermc.geyser.api.network.RemoteServer;
import org.geysermc.geyser.network.CIDRMatcher;
@ -119,6 +120,8 @@ public interface GeyserConfiguration {
int getPendingAuthenticationTimeout();
boolean isAutoconfiguredRemote();
interface IBedrockConfiguration extends BedrockListener {
void setAddress(String address);
@ -157,6 +160,8 @@ public interface GeyserConfiguration {
default int protocolVersion() {
return GameProtocol.getJavaProtocolVersion();
}
void setAuthType(AuthType authType);
}
interface IUserAuthenticationInfo {