Skip to content

Commit

Permalink
Update version number to 6.14.1
Browse files Browse the repository at this point in the history
  • Loading branch information
BenCodez committed Sep 24, 2023
1 parent f683cc6 commit 37e29b8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 51 deletions.
2 changes: 1 addition & 1 deletion VotingPlugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.bencodez</groupId>
<artifactId>${version.art}</artifactId>
<version>6.14</version>
<version>6.14.1</version>
<packaging>jar</packaging>
<name>VotingPlugin</name>
<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.bencodez.votingplugin.cooldown;

import java.time.Duration;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;
Expand Down Expand Up @@ -35,8 +33,6 @@ public class CoolDownCheck implements Listener {

private HashMap<UUID, ScheduledFuture<?>> allSiteTasks = new HashMap<UUID, ScheduledFuture<?>>();

private HashMap<String, ScheduledFuture<?>> voteSiteChecks = new HashMap<String, ScheduledFuture<?>>();

public CoolDownCheck(VotingPluginMain plugin) {
this.plugin = plugin;
this.timer = Executors.newScheduledThreadPool(1);
Expand Down Expand Up @@ -183,49 +179,6 @@ public void onFinish() {
}
});

//scheduleGlobalCheckVoteSite();
}

public void scheduleGlobalCheckVoteSite() {
if (plugin.getConfigFile().isPerSiteCoolDownEvents()) {
for (VoteSite site : plugin.getVoteSites()) {
scheduleGlobalCheckVoteSite(site);
}
}
}

public void scheduleGlobalCheckVoteSite(VoteSite site) {
if (voteSiteChecks.containsKey(site.getKey())) {
voteSiteChecks.get(site.getKey()).cancel(false);
voteSiteChecks.remove(site.getKey());
}
if (site.isVoteDelayDaily()) {
LocalDateTime resetTime = plugin.getTimeChecker().getTime().withHour(site.getVoteDelayDailyHour())
.withMinute(0).withSecond(0);
LocalDateTime resetTimeTomorrow = resetTime.plusHours(24);
long time = 0;
LocalDateTime now = plugin.getTimeChecker().getTime();
if (now.isBefore(resetTime)) {
Duration dur = Duration.between(now, resetTime);
time = dur.getSeconds();
} else if (now.isBefore(resetTimeTomorrow)) {
Duration dur = Duration.between(now, resetTimeTomorrow);
time = dur.getSeconds();
}

ScheduledFuture<?> scheduledFuture = timer.schedule(new Runnable() {

@Override
public void run() {
checkAllVoteSite(site);
}
}, time + 90, TimeUnit.SECONDS);
plugin.getLogger().info(
"Checking vote delay daily cooldown events/rewards in " + time + " seconds for " + site.getKey());

voteSiteChecks.put(site.getKey(), scheduledFuture);
}

}

public void checkAllVoteSite(VoteSite site) {
Expand All @@ -251,8 +204,6 @@ public void checkAllVoteSite(VoteSite site) {
cols = null;

plugin.getLogger().info("Finished checking vote cooldown rewards for all players: " + site.getKey());
//scheduleGlobalCheckVoteSite(site);

}

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public String loadingDebug() {
str += ", VoteDelayDaily: " + isVoteDelayDaily();
str += ", IsWaitUntilVoteDelay: " + isWaitUntilVoteDelay();
str += ", ServiceSite: " + getServiceSite();
str += ", TimeOffSet:" + getVoteDelayDailyHour();
str += ", VoteDelayDailyHour:" + getVoteDelayDailyHour();
str += ", Url: " + getVoteURL();
str += ", IgnoreCanVote: " + isIgnoreCanVote();
str += ", Hidden: " + isHidden();
Expand Down

0 comments on commit 37e29b8

Please sign in to comment.