Compare commits

...
7 Commits
12 changed files with 69 additions and 22 deletions

No files matched your search

+1
View File
@@ -109,6 +109,7 @@ Format:
# Broadcast vote message
# Set to an empty message to disable
# Use %NewLine% for a new line
BroadcastMsg: '&6[&4Broadcast&6] &2Thanks &c%player% &2for voting on %SiteName%'
# If true uses broadcast setting below for offline votes
OnlyOneOfflineBroadcast: false
+6 -1
View File
@@ -33,7 +33,7 @@ Cumulative:
# Can have multiple listed here
'20':
Enabled: false
# Wether or not votes must be made in same day/week
# Whether or not votes must be made in same day/week
# Useful if you want to require a certain number of voting sites to be voted on
# for a daily/weekly reward instead of all of them
# Valid options
@@ -42,6 +42,11 @@ Cumulative:
# Weekly
# Daily
TotalToUse: AllTime
# Blacklist recurring votes
#BlackList:
#- 40
# Whether or not to gives cumulative reward for every x number of votes, default: true
#Recurring: true
Rewards:
Messages:
Player: '&aYou got %cumulative% cumulative votes!'
+1
View File
@@ -12,6 +12,7 @@ Password: ''
# Max number of connections
MaxConnections: 1
# Table name prefix, for use with mutliple servers
# Don't use with PLUGINMESSAGING bungee setup
Prefix: ''
#UseSSL: true
#PublicKeyRetrieval: false
+1 -1
View File
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.bencodez</groupId>
<artifactId>votingplugin</artifactId>
<version>6.9</version>
<version>6.9.1</version>
<packaging>jar</packaging>
<name>VotingPlugin</name>
<properties>
@@ -1049,10 +1049,11 @@ public class VotingPluginMain extends AdvancedCorePlugin {
public String onRewardRequest(Reward reward, com.bencodez.advancedcore.api.user.AdvancedCoreUser user,
int num, HashMap<String, String> placeholders) {
VotingPluginUser vpUser = UserManager.getInstance().getVotingPluginUser(user);
vpUser.addPoints(num);
return null;
String str = "" + vpUser.addPoints(num);
debug("Setting points to " + str);
return str;
}
}.synchronize().addEditButton(
}.synchronize().asPlaceholder("newpoints").addEditButton(
new EditGUIButton(new ItemBuilder(Material.PAPER), new EditGUIValueNumber("Points", null) {
@Override
@@ -514,12 +514,11 @@ public class VotingPluginBungee extends Plugin implements Listener {
}
}
}
currentVotePartyVotesRequired = getConfig().getVotePartyVotesRequired()
+ voteCacheFile.getVotePartyInreaseVotesRequired();
votePartyVotes = voteCacheFile.getVotePartyCurrentVotes();
}
currentVotePartyVotesRequired = getConfig().getVotePartyVotesRequired()
+ voteCacheFile.getVotePartyInreaseVotesRequired();
votePartyVotes = voteCacheFile.getVotePartyCurrentVotes();
BStatsMetricsBungee metrics = new BStatsMetricsBungee(this, 9453);
metrics.addCustomChart(
@@ -2010,7 +2010,7 @@ public class CommandLoader {
}
});
if (plugin.getGui().isLastMonthGUI()) {
if (plugin.getGui().isLastMonthGUI() || plugin.getOptions().getDebug().equals(DebugLevel.DEV)) {
plugin.getVoteCommand()
.add(new CommandHandler(new String[] { "LastMonthTop" },
"VotingPlugin.Commands.Vote.LastMonthTop|" + playerPerm,
@@ -3,6 +3,7 @@ package com.bencodez.votingplugin.config;
import java.io.File;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.bencodez.advancedcore.api.yml.YMLFile;
@@ -91,6 +92,14 @@ public class SpecialRewardsConfig extends YMLFile {
return "Cumulative." + cumulative + ".Rewards";
}
public List<Integer> getCumulativeBlackList(int cumulative) {
return getData().getIntegerList("Cumulative." + cumulative + ".BlackList");
}
public boolean getCumulativeRecurring(int cumulative) {
return getData().getBoolean("Cumulative." + cumulative + ".Recurring", true);
}
/**
* Gets the cumulative votes.
*
@@ -3,6 +3,8 @@ package com.bencodez.votingplugin.listeners;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.TimerTask;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
@@ -200,9 +202,10 @@ public class PlayerVoteListener implements Listener {
plugin.getSpecialRewards().checkCumualativeVotes(user, event.getBungeeTextTotals(), event.isForceBungee());
plugin.getSpecialRewards().checkMilestone(user, event.getBungeeTextTotals(), event.isForceBungee());
final String uuid = user.getUUID();
if (plugin.getBungeeSettings().isUseBungeecoord()) {
if (plugin.getBungeeHandler().getMethod().equals(BungeeMethod.MYSQL)) {
final String uuid = user.getUUID();
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
@Override
@@ -214,14 +217,24 @@ public class PlayerVoteListener implements Listener {
}, 40);
}
}
if (!user.isOnline()) {
user.clearCache();
}
}
PlayerPostVoteEvent postVoteEvent = new PlayerPostVoteEvent(voteSite, user, event.isRealVote(),
event.isForceBungee());
plugin.getServer().getPluginManager().callEvent(postVoteEvent);
PlayerPostVoteEvent postVoteEvent = new PlayerPostVoteEvent(voteSite, user, event.isRealVote(),
event.isForceBungee());
plugin.getServer().getPluginManager().callEvent(postVoteEvent);
plugin.getTimer().schedule(new TimerTask() {
@Override
public void run() {
VotingPluginUser user = plugin.getVotingPluginUserManager()
.getVotingPluginUser(UUID.fromString(uuid));
if (!user.isOnline()) {
user.clearCache();
}
}
}, 1000 * 5);
}
plugin.setUpdate(true);
}
@@ -766,7 +766,7 @@ public class PlaceHolders {
for (String ident : placeholder.getCache().keySet()) {
placeholder.getCache().get(ident).put(vpUser.getJavaUUID(),
placeholder.placeholderRequest(vpUser, ident));
plugin.devDebug("Updated cache for " + vpUser.getUUID() + " on " + key);
plugin.devDebug("Updated placeholder cache for " + vpUser.getUUID() + " on " + key);
}
@@ -2,6 +2,7 @@ package com.bencodez.votingplugin.specialrewards;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.bukkit.Bukkit;
@@ -86,8 +87,25 @@ public class SpecialRewards {
}
}
if (total != 0 && total >= votesRequired) {
if ((total % votesRequired) == 0) {
List<Integer> blackList = plugin.getSpecialRewardsConfig()
.getCumulativeBlackList(votesRequired);
boolean blackListed = false;
for (Integer num : blackList) {
if (num.intValue() == total) {
blackListed = true;
plugin.extraDebug("Not giving cumulative " + votesRequired + " to "
+ user.getPlayerName() + " due to blacklist");
}
}
if (plugin.getSpecialRewardsConfig().getCumulativeRecurring(votesRequired)) {
if (total != 0 && total >= votesRequired) {
if ((total % votesRequired) == 0 && !blackListed) {
gotCumulative = true;
}
}
} else {
if (total == votesRequired) {
gotCumulative = true;
}
}
@@ -920,7 +920,7 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
* @param value the new points
*/
public void setPoints(int value) {
getUserData().setInt(getPointsPath(), value, !plugin.getBungeeSettings().isUseBungeecoord());
getUserData().setInt(getPointsPath(), value, false);
}
public void setPrimaryAccount(java.util.UUID uuid) {