Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37e29b8643 | ||
|
|
f683cc66c1 | ||
|
|
2059832df8 | ||
|
|
bda5e61898 | ||
|
|
dcb5f67ba8 | ||
|
|
e6065f85cc | ||
|
|
e0d3d36349 | ||
|
|
ab4d2069eb | ||
|
|
84f8f9073d | ||
|
|
1e9828f594 | ||
|
|
a01050125b | ||
|
|
60957be6fe | ||
|
|
a2b094f7d8 | ||
|
|
56e9705a6e | ||
|
|
ad62da3221 | ||
|
|
c1421d6324 | ||
|
|
068c2b704e | ||
|
|
89d21044d2 | ||
|
|
98246613ca | ||
|
|
ee884ee06a | ||
|
|
355ca2cdf0 | ||
|
|
abc37be619 | ||
|
|
20d9c08630 | ||
|
|
523c9e4ef9 | ||
|
|
76b19f7fb3 | ||
|
|
d776d0d798 | ||
|
|
b63da09fe8 | ||
|
|
d626210804 | ||
|
|
777c198471 | ||
|
|
dbd52a9114 | ||
|
|
3208b865e6 | ||
|
|
a78624eafb | ||
|
|
3249a43f4a | ||
|
|
8e15ba0a3a | ||
|
|
25969f35e0 | ||
|
|
6625bf9830 | ||
|
|
a925dcfd88 | ||
|
|
40357def84 | ||
|
|
b4806abf70 | ||
|
|
f847c033fd | ||
|
|
2919d23fd5 | ||
|
|
78412f4717 | ||
|
|
438504a344 | ||
|
|
d27bc2580f | ||
|
|
665865c5b3 | ||
|
|
d4124c78c2 | ||
|
|
63acc39588 | ||
|
|
46d7a3e95c | ||
|
|
39e5b54af6 | ||
|
|
1a47862d22 | ||
|
|
63c73b8871 | ||
|
|
3bfab3518b | ||
|
|
843d47cfb5 | ||
|
|
f7617eba61 | ||
|
|
1c95d37ce4 | ||
|
|
db65b564a5 | ||
|
|
6f88e126e4 | ||
|
|
25ea0b3a37 | ||
|
|
d3bdcc762f | ||
|
|
d72eb0e2a7 | ||
|
|
7b3a458b25 | ||
|
|
e2b79072d0 | ||
|
|
7845741cec | ||
|
|
6e2497dee7 | ||
|
|
7982c3df80 | ||
|
|
a7701f27f1 | ||
|
|
bbe95bf83a | ||
|
|
4e944df7f2 | ||
|
|
6461aac03d | ||
|
|
1ece7935a2 | ||
|
|
e130261a75 | ||
|
|
c65c241b4d | ||
|
|
9876e8e77b | ||
|
|
674c41fec2 | ||
|
|
6c295ec07f | ||
|
|
332b7b667e | ||
|
|
173bd381a5 | ||
|
|
6154efdd50 | ||
|
|
ee0dcf8019 | ||
|
|
6a4740f729 | ||
|
|
ccf58be365 | ||
|
|
b871278d82 | ||
|
|
90bc2dd3ee | ||
|
|
a85b9dce23 | ||
|
|
a171fad307 | ||
|
|
eba230e5c0 | ||
|
|
ffd1f616d4 | ||
|
|
4dfbf0c71f | ||
|
|
c97616eb8d | ||
|
|
6039bb12b8 | ||
|
|
11bf99faf9 | ||
|
|
cbfde9bedd | ||
|
|
0ab0fa5fb5 | ||
|
|
fd460787c3 | ||
|
|
524d22d37a | ||
|
|
220368d037 | ||
|
|
5d86c5297d | ||
|
|
7d69f1e496 | ||
|
|
e2784c6b17 | ||
|
|
f9ce8f325d | ||
|
|
b059fc644a | ||
|
|
5c7e5d2d59 | ||
|
|
3b4dde335d | ||
|
|
f00ca81c28 | ||
|
|
36ef5e15cf | ||
|
|
9a122fb46d | ||
|
|
17fc78a15f | ||
|
|
0718f0976d | ||
|
|
580e7d3061 | ||
|
|
29af36a9e9 | ||
|
|
56d39722cb | ||
|
|
6a202d4768 | ||
|
|
d399684bfa | ||
|
|
1a0da65c66 | ||
|
|
463b303f2e | ||
|
|
abf0e2bebb | ||
|
|
29670f8c22 | ||
|
|
7b08d6806b | ||
|
|
3211e22963 | ||
|
|
2634639f6b | ||
|
|
0798110743 | ||
|
|
2f90e112b1 | ||
|
|
661ea3ce94 | ||
|
|
8d6e95927c | ||
|
|
c138edccc8 | ||
|
|
e59b171aae | ||
|
|
36cfe6c9c6 | ||
|
|
45a413c3a6 | ||
|
|
a640582278 | ||
|
|
94122a1c80 | ||
|
|
0448278ba1 | ||
|
|
097bff23a2 | ||
|
|
be76d8f4af | ||
|
|
6122805c0d | ||
|
|
392d5cb17a | ||
|
|
ec1352d52b | ||
|
|
c3a4db1ac8 | ||
|
|
442eb35a4f | ||
|
|
d0851a9365 | ||
|
|
5273745be5 | ||
|
|
ca937f6879 | ||
|
|
a4c4fa5556 | ||
|
|
480c303f2f | ||
|
|
347640f346 | ||
|
|
1d8314c0eb | ||
|
|
20d95baea9 | ||
|
|
510f400c1b | ||
|
|
c49d0b3ede | ||
|
|
ff197cb6b6 | ||
|
|
9e4605258b | ||
|
|
c54e8bc8bd | ||
|
|
fe937b8f8d | ||
|
|
d262b3689a | ||
|
|
aac5226fce | ||
|
|
1d1b9722ac | ||
|
|
94193501ba | ||
|
|
2b142316dc | ||
|
|
a06124e49c | ||
|
|
c1bd04f117 | ||
|
|
4272d15a8b | ||
|
|
0537dad68e | ||
|
|
c1f09a6bd9 | ||
|
|
69ea7c71b3 | ||
|
|
3052f28b2c | ||
|
|
892d23e0d0 |
No files matched your search
@@ -0,0 +1,11 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "maven" # See documentation for possible values
|
||||
directory: "/VotingPlugin/" # Location of package manifests
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
@@ -1,17 +0,0 @@
|
||||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 20
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 5
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- Priority
|
||||
- nonstale
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: stale
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: false
|
||||
@@ -0,0 +1,24 @@
|
||||
name: Deploy Javadoc
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Deploy JavaDoc 🚀
|
||||
uses: MathieuSoysal/Javadoc-publisher.yml@main
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
javadoc-branch: gh-pages
|
||||
java-version: 17
|
||||
target-folder: ''
|
||||
project: maven # or gradle
|
||||
# subdirectories: moduleA moduleB #for subdirectories support, needs to be run with custom command
|
||||
custom-command: mvn -f VotingPlugin/pom.xml deploy -P javadoc javadoc:aggregate
|
||||
javadoc-source-folder: 'VotingPlugin/target/apidocs'
|
||||
@@ -0,0 +1,27 @@
|
||||
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
|
||||
#
|
||||
# You can adjust the behavior by modifying this file.
|
||||
# For more information, see:
|
||||
# https://github.com/actions/stale
|
||||
name: Mark stale issues and pull requests
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '19 16 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'Stale issue message'
|
||||
stale-pr-message: 'Stale pull request message'
|
||||
stale-issue-label: 'no-issue-activity'
|
||||
stale-pr-label: 'no-pr-activity'
|
||||
@@ -52,6 +52,13 @@ PerServerPoints: false
|
||||
# Should allow some compability with other plugins
|
||||
TriggerVotifierEvent: false
|
||||
|
||||
# If enabled plugin will give extra allsites reward if deterimned that it should
|
||||
# E.g. user votes offline for 7 days, they will only get 1 allsites reward by default
|
||||
# When enabled, they should get 7
|
||||
# Only applies to PLUGINMESSAGING
|
||||
# Recommend enabling ExtraAllSitesCheck in config.yml as well
|
||||
GiveExtraAllSitesRewards: false
|
||||
|
||||
# What server this is in bungee (must match)
|
||||
# Also can be applied to rewards
|
||||
Server: PleaseSet
|
||||
|
||||
@@ -172,6 +172,8 @@ Format:
|
||||
TimeFormat: '%amount% %TimeType%'
|
||||
LastVoted: '%times% ago'
|
||||
NeverVoted: 'Never voted'
|
||||
# Whether or not to include seconds into last voted time
|
||||
IncludeSeconds: true
|
||||
|
||||
# Format for /vote total
|
||||
Total:
|
||||
@@ -245,6 +247,16 @@ Format:
|
||||
# %Points% = player points
|
||||
Points: '&a%Player% currently has &a&l%Points%&a Points!'
|
||||
|
||||
# /vote givepoints command
|
||||
# Transfer between players command
|
||||
# Enable command below
|
||||
GivePoints:
|
||||
NotEnoughPoints: '&cNot enough points'
|
||||
NotJoinedServer: '&c%player% has not joined the server'
|
||||
NumberLowerThanZero: '&cNumber of points needs to be greater than 0'
|
||||
TransferFrom: '&c%transfer% points given to %touser%'
|
||||
TransferTo: '&cYou received %transfer% points from %fromuser%'
|
||||
|
||||
ToggleBroadcasts:
|
||||
Enabled: '&cYou will now see vote broadcasts'
|
||||
Disabled: '&cYou will no longer see vote broadcasts'
|
||||
@@ -321,6 +333,11 @@ Format:
|
||||
Weekly: 'Weekly'
|
||||
Monthly: 'Monthly'
|
||||
AllTime: 'AllTime'
|
||||
|
||||
# Invalid command messages
|
||||
InvalidCommand:
|
||||
Vote: '&4No valid arguments, see /vote help!'
|
||||
AdminVote: '&4No valid arguments, see /adminvote help!'
|
||||
|
||||
# Playernames to not be broadcasted when voting
|
||||
# case sensitive
|
||||
@@ -409,8 +426,10 @@ LogVotesToFile: false
|
||||
UsePrimaryAccountForPlaceholders: false
|
||||
|
||||
# Valid Options:
|
||||
# AUTO - Auto cache after they have been used (Recommended)
|
||||
# SPECIFIC - Only cache certain placeholders
|
||||
# AUTOALL - Auto cache placeholders after they have been used and cache all players placeholder all the time
|
||||
# AUTO - Auto cache after they have been used and cache online players placeholders (Recommended)
|
||||
# SPECIFIC - Only cache certain placeholders for online players
|
||||
# SPECIFICALL - Only cache certain placeholders for all players
|
||||
# NONE - Don't cache any placeholders
|
||||
PlaceholderCacheLevel: AUTO
|
||||
|
||||
@@ -437,10 +456,12 @@ UseJavascriptPlaceholders: false
|
||||
# For the example below use %votingplugin_custom_enoughpoints_5%
|
||||
# DO NOT USE ON MAIN THREAD IF POSSIBLE
|
||||
# Keep everything lowercase
|
||||
# Example:
|
||||
#CustomPlaceholderReturns:
|
||||
# 'enoughpoints_5':
|
||||
# 'true': 'User has enough points'
|
||||
# 'false': 'User does not have enough points'
|
||||
CustomPlaceholderReturns: {}
|
||||
|
||||
###########################################
|
||||
# Login options
|
||||
@@ -454,7 +475,7 @@ TreatVanishAsOffline: false
|
||||
DelayLoginEvent: 0
|
||||
|
||||
# Wait until user is logged in with AuthMe
|
||||
# Requires AuthMe
|
||||
# Requires AuthMe or LoginSecurity
|
||||
WaitUntilLoggedIn: true
|
||||
|
||||
###########################################
|
||||
@@ -500,6 +521,9 @@ AutoCreateVoteSites: true
|
||||
# Not really recommended
|
||||
AddTotals: true
|
||||
|
||||
# Disabling this prevents offline votes from adding totals to users
|
||||
AddTotalsOffline: true
|
||||
|
||||
# If false, votestreaks will be disabled
|
||||
UseVoteStreaks: true
|
||||
|
||||
@@ -507,8 +531,10 @@ UseVoteStreaks: true
|
||||
UseHighestTotals: true
|
||||
|
||||
# Enable Geyser prefix support
|
||||
# Geyser support is hit or miss currently
|
||||
# May work best if players vote with prefix
|
||||
# May take time before geyser players can vote properly
|
||||
# If players vote with prefix, then this is probably not needed and
|
||||
# may work better disabled
|
||||
# Geyser support is currently hit or miss
|
||||
GeyserPrefixSupport: false
|
||||
GeyserPrefix: '*'
|
||||
|
||||
@@ -528,6 +554,28 @@ OnlineMode: true
|
||||
# May improve performance
|
||||
#DisableCheckOnWorldChange: false
|
||||
|
||||
# Disable javascript processing in messages/rewards
|
||||
DisableJavascript: false
|
||||
|
||||
# If true, number of vote shop purchases will be tracked
|
||||
# Data will be tracked in serverdata.yml, may change in the future
|
||||
# No commands to view data currently
|
||||
TrackShopPurchases: false
|
||||
|
||||
# Limits about of offline votesites
|
||||
# Does not currently work with bungee votes from votingplugin
|
||||
OfflineVotesLimit:
|
||||
# Enable or disable
|
||||
Enabled: false
|
||||
# Limit of votes per votesite
|
||||
Amount: 5
|
||||
|
||||
# Default worlds set for all rewards
|
||||
DefaultRewardWorlds: []
|
||||
|
||||
# Default blackedlisted worlds set for all rewards
|
||||
DefaultRewardBlackListedWorlds: []
|
||||
|
||||
###########################################
|
||||
# Skull settings
|
||||
###########################################
|
||||
@@ -663,7 +711,7 @@ DropOnFullInv: true
|
||||
|
||||
# This will prevent spam clicking GUI's to prevent exploits
|
||||
# Number is time in between clicking in milliseconds
|
||||
SpamClickTime: 150
|
||||
SpamClickTime: 100
|
||||
# Message to send when inventory forced closed when spam clicking
|
||||
# Uncomment to use
|
||||
#SpamClickMessage: '&cDetected spam clicking GUI, closing to prevent exploits'
|
||||
@@ -694,6 +742,10 @@ PurgeMin: 90
|
||||
# Options below don't need to be touched
|
||||
##########################################
|
||||
|
||||
# If enabled, data is repulled from storage on vote shop purchase
|
||||
# This prevents possible exploits with vote shop
|
||||
ExtraVoteShopCheck: true
|
||||
|
||||
# Options for request api
|
||||
# Current methods:
|
||||
# ANVIL
|
||||
|
||||
@@ -309,6 +309,8 @@ CHEST:
|
||||
VoteShopLimitReached: '&aYou reached your limit'
|
||||
VoteShopRequireConfirmation: false
|
||||
VoteShopDisabled: '&cVote shop disabled'
|
||||
# If true, shop gui will reopen, updating all placeholders
|
||||
VoteShopReopenGUIOnPurchase: false
|
||||
# VoteShop extra items for display only
|
||||
#VoteShopExtraItems:
|
||||
#Item:
|
||||
@@ -376,7 +378,11 @@ BOOK:
|
||||
CanVoteText: 'Click me'
|
||||
CanVoteColor: 'GREEN'
|
||||
AlreadyVotedText: 'Click me'
|
||||
AlreadyVotedColor: 'RED'
|
||||
AlreadyVotedColor: 'RED'
|
||||
# If true the layout below is the full book text
|
||||
Manual: false
|
||||
# Only works if Manual is enabled
|
||||
TopLayout: []
|
||||
Layout:
|
||||
- '&3&l%Sitename%'
|
||||
- '[UrlText]'
|
||||
|
||||
@@ -96,6 +96,9 @@ VoteParty:
|
||||
# List of commands to execute, these only execute once.
|
||||
# %player% does not work here
|
||||
GlobalCommands: []
|
||||
# List of commands to execute once
|
||||
# Only run will run
|
||||
GlobalRandomCommand: []
|
||||
# Rewards to give per player
|
||||
Rewards:
|
||||
# Uncomment below for online players to be rewarded only
|
||||
@@ -128,6 +131,7 @@ VoteStreak:
|
||||
# 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)
|
||||
# This may not work perfectly on bungee setups at this time
|
||||
'2':
|
||||
# Enabled or not
|
||||
Enabled: false
|
||||
|
||||
@@ -48,8 +48,11 @@ VoteSites:
|
||||
# Recommend: false
|
||||
VoteDelayDaily: false
|
||||
|
||||
#Offset time for /vote next caculations
|
||||
#TimeOffSet: 0
|
||||
# Replaces offset, set the exact hour based on server time
|
||||
# Include server time offset when setting this
|
||||
# 2 = 2 am server time
|
||||
# Use 1-24
|
||||
#VoteDelayDailyHour: 14
|
||||
|
||||
# If true, rewards can be executed offline (requires ForceOffline to be true in the reward)
|
||||
# Setting this to true will execute the reward offline while the player is offline
|
||||
|
||||
@@ -112,6 +112,11 @@ Broadcast: true
|
||||
GeyserSupport: false
|
||||
GeyserPrefix: '.'
|
||||
|
||||
# Time votes will be cached on proxy
|
||||
# -1 means no time limit
|
||||
# Time in days
|
||||
VoteCacheTime: -1
|
||||
|
||||
VoteParty:
|
||||
# If enabled, will trigger vote party reward
|
||||
# in BungeeSettings.yml under BungeeVotePartyReward
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: ${project.name}
|
||||
version: ${project.version}
|
||||
version: "${project.version}"
|
||||
main: com.bencodez.votingplugin.VotingPluginMain
|
||||
description: Highly Customizable Voting Listener!
|
||||
website: https://www.spigotmc.org/resources/votingplugin.15358/
|
||||
@@ -16,10 +16,11 @@ softdepend:
|
||||
- AuthMe
|
||||
- SuperVanish
|
||||
- PremiumVanish
|
||||
- DiscordSRV
|
||||
- LuckPerms
|
||||
loadbefore:
|
||||
- MCPerks
|
||||
api-version: 1.13
|
||||
folia-supported: true
|
||||
libraries:
|
||||
- org.openjdk.nashorn:nashorn-core:15.3
|
||||
commands:
|
||||
@@ -56,9 +57,6 @@ commands:
|
||||
votereward:
|
||||
description: Open VoteReward GUI
|
||||
aliases: vreward
|
||||
vote?:
|
||||
description: View Help
|
||||
aliases: v?
|
||||
voteparty:
|
||||
description: A command
|
||||
aliases: vparty
|
||||
|
||||
+146
-23
@@ -1,13 +1,11 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.bencodez</groupId>
|
||||
<artifactId>votingplugin</artifactId>
|
||||
<version>6.13</version>
|
||||
<artifactId>${version.art}</artifactId>
|
||||
<version>6.14.1</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>VotingPlugin</name>
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<github.global.server>github</github.global.server>
|
||||
<project.build.sourceEncoding>Cp1252</project.build.sourceEncoding>
|
||||
<build.number>NOTSET</build.number>
|
||||
@@ -61,7 +59,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<version>3.3.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
@@ -90,7 +88,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.4.3</version>
|
||||
<version>3.5.0</version>
|
||||
<configuration>
|
||||
<shadedArtifactAttached>false</shadedArtifactAttached>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
@@ -164,7 +162,7 @@
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.3.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resources</id>
|
||||
@@ -210,24 +208,32 @@
|
||||
<id>bencodez repo</id>
|
||||
<url>https://nexus.bencodez.com/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.19.4-R0.1-SNAPSHOT</version>
|
||||
<version>1.20.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.2</version>
|
||||
<version>1.18.28</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.17-R0.1-SNAPSHOT</version>
|
||||
<version>1.20-R0.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -245,26 +251,66 @@
|
||||
<dependency>
|
||||
<groupId>com.velocitypowered</groupId>
|
||||
<artifactId>velocity-api</artifactId>
|
||||
<version>1.1.5</version>
|
||||
<version>3.1.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-velocity</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<version>3.0.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bencodez</groupId>
|
||||
<artifactId>advancedcore</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>compile</scope>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.11.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>normal</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<build.profile.id>normal</build.profile.id>
|
||||
<version.art>votingplugin</version.art>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.bencodez</groupId>
|
||||
<artifactId>advancedcore</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>normal-folia</id>
|
||||
<properties>
|
||||
<build.profile.id>normal</build.profile.id>
|
||||
<version.art>votingplugin-folia</version.art>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.bencodez</groupId>
|
||||
<artifactId>advancedcore-folia</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>prod2</id>
|
||||
<properties>
|
||||
<version.art>votingplugin</version.art>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<build.profile.id>prod2</build.profile.id>
|
||||
</properties>
|
||||
<distributionManagement>
|
||||
@@ -274,10 +320,21 @@
|
||||
<url>file://${project.build.directory}/mvn-repo</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.bencodez</groupId>
|
||||
<artifactId>advancedcore</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>deploy-snapshot</id>
|
||||
<properties>
|
||||
<version.art>votingplugin</version.art>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<build.profile.id>deploy-snapshot</build.profile.id>
|
||||
</properties>
|
||||
<distributionManagement>
|
||||
@@ -290,12 +347,20 @@
|
||||
<url>https://nexus.bencodez.com/repository/maven-snapshots/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.bencodez</groupId>
|
||||
<artifactId>advancedcore</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>3.0.0-M1</version>
|
||||
<version>3.1.1</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
@@ -303,7 +368,7 @@
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<version>1.5.1</version>
|
||||
<version>1.6.13</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-deploy</id>
|
||||
@@ -322,11 +387,69 @@
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>javadoc</id>
|
||||
<properties>
|
||||
<version.art>votingplugin</version.art>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<build.profile.id>javadoc</build.profile.id>
|
||||
</properties>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>internal.repo</id>
|
||||
<name>Temporary Staging Repository</name>
|
||||
<url>file://${project.build.directory}/mvn-repo</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.bencodez</groupId>
|
||||
<artifactId>advancedcore</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<phase>deploy</phase>
|
||||
<configuration>
|
||||
<sourcepath>${project.basedir}/target/delombok</sourcepath>
|
||||
<outputDirectory>${project.basedir}/target/apidocs</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>deploy</id>
|
||||
<properties>
|
||||
<version.art>votingplugin</version.art>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<build.profile.id>deploy</build.profile.id>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.bencodez</groupId>
|
||||
<artifactId>advancedcore</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>nexus</id>
|
||||
@@ -342,7 +465,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.4</version>
|
||||
<version>3.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
@@ -359,7 +482,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>3.0.0-M1</version>
|
||||
<version>3.1.1</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
@@ -367,7 +490,7 @@
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<version>1.5.1</version>
|
||||
<version>1.6.13</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-deploy</id>
|
||||
@@ -383,7 +506,7 @@
|
||||
<skipStaging>true</skipStaging>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<!--<plugin>
|
||||
<groupId>com.github.github</groupId>
|
||||
<artifactId>site-maven-plugin</artifactId>
|
||||
<version>0.12</version>
|
||||
@@ -409,7 +532,7 @@
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugin>-->
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.Ben12345rocks.VotingPlugin.Objects;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
@Deprecated
|
||||
@@ -10,7 +10,7 @@ public class User {
|
||||
private VotingPluginUser user;
|
||||
|
||||
public User(Player p) {
|
||||
user = UserManager.getInstance().getVotingPluginUser(p);
|
||||
user = VotingPluginMain.plugin.getVotingPluginUserManager().getVotingPluginUser(p);
|
||||
}
|
||||
|
||||
public void addPoints(int points) {
|
||||
|
||||
@@ -32,7 +32,6 @@ import com.bencodez.votingplugin.bungee.BungeeMessageData;
|
||||
import com.bencodez.votingplugin.bungee.BungeeMethod;
|
||||
import com.bencodez.votingplugin.bungee.BungeeVersion;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
import lombok.Getter;
|
||||
@@ -49,10 +48,10 @@ public class BungeeHandler implements Listener {
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
@Getter
|
||||
private int bungeeVotePartyCurrent = 0;
|
||||
private int bungeeVotePartyCurrent = -2;
|
||||
|
||||
@Getter
|
||||
private int bungeeVotePartyRequired = 0;
|
||||
private int bungeeVotePartyRequired = -2;
|
||||
|
||||
@Getter
|
||||
private SocketHandler socketHandler;
|
||||
@@ -64,7 +63,6 @@ public class BungeeHandler implements Listener {
|
||||
|
||||
public BungeeHandler(VotingPluginMain plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
}
|
||||
|
||||
public void close() {
|
||||
@@ -287,8 +285,8 @@ public class BungeeHandler implements Listener {
|
||||
String service = args.get(2);
|
||||
long time = Long.parseLong(args.get(3));
|
||||
plugin.debug("pluginmessaging vote received from " + player + "/" + uuid + " on " + service);
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid),
|
||||
player);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager()
|
||||
.getVotingPluginUser(UUID.fromString(uuid), player);
|
||||
|
||||
boolean wasOnline = Boolean.valueOf(args.get(4));
|
||||
|
||||
@@ -350,6 +348,8 @@ public class BungeeHandler implements Listener {
|
||||
user.addPoints(plugin.getConfigFile().getPointsOnVote());
|
||||
}
|
||||
|
||||
plugin.getSpecialRewards().bungeeAllSitesCheck(user, numberOfVotes, num);
|
||||
|
||||
if (Boolean.valueOf(args.get(5))) {
|
||||
plugin.getServerData().addServiceSite(service);
|
||||
}
|
||||
@@ -383,8 +383,8 @@ public class BungeeHandler implements Listener {
|
||||
|
||||
plugin.debug(
|
||||
"pluginmessaging voteonline received from " + player + "/" + uuid + " on " + service);
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid),
|
||||
player);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager()
|
||||
.getVotingPluginUser(UUID.fromString(uuid), player);
|
||||
user.cache();
|
||||
|
||||
if (plugin.getBungeeSettings().isPerServerPoints()) {
|
||||
@@ -442,6 +442,8 @@ public class BungeeHandler implements Listener {
|
||||
user.addPoints(plugin.getConfigFile().getPointsOnVote());
|
||||
}
|
||||
|
||||
plugin.getSpecialRewards().bungeeAllSitesCheck(user, numberOfVotes, num);
|
||||
|
||||
if (Boolean.valueOf(args.get(5))) {
|
||||
plugin.getServerData().addServiceSite(service);
|
||||
}
|
||||
@@ -456,7 +458,8 @@ public class BungeeHandler implements Listener {
|
||||
public void onRecieve(String subChannel, ArrayList<String> args) {
|
||||
String player = args.get(0);
|
||||
plugin.debug("pluginmessaging voteupdate received for " + player);
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(player));
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager()
|
||||
.getVotingPluginUser(UUID.fromString(player));
|
||||
user.cache();
|
||||
|
||||
user.offVote();
|
||||
@@ -485,8 +488,8 @@ public class BungeeHandler implements Listener {
|
||||
if (args.size() > 2) {
|
||||
String uuid = args.get(0);
|
||||
String service = args.get(2);
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid),
|
||||
args.get(1));
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager()
|
||||
.getVotingPluginUser(UUID.fromString(uuid), args.get(1));
|
||||
VoteSite site = plugin.getVoteSite(service, true);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, false);
|
||||
@@ -503,8 +506,8 @@ public class BungeeHandler implements Listener {
|
||||
if (args.size() > 2) {
|
||||
String uuid = args.get(0);
|
||||
String votes = args.get(2);
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid),
|
||||
args.get(1));
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager()
|
||||
.getVotingPluginUser(UUID.fromString(uuid), args.get(1));
|
||||
user.offlineBroadcast(user, false, Integer.parseInt(votes));
|
||||
}
|
||||
}
|
||||
@@ -523,7 +526,7 @@ public class BungeeHandler implements Listener {
|
||||
@Override
|
||||
public void onRecieve(String subChannel, ArrayList<String> args) {
|
||||
for (final String cmd : plugin.getBungeeSettings().getBungeeVotePartyGlobalCommands()) {
|
||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||
plugin.getBukkitScheduler().runTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -572,9 +575,9 @@ public class BungeeHandler implements Listener {
|
||||
String uuid = data[1];
|
||||
VotingPluginUser user = null;
|
||||
if (!uuid.isEmpty()) {
|
||||
user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid));
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(UUID.fromString(uuid));
|
||||
} else {
|
||||
user = UserManager.getInstance().getVotingPluginUser(data[2]);
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(data[2]);
|
||||
}
|
||||
|
||||
user.cache();
|
||||
@@ -605,9 +608,9 @@ public class BungeeHandler implements Listener {
|
||||
String uuid = data[1];
|
||||
VotingPluginUser user = null;
|
||||
if (!uuid.isEmpty()) {
|
||||
user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid));
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(UUID.fromString(uuid));
|
||||
} else {
|
||||
user = UserManager.getInstance().getVotingPluginUser(data[2]);
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(data[2]);
|
||||
}
|
||||
|
||||
user.cache();
|
||||
@@ -628,7 +631,7 @@ public class BungeeHandler implements Listener {
|
||||
if (data.length > 2) {
|
||||
String votes = data[0];
|
||||
String p = data[1];
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(p);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(p);
|
||||
user.offlineBroadcast(user, false, Integer.parseInt(votes));
|
||||
}
|
||||
}
|
||||
@@ -641,7 +644,7 @@ public class BungeeHandler implements Listener {
|
||||
if (data.length > 2) {
|
||||
VoteSite site = plugin.getVoteSite(data[1], true);
|
||||
String p = data[3];
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(p);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(p);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, false);
|
||||
} else {
|
||||
@@ -658,7 +661,7 @@ public class BungeeHandler implements Listener {
|
||||
if (data.length > 2) {
|
||||
VoteSite site = plugin.getVoteSite(data[1], true);
|
||||
String p = data[2];
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(p);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(p);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, false);
|
||||
} else {
|
||||
|
||||
@@ -33,7 +33,7 @@ public class VotingPluginHooks {
|
||||
}
|
||||
|
||||
public UserManager getUserManager() {
|
||||
return UserManager.getInstance();
|
||||
return getMainClass().getVotingPluginUserManager();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -54,6 +54,7 @@ import com.bencodez.advancedcore.api.rewards.injected.RewardInjectValidator;
|
||||
import com.bencodez.advancedcore.api.skull.SkullHandler;
|
||||
import com.bencodez.advancedcore.api.updater.Updater;
|
||||
import com.bencodez.advancedcore.api.user.userstorage.Column;
|
||||
import com.bencodez.advancedcore.api.yml.YMLConfig;
|
||||
import com.bencodez.advancedcore.logger.Logger;
|
||||
import com.bencodez.advancedcore.nms.NMSManager;
|
||||
import com.bencodez.votingplugin.broadcast.BroadcastHandler;
|
||||
@@ -80,6 +81,7 @@ import com.bencodez.votingplugin.listeners.VotingPluginUpdateEvent;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
import com.bencodez.votingplugin.placeholders.MVdWPlaceholders;
|
||||
import com.bencodez.votingplugin.placeholders.PlaceHolders;
|
||||
import com.bencodez.votingplugin.placeholders.VotingPluginExpansion;
|
||||
import com.bencodez.votingplugin.signs.Signs;
|
||||
import com.bencodez.votingplugin.specialrewards.SpecialRewards;
|
||||
import com.bencodez.votingplugin.test.VoteTester;
|
||||
@@ -146,7 +148,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
|
||||
@Getter
|
||||
private PlaceHolders placeholders;
|
||||
|
||||
|
||||
@Getter
|
||||
private VoteTester voteTester;
|
||||
|
||||
@@ -221,13 +223,13 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
@Getter
|
||||
private UserManager votingPluginUserManager;
|
||||
|
||||
private void addDirectlyDefinedRewards(DirectlyDefinedReward directlyDefinedReward) {
|
||||
public void addDirectlyDefinedRewards(DirectlyDefinedReward directlyDefinedReward) {
|
||||
getRewardHandler().addDirectlyDefined(directlyDefinedReward);
|
||||
}
|
||||
|
||||
public void basicBungeeUpdate() {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
VotingPluginUser user = getVotingPluginUserManager().getVotingPluginUser(player);
|
||||
user.cache();
|
||||
user.offVote();
|
||||
user.checkOfflineRewards();
|
||||
@@ -260,13 +262,13 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
}
|
||||
|
||||
if (ymlError) {
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
plugin.getBukkitScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
plugin.getLogger().severe("Failed to load a file, check startup log");
|
||||
}
|
||||
}, 10);
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +296,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
* @return the user
|
||||
*/
|
||||
public VotingPluginUser getUser(UUID uuid) {
|
||||
return UserManager.getInstance().getVotingPluginUser(uuid);
|
||||
return getVotingPluginUserManager().getVotingPluginUser(uuid);
|
||||
}
|
||||
|
||||
private YamlConfiguration getVersionFile() {
|
||||
@@ -927,10 +929,13 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
getBungeeSettings().setValue(path, value);
|
||||
}
|
||||
});
|
||||
|
||||
getRewardHandler().checkDirectlyDefined();
|
||||
|
||||
}
|
||||
|
||||
private void loadTimer() {
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
plugin.getBukkitScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -955,7 +960,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
}, 1000, 1000 * 30, TimeUnit.MILLISECONDS);
|
||||
|
||||
}
|
||||
}, 40L);
|
||||
}, 2);
|
||||
|
||||
}
|
||||
|
||||
@@ -1013,30 +1018,37 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
@Getter
|
||||
private TimeQueueHandler timeQueueHandler;
|
||||
|
||||
private void loadBungeeHandler() {
|
||||
bungeeHandler = new BungeeHandler(this);
|
||||
bungeeHandler.load();
|
||||
|
||||
if (getOptions().getServer().equalsIgnoreCase("PleaseSet")) {
|
||||
getLogger().warning("Bungeecoord is true and server name is not set, bungeecoord features may not work");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostLoad() {
|
||||
loadVersionFile();
|
||||
getOptions().setServer(bungeeSettings.getServer());
|
||||
|
||||
|
||||
voteTester = new VoteTester(plugin);
|
||||
|
||||
loadVoteTimer();
|
||||
|
||||
if (bungeeSettings.isUseBungeecoord()) {
|
||||
bungeeHandler = new BungeeHandler(this);
|
||||
bungeeHandler.load();
|
||||
|
||||
if (getOptions().getServer().equalsIgnoreCase("PleaseSet")) {
|
||||
getLogger()
|
||||
.warning("Bungeecoord is true and server name is not set, bungeecoord features may not work");
|
||||
}
|
||||
|
||||
loadBungeeHandler();
|
||||
}
|
||||
|
||||
if (!bungeeSettings.isUseBungeecoord() || !bungeeSettings.isGloblalDataEnabled()) {
|
||||
this.timeQueueHandler = new TimeQueueHandler(this);
|
||||
}
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||
new VotingPluginExpansion(this).register();
|
||||
getLogger().info("Loading PlaceholderAPI expansion");
|
||||
}
|
||||
|
||||
registerCommands();
|
||||
checkVotifier();
|
||||
registerEvents();
|
||||
@@ -1051,7 +1063,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
coolDownCheck.checkEnabled();
|
||||
coolDownCheck.load();
|
||||
|
||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||
plugin.getBukkitScheduler().runTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -1061,7 +1073,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
|
||||
topVoterHandler = new TopVoterHandler(this);
|
||||
lastMonthTopVoter = new LinkedHashMap<TopVoterPlayer, Integer>();
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
plugin.getBukkitScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -1084,7 +1096,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
|
||||
topVoterHandler.register();
|
||||
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
plugin.getBukkitScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -1121,7 +1133,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
@Override
|
||||
public String onRewardRequest(Reward reward, com.bencodez.advancedcore.api.user.AdvancedCoreUser user,
|
||||
int num, HashMap<String, String> placeholders) {
|
||||
VotingPluginUser vpUser = UserManager.getInstance().getVotingPluginUser(user);
|
||||
VotingPluginUser vpUser = getVotingPluginUserManager().getVotingPluginUser(user);
|
||||
String str = "" + vpUser.addPoints(num);
|
||||
debug("Setting points to " + str);
|
||||
return str;
|
||||
@@ -1154,7 +1166,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
StringParser.getInstance().replacePlaceHolder(section.getString("Message", ""),
|
||||
placeholders),
|
||||
section.getString("Color", "BLUE"), section.getString("Style", "SOLID"),
|
||||
(double) UserManager.getInstance().getVotingPluginUser(user).getSitesVotedOn()
|
||||
(double) getVotingPluginUserManager().getVotingPluginUser(user).getSitesVotedOn()
|
||||
/ plugin.getVoteSites().size(),
|
||||
section.getInt("Delay", 30));
|
||||
}
|
||||
@@ -1167,7 +1179,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
|
||||
@Override
|
||||
public String getValue(Reward reward, com.bencodez.advancedcore.api.user.AdvancedCoreUser user) {
|
||||
VotingPluginUser vUser = UserManager.getInstance().getVotingPluginUser(user);
|
||||
VotingPluginUser vUser = getVotingPluginUserManager().getVotingPluginUser(user);
|
||||
return "" + vUser.getTotal(top);
|
||||
}
|
||||
});
|
||||
@@ -1210,14 +1222,14 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
}
|
||||
|
||||
if (!issues) {
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
plugin.getBukkitScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
plugin.getLogger().warning(
|
||||
"Detected an issue with voting sites, check the server startup log for more details: https://github.com/BenCodez/VotingPlugin/wiki/Votifier-Troubleshooting");
|
||||
}
|
||||
}, 30l);
|
||||
}, 5);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1248,7 +1260,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
|
||||
loadVoteSites();
|
||||
|
||||
votingPluginUserManager = UserManager.getInstance();
|
||||
votingPluginUserManager = new UserManager(this);
|
||||
votingPluginUserManager.addCachingKeys();
|
||||
|
||||
setJenkinsSite("bencodez.com");
|
||||
@@ -1309,7 +1321,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
|
||||
Permission perm = Bukkit.getPluginManager().getPermission("VotingPlugin.Player");
|
||||
if (perm != null) {
|
||||
if (configFile.getGiveDefaultPermission()) {
|
||||
if (configFile.isGiveDefaultPermission()) {
|
||||
perm.setDefault(PermissionDefault.TRUE);
|
||||
getLogger().info("Giving VotingPlugin.Player permission by default, can be disabled in the config");
|
||||
} else {
|
||||
@@ -1379,7 +1391,12 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
bungeeSettings.reloadData();
|
||||
|
||||
if (bungeeSettings.isUseBungeecoord()) {
|
||||
getBungeeHandler().loadGlobalMysql();
|
||||
if (getBungeeHandler() == null) {
|
||||
loadBungeeHandler();
|
||||
}
|
||||
if (userStorage) {
|
||||
getBungeeHandler().loadGlobalMysql();
|
||||
}
|
||||
}
|
||||
checkYMLError();
|
||||
|
||||
@@ -1389,16 +1406,29 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
|
||||
updateAdvancedCoreHook();
|
||||
plugin.loadVoteSites();
|
||||
loadDirectlyDefined();
|
||||
|
||||
reloadAdvancedCore(userStorage);
|
||||
getOptions().setServer(bungeeSettings.getServer());
|
||||
if (userStorage) {
|
||||
placeholders.load();
|
||||
placeholders.reload();
|
||||
getCoolDownCheck().getTimer().schedule(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (VoteSite site : plugin.getVoteSites()) {
|
||||
if (site.isVoteDelayDaily()) {
|
||||
getCoolDownCheck().checkAllVoteSite(site);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 5, TimeUnit.SECONDS);
|
||||
|
||||
}
|
||||
|
||||
voteReminding.loadRemindChecking();
|
||||
coolDownCheck.checkEnabled();
|
||||
loadDirectlyDefined();
|
||||
|
||||
setUpdate(true);
|
||||
}
|
||||
@@ -1461,10 +1491,10 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
}
|
||||
}
|
||||
boolean topVoterIgnorePermissionUse = plugin.getConfigFile()
|
||||
.getTopVoterIgnorePermission();
|
||||
.isTopVoterIgnorePermission();
|
||||
ArrayList<String> blackList = plugin.getConfigFile().getBlackList();
|
||||
|
||||
// ArrayList<String> uuids = UserManager.getInstance().getAllUUIDs();
|
||||
// ArrayList<String> uuids = getVotingPluginUserManager().getAllUUIDs();
|
||||
int currentDay = LocalDateTime.now().getDayOfMonth();
|
||||
HashMap<UUID, ArrayList<Column>> cols = plugin.getUserManager().getAllKeys();
|
||||
long time1 = ((System.currentTimeMillis() - startTime) / 1000);
|
||||
@@ -1476,7 +1506,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
String uuid = playerData.getKey().toString();
|
||||
if (plugin != null && plugin.isEnabled()) {
|
||||
if (uuid != null && !uuid.isEmpty()) {
|
||||
VotingPluginUser user = UserManager.getInstance()
|
||||
VotingPluginUser user = getVotingPluginUserManager()
|
||||
.getVotingPluginUser(UUID.fromString(uuid), false);
|
||||
user.dontCache();
|
||||
user.updateTempCacheWithColumns(playerData.getValue());
|
||||
@@ -1518,7 +1548,10 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
}
|
||||
}
|
||||
if (plugin != null) {
|
||||
plugin.getPlaceholders().onUpdate(user);
|
||||
if (!plugin.getPlaceholders().getCacheLevel().onlineOnly()
|
||||
|| user.isOnline()) {
|
||||
plugin.getPlaceholders().onUpdate(user, false);
|
||||
}
|
||||
}
|
||||
user.clearTempCache();
|
||||
user = null;
|
||||
@@ -1592,7 +1625,23 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
public void updateAdvancedCoreHook() {
|
||||
getJavascriptEngine().put("VotingPlugin", this);
|
||||
allowDownloadingFromSpigot(15358);
|
||||
setConfigData(configFile.getData());
|
||||
setConfigData(new YMLConfig(this, configFile.getData()) {
|
||||
|
||||
@Override
|
||||
public void setValue(String path, Object value) {
|
||||
configFile.setValue(path, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData() {
|
||||
configFile.saveData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createSection(String key) {
|
||||
configFile.createSection(key);
|
||||
}
|
||||
});
|
||||
if (bungeeSettings.isUseBungeecoord()) {
|
||||
getOptions().setPerServerRewards(getBungeeSettings().isPerServerRewards());
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.bencodez.votingplugin;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import com.bencodez.advancedcore.api.metrics.BStatsMetrics;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
|
||||
public class VotingPluginMetrics {
|
||||
|
||||
@@ -66,13 +65,20 @@ public class VotingPluginMetrics {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
if (!plugin.getSpecialRewardsConfig().getVotePartyEnabled()) {
|
||||
if (!plugin.getSpecialRewardsConfig().isVotePartyEnabled()) {
|
||||
return "False";
|
||||
} else {
|
||||
return "True";
|
||||
}
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("placeholder_cache_level", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return plugin.getPlaceholders().getCacheLevel().toString();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_milestone", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
@@ -177,7 +183,7 @@ public class VotingPluginMetrics {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
int total = UserManager.getInstance().getAllUUIDs().size();
|
||||
int total = plugin.getUserManager().getAllUUIDs().size();
|
||||
if (total > 800000) {
|
||||
return ">800000";
|
||||
} else if (total > 700000) {
|
||||
@@ -219,28 +225,28 @@ public class VotingPluginMetrics {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getConfigFile().getVoteRemindingEnabled();
|
||||
return "" + plugin.getConfigFile().isVoteRemindingEnabled();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("LoadTopVoter_Monthly", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getConfigFile().getLoadTopVoterMonthly();
|
||||
return "" + plugin.getConfigFile().isLoadTopVoterMonthly();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("LoadTopVoter_Weekly", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getConfigFile().getLoadTopVoterWeekly();
|
||||
return "" + plugin.getConfigFile().isLoadTopVoterWeekly();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("LoadTopVoter_Daily", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getConfigFile().getLoadTopVoterDaily();
|
||||
return "" + plugin.getConfigFile().isLoadTopVoterDaily();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("bungeemethod", new Callable<String>() {
|
||||
|
||||
@@ -13,7 +13,6 @@ import org.bukkit.entity.Player;
|
||||
import com.bencodez.advancedcore.api.messages.StringParser;
|
||||
import com.bencodez.advancedcore.api.misc.MiscUtils;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
|
||||
public class BroadcastHandler {
|
||||
private VotingPluginMain plugin;
|
||||
@@ -46,7 +45,7 @@ public class BroadcastHandler {
|
||||
bc = StringParser.getInstance().replacePlaceHolder(bc, placeholders);
|
||||
ArrayList<Player> players = new ArrayList<Player>();
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (!UserManager.getInstance().getVotingPluginUser(p).getDisableBroadcast()) {
|
||||
if (!plugin.getVotingPluginUserManager().getVotingPluginUser(p).getDisableBroadcast()) {
|
||||
players.add(p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,6 +145,10 @@ public class Config {
|
||||
return getData().getInt("VoteParty.IncreaseVotesRequired", 0);
|
||||
}
|
||||
|
||||
public int getVoteCacheTime() {
|
||||
return getData().getInt("VoteCacheTime", -1);
|
||||
}
|
||||
|
||||
public String getVotePartyBroadcast() {
|
||||
return getData().getString("VoteParty.Broadcast", "");
|
||||
}
|
||||
|
||||
@@ -180,6 +180,27 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
public void checkVoteCacheTime() {
|
||||
long cTime = LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||
for (Entry<String, ArrayList<OfflineBungeeVote>> entry : cachedOnlineVotes.entrySet()) {
|
||||
ArrayList<OfflineBungeeVote> votes = entry.getValue();
|
||||
for (int i = votes.size() - 1; i >= 0; i--) {
|
||||
if (cTime - votes.get(i).getTime() > getConfig().getVoteCacheTime() * 24 * 60 * 60 * 1000) {
|
||||
votes.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Entry<String, ArrayList<OfflineBungeeVote>> entry : cachedVotes.entrySet()) {
|
||||
ArrayList<OfflineBungeeVote> votes = entry.getValue();
|
||||
for (int i = votes.size() - 1; i >= 0; i--) {
|
||||
if (cTime - votes.get(i).getTime() > getConfig().getVoteCacheTime() * 24 * 60 * 60 * 1000) {
|
||||
votes.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void debug(String msg) {
|
||||
if (config.getDebug()) {
|
||||
getLogger().info("Debug: " + msg);
|
||||
@@ -582,6 +603,9 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
|
||||
@Override
|
||||
public void timeChanged(TimeType type, boolean fake, boolean pre, boolean post) {
|
||||
if (getConfig().getVoteCacheTime() > 0) {
|
||||
checkVoteCacheTime();
|
||||
}
|
||||
if (!config.getGlobalDataEnabled()) {
|
||||
return;
|
||||
}
|
||||
@@ -1299,7 +1323,7 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
|
||||
}
|
||||
} else {
|
||||
if (isOnline(p) && !config.getBlockedServers().contains(p.getServer().getInfo().getName())) {
|
||||
if (isOnline(p) && getAvailableAllServers().contains(p.getServer().getInfo().getName())) {
|
||||
sendPluginMessageServer(p.getServer().getInfo().getName(), "VoteOnline", player, uuid, service,
|
||||
"" + time, Boolean.TRUE.toString(), "" + realVote, text.toString(),
|
||||
"" + getConfig().getBungeeManageTotals(), "" + BungeeVersion.getPluginMessageVersion(),
|
||||
|
||||
@@ -60,7 +60,11 @@ public class Config extends VelocityYMLFile {
|
||||
public int getBungeePort() {
|
||||
return getInt(getNode("BungeeServer", "Port"), 1297);
|
||||
}
|
||||
|
||||
|
||||
public int getVoteCacheTime() {
|
||||
return getInt(getNode("VoteCacheTime"), -1);
|
||||
}
|
||||
|
||||
public boolean getDebug() {
|
||||
return getBoolean(getNode("Debug"), false);
|
||||
}
|
||||
|
||||
+34
-2
@@ -533,6 +533,27 @@ public class VotingPluginVelocity {
|
||||
}
|
||||
}
|
||||
|
||||
public void checkVoteCacheTime() {
|
||||
long cTime = LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||
for (Entry<String, ArrayList<OfflineBungeeVote>> entry : cachedOnlineVotes.entrySet()) {
|
||||
ArrayList<OfflineBungeeVote> votes = entry.getValue();
|
||||
for (int i = votes.size() - 1; i >= 0; i--) {
|
||||
if (cTime - votes.get(i).getTime() > getConfig().getVoteCacheTime() * 24 * 60 * 60 * 1000) {
|
||||
votes.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Entry<RegisteredServer, ArrayList<OfflineBungeeVote>> entry : cachedVotes.entrySet()) {
|
||||
ArrayList<OfflineBungeeVote> votes = entry.getValue();
|
||||
for (int i = votes.size() - 1; i >= 0; i--) {
|
||||
if (cTime - votes.get(i).getTime() > getConfig().getVoteCacheTime() * 24 * 60 * 60 * 1000) {
|
||||
votes.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onProxyDisable(ProxyShutdownEvent event) {
|
||||
if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
|
||||
@@ -622,6 +643,9 @@ public class VotingPluginVelocity {
|
||||
|
||||
@Override
|
||||
public void timeChanged(TimeType type, boolean fake, boolean pre, boolean post) {
|
||||
if (getConfig().getVoteCacheTime() > 0) {
|
||||
checkVoteCacheTime();
|
||||
}
|
||||
if (!config.getGlobalDataEnabled()) {
|
||||
return;
|
||||
}
|
||||
@@ -1338,8 +1362,7 @@ public class VotingPluginVelocity {
|
||||
}
|
||||
} else {
|
||||
|
||||
if (isOnline(p) && !config.getBlockedServers()
|
||||
.contains(p.getCurrentServer().get().getServerInfo().getName())) {
|
||||
if (isOnline(p) && isInAvailableServers(p.getCurrentServer().get().getServerInfo().getName())) {
|
||||
sendPluginMessageServer(p.getCurrentServer().get().getServer(), "VoteOnline", player, uuid,
|
||||
service, "" + time, Boolean.TRUE.toString(), "" + realVote, text.toString(),
|
||||
"" + getConfig().getBungeeManageTotals(), "" + BungeeVersion.getPluginMessageVersion(),
|
||||
@@ -1395,6 +1418,15 @@ public class VotingPluginVelocity {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInAvailableServers(String server) {
|
||||
for (RegisteredServer s : getAvailableAllServers()) {
|
||||
if (s.getServerInfo().getName().equalsIgnoreCase(server)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Set<RegisteredServer> getAvailableAllServers() {
|
||||
Set<RegisteredServer> servers = new HashSet<RegisteredServer>();
|
||||
if (config.getWhiteListedServers().isEmpty()) {
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,11 +1,11 @@
|
||||
package com.bencodez.votingplugin.commands.executers;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.bencodez.advancedcore.api.command.CommandHandler;
|
||||
import com.bencodez.advancedcore.api.messages.StringParser;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
@@ -36,7 +36,7 @@ public class CommandAdminVote implements CommandExecutor {
|
||||
}
|
||||
|
||||
// invalid command
|
||||
sender.sendMessage(ChatColor.RED + "No valid arguments, see /adminvote help!");
|
||||
sender.sendMessage(StringParser.getInstance().colorize(plugin.getConfigFile().getFormatInvalidCommandAdminVote()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@ package com.bencodez.votingplugin.commands.executers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.bencodez.advancedcore.api.command.CommandHandler;
|
||||
import com.bencodez.advancedcore.api.messages.StringParser;
|
||||
import com.bencodez.advancedcore.api.misc.ArrayUtils;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
@@ -91,9 +91,9 @@ public class CommandAliases implements CommandExecutor {
|
||||
|
||||
// invalid command
|
||||
if (adminCommand) {
|
||||
sender.sendMessage(ChatColor.RED + "No valid arguments, see /adminvote help!");
|
||||
sender.sendMessage(StringParser.getInstance().colorize(plugin.getConfigFile().getFormatInvalidCommandAdminVote()));
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "No valid arguments, see /vote help!");
|
||||
sender.sendMessage(StringParser.getInstance().colorize(plugin.getConfigFile().getFormatInvalidCommandVote()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.bencodez.votingplugin.commands.executers;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.bencodez.advancedcore.api.command.CommandHandler;
|
||||
import com.bencodez.advancedcore.api.messages.StringParser;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
@@ -61,7 +61,7 @@ public class CommandVote implements CommandExecutor {
|
||||
}
|
||||
|
||||
// invalid command
|
||||
sender.sendMessage(ChatColor.RED + "No valid arguments, see /vote help!");
|
||||
sender.sendMessage(StringParser.getInstance().colorize(plugin.getConfigFile().getFormatInvalidCommandVote()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@ import com.bencodez.advancedcore.api.valuerequest.InputMethod;
|
||||
import com.bencodez.advancedcore.api.valuerequest.ValueRequest;
|
||||
import com.bencodez.advancedcore.api.valuerequest.ValueRequestBuilder;
|
||||
import com.bencodez.advancedcore.api.valuerequest.listeners.StringListener;
|
||||
import com.bencodez.advancedcore.api.yml.editor.ConfigEditor;
|
||||
import com.bencodez.advancedcore.command.gui.RewardEditGUI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.commands.gui.admin.AdminVoteBungeeSettings;
|
||||
import com.bencodez.votingplugin.commands.gui.admin.AdminVoteVoteParty;
|
||||
import com.bencodez.votingplugin.commands.gui.admin.cumulative.AdminVoteCumulative;
|
||||
import com.bencodez.votingplugin.commands.gui.admin.milestones.AdminVoteMilestones;
|
||||
@@ -167,11 +167,40 @@ public class AdminGUI {
|
||||
}
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton(new ItemBuilder("GRASS_BLOCK").setName("&cEdit BungeeSettings.yml")) {
|
||||
buttons.add(new BInventoryButton(
|
||||
new ItemBuilder("GRASS_BLOCK").setName("&cEdit BungeeSettings.yml").addLoreLine("&aCurrently WIP")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new AdminVoteBungeeSettings(plugin, clickEvent.getPlayer()).open();
|
||||
new ConfigEditor(plugin, plugin.getBungeeSettings()).open(clickEvent.getPlayer());
|
||||
}
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton(
|
||||
new ItemBuilder("GRASS_BLOCK").setName("&cEdit Config.yml").addLoreLine("&aCurrently WIP")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new ConfigEditor(plugin, plugin.getConfigFile(), plugin.getOptions().getYmlConfig(),
|
||||
plugin.getOptions().getClass()).open(clickEvent.getPlayer());
|
||||
}
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton(
|
||||
new ItemBuilder(Material.CHEST).setName("&cEdit GUI.yml").addLoreLine("&aCurrently WIP")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new ConfigEditor(plugin, plugin.getGui()).open(clickEvent.getPlayer());
|
||||
}
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton(
|
||||
new ItemBuilder("GRASS_BLOCK").setName("&cEdit SpecialRewards.yml").addLoreLine("&aCurrently WIP")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new ConfigEditor(plugin, plugin.getSpecialRewardsConfig()).open(clickEvent.getPlayer());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -340,6 +369,17 @@ public class AdminGUI {
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueNumber("VoteDelayDailyHour", voteSite.getVoteDelayDailyHour()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Number num) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
plugin.getConfigVoteSites().setVoteDelay(siteName, num.intValue());
|
||||
plugin.reload();
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueBoolean("Enabled", voteSite.isEnabled()) {
|
||||
|
||||
@Override
|
||||
|
||||
-147
@@ -1,147 +0,0 @@
|
||||
package com.bencodez.votingplugin.commands.gui.admin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.bencodez.advancedcore.api.gui.GUIHandler;
|
||||
import com.bencodez.advancedcore.api.gui.GUIMethod;
|
||||
import com.bencodez.advancedcore.api.inventory.editgui.EditGUI;
|
||||
import com.bencodez.advancedcore.api.inventory.editgui.EditGUIButton;
|
||||
import com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueBoolean;
|
||||
import com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueString;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
public class AdminVoteBungeeSettings extends GUIHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteBungeeSettings(VotingPluginMain plugin, CommandSender player) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
EditGUI inv = new EditGUI("Edit BungeeSettings");
|
||||
inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.BungeeSettings");
|
||||
|
||||
inv.addButton(new EditGUIButton(
|
||||
new EditGUIValueBoolean("UseBungeecord", plugin.getBungeeSettings().isUseBungeecoord()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean value) {
|
||||
setPathData(getKey(), value);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(
|
||||
new EditGUIButton(new EditGUIValueString("BungeeMethod", plugin.getBungeeSettings().getBungeeMethod()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, String value) {
|
||||
setPathData(getKey(), value);
|
||||
}
|
||||
}).addOptions("PLUGINMESSAGING", "SOCKETS", "MYSQL"));
|
||||
|
||||
inv.addButton(
|
||||
new EditGUIButton(new EditGUIValueBoolean("BungeeDebug", plugin.getBungeeSettings().isBungeeDebug()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean value) {
|
||||
setPathData(getKey(), value);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(
|
||||
new EditGUIValueBoolean("BungeeBroadcast", plugin.getBungeeSettings().isBungeeBroadcast()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean value) {
|
||||
setPathData(getKey(), value);
|
||||
}
|
||||
}.addLore("Triggers a broadcast for the entire network, most cases it is best for this to be false")));
|
||||
|
||||
inv.addButton(new EditGUIButton(
|
||||
new EditGUIValueBoolean("BungeeBroadcastAlways", plugin.getBungeeSettings().isBungeeBroadcastAlways()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean value) {
|
||||
setPathData(getKey(), value);
|
||||
}
|
||||
}.addLore("Whether or not to broadcast on cached votes").addLore("PLUGINMESSAGING ONLY")));
|
||||
|
||||
inv.addButton(new EditGUIButton(
|
||||
new EditGUIValueBoolean("PerServerRewards", plugin.getBungeeSettings().isPerServerRewards()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean value) {
|
||||
setPathData(getKey(), value);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(
|
||||
new EditGUIValueBoolean("PerServerMilestones", plugin.getBungeeSettings().isPerServerMilestones()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean value) {
|
||||
setPathData(getKey(), value);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(
|
||||
new EditGUIValueBoolean("PerServerPoints", plugin.getBungeeSettings().isPerServerPoints()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean value) {
|
||||
setPathData(getKey(), value);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(
|
||||
new EditGUIValueBoolean("TriggerVotifierEvent", plugin.getBungeeSettings().isTriggerVotifierEvent()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean value) {
|
||||
setPathData(getKey(), value);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueString("Server", plugin.getBungeeSettings().getServer()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, String value) {
|
||||
setPathData(getKey(), value);
|
||||
}
|
||||
}.addLore("Server name as stated in proxy")));
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHEST);
|
||||
}
|
||||
|
||||
private void setPathData(String path, Object value) {
|
||||
plugin.getBungeeSettings().getData().set(path, value);
|
||||
plugin.getBungeeSettings().saveData();
|
||||
plugin.reload();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -64,7 +64,7 @@ public class AdminVoteHelp extends GUIHandler {
|
||||
ArrayList<TextComponent> msg = new ArrayList<TextComponent>();
|
||||
HashMap<String, TextComponent> unsorted = new HashMap<String, TextComponent>();
|
||||
|
||||
boolean requirePerms = plugin.getConfigFile().getFormatCommandsVoteHelpRequirePermission();
|
||||
boolean requirePerms = plugin.getConfigFile().isFormatCommandsVoteHelpRequirePermission();
|
||||
|
||||
for (CommandHandler cmdHandle : plugin.getAdminVoteCommand()) {
|
||||
if (!requirePerms || cmdHandle.hasPerm(sender)) {
|
||||
|
||||
+1
-2
@@ -14,7 +14,6 @@ import com.bencodez.advancedcore.api.gui.GUIMethod;
|
||||
import com.bencodez.advancedcore.api.placeholder.NonPlayerPlaceHolder;
|
||||
import com.bencodez.advancedcore.api.placeholder.PlaceHolder;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
import xyz.upperlevel.spigot.book.BookUtil;
|
||||
@@ -75,7 +74,7 @@ public class AdminVotePlaceholdersPlayer extends GUIHandler {
|
||||
msg.add("&cPlaceholders:");
|
||||
VotingPluginUser placeholderUser = user;
|
||||
if (plugin.getConfigFile().isUsePrimaryAccountForPlaceholders() && user.hasPrimaryAccount()) {
|
||||
placeholderUser = UserManager.getInstance().getVotingPluginUser(user.getPrimaryAccount());
|
||||
placeholderUser = plugin.getVotingPluginUserManager().getVotingPluginUser(user.getPrimaryAccount());
|
||||
}
|
||||
for (PlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getPlaceholders()) {
|
||||
String identifier = placeholder.getIdentifier().toLowerCase();
|
||||
|
||||
+9
-9
@@ -52,7 +52,7 @@ public class AdminVoteVoteParty extends GUIHandler {
|
||||
|
||||
// to add
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1),
|
||||
new EditGUIValueBoolean("Enabled", plugin.getSpecialRewardsConfig().getVotePartyEnabled()) {
|
||||
new EditGUIValueBoolean("Enabled", plugin.getSpecialRewardsConfig().isVotePartyEnabled()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean name) {
|
||||
@@ -70,7 +70,7 @@ public class AdminVoteVoteParty extends GUIHandler {
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.LADDER, 1), new EditGUIValueNumber(
|
||||
"IncreaseVotesRquired", plugin.getSpecialRewardsConfig().getVotePartyIncreaseVotesRquired()) {
|
||||
"IncreaseVotesRquired", plugin.getSpecialRewardsConfig().getVotePartyIncreaseVotesRequired()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Number num) {
|
||||
@@ -106,7 +106,7 @@ public class AdminVoteVoteParty extends GUIHandler {
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean("GiveAllPlayers",
|
||||
plugin.getSpecialRewardsConfig().getVotePartyGiveAllPlayers()) {
|
||||
plugin.getSpecialRewardsConfig().isVotePartyGiveAllPlayers()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean name) {
|
||||
@@ -124,7 +124,7 @@ public class AdminVoteVoteParty extends GUIHandler {
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1),
|
||||
new EditGUIValueBoolean("ResetEachDay", plugin.getSpecialRewardsConfig().getVotePartyResetEachDay()) {
|
||||
new EditGUIValueBoolean("ResetEachDay", plugin.getSpecialRewardsConfig().isVotePartyResetEachDay()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean name) {
|
||||
@@ -133,7 +133,7 @@ public class AdminVoteVoteParty extends GUIHandler {
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1),
|
||||
new EditGUIValueBoolean("ResetWeekly", plugin.getSpecialRewardsConfig().getVotePartyResetWeekly()) {
|
||||
new EditGUIValueBoolean("ResetWeekly", plugin.getSpecialRewardsConfig().isVotePartyResetWeekly()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean name) {
|
||||
@@ -142,7 +142,7 @@ public class AdminVoteVoteParty extends GUIHandler {
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1),
|
||||
new EditGUIValueBoolean("ResetMonthly", plugin.getSpecialRewardsConfig().getVotePartyResetMontly()) {
|
||||
new EditGUIValueBoolean("ResetMonthly", plugin.getSpecialRewardsConfig().isVotePartyResetMonthly()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean name) {
|
||||
@@ -151,7 +151,7 @@ public class AdminVoteVoteParty extends GUIHandler {
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean("OnlyOncePerDay",
|
||||
plugin.getSpecialRewardsConfig().getVotePartyOnlyOncePerDay()) {
|
||||
plugin.getSpecialRewardsConfig().isVotePartyOnlyOncePerDay()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean name) {
|
||||
@@ -169,7 +169,7 @@ public class AdminVoteVoteParty extends GUIHandler {
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean("CountFakeVotes",
|
||||
plugin.getSpecialRewardsConfig().getVotePartyCountFakeVotes()) {
|
||||
plugin.getSpecialRewardsConfig().isVotePartyCountFakeVotes()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean name) {
|
||||
@@ -178,7 +178,7 @@ public class AdminVoteVoteParty extends GUIHandler {
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean("CountOfflineVotes",
|
||||
plugin.getSpecialRewardsConfig().getVotePartyCountOfflineVotes()) {
|
||||
plugin.getSpecialRewardsConfig().isVotePartyCountOfflineVotes()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean name) {
|
||||
|
||||
+27
@@ -1,6 +1,8 @@
|
||||
package com.bencodez.votingplugin.commands.gui.admin.voteshop;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -109,6 +111,31 @@ public class AdminVoteVoteShopItem extends GUIHandler {
|
||||
setPathData(getKey(), value);
|
||||
}
|
||||
}));
|
||||
inv.addButton(new BInventoryButton(
|
||||
new ItemBuilder(player.getInventory().getItemInMainHand().clone()).addLoreLine("&cClick to add")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
ItemBuilder item = new ItemBuilder(clickEvent.getPlayer().getInventory().getItemInMainHand().clone());
|
||||
Map<String, Object> map = item.getConfiguration(false);
|
||||
for (Entry<String, Object> entry : map.entrySet()) {
|
||||
setPathData(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(player.getInventory().getItemInMainHand().clone())
|
||||
.addLoreLine("&cClick to add with exact data")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
ItemBuilder item = new ItemBuilder(clickEvent.getPlayer().getInventory().getItemInMainHand().clone());
|
||||
Map<String, Object> map = item.getConfiguration(true);
|
||||
for (Entry<String, Object> entry : map.entrySet()) {
|
||||
setPathData("ItemStack." + entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.DISPENSER, 1).setName("&cRewards")) {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,7 +17,6 @@ import com.bencodez.advancedcore.api.misc.ArrayUtils;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardOptions;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteGUI extends GUIHandler {
|
||||
@@ -122,7 +121,7 @@ public class VoteGUI extends GUIHandler {
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
if (this.user == null) {
|
||||
user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
|
||||
}
|
||||
BInventory inv = new BInventory(plugin.getGui().getChestVoteGUIName());
|
||||
if (!plugin.getConfigFile().isAlwaysCloseInventory()) {
|
||||
@@ -166,7 +165,7 @@ public class VoteGUI extends GUIHandler {
|
||||
|
||||
if (plugin.getRewardHandler().hasRewards(plugin.getGui().getData(), plugin.getGui()
|
||||
.getChestVoteGUISlotRewardsPath(slot, event.getButton().getLastRewardsPath(player)))) {
|
||||
plugin.getRewardHandler().giveReward(UserManager.getInstance().getVotingPluginUser(player),
|
||||
plugin.getRewardHandler().giveReward(plugin.getVotingPluginUserManager().getVotingPluginUser(player),
|
||||
plugin.getGui().getData(),
|
||||
plugin.getGui().getChestVoteGUISlotRewardsPath(slot,
|
||||
event.getButton().getLastRewardsPath(player)),
|
||||
@@ -177,7 +176,7 @@ public class VoteGUI extends GUIHandler {
|
||||
@Override
|
||||
public ItemBuilder onUpdate(Player player) {
|
||||
ItemBuilder item = getItemSlot(slot, player);
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
|
||||
item.addPlaceholder("points", "" + user.getPoints());
|
||||
item.addPlaceholder("player", user.getPlayerName());
|
||||
item.addPlaceholder("top", plugin.getConfigFile().getVoteTopDefault());
|
||||
|
||||
@@ -37,7 +37,7 @@ public class VoteHelp extends GUIHandler {
|
||||
ArrayList<TextComponent> msg = new ArrayList<TextComponent>();
|
||||
HashMap<String, TextComponent> unsorted = new HashMap<String, TextComponent>();
|
||||
|
||||
boolean requirePerms = plugin.getConfigFile().getFormatCommandsVoteHelpRequirePermission();
|
||||
boolean requirePerms = plugin.getConfigFile().isFormatCommandsVoteHelpRequirePermission();
|
||||
|
||||
String colorStr = plugin.getConfigFile().getFormatCommandsVoteHelpHoverColor();
|
||||
ChatColor hoverColor = null;
|
||||
@@ -68,7 +68,7 @@ public class VoteHelp extends GUIHandler {
|
||||
ArrayList<TextComponent> msg = new ArrayList<TextComponent>();
|
||||
HashMap<String, TextComponent> unsorted = new HashMap<String, TextComponent>();
|
||||
|
||||
boolean requirePerms = plugin.getConfigFile().getFormatCommandsVoteHelpRequirePermission();
|
||||
boolean requirePerms = plugin.getConfigFile().isFormatCommandsVoteHelpRequirePermission();
|
||||
|
||||
for (CommandHandler cmdHandle : plugin.getVoteCommand()) {
|
||||
if (!requirePerms || cmdHandle.hasPerm(sender)) {
|
||||
|
||||
@@ -8,8 +8,8 @@ import org.bukkit.entity.Player;
|
||||
import com.bencodez.advancedcore.api.gui.GUIHandler;
|
||||
import com.bencodez.advancedcore.api.gui.GUIMethod;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
|
||||
import com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton;
|
||||
import com.bencodez.advancedcore.api.item.ItemBuilder;
|
||||
import com.bencodez.advancedcore.api.messages.StringParser;
|
||||
@@ -17,7 +17,6 @@ import com.bencodez.advancedcore.api.misc.ArrayUtils;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteLast extends GUIHandler {
|
||||
@@ -74,7 +73,7 @@ public class VoteLast extends GUIHandler {
|
||||
if (plugin.getGui().isChestVoteLastClickableLinks()) {
|
||||
Player player = event.getPlayer();
|
||||
if (player != null) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
|
||||
user.sendMessage(
|
||||
StringParser.getInstance()
|
||||
.replacePlaceHolder(
|
||||
@@ -115,7 +114,7 @@ public class VoteLast extends GUIHandler {
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().getChestVoteLastBackButton()) {
|
||||
if (plugin.getGui().isChestVoteLastBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ public class VoteNext extends GUIHandler {
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().getChestVoteNextBackButton()) {
|
||||
if (plugin.getGui().isChestVoteNextBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
}
|
||||
inv.openInventory(player);
|
||||
|
||||
@@ -16,7 +16,6 @@ import com.bencodez.advancedcore.api.messages.StringParser;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardOptions;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteShop extends GUIHandler {
|
||||
@@ -46,7 +45,7 @@ public class VoteShop extends GUIHandler {
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
if (!plugin.getGui().getChestVoteShopEnabled()) {
|
||||
if (!plugin.getGui().isChestVoteShopEnabled()) {
|
||||
player.sendMessage(StringParser.getInstance().colorize(plugin.getGui().getChestVoteShopDisabled()));
|
||||
return;
|
||||
}
|
||||
@@ -54,6 +53,10 @@ public class VoteShop extends GUIHandler {
|
||||
if (this.user == null) {
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
|
||||
}
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
|
||||
/*
|
||||
* if (!plugin.getConfigFile().isExtraVoteShopCheck()) { user.cacheAsync(); }
|
||||
*/
|
||||
BInventory inv = new BInventory(plugin.getGui().getChestVoteShopName());
|
||||
inv.addPlaceholder("points", "" + user.getPoints());
|
||||
inv.addPlaceholder("sitesavailable", "" + user.getSitesNotVotedOn());
|
||||
@@ -92,8 +95,10 @@ public class VoteShop extends GUIHandler {
|
||||
public void onClick(ClickEvent event) {
|
||||
Player player = event.getWhoClicked();
|
||||
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
user.cache();
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
|
||||
if (plugin.getConfigFile().isExtraVoteShopCheck()) {
|
||||
user.cache();
|
||||
}
|
||||
|
||||
String identifier = (String) getData("identifier");
|
||||
int limit = (int) getData("Limit");
|
||||
@@ -118,9 +123,12 @@ public class VoteShop extends GUIHandler {
|
||||
plugin.getGui().getChestShopIdentifierIdentifierName(identifier));
|
||||
placeholders.put("points", "" + points);
|
||||
placeholders.put("limit", "" + limit);
|
||||
if (user.removePoints(points)) {
|
||||
if (user.removePoints(points, true)) {
|
||||
plugin.getLogger().info("VoteShop: " + user.getPlayerName() + "/"
|
||||
+ user.getUUID() + " bought " + identifier + " for " + points);
|
||||
if (plugin.getConfigFile().isTrackShopPurchases()) {
|
||||
plugin.getServerData().addVoteShopPurchase(identifier);
|
||||
}
|
||||
|
||||
plugin.getRewardHandler().giveReward(user, plugin.getGui().getData(),
|
||||
plugin.getGui().getChestShopIdentifierRewardsPath(identifier),
|
||||
@@ -138,13 +146,23 @@ public class VoteShop extends GUIHandler {
|
||||
plugin.getConfigFile().getFormatShopFailedMsg(), placeholders));
|
||||
}
|
||||
} else {
|
||||
new VoteShopConfirm(plugin, player, user, identifier).open(GUIMethod.CHEST);
|
||||
plugin.getBukkitScheduler().runTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new VoteShopConfirm(plugin, player, user, identifier).open(GUIMethod.CHEST);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
user.sendMessage(plugin.getGui().getChestVoteShopLimitReached());
|
||||
}
|
||||
plugin.getCommandLoader().processSlotClick(player, user, identifier);
|
||||
if (plugin.getGui().isChestVoteShopReopenGUIOnPurchase()) {
|
||||
plugin.getCommandLoader().processSlotClick(player, user, "shop");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +196,7 @@ public class VoteShop extends GUIHandler {
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().getChestVoteShopBackButton()) {
|
||||
if (plugin.getGui().isChestVoteShopBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
}
|
||||
|
||||
|
||||
@@ -60,9 +60,12 @@ public class VoteShopConfirm extends GUIHandler {
|
||||
placeholders.put("identifier", identifier);
|
||||
placeholders.put("points", "" + points);
|
||||
placeholders.put("limit", "" + limit);
|
||||
if (user.removePoints(points)) {
|
||||
if (user.removePoints(points, true)) {
|
||||
plugin.getLogger().info("VoteShop: " + user.getPlayerName() + "/" + user.getUUID() + " bought "
|
||||
+ identifier + " for " + points);
|
||||
if (plugin.getConfigFile().isTrackShopPurchases()) {
|
||||
plugin.getServerData().addVoteShopPurchase(identifier);
|
||||
}
|
||||
|
||||
plugin.getRewardHandler().giveReward(user, plugin.getGui().getData(),
|
||||
plugin.getGui().getChestShopIdentifierRewardsPath(identifier),
|
||||
|
||||
@@ -136,7 +136,7 @@ public class VoteStreak extends GUIHandler {
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().getChestVoteStreakBackButton()) {
|
||||
if (plugin.getGui().isChestVoteStreakBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.bencodez.advancedcore.nms.NMSManager;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoterPlayer;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteToday extends GUIHandler {
|
||||
@@ -110,7 +109,7 @@ public class VoteToday extends GUIHandler {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(uuid);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(uuid);
|
||||
new VoteGUI(plugin, player, user)
|
||||
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodGUI().toUpperCase()));
|
||||
}
|
||||
@@ -134,7 +133,7 @@ public class VoteToday extends GUIHandler {
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().getChestVoteTodayBackButton()) {
|
||||
if (plugin.getGui().isChestVoteTodayBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
}
|
||||
inv.openInventory(player);
|
||||
|
||||
@@ -119,7 +119,7 @@ public class VoteTopVoter extends GUIHandler {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
if (plugin.getGui().getChestVoteTopOpenMainGUIOnClick()) {
|
||||
if (plugin.getGui().isChestVoteTopOpenMainGUIOnClick()) {
|
||||
TopVoterPlayer user = (TopVoterPlayer) getData("User");
|
||||
new VoteGUI(plugin, player, user.getUser())
|
||||
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodGUI().toUpperCase()));
|
||||
@@ -131,7 +131,7 @@ public class VoteTopVoter extends GUIHandler {
|
||||
button.setSlot(playerSlots.remove());
|
||||
}
|
||||
|
||||
inv.setCloseInv(plugin.getGui().getChestVoteTopCloseGUIOnClick());
|
||||
inv.setCloseInv(plugin.getGui().isChestVoteTopCloseGUIOnClick());
|
||||
|
||||
inv.addButton(button);
|
||||
pos++;
|
||||
@@ -174,7 +174,7 @@ public class VoteTopVoter extends GUIHandler {
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().getChestVoteTopBackButton()) {
|
||||
if (plugin.getGui().isChestVoteTopBackButton()) {
|
||||
if (customzationEnabled) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user)
|
||||
.setSlot(customization.getInt("BackButtonSlot", 0)));
|
||||
@@ -199,7 +199,7 @@ public class VoteTopVoter extends GUIHandler {
|
||||
});
|
||||
}
|
||||
|
||||
if (customization == null || (customzationEnabled && !customization.getBoolean("RemoveBottomBar"))) {
|
||||
if (customization == null || !customzationEnabled || !customization.getBoolean("RemoveBottomBar")) {
|
||||
inv.setPages(true);
|
||||
}
|
||||
inv.setMaxInvSize(plugin.getGui().getChestVoteTopSize());
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ public class VoteTopVoterLastMonth extends GUIHandler {
|
||||
pos++;
|
||||
}
|
||||
|
||||
if (plugin.getGui().getChestVoteTopBackButton()) {
|
||||
if (plugin.getGui().isChestVoteTopBackButton()) {
|
||||
inv.getPageButtons().add(plugin.getCommandLoader().getBackButton(user).setSlot(1));
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ public class VoteTotal extends GUIHandler {
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().getChestVoteTotalBackButton()) {
|
||||
if (plugin.getGui().isChestVoteTotalBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
}
|
||||
inv.openInventory(player);
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoter;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
import xyz.upperlevel.spigot.book.BookUtil;
|
||||
@@ -41,11 +40,11 @@ public class VoteURL extends GUIHandler {
|
||||
this.user = user;
|
||||
this.json = json;
|
||||
if (user == null && player instanceof Player) {
|
||||
this.user = UserManager.getInstance().getVotingPluginUser((Player) player);
|
||||
this.user = plugin.getVotingPluginUserManager().getVotingPluginUser((Player) player);
|
||||
}
|
||||
if (player != null && user != null && player.getName().equals(user.getPlayerName())) {
|
||||
if (plugin.getConfigFile().isUsePrimaryAccountForPlaceholders() && user.hasPrimaryAccount()) {
|
||||
user = UserManager.getInstance().getVotingPluginUser(user.getPrimaryAccount());
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(user.getPrimaryAccount());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,7 +57,7 @@ public class VoteURL extends GUIHandler {
|
||||
if (title != null) {
|
||||
sites.addAll(title);
|
||||
}
|
||||
if (plugin.getConfigFile().getFormatCommandsVoteAutoInputSites()) {
|
||||
if (plugin.getConfigFile().isFormatCommandsVoteAutoInputSites()) {
|
||||
int counter = 0;
|
||||
for (VoteSite voteSite : plugin.getVoteSites()) {
|
||||
if (!voteSite.isHidden()) {
|
||||
@@ -133,6 +132,11 @@ public class VoteURL extends GUIHandler {
|
||||
public void onBook(Player player) {
|
||||
BookWrapper book = new BookWrapper(plugin.getGui().getBookVoteURLBookGUITitle());
|
||||
|
||||
if (plugin.getGui().isBookVoteURLBookGUIManual()) {
|
||||
Layout layout = new Layout(plugin.getGui().getBookVoteURLBookGUITopLayout());
|
||||
book.addLayout(layout);
|
||||
}
|
||||
int i = 1;
|
||||
for (VoteSite site : plugin.getVoteSites()) {
|
||||
Layout layout = new Layout(plugin.getGui().getBookVoteURLBookGUILayout()).addPlaceholder("sitename",
|
||||
site.getDisplayName());
|
||||
@@ -142,12 +146,12 @@ public class VoteURL extends GUIHandler {
|
||||
color = ChatColor.valueOf(plugin.getGui().getBookVoteURLBookGUICanVoteColor());
|
||||
text = plugin.getGui().getBookVoteURLBookGUICanVoteText();
|
||||
}
|
||||
String url = StringParser.getInstance().replacePlaceHolder(site.getVoteURLJsonStrip(), "player",
|
||||
user.getPlayerName());
|
||||
String url = StringParser.getInstance().replacePlaceHolder(StringParser.getInstance()
|
||||
.replacePlaceHolder(site.getVoteURLJsonStrip(), "player", user.getPlayerName()), "num", "" + i);
|
||||
layout.replaceTextComponent("[UrlText]", BookUtil.TextBuilder.of(text).color(color)
|
||||
.onClick(BookUtil.ClickAction.openUrl(url)).onHover(BookUtil.HoverAction.showText(url)).build());
|
||||
book.addLayout(layout);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
book.open(player);
|
||||
@@ -162,14 +166,14 @@ public class VoteURL extends GUIHandler {
|
||||
public void onChest(Player player) {
|
||||
// normal GUI
|
||||
BInventory inv = new BInventory(plugin.getGui().getChestVoteURLName());
|
||||
if (plugin.getGui().getChestVoteURLViewAllUrlsButtonEnabled()) {
|
||||
if (plugin.getGui().isChestVoteURLViewAllUrlsButtonEnabled()) {
|
||||
ItemBuilder builderAll = getItemAll();
|
||||
|
||||
inv.addButton(new UpdatingBInventoryButton(plugin, builderAll, 5000, 5000) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(event.getPlayer());
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(event.getPlayer());
|
||||
json = true;
|
||||
user.sendMessage(getChat(player));
|
||||
}
|
||||
@@ -196,7 +200,7 @@ public class VoteURL extends GUIHandler {
|
||||
public void onClick(ClickEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (player != null) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
|
||||
user.sendMessage(StringParser.getInstance().replacePlaceHolder(StringParser.getInstance()
|
||||
.replacePlaceHolder(StringParser.getInstance().replacePlaceHolder(
|
||||
plugin.getGui().getChestVoteURLURLText(), "voteurl", voteSite.getVoteURL()),
|
||||
@@ -229,7 +233,7 @@ public class VoteURL extends GUIHandler {
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().getChestVoteURLBackButton()) {
|
||||
if (plugin.getGui().isChestVoteURLBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public class VoteURLVoteSite extends GUIHandler {
|
||||
}
|
||||
});
|
||||
|
||||
if (plugin.getGui().getChestVoteURLBackButton()) {
|
||||
if (plugin.getGui().isChestVoteURLBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
}
|
||||
inv.openInventory(player);
|
||||
|
||||
@@ -46,6 +46,11 @@ public class BungeeSettings extends YMLFile {
|
||||
@ConfigDataBoolean(path = "PerServerMilestones")
|
||||
@Getter
|
||||
private boolean perServerMilestones = false;
|
||||
|
||||
@ConfigDataBoolean(path = "GiveExtraAllSitesRewards")
|
||||
@Getter
|
||||
private boolean giveExtraAllSitesRewards = false;
|
||||
|
||||
|
||||
@ConfigDataBoolean(path = "PerServerRewards")
|
||||
@Getter
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.bencodez.advancedcore.api.yml.YMLFile;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.AnnotationHandler;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataBoolean;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataInt;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataKeys;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataListString;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataString;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
@@ -34,6 +35,10 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private boolean addTotals = true;
|
||||
|
||||
@ConfigDataBoolean(path = "AddTotalsOffline")
|
||||
@Getter
|
||||
private boolean addTotalsOffline = true;
|
||||
|
||||
@ConfigDataBoolean(path = "PerSiteCoolDownEvents")
|
||||
@Getter
|
||||
private boolean perSiteCoolDownEvents = false;
|
||||
@@ -66,6 +71,14 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private boolean alwaysCloseInventory = false;
|
||||
|
||||
@ConfigDataBoolean(path = "ExtraVoteShopCheck")
|
||||
@Getter
|
||||
private boolean extraVoteShopCheck = true;
|
||||
|
||||
@ConfigDataBoolean(path = "TrackShopPurchases")
|
||||
@Getter
|
||||
private boolean trackShopPurchases = false;
|
||||
|
||||
@ConfigDataBoolean(path = "AlwaysUpdate")
|
||||
@Getter
|
||||
private boolean alwaysUpdate = false;
|
||||
@@ -158,6 +171,26 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private String formatCommandsVoteLastLastVoted = "%times% ago";
|
||||
|
||||
@ConfigDataString(path = "Format.Commands.Vote.GivePoints.NotEnoughPoints")
|
||||
@Getter
|
||||
private String formatCommandsVoteGivePointsNotEnoughPoints = "&cNot enough points";
|
||||
|
||||
@ConfigDataString(path = "Format.Commands.Vote.GivePoints.NotJoinedServer")
|
||||
@Getter
|
||||
private String formatCommandsVoteGivePointsNotJoinedServer = "&c%player% has not joined the server";
|
||||
|
||||
@ConfigDataString(path = "Format.Commands.Vote.GivePoints.NumberLowerThanZero")
|
||||
@Getter
|
||||
private String formatCommandsVoteGivePointsNumberLowerThanZero = "&cNumber of points needs to be greater than 0";
|
||||
|
||||
@ConfigDataString(path = "Format.Commands.Vote.GivePoints.TransferFrom")
|
||||
@Getter
|
||||
private String formatCommandsVoteGivePointsTransferFrom = "&c%transfer% points given to %touser%";
|
||||
|
||||
@ConfigDataString(path = "Format.Commands.Vote.GivePoints.TransferTo")
|
||||
@Getter
|
||||
private String formatCommandsVoteGivePointsTransferTo = "&cYou received %transfer points from %fromuser%";
|
||||
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Last.Line", defaultValue = "&3%SiteName%: &6%timeSince% ago")
|
||||
@Getter
|
||||
private String formatCommandsVoteLastLine;
|
||||
@@ -166,6 +199,10 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private String formatCommandsVoteLastNeverVoted;
|
||||
|
||||
@ConfigDataBoolean(path = "Format.Commands.Vote.Last.IncludeSeconds")
|
||||
@Getter
|
||||
private boolean formatCommandsVoteLastIncludeSeconds = true;
|
||||
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Last.TimeFormat", defaultValue = "%amount% %TimeType%")
|
||||
@Getter
|
||||
private String formatCommandsVoteLastTimeFormat;
|
||||
@@ -254,6 +291,14 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private boolean preventRepeatMilestones = false;
|
||||
|
||||
@ConfigDataBoolean(path = "OfflineVotesLimit.Enabled")
|
||||
@Getter
|
||||
private boolean offlineVotesLimitEnabled = false;
|
||||
|
||||
@ConfigDataInt(path = "OfflineVotesLimit.Amount")
|
||||
@Getter
|
||||
private int offlineVotesLimitAmount = 5;
|
||||
|
||||
@ConfigDataBoolean(path = "UpdateWithPlayersOnlineOnly")
|
||||
@Getter
|
||||
private boolean updateWithPlayersOnlineOnly = false;
|
||||
@@ -296,21 +341,13 @@ public class Config extends YMLFile {
|
||||
return (ArrayList<String>) getData().getList("BlackList", new ArrayList<String>());
|
||||
}
|
||||
|
||||
public Set<String> getCustomCommands() {
|
||||
Set<String> str = getData().getConfigurationSection("CustomCommands").getKeys(false);
|
||||
if (str == null) {
|
||||
str = new HashSet<String>();
|
||||
}
|
||||
return str;
|
||||
}
|
||||
@ConfigDataKeys(path = "CustomCommands")
|
||||
@Getter
|
||||
private Set<String> customCommands = new HashSet<String>();
|
||||
|
||||
public Set<String> getCustomPlaceholderReturns() {
|
||||
Set<String> str = getData().getConfigurationSection("CustomPlaceholderReturns").getKeys(false);
|
||||
if (str == null) {
|
||||
str = new HashSet<String>();
|
||||
}
|
||||
return str;
|
||||
}
|
||||
@ConfigDataKeys(path = "CustomPlaceholderReturns")
|
||||
@Getter
|
||||
private Set<String> customPlaceholderReturns = new HashSet<String>();
|
||||
|
||||
public Set<String> getCustomPlaceholderReturns(String placeholder) {
|
||||
Set<String> str = getData().getConfigurationSection("CustomPlaceholderReturns." + placeholder).getKeys(false);
|
||||
@@ -328,141 +365,77 @@ public class Config extends YMLFile {
|
||||
return getData().getConfigurationSection("CustomCommands." + ident);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the broad cast msg.
|
||||
*
|
||||
* @return the broad cast msg
|
||||
*/
|
||||
public String getFormatBroadCastMsg() {
|
||||
return getData().getString("Format.BroadcastMsg",
|
||||
"&6[&4Broadcast&6] &2Thanks &c%player% &2for voting on %SiteName%");
|
||||
@ConfigDataString(path = "Format.BroadcastMsg")
|
||||
@Getter
|
||||
private String formatBroadCastMsg = "&6[&4Broadcast&6] &2Thanks &c%player% &2for voting on %SiteName%";
|
||||
|
||||
}
|
||||
@ConfigDataBoolean(path = "Format.BroadcastWhenOnline")
|
||||
@Getter
|
||||
private boolean formatBroadcastWhenOnline = false;
|
||||
|
||||
/**
|
||||
* Gets the broadcast when online.
|
||||
*
|
||||
* @return the broadcast when online
|
||||
*/
|
||||
public boolean getFormatBroadcastWhenOnline() {
|
||||
return getData().getBoolean("Format.BroadcastWhenOnline");
|
||||
}
|
||||
@ConfigDataBoolean(path = "Format.Commands.Vote.AutoInputSites")
|
||||
@Getter
|
||||
private boolean formatCommandsVoteAutoInputSites = true;
|
||||
|
||||
/**
|
||||
* Gets the commands vote auto input sites.
|
||||
*
|
||||
* @return the commands vote auto input sites
|
||||
*/
|
||||
public boolean getFormatCommandsVoteAutoInputSites() {
|
||||
return getData().getBoolean("Format.Commands.Vote.AutoInputSites");
|
||||
}
|
||||
@ConfigDataListString(path = "Format.Commands.Vote.Best.Lines")
|
||||
@Getter
|
||||
private ArrayList<String> formatCommandsVoteBestLines = new ArrayList<String>();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ArrayList<String> getFormatCommandsVoteBestLines() {
|
||||
return (ArrayList<String>) getData().getList("Format.Commands.Vote.Best.Lines", new ArrayList<String>());
|
||||
}
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Best.Title")
|
||||
@Getter
|
||||
private String formatCommandsVoteBestTitle = "&3&l%player% Best Votes";
|
||||
|
||||
public String getFormatCommandsVoteBestTitle() {
|
||||
return getData().getString("Format.Commands.Vote.Best.Title", "&3&l%player% Best Votes");
|
||||
}
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Help.HoverColor")
|
||||
@Getter
|
||||
private String formatCommandsVoteHelpHoverColor = "AQUA";
|
||||
|
||||
public String getFormatCommandsVoteHelpHoverColor() {
|
||||
return getData().getString("Format.Commands.Vote.Help.HoverColor", "AQUA");
|
||||
}
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Help.Line")
|
||||
@Getter
|
||||
private String formatCommandsVoteHelpLine = "&6%Command% - &6%HelpMessage%";
|
||||
|
||||
/**
|
||||
* Gets the commands vote help line.
|
||||
*
|
||||
* @return the commands vote help line
|
||||
*/
|
||||
public String getFormatCommandsVoteHelpLine() {
|
||||
return getData().getString("Format.Commands.Vote.Help.Line", "&6%Command% - &6%HelpMessage%");
|
||||
}
|
||||
@ConfigDataBoolean(path = "Format.Commands.Vote.Help.RequirePermission")
|
||||
@Getter
|
||||
private boolean formatCommandsVoteHelpRequirePermission = false;
|
||||
|
||||
/**
|
||||
* Gets the commands vote help require permission.
|
||||
*
|
||||
* @return the commands vote help require permission
|
||||
*/
|
||||
public boolean getFormatCommandsVoteHelpRequirePermission() {
|
||||
return getData().getBoolean("Format.Commands.Vote.Help.RequirePermission");
|
||||
}
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Help.Title")
|
||||
@Getter
|
||||
private String formatCommandsVoteHelpTitle = "&6Voting Player Help";
|
||||
|
||||
/**
|
||||
* Gets the commands vote help title.
|
||||
*
|
||||
* @return the commands vote help title
|
||||
*/
|
||||
public String getFormatCommandsVoteHelpTitle() {
|
||||
return getData().getString("Format.Commands.Vote.Help.Title", "&6Voting Player Help");
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Last.Title")
|
||||
@Getter
|
||||
private String formatCommandsVoteLastTitle = "&3&l%player% Last Vote Times:";
|
||||
|
||||
}
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Next.Info.CanVote")
|
||||
@Getter
|
||||
private String formatCommandsVoteNextInfoCanVote = "Go Vote!";
|
||||
|
||||
/**
|
||||
* Gets the commands vote last title.
|
||||
*
|
||||
* @return the commands vote last title
|
||||
*/
|
||||
public String getFormatCommandsVoteLastTitle() {
|
||||
return getData().getString("Format.Commands.Vote.Last.Title", "&3&l%player% Last Vote Times:");
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Next.Info.Error")
|
||||
@Getter
|
||||
private String formatCommandsVoteNextInfoError = "";
|
||||
|
||||
}
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Next.Info.TimeUntilVote")
|
||||
@Getter
|
||||
private String formatCommandsVoteNextInfoTime = "&cCould not caculate time until next vote!";
|
||||
|
||||
/**
|
||||
* Gets the commands vote next info can vote.
|
||||
*
|
||||
* @return the commands vote next info can vote
|
||||
*/
|
||||
public String getFormatCommandsVoteNextInfoCanVote() {
|
||||
return getData().getString("Format.Commands.Vote.Next.Info.CanVote", "Go Vote!");
|
||||
}
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Next.Info.VoteDelayDaily")
|
||||
@Getter
|
||||
private String formatCommandsVoteNextInfoVoteDelayDaily = "%hours% Hours and %minutes% Minutes";
|
||||
|
||||
/**
|
||||
* Gets the commands vote next info error.
|
||||
*
|
||||
* @return the commands vote next info error
|
||||
*/
|
||||
public String getFormatCommandsVoteNextInfoError() {
|
||||
return getData().getString("Format.Commands.Vote.Next.Info.Error", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the commands vote next info time.
|
||||
*
|
||||
* @return the commands vote next info time
|
||||
*/
|
||||
public String getFormatCommandsVoteNextInfoTime() {
|
||||
return getData().getString("Format.Commands.Vote.Next.Info.TimeUntilVote",
|
||||
"&cCould not caculate time until next vote!");
|
||||
}
|
||||
|
||||
public String getFormatCommandsVoteNextInfoVoteDelayDaily() {
|
||||
return getData().getString("Format.Commands.Vote.Next.Info.VoteDelayDaily",
|
||||
"%hours% Hours and %minutes% Minutes");
|
||||
}
|
||||
@ConfigDataString(path = "PlaceholderCacheLevel", options = { "AUTO", "SPECIFIC", "NONE" })
|
||||
@Getter
|
||||
private String placeholderCacheLevelString = "AUTO";
|
||||
|
||||
public PlaceholderCacheLevel getPlaceholderCacheLevel() {
|
||||
return PlaceholderCacheLevel.getCache(getData().getString("PlaceholderCacheLevel", "AUTO"));
|
||||
return PlaceholderCacheLevel.getCache(getPlaceholderCacheLevelString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the commands vote next layout.
|
||||
*
|
||||
* @return the commands vote next layout
|
||||
*/
|
||||
public String getFormatCommandsVoteNextLayout() {
|
||||
return getData().getString("Format.Commands.Vote.Next.Layout", "&3%SiteName%: &6%info%");
|
||||
}
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Next.Layout")
|
||||
@Getter
|
||||
private String formatCommandsVoteNextLayout = "&3%SiteName%: &6%info%";
|
||||
|
||||
/**
|
||||
* Gets the commands vote next title.
|
||||
*
|
||||
* @return the commands vote next title
|
||||
*/
|
||||
public String getFormatCommandsVoteNextTitle() {
|
||||
return getData().getString("Format.Commands.Vote.Next.Title", "&3&l%player% Next Votes:");
|
||||
|
||||
}
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Next.Title")
|
||||
@Getter
|
||||
private String formatCommandsVoteNextTitle = "&3&l%player% Next Votes:";
|
||||
|
||||
/**
|
||||
* Gets the commands vote party.
|
||||
@@ -482,9 +455,9 @@ public class Config extends YMLFile {
|
||||
return (ArrayList<String>) getData().getList("Format.Commands.Vote.Streak.Lines", new ArrayList<String>());
|
||||
}
|
||||
|
||||
public String getFormatCommandsVoteStreakTitle() {
|
||||
return getData().getString("Format.Commands.Vote.Streak.Title", "&3&l%player% Vote Streak");
|
||||
}
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Streak.Title")
|
||||
@Getter
|
||||
private String formatCommandsVoteStreakTitle = "&3&l%player% Vote Streak";
|
||||
|
||||
/**
|
||||
* Gets the commands vote text.
|
||||
@@ -527,168 +500,103 @@ public class Config extends YMLFile {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the commands vote URLS.
|
||||
*
|
||||
* @return the commands vote URLS
|
||||
*/
|
||||
public String getFormatCommandsVoteURLS() {
|
||||
return getData().getString("Format.Commands.Vote.Sites", "&4%num%: &c&l%SiteName% - &c%url%");
|
||||
}
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Sites")
|
||||
@Getter
|
||||
private String formatCommandsVoteURLS = "&4%num%: &c&l%SiteName% - &c%url%";
|
||||
|
||||
/**
|
||||
* Gets the command vote points.
|
||||
*
|
||||
* @return the command vote points
|
||||
*/
|
||||
public String getFormatCommandVotePoints() {
|
||||
return getData().getString("Format.Commands.Vote.Points", "&a%Player% currently has &a&l%Points%&a Points!");
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Points")
|
||||
@Getter
|
||||
private String formatCommandsVotePoints = "&a%Player% currently has &a&l%Points%&a Points!";
|
||||
|
||||
}
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Top.Line")
|
||||
@Getter
|
||||
private String formatCommandsVoteTopLine = "&c%num%: &6%player%, %votes%";
|
||||
|
||||
/**
|
||||
* Gets the command vote top line.
|
||||
*
|
||||
* @return the command vote top line
|
||||
*/
|
||||
public String getFormatCommandVoteTopLine() {
|
||||
return getData().getString("Format.Commands.Vote.Top.Line", "&c%num%: &6%player%, %votes%");
|
||||
}
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Top.Title")
|
||||
@Getter
|
||||
private String formatCommandVoteTopTitle = "&3Top %Top% Voters %page%/%maxpages%";
|
||||
|
||||
/**
|
||||
* Gets the command vote top title.
|
||||
*
|
||||
* @return the command vote top title
|
||||
*/
|
||||
public String getFormatCommandVoteTopTitle() {
|
||||
return getData().getString("Format.Commands.Vote.Top.Title", "&3Top %Top% Voters %page%/%maxpages%");
|
||||
@ConfigDataString(path = "Format.NextPage")
|
||||
@Getter
|
||||
private String formatNextPage = "&aNext Page";
|
||||
|
||||
}
|
||||
@ConfigDataString(path = "Format.NoPerms")
|
||||
@Getter
|
||||
private String formatNoPerms = "&cYou do not have enough permission!";
|
||||
|
||||
public String getFormatNextPage() {
|
||||
return getData().getString("Format.NextPage", "&aNext Page");
|
||||
}
|
||||
@ConfigDataString(path = "Format.NotNumber")
|
||||
@Getter
|
||||
private String formatNotNumber = "&cError on &6%arg%&c, number expected!";
|
||||
|
||||
/**
|
||||
* Gets the format no perms.
|
||||
*
|
||||
* @return the format no perms
|
||||
*/
|
||||
public String getFormatNoPerms() {
|
||||
return getData().getString("Format.NoPerms", "&cYou do not have enough permission!");
|
||||
}
|
||||
@ConfigDataString(path = "Format.PrevPage")
|
||||
@Getter
|
||||
private String formatPrevPage = "&aPrevious Page";
|
||||
|
||||
public String getFormatNotNumber() {
|
||||
return getData().getString("Format.NotNumber", "&cError on &6%arg%&c, number expected!");
|
||||
}
|
||||
@ConfigDataString(path = "Format.ShopFailed")
|
||||
@Getter
|
||||
private String formatShopFailedMsg = "&cYou do not have %Points% points to purhcase this!";
|
||||
|
||||
public String getFormatPrevPage() {
|
||||
return getData().getString("Format.PrevPage", "&aPrevious Page");
|
||||
}
|
||||
@ConfigDataString(path = "Format.ShopNotPurchasable")
|
||||
@Getter
|
||||
private String formatShopNotPurchasable = "&cThis item is not buyable!";
|
||||
|
||||
public String getFormatShopFailedMsg() {
|
||||
return getData().getString("Format.ShopFailed", "&cYou do not have %Points% points to purhcase this!");
|
||||
}
|
||||
@ConfigDataString(path = "Format.ShopPurchase")
|
||||
@Getter
|
||||
private String formatShopPurchaseMsg = "&aYou bought the %Identifier% for %Points% Points!";
|
||||
|
||||
public String getFormatShopNotPurchasable() {
|
||||
return getData().getString("Format.ShopNotPurchasable", "&cThis item is not buyable!");
|
||||
}
|
||||
@ConfigDataString(path = "Format.Signs.TopVoterSign.Line1")
|
||||
@Getter
|
||||
private String formatSignTopVoterSignLine1 = "TopVoter: %SiteName%";
|
||||
|
||||
public String getFormatShopPurchaseMsg() {
|
||||
return getData().getString("Format.ShopPurchase", "&aYou bought the %Identifier% for %Points% Points!");
|
||||
@ConfigDataString(path = "Format.Signs.TopVoterSign.Line2")
|
||||
@Getter
|
||||
private String formatSignTopVoterSignLine2 = "#%position%";
|
||||
@ConfigDataString(path = "Format.Signs.TopVoterSign.Line3")
|
||||
@Getter
|
||||
private String formatSignTopVoterSignLine3 = "%player%";
|
||||
@ConfigDataString(path = "Format.Signs.TopVoterSign.Line4")
|
||||
@Getter
|
||||
private String formatSignTopVoterSignLine4 = "%votes% Votes";
|
||||
|
||||
}
|
||||
@ConfigDataString(path = "Format.Signs.RightClickMessage")
|
||||
@Getter
|
||||
private String formatSignTopVoterSignRightClickMessage = "&c&l%player% &cis &c&l%position% &cwith &c&l%votes% &cin &c&l%SiteName%";
|
||||
|
||||
/**
|
||||
* Gets the sign top voter sign line 1.
|
||||
*
|
||||
* @return the sign top voter sign line 1
|
||||
*/
|
||||
public String getFormatSignTopVoterSignLine1() {
|
||||
return getData().getString("Format.Signs.TopVoterSign.Line1", "TopVoter: %SiteName%");
|
||||
@ConfigDataString(path = "Format.TimeFormat")
|
||||
@Getter
|
||||
private String formatTimeFormat = "EEE, d MMM yyyy HH:mm";
|
||||
|
||||
}
|
||||
@ConfigDataString(path = "Format.TopVoter.AllTime")
|
||||
@Getter
|
||||
private String formatTopVoterAllTime = "AllTime";
|
||||
|
||||
/**
|
||||
* Gets the sign top voter sign line 2.
|
||||
*
|
||||
* @return the sign top voter sign line 2
|
||||
*/
|
||||
public String getFormatSignTopVoterSignLine2() {
|
||||
return getData().getString("Format.Signs.TopVoterSign.Line2", "#%position%");
|
||||
}
|
||||
@ConfigDataString(path = "Format.TopVoter.Daily")
|
||||
@Getter
|
||||
private String formatTopVoterDaily = "Daily";
|
||||
|
||||
/**
|
||||
* Gets the sign top voter sign line 3.
|
||||
*
|
||||
* @return the sign top voter sign line 3
|
||||
*/
|
||||
public String getFormatSignTopVoterSignLine3() {
|
||||
return getData().getString("Format.Signs.TopVoterSign.Line3", "%player%");
|
||||
@ConfigDataString(path = "Format.TopVoter.Monthly")
|
||||
@Getter
|
||||
private String formatTopVoterMonthly = "Monthly";
|
||||
|
||||
}
|
||||
@ConfigDataString(path = "Format.TopVoterAwardMsg")
|
||||
@Getter
|
||||
private String formatTopVoterRewardMsg = "&aYou came in %place% in top voters of the month! Here is an award!";
|
||||
|
||||
/**
|
||||
* Gets the sign top voter sign line 4.
|
||||
*
|
||||
* @return the sign top voter sign line 4
|
||||
*/
|
||||
public String getFormatSignTopVoterSignLine4() {
|
||||
return getData().getString("Format.Signs.TopVoterSign.Line4", "%votes% Votes");
|
||||
@ConfigDataString(path = "Format.TopVoter.Weekly")
|
||||
@Getter
|
||||
private String formatTopVoterWeekly = "Weekly";
|
||||
|
||||
}
|
||||
@ConfigDataString(path = "Format.UserNotExist")
|
||||
@Getter
|
||||
private String formatUserNotExist = "&cUser does not exist: %player%";
|
||||
|
||||
/**
|
||||
* Gets the sign top voter sign right click message.
|
||||
*
|
||||
* @return the sign top voter sign right click message
|
||||
*/
|
||||
public String getFormatSignTopVoterSignRightClickMessage() {
|
||||
return getData().getString("Format.Signs.RightClickMessage",
|
||||
"&c&l%player% &cis &c&l%position% &cwith &c&l%votes% &cin &c&l%SiteName%");
|
||||
@ConfigDataString(path = "Format.InvalidCommand.Vote")
|
||||
@Getter
|
||||
private String formatInvalidCommandVote = "&4No valid arguments, see /vote help!";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the time format.
|
||||
*
|
||||
* @return the time format
|
||||
*/
|
||||
public String getFormatTimeFormat() {
|
||||
return getData().getString("Format.TimeFormat", "EEE, d MMM yyyy HH:mm");
|
||||
|
||||
}
|
||||
|
||||
public String getFormatTopVoterAllTime() {
|
||||
return getData().getString("Format.TopVoter.AllTime", "AllTime");
|
||||
}
|
||||
|
||||
public String getFormatTopVoterDaily() {
|
||||
return getData().getString("Format.TopVoter.Daily", "Daily");
|
||||
}
|
||||
|
||||
public String getFormatTopVoterMonthly() {
|
||||
return getData().getString("Format.TopVoter.Monthly", "Monthly");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the top voter reward msg.
|
||||
*
|
||||
* @return the top voter reward msg
|
||||
*/
|
||||
public String getFormatTopVoterRewardMsg() {
|
||||
return getData().getString("Format.TopVoterAwardMsg",
|
||||
"&aYou came in %place% in top voters of the month! Here is an award!");
|
||||
|
||||
}
|
||||
|
||||
public String getFormatTopVoterWeekly() {
|
||||
return getData().getString("Format.TopVoter.Weekly", "Weekly");
|
||||
}
|
||||
|
||||
public String getFormatUserNotExist() {
|
||||
return getData().getString("Format.UserNotExist", "&cUser does not exist: %player%");
|
||||
}
|
||||
@ConfigDataString(path = "Format.InvalidCommand.AdminVote")
|
||||
@Getter
|
||||
private String formatInvalidCommandAdminVote = "&4No valid arguments, see /adminvote help!";
|
||||
|
||||
/**
|
||||
* Gets the vote help.
|
||||
@@ -700,133 +608,92 @@ public class Config extends YMLFile {
|
||||
return (ArrayList<String>) getData().getList("Format.Commands.Vote.Help.Lines", new ArrayList<String>());
|
||||
}
|
||||
|
||||
public boolean getGiveDefaultPermission() {
|
||||
return getData().getBoolean("GiveDefaultPermission", true);
|
||||
}
|
||||
@ConfigDataBoolean(path = "GiveDefaultPermission")
|
||||
@Getter
|
||||
private boolean giveDefaultPermission = true;
|
||||
|
||||
public boolean getLoadTopVoter(TopVoter top) {
|
||||
switch (top) {
|
||||
case AllTime:
|
||||
return getLoadTopVoterAllTime();
|
||||
return isLoadTopVoterAllTime();
|
||||
case Daily:
|
||||
return getLoadTopVoterDaily();
|
||||
return isLoadTopVoterDaily();
|
||||
case Monthly:
|
||||
return getLoadTopVoterMonthly();
|
||||
return isLoadTopVoterMonthly();
|
||||
case Weekly:
|
||||
return getLoadTopVoterWeekly();
|
||||
return isLoadTopVoterWeekly();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getLoadTopVoterAllTime() {
|
||||
return getData().getBoolean("LoadTopVoter.AllTime", true);
|
||||
}
|
||||
@ConfigDataBoolean(path = "LoadTopVoter.AllTime")
|
||||
@Getter
|
||||
private boolean loadTopVoterAllTime = true;
|
||||
|
||||
public boolean getLoadTopVoterDaily() {
|
||||
return getData().getBoolean("LoadTopVoter.Daily", false);
|
||||
}
|
||||
@ConfigDataBoolean(path = "LoadTopVoter.Monthly")
|
||||
@Getter
|
||||
private boolean loadTopVoterMonthly = true;
|
||||
|
||||
public boolean getLoadTopVoterMonthly() {
|
||||
return getData().getBoolean("LoadTopVoter.Monthly", true);
|
||||
}
|
||||
@ConfigDataBoolean(path = "LoadTopVoter.Daily")
|
||||
@Getter
|
||||
private boolean loadTopVoterDaily = false;
|
||||
|
||||
public boolean getLoadTopVoterWeekly() {
|
||||
return getData().getBoolean("LoadTopVoter.Weekly", false);
|
||||
}
|
||||
@ConfigDataBoolean(path = "LoadTopVoter.Weekly")
|
||||
@Getter
|
||||
private boolean loadTopVoterWeekly = false;
|
||||
|
||||
public int getPointsOnVote() {
|
||||
return getData().getInt("PointsOnVote", 1);
|
||||
}
|
||||
@ConfigDataInt(path = "PointsOnVote")
|
||||
@Getter
|
||||
private int pointsOnVote = 1;
|
||||
|
||||
public int getPurgeMin() {
|
||||
return getData().getInt("PurgeMin", 90);
|
||||
}
|
||||
@ConfigDataInt(path = "PurgeMin")
|
||||
@Getter
|
||||
private int purgeMin = 90;
|
||||
|
||||
public boolean getPurgeOldData() {
|
||||
return getData().getBoolean("PurgeOldData");
|
||||
}
|
||||
@ConfigDataBoolean(path = "PurgeOldData")
|
||||
@Getter
|
||||
private boolean purgeOldData = false;
|
||||
|
||||
/**
|
||||
* Gets the request API default method.
|
||||
*
|
||||
* @return the request API default method
|
||||
*/
|
||||
public String getRequestAPIDefaultMethod() {
|
||||
return getData().getString("RequestAPI.DefaultMethod", "Anvil");
|
||||
}
|
||||
@ConfigDataString(path = "RequestAPI.DefaultMethod")
|
||||
@Getter
|
||||
private String requestAPIDefaultMethod = "ANVIL";
|
||||
|
||||
/**
|
||||
* Gets the request API disabled methods.
|
||||
*
|
||||
* @return the request API disabled methods
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public ArrayList<String> getRequestAPIDisabledMethods() {
|
||||
return (ArrayList<String>) getData().getList("RequestAPI.DisabledMethods", new ArrayList<String>());
|
||||
}
|
||||
@ConfigDataListString(path = "RequestAPI.DisabledMethods")
|
||||
@Getter
|
||||
private ArrayList<String> requestAPIDisabledMethods = new ArrayList<String>();
|
||||
|
||||
/**
|
||||
* Gets the store top voters daily.
|
||||
*
|
||||
* @return the store top voters daily
|
||||
*/
|
||||
public boolean getStoreTopVotersDaily() {
|
||||
return getData().getBoolean("StoreTopVoters.Daily");
|
||||
}
|
||||
@ConfigDataBoolean(path = "StoreTopVoters.Daily")
|
||||
@Getter
|
||||
private boolean storeTopVotersDaily = false;
|
||||
|
||||
/**
|
||||
* Gets the store top voters weekly.
|
||||
*
|
||||
* @return the store top voters weekly
|
||||
*/
|
||||
public boolean getStoreTopVotersWeekly() {
|
||||
return getData().getBoolean("StoreTopVoters.Weekly");
|
||||
}
|
||||
@ConfigDataBoolean(path = "StoreTopVoters.Weekly")
|
||||
@Getter
|
||||
private boolean storeTopVotersWeekly = false;
|
||||
|
||||
public boolean getTopVoterAwardsTies() {
|
||||
return getData().getBoolean("TopVoterAwardsTies", true);
|
||||
}
|
||||
@ConfigDataBoolean(path = "TopVoterAwardsTies")
|
||||
@Getter
|
||||
private boolean topVoterAwardsTies = true;
|
||||
|
||||
public boolean getTopVoterIgnorePermission() {
|
||||
return getData().getBoolean("TopVoterIgnorePermission");
|
||||
}
|
||||
@ConfigDataBoolean(path = "TopVoterIgnorePermission")
|
||||
@Getter
|
||||
private boolean topVoterIgnorePermission = false;
|
||||
|
||||
/**
|
||||
* Gets the enabled.
|
||||
*
|
||||
* @return the enabled
|
||||
*/
|
||||
public boolean getVoteRemindingEnabled() {
|
||||
return getData().getBoolean("VoteReminding.Enabled");
|
||||
}
|
||||
@ConfigDataBoolean(path = "VoteReminding.Enabled")
|
||||
@Getter
|
||||
private boolean voteRemindingEnabled = true;
|
||||
|
||||
/**
|
||||
* Gets the remind delay.
|
||||
*
|
||||
* @return the remind delay
|
||||
*/
|
||||
public int getVoteRemindingRemindDelay() {
|
||||
return getData().getInt("VoteReminding.RemindDelay", 30);
|
||||
}
|
||||
@ConfigDataInt(path = "VoteReminding.RemindDelay")
|
||||
@Getter
|
||||
private int voteRemindingRemindDelay = 30;
|
||||
|
||||
/**
|
||||
* Gets the remind on login.
|
||||
*
|
||||
* @return the remind on login
|
||||
*/
|
||||
public boolean getVoteRemindingRemindOnLogin() {
|
||||
return getData().getBoolean("VoteReminding.RemindOnLogin");
|
||||
}
|
||||
@ConfigDataBoolean(path = "VoteReminding.RemindOnLogin")
|
||||
@Getter
|
||||
private boolean voteRemindingRemindOnLogin = false;
|
||||
|
||||
/**
|
||||
* Gets the remind only once.
|
||||
*
|
||||
* @return the remind only once
|
||||
*/
|
||||
public boolean getVoteRemindingRemindOnlyOnce() {
|
||||
return getData().getBoolean("VoteReminding.RemindOnlyOnce");
|
||||
}
|
||||
@ConfigDataBoolean(path = "VoteReminding.RemindOnlyOnce")
|
||||
@Getter
|
||||
private boolean voteRemindingRemindOnlyOnce = false;
|
||||
|
||||
/**
|
||||
* Gets the rewards.
|
||||
@@ -837,9 +704,9 @@ public class Config extends YMLFile {
|
||||
return "VoteReminding.Rewards";
|
||||
}
|
||||
|
||||
public String getVoteTopDefault() {
|
||||
return getData().getString("VoteTopDefault", "Monthly");
|
||||
}
|
||||
@ConfigDataString(path = "VoteTopDefault")
|
||||
@Getter
|
||||
private String voteTopDefault = "Monthly";
|
||||
|
||||
@Override
|
||||
public void loadValues() {
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.bencodez.advancedcore.api.messages.StringParser;
|
||||
import com.bencodez.advancedcore.api.misc.ArrayUtils;
|
||||
import com.bencodez.advancedcore.api.rewards.DirectlyDefinedReward;
|
||||
import com.bencodez.advancedcore.api.yml.YMLFile;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
@@ -53,6 +54,53 @@ public class ConfigVoteSites extends YMLFile {
|
||||
|
||||
plugin.loadVoteSites();
|
||||
|
||||
plugin.addDirectlyDefinedRewards(new DirectlyDefinedReward("VoteSites." + siteName + ".Rewards") {
|
||||
|
||||
@Override
|
||||
public void createSection(String key) {
|
||||
plugin.getConfigVoteSites().createSection(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationSection getFileData() {
|
||||
return plugin.getConfigVoteSites().getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
plugin.getConfigVoteSites().saveData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(String path, Object value) {
|
||||
plugin.getConfigVoteSites().setValue(path, value);
|
||||
}
|
||||
});
|
||||
|
||||
plugin.addDirectlyDefinedRewards(
|
||||
new DirectlyDefinedReward("VoteSites." + siteName + ".CoolDownEndRewards") {
|
||||
|
||||
@Override
|
||||
public void createSection(String key) {
|
||||
plugin.getConfigVoteSites().createSection(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationSection getFileData() {
|
||||
return plugin.getConfigVoteSites().getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
plugin.getConfigVoteSites().saveData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(String path, Object value) {
|
||||
plugin.getConfigVoteSites().setValue(path, value);
|
||||
}
|
||||
});
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (p.hasPermission("VotingPlugin.Admin.GenerateServiceSite") || p.isOp()) {
|
||||
p.sendMessage(StringParser.getInstance().colorize("&cGenerating votesite for service site "
|
||||
@@ -120,8 +168,8 @@ public class ConfigVoteSites extends YMLFile {
|
||||
return getData(siteName).getString("ServiceSite");
|
||||
}
|
||||
|
||||
public int getTimeOffSet(String siteName) {
|
||||
return getData(siteName).getInt("TimeOffSet", 0);
|
||||
public int getVoteDelayDailyHour(String siteName) {
|
||||
return getData(siteName).getInt("VoteDelayDailyHour", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,6 +12,8 @@ import com.bencodez.advancedcore.api.yml.YMLFile;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.AnnotationHandler;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataBoolean;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataConfigurationSection;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataInt;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataKeys;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataListString;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataString;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
@@ -33,6 +35,10 @@ public class GUI extends YMLFile {
|
||||
@Getter
|
||||
private String bookVoteURLBookGUICanVoteColor = "GREEN";
|
||||
|
||||
@ConfigDataBoolean(path = "BOOK.VoteURLBookGUI.Manual")
|
||||
@Getter
|
||||
private boolean bookVoteURLBookGUIManual = false;
|
||||
|
||||
@ConfigDataString(path = "BOOK.VoteURLBookGUI.CanVoteText")
|
||||
@Getter
|
||||
private String bookVoteURLBookGUICanVoteText = "Click me";
|
||||
@@ -42,6 +48,10 @@ public class GUI extends YMLFile {
|
||||
private ArrayList<String> bookVoteURLBookGUILayout = ArrayUtils.getInstance()
|
||||
.convert(new String[] { "&c%Sitename%", "[UrlText]" });
|
||||
|
||||
@ConfigDataListString(path = "BOOK.VoteURLBookGUI.TopLayout")
|
||||
@Getter
|
||||
private ArrayList<String> bookVoteURLBookGUITopLayout = new ArrayList<String>();
|
||||
|
||||
@ConfigDataString(path = "BOOK.VoteURLBookGUI.Title")
|
||||
@Getter
|
||||
private String bookVoteURLBookGUITitle = "&cVoteURL";
|
||||
@@ -173,9 +183,9 @@ public class GUI extends YMLFile {
|
||||
saveData();
|
||||
}
|
||||
|
||||
public ConfigurationSection getCHESTBackButton() {
|
||||
return getData().getConfigurationSection("CHEST.BackButton");
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.BackButton")
|
||||
@Getter
|
||||
private ConfigurationSection CHESTBackButton;
|
||||
|
||||
public int getChestShopIdentifierCost(String identifier) {
|
||||
return getData().getInt("CHEST.Shop." + identifier + ".Cost");
|
||||
@@ -205,25 +215,25 @@ public class GUI extends YMLFile {
|
||||
return getData().getConfigurationSection("CHEST.Shop." + identifier);
|
||||
}
|
||||
|
||||
public ConfigurationSection getChestVoteBestDayBestItem() {
|
||||
return getData().getConfigurationSection("CHEST.VoteBest.DayBest.Item");
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.VoteBest.DayBest.Item")
|
||||
@Getter
|
||||
private ConfigurationSection chestVoteBestDayBestItem;
|
||||
|
||||
public ConfigurationSection getChestVoteBestMonthBestItem() {
|
||||
return getData().getConfigurationSection("CHEST.VoteBest.MonthBest.Item");
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.VoteBest.MonthBest.Item")
|
||||
@Getter
|
||||
private ConfigurationSection chestVoteBestMonthBestItem;
|
||||
|
||||
public String getChestVoteBestName() {
|
||||
return getData().getString("CHEST.VoteBest.Name", "VoteBest: %player%");
|
||||
}
|
||||
@ConfigDataString(path = "CHEST.VoteBest.Name")
|
||||
@Getter
|
||||
private String chestVoteBestName = "VoteBest: %player%";
|
||||
|
||||
public ConfigurationSection getChestVoteBestWeekBestItem() {
|
||||
return getData().getConfigurationSection("CHEST.VoteBest.WeekBest.Item");
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.VoteBest.WeekBest.Item")
|
||||
@Getter
|
||||
private ConfigurationSection chestVoteBestWeekBestItem;
|
||||
|
||||
public String getChestVoteGUIName() {
|
||||
return getData().getString("CHEST.VoteGUIName", "&cVoteGUI: &c&l%player%");
|
||||
}
|
||||
@ConfigDataString(path = "CHEST.VoteGUIName")
|
||||
@Getter
|
||||
private String chestVoteGUIName = "&cVoteGUI: &c&l%player%";
|
||||
|
||||
/**
|
||||
* Gets the vote GUI slot command.
|
||||
@@ -251,26 +261,17 @@ public class GUI extends YMLFile {
|
||||
return "CHEST.VoteGUI." + slot + "." + lastPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vote GUI slots.
|
||||
*
|
||||
* @return the vote GUI slots
|
||||
*/
|
||||
public Set<String> getChestVoteGUISlots() {
|
||||
try {
|
||||
return getData().getConfigurationSection("CHEST.VoteGUI").getKeys(false);
|
||||
} catch (Exception ex) {
|
||||
return new HashSet<String>();
|
||||
}
|
||||
}
|
||||
@ConfigDataKeys(path = "CHEST.VoteGUI")
|
||||
@Getter
|
||||
private Set<String> chestVoteGUISlots = new HashSet<String>();
|
||||
|
||||
public ConfigurationSection getChestVoteGUISlotSection(String slot) {
|
||||
return getData().getConfigurationSection("CHEST.VoteGUI." + slot + ".Item");
|
||||
}
|
||||
|
||||
public ConfigurationSection getChestVoteTopCustomization() {
|
||||
return getData().getConfigurationSection("CHEST.VoteTop.Customization");
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.VoteTop.Customization")
|
||||
@Getter
|
||||
private ConfigurationSection chestVoteTopCustomization;
|
||||
|
||||
/**
|
||||
* Gets the vote GUI slot slot.
|
||||
@@ -282,53 +283,57 @@ public class GUI extends YMLFile {
|
||||
return getData().getInt("CHEST.VoteGUI." + slot + ".Slot", -1);
|
||||
}
|
||||
|
||||
public boolean getChestVoteLastBackButton() {
|
||||
return getData().getBoolean("CHEST.VoteLast.BackButton");
|
||||
}
|
||||
@ConfigDataBoolean(path = "CHEST.VoteLast.BackButton")
|
||||
@Getter
|
||||
private boolean chestVoteLastBackButton = false;
|
||||
|
||||
public String getChestVoteLastLine() {
|
||||
return getData().getString("CHEST.VoteLast.Line", "&6%timeSince%");
|
||||
}
|
||||
@ConfigDataString(path = "CHEST.VoteLast.Line")
|
||||
@Getter
|
||||
private String chestVoteLastLine = "&6%timeSince%";
|
||||
|
||||
public String getChestVoteLastName() {
|
||||
return getData().getString("CHEST.VoteLast.Name", "VoteLast: %player%");
|
||||
}
|
||||
@ConfigDataString(path = "CHEST.VoteLast.Name")
|
||||
@Getter
|
||||
private String chestVoteLastName = "VoteLast: %player%";
|
||||
|
||||
public boolean getChestVoteNextBackButton() {
|
||||
return getData().getBoolean("CHEST.VoteNext.BackButton");
|
||||
}
|
||||
@ConfigDataBoolean(path = "CHEST.VoteNext.BackButton")
|
||||
@Getter
|
||||
private boolean chestVoteNextBackButton = false;
|
||||
|
||||
@ConfigDataString(path = "CHEST.VoteNext.Name")
|
||||
@Getter
|
||||
private String chestVoteNextName = "VoteNext: %player%";
|
||||
|
||||
@ConfigDataString(path = "CHEST.VoteNext.Line")
|
||||
@Getter
|
||||
private String chestVoteNextLine = "%time%";
|
||||
|
||||
public String getChestVoteNextName() {
|
||||
return getData().getString("CHEST.VoteNext.Name", "VoteNext: %player%");
|
||||
}
|
||||
|
||||
public String getChestVoteNextLine() {
|
||||
return getData().getString("CHEST.VoteNext.Line", "%time%");
|
||||
}
|
||||
|
||||
public String getChestVoteNextCustomSiteNamesDisplays(String site) {
|
||||
return getData().getString("CHEST.VoteNext.CustomSiteNamesDisplays." + site, "");
|
||||
}
|
||||
|
||||
public String getChestVoteRewardName() {
|
||||
return getData().getString("CHEST.VoteRewardName", "VoteReward");
|
||||
}
|
||||
@ConfigDataString(path = "CHEST.VoteRewardName")
|
||||
@Getter
|
||||
private String chestVoteRewardName = "VoteReward";
|
||||
|
||||
public boolean getChestVoteShopBackButton() {
|
||||
return getData().getBoolean("CHEST.VoteShopBackButton", true);
|
||||
}
|
||||
@ConfigDataBoolean(path = "CHEST.VoteShopBackButton")
|
||||
@Getter
|
||||
private boolean chestVoteShopBackButton = true;
|
||||
|
||||
@ConfigDataBoolean(path = "CHEST.VoteShopReopenGUIOnPurchase")
|
||||
@Getter
|
||||
private boolean chestVoteShopReopenGUIOnPurchase = true;
|
||||
|
||||
public boolean getChestVoteShopCloseGUI(String shop) {
|
||||
return getData().getBoolean("CHEST.Shop." + shop + ".CloseGUI", true);
|
||||
}
|
||||
|
||||
public boolean getChestVoteShopEnabled() {
|
||||
return getData().getBoolean("CHEST.VoteShopEnabled", true);
|
||||
}
|
||||
@ConfigDataBoolean(path = "CHEST.VoteShopEnabled")
|
||||
@Getter
|
||||
private boolean chestVoteShopEnabled = true;
|
||||
|
||||
public String getChestVoteShopName() {
|
||||
return getData().getString("CHEST.VoteShopName", "VoteShop");
|
||||
}
|
||||
@ConfigDataString(path = "CHEST.VoteShopName")
|
||||
@Getter
|
||||
private String chestVoteShopName = "VoteShop";
|
||||
|
||||
public boolean getChestVoteShopNotBuyable(String shop) {
|
||||
return getData().getBoolean("CHEST.Shop." + shop + ".NotBuyable", false);
|
||||
@@ -355,94 +360,93 @@ public class GUI extends YMLFile {
|
||||
return getData().getBoolean("CHEST.Shop." + shop + ".Reset.Weekly", false);
|
||||
}
|
||||
|
||||
public boolean getChestVoteStreakBackButton() {
|
||||
return getData().getBoolean("CHEST.VoteStreak.BackButton");
|
||||
}
|
||||
@ConfigDataBoolean(path = "CHEST.VoteStreak.BackButton")
|
||||
@Getter
|
||||
private boolean chestVoteStreakBackButton = false;
|
||||
|
||||
public ConfigurationSection getChestVoteStreakCurrentDayStreakItem() {
|
||||
return getData().getConfigurationSection("CHEST.VoteStreak.CurrentDayStreak.Item");
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.VoteStreak.CurrentDayStreak.Item")
|
||||
@Getter
|
||||
private ConfigurationSection chestVoteStreakCurrentDayStreakItem;
|
||||
|
||||
public ConfigurationSection getChestVoteStreakCurrentMonthStreakItem() {
|
||||
return getData().getConfigurationSection("CHEST.VoteStreak.CurrentMonthStreak.Item");
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.VoteStreak.CurrentMonthStreak.Item")
|
||||
@Getter
|
||||
private ConfigurationSection chestVoteStreakCurrentMonthStreakItem;
|
||||
|
||||
public ConfigurationSection getChestVoteStreakCurrentWeekStreakItem() {
|
||||
return getData().getConfigurationSection("CHEST.VoteStreak.CurrentWeekStreak.Item");
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.VoteStreak.CurrentWeekStreak.Item")
|
||||
@Getter
|
||||
private ConfigurationSection chestVoteStreakCurrentWeekStreakItem;
|
||||
|
||||
public ConfigurationSection getChestVoteStreakHighestDayStreakItem() {
|
||||
return getData().getConfigurationSection("CHEST.VoteStreak.HighestDayStreak.Item");
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.VoteStreak.HighestDayStreak.Item")
|
||||
@Getter
|
||||
private ConfigurationSection chestVoteStreakHighestDayStreakItem;
|
||||
|
||||
public ConfigurationSection getChestVoteStreakHighestMonthStreakItem() {
|
||||
return getData().getConfigurationSection("CHEST.VoteStreak.HighestMonthStreak.Item");
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.VoteStreak.HighestMonthStreak.Item")
|
||||
@Getter
|
||||
private ConfigurationSection chestVoteStreakHighestMonthStreakItem;
|
||||
|
||||
public ConfigurationSection getChestVoteStreakHighestWeekStreakItem() {
|
||||
return getData().getConfigurationSection("CHEST.VoteStreak.HighestWeekStreak.Item");
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.VoteStreak.HighestWeekStreak.Item")
|
||||
@Getter
|
||||
private ConfigurationSection chestVoteStreakHighestWeekStreakItem;
|
||||
|
||||
public String getChestVoteStreakName() {
|
||||
return getData().getString("CHEST.VoteStreak.Name", "VoteStreak");
|
||||
}
|
||||
@ConfigDataString(path = "CHEST.VoteStreak.Name")
|
||||
@Getter
|
||||
private String chestVoteStreakName = "VoteStreak";
|
||||
|
||||
public boolean getChestVoteTodayBackButton() {
|
||||
return getData().getBoolean("CHEST.VoteToday.BackButton");
|
||||
}
|
||||
@ConfigDataBoolean(path = "CHEST.VoteToday.BackButton")
|
||||
@Getter
|
||||
private boolean chestVoteTodayBackButton = false;
|
||||
|
||||
public String getChestVoteTodayName() {
|
||||
return getData().getString("CHEST.VoteToday.Name", "VoteToday");
|
||||
}
|
||||
@ConfigDataString(path = "CHEST.VoteToday.Name")
|
||||
@Getter
|
||||
private String chestVoteTodayName = "VoteToday";
|
||||
|
||||
public boolean getChestVoteTopBackButton() {
|
||||
return getData().getBoolean("CHEST.VoteTop.BackButton");
|
||||
}
|
||||
@ConfigDataBoolean(path = "CHEST.VoteTop.BackButton")
|
||||
@Getter
|
||||
private boolean chestVoteTopBackButton = false;
|
||||
|
||||
public String getChestVoteTopItemLore() {
|
||||
return getData().getString("CHEST.VoteTop.Item.Lore", "&3&lVotes: &3%votes%");
|
||||
}
|
||||
@ConfigDataString(path = "CHEST.VoteTop.Item.Lore")
|
||||
@Getter
|
||||
private String chestVoteTopItemLore = "&3&lVotes: &3%votes%";
|
||||
|
||||
public String getChestVoteTopItemName() {
|
||||
return getData().getString("CHEST.VoteTop.Item.Name", "&3&l%position%: &3%player%");
|
||||
}
|
||||
@ConfigDataString(path = "CHEST.VoteTop.Item.Name")
|
||||
@Getter
|
||||
private String chestVoteTopItemName = "&3&l%position%: &3%player%";
|
||||
|
||||
public String getChestVoteTopName() {
|
||||
return getData().getString("CHEST.VoteTop.Name", "VoteTop %topvoter%");
|
||||
}
|
||||
@ConfigDataString(path = "CHEST.VoteTop.Name")
|
||||
@Getter
|
||||
private String chestVoteTopName = "VoteTop %topvoter%";
|
||||
|
||||
public boolean getChestVoteTopOpenMainGUIOnClick() {
|
||||
return getData().getBoolean("CHEST.VoteTop.OpenMainGUIOnClick", true);
|
||||
}
|
||||
@ConfigDataBoolean(path = "CHEST.VoteTop.OpenMainGUIOnClick")
|
||||
@Getter
|
||||
private boolean chestVoteTopOpenMainGUIOnClick = true;
|
||||
|
||||
public boolean getChestVoteTopCloseGUIOnClick() {
|
||||
return getData().getBoolean("CHEST.VoteTop.CloseGUIOnClick", true);
|
||||
}
|
||||
@ConfigDataBoolean(path = "CHEST.VoteTop.CloseGUIOnClick")
|
||||
@Getter
|
||||
private boolean chestVoteTopCloseGUIOnClick = true;
|
||||
|
||||
public int getChestVoteTopSize() {
|
||||
return getData().getInt("CHEST.VoteTop.Size", 27);
|
||||
}
|
||||
@ConfigDataInt(path = "CHEST.VoteTop.Size")
|
||||
@Getter
|
||||
private int chestVoteTopSize = 27;
|
||||
|
||||
public ConfigurationSection getChestVoteTopSwitchItem() {
|
||||
return getData().getConfigurationSection("CHEST.VoteTop.SwitchItem");
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.VoteTop.SwitchItem")
|
||||
@Getter
|
||||
private ConfigurationSection chestVoteTopSwitchItem;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ArrayList<String> getChestVoteTopSwitchItemTopVoters() {
|
||||
return (ArrayList<String>) getData().getList("CHEST.VoteTop.SwitchItem.TopVoters", new ArrayList<String>());
|
||||
}
|
||||
@ConfigDataListString(path = "CHEST.VoteTop.SwitchItem.TopVoters")
|
||||
@Getter
|
||||
private ArrayList<String> chestVoteTopSwitchItemTopVoters = new ArrayList<String>();
|
||||
|
||||
public ConfigurationSection getChestVoteTotalAllTimeTotalItem() {
|
||||
return getData().getConfigurationSection("CHEST.VoteTotal.AllTimeTotal.Item");
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.VoteTotal.AllTimeTotal.Item")
|
||||
@Getter
|
||||
private ConfigurationSection chestVoteTotalAllTimeTotalItem;
|
||||
|
||||
public boolean getChestVoteTotalBackButton() {
|
||||
return getData().getBoolean("CHEST.VoteTotal.BackButton");
|
||||
}
|
||||
@ConfigDataBoolean(path = "CHEST.VoteTotal.BackButton")
|
||||
@Getter
|
||||
private boolean chestVoteTotalBackButton = false;
|
||||
|
||||
public ConfigurationSection getChestVoteTotalDayTotalItem() {
|
||||
return getData().getConfigurationSection("CHEST.VoteTotal.DayTotal.Item");
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.VoteTotal.DayTotal.Item")
|
||||
@Getter
|
||||
private ConfigurationSection chestVoteTotalDayTotalItem;
|
||||
|
||||
public ConfigurationSection getChestVoteTotalItem(TopVoter top) {
|
||||
switch (top) {
|
||||
@@ -460,60 +464,49 @@ public class GUI extends YMLFile {
|
||||
}
|
||||
}
|
||||
|
||||
public ConfigurationSection getChestVoteTotalMonthTotalItem() {
|
||||
return getData().getConfigurationSection("CHEST.VoteTotal.MonthTotal.Item");
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.VoteTotal.MonthTotal.Item")
|
||||
@Getter
|
||||
private ConfigurationSection chestVoteTotalMonthTotalItem;
|
||||
|
||||
public String getChestVoteTotalName() {
|
||||
return getData().getString("CHEST.VoteTotal.Name", "VoteTotal: %player%");
|
||||
}
|
||||
@ConfigDataString(path = "CHEST.VoteTotal.Name")
|
||||
@Getter
|
||||
private String chestVoteTotalName = "VoteTotal: %player%";
|
||||
|
||||
public ConfigurationSection getChestVoteTotalWeekTotalItem() {
|
||||
return getData().getConfigurationSection("CHEST.VoteTotal.WeekTotal.Item");
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.VoteTotal.WeekTotal.Item")
|
||||
@Getter
|
||||
private ConfigurationSection chestVoteTotalWeekTotalItem;
|
||||
|
||||
public int getChestVoteURLAllUrlsButtonSlot() {
|
||||
return getData().getInt("CHEST.VoteURL.AllUrlsButton.Slot", -1);
|
||||
}
|
||||
@ConfigDataInt(path = "CHEST.VoteURL.AllUrlsButton.Slot")
|
||||
@Getter
|
||||
private int chestVoteURLAllUrlsButtonSlot = -1;
|
||||
|
||||
public int getChestVoteURLAllUrlsButtonStartSlot() {
|
||||
return getData().getInt("CHEST.VoteURL.StartSlot", -1);
|
||||
}
|
||||
@ConfigDataInt(path = "CHEST.VoteURL.StartSlot")
|
||||
@Getter
|
||||
private int chestVoteURLAllUrlsButtonStartSlot = -1;
|
||||
|
||||
public ConfigurationSection getChestVoteURLAlreadyVotedAllUrlsButtonItemSection() {
|
||||
if (getData().isConfigurationSection("CHEST.VoteURL.AllUrlsButton.AlreadyVotedItem")) {
|
||||
return getData().getConfigurationSection("CHEST.VoteURL.AllUrlsButton.AlreadyVotedItem");
|
||||
} else {
|
||||
return getData().getConfigurationSection("CHEST.VoteURL.AlreadyVotedItem");
|
||||
}
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.VoteURL.AllUrlsButton.AlreadyVotedItem", secondPath = "CHEST.VoteURL.AlreadyVotedItem")
|
||||
@Getter
|
||||
private ConfigurationSection chestVoteURLAlreadyVotedAllUrlsButtonItemSection;
|
||||
|
||||
public ConfigurationSection getChestVoteURLAlreadyVotedItemSection() {
|
||||
return getData().getConfigurationSection("CHEST.VoteURL.AlreadyVotedItem");
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.VoteURL.AlreadyVotedItem")
|
||||
@Getter
|
||||
private ConfigurationSection chestVoteURLAlreadyVotedItemSection;
|
||||
|
||||
public boolean getChestVoteURLBackButton() {
|
||||
return getData().getBoolean("CHEST.VoteURL.BackButton");
|
||||
}
|
||||
@ConfigDataBoolean(path = "CHEST.VoteURL.BackButton")
|
||||
@Getter
|
||||
private boolean chestVoteURLBackButton = false;
|
||||
|
||||
public ConfigurationSection getChestVoteURLCanVoteAllUrlsButtonItemSection() {
|
||||
if (getData().isConfigurationSection("CHEST.VoteURL.AllUrlsButton.CanVoteItem")) {
|
||||
return getData().getConfigurationSection("CHEST.VoteURL.AllUrlsButton.CanVoteItem");
|
||||
} else {
|
||||
return getData().getConfigurationSection("CHEST.VoteURL.CanVoteItem");
|
||||
}
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.VoteURL.AllUrlsButton.CanVoteItem", secondPath = "CHEST.VoteURL.CanVoteItem")
|
||||
@Getter
|
||||
private ConfigurationSection chestVoteURLCanVoteAllUrlsButtonItemSection;
|
||||
|
||||
public ConfigurationSection getChestVoteURLCanVoteItemSection() {
|
||||
return getData().getConfigurationSection("CHEST.VoteURL.CanVoteItem");
|
||||
}
|
||||
@ConfigDataConfigurationSection(path = "CHEST.VoteURL.CanVoteItem")
|
||||
@Getter
|
||||
private ConfigurationSection chestVoteURLCanVoteItemSection;
|
||||
|
||||
public Set<String> getChestVoteURLExtraItems() {
|
||||
if (getData().isConfigurationSection("CHEST.VoteURL.ExtraItems")) {
|
||||
return getData().getConfigurationSection("CHEST.VoteURL.ExtraItems").getKeys(false);
|
||||
}
|
||||
return new HashSet<String>();
|
||||
}
|
||||
@ConfigDataKeys(path = "CHEST.VoteURL.ExtraItems")
|
||||
@Getter
|
||||
private Set<String> chestVoteURLExtraItems = new HashSet<String>();
|
||||
|
||||
public ConfigurationSection getChestVoteURLExtraItemsItem(String item) {
|
||||
return getData().getConfigurationSection("CHEST.VoteURL.ExtraItems." + item);
|
||||
@@ -530,69 +523,45 @@ public class GUI extends YMLFile {
|
||||
return getData().getConfigurationSection("CHEST.VoteShopExtraItems." + item);
|
||||
}
|
||||
|
||||
public Set<String> getChestGUIVoteShopExtraItems() {
|
||||
if (getData().isConfigurationSection("CHEST.VoteShopExtraItems")) {
|
||||
return getData().getConfigurationSection("CHEST.VoteShopExtraItems").getKeys(false);
|
||||
}
|
||||
return new HashSet<String>();
|
||||
}
|
||||
@ConfigDataKeys(path = "CHEST.VoteShopExtraItems")
|
||||
@Getter
|
||||
private Set<String> chestGUIVoteShopExtraItems = new HashSet<String>();
|
||||
|
||||
public ConfigurationSection getChestGUIExtraItemsItem(String gui, String item) {
|
||||
return getData().getConfigurationSection("CHEST." + gui + ".ExtraItems." + item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vote URL site name.
|
||||
*
|
||||
* @return the vote URL site name
|
||||
*/
|
||||
public String getChestVoteURLGUISiteName() {
|
||||
return getData().getString("CHEST.VoteURL.SiteName", "&c%Name%");
|
||||
}
|
||||
@ConfigDataString(path = "CHEST.VoteURL.SiteName")
|
||||
@Getter
|
||||
private String chestVoteURLGUISiteName = "&c%Name%";
|
||||
|
||||
public String getChestVoteURLGUISiteNameCanVote() {
|
||||
return getData().getString("CHEST.VoteURL.SiteNameCanVote", "&a%Name%");
|
||||
}
|
||||
@ConfigDataString(path = "CHEST.VoteURL.SiteNameCanVote")
|
||||
@Getter
|
||||
private String chestVoteURLGUISiteNameCanVote = "&a%Name%";
|
||||
|
||||
public String getChestVoteURLName() {
|
||||
return getData().getString("CHEST.VoteURL.Name", "&cVoteURL");
|
||||
}
|
||||
@ConfigDataString(path = "CHEST.VoteURL.Name")
|
||||
@Getter
|
||||
private String chestVoteURLName = "&cVoteURL";
|
||||
|
||||
/**
|
||||
* Gets the vote URL next vote.
|
||||
*
|
||||
* @return the vote URL next vote
|
||||
*/
|
||||
public String getChestVoteURLNextVote() {
|
||||
return getData().getString("CHEST.VoteURL.NextVote", "&cCan Vote In: %Info%");
|
||||
@ConfigDataString(path = "CHEST.VoteURL.NextVote")
|
||||
@Getter
|
||||
private String chestVoteURLNextVote = "&cCan Vote In: %Info%";
|
||||
|
||||
}
|
||||
@ConfigDataString(path = "CHEST.VoteURL.SeeURL")
|
||||
@Getter
|
||||
private String chestVoteURLSeeURL = "&cClick to see URL";
|
||||
|
||||
/**
|
||||
* Gets the vote URL see URL.
|
||||
*
|
||||
* @return the vote URL see URL
|
||||
*/
|
||||
public String getChestVoteURLSeeURL() {
|
||||
return getData().getString("CHEST.VoteURL.SeeURL", "&cClick to see URL");
|
||||
}
|
||||
@ConfigDataString(path = "CHEST.VoteURLSite.Name")
|
||||
@Getter
|
||||
private String chestVoteURLSiteName = "VoteSite %site%";
|
||||
|
||||
public String getChestVoteURLSiteName() {
|
||||
return getData().getString("CHEST.VoteURLSite.Name", "VoteSite %site%");
|
||||
}
|
||||
@ConfigDataString(path = "CHEST.VoteURL.URLText")
|
||||
@Getter
|
||||
private String chestVoteURLURLText = "%VoteUrl%";
|
||||
|
||||
public String getChestVoteURLURLText() {
|
||||
return getData().getString("CHEST.VoteURL.URLText", "%VoteUrl%");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vote URL view all urls button enabled.
|
||||
*
|
||||
* @return the vote URL view all urls button enabled
|
||||
*/
|
||||
public boolean getChestVoteURLViewAllUrlsButtonEnabled() {
|
||||
return getData().getBoolean("CHEST.VoteURL.ViewAllUrlsButtonEnabled");
|
||||
}
|
||||
@ConfigDataBoolean(path = "CHEST.VoteURL.ViewAllUrlsButtonEnabled")
|
||||
@Getter
|
||||
private boolean chestVoteURLViewAllUrlsButtonEnabled = false;
|
||||
|
||||
public boolean isChestVoteShopRequireConfirmation(String identifier) {
|
||||
return getData().getBoolean("CHEST.Shop." + identifier + ".RequireConfirmation",
|
||||
|
||||
@@ -10,6 +10,10 @@ import com.bencodez.advancedcore.api.yml.YMLFile;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.AnnotationHandler;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataBoolean;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataDouble;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataInt;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataKeys;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataListString;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataString;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoter;
|
||||
|
||||
@@ -63,6 +67,10 @@ public class SpecialRewardsConfig extends YMLFile {
|
||||
@Getter
|
||||
private boolean votePartyResetExtraVotesMonthly = false;
|
||||
|
||||
@ConfigDataListString(path = "VoteParty.GlobalRandomCommand")
|
||||
@Getter
|
||||
private ArrayList<String> votePartyGlobalRandomCommand = new ArrayList<String>();
|
||||
|
||||
@Getter
|
||||
private String votePartyRewardsPath = "VoteParty.Rewards";
|
||||
|
||||
@@ -103,29 +111,10 @@ public class SpecialRewardsConfig extends YMLFile {
|
||||
return getData().getBoolean("Cumulative." + cumulative + ".Recurring", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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>();
|
||||
}
|
||||
}
|
||||
@ConfigDataKeys(path = "Cumulative")
|
||||
@Getter
|
||||
private Set<String> cumulativeVotes = new HashSet<String>();
|
||||
|
||||
/**
|
||||
* Gets the cumulative votes in same day.
|
||||
*
|
||||
* @param cumulative the cumulative
|
||||
* @return the cumulative votes in same day
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean getCumulativeVotesInSameDay(int cumulative) {
|
||||
return getData().getBoolean("Cumulative." + cumulative + ".VotesInSameDay");
|
||||
@@ -159,19 +148,9 @@ public class SpecialRewardsConfig extends YMLFile {
|
||||
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>();
|
||||
|
||||
}
|
||||
}
|
||||
@ConfigDataKeys(path = "DailyAwards")
|
||||
@Getter
|
||||
private Set<String> dailyPossibleRewardPlaces = new HashSet<String>();
|
||||
|
||||
/**
|
||||
* Gets the milestone reward enabled.
|
||||
@@ -193,22 +172,9 @@ public class SpecialRewardsConfig extends YMLFile {
|
||||
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>();
|
||||
}
|
||||
}
|
||||
@ConfigDataKeys(path = "MileStones")
|
||||
@Getter
|
||||
private Set<String> milestoneVotes = new HashSet<String>();
|
||||
|
||||
public String getMonthlyAwardRewardsPath(String path) {
|
||||
return "MonthlyAwards." + path + ".Rewards";
|
||||
@@ -227,82 +193,64 @@ public class SpecialRewardsConfig extends YMLFile {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getResetMilestonesMonthly() {
|
||||
return getData().getBoolean("ResetMilestonesMonthly");
|
||||
}
|
||||
@ConfigDataBoolean(path = "ResetMilestonesMonthly")
|
||||
@Getter
|
||||
private boolean resetMilestonesMonthly = false;
|
||||
@ConfigDataString(path = "VoteParty.Broadcast")
|
||||
@Getter
|
||||
private String votePartyBroadcast = "";
|
||||
|
||||
public String getVotePartyBroadcast() {
|
||||
return getData().getString("VoteParty.Broadcast", "");
|
||||
}
|
||||
@ConfigDataListString(path = "VoteParty.GlobalCommands", secondPath = "VoteParty.Commands")
|
||||
@Getter
|
||||
private ArrayList<String> votePartyGlobalCommands = new ArrayList<String>();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ArrayList<String> getVotePartyGlobalCommands() {
|
||||
return (ArrayList<String>) getData().getList("VoteParty.GlobalCommands",
|
||||
(ArrayList<String>) getData().getList("VoteParty.Commands", new ArrayList<String>()));
|
||||
}
|
||||
@ConfigDataBoolean(path = "VoteParty.CountFakeVotes")
|
||||
@Getter
|
||||
private boolean votePartyCountFakeVotes = true;
|
||||
|
||||
public boolean getVotePartyCountFakeVotes() {
|
||||
return getData().getBoolean("VoteParty.CountFakeVotes", true);
|
||||
}
|
||||
@ConfigDataBoolean(path = "VoteParty.CountOfflineVotes")
|
||||
@Getter
|
||||
private boolean votePartyCountOfflineVotes = true;
|
||||
|
||||
public boolean getVotePartyCountOfflineVotes() {
|
||||
return getData().getBoolean("VoteParty.CountOfflineVotes", true);
|
||||
}
|
||||
@ConfigDataBoolean(path = "VoteParty.Enabled")
|
||||
@Getter
|
||||
private boolean votePartyEnabled = false;
|
||||
|
||||
/**
|
||||
* Gets the vote party enabled.
|
||||
*
|
||||
* @return the vote party enabled
|
||||
*/
|
||||
public boolean getVotePartyEnabled() {
|
||||
return getData().getBoolean("VoteParty.Enabled");
|
||||
}
|
||||
@ConfigDataBoolean(path = "VoteParty.GiveAllPlayers")
|
||||
@Getter
|
||||
private boolean votePartyGiveAllPlayers = false;
|
||||
|
||||
/**
|
||||
* Gets the vote party give all players.
|
||||
*
|
||||
* @return the vote party give all players
|
||||
*/
|
||||
public boolean getVotePartyGiveAllPlayers() {
|
||||
return getData().getBoolean("VoteParty.GiveAllPlayers");
|
||||
}
|
||||
@ConfigDataInt(path = "VoteParty.IncreaseVotesRquired")
|
||||
@Getter
|
||||
private int votePartyIncreaseVotesRequired = 0;
|
||||
|
||||
public int getVotePartyIncreaseVotesRquired() {
|
||||
return getData().getInt("VoteParty.IncreaseVotesRquired", 0);
|
||||
}
|
||||
@ConfigDataBoolean(path = "VoteParty.OnlyOncePerDay")
|
||||
@Getter
|
||||
private boolean votePartyOnlyOncePerDay = false;
|
||||
|
||||
public boolean getVotePartyOnlyOncePerDay() {
|
||||
return getData().getBoolean("VoteParty.OnlyOncePerDay");
|
||||
}
|
||||
@ConfigDataBoolean(path = "VoteParty.OnlyOncePerWeek")
|
||||
@Getter
|
||||
private boolean votePartyOnlyOncePerWeek = false;
|
||||
|
||||
public boolean getVotePartyOnlyOncePerWeek() {
|
||||
return getData().getBoolean("VoteParty.OnlyOncePerWeek");
|
||||
}
|
||||
@ConfigDataBoolean(path = "VoteParty.ResetEachDay")
|
||||
@Getter
|
||||
private boolean votePartyResetEachDay = false;
|
||||
|
||||
public boolean getVotePartyResetEachDay() {
|
||||
return getData().getBoolean("VoteParty.ResetEachDay");
|
||||
}
|
||||
@ConfigDataBoolean(path = "VoteParty.ResetMonthly")
|
||||
@Getter
|
||||
private boolean votePartyResetMonthly = false;
|
||||
|
||||
public boolean getVotePartyResetMontly() {
|
||||
return getData().getBoolean("VoteParty.ResetMonthly");
|
||||
}
|
||||
@ConfigDataBoolean(path = "VoteParty.ResetWeekly")
|
||||
@Getter
|
||||
private boolean votePartyResetWeekly = false;
|
||||
|
||||
public boolean getVotePartyResetWeekly() {
|
||||
return getData().getBoolean("VoteParty.ResetWeekly");
|
||||
}
|
||||
@ConfigDataInt(path = "VoteParty.UserVotesRequired")
|
||||
@Getter
|
||||
private int votePartyUserVotesRequired = 0;
|
||||
|
||||
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");
|
||||
}
|
||||
@ConfigDataInt(path = "VoteParty.VotesRequired")
|
||||
@Getter
|
||||
private int votePartyVotesRequired = 0;
|
||||
|
||||
public boolean getVoteStreakRewardEnabled(String type, String s) {
|
||||
return getData().getBoolean("VoteStreak." + type + "." + s + ".Enabled");
|
||||
@@ -328,18 +276,9 @@ public class SpecialRewardsConfig extends YMLFile {
|
||||
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>();
|
||||
}
|
||||
}
|
||||
@ConfigDataKeys(path = "WeeklyAwards")
|
||||
@Getter
|
||||
private Set<String> weeklyPossibleRewardPlaces = new HashSet<String>();
|
||||
|
||||
@Override
|
||||
public void loadValues() {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.bencodez.votingplugin.cooldown;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
@@ -14,12 +16,15 @@ import org.bukkit.event.Listener;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardOptions;
|
||||
import com.bencodez.advancedcore.api.user.AdvancedCoreUser;
|
||||
import com.bencodez.advancedcore.api.user.UserStartup;
|
||||
import com.bencodez.advancedcore.api.user.userstorage.Column;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.events.PlayerVoteCoolDownEndEvent;
|
||||
import com.bencodez.votingplugin.events.PlayerVoteSiteCoolDownEndEvent;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
public class CoolDownCheck implements Listener {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
@@ -33,6 +38,7 @@ public class CoolDownCheck implements Listener {
|
||||
this.timer = Executors.newScheduledThreadPool(1);
|
||||
}
|
||||
|
||||
@Getter
|
||||
private ScheduledExecutorService timer;
|
||||
|
||||
private boolean cooldownCheckEnabled = false;
|
||||
@@ -65,7 +71,7 @@ public class CoolDownCheck implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
public void check(VotingPluginUser user) {
|
||||
public synchronized void check(VotingPluginUser user) {
|
||||
boolean coolDownCheck = user.getCoolDownCheck();
|
||||
if (user.canVoteAll() && coolDownCheck) {
|
||||
user.setCoolDownCheck(false);
|
||||
@@ -79,13 +85,14 @@ public class CoolDownCheck implements Listener {
|
||||
|
||||
public synchronized void checkPerSite(VotingPluginUser user) {
|
||||
if (plugin.getConfigFile().isPerSiteCoolDownEvents()) {
|
||||
HashMap<VoteSite, Boolean> coolDownChecks = user.getCoolDownCheckSiteList();
|
||||
HashMap<String, Boolean> coolDownChecks = user.getCoolDownCheckSiteList();
|
||||
boolean changed = false;
|
||||
for (VoteSite site : plugin.getVoteSites()) {
|
||||
if (user.canVoteSite(site)) {
|
||||
if (!coolDownChecks.containsKey(site) || !coolDownChecks.get(site).booleanValue()) {
|
||||
coolDownChecks.put(site, Boolean.TRUE);
|
||||
if (!coolDownChecks.containsKey(site.getKey()) || !coolDownChecks.get(site.getKey()).booleanValue()) {
|
||||
if (user.canVoteSite(site)) {
|
||||
coolDownChecks.put(site.getKey(), Boolean.TRUE);
|
||||
changed = true;
|
||||
plugin.extraDebug("Triggering votesitecooldownend event for " + user.getUUID());
|
||||
PlayerVoteSiteCoolDownEndEvent event = new PlayerVoteSiteCoolDownEndEvent(user, site);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
@@ -103,12 +110,12 @@ public class CoolDownCheck implements Listener {
|
||||
public void schedulePerSite(VotingPluginUser user) {
|
||||
final UUID uuid = UUID.fromString(user.getUUID());
|
||||
long time = user.getNextTimeFirstSiteAvailable();
|
||||
if (perSiteTasks.containsKey(uuid)) {
|
||||
perSiteTasks.get(uuid).cancel(false);
|
||||
perSiteTasks.remove(uuid);
|
||||
}
|
||||
if (time > 0) {
|
||||
if (perSiteTasks.containsKey(uuid)) {
|
||||
perSiteTasks.get(uuid).cancel(false);
|
||||
perSiteTasks.remove(uuid);
|
||||
}
|
||||
plugin.devDebug("PerSiteCoolDownEvent schedule time: " + time);
|
||||
plugin.devDebug("PerSiteCoolDownEvent schedule time: " + time + " seconds");
|
||||
ScheduledFuture<?> scheduledFuture = timer.schedule(new Runnable() {
|
||||
|
||||
@Override
|
||||
@@ -126,19 +133,21 @@ public class CoolDownCheck implements Listener {
|
||||
public void schedule(VotingPluginUser user) {
|
||||
final UUID uuid = UUID.fromString(user.getUUID());
|
||||
long time = user.getNextTimeAllSitesAvailable();
|
||||
if (allSiteTasks.containsKey(uuid)) {
|
||||
allSiteTasks.get(uuid).cancel(false);
|
||||
allSiteTasks.remove(uuid);
|
||||
}
|
||||
if (time > 0) {
|
||||
user.setCoolDownCheck(true);
|
||||
if (allSiteTasks.containsKey(uuid)) {
|
||||
allSiteTasks.get(uuid).cancel(false);
|
||||
allSiteTasks.remove(uuid);
|
||||
}
|
||||
ScheduledFuture<?> scheduledFuture = timer.schedule(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
check(uuid);
|
||||
if (plugin != null && plugin.isEnabled()) {
|
||||
check(uuid);
|
||||
}
|
||||
}
|
||||
}, time + 2, TimeUnit.SECONDS);
|
||||
}, time+2, TimeUnit.SECONDS);
|
||||
allSiteTasks.put(uuid, scheduledFuture);
|
||||
}
|
||||
|
||||
@@ -169,6 +178,32 @@ public class CoolDownCheck implements Listener {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void checkAllVoteSite(VoteSite site) {
|
||||
plugin.getLogger().info("Checking vote cooldown rewards for all players: " + site.getKey());
|
||||
HashMap<UUID, ArrayList<Column>> cols = plugin.getUserManager().getAllKeys();
|
||||
for (Entry<UUID, ArrayList<Column>> playerData : cols.entrySet()) {
|
||||
|
||||
String uuid = playerData.getKey().toString();
|
||||
if (plugin != null && plugin.isEnabled()) {
|
||||
if (uuid != null && !uuid.isEmpty()) {
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager()
|
||||
.getVotingPluginUser(UUID.fromString(uuid), false);
|
||||
user.dontCache();
|
||||
user.updateTempCacheWithColumns(playerData.getValue());
|
||||
cols.put(playerData.getKey(), null);
|
||||
checkPerSite(user);
|
||||
user.clearTempCache();
|
||||
user = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
cols.clear();
|
||||
cols = null;
|
||||
|
||||
plugin.getLogger().info("Finished checking vote cooldown rewards for all players: " + site.getKey());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@@ -180,7 +215,8 @@ public class CoolDownCheck implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onCoolDownEnd(PlayerVoteSiteCoolDownEndEvent event) {
|
||||
plugin.getRewardHandler().giveReward(event.getPlayer(), event.getSite().getSiteData(), "CoolDownEndRewards",
|
||||
new RewardOptions());
|
||||
new RewardOptions().addPlaceholder("sitename", event.getSite().getDisplayName()).addPlaceholder("url",
|
||||
event.getSite().getVoteURL(false)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,6 +50,19 @@ public class ServerData {
|
||||
}
|
||||
}
|
||||
|
||||
public void addVoteShopPurchase(String ident) {
|
||||
setVoteShopPurchases(ident, (getVoteShopPurchases(ident) + 1));
|
||||
}
|
||||
|
||||
public void setVoteShopPurchases(String ident, int amount) {
|
||||
getData().set("VoteShopPurchases." + ident, amount);
|
||||
saveData();
|
||||
}
|
||||
|
||||
public int getVoteShopPurchases(String ident) {
|
||||
return getData().getInt("VoteShopPurchases." + ident);
|
||||
}
|
||||
|
||||
public void setAutoCachedPlaceholder(List<String> placeholders) {
|
||||
getData().set("AutoCachePlaceholders", placeholders);
|
||||
saveData();
|
||||
|
||||
@@ -55,17 +55,22 @@ public class PlayerPostVoteEvent extends Event {
|
||||
@Getter
|
||||
@Setter
|
||||
private VoteSite voteSite;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private long voteTime = 0;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private VotingPluginUser votingPluginUser;
|
||||
|
||||
public PlayerPostVoteEvent(VoteSite voteSite, VotingPluginUser user, boolean realVote, boolean forceBungee) {
|
||||
public PlayerPostVoteEvent(VoteSite voteSite, VotingPluginUser user, boolean realVote, boolean forceBungee, long voteTime) {
|
||||
super(true);
|
||||
this.user = user;
|
||||
this.voteSite = voteSite;
|
||||
this.realVote = realVote;
|
||||
this.forceBungee = forceBungee;
|
||||
this.voteTime = voteTime;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.bencodez.votingplugin.listeners;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@@ -39,7 +38,7 @@ public class BlockBreak implements Listener {
|
||||
if (event.getBlock().getState() instanceof Sign) {
|
||||
Sign s = (Sign) event.getBlock().getState();
|
||||
final Location loc = s.getLocation();
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
plugin.getBukkitScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.bencodez.votingplugin.listeners;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.events.PlayerVoteEvent;
|
||||
import com.vexsoftware.votifier.model.Vote;
|
||||
@@ -10,7 +8,7 @@ import com.vexsoftware.votifier.model.VotifierEvent;
|
||||
public class BungeeVotifierEvent {
|
||||
public void send(VotingPluginMain plugin, PlayerVoteEvent event) {
|
||||
plugin.debug("Triggering vote event");
|
||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||
plugin.getBukkitScheduler().runTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -12,7 +12,6 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import com.bencodez.advancedcore.api.misc.PlayerUtils;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.signs.SignHandler;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
@@ -52,7 +51,7 @@ public class PlayerInteract implements Listener {
|
||||
if (sign.isLocationSame(event.getClickedBlock().getLocation())) {
|
||||
// plugin.debug(player.getName() +
|
||||
// " right clicked a top voter sign, sending message");
|
||||
UserManager.getInstance().getVotingPluginUser(player)
|
||||
plugin.getVotingPluginUserManager().getVotingPluginUser(player)
|
||||
.sendMessage(sign.getRightClickMessage());
|
||||
|
||||
if (!sign.isSkullSet()) {
|
||||
|
||||
@@ -9,7 +9,6 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import com.bencodez.advancedcore.listeners.AdvancedCoreLoginEvent;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.bungee.BungeeMethod;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
@@ -31,7 +30,7 @@ public class PlayerJoinEvent implements Listener {
|
||||
}
|
||||
|
||||
private void login(Player player) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
|
||||
if (player.isOp() && plugin.isYmlError()) {
|
||||
user.sendMessage("&cVotingPlugin: Detected yml error, please check console for details");
|
||||
}
|
||||
@@ -47,7 +46,7 @@ public class PlayerJoinEvent implements Listener {
|
||||
|
||||
user.loginRewards();
|
||||
|
||||
plugin.getPlaceholders().onUpdate(user);
|
||||
plugin.getPlaceholders().onUpdate(user, true);
|
||||
|
||||
if (plugin.getBungeeSettings().isUseBungeecoord()
|
||||
&& plugin.getBungeeHandler().getMethod().equals(BungeeMethod.PLUGINMESSAGING)) {
|
||||
@@ -81,9 +80,10 @@ public class PlayerJoinEvent implements Listener {
|
||||
public void run() {
|
||||
VotingPluginMain.plugin.getAdvancedTab().remove(uuid);
|
||||
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(uuid);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(uuid);
|
||||
user.dontCache();
|
||||
user.logoutRewards();
|
||||
plugin.getPlaceholders().onLogout(user);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import com.bencodez.votingplugin.bungee.BungeeMethod;
|
||||
import com.bencodez.votingplugin.events.PlayerPostVoteEvent;
|
||||
import com.bencodez.votingplugin.events.PlayerVoteEvent;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
@@ -55,7 +54,7 @@ public class PlayerVoteListener implements Listener {
|
||||
plugin.getLogger().warning("Player " + playerName
|
||||
+ " has not joined before, disregarding vote, set AllowUnjoined to true to prevent this");
|
||||
if (event.isBungee() && plugin.getBungeeSettings().isRemoveInvalidUsers()) {
|
||||
UserManager.getInstance().getVotingPluginUser(playerName).remove();
|
||||
plugin.getVotingPluginUserManager().getVotingPluginUser(playerName).remove();
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -108,9 +107,9 @@ public class PlayerVoteListener implements Listener {
|
||||
Player p = Bukkit.getPlayerExact(playerName);
|
||||
if (p != null) {
|
||||
// player online
|
||||
user = UserManager.getInstance().getVotingPluginUser(p);
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(p);
|
||||
} else {
|
||||
user = UserManager.getInstance().getVotingPluginUser(playerName);
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(playerName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +132,7 @@ public class PlayerVoteListener implements Listener {
|
||||
// broadcast vote if enabled in config
|
||||
if (plugin.getConfigFile().isBroadcastVotesEnabled()
|
||||
&& (plugin.getBungeeSettings().isBungeeBroadcast() || !event.isBungee())) {
|
||||
if (!plugin.getConfigFile().getFormatBroadcastWhenOnline() || user.isOnline()) {
|
||||
if (!plugin.getConfigFile().isFormatBroadcastWhenOnline() || user.isOnline()) {
|
||||
voteSite.broadcastVote(user);
|
||||
}
|
||||
}
|
||||
@@ -143,11 +142,14 @@ public class PlayerVoteListener implements Listener {
|
||||
plugin.getBroadcastHandler().onVote(playerName);
|
||||
}
|
||||
|
||||
long voteTime = 0;
|
||||
// update last vote time
|
||||
if (event.getTime() != 0) {
|
||||
user.setTime(voteSite, event.getTime());
|
||||
voteTime = event.getTime();
|
||||
} else {
|
||||
user.setTime(voteSite);
|
||||
voteTime = LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||
}
|
||||
|
||||
// try logging to file
|
||||
@@ -164,7 +166,7 @@ public class PlayerVoteListener implements Listener {
|
||||
plugin.getSpecialRewards().checkFirstVote(user, event.isForceBungee());
|
||||
plugin.getSpecialRewards().checkFirstVoteToday(user, event.isForceBungee());
|
||||
|
||||
if (user.isReminded() && plugin.getConfigFile().getVoteRemindingRemindOnlyOnce()) {
|
||||
if (user.isReminded() && plugin.getConfigFile().isVoteRemindingRemindOnlyOnce()) {
|
||||
user.setReminded(false);
|
||||
}
|
||||
|
||||
@@ -183,16 +185,24 @@ public class PlayerVoteListener implements Listener {
|
||||
user.closeInv();
|
||||
}
|
||||
} else {
|
||||
user.addOfflineVote(voteSite.getKey());
|
||||
plugin.debug("Offline vote set for " + playerName + " (" + user.getUUID() + ") on " + voteSite.getKey());
|
||||
if (!plugin.getConfigFile().isOfflineVotesLimitEnabled()
|
||||
|| user.getNumberOfOfflineVotes(voteSite) <= plugin.getConfigFile().getOfflineVotesLimitAmount()) {
|
||||
user.addOfflineVote(voteSite.getKey());
|
||||
plugin.debug(
|
||||
"Offline vote set for " + playerName + " (" + user.getUUID() + ") on " + voteSite.getKey());
|
||||
} else {
|
||||
plugin.debug("Not setting offline vote, offline vote limit reached");
|
||||
}
|
||||
}
|
||||
|
||||
// add to total votes
|
||||
if ((plugin.getConfigFile().isCountFakeVotes() || event.isRealVote()) && event.isAddTotals()) {
|
||||
if (plugin.getConfigFile().isAddTotals()) {
|
||||
user.addTotal();
|
||||
user.addTotalDaily();
|
||||
user.addTotalWeekly();
|
||||
if (plugin.getConfigFile().isAddTotalsOffline() || user.isOnline()) {
|
||||
user.addTotal();
|
||||
user.addTotalDaily();
|
||||
user.addTotalWeekly();
|
||||
}
|
||||
}
|
||||
user.addPoints();
|
||||
}
|
||||
@@ -208,7 +218,7 @@ public class PlayerVoteListener implements Listener {
|
||||
if (plugin.getBungeeSettings().isUseBungeecoord()) {
|
||||
if (plugin.getBungeeHandler().getMethod().equals(BungeeMethod.MYSQL)) {
|
||||
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
plugin.getBukkitScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -216,12 +226,12 @@ public class PlayerVoteListener implements Listener {
|
||||
plugin.getPluginMessaging().sendPluginMessage("VoteUpdate", uuid);
|
||||
}
|
||||
}
|
||||
}, 40);
|
||||
}, 2);
|
||||
}
|
||||
}
|
||||
|
||||
PlayerPostVoteEvent postVoteEvent = new PlayerPostVoteEvent(voteSite, user, event.isRealVote(),
|
||||
event.isForceBungee());
|
||||
event.isForceBungee(), voteTime);
|
||||
plugin.getServer().getPluginManager().callEvent(postVoteEvent);
|
||||
|
||||
if (!user.isOnline()) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.bencodez.votingplugin.listeners;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
@@ -47,7 +46,7 @@ public class SignChange implements Listener {
|
||||
plugin.getServerData().addSign(event.getBlock().getLocation(), event.getLine(2),
|
||||
Integer.parseInt(event.getLine(1)));
|
||||
event.getPlayer().sendMessage(StringParser.getInstance().colorize("&aAdded sign!"));
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
plugin.getBukkitScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -16,7 +16,6 @@ import com.bencodez.advancedcore.api.misc.MiscUtils;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.bungee.BungeeMethod;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
import lombok.Getter;
|
||||
@@ -65,7 +64,7 @@ public class VoteSite {
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private double timeOffSet;
|
||||
private int voteDelayDailyHour;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@@ -138,7 +137,7 @@ public class VoteSite {
|
||||
bc = StringParser.getInstance().replacePlaceHolders(user.getOfflinePlayer(), bc);
|
||||
ArrayList<Player> players = new ArrayList<Player>();
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (!UserManager.getInstance().getVotingPluginUser(p).getDisableBroadcast()) {
|
||||
if (!plugin.getVotingPluginUserManager().getVotingPluginUser(p).getDisableBroadcast()) {
|
||||
players.add(p);
|
||||
}
|
||||
}
|
||||
@@ -231,7 +230,7 @@ public class VoteSite {
|
||||
voteDelayDaily = plugin.getConfigVoteSites().getVoteSiteResetVoteDelayDaily(key);
|
||||
giveOffline = plugin.getConfigVoteSites().getVoteSiteGiveOffline(key);
|
||||
waitUntilVoteDelay = plugin.getConfigVoteSites().getWaitUntilVoteDelay(key);
|
||||
timeOffSet = plugin.getConfigVoteSites().getTimeOffSet(key);
|
||||
voteDelayDailyHour = plugin.getConfigVoteSites().getVoteDelayDailyHour(key);
|
||||
hidden = plugin.getConfigVoteSites().getVoteSiteHidden(key);
|
||||
ignoreCanVote = plugin.getConfigVoteSites().getVoteSiteIgnoreCanVote(key);
|
||||
}
|
||||
@@ -248,7 +247,7 @@ public class VoteSite {
|
||||
str += ", VoteDelayDaily: " + isVoteDelayDaily();
|
||||
str += ", IsWaitUntilVoteDelay: " + isWaitUntilVoteDelay();
|
||||
str += ", ServiceSite: " + getServiceSite();
|
||||
str += ", TimeOffSet:" + getTimeOffSet();
|
||||
str += ", VoteDelayDailyHour:" + getVoteDelayDailyHour();
|
||||
str += ", Url: " + getVoteURL();
|
||||
str += ", IgnoreCanVote: " + isIgnoreCanVote();
|
||||
str += ", Hidden: " + isHidden();
|
||||
|
||||
@@ -5,7 +5,6 @@ import org.bukkit.Bukkit;
|
||||
import com.bencodez.advancedcore.api.placeholder.NonPlayerPlaceHolder;
|
||||
import com.bencodez.advancedcore.api.placeholder.PlaceHolder;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
import be.maximvdw.placeholderapi.PlaceholderAPI;
|
||||
@@ -41,11 +40,11 @@ public class MVdWPlaceholders {
|
||||
|
||||
@Override
|
||||
public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
|
||||
VotingPluginUser user = UserManager.getInstance()
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager()
|
||||
.getVotingPluginUser(event.getOfflinePlayer());
|
||||
if (plugin.getConfigFile().isUsePrimaryAccountForPlaceholders()
|
||||
&& user.hasPrimaryAccount()) {
|
||||
user = UserManager.getInstance().getVotingPluginUser(user.getPrimaryAccount());
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(user.getPrimaryAccount());
|
||||
}
|
||||
return place.placeholderRequest(user,
|
||||
event.getPlaceholder().substring("VotingPlugin_".length()));
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.bencodez.advancedcore.api.messages.StringParser;
|
||||
import com.bencodez.advancedcore.api.placeholder.CalculatingPlaceholder;
|
||||
import com.bencodez.advancedcore.api.placeholder.NonPlayerPlaceHolder;
|
||||
import com.bencodez.advancedcore.api.placeholder.PlaceHolder;
|
||||
import com.bencodez.advancedcore.api.user.AdvancedCoreUser;
|
||||
@@ -26,7 +27,6 @@ import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoter;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoterPlayer;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
import lombok.Getter;
|
||||
@@ -55,7 +55,7 @@ public class PlaceHolders {
|
||||
onUpdate();
|
||||
if (!cacheLevel.equals(PlaceholderCacheLevel.NONE)) {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
onUpdate(UserManager.getInstance().getVotingPluginUser(player));
|
||||
onUpdate(plugin.getVotingPluginUserManager().getVotingPluginUser(player), player.isOnline());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public class PlaceHolders {
|
||||
return "no player";
|
||||
}
|
||||
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(p);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(p);
|
||||
if (useCache) {
|
||||
if (!cachedPlaceholders.contains(identifier)) {
|
||||
// not cached placeholder
|
||||
@@ -150,45 +150,85 @@ public class PlaceHolders {
|
||||
}
|
||||
if (plugin.getConfigFile().isUsePrimaryAccountForPlaceholders()) {
|
||||
if (user.hasPrimaryAccount()) {
|
||||
user = UserManager.getInstance().getVotingPluginUser(user.getPrimaryAccount());
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(user.getPrimaryAccount());
|
||||
}
|
||||
}
|
||||
|
||||
for (PlaceHolder<VotingPluginUser> placeholder : placeholders) {
|
||||
try {
|
||||
if (placeholder.matches(identifier)) {
|
||||
if (useCache) {
|
||||
if (placeholder.isUsesCache() && placeholder.isCached(identifier)) {
|
||||
ConcurrentHashMap<UUID, String> cache = placeholder.getCache().get(identifier);
|
||||
if (cache.containsKey(p.getUniqueId())) {
|
||||
return cache.get(p.getUniqueId());
|
||||
} else if (!forceProcess) {
|
||||
schedulePlaceholderCheck(user);
|
||||
return "...";
|
||||
if (placeholder instanceof CalculatingPlaceholder<?>) {
|
||||
if (useCache) {
|
||||
CalculatingPlaceholder<VotingPluginUser> cPlaceholder = (CalculatingPlaceholder<VotingPluginUser>) placeholder;
|
||||
if (placeholder.isUsesCache() && placeholder.isCached(identifier)) {
|
||||
ConcurrentHashMap<UUID, String> cache = placeholder.getCache().get(identifier);
|
||||
if (cache.containsKey(p.getUniqueId())) {
|
||||
if (cPlaceholder.getCacheData().containsKey(user.getJavaUUID())) {
|
||||
return cPlaceholder.placeholderRequest(user, identifier);
|
||||
}
|
||||
return cache.get(p.getUniqueId());
|
||||
} else if (!forceProcess) {
|
||||
schedulePlaceholderCheck(user);
|
||||
return "...";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (forceProcess) {
|
||||
if (getCacheLevel().shouldCache()) {
|
||||
if (!placeholdersToSetCacheOn.contains(identifier)
|
||||
&& !cachedPlaceholders.contains(identifier)) {
|
||||
placeholdersToSetCacheOn.add(identifier);
|
||||
schedulePlaceholderCheck(user);
|
||||
if (forceProcess) {
|
||||
if (getCacheLevel().shouldCache()) {
|
||||
if (!placeholdersToSetCacheOn.contains(identifier)
|
||||
&& !cachedPlaceholders.contains(identifier)) {
|
||||
placeholdersToSetCacheOn.add(identifier);
|
||||
schedulePlaceholderCheck(user);
|
||||
}
|
||||
}
|
||||
return placeholder.placeholderRequest(user, identifier);
|
||||
} else {
|
||||
if (getCacheLevel().shouldCache()) {
|
||||
if (!placeholdersToSetCacheOn.contains(identifier)
|
||||
&& !cachedPlaceholders.contains(identifier)) {
|
||||
placeholdersToSetCacheOn.add(identifier);
|
||||
schedulePlaceholderCheck(user);
|
||||
}
|
||||
}
|
||||
return ".";
|
||||
}
|
||||
return placeholder.placeholderRequest(user, identifier);
|
||||
} else {
|
||||
if (getCacheLevel().shouldCache()) {
|
||||
if (!placeholdersToSetCacheOn.contains(identifier)
|
||||
&& !cachedPlaceholders.contains(identifier)) {
|
||||
placeholdersToSetCacheOn.add(identifier);
|
||||
schedulePlaceholderCheck(user);
|
||||
}
|
||||
}
|
||||
return ".";
|
||||
return placeholder.placeholderRequest(user, identifier);
|
||||
}
|
||||
} else {
|
||||
return placeholder.placeholderRequest(user, identifier);
|
||||
if (useCache) {
|
||||
if (placeholder.isUsesCache() && placeholder.isCached(identifier)) {
|
||||
ConcurrentHashMap<UUID, String> cache = placeholder.getCache().get(identifier);
|
||||
if (cache.containsKey(p.getUniqueId())) {
|
||||
return cache.get(p.getUniqueId());
|
||||
} else if (!forceProcess) {
|
||||
schedulePlaceholderCheck(user);
|
||||
return "...";
|
||||
}
|
||||
}
|
||||
|
||||
if (forceProcess) {
|
||||
if (getCacheLevel().shouldCache()) {
|
||||
if (!placeholdersToSetCacheOn.contains(identifier)
|
||||
&& !cachedPlaceholders.contains(identifier)) {
|
||||
placeholdersToSetCacheOn.add(identifier);
|
||||
schedulePlaceholderCheck(user);
|
||||
}
|
||||
}
|
||||
return placeholder.placeholderRequest(user, identifier);
|
||||
} else {
|
||||
if (getCacheLevel().shouldCache()) {
|
||||
if (!placeholdersToSetCacheOn.contains(identifier)
|
||||
&& !cachedPlaceholders.contains(identifier)) {
|
||||
placeholdersToSetCacheOn.add(identifier);
|
||||
schedulePlaceholderCheck(user);
|
||||
}
|
||||
}
|
||||
return ".";
|
||||
}
|
||||
} else {
|
||||
return placeholder.placeholderRequest(user, identifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -452,12 +492,25 @@ public class PlaceHolders {
|
||||
}.withDescription("How long until user can vote on anysite").updateDataKey("LastVotes"));
|
||||
|
||||
for (final VoteSite voteSite : plugin.getVoteSites()) {
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Next_" + voteSite.getKey()) {
|
||||
placeholders.add(new CalculatingPlaceholder<VotingPluginUser>("Next_" + voteSite.getKey()) {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
if (getCacheData().containsKey(user.getJavaUUID())) {
|
||||
String data = getCacheData().get(user.getJavaUUID());
|
||||
if (!data.isEmpty()) {
|
||||
long time = Long.valueOf(data);
|
||||
return user.voteCommandNextInfo(voteSite, time);
|
||||
}
|
||||
}
|
||||
return user.voteCommandNextInfo(voteSite);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String placeholderDataRequest(VotingPluginUser user, String identifier) {
|
||||
long time = user.getTime(voteSite);
|
||||
return "" + time;
|
||||
}
|
||||
}.withDescription("How long until user can vote on " + voteSite.getKey()).updateDataKey("LastVotes"));
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Last_" + voteSite.getKey()) {
|
||||
|
||||
@@ -554,6 +607,43 @@ public class PlaceHolders {
|
||||
}
|
||||
}.withDescription("Get user top voter position"));
|
||||
|
||||
if (plugin.getGui().isLastMonthGUI()) {
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("Top_LastMonth_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(String identifier) {
|
||||
if (!StringParser.getInstance().isInt(identifier.split("_")[2])) {
|
||||
return null;
|
||||
}
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<TopVoterPlayer, Integer> entry : plugin.getLastMonthTopVoter().entrySet()) {
|
||||
if (num == number) {
|
||||
return entry.getKey().getPlayerName();
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user at position in last month top voter"));
|
||||
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("Top_LastMonthVotes_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<TopVoterPlayer, Integer> entry : plugin.getLastMonthTopVoter().entrySet()) {
|
||||
if (num == number) {
|
||||
return "" + entry.getValue().intValue();
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user votes at position in last month top voter"));
|
||||
}
|
||||
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("Top_Month_") {
|
||||
|
||||
@Override
|
||||
@@ -732,7 +822,7 @@ public class PlaceHolders {
|
||||
if (plugin.getBungeeHandler() != null) {
|
||||
return Integer.toString(plugin.getBungeeHandler().getBungeeVotePartyCurrent());
|
||||
}
|
||||
return "" + 0;
|
||||
return "-1";
|
||||
}
|
||||
}.withDescription("Current amount of bungee voteparty votes"));
|
||||
|
||||
@@ -744,7 +834,7 @@ public class PlaceHolders {
|
||||
return Integer.toString(plugin.getBungeeHandler().getBungeeVotePartyRequired()
|
||||
- plugin.getBungeeHandler().getBungeeVotePartyCurrent());
|
||||
}
|
||||
return "" + 0;
|
||||
return "-1";
|
||||
}
|
||||
}.withDescription("Voteparty bungee votes needed"));
|
||||
|
||||
@@ -755,7 +845,7 @@ public class PlaceHolders {
|
||||
if (plugin.getBungeeHandler() != null) {
|
||||
return Integer.toString(plugin.getBungeeHandler().getBungeeVotePartyRequired());
|
||||
}
|
||||
return "" + 0;
|
||||
return "-1";
|
||||
}
|
||||
}.withDescription("Amount of votes needed for bungee voteparty"));
|
||||
|
||||
@@ -876,22 +966,45 @@ public class PlaceHolders {
|
||||
|
||||
@Override
|
||||
public void onChange(AdvancedCoreUser user, String... keys) {
|
||||
VotingPluginUser vpUser = UserManager.getInstance().getVotingPluginUser(user);
|
||||
VotingPluginUser vpUser = plugin.getVotingPluginUserManager().getVotingPluginUser(user);
|
||||
if (!vpUser.isCached()) {
|
||||
vpUser.dontCache();
|
||||
}
|
||||
for (PlaceHolder<VotingPluginUser> placeholder : placeholders) {
|
||||
if (placeholder.isUsesCache()) {
|
||||
for (String key : keys) {
|
||||
if (placeholder.getUpdateDataKey().equalsIgnoreCase(key)) {
|
||||
for (String ident : placeholder.getCache().keySet()) {
|
||||
String value = placeholder.placeholderRequest(vpUser, ident);
|
||||
placeholder.getCache().get(ident).put(vpUser.getJavaUUID(), value);
|
||||
plugin.devDebug("Updated placeholder cache for " + vpUser.getUUID() + " on " + key
|
||||
+ " with " + value);
|
||||
|
||||
if (placeholder.isCached(placeholder.getIdentifier(), user.getJavaUUID())
|
||||
|| !getCacheLevel().onlineOnly() || user.isOnline()) {
|
||||
if (placeholder instanceof CalculatingPlaceholder<?>) {
|
||||
CalculatingPlaceholder<VotingPluginUser> cPlaceholder = (CalculatingPlaceholder<VotingPluginUser>) placeholder;
|
||||
if (placeholder.isUsesCache()) {
|
||||
for (String key : keys) {
|
||||
if (placeholder.getUpdateDataKey().equalsIgnoreCase(key)) {
|
||||
for (String ident : placeholder.getCache().keySet()) {
|
||||
String value = placeholder.placeholderRequest(vpUser, ident);
|
||||
cPlaceholder.getCacheData().put(user.getJavaUUID(),
|
||||
cPlaceholder.placeholderDataRequest(vpUser, ident));
|
||||
placeholder.getCache().get(ident).put(vpUser.getJavaUUID(), value);
|
||||
plugin.devDebug("Updated calculating placeholder cache for "
|
||||
+ vpUser.getUUID() + " on " + key + " with " + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (placeholder.isUsesCache()) {
|
||||
for (String key : keys) {
|
||||
if (placeholder.getUpdateDataKey().equalsIgnoreCase(key)) {
|
||||
for (String ident : placeholder.getCache().keySet()) {
|
||||
String value = placeholder.placeholderRequest(vpUser, ident);
|
||||
placeholder.getCache().get(ident).put(vpUser.getJavaUUID(), value);
|
||||
plugin.devDebug("Updated placeholder cache for " + vpUser.getUUID()
|
||||
+ " on " + key + " with " + value);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -901,35 +1014,59 @@ public class PlaceHolders {
|
||||
}
|
||||
|
||||
public void onVotePartyUpdate() {
|
||||
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : nonPlayerPlaceholders) {
|
||||
if (placeholder.isUsesCache()) {
|
||||
if (placeholder.getIdentifier().startsWith("VoteParty")) {
|
||||
for (String ident : placeholder.getCache().keySet()) {
|
||||
placeholder.getCache().put(ident, placeholder.placeholderRequest(ident));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* for (NonPlayerPlaceHolder<VotingPluginUser> placeholder :
|
||||
* nonPlayerPlaceholders) { if (placeholder.isUsesCache()) { if
|
||||
* (placeholder.getIdentifier().startsWith("VoteParty")) { for (String ident :
|
||||
* placeholder.getCache().keySet()) { placeholder.getCache().put(ident,
|
||||
* placeholder.placeholderRequest(ident)); } } } }
|
||||
*/
|
||||
}
|
||||
|
||||
public void onBungeeVotePartyUpdate() {
|
||||
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : nonPlayerPlaceholders) {
|
||||
if (placeholder.isUsesCache()) {
|
||||
if (placeholder.getIdentifier().startsWith("BungeeVoteParty")) {
|
||||
for (String ident : placeholder.getCache().keySet()) {
|
||||
placeholder.getCache().put(ident, placeholder.placeholderRequest(ident));
|
||||
}
|
||||
/*
|
||||
* for (NonPlayerPlaceHolder<VotingPluginUser> placeholder :
|
||||
* nonPlayerPlaceholders) { if (placeholder.isUsesCache()) { if
|
||||
* (placeholder.getIdentifier().startsWith("BungeeVoteParty")) { for (String
|
||||
* ident : placeholder.getCache().keySet()) { placeholder.getCache().put(ident,
|
||||
* placeholder.placeholderRequest(ident)); } } } }
|
||||
*/
|
||||
}
|
||||
|
||||
public void onLogout(VotingPluginUser user) {
|
||||
if (plugin.getPlaceholders().getCacheLevel().onlineOnly()) {
|
||||
for (PlaceHolder<VotingPluginUser> placeholder : placeholders) {
|
||||
if (placeholder.isUsesCache()) {
|
||||
placeholder.clearCachePlayer(user.getJavaUUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onUpdate(VotingPluginUser user) {
|
||||
public void onUpdate(VotingPluginUser user, boolean login) {
|
||||
for (PlaceHolder<VotingPluginUser> placeholder : placeholders) {
|
||||
if (placeholder.isUsesCache()) {
|
||||
for (String ident : placeholder.getCache().keySet()) {
|
||||
placeholder.getCache().get(ident).put(user.getJavaUUID(),
|
||||
placeholder.placeholderRequest(user, ident));
|
||||
if (placeholder.isCached(placeholder.getIdentifier(), user.getJavaUUID()) || login) {
|
||||
if (placeholder instanceof CalculatingPlaceholder<?>) {
|
||||
|
||||
CalculatingPlaceholder<VotingPluginUser> cPlaceholder = (CalculatingPlaceholder<VotingPluginUser>) placeholder;
|
||||
if (placeholder.isUsesCache()) {
|
||||
for (String ident : placeholder.getCache().keySet()) {
|
||||
cPlaceholder.getCacheData().put(user.getJavaUUID(),
|
||||
cPlaceholder.placeholderDataRequest(user, ident));
|
||||
placeholder.getCache().get(ident).put(user.getJavaUUID(),
|
||||
placeholder.placeholderRequest(user, ident));
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
if (placeholder.isUsesCache()) {
|
||||
for (String ident : placeholder.getCache().keySet()) {
|
||||
placeholder.getCache().get(ident).put(user.getJavaUUID(),
|
||||
placeholder.placeholderRequest(user, ident));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -941,15 +1078,15 @@ public class PlaceHolders {
|
||||
if (toCache.startsWith("votingplugin")) {
|
||||
toCache = toCache.substring("votingplugin_".length());
|
||||
}
|
||||
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : nonPlayerPlaceholders) {
|
||||
if (placeholder.matches(toCache)) {
|
||||
placeholder.setUseCache(true, toCache);
|
||||
cachedPlaceholders.add(toCache);
|
||||
plugin.getServerData().addAutoCachedPlaceholder(toCache);
|
||||
plugin.extraDebug("Auto Caching placeholder " + toCache);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* for (NonPlayerPlaceHolder<VotingPluginUser> placeholder :
|
||||
* nonPlayerPlaceholders) { if (placeholder.matches(toCache)) {
|
||||
* placeholder.setUseCache(true, toCache); cachedPlaceholders.add(toCache);
|
||||
* plugin.getServerData().addAutoCachedPlaceholder(toCache);
|
||||
* plugin.extraDebug("Auto Caching placeholder " + toCache); }
|
||||
*
|
||||
* }
|
||||
*/
|
||||
for (PlaceHolder<VotingPluginUser> placeholder : placeholders) {
|
||||
if (placeholder.matches(toCache)) {
|
||||
placeholder.setUseCache(true, toCache);
|
||||
@@ -968,27 +1105,24 @@ public class PlaceHolders {
|
||||
@Override
|
||||
public void run() {
|
||||
checkNonCachedPlaceholders();
|
||||
onUpdate(user);
|
||||
onUpdate(user, user.isOnline());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
checkNonCachedPlaceholders();
|
||||
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : nonPlayerPlaceholders) {
|
||||
if (placeholder.isUsesCache()) {
|
||||
for (String ident : placeholder.getCache().keySet()) {
|
||||
if (ident != null) {
|
||||
String str = placeholder.placeholderRequest(ident);
|
||||
if (str != null) {
|
||||
placeholder.getCache().put(ident, str);
|
||||
}
|
||||
} else {
|
||||
plugin.debug("ident null: " + placeholder.getIdentifier());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
onUpdate(plugin.getVotingPluginUserManager().getVotingPluginUser(p), true);
|
||||
}
|
||||
/*
|
||||
* for (NonPlayerPlaceHolder<VotingPluginUser> placeholder :
|
||||
* nonPlayerPlaceholders) { if (placeholder.isUsesCache()) { for (String ident :
|
||||
* placeholder.getCache().keySet()) { if (ident != null) { String str =
|
||||
* placeholder.placeholderRequest(ident); if (str != null) {
|
||||
* placeholder.getCache().put(ident, str); } } else {
|
||||
* plugin.debug("ident null: " + placeholder.getIdentifier()); } } } }
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.bencodez.votingplugin.placeholders;
|
||||
|
||||
public enum PlaceholderCacheLevel {
|
||||
NONE, SPECIFC, AUTO;
|
||||
NONE, SPECIFIC, AUTO, AUTOALL, SPECIFICALL;
|
||||
|
||||
public static PlaceholderCacheLevel getCache(String str) {
|
||||
for (PlaceholderCacheLevel v : PlaceholderCacheLevel.values()) {
|
||||
@@ -12,14 +12,28 @@ public enum PlaceholderCacheLevel {
|
||||
return AUTO;
|
||||
}
|
||||
|
||||
public boolean onlineOnly() {
|
||||
if (this == AUTOALL) {
|
||||
return false;
|
||||
}
|
||||
if (this == SPECIFICALL) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean shouldCache() {
|
||||
switch (this) {
|
||||
case AUTO:
|
||||
return true;
|
||||
case NONE:
|
||||
return false;
|
||||
case SPECIFC:
|
||||
case SPECIFIC:
|
||||
return false;
|
||||
case SPECIFICALL:
|
||||
return false;
|
||||
case AUTOALL:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.bencodez.votingplugin.placeholders;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
|
||||
public class VotingPluginExpansion extends PlaceholderExpansion {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public VotingPluginExpansion(VotingPluginMain plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAuthor() {
|
||||
return "bencodez";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "votingplugin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return "1.6";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean persist() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onRequest(OfflinePlayer p, String indendifier) {
|
||||
return plugin.getPlaceholders().getPlaceHolder(p, indendifier);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.bencodez.votingplugin.signs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@@ -111,7 +110,7 @@ public class SignHandler {
|
||||
* Check valid sign.
|
||||
*/
|
||||
public void checkValidSign() {
|
||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||
plugin.getBukkitScheduler().runTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -121,7 +120,7 @@ public class SignHandler {
|
||||
setValid(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, getLocation());
|
||||
|
||||
}
|
||||
|
||||
@@ -240,8 +239,9 @@ public class SignHandler {
|
||||
* @param delay the delay
|
||||
*/
|
||||
public void updateSign(int delay) {
|
||||
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
|
||||
plugin.getBukkitScheduler().runTaskLater(plugin, new Runnable() {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
@@ -261,7 +261,7 @@ public class SignHandler {
|
||||
VotingPluginMain.plugin.debug(ex);
|
||||
}
|
||||
}
|
||||
}, delay);
|
||||
}, delay, getLocation());
|
||||
}
|
||||
|
||||
public void updateSkulls(Location loc1, Location loc2) {
|
||||
|
||||
@@ -77,7 +77,7 @@ public class Signs {
|
||||
} else {
|
||||
getSigns().get(i).updateLines();
|
||||
getSigns().get(i).updateSign(time);
|
||||
time += 5;
|
||||
time += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,23 @@ public class SpecialRewards {
|
||||
return checkAllVotes;
|
||||
}
|
||||
|
||||
public void bungeeAllSitesCheck(VotingPluginUser user, int numberOfVotes, int num) {
|
||||
if (plugin.getBungeeSettings().isGiveExtraAllSitesRewards()) {
|
||||
int numberOfSites = plugin.getVoteSites().size();
|
||||
if (numberOfVotes >= numberOfSites * 2) {
|
||||
if (num > numberOfSites) {
|
||||
if (num % numberOfSites == 0) {
|
||||
// should give extra allsites?
|
||||
if (user.checkAllVotes()) {
|
||||
plugin.debug("Giving extra allsites reward from bungee");
|
||||
giveAllSitesRewards(user, user.isOnline(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkAlmostAllSites(VotingPluginUser user, boolean forceBungee) {
|
||||
boolean checkAllVotes = user.checkAlmostAllVotes();
|
||||
if (checkAllVotes) {
|
||||
|
||||
@@ -4,14 +4,11 @@ import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.bencodez.advancedcore.api.rewards.Reward;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardOptions;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.events.PlayerVoteEvent;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoter;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteTester {
|
||||
@@ -29,7 +26,7 @@ public class VoteTester {
|
||||
public void run() {
|
||||
long time1 = System.currentTimeMillis();
|
||||
ArrayList<Long> timesPerReward = new ArrayList<Long>();
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(name);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(name);
|
||||
Reward reward = plugin.getRewardHandler().getReward(rewardName);
|
||||
int rewardsGiven = 0;
|
||||
for (int i = 0; i < amount; i++) {
|
||||
@@ -52,7 +49,7 @@ public class VoteTester {
|
||||
VotingPluginMain.plugin.getLogger()
|
||||
.info("Time to process rewards (" + amount + "): " + time + " ms, average per reward "
|
||||
+ timePerRewardAvg + " ms. " + VotingPluginMain.plugin.getStorageType() + ", "
|
||||
+ UserManager.getInstance().getAllUUIDs().size() + " users. " + rewardsGiven
|
||||
+ plugin.getVotingPluginUserManager().getAllUUIDs().size() + " users. " + rewardsGiven
|
||||
+ " rewards given");
|
||||
}
|
||||
|
||||
@@ -126,7 +123,7 @@ public class VoteTester {
|
||||
VotingPluginMain.plugin.getLogger()
|
||||
.info("Time to process votes (" + amount + "): " + time + " ms, average per vote "
|
||||
+ timePerVoteAvg + " ms. " + VotingPluginMain.plugin.getStorageType() + ", "
|
||||
+ UserManager.getInstance().getAllUUIDs().size() + " users. "
|
||||
+ plugin.getVotingPluginUserManager().getAllUUIDs().size() + " users. "
|
||||
+ VotingPluginMain.plugin.getVoteSites().size() + " votesites");
|
||||
}
|
||||
|
||||
@@ -136,7 +133,7 @@ public class VoteTester {
|
||||
|
||||
public void testSpam(int amount, String name, String site) {
|
||||
for (int i = 0; i < amount; i++) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
plugin.getBukkitScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -83,16 +83,16 @@ public enum TopVoter {
|
||||
if (switchItems != null && !switchItems.isEmpty()) {
|
||||
list.addAll(switchItems);
|
||||
} else {
|
||||
if (VotingPluginMain.plugin.getConfigFile().getLoadTopVoterAllTime()) {
|
||||
if (VotingPluginMain.plugin.getConfigFile().isLoadTopVoterAllTime()) {
|
||||
list.add(TopVoter.AllTime);
|
||||
}
|
||||
if (VotingPluginMain.plugin.getConfigFile().getLoadTopVoterMonthly()) {
|
||||
if (VotingPluginMain.plugin.getConfigFile().isLoadTopVoterMonthly()) {
|
||||
list.add(TopVoter.Monthly);
|
||||
}
|
||||
if (VotingPluginMain.plugin.getConfigFile().getLoadTopVoterWeekly()) {
|
||||
if (VotingPluginMain.plugin.getConfigFile().isLoadTopVoterWeekly()) {
|
||||
list.add(TopVoter.Weekly);
|
||||
}
|
||||
if (VotingPluginMain.plugin.getConfigFile().getLoadTopVoterDaily()) {
|
||||
if (VotingPluginMain.plugin.getConfigFile().isLoadTopVoterDaily()) {
|
||||
list.add(TopVoter.Daily);
|
||||
}
|
||||
}
|
||||
@@ -114,16 +114,16 @@ public enum TopVoter {
|
||||
if (switchItems != null && !switchItems.isEmpty()) {
|
||||
list.addAll(switchItems);
|
||||
} else {
|
||||
if (VotingPluginMain.plugin.getConfigFile().getLoadTopVoterAllTime()) {
|
||||
if (VotingPluginMain.plugin.getConfigFile().isLoadTopVoterAllTime()) {
|
||||
list.add(TopVoter.AllTime);
|
||||
}
|
||||
if (VotingPluginMain.plugin.getConfigFile().getLoadTopVoterMonthly()) {
|
||||
if (VotingPluginMain.plugin.getConfigFile().isLoadTopVoterMonthly()) {
|
||||
list.add(TopVoter.Monthly);
|
||||
}
|
||||
if (VotingPluginMain.plugin.getConfigFile().getLoadTopVoterWeekly()) {
|
||||
if (VotingPluginMain.plugin.getConfigFile().isLoadTopVoterWeekly()) {
|
||||
list.add(TopVoter.Weekly);
|
||||
}
|
||||
if (VotingPluginMain.plugin.getConfigFile().getLoadTopVoterDaily()) {
|
||||
if (VotingPluginMain.plugin.getConfigFile().isLoadTopVoterDaily()) {
|
||||
list.add(TopVoter.Daily);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.bencodez.advancedcore.api.user.userstorage.Column;
|
||||
import com.bencodez.advancedcore.api.user.userstorage.DataType;
|
||||
import com.bencodez.advancedcore.api.yml.YMLFileHandler;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class TopVoterHandler implements Listener {
|
||||
@@ -55,7 +54,7 @@ public class TopVoterHandler implements Listener {
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
ArrayList<TopVoterPlayer> users = plugin.convertSet(plugin.getTopVoter(TopVoter.Weekly).keySet());
|
||||
for (int i = 0; i < users.size(); i++) {
|
||||
String line = plugin.getConfigFile().getFormatCommandVoteTopLine().replace("%num%", "" + (i + 1))
|
||||
String line = plugin.getConfigFile().getFormatCommandsVoteTopLine().replace("%num%", "" + (i + 1))
|
||||
.replace("%player%", users.get(i).getPlayerName())
|
||||
.replace("%votes%", "" + plugin.getTopVoter(TopVoter.Weekly).get(users.get(i)));
|
||||
msg.add(line);
|
||||
@@ -94,7 +93,8 @@ public class TopVoterHandler implements Listener {
|
||||
String uuid = playerData.getKey().toString();
|
||||
if (plugin != null && plugin.isEnabled()) {
|
||||
if (uuid != null && !uuid.isEmpty()) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid));
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager()
|
||||
.getVotingPluginUser(UUID.fromString(uuid), false);
|
||||
user.dontCache();
|
||||
user.updateTempCacheWithColumns(playerData.getValue());
|
||||
cols.put(playerData.getKey(), null);
|
||||
@@ -132,7 +132,7 @@ public class TopVoterHandler implements Listener {
|
||||
public void onDayChange(DayChangeEvent event) {
|
||||
synchronized (VotingPluginMain.plugin) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
if (plugin.getConfigFile().getStoreTopVotersDaily()) {
|
||||
if (plugin.getConfigFile().isStoreTopVotersDaily()) {
|
||||
plugin.getLogger().info("Saving TopVoters Daily");
|
||||
storeTopVoters(TopVoter.Daily);
|
||||
}
|
||||
@@ -141,7 +141,8 @@ public class TopVoterHandler implements Listener {
|
||||
if (plugin.getConfigFile().isUseVoteStreaks() || plugin.getConfigFile().isUseHighestTotals()) {
|
||||
HashMap<UUID, ArrayList<Column>> cols = plugin.getUserManager().getAllKeys();
|
||||
for (Entry<UUID, ArrayList<Column>> playerData : cols.entrySet()) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(playerData.getKey(), false);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(playerData.getKey(),
|
||||
false);
|
||||
user.dontCache();
|
||||
user.updateTempCacheWithColumns(playerData.getValue());
|
||||
cols.put(playerData.getKey(), null);
|
||||
@@ -174,7 +175,7 @@ public class TopVoterHandler implements Listener {
|
||||
LinkedHashMap<TopVoterPlayer, Integer> clone = (LinkedHashMap<TopVoterPlayer, Integer>) plugin
|
||||
.getTopVoter(TopVoter.Daily).clone();
|
||||
for (Entry<TopVoterPlayer, Integer> entry : clone.entrySet()) {
|
||||
if (plugin.getConfigFile().getTopVoterAwardsTies()) {
|
||||
if (plugin.getConfigFile().isTopVoterAwardsTies()) {
|
||||
if (entry.getValue().intValue() != lastTotal) {
|
||||
i++;
|
||||
}
|
||||
@@ -184,8 +185,10 @@ public class TopVoterHandler implements Listener {
|
||||
if (places.containsKey(i)) {
|
||||
VotingPluginUser user = entry.getKey().getUser();
|
||||
user.dontCache();
|
||||
if (!plugin.getConfigFile().getTopVoterIgnorePermission() || !user.isTopVoterIgnore()) {
|
||||
if (!plugin.getConfigFile().isTopVoterIgnorePermission() || !user.isTopVoterIgnore()) {
|
||||
user.giveDailyTopVoterAward(i, places.get(i));
|
||||
plugin.getLogger().info(
|
||||
"Giving daily top voter reward " + i + " to " + entry.getKey().getPlayerName());
|
||||
}
|
||||
}
|
||||
lastTotal = entry.getValue().intValue();
|
||||
@@ -202,7 +205,7 @@ public class TopVoterHandler implements Listener {
|
||||
}
|
||||
|
||||
// give time for other servers to catch up
|
||||
if (!plugin.getTopVoterHandler().bungeeHandleResets()) {
|
||||
if (!plugin.getTopVoterHandler().bungeeHandleResets() && plugin.getBungeeSettings().isUseBungeecoord()) {
|
||||
plugin.debug("Delaying time change 10 seconds for other servers to catchup");
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
@@ -236,7 +239,8 @@ public class TopVoterHandler implements Listener {
|
||||
if (plugin.getConfigFile().isUseHighestTotals() || plugin.getConfigFile().isUseVoteStreaks()) {
|
||||
HashMap<UUID, ArrayList<Column>> cols = plugin.getUserManager().getAllKeys();
|
||||
for (Entry<UUID, ArrayList<Column>> playerData : cols.entrySet()) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(playerData.getKey(), false);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(playerData.getKey(),
|
||||
false);
|
||||
user.dontCache();
|
||||
user.updateTempCacheWithColumns(playerData.getValue());
|
||||
cols.put(playerData.getKey(), null);
|
||||
@@ -281,7 +285,7 @@ public class TopVoterHandler implements Listener {
|
||||
LinkedHashMap<TopVoterPlayer, Integer> clone = (LinkedHashMap<TopVoterPlayer, Integer>) plugin
|
||||
.getTopVoter(TopVoter.Monthly).clone();
|
||||
for (Entry<TopVoterPlayer, Integer> entry : clone.entrySet()) {
|
||||
if (plugin.getConfigFile().getTopVoterAwardsTies()) {
|
||||
if (plugin.getConfigFile().isTopVoterAwardsTies()) {
|
||||
if (entry.getValue().intValue() != lastTotal) {
|
||||
i++;
|
||||
}
|
||||
@@ -292,8 +296,10 @@ public class TopVoterHandler implements Listener {
|
||||
if (places.containsKey(i)) {
|
||||
VotingPluginUser user = entry.getKey().getUser();
|
||||
user.dontCache();
|
||||
if (!plugin.getConfigFile().getTopVoterIgnorePermission() || !user.isTopVoterIgnore()) {
|
||||
if (!plugin.getConfigFile().isTopVoterIgnorePermission() || !user.isTopVoterIgnore()) {
|
||||
user.giveMonthlyTopVoterAward(i, places.get(i));
|
||||
plugin.getLogger().info("Giving Monthly top voter reward " + i + " to "
|
||||
+ entry.getKey().getPlayerName());
|
||||
}
|
||||
}
|
||||
lastTotal = entry.getValue().intValue();
|
||||
@@ -304,7 +310,7 @@ public class TopVoterHandler implements Listener {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (plugin.getSpecialRewardsConfig().getResetMilestonesMonthly()) {
|
||||
if (plugin.getSpecialRewardsConfig().isResetMilestonesMonthly()) {
|
||||
resetMilestoneCount();
|
||||
resetGottenMilestones();
|
||||
}
|
||||
@@ -316,7 +322,7 @@ public class TopVoterHandler implements Listener {
|
||||
}
|
||||
|
||||
// give time for other servers to catch up
|
||||
if (!bungeeHandleResets()) {
|
||||
if (!bungeeHandleResets() && plugin.getBungeeSettings().isUseBungeecoord()) {
|
||||
plugin.debug("Delaying time change 10 seconds for other servers to catchup");
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
@@ -346,7 +352,7 @@ public class TopVoterHandler implements Listener {
|
||||
public void onWeekChange(WeekChangeEvent event) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
synchronized (VotingPluginMain.plugin) {
|
||||
if (plugin.getConfigFile().getStoreTopVotersWeekly()) {
|
||||
if (plugin.getConfigFile().isStoreTopVotersWeekly()) {
|
||||
plugin.getLogger().info("Saving TopVoters Weekly");
|
||||
storeTopVoters(TopVoter.Weekly);
|
||||
}
|
||||
@@ -356,7 +362,8 @@ public class TopVoterHandler implements Listener {
|
||||
if (plugin.getConfigFile().isUseVoteStreaks() || plugin.getConfigFile().isUseHighestTotals()) {
|
||||
HashMap<UUID, ArrayList<Column>> cols = plugin.getUserManager().getAllKeys();
|
||||
for (Entry<UUID, ArrayList<Column>> playerData : cols.entrySet()) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(playerData.getKey(), false);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(playerData.getKey(),
|
||||
false);
|
||||
user.dontCache();
|
||||
user.updateTempCacheWithColumns(playerData.getValue());
|
||||
cols.put(playerData.getKey(), null);
|
||||
@@ -395,7 +402,7 @@ public class TopVoterHandler implements Listener {
|
||||
LinkedHashMap<TopVoterPlayer, Integer> clone = (LinkedHashMap<TopVoterPlayer, Integer>) plugin
|
||||
.getTopVoter(TopVoter.Weekly).clone();
|
||||
for (Entry<TopVoterPlayer, Integer> entry : clone.entrySet()) {
|
||||
if (plugin.getConfigFile().getTopVoterAwardsTies()) {
|
||||
if (plugin.getConfigFile().isTopVoterAwardsTies()) {
|
||||
if (entry.getValue().intValue() != lastTotal) {
|
||||
i++;
|
||||
}
|
||||
@@ -405,9 +412,10 @@ public class TopVoterHandler implements Listener {
|
||||
if (places.containsKey(i)) {
|
||||
VotingPluginUser user = entry.getKey().getUser();
|
||||
user.dontCache();
|
||||
if (!plugin.getConfigFile().getTopVoterIgnorePermission() || !user.isTopVoterIgnore()) {
|
||||
|
||||
if (!plugin.getConfigFile().isTopVoterIgnorePermission() || !user.isTopVoterIgnore()) {
|
||||
user.giveWeeklyTopVoterAward(i, places.get(i));
|
||||
plugin.getLogger().info("Giving weekly top voter reward " + i + " to "
|
||||
+ entry.getKey().getPlayerName());
|
||||
}
|
||||
}
|
||||
lastTotal = entry.getValue().intValue();
|
||||
@@ -424,7 +432,7 @@ public class TopVoterHandler implements Listener {
|
||||
}
|
||||
|
||||
// give time for other servers to catch up
|
||||
if (!plugin.getTopVoterHandler().bungeeHandleResets()) {
|
||||
if (!plugin.getTopVoterHandler().bungeeHandleResets() && plugin.getBungeeSettings().isUseBungeecoord()) {
|
||||
plugin.debug("Delaying time change 10 seconds for other servers to catchup");
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
@@ -565,7 +573,7 @@ public class TopVoterHandler implements Listener {
|
||||
ArrayList<String> topVoters = new ArrayList<String>();
|
||||
int count = 1;
|
||||
for (Entry<TopVoterPlayer, Integer> entry : plugin.getTopVoter(TopVoter.AllTime).entrySet()) {
|
||||
String line = plugin.getConfigFile().getFormatCommandVoteTopLine();
|
||||
String line = plugin.getConfigFile().getFormatCommandsVoteTopLine();
|
||||
line = line.replace("%num%", "" + count);
|
||||
line = line.replace("%player%", entry.getKey().getPlayerName());
|
||||
line = line.replace("%votes%", "" + entry.getValue());
|
||||
@@ -604,7 +612,7 @@ public class TopVoterHandler implements Listener {
|
||||
ArrayList<String> topVoters = new ArrayList<String>();
|
||||
int count = 1;
|
||||
for (Entry<TopVoterPlayer, Integer> entry : plugin.getTopVoter(TopVoter.Daily).entrySet()) {
|
||||
String line = plugin.getConfigFile().getFormatCommandVoteTopLine();
|
||||
String line = plugin.getConfigFile().getFormatCommandsVoteTopLine();
|
||||
line = line.replace("%num%", "" + count);
|
||||
line = line.replace("%player%", entry.getKey().getPlayerName());
|
||||
line = line.replace("%votes%", "" + entry.getValue());
|
||||
@@ -643,7 +651,7 @@ public class TopVoterHandler implements Listener {
|
||||
ArrayList<String> topVoters = new ArrayList<String>();
|
||||
int count = 1;
|
||||
for (Entry<TopVoterPlayer, Integer> entry : plugin.getTopVoter(TopVoter.Monthly).entrySet()) {
|
||||
String line = plugin.getConfigFile().getFormatCommandVoteTopLine();
|
||||
String line = plugin.getConfigFile().getFormatCommandsVoteTopLine();
|
||||
line = line.replace("%num%", "" + count);
|
||||
line = line.replace("%player%", entry.getKey().getPlayerName());
|
||||
line = line.replace("%votes%", "" + entry.getValue());
|
||||
@@ -763,7 +771,7 @@ public class TopVoterHandler implements Listener {
|
||||
ArrayList<String> topVoters = new ArrayList<String>();
|
||||
int count = 1;
|
||||
for (Entry<TopVoterPlayer, Integer> entry : plugin.getTopVoter(TopVoter.Weekly).entrySet()) {
|
||||
String line = plugin.getConfigFile().getFormatCommandVoteTopLine();
|
||||
String line = plugin.getConfigFile().getFormatCommandsVoteTopLine();
|
||||
line = line.replace("%num%", "" + count);
|
||||
line = line.replace("%player%", entry.getKey().getPlayerName());
|
||||
line = line.replace("%votes%", "" + entry.getValue());
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.UUID;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.bencodez.advancedcore.api.misc.PlayerUtils;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
import lombok.Getter;
|
||||
@@ -34,6 +34,6 @@ public class TopVoterPlayer {
|
||||
}
|
||||
|
||||
public VotingPluginUser getUser() {
|
||||
return UserManager.getInstance().getVotingPluginUser(getUuid(), getPlayerName());
|
||||
return VotingPluginMain.plugin.getVotingPluginUserManager().getVotingPluginUser(getUuid(), getPlayerName());
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,6 @@ package com.bencodez.votingplugin.updater;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.bencodez.advancedcore.api.updater.Updater;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
@@ -74,7 +72,7 @@ public class CheckUpdate {
|
||||
if (plugin.getConfigFile().isDisableUpdateChecking()) {
|
||||
return;
|
||||
}
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
plugin.getBukkitScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -88,7 +86,7 @@ public class CheckUpdate {
|
||||
}, 1000 * 60 * 1200, 1000 * 60 * 1200);
|
||||
|
||||
}
|
||||
}, 10l);
|
||||
}, 10);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,34 +7,36 @@ import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.bencodez.advancedcore.api.user.usercache.UserDataManager;
|
||||
import com.bencodez.advancedcore.api.user.usercache.keys.UserDataKeyBoolean;
|
||||
import com.bencodez.advancedcore.api.user.usercache.keys.UserDataKeyInt;
|
||||
import com.bencodez.advancedcore.api.user.usercache.keys.UserDataKeyString;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
public class UserManager {
|
||||
/** The instance. */
|
||||
static UserManager instance = new UserManager();
|
||||
/** The plugin. */
|
||||
static VotingPluginMain plugin = VotingPluginMain.plugin;
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
/**
|
||||
* Gets the single instance of UserManager.
|
||||
*
|
||||
* @return single instance of UserManager
|
||||
*/
|
||||
public UserManager(VotingPluginMain plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public UserManager() {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
static UserManager instance = new UserManager();
|
||||
|
||||
@Deprecated
|
||||
public static UserManager getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public UserManager() {
|
||||
}
|
||||
|
||||
public void addCachingKeys() {
|
||||
UserDataManager manager = plugin.getUserManager().getDataManager();
|
||||
manager.addKey(new UserDataKeyString("TopVoterIgnore").setColumnType("VARCHAR(5)"));
|
||||
manager.addKey(new UserDataKeyBoolean("TopVoterIgnore"));
|
||||
manager.addKey(new UserDataKeyInt("VotePartyVotes"));
|
||||
manager.addKey(new UserDataKeyString("LastVotes"));
|
||||
manager.addKey(new UserDataKeyString("CoolDownCheck").setColumnType("VARCHAR(5)"));
|
||||
manager.addKey(new UserDataKeyBoolean(getCoolDownCheckPath()));
|
||||
manager.addKey(new UserDataKeyString("OfflineVotes").setColumnType("MEDIUMTEXT"));
|
||||
manager.addKey(new UserDataKeyInt("MilestoneCount"));
|
||||
manager.addKey(new UserDataKeyInt("MonthTotal"));
|
||||
@@ -46,8 +48,8 @@ public class UserManager {
|
||||
manager.addKey(new UserDataKeyInt("BestDayVoteStreak"));
|
||||
manager.addKey(new UserDataKeyString("DayVoteStreakLastUpdate").setColumnType("MEDIUMTEXT"));
|
||||
manager.addKey(new UserDataKeyString("GottenMileStones").setColumnType("LONGTEXT"));
|
||||
manager.addKey(new UserDataKeyString("Reminded").setColumnType("VARCHAR(5)"));
|
||||
manager.addKey(new UserDataKeyString("DisableBroadcast").setColumnType("VARCHAR(5)"));
|
||||
manager.addKey(new UserDataKeyBoolean("Reminded"));
|
||||
manager.addKey(new UserDataKeyBoolean("DisableBroadcast"));
|
||||
manager.addKey(new UserDataKeyInt("WeekVoteStreak"));
|
||||
manager.addKey(new UserDataKeyInt("BestWeekVoteStreak"));
|
||||
manager.addKey(new UserDataKeyInt("MonthVoteStreak"));
|
||||
@@ -58,6 +60,7 @@ public class UserManager {
|
||||
manager.addKey(new UserDataKeyInt("LastWeeklyTotal"));
|
||||
manager.addKey(new UserDataKeyInt("LastDailyTotal"));
|
||||
manager.addKey(new UserDataKeyInt("BestMonthVoteStreak"));
|
||||
manager.addKey(new UserDataKeyString(getCoolDownCheckSitePath()).setColumnType("LONGTEXT"));
|
||||
if (plugin.getOptions().isPerServerRewards()) {
|
||||
manager.addKey(new UserDataKeyString("OfflineRewards" + plugin.getOptions().getServer())
|
||||
.setColumnType("MEDIUMTEXT"));
|
||||
@@ -82,6 +85,22 @@ public class UserManager {
|
||||
return "AlmostAllSitesLast";
|
||||
}
|
||||
|
||||
public String getCoolDownCheckSitePath() {
|
||||
if (plugin.getBungeeSettings().isUseBungeecoord()) {
|
||||
return "CoolDownCheck_" + plugin.getBungeeSettings().getServerNameStorage() + "_Sites";
|
||||
} else {
|
||||
return "CoolDownCheck" + "_Sites";
|
||||
}
|
||||
}
|
||||
|
||||
public String getCoolDownCheckPath() {
|
||||
if (plugin.getBungeeSettings().isUseBungeecoord()) {
|
||||
return "CoolDownCheck_" + plugin.getBungeeSettings().getServerNameStorage();
|
||||
} else {
|
||||
return "CoolDownCheck";
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<String> getAllUUIDs() {
|
||||
return plugin.getUserManager().getAllUUIDs();
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -116,7 +116,11 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
* @param value the value
|
||||
* @return current total points
|
||||
*/
|
||||
public synchronized int addPoints(int value) {
|
||||
public int addPoints(int value) {
|
||||
return addPoints(value, false);
|
||||
}
|
||||
|
||||
public synchronized int addPoints(int value, boolean async) {
|
||||
PlayerReceivePointsEvent event = new PlayerReceivePointsEvent(this, value);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
@@ -124,7 +128,7 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
return getPoints();
|
||||
}
|
||||
int newTotal = getPoints() + event.getPoints();
|
||||
setPoints(newTotal);
|
||||
setPoints(newTotal, async);
|
||||
return newTotal;
|
||||
}
|
||||
|
||||
@@ -272,21 +276,19 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
|
||||
return now.isAfter(nextvote);
|
||||
} else {
|
||||
LocalDateTime offsetoclockyesterday = plugin.getTimeChecker().getTime().plusDays(-1).withHour(0)
|
||||
.withMinute(0).plusHours((long) voteSite.getTimeOffSet());
|
||||
LocalDateTime offsetoclocktoday = plugin.getTimeChecker().getTime().withHour(0).withMinute(0)
|
||||
.plusHours((long) voteSite.getTimeOffSet());
|
||||
LocalDateTime resetTime = plugin.getTimeChecker().getTime().withHour(voteSite.getVoteDelayDailyHour())
|
||||
.withMinute(0).withSecond(0);
|
||||
LocalDateTime resetTimeTomorrow = resetTime.plusHours(24);
|
||||
|
||||
if (!now.isBefore(offsetoclocktoday)) {
|
||||
if (!lastVote.isBefore(offsetoclocktoday)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
if (lastVote.isBefore(resetTimeTomorrow)) {
|
||||
if (lastVote.isBefore(resetTime)) {
|
||||
if (now.isAfter(resetTime)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!lastVote.isBefore(offsetoclockyesterday)) {
|
||||
return false;
|
||||
} else {
|
||||
if (now.isAfter(resetTimeTomorrow)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -447,8 +449,8 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
return getData().getInt("LastMonthTotal", isCacheData(), isWaitForCache());
|
||||
}
|
||||
|
||||
public HashMap<VoteSite, Boolean> getCoolDownCheckSiteList() {
|
||||
HashMap<VoteSite, Boolean> coolDownChecks = new HashMap<VoteSite, Boolean>();
|
||||
public HashMap<String, Boolean> getCoolDownCheckSiteList() {
|
||||
HashMap<String, Boolean> coolDownChecks = new HashMap<String, Boolean>();
|
||||
ArrayList<String> coolDownCheck = getData().getStringList(getCoolDownCheckSitePath(), isCacheData(),
|
||||
isWaitForCache());
|
||||
for (String str : coolDownCheck) {
|
||||
@@ -457,7 +459,7 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
VoteSite site = plugin.getVoteSite(data[0], true);
|
||||
if (site != null) {
|
||||
Boolean b = Boolean.valueOf(data[1]);
|
||||
coolDownChecks.put(site, b);
|
||||
coolDownChecks.put(site.getKey(), b);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -465,9 +467,9 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
}
|
||||
|
||||
public boolean getCoolDownCheckSite(VoteSite site) {
|
||||
HashMap<VoteSite, Boolean> coolDownChecks = getCoolDownCheckSiteList();
|
||||
if (coolDownChecks.containsKey(site)) {
|
||||
return coolDownChecks.get(site).booleanValue();
|
||||
HashMap<String, Boolean> coolDownChecks = getCoolDownCheckSiteList();
|
||||
if (coolDownChecks.containsKey(site.getKey())) {
|
||||
return coolDownChecks.get(site.getKey()).booleanValue();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -706,7 +708,7 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
* Login message.
|
||||
*/
|
||||
public void loginMessage() {
|
||||
if (plugin.getConfigFile().getVoteRemindingRemindOnLogin()) {
|
||||
if (plugin.getConfigFile().isVoteRemindingRemindOnLogin()) {
|
||||
plugin.getVoteReminding().runRemindLogin(this);
|
||||
}
|
||||
}
|
||||
@@ -799,7 +801,7 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
bc = StringParser.getInstance().replacePlaceHolders(user.getOfflinePlayer(), bc);
|
||||
ArrayList<Player> players = new ArrayList<Player>();
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (!UserManager.getInstance().getVotingPluginUser(p).getDisableBroadcast()) {
|
||||
if (!plugin.getVotingPluginUserManager().getVotingPluginUser(p).getDisableBroadcast()) {
|
||||
players.add(p);
|
||||
}
|
||||
}
|
||||
@@ -812,7 +814,7 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
}
|
||||
|
||||
public void playerVote(VoteSite voteSite, boolean online, boolean broadcast, boolean bungee) {
|
||||
if (plugin.getConfigFile().getFormatBroadcastWhenOnline() && plugin.getConfigFile().isBroadcastVotesEnabled()
|
||||
if (plugin.getConfigFile().isFormatBroadcastWhenOnline() && plugin.getConfigFile().isBroadcastVotesEnabled()
|
||||
&& broadcast && !plugin.getBungeeSettings().isDisableBroadcast()) {
|
||||
voteSite.broadcastVote(this);
|
||||
}
|
||||
@@ -833,6 +835,14 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean removePoints(int points, boolean async) {
|
||||
if (getPoints() >= points) {
|
||||
setPoints(getPoints() - points, async);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void resetTotals(TopVoter topVoter) {
|
||||
setTotal(topVoter, 0);
|
||||
}
|
||||
@@ -939,18 +949,18 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
getUserData().setStringList("LastVotes", data);
|
||||
}
|
||||
|
||||
public void setCoolDownCheckSite(HashMap<VoteSite, Boolean> coolDownChecks) {
|
||||
public void setCoolDownCheckSite(HashMap<String, Boolean> coolDownChecks) {
|
||||
ArrayList<String> data = new ArrayList<String>();
|
||||
for (Entry<VoteSite, Boolean> entry : coolDownChecks.entrySet()) {
|
||||
String str = entry.getKey().getKey() + "//" + entry.getValue().toString();
|
||||
for (Entry<String, Boolean> entry : coolDownChecks.entrySet()) {
|
||||
String str = entry.getKey() + "//" + entry.getValue().toString();
|
||||
data.add(str);
|
||||
}
|
||||
getUserData().setStringList(getCoolDownCheckSitePath(), data);
|
||||
}
|
||||
|
||||
public void setCoolDownCheckSite(VoteSite site, boolean value) {
|
||||
HashMap<VoteSite, Boolean> coolDownChecks = getCoolDownCheckSiteList();
|
||||
coolDownChecks.put(site, Boolean.valueOf(value));
|
||||
HashMap<String, Boolean> coolDownChecks = getCoolDownCheckSiteList();
|
||||
coolDownChecks.put(site.getKey(), Boolean.valueOf(value));
|
||||
setCoolDownCheckSite(coolDownChecks);
|
||||
}
|
||||
|
||||
@@ -1007,6 +1017,10 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
getUserData().setInt(getPointsPath(), value, false);
|
||||
}
|
||||
|
||||
public void setPoints(int value, boolean async) {
|
||||
getUserData().setInt(getPointsPath(), value, false, async);
|
||||
}
|
||||
|
||||
public void setPrimaryAccount(java.util.UUID uuid) {
|
||||
if (uuid != null) {
|
||||
getData().setString("PrimaryAccount", uuid.toString());
|
||||
@@ -1193,14 +1207,16 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
info += " ";
|
||||
}
|
||||
|
||||
if (diffSeconds == 1) {
|
||||
info += StringParser.getInstance().replacePlaceHolder(StringParser.getInstance().replacePlaceHolder(
|
||||
plugin.getConfigFile().getFormatCommandsVoteLastTimeFormat(), "TimeType",
|
||||
plugin.getConfigFile().getFormatTimeFormatsSecond()), "amount", "" + diffSeconds);
|
||||
} else {
|
||||
info += StringParser.getInstance().replacePlaceHolder(StringParser.getInstance().replacePlaceHolder(
|
||||
plugin.getConfigFile().getFormatCommandsVoteLastTimeFormat(), "TimeType",
|
||||
plugin.getConfigFile().getFormatTimeFormatsSeconds()), "amount", "" + diffSeconds);
|
||||
if (plugin.getConfigFile().isFormatCommandsVoteLastIncludeSeconds()) {
|
||||
if (diffSeconds == 1) {
|
||||
info += StringParser.getInstance().replacePlaceHolder(StringParser.getInstance().replacePlaceHolder(
|
||||
plugin.getConfigFile().getFormatCommandsVoteLastTimeFormat(), "TimeType",
|
||||
plugin.getConfigFile().getFormatTimeFormatsSecond()), "amount", "" + diffSeconds);
|
||||
} else {
|
||||
info += StringParser.getInstance().replacePlaceHolder(StringParser.getInstance().replacePlaceHolder(
|
||||
plugin.getConfigFile().getFormatCommandsVoteLastTimeFormat(), "TimeType",
|
||||
plugin.getConfigFile().getFormatTimeFormatsSeconds()), "amount", "" + diffSeconds);
|
||||
}
|
||||
}
|
||||
|
||||
info = StringParser.getInstance()
|
||||
@@ -1237,106 +1253,43 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
}
|
||||
|
||||
public String voteCommandNextInfo(VoteSite voteSite) {
|
||||
return voteCommandNextInfo(voteSite, getTime(voteSite));
|
||||
}
|
||||
|
||||
public String voteCommandNextInfo(VoteSite voteSite, long time) {
|
||||
String info = new String();
|
||||
|
||||
long time = getTime(voteSite);
|
||||
LocalDateTime now = plugin.getTimeChecker().getTime();
|
||||
|
||||
LocalDateTime lastVote = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault())
|
||||
.plusHours(plugin.getOptions().getTimeHourOffSet());
|
||||
|
||||
if (!voteSite.isVoteDelayDaily()) {
|
||||
double votedelay = voteSite.getVoteDelay();
|
||||
if (votedelay == 0 && voteSite.getVoteDelayMin() == 0) {
|
||||
String errorMsg = plugin.getConfigFile().getFormatCommandsVoteNextInfoError();
|
||||
info = errorMsg;
|
||||
} else {
|
||||
|
||||
LocalDateTime nextvote = lastVote.plusHours((long) votedelay)
|
||||
.plusMinutes((long) voteSite.getVoteDelayMin());
|
||||
|
||||
if (time == 0 || now.isAfter(nextvote)) {
|
||||
info = plugin.getConfigFile().getFormatCommandsVoteNextInfoCanVote();
|
||||
} else {
|
||||
Duration dur = Duration.between(now, nextvote);
|
||||
|
||||
long diffHours = dur.getSeconds() / (60 * 60);
|
||||
long diffMinutes = dur.getSeconds() / 60 - diffHours * 60;
|
||||
|
||||
String timeMsg = plugin.getConfigFile().getFormatCommandsVoteNextInfoTime();
|
||||
timeMsg = StringParser.getInstance().replaceIgnoreCase(timeMsg, "%hours%",
|
||||
Long.toString(diffHours));
|
||||
timeMsg = StringParser.getInstance().replaceIgnoreCase(timeMsg, "%minutes%",
|
||||
Long.toString(diffMinutes));
|
||||
info = timeMsg;
|
||||
|
||||
}
|
||||
}
|
||||
long nextTime = voteNextDurationTime(voteSite, time);
|
||||
if (nextTime == 0) {
|
||||
info = plugin.getConfigFile().getFormatCommandsVoteNextInfoCanVote();
|
||||
} else {
|
||||
LocalDateTime offsetoclockyesterday = plugin.getTimeChecker().getTime().plusDays(-1).withHour(0)
|
||||
.withMinute(0).plusHours((long) voteSite.getTimeOffSet());
|
||||
LocalDateTime offsetoclocktoday = plugin.getTimeChecker().getTime().withHour(0).withMinute(0)
|
||||
.plusHours((long) voteSite.getTimeOffSet());
|
||||
LocalDateTime offsetoclocktomorrow = plugin.getTimeChecker().getTime().plusDays(1).withHour(0).withMinute(0)
|
||||
.plusHours((long) voteSite.getTimeOffSet());
|
||||
int diffHours = (int) (nextTime / (60 * 60));
|
||||
long diffMinutes = nextTime / 60 - diffHours * 60;
|
||||
|
||||
if (!now.isBefore(offsetoclocktoday)) {
|
||||
if (!lastVote.isBefore(offsetoclocktoday)) {
|
||||
Duration dur = Duration.between(now, offsetoclocktomorrow);
|
||||
int diffHours = (int) (dur.getSeconds() / (60 * 60));
|
||||
long diffMinutes = dur.getSeconds() / 60 - diffHours * 60;
|
||||
|
||||
if (diffHours < 0) {
|
||||
diffHours = diffHours * -1;
|
||||
}
|
||||
if (diffHours >= 24) {
|
||||
diffHours = diffHours - 24;
|
||||
}
|
||||
if (diffMinutes < 0) {
|
||||
diffMinutes = diffMinutes * -1;
|
||||
}
|
||||
|
||||
String timeMsg = plugin.getConfigFile().getFormatCommandsVoteNextInfoVoteDelayDaily();
|
||||
timeMsg = StringParser.getInstance().replaceIgnoreCase(timeMsg, "%hours%",
|
||||
Integer.toString(diffHours));
|
||||
timeMsg = StringParser.getInstance().replaceIgnoreCase(timeMsg, "%minutes%",
|
||||
Long.toString(diffMinutes));
|
||||
info = timeMsg;
|
||||
} else {
|
||||
info = plugin.getConfigFile().getFormatCommandsVoteNextInfoCanVote();
|
||||
}
|
||||
} else {
|
||||
if (!lastVote.isBefore(offsetoclockyesterday)) {
|
||||
Duration dur = Duration.between(now, offsetoclocktoday);
|
||||
int diffHours = (int) (dur.getSeconds() / (60 * 60));
|
||||
long diffMinutes = dur.getSeconds() / 60 - diffHours * 60;
|
||||
|
||||
if (diffHours < 0) {
|
||||
diffHours = diffHours * -1;
|
||||
}
|
||||
if (diffHours >= 24) {
|
||||
diffHours = diffHours - 24;
|
||||
}
|
||||
if (diffMinutes < 0) {
|
||||
diffMinutes = diffMinutes * -1;
|
||||
}
|
||||
|
||||
String timeMsg = plugin.getConfigFile().getFormatCommandsVoteNextInfoVoteDelayDaily();
|
||||
timeMsg = StringParser.getInstance().replaceIgnoreCase(timeMsg, "%hours%",
|
||||
Integer.toString(diffHours));
|
||||
timeMsg = StringParser.getInstance().replaceIgnoreCase(timeMsg, "%minutes%",
|
||||
Long.toString(diffMinutes));
|
||||
info = timeMsg;
|
||||
} else {
|
||||
info = plugin.getConfigFile().getFormatCommandsVoteNextInfoCanVote();
|
||||
}
|
||||
if (diffHours < 0) {
|
||||
diffHours = diffHours * -1;
|
||||
}
|
||||
if (diffHours >= 24) {
|
||||
diffHours = diffHours - 24;
|
||||
}
|
||||
if (diffMinutes < 0) {
|
||||
diffMinutes = diffMinutes * -1;
|
||||
}
|
||||
|
||||
String timeMsg = plugin.getConfigFile().getFormatCommandsVoteNextInfoVoteDelayDaily();
|
||||
timeMsg = StringParser.getInstance().replaceIgnoreCase(timeMsg, "%hours%", Integer.toString(diffHours));
|
||||
timeMsg = StringParser.getInstance().replaceIgnoreCase(timeMsg, "%minutes%", Long.toString(diffMinutes));
|
||||
info = timeMsg;
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
public long voteNextDurationTime(VoteSite voteSite) {
|
||||
long time = getTime(voteSite);
|
||||
return voteNextDurationTime(voteSite, getTime(voteSite));
|
||||
}
|
||||
|
||||
public long voteNextDurationTime(VoteSite voteSite, long time) {
|
||||
LocalDateTime now = plugin.getTimeChecker().getTime();
|
||||
|
||||
LocalDateTime lastVote = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault())
|
||||
@@ -1358,28 +1311,22 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LocalDateTime offsetoclockyesterday = plugin.getTimeChecker().getTime().plusDays(-1).withHour(0)
|
||||
.withMinute(0).plusHours((long) voteSite.getTimeOffSet());
|
||||
LocalDateTime offsetoclocktoday = plugin.getTimeChecker().getTime().withHour(0).withMinute(0)
|
||||
.plusHours((long) voteSite.getTimeOffSet());
|
||||
LocalDateTime offsetoclocktomorrow = plugin.getTimeChecker().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);
|
||||
LocalDateTime resetTime = plugin.getTimeChecker().getTime().withHour(voteSite.getVoteDelayDailyHour())
|
||||
.withMinute(0).withSecond(0);
|
||||
LocalDateTime resetTimeTomorrow = resetTime.plusHours(24);
|
||||
if (lastVote.isBefore(resetTime)) {
|
||||
if (now.isBefore(resetTime)) {
|
||||
Duration dur = Duration.between(now, resetTime);
|
||||
return dur.getSeconds();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (!lastVote.isBefore(offsetoclockyesterday)) {
|
||||
Duration dur = Duration.between(now, offsetoclocktoday);
|
||||
} else if (lastVote.isBefore(resetTimeTomorrow)) {
|
||||
if (now.isBefore(resetTimeTomorrow)) {
|
||||
Duration dur = Duration.between(now, resetTimeTomorrow);
|
||||
return dur.getSeconds();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1443,4 +1390,24 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
setLastVotes(map);
|
||||
}
|
||||
|
||||
public int getNumberOfOfflineVotes(VoteSite site) {
|
||||
ArrayList<String> offlineVotes = getOfflineVotes();
|
||||
int num = 0;
|
||||
for (String str : offlineVotes) {
|
||||
if (str.equals(site.getKey())) {
|
||||
num++;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
public long getLastVoteTimer(VoteSite voteSite) {
|
||||
HashMap<VoteSite, Long> times = getLastVotes();
|
||||
if (times.containsKey(voteSite)) {
|
||||
return times.get(voteSite).longValue();
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -22,7 +23,6 @@ import com.bencodez.advancedcore.api.time.events.WeekChangeEvent;
|
||||
import com.bencodez.advancedcore.api.user.userstorage.DataType;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.events.VotePartyEvent;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
@@ -64,11 +64,11 @@ public class VoteParty implements Listener {
|
||||
if (getTotalVotes() < getVotesRequired()) {
|
||||
return;
|
||||
}
|
||||
if (plugin.getSpecialRewardsConfig().getVotePartyOnlyOncePerDay()
|
||||
if (plugin.getSpecialRewardsConfig().isVotePartyOnlyOncePerDay()
|
||||
&& plugin.getServerData().isLastVotePartySameDay()) {
|
||||
return;
|
||||
}
|
||||
if (plugin.getSpecialRewardsConfig().getVotePartyOnlyOncePerWeek()
|
||||
if (plugin.getSpecialRewardsConfig().isVotePartyOnlyOncePerWeek()
|
||||
&& plugin.getServerData().isLastVotePartySameWeek()) {
|
||||
return;
|
||||
}
|
||||
@@ -84,16 +84,16 @@ public class VoteParty implements Listener {
|
||||
|
||||
giveRewards(user, forceBungee);
|
||||
|
||||
if (plugin.getSpecialRewardsConfig().getVotePartyIncreaseVotesRquired() > 0) {
|
||||
if (plugin.getSpecialRewardsConfig().getVotePartyIncreaseVotesRequired() > 0) {
|
||||
plugin.getServerData().setVotePartyExtraRequired(plugin.getServerData().getVotePartyExtraRequired()
|
||||
+ plugin.getSpecialRewardsConfig().getVotePartyIncreaseVotesRquired());
|
||||
+ plugin.getSpecialRewardsConfig().getVotePartyIncreaseVotesRequired());
|
||||
}
|
||||
|
||||
if (plugin.getSpecialRewardsConfig().getVotePartyOnlyOncePerDay()) {
|
||||
if (plugin.getSpecialRewardsConfig().isVotePartyOnlyOncePerDay()) {
|
||||
plugin.getServerData().updateLastVoteParty();
|
||||
}
|
||||
|
||||
if (plugin.getSpecialRewardsConfig().getVotePartyOnlyOncePerWeek()) {
|
||||
if (plugin.getSpecialRewardsConfig().isVotePartyOnlyOncePerWeek()) {
|
||||
plugin.getServerData().updateLastVotePartyWeek();
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public class VoteParty implements Listener {
|
||||
* @param sender the sender
|
||||
*/
|
||||
public void commandVoteParty(CommandSender sender) {
|
||||
if (plugin.getSpecialRewardsConfig().getVotePartyEnabled()) {
|
||||
if (plugin.getSpecialRewardsConfig().isVotePartyEnabled()) {
|
||||
ArrayList<String> msg = plugin.getConfigFile().getFormatCommandsVoteParty();
|
||||
int votesRequired = getVotesRequired();
|
||||
int votes = getTotalVotes();
|
||||
@@ -204,7 +204,7 @@ public class VoteParty implements Listener {
|
||||
|
||||
String player = getRandomPlayerName();
|
||||
for (final String cmd : plugin.getSpecialRewardsConfig().getVotePartyGlobalCommands()) {
|
||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||
plugin.getBukkitScheduler().runTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -215,7 +215,22 @@ public class VoteParty implements Listener {
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getSpecialRewardsConfig().getVotePartyGiveAllPlayers()) {
|
||||
final ArrayList<String> list = plugin.getSpecialRewardsConfig().getVotePartyGlobalRandomCommand();
|
||||
if (list.size() > 0) {
|
||||
plugin.getBukkitScheduler().runTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(),
|
||||
StringParser.getInstance().replacePlaceHolder(
|
||||
list.get(ThreadLocalRandom.current().nextInt(list.size())), "randomonlineplayer",
|
||||
player));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getSpecialRewardsConfig().isVotePartyGiveAllPlayers()) {
|
||||
plugin.debug("Trying to give all players vote party");
|
||||
ArrayList<String> alreadyGotten = new ArrayList<String>();
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
@@ -223,7 +238,7 @@ public class VoteParty implements Listener {
|
||||
if (orgUser != null && orgUser.getJavaUUID().equals(p.getUniqueId())) {
|
||||
user = orgUser;
|
||||
} else {
|
||||
user = UserManager.getInstance().getVotingPluginUser(p);
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(p);
|
||||
user.dontCache();
|
||||
}
|
||||
|
||||
@@ -232,13 +247,13 @@ public class VoteParty implements Listener {
|
||||
}
|
||||
alreadyGotten.add(p.getUniqueId().toString());
|
||||
}
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
for (String uuid : plugin.getVotingPluginUserManager().getAllUUIDs()) {
|
||||
if (!alreadyGotten.contains(uuid)) {
|
||||
VotingPluginUser user;
|
||||
if (orgUser != null && orgUser.getJavaUUID().toString().equals(uuid)) {
|
||||
user = orgUser;
|
||||
} else {
|
||||
user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid));
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(UUID.fromString(uuid));
|
||||
user.dontCache();
|
||||
}
|
||||
|
||||
@@ -255,7 +270,7 @@ public class VoteParty implements Listener {
|
||||
if (orgUser != null && orgUser.getJavaUUID().toString().equals(uuid)) {
|
||||
user = orgUser;
|
||||
} else {
|
||||
user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid));
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(UUID.fromString(uuid));
|
||||
user.dontCache();
|
||||
}
|
||||
if (!plugin.getSpecialRewardsConfig().isVotePartyGiveOnlinePlayersOnly() || user.isOnline()) {
|
||||
@@ -269,14 +284,14 @@ public class VoteParty implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onDayChange(DayChangeEvent event) {
|
||||
if (plugin.getSpecialRewardsConfig().getVotePartyResetEachDay()) {
|
||||
if (plugin.getSpecialRewardsConfig().isVotePartyResetEachDay()) {
|
||||
reset(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMonthChange(MonthChangeEvent event) {
|
||||
if (plugin.getSpecialRewardsConfig().getVotePartyResetMontly()) {
|
||||
if (plugin.getSpecialRewardsConfig().isVotePartyResetMonthly()) {
|
||||
reset(true);
|
||||
}
|
||||
|
||||
@@ -287,7 +302,7 @@ public class VoteParty implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onWeekChange(WeekChangeEvent event) {
|
||||
if (plugin.getSpecialRewardsConfig().getVotePartyResetWeekly()) {
|
||||
if (plugin.getSpecialRewardsConfig().isVotePartyResetWeekly()) {
|
||||
reset(true);
|
||||
}
|
||||
}
|
||||
@@ -330,9 +345,9 @@ public class VoteParty implements Listener {
|
||||
}
|
||||
|
||||
public synchronized void vote(VotingPluginUser user, boolean realVote, boolean forceBungee) {
|
||||
if (plugin.getSpecialRewardsConfig().getVotePartyEnabled()) {
|
||||
if (plugin.getSpecialRewardsConfig().getVotePartyCountFakeVotes() || realVote) {
|
||||
if (plugin.getSpecialRewardsConfig().getVotePartyCountOfflineVotes() || user.isOnline()) {
|
||||
if (plugin.getSpecialRewardsConfig().isVotePartyEnabled()) {
|
||||
if (plugin.getSpecialRewardsConfig().isVotePartyCountFakeVotes() || realVote) {
|
||||
if (plugin.getSpecialRewardsConfig().isVotePartyCountOfflineVotes() || user.isOnline()) {
|
||||
addTotal(user);
|
||||
addVotePlayer(user);
|
||||
check(user, forceBungee);
|
||||
|
||||
@@ -11,7 +11,6 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
import lombok.Getter;
|
||||
@@ -42,7 +41,7 @@ public class VoteReminding {
|
||||
public void checkRemind(VotingPluginUser user) {
|
||||
if (user.hasPermission("VotingPlugin.Login.RemindVotes") || user.hasPermission("VotingPlugin.Player")) {
|
||||
if (shouldRemind(user)) {
|
||||
if (!plugin.getConfigFile().getVoteRemindingRemindOnlyOnce()) {
|
||||
if (!plugin.getConfigFile().isVoteRemindingRemindOnlyOnce()) {
|
||||
runRemind(user);
|
||||
} else if (!user.isReminded()) {
|
||||
runRemind(user);
|
||||
@@ -54,7 +53,8 @@ public class VoteReminding {
|
||||
|
||||
private void giveReward(VotingPluginUser user) {
|
||||
new RewardBuilder(plugin.getConfigFile().getData(), plugin.getConfigFile().getVoteRemindingRewardsPath())
|
||||
.withPlaceHolder("sitesavailable", "" + user.getSitesNotVotedOn()).setGiveOffline(false).send(user);
|
||||
.withPlaceHolder("sitesavailable", "" + user.getSitesNotVotedOn()).setGiveOffline(false)
|
||||
.disableDefaultWorlds().send(user);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,7 +72,7 @@ public class VoteReminding {
|
||||
public void run() {
|
||||
if (plugin != null && plugin.isEnabled()) {
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
|
||||
if (!plugin.getOptions().isTreatVanishAsOffline() || !user.isVanished()) {
|
||||
checkRemind(user);
|
||||
}
|
||||
@@ -91,12 +91,12 @@ public class VoteReminding {
|
||||
* @param user the user
|
||||
*/
|
||||
public void runRemind(VotingPluginUser user) {
|
||||
if (plugin.getConfigFile().getVoteRemindingEnabled()) {
|
||||
if (plugin.getConfigFile().isVoteRemindingEnabled()) {
|
||||
if (plugin.getConfigFile().isUsePrimaryAccountForPlaceholders() && user.hasPrimaryAccount()) {
|
||||
user = UserManager.getInstance().getVotingPluginUser(user.getPrimaryAccount());
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(user.getPrimaryAccount());
|
||||
}
|
||||
giveReward(user);
|
||||
if (user.getData().hasData() && plugin.getConfigFile().getVoteRemindingRemindOnlyOnce()) {
|
||||
if (user.getData().hasData() && plugin.getConfigFile().isVoteRemindingRemindOnlyOnce()) {
|
||||
user.setReminded(true);
|
||||
}
|
||||
|
||||
@@ -125,12 +125,13 @@ public class VoteReminding {
|
||||
}
|
||||
|
||||
public void runRemindLogin(VotingPluginUser user) {
|
||||
if (plugin.getConfigFile().getVoteRemindingEnabled()) {
|
||||
if (plugin.getConfigFile().isVoteRemindingEnabled()) {
|
||||
if (user.hasPermission("VotingPlugin.Login.RemindVotes") || user.hasPermission("VotingPlugin.Player")) {
|
||||
if (plugin.getConfigFile().isUsePrimaryAccountForPlaceholders() && user.hasPrimaryAccount()) {
|
||||
user = UserManager.getInstance().getVotingPluginUser(user.getPrimaryAccount());
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(user.getPrimaryAccount());
|
||||
}
|
||||
if ((!UserManager.getInstance().getAllUUIDs().contains(user.getUUID()) || shouldRemind(user))) {
|
||||
if ((!plugin.getVotingPluginUserManager().getAllUUIDs().contains(user.getUUID())
|
||||
|| shouldRemind(user))) {
|
||||
giveReward(user);
|
||||
if (user.getData().hasData()) {
|
||||
user.setReminded(true);
|
||||
|
||||
Reference in new issue
Block a user