Compare commits

...
94 Commits
Author SHA1 Message Date
BenCodez a78624eafb Update version number to 6.14 2023-08-27 14:46:41 -04:00
BenCodez 3249a43f4a Added command to manually update config 2023-08-27 14:29:04 -04:00
BenCodez 8e15ba0a3a Disable config auto updating 2023-08-27 14:26:11 -04:00
BenCodez 25969f35e0 Add config updater, disabled by default 2023-08-26 21:50:03 -04:00
BenCodez 6625bf9830 Improve gui editing for adding items, add voteshop item edits 2023-08-26 20:18:46 -04:00
BenCodez a925dcfd88 Edit config comments 2023-08-26 19:37:38 -04:00
BenCodez 40357def84 Add config option to support not adding totals while offline 2023-08-26 19:11:44 -04:00
BenCodez b4806abf70 Fix resetallvotedsites command not checking persite cooldowns 2023-08-26 15:30:44 -04:00
BenCodez f847c033fd Change handling of force cooldown rewards command handling 2023-08-26 15:27:54 -04:00
BenCodez 2919d23fd5 Slight change to placeholder 2023-08-26 14:59:08 -04:00
BenCodez 78412f4717 Add placeholders to PlayerVoteSiteCoolDownEndEvent rewards 2023-08-25 16:57:19 -04:00
BenCodez 438504a344 Check cooldown events on manual vote resets 2023-08-24 21:29:29 -04:00
BenCodez d27bc2580f Fix bottom bar of top voter not working in some rare cases 2023-08-24 19:21:51 -04:00
BenCodez 665865c5b3 Add bstats metrics for placeholder cache level 2023-08-20 13:46:35 -04:00
BenCodez d4124c78c2 Add new cache level, SPECIFICALL 2023-08-20 13:44:04 -04:00
BenCodez 63acc39588 Remove softdepend 2023-08-20 13:20:57 -04:00
BenCodez 46d7a3e95c Fix issue with placeholders not updating 2023-08-15 17:09:08 -04:00
BenCodez 39e5b54af6 Add another placeholder cache level 2023-08-12 21:16:49 -04:00
BenCodez 1a47862d22 Implement placeholder caching changes 2023-08-12 16:04:38 -04:00
BenCodez 63c73b8871 Remove need for external placeholder expansion, include directly 2023-08-08 19:54:00 -04:00
Ben 3bfab3518b Merge pull request #1291 from BenCodez/dependabot/maven/VotingPlugin/net.md-5-bungeecord-api-1.20-R0.1
Bump net.md-5:bungeecord-api from 1.17-R0.1-SNAPSHOT to 1.20-R0.1 in /VotingPlugin
2023-08-07 07:58:29 -04:00
dependabot[bot] 843d47cfb5 Bump net.md-5:bungeecord-api in /VotingPlugin
Bumps [net.md-5:bungeecord-api](https://github.com/SpigotMC/BungeeCord) from 1.17-R0.1-SNAPSHOT to 1.20-R0.1.
- [Commits](https://github.com/SpigotMC/BungeeCord/commits)

---
updated-dependencies:
- dependency-name: net.md-5:bungeecord-api
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-07 06:26:35 +00:00
BenCodez f7617eba61 Add vote time to playerpostvoteevent 2023-08-06 13:27:21 -04:00
BenCodez 1c95d37ce4 Set default bungee vote party placeholder to -1 to detect issues better 2023-08-05 17:38:09 -04:00
BenCodez db65b564a5 Add config options to adjust invalid arguments message 2023-08-04 20:43:44 -04:00
BenCodez 6f88e126e4 revert changes 2023-08-04 17:19:32 -04:00
BenCodez 25ea0b3a37 Changes to time handling 2023-08-03 20:24:49 -04:00
BenCodez d3bdcc762f Only reload global mysql on reloadall 2023-08-01 16:55:53 -04:00
BenCodez d72eb0e2a7 Force background update on cleartotal command 2023-07-29 20:24:06 -04:00
BenCodez 7b3a458b25 Update cache of online players on resetmilestonecount 2023-07-28 20:10:57 -04:00
BenCodez e2b79072d0 Add config option to disable javascript 2023-07-28 17:28:10 -04:00
BenCodez 7845741cec Handle incorrectly generated directlydefined reward files 2023-07-23 19:25:40 -04:00
BenCodez 6e2497dee7 More config handling improvements 2023-07-23 13:35:07 -04:00
BenCodez 7982c3df80 Switch to better config handling for config editor 2023-07-22 22:15:17 -04:00
BenCodez a7701f27f1 Improve config editor slightly 2023-07-22 21:32:26 -04:00
BenCodez bbe95bf83a Add system to purge cache of proxy votes 2023-07-14 20:40:51 -04:00
BenCodez 4e944df7f2 Add option to disable seconds in last vote times 2023-07-12 19:43:39 -04:00
BenCodez 6461aac03d Change deprecated api 2023-07-09 13:40:41 -04:00
BenCodez 1ece7935a2 Add getInstance method back to user manager for other plugins 2023-07-08 19:05:46 -04:00
BenCodez e130261a75 Add number placeholder for book gui 2023-07-07 12:46:29 -04:00
BenCodez c65c241b4d Add ability to manual layout in bookgui 2023-07-07 12:44:21 -04:00
BenCodez 9876e8e77b https://github.com/BenCodez/AdvancedCore/wiki/AdvancedPriority-Examples 2023-07-05 14:47:45 -04:00
BenCodez 674c41fec2 Improve config editor 2023-07-04 16:19:54 -04:00
BenCodez 6c295ec07f Small adjustment 2023-07-01 17:28:46 -04:00
BenCodez 332b7b667e Use new config editor 2023-06-25 17:38:03 -04:00
BenCodez 173bd381a5 Minor adjustment to plugin.yml 2023-06-25 16:29:51 -04:00
BenCodez 6154efdd50 Adjustments to vote handling 2023-06-23 18:57:58 -04:00
BenCodez ee0dcf8019 Add random global command to vote party 2023-06-21 20:18:51 -04:00
BenCodez 6a4740f729 Disable default worlds check on vote reminding 2023-06-20 20:27:56 -04:00
BenCodez ccf58be365 Add new offline vote limit feature 2023-06-20 20:06:47 -04:00
Ben b871278d82 Merge pull request #1286 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-jar-plugin-3.3.0
Bump maven-jar-plugin from 2.3.1 to 3.3.0 in /VotingPlugin
2023-06-19 21:07:19 -04:00
Ben 90bc2dd3ee Merge pull request #1285 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-shade-plugin-3.5.0
Bump maven-shade-plugin from 3.3.0 to 3.5.0 in /VotingPlugin
2023-06-19 21:07:04 -04:00
Ben a85b9dce23 Merge pull request #1284 from BenCodez/dependabot/maven/VotingPlugin/org.bstats-bstats-velocity-3.0.2
Bump bstats-velocity from 2.2.1 to 3.0.2 in /VotingPlugin
2023-06-19 21:06:57 -04:00
Ben a171fad307 Merge pull request #1283 from BenCodez/dependabot/maven/VotingPlugin/org.sonatype.plugins-nexus-staging-maven-plugin-1.6.13
Bump nexus-staging-maven-plugin from 1.5.1 to 1.6.13 in /VotingPlugin
2023-06-19 21:06:51 -04:00
dependabot[bot] eba230e5c0 Bump maven-jar-plugin from 2.3.1 to 3.3.0 in /VotingPlugin
Bumps [maven-jar-plugin](https://github.com/apache/maven-jar-plugin) from 2.3.1 to 3.3.0.
- [Release notes](https://github.com/apache/maven-jar-plugin/releases)
- [Commits](https://github.com/apache/maven-jar-plugin/compare/maven-jar-plugin-2.3.1...maven-jar-plugin-3.3.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-jar-plugin
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-20 01:06:17 +00:00
dependabot[bot] ffd1f616d4 Bump maven-shade-plugin from 3.3.0 to 3.5.0 in /VotingPlugin
Bumps [maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.3.0 to 3.5.0.
- [Release notes](https://github.com/apache/maven-shade-plugin/releases)
- [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.3.0...maven-shade-plugin-3.5.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-shade-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-20 01:06:12 +00:00
dependabot[bot] 4dfbf0c71f Bump bstats-velocity from 2.2.1 to 3.0.2 in /VotingPlugin
Bumps [bstats-velocity](https://github.com/Bastian/bStats-Metrics) from 2.2.1 to 3.0.2.
- [Release notes](https://github.com/Bastian/bStats-Metrics/releases)
- [Commits](https://github.com/Bastian/bStats-Metrics/compare/v2.2.1...v3.0.2)

---
updated-dependencies:
- dependency-name: org.bstats:bstats-velocity
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-20 01:04:32 +00:00
dependabot[bot] c97616eb8d Bump nexus-staging-maven-plugin from 1.5.1 to 1.6.13 in /VotingPlugin
Bumps nexus-staging-maven-plugin from 1.5.1 to 1.6.13.

---
updated-dependencies:
- dependency-name: org.sonatype.plugins:nexus-staging-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-20 01:04:25 +00:00
Ben 6039bb12b8 Update dependabot.yml 2023-06-19 21:03:51 -04:00
Ben 11bf99faf9 Merge pull request #1282 from BenCodez/dependabot/maven/VotingPlugin/org.projectlombok-lombok-1.18.28
Bump lombok from 1.18.20 to 1.18.28 in /VotingPlugin
2023-06-19 20:58:18 -04:00
Ben cbfde9bedd Merge pull request #1280 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-resources-plugin-3.3.1
Bump maven-resources-plugin from 3.1.0 to 3.3.1 in /VotingPlugin
2023-06-19 20:58:08 -04:00
Ben 0ab0fa5fb5 Merge pull request #1279 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-javadoc-plugin-3.5.0
Bump maven-javadoc-plugin from 2.10.4 to 3.5.0 in /VotingPlugin
2023-06-19 20:57:47 -04:00
Ben fd460787c3 Update dependabot.yml 2023-06-19 20:57:21 -04:00
dependabot[bot] 524d22d37a Bump lombok from 1.18.20 to 1.18.28 in /VotingPlugin
Bumps [lombok](https://github.com/projectlombok/lombok) from 1.18.20 to 1.18.28.
- [Release notes](https://github.com/projectlombok/lombok/releases)
- [Changelog](https://github.com/projectlombok/lombok/blob/master/doc/changelog.markdown)
- [Commits](https://github.com/projectlombok/lombok/compare/v1.18.20...v1.18.28)

---
updated-dependencies:
- dependency-name: org.projectlombok:lombok
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-20 00:55:51 +00:00
dependabot[bot] 220368d037 Bump maven-resources-plugin from 3.1.0 to 3.3.1 in /VotingPlugin
Bumps [maven-resources-plugin](https://github.com/apache/maven-resources-plugin) from 3.1.0 to 3.3.1.
- [Release notes](https://github.com/apache/maven-resources-plugin/releases)
- [Commits](https://github.com/apache/maven-resources-plugin/compare/maven-resources-plugin-3.1.0...maven-resources-plugin-3.3.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-resources-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-20 00:55:41 +00:00
dependabot[bot] 5d86c5297d Bump maven-javadoc-plugin from 2.10.4 to 3.5.0 in /VotingPlugin
Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 2.10.4 to 3.5.0.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-2.10.4...maven-javadoc-plugin-3.5.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-javadoc-plugin
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-20 00:55:26 +00:00
Ben 7d69f1e496 Merge pull request #1278 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-deploy-plugin-3.1.1
Bump maven-deploy-plugin from 3.0.0-M1 to 3.1.1 in /VotingPlugin
2023-06-19 20:55:02 -04:00
dependabot[bot] e2784c6b17 Bump maven-deploy-plugin from 3.0.0-M1 to 3.1.1 in /VotingPlugin
Bumps [maven-deploy-plugin](https://github.com/apache/maven-deploy-plugin) from 3.0.0-M1 to 3.1.1.
- [Release notes](https://github.com/apache/maven-deploy-plugin/releases)
- [Commits](https://github.com/apache/maven-deploy-plugin/compare/maven-deploy-plugin-3.0.0-M1...maven-deploy-plugin-3.1.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-deploy-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-20 00:54:04 +00:00
Ben f9ce8f325d Update dependabot.yml 2023-06-19 20:53:35 -04:00
Ben b059fc644a Update dependabot.yml 2023-06-19 20:52:23 -04:00
Ben 5c7e5d2d59 Create dependabot.yml 2023-06-19 20:50:36 -04:00
BenCodez 3b4dde335d Implement better command handler api to handle player commands 2023-06-19 20:01:59 -04:00
BenCodez f00ca81c28 Use new command handler constructor 2023-06-19 19:46:58 -04:00
Ben 36ef5e15cf Update publish-javadoc.yml 2023-06-18 15:46:27 -04:00
BenCodez 9a122fb46d Change deploy profile slightly 2023-06-18 15:36:02 -04:00
BenCodez 17fc78a15f Fix profile 2023-06-18 15:29:30 -04:00
BenCodez 0718f0976d Add javadoc profile 2023-06-18 15:27:14 -04:00
Ben 580e7d3061 Update publish-javadoc.yml 2023-06-18 15:26:59 -04:00
Ben 29af36a9e9 Create publish-javadoc.yml 2023-06-18 15:22:10 -04:00
Ben 56d39722cb Delete publish-javadoc.yml 2023-06-18 13:43:09 -04:00
Ben 6a202d4768 Update publish-javadoc.yml 2023-06-18 13:39:12 -04:00
Ben d399684bfa Create publish-javadoc.yml 2023-06-18 13:35:08 -04:00
Ben 1a0da65c66 Delete publish-javadoc.yml 2023-06-18 13:25:35 -04:00
Ben 463b303f2e Update publish-javadoc.yml 2023-06-18 13:22:46 -04:00
Ben abf0e2bebb Update publish-javadoc.yml 2023-06-18 13:17:51 -04:00
Ben 29670f8c22 Update publish-javadoc.yml 2023-06-18 13:16:18 -04:00
Ben 7b08d6806b Update publish-javadoc.yml 2023-06-18 13:13:47 -04:00
Ben 3211e22963 Update publish-javadoc.yml 2023-06-18 12:52:23 -04:00
Ben 2634639f6b Update publish-javadoc.yml 2023-06-18 12:49:08 -04:00
Ben 0798110743 Update publish-javadoc.yml 2023-06-18 12:46:46 -04:00
Ben 2f90e112b1 Update publish-javadoc.yml 2023-06-18 12:43:16 -04:00
Ben 661ea3ce94 Update publish-javadoc.yml 2023-06-17 22:17:11 -04:00
Ben 8d6e95927c Merge pull request #1277 from BenCodez/Auto-upload-javadoc
Create publish-javadoc.yml
2023-06-17 22:14:05 -04:00
Ben c138edccc8 Create publish-javadoc.yml 2023-06-17 22:13:51 -04:00
52 changed files with 1707 additions and 1494 deletions

No files matched your search

+11
View File
@@ -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"
+24
View File
@@ -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'
+46 -6
View File
@@ -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:
@@ -331,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
@@ -419,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
@@ -447,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
@@ -464,7 +475,7 @@ TreatVanishAsOffline: false
DelayLoginEvent: 0
# Wait until user is logged in with AuthMe
# Requires AuthMe
# Requires AuthMe or LoginSecurity
WaitUntilLoggedIn: true
###########################################
@@ -510,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
@@ -517,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: '*'
@@ -538,11 +554,35 @@ 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: []
# If enabled Config.yml will add new options as they are added to default file
# Expiremental at this time, make backups
# Still a WIP, DO NOT USE IN LIVE SERVERS
# Use /av config update to do manual update if you so desire
# Config backup will be made
AutoConfigUpdating: false
###########################################
# Skull settings
###########################################
@@ -678,7 +718,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'
+5 -1
View File
@@ -378,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
+5
View File
@@ -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 -2
View File
@@ -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,7 +16,6 @@ softdepend:
- AuthMe
- SuperVanish
- PremiumVanish
- DiscordSRV
loadbefore:
- MCPerks
api-version: 1.13
+70 -13
View File
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.bencodez</groupId>
<artifactId>${version.art}</artifactId>
<version>6.13.1</version>
<version>6.14</version>
<packaging>jar</packaging>
<name>VotingPlugin</name>
<properties>
@@ -59,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>
@@ -88,7 +88,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<version>3.5.0</version>
<configuration>
<shadedArtifactAttached>false</shadedArtifactAttached>
<minimizeJar>true</minimizeJar>
@@ -162,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>
@@ -212,6 +212,10 @@
<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>
@@ -223,13 +227,13 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</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>
@@ -253,9 +257,15 @@
<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>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.3</version>
<scope>provided</scope>
</dependency>
</dependencies>
<profiles>
<profile>
@@ -350,7 +360,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0</version>
<version>3.1.1</version>
<configuration>
<skip>true</skip>
</configuration>
@@ -377,6 +387,52 @@
</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.5.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>
@@ -385,6 +441,7 @@
<maven.compiler.target>1.8</maven.compiler.target>
<build.profile.id>deploy</build.profile.id>
</properties>
<dependencies>
<dependency>
<groupId>com.bencodez</groupId>
@@ -408,7 +465,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<version>3.5.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
@@ -425,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>
@@ -433,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>
@@ -449,7 +506,7 @@
<skipStaging>true</skipStaging>
</configuration>
</plugin>
<plugin>
<!--<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.12</version>
@@ -475,7 +532,7 @@
</configuration>
</execution>
</executions>
</plugin>
</plugin>-->
</plugins>
</build>
</profile>
@@ -49,10 +49,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 +64,6 @@ public class BungeeHandler implements Listener {
public BungeeHandler(VotingPluginMain plugin) {
this.plugin = plugin;
}
public void close() {
@@ -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.advancedcore.scheduler.BukkitScheduler;
@@ -81,6 +82,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;
@@ -222,7 +224,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
@Getter
private UserManager votingPluginUserManager;
private void addDirectlyDefinedRewards(DirectlyDefinedReward directlyDefinedReward) {
public void addDirectlyDefinedRewards(DirectlyDefinedReward directlyDefinedReward) {
getRewardHandler().addDirectlyDefined(directlyDefinedReward);
}
@@ -928,6 +930,9 @@ public class VotingPluginMain extends AdvancedCorePlugin {
getBungeeSettings().setValue(path, value);
}
});
getRewardHandler().checkDirectlyDefined();
}
private void loadTimer() {
@@ -1014,6 +1019,15 @@ 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();
@@ -1024,20 +1038,18 @@ public class VotingPluginMain extends AdvancedCorePlugin {
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();
@@ -1310,7 +1322,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 {
@@ -1380,7 +1392,12 @@ public class VotingPluginMain extends AdvancedCorePlugin {
bungeeSettings.reloadData();
if (bungeeSettings.isUseBungeecoord()) {
getBungeeHandler().loadGlobalMysql();
if (getBungeeHandler() == null) {
loadBungeeHandler();
}
if (userStorage) {
getBungeeHandler().loadGlobalMysql();
}
}
checkYMLError();
@@ -1390,7 +1407,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
updateAdvancedCoreHook();
plugin.loadVoteSites();
loadDirectlyDefined();
reloadAdvancedCore(userStorage);
getOptions().setServer(bungeeSettings.getServer());
if (userStorage) {
@@ -1400,6 +1417,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
voteReminding.loadRemindChecking();
coolDownCheck.checkEnabled();
loadDirectlyDefined();
setUpdate(true);
}
@@ -1408,6 +1426,16 @@ public class VotingPluginMain extends AdvancedCorePlugin {
configFile = new Config(this);
configFile.setup();
if (configFile.isAutoConfigUpdating()) {
/*try {
ConfigUpdater.update(plugin, "Config.yml", configFile.getdFile(),
Arrays.asList("VoteReminding", "MySQL", "CustomCommands", "CustomPlaceholderReturns"));
configFile.reloadData();
} catch (IOException e) {
e.printStackTrace();
}*/
}
configVoteSites = new ConfigVoteSites(this);
configVoteSites.setup();
@@ -1462,7 +1490,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
}
}
boolean topVoterIgnorePermissionUse = plugin.getConfigFile()
.getTopVoterIgnorePermission();
.isTopVoterIgnorePermission();
ArrayList<String> blackList = plugin.getConfigFile().getBlackList();
// ArrayList<String> uuids = getVotingPluginUserManager().getAllUUIDs();
@@ -1519,7 +1547,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;
@@ -1593,7 +1624,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());
}
@@ -65,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
@@ -218,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>() {
@@ -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);
}
@@ -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());
}
});
@@ -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)) {
@@ -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) {
@@ -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
@@ -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)) {
@@ -114,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);
@@ -45,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;
}
@@ -153,7 +153,7 @@ public class VoteShop extends GUIHandler {
user.sendMessage(plugin.getGui().getChestVoteShopLimitReached());
}
plugin.getCommandLoader().processSlotClick(player, user, identifier);
if (plugin.getGui().getChestVoteShopReopenGUIOnPurchase()) {
if (plugin.getGui().isChestVoteShopReopenGUIOnPurchase()) {
plugin.getCommandLoader().processSlotClick(player, user, "shop");
}
}
@@ -189,7 +189,7 @@ public class VoteShop extends GUIHandler {
});
}
if (plugin.getGui().getChestVoteShopBackButton()) {
if (plugin.getGui().isChestVoteShopBackButton()) {
inv.addButton(plugin.getCommandLoader().getBackButton(user));
}
@@ -136,7 +136,7 @@ public class VoteStreak extends GUIHandler {
});
}
if (plugin.getGui().getChestVoteStreakBackButton()) {
if (plugin.getGui().isChestVoteStreakBackButton()) {
inv.addButton(plugin.getCommandLoader().getBackButton(user));
}
@@ -133,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());
@@ -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);
@@ -57,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()) {
@@ -132,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());
@@ -141,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);
@@ -161,7 +166,7 @@ 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) {
@@ -228,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);
@@ -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;
@@ -194,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;
@@ -282,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;
@@ -324,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);
@@ -356,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.
@@ -510,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.
@@ -555,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.
@@ -728,133 +608,96 @@ 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;
@ConfigDataBoolean(path = "AutoConfigUpdating")
@Getter
private boolean autoConfigUpdating = false;
/**
* Gets the rewards.
@@ -865,9 +708,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 "
@@ -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,57 +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);
}
public boolean getChestVoteShopReopenGUIOnPurchase() {
return getData().getBoolean("CHEST.VoteShopReopenGUIOnPurchase", false);
}
@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);
@@ -359,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) {
@@ -464,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);
@@ -534,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() {
@@ -180,7 +180,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)));
}
}
@@ -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;
}
/*
@@ -46,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)) {
@@ -83,6 +83,7 @@ public class PlayerJoinEvent implements Listener {
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(uuid);
user.dontCache();
user.logoutRewards();
plugin.getPlaceholders().onLogout(user);
}
});
}
@@ -133,7 +133,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 +143,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 +167,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 +186,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();
}
@@ -221,7 +232,7 @@ public class PlayerVoteListener implements Listener {
}
PlayerPostVoteEvent postVoteEvent = new PlayerPostVoteEvent(voteSite, user, event.isRealVote(),
event.isForceBungee());
event.isForceBungee(), voteTime);
plugin.getServer().getPluginManager().callEvent(postVoteEvent);
if (!user.isOnline()) {
@@ -55,7 +55,7 @@ public class PlaceHolders {
onUpdate();
if (!cacheLevel.equals(PlaceholderCacheLevel.NONE)) {
for (Player player : Bukkit.getOnlinePlayers()) {
onUpdate(plugin.getVotingPluginUserManager().getVotingPluginUser(player));
onUpdate(plugin.getVotingPluginUserManager().getVotingPluginUser(player), player.isOnline());
}
}
}
@@ -785,7 +785,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"));
@@ -797,7 +797,7 @@ public class PlaceHolders {
return Integer.toString(plugin.getBungeeHandler().getBungeeVotePartyRequired()
- plugin.getBungeeHandler().getBungeeVotePartyCurrent());
}
return "" + 0;
return "-1";
}
}.withDescription("Voteparty bungee votes needed"));
@@ -808,7 +808,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"));
@@ -934,34 +934,39 @@ public class PlaceHolders {
vpUser.dontCache();
}
for (PlaceHolder<VotingPluginUser> placeholder : placeholders) {
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);
if (placeholder.isUsesCache()) {
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);
} 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);
}
}
}
}
}
}
@@ -972,48 +977,58 @@ 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 instanceof CalculatingPlaceholder<?>) {
if (placeholder.isUsesCache()) {
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));
}
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));
}
} else {
if (placeholder.isUsesCache()) {
for (String ident : placeholder.getCache().keySet()) {
placeholder.getCache().get(ident).put(user.getJavaUUID(),
placeholder.placeholderRequest(user, ident));
}
}
}
}
}
@@ -1026,15 +1041,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);
@@ -1053,27 +1068,21 @@ 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 (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;
}
@@ -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);
}
}
@@ -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);
}
}
@@ -54,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);
@@ -93,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 = plugin.getVotingPluginUserManager().getVotingPluginUser(UUID.fromString(uuid));
VotingPluginUser user = plugin.getVotingPluginUserManager()
.getVotingPluginUser(UUID.fromString(uuid), false);
user.dontCache();
user.updateTempCacheWithColumns(playerData.getValue());
cols.put(playerData.getKey(), null);
@@ -131,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);
}
@@ -140,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 = plugin.getVotingPluginUserManager().getVotingPluginUser(playerData.getKey(), false);
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(playerData.getKey(),
false);
user.dontCache();
user.updateTempCacheWithColumns(playerData.getValue());
cols.put(playerData.getKey(), null);
@@ -173,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++;
}
@@ -183,10 +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());
plugin.getLogger().info(
"Giving daily top voter reward " + i + " to " + entry.getKey().getPlayerName());
}
}
lastTotal = entry.getValue().intValue();
@@ -237,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 = plugin.getVotingPluginUserManager().getVotingPluginUser(playerData.getKey(), false);
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(playerData.getKey(),
false);
user.dontCache();
user.updateTempCacheWithColumns(playerData.getValue());
cols.put(playerData.getKey(), null);
@@ -282,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++;
}
@@ -293,7 +296,7 @@ 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());
@@ -307,7 +310,7 @@ public class TopVoterHandler implements Listener {
e.printStackTrace();
}
if (plugin.getSpecialRewardsConfig().getResetMilestonesMonthly()) {
if (plugin.getSpecialRewardsConfig().isResetMilestonesMonthly()) {
resetMilestoneCount();
resetGottenMilestones();
}
@@ -349,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);
}
@@ -359,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 = plugin.getVotingPluginUserManager().getVotingPluginUser(playerData.getKey(), false);
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(playerData.getKey(),
false);
user.dontCache();
user.updateTempCacheWithColumns(playerData.getValue());
cols.put(playerData.getKey(), null);
@@ -398,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++;
}
@@ -408,7 +412,7 @@ 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());
@@ -569,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());
@@ -608,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());
@@ -647,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());
@@ -767,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());
@@ -15,11 +15,22 @@ import com.bencodez.votingplugin.VotingPluginMain;
public class UserManager {
private VotingPluginMain plugin;
public UserManager(VotingPluginMain plugin) {
this.plugin = plugin;
}
@Deprecated
public UserManager() {
}
@Deprecated
static UserManager instance = new UserManager();
@Deprecated
public static UserManager getInstance() {
return instance;
}
public void addCachingKeys() {
UserDataManager manager = plugin.getUserManager().getDataManager();
manager.addKey(new UserDataKeyBoolean("TopVoterIgnore"));
@@ -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;
@@ -710,7 +710,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);
}
}
@@ -816,7 +816,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);
}
@@ -1209,14 +1209,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()
@@ -1255,7 +1257,7 @@ 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();
@@ -1462,4 +1464,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;
@@ -64,11 +65,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 +85,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 +106,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();
@@ -215,7 +216,22 @@ public class VoteParty implements Listener {
});
}
if (plugin.getSpecialRewardsConfig().getVotePartyGiveAllPlayers()) {
final ArrayList<String> list = plugin.getSpecialRewardsConfig().getVotePartyGlobalRandomCommand();
if (list.size() > 0) {
BukkitScheduler.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()) {
@@ -269,14 +285,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 +303,7 @@ public class VoteParty implements Listener {
@EventHandler
public void onWeekChange(WeekChangeEvent event) {
if (plugin.getSpecialRewardsConfig().getVotePartyResetWeekly()) {
if (plugin.getSpecialRewardsConfig().isVotePartyResetWeekly()) {
reset(true);
}
}
@@ -330,9 +346,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);
@@ -41,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);
@@ -53,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);
}
/**
@@ -90,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 = plugin.getVotingPluginUserManager().getVotingPluginUser(user.getPrimaryAccount());
}
giveReward(user);
if (user.getData().hasData() && plugin.getConfigFile().getVoteRemindingRemindOnlyOnce()) {
if (user.getData().hasData() && plugin.getConfigFile().isVoteRemindingRemindOnlyOnce()) {
user.setReminded(true);
}
@@ -124,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 = plugin.getVotingPluginUserManager().getVotingPluginUser(user.getPrimaryAccount());
}
if ((!plugin.getVotingPluginUserManager().getAllUUIDs().contains(user.getUUID()) || shouldRemind(user))) {
if ((!plugin.getVotingPluginUserManager().getAllUUIDs().contains(user.getUUID())
|| shouldRemind(user))) {
giveReward(user);
if (user.getData().hasData()) {
user.setReminded(true);