From c3df294ce650271651312960d8cbdca9568a852b Mon Sep 17 00:00:00 2001 From: BenCodez Date: Fri, 15 Mar 2024 17:04:15 -0400 Subject: [PATCH] Changes for vote delay daily sites issues --- .../votingplugin/user/VotingPluginUser.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/VotingPlugin/src/com/bencodez/votingplugin/user/VotingPluginUser.java b/VotingPlugin/src/com/bencodez/votingplugin/user/VotingPluginUser.java index 71ee80237..211f55d92 100644 --- a/VotingPlugin/src/com/bencodez/votingplugin/user/VotingPluginUser.java +++ b/VotingPlugin/src/com/bencodez/votingplugin/user/VotingPluginUser.java @@ -5,6 +5,7 @@ import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; +import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.Collections; import java.util.Date; @@ -281,18 +282,16 @@ public boolean canVoteSite(VoteSite voteSite) { .withMinute(0).withSecond(0); LocalDateTime resetTimeTomorrow = resetTime.plusHours(24); - if (lastVote.isBefore(resetTimeTomorrow)) { - if (lastVote.isBefore(resetTime)) { - if (now.isAfter(resetTime)) { - return true; - } else { - return false; - } + if (ChronoUnit.HOURS.between(lastVote, resetTime) > voteSite.getVoteDelay()) { + if (now.isAfter(resetTime)) { + return true; } + } else { if (now.isAfter(resetTimeTomorrow)) { return true; } } + } } catch (Exception e) { e.printStackTrace();