mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-12 09:37:35 +00:00
* Enhance ICustomSkinLoaderPlugin. * Support auto update config file per snapshot. Fix crash with forge 1.14.2 ~ 1.15.2. * ElyByAPI should check root now. * Remove unnecessary packages, add some deprecated loaders. * Reformat imports. * Move forge stuffs to another commit. * Fix config updating incorrectly.
47 lines
1.5 KiB
Java
47 lines
1.5 KiB
Java
package customskinloader.loader.jsonapi;
|
|
|
|
import java.util.Map;
|
|
|
|
import com.google.gson.Gson;
|
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
|
import customskinloader.config.SkinSiteProfile;
|
|
import customskinloader.loader.JsonAPILoader;
|
|
import customskinloader.profile.ModelManager0;
|
|
import customskinloader.profile.UserProfile;
|
|
|
|
public abstract class GlitchlessAPI implements JsonAPILoader.IJsonAPI {
|
|
|
|
public static class GlitchlessGames extends GlitchlessAPI {
|
|
@Override public String getLoaderName() { return "GlitchlessGames"; }
|
|
@Override public String getRoot() { return "https://games.glitchless.ru/api/minecraft/users/profiles/textures/?nickname="; }
|
|
}
|
|
|
|
@Override
|
|
public String toJsonUrl(String root, String username) {
|
|
return root + username;
|
|
}
|
|
|
|
@Override
|
|
public UserProfile toUserProfile(String root, String json, boolean local) {
|
|
GlitchlessApiResponse result = new Gson().fromJson(json, GlitchlessApiResponse.class);
|
|
if (!result.textures.containsKey(MinecraftProfileTexture.Type.SKIN))
|
|
return null;
|
|
|
|
return ModelManager0.toUserProfile(result.textures);
|
|
}
|
|
|
|
@Override
|
|
public String getPayload(SkinSiteProfile ssp) {
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public String getName() {
|
|
return "GlitchlessAPI";
|
|
}
|
|
|
|
public static class GlitchlessApiResponse {
|
|
protected Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> textures;
|
|
}
|
|
}
|