13
0

Merge pull request 'Fix some numbering stuff for listing' (#125) from fix_numbering into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #125
Reviewed-by: Chaoscaot <chaoscaot@zohomail.eu>
Dieser Commit ist enthalten in:
Chaoscaot 2022-08-07 18:26:21 +02:00
Commit 0e0c315045

Datei anzeigen

@ -84,19 +84,19 @@ public class SchematicCommand extends SWCommand {
@Register("list") @Register("list")
@Register({"list", "/"}) @Register({"list", "/"})
public void schemList(Player player, @OptionalValue("0") int page) { public void schemList(Player player, @OptionalValue("1") int page) {
renderSchemlist(player, SchematicNode.getSchematicsAccessibleByUser(getUser(player).getId(), 0), page, null, SchematicListBehavior.DEFAULT); renderSchemlist(player, SchematicNode.getSchematicsAccessibleByUser(getUser(player).getId(), 0), Math.max(page - 1, 0), null, SchematicListBehavior.DEFAULT);
} }
@Register({"list", "public"}) @Register({"list", "public"})
public void schemListPublic(Player player, @Mapper("publicDirMapper") SchematicNode node, @OptionalValue("0") int page) { public void schemListPublic(Player player, @Mapper("publicDirMapper") SchematicNode node, @OptionalValue("1") int page) {
schemList(player, node, page); schemList(player, node, page);
} }
@Register({"list", "public"}) @Register({"list", "public"})
@Register({"list", "public", "/"}) @Register({"list", "public", "/"})
public void schemListPublic(Player player, @OptionalValue("0") int page) { public void schemListPublic(Player player, @OptionalValue("1") int page) {
renderSchemlist(player, SchematicNode.getSchematicsAccessibleByUser(0, 0), page, null, SchematicListBehavior.builder().setPublics(true).setPageCommandGen(integer -> "/schem list public " + integer).build()); renderSchemlist(player, SchematicNode.getSchematicsAccessibleByUser(0, 0), Math.max(page - 1, 0), null, SchematicListBehavior.builder().setPublics(true).setPageCommandGen(integer -> "/schem list public " + integer).build());
} }
@ -106,12 +106,12 @@ public class SchematicCommand extends SWCommand {
} }
@Register("list") @Register("list")
public void schemList(Player player, @Mapper("dirMapper") SchematicNode node, @OptionalValue("0") int page) { public void schemList(Player player, @Mapper("dirMapper") SchematicNode node, @OptionalValue("1") int page) {
SteamwarUser user = getUser(player); SteamwarUser user = getUser(player);
if (!node.isDir()) { if (!node.isDir()) {
SchematicSystem.MESSAGE.send("COMMAND_NOT_FOLDER", player); SchematicSystem.MESSAGE.send("COMMAND_NOT_FOLDER", player);
} else { } else {
renderSchemlist(player, SchematicNode.getSchematicNodeInNode(node), page, node, SchematicListBehavior.builder().setPublics(node.getOwner() == 0).setPageCommandGen(value -> "/schem list " + (node.getOwner()==0?"public ":"") + node.generateBreadcrumbs(user) + " " + value).build()); renderSchemlist(player, SchematicNode.getSchematicNodeInNode(node), Math.max(page - 1, 0), node, SchematicListBehavior.builder().setPublics(node.getOwner() == 0).setPageCommandGen(value -> "/schem list " + (node.getOwner()==0?"public ":"") + node.generateBreadcrumbs(user) + " " + value).build());
} }
} }
@ -287,7 +287,7 @@ public class SchematicCommand extends SWCommand {
} }
@Register("search") @Register("search")
public void schemSearch(Player player, @OptionalValue("0") int page, @Mapper("searchMapper") String... query) { public void schemSearch(Player player, @OptionalValue("1") int page, @Mapper("searchMapper") String... query) {
SteamwarUser user = getUser(player); SteamwarUser user = getUser(player);
int userId = user.getId(); int userId = user.getId();
List<Predicate<SchematicNode>> predicates = new ArrayList<>(); List<Predicate<SchematicNode>> predicates = new ArrayList<>();
@ -349,7 +349,7 @@ public class SchematicCommand extends SWCommand {
} }
return true; return true;
}); });
renderSchemlist(player, nodes, page, null, SchematicListBehavior.builder().setPublics(userId == 0).setShowPath(false).setRenderHook(s -> { renderSchemlist(player, nodes, Math.max(page - 1, 0), null, SchematicListBehavior.builder().setPublics(userId == 0).setShowPath(false).setRenderHook(s -> {
for (String ss : nameList) { for (String ss : nameList) {
s = s.replace(ss, "§e§l" + ss + "§7"); s = s.replace(ss, "§e§l" + ss + "§7");
} }