Add optional %user% Field
This commit is contained in:
parent
39ce7daefd
commit
ded4ee717a
@ -27,6 +27,7 @@ public class Main {
|
||||
.collect(Collectors.joining(", "));
|
||||
|
||||
private static String currentScene = "start";
|
||||
private static String userName = "Player";
|
||||
|
||||
public static void main(String[] args) {
|
||||
if (args.length > 0) {
|
||||
@ -47,6 +48,13 @@ public class Main {
|
||||
textSpeed = TextSpeed.FAST;
|
||||
}
|
||||
|
||||
System.out.println("What is your Name?");
|
||||
System.out.print("> ");
|
||||
String name = scanner.nextLine();
|
||||
if(!name.isEmpty()) {
|
||||
userName = name.strip().split(" ")[0];
|
||||
}
|
||||
|
||||
run(currentScene);
|
||||
}
|
||||
|
||||
@ -71,6 +79,7 @@ public class Main {
|
||||
}
|
||||
|
||||
public static void writeText(String text) {
|
||||
text = text.replace("%user%", userName);
|
||||
try {
|
||||
for (char c : text.toCharArray()) {
|
||||
System.out.print(c);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user