新增数据统计项

This commit is contained in:
zhangyuheng 2024-07-08 16:51:16 +08:00
parent c858332fbd
commit fb1736e0f2
3 changed files with 21 additions and 1 deletions

View File

@ -6,7 +6,7 @@
<groupId>cn.lunadeer</groupId>
<artifactId>Dominion</artifactId>
<version>1.35.8-beta</version>
<version>1.35.9-beta</version>
<packaging>jar</packaging>
<name>Dominion</name>

View File

@ -433,6 +433,22 @@ public class Cache {
return new ArrayList<>(id_dominions.values());
}
public int getDominionCounts() {
return id_dominions.size();
}
public int getMemberCounts() {
int count = 0;
for (Map<Integer, MemberDTO> member : player_uuid_to_member.values()) {
count += member.size();
}
return count;
}
public int getGroupCounts() {
return id_groups.size();
}
public static Cache instance;
private ConcurrentHashMap<Integer, DominionDTO> id_dominions;
private ConcurrentHashMap<String, List<DominionNode>> world_dominion_tree;

View File

@ -1,5 +1,6 @@
package cn.lunadeer.dominion;
import cn.lunadeer.dominion.dtos.PrivilegeTemplateDTO;
import cn.lunadeer.dominion.events.EnvironmentEvents;
import cn.lunadeer.dominion.events.PlayerEvents;
import cn.lunadeer.dominion.events.SelectPointEvents;
@ -46,6 +47,9 @@ public final class Dominion extends JavaPlugin {
bStatsMetrics metrics = new bStatsMetrics(this, 21445);
metrics.addCustomChart(new bStatsMetrics.SimplePie("database", () -> config.getDbType()));
metrics.addCustomChart(new bStatsMetrics.SingleLineChart("dominion_count", () -> Cache.instance.getDominionCounts()));
metrics.addCustomChart(new bStatsMetrics.SingleLineChart("group_count", () -> Cache.instance.getGroupCounts()));
metrics.addCustomChart(new bStatsMetrics.SingleLineChart("member_count", () -> Cache.instance.getMemberCounts()));
if (config.getCheckUpdate()) {
giteaReleaseCheck = new GiteaReleaseCheck(this,