aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2022-01-28 18:23:43 +0000
committerLuck <git@lucko.me>2022-01-28 18:23:51 +0000
commitef490d2c00af0c8d549c111654619ee57b1b9d87 (patch)
treea322acbcd970389ed179e8f86152b7e689046bc1
parent30467640d901dbab0a5a580cfbd8a2ccc0d0a475 (diff)
downloadspark-ef490d2c00af0c8d549c111654619ee57b1b9d87.tar.gz
spark-ef490d2c00af0c8d549c111654619ee57b1b9d87.tar.bz2
spark-ef490d2c00af0c8d549c111654619ee57b1b9d87.zip
Change textual diagram characters
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/util/StatisticFormatter.java27
1 files changed, 14 insertions, 13 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/common/util/StatisticFormatter.java b/spark-common/src/main/java/me/lucko/spark/common/util/StatisticFormatter.java
index 9a2850e..24e49fa 100644
--- a/spark-common/src/main/java/me/lucko/spark/common/util/StatisticFormatter.java
+++ b/spark-common/src/main/java/me/lucko/spark/common/util/StatisticFormatter.java
@@ -38,7 +38,8 @@ import static net.kyori.adventure.text.format.NamedTextColor.YELLOW;
public enum StatisticFormatter {
;
- private static final String BAR_CHARACTER = "|";
+ private static final String BAR_TRUE_CHARACTER = "┃";
+ private static final String BAR_FALSE_CHARACTER = "╻";
public static TextComponent formatTps(double tps) {
TextColor color;
@@ -124,13 +125,13 @@ public enum StatisticFormatter {
int usedChars = (int) ((used * length) / max);
int committedChars = (int) ((committed * length) / max);
- TextComponent.Builder line = text().content(Strings.repeat(BAR_CHARACTER, usedChars)).color(YELLOW);
+ TextComponent.Builder line = text().content(Strings.repeat(BAR_TRUE_CHARACTER, usedChars)).color(YELLOW);
if (committedChars > usedChars) {
- line.append(text(Strings.repeat(BAR_CHARACTER, (committedChars - usedChars) - 1), GRAY));
- line.append(Component.text(BAR_CHARACTER, RED));
+ line.append(text(Strings.repeat(BAR_FALSE_CHARACTER, (committedChars - usedChars) - 1), GRAY));
+ line.append(Component.text(BAR_FALSE_CHARACTER, RED));
}
if (length > committedChars) {
- line.append(text(Strings.repeat(BAR_CHARACTER, (length - committedChars)), GRAY));
+ line.append(text(Strings.repeat(BAR_FALSE_CHARACTER, (length - committedChars)), GRAY));
}
return text()
@@ -153,18 +154,18 @@ public enum StatisticFormatter {
int collectionUsedChars = (int) ((collectionUsed * length) / max);
int committedChars = (int) ((committed * length) / max);
- TextComponent.Builder line = text().content(Strings.repeat(BAR_CHARACTER, collectionUsedChars)).color(YELLOW);
+ TextComponent.Builder line = text().content(Strings.repeat(BAR_TRUE_CHARACTER, collectionUsedChars)).color(YELLOW);
if (usedChars > collectionUsedChars) {
- line.append(Component.text(BAR_CHARACTER, RED));
- line.append(text(Strings.repeat(BAR_CHARACTER, (usedChars - collectionUsedChars) - 1), YELLOW));
+ line.append(Component.text(BAR_TRUE_CHARACTER, RED));
+ line.append(text(Strings.repeat(BAR_TRUE_CHARACTER, (usedChars - collectionUsedChars) - 1), YELLOW));
}
if (committedChars > usedChars) {
- line.append(text(Strings.repeat(BAR_CHARACTER, (committedChars - usedChars) - 1), GRAY));
- line.append(Component.text(BAR_CHARACTER, YELLOW));
+ line.append(text(Strings.repeat(BAR_FALSE_CHARACTER, (committedChars - usedChars) - 1), GRAY));
+ line.append(Component.text(BAR_FALSE_CHARACTER, YELLOW));
}
if (length > committedChars) {
- line.append(text(Strings.repeat(BAR_CHARACTER, (length - committedChars)), GRAY));
+ line.append(text(Strings.repeat(BAR_FALSE_CHARACTER, (length - committedChars)), GRAY));
}
return text()
@@ -179,8 +180,8 @@ public enum StatisticFormatter {
int freeChars = length - usedChars;
return text()
.append(text("[", DARK_GRAY))
- .append(text(Strings.repeat(BAR_CHARACTER, usedChars), YELLOW))
- .append(text(Strings.repeat(BAR_CHARACTER, freeChars), GRAY))
+ .append(text(Strings.repeat(BAR_TRUE_CHARACTER, usedChars), YELLOW))
+ .append(text(Strings.repeat(BAR_FALSE_CHARACTER, freeChars), GRAY))
.append(text("]", DARK_GRAY))
.build();
}