Search in sources :

Example 1 with Cape

use of org.dragonet.common.data.entity.Skin.Cape in project DragonProxy by DragonetMC.

the class SkinFetcher method getPlayerProfile.

private PlayerProfile getPlayerProfile(GameProfile gameProfile) {
    try {
        return profilesCache.get(gameProfile.getId(), () -> {
            Property property = getProfileProperty(gameProfile.getId());
            System.out.println(property.toString());
            Skin skin = Skin.DEFAULT_SKIN_STEVE;
            if (gameProfile.getTextures().containsKey(GameProfile.TextureType.SKIN)) {
                System.out.println(gameProfile.getTexture(GameProfile.TextureType.SKIN).getURL());
                System.out.println(Skin.getModelFromJava(gameProfile.getTexture(GameProfile.TextureType.SKIN).getModel()));
                skin = new Skin(new URL(gameProfile.getTexture(GameProfile.TextureType.SKIN).getURL()), Skin.getModelFromJava(gameProfile.getTexture(GameProfile.TextureType.SKIN).getModel()));
            }
            if (gameProfile.getTextures().containsKey(GameProfile.TextureType.CAPE))
                skin.setCape(skin.new Cape(new URL(gameProfile.getTexture(GameProfile.TextureType.CAPE).getURL())));
            PlayerProfile profile = new PlayerProfile(gameProfile.getId(), property, skin);
            if (property != null) {
                // profilesCache.put(gameProfile.getId(), profile);
                return profile;
            }
            return null;
        });
    } catch (CacheLoader.InvalidCacheLoadException | ExecutionException ex) {
        return null;
    }
}
Also used : Skin(org.dragonet.common.data.entity.Skin) Cape(org.dragonet.common.data.entity.Skin.Cape) ExecutionException(java.util.concurrent.ExecutionException) Property(com.github.steveice10.mc.auth.data.GameProfile.Property) URL(java.net.URL)

Aggregations

Property (com.github.steveice10.mc.auth.data.GameProfile.Property)1 URL (java.net.URL)1 ExecutionException (java.util.concurrent.ExecutionException)1 Skin (org.dragonet.common.data.entity.Skin)1 Cape (org.dragonet.common.data.entity.Skin.Cape)1