mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-20 13:29:40 +00:00
Fix CustomSkinAPIPlus loading incorrectly. Fix unable to complete config with default value. (#168)
This commit is contained in:
1 parent
3e001c4cdf
commit
4df8ce38d6
12 files changed
+240
-114
No files matched your search
@@ -1,10 +1,12 @@
|
||||
package customskinloader.loader;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
@@ -25,9 +27,7 @@ import org.apache.commons.codec.Charsets;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public abstract class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.IProfileLoader {
|
||||
|
||||
// === ICustomSkinLoaderPlugin ===
|
||||
public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.IProfileLoader {
|
||||
|
||||
@Override
|
||||
public ProfileLoader.IProfileLoader getProfileLoader() {
|
||||
@@ -35,23 +35,36 @@ public abstract class MojangAPILoader implements ICustomSkinLoaderPlugin, Profil
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSkinSiteProfile(SkinSiteProfile ssp) {
|
||||
ssp.type = this.getName();
|
||||
ssp.apiRoot = this.getAPIRoot();
|
||||
ssp.sessionRoot = this.getSessionRoot();
|
||||
public List<IDefaultProfile> getDefaultProfiles() {
|
||||
return Lists.newArrayList(new Mojang(this));
|
||||
}
|
||||
|
||||
public abstract String getAPIRoot();
|
||||
public abstract String getSessionRoot();
|
||||
public abstract static class DefaultProfile implements ICustomSkinLoaderPlugin.IDefaultProfile {
|
||||
protected final MojangAPILoader loader;
|
||||
|
||||
public static class Mojang extends MojangAPILoader {
|
||||
@Override public String getLoaderName() { return "Mojang"; }
|
||||
public DefaultProfile(MojangAPILoader loader) {
|
||||
this.loader = loader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSkinSiteProfile(SkinSiteProfile ssp) {
|
||||
ssp.type = this.loader.getName();
|
||||
ssp.apiRoot = this.getAPIRoot();
|
||||
ssp.sessionRoot = this.getSessionRoot();
|
||||
}
|
||||
|
||||
public abstract String getAPIRoot();
|
||||
public abstract String getSessionRoot();
|
||||
}
|
||||
|
||||
public static class Mojang extends MojangAPILoader.DefaultProfile {
|
||||
public Mojang(MojangAPILoader loader) { super(loader); }
|
||||
@Override public String getName() { return "Mojang"; }
|
||||
@Override public int getPriority() { return 100; }
|
||||
@Override public String getAPIRoot() { return getMojangApiRoot(); }
|
||||
@Override public String getSessionRoot() { return getMojangSessionRoot(); }
|
||||
}
|
||||
|
||||
// === IProfileLoader ===
|
||||
|
||||
@Override
|
||||
public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile) throws Exception {
|
||||
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = getTextures(gameProfile);
|
||||
|
||||
Reference in new issue
Block a user