summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeuin <[email protected]>2020-12-29 15:34:22 +0800
committerKeuin <[email protected]>2020-12-29 15:34:22 +0800
commita1e7b4054aefb1c96389057fde69dce898234b18 (patch)
treed7a9dc0bdf348ec0412f7ca546e06a13f8958e7d
parent0e296b04dc926356a5905bdcd844c0f7cb07100c (diff)
1.3.1: improve print of `/blame stat`
-rw-r--r--gradle.properties2
-rw-r--r--src/main/java/com/keuin/blame/command/BlameStatCommand.java18
2 files changed, 11 insertions, 9 deletions
diff --git a/gradle.properties b/gradle.properties
index 6b845f6..aa2141a 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -6,7 +6,7 @@ minecraft_version=1.15.2
yarn_mappings=1.15.2+build.17
loader_version=0.10.8
# Mod Properties
-mod_version=1.3.0-alpha
+mod_version=1.3.1-alpha
maven_group=com.keuin.blame
archives_base_name=blame-fabric
# Dependencies
diff --git a/src/main/java/com/keuin/blame/command/BlameStatCommand.java b/src/main/java/com/keuin/blame/command/BlameStatCommand.java
index 677ea88..fade0a1 100644
--- a/src/main/java/com/keuin/blame/command/BlameStatCommand.java
+++ b/src/main/java/com/keuin/blame/command/BlameStatCommand.java
@@ -1,5 +1,6 @@
package com.keuin.blame.command;
+import com.google.common.base.Strings;
import com.keuin.blame.data.entry.LogEntry;
import com.keuin.blame.data.helper.VersionedLogEntryHelper;
import com.keuin.blame.util.DatabaseUtil;
@@ -21,22 +22,23 @@ public class BlameStatCommand {
private static final Logger logger = Logger.getLogger(BlameStatCommand.class.getName());
public static int showStat(CommandContext<ServerCommandSource> context) {
+ PrintUtil.msgInfo(context, "Collecting statistics. This may take a few seconds...");
showStat(new ShowStatCallback() {
@Override
public void showStat(@Nullable BlameStat stat) {
StringBuilder sb = new StringBuilder();
if (stat != null) {
- sb.append("Data statistics\n");
- sb.append("===============\n");
- sb.append("\n");
+ sb.append("Statistics\n");
+ sb.append("====\n");
sb.append("# Count by subjects\n");
stat.getCountMap().forEach((subjectId, count) -> {
- sb.append(subjectId).append(": ").append(count).append("\n");
+ sb.append("<").append(
+ Optional.ofNullable(Strings.emptyToNull(subjectId)).orElse("null")
+ ).append(">: ").append(count).append("\n");
});
- sb.append("\n");
- sb.append("=== END ===\n");
+ sb.append("=== END ===");
} else {
- sb.append("Failed to get statistics. Please refer to server log for more information.\n");
+ sb.append("Failed to get statistics. Please refer to server log for more information.");
}
PrintUtil.msgInfo(context, sb.toString());
}
@@ -74,7 +76,7 @@ public class BlameStatCommand {
callback.showStat(null);
}
}
- }).start();
+ }, "BlameStatCommandThread").start();
}
public static class BlameStat {