mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
[FIX] SessionStorage NPE
This commit is contained in:
parent
aced575921
commit
62c8ca878e
2 changed files with 9 additions and 0 deletions
|
@ -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 {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
public abstract class SessionStorage {
|
||||
protected transient LaunchServer server;
|
||||
public static ProviderMap<SessionStorage> providers = new ProviderMap<>();
|
||||
private static boolean registeredProviders = false;
|
||||
public abstract byte[] getSessionData(UUID session);
|
||||
public abstract Stream<UUID> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue