mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-12-01 02:04:51 +00:00
Make version, server and packs stand out in the splash info
This commit is contained in:
1 parent
3048f6e2bf
commit
aa78a380fd
4 files changed
+39
-5
No files matched your search
@@ -1563,7 +1563,7 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
|||||||
boolean eagerInjection = IrisSettings.get().getGeneral().isEagerRuntimeInjection();
|
boolean eagerInjection = IrisSettings.get().getGeneral().isEagerRuntimeInjection();
|
||||||
boolean datapackFromBootstrap = DefaultPackBootstrapProvisioner.wasProvisionedThisStartup();
|
boolean datapackFromBootstrap = DefaultPackBootstrapProvisioner.wasProvisionedThisStartup();
|
||||||
return List.of(
|
return List.of(
|
||||||
List.of(new IrisSplashComposer.Detail("Packs",IrisSplashComposer.packSummary(packs))),
|
List.of(IrisSplashComposer.Detail.headline("Packs", IrisSplashComposer.packSummary(packs))),
|
||||||
List.of(new IrisSplashComposer.Detail("Custom biomes", String.valueOf(INMS.get().countCustomBiomes()))),
|
List.of(new IrisSplashComposer.Detail("Custom biomes", String.valueOf(INMS.get().countCustomBiomes()))),
|
||||||
List.of(new IrisSplashComposer.Detail("SIMD", SimdSupport.shortStatus()),
|
List.of(new IrisSplashComposer.Detail("SIMD", SimdSupport.shortStatus()),
|
||||||
new IrisSplashComposer.Detail("Datapack", datapackFromBootstrap ? "bootstrap" : "startup install"),
|
new IrisSplashComposer.Detail("Datapack", datapackFromBootstrap ? "bootstrap" : "startup install"),
|
||||||
|
|||||||
@@ -60,7 +60,8 @@ public final class IrisSplashComposer {
|
|||||||
String label = styled.isEmpty()
|
String label = styled.isEmpty()
|
||||||
? " " + padRight(detail.label(), LABEL_WIDTH)
|
? " " + padRight(detail.label(), LABEL_WIDTH)
|
||||||
: FACT_GAP + detail.label() + " ";
|
: FACT_GAP + detail.label() + " ";
|
||||||
styled.append(style.label(label)).append(style.value(detail.value()));
|
styled.append(style.label(label))
|
||||||
|
.append(detail.headline() ? style.headlineValue(detail.value()) : style.value(detail.value()));
|
||||||
}
|
}
|
||||||
return styled.toString();
|
return styled.toString();
|
||||||
}
|
}
|
||||||
@@ -80,10 +81,10 @@ public final class IrisSplashComposer {
|
|||||||
String java = javaVersion() < 0 ? "unknown" : String.valueOf(javaVersion());
|
String java = javaVersion() < 0 ? "unknown" : String.valueOf(javaVersion());
|
||||||
return new String[]{
|
return new String[]{
|
||||||
prefix + style.title(" Iris, ") + style.subtitle("Dimension Engine ") + style.tag("[" + releaseTrain + "]"),
|
prefix + style.title(" Iris, ") + style.subtitle("Dimension Engine ") + style.tag("[" + releaseTrain + "]"),
|
||||||
prefix + styledRow(List.of(new Detail("Version", version)), style),
|
prefix + styledRow(List.of(Detail.headline("Version", version)), style),
|
||||||
prefix + styledRow(List.of(new Detail("By", "Volmit Software (Arcane Arts)")), 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(new Detail("Web", "volmitsoftware.com")), style),
|
||||||
prefix + styledRow(List.of(new Detail("Server", serverLine)), style),
|
prefix + styledRow(List.of(Detail.headline("Server", serverLine)), style),
|
||||||
prefix + styledRow(List.of(new Detail("Java", java), new Detail("Date", startupDate())), style),
|
prefix + styledRow(List.of(new Detail("Java", java), new Detail("Date", startupDate())), style),
|
||||||
prefix + styledRow(List.of(new Detail("Commit", shortCommit() + "/" + BuildConstants.ENVIRONMENT)), style),
|
prefix + styledRow(List.of(new Detail("Commit", shortCommit() + "/" + BuildConstants.ENVIRONMENT)), style),
|
||||||
"",
|
"",
|
||||||
@@ -157,7 +158,15 @@ public final class IrisSplashComposer {
|
|||||||
return LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE);
|
return LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public record Detail(String label, String value) {
|
/** A headline fact is what support asks for first, so its value stands out from the rest. */
|
||||||
|
public record Detail(String label, String value, boolean headline) {
|
||||||
|
public Detail(String label, String value) {
|
||||||
|
this(label, value, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Detail headline(String label, String value) {
|
||||||
|
return new Detail(label, value, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface InfoStyle {
|
public interface InfoStyle {
|
||||||
@@ -187,5 +196,9 @@ public final class IrisSplashComposer {
|
|||||||
default String value(String text) {
|
default String value(String text) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default String headlineValue(String text) {
|
||||||
|
return value(text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,6 +85,11 @@ public enum Mode {
|
|||||||
public String value(String text) {
|
public String value(String text) {
|
||||||
return C.GRAY + text;
|
return C.GRAY + text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String headlineValue(String text) {
|
||||||
|
return C.WHITE + text;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,22 @@ public class IrisSplashComposerTest {
|
|||||||
assertFalse(String.join("\n", info).contains("RC.1.1.6"));
|
assertFalse(String.join("\n", info).contains("RC.1.1.6"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onlyHeadlineFactsGetTheHeadlineValueStyle() {
|
||||||
|
IrisSplashComposer.InfoStyle marksHeadlines = new IrisSplashComposer.InfoStyle() {
|
||||||
|
@Override
|
||||||
|
public String headlineValue(String text) {
|
||||||
|
return "*" + text;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
String[] info = IrisSplashComposer.composeInfo("4.0.0-26.2", "Paper 26.2", marksHeadlines);
|
||||||
|
|
||||||
|
assertEquals(" Version *4.0.0-26.2", info[1]);
|
||||||
|
assertEquals(" Web volmitsoftware.com", info[3]);
|
||||||
|
assertEquals(" Server *Paper 26.2", info[4]);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void composeInfoShowsWebsiteAndKeepsSplashHeight() {
|
public void composeInfoShowsWebsiteAndKeepsSplashHeight() {
|
||||||
String[] info = IrisSplashComposer.composeInfo("4.0.0-26.2", "Paper 26.2", IrisSplashComposer.InfoStyle.PLAIN);
|
String[] info = IrisSplashComposer.composeInfo("4.0.0-26.2", "Paper 26.2", IrisSplashComposer.InfoStyle.PLAIN);
|
||||||
|
|||||||
Reference in new issue
Block a user