From d3d48d9514cbc89e991814e56152e4d4212dc596 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 5 Dec 2021 12:54:39 +0100 Subject: [PATCH] Fix Poll Commands Signed-off-by: Chaoscaot --- src/de/steamwar/bungeecore/commands/PollresultCommand.java | 2 +- src/de/steamwar/bungeecore/sql/PollAnswer.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/PollresultCommand.java b/src/de/steamwar/bungeecore/commands/PollresultCommand.java index cfebd66..df77cb8 100644 --- a/src/de/steamwar/bungeecore/commands/PollresultCommand.java +++ b/src/de/steamwar/bungeecore/commands/PollresultCommand.java @@ -46,7 +46,7 @@ public class PollresultCommand extends BasicCommand { ProxiedPlayer player = (ProxiedPlayer) sender; Map voted = PollAnswer.getCurrentResults(); - Message.send("POLLRESULT_HEADER", player, voted.values().stream().reduce(Integer::sum), PollSystem.getQuestion()); + Message.send("POLLRESULT_HEADER", player, voted.values().stream().reduce(Integer::sum).orElse(0), PollSystem.getQuestion()); for (Map.Entry e: voted.entrySet()) { Message.send("POLLRESULT_LIST", sender, e.getKey(), e.getValue()); } diff --git a/src/de/steamwar/bungeecore/sql/PollAnswer.java b/src/de/steamwar/bungeecore/sql/PollAnswer.java index 7d23c38..7a34476 100644 --- a/src/de/steamwar/bungeecore/sql/PollAnswer.java +++ b/src/de/steamwar/bungeecore/sql/PollAnswer.java @@ -58,7 +58,7 @@ public class PollAnswer { return getResults.select(rs -> { Map retMap = new HashMap<>(); while (rs.next()) - retMap.put(PollSystem.getAnswer(rs.getInt("Answer")), rs.getInt("Times")); + retMap.put(PollSystem.getAnswer(rs.getInt("Answer")-1), rs.getInt("Times")); return retMap; }, PollSystem.getQuestion()); }