Compare commits

...
13 Commits
17 changed files with 74 additions and 32 deletions

No files matched your search

@@ -39,6 +39,11 @@ DisableBroadcast: false
# Requires server name below to be correct
PerServerRewards: false
# If true, milestones work per server
# Please note totals still sync, but milestones can be claimed on each server
# Needs to be set across all needed servers
PerServerMilestones: false
# If true, points will be given on a per server level
# Points will be added when server gets vote from bungee
PerServerPoints: false
+6 -1
View File
@@ -18,9 +18,14 @@ AllSites:
Messages:
Player: '&aYou voted on all sites in 1 day!'
# If true only cumulative reward at a time can be given
# The cumulative rewards will go in order as listed under Cumulative, so if true
# the first cumulative (in the order as listed) that can be given will, then will ignore the rest
OnlyOneCumulative: false
# NOTE: This is not a 1 time reward, that's what milestones are for!
# If total votes (Can be changed) divided by cumulative amount
# and as no remainder (So divides perfectly)then a reward is given
# and with no remainder (So divides perfectly) then a reward is given
Cumulative:
# Number of votes required
# Allows multiple cumulative rewards
-4
View File
@@ -11,10 +11,6 @@ Username: ''
Password: ''
# Max number of connections
MaxConnections: 1
# Maxium size of caching mysql
# -1 for no limit
# Affecting this value may affect performance
MaxSize: -1
# Table name prefix, for use with mutliple servers
Prefix: ''
#UseSSL: true
+1 -1
View File
@@ -8,7 +8,7 @@ softdepend: [MVdWPlaceholders, Votifier, VotifierPlus, NuVotifier, CMI, Vault, P
loadbefore: [MCPerks]
api-version: 1.13
libraries:
- org.openjdk.nashorn:nashorn-core:15.2
- org.openjdk.nashorn:nashorn-core:15.3
commands:
vote:
description: Vote command
+1 -1
View File
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.bencodez</groupId>
<artifactId>votingplugin</artifactId>
<version>6.7</version>
<version>6.7.1</version>
<packaging>jar</packaging>
<name>VotingPlugin</name>
<properties>
@@ -58,7 +58,7 @@ public class BungeeHandler {
} else if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
plugin.registerBungeeChannels("vp:vp");
plugin.getPluginMessaging().setDebug(true);
plugin.getPluginMessaging().setDebug(plugin.getBungeeSettings().isBungeeDebug());
plugin.getPluginMessaging().add(new PluginMessageHandler("Vote") {
@Override
@@ -1103,7 +1103,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
plugin.getLogger().info("Enabled VotingPlugin " + plugin.getDescription().getVersion());
if (getProfile().contains("dev")) {
plugin.getLogger().warning(
plugin.getLogger().info(
"Using dev build, this is not a stable build, use at your own risk. Build number: " + buildNumber);
}
@@ -1116,7 +1116,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
if (!site.hasRewards() && !hasRewards) {
issues = false;
plugin.getLogger().warning("No rewards detected for the site: " + site.getKey()
+ ". See https://github.com/BenCodez/VotingPlugin/wiki/Rewards on how to add rewards");
+ ". See https://github.com/BenCodez/VotingPlugin/wiki/Rewards");
}
boolean contains = false;
@@ -26,6 +26,7 @@ import java.util.zip.ZipInputStream;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.advancedcore.api.misc.encryption.EncryptionHandler;
import com.bencodez.advancedcore.api.misc.jsonparser.JsonParser;
import com.bencodez.advancedcore.api.user.usercache.value.DataValue;
import com.bencodez.advancedcore.api.user.usercache.value.DataValueInt;
import com.bencodez.advancedcore.api.user.usercache.value.DataValueString;
@@ -36,7 +37,6 @@ import com.bencodez.advancedcore.bungeeapi.sockets.SocketHandler;
import com.bencodez.advancedcore.bungeeapi.sockets.SocketReceiver;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import lombok.Getter;
import net.md_5.bungee.api.ChatColor;
@@ -160,7 +160,7 @@ public class VotingPluginBungee extends Plugin implements Listener {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
// Parse JSON response and get UUID
JsonElement element = new JsonParser().parse(bufferedReader);
JsonElement element = JsonParser.parseReader(bufferedReader);
JsonObject object = element.getAsJsonObject();
String uuidAsString = object.get("id").getAsString();
@@ -713,6 +713,7 @@ public class VotingPluginBungee extends Plugin implements Listener {
String uuid = getUUID(player);
if (uuid.isEmpty()) {
if (config.getAllowUnJoined()) {
debug("Fetching UUID online, since allowunjoined is enabled");
UUID u = null;
try {
u = fetchUUID(player);
@@ -37,6 +37,7 @@ import org.slf4j.Logger;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.advancedcore.api.misc.encryption.EncryptionHandler;
import com.bencodez.advancedcore.api.misc.jsonparser.JsonParser;
import com.bencodez.advancedcore.api.user.usercache.value.DataValue;
import com.bencodez.advancedcore.api.user.usercache.value.DataValueInt;
import com.bencodez.advancedcore.api.user.usercache.value.DataValueString;
@@ -51,7 +52,6 @@ import com.bencodez.votingplugin.bungee.BungeeVersion;
import com.bencodez.votingplugin.bungee.OfflineBungeeVote;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.inject.Inject;
import com.velocitypowered.api.command.CommandMeta;
import com.velocitypowered.api.event.Subscribe;
@@ -199,7 +199,7 @@ public class VotingPluginVelocity {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
// Parse JSON response and get UUID
JsonElement element = new JsonParser().parse(bufferedReader);
JsonElement element = JsonParser.parseReader(bufferedReader);
JsonObject object = element.getAsJsonObject();
String uuidAsString = object.get("id").getAsString();
@@ -780,6 +780,7 @@ public class VotingPluginVelocity {
String uuid = getUUID(player);
if (uuid.isEmpty()) {
if (config.getAllowUnJoined()) {
debug("Fetching UUID online, since allowunjoined is enabled");
UUID u = null;
try {
u = fetchUUID(player);
@@ -318,6 +318,16 @@ public class CommandLoader {
+ user.getMilestoneCount());
user.setHasGotteMilestone(num, true);
}
} else {
if (user.hasGottenMilestone(num)) {
sendMessage(sender,
"&cMilestone " + num + " for " + user.getPlayerName()
+ " already given when it shouldn't be, Current AllTimeTotal: "
+ user.getTotal(TopVoter.AllTime) + ", Current MileStoneCount: "
+ user.getMilestoneCount());
user.setHasGotteMilestone(num, false);
}
}
}
}
@@ -2003,7 +2013,8 @@ public class CommandLoader {
@Override
public void execute(CommandSender sender, String[] args) {
new VoteTopVoter(plugin, sender, null, top, 1).open(GUIMethod.valueOf(plugin.getGui().getGuiMethodTopVoter().toUpperCase()));
new VoteTopVoter(plugin, sender, null, top, 1)
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodTopVoter().toUpperCase()));
}
});
@@ -2013,7 +2024,8 @@ public class CommandLoader {
@Override
public void execute(CommandSender sender, String[] args) {
int page = Integer.parseInt(args[2]);
new VoteTopVoter(plugin, sender, null, top, page).open(GUIMethod.valueOf(plugin.getGui().getGuiMethodTopVoter().toUpperCase()));
new VoteTopVoter(plugin, sender, null, top, page)
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodTopVoter().toUpperCase()));
}
});
}
@@ -2025,7 +2037,8 @@ public class CommandLoader {
public void execute(CommandSender sender, String[] args) {
int page = Integer.parseInt(args[1]);
new VoteTopVoter(plugin, sender, null, TopVoter.getDefault(), page).open(GUIMethod.valueOf(plugin.getGui().getGuiMethodTopVoter().toUpperCase()));
new VoteTopVoter(plugin, sender, null, TopVoter.getDefault(), page)
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodTopVoter().toUpperCase()));
}
});
@@ -95,6 +95,15 @@ public class AdminVoteBungeeSettings extends GUIHandler {
}
}));
inv.addButton(new EditGUIButton(
new EditGUIValueBoolean("PerServerMilestones", plugin.getBungeeSettings().isPerServerMilestones()) {
@Override
public void setValue(Player player, boolean value) {
setPathData(getKey(), value);
}
}));
inv.addButton(new EditGUIButton(
new EditGUIValueBoolean("PerServerPoints", plugin.getBungeeSettings().isPerServerPoints()) {
@@ -41,6 +41,10 @@ public class BungeeSettings extends YMLFile {
@Getter
private boolean perServerPoints = false;
@ConfigDataBoolean(path = "PerServerMilestones")
@Getter
private boolean perServerMilestones = false;
@ConfigDataBoolean(path = "PerServerRewards")
@Getter
private boolean perServerRewards = false;
@@ -34,6 +34,10 @@ public class SpecialRewardsConfig extends YMLFile {
@Getter
private boolean enableWeeklyAwards = false;
@ConfigDataBoolean(path = "OnlyOneCumulative")
@Getter
private boolean onlyOneCumulative = false;
@Getter
private String firstVoteRewardsPath = "FirstVote";
@@ -52,13 +52,6 @@ public class VotiferEvent implements Listener {
// ignore own plugin calls of event
return;
}
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
plugin.getServerData().addServiceSite(voteSite);
}
});
if (voteUsername.length() == 0) {
plugin.getLogger().warning("No name from vote on " + voteSite);
@@ -76,7 +69,7 @@ public class VotiferEvent implements Listener {
@Override
public void run() {
plugin.getServerData().addServiceSite(voteSite);
if (plugin.getBungeeSettings().isUseBungeecoord() && !plugin.getBungeeSettings().isVotifierBypass()
&& (plugin.getBungeeHandler().getMethod().equals(BungeeMethod.PLUGINMESSAGING)
|| plugin.getBungeeHandler().getMethod().equals(BungeeMethod.SOCKETS))) {
@@ -94,10 +94,14 @@ public class SpecialRewards {
}
if (gotCumulative) {
gotCumulativeAny = true;
plugin.debug(user.getPlayerName() + " got cumulative " + votesRequired + ", total: "
+ top.toString() + ", current total: " + total);
giveCumulativeVoteReward(user, user.isOnline(), votesRequired, forceBungee);
if (!plugin.getSpecialRewardsConfig().isOnlyOneCumulative() || !gotCumulativeAny) {
gotCumulativeAny = true;
plugin.debug(user.getPlayerName() + " got cumulative " + votesRequired + ", total: "
+ top.toString() + ", current total: " + total);
giveCumulativeVoteReward(user, user.isOnline(), votesRequired, forceBungee);
} else {
plugin.debug("Already got one cumulative");
}
} else {
plugin.devDebug(user.getPlayerName() + " not able to get cumulative " + votesRequired
+ ", total required: " + top.toString() + ", current player total: " + total);
@@ -400,7 +400,7 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
public HashMap<String, Boolean> getHasGottenMilestone() {
HashMap<String, Boolean> hasGottenMilestone = new HashMap<String, Boolean>();
ArrayList<String> milestoneList = getUserData().getStringList("GottenMileStones");
ArrayList<String> milestoneList = getUserData().getStringList(getGottenMilestonesPath());
for (String str : milestoneList) {
String[] data = str.split("//");
if (data.length > 1) {
@@ -788,7 +788,14 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
String str = entry.getKey() + "//" + entry.getValue().booleanValue();
data.add(str);
}
getUserData().setStringList("GottenMileStones", data);
getUserData().setStringList(getGottenMilestonesPath(), data);
}
public String getGottenMilestonesPath() {
if (plugin.getBungeeSettings().isPerServerMilestones()) {
return plugin.getOptions().getServer() + "_" + "GottenMilestones";
}
return "GottenMileStones";
}
public void setHighestDailyTotal(int total) {
@@ -62,7 +62,7 @@ public class VoteReminding {
@Override
public void run() {
if (plugin != null) {
if (plugin != null && plugin.isEnabled()) {
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
checkRemind(user);