Compare commits

...
19 Commits
Author SHA1 Message Date
Ben12345rocks b6a67f2aeb Update version number 2018-11-18 12:56:04 -05:00
Ben12345rocks a5b416b210 Bug fix 2018-11-14 16:50:37 -05:00
Ben12345rocks caa4a7a714 Change help message 2018-11-13 20:17:27 -05:00
Ben12345rocks 72aa819361 Add command to force vote party 2018-11-13 20:16:26 -05:00
Ben12345rocks cf52db0c7d Bug fix 2018-11-13 20:13:43 -05:00
Ben12345rocks 5021c4bf67 Remove option 2018-11-13 19:45:16 -05:00
Ben12345rocks 9dd8e757d4 Fix typo 2018-11-13 19:26:00 -05:00
Ben12345rocks da7cdb74d4 Bug fix 2018-11-13 16:55:05 -05:00
Ben12345rocks 18c6ee6614 Bug fixes 2018-11-13 16:53:08 -05:00
Ben12345rocks cafe2b1de7 Slight case change on command 2018-11-05 19:29:56 -05:00
Ben12345rocks 74c94746c1 Check milestones on amount edit 2018-11-04 12:27:31 -05:00
Ben12345rocks 61130a1b2b Slight changes 2018-11-03 20:48:39 -04:00
Ben12345rocks 7dafa5c8eb Bug fix 2018-11-03 20:45:13 -04:00
Ben12345rocks c89edc47c3 Add more placeholders 2018-11-03 20:30:05 -04:00
Ben12345rocks 0b89df6262 Improve /av servicesites 2018-11-03 20:20:36 -04:00
Ben12345rocks c2218b2c67 Added command to set milestone count 2018-11-02 16:50:06 -04:00
Ben12345rocks 1950cfdd2d Little bug fixes 2018-11-01 19:23:08 -04:00
Ben12345rocks 71af70a026 Add new commands 2018-10-30 20:40:03 -04:00
Ben12345rocks b269c29f7c Add option to wait until votedelay is over to accept vote, closes #437 2018-10-29 19:28:31 -04:00
13 changed files with 173 additions and 43 deletions

No files matched your search

