Skip to content

Commit

Permalink
Make getCustomProgressBar update the title and max for already create…
Browse files Browse the repository at this point in the history
…d bars
  • Loading branch information
Gaming32 committed Sep 18, 2023
1 parent c28c8bc commit 8b17c28
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void close() {
public void setProgress(int progress) {
progress = Math.min(maximum, Math.max(minimum, progress));
checkClosed();
if (progress == this.progress) return;
this.progress = progress;
LoadingScreenApi.customProgressBarOp(id, "progress", Integer.toString(progress));
}
Expand Down Expand Up @@ -96,6 +97,7 @@ public void setMaximum(int maximum) {
throw new IllegalArgumentException("maximum may not be less than minimum");
}
checkClosed();
if (maximum == this.maximum) return;
this.maximum = maximum;
LoadingScreenApi.customProgressBarOp(id, "maximum", Integer.toString(maximum));
}
Expand All @@ -117,6 +119,7 @@ public void setMinimum(int minimum) {
throw new IllegalArgumentException("minimum may not be greater than maximum");
}
checkClosed();
if (minimum == this.minimum) return;
this.minimum = minimum;
LoadingScreenApi.customProgressBarOp(id, "minimum", Integer.toString(minimum));
}
Expand All @@ -135,6 +138,7 @@ public int getMinimum() {
public void setTitle(String title) {
Objects.requireNonNull(title, "title");
checkClosed();
if (title.equals(this.title)) return;
this.title = title;
LoadingScreenApi.customProgressBarOp(id, "title", title);
}
Expand All @@ -152,6 +156,7 @@ public String getTitle() {
*/
public void setIndeterminate(boolean indeterminate) {
checkClosed();
if (indeterminate == this.indeterminate) return;
this.indeterminate = indeterminate;
LoadingScreenApi.customProgressBarOp(id, "indeterminate", Boolean.toString(indeterminate));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ public static CustomProgressBar getCustomProgressBar(@NotNull String id, @NotNul
if (bar == null) {
CUSTOM_PROGRESS_BARS.put(id, bar = createCustomProgressBar(id, title, max));
}
bar.setTitle(title);
bar.setMaximum(max);
return bar;
}

Expand Down

0 comments on commit 8b17c28

Please sign in to comment.