|
@ -25,7 +25,7 @@ public class TravelCommand implements CommandAPI { |
|
|
public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine) { |
|
|
public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine) { |
|
|
System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad gezückt. Wohin möchtest du reisen?" + Colors.ANSI_RESET); |
|
|
System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad gezückt. Wohin möchtest du reisen?" + Colors.ANSI_RESET); |
|
|
JSONArray locations = travelEngine.getLocationList(); |
|
|
JSONArray locations = travelEngine.getLocationList(); |
|
|
String locationName; |
|
|
|
|
|
|
|
|
String locationName = ""; |
|
|
String locationWueste = locations.getJSONObject(5).getString("name"); |
|
|
String locationWueste = locations.getJSONObject(5).getString("name"); |
|
|
String locationGruenland = locations.getJSONObject(4).getString("name"); |
|
|
String locationGruenland = locations.getJSONObject(4).getString("name"); |
|
|
String locationWinterland = locations.getJSONObject(2).getString("name"); |
|
|
String locationWinterland = locations.getJSONObject(2).getString("name"); |
|
@ -36,10 +36,7 @@ public class TravelCommand implements CommandAPI { |
|
|
System.out.println("- " + locationStrand + "\n" + "- " + locationGruenland + "\n" + "- " + locationBerge); |
|
|
System.out.println("- " + locationStrand + "\n" + "- " + locationGruenland + "\n" + "- " + locationBerge); |
|
|
|
|
|
|
|
|
locationName = scanner.nextLine(); |
|
|
locationName = scanner.nextLine(); |
|
|
if (travelEngine.locationExistsWald(locationName)) { |
|
|
|
|
|
travelEngine.travelTo(new Location(locationName, new ArrayList<Mob>(), new ArrayList<Item>())); |
|
|
|
|
|
System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); |
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
if (!travelEngine.locationExistsWald(locationName)) { |
|
|
exittravelCommand(); |
|
|
exittravelCommand(); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@ -48,10 +45,7 @@ public class TravelCommand implements CommandAPI { |
|
|
System.out.println("- " + locationWueste + "\n" + "- " + locationWald); |
|
|
System.out.println("- " + locationWueste + "\n" + "- " + locationWald); |
|
|
|
|
|
|
|
|
locationName = scanner.nextLine(); |
|
|
locationName = scanner.nextLine(); |
|
|
if (travelEngine.locationExistsStrand(locationName)) { |
|
|
|
|
|
travelEngine.travelTo(new Location(locationName, new ArrayList<Mob>(), new ArrayList<Item>())); |
|
|
|
|
|
System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); |
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
if (!travelEngine.locationExistsStrand(locationName)) { |
|
|
exittravelCommand(); |
|
|
exittravelCommand(); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@ -60,10 +54,7 @@ public class TravelCommand implements CommandAPI { |
|
|
System.out.println("- " + locationWueste + "\n" + "- " + locationWald + "\n" + "- " + locationWinterland); |
|
|
System.out.println("- " + locationWueste + "\n" + "- " + locationWald + "\n" + "- " + locationWinterland); |
|
|
|
|
|
|
|
|
locationName = scanner.nextLine(); |
|
|
locationName = scanner.nextLine(); |
|
|
if (travelEngine.locationExistsGruenland(locationName)) { |
|
|
|
|
|
travelEngine.travelTo(new Location(locationName, new ArrayList<Mob>(), new ArrayList<Item>())); |
|
|
|
|
|
System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); |
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
if (!travelEngine.locationExistsGruenland(locationName)) { |
|
|
exittravelCommand(); |
|
|
exittravelCommand(); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@ -72,10 +63,7 @@ public class TravelCommand implements CommandAPI { |
|
|
System.out.println("- " + locationWald + "\n" + "- " + locationWinterland); |
|
|
System.out.println("- " + locationWald + "\n" + "- " + locationWinterland); |
|
|
|
|
|
|
|
|
locationName = scanner.nextLine(); |
|
|
locationName = scanner.nextLine(); |
|
|
if (travelEngine.locationExistsBerge(locationName)) { |
|
|
|
|
|
travelEngine.travelTo(new Location(locationName, new ArrayList<Mob>(), new ArrayList<Item>())); |
|
|
|
|
|
System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); |
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
if (!travelEngine.locationExistsBerge(locationName)) { |
|
|
exittravelCommand(); |
|
|
exittravelCommand(); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@ -84,10 +72,7 @@ public class TravelCommand implements CommandAPI { |
|
|
System.out.println("- " + locationGruenland + "\n" + "- " + locationBerge); |
|
|
System.out.println("- " + locationGruenland + "\n" + "- " + locationBerge); |
|
|
|
|
|
|
|
|
locationName = scanner.nextLine(); |
|
|
locationName = scanner.nextLine(); |
|
|
if (travelEngine.locationExistsWinterland(locationName)) { |
|
|
|
|
|
travelEngine.travelTo(new Location(locationName, new ArrayList<Mob>(), new ArrayList<Item>())); |
|
|
|
|
|
System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); |
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
if (!travelEngine.locationExistsWinterland(locationName)) { |
|
|
exittravelCommand(); |
|
|
exittravelCommand(); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@ -96,13 +81,11 @@ public class TravelCommand implements CommandAPI { |
|
|
System.out.println("- " + locationStrand + "\n" + "- " + locationGruenland); |
|
|
System.out.println("- " + locationStrand + "\n" + "- " + locationGruenland); |
|
|
|
|
|
|
|
|
locationName = scanner.nextLine(); |
|
|
locationName = scanner.nextLine(); |
|
|
if (travelEngine.locationExistsWueste(locationName)) { |
|
|
|
|
|
travelEngine.travelTo(new Location(locationName, new ArrayList<Mob>(), new ArrayList<Item>())); |
|
|
|
|
|
System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); |
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
if (!travelEngine.locationExistsWueste(locationName)) { |
|
|
exittravelCommand(); |
|
|
exittravelCommand(); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} travelEngine.travelTo(new Location(locationName, new ArrayList<Mob>(), new ArrayList<Item>())); |
|
|
|
|
|
System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |