Advertisement
Lokha

Untitled

Dec 13th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. for (World world : Bukkit.getWorlds()) {
  2. System.out.println("Top entity by chunk " + world.getName());
  3. Stream.of(world.getLoadedChunks())
  4. .map(chunk -> new ImmutablePair<>(chunk, Arrays.asList(chunk.getEntities())))
  5. .sorted((o1, o2) -> o2.right.size() - o1.right.size())
  6. .limit(10)
  7. .forEach(pair -> {
  8. String entityData = pair.getRight().stream()
  9. .collect(Collectors.groupingBy(Entity::getType))
  10. .entrySet().stream()
  11. .map(e -> e.getKey().name() + " - " + e.getValue().size())
  12. .collect(Collectors.joining(", "));
  13. System.out.println("chunk " + pair.getLeft().getX() + " " + pair.getLeft().getZ() + ", entity count " + pair.getRight().size() + " (" + entityData + ")");
  14. });
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement