Show Mod info sorted by severity and show client-only mods as OK

This commit is contained in:
Frank 2021-11-06 20:04:52 +01:00
parent a879a82645
commit 8233174487
2 changed files with 15 additions and 11 deletions

View file

@ -88,6 +88,7 @@ public class GridLayout extends GridColumn {
public static final int COLOR_RED = 0xFFDB1F48;
public static final int COLOR_CYAN = 0xFF01949A;
public static final int COLOR_GREEN = 0xFF00FF00;
public static final int COLOR_DARK_GREEN = 0xFF007F00;
public static final int COLOR_YELLOW = 0xFFFAD02C;
public static final int COLOR_BLUE = 0xFF0000FF;
public static final int COLOR_GRAY = 0xFF7F7F7F;

View file

@ -73,13 +73,14 @@ public class ModListScreen extends BCLibScreen {
public static void addModDesc(GridColumn grid, java.util.List<ModUtil.ModInfo> mods, HelloClient.IServerModMap serverInfo, GridScreen parent) {
final int STATE_OK = 0;
final int STATE_MISSING = 1;
final int STATE_SERVER_MISSING = 2;
final int STATE_VERSION = 3;
final int STATE_SERVER_MISSING_CLIENT_MOD = 4;
final int STATE_VERSION_NOT_OFFERED = 5;
final int STATE_MISSING_NOT_OFFERED = 6;
final int STATE_OK = 6;
final int STATE_SERVER_MISSING_CLIENT_MOD = 5;
final int STATE_MISSING_NOT_OFFERED = 4;
final int STATE_VERSION_NOT_OFFERED = 3;
final int STATE_VERSION = 2;
final int STATE_SERVER_MISSING = 1;
final int STATE_MISSING = 0;
List<Triple<String, Integer, String>> items = new LinkedList<>();
if (serverInfo!=null) {
@ -141,7 +142,7 @@ public class ModListScreen extends BCLibScreen {
});
items.stream()
.sorted(Comparator.comparing(a -> a.first.toLowerCase(Locale.ROOT)))
.sorted(Comparator.comparing(a -> a.second + a.first.toLowerCase(Locale.ROOT)))
.forEach(t -> {
final String name = t.first;
final int state = t.second;
@ -160,12 +161,14 @@ public class ModListScreen extends BCLibScreen {
color = GridLayout.COLOR_YELLOW;
}
} else if (state==STATE_SERVER_MISSING || state == STATE_SERVER_MISSING_CLIENT_MOD) {
typeText = "[NOT ON SERVER]";
if (state == STATE_SERVER_MISSING_CLIENT_MOD) {
color = GridLayout.COLOR_YELLOW;
color = GridLayout.COLOR_CYAN;
typeText = "[OK]";
} else {
typeText = "[NOT ON SERVER]";
}
} else {
color = GridLayout.COLOR_CYAN;
color = GridLayout.COLOR_DARK_GREEN;
typeText = "[OK]";
}
TextComponent dash = new TextComponent("-");