Browse Source

refactoring: Outsourced code in InteractionLoop

Whether the player is new or not will be checked in new outsourced function
remotes/origin/develop
David Hermann 2 years ago
parent
commit
4e990e2d04
  1. 6
      src/main/java/org/bitbiome/classes/InteractionLoop.java

6
src/main/java/org/bitbiome/classes/InteractionLoop.java

@ -11,7 +11,7 @@ public class InteractionLoop {
public void run(TravelEngine travelEngine) {
boolean isRunning = true;
if (travelEngine.getPlayer().getName().equals("null")) {
if (playerIsNew(travelEngine.getPlayer().getName())) {
print(Colors.ANSI_BLUE + "Oh, ein Fremder!\nBist du bereit für dein womöglich größtes Abenteuer?\nDann sag mir doch zunächst wie du heißt: " + Colors.ANSI_RESET);
String name = input.nextLine();
JsonParser jp = new JsonParser();
@ -34,6 +34,10 @@ public class InteractionLoop {
return true;
}
public boolean playerIsNew(String name) {
return name.equalsIgnoreCase("null");
}
}
Loading…
Cancel
Save