Browse Source

Changed traveloptions Gruenland

remotes/origin/map
Tanja Herche 2 years ago
parent
commit
155b139ccb
  1. 10
      src/main/java/org/bitbiome/classes/TravelEngine.java
  2. 11
      src/main/java/org/bitbiome/commands/TravelCommand.java

10
src/main/java/org/bitbiome/classes/TravelEngine.java

@ -52,6 +52,7 @@ public class TravelEngine {
} }
return found; return found;
} }
public boolean locationExistsStrand(String name) { public boolean locationExistsStrand(String name) {
boolean found = false; boolean found = false;
for (int i = 0; i < locations.length(); i++) for (int i = 0; i < locations.length(); i++)
@ -61,6 +62,15 @@ public class TravelEngine {
return found; return found;
} }
public boolean locationExistsGruenland(String name) {
boolean found = false;
for (int i = 0; i < locations.length(); i++)
if (locations.getJSONObject(5).getString("name").equals(name) | locations.getJSONObject(0).getString("name").equals(name) | locations.getJSONObject(2).getString("name").equals(name)) {
found = true;
}
return found;
}
public Location getLocationByName(String name) { public Location getLocationByName(String name) {
JsonParser jp = new JsonParser(); JsonParser jp = new JsonParser();
JSONObject gameconfig = jp.getJSONObject("gameconfig.json"); JSONObject gameconfig = jp.getJSONObject("gameconfig.json");

11
src/main/java/org/bitbiome/commands/TravelCommand.java

@ -40,6 +40,17 @@ public class TravelCommand implements CommandAPI {
System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET);
} }
} else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Gruenland")) {
System.out.println("- " + locations.getJSONObject(5).getString("name") + "\n" + "- " + locations.getJSONObject(0).getString("name") + "\n" + "- " + locations.getJSONObject(2).getString("name"));
String 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 {
System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET);
}
} else { } else {
for (int i = 0; i < locations.length(); i++) { for (int i = 0; i < locations.length(); i++) {
System.out.println("- " + locations.getJSONObject(i).getString("name")); System.out.println("- " + locations.getJSONObject(i).getString("name"));

Loading…
Cancel
Save