use of org.terasology.logic.console.commandSystem.annotations.Command in project Terasology by MovingBlocks.
the class ItemCommands method listItems.
@Command(shortDescription = "Lists all available items (prefabs)\nYou can filter by adding the beginning of words " + "after the commands, e.g.: \"listItems engine: core:\" will list all items from the engine and core module", requiredPermission = PermissionManager.CHEAT_PERMISSION)
public String listItems(@CommandParam(value = "startsWith", required = false) String[] startsWith) {
List<String> stringItems = Lists.newArrayList();
for (Prefab prefab : prefabManager.listPrefabs()) {
if (!BlockCommands.uriStartsWithAnyString(prefab.getName(), startsWith)) {
continue;
}
stringItems.add(prefab.getName());
}
Collections.sort(stringItems);
StringBuilder items = new StringBuilder();
for (String item : stringItems) {
if (!items.toString().isEmpty()) {
items.append(Console.NEW_LINE);
}
items.append(item);
}
return items.toString();
}
Aggregations