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