Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23ffc18289 | ||
|
|
2152a6688f | ||
|
|
c3220392eb | ||
|
|
fec401485b | ||
|
|
2b2a6385b4 | ||
|
|
9937f3d9c0 | ||
|
|
b276d516a6 | ||
|
|
d6a336e9b9 | ||
|
|
b356cb1794 | ||
|
|
4b0a2ee384 | ||
|
|
8dab62124e | ||
|
|
a7df1a0150 | ||
|
|
f2d7e24400 | ||
|
|
fa74bdcb3c | ||
|
|
80a4cb8f78 | ||
|
|
f16aef16d4 | ||
|
|
e7a1a1241b | ||
|
|
0ee002e3fb | ||
|
|
69ab9df8b3 | ||
|
|
54ff1dd66b | ||
|
|
75732910e2 | ||
|
|
9c6614836a | ||
|
|
72148816e5 | ||
|
|
f969c91170 | ||
|
|
904d660919 | ||
|
|
fb5449effe | ||
|
|
46db998e17 | ||
|
|
2bcf096584 | ||
|
|
c2b7e2388e | ||
|
|
180ae04b24 | ||
|
|
73efcfb87f | ||
|
|
6ba2ff582a | ||
|
|
d622b5b684 | ||
|
|
2247134daa | ||
|
|
7de7150e41 | ||
|
|
be23989a20 | ||
|
|
8c4bdc8e20 | ||
|
|
f4d507d821 | ||
|
|
43fd338efd | ||
|
|
c51873e7b2 | ||
|
|
5e1d5b534b | ||
|
|
c762ef5be1 | ||
|
|
1d0f8d5c06 | ||
|
|
6129480077 | ||
|
|
f8d7c837f9 | ||
|
|
d7aba7b390 | ||
|
|
5833a1c5cc | ||
|
|
6833247a8c | ||
|
|
46087ccad5 | ||
|
|
4634d6bdc2 | ||
|
|
3f451c888a | ||
|
|
ea448e3920 | ||
|
|
169aaf026e | ||
|
|
0af3f7f2bc | ||
|
|
b3baa33c39 | ||
|
|
e7f8aac88d | ||
|
|
6ce4040bae | ||
|
|
f5e38b2b1b | ||
|
|
9fdb9b4efb | ||
|
|
29f020bdc0 | ||
|
|
cce5bb0672 | ||
|
|
8a0cd0426c | ||
|
|
397c4392a0 | ||
|
|
4784b372c9 | ||
|
|
1521d0787c | ||
|
|
9cbcb74822 |
No files matched your search
@@ -2,8 +2,11 @@ eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
|
||||
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
|
||||
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
|
||||
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
|
||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
@@ -64,12 +67,14 @@ org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
||||
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
|
||||
@@ -81,7 +86,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=info
|
||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
|
||||
@@ -92,6 +97,9 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
@@ -99,6 +107,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||
|
||||
@@ -19,6 +19,10 @@ MySQL:
|
||||
Password: ''
|
||||
# Max number of connections
|
||||
MaxConnections: 1
|
||||
# Maxium size of caching mysql
|
||||
# -1 for no limit
|
||||
# Affecting this value may affect performance
|
||||
MaxSize: -1
|
||||
|
||||
# Let players who never joined before vote
|
||||
# Recommend: False (Will prevent creating random user data files)
|
||||
@@ -104,12 +108,6 @@ Commands:
|
||||
# Set Message to '' (2 ') to disable message
|
||||
|
||||
Format:
|
||||
# Message when player tries to run command without required permissions
|
||||
NoPerms: '&cYou do not have enough permission!'
|
||||
|
||||
# Message when player types a command but does not input a number where needed
|
||||
NotNumber: '&cError on &6%arg%&c, number expected!'
|
||||
|
||||
# CommandHandler help message
|
||||
HelpLine: '&3&l%Command% - &3%HelpMessage%'
|
||||
|
||||
@@ -156,7 +154,7 @@ Format:
|
||||
# If there is an error finding out time until next vote
|
||||
Error: '&cCould not caculate time until next vote!'
|
||||
# For sites that have this, requires votedelaydaily to be set to true in the site
|
||||
VoteDelayDaily: 'Tomorrow'
|
||||
VoteDelayDaily: '%hours% Hours and %minutes% Minutes'
|
||||
|
||||
# Format for /vote last
|
||||
Last:
|
||||
@@ -353,10 +351,16 @@ GUI:
|
||||
Material: 'REDSTONE_BLOCK'
|
||||
Data: 0
|
||||
Amount: 1
|
||||
Name: '&4All Voting Sites'
|
||||
Lore:
|
||||
- '&cClick Me'
|
||||
CanVoteItem:
|
||||
Material: 'EMERALD_BLOCK'
|
||||
Data: 0
|
||||
Amount: 1
|
||||
Name: '&4All Voting Sites'
|
||||
Lore:
|
||||
- '&cClick Me'
|
||||
AlreadyVotedItem:
|
||||
Material: 'REDSTONE_BLOCK'
|
||||
Data: 0
|
||||
@@ -507,7 +511,14 @@ GUI:
|
||||
VoteGUIName: '&cVoteGUI: &c&l%player%'
|
||||
VoteRewardName: 'VoteReward'
|
||||
VoteShopName: 'VoteShop'
|
||||
|
||||
BackButton:
|
||||
Material: 'PAPER'
|
||||
Data: 0
|
||||
Amount: 1
|
||||
Name: '&8Back to VoteGUI'
|
||||
|
||||
VoteShopBackButton: true
|
||||
Shop:
|
||||
# Identifier
|
||||
# Used in placeholders for formats
|
||||
@@ -580,6 +591,8 @@ VoteParty:
|
||||
GiveAllPlayers: false
|
||||
# If true, the vote count will reset each day
|
||||
ResetEachDay: false
|
||||
# Count votes from /av vote?
|
||||
CountFakeVotes: true
|
||||
# Number of user votes that apply to vote party total the user needs to get rewards
|
||||
UserVotesRequired: 0
|
||||
# Broadcast when vote party reached
|
||||
@@ -678,7 +691,7 @@ EnableMonthlyAwards: true
|
||||
MonthlyAwards:
|
||||
# Position. 1 is first in top voter, 2 is second, etc...
|
||||
1:
|
||||
Rewards:
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou came in first place in %TopVoter%!'
|
||||
2:
|
||||
@@ -762,6 +775,16 @@ LogVotesToFile: false
|
||||
# Longer times result in longer wait in stuff updating after a vote, like topvoter
|
||||
DelayBetweenUpdates: 3
|
||||
|
||||
# Clear cache on update, setting to true reduces performance
|
||||
ClearCacheOnUpdate: false
|
||||
|
||||
# Set to true to disable no service site message on voting
|
||||
# You should never have to touch this if everything is setup properly
|
||||
DisableNoServiceSiteMessage: false
|
||||
|
||||
# Used in special cases
|
||||
# Much slower, but may work better
|
||||
AlternateUUIDLookup: false
|
||||
|
||||
# Shouldn't need to change this
|
||||
AutoKillInvs: true
|
||||
@@ -156,6 +156,30 @@ commands:
|
||||
adminvoteClearCache:
|
||||
description: Command Alias
|
||||
aliases: avClearCache
|
||||
adminvoteConvertFrom:
|
||||
description: Command Alias
|
||||
aliases: avConvertFrom
|
||||
adminvoteRemovePoints:
|
||||
description: Command Alias
|
||||
aliases: avRemovePoints
|
||||
adminvoteServiceSites:
|
||||
description: Command Alias
|
||||
aliases: avServiceSites
|
||||
adminvoteSetVotePartyCount:
|
||||
description: Command Alias
|
||||
aliases: avSetVotePartyCount
|
||||
adminvoteClearOfflineVotes:
|
||||
description: Command Alias
|
||||
aliases: avClearOfflineVotes
|
||||
adminvoteGiveAll:
|
||||
description: Command Alias
|
||||
aliases: avGiveAll
|
||||
adminvoteGiveAllOnline:
|
||||
description: Command Alias
|
||||
aliases: avGiveAllOnline
|
||||
adminvoteForceTimeChanged:
|
||||
description: Command Alias
|
||||
aliases: avForceTimeChanged
|
||||
permissions:
|
||||
VotingPlugin.Player:
|
||||
description: Allows basic access player commands
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.Ben12345rocks</groupId>
|
||||
<artifactId>VotingPlugin</artifactId>
|
||||
<version>5.9.4</version>
|
||||
<version>5.10.2</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>VotingPlugin</name>
|
||||
<properties>
|
||||
@@ -161,7 +161,7 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.12-R0.1-SNAPSHOT</version>
|
||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.Ben12345rocks.VotingPlugin.Commands.GUI.PlayerGUIs;
|
||||
import com.Ben12345rocks.VotingPlugin.Commands.TabCompleter.AliasesTabCompleter;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.ConfigVoteSites;
|
||||
import com.Ben12345rocks.VotingPlugin.Data.ServerData;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.PlayerVoteEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.VotiferEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
@@ -226,7 +227,20 @@ public class CommandLoader {
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
user.addPoints(Integer.parseInt(args[2]));
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&cGave " + args[1] + " " + args[2] + " points"));
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&cGave " + args[1] + " " + args[2] + " points"
|
||||
+ ", " + args[1] + " now has " + user.getPoints() + " points"));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.adminVoteCommand.add(new CommandHandler(new String[] { "RemovePoints", "(player)", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.RemovePoints|" + adminPerm, "Remove voting points") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
user.removePoints(Integer.parseInt(args[2]));
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&cRemoved " + args[2] + " points from " + args[1]
|
||||
+ ", " + args[1] + " now has " + user.getPoints() + " points"));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -240,6 +254,27 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.adminVoteCommand.add(new CommandHandler(new String[] { "ServiceSites" },
|
||||
"VotingPlugin.Commands.AdminVote.ServiceSites|" + adminPerm,
|
||||
"See a list of all service sites the server got") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
sendMessage(sender, "&cEvery service site the server has gotten:");
|
||||
|
||||
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?");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
plugin.adminVoteCommand.add(new CommandHandler(new String[] { "Help&?", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.Help|" + adminPerm, "See this page") {
|
||||
|
||||
@@ -435,7 +470,7 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
VotiferEvent.playerVote(args[1], args[2]);
|
||||
VotiferEvent.playerVote(args[1], args[2], false);
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(plugin.getVoteSite(args[2]),
|
||||
UserManager.getInstance().getVotingPluginUser(args[1]));
|
||||
plugin.getServer().getPluginManager().callEvent(voteEvent);
|
||||
@@ -468,7 +503,8 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
CommandAdminVote.getInstance().setVoteSiteServiceSite(sender, args[1], args[3]);
|
||||
CommandAdminVote.getInstance().setVoteSiteServiceSite(sender, plugin.getVoteSiteName(args[1]),
|
||||
args[3]);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -478,7 +514,8 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
CommandAdminVote.getInstance().setVoteSiteVoteURL(sender, args[1], args[3]);
|
||||
CommandAdminVote.getInstance().setVoteSiteVoteURL(sender, plugin.getVoteSiteName(args[1]),
|
||||
args[3]);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -489,7 +526,8 @@ public class CommandLoader {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
|
||||
CommandAdminVote.getInstance().setVoteSitePriority(sender, args[1], Integer.parseInt(args[3]));
|
||||
CommandAdminVote.getInstance().setVoteSitePriority(sender, plugin.getVoteSiteName(args[1]),
|
||||
Integer.parseInt(args[3]));
|
||||
|
||||
}
|
||||
});
|
||||
@@ -501,7 +539,8 @@ public class CommandLoader {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
|
||||
CommandAdminVote.getInstance().setVoteSiteVoteDelay(sender, args[1], Integer.parseInt(args[3]));
|
||||
CommandAdminVote.getInstance().setVoteSiteVoteDelay(sender, plugin.getVoteSiteName(args[1]),
|
||||
Integer.parseInt(args[3]));
|
||||
|
||||
}
|
||||
});
|
||||
@@ -531,7 +570,7 @@ public class CommandLoader {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
|
||||
CommandAdminVote.getInstance().setVoteSiteEnabled(sender, args[1],
|
||||
CommandAdminVote.getInstance().setVoteSiteEnabled(sender, plugin.getVoteSiteName(args[1]),
|
||||
Boolean.parseBoolean(args[3]));
|
||||
|
||||
}
|
||||
@@ -543,7 +582,7 @@ public class CommandLoader {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
|
||||
CommandAdminVote.getInstance().checkVoteSite(sender, args[1]);
|
||||
CommandAdminVote.getInstance().checkVoteSite(sender, plugin.getVoteSiteName(args[1]));
|
||||
|
||||
}
|
||||
});
|
||||
@@ -559,6 +598,29 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.adminVoteCommand.add(new CommandHandler(new String[] { "SetVotePartyCount", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.SetVotePartyCount|" + adminPerm, "Set voteparty count") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
plugin.getVoteParty().setTotalVotes(Integer.parseInt(args[1]));
|
||||
sendMessage(sender, "&cSet vote party count to " + args[1]);
|
||||
}
|
||||
});
|
||||
|
||||
plugin.adminVoteCommand.add(new CommandHandler(new String[] { "ClearOfflineVotes" },
|
||||
"VotingPlugin.Commands.AdminVote.ClearOfflineVotes|" + adminPerm, "Clear all offline votes") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
user.setOfflineVotes(new ArrayList<String>());
|
||||
}
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&cCleared"));
|
||||
}
|
||||
});
|
||||
|
||||
ArrayList<CommandHandler> avCommands = com.Ben12345rocks.AdvancedCore.Commands.CommandLoader.getInstance()
|
||||
.getBasicAdminCommands("VotingPlugin");
|
||||
for (CommandHandler cmd : avCommands) {
|
||||
@@ -643,7 +705,8 @@ public class CommandLoader {
|
||||
@Override
|
||||
public void onInput(Player player, String value) {
|
||||
VotiferEvent.playerVote(
|
||||
UserGUI.getInstance().getCurrentPlayer(player), value);
|
||||
UserGUI.getInstance().getCurrentPlayer(player), value,
|
||||
false);
|
||||
|
||||
player.sendMessage("Forced vote for "
|
||||
+ UserGUI.getInstance().getCurrentPlayer(player)
|
||||
@@ -958,7 +1021,12 @@ public class CommandLoader {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
Player player = (Player) sender;
|
||||
PlayerGUIs.getInstance().openVoteGUI(player, UserManager.getInstance().getVotingPluginUser(args[1]));
|
||||
if (com.Ben12345rocks.AdvancedCore.UserManager.UserManager.getInstance().userExist(args[1])) {
|
||||
PlayerGUIs.getInstance().openVoteGUI(player,
|
||||
UserManager.getInstance().getVotingPluginUser(args[1]));
|
||||
} else {
|
||||
sendMessage(sender, "&cUser does not exist: " + args[1]);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -197,7 +197,7 @@ public class Commands {
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
|
||||
for (CommandHandler handle : plugin.voteCommand) {
|
||||
msg.add(handle.getHelpLineCommand("/v") + " : " + handle.getPerm());
|
||||
msg.add(handle.getHelpLineCommand("/vote") + " : " + handle.getPerm());
|
||||
}
|
||||
|
||||
for (CommandHandler handle : plugin.adminVoteCommand) {
|
||||
@@ -467,9 +467,6 @@ public class Commands {
|
||||
return ArrayUtils.getInstance().convert(ArrayUtils.getInstance().colorize(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update vote today.
|
||||
*/
|
||||
public void updateVoteToday(ArrayList<User> users) {
|
||||
plugin.voteToday.clear();
|
||||
|
||||
@@ -527,9 +524,13 @@ public class Commands {
|
||||
* @return the string
|
||||
*/
|
||||
public String voteCommandLastDate(User user, VoteSite voteSite) {
|
||||
Date date = new Date(user.getTime(voteSite));
|
||||
String timeString = new SimpleDateFormat(config.getFormatTimeFormat()).format(date);
|
||||
return timeString;
|
||||
long time = user.getTime(voteSite);
|
||||
if (time > 0) {
|
||||
Date date = new Date(time);
|
||||
String timeString = new SimpleDateFormat(config.getFormatTimeFormat()).format(date);
|
||||
return timeString;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String voteCommandLastLine(User user, VoteSite voteSite) {
|
||||
@@ -611,7 +612,18 @@ public class Commands {
|
||||
}
|
||||
} else {
|
||||
if (lastVote.getDayOfYear() == now.getDayOfYear() && lastVote.getYear() == now.getYear()) {
|
||||
info = config.getFormatCommandsVoteNextInfoVoteDelayDaily();
|
||||
LocalDateTime midnight = LocalDateTime.now().plusDays(1).withHour(0).withMinute(0);
|
||||
Duration dur = Duration.between(now, midnight);
|
||||
|
||||
int diffHours = (int) (dur.getSeconds() / (60 * 60));
|
||||
long diffMinutes = dur.getSeconds() / 60 - diffHours*60;
|
||||
|
||||
String timeMsg = config.getFormatCommandsVoteNextInfoVoteDelayDaily();
|
||||
timeMsg = StringUtils.getInstance().replaceIgnoreCase(timeMsg, "%hours%", Integer.toString(diffHours));
|
||||
timeMsg = StringUtils.getInstance().replaceIgnoreCase(timeMsg, "%minutes%",
|
||||
Long.toString(diffMinutes));
|
||||
info = timeMsg;
|
||||
|
||||
} else {
|
||||
info = config.getFormatCommandsVoteNextInfoCanVote();
|
||||
}
|
||||
|
||||
@@ -4,8 +4,11 @@ import java.time.format.DateTimeFormatter;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.AdvancedCoreHook;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Inventory.BInventory;
|
||||
@@ -97,7 +100,7 @@ public class PlayerGUIs {
|
||||
&& !player.hasPermission("VotingPlugin.Mod"))
|
||||
|| (!player.hasPermission("VotingPlugin.Commands.Vote.GUI")
|
||||
&& !player.hasPermission("VotingPlugin.Player"))) {
|
||||
player.sendMessage(AdvancedCoreHook.getInstance().getFormatNoPerms());
|
||||
player.sendMessage(StringUtils.getInstance().colorize(AdvancedCoreHook.getInstance().getFormatNoPerms()));
|
||||
return;
|
||||
}
|
||||
setSelectedPlayer(player, user);
|
||||
@@ -181,7 +184,7 @@ public class PlayerGUIs {
|
||||
.replacePlaceHolder(Config.getInstance().getGUIVoteLastName(), "player", user.getPlayerName()));
|
||||
for (VoteSite site : plugin.getVoteSites()) {
|
||||
inv.addButton(inv.getNextSlot(),
|
||||
new BInventoryButton(new ItemBuilder(site.getItem()).setName(site.getDisplayName())
|
||||
new BInventoryButton(site.getItem().setName(site.getDisplayName())
|
||||
.setLore(Commands.getInstance().voteCommandLastLine(user, site)).setAmountNone(1)) {
|
||||
|
||||
@Override
|
||||
@@ -192,7 +195,7 @@ public class PlayerGUIs {
|
||||
}
|
||||
|
||||
if (Config.getInstance().getGUIVoteLastBackButton()) {
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.PAPER, 1).setName("&8Back to VoteGUI")) {
|
||||
inv.addButton(new BInventoryButton(getBackButton()) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -211,7 +214,7 @@ public class PlayerGUIs {
|
||||
.replacePlaceHolder(Config.getInstance().getGUIVoteNextName(), "player", user.getPlayerName()));
|
||||
for (VoteSite site : plugin.getVoteSites()) {
|
||||
inv.addButton(inv.getNextSlot(),
|
||||
new BInventoryButton(new ItemBuilder(site.getItem()).setName(site.getDisplayName())
|
||||
new BInventoryButton(site.getItem().setName(site.getDisplayName())
|
||||
.setLore(Commands.getInstance().voteCommandNextInfo(user, site)).setAmountNone(1)) {
|
||||
|
||||
@Override
|
||||
@@ -222,7 +225,7 @@ public class PlayerGUIs {
|
||||
}
|
||||
|
||||
if (Config.getInstance().getGUIVoteNextBackButton()) {
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.PAPER, 1).setName("&8Back to VoteGUI")) {
|
||||
inv.addButton(new BInventoryButton(getBackButton()) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -296,7 +299,7 @@ public class PlayerGUIs {
|
||||
});
|
||||
|
||||
if (Config.getInstance().getGUIVoteStreakBackButton()) {
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.PAPER, 1).setName("&8Back to VoteGUI")) {
|
||||
inv.addButton(new BInventoryButton(getBackButton()) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -309,6 +312,7 @@ public class PlayerGUIs {
|
||||
}
|
||||
|
||||
public void openVoteToday(Player player) {
|
||||
setSelectedPlayer(player, null);
|
||||
BInventory inv = new BInventory(Config.getInstance().getGUIVoteTodayName());
|
||||
for (User user : plugin.voteToday.keySet()) {
|
||||
|
||||
@@ -331,7 +335,7 @@ public class PlayerGUIs {
|
||||
}
|
||||
|
||||
if (Config.getInstance().getGUIVoteTodayBackButton()) {
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.PAPER, 1).setName("&8Back to VoteGUI")) {
|
||||
inv.addButton(new BInventoryButton(getBackButton()) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -373,12 +377,20 @@ public class PlayerGUIs {
|
||||
.addLoreLine(Config.getInstance().getGUIVoteTopItemLore())
|
||||
.addPlaceholder("position", "" + pos)
|
||||
.addPlaceholder("player", entry.getKey().getPlayerName())
|
||||
.addPlaceholder("votes", "" + entry.getValue())) {
|
||||
.addPlaceholder("votes", "" + entry.getValue())
|
||||
.addLoreLine("&3Name: " + entry.getKey().getPlayerName())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
User user = UserManager.getInstance()
|
||||
.getVotingPluginUser(clickEvent.getClickedItem().getItemMeta().getDisplayName());
|
||||
String name = "";
|
||||
ItemBuilder item = new ItemBuilder(clickEvent.getClickedItem());
|
||||
for (String lore : item.getLore()) {
|
||||
if (lore.contains("Name:")) {
|
||||
name = ChatColor.stripColor(item.getName()).split(":")[1].trim();
|
||||
plugin.debug(name);
|
||||
}
|
||||
}
|
||||
User user = UserManager.getInstance().getVotingPluginUser(name);
|
||||
openVoteGUI(player, user);
|
||||
}
|
||||
});
|
||||
@@ -390,12 +402,16 @@ public class PlayerGUIs {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
openVoteTop(player, cur.next());
|
||||
if (!clickEvent.getClick().equals(ClickType.RIGHT)) {
|
||||
openVoteTop(player, cur.next());
|
||||
} else {
|
||||
openVoteTop(player, cur.prev());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (Config.getInstance().getGUIVoteTopBackButton()) {
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.PAPER, 1).setName("&8Back to VoteGUI")) {
|
||||
inv.getPageButtons().add(new BInventoryButton(getBackButton().setSlot(1)) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -446,7 +462,7 @@ public class PlayerGUIs {
|
||||
});
|
||||
|
||||
if (Config.getInstance().getGUIVoteTotalBackButton()) {
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.PAPER, 1).setName("&8Back to VoteGUI")) {
|
||||
inv.addButton(new BInventoryButton(getBackButton()) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -464,6 +480,7 @@ public class PlayerGUIs {
|
||||
* the player
|
||||
*/
|
||||
public void openVoteURL(Player player) {
|
||||
setSelectedPlayer(player, null);
|
||||
BInventory inv = new BInventory(Config.getInstance().getGUIVoteURLName());
|
||||
|
||||
User user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
@@ -476,8 +493,12 @@ public class PlayerGUIs {
|
||||
builderAll = new ItemBuilder(Config.getInstance().getVoteURLCanVoteAllUrlsButtonItemSection());
|
||||
}
|
||||
|
||||
builderAll.setName("&4All Voting Sites");
|
||||
builderAll.setLore("&cClick Me");
|
||||
if (!builderAll.hasCustomDisplayName()) {
|
||||
builderAll.setName("&4All Voting Sites");
|
||||
}
|
||||
if (!builderAll.hasCustomLore()) {
|
||||
builderAll.setLore("&cClick Me");
|
||||
}
|
||||
|
||||
inv.addButton(count, new BInventoryButton(builderAll) {
|
||||
|
||||
@@ -524,7 +545,7 @@ public class PlayerGUIs {
|
||||
}
|
||||
|
||||
if (Config.getInstance().getGUIVoteURLBackButton()) {
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.PAPER, 1).setName("&8Back to VoteGUI")) {
|
||||
inv.addButton(new BInventoryButton(getBackButton()) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -573,7 +594,7 @@ public class PlayerGUIs {
|
||||
});
|
||||
|
||||
if (Config.getInstance().getGUIVoteURLBackButton()) {
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.PAPER, 1).setName("&8Back to VoteGUI")) {
|
||||
inv.addButton(new BInventoryButton(getBackButton()) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -603,7 +624,7 @@ public class PlayerGUIs {
|
||||
int count = 0;
|
||||
for (VoteSite voteSite : plugin.getVoteSites()) {
|
||||
try {
|
||||
ItemBuilder builder = new ItemBuilder(voteSite.getItem());
|
||||
ItemBuilder builder = voteSite.getItem();
|
||||
final VoteSite site = voteSite;
|
||||
|
||||
inv.addButton(count, new BInventoryButton(builder) {
|
||||
@@ -645,4 +666,12 @@ public class PlayerGUIs {
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
public ItemBuilder getBackButton() {
|
||||
ConfigurationSection sec = Config.getInstance().getBackButton();
|
||||
if (sec != null) {
|
||||
return new ItemBuilder(sec);
|
||||
}
|
||||
return new ItemBuilder(Material.PAPER, 1).setName("&8Back to VoteGUI");
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public class Config extends YMLFile {
|
||||
public boolean allowUnJoined() {
|
||||
return getData().getBoolean("AllowUnjoined");
|
||||
}
|
||||
|
||||
|
||||
public boolean getGUIVoteLastBackButton() {
|
||||
return getData().getBoolean("GUI.VoteLast.BackButton");
|
||||
}
|
||||
@@ -383,7 +383,12 @@ public class Config extends YMLFile {
|
||||
}
|
||||
|
||||
public String getFormatCommandsVoteNextInfoVoteDelayDaily() {
|
||||
return getData().getString("Format.Commands.Vote.Next.Info.VoteDelayDaily", "Tomorrow");
|
||||
return getData().getString("Format.Commands.Vote.Next.Info.VoteDelayDaily",
|
||||
"%hours% Hours and %minutes% Minutes");
|
||||
}
|
||||
|
||||
public boolean getVoteShopBackButton() {
|
||||
return getData().getBoolean("VoteShopBackButton", true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -860,6 +865,26 @@ public class Config extends YMLFile {
|
||||
return "MonthlyAwards." + pos + ".Rewards";
|
||||
}
|
||||
|
||||
public boolean getAlternateUUIDLookup() {
|
||||
return getData().getBoolean("AlternateUUIDLookup");
|
||||
}
|
||||
|
||||
public int getMysqlMaxSize() {
|
||||
return getData().getInt("MySQL.MaxSize", -1);
|
||||
}
|
||||
|
||||
public ConfigurationSection getBackButton() {
|
||||
return getData().getConfigurationSection("BackButton");
|
||||
}
|
||||
|
||||
public boolean getAutoKillInvs() {
|
||||
return getData().getBoolean("AutoKillInvs", true);
|
||||
}
|
||||
|
||||
public boolean getVotePartyCountFakeVotes() {
|
||||
return getData().getBoolean("VoteParty.CountFakeVotes", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the monthly awards enabled.
|
||||
*
|
||||
@@ -869,6 +894,10 @@ public class Config extends YMLFile {
|
||||
return getData().getBoolean("EnableMonthlyAwards");
|
||||
}
|
||||
|
||||
public boolean getClearCacheOnUpdate() {
|
||||
return getData().getBoolean("ClearCacheOnUpdate");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the monthly possible reward places.
|
||||
*
|
||||
@@ -1387,23 +1416,23 @@ public class Config extends YMLFile {
|
||||
public boolean getGUIVoteStreakBackButton() {
|
||||
return getData().getBoolean("GUI.VoteStreak.BackButton");
|
||||
}
|
||||
|
||||
|
||||
public boolean getGUIVoteNextBackButton() {
|
||||
return getData().getBoolean("GUI.VoteNext.BackButton");
|
||||
}
|
||||
|
||||
|
||||
public boolean getGUIVoteTodayBackButton() {
|
||||
return getData().getBoolean("GUI.VoteToday.BackButton");
|
||||
}
|
||||
|
||||
|
||||
public boolean getGUIVoteTopBackButton() {
|
||||
return getData().getBoolean("GUI.VoteToday.BackButton");
|
||||
}
|
||||
|
||||
|
||||
public boolean getGUIVoteTotalBackButton() {
|
||||
return getData().getBoolean("GUI.VoteTotal.BackButton");
|
||||
}
|
||||
|
||||
|
||||
public boolean getGUIVoteURLBackButton() {
|
||||
return getData().getBoolean("GUI.VoteURL.BackButton");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -224,4 +225,20 @@ public class ServerData {
|
||||
public void updateValues() {
|
||||
setVersion();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ArrayList<String> getServiceSites() {
|
||||
return (ArrayList<String>) getData().getList("ServiceSites", new ArrayList<String>());
|
||||
}
|
||||
|
||||
public void addServiceSite(String site) {
|
||||
ArrayList<String> l = getServiceSites();
|
||||
l.add(site);
|
||||
setServiceSites(l);
|
||||
}
|
||||
|
||||
public void setServiceSites(ArrayList<String> list) {
|
||||
getData().set("ServiceSites", list);
|
||||
saveData();
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,12 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.PlayerUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.ConfigVoteSites;
|
||||
import com.Ben12345rocks.VotingPlugin.Data.ServerData;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.VoteSite;
|
||||
import com.Ben12345rocks.VotingPlugin.OtherRewards.OtherVoteReward;
|
||||
@@ -33,39 +36,46 @@ public class VotiferEvent implements Listener {
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
/**
|
||||
* Player vote.
|
||||
*
|
||||
* @param playerName
|
||||
* the player name
|
||||
* @param voteSiteURL
|
||||
* the vote site URL
|
||||
*/
|
||||
public static void playerVote(final String playerName, final String voteSiteURL) {
|
||||
playerVote(playerName, voteSiteURL, true);
|
||||
}
|
||||
|
||||
public static void playerVote(final String playerName, final String voteSiteURL, final boolean realVote) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
synchronized (configVoteSites) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(playerName);
|
||||
if (!user.hasLoggedOnBefore() && !config.allowUnJoined()) {
|
||||
if (!PlayerUtils.getInstance().isValidUser(playerName) && !config.allowUnJoined()) {
|
||||
plugin.getLogger().warning("Player " + playerName
|
||||
+ " has not joined before, disregarding vote, set AllowUnjoined to true to prevent this");
|
||||
return;
|
||||
}
|
||||
User user = UserManager.getInstance().getVotingPluginUser(playerName);
|
||||
|
||||
VoteSite voteSite = plugin.getVoteSite(voteSiteURL);
|
||||
if (voteSite == null) {
|
||||
if (!Config.getInstance().getDisableNoServiceSiteMessage()) {
|
||||
plugin.getLogger().warning("No voting site with the service site: '" + voteSiteURL + "'");
|
||||
plugin.getLogger().warning(
|
||||
"Please read here on how to fix it: https://github.com/Ben12345rocks/VotingPlugin/wiki/Common-Problems");
|
||||
|
||||
ArrayList<String> services = new ArrayList<String>();
|
||||
for (VoteSite site : plugin.getVoteSites()) {
|
||||
services.add(site.getServiceSite());
|
||||
}
|
||||
plugin.getLogger().warning(
|
||||
"Current service sites: " + ArrayUtils.getInstance().makeStringList(services));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// vote party
|
||||
if (Config.getInstance().getVotePartyEnabled()) {
|
||||
VoteParty.getInstance().addTotal(user);
|
||||
VoteParty.getInstance().addVotePlayer(user);
|
||||
VoteParty.getInstance().check();
|
||||
if (Config.getInstance().getVotePartyCountFakeVotes() || realVote) {
|
||||
VoteParty.getInstance().addTotal(user);
|
||||
VoteParty.getInstance().addVotePlayer(user);
|
||||
VoteParty.getInstance().check();
|
||||
}
|
||||
}
|
||||
|
||||
// broadcast vote if enabled in config
|
||||
@@ -96,9 +106,12 @@ public class VotiferEvent implements Listener {
|
||||
|
||||
if (user.isOnline() || voteSite.isGiveOffline()) {
|
||||
user.playerVote(voteSite, true, false);
|
||||
user.closeInv();
|
||||
} else {
|
||||
user.addOfflineVote(voteSite.getKey());
|
||||
plugin.debug("Offline vote set for " + playerName + " on " + voteSite.getKey());
|
||||
// plugin.debug(ArrayUtils.getInstance().makeStringList(user.getOfflineVotes()));
|
||||
plugin.debug("Offline vote set for " + playerName + " (" + user.getUUID() + ") on "
|
||||
+ voteSite.getKey());
|
||||
}
|
||||
|
||||
plugin.setUpdate(true);
|
||||
@@ -129,7 +142,8 @@ public class VotiferEvent implements Listener {
|
||||
|
||||
Vote vote = event.getVote();
|
||||
final String voteSite = vote.getServiceName();
|
||||
final String voteUsername = vote.getUsername();
|
||||
final String voteUsername = vote.getUsername().trim();
|
||||
ServerData.getInstance().addServiceSite(voteSite);
|
||||
|
||||
if (voteUsername.length() == 0) {
|
||||
plugin.getLogger().warning("No name from vote on " + voteSite);
|
||||
@@ -167,7 +181,7 @@ public class VotiferEvent implements Listener {
|
||||
ConfigVoteSites.getInstance().generateVoteSite(voteSiteName);
|
||||
}
|
||||
|
||||
playerVote(voteUsername, voteSite);
|
||||
playerVote(voteUsername, voteSite, true);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
@@ -16,6 +17,7 @@ import java.util.TimerTask;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@@ -74,16 +76,16 @@ public class Main extends JavaPlugin {
|
||||
public static Main plugin;
|
||||
|
||||
/** The top voter monthly. */
|
||||
public HashMap<User, Integer> topVoterAllTime;
|
||||
public LinkedHashMap<User, Integer> topVoterAllTime;
|
||||
|
||||
/** The top voter monthly. */
|
||||
public HashMap<User, Integer> topVoterMonthly;
|
||||
public LinkedHashMap<User, Integer> topVoterMonthly;
|
||||
|
||||
/** The top voter weekly. */
|
||||
public HashMap<User, Integer> topVoterWeekly;
|
||||
public LinkedHashMap<User, Integer> topVoterWeekly;
|
||||
|
||||
/** The top voter daily. */
|
||||
public HashMap<User, Integer> topVoterDaily;
|
||||
public LinkedHashMap<User, Integer> topVoterDaily;
|
||||
|
||||
/** The updater. */
|
||||
public Updater updater;
|
||||
@@ -98,7 +100,7 @@ public class Main extends JavaPlugin {
|
||||
private List<VoteSite> voteSites;
|
||||
|
||||
/** The vote today. */
|
||||
public HashMap<User, HashMap<VoteSite, LocalDateTime>> voteToday;
|
||||
public LinkedHashMap<User, HashMap<VoteSite, LocalDateTime>> voteToday;
|
||||
|
||||
/** The signs. */
|
||||
public ArrayList<SignHandler> signs;
|
||||
@@ -108,6 +110,8 @@ public class Main extends JavaPlugin {
|
||||
|
||||
private boolean update = true;
|
||||
|
||||
private boolean updateStarted = false;
|
||||
|
||||
/**
|
||||
* Check votifier.
|
||||
*/
|
||||
@@ -228,11 +232,16 @@ public class Main extends JavaPlugin {
|
||||
for (String siteName : sites) {
|
||||
String URL = ConfigVoteSites.getInstance().getServiceSite(siteName);
|
||||
if (URL != null) {
|
||||
if (URL.equals(url)) {
|
||||
if (URL.equalsIgnoreCase(url)) {
|
||||
return siteName;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String siteName : sites) {
|
||||
if (siteName.equalsIgnoreCase(url)) {
|
||||
return siteName;
|
||||
}
|
||||
}
|
||||
}
|
||||
return url;
|
||||
|
||||
@@ -641,6 +650,9 @@ public class Main extends JavaPlugin {
|
||||
loadVoteSites();
|
||||
updateAdvancedCoreHook();
|
||||
AdvancedCoreHook.getInstance().loadHook(this);
|
||||
if (AdvancedCoreHook.getInstance().getStorageType().equals(UserStorage.MYSQL)) {
|
||||
debug("UseBatchUpdates: " + AdvancedCoreHook.getInstance().getMysql().isUseBatchUpdates());
|
||||
}
|
||||
registerCommands();
|
||||
registerEvents();
|
||||
checkVotifier();
|
||||
@@ -659,11 +671,11 @@ public class Main extends JavaPlugin {
|
||||
}
|
||||
});
|
||||
|
||||
topVoterMonthly = new HashMap<User, Integer>();
|
||||
topVoterWeekly = new HashMap<User, Integer>();
|
||||
topVoterDaily = new HashMap<User, Integer>();
|
||||
voteToday = new HashMap<User, HashMap<VoteSite, LocalDateTime>>();
|
||||
topVoterAllTime = new HashMap<User, Integer>();
|
||||
topVoterMonthly = new LinkedHashMap<User, Integer>();
|
||||
topVoterWeekly = new LinkedHashMap<User, Integer>();
|
||||
topVoterDaily = new LinkedHashMap<User, Integer>();
|
||||
voteToday = new LinkedHashMap<User, HashMap<VoteSite, LocalDateTime>>();
|
||||
topVoterAllTime = new LinkedHashMap<User, Integer>();
|
||||
|
||||
voteLog = new Logger(plugin, new File(plugin.getDataFolder() + File.separator + "Log", "votelog.txt"));
|
||||
|
||||
@@ -771,10 +783,34 @@ public class Main extends JavaPlugin {
|
||||
* Setup files.
|
||||
*/
|
||||
public void setupFiles() {
|
||||
config = Config.getInstance();
|
||||
configVoteSites = ConfigVoteSites.getInstance();
|
||||
config.setup();
|
||||
configVoteSites.setup();
|
||||
try {
|
||||
config = Config.getInstance();
|
||||
config.setup();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
plugin.getLogger().severe("Failed to load Config.yml");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
try {
|
||||
configVoteSites = ConfigVoteSites.getInstance();
|
||||
configVoteSites.setup();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
plugin.getLogger().severe("Failed to load VoteSites.yml");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
|
||||
plugin.debug("Loaded Files");
|
||||
|
||||
@@ -784,7 +820,9 @@ public class Main extends JavaPlugin {
|
||||
* Update.
|
||||
*/
|
||||
public void update() {
|
||||
if (update && plugin != null) {
|
||||
if (update && plugin != null && !updateStarted) {
|
||||
updateStarted = true;
|
||||
update = false;
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
@@ -794,12 +832,15 @@ public class Main extends JavaPlugin {
|
||||
if (AdvancedCoreHook.getInstance().getMysql() == null) {
|
||||
plugin.debug("MySQL not loaded yet");
|
||||
return;
|
||||
} else {
|
||||
} else if (Config.getInstance().getClearCacheOnUpdate()) {
|
||||
AdvancedCoreHook.getInstance().getMysql().clearCache();
|
||||
} else {
|
||||
AdvancedCoreHook.getInstance().getMysql().clearCacheBasic();
|
||||
}
|
||||
}
|
||||
update = false;
|
||||
|
||||
plugin.debug("Starting background task");
|
||||
long time = System.currentTimeMillis();
|
||||
try {
|
||||
ArrayList<String> uuids = UserManager.getInstance().getAllUUIDs();
|
||||
ArrayList<User> users = new ArrayList<User>();
|
||||
@@ -807,12 +848,20 @@ public class Main extends JavaPlugin {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
users.add(user);
|
||||
}
|
||||
plugin.debug("Finished loading player data");
|
||||
update = false;
|
||||
long time1 = ((System.currentTimeMillis() - time) / 1000);
|
||||
plugin.debug(
|
||||
"Finished loading player data in " + time1 + " seconds, " + users.size() + " users");
|
||||
TopVoterHandler.getInstance().updateTopVoters(users);
|
||||
Commands.getInstance().updateVoteToday(users);
|
||||
ServerData.getInstance().updateValues();
|
||||
Signs.getInstance().updateSigns();
|
||||
plugin.debug("Background task ran");
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
UserManager.getInstance().getVotingPluginUser(player).offVote();
|
||||
}
|
||||
time1 = ((System.currentTimeMillis() - time) / 1000);
|
||||
plugin.debug("Background task finished in " + time1 + " seconds");
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
plugin.getLogger().info("Looks like something went wrong.");
|
||||
@@ -821,10 +870,16 @@ public class Main extends JavaPlugin {
|
||||
}
|
||||
|
||||
});
|
||||
updateStarted = false;
|
||||
}
|
||||
}
|
||||
|
||||
public VoteParty getVoteParty() {
|
||||
return VoteParty.getInstance();
|
||||
}
|
||||
|
||||
public void updateAdvancedCoreHook() {
|
||||
AdvancedCoreHook.getInstance().setMaxMysqlSize(Config.getInstance().getMysqlMaxSize());
|
||||
AdvancedCoreHook.getInstance().setAutoDownload(Config.getInstance().getAutoDownload());
|
||||
AdvancedCoreHook.getInstance().getJavascriptEngine().put("VotingPlugin", this);
|
||||
AdvancedCoreHook.getInstance().allowDownloadingFromSpigot(15358);
|
||||
@@ -842,6 +897,8 @@ public class Main extends JavaPlugin {
|
||||
AdvancedCoreHook.getInstance().setHelpLine(Config.getInstance().getFormatHelpLine());
|
||||
AdvancedCoreHook.getInstance().setLogDebugToFile(Config.getInstance().getLogDebugToFile());
|
||||
AdvancedCoreHook.getInstance().setSendScoreboards(Config.getInstance().getSendScoreboards());
|
||||
AdvancedCoreHook.getInstance().setAlternateUUIDLookUp(Config.getInstance().getAlternateUUIDLookup());
|
||||
AdvancedCoreHook.getInstance().setAutoKillInvs(Config.getInstance().getAutoKillInvs());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public enum TopVoter {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return AllTime;
|
||||
}
|
||||
|
||||
public TopVoter next() {
|
||||
@@ -49,4 +49,21 @@ public enum TopVoter {
|
||||
}
|
||||
return TopVoter.AllTime;
|
||||
}
|
||||
|
||||
public TopVoter prev() {
|
||||
switch (this) {
|
||||
case AllTime:
|
||||
return Daily;
|
||||
case Daily:
|
||||
return Weekly;
|
||||
case Monthly:
|
||||
return AllTime;
|
||||
case Weekly:
|
||||
return Monthly;
|
||||
default:
|
||||
return AllTime;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,13 +11,12 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Objects.RewardBuilder;
|
||||
import com.Ben12345rocks.AdvancedCore.Objects.RewardHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Objects.UUID;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.MiscUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.PlayerUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.StringUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
@@ -113,7 +112,10 @@ public class User extends com.Ben12345rocks.AdvancedCore.Objects.User {
|
||||
* Adds the points.
|
||||
*/
|
||||
public void addPoints() {
|
||||
addPoints(Config.getInstance().getPointsOnVote());
|
||||
int points = Config.getInstance().getPointsOnVote();
|
||||
if (points != 0) {
|
||||
addPoints(points);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,6 +133,7 @@ public class User extends com.Ben12345rocks.AdvancedCore.Objects.User {
|
||||
*
|
||||
*/
|
||||
public void addTotal() {
|
||||
setMilestoneCount(getMilestoneCount() + 1);
|
||||
addMonthTotal();
|
||||
addAllTimeTotal();
|
||||
}
|
||||
@@ -253,21 +256,6 @@ public class User extends com.Ben12345rocks.AdvancedCore.Objects.User {
|
||||
setWeeklyTotal(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Daily top voter award.
|
||||
*
|
||||
* @param place
|
||||
* the place
|
||||
*/
|
||||
public void dailyTopVoterAward(int place) {
|
||||
if (PlayerUtils.getInstance().isPlayerOnline(getPlayerName())) {
|
||||
// online
|
||||
giveDailyTopVoterAward(place);
|
||||
} else {
|
||||
addOfflineOtherReward("DailyTopVoter" + place);
|
||||
}
|
||||
}
|
||||
|
||||
public int getAllTimeTotal() {
|
||||
return getUserData().getInt("AllTimeTotal");
|
||||
}
|
||||
@@ -419,13 +407,8 @@ public class User extends com.Ben12345rocks.AdvancedCore.Objects.User {
|
||||
* the place
|
||||
*/
|
||||
public void giveDailyTopVoterAward(int place) {
|
||||
RewardHandler.getInstance().giveReward(this, Config.getInstance().getData(),
|
||||
Config.getInstance().getDailyAwardRewardsPath(place));
|
||||
Player player = Bukkit.getPlayer(java.util.UUID.fromString(getUUID()));
|
||||
if (player != null) {
|
||||
player.sendMessage(StringUtils.getInstance()
|
||||
.colorize(Config.getInstance().getFormatTopVoterRewardMsg().replace("%place%", "" + place)));
|
||||
}
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getDailyAwardRewardsPath(place))
|
||||
.withPlaceHolder("place", "" + place).withPlaceHolder("topvoter", "Daily").send(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -435,13 +418,8 @@ public class User extends com.Ben12345rocks.AdvancedCore.Objects.User {
|
||||
* the place
|
||||
*/
|
||||
public void giveMonthlyTopVoterAward(int place) {
|
||||
RewardHandler.getInstance().giveReward(this, Config.getInstance().getData(),
|
||||
Config.getInstance().getMonthlyAwardRewardsPath(place));
|
||||
Player player = Bukkit.getPlayer(java.util.UUID.fromString(getUUID()));
|
||||
if (player != null) {
|
||||
player.sendMessage(StringUtils.getInstance()
|
||||
.colorize(Config.getInstance().getFormatTopVoterRewardMsg().replace("%place%", "" + place)));
|
||||
}
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getMonthlyAwardRewardsPath(place))
|
||||
.withPlaceHolder("place", "" + place).withPlaceHolder("topvoter", "Monthly").send(this);
|
||||
}
|
||||
|
||||
public void giveOfflineOtherRewards() {
|
||||
@@ -531,13 +509,8 @@ public class User extends com.Ben12345rocks.AdvancedCore.Objects.User {
|
||||
* the place
|
||||
*/
|
||||
public void giveWeeklyTopVoterAward(int place) {
|
||||
RewardHandler.getInstance().giveReward(this, Config.getInstance().getData(),
|
||||
Config.getInstance().getWeeklyAwardRewardsPath(place));
|
||||
Player player = Bukkit.getPlayer(java.util.UUID.fromString(getUUID()));
|
||||
if (player != null) {
|
||||
player.sendMessage(StringUtils.getInstance()
|
||||
.colorize(Config.getInstance().getFormatTopVoterRewardMsg().replace("%place%", "" + place)));
|
||||
}
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getWeeklyAwardRewardsPath(place))
|
||||
.withPlaceHolder("place", "" + place).withPlaceHolder("topvoter", "Weekly").send(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -581,21 +554,6 @@ public class User extends com.Ben12345rocks.AdvancedCore.Objects.User {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monthly top voter award.
|
||||
*
|
||||
* @param place
|
||||
* the place
|
||||
*/
|
||||
public void monthlyTopVoterAward(int place) {
|
||||
if (PlayerUtils.getInstance().isPlayerOnline(getPlayerName())) {
|
||||
// online
|
||||
giveMonthlyTopVoterAward(place);
|
||||
} else {
|
||||
addOfflineOtherReward("MonthlyTopVoter" + place);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Off vote.
|
||||
*/
|
||||
@@ -604,16 +562,22 @@ public class User extends com.Ben12345rocks.AdvancedCore.Objects.User {
|
||||
if (player != null) {
|
||||
setTopVoterIgnore(player.hasPermission("VotingPlugin.TopVoter.Ignore"));
|
||||
ArrayList<String> offlineVotes = getOfflineVotes();
|
||||
// plugin.debug(ArrayUtils.getInstance().makeStringList(offlineVotes));
|
||||
if (offlineVotes.size() > 0) {
|
||||
sendVoteEffects(true);
|
||||
}
|
||||
|
||||
for (int i = 0; i < offlineVotes.size(); i++) {
|
||||
if (plugin.hasVoteSite(offlineVotes.get(i))) {
|
||||
plugin.debug("Giving offline site reward: " + offlineVotes.get(i));
|
||||
playerVote(plugin.getVoteSite(offlineVotes.get(i)), false, true);
|
||||
} else {
|
||||
plugin.debug("Site doesn't exist: " + offlineVotes.get(i));
|
||||
}
|
||||
}
|
||||
setOfflineVotes(new ArrayList<String>());
|
||||
if (!offlineVotes.isEmpty()) {
|
||||
setOfflineVotes(new ArrayList<String>());
|
||||
}
|
||||
|
||||
giveOfflineOtherRewards();
|
||||
}
|
||||
@@ -804,19 +768,4 @@ public class User extends com.Ben12345rocks.AdvancedCore.Objects.User {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Weekly top voter award.
|
||||
*
|
||||
* @param place
|
||||
* the place
|
||||
*/
|
||||
public void weeklyTopVoterAward(int place) {
|
||||
if (PlayerUtils.getInstance().isPlayerOnline(getPlayerName())) {
|
||||
// online
|
||||
giveWeeklyTopVoterAward(place);
|
||||
} else {
|
||||
addOfflineOtherReward("WeeklyTopVoter" + place);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Objects;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Objects.RewardBuilder;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Item.ItemBuilder;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.MiscUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.StringUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
@@ -78,10 +80,12 @@ public class VoteSite {
|
||||
* the user
|
||||
*/
|
||||
public void broadcastVote(User user) {
|
||||
String playerName = user.getPlayerName();
|
||||
String bc = StringUtils.getInstance().colorize(config.getFormatBroadCastMsg());
|
||||
bc = bc.replace("%player%", playerName).replace("%SiteName%", getDisplayName());
|
||||
MiscUtils.getInstance().broadcast(bc);
|
||||
if (!user.isVanished()) {
|
||||
String playerName = user.getPlayerName();
|
||||
String bc = StringUtils.getInstance().colorize(config.getFormatBroadCastMsg());
|
||||
bc = bc.replace("%player%", playerName).replace("%SiteName%", getDisplayName());
|
||||
MiscUtils.getInstance().broadcast(bc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,8 +98,13 @@ public class VoteSite {
|
||||
/**
|
||||
* @return the item
|
||||
*/
|
||||
public ConfigurationSection getItem() {
|
||||
return item;
|
||||
public ItemBuilder getItem() {
|
||||
if (item == null) {
|
||||
plugin.getLogger().warning("Invalid item section in site: " + key);
|
||||
return new ItemBuilder(Material.STONE, 1).setName("&cInvalid item for site: " + key);
|
||||
} else {
|
||||
return new ItemBuilder(item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.AdvancedCoreHook;
|
||||
@@ -75,7 +76,7 @@ public class TopVoterHandler implements Listener {
|
||||
return ArrayUtils.getInstance().convert(msg);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onDateChanged(DateChangedEvent event) {
|
||||
ArrayList<String> uuids = UserManager.getInstance().getAllUUIDs();
|
||||
ArrayList<User> users = new ArrayList<User>();
|
||||
@@ -86,7 +87,7 @@ public class TopVoterHandler implements Listener {
|
||||
updateTopVoters(users);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onDayChange(DayChangeEvent event) {
|
||||
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
@@ -115,7 +116,7 @@ public class TopVoterHandler implements Listener {
|
||||
if (!Config.getInstance().getTopVoterIgnorePermission() || !user.isTopVoterIgnore()) {
|
||||
i++;
|
||||
if (places.contains(Integer.toString(i))) {
|
||||
user.dailyTopVoterAward(i);
|
||||
user.giveDailyTopVoterAward(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,7 +125,7 @@ public class TopVoterHandler implements Listener {
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onMonthChange(MonthChangeEvent event) {
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
@@ -152,7 +153,7 @@ public class TopVoterHandler implements Listener {
|
||||
if (!Config.getInstance().getTopVoterIgnorePermission() || !user.isTopVoterIgnore()) {
|
||||
i++;
|
||||
if (places.contains(Integer.toString(i))) {
|
||||
user.monthlyTopVoterAward(i);
|
||||
user.giveMonthlyTopVoterAward(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,7 +171,7 @@ public class TopVoterHandler implements Listener {
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onWeekChange(WeekChangeEvent event) {
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
@@ -198,7 +199,7 @@ public class TopVoterHandler implements Listener {
|
||||
if (!Config.getInstance().getTopVoterIgnorePermission() || !user.isTopVoterIgnore()) {
|
||||
i++;
|
||||
if (places.contains(Integer.toString(i))) {
|
||||
user.weeklyTopVoterAward(i);
|
||||
user.giveWeeklyTopVoterAward(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -247,9 +248,9 @@ public class TopVoterHandler implements Listener {
|
||||
* the order, false for high to low
|
||||
* @return the hash map
|
||||
*/
|
||||
public HashMap<User, Integer> sortByValues(HashMap<User, Integer> unsortMap, final boolean order) {
|
||||
public LinkedHashMap<User, Integer> sortByValues(LinkedHashMap<User, Integer> topVoterAllTime, final boolean order) {
|
||||
|
||||
List<Entry<User, Integer>> list = new LinkedList<Entry<User, Integer>>(unsortMap.entrySet());
|
||||
List<Entry<User, Integer>> list = new LinkedList<Entry<User, Integer>>(topVoterAllTime.entrySet());
|
||||
|
||||
// Sorting the list based on values
|
||||
Collections.sort(list, new Comparator<Entry<User, Integer>>() {
|
||||
@@ -265,11 +266,11 @@ public class TopVoterHandler implements Listener {
|
||||
});
|
||||
|
||||
// Maintaining insertion order with the help of LinkedList
|
||||
HashMap<User, Integer> sortedMap = new LinkedHashMap<User, Integer>();
|
||||
LinkedHashMap<User, Integer> sortedMap = new LinkedHashMap<User, Integer>();
|
||||
for (Entry<User, Integer> entry : list) {
|
||||
sortedMap.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
|
||||
return sortedMap;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class UserManager {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public User getVotingPluginUser(String playerName) {
|
||||
return new User(playerName);
|
||||
return new User(com.Ben12345rocks.AdvancedCore.UserManager.UserManager.getInstance().getProperName(playerName));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
||||
@@ -116,6 +116,7 @@ public class VoteReminding {
|
||||
if (Config.getInstance().getVoteRemindingEnabled()
|
||||
&& (!UserManager.getInstance().getAllUUIDs().contains(user.getUUID()) || user.canVoteAll())) {
|
||||
giveReward(user);
|
||||
user.setReminded(true);
|
||||
plugin.debug(user.getPlayerName() + " was reminded!");
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.Ben12345rocks.AdvancedCore.Util.Inventory.BInventory.ClickEvent;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Inventory.BInventoryButton;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Item.ItemBuilder;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Commands.GUI.PlayerGUIs;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
@@ -60,6 +61,18 @@ public class VoteShop {
|
||||
});
|
||||
}
|
||||
|
||||
if (Config.getInstance().getVoteShopBackButton()) {
|
||||
inv.addButton(new BInventoryButton(PlayerGUIs.getInstance().getBackButton()) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
PlayerGUIs.getInstance().openVoteGUI(event.getPlayer(),
|
||||
UserManager.getInstance().getVotingPluginUser(player));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user