From 2a9a4256f9b2def7b76bbc15c988240733b76ead Mon Sep 17 00:00:00 2001 From: Gravit Date: Fri, 29 May 2020 23:46:12 +0700 Subject: [PATCH] [FIX] NPE in MysqlHWIDProvider --- .../auth/protect/AdvancedProtectHandler.java | 12 ++++++++++++ .../launchserver/auth/protect/ProtectHandler.java | 10 ++++++++++ .../launchserver/config/LaunchServerConfig.java | 2 ++ 3 files changed, 24 insertions(+) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/AdvancedProtectHandler.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/AdvancedProtectHandler.java index 3312e6cb..e23d4f48 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/AdvancedProtectHandler.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/AdvancedProtectHandler.java @@ -105,4 +105,16 @@ public Map getCommands() { public boolean onJoinServer(String serverID, String username, Client client) { return !enableHardwareFeature || (client.trustLevel != null && client.trustLevel.hardwareInfo != null); } + + @Override + public void init() { + if(provider != null) + provider.init(); + } + + @Override + public void close() { + if(provider != null) + provider.close(); + } } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/ProtectHandler.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/ProtectHandler.java index 8bdaadc3..ce19e627 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/ProtectHandler.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/ProtectHandler.java @@ -20,5 +20,15 @@ public static void registerHandlers() { public abstract boolean allowGetAccessToken(AuthResponse.AuthContext context); public abstract void checkLaunchServerLicense(); //Выдает SecurityException при ошибке проверки лицензии + + public void init() + { + + } + + public void close() + { + + } //public abstract } 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 6f55b94c..08ca4407 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java @@ -184,6 +184,7 @@ public void init(LaunchServer.ReloadType type) { } if (protectHandler != null) { server.registerObject("protectHandler", protectHandler); + protectHandler.init(); protectHandler.checkLaunchServerLicense(); } if (components != null) { @@ -226,6 +227,7 @@ public void close(LaunchServer.ReloadType type) { } if (protectHandler != null) { server.unregisterObject("protectHandler", protectHandler); + protectHandler.close(); } if (dao != null) { server.unregisterObject("dao", dao);