Skip to content

Commit

Permalink
Fixed an issue with cheater punishment not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Mazawrath committed Jan 14, 2020
1 parent 42d61d3 commit f734f87
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/com/mazawrath/beanbot/utilities/Points.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,14 @@ public long useTriviaQuestion(PointsUser user, boolean cheaterPunishment) {
if (cheaterPunishment) {
r.db(DB_NAME).table(user.getServerId()).filter(r.hashMap("id", user.getUserId())).update(r.hashMap("Last Used Trivia Question", System.currentTimeMillis())).run(conn);
r.db(DB_NAME).table(user.getServerId()).filter(r.hashMap("id", user.getUserId())).update(r.hashMap("Trivia questions answered", Points.MAX_TRIVIA_QUESTIONS_PER_DAY)).run(conn);
return System.currentTimeMillis();
}

if (System.currentTimeMillis() - timeLeft > TRIVIA_QUESTION_TIME_LIMIT) {
r.db(DB_NAME).table(user.getServerId()).filter(r.hashMap("id", user.getUserId())).update(r.hashMap("Last Used Trivia Question", System.currentTimeMillis())).run(conn);
r.db(DB_NAME).table(user.getServerId()).filter(r.hashMap("id", user.getUserId())).update(r.hashMap("Trivia questions answered", 1)).run(conn);
return 0;
} else if (triviaAnswered <= MAX_TRIVIA_QUESTIONS_PER_DAY) {
} else if (triviaAnswered < MAX_TRIVIA_QUESTIONS_PER_DAY) {
r.db(DB_NAME).table(user.getServerId()).filter(r.hashMap("id", user.getUserId())).update(r.hashMap("Trivia questions answered", triviaAnswered + 1)).run(conn);
return 0;
}
Expand Down

0 comments on commit f734f87

Please sign in to comment.