diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java index 312c900c..73b62f03 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java @@ -52,12 +52,15 @@ public LaunchServerConfig setLaunchServer(LaunchServer server) { public DaoProvider dao; private transient AuthProviderPair authDefault; + private transient Map authPairs = null; public AuthProviderPair getAuthProviderPair(String name) { - for (AuthProviderPair pair : auth) { - if (pair.name.equals(name)) return pair; - } - return null; + if (authPairs == null) { + Map pairs = new HashMap<>(); + for (AuthProviderPair p : auth) pairs.put(p.name, p); + authPairs = pairs; + } + return authPairs.get(name); } public ProtectHandler protectHandler; @@ -125,6 +128,7 @@ public void verify() { public void init(LaunchServer.ReloadType type) { Launcher.applyLauncherEnv(env); + authPairs = null; for (AuthProviderPair provider : auth) { provider.init(server); } @@ -144,8 +148,6 @@ public void init(LaunchServer.ReloadType type) { server.registerObject("auth.".concat(pair.name).concat(".hwid"), pair.hwid); } } - - Arrays.stream(mirrors).forEach(server.mirrorManager::addMirror); }