Skip to content

Commit

Permalink
新增数据统计项
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdeZhang committed Jul 8, 2024
1 parent c858332 commit fb1736e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/cn/lunadeer/dominion/Cache.java
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,22 @@ public List<DominionDTO> getDominions() {
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;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/cn/lunadeer/dominion/Dominion.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -46,6 +47,9 @@ public void onEnable() {

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,
Expand Down

0 comments on commit fb1736e

Please sign in to comment.