diff --git a/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/filter/NationPlaceholders.java b/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/filter/NationPlaceholders.java index d2da0d80..2fc14e64 100644 --- a/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/filter/NationPlaceholders.java +++ b/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/filter/NationPlaceholders.java @@ -68,6 +68,26 @@ public String getName(DBNation o) { return o.getName(); } + @Override + public Set deserializeSelection(ValueStore store, String input) { + Set superSet = super.deserializeSelection(store, input); + List> sortCriteria = List.of( + n -> (double) n.getAlliance_id(), + n -> (double) n.getCities(), + n -> (double) n.getId() + ); + return superSet.stream().sorted((n1, n2) -> { + for (Function criteria : sortCriteria) { + double val1 = criteria.apply(n1); + double val2 = criteria.apply(n2); + if (val1 != val2) { + return Double.compare(val1, val2); + } + } + return 0; + }).collect(Collectors.toCollection(LinkedHashSet::new)); + } + @NoFormat @Command(desc = "Add an alias for a selection of Nations") @RolePermission(value = {Roles.INTERNAL_AFFAIRS_STAFF, Roles.MILCOM, Roles.ECON_STAFF, Roles.FOREIGN_AFFAIRS_STAFF, Roles.ECON, Roles.FOREIGN_AFFAIRS}, any = true) diff --git a/src/main/java/link/locutus/discord/util/task/ia/IACheckup.java b/src/main/java/link/locutus/discord/util/task/ia/IACheckup.java index 8a4c411e..5bb9dfc0 100644 --- a/src/main/java/link/locutus/discord/util/task/ia/IACheckup.java +++ b/src/main/java/link/locutus/discord/util/task/ia/IACheckup.java @@ -857,7 +857,12 @@ public static Map.Entry checkProductionBonus(DBNation nation, Ma } private Map.Entry checkBuyRpc(GuildDB db, DBNation nation, Map cities) { - if (nation.getCities() > Projects.ACTIVITY_CENTER.maxCities()) return null; + if (nation.getCities() > Projects.ACTIVITY_CENTER.maxCities()) { + if (nation.hasProject(Projects.ACTIVITY_CENTER)) { + return Map.entry("-1", "Go to the projects tab and sell activity center"); + } + return null; + } if (nation.getProjectTurns() > 0 || nation.getFreeProjectSlots() <= 0) return null; return new AbstractMap.SimpleEntry<>("1", "Go to the projects tab and buy the Activity Center"); }