diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerStarter.java b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerStarter.java index 7e012dfe..8c49e94b 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerStarter.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerStarter.java @@ -10,6 +10,7 @@ import pro.gravit.launchserver.auth.protect.ProtectHandler; import pro.gravit.launchserver.auth.protect.hwid.HWIDProvider; import pro.gravit.launchserver.auth.provider.AuthProvider; +import pro.gravit.launchserver.auth.session.SessionStorage; import pro.gravit.launchserver.auth.texture.TextureProvider; import pro.gravit.launchserver.components.Component; import pro.gravit.launchserver.config.LaunchServerConfig; @@ -215,6 +216,7 @@ public static void registerAll() { AuthRequest.registerProviders(); HWIDProvider.registerProviders(); OptionalAction.registerProviders(); + SessionStorage.registerProviders(); } public static void generateConfigIfNotExists(Path configFile, CommandHandler commandHandler, LaunchServer.LaunchServerEnv env) throws IOException { diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/session/SessionStorage.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/session/SessionStorage.java index 463b7a60..e576c07f 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/session/SessionStorage.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/session/SessionStorage.java @@ -10,6 +10,7 @@ public abstract class SessionStorage { protected transient LaunchServer server; public static ProviderMap providers = new ProviderMap<>(); + private static boolean registeredProviders = false; public abstract byte[] getSessionData(UUID session); public abstract Stream getSessionsFromUserUUID(UUID userUUID); public abstract boolean writeSession(UUID userUUID, UUID sessionUUID, byte[] data); @@ -23,4 +24,10 @@ public void init(LaunchServer server) { this.server = server; } + public static void registerProviders() { + if(!registeredProviders) { + providers.register("memory", MemorySessionStorage.class); + registeredProviders = true; + } + } }