use of dev.frankheijden.insights.api.concurrent.ScanOptions in project Insights by InsightsPlugin.
the class CommandScan method handleCustomScan.
@CommandMethod("custom <items>")
@CommandPermission("insights.scan.custom")
private void handleCustomScan(Player player, @Argument("radius") @Range(min = "0", max = "256") int radius, @Flag(value = "group-by-chunk", aliases = { "c" }) boolean groupByChunk, @Argument("items") ScanObject<?>[] items) {
List<ScanObject<?>> scanObjects = Arrays.asList(items);
boolean hasOnlyEntities = scanObjects.stream().allMatch(s -> s.getType() == ScanObject.Type.ENTITY);
boolean hasOnlyMaterials = scanObjects.stream().allMatch(s -> s.getType() == ScanObject.Type.MATERIAL);
ScanOptions options;
if (hasOnlyEntities) {
options = ScanOptions.entitiesOnly();
} else if (hasOnlyMaterials) {
options = ScanOptions.materialsOnly();
} else {
options = ScanOptions.scanOnly();
}
handleScan(player, radius, new HashSet<>(scanObjects), options, true, groupByChunk);
}
Aggregations