diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/JsonAuthHandler.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/JsonAuthHandler.java index 9c0804e4..d661a537 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/JsonAuthHandler.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/JsonAuthHandler.java @@ -1,5 +1,6 @@ package ru.gravit.launchserver.auth.handler; +import ru.gravit.launcher.Launcher; import ru.gravit.launchserver.LaunchServer; import ru.gravit.utils.HTTPRequest; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpEntryCacheCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpEntryCacheCommand.java index b2cec441..bafb2b60 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpEntryCacheCommand.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpEntryCacheCommand.java @@ -1,5 +1,6 @@ package ru.gravit.launchserver.command.dump; +import ru.gravit.launcher.Launcher; import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.auth.AuthProviderPair; import ru.gravit.launchserver.auth.handler.CachedAuthHandler; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpSessionsCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpSessionsCommand.java index bfb25d90..503e4335 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpSessionsCommand.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpSessionsCommand.java @@ -1,6 +1,7 @@ package ru.gravit.launchserver.command.dump; import com.google.gson.reflect.TypeToken; +import ru.gravit.launcher.Launcher; import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.command.Command; import ru.gravit.launchserver.socket.Client; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/hash/DownloadClientCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/hash/DownloadClientCommand.java index fc5b32cf..6a6c31fb 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/hash/DownloadClientCommand.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/hash/DownloadClientCommand.java @@ -1,5 +1,6 @@ package ru.gravit.launchserver.command.hash; +import ru.gravit.launcher.Launcher; import ru.gravit.launcher.profiles.ClientProfile; import ru.gravit.launcher.profiles.ClientProfile.Version; import ru.gravit.launchserver.LaunchServer; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/service/ComponentCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/service/ComponentCommand.java index 448a6f33..290d6f5d 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/service/ComponentCommand.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/service/ComponentCommand.java @@ -1,5 +1,6 @@ package ru.gravit.launchserver.command.service; +import ru.gravit.launcher.Launcher; import ru.gravit.launcher.NeedGarbageCollection; import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.command.Command; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/config/adapter/ComponentAdapter.java b/LaunchServer/src/main/java/ru/gravit/launchserver/config/adapter/ComponentAdapter.java deleted file mode 100644 index b4b9e312..00000000 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/config/adapter/ComponentAdapter.java +++ /dev/null @@ -1,35 +0,0 @@ -package ru.gravit.launchserver.config.adapter; - -import com.google.gson.*; -import ru.gravit.launchserver.components.Component; -import ru.gravit.utils.helper.LogHelper; - -import java.lang.reflect.Type; - -public class ComponentAdapter implements JsonSerializer, JsonDeserializer { - private static final String PROP_NAME = "component"; - - @Override - public Component deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { - String typename = json.getAsJsonObject().getAsJsonPrimitive(PROP_NAME).getAsString(); - Class cls = Component.getComponentClass(typename); - if (cls == null) { - LogHelper.error("Component %s not found", typename); - return null; - } - - - return (Component) context.deserialize(json, cls); - } - - @Override - public JsonElement serialize(Component src, Type typeOfSrc, JsonSerializationContext context) { - JsonObject jo = context.serialize(src).getAsJsonObject(); - - @SuppressWarnings("unchecked") - String classPath = Component.getComponentName((Class) src.getClass()); - jo.add(PROP_NAME, new JsonPrimitive(classPath)); - - return jo; - } -} diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/config/adapter/ProtectHandlerAdapter.java b/LaunchServer/src/main/java/ru/gravit/launchserver/config/adapter/ProtectHandlerAdapter.java deleted file mode 100644 index 48fca6f8..00000000 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/config/adapter/ProtectHandlerAdapter.java +++ /dev/null @@ -1,35 +0,0 @@ -package ru.gravit.launchserver.config.adapter; - -import com.google.gson.*; -import ru.gravit.launchserver.auth.protect.ProtectHandler; -import ru.gravit.utils.helper.LogHelper; - -import java.lang.reflect.Type; - -public class ProtectHandlerAdapter implements JsonSerializer, JsonDeserializer { - private static final String PROP_NAME = "type"; - - @Override - public ProtectHandler deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { - String typename = json.getAsJsonObject().getAsJsonPrimitive(PROP_NAME).getAsString(); - Class cls = ProtectHandler.getHandlerClass(typename); - if (cls == null) { - LogHelper.error("ProtectHandler %s not found", typename); - return null; - } - - - return (ProtectHandler) context.deserialize(json, cls); - } - - @Override - public JsonElement serialize(ProtectHandler src, Type typeOfSrc, JsonSerializationContext context) { - JsonObject jo = context.serialize(src).getAsJsonObject(); - - @SuppressWarnings("unchecked") - String classPath = ProtectHandler.getHandlerName((Class) src.getClass()); - jo.add(PROP_NAME, new JsonPrimitive(classPath)); - - return jo; - } -}