mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 17:11:39 +03:00
[FIX] Фиксы автозамены
This commit is contained in:
parent
b12c26047b
commit
d266fe8b74
7 changed files with 5 additions and 70 deletions
|
@ -1,5 +1,6 @@
|
||||||
package ru.gravit.launchserver.auth.handler;
|
package ru.gravit.launchserver.auth.handler;
|
||||||
|
|
||||||
|
import ru.gravit.launcher.Launcher;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.utils.HTTPRequest;
|
import ru.gravit.utils.HTTPRequest;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package ru.gravit.launchserver.command.dump;
|
package ru.gravit.launchserver.command.dump;
|
||||||
|
|
||||||
|
import ru.gravit.launcher.Launcher;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.auth.AuthProviderPair;
|
import ru.gravit.launchserver.auth.AuthProviderPair;
|
||||||
import ru.gravit.launchserver.auth.handler.CachedAuthHandler;
|
import ru.gravit.launchserver.auth.handler.CachedAuthHandler;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package ru.gravit.launchserver.command.dump;
|
package ru.gravit.launchserver.command.dump;
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import ru.gravit.launcher.Launcher;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.command.Command;
|
import ru.gravit.launchserver.command.Command;
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package ru.gravit.launchserver.command.hash;
|
package ru.gravit.launchserver.command.hash;
|
||||||
|
|
||||||
|
import ru.gravit.launcher.Launcher;
|
||||||
import ru.gravit.launcher.profiles.ClientProfile;
|
import ru.gravit.launcher.profiles.ClientProfile;
|
||||||
import ru.gravit.launcher.profiles.ClientProfile.Version;
|
import ru.gravit.launcher.profiles.ClientProfile.Version;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package ru.gravit.launchserver.command.service;
|
package ru.gravit.launchserver.command.service;
|
||||||
|
|
||||||
|
import ru.gravit.launcher.Launcher;
|
||||||
import ru.gravit.launcher.NeedGarbageCollection;
|
import ru.gravit.launcher.NeedGarbageCollection;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.command.Command;
|
import ru.gravit.launchserver.command.Command;
|
||||||
|
|
|
@ -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<Component>, JsonDeserializer<Component> {
|
|
||||||
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<? extends Component> 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<Component>) src.getClass());
|
|
||||||
jo.add(PROP_NAME, new JsonPrimitive(classPath));
|
|
||||||
|
|
||||||
return jo;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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<ProtectHandler>, JsonDeserializer<ProtectHandler> {
|
|
||||||
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<? extends ProtectHandler> 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<ProtectHandler>) src.getClass());
|
|
||||||
jo.add(PROP_NAME, new JsonPrimitive(classPath));
|
|
||||||
|
|
||||||
return jo;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue