|
41 | 41 | import java.time.temporal.ChronoUnit;
|
42 | 42 | import java.util.Date;
|
43 | 43 | import java.util.HashMap;
|
| 44 | +import java.util.List; |
44 | 45 | import java.util.Map;
|
45 | 46 | import java.util.StringJoiner;
|
46 | 47 | import java.util.concurrent.Callable;
|
@@ -118,6 +119,27 @@ public Map<String, Object> getDefaults() {
|
118 | 119 | }
|
119 | 120 | }
|
120 | 121 |
|
| 122 | + private int getChunks(){ |
| 123 | + return Bukkit.getWorlds() |
| 124 | + .stream() |
| 125 | + .mapToInt(world -> world.getLoadedChunks().length) |
| 126 | + .sum(); |
| 127 | + } |
| 128 | + |
| 129 | + private int getLivingEntities(){ |
| 130 | + return Bukkit.getWorlds() |
| 131 | + .stream() |
| 132 | + .mapToInt(world -> world.getLivingEntities().size()) |
| 133 | + .sum(); |
| 134 | + } |
| 135 | + |
| 136 | + private Integer getTotalEntities(){ |
| 137 | + return Bukkit.getWorlds() |
| 138 | + .stream() |
| 139 | + .mapToInt(world -> world.getEntities().size()) |
| 140 | + .sum(); |
| 141 | + } |
| 142 | + |
121 | 143 | @Override
|
122 | 144 | public String onRequest(OfflinePlayer p, @NotNull String identifier) {
|
123 | 145 | final int MB = 1048576;
|
@@ -421,31 +443,5 @@ private String getPercent(double tps){
|
421 | 443 |
|
422 | 444 | return (tps > 20.0 ? "*" : "") + finalPercent + "%";
|
423 | 445 | }
|
424 |
| - |
425 |
| - private Integer getChunks(){ |
426 |
| - int loadedChunks = 0; |
427 |
| - for (final World world : Bukkit.getWorlds()) { |
428 |
| - loadedChunks += world.getLoadedChunks().length; |
429 |
| - } |
430 |
| - |
431 |
| - return loadedChunks; |
432 |
| - } |
433 |
| - |
434 |
| - private Integer getLivingEntities(){ |
435 |
| - int livingEntities = 0; |
436 |
| - for (final World world : Bukkit.getWorlds()) { |
437 |
| - livingEntities += world.getLivingEntities().size(); |
438 |
| - } |
439 |
| - |
440 |
| - return livingEntities; |
441 |
| - } |
442 |
| - |
443 |
| - private Integer getTotalEntities(){ |
444 |
| - int allEntities = 0; |
445 |
| - for (World world : Bukkit.getWorlds()) { |
446 |
| - allEntities += world.getEntities().size(); |
447 |
| - } |
448 |
| - |
449 |
| - return allEntities; |
450 |
| - } |
| 446 | + |
451 | 447 | }
|
0 commit comments