Fix: do not spam the text ui with the same status
This commit is contained in:
@@ -45,6 +45,7 @@ public class GuiText implements Gui {
|
||||
private Log log;
|
||||
private DateFormat df;
|
||||
private String eta;
|
||||
private String statusOld; // buffer to avoid displaying the same info multiple time
|
||||
|
||||
private Client client;
|
||||
private DownloadProgress downloadProgress;
|
||||
@@ -55,6 +56,7 @@ public class GuiText implements Gui {
|
||||
this.log = Log.getInstance(null);
|
||||
this.df = new SimpleDateFormat("MMM dd HH:mm:ss");
|
||||
this.eta = "";
|
||||
this.statusOld = "";
|
||||
}
|
||||
|
||||
@Override public void start() {
|
||||
@@ -115,7 +117,11 @@ public class GuiText implements Gui {
|
||||
}
|
||||
}
|
||||
else {
|
||||
System.out.println(String.format("%s %s", this.df.format(new Date()), msg_));
|
||||
String statusNew = String.format("%s %s", this.df.format(new Date()), msg_);
|
||||
if (statusOld.equals(statusNew) == false) {
|
||||
statusOld = statusNew;
|
||||
System.out.println(statusNew);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user