Search Pageination #113
@ -79,7 +79,7 @@ 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("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"})
|
@Register({"list", "public"})
|
||||||
@ -90,7 +90,7 @@ public class SchematicCommand extends SWCommand {
|
|||||||
@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("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()) {
|
if (!node.isDir()) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Das ist eine Schematic und kein Ordner");
|
player.sendMessage(SchematicSystem.PREFIX + "Das ist eine Schematic und kein Ordner");
|
||||||
} else {
|
} 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;
|
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) {
|
for (String ss : nameList) {
|
||||||
s = s.replace(ss, "§e§l" + ss + "§7");
|
s = s.replace(ss, "§e§l" + ss + "§7");
|
||||||
}
|
}
|
||||||
return "§7" + s;
|
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")
|
@Register("download")
|
||||||
|
@ -86,7 +86,6 @@ public class SchematicCommandUtils {
|
|||||||
int chunk,
|
int chunk,
|
||||||
SchematicNode parent,
|
SchematicNode parent,
|
||||||
SchematicListBehavior behavior) {
|
SchematicListBehavior behavior) {
|
||||||
nodes.sort(Comparator.comparing(SchematicNode::getName));
|
|
||||||
SteamwarUser user = getUser(player);
|
SteamwarUser user = getUser(player);
|
||||||
int pageCount = (int) Math.ceil(nodes.size() / (double) CHUNK_SIZE);
|
int pageCount = (int) Math.ceil(nodes.size() / (double) CHUNK_SIZE);
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren