From adefda970e8258f83b1f74439efbb02c5dc6033d Mon Sep 17 00:00:00 2001 From: Zaxar163 Date: Mon, 10 Feb 2020 19:18:22 +0100 Subject: [PATCH] =?UTF-8?q?[FIX]=20=D0=91=D0=BE=D0=BB=D0=B5=D0=B5=20=D0=B1?= =?UTF-8?q?=D1=8B=D1=81=D1=82=D1=80=D0=BE=D0=B5=20=20=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D1=83=D1=87=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=B9=D0=B4=D0=B5=D1=80=D0=B0=20=D0=BF=D0=BE=20=D0=BD?= =?UTF-8?q?=D0=B0=D0=B7=D0=B2=D0=B0=D0=BD=D0=B8=D0=B9...=20(=D0=BA=D0=BE?= =?UTF-8?q?=D0=BB=D0=BB=D0=B5=D0=BA=D1=86=D0=B8=D1=8F=20=D0=B2=20=D0=BA?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D1=80=D0=BE=D0=B9=20=D0=BE=D0=BD=20=D1=85?= =?UTF-8?q?=D1=80=D0=B0=D0=BD=D0=B8=D1=82=D1=81=D1=8F=20lasy=20fill)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../launchserver/config/LaunchServerConfig.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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); }