Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c72154eed | ||
|
|
0dc942ecfd | ||
|
|
bc4d051590 | ||
|
|
011a0322ea | ||
|
|
ed90db12a4 | ||
|
|
3afea03485 | ||
|
|
6da17ee181 | ||
|
|
e5d1c255c0 | ||
|
|
b43754661c | ||
|
|
89c419c8df | ||
|
|
bd6b2b1edb | ||
|
|
b7c73902f2 | ||
|
|
c0995447de | ||
|
|
d970506c76 | ||
|
|
74fb06302a | ||
|
|
1cfed8aa98 | ||
|
|
9f563c37e5 | ||
|
|
d311588984 | ||
|
|
8c5324f602 | ||
|
|
17832a0bf7 | ||
|
|
3c415c63c9 | ||
|
|
6ab27775d2 | ||
|
|
e04bf8210f | ||
|
|
7b4879ddf1 | ||
|
|
081ac7bb3c | ||
|
|
d9894c6b74 | ||
|
|
f13f56c830 |
No files matched your search
Binary file not shown.
@@ -165,9 +165,10 @@ Format:
|
||||
# Lines for each vote site
|
||||
# %time% = time, using timeformat below
|
||||
# %timesince% = time since vote
|
||||
Line: '&3%SiteName%: &6%timeSince% ago'
|
||||
Line: '&3%SiteName%: &6%timeSince%'
|
||||
# Spelling of TimeType can be changed under Format.Commands.TimeFormats
|
||||
TimeFormat: '%amount% %TimeType%'
|
||||
LastVoted: '%times% ago'
|
||||
NeverVoted: 'Never voted'
|
||||
|
||||
# Format for /vote total
|
||||
@@ -245,7 +246,7 @@ Format:
|
||||
# See https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
|
||||
TimeFormat: 'EEE, d MMM yyyy HH:mm'
|
||||
|
||||
TimeFomrats:
|
||||
TimeFormats:
|
||||
Day: 'Day'
|
||||
Days: 'Days'
|
||||
Hour: 'Hour'
|
||||
@@ -389,6 +390,8 @@ GUI:
|
||||
Data: 0
|
||||
Amount: 1
|
||||
URLText: '%VoteUrl%'
|
||||
|
||||
VoteRewardBackButton: false
|
||||
# Customize /vote reward
|
||||
# Show players what you get when you vote on each site
|
||||
VoteReward:
|
||||
@@ -861,6 +864,9 @@ AutoCreateVoteSites: true
|
||||
# You can also use /av download
|
||||
AutoDownload: false
|
||||
|
||||
# Whether or not to disable update checks
|
||||
DisableUpdateChecking: false
|
||||
|
||||
# Disable this on a hub server for example
|
||||
# Still processes rewards for offline rewards (just won't give any)
|
||||
ProcessRewards: true
|
||||
|
||||
@@ -126,15 +126,11 @@ commands:
|
||||
adminvoteusers:
|
||||
description: Command Alias
|
||||
aliases: avusers
|
||||
adminvoteClearTotal:
|
||||
description: Command Alias
|
||||
aliases: avClearTotal
|
||||
adminvoteConvertFromData:
|
||||
description: Command Alias
|
||||
aliases: avConvertFromData
|
||||
adminvoteClearTotal:
|
||||
description: Command Alias
|
||||
aliases: avClearTotal
|
||||
adminvoteBackgroundUpdate:
|
||||
description: Command Alias
|
||||
aliases: avBackgroundUpdate
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.Ben12345rocks</groupId>
|
||||
<artifactId>VotingPlugin</artifactId>
|
||||
<version>5.16.2</version>
|
||||
<version>5.17</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>VotingPlugin</name>
|
||||
<properties>
|
||||
@@ -271,5 +271,12 @@
|
||||
<version>1.18.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.mimimum.minecraft</groupId>
|
||||
<artifactId>SuperbVote</artifactId>
|
||||
<version>0.5.3</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/Jars/SuperbVote-0.5.3.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -59,6 +59,9 @@ import com.swifteh.GAL.GAL;
|
||||
import com.swifteh.GAL.GALVote;
|
||||
import com.swifteh.GAL.VoteType;
|
||||
|
||||
import io.minimum.minecraft.superbvote.SuperbVote;
|
||||
import io.minimum.minecraft.superbvote.util.PlayerVotes;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class CommandLoader.
|
||||
@@ -216,6 +219,30 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "ConvertFrom", "SuperbVote" },
|
||||
"VotingPlugin.Commands.AdminVote.ConvertFrom.SuperbVote|" + adminPerm, "Convert from SuperbVote") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (Bukkit.getServer().getPluginManager().getPlugin("SuperbVote") != null) {
|
||||
sender.sendMessage("Starting to convert");
|
||||
|
||||
for (OfflinePlayer p : Bukkit.getOfflinePlayers()) {
|
||||
PlayerVotes votes = SuperbVote.getPlugin().getVoteStorage().getVotes(p.getUniqueId());
|
||||
if (votes != null) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(p);
|
||||
if (votes.getVotes() > 0) {
|
||||
user.setTotal(TopVoter.AllTime, votes.getVotes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
sender.sendMessage("SuperbVote not loaded");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "SetPoints", "(player)", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.SetPoints|" + adminPerm, "Set players voting points") {
|
||||
|
||||
@@ -901,7 +928,23 @@ public class CommandLoader {
|
||||
if (identifier.endsWith("_")) {
|
||||
identifier += "#";
|
||||
}
|
||||
msg.add("%VotingPlugin_" + identifier + "%");
|
||||
if (placeholder.hasDescription()) {
|
||||
msg.add("%VotingPlugin_" + identifier + "% - " + placeholder.getDescription());
|
||||
} else {
|
||||
msg.add("%VotingPlugin_" + identifier + "%");
|
||||
}
|
||||
}
|
||||
|
||||
for (PlaceHolder placeholder : PlaceHolders.getInstance().getNonPlayerPlaceholders()) {
|
||||
String identifier = placeholder.getIdentifier();
|
||||
if (identifier.endsWith("_")) {
|
||||
identifier += "#";
|
||||
}
|
||||
if (placeholder.hasDescription()) {
|
||||
msg.add("%VotingPlugin_" + identifier + "% - " + placeholder.getDescription());
|
||||
} else {
|
||||
msg.add("%VotingPlugin_" + identifier + "%");
|
||||
}
|
||||
}
|
||||
|
||||
sendMessage(sender, msg);
|
||||
@@ -938,10 +981,28 @@ public class CommandLoader {
|
||||
+ placeholder.placeholderRequest(user.getOfflinePlayer(), user, identifier));
|
||||
}
|
||||
|
||||
for (PlaceHolder placeholder : PlaceHolders.getInstance().getNonPlayerPlaceholders()) {
|
||||
String identifier = placeholder.getIdentifier();
|
||||
if (identifier.endsWith("_")) {
|
||||
identifier += "1";
|
||||
}
|
||||
msg.add("%VotingPlugin_" + identifier + "% = "
|
||||
+ placeholder.placeholderRequest(user.getOfflinePlayer(), user, identifier));
|
||||
}
|
||||
|
||||
sendMessage(sender, msg);
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "" },
|
||||
"VotingPlugin.Commands.AdminVote|" + adminPerm, "Base command") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
sendMessage(sender, "&cInvalid command, see /adminvote help");
|
||||
}
|
||||
});
|
||||
|
||||
ArrayList<CommandHandler> avCommands = com.Ben12345rocks.AdvancedCore.Commands.CommandLoader.getInstance()
|
||||
.getBasicAdminCommands("VotingPlugin");
|
||||
for (CommandHandler cmd : avCommands) {
|
||||
@@ -965,7 +1026,6 @@ 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);
|
||||
}
|
||||
@@ -983,7 +1043,6 @@ 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());
|
||||
@@ -993,12 +1052,6 @@ 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1332,21 +1385,15 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getVoteCommand().add(new CommandHandler(new String[] { "Points", },
|
||||
"VotingPlugin.Commands.Vote.Points|" + playerPerm, "View your points") {
|
||||
plugin.getVoteCommand().add(new CommandHandler(new String[] { "Points" },
|
||||
"VotingPlugin.Commands.Vote.Points|" + playerPerm, "View your points", false) {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
|
||||
if (sender instanceof Player) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser((Player) sender);
|
||||
String msg = Config.getInstance().getFormatCommandVotePoints()
|
||||
.replace("%Player%", user.getPlayerName()).replace("%Points%", "" + user.getPoints());
|
||||
user.sendMessage(msg);
|
||||
} else {
|
||||
sender.sendMessage("Must be a player to use this!");
|
||||
}
|
||||
|
||||
User user = UserManager.getInstance().getVotingPluginUser((Player) sender);
|
||||
String msg = Config.getInstance().getFormatCommandVotePoints().replace("%Player%", user.getPlayerName())
|
||||
.replace("%Points%", "" + user.getPoints());
|
||||
user.sendMessage(msg);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1822,23 +1869,24 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getVoteCommand().add(new CommandHandler(new String[] {}, "", "See voting URLs") {
|
||||
plugin.getVoteCommand().add(
|
||||
new CommandHandler(new String[] {}, "VotingPlugin.Commands.Vote|" + playerPerm, "See voting URLs") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (!Config.getInstance().isCommandsUseGUIVote() || !(sender instanceof Player)) {
|
||||
if (isPlayer(sender)) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser((Player) sender);
|
||||
user.sendMessage(Commands.getInstance().voteURLs(user));
|
||||
} else {
|
||||
sender.sendMessage(Commands.getInstance().voteURLs(null));
|
||||
}
|
||||
} else {
|
||||
PlayerGUIs.getInstance().openVoteURL((Player) sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (!Config.getInstance().isCommandsUseGUIVote() || !(sender instanceof Player)) {
|
||||
if (isPlayer(sender)) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser((Player) sender);
|
||||
user.sendMessage(Commands.getInstance().voteURLs(user));
|
||||
} else {
|
||||
sender.sendMessage(Commands.getInstance().voteURLs(null));
|
||||
}
|
||||
} else {
|
||||
PlayerGUIs.getInstance().openVoteURL((Player) sender);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ArrayList<CommandHandler> avCommands = com.Ben12345rocks.AdvancedCore.Commands.CommandLoader.getInstance()
|
||||
.getBasicCommands("VotingPlugin");
|
||||
@@ -1857,4 +1905,67 @@ public class CommandLoader {
|
||||
public void setCommands(HashMap<String, CommandHandler> commands) {
|
||||
this.commands = commands;
|
||||
}
|
||||
|
||||
public boolean isVotingPluginCommand(Player player, String cmd) {
|
||||
if (plugin.getCommand(cmd) != null || cmd.startsWith("votingplugin")) {
|
||||
return true;
|
||||
}
|
||||
for (String str : plugin.getDescription().getCommands().keySet()) {
|
||||
|
||||
for (String str1 : plugin.getCommand(str).getAliases()) {
|
||||
if (str1.equalsIgnoreCase(cmd)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasPermission(Player player, String cmd) {
|
||||
if (cmd.startsWith("votingplugin:")) {
|
||||
cmd = cmd.substring("votingplugin:".length());
|
||||
}
|
||||
boolean adminCommand = false;
|
||||
|
||||
if (cmd.startsWith("vote")) {
|
||||
cmd = cmd.substring("vote".length());
|
||||
} else if (cmd.startsWith("v")) {
|
||||
cmd = cmd.substring(1);
|
||||
} else if (cmd.startsWith("av")) {
|
||||
adminCommand = true;
|
||||
cmd = cmd.substring("av".length());
|
||||
} else if (cmd.startsWith("adminvote")) {
|
||||
adminCommand = true;
|
||||
cmd = cmd.substring("adminvote".length());
|
||||
}
|
||||
// plugin.debug(cmd);
|
||||
if (!adminCommand) {
|
||||
for (CommandHandler handle : plugin.getVoteCommand()) {
|
||||
if (handle.isCommand(cmd)) {
|
||||
// plugin.debug("is handle " + ArrayUtils.getInstance()
|
||||
// .makeStringList(ArrayUtils.getInstance().convert(handle.getArgs())));
|
||||
if (handle.hasPerm(player)) {
|
||||
// plugin.debug("has perm");
|
||||
return true;
|
||||
} else {
|
||||
// plugin.debug("no perm " + cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (CommandHandler handle : plugin.getAdminVoteCommand()) {
|
||||
if (handle.isCommand(cmd)) {
|
||||
// plugin.debug("is handle " + ArrayUtils.getInstance()
|
||||
// .makeStringList(ArrayUtils.getInstance().convert(handle.getArgs())));
|
||||
if (handle.hasPerm(player)) {
|
||||
// plugin.debug("has perm");
|
||||
return true;
|
||||
} else {
|
||||
// plugin.debug("no perm " + cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -669,6 +669,9 @@ public class Commands {
|
||||
Config.getInstance().getFormatTimeFormatsSeconds()), "amount", "" + diffSeconds);
|
||||
}
|
||||
|
||||
info = StringUtils.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getFormatCommandsVoteLastLastVoted(), "times", info);
|
||||
|
||||
return info;
|
||||
}
|
||||
return Config.getInstance().getFormatCommandsVoteLastNeverVoted();
|
||||
|
||||
@@ -584,8 +584,6 @@ public class PlayerGUIs {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(event.getPlayer());
|
||||
Player player = event.getWhoClicked();
|
||||
player.closeInventory();
|
||||
user.sendMessage(Commands.getInstance().voteURLs(user));
|
||||
|
||||
}
|
||||
@@ -609,10 +607,8 @@ public class PlayerGUIs {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Player player = event.getWhoClicked();
|
||||
Player player = event.getPlayer();
|
||||
if (player != null) {
|
||||
player.closeInventory();
|
||||
|
||||
if (Config.getInstance().isCommandsVoteRewardFromVoteURL()
|
||||
&& event.getClick().equals(ClickType.RIGHT)) {
|
||||
voteReward(player, voteSite.getKey());
|
||||
@@ -741,6 +737,16 @@ public class PlayerGUIs {
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.getInstance().isVoteRewardBackButton()) {
|
||||
inv.addButton(new BInventoryButton(getBackButton()) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
openVoteGUI(event.getPlayer(), getSelectedPlayer(event.getPlayer()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
}
|
||||
@@ -67,6 +67,10 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private String formatCommandsVoteLastNeverVoted;
|
||||
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Last.LastVoted", defaultValue = "%times% ago")
|
||||
@Getter
|
||||
private String formatCommandsVoteLastLastVoted;
|
||||
|
||||
@ConfigDataString(path = "Format.TimeFormats.Days", defaultValue = "Days")
|
||||
@Getter
|
||||
private String formatTimeFormatsDays;
|
||||
@@ -181,6 +185,10 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private boolean countFakeVotes = true;
|
||||
|
||||
@ConfigDataBoolean(path = "GUI.VoteRewardBackButton")
|
||||
@Getter
|
||||
private boolean voteRewardBackButton = false;
|
||||
|
||||
@ConfigDataInt(path = "ConvertDelay", defaultValue = 30000)
|
||||
@Getter
|
||||
private int convertDelay;
|
||||
@@ -189,6 +197,10 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private boolean enableDailyRewards = false;
|
||||
|
||||
@ConfigDataBoolean(path = "DisableUpdateChecking")
|
||||
@Getter
|
||||
private boolean disableUpdateChecking = false;
|
||||
|
||||
@ConfigDataInt(path = "DelayBetweenUpdates")
|
||||
@Getter
|
||||
private int delayBetweenUpdates = 3;
|
||||
@@ -1029,7 +1041,7 @@ public class Config extends YMLFile {
|
||||
return getData().getBoolean("TopVoterIgnorePermission");
|
||||
}
|
||||
|
||||
public int getUserVotesRequired() {
|
||||
public int getVotePartyUserVotesRequired() {
|
||||
return getData().getInt("VoteParty.UserVotesRequired");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ public class PlayerSpecialRewardEvent extends Event {
|
||||
private boolean cancelled;
|
||||
|
||||
public PlayerSpecialRewardEvent(User user, SpecialRewardType type) {
|
||||
super();
|
||||
super(true);
|
||||
setType(type);
|
||||
setUser(user);
|
||||
}
|
||||
|
||||
@@ -6,10 +6,9 @@ public enum SpecialRewardType {
|
||||
ALLSITE, CUMMULATIVE, MILESTONE, VOTESTREAK, FIRSTVOTE;
|
||||
|
||||
@Getter
|
||||
|
||||
private int amount = -1;
|
||||
@Getter
|
||||
|
||||
@Getter
|
||||
private String type = "";
|
||||
|
||||
public SpecialRewardType setAmount(int num) {
|
||||
|
||||
@@ -29,7 +29,7 @@ public class VotePartyEvent extends Event {
|
||||
private boolean cancelled;
|
||||
|
||||
public VotePartyEvent() {
|
||||
super();
|
||||
super(true);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Listeners;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandSendEvent;
|
||||
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Commands.CommandLoader;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class PlayerJoinEvent.
|
||||
*/
|
||||
public class PlayerCommandSendListener implements Listener {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static Main plugin;
|
||||
|
||||
public PlayerCommandSendListener(Main plugin) {
|
||||
PlayerCommandSendListener.plugin = plugin;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onTab(PlayerCommandSendEvent event) {
|
||||
ArrayList<String> removeCmds = new ArrayList<String>();
|
||||
ArrayList<String> whiteListed = new ArrayList<String>();
|
||||
for (String cmd : event.getCommands()) {
|
||||
if (CommandLoader.getInstance().isVotingPluginCommand(event.getPlayer(), cmd)) {
|
||||
if (!CommandLoader.getInstance().hasPermission(event.getPlayer(), cmd) && !whiteListed.contains(cmd)) {
|
||||
removeCmds.add(cmd);
|
||||
// plugin.debug("removed " + cmd);
|
||||
} else {
|
||||
removeCmds.remove(cmd);
|
||||
whiteListed.add(cmd);
|
||||
// plugin.debug("has " + cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
event.getCommands().removeAll(removeCmds);
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,6 @@ public class PlayerJoinEvent implements Listener {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
if (event.getPlayer() == null
|
||||
|| (AdvancedCoreHook.getInstance().getStorageType().equals(UserStorage.MYSQL)
|
||||
&& AdvancedCoreHook.getInstance().getMysql() == null)) {
|
||||
@@ -59,13 +58,9 @@ public class PlayerJoinEvent implements Listener {
|
||||
|
||||
if (user.getData().hasData()) {
|
||||
// give offline vote (if they voted offline)
|
||||
|
||||
user.offVote();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}, 20L);
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ public class PlayerVoteListener implements Listener {
|
||||
}
|
||||
|
||||
User user = UserManager.getInstance().getVotingPluginUser(playerName);
|
||||
user.updateName();
|
||||
|
||||
if (Config.getInstance().isClearCacheOnVote()) {
|
||||
user.clearCache();
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.Ben12345rocks.AdvancedCore.AdvancedCoreHook;
|
||||
import com.Ben12345rocks.AdvancedCore.CommandAPI.CommandHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.NMSManager.NMSManager;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.Injected.RewardInjectInt;
|
||||
import com.Ben12345rocks.AdvancedCore.UserManager.UUID;
|
||||
import com.Ben12345rocks.AdvancedCore.UserManager.UserStorage;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Javascript.JavascriptPlaceholderRequest;
|
||||
@@ -47,6 +48,7 @@ import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.ConfigVoteSites;
|
||||
import com.Ben12345rocks.VotingPlugin.Data.ServerData;
|
||||
import com.Ben12345rocks.VotingPlugin.Listeners.BlockBreak;
|
||||
import com.Ben12345rocks.VotingPlugin.Listeners.PlayerCommandSendListener;
|
||||
import com.Ben12345rocks.VotingPlugin.Listeners.PlayerInteract;
|
||||
import com.Ben12345rocks.VotingPlugin.Listeners.PlayerJoinEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.Listeners.PlayerVoteListener;
|
||||
@@ -120,7 +122,7 @@ public class Main extends JavaPlugin {
|
||||
/**
|
||||
* Check votifier.
|
||||
*/
|
||||
public void checkVotifier() {
|
||||
private void checkVotifier() {
|
||||
try {
|
||||
Class.forName("com.vexsoftware.votifier.model.VotifierEvent");
|
||||
} catch (ClassNotFoundException e) {
|
||||
@@ -701,9 +703,7 @@ public class Main extends JavaPlugin {
|
||||
registerCommands();
|
||||
registerEvents();
|
||||
checkVotifier();
|
||||
|
||||
CheckUpdate.getInstance().startUp();
|
||||
|
||||
VoteReminding.getInstance().loadRemindChecking();
|
||||
|
||||
plugin.signs = new ArrayList<SignHandler>();
|
||||
@@ -721,11 +721,11 @@ public class Main extends JavaPlugin {
|
||||
topVoter.put(top, new LinkedHashMap<User, Integer>());
|
||||
}
|
||||
voteToday = new LinkedHashMap<User, HashMap<VoteSite, LocalDateTime>>();
|
||||
|
||||
voteLog = new Logger(plugin, new File(plugin.getDataFolder() + File.separator + "Log", "votelog.txt"));
|
||||
|
||||
AdminGUI.getInstance().loadHook();
|
||||
|
||||
// vote party
|
||||
if (Config.getInstance().getVotePartyEnabled()) {
|
||||
VoteParty.getInstance().check();
|
||||
}
|
||||
@@ -772,9 +772,17 @@ public class Main extends JavaPlugin {
|
||||
AdvancedCoreHook.getInstance().getMysql().alterColumnType("MonthTotal", "INT DEFAULT '0'");
|
||||
AdvancedCoreHook.getInstance().getMysql().alterColumnType("HighestWeeklyTotal", "INT DEFAULT '0'");
|
||||
AdvancedCoreHook.getInstance().getMysql().alterColumnType("LastMonthTotal", "INT DEFAULT '0'");
|
||||
|
||||
}
|
||||
|
||||
RewardHandler.getInstance().getInjectedRewards().add(new RewardInjectInt("Points", 0) {
|
||||
|
||||
@Override
|
||||
public void onRewardRequest(com.Ben12345rocks.AdvancedCore.UserManager.User user, int num,
|
||||
HashMap<String, String> placeholders) {
|
||||
UserManager.getInstance().getVotingPluginUser(user).addPoints(num);
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getLogger().info("Enabled VotingPlugin " + plugin.getDescription().getVersion());
|
||||
|
||||
boolean hasRewards = RewardHandler.getInstance().hasRewards(ConfigVoteSites.getInstance().getData(),
|
||||
@@ -815,7 +823,7 @@ public class Main extends JavaPlugin {
|
||||
|
||||
if (NMSManager.getInstance().isVersion("1.7", "1.8", "1.9", "1.10", "1.11", "1.12")) {
|
||||
plugin.getLogger().severe("Detected running " + NMSManager.getInstance().getVersion()
|
||||
+ ", this version is not supported on this build");
|
||||
+ ", this version is not supported on this build. Support is limited");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -860,14 +868,11 @@ public class Main extends JavaPlugin {
|
||||
pm.registerEvents(new PlayerJoinEvent(this), this);
|
||||
pm.registerEvents(new VotiferEvent(this), this);
|
||||
pm.registerEvents(new PlayerVoteListener(this), this);
|
||||
|
||||
pm.registerEvents(new SignChange(this), this);
|
||||
|
||||
pm.registerEvents(new BlockBreak(this), this);
|
||||
|
||||
pm.registerEvents(new PlayerInteract(this), this);
|
||||
|
||||
pm.registerEvents(new VotingPluginUpdateEvent(this), this);
|
||||
pm.registerEvents(new PlayerCommandSendListener(this), this);
|
||||
|
||||
plugin.debug("Loaded Events");
|
||||
|
||||
@@ -886,14 +891,9 @@ public class Main extends JavaPlugin {
|
||||
AdvancedCoreHook.getInstance().setConfigData(Config.getInstance().getData());
|
||||
AdvancedCoreHook.getInstance().reload();
|
||||
PlaceHolders.getInstance().load();
|
||||
// loadTimer();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup files.
|
||||
*/
|
||||
public void setupFiles() {
|
||||
private void setupFiles() {
|
||||
try {
|
||||
config = Config.getInstance();
|
||||
config.setup();
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.Bukkit;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Updater.Updater;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
@@ -49,6 +50,9 @@ public class CheckUpdate {
|
||||
* Check update.
|
||||
*/
|
||||
public void checkUpdate() {
|
||||
if (Config.getInstance().isDisableUpdateChecking()) {
|
||||
return;
|
||||
}
|
||||
plugin.setUpdater(new Updater(plugin, 15358, false));
|
||||
final Updater.UpdateResult result = plugin.getUpdater().getResult();
|
||||
switch (result) {
|
||||
@@ -75,6 +79,9 @@ public class CheckUpdate {
|
||||
}
|
||||
|
||||
public void checkUpdateBasic() {
|
||||
if (Config.getInstance().isDisableUpdateChecking()) {
|
||||
return;
|
||||
}
|
||||
plugin.setUpdater(new Updater(plugin, 15358, false));
|
||||
final Updater.UpdateResult result = plugin.getUpdater().getResult();
|
||||
switch (result) {
|
||||
@@ -95,6 +102,9 @@ public class CheckUpdate {
|
||||
* Start up.
|
||||
*/
|
||||
public void startUp() {
|
||||
if (Config.getInstance().isDisableUpdateChecking()) {
|
||||
return;
|
||||
}
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,6 +44,10 @@ public class UserManager {
|
||||
return getVotingPluginUser(player.getName());
|
||||
}
|
||||
|
||||
public User getVotingPluginUser(com.Ben12345rocks.AdvancedCore.UserManager.User user) {
|
||||
return getVotingPluginUser(java.util.UUID.fromString(user.getUUID()));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public User getVotingPluginUser(String playerName) {
|
||||
return new User(com.Ben12345rocks.AdvancedCore.UserManager.UserManager.getInstance().getProperName(playerName));
|
||||
|
||||
@@ -12,6 +12,8 @@ public abstract class PlaceHolder {
|
||||
private String identifier;
|
||||
@Getter
|
||||
private boolean useStartsWith = false;
|
||||
@Getter
|
||||
private String description;
|
||||
|
||||
public PlaceHolder(String identifier) {
|
||||
this.identifier = identifier;
|
||||
@@ -42,4 +44,13 @@ public abstract class PlaceHolder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public PlaceHolder withDescription(String desc) {
|
||||
description = desc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean hasDescription() {
|
||||
return description != null;
|
||||
}
|
||||
|
||||
}
|
||||
+102
-31
@@ -97,7 +97,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getTotal(TopVoter.Monthly));
|
||||
}
|
||||
});
|
||||
}.withDescription("Month total"));
|
||||
|
||||
placeholders.add(new PlaceHolder("alltimetotal") {
|
||||
|
||||
@@ -105,7 +105,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getTotal(TopVoter.AllTime));
|
||||
}
|
||||
});
|
||||
}.withDescription("Alltime total"));
|
||||
|
||||
placeholders.add(new PlaceHolder("lastmonthtotal") {
|
||||
|
||||
@@ -113,7 +113,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getLastMonthTotal());
|
||||
}
|
||||
});
|
||||
}.withDescription("Last month total"));
|
||||
|
||||
// end of older placeholders
|
||||
|
||||
@@ -123,7 +123,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return "" + user.getDisableBroadcast();
|
||||
}
|
||||
});
|
||||
}.withDescription("Returns true/false if user has broadcast disabled"));
|
||||
|
||||
placeholders.add(new PlaceHolder("MilestoneCount") {
|
||||
|
||||
@@ -131,7 +131,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return "" + user.getMilestoneCount();
|
||||
}
|
||||
});
|
||||
}.withDescription("User milestonecount"));
|
||||
|
||||
for (final String identifier : Config.getInstance().getIdentifiers()) {
|
||||
if (Config.getInstance().getIdentifierLimit(identifier) > 0) {
|
||||
@@ -141,7 +141,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String ident) {
|
||||
return "" + user.getVoteShopIdentifierLimit(identifier);
|
||||
}
|
||||
});
|
||||
}.withDescription("User voteshop limit for " + identifier));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getTotal(top));
|
||||
}
|
||||
});
|
||||
}.withDescription("User total for " + top.getName()));
|
||||
}
|
||||
|
||||
placeholders.add(new PlaceHolder("BestDailyTotal") {
|
||||
@@ -161,7 +161,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getHighestDailyTotal());
|
||||
}
|
||||
});
|
||||
}.withDescription("Best daily total"));
|
||||
|
||||
placeholders.add(new PlaceHolder("BestWeeklyTotal") {
|
||||
|
||||
@@ -169,7 +169,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getHighestWeeklyTotal());
|
||||
}
|
||||
});
|
||||
}.withDescription("Best weekly total"));
|
||||
|
||||
placeholders.add(new PlaceHolder("BestMonthlyTotal") {
|
||||
|
||||
@@ -177,7 +177,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getHighestMonthlyTotal());
|
||||
}
|
||||
});
|
||||
}.withDescription("Best monthly total"));
|
||||
|
||||
placeholders.add(new PlaceHolder("DailyVoteStreak") {
|
||||
|
||||
@@ -185,7 +185,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getDayVoteStreak());
|
||||
}
|
||||
});
|
||||
}.withDescription("Current daily votestreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder("WeeklyVoteStreak") {
|
||||
|
||||
@@ -193,7 +193,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getWeekVoteStreak());
|
||||
}
|
||||
});
|
||||
}.withDescription("Current weekly votestreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder("MonthVoteStreak") {
|
||||
|
||||
@@ -201,7 +201,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getMonthVoteStreak());
|
||||
}
|
||||
});
|
||||
}.withDescription("Current month votestreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder("BestDailyVoteStreak") {
|
||||
|
||||
@@ -209,7 +209,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getBestDayVoteStreak());
|
||||
}
|
||||
});
|
||||
}.withDescription("Best daily votestreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder("BestWeeklyVoteStreak") {
|
||||
|
||||
@@ -217,7 +217,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getBestWeekVoteStreak());
|
||||
}
|
||||
});
|
||||
}.withDescription("Best weekly votestreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder("BestMonthVoteStreak") {
|
||||
|
||||
@@ -225,7 +225,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getBestMonthVoteStreak());
|
||||
}
|
||||
});
|
||||
}.withDescription("Best month votestreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Points") {
|
||||
|
||||
@@ -233,7 +233,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getPoints());
|
||||
}
|
||||
});
|
||||
}.withDescription("User points"));
|
||||
|
||||
placeholders.add(new PlaceHolder("CanVote") {
|
||||
|
||||
@@ -241,7 +241,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Boolean.toString(user.canVoteAll());
|
||||
}
|
||||
});
|
||||
}.withDescription("Return true/false if player can vote on all sites"));
|
||||
|
||||
for (final VoteSite voteSite : plugin.getVoteSites()) {
|
||||
placeholders.add(new PlaceHolder("Next_" + voteSite.getKey()) {
|
||||
@@ -250,14 +250,21 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Commands.getInstance().voteCommandNextInfo(user, voteSite);
|
||||
}
|
||||
});
|
||||
}.withDescription("How long until user can vote on " + voteSite.getKey()));
|
||||
placeholders.add(new PlaceHolder("Last_" + voteSite.getKey()) {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Commands.getInstance().voteCommandLastDuration(user, voteSite);
|
||||
}
|
||||
});
|
||||
}.withDescription("How long ago user voted on " + voteSite.getKey()));
|
||||
placeholders.add(new PlaceHolder("CanVote_" + voteSite.getKey()) {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return "" + user.canVoteSite(voteSite);
|
||||
}
|
||||
}.withDescription("Whether or not player can vote on " + voteSite.getKey()));
|
||||
}
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_All_Position") {
|
||||
@@ -273,7 +280,23 @@ public class PlaceHolders {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}.withDescription("Get user top voter position"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_AllVotes_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.AllTime).entrySet()) {
|
||||
if (num == number) {
|
||||
return "" + entry.getKey().getTotal(TopVoter.AllTime);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user votes at postion in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_All_") {
|
||||
|
||||
@@ -289,7 +312,7 @@ public class PlaceHolders {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith());
|
||||
}.useStartsWith().withDescription("Get user at postion in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_Month_Position") {
|
||||
|
||||
@@ -304,7 +327,7 @@ public class PlaceHolders {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}.withDescription("Get user top voter position"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_Month_") {
|
||||
|
||||
@@ -320,7 +343,23 @@ public class PlaceHolders {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith());
|
||||
}.useStartsWith().withDescription("Get user at postion in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_MonthVotes_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Monthly).entrySet()) {
|
||||
if (num == number) {
|
||||
return "" + entry.getKey().getTotal(TopVoter.Monthly);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user votes at postion in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_Week_Position") {
|
||||
|
||||
@@ -335,7 +374,7 @@ public class PlaceHolders {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}.withDescription("Get user top voter position"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_Week_") {
|
||||
|
||||
@@ -351,7 +390,23 @@ public class PlaceHolders {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith());
|
||||
}.useStartsWith().withDescription("Get user at postion in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_WeekVotes_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Weekly).entrySet()) {
|
||||
if (num == number) {
|
||||
return "" + entry.getKey().getTotal(TopVoter.Weekly);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user votes at postion in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_Daily_Position") {
|
||||
|
||||
@@ -366,7 +421,7 @@ public class PlaceHolders {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}.withDescription("Get user top voter position"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_Daily_") {
|
||||
|
||||
@@ -382,7 +437,23 @@ public class PlaceHolders {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith());
|
||||
}.useStartsWith().withDescription("Get user at postion in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_DailyVotes_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Daily).entrySet()) {
|
||||
if (num == number) {
|
||||
return "" + entry.getKey().getTotal(TopVoter.Daily);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user votes at postion in top voter"));
|
||||
|
||||
// non players
|
||||
|
||||
@@ -392,7 +463,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(VoteParty.getInstance().getTotalVotes());
|
||||
}
|
||||
});
|
||||
}.withDescription("Current amount of voteparty votes"));
|
||||
|
||||
nonPlayerPlaceholders.add(new PlaceHolder("VotePartyVotesNeeded") {
|
||||
|
||||
@@ -400,7 +471,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(VoteParty.getInstance().getNeededVotes());
|
||||
}
|
||||
});
|
||||
}.withDescription("Voteparty votes needed"));
|
||||
|
||||
nonPlayerPlaceholders.add(new PlaceHolder("VotePartyVotesRequired") {
|
||||
|
||||
@@ -408,6 +479,6 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(VoteParty.getInstance().getVotesRequired());
|
||||
}
|
||||
});
|
||||
}.withDescription("Amount of votes needed for voteparty"));
|
||||
}
|
||||
}
|
||||
@@ -95,8 +95,8 @@ public class VoteParty implements Listener {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
giveRewards();
|
||||
MiscUtils.getInstance().broadcast(Config.getInstance().getVotePartyBroadcast());
|
||||
giveRewards();
|
||||
|
||||
if (Config.getInstance().getVotePartyIncreaseVotesRquired() > 0) {
|
||||
ServerData.getInstance().setVotePartyExtraRequired(ServerData.getInstance().getVotePartyExtraRequired()
|
||||
@@ -174,19 +174,17 @@ public class VoteParty implements Listener {
|
||||
}
|
||||
|
||||
public void giveReward(User user, boolean online) {
|
||||
/*
|
||||
* if (PlayerUtils.getInstance().isPlayerOnline(user.getPlayerName())) { if
|
||||
* (user.getVotePartyVotes() >= Config.getInstance().getUserVotesRequired()) {
|
||||
* RewardHandler.getInstance().giveReward(user, Config.getInstance().getData(),
|
||||
* Config.getInstance().getVotePartyRewardsPath()); } } else {
|
||||
* user.addOfflineOtherReward("VoteParty"); }
|
||||
*/
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getVotePartyRewardsPath())
|
||||
.setOnline(online)
|
||||
.withPlaceHolder("VotesRequired", "" + Config.getInstance().getVotePartyVotesRequired()).send(user);
|
||||
}
|
||||
|
||||
public void giveReward(User user) {
|
||||
if (Config.getInstance().getVotePartyUserVotesRequired() > 0) {
|
||||
if (user.getVotePartyVotes() < Config.getInstance().getVotePartyUserVotesRequired()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
giveReward(user, user.isOnline());
|
||||
}
|
||||
|
||||
@@ -206,11 +204,13 @@ public class VoteParty implements Listener {
|
||||
}
|
||||
|
||||
if (Config.getInstance().getVotePartyGiveAllPlayers()) {
|
||||
plugin.debug("Giving all players vote party");
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
giveReward(user);
|
||||
}
|
||||
} else {
|
||||
plugin.debug(ArrayUtils.getInstance().makeStringList(getVotedUsers()));
|
||||
for (String uuid : getVotedUsers()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
giveReward(user);
|
||||
|
||||
Reference in new issue
Block a user