forked from MoSadie/SimpleMainMenu-Lib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSplashText.java
More file actions
35 lines (29 loc) · 914 Bytes
/
SplashText.java
File metadata and controls
35 lines (29 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.mosadie.servermainmenu.api;
import net.minecraft.text.Text;
import java.util.ArrayList;
import java.util.List;
public record SplashText(Text[] lines) {
public static Builder builder(Text text) {
return builder().addLine(text);
}
public static Builder builder(String text) {
return builder().addLine(text);
}
public static Builder builder() {
return new Builder();
}
public static final class Builder {
private final List<Text> lines = new ArrayList<>();
public Builder addLine(Text text) {
lines.add(text);
return this;
}
public Builder addLine(String text) {
lines.add(Text.literal(text).setStyle(Util.SPLASH_TEXT_STYLE));
return this;
}
public SplashText build() {
return new SplashText(lines.toArray(Text[]::new));
}
}
}