remove unnecessary events pattern and replace it with something more simple
This commit is contained in:
@@ -33,10 +33,10 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
|
||||
import itdelatrisu.opsu.ui.Colors;
|
||||
import org.newdawn.slick.util.Log;
|
||||
import yugecin.opsudance.events.BubNotifListener;
|
||||
|
||||
import static itdelatrisu.opsu.ui.Colors.*;
|
||||
import static yugecin.opsudance.core.InstanceContainer.*;
|
||||
import static yugecin.opsudance.core.errorhandling.ErrorHandler.*;
|
||||
|
||||
/**
|
||||
@@ -220,7 +220,7 @@ public class Download {
|
||||
else if (redirectCount > MAX_REDIRECTS)
|
||||
error = String.format("Download for URL '%s' is attempting too many redirects (over %d).", base.toString(), MAX_REDIRECTS);
|
||||
if (error != null) {
|
||||
BubNotifListener.EVENT.make().onBubNotif(error, Colors.BUB_ORANGE);
|
||||
bubNotifs.send(BUB_ORANGE, error);
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
|
||||
@@ -33,9 +33,8 @@ import java.io.File;
|
||||
import org.newdawn.slick.Color;
|
||||
import org.newdawn.slick.Graphics;
|
||||
import org.newdawn.slick.Image;
|
||||
import yugecin.opsudance.events.BarNotifListener;
|
||||
import yugecin.opsudance.events.BubNotifListener;
|
||||
|
||||
import static itdelatrisu.opsu.ui.Colors.*;
|
||||
import static yugecin.opsudance.core.InstanceContainer.*;
|
||||
import static yugecin.opsudance.options.Options.*;
|
||||
|
||||
@@ -280,14 +279,12 @@ public class DownloadNode {
|
||||
download.setListener(new DownloadListener() {
|
||||
@Override
|
||||
public void completed() {
|
||||
BarNotifListener.EVENT.make().onBarNotif(
|
||||
String.format("Download complete: %s", getTitle()));
|
||||
barNotifs.sendf("Download complete: %s", getTitle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error() {
|
||||
BarNotifListener.EVENT.make().onBarNotif(
|
||||
"Download failed due to a connection error.");
|
||||
barNotifs.send("Download failed due to a connection error.");
|
||||
}
|
||||
});
|
||||
this.download = download;
|
||||
@@ -409,9 +406,10 @@ public class DownloadNode {
|
||||
public void drawDownload(Graphics g, float position, int id, boolean hover) {
|
||||
Download download = this.download; // in case clearDownload() is called asynchronously
|
||||
if (download == null) {
|
||||
BubNotifListener.EVENT.make().onBubNotif(
|
||||
"Trying to draw download information for button without Download object",
|
||||
Colors.BUB_ORANGE);
|
||||
bubNotifs.send(
|
||||
BUB_ORANGE,
|
||||
"Trying to draw download information for button without Download object"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||
import org.newdawn.slick.util.Log;
|
||||
import org.newdawn.slick.util.ResourceLoader;
|
||||
import yugecin.opsudance.core.Constants;
|
||||
import yugecin.opsudance.events.BarNotifListener;
|
||||
|
||||
import static yugecin.opsudance.core.errorhandling.ErrorHandler.*;
|
||||
import static yugecin.opsudance.core.InstanceContainer.*;
|
||||
@@ -241,14 +240,13 @@ public class Updater {
|
||||
@Override
|
||||
public void completed() {
|
||||
status = Status.UPDATE_DOWNLOADED;
|
||||
BarNotifListener.EVENT.make().onBarNotif("Update has finished downloading");
|
||||
barNotifs.send("Update has finished downloading");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error() {
|
||||
status = Status.CONNECTION_ERROR;
|
||||
BarNotifListener.EVENT.make().onBarNotif(
|
||||
"Update failed due to a connection error.");
|
||||
barNotifs.send("Update failed due to a connection error.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user