Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a545462410 | ||
|
|
bb7cc4d6e7 | ||
|
|
eb69cf41a5 | ||
|
|
642164b1b4 | ||
|
|
ff99a462d7 | ||
|
|
e7de87e8aa | ||
|
|
e5d91037cb | ||
|
|
e7db5b8aa2 | ||
|
|
551c962cd2 | ||
|
|
5ada4e05a2 | ||
|
|
1f3243e362 | ||
|
|
303b944128 | ||
|
|
989e8fd7a2 | ||
|
|
9a21e37516 | ||
|
|
29a27477b6 | ||
|
|
0ebc5a4c6e | ||
|
|
1c6131589f | ||
|
|
a183335df7 | ||
|
|
c0447ab6e0 | ||
|
|
0c9c2dacfa | ||
|
|
48dbd26d24 | ||
|
|
65de370539 | ||
|
|
1ffb050939 | ||
|
|
0f15c69831 | ||
|
|
5d99ea6154 | ||
|
|
7224cb76de | ||
|
|
1ac9df057d | ||
|
|
033941388c | ||
|
|
fc979bc6bf | ||
|
|
f1860f2934 | ||
|
|
ab8696a3a4 | ||
|
|
09cd00a563 | ||
|
|
f2ca7c3240 | ||
|
|
6928c15147 | ||
|
|
9e278de881 |
No files matched your search
@@ -6,7 +6,7 @@
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.8.0_261">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# --------------------------
|
||||
# Bungee Setup
|
||||
# Only if using votingplugin bungee to send votes
|
||||
# REQUIRES RESTART FOR CHANGES TO TAKE EFFECT
|
||||
# --------------------------
|
||||
|
||||
# Plugin using bungee, requires plugin on bungee server
|
||||
UseBungeecord: false
|
||||
|
||||
# For pluginmessaging method only
|
||||
# Whether to broadcast on cached votes
|
||||
BungeeBroadcastAlways: false
|
||||
|
||||
# What type of bungee setup
|
||||
# Requires restart and set on all servers
|
||||
# https://github.com/Ben12345rocks/VotingPlugin/wiki/Bungeecoord-Setups
|
||||
# Available:
|
||||
# SOCKETS
|
||||
# PLUGINMESSAGING
|
||||
# MYSQL
|
||||
BungeeMethod: PLUGINMESSAGING
|
||||
|
||||
# Enables more debug messages for communication between servers
|
||||
# Use /votingpluginbungee status for testing communication
|
||||
BungeeDebug: false
|
||||
|
||||
# Get the plugin to broadcast to all servers
|
||||
# If false you need to enable
|
||||
BungeeBroadcast: false
|
||||
|
||||
# What server this is in bungee (must match)
|
||||
# Also can be applied to rewards
|
||||
Server: PleaseSet
|
||||
|
||||
# -----------------------------
|
||||
# For socket setup below only
|
||||
# -----------------------------
|
||||
|
||||
# Bungee communication, add bungee host/port here
|
||||
BungeeServer:
|
||||
Host: '127.0.0.1'
|
||||
Port: 1297
|
||||
|
||||
# Bungee communication, add this to bungee server
|
||||
SpigotServer:
|
||||
Host: '127.0.0.1'
|
||||
Port: 1298
|
||||
@@ -585,6 +585,7 @@ VoteShopHideLimitedReached: true
|
||||
# Requires above to be false
|
||||
VoteShopLimitReached: '&aYou reached your limit'
|
||||
VoteShopRequireConfirmation: false
|
||||
VoteShopDisabled: '&cVote shop disabled'
|
||||
Shop:
|
||||
# Identifier
|
||||
# Used in placeholders for formats
|
||||
@@ -625,140 +626,8 @@ Shop:
|
||||
# Extra Rewards
|
||||
# ------------------------------------------------
|
||||
|
||||
# To disable reward set value to []
|
||||
# Eg:
|
||||
# FirstVote: [] (All in one line)
|
||||
# Rewards will be given if there is a reward to give
|
||||
|
||||
# First vote rewards
|
||||
FirstVote:
|
||||
Messages:
|
||||
Player: '&aYou voted for your first time!'
|
||||
|
||||
# All vote rewards
|
||||
# Reward for voting on all sites in one day
|
||||
AllSites:
|
||||
Messages:
|
||||
Player: '&aYou voted on all sites in 1 day!'
|
||||
|
||||
Cumulative:
|
||||
# Number of votes required
|
||||
# Allows multiple cumulative rewards
|
||||
# Number be be around ' (E.g. '1')
|
||||
# Can have multiple listed here
|
||||
'20':
|
||||
Enabled: false
|
||||
# Wether or not votes must be made in same day/week
|
||||
# Useful if you want to require a certain number of voting sites to be voted on
|
||||
# for a daily/weekly reward instead of all of them
|
||||
VotesInSameDay: false
|
||||
VotesInSameWeek: false
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou got %cumulative% cumulative votes!'
|
||||
|
||||
VoteParty:
|
||||
# Wether or not vote party is enabled
|
||||
Enabled: false
|
||||
# Number of votes required to give rewards
|
||||
VotesRequired: 20
|
||||
# Increase the amount of votes required on each vote party reached
|
||||
#IncreaseVotesRquired: 10
|
||||
# If true, players who did not vote to reach the votes required will
|
||||
# recieve the reward
|
||||
GiveAllPlayers: false
|
||||
# If true, the vote count will reset each day
|
||||
ResetEachDay: false
|
||||
# Reset at the end of the month
|
||||
ResetMonthly: false
|
||||
# Reset extra votes
|
||||
ResetExtraVotesMonthly: 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
|
||||
Broadcast: '&cReached the vote party amount!'
|
||||
# List of commands to execute, these only execute once.
|
||||
# %player% does not work here
|
||||
Commands: []
|
||||
# Rewards to give per player
|
||||
Rewards:
|
||||
Commands:
|
||||
- say %player%
|
||||
Items:
|
||||
DIAMOND:
|
||||
Material: 'DIAMOND'
|
||||
Amount: 1
|
||||
|
||||
# Reset milestones at end of the month
|
||||
ResetMilestonesMonthly: false
|
||||
|
||||
MileStones:
|
||||
# Number of votes required
|
||||
# Allows multiple milestones
|
||||
# Number be around ' (E.g. '1')
|
||||
# Can have multiple listed here
|
||||
'20':
|
||||
Enabled: false
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou got %milestone% milestone votes!'
|
||||
|
||||
VoteStreak:
|
||||
# Valid options: Day, Week, Month
|
||||
Day:
|
||||
# Number of days in a row
|
||||
# Each day requires one vote
|
||||
# Add a - to give a reward for every multiple (e.g. 2- = 2,4,6,8, and so on)
|
||||
'2':
|
||||
# Enabled or not
|
||||
Enabled: false
|
||||
# Rewards to give
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: "&aYou voted for %Streak% %Type%'s in a row!"
|
||||
Week:
|
||||
# Number of weeks in a row
|
||||
# Requires atleast one vote per week
|
||||
'2':
|
||||
# Enabled or not
|
||||
Enabled: false
|
||||
# Rewards to give
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: "&aYou voted for %Streak% %Type%'s in a row!"
|
||||
Month:
|
||||
# Number of months in a row
|
||||
# Requires atleast 1 vote per month
|
||||
'2':
|
||||
# Enabled or not
|
||||
Enabled: false
|
||||
# Rewards to give
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: "&aYou voted for %Streak% %Type%'s in a row!"
|
||||
Requirement:
|
||||
# Require certain percentage of votes
|
||||
UsePercentage: false
|
||||
# Percentage requirements of votes
|
||||
# 50 = %50
|
||||
Day: 50
|
||||
Week: 50
|
||||
Month: 50
|
||||
|
||||
# Reward given when vote cooldown ended
|
||||
VoteCoolDownEndedReward: []
|
||||
|
||||
|
||||
# ONLY USE THIS FOR TITLES/SOUNDS AND OTHER EFFECTS
|
||||
# IT WILL ONLY RUN ONE TIME FOR ANY NUMBER OF OFFLINE VOTES (3 offline votes = 1 AnySiteReward)
|
||||
# Any reward files listed here are ran on vote of any site
|
||||
# It is recommended to add rewards to each site instead of here
|
||||
# Using forceoffline won't work here
|
||||
# Use EverySiteReward in VoteSites.yml for a global reward for each site
|
||||
AnySiteRewards: []
|
||||
|
||||
# Moved to SpecialRewards.yml
|
||||
# Rewards here will be copied upon updating
|
||||
|
||||
# ------------------------------------------------
|
||||
# Top Voter
|
||||
@@ -787,6 +656,10 @@ LoadTopVoter:
|
||||
Monthly: true
|
||||
Weekly: false
|
||||
Daily: false
|
||||
|
||||
# Maxium number of players to show on top voter
|
||||
# Set to -1 for no limit
|
||||
MaxiumNumberOfTopVotersToLoad: -1
|
||||
|
||||
# When top voter awards are given (even if there are none listed) it will store top voters
|
||||
# Files will created in TopVoters folder.
|
||||
@@ -794,47 +667,6 @@ StoreTopVoters:
|
||||
Monthly: true
|
||||
Weekly: false
|
||||
Daily: false
|
||||
|
||||
EnableMonthlyAwards: true
|
||||
# Rewards to give
|
||||
MonthlyAwards:
|
||||
# Position. 1 is first in top voter, 2 is second, etc...
|
||||
# Using 1-10 will reward players in first to tenth place with the same reward
|
||||
1:
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou came in first place in %TopVoter%!'
|
||||
2:
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou came in second place in %TopVoter%!'
|
||||
|
||||
EnableWeeklyAwards: false
|
||||
# Rewards to give on weekly top voter
|
||||
WeeklyAwards:
|
||||
# Position. 1 is first in top voter, 2 is second, etc...
|
||||
1:
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou came in first place in %TopVoter%!'
|
||||
2:
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou came in second place in %TopVoter%!'
|
||||
|
||||
EnableDailyRewards: false
|
||||
# Rewards to give on daily top voter
|
||||
DailyAwards:
|
||||
# Position. 1 is first in top voter, 2 is second, etc...
|
||||
1:
|
||||
# Reward files to give
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou came in first place in %TopVoter%!'
|
||||
2:
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou came in second place in %TopVoter%!'
|
||||
|
||||
# ------------------------------------------------
|
||||
# Advanced
|
||||
@@ -985,52 +817,12 @@ DisabledCommands: []
|
||||
# Enable to true for extra player checks
|
||||
ExtraBackgroundUpdate: false
|
||||
|
||||
# --------------------------
|
||||
# Bungee Setup
|
||||
# Only if using votingplugin bungee to send votes
|
||||
# REQUIRES RESTART FOR CHANGES TO TAKE EFFECT
|
||||
# --------------------------
|
||||
|
||||
# Plugin using bungee, requires plugin on bungee server
|
||||
UseBungeecoord: false
|
||||
|
||||
# For pluginmessaging method only
|
||||
# Whether to broadcast on cached votes
|
||||
BungeeBroadcastAlways: false
|
||||
|
||||
# What type of bungee setup
|
||||
# Requires restart and set on all servers
|
||||
# https://github.com/Ben12345rocks/VotingPlugin/wiki/Bungeecoord-Setups
|
||||
# Available:
|
||||
# SOCKETS
|
||||
# PLUGINMESSAGING
|
||||
# MYSQL
|
||||
BungeeMethod: SOCKETS
|
||||
|
||||
# Enables more debug messages for communication between servers
|
||||
# Use /votingpluginbungee status for testing communication
|
||||
BungeeDebug: false
|
||||
|
||||
# Get the plugin to broadcast to all servers
|
||||
BungeeBroadcast: false
|
||||
|
||||
# -----------------------------
|
||||
# For socket setup below only
|
||||
# -----------------------------
|
||||
|
||||
# What server this is in bungee (must match)
|
||||
# Also can be applied to rewards
|
||||
Server: PleaseSet
|
||||
|
||||
# Bungee communication, add bungee host/port here
|
||||
BungeeServer:
|
||||
Host: '127.0.0.1'
|
||||
Port: 1297
|
||||
|
||||
# Bungee communication, add this to bungee server
|
||||
SpigotServer:
|
||||
Host: '127.0.0.1'
|
||||
Port: 1298
|
||||
# This will prevent spam clicking GUI's to prevent exploits
|
||||
# Number is time in between clicking in milliseconds
|
||||
SpamClickTime: 350
|
||||
# Message to send when inventory forced closed when spam clicking
|
||||
# Uncomment to use
|
||||
#SpamClickMessage: '&cDetected spam clicking GUI, closing to prevent exploits'
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Mysql cache options
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
# To disable reward set value to []
|
||||
# or remove entirely
|
||||
# Eg:
|
||||
# FirstVote: [] (All in one line)
|
||||
# Rewards will be given if there is a reward to give
|
||||
|
||||
# First vote rewards
|
||||
FirstVote:
|
||||
Messages:
|
||||
Player: '&aYou voted for your first time!'
|
||||
|
||||
# All vote rewards
|
||||
# Reward for voting on all sites in one day
|
||||
AllSites:
|
||||
Messages:
|
||||
Player: '&aYou voted on all sites in 1 day!'
|
||||
|
||||
Cumulative:
|
||||
# Number of votes required
|
||||
# Allows multiple cumulative rewards
|
||||
# Number be be around ' (E.g. '1')
|
||||
# Can have multiple listed here
|
||||
'20':
|
||||
Enabled: false
|
||||
# Wether or not votes must be made in same day/week
|
||||
# Useful if you want to require a certain number of voting sites to be voted on
|
||||
# for a daily/weekly reward instead of all of them
|
||||
VotesInSameDay: false
|
||||
VotesInSameWeek: false
|
||||
VotesInSameMonth: false
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou got %cumulative% cumulative votes!'
|
||||
|
||||
# Vote party configuration
|
||||
VoteParty:
|
||||
# Wether or not vote party is enabled
|
||||
Enabled: false
|
||||
# Number of votes required to give rewards
|
||||
VotesRequired: 20
|
||||
# Increase the amount of votes required on each vote party reached
|
||||
#IncreaseVotesRquired: 10
|
||||
# If true, players who did not vote to reach the votes required will
|
||||
# recieve the reward
|
||||
GiveAllPlayers: false
|
||||
# If true, the vote count will reset each day
|
||||
ResetEachDay: false
|
||||
# Reset at the end of the month
|
||||
ResetMonthly: false
|
||||
# Reset extra votes
|
||||
ResetExtraVotesMonthly: 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
|
||||
Broadcast: '&cReached the vote party amount!'
|
||||
# List of commands to execute, these only execute once.
|
||||
# %player% does not work here
|
||||
Commands: []
|
||||
# Rewards to give per player
|
||||
Rewards:
|
||||
Commands:
|
||||
- say %player%
|
||||
Items:
|
||||
DIAMOND:
|
||||
Material: 'DIAMOND'
|
||||
Amount: 1
|
||||
|
||||
# Reset milestones at end of the month
|
||||
ResetMilestonesMonthly: false
|
||||
|
||||
MileStones:
|
||||
# Number of votes required
|
||||
# Allows multiple milestones
|
||||
# Number be around ' (E.g. '1')
|
||||
# Can have multiple listed here
|
||||
'20':
|
||||
Enabled: false
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou got %milestone% milestone votes!'
|
||||
|
||||
VoteStreak:
|
||||
# Valid options: Day, Week, Month
|
||||
Day:
|
||||
# Number of days in a row
|
||||
# Each day requires one vote
|
||||
# Add a - to give a reward for every multiple (e.g. 2- = 2,4,6,8, and so on)
|
||||
'2':
|
||||
# Enabled or not
|
||||
Enabled: false
|
||||
# Rewards to give
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: "&aYou voted for %Streak% %Type%'s in a row!"
|
||||
Week:
|
||||
# Number of weeks in a row
|
||||
# Requires atleast one vote per week
|
||||
'2':
|
||||
# Enabled or not
|
||||
Enabled: false
|
||||
# Rewards to give
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: "&aYou voted for %Streak% %Type%'s in a row!"
|
||||
Month:
|
||||
# Number of months in a row
|
||||
# Requires atleast 1 vote per month
|
||||
'2':
|
||||
# Enabled or not
|
||||
Enabled: false
|
||||
# Rewards to give
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: "&aYou voted for %Streak% %Type%'s in a row!"
|
||||
Requirement:
|
||||
# Require certain percentage of votes
|
||||
UsePercentage: false
|
||||
# Percentage requirements of votes
|
||||
# 50 = %50
|
||||
Day: 50
|
||||
Week: 50
|
||||
Month: 50
|
||||
|
||||
# Reward given when vote cooldown ended
|
||||
VoteCoolDownEndedReward: []
|
||||
|
||||
# ONLY USE THIS FOR TITLES/SOUNDS AND OTHER EFFECTS
|
||||
# IT WILL ONLY RUN ONE TIME FOR ANY NUMBER OF OFFLINE VOTES (3 offline votes = 1 AnySiteReward)
|
||||
# Any reward files listed here are ran on vote of any site
|
||||
# It is recommended to add rewards to each site instead of here
|
||||
# Using forceoffline won't work here
|
||||
# Use EverySiteReward in VoteSites.yml for a global reward for each site
|
||||
AnySiteRewards: []
|
||||
|
||||
EnableMonthlyAwards: true
|
||||
# Rewards to give
|
||||
MonthlyAwards:
|
||||
# Position. 1 is first in top voter, 2 is second, etc...
|
||||
# Using 1-10 will reward players in first to tenth place with the same reward
|
||||
1:
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou came in first place in %TopVoter%!'
|
||||
2:
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou came in second place in %TopVoter%!'
|
||||
|
||||
EnableWeeklyAwards: false
|
||||
# Rewards to give on weekly top voter
|
||||
WeeklyAwards:
|
||||
# Position. 1 is first in top voter, 2 is second, etc...
|
||||
1:
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou came in first place in %TopVoter%!'
|
||||
2:
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou came in second place in %TopVoter%!'
|
||||
|
||||
EnableDailyRewards: false
|
||||
# Rewards to give on daily top voter
|
||||
DailyAwards:
|
||||
# Position. 1 is first in top voter, 2 is second, etc...
|
||||
1:
|
||||
# Reward files to give
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou came in first place in %TopVoter%!'
|
||||
2:
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou came in second place in %TopVoter%!'
|
||||
@@ -35,7 +35,7 @@ BlockedServers:
|
||||
# SOCKETS
|
||||
# PLUGINMESSAGING
|
||||
# MYSQL
|
||||
BungeeMethod: SOCKETS
|
||||
BungeeMethod: PLUGINMESSAGING
|
||||
|
||||
# ----------------------------
|
||||
# SOCKET METHOD Only, ignore otherwise
|
||||
|
||||
@@ -4,7 +4,7 @@ main: com.Ben12345rocks.VotingPlugin.Main
|
||||
description: Highly Customizable Voting Listener!
|
||||
website: https://www.spigotmc.org/resources/votingplugin.15358/
|
||||
author: Ben12345rocks
|
||||
softdepend: [MVdWPlaceholders, Votifier, CMI, Vault, PlaceholderAPI, ProtocolLib, MVdWPlaceholderAPI, AuthMe]
|
||||
softdepend: [MVdWPlaceholders, Votifier, VotifierPlus, NuVotifier, CMI, Vault, PlaceholderAPI, ProtocolLib, MVdWPlaceholderAPI, AuthMe]
|
||||
api-version: 1.13
|
||||
commands:
|
||||
vote:
|
||||
@@ -195,15 +195,25 @@ commands:
|
||||
adminvoteForceVoteParty:
|
||||
description: Command Alias
|
||||
aliases: avForceVoteParty
|
||||
adminvoteUserEditValue:
|
||||
description: Command Alias
|
||||
aliases: avUserEditValue
|
||||
adminvoteSetRequestMethod:
|
||||
description: Command Alias
|
||||
aliases: avSetRequestMethod
|
||||
adminvoteUser:
|
||||
description: Command Alias
|
||||
aliases: avUser
|
||||
adminvoteCurrentPluginTime:
|
||||
description: Command Alias
|
||||
aliases: avCurrentPluginTime
|
||||
adminvoteResetPoints:
|
||||
description: Command Alias
|
||||
aliases: avResetPoints
|
||||
adminvoteVotePartyExtraRequired:
|
||||
description: Command Alias
|
||||
aliases: avVotePartyExtraRequired
|
||||
adminvoteRunCMD:
|
||||
description: Command Alias
|
||||
aliases: avRunCMD
|
||||
|
||||
permissions:
|
||||
VotingPlugin.Player:
|
||||
description: Allows basic access player commands
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.Ben12345rocks</groupId>
|
||||
<artifactId>VotingPlugin</artifactId>
|
||||
<version>5.23</version>
|
||||
<version>5.23.3</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>VotingPlugin</name>
|
||||
<properties>
|
||||
|
||||
@@ -10,7 +10,8 @@ import com.Ben12345rocks.AdvancedCore.Util.PluginMessage.PluginMessageHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Sockets.ClientHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Sockets.SocketHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Sockets.SocketReceiver;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.BungeeSettings;
|
||||
import com.Ben12345rocks.VotingPlugin.Data.ServerData;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.VoteSite;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
@@ -44,7 +45,7 @@ public class BungeeHandler {
|
||||
public void load() {
|
||||
Main.plugin.debug("Loading bungee handler");
|
||||
|
||||
method = BungeeMethod.getByName(Config.getInstance().getBungeeMethod());
|
||||
method = BungeeMethod.getByName(BungeeSettings.getInstance().getBungeeMethod());
|
||||
|
||||
Main.plugin.getLogger().info("Using BungeeMethod: " + method.toString());
|
||||
|
||||
@@ -64,14 +65,21 @@ public class BungeeHandler {
|
||||
|
||||
user.bungeeVotePluginMessaging(service, time);
|
||||
|
||||
if (Boolean.valueOf(args.get(4)) || Config.getInstance().isBungeeBroadcastAlways()) {
|
||||
VoteSite site = Main.plugin.getVoteSite(service);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, false);
|
||||
} else {
|
||||
Main.plugin.getLogger().warning("No votesite for " + service);
|
||||
if (!BungeeSettings.getInstance().isBungeeBroadcast()) {
|
||||
if (Boolean.valueOf(args.get(4)) || BungeeSettings.getInstance().isBungeeBroadcastAlways()) {
|
||||
VoteSite site = Main.plugin.getVoteSite(service);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, false);
|
||||
} else {
|
||||
Main.plugin.getLogger().warning("No votesite for " + service);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (args.size() > 4 && Boolean.valueOf(args.get(5))) {
|
||||
ServerData.getInstance().addServiceSite(service);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -88,14 +96,20 @@ public class BungeeHandler {
|
||||
|
||||
user.bungeeVotePluginMessaging(service, time);
|
||||
|
||||
if (Boolean.valueOf(args.get(4)) || Config.getInstance().isBungeeBroadcastAlways()) {
|
||||
VoteSite site = Main.plugin.getVoteSite(service);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, false);
|
||||
} else {
|
||||
Main.plugin.getLogger().warning("No votesite for " + service);
|
||||
if (!BungeeSettings.getInstance().isBungeeBroadcast()) {
|
||||
if (Boolean.valueOf(args.get(4)) || BungeeSettings.getInstance().isBungeeBroadcastAlways()) {
|
||||
VoteSite site = Main.plugin.getVoteSite(service);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, false);
|
||||
} else {
|
||||
Main.plugin.getLogger().warning("No votesite for " + service);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (args.size() > 4 && Boolean.valueOf(args.get(5))) {
|
||||
ServerData.getInstance().addServiceSite(service);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -131,13 +145,14 @@ public class BungeeHandler {
|
||||
} else if (method.equals(BungeeMethod.SOCKETS)) {
|
||||
encryptionHandler = new EncryptionHandler(new File(Main.plugin.getDataFolder(), "secretkey.key"));
|
||||
|
||||
clientHandler = new ClientHandler(Config.getInstance().getBungeeServerHost(),
|
||||
Config.getInstance().getBungeeServerPort(), encryptionHandler,
|
||||
Config.getInstance().isBungeeDebug());
|
||||
clientHandler = new ClientHandler(BungeeSettings.getInstance().getBungeeServerHost(),
|
||||
BungeeSettings.getInstance().getBungeeServerPort(), encryptionHandler,
|
||||
BungeeSettings.getInstance().isBungeeDebug());
|
||||
|
||||
socketHandler = new SocketHandler(Main.plugin.getVersion(), Config.getInstance().getSpigotServerHost(),
|
||||
Config.getInstance().getSpigotServerPort(), encryptionHandler,
|
||||
Config.getInstance().isBungeeDebug());
|
||||
socketHandler = new SocketHandler(Main.plugin.getVersion(),
|
||||
BungeeSettings.getInstance().getSpigotServerHost(),
|
||||
BungeeSettings.getInstance().getSpigotServerPort(), encryptionHandler,
|
||||
BungeeSettings.getInstance().isBungeeDebug());
|
||||
|
||||
socketHandler.add(new SocketReceiver("bungeevote") {
|
||||
|
||||
|
||||
@@ -46,6 +46,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.Config.SpecialRewardsConfig;
|
||||
import com.Ben12345rocks.VotingPlugin.Data.ServerData;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.PlayerVoteEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
@@ -1124,6 +1125,19 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "User", "(player)", "ForceVoteShop", "(VoteShop)" },
|
||||
"VotingPlugin.Commands.AdminVote.ForceVoteShop|" + adminPerm, "Force a voteshop reward") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
RewardHandler.getInstance().giveReward(user, Config.getInstance().getData(),
|
||||
Config.getInstance().getIdentifierRewardsPath(args[3]), new RewardOptions());
|
||||
sendMessage(sender, "&cVoteShop " + args[3] + " forced");
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "User", "(player)", "ForceMilestone", "(Number)" },
|
||||
"VotingPlugin.Commands.AdminVote.ForceMilestone|" + adminPerm, "Force a milestone") {
|
||||
@@ -1342,13 +1356,14 @@ public class CommandLoader {
|
||||
Player player = event.getWhoClicked();
|
||||
String playerName = (String) event.getMeta(player, "Player");
|
||||
BInventory inv = new BInventory("MileStones: " + playerName);
|
||||
for (String mileStoneName : Config.getInstance().getMilestoneVotes()) {
|
||||
for (String mileStoneName : SpecialRewardsConfig.getInstance()
|
||||
.getMilestoneVotes()) {
|
||||
if (StringParser.getInstance().isInt(mileStoneName)) {
|
||||
int mileStone = Integer.parseInt(mileStoneName);
|
||||
|
||||
inv.addButton(inv.getNextSlot(),
|
||||
new BInventoryButton("" + mileStone, new String[] {
|
||||
"Enabled: " + Config.getInstance()
|
||||
"Enabled: " + SpecialRewardsConfig.getInstance()
|
||||
.getMilestoneRewardEnabled(mileStone),
|
||||
"&cClick to set wether this has been completed or not" },
|
||||
new ItemStack(Material.STONE)) {
|
||||
@@ -1429,6 +1444,22 @@ public class CommandLoader {
|
||||
public void updateReplacements() {
|
||||
}
|
||||
});
|
||||
|
||||
TabCompleteHandler.getInstance().addTabCompleteOption(new TabCompleteHandle("(VoteShop)", sites) {
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
ArrayList<String> sites = new ArrayList<String>();
|
||||
for (String str : Config.getInstance().getIdentifiers()) {
|
||||
sites.add(str);
|
||||
}
|
||||
setReplace(sites);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateReplacements() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2250,7 +2281,7 @@ public class CommandLoader {
|
||||
User user = UserManager.getInstance().getVotingPluginUser((Player) sender);
|
||||
user.sendMessage(Commands.getInstance().voteURLs(user, true));
|
||||
} else {
|
||||
sender.sendMessage(Commands.getInstance().voteURLs(null, true));
|
||||
sender.sendMessage(Commands.getInstance().voteURLs(null, false));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -723,6 +723,54 @@ public class Commands {
|
||||
return ArrayUtils.getInstance().convert(msg);
|
||||
}
|
||||
|
||||
public long voteNextDurationTime(User user, VoteSite voteSite) {
|
||||
long time = user.getTime(voteSite);
|
||||
LocalDateTime now = TimeChecker.getInstance().getTime();
|
||||
;
|
||||
LocalDateTime lastVote = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault())
|
||||
.plusHours(Main.plugin.getOptions().getTimeHourOffSet());
|
||||
|
||||
if (!voteSite.isVoteDelayDaily()) {
|
||||
double votedelay = voteSite.getVoteDelay();
|
||||
if (votedelay == 0 && voteSite.getVoteDelayMin() == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
LocalDateTime nextvote = lastVote.plusHours((long) votedelay)
|
||||
.plusMinutes((long) voteSite.getVoteDelayMin());
|
||||
|
||||
if (time == 0 || now.isAfter(nextvote)) {
|
||||
return 0;
|
||||
} else {
|
||||
Duration dur = Duration.between(now, nextvote);
|
||||
return dur.getSeconds();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LocalDateTime offsetoclockyesterday = TimeChecker.getInstance().getTime().plusDays(-1).withHour(0)
|
||||
.withMinute(0).plusHours((long) voteSite.getTimeOffSet());
|
||||
LocalDateTime offsetoclocktoday = TimeChecker.getInstance().getTime().withHour(0).withMinute(0)
|
||||
.plusHours((long) voteSite.getTimeOffSet());
|
||||
LocalDateTime offsetoclocktomorrow = TimeChecker.getInstance().getTime().plusDays(1).withHour(0)
|
||||
.withMinute(0).plusHours((long) voteSite.getTimeOffSet());
|
||||
|
||||
if (!now.isBefore(offsetoclocktoday)) {
|
||||
if (!lastVote.isBefore(offsetoclocktoday)) {
|
||||
Duration dur = Duration.between(now, offsetoclocktomorrow);
|
||||
return dur.getSeconds();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (!lastVote.isBefore(offsetoclockyesterday)) {
|
||||
Duration dur = Duration.between(now, offsetoclocktoday);
|
||||
return dur.getSeconds();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Vote command next info.
|
||||
*
|
||||
@@ -769,12 +817,12 @@ public class Commands {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LocalDateTime offsetoclockyesterday = TimeChecker.getInstance().getTime().plusDays(-1).withHour(0).withMinute(0)
|
||||
.plusHours((long) voteSite.getTimeOffSet());
|
||||
LocalDateTime offsetoclockyesterday = TimeChecker.getInstance().getTime().plusDays(-1).withHour(0)
|
||||
.withMinute(0).plusHours((long) voteSite.getTimeOffSet());
|
||||
LocalDateTime offsetoclocktoday = TimeChecker.getInstance().getTime().withHour(0).withMinute(0)
|
||||
.plusHours((long) voteSite.getTimeOffSet());
|
||||
LocalDateTime offsetoclocktomorrow = TimeChecker.getInstance().getTime().plusDays(1).withHour(0).withMinute(0)
|
||||
.plusHours((long) voteSite.getTimeOffSet());
|
||||
LocalDateTime offsetoclocktomorrow = TimeChecker.getInstance().getTime().plusDays(1).withHour(0)
|
||||
.withMinute(0).plusHours((long) voteSite.getTimeOffSet());
|
||||
|
||||
if (!now.isBefore(offsetoclocktoday)) {
|
||||
if (!lastVote.isBefore(offsetoclocktoday)) {
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.PlayerUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Commands.Commands;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.BungeeSettings;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.VoteSite;
|
||||
@@ -85,8 +86,8 @@ public class PlayerGUIs {
|
||||
|
||||
public void openVoteBest(Player player, User user) {
|
||||
setSelectedPlayer(player, user);
|
||||
BInventory inv = new BInventory(StringParser.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getGUIVoteBestName(), "player", user.getPlayerName()));
|
||||
BInventory inv = new BInventory(Config.getInstance().getGUIVoteBestName());
|
||||
inv.addPlaceholder("player", user.getPlayerName());
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteBestDayBestItem())
|
||||
.addPlaceholder("Best", "" + user.getBestDayVoteStreak())) {
|
||||
@@ -132,12 +133,15 @@ public class PlayerGUIs {
|
||||
return;
|
||||
}
|
||||
setSelectedPlayer(player, user);
|
||||
BInventory inv = new BInventory(StringParser.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getGUIVoteGUIName(), "player", user.getPlayerName()));
|
||||
BInventory inv = new BInventory(Config.getInstance().getGUIVoteGUIName());
|
||||
if (!Config.getInstance().isAlwaysCloseInventory()) {
|
||||
inv.dontClose();
|
||||
}
|
||||
|
||||
inv.addPlaceholder("points", "" + user.getPoints());
|
||||
inv.addPlaceholder("player", user.getPlayerName());
|
||||
inv.addPlaceholder("top", Config.getInstance().getVoteTopDefault());
|
||||
|
||||
for (String slot : Config.getInstance().getVoteGUISlots()) {
|
||||
ItemBuilder builder = new ItemBuilder(Config.getInstance().getVoteGUISlotSection(slot));
|
||||
|
||||
@@ -145,6 +149,7 @@ public class PlayerGUIs {
|
||||
|
||||
lore = ArrayUtils.getInstance().convert(Config.getInstance().getVoteGUISlotLore(slot));
|
||||
|
||||
String str = Config.getInstance().getVoteTopDefault();
|
||||
if (lore.length == 0) {
|
||||
if (slot.equalsIgnoreCase("url")) {
|
||||
lore = new String[] { "&aClick me" };
|
||||
@@ -155,7 +160,7 @@ public class PlayerGUIs {
|
||||
} else if (slot.equalsIgnoreCase("total")) {
|
||||
lore = Commands.getInstance().voteCommandTotal(user);
|
||||
} else if (slot.equalsIgnoreCase("top")) {
|
||||
String str = Config.getInstance().getVoteTopDefault();
|
||||
|
||||
if (str.equalsIgnoreCase("monthly")) {
|
||||
lore = TopVoterHandler.getInstance().topVoterMonthly(1);
|
||||
} else if (str.equalsIgnoreCase("weekly")) {
|
||||
@@ -172,10 +177,6 @@ public class PlayerGUIs {
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<String, String> placeholders = new HashMap<String, String>();
|
||||
placeholders.put("points", "" + user.getPoints());
|
||||
|
||||
builder.setPlaceholders(placeholders);
|
||||
builder.setLore(ArrayUtils.getInstance().convert(lore));
|
||||
|
||||
inv.addButton(new BInventoryButton(builder) {
|
||||
@@ -228,8 +229,8 @@ public class PlayerGUIs {
|
||||
|
||||
public void openVoteLast(Player player, User user) {
|
||||
setSelectedPlayer(player, user);
|
||||
BInventory inv = new BInventory(StringParser.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getGUIVoteLastName(), "player", user.getPlayerName()));
|
||||
BInventory inv = new BInventory(Config.getInstance().getGUIVoteLastName());
|
||||
inv.addPlaceholder("player", user.getPlayerName());
|
||||
for (VoteSite site : plugin.getVoteSites()) {
|
||||
inv.addButton(inv.getNextSlot(), new BInventoryButton(site.getItem().setName(site.getDisplayName())
|
||||
.setLore(Commands.getInstance().voteCommandLastLine(user, site)).setAmountNone(1)) {
|
||||
@@ -250,8 +251,8 @@ public class PlayerGUIs {
|
||||
|
||||
public void openVoteNext(Player player, User user) {
|
||||
setSelectedPlayer(player, user);
|
||||
BInventory inv = new BInventory(StringParser.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getGUIVoteNextName(), "player", user.getPlayerName()));
|
||||
BInventory inv = new BInventory(Config.getInstance().getGUIVoteNextName());
|
||||
inv.addPlaceholder("player", user.getPlayerName());
|
||||
for (VoteSite site : plugin.getVoteSites()) {
|
||||
inv.addButton(inv.getNextSlot(), new BInventoryButton(site.getItem().setName(site.getDisplayName())
|
||||
.setLore(Commands.getInstance().voteCommandNextInfo(user, site)).setAmountNone(1)) {
|
||||
@@ -271,7 +272,7 @@ public class PlayerGUIs {
|
||||
|
||||
public void openVoteShop(Player player) {
|
||||
if (!Config.getInstance().getVoteShopEnabled()) {
|
||||
player.sendMessage(StringParser.getInstance().colorize("&cVote shop disabled"));
|
||||
player.sendMessage(StringParser.getInstance().colorize(Config.getInstance().getVoteShopDisabled()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -309,7 +310,8 @@ public class PlayerGUIs {
|
||||
event.getButton().getInv().closeInv(player, null);
|
||||
|
||||
User user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
if (Config.getInstance().isClearCacheOnVoteShopPurchase()) {
|
||||
if (Config.getInstance().isClearCacheOnVoteShopPurchase()
|
||||
|| BungeeSettings.getInstance().isUseBungeecoord()) {
|
||||
user.clearCache();
|
||||
}
|
||||
String identifier = (String) getData("identifier");
|
||||
@@ -433,8 +435,8 @@ public class PlayerGUIs {
|
||||
|
||||
public void openVoteStreak(Player player, User user) {
|
||||
setSelectedPlayer(player, user);
|
||||
BInventory inv = new BInventory(StringParser.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getGUIVoteStreakName(), "player", user.getPlayerName()));
|
||||
BInventory inv = new BInventory(Config.getInstance().getGUIVoteStreakName());
|
||||
inv.addPlaceholder("player", user.getPlayerName());
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteStreakCurrentDayStreakItem())
|
||||
.addPlaceholder("Streak", "" + user.getDayVoteStreak())) {
|
||||
@@ -554,8 +556,8 @@ public class PlayerGUIs {
|
||||
LinkedHashMap<User, Integer> topVotes = (LinkedHashMap<User, Integer>) plugin.getTopVoter(top).clone();
|
||||
users = topVotes.entrySet();
|
||||
|
||||
BInventory inv = new BInventory(StringParser.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getGUIVoteTopName(), "topvoter", topVoter));
|
||||
BInventory inv = new BInventory(Config.getInstance().getGUIVoteTopName());
|
||||
inv.addPlaceholder("topvoter", topVoter);
|
||||
if (!Config.getInstance().isAlwaysCloseInventory()) {
|
||||
inv.dontClose();
|
||||
}
|
||||
@@ -618,8 +620,8 @@ public class PlayerGUIs {
|
||||
|
||||
users = plugin.getLastMonthTopVoter().entrySet();
|
||||
|
||||
BInventory inv = new BInventory(StringParser.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getGUIVoteTopName(), "topvoter", "Last Month"));
|
||||
BInventory inv = new BInventory(Config.getInstance().getGUIVoteTopName());
|
||||
inv.addPlaceholder("topvoter", "Last Month");
|
||||
if (!Config.getInstance().isAlwaysCloseInventory()) {
|
||||
inv.dontClose();
|
||||
}
|
||||
@@ -662,8 +664,8 @@ public class PlayerGUIs {
|
||||
|
||||
public void openVoteTotal(Player player, User user) {
|
||||
setSelectedPlayer(player, user);
|
||||
BInventory inv = new BInventory(StringParser.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getGUIVoteTotalName(), "player", user.getPlayerName()));
|
||||
BInventory inv = new BInventory(Config.getInstance().getGUIVoteTotalName());
|
||||
inv.addPlaceholder("player", user.getPlayerName());
|
||||
|
||||
for (TopVoter top : TopVoter.values()) {
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteTotalItem(top))
|
||||
@@ -777,8 +779,8 @@ public class PlayerGUIs {
|
||||
}
|
||||
User user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
VoteSite site = plugin.getVoteSite(voteSite);
|
||||
BInventory inv = new BInventory(StringParser.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getGUIVoteURLSiteName(), "site", site.getDisplayName()));
|
||||
BInventory inv = new BInventory(Config.getInstance().getGUIVoteURLSiteName());
|
||||
inv.addPlaceholder("site", site.getDisplayName());
|
||||
inv.setMeta(player, "VoteSite", site);
|
||||
if (!Config.getInstance().isAlwaysCloseInventory()) {
|
||||
inv.dontClose();
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Config;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Annotation.AnnotationHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Annotation.ConfigDataBoolean;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Annotation.ConfigDataInt;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Annotation.ConfigDataString;
|
||||
import com.Ben12345rocks.AdvancedCore.YML.YMLFile;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
public class BungeeSettings extends YMLFile {
|
||||
/** The instance. */
|
||||
static BungeeSettings instance = new BungeeSettings();
|
||||
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
/**
|
||||
* Gets the single instance of Config.
|
||||
*
|
||||
* @return single instance of Config
|
||||
*/
|
||||
public static BungeeSettings getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public BungeeSettings() {
|
||||
super(new File(Main.plugin.getDataFolder(), "BungeeSettings.yml"));
|
||||
}
|
||||
|
||||
public void loadValues() {
|
||||
new AnnotationHandler().load(getData(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFileCreation() {
|
||||
plugin.saveResource("BungeeSettings.yml", true);
|
||||
}
|
||||
|
||||
@ConfigDataBoolean(path = "UseBungeecord", secondPath = "UseBungeecoord")
|
||||
@Getter
|
||||
private boolean useBungeecoord = false;
|
||||
|
||||
@ConfigDataBoolean(path = "BungeeBroadcast")
|
||||
@Getter
|
||||
private boolean bungeeBroadcast = false;
|
||||
|
||||
@ConfigDataBoolean(path = "BungeeBroadcastAlways")
|
||||
@Getter
|
||||
private boolean bungeeBroadcastAlways = false;
|
||||
|
||||
@ConfigDataBoolean(path = "BungeeDebug")
|
||||
@Getter
|
||||
private boolean bungeeDebug = false;
|
||||
|
||||
@ConfigDataString(path = "BungeeMethod")
|
||||
@Getter
|
||||
private String bungeeMethod = "SOCKETS";
|
||||
|
||||
@ConfigDataString(path = "BungeeServer.Host")
|
||||
@Getter
|
||||
private String bungeeServerHost = "";
|
||||
|
||||
@ConfigDataString(path = "Server")
|
||||
@Getter
|
||||
private String server = "PleaseSet";
|
||||
|
||||
@ConfigDataString(path = "SpigotServer.Host")
|
||||
@Getter
|
||||
private String spigotServerHost = "";
|
||||
|
||||
@ConfigDataInt(path = "BungeeServer.Port")
|
||||
@Getter
|
||||
private int bungeeServerPort = 1297;
|
||||
|
||||
@ConfigDataInt(path = "SpigotServer.Port")
|
||||
@Getter
|
||||
private int spigotServerPort = 1298;
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Annotation.AnnotationHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Annotation.ConfigDataBoolean;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Annotation.ConfigDataConfigurationSection;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Annotation.ConfigDataDouble;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Annotation.ConfigDataInt;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Annotation.ConfigDataListString;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Annotation.ConfigDataString;
|
||||
@@ -139,35 +138,17 @@ public class Config extends YMLFile {
|
||||
private boolean alterColumns = true;
|
||||
|
||||
@Getter
|
||||
private String allSitesRewardPath = "AllSites";
|
||||
@ConfigDataString(path = "VoteShopDisabled")
|
||||
private String voteShopDisabled = "&cVote shop disabled";
|
||||
|
||||
@ConfigDataBoolean(path = "AlternateUUIDLookup")
|
||||
@Getter
|
||||
private boolean alternateUUIDLookup = false;
|
||||
|
||||
@Getter
|
||||
private String anySiteRewardsPath = "AnySiteRewards";
|
||||
|
||||
@ConfigDataBoolean(path = "AutoCreateVoteSites")
|
||||
@Getter
|
||||
private boolean autoCreateVoteSites = true;
|
||||
|
||||
@ConfigDataBoolean(path = "UseBungeecoord")
|
||||
@Getter
|
||||
private boolean useBungeecoord = false;
|
||||
|
||||
@ConfigDataBoolean(path = "BungeeBroadcast")
|
||||
@Getter
|
||||
private boolean bungeeBroadcast = false;
|
||||
|
||||
@ConfigDataBoolean(path = "BungeeBroadcastAlways")
|
||||
@Getter
|
||||
private boolean bungeeBroadcastAlways = false;
|
||||
|
||||
@ConfigDataBoolean(path = "BungeeDebug")
|
||||
@Getter
|
||||
private boolean bungeeDebug = false;
|
||||
|
||||
@ConfigDataBoolean(path = "GUI.VoteURL.AllUrlsButton.RequireAllSitesVoted")
|
||||
@Getter
|
||||
private boolean guiVoteURLAllUrlsButtonrequireAllSitesVoted = true;
|
||||
@@ -232,10 +213,6 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private int convertAmount = 250;
|
||||
|
||||
@ConfigDataBoolean(path = "EnableDailyRewards")
|
||||
@Getter
|
||||
private boolean enableDailyRewards = false;
|
||||
|
||||
@ConfigDataBoolean(path = "DisableUpdateChecking")
|
||||
@Getter
|
||||
private boolean disableUpdateChecking = false;
|
||||
@@ -244,6 +221,10 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private int delayBetweenUpdates = 3;
|
||||
|
||||
@ConfigDataInt(path = "MaxiumNumberOfTopVotersToLoad")
|
||||
@Getter
|
||||
private int MaxiumNumberOfTopVotersToLoad = -1;
|
||||
|
||||
@ConfigDataBoolean(path = "DisableNoServiceSiteMessage")
|
||||
@Getter
|
||||
private boolean disableNoServiceSiteMessage = false;
|
||||
@@ -252,10 +233,6 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private ArrayList<String> disabledDefaultPermissions = new ArrayList<String>();
|
||||
|
||||
@ConfigDataBoolean(path = "VoteParty.ResetExtraVotesMonthly")
|
||||
@Getter
|
||||
private boolean votePartyResetExtraVotesMonthly = false;
|
||||
|
||||
@ConfigDataBoolean(path = "DisableAdvancedTab")
|
||||
@Getter
|
||||
private boolean disableAdvancedTab = false;
|
||||
@@ -268,40 +245,10 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private boolean formatCommandsVoteForceLinks = true;
|
||||
|
||||
@Getter
|
||||
private String firstVoteRewardsPath = "FirstVote";
|
||||
|
||||
@ConfigDataBoolean(path = "LogVotesToFile")
|
||||
@Getter
|
||||
private boolean logVotesToFile = false;
|
||||
|
||||
@ConfigDataBoolean(path = "EnableMonthlyAwards")
|
||||
@Getter
|
||||
private boolean enableMonthlyAwards = false;
|
||||
|
||||
@Getter
|
||||
private String votePartyRewardsPath = "VoteParty.Rewards";
|
||||
|
||||
@ConfigDataBoolean(path = "EnableWeeklyAwards")
|
||||
@Getter
|
||||
private boolean enableWeeklyAwards = false;
|
||||
|
||||
@ConfigDataDouble(path = "VoteStreak.Requirement.Day")
|
||||
@Getter
|
||||
private double voteStreakRequirementDay = 50;
|
||||
|
||||
@ConfigDataDouble(path = "VoteStreak.Requirement.Week")
|
||||
@Getter
|
||||
private double voteStreakRequirementWeek = 50;
|
||||
|
||||
@ConfigDataDouble(path = "VoteStreak.Requirement.Month")
|
||||
@Getter
|
||||
private double voteStreakRequirementMonth = 50;
|
||||
|
||||
@ConfigDataBoolean(path = "VoteStreak.Requirement.UsePercentage")
|
||||
@Getter
|
||||
private boolean voteStreakRequirementUsePercentage = false;
|
||||
|
||||
@ConfigDataBoolean(path = "LoadCommandAliases")
|
||||
@Getter
|
||||
private boolean loadCommandAliases = true;
|
||||
@@ -313,10 +260,6 @@ public class Config extends YMLFile {
|
||||
@ConfigDataString(path = "GUI.VoteTop.PlayerItem.Material")
|
||||
@Getter
|
||||
private String guiVoteTopPlayerItemMaterial = "PAPER";
|
||||
|
||||
@ConfigDataString(path = "BungeeMethod")
|
||||
@Getter
|
||||
private String bungeeMethod = "SOCKETS";
|
||||
|
||||
@ConfigDataBoolean(path = "AllowVotePointTransfers")
|
||||
@Getter
|
||||
@@ -376,6 +319,11 @@ public class Config extends YMLFile {
|
||||
@ConfigDataBoolean(path = "UseJavascriptPlaceholders")
|
||||
@Getter
|
||||
private boolean useJavascriptPlaceholders = true;
|
||||
|
||||
@ConfigDataBoolean(path = "UseBungeecord", secondPath = "UseBungeecoord")
|
||||
@Getter
|
||||
@Deprecated
|
||||
private boolean useBungeecoord = false;
|
||||
|
||||
@ConfigDataListString(path = "DisabledCommands")
|
||||
@Getter
|
||||
@@ -385,22 +333,6 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private ArrayList<String> votingBroadcastBlacklist = new ArrayList<String>();
|
||||
|
||||
@ConfigDataString(path = "BungeeServer.Host")
|
||||
@Getter
|
||||
private String bungeeServerHost = "";
|
||||
|
||||
@ConfigDataString(path = "SpigotServer.Host")
|
||||
@Getter
|
||||
private String spigotServerHost = "";
|
||||
|
||||
@ConfigDataInt(path = "BungeeServer.Port")
|
||||
@Getter
|
||||
private int bungeeServerPort = 1297;
|
||||
|
||||
@ConfigDataInt(path = "SpigotServer.Port")
|
||||
@Getter
|
||||
private int spigotServerPort = 1298;
|
||||
|
||||
/**
|
||||
* Instantiates a new config.
|
||||
*/
|
||||
@@ -422,78 +354,6 @@ public class Config extends YMLFile {
|
||||
return (ArrayList<String>) getData().getList("BlackList", new ArrayList<String>());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cumulative reward enabled.
|
||||
*
|
||||
* @param cumulative
|
||||
* the cumulative
|
||||
* @return the cumulative reward enabled
|
||||
*/
|
||||
public boolean getCumulativeRewardEnabled(int cumulative) {
|
||||
return getData().getBoolean("Cumulative." + cumulative + ".Enabled");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cumulative rewards path
|
||||
*
|
||||
* @param cumulative
|
||||
* the cumulative
|
||||
* @return the cumulative rewards
|
||||
*/
|
||||
public String getCumulativeRewardsPath(int cumulative) {
|
||||
return "Cumulative." + cumulative + ".Rewards";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cumulative votes.
|
||||
*
|
||||
* @return the cumulative votes
|
||||
*/
|
||||
public Set<String> getCumulativeVotes() {
|
||||
try {
|
||||
Set<String> set = getData().getConfigurationSection("Cumulative").getKeys(false);
|
||||
if (set != null) {
|
||||
return set;
|
||||
}
|
||||
return new HashSet<String>();
|
||||
} catch (Exception ex) {
|
||||
return new HashSet<String>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cumulative votes in same day.
|
||||
*
|
||||
* @param cumulative
|
||||
* the cumulative
|
||||
* @return the cumulative votes in same day
|
||||
*/
|
||||
public boolean getCumulativeVotesInSameDay(int cumulative) {
|
||||
return getData().getBoolean("Cumulative." + cumulative + ".VotesInSameDay");
|
||||
}
|
||||
|
||||
public boolean getCumulativeVotesInSameWeek(int cumulative) {
|
||||
return getData().getBoolean("Cumulative." + cumulative + ".VotesInSameWeek");
|
||||
}
|
||||
|
||||
public String getDailyAwardRewardsPath(String path) {
|
||||
return "DailyAwards." + path + ".Rewards";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the daily possible reward places.
|
||||
*
|
||||
* @return the daily possible reward places
|
||||
*/
|
||||
public Set<String> getDailyPossibleRewardPlaces() {
|
||||
try {
|
||||
return getData().getConfigurationSection("DailyAwards").getKeys(false);
|
||||
} catch (Exception ex) {
|
||||
return new HashSet<String>();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the broad cast msg.
|
||||
*
|
||||
@@ -1090,62 +950,6 @@ public class Config extends YMLFile {
|
||||
return getData().getBoolean("LoadTopVoter.Weekly");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the milestone reward enabled.
|
||||
*
|
||||
* @param milestones
|
||||
* the milestones
|
||||
* @return the milestone reward enabled
|
||||
*/
|
||||
public boolean getMilestoneRewardEnabled(int milestones) {
|
||||
return getData().getBoolean("MileStones." + milestones + ".Enabled");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the milestone rewards.
|
||||
*
|
||||
* @param milestones
|
||||
* the milestones
|
||||
* @return the milestone rewards
|
||||
*/
|
||||
public String getMilestoneRewardsPath(int milestones) {
|
||||
return "MileStones." + milestones + ".Rewards";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the milestone votes.
|
||||
*
|
||||
* @return the milestone votes
|
||||
*/
|
||||
public Set<String> getMilestoneVotes() {
|
||||
try {
|
||||
Set<String> set = getData().getConfigurationSection("MileStones").getKeys(false);
|
||||
if (set != null) {
|
||||
return set;
|
||||
}
|
||||
return new HashSet<String>();
|
||||
} catch (Exception ex) {
|
||||
return new HashSet<String>();
|
||||
}
|
||||
}
|
||||
|
||||
public String getMonthlyAwardRewardsPath(String path) {
|
||||
return "MonthlyAwards." + path + ".Rewards";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the monthly possible reward places.
|
||||
*
|
||||
* @return the monthly possible reward places
|
||||
*/
|
||||
public Set<String> getMonthlyPossibleRewardPlaces() {
|
||||
try {
|
||||
return getData().getConfigurationSection("MonthlyAwards").getKeys(false);
|
||||
} catch (Exception ex) {
|
||||
return new HashSet<String>();
|
||||
}
|
||||
}
|
||||
|
||||
public int getPointsOnVote() {
|
||||
return getData().getInt("PointsOnVote", 1);
|
||||
}
|
||||
@@ -1177,10 +981,6 @@ public class Config extends YMLFile {
|
||||
return (ArrayList<String>) getData().getList("RequestAPI.DisabledMethods", new ArrayList<String>());
|
||||
}
|
||||
|
||||
public boolean getResetMilestonesMonthly() {
|
||||
return getData().getBoolean("ResetMilestonesMonthly");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the store top voters daily.
|
||||
*
|
||||
@@ -1268,62 +1068,6 @@ public class Config extends YMLFile {
|
||||
return getData().getInt("GUI.VoteGUI." + slot + ".Slot", -1);
|
||||
}
|
||||
|
||||
public String getVotePartyBroadcast() {
|
||||
return getData().getString("VoteParty.Broadcast", "");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ArrayList<String> getVotePartyCommands() {
|
||||
return (ArrayList<String>) getData().getList("VoteParty.Commands", new ArrayList<String>());
|
||||
}
|
||||
|
||||
public boolean getVotePartyCountFakeVotes() {
|
||||
return getData().getBoolean("VoteParty.CountFakeVotes", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vote party enabled.
|
||||
*
|
||||
* @return the vote party enabled
|
||||
*/
|
||||
public boolean getVotePartyEnabled() {
|
||||
return getData().getBoolean("VoteParty.Enabled");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vote party give all players.
|
||||
*
|
||||
* @return the vote party give all players
|
||||
*/
|
||||
public boolean getVotePartyGiveAllPlayers() {
|
||||
return getData().getBoolean("VoteParty.GiveAllPlayers");
|
||||
}
|
||||
|
||||
public int getVotePartyIncreaseVotesRquired() {
|
||||
return getData().getInt("VoteParty.IncreaseVotesRquired", 0);
|
||||
}
|
||||
|
||||
public boolean getVotePartyResetEachDay() {
|
||||
return getData().getBoolean("VoteParty.ResetEachDay");
|
||||
}
|
||||
|
||||
public boolean getVotePartyResetMontly() {
|
||||
return getData().getBoolean("VoteParty.ResetMonthly");
|
||||
}
|
||||
|
||||
public int getVotePartyUserVotesRequired() {
|
||||
return getData().getInt("VoteParty.UserVotesRequired");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vote party votes required.
|
||||
*
|
||||
* @return the vote party votes required
|
||||
*/
|
||||
public int getVotePartyVotesRequired() {
|
||||
return getData().getInt("VoteParty.VotesRequired");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the enabled.
|
||||
*
|
||||
@@ -1436,35 +1180,6 @@ public class Config extends YMLFile {
|
||||
return getData().getInt("GUI.VoteReward." + siteName + ".Items." + item + ".Slot");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the votes required.
|
||||
*
|
||||
* @return the votes required
|
||||
*/
|
||||
public int getVotesRequired() {
|
||||
return getData().getInt("VotesRequired");
|
||||
}
|
||||
|
||||
public boolean getVoteStreakRewardEnabled(String type, String s) {
|
||||
return getData().getBoolean("VoteStreak." + type + "." + s + ".Enabled");
|
||||
}
|
||||
|
||||
public String getVoteStreakRewardsPath(String type, String string) {
|
||||
return "VoteStreak." + type + "." + string + ".Rewards";
|
||||
}
|
||||
|
||||
public Set<String> getVoteStreakVotes(String type) {
|
||||
try {
|
||||
Set<String> set = getData().getConfigurationSection("VoteStreak." + type).getKeys(false);
|
||||
if (set != null) {
|
||||
return set;
|
||||
}
|
||||
return new HashSet<String>();
|
||||
} catch (Exception ex) {
|
||||
return new HashSet<String>();
|
||||
}
|
||||
}
|
||||
|
||||
public String getVoteTopDefault() {
|
||||
return getData().getString("VoteTopDefault", "Monthly");
|
||||
}
|
||||
@@ -1530,23 +1245,6 @@ public class Config extends YMLFile {
|
||||
return getData().getBoolean("GUI.VoteURL.ViewAllUrlsButtonEnabled");
|
||||
}
|
||||
|
||||
public String getWeeklyAwardRewardsPath(String path) {
|
||||
return "WeeklyAwards." + path + ".Rewards";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the weekly possible reward places.
|
||||
*
|
||||
* @return the weekly possible reward places
|
||||
*/
|
||||
public Set<String> getWeeklyPossibleRewardPlaces() {
|
||||
try {
|
||||
return getData().getConfigurationSection("WeeklyAwards").getKeys(false);
|
||||
} catch (Exception ex) {
|
||||
return new HashSet<String>();
|
||||
}
|
||||
}
|
||||
|
||||
public void loadValues() {
|
||||
new AnnotationHandler().load(getData(), this);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,303 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Config;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Annotation.AnnotationHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Annotation.ConfigDataBoolean;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Annotation.ConfigDataDouble;
|
||||
import com.Ben12345rocks.AdvancedCore.YML.YMLFile;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
public class SpecialRewardsConfig extends YMLFile {
|
||||
/** The instance. */
|
||||
static SpecialRewardsConfig instance = new SpecialRewardsConfig();
|
||||
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
/**
|
||||
* Gets the single instance of Config.
|
||||
*
|
||||
* @return single instance of Config
|
||||
*/
|
||||
public static SpecialRewardsConfig getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public SpecialRewardsConfig() {
|
||||
super(new File(Main.plugin.getDataFolder(), "SpecialRewards.yml"));
|
||||
}
|
||||
|
||||
public void loadValues() {
|
||||
new AnnotationHandler().load(getData(), this);
|
||||
}
|
||||
|
||||
public String getWeeklyAwardRewardsPath(String path) {
|
||||
return "WeeklyAwards." + path + ".Rewards";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the weekly possible reward places.
|
||||
*
|
||||
* @return the weekly possible reward places
|
||||
*/
|
||||
public Set<String> getWeeklyPossibleRewardPlaces() {
|
||||
try {
|
||||
return getData().getConfigurationSection("WeeklyAwards").getKeys(false);
|
||||
} catch (Exception ex) {
|
||||
return new HashSet<String>();
|
||||
}
|
||||
}
|
||||
|
||||
public String getMonthlyAwardRewardsPath(String path) {
|
||||
return "MonthlyAwards." + path + ".Rewards";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the monthly possible reward places.
|
||||
*
|
||||
* @return the monthly possible reward places
|
||||
*/
|
||||
public Set<String> getMonthlyPossibleRewardPlaces() {
|
||||
try {
|
||||
return getData().getConfigurationSection("MonthlyAwards").getKeys(false);
|
||||
} catch (Exception ex) {
|
||||
return new HashSet<String>();
|
||||
}
|
||||
}
|
||||
|
||||
public String getDailyAwardRewardsPath(String path) {
|
||||
return "DailyAwards." + path + ".Rewards";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the daily possible reward places.
|
||||
*
|
||||
* @return the daily possible reward places
|
||||
*/
|
||||
public Set<String> getDailyPossibleRewardPlaces() {
|
||||
try {
|
||||
return getData().getConfigurationSection("DailyAwards").getKeys(false);
|
||||
} catch (Exception ex) {
|
||||
return new HashSet<String>();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ConfigDataBoolean(path = "EnableWeeklyAwards")
|
||||
@Getter
|
||||
private boolean enableWeeklyAwards = false;
|
||||
|
||||
@ConfigDataBoolean(path = "EnableDailyRewards")
|
||||
@Getter
|
||||
private boolean enableDailyRewards = false;
|
||||
|
||||
@ConfigDataBoolean(path = "EnableMonthlyAwards")
|
||||
@Getter
|
||||
private boolean enableMonthlyAwards = false;
|
||||
|
||||
@Override
|
||||
public void onFileCreation() {
|
||||
plugin.saveResource("SpecialRewards.yml", true);
|
||||
}
|
||||
|
||||
public boolean getCumulativeRewardEnabled(int cumulative) {
|
||||
return getData().getBoolean("Cumulative." + cumulative + ".Enabled");
|
||||
}
|
||||
|
||||
public String getCumulativeRewardsPath(int cumulative) {
|
||||
return "Cumulative." + cumulative + ".Rewards";
|
||||
}
|
||||
|
||||
public String getVotePartyBroadcast() {
|
||||
return getData().getString("VoteParty.Broadcast", "");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ArrayList<String> getVotePartyCommands() {
|
||||
return (ArrayList<String>) getData().getList("VoteParty.Commands", new ArrayList<String>());
|
||||
}
|
||||
|
||||
public boolean getVotePartyCountFakeVotes() {
|
||||
return getData().getBoolean("VoteParty.CountFakeVotes", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vote party enabled.
|
||||
*
|
||||
* @return the vote party enabled
|
||||
*/
|
||||
public boolean getVotePartyEnabled() {
|
||||
return getData().getBoolean("VoteParty.Enabled");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vote party give all players.
|
||||
*
|
||||
* @return the vote party give all players
|
||||
*/
|
||||
public boolean getVotePartyGiveAllPlayers() {
|
||||
return getData().getBoolean("VoteParty.GiveAllPlayers");
|
||||
}
|
||||
|
||||
public int getVotePartyIncreaseVotesRquired() {
|
||||
return getData().getInt("VoteParty.IncreaseVotesRquired", 0);
|
||||
}
|
||||
|
||||
public boolean getVotePartyResetEachDay() {
|
||||
return getData().getBoolean("VoteParty.ResetEachDay");
|
||||
}
|
||||
|
||||
public boolean getVotePartyResetMontly() {
|
||||
return getData().getBoolean("VoteParty.ResetMonthly");
|
||||
}
|
||||
|
||||
public int getVotePartyUserVotesRequired() {
|
||||
return getData().getInt("VoteParty.UserVotesRequired");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vote party votes required.
|
||||
*
|
||||
* @return the vote party votes required
|
||||
*/
|
||||
public int getVotePartyVotesRequired() {
|
||||
return getData().getInt("VoteParty.VotesRequired");
|
||||
}
|
||||
|
||||
@Getter
|
||||
private String anySiteRewardsPath = "AnySiteRewards";
|
||||
|
||||
@ConfigDataDouble(path = "VoteStreak.Requirement.Day")
|
||||
@Getter
|
||||
private double voteStreakRequirementDay = 50;
|
||||
|
||||
@ConfigDataDouble(path = "VoteStreak.Requirement.Week")
|
||||
@Getter
|
||||
private double voteStreakRequirementWeek = 50;
|
||||
|
||||
@ConfigDataDouble(path = "VoteStreak.Requirement.Month")
|
||||
@Getter
|
||||
private double voteStreakRequirementMonth = 50;
|
||||
|
||||
@ConfigDataBoolean(path = "VoteStreak.Requirement.UsePercentage")
|
||||
@Getter
|
||||
private boolean voteStreakRequirementUsePercentage = false;
|
||||
|
||||
public boolean getVoteStreakRewardEnabled(String type, String s) {
|
||||
return getData().getBoolean("VoteStreak." + type + "." + s + ".Enabled");
|
||||
}
|
||||
|
||||
public String getVoteStreakRewardsPath(String type, String string) {
|
||||
return "VoteStreak." + type + "." + string + ".Rewards";
|
||||
}
|
||||
|
||||
public boolean getResetMilestonesMonthly() {
|
||||
return getData().getBoolean("ResetMilestonesMonthly");
|
||||
}
|
||||
|
||||
public Set<String> getVoteStreakVotes(String type) {
|
||||
try {
|
||||
Set<String> set = getData().getConfigurationSection("VoteStreak." + type).getKeys(false);
|
||||
if (set != null) {
|
||||
return set;
|
||||
}
|
||||
return new HashSet<String>();
|
||||
} catch (Exception ex) {
|
||||
return new HashSet<String>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cumulative votes.
|
||||
*
|
||||
* @return the cumulative votes
|
||||
*/
|
||||
public Set<String> getCumulativeVotes() {
|
||||
try {
|
||||
Set<String> set = getData().getConfigurationSection("Cumulative").getKeys(false);
|
||||
if (set != null) {
|
||||
return set;
|
||||
}
|
||||
return new HashSet<String>();
|
||||
} catch (Exception ex) {
|
||||
return new HashSet<String>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the milestone reward enabled.
|
||||
*
|
||||
* @param milestones
|
||||
* the milestones
|
||||
* @return the milestone reward enabled
|
||||
*/
|
||||
public boolean getMilestoneRewardEnabled(int milestones) {
|
||||
return getData().getBoolean("MileStones." + milestones + ".Enabled");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the milestone rewards.
|
||||
*
|
||||
* @param milestones
|
||||
* the milestones
|
||||
* @return the milestone rewards
|
||||
*/
|
||||
public String getMilestoneRewardsPath(int milestones) {
|
||||
return "MileStones." + milestones + ".Rewards";
|
||||
}
|
||||
|
||||
@ConfigDataBoolean(path = "VoteParty.ResetExtraVotesMonthly")
|
||||
@Getter
|
||||
private boolean votePartyResetExtraVotesMonthly = false;
|
||||
|
||||
/**
|
||||
* Gets the milestone votes.
|
||||
*
|
||||
* @return the milestone votes
|
||||
*/
|
||||
public Set<String> getMilestoneVotes() {
|
||||
try {
|
||||
Set<String> set = getData().getConfigurationSection("MileStones").getKeys(false);
|
||||
if (set != null) {
|
||||
return set;
|
||||
}
|
||||
return new HashSet<String>();
|
||||
} catch (Exception ex) {
|
||||
return new HashSet<String>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cumulative votes in same day.
|
||||
*
|
||||
* @param cumulative
|
||||
* the cumulative
|
||||
* @return the cumulative votes in same day
|
||||
*/
|
||||
public boolean getCumulativeVotesInSameDay(int cumulative) {
|
||||
return getData().getBoolean("Cumulative." + cumulative + ".VotesInSameDay");
|
||||
}
|
||||
|
||||
public boolean getCumulativeVotesInSameWeek(int cumulative) {
|
||||
return getData().getBoolean("Cumulative." + cumulative + ".VotesInSameWeek");
|
||||
}
|
||||
|
||||
public boolean getCumulativeVotesInSameMonth(int cumulative) {
|
||||
return getData().getBoolean("Cumulative." + cumulative + ".VotesInSameMonth");
|
||||
}
|
||||
|
||||
@Getter
|
||||
private String allSitesRewardPath = "AllSites";
|
||||
|
||||
@Getter
|
||||
private String votePartyRewardsPath = "VoteParty.Rewards";
|
||||
|
||||
@Getter
|
||||
private String firstVoteRewardsPath = "FirstVote";
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import com.Ben12345rocks.AdvancedCore.Rewards.RewardOptions;
|
||||
import com.Ben12345rocks.AdvancedCore.TimeChecker.Events.DateChangedEvent;
|
||||
import com.Ben12345rocks.AdvancedCore.UserManager.UUID;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.SpecialRewardsConfig;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.PlayerVoteCoolDownEndEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
@@ -79,7 +79,7 @@ public class CoolDownCheck implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onCoolDownEnd(PlayerVoteCoolDownEndEvent event) {
|
||||
RewardHandler.getInstance().giveReward(event.getPlayer(), Config.getInstance().getData(),
|
||||
RewardHandler.getInstance().giveReward(event.getPlayer(), SpecialRewardsConfig.getInstance().getData(),
|
||||
"VoteCoolDownEndedReward",
|
||||
new RewardOptions().addPlaceholder("Votesite", event.getVoteSite().getDisplayName()));
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.Ben12345rocks.AdvancedCore.Util.Misc.PlayerUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.PluginMessage.PluginMessage;
|
||||
import com.Ben12345rocks.VotingPlugin.BungeeHandler;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.BungeeSettings;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.ConfigVoteSites;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.PlayerVoteEvent;
|
||||
@@ -88,7 +89,7 @@ public class PlayerVoteListener implements Listener {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(playerName);
|
||||
user.updateName();
|
||||
|
||||
if (Config.getInstance().isClearCacheOnVote() || Config.getInstance().isUseBungeecoord()) {
|
||||
if (Config.getInstance().isClearCacheOnVote() || BungeeSettings.getInstance().isUseBungeecoord()) {
|
||||
user.clearCache();
|
||||
}
|
||||
|
||||
@@ -103,7 +104,7 @@ public class PlayerVoteListener implements Listener {
|
||||
VoteParty.getInstance().vote(user, event.isRealVote());
|
||||
|
||||
// broadcast vote if enabled in config
|
||||
if (config.isBroadcastVotesEnabled() && (!Config.getInstance().isBungeeBroadcast() || !event.isBungee())) {
|
||||
if (config.isBroadcastVotesEnabled() && (BungeeSettings.getInstance().isBungeeBroadcast() || !event.isBungee())) {
|
||||
if (!Config.getInstance().getFormatBroadcastWhenOnline() || user.isOnline()) {
|
||||
voteSite.broadcastVote(user);
|
||||
}
|
||||
@@ -153,7 +154,7 @@ public class PlayerVoteListener implements Listener {
|
||||
SpecialRewards.getInstance().checkCumualativeVotes(user);
|
||||
SpecialRewards.getInstance().checkMilestone(user);
|
||||
|
||||
if (config.isUseBungeecoord()) {
|
||||
if (BungeeSettings.getInstance().isUseBungeecoord()) {
|
||||
if (BungeeHandler.getInstance().getMethod().equals(BungeeMethod.MYSQL)) {
|
||||
final String uuid = user.getUUID();
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
|
||||
+50
@@ -6,6 +6,9 @@ import org.bukkit.event.Listener;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Listeners.PluginUpdateVersionEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.BungeeSettings;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.SpecialRewardsConfig;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
@@ -32,12 +35,59 @@ public class VotingPluginUpdateEvent implements Listener {
|
||||
* @param event
|
||||
* the event
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPluginUpdate(PluginUpdateVersionEvent event) {
|
||||
if (event.getPlugin().getName().equals(plugin.getDescription().getName())) {
|
||||
if (!event.getOldVersion().equals("")) {
|
||||
plugin.getLogger().info("VotingPlugin Updated to " + plugin.getDescription().getVersion() + " from "
|
||||
+ event.getOldVersion());
|
||||
|
||||
if (SpecialRewardsConfig.getInstance().isJustCreated()) {
|
||||
// copy old data over
|
||||
plugin.getLogger().info("Coping data from Config.yml into SpecialRewards.yml");
|
||||
|
||||
String[] copies = new String[] { "VoteCoolDownEndedReward", "AnySiteRewards", "VoteStreak",
|
||||
"MileStones", "VoteParty", "Cumulative", "AllSites", "FirstVote", "DailyAwards",
|
||||
"WeeklyAwards", "MonthlyAwards" };
|
||||
for (String str : copies) {
|
||||
SpecialRewardsConfig.getInstance().getData().set(str,
|
||||
Config.getInstance().getData().getConfigurationSection(str));
|
||||
}
|
||||
|
||||
String[] copies1 = new String[] { "ResetMilestonesMonthly", "EnableMonthlyAwards",
|
||||
"EnableWeeklyAwards", "EnableDailyRewards" };
|
||||
for (String str : copies1) {
|
||||
SpecialRewardsConfig.getInstance().getData().set(str,
|
||||
Config.getInstance().getData().getBoolean(str));
|
||||
}
|
||||
SpecialRewardsConfig.getInstance().saveData();
|
||||
}
|
||||
|
||||
if (BungeeSettings.getInstance().isJustCreated()) {
|
||||
// copy old data over
|
||||
plugin.getLogger().info("Coping data from Config.yml into BungeeSettings.yml");
|
||||
|
||||
String[] copies = new String[] { "BungeeServer", "SpigotServer" };
|
||||
for (String str : copies) {
|
||||
BungeeSettings.getInstance().getData().set(str,
|
||||
Config.getInstance().getData().getConfigurationSection(str));
|
||||
}
|
||||
|
||||
BungeeSettings.getInstance().getData().set("UseBungeecord",
|
||||
Config.getInstance().isUseBungeecoord());
|
||||
|
||||
String[] copies1 = new String[] { "BungeeBroadcastAlways", "BungeeDebug", "BungeeBroadcast" };
|
||||
for (String str : copies1) {
|
||||
BungeeSettings.getInstance().getData().set(str, Config.getInstance().getData().getBoolean(str));
|
||||
}
|
||||
|
||||
String[] copies2 = new String[] { "BungeeMethod", "Server" };
|
||||
for (String str : copies2) {
|
||||
BungeeSettings.getInstance().getData().set(str, Config.getInstance().getData().getString(str));
|
||||
}
|
||||
BungeeSettings.getInstance().saveData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,8 +52,10 @@ import com.Ben12345rocks.VotingPlugin.Commands.Executers.CommandVote;
|
||||
import com.Ben12345rocks.VotingPlugin.Commands.GUI.AdminGUI;
|
||||
import com.Ben12345rocks.VotingPlugin.Commands.TabCompleter.AdminVoteTabCompleter;
|
||||
import com.Ben12345rocks.VotingPlugin.Commands.TabCompleter.VoteTabCompleter;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.BungeeSettings;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.ConfigVoteSites;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.SpecialRewardsConfig;
|
||||
import com.Ben12345rocks.VotingPlugin.CoolDown.CoolDownCheck;
|
||||
import com.Ben12345rocks.VotingPlugin.Data.ServerData;
|
||||
import com.Ben12345rocks.VotingPlugin.Listeners.BlockBreak;
|
||||
@@ -141,6 +143,12 @@ public class Main extends AdvancedCorePlugin {
|
||||
@Getter
|
||||
private LinkedHashMap<java.util.UUID, ArrayList<String>> advancedTab = new LinkedHashMap<java.util.UUID, ArrayList<String>>();
|
||||
|
||||
@Getter
|
||||
private SpecialRewardsConfig specialRewardsConfig;
|
||||
|
||||
@Getter
|
||||
private BungeeSettings bungeeSettings;
|
||||
|
||||
/**
|
||||
* Check votifier.
|
||||
*/
|
||||
@@ -148,7 +156,7 @@ public class Main extends AdvancedCorePlugin {
|
||||
try {
|
||||
Class.forName("com.vexsoftware.votifier.model.VotifierEvent");
|
||||
} catch (ClassNotFoundException e) {
|
||||
if (!Config.getInstance().isUseBungeecoord()) {
|
||||
if (!BungeeSettings.getInstance().isUseBungeecoord()) {
|
||||
plugin.getLogger()
|
||||
.warning("No VotifierEvent found, install Votifier, NuVotifier, or another Votifier plugin");
|
||||
} else {
|
||||
@@ -494,8 +502,8 @@ public class Main extends AdvancedCorePlugin {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
if (RewardHandler.getInstance().hasRewards(Config.getInstance().getData(),
|
||||
Config.getInstance().getFirstVoteRewardsPath())) {
|
||||
if (RewardHandler.getInstance().hasRewards(SpecialRewardsConfig.getInstance().getData(),
|
||||
SpecialRewardsConfig.getInstance().getFirstVoteRewardsPath())) {
|
||||
return "True";
|
||||
} else {
|
||||
return "False";
|
||||
@@ -518,8 +526,8 @@ public class Main extends AdvancedCorePlugin {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
if (RewardHandler.getInstance().hasRewards(Config.getInstance().getData(),
|
||||
Config.getInstance().getAllSitesRewardPath())) {
|
||||
if (RewardHandler.getInstance().hasRewards(SpecialRewardsConfig.getInstance().getData(),
|
||||
SpecialRewardsConfig.getInstance().getAllSitesRewardPath())) {
|
||||
return "True";
|
||||
} else {
|
||||
return "False";
|
||||
@@ -530,11 +538,11 @@ public class Main extends AdvancedCorePlugin {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
if (Config.getInstance().getCumulativeVotes().size() == 0) {
|
||||
if (SpecialRewardsConfig.getInstance().getCumulativeVotes().size() == 0) {
|
||||
return "False";
|
||||
} else {
|
||||
for (String cum : Config.getInstance().getCumulativeVotes()) {
|
||||
if (Config.getInstance().getCumulativeRewardEnabled(Integer.parseInt(cum))) {
|
||||
for (String cum : SpecialRewardsConfig.getInstance().getCumulativeVotes()) {
|
||||
if (SpecialRewardsConfig.getInstance().getCumulativeRewardEnabled(Integer.parseInt(cum))) {
|
||||
return "True";
|
||||
}
|
||||
}
|
||||
@@ -546,7 +554,7 @@ public class Main extends AdvancedCorePlugin {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
if (!Config.getInstance().getVotePartyEnabled()) {
|
||||
if (!SpecialRewardsConfig.getInstance().getVotePartyEnabled()) {
|
||||
return "False";
|
||||
} else {
|
||||
return "True";
|
||||
@@ -557,11 +565,11 @@ public class Main extends AdvancedCorePlugin {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
if (Config.getInstance().getMilestoneVotes().size() == 0) {
|
||||
if (SpecialRewardsConfig.getInstance().getMilestoneVotes().size() == 0) {
|
||||
return "False";
|
||||
} else {
|
||||
for (String milestone : Config.getInstance().getMilestoneVotes()) {
|
||||
if (Config.getInstance().getMilestoneRewardEnabled(Integer.parseInt(milestone))) {
|
||||
for (String milestone : SpecialRewardsConfig.getInstance().getMilestoneVotes()) {
|
||||
if (SpecialRewardsConfig.getInstance().getMilestoneRewardEnabled(Integer.parseInt(milestone))) {
|
||||
return "True";
|
||||
}
|
||||
}
|
||||
@@ -573,8 +581,8 @@ public class Main extends AdvancedCorePlugin {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
if (RewardHandler.getInstance().hasRewards(Config.getInstance().getData(),
|
||||
Config.getInstance().getAnySiteRewardsPath())) {
|
||||
if (RewardHandler.getInstance().hasRewards(SpecialRewardsConfig.getInstance().getData(),
|
||||
SpecialRewardsConfig.getInstance().getAnySiteRewardsPath())) {
|
||||
return "True";
|
||||
} else {
|
||||
return "False";
|
||||
@@ -585,11 +593,11 @@ public class Main extends AdvancedCorePlugin {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
for (String s : Config.getInstance().getVoteStreakVotes("Day")) {
|
||||
for (String s : SpecialRewardsConfig.getInstance().getVoteStreakVotes("Day")) {
|
||||
|
||||
if (Config.getInstance().getVoteStreakRewardEnabled("Day", s)
|
||||
&& RewardHandler.getInstance().hasRewards(Config.getInstance().getData(),
|
||||
Config.getInstance().getVoteStreakRewardsPath("Day", s))) {
|
||||
if (SpecialRewardsConfig.getInstance().getVoteStreakRewardEnabled("Day", s)
|
||||
&& RewardHandler.getInstance().hasRewards(SpecialRewardsConfig.getInstance().getData(),
|
||||
SpecialRewardsConfig.getInstance().getVoteStreakRewardsPath("Day", s))) {
|
||||
return "True";
|
||||
}
|
||||
|
||||
@@ -602,11 +610,11 @@ public class Main extends AdvancedCorePlugin {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
for (String s : Config.getInstance().getVoteStreakVotes("Week")) {
|
||||
for (String s : SpecialRewardsConfig.getInstance().getVoteStreakVotes("Week")) {
|
||||
|
||||
if (Config.getInstance().getVoteStreakRewardEnabled("Week", s)
|
||||
&& RewardHandler.getInstance().hasRewards(Config.getInstance().getData(),
|
||||
Config.getInstance().getVoteStreakRewardsPath("Week", s))) {
|
||||
if (SpecialRewardsConfig.getInstance().getVoteStreakRewardEnabled("Week", s)
|
||||
&& RewardHandler.getInstance().hasRewards(SpecialRewardsConfig.getInstance().getData(),
|
||||
SpecialRewardsConfig.getInstance().getVoteStreakRewardsPath("Week", s))) {
|
||||
return "True";
|
||||
}
|
||||
}
|
||||
@@ -619,11 +627,11 @@ public class Main extends AdvancedCorePlugin {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
for (String s : Config.getInstance().getVoteStreakVotes("Month")) {
|
||||
for (String s : SpecialRewardsConfig.getInstance().getVoteStreakVotes("Month")) {
|
||||
|
||||
if (Config.getInstance().getVoteStreakRewardEnabled("Month", s)
|
||||
&& RewardHandler.getInstance().hasRewards(Config.getInstance().getData(),
|
||||
Config.getInstance().getVoteStreakRewardsPath("Month", s))) {
|
||||
if (SpecialRewardsConfig.getInstance().getVoteStreakRewardEnabled("Month", s)
|
||||
&& RewardHandler.getInstance().hasRewards(SpecialRewardsConfig.getInstance().getData(),
|
||||
SpecialRewardsConfig.getInstance().getVoteStreakRewardsPath("Month", s))) {
|
||||
return "True";
|
||||
}
|
||||
}
|
||||
@@ -777,7 +785,7 @@ public class Main extends AdvancedCorePlugin {
|
||||
|
||||
@Override
|
||||
public void onPostLoad() {
|
||||
if (Config.getInstance().isUseBungeecoord()) {
|
||||
if (BungeeSettings.getInstance().isUseBungeecoord()) {
|
||||
BungeeHandler.getInstance().load();
|
||||
|
||||
if (getOptions().getServer().equalsIgnoreCase("PleaseSet")) {
|
||||
@@ -787,6 +795,8 @@ public class Main extends AdvancedCorePlugin {
|
||||
|
||||
}
|
||||
|
||||
getOptions().setServer(BungeeSettings.getInstance().getServer());
|
||||
|
||||
registerCommands();
|
||||
checkVotifier();
|
||||
registerEvents();
|
||||
@@ -821,7 +831,7 @@ public class Main extends AdvancedCorePlugin {
|
||||
AdminGUI.getInstance().loadHook();
|
||||
|
||||
// vote party
|
||||
if (Config.getInstance().getVotePartyEnabled()) {
|
||||
if (SpecialRewardsConfig.getInstance().getVotePartyEnabled()) {
|
||||
VoteParty.getInstance().check();
|
||||
}
|
||||
VoteParty.getInstance().register();
|
||||
@@ -875,6 +885,7 @@ public class Main extends AdvancedCorePlugin {
|
||||
getMysql().alterColumnType("MonthTotal", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("HighestWeeklyTotal", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("LastMonthTotal", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("OfflineRewards", "MEDIUMTEXT");
|
||||
}
|
||||
|
||||
// Add rewards
|
||||
@@ -1020,7 +1031,7 @@ public class Main extends AdvancedCorePlugin {
|
||||
public void onUnLoad() {
|
||||
Signs.getInstance().storeSigns();
|
||||
HandlerList.unregisterAll(plugin);
|
||||
if (Config.getInstance().isUseBungeecoord()) {
|
||||
if (BungeeSettings.getInstance().isUseBungeecoord()) {
|
||||
try {
|
||||
BungeeHandler.getInstance().close();
|
||||
} catch (Exception e) {
|
||||
@@ -1098,11 +1109,16 @@ public class Main extends AdvancedCorePlugin {
|
||||
config.loadValues();
|
||||
|
||||
configVoteSites.reloadData();
|
||||
|
||||
specialRewardsConfig.reloadData();
|
||||
|
||||
bungeeSettings.reloadData();
|
||||
checkYMLError();
|
||||
|
||||
updateAdvancedCoreHook();
|
||||
plugin.loadVoteSites();
|
||||
reloadAdvancedCore();
|
||||
getOptions().setServer(BungeeSettings.getInstance().getServer());
|
||||
PlaceHolders.getInstance().load();
|
||||
CoolDownCheck.getInstance().checkAll();
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
@@ -1122,6 +1138,14 @@ public class Main extends AdvancedCorePlugin {
|
||||
configVoteSites = ConfigVoteSites.getInstance();
|
||||
configVoteSites.setup();
|
||||
|
||||
specialRewardsConfig = SpecialRewardsConfig.getInstance();
|
||||
specialRewardsConfig.setup();
|
||||
specialRewardsConfig.loadValues();
|
||||
|
||||
bungeeSettings = BungeeSettings.getInstance();
|
||||
bungeeSettings.setup();
|
||||
bungeeSettings.loadValues();
|
||||
|
||||
checkYMLError();
|
||||
|
||||
plugin.debug("Loaded Files");
|
||||
@@ -1144,7 +1168,7 @@ public class Main extends AdvancedCorePlugin {
|
||||
plugin.debug("MySQL not loaded yet");
|
||||
return;
|
||||
} else if (Config.getInstance().isClearCacheOnUpdate()
|
||||
|| Config.getInstance().isUseBungeecoord()) {
|
||||
|| BungeeSettings.getInstance().isUseBungeecoord()) {
|
||||
getMysql().clearCache();
|
||||
} else {
|
||||
getMysql().clearCacheBasic();
|
||||
|
||||
@@ -24,7 +24,9 @@ import com.Ben12345rocks.AdvancedCore.Util.Messages.StringParser;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.MiscUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.BungeeHandler;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.BungeeSettings;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.SpecialRewardsConfig;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.PlayerReceivePointsEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.PlayerVoteCoolDownEndEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.PlayerVoteEvent;
|
||||
@@ -303,8 +305,8 @@ public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
|
||||
public void checkDayVoteStreak() {
|
||||
if (!voteStreakUpdatedToday(LocalDateTime.now())) {
|
||||
if (!Config.getInstance().isVoteStreakRequirementUsePercentage()
|
||||
|| hasPercentageTotal(TopVoter.Daily, Config.getInstance().getVoteStreakRequirementDay(), null)) {
|
||||
if (!SpecialRewardsConfig.getInstance().isVoteStreakRequirementUsePercentage() || hasPercentageTotal(
|
||||
TopVoter.Daily, SpecialRewardsConfig.getInstance().getVoteStreakRequirementDay(), null)) {
|
||||
addDayVoteStreak();
|
||||
SpecialRewards.getInstance().checkVoteStreak(this, "Day");
|
||||
setDayVoteStreakLastUpdate(System.currentTimeMillis());
|
||||
@@ -538,15 +540,17 @@ public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
}
|
||||
|
||||
public void giveDailyTopVoterAward(int place, String path) {
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getDailyAwardRewardsPath(path))
|
||||
.withPlaceHolder("place", "" + place).withPlaceHolder("topvoter", "Daily")
|
||||
.withPlaceHolder("votes", "" + getTotal(TopVoter.Daily)).setOnline(isOnline()).send(this);
|
||||
new RewardBuilder(SpecialRewardsConfig.getInstance().getData(),
|
||||
SpecialRewardsConfig.getInstance().getDailyAwardRewardsPath(path)).withPlaceHolder("place", "" + place)
|
||||
.withPlaceHolder("topvoter", "Daily").withPlaceHolder("votes", "" + getTotal(TopVoter.Daily))
|
||||
.setOnline(isOnline()).send(this);
|
||||
}
|
||||
|
||||
public void giveMonthlyTopVoterAward(int place, String path) {
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getMonthlyAwardRewardsPath(path))
|
||||
.withPlaceHolder("place", "" + place).withPlaceHolder("topvoter", "Monthly")
|
||||
.withPlaceHolder("votes", "" + getTotal(TopVoter.Monthly)).setOnline(isOnline()).send(this);
|
||||
new RewardBuilder(SpecialRewardsConfig.getInstance().getData(),
|
||||
SpecialRewardsConfig.getInstance().getMonthlyAwardRewardsPath(path))
|
||||
.withPlaceHolder("place", "" + place).withPlaceHolder("topvoter", "Monthly")
|
||||
.withPlaceHolder("votes", "" + getTotal(TopVoter.Monthly)).setOnline(isOnline()).send(this);
|
||||
}
|
||||
|
||||
public void giveOfflineOtherRewards() {
|
||||
@@ -564,7 +568,7 @@ public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
if (StringParser.getInstance().isInt(st)) {
|
||||
int votesRequired = Integer.parseInt(st);
|
||||
if (votesRequired != 0) {
|
||||
if (Config.getInstance().getCumulativeRewardEnabled(votesRequired)) {
|
||||
if (SpecialRewardsConfig.getInstance().getCumulativeRewardEnabled(votesRequired)) {
|
||||
SpecialRewards.getInstance().giveCumulativeVoteReward(this, false, votesRequired);
|
||||
}
|
||||
}
|
||||
@@ -574,7 +578,7 @@ public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
if (StringParser.getInstance().isInt(st)) {
|
||||
int votesRequired = Integer.parseInt(st);
|
||||
if (votesRequired > 0) {
|
||||
if (Config.getInstance().getMilestoneRewardEnabled(votesRequired)) {
|
||||
if (SpecialRewardsConfig.getInstance().getMilestoneRewardEnabled(votesRequired)) {
|
||||
SpecialRewards.getInstance().giveMilestoneVoteReward(this, true, votesRequired);
|
||||
}
|
||||
}
|
||||
@@ -585,7 +589,7 @@ public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
String type = args[1];
|
||||
String st = args[2];
|
||||
|
||||
if (Config.getInstance().getVoteStreakRewardEnabled(type, st)) {
|
||||
if (SpecialRewardsConfig.getInstance().getVoteStreakRewardEnabled(type, st)) {
|
||||
SpecialRewards.getInstance().giveVoteStreakReward(this, false, type, "" + st, -1);
|
||||
}
|
||||
|
||||
@@ -601,13 +605,14 @@ public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
}
|
||||
|
||||
public void giveWeeklyTopVoterAward(int place, String path) {
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getWeeklyAwardRewardsPath(path))
|
||||
.withPlaceHolder("place", "" + place).withPlaceHolder("topvoter", "Weekly")
|
||||
.withPlaceHolder("votes", "" + getTotal(TopVoter.Weekly)).setOnline(isOnline()).send(this);
|
||||
new RewardBuilder(SpecialRewardsConfig.getInstance().getData(),
|
||||
SpecialRewardsConfig.getInstance().getWeeklyAwardRewardsPath(path)).withPlaceHolder("place", "" + place)
|
||||
.withPlaceHolder("topvoter", "Weekly").withPlaceHolder("votes", "" + getTotal(TopVoter.Weekly))
|
||||
.setOnline(isOnline()).send(this);
|
||||
}
|
||||
|
||||
public void bungeeVotePluginMessaging(String service, long time) {
|
||||
if (Config.getInstance().isUseBungeecoord()) {
|
||||
if (BungeeSettings.getInstance().isUseBungeecoord()) {
|
||||
Main.plugin.debug("Pluginmessaging vote for " + getPlayerName() + " on " + service);
|
||||
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(plugin.getVoteSite(service), getPlayerName(), service,
|
||||
@@ -627,7 +632,7 @@ public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
}
|
||||
|
||||
public void bungeeVote(String service) {
|
||||
if (Config.getInstance().isUseBungeecoord()) {
|
||||
if (BungeeSettings.getInstance().isUseBungeecoord()) {
|
||||
Main.plugin.debug("Bungee vote for " + getPlayerName() + " on " + service);
|
||||
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(plugin.getVoteSite(service), getPlayerName(), service,
|
||||
@@ -645,7 +650,7 @@ public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
}
|
||||
|
||||
public void bungeeVoteOnline(String service) {
|
||||
if (Config.getInstance().isUseBungeecoord()) {
|
||||
if (BungeeSettings.getInstance().isUseBungeecoord()) {
|
||||
Main.plugin.debug("Bungee online vote for " + getPlayerName() + " on " + service);
|
||||
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(plugin.getVoteSite(service), getPlayerName(), service,
|
||||
@@ -668,7 +673,7 @@ public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
* @return true if user got the first vote reward
|
||||
*/
|
||||
public boolean hasGottenFirstVote() {
|
||||
if (Config.getInstance().isUseBungeecoord()
|
||||
if (BungeeSettings.getInstance().isUseBungeecoord()
|
||||
&& BungeeHandler.getInstance().getMethod().equals(BungeeMethod.PLUGINMESSAGING)) {
|
||||
return getTotal(TopVoter.AllTime) > 1;
|
||||
}
|
||||
@@ -792,8 +797,8 @@ public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
* the online
|
||||
*/
|
||||
public void sendVoteEffects(boolean online) {
|
||||
RewardHandler.getInstance().giveReward(this, Config.getInstance().getData(),
|
||||
Config.getInstance().getAnySiteRewardsPath(), new RewardOptions().setOnline(online));
|
||||
RewardHandler.getInstance().giveReward(this, SpecialRewardsConfig.getInstance().getData(),
|
||||
SpecialRewardsConfig.getInstance().getAnySiteRewardsPath(), new RewardOptions().setOnline(online));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.Ben12345rocks.AdvancedCore.Util.Misc.PlayerUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.PluginMessage.PluginMessage;
|
||||
import com.Ben12345rocks.VotingPlugin.BungeeHandler;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.BungeeSettings;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.ConfigVoteSites;
|
||||
import com.Ben12345rocks.VotingPlugin.Data.ServerData;
|
||||
@@ -48,6 +49,9 @@ public class VoteSite {
|
||||
if (!Config.getInstance().isFormatCommandsVoteForceLinks() || !json) {
|
||||
return voteURL;
|
||||
} else {
|
||||
if (!voteURL.startsWith("http")) {
|
||||
return "[Text=\"" + voteURL + "\",url=\"http://" + voteURL + "\"]";
|
||||
}
|
||||
return "[Text=\"" + voteURL + "\",url=\"" + voteURL + "\"]";
|
||||
}
|
||||
}
|
||||
@@ -138,7 +142,8 @@ public class VoteSite {
|
||||
*/
|
||||
public void broadcastVote(User user, boolean checkBungee) {
|
||||
if (!user.isVanished()) {
|
||||
if (checkBungee && Config.getInstance().isBungeeBroadcast() && Config.getInstance().isUseBungeecoord()) {
|
||||
if (checkBungee && BungeeSettings.getInstance().isBungeeBroadcast()
|
||||
&& BungeeSettings.getInstance().isUseBungeecoord()) {
|
||||
if (BungeeHandler.getInstance().getMethod().equals(BungeeMethod.SOCKETS)) {
|
||||
BungeeHandler.getInstance().sendData("Broadcast", getServiceSite(), user.getPlayerName());
|
||||
} else if (BungeeHandler.getInstance().getMethod().equals(BungeeMethod.MYSQL)
|
||||
|
||||
+32
-26
@@ -11,6 +11,7 @@ import com.Ben12345rocks.AdvancedCore.Util.Messages.StringParser;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.ConfigVoteSites;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.SpecialRewardsConfig;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.PlayerSpecialRewardEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.SpecialRewardType;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
@@ -83,19 +84,21 @@ public class SpecialRewards {
|
||||
*/
|
||||
public boolean checkCumualativeVotes(User user) {
|
||||
boolean gotCumulative = false;
|
||||
Set<String> votes = Config.getInstance().getCumulativeVotes();
|
||||
Set<String> votes = SpecialRewardsConfig.getInstance().getCumulativeVotes();
|
||||
for (String vote : votes) {
|
||||
if (StringParser.getInstance().isInt(vote)) {
|
||||
int votesRequired = Integer.parseInt(vote);
|
||||
if (votesRequired != 0) {
|
||||
if (Config.getInstance().getCumulativeRewardEnabled(votesRequired)
|
||||
&& RewardHandler.getInstance().hasRewards(Config.getInstance().getData(),
|
||||
Config.getInstance().getCumulativeRewardsPath(votesRequired))) {
|
||||
if (SpecialRewardsConfig.getInstance().getCumulativeRewardEnabled(votesRequired)
|
||||
&& RewardHandler.getInstance().hasRewards(SpecialRewardsConfig.getInstance().getData(),
|
||||
SpecialRewardsConfig.getInstance().getCumulativeRewardsPath(votesRequired))) {
|
||||
int total = 0;
|
||||
if (Config.getInstance().getCumulativeVotesInSameDay(votesRequired)) {
|
||||
if (SpecialRewardsConfig.getInstance().getCumulativeVotesInSameDay(votesRequired)) {
|
||||
total = user.getTotal(TopVoter.Daily);
|
||||
} else if (Config.getInstance().getCumulativeVotesInSameWeek(votesRequired)) {
|
||||
} else if (SpecialRewardsConfig.getInstance().getCumulativeVotesInSameWeek(votesRequired)) {
|
||||
total = user.getTotal(TopVoter.Weekly);
|
||||
} else if (SpecialRewardsConfig.getInstance().getCumulativeVotesInSameMonth(votesRequired)) {
|
||||
total = user.getTotal(TopVoter.Monthly);
|
||||
} else {
|
||||
total = user.getTotal(TopVoter.AllTime);
|
||||
}
|
||||
@@ -125,8 +128,8 @@ public class SpecialRewards {
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean checkFirstVote(User user) {
|
||||
if (RewardHandler.getInstance().hasRewards(Config.getInstance().getData(),
|
||||
Config.getInstance().getFirstVoteRewardsPath())) {
|
||||
if (RewardHandler.getInstance().hasRewards(SpecialRewardsConfig.getInstance().getData(),
|
||||
SpecialRewardsConfig.getInstance().getFirstVoteRewardsPath())) {
|
||||
if (!user.hasGottenFirstVote()) {
|
||||
giveFirstVoteRewards(user, user.isOnline());
|
||||
return true;
|
||||
@@ -145,14 +148,14 @@ public class SpecialRewards {
|
||||
*/
|
||||
public boolean checkMilestone(User user) {
|
||||
boolean gotMilestone = false;
|
||||
Set<String> votes = Config.getInstance().getMilestoneVotes();
|
||||
Set<String> votes = SpecialRewardsConfig.getInstance().getMilestoneVotes();
|
||||
for (String vote : votes) {
|
||||
if (StringParser.getInstance().isInt(vote)) {
|
||||
int votesRequired = Integer.parseInt(vote);
|
||||
if (votesRequired != 0) {
|
||||
if (Config.getInstance().getMilestoneRewardEnabled(votesRequired)
|
||||
&& RewardHandler.getInstance().hasRewards(Config.getInstance().getData(),
|
||||
Config.getInstance().getMilestoneRewardsPath(votesRequired))) {
|
||||
if (SpecialRewardsConfig.getInstance().getMilestoneRewardEnabled(votesRequired)
|
||||
&& RewardHandler.getInstance().hasRewards(SpecialRewardsConfig.getInstance().getData(),
|
||||
SpecialRewardsConfig.getInstance().getMilestoneRewardsPath(votesRequired))) {
|
||||
|
||||
int userVotesTotal = user.getMilestoneCount();
|
||||
if (userVotesTotal >= votesRequired && !user.hasGottenMilestone(votesRequired)) {
|
||||
@@ -173,7 +176,7 @@ public class SpecialRewards {
|
||||
public boolean checkVoteStreak(User user, String type) {
|
||||
boolean gotReward = false;
|
||||
|
||||
Set<String> streaks = Config.getInstance().getVoteStreakVotes(type);
|
||||
Set<String> streaks = SpecialRewardsConfig.getInstance().getVoteStreakVotes(type);
|
||||
for (String streak : streaks) {
|
||||
String s = streak.replaceAll("-", "");
|
||||
boolean multiple = false;
|
||||
@@ -184,9 +187,9 @@ public class SpecialRewards {
|
||||
if (StringParser.getInstance().isInt(s)) {
|
||||
int streakRequired = Integer.parseInt(s);
|
||||
if (streakRequired != 0) {
|
||||
if (Config.getInstance().getVoteStreakRewardEnabled(type, streak)
|
||||
&& RewardHandler.getInstance().hasRewards(Config.getInstance().getData(),
|
||||
Config.getInstance().getVoteStreakRewardsPath(type, "" + streak))) {
|
||||
if (SpecialRewardsConfig.getInstance().getVoteStreakRewardEnabled(type, streak)
|
||||
&& RewardHandler.getInstance().hasRewards(SpecialRewardsConfig.getInstance().getData(),
|
||||
SpecialRewardsConfig.getInstance().getVoteStreakRewardsPath(type, "" + streak))) {
|
||||
int curStreak = 0;
|
||||
if (type.equalsIgnoreCase("day")) {
|
||||
curStreak = user.getDayVoteStreak();
|
||||
@@ -235,8 +238,8 @@ public class SpecialRewards {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
RewardHandler.getInstance().giveReward(user, Config.getInstance().getData(),
|
||||
Config.getInstance().getAllSitesRewardPath(), new RewardOptions().setOnline(online));
|
||||
RewardHandler.getInstance().giveReward(user, SpecialRewardsConfig.getInstance().getData(),
|
||||
SpecialRewardsConfig.getInstance().getAllSitesRewardPath(), new RewardOptions().setOnline(online));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -258,8 +261,9 @@ public class SpecialRewards {
|
||||
return;
|
||||
}
|
||||
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getCumulativeRewardsPath(cumulative))
|
||||
.setOnline(online).withPlaceHolder("Cumulative", "" + cumulative).send(user);
|
||||
new RewardBuilder(SpecialRewardsConfig.getInstance().getData(),
|
||||
SpecialRewardsConfig.getInstance().getCumulativeRewardsPath(cumulative)).setOnline(online)
|
||||
.withPlaceHolder("Cumulative", "" + cumulative).send(user);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -277,8 +281,8 @@ public class SpecialRewards {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
RewardHandler.getInstance().giveReward(user, Config.getInstance().getData(),
|
||||
Config.getInstance().getFirstVoteRewardsPath(), new RewardOptions().setOnline(online));
|
||||
RewardHandler.getInstance().giveReward(user, SpecialRewardsConfig.getInstance().getData(),
|
||||
SpecialRewardsConfig.getInstance().getFirstVoteRewardsPath(), new RewardOptions().setOnline(online));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -299,8 +303,9 @@ public class SpecialRewards {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getMilestoneRewardsPath(milestone))
|
||||
.setOnline(online).withPlaceHolder("Milestone", "" + milestone).send(user);
|
||||
new RewardBuilder(SpecialRewardsConfig.getInstance().getData(),
|
||||
SpecialRewardsConfig.getInstance().getMilestoneRewardsPath(milestone)).setOnline(online)
|
||||
.withPlaceHolder("Milestone", "" + milestone).send(user);
|
||||
}
|
||||
|
||||
public void giveVoteStreakReward(User user, boolean online, String type, String string, int votes) {
|
||||
@@ -311,8 +316,9 @@ public class SpecialRewards {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getVoteStreakRewardsPath(type, string))
|
||||
.setOnline(online).withPlaceHolder("Type", type).withPlaceHolder("Streak", "" + votes).send(user);
|
||||
new RewardBuilder(SpecialRewardsConfig.getInstance().getData(),
|
||||
SpecialRewardsConfig.getInstance().getVoteStreakRewardsPath(type, string)).setOnline(online)
|
||||
.withPlaceHolder("Type", type).withPlaceHolder("Streak", "" + votes).send(user);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.YML.YMLFileHandler;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.SpecialRewardsConfig;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.SpecialRewards.SpecialRewards;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
@@ -150,8 +151,9 @@ public class TopVoterHandler implements Listener {
|
||||
}
|
||||
|
||||
try {
|
||||
if (Config.getInstance().isEnableDailyRewards()) {
|
||||
HashMap<Integer, String> places = handlePlaces(Config.getInstance().getDailyPossibleRewardPlaces());
|
||||
if (SpecialRewardsConfig.getInstance().isEnableDailyRewards()) {
|
||||
HashMap<Integer, String> places = handlePlaces(
|
||||
SpecialRewardsConfig.getInstance().getDailyPossibleRewardPlaces());
|
||||
int i = 0;
|
||||
int lastTotal = -1;
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -189,9 +191,10 @@ public class TopVoterHandler implements Listener {
|
||||
if (user.getTotal(TopVoter.Monthly) == 0 && user.getMonthVoteStreak() != 0) {
|
||||
user.setMonthVoteStreak(0);
|
||||
} else {
|
||||
if (!Config.getInstance().isVoteStreakRequirementUsePercentage() || user.hasPercentageTotal(
|
||||
TopVoter.Monthly, Config.getInstance().getVoteStreakRequirementMonth(),
|
||||
LocalDateTime.now().minusDays(1))) {
|
||||
if (!SpecialRewardsConfig.getInstance().isVoteStreakRequirementUsePercentage()
|
||||
|| user.hasPercentageTotal(TopVoter.Monthly,
|
||||
SpecialRewardsConfig.getInstance().getVoteStreakRequirementMonth(),
|
||||
LocalDateTime.now().minusDays(1))) {
|
||||
user.addMonthVoteStreak();
|
||||
SpecialRewards.getInstance().checkVoteStreak(user, "Month");
|
||||
}
|
||||
@@ -216,9 +219,9 @@ public class TopVoterHandler implements Listener {
|
||||
}
|
||||
|
||||
try {
|
||||
if (Config.getInstance().isEnableMonthlyAwards()) {
|
||||
if (SpecialRewardsConfig.getInstance().isEnableMonthlyAwards()) {
|
||||
HashMap<Integer, String> places = handlePlaces(
|
||||
Config.getInstance().getMonthlyPossibleRewardPlaces());
|
||||
SpecialRewardsConfig.getInstance().getMonthlyPossibleRewardPlaces());
|
||||
int i = 0;
|
||||
int lastTotal = -1;
|
||||
|
||||
@@ -249,7 +252,7 @@ public class TopVoterHandler implements Listener {
|
||||
|
||||
resetTotals(TopVoter.Monthly);
|
||||
|
||||
if (Config.getInstance().getResetMilestonesMonthly()) {
|
||||
if (SpecialRewardsConfig.getInstance().getResetMilestonesMonthly()) {
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
user.setMilestoneCount(0);
|
||||
@@ -274,8 +277,9 @@ public class TopVoterHandler implements Listener {
|
||||
if (user.getTotal(TopVoter.Weekly) == 0 && user.getWeekVoteStreak() != 0) {
|
||||
user.setWeekVoteStreak(0);
|
||||
} else {
|
||||
if (!Config.getInstance().isVoteStreakRequirementUsePercentage() || user.hasPercentageTotal(
|
||||
TopVoter.Weekly, Config.getInstance().getVoteStreakRequirementWeek(), null)) {
|
||||
if (!SpecialRewardsConfig.getInstance().isVoteStreakRequirementUsePercentage()
|
||||
|| user.hasPercentageTotal(TopVoter.Weekly,
|
||||
SpecialRewardsConfig.getInstance().getVoteStreakRequirementWeek(), null)) {
|
||||
user.addWeekVoteStreak();
|
||||
SpecialRewards.getInstance().checkVoteStreak(user, "Week");
|
||||
}
|
||||
@@ -298,9 +302,9 @@ public class TopVoterHandler implements Listener {
|
||||
}
|
||||
|
||||
try {
|
||||
if (Config.getInstance().isEnableWeeklyAwards()) {
|
||||
if (SpecialRewardsConfig.getInstance().isEnableWeeklyAwards()) {
|
||||
HashMap<Integer, String> places = handlePlaces(
|
||||
Config.getInstance().getWeeklyPossibleRewardPlaces());
|
||||
SpecialRewardsConfig.getInstance().getWeeklyPossibleRewardPlaces());
|
||||
int i = 0;
|
||||
int lastTotal = -1;
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -652,15 +656,29 @@ public class TopVoterHandler implements Listener {
|
||||
plugin.debug("Number of users to check top voter: " + users.size());
|
||||
|
||||
for (TopVoter top : TopVoter.values()) {
|
||||
plugin.getTopVoter(top).clear();
|
||||
if (Config.getInstance().getLoadTopVoter(top)) {
|
||||
LinkedHashMap<User, Integer> map = new LinkedHashMap<User, Integer>();
|
||||
|
||||
for (User user : users) {
|
||||
int total = user.getTotal(top);
|
||||
if (total > 0) {
|
||||
plugin.getTopVoter(top).put(user, total);
|
||||
map.put(user, total);
|
||||
}
|
||||
}
|
||||
plugin.getTopVoter().put(top, sortByValues(plugin.getTopVoter(top), false));
|
||||
|
||||
map = sortByValues(map, false);
|
||||
int limitSize = Config.getInstance().getMaxiumNumberOfTopVotersToLoad();
|
||||
if (limitSize > 0) {
|
||||
ArrayList<User> listKeys = new ArrayList<User>(map.keySet());
|
||||
if (listKeys.size() > limitSize) {
|
||||
for (int i = listKeys.size() - 1; i >= 0 && i >= limitSize; i--) {
|
||||
map.remove(listKeys.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
plugin.getTopVoter(top).clear();
|
||||
plugin.getTopVoter().put(top, map);
|
||||
plugin.debug(top.toString() + " TopVoter loaded");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.Ben12345rocks.VotingPlugin.Util.PlaceHolders;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@@ -259,6 +260,35 @@ public class PlaceHolders {
|
||||
}
|
||||
}.withDescription("Return true/false if player can vote on all sites"));
|
||||
|
||||
placeholders.add(new PlaceHolder<User>("Next_AnySite") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
if (user.canVoteAny()) {
|
||||
return Config.getInstance().getFormatCommandsVoteNextInfoCanVote();
|
||||
}
|
||||
long smallest = -1;
|
||||
HashMap<Long, VoteSite> times = new HashMap<Long, VoteSite>();
|
||||
for (VoteSite site : plugin.getVoteSites()) {
|
||||
long t = Commands.getInstance().voteNextDurationTime(user, site);
|
||||
if (smallest == -1) {
|
||||
smallest = t;
|
||||
}
|
||||
if (t < smallest) {
|
||||
smallest = t;
|
||||
}
|
||||
times.put(t, site);
|
||||
}
|
||||
for (Entry<Long,VoteSite> entry : times.entrySet()) {
|
||||
if (entry.getKey().longValue() == smallest) {
|
||||
return Commands.getInstance().voteCommandNextInfo(user, entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
return "Error";
|
||||
}
|
||||
}.withDescription("How long until user can vote on anysite"));
|
||||
|
||||
for (final VoteSite voteSite : plugin.getVoteSites()) {
|
||||
placeholders.add(new PlaceHolder<User>("Next_" + voteSite.getKey()) {
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.MiscUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.SpecialRewardsConfig;
|
||||
import com.Ben12345rocks.VotingPlugin.Data.ServerData;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.VotePartyEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
@@ -95,12 +96,12 @@ public class VoteParty implements Listener {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
MiscUtils.getInstance().broadcast(Config.getInstance().getVotePartyBroadcast());
|
||||
MiscUtils.getInstance().broadcast(SpecialRewardsConfig.getInstance().getVotePartyBroadcast());
|
||||
giveRewards();
|
||||
|
||||
if (Config.getInstance().getVotePartyIncreaseVotesRquired() > 0) {
|
||||
if (SpecialRewardsConfig.getInstance().getVotePartyIncreaseVotesRquired() > 0) {
|
||||
ServerData.getInstance().setVotePartyExtraRequired(ServerData.getInstance().getVotePartyExtraRequired()
|
||||
+ Config.getInstance().getVotePartyIncreaseVotesRquired());
|
||||
+ SpecialRewardsConfig.getInstance().getVotePartyIncreaseVotesRquired());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +114,7 @@ public class VoteParty implements Listener {
|
||||
* the sender
|
||||
*/
|
||||
public void commandVoteParty(CommandSender sender) {
|
||||
if (Config.getInstance().getVotePartyEnabled()) {
|
||||
if (SpecialRewardsConfig.getInstance().getVotePartyEnabled()) {
|
||||
ArrayList<String> msg = Config.getInstance().getFormatCommandsVoteParty();
|
||||
int votesRequired = getVotesRequired();
|
||||
int votes = getTotalVotes();
|
||||
@@ -165,7 +166,7 @@ public class VoteParty implements Listener {
|
||||
}
|
||||
|
||||
public int getVotesRequired() {
|
||||
int required = Config.getInstance().getVotePartyVotesRequired();
|
||||
int required = SpecialRewardsConfig.getInstance().getVotePartyVotesRequired();
|
||||
int extra = ServerData.getInstance().getVotePartyExtraRequired();
|
||||
if (extra > 0) {
|
||||
return required + extra;
|
||||
@@ -174,8 +175,8 @@ public class VoteParty implements Listener {
|
||||
}
|
||||
|
||||
public void giveReward(User user) {
|
||||
if (Config.getInstance().getVotePartyUserVotesRequired() > 0) {
|
||||
if (user.getVotePartyVotes() < Config.getInstance().getVotePartyUserVotesRequired()) {
|
||||
if (SpecialRewardsConfig.getInstance().getVotePartyUserVotesRequired() > 0) {
|
||||
if (user.getVotePartyVotes() < SpecialRewardsConfig.getInstance().getVotePartyUserVotesRequired()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -183,16 +184,16 @@ public class VoteParty implements Listener {
|
||||
}
|
||||
|
||||
public void giveReward(User user, boolean online) {
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getVotePartyRewardsPath())
|
||||
new RewardBuilder(SpecialRewardsConfig.getInstance().getData(), SpecialRewardsConfig.getInstance().getVotePartyRewardsPath())
|
||||
.setOnline(online)
|
||||
.withPlaceHolder("VotesRequired", "" + Config.getInstance().getVotePartyVotesRequired()).send(user);
|
||||
.withPlaceHolder("VotesRequired", "" + SpecialRewardsConfig.getInstance().getVotePartyVotesRequired()).send(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Give rewards.
|
||||
*/
|
||||
public void giveRewards() {
|
||||
for (final String cmd : Config.getInstance().getVotePartyCommands()) {
|
||||
for (final String cmd : SpecialRewardsConfig.getInstance().getVotePartyCommands()) {
|
||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
@@ -203,13 +204,14 @@ public class VoteParty implements Listener {
|
||||
});
|
||||
}
|
||||
|
||||
if (Config.getInstance().getVotePartyGiveAllPlayers()) {
|
||||
plugin.debug("Giving all players vote party");
|
||||
if (SpecialRewardsConfig.getInstance().getVotePartyGiveAllPlayers()) {
|
||||
plugin.debug("Trying to give all players vote party");
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
giveReward(user);
|
||||
}
|
||||
} else {
|
||||
plugin.debug("Trying to give all online players vote party");
|
||||
plugin.debug(ArrayUtils.getInstance().makeStringList(getVotedUsers()));
|
||||
for (String uuid : getVotedUsers()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
@@ -221,18 +223,18 @@ public class VoteParty implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onDayChange(DayChangeEvent event) {
|
||||
if (Config.getInstance().getVotePartyResetEachDay()) {
|
||||
if (SpecialRewardsConfig.getInstance().getVotePartyResetEachDay()) {
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMonthChange(MonthChangeEvent event) {
|
||||
if (Config.getInstance().getVotePartyResetMontly()) {
|
||||
if (SpecialRewardsConfig.getInstance().getVotePartyResetMontly()) {
|
||||
reset();
|
||||
}
|
||||
|
||||
if (Config.getInstance().isVotePartyResetExtraVotesMonthly()) {
|
||||
if (SpecialRewardsConfig.getInstance().isVotePartyResetExtraVotesMonthly()) {
|
||||
ServerData.getInstance().setVotePartyExtraRequired(0);
|
||||
}
|
||||
}
|
||||
@@ -276,8 +278,8 @@ public class VoteParty implements Listener {
|
||||
}
|
||||
|
||||
public synchronized void vote(User user, boolean realVote) {
|
||||
if (Config.getInstance().getVotePartyEnabled()) {
|
||||
if (Config.getInstance().getVotePartyCountFakeVotes() || realVote) {
|
||||
if (SpecialRewardsConfig.getInstance().getVotePartyEnabled()) {
|
||||
if (SpecialRewardsConfig.getInstance().getVotePartyCountFakeVotes() || realVote) {
|
||||
addTotal(user);
|
||||
addVotePlayer(user);
|
||||
check();
|
||||
|
||||
@@ -58,7 +58,7 @@ public class VoteReminding {
|
||||
|
||||
if (PlayerUtils.getInstance().hasServerPermission(playerName, "VotingPlugin.Login.RemindVotes")
|
||||
|| PlayerUtils.getInstance().hasServerPermission(playerName, "VotingPlugin.Player")) {
|
||||
if (user.canVoteAll()) {
|
||||
if (user.canVoteAll() || (user.canVoteAny() && user.hasPermission("VotingPlugin.Login.RemindVotes.Any"))) {
|
||||
Player player = Bukkit.getPlayer(playerName);
|
||||
if (player != null) {
|
||||
if (!Config.getInstance().getVoteRemindingRemindOnlyOnce()) {
|
||||
|
||||
@@ -37,7 +37,6 @@ import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||
import net.md_5.bungee.api.event.ServerConnectedEvent;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
@@ -57,6 +56,7 @@ public class Bungee extends Plugin implements net.md_5.bungee.api.plugin.Listene
|
||||
|
||||
private EncryptionHandler encryptionHandler;
|
||||
|
||||
@Getter
|
||||
private BungeeMethod method;
|
||||
|
||||
private HashMap<String, ArrayList<OfflineBungeeVote>> cachedVotes = new HashMap<String, ArrayList<OfflineBungeeVote>>();
|
||||
@@ -100,7 +100,7 @@ public class Bungee extends Plugin implements net.md_5.bungee.api.plugin.Listene
|
||||
for (OfflineBungeeVote cache : c) {
|
||||
sendPluginMessageServer(getProxy().getPlayer(UUID.fromString(uuid)).getServer().getInfo().getName(),
|
||||
"VoteOnline", cache.getPlayerName(), cache.getUuid(), cache.getService(),
|
||||
"" + cache.getTime(), Boolean.FALSE.toString());
|
||||
"" + cache.getTime(), Boolean.FALSE.toString(), "" + cache.isRealVote());
|
||||
}
|
||||
cachedOnlineVotes.put(uuid, new ArrayList<OfflineBungeeVote>());
|
||||
}
|
||||
@@ -114,7 +114,8 @@ public class Bungee extends Plugin implements net.md_5.bungee.api.plugin.Listene
|
||||
if (!c.isEmpty()) {
|
||||
for (OfflineBungeeVote cache : c) {
|
||||
sendPluginMessageServer(server, "Vote", cache.getPlayerName(), cache.getUuid(),
|
||||
cache.getService(), "" + cache.getTime(), Boolean.FALSE.toString());
|
||||
cache.getService(), "" + cache.getTime(), Boolean.FALSE.toString(),
|
||||
"" + cache.isRealVote());
|
||||
}
|
||||
cachedVotes.put(server, new ArrayList<OfflineBungeeVote>());
|
||||
}
|
||||
@@ -125,27 +126,16 @@ public class Bungee extends Plugin implements net.md_5.bungee.api.plugin.Listene
|
||||
@EventHandler
|
||||
public void onServerConnected(ServerConnectedEvent event) {
|
||||
final String server = event.getServer().getInfo().getName();
|
||||
getProxy().getScheduler().schedule(this, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
checkCachedVotes(server);
|
||||
}
|
||||
|
||||
}, 2, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PostLoginEvent event) {
|
||||
final String uuid = event.getPlayer().getUniqueId().toString();
|
||||
getProxy().getScheduler().schedule(this, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
checkCachedVotes(server);
|
||||
checkOnlineVotes(event.getPlayer(), uuid);
|
||||
}
|
||||
}, 2, TimeUnit.SECONDS);
|
||||
|
||||
}, 2, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -202,6 +192,7 @@ public class Bungee extends Plugin implements net.md_5.bungee.api.plugin.Listene
|
||||
getMysql().alterColumnType("MonthTotal", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("HighestWeeklyTotal", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("LastMonthTotal", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("OfflineRewards", "MEDIUMTEXT");
|
||||
|
||||
getProxy().getPluginManager().registerCommand(this, new VotingPluginBungeeCommand(this));
|
||||
|
||||
@@ -220,7 +211,7 @@ public class Bungee extends Plugin implements net.md_5.bungee.api.plugin.Listene
|
||||
for (String num : voteCacheFile.getServerVotes(server)) {
|
||||
Configuration data = voteCacheFile.getServerVotes(server, num);
|
||||
vote.add(new OfflineBungeeVote(data.getString("Name"), data.getString("UUID"),
|
||||
data.getString("Service"), data.getLong("Time")));
|
||||
data.getString("Service"), data.getLong("Time"), data.getBoolean("Real")));
|
||||
}
|
||||
cachedVotes.put(server, vote);
|
||||
}
|
||||
@@ -234,7 +225,7 @@ public class Bungee extends Plugin implements net.md_5.bungee.api.plugin.Listene
|
||||
for (String num : voteCacheFile.getServerVotes(player)) {
|
||||
Configuration data = voteCacheFile.getOnlineVotes(player, num);
|
||||
vote.add(new OfflineBungeeVote(data.getString("Name"), data.getString("UUID"),
|
||||
data.getString("Service"), data.getLong("Time")));
|
||||
data.getString("Service"), data.getLong("Time"), data.getBoolean("Real")));
|
||||
}
|
||||
cachedOnlineVotes.put(player, vote);
|
||||
}
|
||||
@@ -317,7 +308,7 @@ public class Bungee extends Plugin implements net.md_5.bungee.api.plugin.Listene
|
||||
Vote vote = event.getVote();
|
||||
getLogger().info("Vote received " + vote.getUsername() + " from service site " + vote.getServiceName());
|
||||
|
||||
vote(vote.getUsername(), vote.getServiceName());
|
||||
vote(vote.getUsername(), vote.getServiceName(), true);
|
||||
|
||||
}
|
||||
|
||||
@@ -327,7 +318,11 @@ public class Bungee extends Plugin implements net.md_5.bungee.api.plugin.Listene
|
||||
}
|
||||
}
|
||||
|
||||
public void vote(String player, String service) {
|
||||
public void vote(String player, String service, boolean realVote) {
|
||||
if (player == null || player.isEmpty()) {
|
||||
getLogger().info("No name from vote on " + service);
|
||||
return;
|
||||
}
|
||||
if (method.equals(BungeeMethod.SOCKETS)) {
|
||||
sendSocketVote(player, service);
|
||||
} else if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
|
||||
@@ -390,29 +385,32 @@ public class Bungee extends Plugin implements net.md_5.bungee.api.plugin.Listene
|
||||
cachedVotes.put(s, new ArrayList<OfflineBungeeVote>());
|
||||
}
|
||||
ArrayList<OfflineBungeeVote> list = cachedVotes.get(s);
|
||||
list.add(new OfflineBungeeVote(player, uuid, service, time));
|
||||
list.add(new OfflineBungeeVote(player, uuid, service, time, realVote));
|
||||
cachedVotes.put(s, list);
|
||||
|
||||
debug("Caching vote for " + player + " on " + service);
|
||||
debug("Caching vote for " + player + " on " + service + " for " + s);
|
||||
|
||||
} else {
|
||||
// send
|
||||
sendPluginMessageServer(s, "Vote", player, uuid, service, "" + time,
|
||||
Boolean.TRUE.toString());
|
||||
Boolean.TRUE.toString(), "" + realVote);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ProxiedPlayer p = getProxy().getPlayer(UUID.fromString(uuid));
|
||||
if (p.isConnected()) {
|
||||
if (p != null && p.isConnected()) {
|
||||
sendPluginMessageServer(p.getServer().getInfo().getName(), "VoteOnline", player, uuid, service,
|
||||
"" + time, Boolean.TRUE.toString());
|
||||
"" + time, Boolean.TRUE.toString(), "" + realVote);
|
||||
} else {
|
||||
if (!cachedOnlineVotes.containsKey(uuid)) {
|
||||
cachedOnlineVotes.put(uuid, new ArrayList<OfflineBungeeVote>());
|
||||
}
|
||||
ArrayList<OfflineBungeeVote> list = cachedVotes.get(uuid);
|
||||
list.add(new OfflineBungeeVote(player, uuid, service, time));
|
||||
ArrayList<OfflineBungeeVote> list = cachedOnlineVotes.get(uuid);
|
||||
if (list == null) {
|
||||
list = new ArrayList<OfflineBungeeVote>();
|
||||
}
|
||||
list.add(new OfflineBungeeVote(player, uuid, service, time, realVote));
|
||||
cachedOnlineVotes.put(uuid, list);
|
||||
debug("Caching online vote for " + player + " on " + service);
|
||||
}
|
||||
|
||||
@@ -143,12 +143,13 @@ public class BungeeMySQL {
|
||||
* Query sql = new Query(mysql, query);
|
||||
* ResultSet rs = sql.executeQuery();
|
||||
*/
|
||||
rs.next();
|
||||
String uuid = rs.getString("uuid");
|
||||
if (uuid != null && !uuid.isEmpty()) {
|
||||
sql.close();
|
||||
conn.close();
|
||||
return uuid;
|
||||
if (rs.next()) {
|
||||
String uuid = rs.getString("uuid");
|
||||
if (uuid != null && !uuid.isEmpty()) {
|
||||
sql.close();
|
||||
conn.close();
|
||||
return uuid;
|
||||
}
|
||||
}
|
||||
sql.close();
|
||||
conn.close();
|
||||
|
||||
@@ -12,12 +12,15 @@ public class OfflineBungeeVote {
|
||||
private String service;
|
||||
@Getter
|
||||
private long time;
|
||||
@Getter
|
||||
private boolean realVote;
|
||||
|
||||
public OfflineBungeeVote(String playerName, String uuid, String service, long time) {
|
||||
public OfflineBungeeVote(String playerName, String uuid, String service, long time, boolean realVote) {
|
||||
this.playerName = playerName;
|
||||
this.uuid = uuid;
|
||||
this.service = service;
|
||||
this.time = time;
|
||||
this.realVote = realVote;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -78,6 +78,7 @@ public class VoteCache {
|
||||
section.set("Service", voteData.getService());
|
||||
section.set("UUID", voteData.getUuid());
|
||||
section.set("Time", voteData.getTime());
|
||||
section.set("Real", voteData.isRealVote());
|
||||
save();
|
||||
}
|
||||
|
||||
@@ -87,6 +88,7 @@ public class VoteCache {
|
||||
section.set("Service", voteData.getService());
|
||||
section.set("UUID", voteData.getUuid());
|
||||
section.set("Time", voteData.getTime());
|
||||
section.set("Real", voteData.isRealVote());
|
||||
save();
|
||||
}
|
||||
|
||||
|
||||
+8
-3
@@ -24,13 +24,18 @@ public class VotingPluginBungeeCommand extends Command {
|
||||
if (args.length >= 2) {
|
||||
String user = args[1];
|
||||
String site = args[2];
|
||||
bungee.vote(user, site);
|
||||
bungee.vote(user, site,false);
|
||||
sender.sendMessage(new TextComponent("Sending vote"));
|
||||
}
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("status")) {
|
||||
sender.sendMessage(new TextComponent("Checking status, waiting for response, check console, only for socket method"));
|
||||
bungee.status(sender);
|
||||
if (bungee.getMethod().equals(BungeeMethod.SOCKETS)) {
|
||||
sender.sendMessage(new TextComponent(
|
||||
"Checking status, waiting for response, check console, only for socket method"));
|
||||
bungee.status(sender);
|
||||
} else {
|
||||
sender.sendMessage(new TextComponent("Not using socket method, command unavailable"));
|
||||
}
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("help")) {
|
||||
TextComponent[] msg = new TextComponent[3];
|
||||
|
||||
Reference in new issue
Block a user