I always forget that runnables exist... It just comes at the cost of self-descriptive names :/

This commit is contained in:
Sollace 2018-07-21 23:45:44 +02:00
parent f1a02fcf90
commit b6d1dcafd0
2 changed files with 3 additions and 16 deletions

View file

@ -1,13 +0,0 @@
package com.voxelmodpack.hdskins;
/**
* Callback for when a skin is loaded.
*
*/
@FunctionalInterface
public interface ISkinAvailableCallback {
/**
* Called when a skin loads.
*/
void skinAvailable();
}

View file

@ -13,9 +13,9 @@ public class ImageBufferDownloadHD implements IImageBuffer {
private Graphics graphics;
private BufferedImage image;
private ISkinAvailableCallback callback;
private Runnable callback;
public ImageBufferDownloadHD withCallback(ISkinAvailableCallback callback) {
public ImageBufferDownloadHD withCallback(Runnable callback) {
this.callback = callback;
return this;
}
@ -71,7 +71,7 @@ public class ImageBufferDownloadHD implements IImageBuffer {
@Override
public void skinAvailable() {
if (callback != null) {
callback.skinAvailable();
callback.run();
}
}
}