use of org.mineskin.data.Skin in project VoxelGamesLibv2 by VoxelGamesLib.
the class TextureHandler method fetchSkin.
public void fetchSkin(int id, String fallBackName, @Nullable SkinCallback skinCallback) {
// check cache
Optional<Skin> s = getSkin(id);
if (s.isPresent()) {
if (skinCallback != null) {
skinCallback.done(s.get());
}
return;
}
// fetch from mineskin
mineskinClient.getSkin(id, new SkinCallback() {
@Override
public void done(Skin skin) {
if (skin.name.equals("")) {
skin.name = fallBackName;
}
loadedSkins.add(skin);
TextureHandler.this.saveSkin(skin);
if (skinCallback != null) {
skinCallback.done(skin);
}
}
@Override
public void error(String errorMessage) {
log.warning("Error while fetching skin #" + id + " (" + fallBackName + "): " + errorMessage);
}
@Override
public void exception(Exception exception) {
log.log(Level.WARNING, "Error while fetching skin #" + id + " (" + fallBackName + "): ", exception);
}
});
}
use of org.mineskin.data.Skin in project VoxelGamesLibv2 by VoxelGamesLib.
the class TextureHandler method fetchSkin.
public void fetchSkin(@Nonnull String name, @Nonnull String url, @Nullable SkinCallback skinCallback) {
// check cache
Optional<Skin> s = getSkin(name);
if (s.isPresent()) {
if (skinCallback != null) {
skinCallback.done(s.get());
}
return;
}
// fetch from mineskin
mineskinClient.generateUrl(url, SkinOptions.create(name, Model.DEFAULT, Visibility.PRIVATE), new SkinCallback() {
@Override
public void done(Skin skin) {
loadedSkins.add(skin);
TextureHandler.this.saveSkin(skin);
if (skinCallback != null) {
skinCallback.done(skin);
}
}
@Override
public void error(String errorMessage) {
log.warning("Error while fetching skin " + name + " (" + url + "): " + errorMessage);
}
@Override
public void exception(Exception exception) {
log.log(Level.WARNING, "Error while fetching skin " + name + " (" + url + "): ", exception);
}
});
}
Aggregations