Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (World world : Bukkit.getWorlds()) {
- System.out.println("Top entity by chunk " + world.getName());
- Stream.of(world.getLoadedChunks())
- .map(chunk -> new ImmutablePair<>(chunk, Arrays.asList(chunk.getEntities())))
- .sorted((o1, o2) -> o2.right.size() - o1.right.size())
- .limit(10)
- .forEach(pair -> {
- String entityData = pair.getRight().stream()
- .collect(Collectors.groupingBy(Entity::getType))
- .entrySet().stream()
- .map(e -> e.getKey().name() + " - " + e.getValue().size())
- .collect(Collectors.joining(", "));
- System.out.println("chunk " + pair.getLeft().getX() + " " + pair.getLeft().getZ() + ", entity count " + pair.getRight().size() + " (" + entityData + ")");
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement