Skip to content

Commit

Permalink
Allow limit monthly votes to work on PLUGINMESSAGING
Browse files Browse the repository at this point in the history
  • Loading branch information
BenCodez committed Oct 1, 2023
1 parent 10732ee commit 28ce76b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
19 changes: 19 additions & 0 deletions VotingPlugin/src/com/bencodez/votingplugin/BungeeHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.bencodez.votingplugin.bungee.BungeeMethod;
import com.bencodez.votingplugin.bungee.BungeeVersion;
import com.bencodez.votingplugin.objects.VoteSite;
import com.bencodez.votingplugin.topvoter.TopVoter;
import com.bencodez.votingplugin.user.VotingPluginUser;

import lombok.Getter;
Expand Down Expand Up @@ -348,6 +349,15 @@ public void onRecieve(String subChannel, ArrayList<String> args) {
user.addPoints(plugin.getConfigFile().getPointsOnVote());
}

if (plugin.getConfigFile().isLimitMonthlyVotes()) {
int value = text.getMonthTotal();
LocalDateTime cTime = plugin.getTimeChecker().getTime();
int days = cTime.getDayOfMonth();
if (value >= days * plugin.getVoteSites().size()) {
user.setTotal(TopVoter.Monthly, days * plugin.getVoteSites().size());
}
}

plugin.getSpecialRewards().bungeeAllSitesCheck(user, numberOfVotes, num);

if (Boolean.valueOf(args.get(5))) {
Expand Down Expand Up @@ -442,6 +452,15 @@ public void onRecieve(String subChannel, ArrayList<String> args) {
user.addPoints(plugin.getConfigFile().getPointsOnVote());
}

if (plugin.getConfigFile().isLimitMonthlyVotes()) {
int value = text.getMonthTotal();
LocalDateTime cTime = plugin.getTimeChecker().getTime();
int days = cTime.getDayOfMonth();
if (value >= days * plugin.getVoteSites().size()) {
user.setTotal(TopVoter.Monthly, days * plugin.getVoteSites().size());
}
}

plugin.getSpecialRewards().bungeeAllSitesCheck(user, numberOfVotes, num);

if (Boolean.valueOf(args.get(5))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,36 @@
import java.util.regex.Pattern;

import lombok.Getter;
import lombok.Setter;

public class BungeeMessageData {

// Message string
// alltimetotal//monthtotal//weeklytotal//dailytotal//points//milestonecount//votepartycurrent//votepartyrequired

@Getter
@Setter
private int allTimeTotal = 0;
@Getter
@Setter
private int dailyTotal = 0;
@Getter
@Setter
private int milestoneCount = 0;
@Getter
@Setter
private int monthTotal = 0;
@Getter
@Setter
private int points = 0;
@Getter
@Setter
private int weeklyTotal = 0;
@Getter
@Setter
private int votePartyCurrent = 0;
@Getter
@Setter
private int votePartyRequired = 0;

public BungeeMessageData(int allTimeTotal, int monthTotal, int weeklyTotal, int dailyTotal, int points,
Expand Down

0 comments on commit 28ce76b

Please sign in to comment.