diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java index 84d729a..47bfc12 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java @@ -79,7 +79,7 @@ public class SchematicCommand extends SWCommand { @Register("list") @Register({"list", "/"}) public void schemList(Player player, @OptionalValue("0") int page) { - renderSchemlist(player, SchematicNode.getSchematicsAccessibleByUser(getUser(player).getId(), 0), page, "", false, null, s -> s, integer -> "/schem list " + integer); + renderSchemlist(player, SchematicNode.getSchematicsAccessibleByUser(getUser(player).getId(), 0), page, null, SchematicListBehavior.DEFAULT); } @Register({"list", "public"}) @@ -90,7 +90,7 @@ public class SchematicCommand extends SWCommand { @Register({"list", "public"}) @Register({"list", "public", "/"}) public void schemListPublic(Player player, @OptionalValue("0") int page) { - renderSchemlist(player, SchematicNode.getSchematicsAccessibleByUser(0, 0), page, "", true, null, s -> s, integer -> "/schem list public " + integer); + renderSchemlist(player, SchematicNode.getSchematicsAccessibleByUser(0, 0), page, null, SchematicListBehavior.builder().setPublics(true).setPageCommandGen(integer -> "/schem list public " + integer).build()); } @@ -105,7 +105,7 @@ public class SchematicCommand extends SWCommand { if (!node.isDir()) { player.sendMessage(SchematicSystem.PREFIX + "Das ist eine Schematic und kein Ordner"); } else { - renderSchemlist(player, SchematicNode.getSchematicNodeInNode(node), page, node.generateBreadcrumbs(user), node.getOwner() == 0, node, s -> s, integer -> "/schem list " + node.generateBreadcrumbs(user) + " " + integer); + 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()); } } @@ -313,12 +313,12 @@ public class SchematicCommand extends SWCommand { } return true; }); - renderSchemlist(player, nodes, page, "", userId == 0, null, s -> { + renderSchemlist(player, nodes, page, null, SchematicListBehavior.builder().setPublics(userId == 0).setShowPath(false).setRenderHook(s -> { for (String ss : nameList) { s = s.replace(ss, "§e§l" + ss + "§7"); } return "§7" + s; - }, integer -> "/schem search " + integer + " " + Arrays.stream(query).reduce((s, s2) -> s + " " + s2).get()); + }).setPageCommandGen(integer -> "/schem search " + integer + " " + Arrays.stream(query).reduce((s, s2) -> s + " " + s2).orElse("")).build()); } @Register("download") diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java index 334dee6..aa9940c 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java @@ -86,7 +86,6 @@ public class SchematicCommandUtils { int chunk, SchematicNode parent, SchematicListBehavior behavior) { - nodes.sort(Comparator.comparing(SchematicNode::getName)); SteamwarUser user = getUser(player); int pageCount = (int) Math.ceil(nodes.size() / (double) CHUNK_SIZE);