mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 00:34:19 +00:00
Keep teal for the Iris tag and even out the splash info
Green success marks, one label style, info aligned to the logo, lowercase web link
This commit is contained in:
1 parent
1c9f62a84c
commit
73b3d4a899
12 files changed
+65
-70
No files matched your search
@@ -411,7 +411,7 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
||||
}
|
||||
|
||||
static void success(String string) {
|
||||
Iris.msg(ChatReport.Tone.SUCCESS.marked(C.IRIS + string));
|
||||
Iris.msg(ChatReport.Tone.SUCCESS.marked(ChatReport.Tone.SUCCESS.consolePaint(string)));
|
||||
}
|
||||
|
||||
static void info(String format, Object... args) {
|
||||
@@ -1563,7 +1563,7 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
||||
boolean eagerInjection = IrisSettings.get().getGeneral().isEagerRuntimeInjection();
|
||||
boolean datapackFromBootstrap = DefaultPackBootstrapProvisioner.wasProvisionedThisStartup();
|
||||
return List.of(
|
||||
List.of(IrisSplashComposer.Detail.key("Packs", IrisSplashComposer.packSummary(packs))),
|
||||
List.of(new IrisSplashComposer.Detail("Packs",IrisSplashComposer.packSummary(packs))),
|
||||
List.of(new IrisSplashComposer.Detail("Custom biomes", String.valueOf(INMS.get().countCustomBiomes()))),
|
||||
List.of(new IrisSplashComposer.Detail("SIMD", SimdSupport.shortStatus()),
|
||||
new IrisSplashComposer.Detail("Datapack", datapackFromBootstrap ? "bootstrap" : "startup install"),
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public final class IrisSplashComposer {
|
||||
private static final String SPLASH_PADDING = " ".repeat(4);
|
||||
private static final int FIRST_SPARE_INFO_ROW = 8;
|
||||
private static final int FIRST_SPARE_INFO_ROW = 7;
|
||||
private static final int SPARE_INFO_ROWS = 3;
|
||||
private static final int PACKS_SHOWN = 6;
|
||||
private static final int SHORT_COMMIT_LENGTH = 7;
|
||||
@@ -60,8 +60,7 @@ public final class IrisSplashComposer {
|
||||
String label = styled.isEmpty()
|
||||
? " " + padRight(detail.label(), LABEL_WIDTH)
|
||||
: FACT_GAP + detail.label() + " ";
|
||||
styled.append(detail.key() ? style.label(label) : style.quietLabel(label))
|
||||
.append(detail.key() ? style.value(detail.value()) : style.quietValue(detail.value()));
|
||||
styled.append(style.label(label)).append(style.value(detail.value()));
|
||||
}
|
||||
return styled.toString();
|
||||
}
|
||||
@@ -80,14 +79,14 @@ public final class IrisSplashComposer {
|
||||
String prefix = style.linePrefix();
|
||||
String java = javaVersion() < 0 ? "unknown" : String.valueOf(javaVersion());
|
||||
return new String[]{
|
||||
"",
|
||||
prefix + style.title(" Iris, ") + style.subtitle("Dimension Engine ") + style.tag("[" + releaseTrain + "]"),
|
||||
prefix + styledRow(List.of(Detail.key("Version", version)), style),
|
||||
prefix + styledRow(List.of(new Detail("Version", version)), style),
|
||||
prefix + styledRow(List.of(new Detail("By", "Volmit Software (Arcane Arts)")), style),
|
||||
prefix + styledRow(List.of(new Detail("Web", "VolmitSoftware.com")), style),
|
||||
prefix + styledRow(List.of(Detail.key("Server", serverLine)), style),
|
||||
prefix + styledRow(List.of(new Detail("Web", "volmitsoftware.com")), style),
|
||||
prefix + styledRow(List.of(new Detail("Server", serverLine)), style),
|
||||
prefix + styledRow(List.of(new Detail("Java", java), new Detail("Date", startupDate())), style),
|
||||
prefix + styledRow(List.of(Detail.key("Commit", shortCommit() + "/" + BuildConstants.ENVIRONMENT)), style),
|
||||
prefix + styledRow(List.of(new Detail("Commit", shortCommit() + "/" + BuildConstants.ENVIRONMENT)), style),
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
@@ -158,15 +157,7 @@ public final class IrisSplashComposer {
|
||||
return LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE);
|
||||
}
|
||||
|
||||
/** One labelled fact; a key fact is what support reads first and keeps the accent color, the rest are dimmed. */
|
||||
public record Detail(String label, String value, boolean key) {
|
||||
public Detail(String label, String value) {
|
||||
this(label, value, false);
|
||||
}
|
||||
|
||||
public static Detail key(String label, String value) {
|
||||
return new Detail(label, value, true);
|
||||
}
|
||||
public record Detail(String label, String value) {
|
||||
}
|
||||
|
||||
public interface InfoStyle {
|
||||
@@ -196,13 +187,5 @@ public final class IrisSplashComposer {
|
||||
default String value(String text) {
|
||||
return text;
|
||||
}
|
||||
|
||||
default String quietLabel(String text) {
|
||||
return label(text);
|
||||
}
|
||||
|
||||
default String quietValue(String text) {
|
||||
return value(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,17 +16,23 @@ public final class ChatReport {
|
||||
private static final int CONSOLE_LABEL_WIDTH = 16;
|
||||
private static final Pattern LEGACY_COLOR = Pattern.compile("(?i)[§&][0-9A-FK-ORX]");
|
||||
|
||||
/**
|
||||
* Chat wears the Iris color for success; the console keeps it for the Iris tag and splash, so it stays special there.
|
||||
* Console success is DARK_GREEN because GREEN shares legacy code 'a' with IRIS and renders as Iris teal.
|
||||
*/
|
||||
public enum Tone {
|
||||
SUCCESS(C.IRIS, ConsoleGlyphs.CHECK),
|
||||
INFO(C.AQUA, ""),
|
||||
WARNING(C.GOLD, ConsoleGlyphs.WARNING),
|
||||
ERROR(C.RED, ConsoleGlyphs.CROSS);
|
||||
SUCCESS(C.IRIS, C.DARK_GREEN, ConsoleGlyphs.CHECK),
|
||||
INFO(C.AQUA, C.AQUA, ""),
|
||||
WARNING(C.GOLD, C.GOLD, ConsoleGlyphs.WARNING),
|
||||
ERROR(C.RED, C.RED, ConsoleGlyphs.CROSS);
|
||||
|
||||
private final C color;
|
||||
private final C consoleColor;
|
||||
private final String mark;
|
||||
|
||||
Tone(C color, String mark) {
|
||||
Tone(C color, C consoleColor, String mark) {
|
||||
this.color = color;
|
||||
this.consoleColor = consoleColor;
|
||||
this.mark = mark;
|
||||
}
|
||||
|
||||
@@ -35,7 +41,15 @@ public final class ChatReport {
|
||||
if (!hasMark()) {
|
||||
return ConsoleLayout.row(styledText);
|
||||
}
|
||||
return color + mark + " " + styledText;
|
||||
return consoleColor + mark + " " + styledText;
|
||||
}
|
||||
|
||||
public C consoleColor() {
|
||||
return consoleColor;
|
||||
}
|
||||
|
||||
public String consolePaint(String text) {
|
||||
return consoleColor + clean(text);
|
||||
}
|
||||
|
||||
public boolean hasMark() {
|
||||
@@ -95,9 +109,9 @@ public final class ChatReport {
|
||||
private List<String> labelRow() {
|
||||
if (label.length() < CONSOLE_LABEL_WIDTH) {
|
||||
String padding = " ".repeat(CONSOLE_LABEL_WIDTH - label.length());
|
||||
return List.of(C.GRAY + label + padding + C.IRIS + value);
|
||||
return List.of(C.GRAY + label + padding + C.WHITE + value);
|
||||
}
|
||||
return List.of(C.GRAY + label, " ".repeat(CONSOLE_LABEL_WIDTH) + C.IRIS + value);
|
||||
return List.of(C.GRAY + label, " ".repeat(CONSOLE_LABEL_WIDTH) + C.WHITE + value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +216,7 @@ public final class ChatReport {
|
||||
*/
|
||||
public List<String> consoleLines() {
|
||||
List<String> lines = new ArrayList<>();
|
||||
lines.add(tone.marked(ReportText.title(tone, clean(title))));
|
||||
lines.add(tone.marked(ReportText.title(tone.consoleColor(), clean(title))));
|
||||
List<List<String>> branches = consoleBranches();
|
||||
for (int index = 0; index < branches.size(); index++) {
|
||||
addBranchLines(lines, branches.get(index), index == branches.size() - 1);
|
||||
@@ -231,9 +245,9 @@ public final class ChatReport {
|
||||
private void addBranchLines(List<String> lines, List<String> branch, boolean last) {
|
||||
String connector = last ? ConsoleGlyphs.LAST_BRANCH : ConsoleGlyphs.BRANCH;
|
||||
String trunk = last ? " " : ConsoleGlyphs.BAR;
|
||||
lines.add(tone.color() + connector + " " + C.GRAY + branch.getFirst());
|
||||
lines.add(tone.consoleColor() + connector + " " + C.GRAY + branch.getFirst());
|
||||
for (int index = 1; index < branch.size(); index++) {
|
||||
lines.add(tone.color() + trunk + " " + C.GRAY + branch.get(index));
|
||||
lines.add(tone.consoleColor() + trunk + " " + C.GRAY + branch.get(index));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,7 +267,7 @@ public final class ChatReport {
|
||||
/** An instruction ending in a colon, then the exact command on its own line so it copies as is. */
|
||||
private static List<String> nextStepBranch(String instruction, String command) {
|
||||
String trimmed = instruction.strip();
|
||||
String commandLine = CONSOLE_COMMAND_INDENT + C.IRIS + command;
|
||||
String commandLine = CONSOLE_COMMAND_INDENT + C.AQUA + command;
|
||||
if (trimmed.isEmpty()) {
|
||||
return List.of(commandLine);
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ public final class ConsoleGlyphs {
|
||||
public static final String BAR = "\u2502";
|
||||
public static final String BRANCH = "\u251c";
|
||||
public static final String LAST_BRANCH = "\u2514";
|
||||
public static final String CHECK = "\u2713";
|
||||
public static final String WARNING = "!";
|
||||
public static final String CROSS = "\u2717";
|
||||
public static final String CHECK = "\u2714";
|
||||
public static final String WARNING = "\u25b2";
|
||||
public static final String CROSS = "\u2716";
|
||||
public static final String ELLIPSIS = "\u2026";
|
||||
|
||||
private static final Map<String, String> ASCII_FALLBACKS = asciiFallbacks();
|
||||
@@ -57,6 +57,7 @@ public final class ConsoleGlyphs {
|
||||
fallbacks.put(BRANCH, "|");
|
||||
fallbacks.put(LAST_BRANCH, "`");
|
||||
fallbacks.put(CHECK, "+");
|
||||
fallbacks.put(WARNING, "!");
|
||||
fallbacks.put(CROSS, "x");
|
||||
fallbacks.put(ELLIPSIS, "...");
|
||||
fallbacks.put("\u2039", "[");
|
||||
|
||||
@@ -31,7 +31,11 @@ final class ReportText {
|
||||
}
|
||||
|
||||
static String title(ChatReport.Tone tone, String plain) {
|
||||
String base = tone.color().toString();
|
||||
return title(tone.color(), plain);
|
||||
}
|
||||
|
||||
static String title(C color, String plain) {
|
||||
String base = color.toString();
|
||||
return base + highlightQuoted(plain, C.WHITE.toString(), base);
|
||||
}
|
||||
|
||||
|
||||
@@ -325,7 +325,7 @@ public class VolmitSender implements CommandSender {
|
||||
}
|
||||
|
||||
private void sendToned(ChatReport.Tone tone, String message) {
|
||||
sendMessage(isPlayer() ? tone.paint(message) : tone.marked(tone.paint(message)));
|
||||
sendMessage(isPlayer() ? tone.paint(message) : tone.marked(tone.consolePaint(message)));
|
||||
}
|
||||
|
||||
public void sendReport(ChatReport report) {
|
||||
|
||||
@@ -127,7 +127,7 @@ public final class IrisSafeguard {
|
||||
|
||||
public static void printFooter() {
|
||||
switch (mode) {
|
||||
case STABLE -> IrisLogging.info(ChatReport.Tone.SUCCESS.marked(ChatReport.Tone.SUCCESS.paint("Stable, no conflicts")));
|
||||
case STABLE -> IrisLogging.info(ChatReport.Tone.SUCCESS.marked(ChatReport.Tone.SUCCESS.consolePaint("Stable, no conflicts")));
|
||||
case WARNING -> warning();
|
||||
case UNSTABLE -> unstable();
|
||||
}
|
||||
|
||||
@@ -63,12 +63,12 @@ public enum Mode {
|
||||
|
||||
@Override
|
||||
public String title(String text) {
|
||||
return color + text;
|
||||
return color.toString() + C.BOLD + text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String subtitle(String text) {
|
||||
return C.WHITE + text;
|
||||
return C.WHITE.toString() + C.BOLD + text;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -83,17 +83,7 @@ public enum Mode {
|
||||
|
||||
@Override
|
||||
public String value(String text) {
|
||||
return color + text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String quietLabel(String text) {
|
||||
return C.DARK_GRAY + text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String quietValue(String text) {
|
||||
return C.GRAY + text;
|
||||
return C.WHITE + text;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -35,15 +35,16 @@ public class IrisSplashComposerTest {
|
||||
new IrisSplashComposer.Detail("Injection", "deferred"))));
|
||||
|
||||
assertEquals(11, info.length);
|
||||
assertEquals(" SIMD 256-bit Injection deferred", info[8]);
|
||||
assertEquals(" SIMD 256-bit Injection deferred", info[7]);
|
||||
assertEquals("", info[10]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void composeInfoUsesCurrentVersionWithoutStaleReleaseTag() {
|
||||
String[] info = IrisSplashComposer.composeInfo("4.0.0-26.2", "Paper 26.2", IrisSplashComposer.InfoStyle.PLAIN);
|
||||
|
||||
assertEquals(" Iris, Dimension Engine [4.0]", info[1]);
|
||||
assertEquals(" Version 4.0.0-26.2", info[2]);
|
||||
assertEquals(" Iris, Dimension Engine [4.0]", info[0]);
|
||||
assertEquals(" Version 4.0.0-26.2", info[1]);
|
||||
assertFalse(String.join("\n", info).contains("RC.1.1.6"));
|
||||
}
|
||||
|
||||
@@ -52,8 +53,8 @@ public class IrisSplashComposerTest {
|
||||
String[] info = IrisSplashComposer.composeInfo("4.0.0-26.2", "Paper 26.2", IrisSplashComposer.InfoStyle.PLAIN);
|
||||
|
||||
assertEquals(11, info.length);
|
||||
assertEquals(" By Volmit Software (Arcane Arts)", info[3]);
|
||||
assertEquals(" Web VolmitSoftware.com", info[4]);
|
||||
assertEquals(" Server Paper 26.2", info[5]);
|
||||
assertEquals(" By Volmit Software (Arcane Arts)", info[2]);
|
||||
assertEquals(" Web volmitsoftware.com", info[3]);
|
||||
assertEquals(" Server Paper 26.2", info[4]);
|
||||
}
|
||||
}
|
||||
@@ -197,12 +197,12 @@ public class ChatReportTest {
|
||||
.hint("The console has the full refusal notice", null)
|
||||
.build());
|
||||
|
||||
assertEquals(List.of("! Regen is running", ConsoleGlyphs.LAST_BRANCH + " The console has the full refusal notice"), console);
|
||||
assertEquals(List.of(ConsoleGlyphs.WARNING + " Regen is running", ConsoleGlyphs.LAST_BRANCH + " The console has the full refusal notice"), console);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void logLinesWithoutAGutterGetTheirTonesMark() {
|
||||
assertEquals("! Default pack is missing",
|
||||
assertEquals(ConsoleGlyphs.WARNING + " Default pack is missing",
|
||||
ConsoleLayout.onGutter(ChatReport.Tone.WARNING, "Default pack is missing").replaceAll("§.", ""));
|
||||
assertEquals(" Loading packs",
|
||||
ConsoleLayout.onGutter(ChatReport.Tone.INFO, "Loading packs").replaceAll("§.", ""));
|
||||
|
||||
@@ -22,9 +22,11 @@ public class ConsoleGlyphsTest {
|
||||
@Test
|
||||
public void asciiConsoleGetsAsciiGlyphsThatKeepTheGutterWidth() {
|
||||
String gutter = ConsoleGlyphs.CROSS + " failed\n" + ConsoleGlyphs.BRANCH + " item\n" + ConsoleGlyphs.BAR + " more\n"
|
||||
+ ConsoleGlyphs.LAST_BRANCH + " Loading" + ConsoleGlyphs.ELLIPSIS + "\n" + ConsoleGlyphs.CHECK + " done";
|
||||
+ ConsoleGlyphs.LAST_BRANCH + " Loading" + ConsoleGlyphs.ELLIPSIS + "\n" + ConsoleGlyphs.CHECK + " done\n"
|
||||
+ ConsoleGlyphs.WARNING + " careful";
|
||||
|
||||
assertEquals("x failed\n| item\n| more\n` Loading...\n+ done", ConsoleGlyphs.forCharset(StandardCharsets.US_ASCII).fit(gutter));
|
||||
assertEquals("x failed\n| item\n| more\n` Loading...\n+ done\n! careful",
|
||||
ConsoleGlyphs.forCharset(StandardCharsets.US_ASCII).fit(gutter));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -42,7 +42,7 @@ public class UnknownFieldReportTest {
|
||||
List<String> lines = plain(UnknownFieldReport.drainReports());
|
||||
|
||||
assertEquals(List.of(
|
||||
"! Pack 'cavetest' has 1 unknown field. Iris ignores it.",
|
||||
"▲ Pack 'cavetest' has 1 unknown field. Iris ignores it.",
|
||||
"└ Biome 'caves' 1 file biomes/carving/volcanic.json:144"
|
||||
), lines);
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class UnknownFieldReportTest {
|
||||
List<String> lines = plain(UnknownFieldReport.drainReports());
|
||||
|
||||
assertEquals(List.of(
|
||||
"! Pack 'cavetest' has 2 unknown fields. Iris ignores them.",
|
||||
"▲ Pack 'cavetest' has 2 unknown fields. Iris ignores them.",
|
||||
"├ Biome 'caves' 3 files e.g. biomes/carving/deep-ravine.json:157",
|
||||
"└ Dimension 'caves' 1 file dimensions/cavetest.json:856"
|
||||
), lines);
|
||||
|
||||
Reference in new issue
Block a user