mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-11 18:27:31 +00:00
81 lines
2.2 KiB
Java
81 lines
2.2 KiB
Java
package customskinloader.loader.jsonapi;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import com.google.common.collect.Lists;
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.reflect.TypeToken;
|
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
|
import customskinloader.loader.JsonAPILoader;
|
|
import customskinloader.plugin.ICustomSkinLoaderPlugin;
|
|
import customskinloader.profile.ModelManager0;
|
|
import customskinloader.profile.UserProfile;
|
|
|
|
public class ElyByAPI implements JsonAPILoader.IJsonAPI {
|
|
|
|
public static class ElyBy extends JsonAPILoader.DefaultProfile {
|
|
public ElyBy(JsonAPILoader loader) {
|
|
super(loader);
|
|
}
|
|
|
|
@Override
|
|
public String getName() {
|
|
return "ElyBy";
|
|
}
|
|
|
|
@Override
|
|
public int getPriority() {
|
|
return 400;
|
|
}
|
|
|
|
@Override
|
|
public String getRoot() {
|
|
return "http://skinsystem.ely.by/textures/";
|
|
}
|
|
}
|
|
|
|
public static class TLauncher extends JsonAPILoader.DefaultProfile {
|
|
public TLauncher(JsonAPILoader loader) {
|
|
super(loader);
|
|
}
|
|
|
|
@Override
|
|
public String getName() {
|
|
return "TLauncher";
|
|
}
|
|
|
|
@Override
|
|
public int getPriority() {
|
|
return 550;
|
|
}
|
|
|
|
@Override
|
|
public String getRoot() {
|
|
return "https://auth.tlauncher.org/skin/profile/texture/login/";
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public List<ICustomSkinLoaderPlugin.IDefaultProfile> getDefaultProfiles(JsonAPILoader loader) {
|
|
return Lists.newArrayList(new ElyBy(loader), new TLauncher(loader));
|
|
}
|
|
|
|
@Override
|
|
public String toJsonUrl(String root, String username) {
|
|
return root + username;
|
|
}
|
|
|
|
@Override
|
|
public UserProfile toUserProfile(String root, String json, boolean local) {
|
|
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> result = new Gson().fromJson(json, new TypeToken<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>>() {
|
|
}.getType());
|
|
return ModelManager0.toUserProfile(result);
|
|
}
|
|
|
|
@Override
|
|
public String getName() {
|
|
return "ElyByAPI";
|
|
}
|
|
}
|