Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 00:23:03 +01:00
Fixed auto-setting auth-type to Floodgate
Dieser Commit ist enthalten in:
Ursprung
d4ffecb500
Commit
7c1100b830
@ -136,15 +136,6 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (geyserConfig.getRemote().authType() == AuthType.FLOODGATE && getProxy().getPluginManager().getPlugin("floodgate") == null) {
|
|
||||||
geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
|
|
||||||
return;
|
|
||||||
} else if (geyserConfig.isAutoconfiguredRemote() && getProxy().getPluginManager().getPlugin("floodgate") != null) {
|
|
||||||
// Floodgate installed means that the user wants Floodgate authentication
|
|
||||||
geyserLogger.debug("Auto-setting to Floodgate authentication.");
|
|
||||||
geyserConfig.getRemote().setAuthType(AuthType.FLOODGATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
geyserConfig.loadFloodgate(this);
|
geyserConfig.loadFloodgate(this);
|
||||||
|
|
||||||
// Big hack - Bungee does not provide us an event to listen to, so schedule a repeating
|
// Big hack - Bungee does not provide us an event to listen to, so schedule a repeating
|
||||||
@ -268,6 +259,11 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
|
|||||||
return findCompatibleListener().stream().mapToInt(InetSocketAddress::getPort).findFirst().orElse(-1);
|
return findCompatibleListener().stream().mapToInt(InetSocketAddress::getPort).findFirst().orElse(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFloodgatePluginPresent() {
|
||||||
|
return getProxy().getPluginManager().getPlugin("floodgate") != null;
|
||||||
|
}
|
||||||
|
|
||||||
private Optional<InetSocketAddress> findCompatibleListener() {
|
private Optional<InetSocketAddress> findCompatibleListener() {
|
||||||
return getProxy().getConfig().getListeners().stream()
|
return getProxy().getConfig().getListeners().stream()
|
||||||
.filter(info -> info.getSocketAddress() instanceof InetSocketAddress)
|
.filter(info -> info.getSocketAddress() instanceof InetSocketAddress)
|
||||||
|
@ -41,7 +41,6 @@ import org.geysermc.geyser.GeyserBootstrap;
|
|||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
import org.geysermc.geyser.GeyserLogger;
|
import org.geysermc.geyser.GeyserLogger;
|
||||||
import org.geysermc.geyser.api.command.Command;
|
import org.geysermc.geyser.api.command.Command;
|
||||||
import org.geysermc.geyser.api.network.AuthType;
|
|
||||||
import org.geysermc.geyser.command.GeyserCommand;
|
import org.geysermc.geyser.command.GeyserCommand;
|
||||||
import org.geysermc.geyser.command.GeyserCommandManager;
|
import org.geysermc.geyser.command.GeyserCommandManager;
|
||||||
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
||||||
@ -60,7 +59,8 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.*;
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class GeyserFabricMod implements ModInitializer, GeyserBootstrap {
|
public class GeyserFabricMod implements ModInitializer, GeyserBootstrap {
|
||||||
private static GeyserFabricMod instance;
|
private static GeyserFabricMod instance;
|
||||||
@ -138,19 +138,7 @@ public class GeyserFabricMod implements ModInitializer, GeyserBootstrap {
|
|||||||
*/
|
*/
|
||||||
public void startGeyser(MinecraftServer server) {
|
public void startGeyser(MinecraftServer server) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
|
geyserConfig.loadFloodgate(this, FabricLoader.getInstance().getModContainer("floodgate").orElse(null));
|
||||||
Optional<ModContainer> floodgate = FabricLoader.getInstance().getModContainer("floodgate");
|
|
||||||
boolean floodgatePresent = floodgate.isPresent();
|
|
||||||
if (geyserConfig.getRemote().authType() == AuthType.FLOODGATE && !floodgatePresent) {
|
|
||||||
geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
|
|
||||||
return;
|
|
||||||
} else if (geyserConfig.isAutoconfiguredRemote() && floodgatePresent) {
|
|
||||||
// Floodgate installed means that the user wants Floodgate authentication
|
|
||||||
geyserLogger.debug("Auto-setting to Floodgate authentication.");
|
|
||||||
geyserConfig.getRemote().setAuthType(AuthType.FLOODGATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
geyserConfig.loadFloodgate(this, floodgate.orElse(null));
|
|
||||||
|
|
||||||
GeyserImpl.start();
|
GeyserImpl.start();
|
||||||
|
|
||||||
@ -240,6 +228,11 @@ public class GeyserFabricMod implements ModInitializer, GeyserBootstrap {
|
|||||||
return ((GeyserServerPortGetter) server).geyser$getServerPort();
|
return ((GeyserServerPortGetter) server).geyser$getServerPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFloodgatePluginPresent() {
|
||||||
|
return FabricLoader.getInstance().getModContainer("floodgate").isPresent();
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public InputStream getResourceOrNull(String resource) {
|
public InputStream getResourceOrNull(String resource) {
|
||||||
|
@ -171,15 +171,6 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (geyserConfig.getRemote().authType() == AuthType.FLOODGATE && Bukkit.getPluginManager().getPlugin("floodgate") == null) {
|
|
||||||
geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
|
|
||||||
this.getPluginLoader().disablePlugin(this);
|
|
||||||
} else if (geyserConfig.isAutoconfiguredRemote() && Bukkit.getPluginManager().getPlugin("floodgate") != null) {
|
|
||||||
// Floodgate installed means that the user wants Floodgate authentication
|
|
||||||
geyserLogger.debug("Auto-setting to Floodgate authentication.");
|
|
||||||
geyserConfig.getRemote().setAuthType(AuthType.FLOODGATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
geyserConfig.loadFloodgate(this);
|
geyserConfig.loadFloodgate(this);
|
||||||
|
|
||||||
this.geyserCommandManager = new GeyserSpigotCommandManager(geyser);
|
this.geyserCommandManager = new GeyserSpigotCommandManager(geyser);
|
||||||
@ -458,4 +449,9 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
|
|||||||
public int getServerPort() {
|
public int getServerPort() {
|
||||||
return Bukkit.getPort();
|
return Bukkit.getPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFloodgatePluginPresent() {
|
||||||
|
return Bukkit.getPluginManager().getPlugin("floodgate") != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -239,4 +239,9 @@ public class GeyserSpongePlugin implements GeyserBootstrap {
|
|||||||
public int getServerPort() {
|
public int getServerPort() {
|
||||||
return Sponge.server().boundAddress().stream().mapToInt(InetSocketAddress::getPort).findFirst().orElse(-1);
|
return Sponge.server().boundAddress().stream().mapToInt(InetSocketAddress::getPort).findFirst().orElse(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFloodgatePluginPresent() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -303,6 +303,11 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap {
|
|||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFloodgatePluginPresent() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link BeanPropertyDefinition}s for the given class
|
* Get the {@link BeanPropertyDefinition}s for the given class
|
||||||
*
|
*
|
||||||
|
@ -126,18 +126,7 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
|
|||||||
} catch (ClassNotFoundException ignored) {
|
} catch (ClassNotFoundException ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (geyserConfig.getRemote().authType() == AuthType.FLOODGATE && proxyServer.getPluginManager().getPlugin("floodgate").isEmpty()) {
|
|
||||||
geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " "
|
|
||||||
+ GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
|
|
||||||
return;
|
|
||||||
} else if (geyserConfig.isAutoconfiguredRemote() && proxyServer.getPluginManager().getPlugin("floodgate").isPresent()) {
|
|
||||||
// Floodgate installed means that the user wants Floodgate authentication
|
|
||||||
geyserLogger.debug("Auto-setting to Floodgate authentication.");
|
|
||||||
geyserConfig.getRemote().setAuthType(AuthType.FLOODGATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
geyserConfig.loadFloodgate(this, proxyServer, configFolder.toFile());
|
geyserConfig.loadFloodgate(this, proxyServer, configFolder.toFile());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void postStartup() {
|
private void postStartup() {
|
||||||
@ -242,4 +231,9 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
|
|||||||
public int getServerPort() {
|
public int getServerPort() {
|
||||||
return proxyServer.getBoundAddress().getPort();
|
return proxyServer.getBoundAddress().getPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFloodgatePluginPresent() {
|
||||||
|
return proxyServer.getPluginManager().getPlugin("floodgate").isPresent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,4 +169,6 @@ public interface GeyserBootstrap {
|
|||||||
* @return the listening port being used by the Java server. -1 if can't be found
|
* @return the listening port being used by the Java server. -1 if can't be found
|
||||||
*/
|
*/
|
||||||
int getServerPort();
|
int getServerPort();
|
||||||
|
|
||||||
|
boolean isFloodgatePluginPresent();
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,6 @@ import org.geysermc.geyser.skin.ProvidedSkins;
|
|||||||
import org.geysermc.geyser.skin.SkinProvider;
|
import org.geysermc.geyser.skin.SkinProvider;
|
||||||
import org.geysermc.geyser.text.GeyserLocale;
|
import org.geysermc.geyser.text.GeyserLocale;
|
||||||
import org.geysermc.geyser.text.MinecraftLocale;
|
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.translator.text.MessageTranslator;
|
||||||
import org.geysermc.geyser.util.*;
|
import org.geysermc.geyser.util.*;
|
||||||
|
|
||||||
@ -324,7 +323,18 @@ public class GeyserImpl implements GeyserApi {
|
|||||||
logger.info("Port set from system property: " + port);
|
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();
|
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.
|
// 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")) {
|
if (!remoteAddress.matches(IP_REGEX) && !remoteAddress.equalsIgnoreCase("localhost")) {
|
||||||
|
@ -27,6 +27,7 @@ package org.geysermc.geyser.configuration;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.geysermc.geyser.GeyserLogger;
|
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.BedrockListener;
|
||||||
import org.geysermc.geyser.api.network.RemoteServer;
|
import org.geysermc.geyser.api.network.RemoteServer;
|
||||||
import org.geysermc.geyser.network.CIDRMatcher;
|
import org.geysermc.geyser.network.CIDRMatcher;
|
||||||
@ -119,6 +120,8 @@ public interface GeyserConfiguration {
|
|||||||
|
|
||||||
int getPendingAuthenticationTimeout();
|
int getPendingAuthenticationTimeout();
|
||||||
|
|
||||||
|
boolean isAutoconfiguredRemote();
|
||||||
|
|
||||||
interface IBedrockConfiguration extends BedrockListener {
|
interface IBedrockConfiguration extends BedrockListener {
|
||||||
void setAddress(String address);
|
void setAddress(String address);
|
||||||
|
|
||||||
@ -157,6 +160,8 @@ public interface GeyserConfiguration {
|
|||||||
default int protocolVersion() {
|
default int protocolVersion() {
|
||||||
return GameProtocol.getJavaProtocolVersion();
|
return GameProtocol.getJavaProtocolVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setAuthType(AuthType authType);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IUserAuthenticationInfo {
|
interface IUserAuthenticationInfo {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren