Make separate metrics for players in different worlds
This commit is contained in:
parent
a4c4b144f8
commit
0961890d47
1 changed files with 5 additions and 2 deletions
|
@ -1,14 +1,17 @@
|
||||||
package ru.ruscalworld.fabricexporter.metrics;
|
package ru.ruscalworld.fabricexporter.metrics;
|
||||||
|
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import ru.ruscalworld.fabricexporter.FabricExporter;
|
import ru.ruscalworld.fabricexporter.FabricExporter;
|
||||||
|
|
||||||
public class OnlinePlayers extends Metric {
|
public class OnlinePlayers extends Metric {
|
||||||
public OnlinePlayers() {
|
public OnlinePlayers() {
|
||||||
super("players_online", "Amount of currently online players on the server");
|
super("players_online", "Amount of currently online players on the server", "world");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(FabricExporter exporter) {
|
public void update(FabricExporter exporter) {
|
||||||
this.getGauge().set(exporter.getServer().getCurrentPlayerCount());
|
for (ServerWorld world : exporter.getServer().getWorlds()) {
|
||||||
|
this.getGauge().labels(world.getRegistryKey().getValue().getPath()).set(world.getPlayers().size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue