Fix config order initlialization

This commit is contained in:
4drian3d 2021-11-15 12:12:29 -05:00
parent 7f92021736
commit cedf188e61
2 changed files with 9 additions and 8 deletions

View File

@ -35,15 +35,16 @@ public class AuthMeVelocityPlugin {
@Subscribe
public void onProxyInitialize(ProxyInitializeEvent event) {
AuthMeConfig.loadConfig(pluginDirectory, logger);
var config = AuthMeConfig.getConfig();
proxy.getChannelRegistrar().register(
MinecraftChannelIdentifier.create("authmevelocity", "main"));
proxy.getEventManager().register(this, new ProxyListener(proxy, logger));
if(proxy.getPluginManager().getPlugin("fastlogin").isPresent()){
proxy.getEventManager().register(this, new FastLoginListener(proxy));
}
AuthMeConfig.loadConfig(pluginDirectory, logger);
proxy.getEventManager().register(this, new ProxyListener(proxy, logger, config));
proxy.getPluginManager().getPlugin("fastlogin").ifPresent(fastlogin ->
proxy.getEventManager().register(this, new FastLoginListener(proxy)));
logger.info("-- AuthMeVelocity enabled --");
var config = AuthMeConfig.getConfig();
logger.info("AuthServers: {}", config.getAuthServers());
if(config.getToServerOptions().sendToServer()){
logger.info("LobbyServers: {}", config.getToServerOptions().getTeleportServers());

View File

@ -31,11 +31,11 @@ public class ProxyListener {
private final Random rm;
private AuthMeConfig.Config config;
public ProxyListener(ProxyServer proxy, Logger logger) {
public ProxyListener(ProxyServer proxy, Logger logger, AuthMeConfig.Config config) {
this.proxy = proxy;
this.logger = logger;
this.rm = new Random();
this.config = AuthMeConfig.getConfig();
this.config = config;
}
@Subscribe