aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon
diff options
context:
space:
mode:
authorTrương Hoàng Long <longtruong2411@gmail.com>2022-10-05 14:03:12 +0200
committerGitHub <noreply@github.com>2022-10-05 14:03:12 +0200
commitaff1c7100a8a5805f01895cdc7e69cb994b2d087 (patch)
treeda6e25895858a50b37b38b3778960d9d4afb828a /src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon
parent346188b9d430ac493ae8c64b128d97a747f044ac (diff)
parent32a141133b636b6a50a01b0e7698c12690246f72 (diff)
downloadSkyblocker-aff1c7100a8a5805f01895cdc7e69cb994b2d087.tar.gz
Skyblocker-aff1c7100a8a5805f01895cdc7e69cb994b2d087.tar.bz2
Skyblocker-aff1c7100a8a5805f01895cdc7e69cb994b2d087.zip
Merge pull request #89 from TheColdPot/patch-1
Fix trivia solver glitch
Diffstat (limited to 'src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon')
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Trivia.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Trivia.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Trivia.java
index 73511c00..b437ce10 100644
--- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Trivia.java
+++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Trivia.java
@@ -16,7 +16,7 @@ public class Trivia extends ChatPatternListener {
private List<String> solutions = Collections.emptyList();
public Trivia() {
- super("^ +(?:([A-Za-z' ]*\\?)|§6 ([ⓐⓑⓒ]) §a([a-zA-Z0-9 ]+))$");
+ super("^ +(?:([A-Za-z,' ]*\\?)|§6 ([ⓐⓑⓒ]) §a([a-zA-Z0-9 ]+))$");
}
@Override
@@ -40,13 +40,14 @@ public class Trivia extends ChatPatternListener {
}
private void updateSolutions(String question) {
- if (question.equals("What SkyBlock year is it?")) {
+ String trimmedQuestion = question.trim();
+ if (trimmedQuestion.equals("What SkyBlock year is it?")) {
long currentTime = System.currentTimeMillis() / 1000L;
long diff = currentTime - 1560276000;
int year = (int) (diff / 446400 + 1);
solutions = Collections.singletonList("Year " + year);
} else {
- solutions = Arrays.asList(answers.get(question));
+ solutions = Arrays.asList(answers.get(trimmedQuestion));
}
}
@@ -63,6 +64,7 @@ public class Trivia extends ChatPatternListener {
answers.put("What is the status of Goldor?", new String[]{"The Wither Lords"});
answers.put("What is the status of Storm?", new String[]{"The Wither Lords"});
answers.put("What is the status of Necron?", new String[]{"The Wither Lords"});
+ answers.put("What is the status of Maxor, Storm, Goldor and Necron?", new String[]{"The Wither Lords"});
answers.put("How many total Fairy Souls are there?", new String[]{"238 Fairy Souls"});
answers.put("How many Fairy Souls are there in Spider's Den?", new String[]{"19 Fairy Souls"});
answers.put("How many Fairy Souls are there in The End?", new String[]{"12 Fairy Souls"});