Browse Source

Earn gold with quiz

You can earn some gold with your quiz now
remotes/origin/quiz
Friederike von Gruben 2 years ago
parent
commit
949d479d9c
  1. 8
      src/main/java/org/bitbiome/commands/QuizCommand.java

8
src/main/java/org/bitbiome/commands/QuizCommand.java

@ -32,7 +32,13 @@ public class QuizCommand implements CommandAPI {
int eingabe = quizScanner.nextInt();
if (answerIsCorrect(eingabe, korrekteAntwort, antworten)) {
print("Richtige Antwort!\n");
String playerpath = "src\\main\\resources\\playerconfig.json";
JSONObject playerconfig = JsonParser.readJSONFile(playerpath);
int gold = playerconfig.getInt("gold");
gold = gold + 5;
playerconfig.put("gold", gold);
JsonParser.writeObject(playerpath, playerconfig);
print("Richtig! Du hast 5 Münzen verdient.\nDein Münzstand beträgt: " + gold);
} else {
print("Leider falsch... Richtig ist: " + korrekteAntwort + "\n");
}

Loading…
Cancel
Save