+2 -2
View File
@@ -648,7 +648,7 @@ MileStones:
Rewards:
Messages:
Player: '&aYou got %milestone% milestone votes!'
VoteStreak:
# Valid options: Day, Week, Month
Day:
@@ -813,7 +813,7 @@ RequestAPI:
# Not recommended though
LogVotesToFile: false
# Only update the background when needed when set to false
# Only update in the background when needed when set to false
AlwaysUpdate: false
# Update in the background only if players are online
+3
View File
@@ -28,6 +28,9 @@ VoteSites:
# Most sites are 24 hours
VoteDelay: 24
# Require waiting until votedelay time has pasted in order to accept vote
WaitUntilVoteDelay: false
# Reset vote delay each day (for certain sites that do this)
VoteDelayDaily: false
+2 -19
View File
@@ -27,9 +27,6 @@ commands:
votetop:
description: See top voters
aliases: vtop
voteinfo:
description: See player info
aliases: vinfo
votetoday:
description: See who voted today
aliases: vtoday
@@ -63,8 +60,6 @@ commands:
votepoints:
description: A command
aliases: vpoints
votegivereward:
description: A command
votechoices:
description: A command
alaises: vchoices
@@ -74,8 +69,6 @@ commands:
adminvote?:
description: Open adminvote help
aliases: av?
adminvoteconvert:
description: A command
adminvotereport:
description: Command Alias
aliases: avreport
@@ -97,24 +90,15 @@ commands:
adminvoterewards:
description: Command Alias
aliases: avrewards
adminvotereward:
description: Command Alias
aliases: avreward
adminvoteuuid:
description: Command Alias
aliases: avuuid
adminvotereset:
description: Command Alias
aliases: avreset
adminvotevotesite:
description: Command Alias
aliases: avvotesite
adminvoteconfig:
description: Command Alias
aliases: avconfig
adminvoteserverdata:
description: Command Alias
aliases: avserverdata
adminvotesettotal:
description: Command Alias
aliases: avsettotal
@@ -124,9 +108,6 @@ commands:
adminvotevote:
description: Command Alias
aliases: [avvote, fakevote]
adminvoteTriggerPlayerVoteEvent:
description: Command Alias
aliases: avTriggerPlayerVoteEvent
adminvotesetpoints:
description: Command Alias
aliases: avsetpoints
@@ -233,4 +214,6 @@ permissions:
VotingPlugin.NoRemind:
description: Ignore vote reminding
default: false
VotingPlugin.Sign.Create:
description: Permission to create sign
+1 -1
View File
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.Ben12345rocks</groupId>
<artifactId>VotingPlugin</artifactId>
<version>5.16.1</version>
<version>5.16.2</version>
<packaging>jar</packaging>
<name>VotingPlugin</name>
<properties>
@@ -42,6 +42,7 @@ import com.Ben12345rocks.VotingPlugin.Data.ServerData;
import com.Ben12345rocks.VotingPlugin.Events.PlayerVoteEvent;
import com.Ben12345rocks.VotingPlugin.Objects.User;
import com.Ben12345rocks.VotingPlugin.Objects.VoteSite;
import com.Ben12345rocks.VotingPlugin.SpecialRewards.SpecialRewards;
import com.Ben12345rocks.VotingPlugin.Test.VoteTester;
import com.Ben12345rocks.VotingPlugin.TopVoter.TopVoter;
import com.Ben12345rocks.VotingPlugin.TopVoter.TopVoterHandler;
@@ -289,19 +290,22 @@ public class CommandLoader {
@Override
public void execute(CommandSender sender, String[] args) {
sendMessage(sender, "&cEvery service site the server has gotten from votifier:");
for (String serviceSites : ServerData.getInstance().getServiceSites()) {
boolean hasSite = plugin.hasVoteSite(serviceSites);
if (hasSite) {
String siteName = plugin.getVoteSiteName(serviceSites);
sendMessage(sender, serviceSites + " : Current site = " + siteName);
} else {
sendMessage(sender, serviceSites
+ " : No site with this service site, did you do something wrong?");
ArrayList<String> serviceSites = ServerData.getInstance().getServiceSites();
if (!serviceSites.isEmpty()) {
sendMessage(sender, "&cEvery service site the server has gotten from votifier:");
for (String serviceSite : serviceSites) {
boolean hasSite = plugin.hasVoteSite(serviceSite);
if (hasSite) {
String siteName = plugin.getVoteSiteName(serviceSite);
sendMessage(sender, serviceSite + " : Current site = " + siteName);
} else {
sendMessage(sender, serviceSite
+ " : No site with this service site, did you do something wrong?");
}
}
} else {
sendMessage(sender, "&cNo votes have been received. Please check your votifier settings.");
}
}
});
@@ -577,6 +581,79 @@ public class CommandLoader {
}
});
plugin.getAdminVoteCommand()
.add(new CommandHandler(new String[] { "AddTotal", "Month", "(player)", "(number)" },
"VotingPlugin.Commands.AdminVote.AddTotal.Month|" + adminPerm, "Add month totals for player") {
@Override
public void execute(CommandSender sender, String[] args) {
User user = UserManager.getInstance().getVotingPluginUser(args[2]);
user.setTotal(TopVoter.Monthly, user.getTotal(TopVoter.Monthly) + Integer.parseInt(args[3]));
sender.sendMessage(StringUtils.getInstance().colorize("&cAdded month total for " + args[2]));
}
});
plugin.getAdminVoteCommand()
.add(new CommandHandler(new String[] { "AddTotal", "AllTime", "(player)", "(number)" },
"VotingPlugin.Commands.AdminVote.AddTotal.AllTime|" + adminPerm,
"Add alltime totals for player") {
@Override
public void execute(CommandSender sender, String[] args) {
User user = UserManager.getInstance().getVotingPluginUser(args[2]);
user.setTotal(TopVoter.AllTime, user.getTotal(TopVoter.AllTime) + Integer.parseInt(args[3]));
sender.sendMessage(StringUtils.getInstance().colorize("&cAdded alltime total for " + args[2]));
}
});
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "AddTotal", "Week", "(player)", "(number)" },
"VotingPlugin.Commands.AdminVote.AddTotal.Week|" + adminPerm, "Add week totals for player") {
@Override
public void execute(CommandSender sender, String[] args) {
User user = UserManager.getInstance().getVotingPluginUser(args[2]);
user.setTotal(TopVoter.Weekly, user.getTotal(TopVoter.Weekly) + Integer.parseInt(args[3]));
sender.sendMessage(StringUtils.getInstance().colorize("&cAdded week total for " + args[2]));
}
});
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "AddTotal", "Day", "(player)", "(number)" },
"VotingPlugin.Commands.AdminVote.AddTotal.Day|" + adminPerm, "Add day totals for player") {
@Override
public void execute(CommandSender sender, String[] args) {
User user = UserManager.getInstance().getVotingPluginUser(args[2]);
user.setTotal(TopVoter.Daily, user.getTotal(TopVoter.Daily) + Integer.parseInt(args[3]));
sender.sendMessage(StringUtils.getInstance().colorize("&cAdded day total for " + args[2]));
}
});
plugin.getAdminVoteCommand()
.add(new CommandHandler(new String[] { "AddMilestoneCount", "(player)", "(number)" },
"VotingPlugin.Commands.AdminVote.AddMilestoneCount|" + adminPerm, "Add milestonecount") {
@Override
public void execute(CommandSender sender, String[] args) {
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
user.setMilestoneCount(user.getMilestoneCount() + Integer.parseInt(args[2]));
SpecialRewards.getInstance().checkMilestone(user);
sender.sendMessage(StringUtils.getInstance().colorize("&cAdded milestonecount for " + args[1]));
}
});
plugin.getAdminVoteCommand()
.add(new CommandHandler(new String[] { "SetMilestoneCount", "(player)", "(number)" },
"VotingPlugin.Commands.AdminVote.SetMilestoneCount|" + adminPerm, "Set milestonecount") {
@Override
public void execute(CommandSender sender, String[] args) {
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
user.setMilestoneCount(Integer.parseInt(args[2]));
SpecialRewards.getInstance().checkMilestone(user);
sender.sendMessage(StringUtils.getInstance().colorize("&cAdded milestonecount for " + args[1]));
}
});
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "Vote", "(player)", "(Sitename)" },
"VotingPlugin.Commands.AdminVote.Vote|" + adminPerm, "Trigger manual vote") {
@@ -831,6 +908,17 @@ public class CommandLoader {
}
});
plugin.getAdminVoteCommand()
.add(new CommandHandler(new String[] { "ForceVoteParty" },
"VotingPlugin.Commands.AdminVote.ForceVoteParty|" + adminPerm,
"Force a voteparty reward, resets vote count") {
@Override
public void execute(CommandSender sender, String[] args) {
VoteParty.getInstance().giveRewards();
}
});
plugin.getAdminVoteCommand()
.add(new CommandHandler(new String[] { "Placeholders", "(player)" },
"VotingPlugin.Commands.AdminVote.Placeholders.Players|" + adminPerm,
@@ -877,6 +965,7 @@ public class CommandLoader {
plugin.getCommand("vote" + arg)
.setTabCompleter(new AliasesTabCompleter().setCMDHandle(cmdHandle, false));
plugin.getCommand("vote" + arg).setPermission(cmdHandle.getPerm().split("|")[0]);
} catch (Exception ex) {
plugin.debug("Failed to load command and tab completer for /vote" + arg);
}
@@ -894,6 +983,7 @@ public class CommandLoader {
plugin.getCommand("adminvote" + arg)
.setTabCompleter(new AliasesTabCompleter().setCMDHandle(cmdHandle, true));
plugin.getCommand("adminvote" + arg).setPermission(cmdHandle.getPerm().split("|")[0]);
} catch (Exception ex) {
plugin.debug("Failed to load command and tab completer for /adminvote" + arg + ": "
+ ex.getMessage());
@@ -903,6 +993,12 @@ public class CommandLoader {
}
}
for (String cmd : plugin.getDescription().getCommands().keySet()) {
String perm = plugin.getCommand(cmd).getPermission();
if (perm == null) {
plugin.debug("/" + cmd + " does not have a permission set");
}
}
}
/**
@@ -562,7 +562,7 @@ public class Config extends YMLFile {
public String getFormatNotNumber() {
return getData().getString("Format.NotNumber", "&cError on &6%arg%&c, number expected!");
}
@Getter
private int formatPageSize = 10;
@@ -124,6 +124,10 @@ public class ConfigVoteSites extends YMLFile {
return getData(siteName).getString("ServiceSite");
}
public boolean getWaitUntilVoteDelay(String siteName) {
return getData(siteName).getBoolean("WaitUntilVoteDelay", false);
}
/**
* Gets the vote delay.
*
@@ -87,6 +87,11 @@ public class PlayerVoteListener implements Listener {
if (Config.getInstance().isClearCacheOnVote()) {
user.clearCache();
}
if (voteSite.isWaitUntilVoteDelay() && !user.canVoteSite(voteSite)) {
plugin.getLogger().info(user.getPlayerName() + " must wait until votedelay is over, ignoring vote");
return;
}
synchronized (object) {
@@ -780,11 +780,11 @@ public class Main extends JavaPlugin {
boolean hasRewards = RewardHandler.getInstance().hasRewards(ConfigVoteSites.getInstance().getData(),
ConfigVoteSites.getInstance().getEverySiteRewardPath());
boolean noIssues = true;
boolean issues = true;
ArrayList<String> services = ServerData.getInstance().getServiceSites();
for (VoteSite site : getVoteSites()) {
if (!site.hasRewards() && !hasRewards) {
noIssues = false;
issues = false;
plugin.getLogger().warning("No rewards detected for the site: " + site.getKey()
+ ". See https://github.com/Ben12345rocks/AdvancedCore/wiki/Rewards on how to add rewards");
}
@@ -796,13 +796,13 @@ public class Main extends JavaPlugin {
}
}
if (!contains) {
noIssues = false;
issues = false;
plugin.getLogger().warning("No vote has been recieved from " + site.getServiceSite()
+ ", may be an invalid service site. Vote on the site and look in console for a service site, if you get nothing then there is an issue with votifier");
}
}
if (!noIssues) {
if (!issues) {
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
@Override
@@ -76,6 +76,10 @@ public class VoteSite {
@Setter
private boolean giveOffline;
@Getter
@Setter
private boolean waitUntilVoteDelay;
/**
* Instantiates a new vote site.
*
@@ -176,6 +180,7 @@ public class VoteSite {
item = configVoteSites.getItem(key);
voteDelayDaily = configVoteSites.getVoteSiteResetVoteDelayDaily(key);
giveOffline = configVoteSites.getVoteSiteGiveOffline(key);
waitUntilVoteDelay = configVoteSites.getWaitUntilVoteDelay(key);
}
public boolean isVaidServiceSite() {
@@ -100,6 +100,7 @@ public class TopVoterHandler implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onDateChanged(DateChangedEvent event) {
plugin.setUpdate(true);
plugin.update();
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@@ -110,8 +111,8 @@ public class TopVoterHandler implements Listener {
user.setDayVoteStreak(0);
} else {
user.addDayVoteStreak();
SpecialRewards.getInstance().checkVoteStreak(user, "Day");
}
SpecialRewards.getInstance().checkVoteStreak(user, "Day");
if (user.getHighestDailyTotal() < user.getTotal(TopVoter.Daily)) {
user.setHighestDailyTotal(user.getTotal(TopVoter.Daily));
@@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
import com.Ben12345rocks.AdvancedCore.Util.Misc.StringUtils;
import com.Ben12345rocks.VotingPlugin.Main;
import com.Ben12345rocks.VotingPlugin.Commands.Commands;
import com.Ben12345rocks.VotingPlugin.Config.Config;
import com.Ben12345rocks.VotingPlugin.Objects.User;
import com.Ben12345rocks.VotingPlugin.Objects.VoteSite;
import com.Ben12345rocks.VotingPlugin.TopVoter.TopVoter;
@@ -116,8 +117,36 @@ public class PlaceHolders {
// end of older placeholders
placeholders.add(new PlaceHolder("DisableBroadcast") {
@Override
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
return "" + user.getDisableBroadcast();
}
});
placeholders.add(new PlaceHolder("MilestoneCount") {
@Override
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
return "" + user.getMilestoneCount();
}
});
for (final String identifier : Config.getInstance().getIdentifiers()) {
if (Config.getInstance().getIdentifierLimit(identifier) > 0) {
placeholders.add(new PlaceHolder("VoteShopLimit_" + identifier) {
@Override
public String placeholderRequest(OfflinePlayer p, User user, String ident) {
return "" + user.getVoteShopIdentifierLimit(identifier);
}
});
}
}
for (final TopVoter top : TopVoter.values()) {
placeholders.add(new PlaceHolder("total_" + top.toString()) {
placeholders.add(new PlaceHolder("Total_" + top.toString()) {
@Override
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
@@ -344,7 +373,7 @@ public class PlaceHolders {
@Override
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
int num = 1;
int number = Integer.parseInt(identifier.split("_")[3]);
int number = Integer.parseInt(identifier.split("_")[2]);
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Daily).entrySet()) {
if (num == number) {
return entry.getKey().getPlayerName();
@@ -186,6 +186,10 @@ public class VoteParty implements Listener {
.withPlaceHolder("VotesRequired", "" + Config.getInstance().getVotePartyVotesRequired()).send(user);
}
public void giveReward(User user) {
giveReward(user, user.isOnline());
}
/**
* Give rewards.
*/
@@ -204,12 +208,12 @@ public class VoteParty implements Listener {
if (Config.getInstance().getVotePartyGiveAllPlayers()) {
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
giveReward(user, true);
giveReward(user);
}
} else {
for (String uuid : getVotedUsers()) {
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
giveReward(user, true);
giveReward(user);
}
}
reset();