diff --git a/VotingPlugin/src/com/bencodez/votingplugin/VotingPluginMain.java b/VotingPlugin/src/com/bencodez/votingplugin/VotingPluginMain.java index d7ea3f3f8..ed753190f 100644 --- a/VotingPlugin/src/com/bencodez/votingplugin/VotingPluginMain.java +++ b/VotingPlugin/src/com/bencodez/votingplugin/VotingPluginMain.java @@ -342,6 +342,16 @@ public VoteSite getVoteSite(String site, boolean checkEnabled) { } + public ArrayList getVoteSitesEnabled() { + ArrayList sites = new ArrayList(); + for (VoteSite site : getVoteSites()) { + if (site.isEnabled()) { + sites.add(site); + } + } + return sites; + } + public String getVoteSiteName(boolean checkEnabled, String... urls) { ArrayList sites = getConfigVoteSites().getVoteSitesNames(checkEnabled); for (String url : urls) { diff --git a/VotingPlugin/src/com/bencodez/votingplugin/specialrewards/SpecialRewards.java b/VotingPlugin/src/com/bencodez/votingplugin/specialrewards/SpecialRewards.java index 0c2807174..0e7bb5f4e 100644 --- a/VotingPlugin/src/com/bencodez/votingplugin/specialrewards/SpecialRewards.java +++ b/VotingPlugin/src/com/bencodez/votingplugin/specialrewards/SpecialRewards.java @@ -262,7 +262,9 @@ public boolean checkVoteStreak(VotingPluginUser user, String type, boolean force if (streak.contains("-")) { // multiple multiple = true; + } + plugin.debug("Streak: " + streak + " multiple: " + multiple); if (StringParser.getInstance().isInt(s)) { int streakRequired = Integer.parseInt(s); if (streakRequired != 0) { @@ -287,8 +289,7 @@ public boolean checkVoteStreak(VotingPluginUser user, String type, boolean force } } else { if (curStreak != 0 && curStreak % streakRequired == 0) { - giveVoteStreakReward(user, user.isOnline(), type, streakRequired + "-", curStreak, - forceBungee); + giveVoteStreakReward(user, user.isOnline(), type, streak, curStreak, forceBungee); gotReward = true; plugin.debug( user.getPlayerName() + " got VoteStreak " + streakRequired + "* for " + type); diff --git a/VotingPlugin/src/com/bencodez/votingplugin/user/VotingPluginUser.java b/VotingPlugin/src/com/bencodez/votingplugin/user/VotingPluginUser.java index 15951bc60..71ee80237 100644 --- a/VotingPlugin/src/com/bencodez/votingplugin/user/VotingPluginUser.java +++ b/VotingPlugin/src/com/bencodez/votingplugin/user/VotingPluginUser.java @@ -352,7 +352,7 @@ public void checkDayVoteStreak(boolean forceBungee) { if (!voteStreakUpdatedToday(LocalDateTime.now())) { if (!plugin.getSpecialRewardsConfig().isVoteStreakRequirementUsePercentage() || hasPercentageTotal( TopVoter.Daily, plugin.getSpecialRewardsConfig().getVoteStreakRequirementDay(), null)) { - plugin.debug("Adding day vote streak to " + getUUID() + " " + plugin.extraDebug("Adding day vote streak to " + getUUID() + " " + plugin.getSpecialRewardsConfig().isVoteStreakRequirementUsePercentage() + " " + hasPercentageTotal(TopVoter.Daily, plugin.getSpecialRewardsConfig().getVoteStreakRequirementDay(), null)); @@ -687,11 +687,12 @@ public boolean hasPercentageTotal(TopVoter top, double percentage, LocalDateTime int total = getTotal(top); switch (top) { case Daily: - return total / plugin.getVoteSites().size() * 100 > percentage; + return (double) total / (double) plugin.getVoteSitesEnabled().size() * 100 > percentage; case Monthly: - return total / (plugin.getVoteSites().size() * time.getMonth().length(false)) * 100 > percentage; + return (double) total / ((double) plugin.getVoteSitesEnabled().size() * time.getMonth().length(false)) + * 100 > percentage; case Weekly: - return total / (plugin.getVoteSites().size() * 7) * 100 > percentage; + return (double) total / ((double) plugin.getVoteSitesEnabled().size() * 7) * 100 > percentage; default: return false; }