Skip to content
This repository was archived by the owner on Dec 30, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ public CategoryListWidget(MinecraftClient client, int width, int height, int top
public void init() {
try {
this.categories = new ArrayList<>();
this.addEntry(new CategoryListEntry(this, new Category(
"updatable",
new TranslatableText("modmanager.categories.updatable")
)));
if (ModManager.getUpdateChecker().updatesAvailable()) {
this.addEntry(new CategoryListEntry(this, new Category(
"updatable",
new TranslatableText("modmanager.categories.updatable")
)));
}
ModManager.getModProvider().getCategories().forEach(category -> this.addEntry(new CategoryListEntry(this, category)));
if (parent.getEntry(this) != null) {
setSelected(parent.getEntry(this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

public class UpdateCheckService extends Thread {

Expand Down Expand Up @@ -115,6 +116,10 @@ public boolean updatesAvailable() {
return !this.updates.isEmpty();
}

public void removeUpdate(String modId) {
this.updates.removeIf(update -> Objects.equals(update.modId, modId));
}

@Nullable
public ModVersion getUpdate(SummarizedMod mod) {
for (AvailableUpdates update : this.updates) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ protected void execute() throws Exception {
Files.delete(jar);
InstallationUtil.downloadMod(http, InstallationUtil.getVersionForMod(subject));
ModManager.getModManipulationManager().markManuallyUpdated(subject);
ModManager.getUpdateChecker().removeUpdate(subject.id());
}
}