Compare commits

...
482 Commits
Author SHA1 Message Date
BenCodez abd86834a6 Update version number to 6.18.2 2025-01-26 13:29:33 -06:00
BenCodez c6647d7cc3 Slight change to plugin messaging 2025-01-26 09:54:46 -06:00
BenCodez a3851f9bf2 Update version number to 6.18.2-SNAPSHOT 2025-01-25 20:37:57 -06:00
BenCodez a951aae0de Update version number to 6.18.1 2025-01-25 20:15:31 -06:00
BenCodez 826fc95131 Adjust encryption 2025-01-25 19:22:14 -06:00
BenCodez dea13f6ff1 Add log warning for disabled plugin message encryption on proxy 2025-01-25 18:24:39 -06:00
BenCodez bab55de93b Add warning when PluginMessageEncryption is disabled 2025-01-25 17:51:53 -06:00
BenCodez 1c112688b1 Add restart requirement notes for PluginMessageChannel and
PluginMessageEncryption

- Added note for PluginMessageChannel restart requirement
- Added note for PluginMessageEncryption restart requirement
- Instructed to copy secretkey.key file to all servers
- Ensured settings must match on all servers
- Updated `BungeeSettings.yml` and `bungeeconfig.yml` files
2025-01-25 16:59:27 -06:00
BenCodez bc0e82f68f Fix null check and correct config path
- Add null check for playerName in isPlayerOnline method
- Correct path for PluginMessageChannel in BungeeSettings
- Ensure playerName is not null before checking online status
- Update config annotation path in BungeeSettings
- Improve code robustness and prevent potential null pointer exceptions
2025-01-25 16:50:10 -06:00
BenCodez a82397a67f Update channel identifier creation to use lowercase values
- Split plugin message channel by colon
- Convert channel parts to lowercase
- Create MinecraftChannelIdentifier with lowercase values
- Register the new channel identifier
- Ensure compatibility with case-insensitive channels
- Improve robustness of channel handling
2025-01-25 16:12:33 -06:00
BenCodez b1ffce516c Add plugin message encryption support
- Add `PluginMessageEncryption` to config files
- Update `BungeeHandler` to handle encryption
- Modify `VotingPluginProxy` to support encrypted messages
- Implement encryption checks in `Config` classes
- Update `BungeeSettings` with encryption setting
- Ensure message encryption in `sendPluginMessage` method
2025-01-25 16:09:53 -06:00
BenCodez f48a008040 Add ability to change pluginmessage channel 2025-01-25 15:35:42 -06:00
BenCodez 90c8255894 Fix isSomeoneOnlineServer method to correctly check for online
players.
2025-01-25 12:36:14 -06:00
BenCodez 4001e865f5 Refactor plugin message handling in VotingPluginProxy
- Combine if-else statements for subchannel checks
- Add comment for unused "TimeChangeFinished" subchannel
- Add handling for "VoteUpdate" subchannel
- Add debug message for ignored plugin messages
- Improve code readability and maintainability
- Ensure proper message forwarding and logging
2025-01-24 17:32:55 -06:00
BenCodez 77b7659cb6 Fix for velocity 2025-01-24 16:24:26 -06:00
BenCodez bc073857f6 Test change for velocity 2025-01-24 16:21:02 -06:00
BenCodez 9c2a41c9b5 Fix reward path in AdminVoteVoteShopItem.java 2025-01-24 10:40:16 -06:00
BenCodez 972f5350a1 Change default second votesite 2025-01-22 08:09:46 -06:00
BenCodez 66df9d85da Improve javadoc commments for VotingPluginUser 2025-01-20 09:55:45 -06:00
Ben 4046dd9d7f Merge pull request #1412 from BlvckBytes/master
Added variable %sitename% to placeholders of Commands.Vote.Today.Line
2025-01-18 19:58:16 -06:00
Philip Hell d89aa6ccb2 Added variable %sitename% to placeholders of Commands.Vote.Today.Line 2025-01-19 02:50:28 +01:00
Ben 813ffed723 Merge pull request #1404 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-javadoc-plugin-3.11.2
Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.11.1 to 3.11.2 in /VotingPlugin
2025-01-12 15:59:02 -06:00
BenCodez c0bc1b2730 Adjust when dev build warning is given 2025-01-10 19:25:37 -06:00
BenCodez 1217e63583 Changes to proxy handling 2025-01-09 08:46:45 -06:00
BenCodez cd6ed92e4f Rewrite backend on velocity to make it more universal with bungee 2025-01-09 08:12:29 -06:00
BenCodez 07c9eda769 Code cleanup 2024-12-31 15:39:51 -06:00
BenCodez ef0f73ba32 Fix a few issues on bungee related to internal changes 2024-12-31 15:29:53 -06:00
BenCodez 10b0fd3b11 Internal rewrites of bungee for universal proxy backend 2024-12-31 11:19:07 -06:00
BenCodez a4aa209aa7 Fix handling of previous months votes on certain dates 2024-12-31 11:17:45 -06:00
BenCodez 70af742083 Code cleanup 2024-12-29 21:42:00 -06:00
BenCodez 0463700037 Add permission check to sites not voted on 2024-12-27 11:08:30 -06:00
BenCodez 69d9c09b06 Increase default skull cache timing 2024-12-20 07:54:11 -06:00
BenCodez 4455cc96b9 Fix issue with no vote url set 2024-12-17 09:11:59 -06:00
BenCodez 0ee7c1f2e8 Adjustment to maven profile 2024-12-16 20:44:49 -06:00
BenCodez 4b3cc8c8e0 Update version number to 6.18.1-SNAPSHOT 2024-12-16 20:36:49 -06:00
BenCodez c2fe26aaea Update version number to 6.18 2024-12-16 20:21:37 -06:00
BenCodez 2aa84c90e8 Adjustments to how previous months top voters are loaded 2024-12-16 17:34:47 -06:00
BenCodez c8cace388e Change command from previousmonthsvoters to previousmonthstotals 2024-12-16 16:29:38 -06:00
BenCodez 1da028476f Don't load command if month date isn't enabled 2024-12-14 16:50:05 -06:00
BenCodez c28bddd0ba Add previous month top voters GUI, uses Month totals with date 2024-12-13 12:43:15 -06:00
BenCodez 1afd8253a5 Add extra time change checks on login 2024-12-13 09:58:29 -06:00
BenCodez a3a1b4604f Add extra check for time queues on proxy 2024-12-13 09:46:28 -06:00
BenCodez 3bd41af200 Add extra checks on proxy time changes 2024-12-13 09:43:04 -06:00
BenCodez 0042045d9b Add bypass fail safe options for bungee time checking 2024-12-13 09:10:04 -06:00
BenCodez 76d7579c7d Update to 1.21.4 2024-12-09 21:24:43 -06:00
Ben f591b863f1 Merge pull request #1405 from BenCodez/dependabot/maven/VotingPlugin/com.coderplus.maven.plugins-copy-rename-maven-plugin-1.0.1
Bump com.coderplus.maven.plugins:copy-rename-maven-plugin from 1.0 to 1.0.1 in /VotingPlugin
2024-12-09 07:43:31 -06:00
dependabot[bot] b43c4b89a8 Bump com.coderplus.maven.plugins:copy-rename-maven-plugin
Bumps [com.coderplus.maven.plugins:copy-rename-maven-plugin](https://github.com/coderplus/copy-rename-maven-plugin) from 1.0 to 1.0.1.
- [Commits](https://github.com/coderplus/copy-rename-maven-plugin/commits)

---
updated-dependencies:
- dependency-name: com.coderplus.maven.plugins:copy-rename-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-09 06:43:18 +00:00
dependabot[bot] bc49aae401 Bump org.apache.maven.plugins:maven-javadoc-plugin in /VotingPlugin
Bumps [org.apache.maven.plugins:maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.11.1 to 3.11.2.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.11.1...maven-javadoc-plugin-3.11.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-09 06:39:01 +00:00
BenCodez f9d7f5a136 Adjust default caching columns 2024-12-08 14:38:28 -06:00
BenCodez 338853a29f Fix issues with new month total date system 2024-12-08 14:34:54 -06:00
BenCodez 7d0722d5c4 Fix vote streak command not working for multiples 2024-12-08 12:37:52 -06:00
BenCodez 86e6bca31d Small adjustment to vote streaking handling 2024-12-08 12:21:12 -06:00
BenCodez 8488233be1 More work on new month date totals 2024-12-07 21:13:56 -06:00
BenCodez ba5f8dfa6d Implement month totals with dates on proxy servers 2024-12-07 17:56:50 -06:00
BenCodez dc865f1d20 First implementation of storing and using totals with month names 2024-12-07 16:03:19 -06:00
BenCodez 5dedb644b2 More adjustments to build numbers on jar files 2024-12-06 20:59:52 -06:00
BenCodez c041c7c33a Adjust maven profile 2024-12-06 20:55:55 -06:00
BenCodez bbc0c4a88e Implement first steps at including version number in jar name 2024-12-06 20:52:47 -06:00
BenCodez 4d200f6675 Change version number to 6.17.5-SNAPSHOT 2024-12-01 16:22:51 -06:00
BenCodez ad7970c99d Update version number to 6.17.4 2024-12-01 16:06:45 -06:00
BenCodez 2ab6ff5105 Added /av resettotal (topvoter) 2024-11-30 20:37:38 -06:00
BenCodez 0470993b81 Adjustments to wiping column data 2024-11-30 20:33:03 -06:00
BenCodez 7de3dff221 Adjustments to time change handling in certain cases on proxy 2024-11-30 20:07:13 -06:00
Ben c17f6facbb Delete .github/workflows/jekyll-gh-pages.yml 2024-11-29 11:00:31 -06:00
Ben d0e2a7987b Create jekyll-gh-pages.yml 2024-11-29 10:59:27 -06:00
BenCodez c9d3b1655d Fix nonvotedplayerscache not working on velocity as it should 2024-11-29 08:27:11 -06:00
BenCodez 348ad9d3d5 Added new config option SkullProfileAPIURL 2024-11-28 12:37:26 -06:00
BenCodez f90b87fa5a Add new options for purging, new purge with no data check 2024-11-25 20:43:05 -06:00
BenCodez 5b19d3397a Add new placeholder for number of votes since last milestone 2024-11-24 14:47:31 -06:00
BenCodez dad0f88865 Change version to 6.17.4-SNAPSHOT 2024-11-24 14:34:32 -06:00
BenCodez 3e862efff2 Fix javadoc issue 2024-11-24 14:24:01 -06:00
BenCodez 52ca5467f7 Update version number to 6.17.3 2024-11-24 14:06:58 -06:00
BenCodez 61657dc670 Disable update checking on dev builds 2024-11-24 11:24:03 -06:00
BenCodez 4bac98c015 Quick fix 2024-11-23 11:22:55 -06:00
BenCodez 1215d224b4 Changes to vote party remindatvotes is gotten from specialrewards.yml 2024-11-23 11:21:57 -06:00
BenCodez 6dde613558 Modify hiding triggering vote message in console 2024-11-21 19:33:52 -06:00
BenCodez 99e34b5cd4 Hide trigger vote message if noservicesitemessage is disabled 2024-11-21 16:23:34 -06:00
BenCodez e049329f41 Add ability to hide issue with service site message on /av vote 2024-11-21 16:16:26 -06:00
BenCodez 8fe4661fe1 Change default skull cache timing 2024-11-19 19:27:11 -06:00
BenCodez af8cfc94a9 Changes to default sound 2024-11-18 08:01:16 -06:00
Ben d98a9a9152 Merge pull request #1394 from BenCodez/dependabot/maven/VotingPlugin/org.projectlombok-lombok-1.18.36
Bump org.projectlombok:lombok from 1.18.34 to 1.18.36 in /VotingPlugin
2024-11-18 07:29:48 -06:00
dependabot[bot] 749ef7fa45 Bump org.projectlombok:lombok from 1.18.34 to 1.18.36 in /VotingPlugin
Bumps [org.projectlombok:lombok](https://github.com/projectlombok/lombok) from 1.18.34 to 1.18.36.
- [Changelog](https://github.com/projectlombok/lombok/blob/master/doc/changelog.markdown)
- [Commits](https://github.com/projectlombok/lombok/compare/v1.18.34...v1.18.36)

---
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>
2024-11-18 06:16:44 +00:00
BenCodez 3f2a2fa33a Change version system to snapshots 2024-11-17 14:53:33 -06:00
BenCodez 2cb48d655a Disable plugin update checking if using snapshot version 2024-11-17 14:48:32 -06:00
BenCodez 573315dd18 Use snapshot version 2024-11-17 14:45:47 -06:00
BenCodez 63091ad815 Add dev maven profile back 2024-11-17 13:54:30 -06:00
BenCodez 9e88f57bfb Cleanup pom.xml 2024-11-17 12:55:15 -06:00
BenCodez 86d38d6ac9 Set correct java version in pom.xml 2024-11-17 12:28:30 -06:00
BenCodez e752d111a0 Fix pom.xml 2024-11-16 22:04:59 -06:00
BenCodez 0a09d13bb3 Remove unneeded maven profiles 2024-11-16 17:30:04 -06:00
BenCodez 08a6d91996 Fix issue with reload order with GlobalData mysql connection 2024-11-07 08:47:12 -06:00
BenCodez 1082c47297 Flush skull cache not used for a week 2024-11-05 18:08:34 -06:00
BenCodez 531812d800 Check if sever still exists on velocity 2024-11-05 07:31:24 -06:00
BenCodez 903a7232de Use new api 2024-11-04 12:01:30 -06:00
Ben ed1a0c0708 Merge pull request #1392 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-javadoc-plugin-3.11.1
Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.10.1 to 3.11.1 in /VotingPlugin
2024-11-04 07:45:16 -06:00
dependabot[bot] 15f12220a3 Bump org.apache.maven.plugins:maven-javadoc-plugin in /VotingPlugin
Bumps [org.apache.maven.plugins:maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.10.1 to 3.11.1.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.10.1...maven-javadoc-plugin-3.11.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-04 06:55:01 +00:00
BenCodez c24871c34d Add new skull caching delay option 2024-11-03 13:58:25 -06:00
BenCodez 65e180ccf8 Remove all unused skull options 2024-11-03 13:48:02 -06:00
BenCodez 4cc523429d Changes to skull caching 2024-11-03 11:03:27 -06:00
BenCodez 01b5e5f8a1 Remove deprecated code 2024-11-02 16:45:50 -06:00
BenCodez 944458d858 Update to 1.21.3 2024-11-02 16:43:35 -06:00
BenCodez 9beaa4e440 Handle casing differences in position placeholder checking 2024-10-29 10:27:48 -06:00
BenCodez 3c78db5fe6 Update version number to 6.17.2 2024-10-20 13:27:26 -06:00
BenCodez 9400a4fa08 change book placeholder to use [] 2024-10-19 12:29:10 -06:00
BenCodez b4519bc6e7 add %num% placeholder to books 2024-10-18 07:06:53 -06:00
BenCodez f698481b97 More adjustments to global data handling 2024-10-08 15:39:21 -06:00
BenCodez 927641f005 Actually fix time changes on velocity not working correctly 2024-10-07 07:33:08 -06:00
BenCodez d85ad022fb Add extra checks on global data time changes 2024-10-07 07:27:49 -06:00
Ben e39fcd78ca Merge pull request #1390 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-javadoc-plugin-3.10.1
Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.10.0 to 3.10.1 in /VotingPlugin
2024-10-07 07:10:15 -06:00
dependabot[bot] 6800ccd4a7 Bump org.apache.maven.plugins:maven-javadoc-plugin in /VotingPlugin
Bumps [org.apache.maven.plugins:maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.10.0 to 3.10.1.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.10.0...maven-javadoc-plugin-3.10.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-07 06:56:01 +00:00
BenCodez 3065e57b44 Add extra debug for vote shop permission checks 2024-10-06 22:18:31 -06:00
BenCodez fdcf092c7f Update banned players every day 2024-10-06 09:38:56 -06:00
BenCodez 7b9e734ccd Add option to force load skulls 2024-10-02 21:56:13 -06:00
BenCodez 5718e3261a Fix VoteParty increase votes required typo 2024-10-02 17:22:54 -06:00
BenCodez e391ba88e4 Add extra debug to limit monthly votes 2024-10-02 07:31:00 -06:00
BenCodez b7942e763c Fix NPE with placeholder caching invalid placeholders 2024-09-30 13:50:30 -06:00
BenCodez cb039e052c Fix invalid enoughpoints placeholder from creating errors 2024-09-30 08:06:58 -06:00
BenCodez 07a4350f10 Add more debug to login event 2024-09-30 07:20:50 -06:00
BenCodez 44130f6a52 Run everysite reward before votesite reward 2024-09-23 14:46:17 -06:00
Ben 6caf9afc1d Merge pull request #1386 from BenCodez/dependabot/maven/VotingPlugin/org.bstats-bstats-velocity-3.1.0
Bump org.bstats:bstats-velocity from 3.0.3 to 3.1.0 in /VotingPlugin
2024-09-23 07:28:25 -06:00
dependabot[bot] 7428581b4c Bump org.bstats:bstats-velocity from 3.0.3 to 3.1.0 in /VotingPlugin
Bumps [org.bstats:bstats-velocity](https://github.com/Bastian/bStats-Metrics) from 3.0.3 to 3.1.0.
- [Release notes](https://github.com/Bastian/bStats-Metrics/releases)
- [Commits](https://github.com/Bastian/bStats-Metrics/compare/v3.0.3...v3.1.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-23 06:13:42 +00:00
BenCodez a2dc362456 Add placeholder support to voteshop permission 2024-09-05 07:30:18 -04:00
Ben 8d8e904a5f Merge pull request #1382 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-javadoc-plugin-3.10.0
Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.8.0 to 3.10.0 in /VotingPlugin
2024-09-02 07:33:11 -04:00
dependabot[bot] 4485006fbb Bump org.apache.maven.plugins:maven-javadoc-plugin in /VotingPlugin
Bumps [org.apache.maven.plugins:maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.8.0 to 3.10.0.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.8.0...maven-javadoc-plugin-3.10.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-02 06:49:44 +00:00
Ben 6fc3cb9096 Merge pull request #1378 from BenCodez/dependabot/maven/VotingPlugin/org.bstats-bstats-velocity-3.0.3
Bump org.bstats:bstats-velocity from 3.0.2 to 3.0.3 in /VotingPlugin
2024-08-26 07:25:55 -04:00
Ben cdf14896f0 Merge pull request #1379 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-deploy-plugin-3.1.3
Bump org.apache.maven.plugins:maven-deploy-plugin from 3.1.2 to 3.1.3 in /VotingPlugin
2024-08-26 07:25:49 -04:00
dependabot[bot] bdd73b2873 Bump org.apache.maven.plugins:maven-deploy-plugin in /VotingPlugin
Bumps [org.apache.maven.plugins:maven-deploy-plugin](https://github.com/apache/maven-deploy-plugin) from 3.1.2 to 3.1.3.
- [Release notes](https://github.com/apache/maven-deploy-plugin/releases)
- [Commits](https://github.com/apache/maven-deploy-plugin/compare/maven-deploy-plugin-3.1.2...maven-deploy-plugin-3.1.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-26 06:59:28 +00:00
dependabot[bot] e8781a0abe Bump org.bstats:bstats-velocity from 3.0.2 to 3.0.3 in /VotingPlugin
Bumps [org.bstats:bstats-velocity](https://github.com/Bastian/bStats-Metrics) from 3.0.2 to 3.0.3.
- [Release notes](https://github.com/Bastian/bStats-Metrics/releases)
- [Commits](https://github.com/Bastian/bStats-Metrics/compare/v3.0.2...v3.0.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-26 06:59:15 +00:00
BenCodez 0d26b59777 process vote party before broadcast message 2024-08-12 16:09:48 -04:00
BenCodez fa0535cf32 Update to 1.21.1 2024-08-11 16:39:08 -04:00
BenCodez 2353ec321c Remove treatvanishasoffline to be enabled for voteparty reminder 2024-08-11 13:08:36 -04:00
BenCodez cb4646f67d Don't broadcast vote party reminders if vanished 2024-08-11 12:44:48 -04:00
BenCodez 7a500f9cca Fixed voteshop exra items rewards not working 2024-08-09 16:04:32 -04:00
BenCodez b583b71721 Fix Shop.yml not reloading on reload 2024-08-04 20:22:07 -04:00
BenCodez c2fa7c4f90 Update version number to 6.17.1 2024-08-04 13:43:54 -04:00
BenCodez 2b82b8db82 Changes to package relocations 2024-08-02 20:14:09 -04:00
BenCodez c130004201 Remove unused command in plugin.yml 2024-08-02 15:52:17 -04:00
BenCodez 4829c772cb Fix voteshop extra items not working 2024-07-30 16:00:20 -04:00
BenCodez e8bf487d74 Fix /voteshop (shop) not working 2024-07-22 20:26:30 -04:00
Ben f5e9a450f9 Merge pull request #1370 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-javadoc-plugin-3.8.0
Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.7.0 to 3.8.0 in /VotingPlugin
2024-07-22 16:07:57 -04:00
dependabot[bot] ebb44330fd Bump org.apache.maven.plugins:maven-javadoc-plugin in /VotingPlugin
Bumps [org.apache.maven.plugins:maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.7.0 to 3.8.0.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.7.0...maven-javadoc-plugin-3.8.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-22 06:29:26 +00:00
BenCodez 616a102d73 Update version number to 6.17 2024-07-20 19:19:41 -04:00
BenCodez a5b741d92b Remove unneeded debug and changes 2024-07-17 19:59:43 -04:00
BenCodez e7f5000a56 More velocity cache fixes 2024-07-17 19:55:36 -04:00
BenCodez 0615f61f0b Fix typo 2024-07-17 19:48:45 -04:00
BenCodez 2ae913c743 Add temp debug 2024-07-17 19:38:54 -04:00
BenCodez 4ec5bfef4f Add extra log message 2024-07-17 19:21:59 -04:00
BenCodez 33e173448a Changes to proxy debug log message 2024-07-17 19:16:32 -04:00
BenCodez 20671c4504 More changes to vote cache on velocity 2024-07-17 14:49:49 -04:00
BenCodez 16705c5707 Changes to vote cache handling on velocity 2024-07-16 21:34:49 -04:00
BenCodez 549309ee8c Changes to auto conversion 2024-07-04 09:44:11 -04:00
BenCodez 2bb3fac778 Remove extra failsafe for Shop.yml conversion 2024-07-04 09:35:38 -04:00
BenCodez 1e84f3cbc6 Add new LimitVotePoints option to limit max amount of points possible 2024-07-04 07:45:54 -04:00
BenCodez 98a0c9944e Change order of file loading 2024-07-03 07:42:47 -04:00
BenCodez 8016240445 Remove vote shop settings from GUI.yml 2024-07-02 12:45:47 -04:00
BenCodez 4dc5e5c3b6 Add extra failsafe for Shop.yml conversion 2024-07-02 12:44:37 -04:00
Ben 5a4f361d3f Merge pull request #1368 from BenCodez/dependabot/maven/VotingPlugin/org.projectlombok-lombok-1.18.34
Bump org.projectlombok:lombok from 1.18.32 to 1.18.34 in /VotingPlugin
2024-07-01 07:39:55 -04:00
dependabot[bot] 2542cc87d3 Bump org.projectlombok:lombok from 1.18.32 to 1.18.34 in /VotingPlugin
Bumps [org.projectlombok:lombok](https://github.com/projectlombok/lombok) from 1.18.32 to 1.18.34.
- [Changelog](https://github.com/projectlombok/lombok/blob/master/doc/changelog.markdown)
- [Commits](https://github.com/projectlombok/lombok/compare/v1.18.32...v1.18.34)

---
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>
2024-07-01 06:33:43 +00:00
BenCodez b13afd53c1 Added Shop.yml, with auto conversion from GUI.yml 2024-06-30 19:56:38 -04:00
BenCodez c1f9ba24a7 Add link to wiki page for OnlineMode setting 2024-06-24 20:17:07 -04:00
BenCodez 1c20ac60e5 Fix error in spacing 2024-06-24 20:10:02 -04:00
Ben 98a4d7062b Merge pull request #1367 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-jar-plugin-3.4.2
Bump org.apache.maven.plugins:maven-jar-plugin from 3.4.1 to 3.4.2 in /VotingPlugin
2024-06-24 15:53:02 -04:00
dependabot[bot] b08edc007a Bump org.apache.maven.plugins:maven-jar-plugin in /VotingPlugin
Bumps [org.apache.maven.plugins:maven-jar-plugin](https://github.com/apache/maven-jar-plugin) from 3.4.1 to 3.4.2.
- [Release notes](https://github.com/apache/maven-jar-plugin/releases)
- [Commits](https://github.com/apache/maven-jar-plugin/compare/maven-jar-plugin-3.4.1...maven-jar-plugin-3.4.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-24 06:38:04 +00:00
BenCodez 054c8d0361 Update version number to 6.16.3 2024-06-23 14:45:19 -04:00
BenCodez c78141357e Change click bypass to require shift on vote URL 2024-06-18 16:36:45 -04:00
BenCodez 5efd5646f2 Changes to vote url GUI 2024-06-17 16:16:23 -04:00
BenCodez e1c1d7b530 Add paper mapping setting 2024-06-16 17:00:54 -04:00
BenCodez f436b03584 Support left clicking on GUI to show all votesites even without perms 2024-06-16 12:23:34 -04:00
BenCodez e34f5f077f Add ability to hide votesites if no permission 2024-06-15 19:56:11 -04:00
BenCodez e1a059b766 Properly shutdown multi-proxy handling on proxy 2024-06-14 15:58:28 -04:00
BenCodez 9cb7158d84 Update to 1.21 2024-06-13 16:31:47 -04:00
BenCodez 35ce6cc68e Fix timer not shuting down on velocity 2024-06-13 16:27:24 -04:00
BenCodez a7832692b7 Add option UUIDLookup on proxy (default=true) 2024-06-04 20:01:04 -04:00
Ben 8fd7a30720 Merge pull request #1360 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-shade-plugin-3.6.0
Bump org.apache.maven.plugins:maven-shade-plugin from 3.5.3 to 3.6.0 in /VotingPlugin
2024-06-03 15:43:25 -04:00
Ben fdd8f28a29 Merge pull request #1361 from BenCodez/dependabot/maven/VotingPlugin/org.sonatype.plugins-nexus-staging-maven-plugin-1.7.0
Bump org.sonatype.plugins:nexus-staging-maven-plugin from 1.6.13 to 1.7.0 in /VotingPlugin
2024-06-03 15:43:18 -04:00
Ben f9d41d49b2 Merge pull request #1362 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-javadoc-plugin-3.7.0
Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.6.3 to 3.7.0 in /VotingPlugin
2024-06-03 15:43:07 -04:00
dependabot[bot] 456e43b37a Bump org.apache.maven.plugins:maven-javadoc-plugin in /VotingPlugin
Bumps [org.apache.maven.plugins:maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.6.3 to 3.7.0.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.6.3...maven-javadoc-plugin-3.7.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-03 06:47:51 +00:00
dependabot[bot] 2cbf12cf1e Bump org.sonatype.plugins:nexus-staging-maven-plugin in /VotingPlugin
Bumps org.sonatype.plugins:nexus-staging-maven-plugin from 1.6.13 to 1.7.0.

---
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>
2024-06-03 06:45:32 +00:00
dependabot[bot] aeac53a5a7 Bump org.apache.maven.plugins:maven-shade-plugin in /VotingPlugin
Bumps [org.apache.maven.plugins:maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.5.3 to 3.6.0.
- [Release notes](https://github.com/apache/maven-shade-plugin/releases)
- [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.5.3...maven-shade-plugin-3.6.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>
2024-06-03 06:45:27 +00:00
BenCodez 2ea402b67c Check offline rewards on resume 2024-06-02 15:52:43 -04:00
BenCodez ba1b8cafcd Change vote party timing 2024-06-02 15:30:21 -04:00
BenCodez 5984ee15b5 Always update last vote party for each day 2024-06-02 14:06:19 -04:00
BenCodez a13b5ee7a2 Add new VoteTotal to rewards as a requirement 2024-06-01 19:44:24 -04:00
BenCodez 56e6a659fe Added ability to pause/resume rewards globally via commands 2024-06-01 19:17:51 -04:00
BenCodez 56f5611a96 Change reward placeholder name 2024-05-30 20:02:35 -04:00
BenCodez a828450846 Add placeholder to voteparty rewards for first vote party today 2024-05-30 20:01:44 -04:00
BenCodez 3f8495d0f7 Added option to only shows sites to vote on still on all urls 2024-05-30 19:56:51 -04:00
BenCodez bbb2df5f16 Added option to enable/disable internal papi expansion 2024-05-28 15:52:12 -04:00
Ben 40eb9b0afc Merge pull request #1358 from BenCodez/dependabot/maven/VotingPlugin/me.clip-placeholderapi-2.11.6
Bump me.clip:placeholderapi from 2.11.5 to 2.11.6 in /VotingPlugin
2024-05-27 15:58:06 -04:00
dependabot[bot] 545eb0cd69 Bump me.clip:placeholderapi from 2.11.5 to 2.11.6 in /VotingPlugin
Bumps me.clip:placeholderapi from 2.11.5 to 2.11.6.

---
updated-dependencies:
- dependency-name: me.clip:placeholderapi
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-27 06:44:10 +00:00
BenCodez 050bfb3055 Update version number to 6.16.2 2024-05-26 16:31:33 -04:00
BenCodez 3ce40de5f6 Update utils classes 2024-05-20 15:19:00 -04:00
BenCodez 095cd2a422 Update imports 2024-05-20 14:45:26 -04:00
BenCodez 5e7cc2b7ad Add relocation to pom.xml 2024-05-20 14:02:55 -04:00
BenCodez 38c61ce669 Update imports 2024-05-20 13:50:11 -04:00
BenCodez 9de71167ec Update imports 2024-05-20 13:16:18 -04:00
BenCodez e8b9c9fbc2 Update imports 2024-05-20 12:46:40 -04:00
BenCodez 60ac9fcd46 Use newer classes 2024-05-20 10:37:14 -04:00
BenCodez a0d334c88b Fix minor spacing error 2024-05-07 19:14:30 -04:00
BenCodez b90b4964e4 Add relocation pattern to fix javadoc 2024-05-07 19:02:00 -04:00
BenCodez a0fbdaa2a0 Update version number to 6.16.1 2024-05-07 18:58:14 -04:00
BenCodez 17066cb679 Stop background timer on velocity on shutdown 2024-05-06 16:04:00 -04:00
Ben 9eb1ba82af Merge pull request #1352 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-deploy-plugin-3.1.2
Bump org.apache.maven.plugins:maven-deploy-plugin from 3.1.1 to 3.1.2 in /VotingPlugin
2024-05-06 15:48:27 -04:00
dependabot[bot] 06b12c9599 Bump org.apache.maven.plugins:maven-deploy-plugin in /VotingPlugin
Bumps [org.apache.maven.plugins:maven-deploy-plugin](https://github.com/apache/maven-deploy-plugin) from 3.1.1 to 3.1.2.
- [Release notes](https://github.com/apache/maven-deploy-plugin/releases)
- [Commits](https://github.com/apache/maven-deploy-plugin/compare/maven-deploy-plugin-3.1.1...maven-deploy-plugin-3.1.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-06 06:19:25 +00:00
BenCodez fe277d8bfd Update version number to 6.16 2024-05-05 13:30:18 -04:00
BenCodez 86cba23568 Add lastmonth position placeholder 2024-05-01 20:17:42 -04:00
BenCodez 5a6140020f Merge branch 'master' of https://github.com/BenCodez/VotingPlugin 2024-05-01 16:15:13 -04:00
BenCodez cb203edecf Update to 1.20.6 2024-04-30 21:13:21 -04:00
Ben 5510e3bb98 Merge pull request #1350 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-shade-plugin-3.5.3
Bump org.apache.maven.plugins:maven-shade-plugin from 3.5.2 to 3.5.3 in /VotingPlugin
2024-04-29 16:07:56 -04:00
dependabot[bot] 470c52e6e3 Bump org.apache.maven.plugins:maven-shade-plugin in /VotingPlugin
Bumps [org.apache.maven.plugins:maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.5.2 to 3.5.3.
- [Release notes](https://github.com/apache/maven-shade-plugin/releases)
- [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.5.2...maven-shade-plugin-3.5.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-29 06:53:18 +00:00
BenCodez 03e4c2165e Fix command casing 2024-04-28 14:50:10 -04:00
BenCodez 45d617106b Fix issues with command aliases not always working 2024-04-28 14:09:48 -04:00
BenCodez 58869742bc Update to 1.20.5 2024-04-23 19:34:57 -04:00
Ben a8841ca732 Merge pull request #1348 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-jar-plugin-3.4.1
Bump org.apache.maven.plugins:maven-jar-plugin from 3.4.0 to 3.4.1 in /VotingPlugin
2024-04-22 16:50:25 -04:00
dependabot[bot] 96ef82aef0 Bump org.apache.maven.plugins:maven-jar-plugin in /VotingPlugin
Bumps [org.apache.maven.plugins:maven-jar-plugin](https://github.com/apache/maven-jar-plugin) from 3.4.0 to 3.4.1.
- [Release notes](https://github.com/apache/maven-jar-plugin/releases)
- [Commits](https://github.com/apache/maven-jar-plugin/compare/maven-jar-plugin-3.4.0...maven-jar-plugin-3.4.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-22 06:44:29 +00:00
BenCodez 5a33b5b892 Changes to almostallsites rewards trigger 2024-04-18 16:57:50 -04:00
Ben ed2fb77a7b Merge pull request #1347 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-jar-plugin-3.4.0
Bump org.apache.maven.plugins:maven-jar-plugin from 3.3.0 to 3.4.0 in /VotingPlugin
2024-04-15 16:42:58 -04:00
dependabot[bot] 8a1c820e42 Bump org.apache.maven.plugins:maven-jar-plugin in /VotingPlugin
Bumps [org.apache.maven.plugins:maven-jar-plugin](https://github.com/apache/maven-jar-plugin) from 3.3.0 to 3.4.0.
- [Release notes](https://github.com/apache/maven-jar-plugin/releases)
- [Commits](https://github.com/apache/maven-jar-plugin/compare/maven-jar-plugin-3.3.0...maven-jar-plugin-3.4.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-15 06:39:42 +00:00
BenCodez 43c5419453 Add additional debug for almostallsites reward 2024-04-14 14:14:51 -04:00
BenCodez 4f2caf67d0 Fix issue with conditional items and rewards in VoteGUI 2024-04-13 08:22:09 -04:00
BenCodez 8b17e43ce0 Adjustments to getting votesites 2024-04-10 20:24:39 -04:00
BenCodez 05db0b189b Add /av correctservicesites command 2024-04-09 20:48:25 -04:00
BenCodez 93f91923bb Slightly adjust vote next time caculations for votedailydaily sites 2024-04-09 17:09:09 -04:00
BenCodez 6dca3ad152 Slight change vote next time caculation 2024-04-07 13:14:59 -04:00
BenCodez 637db5afdb Changes to placeholders 2024-04-06 20:03:14 -04:00
BenCodez 029fa00e3a Fix typo 2024-04-06 19:46:11 -04:00
BenCodez e1bb95c482 Use only enabled votesites for monthly total 2024-04-06 15:58:17 -04:00
BenCodez 667b1b082d change log message to debug 2024-03-29 14:11:09 -04:00
BenCodez 2097fc4b86 Add new advanced service site handling feature, experimental 2024-03-28 20:53:29 -04:00
Ben 49d20c0bc8 Merge pull request #1341 from BenCodez/dependabot/maven/VotingPlugin/org.projectlombok-lombok-1.18.32
Bump org.projectlombok:lombok from 1.18.30 to 1.18.32 in /VotingPlugin
2024-03-25 16:47:05 -04:00
dependabot[bot] fe2ac4f02c Bump org.projectlombok:lombok from 1.18.30 to 1.18.32 in /VotingPlugin
Bumps [org.projectlombok:lombok](https://github.com/projectlombok/lombok) from 1.18.30 to 1.18.32.
- [Changelog](https://github.com/projectlombok/lombok/blob/master/doc/changelog.markdown)
- [Commits](https://github.com/projectlombok/lombok/compare/v1.18.30...v1.18.32)

---
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>
2024-03-25 06:29:20 +00:00
BenCodez 4859c37ef8 Fix status command on velocity not working 2024-03-23 22:13:28 -04:00
BenCodez c818007426 Fix issue with multi-proxy redis on velocity 2024-03-23 20:48:31 -04:00
Ben c86f07aeb6 Create FUNDING.yml 2024-03-22 16:57:09 -04:00
BenCodez 0a74e338c2 More fixes for cooldown events 2024-03-19 21:15:04 -04:00
BenCodez d1dc8b392f Added neededvotes placeholder to broadcast 2024-03-17 17:35:02 -04:00
BenCodez bd5234b479 Adjustments to vote delay daily can vote caculations 2024-03-16 14:58:04 -04:00
BenCodez cca9e3dc58 Added votesrequired placeholder to broadcasts 2024-03-16 08:38:52 -04:00
BenCodez c3df294ce6 Changes for vote delay daily sites issues 2024-03-15 17:04:15 -04:00
BenCodez d81a113240 More changes to cooldown events 2024-03-12 20:45:36 -04:00
BenCodez f2feafa45a Changes to cooldown checks 2024-03-12 20:37:58 -04:00
BenCodez f63a743c2c Change default displayitem material on auto generated votesites 2024-03-09 19:51:12 -05:00
BenCodez 2d9c6482fc Add placeholders for time until month and week changes 2024-03-09 19:46:18 -05:00
BenCodez 448a9eeea9 Add placeholderapi placeholder %votingplugin_sitesavailable% 2024-03-08 18:48:52 -05:00
BenCodez c8e32696af Adjustments to cooldown checks 2024-03-06 20:49:56 -05:00
BenCodez 36eb6eafb3 Add votedelay and votehour placeholders 2024-03-05 19:03:05 -05:00
BenCodez 040fafe33a Add better handling of more than 2 proxies in multi-proxy setup 2024-03-03 14:43:13 -05:00
BenCodez 040e467761 Fix issue with new placeholder not always working 2024-02-29 19:08:01 -05:00
BenCodez e0d28be260 Fix typo in debug 2024-02-28 19:33:57 -05:00
BenCodez 1ef2440bf9 Add more placeholders to VoteURL GUI 2024-02-28 19:07:25 -05:00
Ben 2a5d5d3bea Merge pull request #1336 from Melon-Oof/master
Update BungeeSettings.yml
2024-02-27 16:39:55 -05:00
Melon-Oof 419153d654 Update BungeeSettings.yml 2024-02-27 17:14:21 +01:00
Ben ed8c504c27 Merge pull request #1335 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-shade-plugin-3.5.2
Bump org.apache.maven.plugins:maven-shade-plugin from 3.5.1 to 3.5.2 in /VotingPlugin
2024-02-26 16:47:58 -05:00
dependabot[bot] 2c29f11a8b Bump org.apache.maven.plugins:maven-shade-plugin in /VotingPlugin
Bumps [org.apache.maven.plugins:maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.5.1 to 3.5.2.
- [Release notes](https://github.com/apache/maven-shade-plugin/releases)
- [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.5.1...maven-shade-plugin-3.5.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-26 06:30:21 +00:00
BenCodez c442cd1deb Add ability to set prefix for redis channels 2024-02-23 20:46:03 -05:00
BenCodez 770e3e866c First implementation of multi-proxy redis 2024-02-23 20:30:32 -05:00
BenCodez 4014046444 Save vote cache file more often on proxy 2024-02-21 19:11:16 -05:00
BenCodez 6f378297dd Recode of multi-proxy backend for prep of redis multi-proxy 2024-02-18 20:24:05 -05:00
BenCodez 1c5c33be6a Update version number to 6.15.1 2024-02-17 20:33:16 -05:00
BenCodez 206665a40b Fix rare ConcurrentModificationException 2024-02-17 15:03:39 -05:00
BenCodez 159eb54e4e Fixed issue with used percentage for vote streaks not working 2024-02-11 13:43:15 -05:00
BenCodez f63ab7b693 Added more debug to votestreak 2024-02-10 08:07:16 -05:00
BenCodez 97e5f73774 Add new merge command to combine user totals 2024-02-05 20:30:57 -05:00
BenCodez 9f85149776 Add players to non voted cache before checking if they are online 2024-02-03 21:34:02 -05:00
BenCodez d6fa68dead Force mutli-proxy login message regardless of allowunjoined setting 2024-02-03 19:12:40 -05:00
BenCodez 5e42fdbfbe Fix remove offline uuids command 2024-02-02 20:25:24 -05:00
BenCodez 9b20d1754b Changes to rmeoveofflineuuids command 2024-02-02 19:50:49 -05:00
BenCodez d310fa3688 Add command to remove offline uuids from database 2024-02-02 19:33:43 -05:00
Ben 7ab3e8040c Merge pull request #1330 from NahuLD/patch-1
Fix issue with RedisHandler initialization utilizing wrong parameters
2024-02-02 10:10:09 -05:00
Nahuel Dolores 5173c24546 Fix issue with RedisHandler initialization utilizing wrong parameters 2024-02-02 10:21:03 -03:00
BenCodez 0c1cccfdcd Save reminds on toggle reminders command 2024-01-31 20:57:05 -05:00
BenCodez d36cd47597 Fix default config for vote reminding comments 2024-01-28 16:42:18 -05:00
BenCodez 6f34d11138 Add extra checks for milestones on proxy setups 2024-01-28 13:53:12 -05:00
Ben bf3f7bb6ad Merge pull request #1328 from BenCodez/dependabot/maven/VotingPlugin/net.md-5-bungeecord-api-1.20-R0.2
Bump net.md-5:bungeecord-api from 1.20-R0.1 to 1.20-R0.2 in /VotingPlugin
2024-01-22 16:51:53 -05:00
dependabot[bot] 28f74aa50a Bump net.md-5:bungeecord-api in /VotingPlugin
Bumps [net.md-5:bungeecord-api](https://github.com/SpigotMC/BungeeCord) from 1.20-R0.1 to 1.20-R0.2.
- [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>
2024-01-22 06:47:54 +00:00
BenCodez dc3c605315 Bypass fake votes for WaitUntilVoteDelay 2023-12-31 15:22:44 -05:00
BenCodez 5abc8004c7 Add option to reset extra votes required weekly 2023-12-31 13:43:24 -05:00
BenCodez bf1e971edd Add bypass permission for waituntilvotedelay 2023-12-31 12:55:30 -05:00
BenCodez 37c767dc74 Update version number to 6.15 2023-12-26 10:25:49 -05:00
BenCodez 8257b4f7f6 Add option to not hide voteshop item with no permission 2023-12-16 19:47:13 -05:00
BenCodez 0340f4512e Handle multi-proxy logins on velocity like bungee 2023-12-16 19:16:16 -05:00
BenCodez c45ce0d090 Fix a minor issue on velocity for redis 2023-12-13 19:58:14 -05:00
BenCodez add3dcaa26 Initial implementation of redis bungee method 2023-12-13 19:56:44 -05:00
BenCodez 4a88b10e61 Fix gotten milestones not resetting if per server milestones enabled 2023-12-12 17:55:32 -05:00
BenCodez 7001d0f7fc Update to 1.20.3 2023-12-05 19:04:31 -05:00
Ben fdf72b14eb Merge pull request #1318 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-javadoc-plugin-3.6.3
Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.6.2 to 3.6.3 in /VotingPlugin
2023-12-04 17:36:45 -05:00
dependabot[bot] 830de0388a Bump org.apache.maven.plugins:maven-javadoc-plugin in /VotingPlugin
Bumps [org.apache.maven.plugins:maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.6.2 to 3.6.3.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.6.2...maven-javadoc-plugin-3.6.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-04 06:52:55 +00:00
BenCodez 4a77c6bdd3 Add DisableReminders placeholder 2023-12-02 20:32:06 -05:00
BenCodez 579844f193 Save vote reminding toggles across restarts 2023-12-01 21:34:06 -05:00
BenCodez 4c6073c02a Add checks to matching server name in BungeeSettings.yml 2023-12-01 20:23:21 -05:00
Ben b1eb591e20 Merge pull request #1315 from NotAlexNoyle/master
Apply license to project root
2023-11-24 17:47:03 -05:00
NotAlexNoyle f5ee776586 Apply license to project root 2023-11-24 21:26:07 +01:00
BenCodez a2bf7c3dfc Update version number to 6.14.2 2023-11-19 19:07:25 -05:00
BenCodez 0543a91c5a Remove deprecated api 2023-11-17 18:34:36 -05:00
Ben d88868c4f7 Merge pull request #1312 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-javadoc-plugin-3.6.2
Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.6.0 to 3.6.2 in /VotingPlugin
2023-11-13 18:30:35 -05:00
dependabot[bot] 86dc52f131 Bump org.apache.maven.plugins:maven-javadoc-plugin in /VotingPlugin
Bumps [org.apache.maven.plugins:maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.6.0 to 3.6.2.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.6.0...maven-javadoc-plugin-3.6.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-13 06:24:14 +00:00
BenCodez f7d88a26ef Handle allowunjoined disabled on multi-proxy setup 2023-11-05 20:16:52 -05:00
BenCodez ab1468d03a Changes to bedrock player support 2023-10-30 20:01:24 -04:00
Ben 3c65365b83 Merge pull request #1311 from BenCodez/dependabot/maven/VotingPlugin/me.clip-placeholderapi-2.11.5
Bump me.clip:placeholderapi from 2.11.4 to 2.11.5 in /VotingPlugin
2023-10-30 17:38:13 -04:00
dependabot[bot] bfefbb59d6 Bump me.clip:placeholderapi from 2.11.4 to 2.11.5 in /VotingPlugin
Bumps me.clip:placeholderapi from 2.11.4 to 2.11.5.

---
updated-dependencies:
- dependency-name: me.clip:placeholderapi
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-30 06:06:35 +00:00
BenCodez 9d74b5e428 Changes to handling ignoring bungee time change votes 2023-10-23 19:42:16 -04:00
BenCodez f131ce948c Force update placeholders on every vote to prevent issues 2023-10-22 12:45:09 -04:00
BenCodez 1a78a23e7c Shorten shutdown time 2023-10-17 16:52:35 -04:00
BenCodez 16cdfec4d5 Add player placeholder to vote reminder broadcast for voteparty 2023-10-13 16:49:45 -04:00
BenCodez 243300534c Add vote reminder broadcasts to vote party, WIP 2023-10-12 20:04:02 -04:00
BenCodez ea646b8e6f Ignore daily total for max amount of votes per day option 2023-10-08 12:34:07 -04:00
BenCodez bd5532aa71 Add vote limit feature to proxy setup 2023-10-05 20:55:20 -04:00
BenCodez be033793c2 Changes to limit monthly votes 2023-10-04 16:50:10 -04:00
BenCodez 28ce76bc60 Allow limit monthly votes to work on PLUGINMESSAGING 2023-10-01 16:36:10 -04:00
BenCodez 10732ee978 Limit monthly votes each day instead of at the end of the month 2023-10-01 13:54:05 -04:00
BenCodez 7deccf2e26 Minor changes to voteparty on proxy setup 2023-09-26 16:50:28 -04:00
Ben 8873fc8263 Merge pull request #1302 from BenCodez/dependabot/maven/VotingPlugin/me.clip-placeholderapi-2.11.4
Bump me.clip:placeholderapi from 2.11.3 to 2.11.4 in /VotingPlugin
2023-09-25 16:45:05 -04:00
Ben aaaaf2c670 Merge pull request #1303 from BenCodez/dependabot/maven/VotingPlugin/org.projectlombok-lombok-1.18.30
Bump org.projectlombok:lombok from 1.18.28 to 1.18.30 in /VotingPlugin
2023-09-25 16:44:50 -04:00
Ben 1e8421f83f Merge pull request #1304 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-shade-plugin-3.5.1
Bump org.apache.maven.plugins:maven-shade-plugin from 3.5.0 to 3.5.1 in /VotingPlugin
2023-09-25 16:44:45 -04:00
dependabot[bot] a29a7bf5c3 Bump org.apache.maven.plugins:maven-shade-plugin in /VotingPlugin
Bumps [org.apache.maven.plugins:maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.5.0 to 3.5.1.
- [Release notes](https://github.com/apache/maven-shade-plugin/releases)
- [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.5.0...maven-shade-plugin-3.5.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-25 06:33:21 +00:00
dependabot[bot] fae67a49ce Bump org.projectlombok:lombok from 1.18.28 to 1.18.30 in /VotingPlugin
Bumps [org.projectlombok:lombok](https://github.com/projectlombok/lombok) from 1.18.28 to 1.18.30.
- [Changelog](https://github.com/projectlombok/lombok/blob/master/doc/changelog.markdown)
- [Commits](https://github.com/projectlombok/lombok/compare/v1.18.28...v1.18.30)

---
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-09-25 06:33:11 +00:00
dependabot[bot] c48a0c1083 Bump me.clip:placeholderapi from 2.11.3 to 2.11.4 in /VotingPlugin
Bumps me.clip:placeholderapi from 2.11.3 to 2.11.4.

---
updated-dependencies:
- dependency-name: me.clip:placeholderapi
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-25 06:33:05 +00:00
BenCodez 37e29b8643 Update version number to 6.14.1 2023-09-23 20:42:13 -04:00
BenCodez f683cc66c1 Update to 1.20.2 2023-09-22 19:54:16 -04:00
BenCodez 2059832df8 Small change to bungee all sites reward 2023-09-18 19:24:52 -04:00
Ben bda5e61898 Merge pull request #1299 from BenCodez/dependabot/maven/VotingPlugin/org.apache.maven.plugins-maven-javadoc-plugin-3.6.0
Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.5.0 to 3.6.0 in /VotingPlugin
2023-09-18 16:53:46 -04:00
dependabot[bot] dcb5f67ba8 Bump org.apache.maven.plugins:maven-javadoc-plugin in /VotingPlugin
Bumps [org.apache.maven.plugins:maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.5.0 to 3.6.0.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.5.0...maven-javadoc-plugin-3.6.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-18 06:23:29 +00:00
BenCodez e6065f85cc Adjust allsites check for bungee a bit 2023-09-17 15:18:17 -04:00
BenCodez e0d3d36349 Add option to give extra allsites rewards when on PLUGINMESSAGING 2023-09-17 14:49:57 -04:00
BenCodez ab4d2069eb A lot of internal changes 2023-09-17 13:01:53 -04:00
BenCodez 84f8f9073d Adjustments to cooldown rewards checking 2023-09-10 20:02:31 -04:00
BenCodez 1e9828f594 Adjust cooldown checks a bit more 2023-09-09 21:16:37 -04:00
BenCodez a01050125b Make sure reset time is exactly the right second 2023-09-09 21:13:25 -04:00
BenCodez 60957be6fe Delay votesite cooldown checks a bit 2023-09-09 21:03:35 -04:00
BenCodez a2b094f7d8 Change some debug messages to log messages temporary 2023-09-09 08:49:53 -04:00
BenCodez 56e9705a6e Adjust cooldown checks slightly 2023-09-07 17:24:57 -04:00
BenCodez ad62da3221 Changes to placeholder caching 2023-09-05 21:15:10 -04:00
BenCodez c1421d6324 Add more placeholder cache updates on bungee votes 2023-09-05 20:51:43 -04:00
BenCodez 068c2b704e Add luckperms to softdepend 2023-09-05 17:21:16 -04:00
BenCodez 89d21044d2 Small code cleanup 2023-09-03 21:22:47 -04:00
BenCodez 98246613ca Remove debug messages 2023-09-03 21:22:19 -04:00
BenCodez ee884ee06a More fixes for vote cooldown events/rewards 2023-09-03 21:19:45 -04:00
BenCodez 355ca2cdf0 Add placeholders for last month top voters 2023-09-03 19:54:32 -04:00
BenCodez abc37be619 Small changes to account for using placeholder cache on next placeholder 2023-09-03 14:28:01 -04:00
BenCodez 20d9c08630 Edit votesites.yml comments slightly for new option 2023-09-03 14:15:54 -04:00
BenCodez 523c9e4ef9 Add gui editing ability for VoteDelayDailyHour 2023-09-03 14:14:52 -04:00
BenCodez 76b19f7fb3 Use new VoteDelayDailyHour option to fix issues with vote delay daily 2023-09-03 14:10:33 -04:00
BenCodez d776d0d798 Delay opening voteshop confirm slightly 2023-09-03 12:33:34 -04:00
BenCodez b63da09fe8 Add command to force check cooldown rewards 2023-09-01 19:29:40 -04:00
BenCodez d626210804 Changes to cooldown rewards checking 2023-09-01 19:26:38 -04:00
BenCodez 777c198471 Small changes to cool down checks 2023-08-30 20:15:43 -04:00
BenCodez dbd52a9114 Slight modifications to cooldown checks 2023-08-28 17:10:47 -04:00
BenCodez 3208b865e6 Removed config auto update option 2023-08-27 15:21:06 -04:00
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
BenCodez e59b171aae Fix deploying profiles 2023-06-17 20:19:31 -04:00
BenCodez 36cfe6c9c6 Update version to 6.13.1 2023-06-17 20:14:32 -04:00
BenCodez 45a413c3a6 Fix minor issue 2023-06-16 16:45:06 -04:00
Ben a640582278 Merge pull request #1275 from akdukaan/patch-2
check milestones in /av user all addmilestonecount
2023-06-16 16:44:07 -04:00
akdukaan 94122a1c80 check milestones in /av user all addmilestonecount 2023-06-15 22:35:28 -05:00
BenCodez 0448278ba1 Fix issue with messages on commands 2023-06-15 17:18:09 -04:00
BenCodez 097bff23a2 Small api change 2023-06-15 16:56:31 -04:00
BenCodez be76d8f4af Support all players on addmilestonecount command 2023-06-15 16:45:58 -04:00
BenCodez 6122805c0d Update cache of onlines players with cleargottenmilestones on all users 2023-06-14 21:44:47 -04:00
BenCodez 392d5cb17a Remove command alias 2023-06-14 21:40:06 -04:00
BenCodez ec1352d52b Add support for clearing all gotten milestones for all players 2023-06-14 21:38:35 -04:00
BenCodez c3a4db1ac8 Update spigot 1.20.1 2023-06-12 17:27:05 -04:00
BenCodez 442eb35a4f Add debug log message if loading vote top last month 2023-06-09 17:06:21 -04:00
BenCodez d0851a9365 Update to 1.20 2023-06-07 19:45:35 -04:00
BenCodez 5273745be5 Remove suppress warnings 2023-06-04 21:00:31 -04:00
BenCodez ca937f6879 edit dependency 2023-06-04 20:48:23 -04:00
BenCodez a4c4fa5556 Fix issue 2023-06-04 20:45:20 -04:00
BenCodez 480c303f2f Add maven profile for folia 2023-06-04 20:44:06 -04:00
BenCodez 347640f346 Fix an issue 2023-06-04 20:23:47 -04:00
BenCodez 1d8314c0eb Test change for java 8 support 2023-06-04 17:24:53 -04:00
BenCodez 20d95baea9 Chnages to placeholder handling 2023-06-04 15:24:49 -04:00
BenCodez 510f400c1b Update placeholders every minute 2023-06-03 15:11:41 -04:00
BenCodez c49d0b3ede Add extra log messages for top voter rewards 2023-06-01 21:32:04 -04:00
BenCodez ff197cb6b6 Add folia support, upgrade to java 17, credits to LOOHP 2023-05-31 20:12:08 -04:00
Ben 9e4605258b Delete stale.yml 2023-05-30 20:26:39 -04:00
Ben c54e8bc8bd Merge pull request #1273 from BenCodez/BenCodez-patch-1
Create stale.yml
2023-05-30 20:25:57 -04:00
Ben fe937b8f8d Create stale.yml 2023-05-30 20:25:45 -04:00
BenCodez d262b3689a Apply voteshop option to voteshop command 2023-05-28 20:06:43 -04:00
BenCodez aac5226fce Change handling of givepoints command 2023-05-28 12:34:29 -04:00
BenCodez 1d1b9722ac Add comments to config option 2023-05-26 19:52:12 -04:00
BenCodez 94193501ba Add new config options for give points command 2023-05-26 19:50:10 -04:00
BenCodez 2b142316dc Add method for adding points async if needed 2023-05-22 17:42:20 -04:00
BenCodez a06124e49c Set points async on vote shop purchase 2023-05-22 17:41:01 -04:00
BenCodez c1bd04f117 Minor user data handling change 2023-05-21 20:19:10 -04:00
BenCodez 4272d15a8b Add config option for tracking vote shop purchases 2023-05-20 18:51:02 -04:00
BenCodez 0537dad68e Track number of purchases with voteshop 2023-05-20 07:59:39 -04:00
BenCodez c1f09a6bd9 Edit config comments 2023-05-16 21:31:04 -04:00
BenCodez 69ea7c71b3 Minor change 2023-05-16 21:30:29 -04:00
BenCodez 3052f28b2c Add option for voteshop check on purchase 2023-05-16 21:28:56 -04:00
BenCodez 892d23e0d0 Add gui option to reopen shop gui on purchase 2023-05-14 19:39:51 -04:00
117 changed files with 11025 additions and 7405 deletions

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
# These are supported funding model platforms
github: BenCodez # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
#patreon: # Replace with a single Patreon username
#open_collective: # Replace with a single Open Collective username
#ko_fi: # Replace with a single Ko-fi username
#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
#liberapay: # Replace with a single Liberapay username
#issuehunt: # Replace with a single IssueHunt username
#lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
#polar: # Replace with a single Polar username
#buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
custom: ["https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YQBX25RTXJ5DG"]
+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"
-17
View File
@@ -1,17 +0,0 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 20
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 5
# Issues with these labels will never be considered stale
exemptLabels:
- Priority
- nonstale
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
+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'
+27
View File
@@ -0,0 +1,27 @@
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: Mark stale issues and pull requests
on:
schedule:
- cron: '19 16 * * *'
jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'Stale issue message'
stale-pr-message: 'Stale pull request message'
stale-issue-label: 'no-issue-activity'
stale-pr-label: 'no-pr-activity'
File renamed without changes.
+1
View File
@@ -5,3 +5,4 @@
/*.iml
/.settings/
/.classpath
/.factorypath
+29
View File
@@ -14,8 +14,19 @@ UseBungeecord: false
# SOCKETS
# PLUGINMESSAGING (Recommended)
# MYSQL
# REDIS (2nd Most Recommended)
BungeeMethod: PLUGINMESSAGING
# Use Redis for between server communication, set BungeeMethod to REDIS to use this
Redis:
Host: localhost
Port: 6379
# To get the user name, run redis-cli, if you set a password, run "auth <your password>" and if the out put is "OK" run "ACL USERS"
Username: 'default'
Password: ''
# Set a prefix from an entire proxy network if using multi-proxy setup below
Prefix: ''
# Enables more debug messages for communication between servers
# Use /votingpluginbungee status for testing communication
BungeeDebug: false
@@ -52,6 +63,13 @@ PerServerPoints: false
# Should allow some compability with other plugins
TriggerVotifierEvent: false
# If enabled plugin will give extra allsites reward if deterimned that it should
# E.g. user votes offline for 7 days, they will only get 1 allsites reward by default
# When enabled, they should get 7
# Only applies to PLUGINMESSAGING
# Recommend enabling ExtraAllSitesCheck in config.yml as well
GiveExtraAllSitesRewards: false
# What server this is in bungee (must match)
# Also can be applied to rewards
Server: PleaseSet
@@ -66,6 +84,17 @@ BungeeVotePartyRewards: {}
# This runs a one time command only
BungeeVotePartyGlobalCommands: []
# Default is vp:vp, can be changed to prevent potential exploits
# Must match on all servers
# This setting requires a restart
PluginMessageChannel: "vp:vp"
# Use this to encrypt the plugin messages
# Must be set on all servers the same
# Copy secretkey.key file to all servers (They all must match)
# This setting requires a restart
PluginMessageEncryption: false
####################################################################################
# Global mysql data handle for between server commmunications
# This is NOT required for bungee voting to work
+122 -17
View File
@@ -50,7 +50,7 @@ VoteReminding:
# Requires VoteDelays to be setup properly
# Use /vote next to see when you can be reminded
# Players require the perm "VotingPlugin.Login.RemindVotes" or "VotingPlugin.Player"
# To remind if any votesite is available (rather than all) use the permission "VotingPlugin.Login.RemindVotes.Any"
# To remind if all votesites are available (rather than any) use the permission "VotingPlugin.Login.RemindVotes.All"
Enabled: true
# Will remind player on login if he can vote
@@ -129,6 +129,9 @@ Format:
# If you want to want to use the feature below where the plugin will
# automaticly list the sites then set the message in the text above
AutoInputSites: true
# If true only show links on all urls that need to be voted on still
OnlyShowSitesToVote: false
# For each VoteSite
# make sure to set VoteURL in your VoteSites
# Requires above to be true
@@ -172,6 +175,8 @@ Format:
TimeFormat: '%amount% %TimeType%'
LastVoted: '%times% ago'
NeverVoted: 'Never voted'
# Whether or not to include seconds into last voted time
IncludeSeconds: true
# Format for /vote total
Total:
@@ -245,6 +250,16 @@ Format:
# %Points% = player points
Points: '&a%Player% currently has &a&l%Points%&a Points!'
# /vote givepoints command
# Transfer between players command
# Enable command below
GivePoints:
NotEnoughPoints: '&cNot enough points'
NotJoinedServer: '&c%player% has not joined the server'
NumberLowerThanZero: '&cNumber of points needs to be greater than 0'
TransferFrom: '&c%transfer% points given to %touser%'
TransferTo: '&cYou received %transfer% points from %fromuser%'
ToggleBroadcasts:
Enabled: '&cYou will now see vote broadcasts'
Disabled: '&cYou will no longer see vote broadcasts'
@@ -321,6 +336,11 @@ Format:
Weekly: 'Weekly'
Monthly: 'Monthly'
AllTime: 'AllTime'
# Invalid command messages
InvalidCommand:
Vote: '&4No valid arguments, see /vote help!'
AdminVote: '&4No valid arguments, see /adminvote help!'
# Playernames to not be broadcasted when voting
# case sensitive
@@ -409,8 +429,10 @@ LogVotesToFile: false
UsePrimaryAccountForPlaceholders: false
# Valid Options:
# AUTO - Auto cache after they have been used (Recommended)
# SPECIFIC - Only cache certain placeholders
# AUTOALL - Auto cache placeholders after they have been used and cache all players placeholder all the time
# AUTO - Auto cache after they have been used and cache online players placeholders (Recommended)
# SPECIFIC - Only cache certain placeholders for online players
# SPECIFICALL - Only cache certain placeholders for all players
# NONE - Don't cache any placeholders
PlaceholderCacheLevel: AUTO
@@ -437,10 +459,15 @@ 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: {}
# Load votingplugin internal expansion
LoadInteralExpansion: true
###########################################
# Login options
@@ -454,7 +481,7 @@ TreatVanishAsOffline: false
DelayLoginEvent: 0
# Wait until user is logged in with AuthMe
# Requires AuthMe
# Requires AuthMe or LoginSecurity
WaitUntilLoggedIn: true
###########################################
@@ -496,21 +523,30 @@ QueueVotesDuringTimeChange: false
# Most cases this will work all the time
AutoCreateVoteSites: true
# Experiemtental feature
# Uses https://github.com/BenCodez/VotingPlugin/wiki/Minecraft-Server-Lists
# Not all voting sites use the domain name as the service sites
# This feature is an attempt to ease setup for new users by matching domain name to actual service site
AdvancedServiceSiteHandling: false
# Set this to false to disable the plugin adding totals
# 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
# If false, storing best totals will be disabled
UseHighestTotals: true
# Enable Geyser prefix support
# Geyser support is hit or miss currently
# May work best if players vote with prefix
GeyserPrefixSupport: false
GeyserPrefix: '*'
# Geyser/Bedrock player support
# Set prefix used for voting
# Players should vote with prefix
# https://github.com/BenCodez/VotingPlugin/wiki/Bedrock-Player-Support
BedrockPlayerPrefix: '.'
# Whether or not to create daily backups. (Only the most recent ones get kept)
CreateBackups: true
@@ -522,12 +558,59 @@ CreateBackups: true
AutoDownload: false
# If false plugin will use offline player UUIDs
# Keep enabled when mixing uuids (Premium and cracked)
# More info: https://github.com/BenCodez/VotingPlugin/wiki/Online-Offline-Mode
OnlineMode: true
# Disable checking on world change
# 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
# Maxium amount of vote points possible, -1 to disable
LimitVotePoints: -1
# Default worlds set for all rewards
DefaultRewardWorlds: []
# Default blackedlisted worlds set for all rewards
DefaultRewardBlackListedWorlds: []
###########################################
# Month Date Totals
# Experimental feature
###########################################
# Experimental
# Stores month votes with date formatting
# MonthTotal-MONTH-YEAR
# This setting only enables setting totals, not using them
# Enabling this is pretty safe and harmless with just this setting
# Essentially will just copy MonthTotal to MonthTotal-MONTH-YEAR
# Can use command /vote PreviousMonthstotals after this is enabled
StoreMonthTotalsWithDate: false
# Experimental
# This setting uses month votes with date formatting
# If using this StoreMonthTotalsWithDate must be enabled
# This setting may be very buggy as it's in early stages
UseMonthDateTotalsAsPrimaryTotal: false
###########################################
# Skull settings
###########################################
@@ -535,12 +618,19 @@ OnlineMode: true
# Preload skulls to improve performance for vote top
# when using skulls as the item to display players
# If false, skulls will be cached as they are used
# assuming loadskulls is enabled
PreloadSkulls: false
PreloadSkulls: true
# Setting to false disables saving skulls in a cache to improve speeds
# Will reduce ram usage (very little) if disabled, but slow GUI speeds when using skulls
LoadSkulls: true
# Number of miliseconds between skull caching
# Default about 4 seconds is good for most servers
# Used to avoid rate limit, increase if needed
# If rate limit is hit caching will pause for 15 minutes
SkullLoadDelay: 4000
# Set a skull profile URL
# This is what gets used to cache skulls
# Default: https://sessionserver.mojang.com/session/minecraft/profile/
# Other examples: https://crafthead.net/profile/
SkullProfileAPIURL: ''
###########################################
# Extra checks on vote
@@ -653,7 +743,7 @@ ExtraBackgroundUpdate: false
# Click sound when using gui
# Set to none for no sound
ClickSound:
Sound: 'UI_BUTTON_CLICK'
Sound: 'ui.button.click'
Volume: 1.0
Pitch: 1.0
@@ -663,7 +753,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'
@@ -683,9 +773,20 @@ CloseGUIOnShiftClick: false
# Purge settings
###########################################
# Remove old player files
# Happens on startup or /av purge
# Recommend leaving this disabled
# When disabled it also disables the commands to manually purge
PurgeOldData: false
# Enable auto purging data on startup
# Do not enable unless you know what you are doing
# Purges players with vote totals
# Requires PurgeOldData to be enabled
PurgeDataOnStartup: false
# Same as above, but checks players have no vote total before purging
# Requires PurgeOldData to be enabled
PurgeNoDataOnStartup: false
# Minimum number of days offline in order to purge
PurgeMin: 90
@@ -694,6 +795,10 @@ PurgeMin: 90
# Options below don't need to be touched
##########################################
# If enabled, data is repulled from storage on vote shop purchase
# This prevents possible exploits with vote shop
ExtraVoteShopCheck: true
# Options for request api
# Current methods:
# ANVIL
+8 -71
View File
@@ -71,7 +71,7 @@ CHEST:
Name: '&4Vote Shop'
Lore:
- '&aYou currently have %points% points'
# 'ExtraName' below is an identifier, can be whatever
# 'ExtraItem' below is an identifier, can be whatever
# ExtraItem:
# Item:
# Material: 'DIRT'
@@ -287,7 +287,6 @@ CHEST:
Name: 'VoteSite: %site%'
VoteGUIName: '&cVoteGUI: &c&l%player%'
VoteRewardName: 'VoteReward'
VoteShopName: 'VoteShop'
BackButton:
Material: 'BARRIER'
@@ -300,74 +299,8 @@ CHEST:
EndOfGUI: false
# If true, this item will become an exit button instead
Exit: false
VoteShopBackButton: true
VoteShopEnabled: true
# Hide items in vote shop which user can not buy
VoteShopHideLimitedReached: true
# Requires above to be false
VoteShopLimitReached: '&aYou reached your limit'
VoteShopRequireConfirmation: false
VoteShopDisabled: '&cVote shop disabled'
# VoteShop extra items for display only
#VoteShopExtraItems:
#Item:
#...
Shop:
# Identifier
# Used in placeholders for formats
# Do not have spaces in the identifier
# Change the identifier for each shop item
Diamond:
Identifier_Name: 'Diamond'
# Item
Material: 'DIAMOND'
Amount: 1
Name: '&4Buy A Diamond'
# You can set skulls of the player using the following
# Remove the # to enable
#Skull: '%Player%'
Lore:
- '&c&lCost: &c3 Voting Points'
# Number of voting points this cost
Cost: 3
# Permission required, leave blank for no permission
Permission: ''
# Whether or not to keep GUI open after purchase
CloseGUI: true
# Require confirmation on purchase, overrides global option above
RequireConfirmation: false
# Overrides other purchase message
#PurchaseMessage: 'Thanks for the purchase'
# Limit how many times you can buy this
#Limit: 3
# Reset limit daily/weekly/monthly
#Reset:
#Daily: false
#Weekly: false
#Monthly: false
# If true, item is not buyable
#NotBuyable: false
# Rewards to run if player buys successfully
Rewards:
# Run command on purchase
#Commands:
#- 'command here'
Items:
Diamond:
Material: 'DIAMOND'
Amount: 1
ShopConfirmPurchase:
Title: 'Confirm Purchase?'
YesItem:
Material: EMERALD_BLOCK
Amount: 1
Name: '&aYes'
NoItem:
Material: BARRIER
Amount: 1
Name: '&cNo'
# VoteShop settings moved to Shop.yml for 6.17 (To be released)
BOOK:
@@ -376,7 +309,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]'
+77
View File
@@ -0,0 +1,77 @@
VoteShop:
Enabled: true
Name: 'VoteShop'
BackButton: true
# Hide items in vote shop which user can not buy
HideLimitedReached: true
# Requires above to be false
LimitReached: '&aYou reached your limit'
RequireConfirmation: false
Disabled: '&cVote shop disabled'
# If true, shop gui will reopen, updating all placeholders
ReopenGUIOnPurchase: false
Shop:
# Identifier
# Used in placeholders for formats
# Do not have spaces in the identifier
# Change the identifier for each shop item
Diamond:
Identifier_Name: 'Diamond'
# Item
Material: 'DIAMOND'
Amount: 1
Name: '&4Buy A Diamond'
# You can set skulls of the player using the following
# Remove the # to enable
#Skull: '%Player%'
Lore:
- '&c&lCost: &c3 Voting Points'
# Number of voting points this cost
Cost: 3
# Permission required, leave blank for no permission
Permission: ''
# Hide if player doesn't have permission (only if permission is set)
HideOnNoPermission: true
# Whether or not to keep GUI open after purchase
CloseGUI: true
# Require confirmation on purchase, overrides global option above
RequireConfirmation: false
# Overrides other purchase message
#PurchaseMessage: 'Thanks for the purchase'
# Limit how many times you can buy this
#Limit: 3
# Reset limit daily/weekly/monthly
#Reset:
#Daily: false
#Weekly: false
#Monthly: false
# If true, item is not buyable
#NotBuyable: false
# Rewards to run if player buys successfully
Rewards:
# Run command on purchase
#Commands:
#- 'command here'
Items:
Diamond:
Material: 'DIAMOND'
Amount: 1
# VoteShop extra items for display only
#ExtraItems:
#ItemIdentifier:
#...
ShopConfirmPurchase:
Title: 'Confirm Purchase?'
YesItem:
Material: EMERALD_BLOCK
Amount: 1
Name: '&aYes'
NoItem:
Material: BARRIER
Amount: 1
Name: '&cNo'
+12 -2
View File
@@ -65,7 +65,7 @@ VoteParty:
# Number of votes required to give rewards
VotesRequired: 20
# Increase the amount of votes required on each vote party reached
#IncreaseVotesRquired: 10
#IncreaseVotesRequired: 10
# If true, players who did not vote to reach the votes required will
# recieve the reward
# If false, only players who voted get rewards
@@ -83,7 +83,9 @@ VoteParty:
OnlyOncePerDay: false
# If true, will give voteparty once per week only
OnlyOncePerWeek: false
# Reset extra votes
# Reset extra votes weekly
ResetExtraVotesWeekly: false
# Reset extra votes monthly
ResetExtraVotesMonthly: false
# Count votes from /av vote?
CountFakeVotes: true
@@ -93,9 +95,16 @@ VoteParty:
CountOfflineVotes: true
# Broadcast when vote party reached
Broadcast: '&cReached the vote party amount!'
# Send a broadcast at a certain number of votes left and send a vote reminder
VoteReminderBroadcast: '%votesrequired% left to go, go vote!'
# Send vote reminder at number of votes to go
VoteReminderAtVotes: []
# 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 +137,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
+12 -4
View File
@@ -38,6 +38,7 @@ VoteSites:
VoteDelay: 24
# Use to have a minute votedelay
# Must set a value on VoteDelay if you plan on only using this setting
#VoteDelayMin: 30
# Require waiting until votedelay time has pasted in order to accept vote
@@ -48,14 +49,21 @@ VoteSites:
# Recommend: false
VoteDelayDaily: false
#Offset time for /vote next caculations
#TimeOffSet: 0
# Replaces offset, set the exact hour based on server time
# Include server time offset when setting this
# 2 = 2 am server time
# Use 1-24
#VoteDelayDailyHour: 14
# If true, rewards can be executed offline (requires ForceOffline to be true in the reward)
# Setting this to true will execute the reward offline while the player is offline
# This basiclly disables offline voting if set to true, don't misinterpret this option
ForceOffline: false
# Requrie a permission to view site in GUI
# If empty or not set anyone can view (default)
#PermissionToView: 'Perm.here'
# VoteSite Material for some GUI's
# Removing this may result in an error, required on each site
DisplayItem:
@@ -81,7 +89,7 @@ VoteSites:
Site2:
Enabled: false
Name: 'Site2'
ServiceSite: 'PlanetMinecraft.com'
ServiceSite: 'Crafty.gg'
VoteURL: 'link to vote URL here, used in /vote'
VoteDelay: 24
DisplayItem:
@@ -115,7 +123,7 @@ VoteSites:
Messages:
Player: 'You got unlucky'
# Give 1 diamond
# Give 1 diamond regardless of above
Items:
item1:
Material: DIAMOND
+103 -12
View File
@@ -19,10 +19,6 @@ Prefix: ''
#Attempt to use mariadb driver
#UseMariaDB: false
# Online mode for UUIDS
# Offline mode setups are not fully tested and are not supported currently
OnlineMode: true
####################################################################################
# Global mysql data handle for between server commmunications
@@ -86,8 +82,29 @@ WhiteListedServers: []
# SOCKETS
# PLUGINMESSAGING (Recommended)
# MYSQL
# REDIS
BungeeMethod: PLUGINMESSAGING
# Default is vp:vp, can be changed to prevent potential exploits
# Must match on all servers
# This setting requires a restart
PluginMessageChannel: "vp:vp"
# Use this to encrypt the plugin messages
# Must be set on all servers the same
# Copy secretkey.key file to all servers (They all must match)
# This setting requires a restart
PluginMessageEncryption: false
# Use Redis for between server communication, set BungeeMethod to REDIS to use this
Redis:
Host: localhost
Port: 6379
Username: ''
Password: ''
# Set a prefix from an entire proxy network if using mutli-proxy setup below
Prefix: ''
# If false, votes will be checked if user is a valid player that has joined to server
# Works for PLUGINMESSAGING and SOCKETS methods only
# This requires spigot servers AllowUnJoined to be set to true in Config.yml
@@ -106,11 +123,24 @@ BungeeManageTotals: true
# Set DisableBroadcast to true on spigot servers (BungeeSettings.yml) as well
Broadcast: true
# Geyser settings
# This may or may not work
# Does not work on velocity currently
GeyserSupport: false
GeyserPrefix: '.'
# Geyser/bedrock player settings
# https://github.com/BenCodez/VotingPlugin/wiki/Bedrock-Player-Support
BedrockPlayerPrefix: '.'
# Time votes will be cached on proxy
# -1 means no time limit
# Time in days
VoteCacheTime: -1
# Maxium number of votes possible per day
# Usually matches the amount of votesites
# Will limit vote totals to match accordingly
# Only applies for month total
# Set to -1 to disable
MaxAmountOfVotesPerDay: -1
# Maxium amount of vote points possible, -1 to disable
LimitVotePoints: -1
VoteParty:
# If enabled, will trigger vote party reward
@@ -130,6 +160,33 @@ VoteParty:
BungeeCommands: []
Broadcast: '&aVote party has been reached!'
# Online mode for UUIDS
# Offline mode setups are not fully tested and are not supported currently
# If using mixed uuids (premium and cracked players leave this enabled and disable UUIDLookup below)
# More details here: https://github.com/BenCodez/VotingPlugin/wiki/Online-Offline-Mode
OnlineMode: true
# If true plugin will atempt to lookup uuids if none exist
UUIDLookup: true
###########################################
# Month Date Totals
# Experimental feature
# Settings must match on backend servers
###########################################
# Experimental
# Stores month votes with date formatting
# MonthTotal-MONTH-YEAR
# This setting only enables setting totals, not using them
# Enabling this is pretty safe and harmless with just this setting
StoreMonthTotalsWithDate: false
# Experimental
# This setting uses month votes with date formatting
# If using this StoreMonthTotalsWithDate must be enabled
# This setting may be very buggy as it's in early stages
UseMonthDateTotalsAsPrimaryTotal: false
##########################################
# PLUGINMESSAGING Settings
@@ -137,19 +194,19 @@ VoteParty:
# Applies to PLUGINMESSAGING only
# Votes will be forwarded when specific player is online
# If set to false, rewards should still reward when player logs in (by default)
WaitForUserOnline: false
##########################################
# Multi-proxy setup
# This is still a WIP, use with caution
# Primary server needs votifier and config option enabled
# Primary server needs votifier and config option enabled
# Set socket host on each proxy and primary server set sub proxies
# All servers should be on pluginmessaging or sockets setup
##########################################
# Support for redis
# experimental
# Support for multiple proxies
MultiProxySupport: false
# Enable on primary proxy server with votifier
@@ -160,12 +217,46 @@ PrimaryServer: false
# Must also disable sendtoallservers
MultiProxyOneGlobalReward: false
# Multi-proxy available methods:
# SOCKET
# REDIS
MultiProxyMethod: SOCKET
##########################################
# REDIS Settings
##########################################
# Set multiproxymethod to REDIS to use redis
MultiProxyRedis:
# If true the plugin will use the exsiting connection set above
# Must be on REDIS method to use this setting
UseExistingConnection: false
Host: localhost
Port: 6379
Username: ''
Password: ''
# Set each server it's own proxy name here (can be anything)
ProxyServerName: proxy1
# Set names of other proxy servers
# Must match what's set as the proxy server name above from other servers
# On non primary proxy server just set the primary proxy server name here
ProxyServers:
- proxy2
- proxy3
##########################################
# SOCKET settings for mutli-proxy
##########################################
# Set this for each proxy
MultiProxySocketHost:
Host: 0.0.0.0
Port: 1234
# Set other sub proxies here
# On non primary proxy only set primary proxy
MultiProxyServers:
secondproxy:
Host: 0.0.0.0
+65 -69
View File
@@ -16,10 +16,11 @@ softdepend:
- AuthMe
- SuperVanish
- PremiumVanish
- DiscordSRV
- LuckPerms
loadbefore:
- MCPerks
api-version: 1.13
folia-supported: true
libraries:
- org.openjdk.nashorn:nashorn-core:15.3
commands:
@@ -53,12 +54,6 @@ commands:
voteurl:
description: Open VoteURL
aliases: vurl
votereward:
description: Open VoteReward GUI
aliases: vreward
vote?:
description: View Help
aliases: v?
voteparty:
description: A command
aliases: vparty
@@ -143,106 +138,106 @@ commands:
adminvotegivereward:
description: Command Alias
aliases: avgivereward
adminvoteConvertFromData:
adminvoteconvertfromdata:
description: Command Alias
aliases: avConvertFromData
adminvoteConvertToData:
aliases: avconvertfromdata
adminvoteonverttodata:
description: Command Alias
aliases: avConvertFromData
adminvoteClearTotal:
aliases: avconverttodata
adminvotecleartotal:
description: Command Alias
adminvoteBackgroundUpdate:
adminvotebackgroundupdate:
description: Command Alias
aliases: avBackgroundUpdate
adminvoteClearCache:
aliases: avbackgroundupdate
adminvoteclearcache:
description: Command Alias
aliases: avClearCache
adminvoteServiceSites:
aliases: avclearcache
adminvoteservicesites:
description: Command Alias
aliases: avServiceSites
adminvoteVoteParty:
aliases: avservicesites
adminvotevoteparty:
description: Command Alias
aliases: avVoteParty
adminvoteChoices:
aliases: avvoteparty
adminvotechoices:
description: Command Alias
aliases: avChoices
adminvoteReloadAll:
aliases: avchoices
adminvotereloadall:
description: Command Alias
aliases: avReloadAll
adminvotePermsPlayer:
aliases: avreloadall
adminvotepermsplayer:
description: Command Alias
aliases: avPermsPlayer
adminvoteResyncMilestonesAlreadyGiven:
aliases: avpermsplayer
adminvoteresyncmilestonesalreadygiven:
description: Command Alias
aliases: avResyncMilestonesAlreadyGiven
voteSetPrimaryAccount:
aliases: avresyncmilestonesalreadygiven
votesetprimaryaccount:
description: Command Alias
adminvoteClearOfflineVotes:
adminvoteclearofflinevotes:
description: Command Alias
aliases: avClearOfflineVotes
adminvoteGiveAll:
aliases: avclearofflinevotes
adminvotegiveall:
description: Command Alias
aliases: avGiveAll
adminvoteGiveAllOnline:
aliases: avgiveall
adminvotegiveallonline:
description: Command Alias
aliases: avGiveAllOnline
adminvoteForceTimeChanged:
aliases: avgiveallonline
adminvoteforcetimechanged:
description: Command Alias
aliases: avForceTimeChanged
aliases: avforcetimechanged
adminvoteplayername:
description: Command Alias
aliases: avplayername
adminvoteResyncMilestones:
adminvoteresyncmilestones:
description: Command Alias
aliases: avResyncMilestones
adminvoteClearOfflineRewards:
aliases: avresyncmilestones
adminvoteclearofflinerewards:
description: Command Alias
aliases: avClearOfflineRewards
adminvoteUserRemove:
aliases: avclearofflinerewards
adminvoteuserremove:
description: Command Alias
aliases: avUserRemove
adminvotePurge:
aliases: avuserremove
adminvotepurge:
description: Command Alias
aliases: avPurge
adminvoteJavascript:
aliases: avpurge
adminvotejavascript:
description: Command Alias
aliases: avJavascript
adminvoteStatus:
aliases: avjavascript
adminvotestatus:
description: Command Alias
aliases: avStatus
adminvoteTest:
aliases: avstatus
adminvotetest:
description: Command Alias
aliases: avTest
adminvotePlaceholders:
aliases: avtest
adminvoteplaceholders:
description: Command Alias
aliases: avPlaceholders
adminvoteDownloadJenkins:
aliases: avplaceholders
adminvotedownloadjenkins:
description: Command Alias
aliases: avDownloadJenkins
adminvoteSetRequestMethod:
aliases: avdownloadjenkins
adminvotesetrequestmethod:
description: Command Alias
aliases: avSetRequestMethod
adminvoteUser:
aliases: avsetrequestmethod
adminvoteuser:
description: Command Alias
aliases: avUser
adminvoteCurrentPluginTime:
aliases: avuser
adminvotecurrentplugintime:
description: Command Alias
aliases: avCurrentPluginTime
adminvoteResetPoints:
aliases: avcurrentplugintime
adminvoteresetpoints:
description: Command Alias
aliases: avResetPoints
adminvoteRunCMD:
aliases: avresetpoints
adminvoteruncmd:
description: Command Alias
aliases: avRunCMD
aliases: avruncmd
adminvoteuseruuidremove:
description: Command Alias
aliases: avuseruuidremove
adminvoteedit:
description: Command Alias
aliases: avedit
adminvoteResetMilestoneCount:
adminvoteresetmilestonecount:
description: Command Alias
aliases: avResetMilestoneCount
aliases: avresetmilestonecount
permissions:
VotingPlugin.Player:
description: Allows basic access player commands
@@ -252,13 +247,14 @@ permissions:
description: Allows admincommands
VotingPlugin.Admin.Debug:
description: Permission to view debug info ingame
VotingPlugin.Signs.Create:
description: Allows access to create signs
VotingPlugin.TopVoter.Ignore:
description: Allows you to be exempt from top voter
VotingPlugin.NoRemind:
description: Ignore vote reminding
default: false
VotingPlugin.BypassWaitUntilVoteDelay:
description: Bypass WaitUntilVoteDelay
default: false
VotingPlugin.Sign.Create:
description: Permission to create sign
VotingPlugin.Admin.GenerateServiceSite:
+288 -97
View File
@@ -1,16 +1,18 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bencodez</groupId>
<artifactId>votingplugin</artifactId>
<version>6.13</version>
<version>6.18.2</version>
<packaging>jar</packaging>
<name>VotingPlugin</name>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<github.global.server>github</github.global.server>
<project.build.sourceEncoding>Cp1252</project.build.sourceEncoding>
<build.number>NOTSET</build.number>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<build>
<resources>
@@ -58,16 +60,6 @@
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<finalName>${project.name}</finalName>
</configuration>
</plugin>
<plugin>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
@@ -90,7 +82,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<version>3.6.0</version>
<configuration>
<shadedArtifactAttached>false</shadedArtifactAttached>
<minimizeJar>true</minimizeJar>
@@ -103,9 +95,20 @@
</filter>
</filters>
<relocations>
<relocation>
<pattern>com.tcoded.folialib</pattern>
<shadedPattern>
${project.groupId}.votingplugin.simpleapi.folialib</shadedPattern>
</relocation>
<relocation>
<pattern>com.bencodez.simpleapi</pattern>
<shadedPattern>
${project.groupId}.votingplugin.simpleapi</shadedPattern>
</relocation>
<relocation>
<pattern>com.bencodez.advancedcore</pattern>
<shadedPattern>${project.groupId}.votingplugin.advancedcore</shadedPattern>
<shadedPattern>
${project.groupId}.votingplugin.advancedcore</shadedPattern>
</relocation>
<relocation>
<pattern>net.pl3x.bukkit.chatapi</pattern>
@@ -113,24 +116,30 @@
</relocation>
<relocation>
<pattern>me.mrten.mysqlapi</pattern>
<shadedPattern>${project.groupId}.votingplugin.mysqlapi</shadedPattern>
<shadedPattern>
${project.groupId}.votingplugin.mysqlapi</shadedPattern>
</relocation>
<relocation>
<pattern>com.zaxxer.HikariCP</pattern>
<shadedPattern>${project.groupId}.votingplugin.HikariCP</shadedPattern>
<shadedPattern>
${project.groupId}.votingplugin.HikariCP</shadedPattern>
</relocation>
<relocation>
<pattern>com.zaxxer.hikari</pattern>
<shadedPattern>${project.groupId}.votingplugin.hikari</shadedPattern>
<shadedPattern>
${project.groupId}.votingplugin.hikari</shadedPattern>
</relocation>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>${project.groupId}.votingplugin.bstats</shadedPattern>
<shadedPattern>
${project.groupId}.votingplugin.bstats</shadedPattern>
</relocation>
<relocation>
<pattern>xyz.upperlevel.spigot</pattern>
<shadedPattern>${project.groupId}.votingplugin.advancedcore.xyz.upperlevel.spigot</shadedPattern>
<shadedPattern>
${project.groupId}.votingplugin.advancedcore.xyz.upperlevel.spigot</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
@@ -141,7 +150,8 @@
</goals>
<configuration>
<artifactSet>
<!-- Lets exclude google code, because the server already has this
<!-- Lets exclude google code, because the
server already has this
code in it (guava, etc) -->
<excludes>
<exclude>com.google.*:*</exclude>
@@ -162,31 +172,6 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${user.home}/Documents/Test Server/plugins</outputDirectory>
<resources>
<resource>
<directory>${basedir}/target</directory>
<includes>
<include>VotingPlugin.jar</include>
</includes>
</resource>
</resources>
<overwrite>true</overwrite>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
@@ -210,24 +195,33 @@
<id>bencodez repo</id>
<url>https://nexus.bencodez.com/repository/maven-public/</url>
</repository>
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
<repository>
<id>placeholderapi</id>
<url>
https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.4-R0.1-SNAPSHOT</version>
<version>1.21.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.2</version>
<version>1.18.36</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.3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -245,40 +239,59 @@
<dependency>
<groupId>com.velocitypowered</groupId>
<artifactId>velocity-api</artifactId>
<version>1.1.5</version>
<version>3.1.2-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-velocity</artifactId>
<version>2.2.1</version>
<version>3.1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.bencodez</groupId>
<artifactId>advancedcore</artifactId>
<version>LATEST</version>
<version>3.7.14-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>prod2</id>
<id>default</id>
<properties>
<build.profile.id>prod2</build.profile.id>
<build.profile.id>default</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>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<archive>
<manifestEntries>
<paperweight-mappings-namespace>mojang</paperweight-mappings-namespace>
</manifestEntries>
</archive>
<finalName>${project.name}</finalName>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>deploy-snapshot</id>
<properties>
<build.profile.id>deploy-snapshot</build.profile.id>
<build.profile.id>dev-snapshot</build.profile.id>
</properties>
<distributionManagement>
<snapshotRepository>
@@ -287,15 +300,67 @@
</snapshotRepository>
<repository>
<id>nexus</id>
<url>https://nexus.bencodez.com/repository/maven-snapshots/</url>
<url>https://nexus.bencodez.com/repository/maven-releases/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<archive>
<manifestEntries>
<paperweight-mappings-namespace>mojang</paperweight-mappings-namespace>
</manifestEntries>
</archive>
<finalName>
${project.name}</finalName>
</configuration>
</plugin>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<id>copy-file</id>
<phase>install</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<sourceFile>
${project.basedir}/target/${project.name}.jar</sourceFile>
<destinationFile>
${project.basedir}/target/${project.name}-${build.number}.jar</destinationFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.11.2</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<phase>deploy</phase>
<configuration>
<sourcepath>
${project.basedir}/target/delombok</sourcepath>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<version>3.1.3</version>
<configuration>
<skip>true</skip>
</configuration>
@@ -303,7 +368,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.5.1</version>
<version>1.7.0</version>
<executions>
<execution>
<id>default-deploy</id>
@@ -322,6 +387,125 @@
</plugins>
</build>
</profile>
<profile>
<id>javadoc</id>
<properties>
<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>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<archive>
<manifestEntries>
<paperweight-mappings-namespace>mojang</paperweight-mappings-namespace>
</manifestEntries>
</archive>
<finalName>${project.name}</finalName>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.11.2</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>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<id>copy-file</id>
<phase>deploy</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<sourceFile>
${project.basedir}/target/${project.name}.jar</sourceFile>
<destinationFile>
${project.basedir}/target/${project.name}-${project.version}.jar</destinationFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>dev</id>
<properties>
<build.profile.id>dev</build.profile.id>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<archive>
<manifestEntries>
<paperweight-mappings-namespace>mojang</paperweight-mappings-namespace>
</manifestEntries>
</archive>
<finalName>${project.name}</finalName>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>
${user.home}/Documents/Test_Server/plugins</outputDirectory>
<resources>
<resource>
<directory>${basedir}/target</directory>
<includes>
<include>VotingPlugin.jar</include>
</includes>
</resource>
</resources>
<overwrite>true</overwrite>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>deploy</id>
<properties>
@@ -339,10 +523,43 @@
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<archive>
<manifestEntries>
<paperweight-mappings-namespace>mojang</paperweight-mappings-namespace>
</manifestEntries>
</archive>
<finalName>${project.name}</finalName>
</configuration>
</plugin>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<id>copy-file</id>
<phase>deploy</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<sourceFile>
${project.basedir}/target/${project.name}.jar</sourceFile>
<destinationFile>
${project.basedir}/target/${project.name}-${project.version}.jar</destinationFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<version>3.11.2</version>
<executions>
<execution>
<id>attach-javadocs</id>
@@ -351,7 +568,8 @@
</goals>
<phase>deploy</phase>
<configuration>
<sourcepath>${project.basedir}/target/delombok</sourcepath>
<sourcepath>
${project.basedir}/target/delombok</sourcepath>
</configuration>
</execution>
</executions>
@@ -359,7 +577,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<version>3.1.3</version>
<configuration>
<skip>true</skip>
</configuration>
@@ -367,7 +585,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.5.1</version>
<version>1.7.0</version>
<executions>
<execution>
<id>default-deploy</id>
@@ -383,33 +601,6 @@
<skipStaging>true</skipStaging>
</configuration>
</plugin>
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.12</version>
<executions>
<execution>
<id>javadoc</id>
<goals>
<goal>site</goal>
</goals>
<phase>deploy</phase>
<configuration>
<message>Maven javadoc for ${project.version}</message>
<noJekyll>true</noJekyll>
<outputDirectory>${project.build.directory}/apidocs
</outputDirectory>
<branch>refs/heads/gh-pages</branch>
<includes>
<include>**/*</include>
</includes>
<repositoryName>VotingPlugin</repositoryName>
<repositoryOwner>BenCodez</repositoryOwner>
<server>github</server>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
@@ -1,31 +0,0 @@
package com.Ben12345rocks.VotingPlugin.Objects;
import org.bukkit.entity.Player;
import com.bencodez.votingplugin.user.UserManager;
import com.bencodez.votingplugin.user.VotingPluginUser;
@Deprecated
public class User {
private VotingPluginUser user;
public User(Player p) {
user = UserManager.getInstance().getVotingPluginUser(p);
}
public void addPoints(int points) {
user.addPoints(points);
}
public int getPoints() {
return user.getPoints();
}
public boolean removePoints(int points) {
return user.removePoints(points);
}
public void setPoints(int points) {
user.setPoints(points);
}
}
File diff suppressed because it is too large. Load diff
@@ -33,7 +33,7 @@ public class VotingPluginHooks {
}
public UserManager getUserManager() {
return UserManager.getInstance();
return getMainClass().getVotingPluginUserManager();
}
}
@@ -7,6 +7,7 @@ import java.net.URL;
import java.security.CodeSource;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.YearMonth;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
@@ -41,21 +42,25 @@ import com.bencodez.advancedcore.api.inventory.editgui.EditGUIButton;
import com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueNumber;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.javascript.JavascriptPlaceholderRequest;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.messages.PlaceholderUtils;
import com.bencodez.advancedcore.api.misc.MiscUtils;
import com.bencodez.advancedcore.api.rewards.DirectlyDefinedReward;
import com.bencodez.advancedcore.api.rewards.Reward;
import com.bencodez.advancedcore.api.rewards.RewardEditData;
import com.bencodez.advancedcore.api.rewards.RewardOptions;
import com.bencodez.advancedcore.api.rewards.RewardPlaceholderHandle;
import com.bencodez.advancedcore.api.rewards.injected.RewardInject;
import com.bencodez.advancedcore.api.rewards.injected.RewardInjectConfigurationSection;
import com.bencodez.advancedcore.api.rewards.injected.RewardInjectInt;
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.rewards.injectedrequirement.RequirementInjectConfigurationSection;
import com.bencodez.advancedcore.api.user.AdvancedCoreUser;
import com.bencodez.advancedcore.api.user.userstorage.Column;
import com.bencodez.advancedcore.logger.Logger;
import com.bencodez.advancedcore.nms.NMSManager;
import com.bencodez.simpleapi.file.YMLConfig;
import com.bencodez.simpleapi.nms.NMSManager;
import com.bencodez.simpleapi.skull.SkullCache;
import com.bencodez.simpleapi.updater.Updater;
import com.bencodez.votingplugin.broadcast.BroadcastHandler;
import com.bencodez.votingplugin.commands.CommandLoader;
import com.bencodez.votingplugin.commands.executers.CommandAdminVote;
@@ -67,6 +72,7 @@ import com.bencodez.votingplugin.config.BungeeSettings;
import com.bencodez.votingplugin.config.Config;
import com.bencodez.votingplugin.config.ConfigVoteSites;
import com.bencodez.votingplugin.config.GUI;
import com.bencodez.votingplugin.config.ShopFile;
import com.bencodez.votingplugin.config.SpecialRewardsConfig;
import com.bencodez.votingplugin.cooldown.CoolDownCheck;
import com.bencodez.votingplugin.data.ServerData;
@@ -80,6 +86,8 @@ 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.servicesites.ServiceSiteHandler;
import com.bencodez.votingplugin.signs.Signs;
import com.bencodez.votingplugin.specialrewards.SpecialRewards;
import com.bencodez.votingplugin.test.VoteTester;
@@ -109,7 +117,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
private ArrayList<CommandHandler> adminVoteCommand;
@Getter
private LinkedHashMap<java.util.UUID, ArrayList<String>> advancedTab = new LinkedHashMap<java.util.UUID, ArrayList<String>>();
private LinkedHashMap<java.util.UUID, ArrayList<String>> advancedTab = new LinkedHashMap<>();
@Getter
private BroadcastHandler broadcastHandler;
@@ -138,15 +146,22 @@ public class VotingPluginMain extends AdvancedCorePlugin {
@Getter
private GUI gui;
@Getter
private ShopFile shopFile;
@Getter
private LinkedHashMap<TopVoterPlayer, Integer> lastMonthTopVoter;
@Getter
@Setter
private LinkedHashMap<YearMonth, LinkedHashMap<TopVoterPlayer, Integer>> previousMonthsTopVoters;
@Getter
private MVdWPlaceholders mvdwPlaceholders;
@Getter
private PlaceHolders placeholders;
@Getter
private VoteTester voteTester;
@@ -221,19 +236,50 @@ public class VotingPluginMain extends AdvancedCorePlugin {
@Getter
private UserManager votingPluginUserManager;
private void addDirectlyDefinedRewards(DirectlyDefinedReward directlyDefinedReward) {
@Getter
private TimeQueueHandler timeQueueHandler;
@Getter
private ServiceSiteHandler serviceSiteHandler;
@Getter
private long lastBackgroundTaskTimeTaken = -1;
private boolean firstTimeLoaded = false;
public void addDirectlyDefinedRewards(DirectlyDefinedReward directlyDefinedReward) {
getRewardHandler().addDirectlyDefined(directlyDefinedReward);
}
public void basicBungeeUpdate() {
for (Player player : Bukkit.getOnlinePlayers()) {
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
VotingPluginUser user = getVotingPluginUserManager().getVotingPluginUser(player);
user.cache();
user.offVote();
user.checkOfflineRewards();
}
}
public void checkFirstTimeLoaded() {
if (!firstTimeLoaded) {
if (getGui().isChestVoteTopUseSkull()) {
int maxToLoad = 200;
for (TopVoter top : topVoter.keySet()) {
int num = 1;
Set<TopVoterPlayer> players = topVoter.get(top).keySet();
for (TopVoterPlayer p : players) {
if (num <= maxToLoad) {
getSkullCacheHandler().addToCache(p.getUuid(), p.getPlayerName());
}
num++;
}
}
}
}
firstTimeLoaded = true;
}
/**
* Check votifier.
*/
@@ -260,18 +306,18 @@ public class VotingPluginMain extends AdvancedCorePlugin {
}
if (ymlError) {
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
plugin.getBukkitScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
@Override
public void run() {
plugin.getLogger().severe("Failed to load a file, check startup log");
}
}, 10);
}, 1);
}
}
public ArrayList<TopVoterPlayer> convertSet(Set<TopVoterPlayer> set) {
return new ArrayList<TopVoterPlayer>(set);
return new ArrayList<>(set);
}
@Override
@@ -282,7 +328,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
public LinkedHashMap<TopVoterPlayer, Integer> getTopVoter(TopVoter top) {
LinkedHashMap<TopVoterPlayer, Integer> top1 = topVoter.get(top);
if (top1 == null) {
top1 = new LinkedHashMap<TopVoterPlayer, Integer>();
top1 = new LinkedHashMap<>();
}
return top1;
}
@@ -294,7 +340,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
* @return the user
*/
public VotingPluginUser getUser(UUID uuid) {
return UserManager.getInstance().getVotingPluginUser(uuid);
return getVotingPluginUserManager().getVotingPluginUser(uuid);
}
private YamlConfiguration getVersionFile() {
@@ -342,26 +388,29 @@ public class VotingPluginMain extends AdvancedCorePlugin {
public String getVoteSiteName(boolean checkEnabled, String... urls) {
ArrayList<String> sites = getConfigVoteSites().getVoteSitesNames(checkEnabled);
for (String url : urls) {
if (url == null) {
return null;
}
if (sites != null) {
for (String siteName : sites) {
String URL = getConfigVoteSites().getServiceSite(siteName);
if (URL != null) {
if (URL.equalsIgnoreCase(url)) {
if (!url.isEmpty()) {
if (sites != null) {
for (String siteName : sites) {
String URL = getConfigVoteSites().getServiceSite(siteName);
if (URL != null) {
if (URL.equalsIgnoreCase(url)) {
return siteName;
}
}
if (siteName.equalsIgnoreCase(url)) {
return siteName;
}
}
if (siteName.equalsIgnoreCase(url)) {
return siteName;
}
}
}
}
return url;
}
for (String url : urls) {
return url;
}
@@ -369,6 +418,16 @@ public class VotingPluginMain extends AdvancedCorePlugin {
}
public ArrayList<VoteSite> getVoteSitesEnabled() {
ArrayList<VoteSite> sites = new ArrayList<>();
for (VoteSite site : getVoteSites()) {
if (site.isEnabled()) {
sites.add(site);
}
}
return sites;
}
public String getVoteSiteServiceSite(String name) {
ArrayList<String> sites = getConfigVoteSites().getVoteSitesNames(true);
if (name == null) {
@@ -378,10 +437,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
for (String siteName : sites) {
String URL = getConfigVoteSites().getServiceSite(siteName);
if (URL != null) {
if (URL.equalsIgnoreCase(name)) {
return URL;
}
if (name.equalsIgnoreCase(siteName)) {
if (URL.equalsIgnoreCase(name) || name.equalsIgnoreCase(siteName)) {
return URL;
}
}
@@ -410,6 +466,15 @@ public class VotingPluginMain extends AdvancedCorePlugin {
return false;
}
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");
}
}
public void loadDirectlyDefined() {
getRewardHandler().getDirectlyDefinedRewards().clear();
// AllSites reward
@@ -880,27 +945,27 @@ public class VotingPluginMain extends AdvancedCorePlugin {
});
}
for (String identifier : plugin.getGui().getChestShopIdentifiers()) {
addDirectlyDefinedRewards(new DirectlyDefinedReward("CHEST.Shop." + identifier + ".Rewards") {
for (String identifier : plugin.getShopFile().getShopIdentifiers()) {
addDirectlyDefinedRewards(new DirectlyDefinedReward("Shop." + identifier + ".Rewards") {
@Override
public void createSection(String key) {
getGui().createSection(key);
getShopFile().createSection(key);
}
@Override
public ConfigurationSection getFileData() {
return getGui().getData();
return getShopFile().getData();
}
@Override
public void save() {
getGui().saveData();
getShopFile().saveData();
}
@Override
public void setData(String path, Object value) {
getGui().setValue(path, value);
getShopFile().setValue(path, value);
}
});
}
@@ -927,10 +992,13 @@ public class VotingPluginMain extends AdvancedCorePlugin {
getBungeeSettings().setValue(path, value);
}
});
getRewardHandler().checkDirectlyDefined();
}
private void loadTimer() {
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
plugin.getBukkitScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
@Override
public void run() {
@@ -955,7 +1023,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
}, 1000, 1000 * 30, TimeUnit.MILLISECONDS);
}
}, 40L);
}, 2);
}
@@ -984,6 +1052,10 @@ public class VotingPluginMain extends AdvancedCorePlugin {
}
private void loadVoteTimer() {
voteTimer = Executors.newSingleThreadScheduledExecutor();
}
/**
* Log vote.
*
@@ -1006,37 +1078,44 @@ public class VotingPluginMain extends AdvancedCorePlugin {
new VotingPluginMetrics().load(plugin);
}
private void loadVoteTimer() {
voteTimer = Executors.newSingleThreadScheduledExecutor();
}
@Getter
private TimeQueueHandler timeQueueHandler;
@Override
public void onPostLoad() {
// auto conversion for Shop.yml
if (plugin.getShopFile().isJustCreated()) {
if (!plugin.getGui().isJustCreated() && !getServerData().isVoteShopConverted()) {
plugin.getLogger().warning("Converting VoteShop configuration to Shop.yml from GUI.yml");
plugin.getShopFile().convertFromGUIFile();
}
getServerData().setShopConverted(true);
} else if (!getServerData().isVoteShopConverted()) {
getServerData().setShopConverted(true);
}
loadVersionFile();
getOptions().setServer(bungeeSettings.getServer());
// only purges if enabled in config
getVotingPluginUserManager().purgeOldPlayersNoData();
voteTester = new VoteTester(plugin);
loadVoteTimer();
if (bungeeSettings.isUseBungeecoord()) {
bungeeHandler = new BungeeHandler(this);
bungeeHandler.load();
if (getOptions().getServer().equalsIgnoreCase("PleaseSet")) {
getLogger()
.warning("Bungeecoord is true and server name is not set, bungeecoord features may not work");
}
loadBungeeHandler();
}
if (!bungeeSettings.isUseBungeecoord() || !bungeeSettings.isGloblalDataEnabled()) {
this.timeQueueHandler = new TimeQueueHandler(this);
}
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
if (getConfigFile().isLoadInteralExpansion()) {
new VotingPluginExpansion(this).register();
getLogger().info("Loading PlaceholderAPI expansion");
}
}
registerCommands();
checkVotifier();
registerEvents();
@@ -1045,13 +1124,14 @@ public class VotingPluginMain extends AdvancedCorePlugin {
checkUpdate.startUp();
voteReminding = new VoteReminding(this);
voteReminding.loadRemindChecking();
voteReminding.loadReminds();
specialRewards = new SpecialRewards(this);
signs = new Signs(this);
coolDownCheck.checkEnabled();
coolDownCheck.load();
Bukkit.getScheduler().runTask(plugin, new Runnable() {
plugin.getBukkitScheduler().runTask(plugin, new Runnable() {
@Override
public void run() {
@@ -1060,20 +1140,23 @@ public class VotingPluginMain extends AdvancedCorePlugin {
});
topVoterHandler = new TopVoterHandler(this);
lastMonthTopVoter = new LinkedHashMap<TopVoterPlayer, Integer>();
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
lastMonthTopVoter = new LinkedHashMap<>();
previousMonthsTopVoters = new LinkedHashMap<>();
plugin.getBukkitScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
topVoterHandler.loadLastMonth();
debug("Loaded last month top voters");
topVoterHandler.loadPreviousMonthTopVoters();
}
});
topVoter = new LinkedHashMap<TopVoter, LinkedHashMap<TopVoterPlayer, Integer>>();
topVoter = new LinkedHashMap<>();
for (TopVoter top : TopVoter.values()) {
topVoter.put(top, new LinkedHashMap<TopVoterPlayer, Integer>());
topVoter.put(top, new LinkedHashMap<>());
}
voteToday = new LinkedHashMap<TopVoterPlayer, HashMap<VoteSite, LocalDateTime>>();
voteToday = new LinkedHashMap<>();
voteLog = new Logger(plugin, new File(plugin.getDataFolder() + File.separator + "Log", "votelog.txt"));
new AdminGUI(this).loadHook();
@@ -1084,7 +1167,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
topVoterHandler.register();
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
plugin.getBukkitScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
@@ -1121,7 +1204,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
@Override
public String onRewardRequest(Reward reward, com.bencodez.advancedcore.api.user.AdvancedCoreUser user,
int num, HashMap<String, String> placeholders) {
VotingPluginUser vpUser = UserManager.getInstance().getVotingPluginUser(user);
VotingPluginUser vpUser = getVotingPluginUserManager().getVotingPluginUser(user);
String str = "" + vpUser.addPoints(num);
debug("Setting points to " + str);
return str;
@@ -1151,10 +1234,9 @@ public class VotingPluginMain extends AdvancedCorePlugin {
ConfigurationSection section, HashMap<String, String> placeholders) {
if (section.getBoolean("Enabled")) {
user.sendBossBar(
StringParser.getInstance().replacePlaceHolder(section.getString("Message", ""),
placeholders),
PlaceholderUtils.replacePlaceHolder(section.getString("Message", ""), placeholders),
section.getString("Color", "BLUE"), section.getString("Style", "SOLID"),
(double) UserManager.getInstance().getVotingPluginUser(user).getSitesVotedOn()
(double) getVotingPluginUserManager().getVotingPluginUser(user).getSitesVotedOn()
/ plugin.getVoteSites().size(),
section.getInt("Delay", 30));
}
@@ -1162,12 +1244,75 @@ public class VotingPluginMain extends AdvancedCorePlugin {
}
});
getRewardHandler().addInjectedRequirements(new RequirementInjectConfigurationSection("VoteTotal") {
@Override
public boolean onRequirementsRequested(Reward reward, AdvancedCoreUser acUser, ConfigurationSection section,
RewardOptions rewardOptions) {
boolean atleast = section.getBoolean("AtleastMode", false);
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(acUser);
for (TopVoter top : TopVoter.values()) {
int required = section.getInt(top.toString(), -1);
if (required >= 0) {
int total = user.getTotal(top);
if (atleast) {
if (total < required) {
debug("Failed requirement " + top.toString() + " " + total + "/" + required);
return false;
}
} else {
if (total != required) {
debug("Failed requirement " + top.toString() + " " + total + "!=" + required);
return false;
}
}
}
}
int milestoneCountRequired = section.getInt("MilestoneCount", -1);
if (milestoneCountRequired >= 0) {
int milestoneCount = user.getMilestoneCount();
if (atleast) {
if (milestoneCount < milestoneCountRequired) {
debug("Failed requirement milestonecount " + milestoneCount + "/" + milestoneCountRequired);
return false;
}
} else {
if (milestoneCount != milestoneCountRequired) {
debug("Failed requirement milestonecount " + milestoneCount + "!="
+ milestoneCountRequired);
return false;
}
}
}
int pointsRequired = section.getInt("Points", -1);
if (pointsRequired >= 0) {
int points = user.getPoints();
if (atleast) {
if (points < pointsRequired) {
debug("Failed requirement points " + points + "/" + pointsRequired);
return false;
}
} else {
if (points != pointsRequired) {
debug("Failed requirement points " + points + "!=" + pointsRequired);
return false;
}
}
}
return true;
}
});
for (final TopVoter top : TopVoter.values()) {
getRewardHandler().addPlaceholder(new RewardPlaceholderHandle("Total_" + top.toString()) {
@Override
public String getValue(Reward reward, com.bencodez.advancedcore.api.user.AdvancedCoreUser user) {
VotingPluginUser vUser = UserManager.getInstance().getVotingPluginUser(user);
VotingPluginUser vUser = getVotingPluginUserManager().getVotingPluginUser(user);
return "" + vUser.getTotal(top);
}
});
@@ -1179,7 +1324,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
}
plugin.getLogger().info("Enabled VotingPlugin " + plugin.getDescription().getVersion());
if (getProfile().contains("dev")) {
if (plugin.getDescription().getVersion().contains("SNAPSHOT")) {
plugin.getLogger().info(
"Using dev build, this is not a stable build, use at your own risk. Build number: " + buildNumber);
}
@@ -1210,14 +1355,22 @@ public class VotingPluginMain extends AdvancedCorePlugin {
}
if (!issues) {
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
plugin.getBukkitScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
@Override
public void run() {
plugin.getLogger().warning(
"Detected an issue with voting sites, check the server startup log for more details: https://github.com/BenCodez/VotingPlugin/wiki/Votifier-Troubleshooting");
}
}, 30l);
}, 5);
plugin.getBukkitScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
@Override
public void run() {
serviceSiteHandler = new ServiceSiteHandler(plugin);
}
}, 10);
}
}
@@ -1239,16 +1392,15 @@ public class VotingPluginMain extends AdvancedCorePlugin {
if (!configFile.isOverrideVersionDisable()) {
Bukkit.getPluginManager().disablePlugin(this);
return;
} else {
plugin.getLogger().warning("Overriding version disable, beware of using this! This may cause issues!");
}
plugin.getLogger().warning("Overriding version disable, beware of using this! This may cause issues!");
}
setupFiles();
loadVoteSites();
votingPluginUserManager = UserManager.getInstance();
votingPluginUserManager = new UserManager(this);
votingPluginUserManager.addCachingKeys();
setJenkinsSite("bencodez.com");
@@ -1272,7 +1424,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
}
voteTimer.shutdown();
try {
voteTimer.awaitTermination(10, TimeUnit.SECONDS);
voteTimer.awaitTermination(1, TimeUnit.SECONDS);
} catch (InterruptedException e) {
e.printStackTrace();
}
@@ -1309,7 +1461,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 {
@@ -1375,11 +1527,20 @@ public class VotingPluginMain extends AdvancedCorePlugin {
specialRewardsConfig.reloadData();
gui.reloadData();
shopFile.reloadData();
bungeeSettings.reloadData();
updateAdvancedCoreHook();
reloadAdvancedCore(userStorage);
if (bungeeSettings.isUseBungeecoord()) {
getBungeeHandler().loadGlobalMysql();
if (getBungeeHandler() == null) {
loadBungeeHandler();
}
if (userStorage) {
getBungeeHandler().loadGlobalMysql();
}
}
checkYMLError();
@@ -1387,18 +1548,29 @@ public class VotingPluginMain extends AdvancedCorePlugin {
broadcastHandler.schedule(getConfigFile().getFormatAlternateBroadcastDelay());
}
updateAdvancedCoreHook();
plugin.loadVoteSites();
loadDirectlyDefined();
reloadAdvancedCore(userStorage);
getOptions().setServer(bungeeSettings.getServer());
if (userStorage) {
placeholders.load();
placeholders.reload();
getCoolDownCheck().getTimer().schedule(new Runnable() {
@Override
public void run() {
for (VoteSite site : plugin.getVoteSites()) {
if (site.isVoteDelayDaily()) {
getCoolDownCheck().checkAllVoteSite(site);
}
}
}
}, 5, TimeUnit.SECONDS);
}
voteReminding.loadRemindChecking();
coolDownCheck.checkEnabled();
loadDirectlyDefined();
setUpdate(true);
}
@@ -1416,19 +1588,19 @@ public class VotingPluginMain extends AdvancedCorePlugin {
bungeeSettings = new BungeeSettings(this);
bungeeSettings.setup();
serverData = new ServerData(this);
gui = new GUI(this);
gui.setup();
serverData = new ServerData(this);
shopFile = new ShopFile(this);
shopFile.setup();
checkYMLError();
plugin.debug("Loaded Files");
}
@Getter
private long lastBackgroundTaskTimeTaken = -1;
public void update() {
if (update || configFile.isAlwaysUpdate()) {
if (!updateStarted && plugin != null) {
@@ -1439,6 +1611,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
synchronized (plugin) {
if (plugin != null && plugin.isEnabled()) {
getUserManager().getDataManager().clearCacheBasic();
SkullCache.flushWeek();
plugin.debug("Starting background task, current cached users: "
+ plugin.getUserManager().getDataManager().getUserDataCache().keySet().size());
@@ -1447,24 +1620,24 @@ public class VotingPluginMain extends AdvancedCorePlugin {
boolean extraBackgroundUpdate = configFile.isExtraBackgroundUpdate();
long startTime = System.currentTimeMillis();
LinkedHashMap<TopVoterPlayer, HashMap<VoteSite, LocalDateTime>> voteToday = new LinkedHashMap<TopVoterPlayer, HashMap<VoteSite, LocalDateTime>>();
LinkedHashMap<TopVoter, LinkedHashMap<TopVoterPlayer, Integer>> tempTopVoter = new LinkedHashMap<TopVoter, LinkedHashMap<TopVoterPlayer, Integer>>();
LinkedHashMap<TopVoterPlayer, HashMap<VoteSite, LocalDateTime>> voteToday = new LinkedHashMap<>();
LinkedHashMap<TopVoter, LinkedHashMap<TopVoterPlayer, Integer>> tempTopVoter = new LinkedHashMap<>();
ArrayList<TopVoter> topVotersToCheck = new ArrayList<TopVoter>();
ArrayList<TopVoter> topVotersToCheck = new ArrayList<>();
for (TopVoter top : TopVoter.values()) {
if (plugin == null) {
return;
}
if (plugin.getConfigFile().getLoadTopVoter(top)) {
topVotersToCheck.add(top);
tempTopVoter.put(top, new LinkedHashMap<TopVoterPlayer, Integer>());
tempTopVoter.put(top, new LinkedHashMap<>());
}
}
boolean topVoterIgnorePermissionUse = plugin.getConfigFile()
.getTopVoterIgnorePermission();
.isTopVoterIgnorePermission();
ArrayList<String> blackList = plugin.getConfigFile().getBlackList();
// ArrayList<String> uuids = UserManager.getInstance().getAllUUIDs();
// ArrayList<String> uuids = getVotingPluginUserManager().getAllUUIDs();
int currentDay = LocalDateTime.now().getDayOfMonth();
HashMap<UUID, ArrayList<Column>> cols = plugin.getUserManager().getAllKeys();
long time1 = ((System.currentTimeMillis() - startTime) / 1000);
@@ -1474,58 +1647,59 @@ public class VotingPluginMain extends AdvancedCorePlugin {
for (Entry<UUID, ArrayList<Column>> playerData : cols.entrySet()) {
String uuid = playerData.getKey().toString();
if (plugin != null && plugin.isEnabled()) {
if (uuid != null && !uuid.isEmpty()) {
VotingPluginUser user = UserManager.getInstance()
.getVotingPluginUser(UUID.fromString(uuid), false);
user.dontCache();
user.updateTempCacheWithColumns(playerData.getValue());
cols.put(playerData.getKey(), null);
if (!user.isBanned() && !blackList.contains(user.getPlayerName())) {
if (!topVoterIgnorePermissionUse || !user.isTopVoterIgnore()) {
for (TopVoter top : topVotersToCheck) {
int total = user.getTotal(top);
if (total > 0) {
tempTopVoter.get(top).put(user.getTopVoterPlayer(), total);
}
}
}
HashMap<VoteSite, LocalDateTime> times = new HashMap<VoteSite, LocalDateTime>();
for (Entry<VoteSite, Long> entry : user.getLastVotes().entrySet()) {
if (entry.getKey().isEnabled() && !entry.getKey().isHidden()) {
long time = entry.getValue();
if ((currentDay == MiscUtils.getInstance().getDayFromMili(time))
&& (LocalDateTime.now().getMonthValue() == MiscUtils
.getInstance().getMonthFromMili(time))
&& (LocalDateTime.now().getYear() == MiscUtils
.getInstance().getYearFromMili(time))) {
times.put(entry.getKey(),
LocalDateTime.ofInstant(Instant.ofEpochMilli(time),
ZoneId.systemDefault()));
}
}
}
if (times.keySet().size() > 0) {
voteToday.put(user.getTopVoterPlayer(), times);
}
}
if (extraBackgroundUpdate) {
if (user.isOnline()) {
user.offVote();
}
}
if (plugin != null) {
plugin.getPlaceholders().onUpdate(user);
}
user.clearTempCache();
user = null;
}
} else {
if ((plugin == null) || !plugin.isEnabled()) {
return;
}
if (uuid != null && !uuid.isEmpty()) {
VotingPluginUser user = getVotingPluginUserManager()
.getVotingPluginUser(UUID.fromString(uuid), false);
user.dontCache();
user.updateTempCacheWithColumns(playerData.getValue());
cols.put(playerData.getKey(), null);
if (!user.isBanned() && !blackList.contains(user.getPlayerName())) {
if (!topVoterIgnorePermissionUse || !user.isTopVoterIgnore()) {
for (TopVoter top : topVotersToCheck) {
int total = user.getTotal(top);
if (total > 0) {
tempTopVoter.get(top).put(user.getTopVoterPlayer(), total);
}
}
}
HashMap<VoteSite, LocalDateTime> times = new HashMap<>();
for (Entry<VoteSite, Long> entry : user.getLastVotes().entrySet()) {
if (entry.getKey().isEnabled() && !entry.getKey().isHidden()) {
long time = entry.getValue();
if ((currentDay == MiscUtils.getInstance().getDayFromMili(time))
&& (LocalDateTime.now().getMonthValue() == MiscUtils
.getInstance().getMonthFromMili(time))
&& (LocalDateTime.now().getYear() == MiscUtils.getInstance()
.getYearFromMili(time))) {
times.put(entry.getKey(), LocalDateTime.ofInstant(
Instant.ofEpochMilli(time), ZoneId.systemDefault()));
}
}
}
if (times.keySet().size() > 0) {
voteToday.put(user.getTopVoterPlayer(), times);
}
}
if (extraBackgroundUpdate) {
if (user.isOnline()) {
user.offVote();
}
}
if (plugin != null) {
if (!plugin.getPlaceholders().getCacheLevel().onlineOnly()
|| user.isOnline()) {
plugin.getPlaceholders().onUpdate(user, false);
}
}
user.clearTempCache();
user = null;
}
}
cols.clear();
cols = null;
@@ -1567,32 +1741,26 @@ public class VotingPluginMain extends AdvancedCorePlugin {
}
}
private boolean firstTimeLoaded = false;
public void checkFirstTimeLoaded() {
if (!firstTimeLoaded) {
if (getGui().isChestVoteTopUseSkull()) {
int maxToLoad = 200;
for (TopVoter top : topVoter.keySet()) {
int num = 1;
Set<TopVoterPlayer> players = topVoter.get(top).keySet();
for (TopVoterPlayer p : players) {
if (num <= maxToLoad) {
SkullHandler.getInstance().loadSkull(p.getPlayerName());
}
num++;
}
}
}
}
firstTimeLoaded = true;
}
public void updateAdvancedCoreHook() {
getJavascriptEngine().put("VotingPlugin", this);
allowDownloadingFromSpigot(15358);
setConfigData(configFile.getData());
setConfigData(new YMLConfig(this, configFile.getData()) {
@Override
public void createSection(String key) {
configFile.createSection(key);
}
@Override
public void saveData() {
configFile.saveData();
}
@Override
public void setValue(String path, Object value) {
configFile.setValue(path, value);
}
});
if (bungeeSettings.isUseBungeecoord()) {
getOptions().setPerServerRewards(getBungeeSettings().isPerServerRewards());
}
@@ -2,8 +2,7 @@ package com.bencodez.votingplugin;
import java.util.concurrent.Callable;
import com.bencodez.advancedcore.api.metrics.BStatsMetrics;
import com.bencodez.votingplugin.user.UserManager;
import com.bencodez.simpleapi.metrics.BStatsMetrics;
public class VotingPluginMetrics {
@@ -17,9 +16,8 @@ public class VotingPluginMetrics {
if (plugin.getRewardHandler().hasRewards(plugin.getSpecialRewardsConfig().getData(),
plugin.getSpecialRewardsConfig().getFirstVoteRewardsPath())) {
return "True";
} else {
return "False";
}
return "False";
}
}));
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_everysite", new Callable<String>() {
@@ -29,9 +27,8 @@ public class VotingPluginMetrics {
if (plugin.getRewardHandler().hasRewards(plugin.getConfigVoteSites().getData(),
plugin.getConfigVoteSites().getEverySiteRewardPath())) {
return "True";
} else {
return "False";
}
return "False";
}
}));
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_allsites", new Callable<String>() {
@@ -41,9 +38,8 @@ public class VotingPluginMetrics {
if (plugin.getRewardHandler().hasRewards(plugin.getSpecialRewardsConfig().getData(),
plugin.getSpecialRewardsConfig().getAllSitesRewardPath())) {
return "True";
} else {
return "False";
}
return "False";
}
}));
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_cumulative", new Callable<String>() {
@@ -52,25 +48,30 @@ public class VotingPluginMetrics {
public String call() throws Exception {
if (plugin.getSpecialRewardsConfig().getCumulativeVotes().size() == 0) {
return "False";
} else {
for (String cum : plugin.getSpecialRewardsConfig().getCumulativeVotes()) {
if (plugin.getSpecialRewardsConfig().getCumulativeRewardEnabled(Integer.parseInt(cum))) {
return "True";
}
}
return "False";
}
for (String cum : plugin.getSpecialRewardsConfig().getCumulativeVotes()) {
if (plugin.getSpecialRewardsConfig().getCumulativeRewardEnabled(Integer.parseInt(cum))) {
return "True";
}
}
return "False";
}
}));
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_voteparty", new Callable<String>() {
@Override
public String call() throws Exception {
if (!plugin.getSpecialRewardsConfig().getVotePartyEnabled()) {
if (!plugin.getSpecialRewardsConfig().isVotePartyEnabled()) {
return "False";
} else {
return "True";
}
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>() {
@@ -79,14 +80,13 @@ public class VotingPluginMetrics {
public String call() throws Exception {
if (plugin.getSpecialRewardsConfig().getMilestoneVotes().size() == 0) {
return "False";
} else {
for (String milestone : plugin.getSpecialRewardsConfig().getMilestoneVotes()) {
if (plugin.getSpecialRewardsConfig().getMilestoneRewardEnabled(Integer.parseInt(milestone))) {
return "True";
}
}
return "False";
}
for (String milestone : plugin.getSpecialRewardsConfig().getMilestoneVotes()) {
if (plugin.getSpecialRewardsConfig().getMilestoneRewardEnabled(Integer.parseInt(milestone))) {
return "True";
}
}
return "False";
}
}));
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_anysitereward", new Callable<String>() {
@@ -96,9 +96,8 @@ public class VotingPluginMetrics {
if (plugin.getRewardHandler().hasRewards(plugin.getSpecialRewardsConfig().getData(),
plugin.getSpecialRewardsConfig().getAnySiteRewardsPath())) {
return "True";
} else {
return "False";
}
return "False";
}
}));
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_votestreakday", new Callable<String>() {
@@ -155,7 +154,7 @@ public class VotingPluginMetrics {
@Override
public String call() throws Exception {
return "" + plugin.getVoteSites().size();
return "" + plugin.getVoteSitesEnabled().size();
}
}));
metrics.addCustomChart(new BStatsMetrics.SimplePie("numberofrewards", new Callable<String>() {
@@ -177,12 +176,14 @@ public class VotingPluginMetrics {
@Override
public String call() throws Exception {
int total = UserManager.getInstance().getAllUUIDs().size();
int total = plugin.getUserManager().getAllUUIDs().size();
if (total > 800000) {
return ">800000";
} else if (total > 700000) {
}
if (total > 700000) {
return "700000-800000";
} else if (total > 600000) {
}
if (total > 600000) {
return "600000-700000";
} else if (total > 500000) {
return "500000-600000";
@@ -219,28 +220,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>() {
@@ -249,9 +250,8 @@ public class VotingPluginMetrics {
public String call() throws Exception {
if (plugin.getBungeeSettings().isUseBungeecoord()) {
return "" + plugin.getBungeeHandler().getMethod().toString();
} else {
return "Disabled";
}
return "Disabled";
}
}));
if (plugin.getBungeeSettings().isUseBungeecoord()) {
@@ -318,11 +318,11 @@ public class VotingPluginMetrics {
}
}));
metrics.addCustomChart(new BStatsMetrics.SimplePie("geyserprefixsupport", new Callable<String>() {
metrics.addCustomChart(new BStatsMetrics.SimplePie("bedrockplayerprefix", new Callable<String>() {
@Override
public String call() throws Exception {
return "" + plugin.getOptions().isGeyserPrefixSupport();
return "" + plugin.getOptions().getBedrockPlayerPrefix();
}
}));
@@ -10,15 +10,15 @@ import java.util.concurrent.TimeUnit;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.messages.PlaceholderUtils;
import com.bencodez.advancedcore.api.misc.MiscUtils;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.user.UserManager;
public class BroadcastHandler {
private VotingPluginMain plugin;
private ScheduledExecutorService timer;
ConcurrentLinkedQueue<String> votedPlayers = new ConcurrentLinkedQueue<String>();
ConcurrentLinkedQueue<String> votedPlayers = new ConcurrentLinkedQueue<>();
public BroadcastHandler(VotingPluginMain plugin, int delay) {
this.plugin = plugin;
@@ -31,8 +31,7 @@ public class BroadcastHandler {
for (int i = 0; i < size; i++) {
votedPlayers.poll();
}
String bc = StringParser.getInstance()
.colorize(plugin.getConfigFile().getFormatAlternateBroadcastBroadcast());
String bc = MessageAPI.colorize(plugin.getConfigFile().getFormatAlternateBroadcastBroadcast());
String playersText = "";
while (!votedPlayers.isEmpty()) {
playersText += votedPlayers.remove();
@@ -40,13 +39,13 @@ public class BroadcastHandler {
playersText += ", ";
}
}
HashMap<String, String> placeholders = new HashMap<String, String>();
HashMap<String, String> placeholders = new HashMap<>();
placeholders.put("numberofplayers", "" + size);
placeholders.put("players", playersText);
bc = StringParser.getInstance().replacePlaceHolder(bc, placeholders);
ArrayList<Player> players = new ArrayList<Player>();
bc = PlaceholderUtils.replacePlaceHolder(bc, placeholders);
ArrayList<Player> players = new ArrayList<>();
for (Player p : Bukkit.getOnlinePlayers()) {
if (!UserManager.getInstance().getVotingPluginUser(p).getDisableBroadcast()) {
if (!plugin.getVotingPluginUserManager().getVotingPluginUser(p).getDisableBroadcast()) {
players.add(p);
}
}
@@ -3,31 +3,43 @@ package com.bencodez.votingplugin.bungee;
import java.util.regex.Pattern;
import lombok.Getter;
import lombok.Setter;
public class BungeeMessageData {
// Message string
// alltimetotal//monthtotal//weeklytotal//dailytotal//points//milestonecount//votepartycurrent//votepartyrequired
// alltimetotal//monthtotal//weeklytotal//dailytotal//points//milestonecount//votepartycurrent//votepartyrequired//datemonthtotal
@Getter
@Setter
private int allTimeTotal = 0;
@Getter
@Setter
private int dailyTotal = 0;
@Getter
@Setter
private int milestoneCount = 0;
@Getter
@Setter
private int monthTotal = 0;
@Getter
@Setter
private int dateMonthTotal = 0;
@Getter
@Setter
private int points = 0;
@Getter
@Setter
private int weeklyTotal = 0;
@Getter
@Setter
private int votePartyCurrent = 0;
@Getter
@Setter
private int votePartyRequired = 0;
public BungeeMessageData(int allTimeTotal, int monthTotal, int weeklyTotal, int dailyTotal, int points,
int milestoneCount, int votePartyCurrent, int votePartyRequired) {
int milestoneCount, int votePartyCurrent, int votePartyRequired, int dateMonthTotal) {
this.allTimeTotal = allTimeTotal;
this.monthTotal = monthTotal;
this.weeklyTotal = weeklyTotal;
@@ -36,6 +48,7 @@ public class BungeeMessageData {
this.milestoneCount = milestoneCount;
this.votePartyCurrent = votePartyCurrent;
this.votePartyRequired = votePartyRequired;
this.dateMonthTotal = dateMonthTotal;
}
public BungeeMessageData(String str) {
@@ -52,6 +65,9 @@ public class BungeeMessageData {
votePartyCurrent = Integer.parseInt(data[6]);
votePartyRequired = Integer.parseInt(data[7]);
}
if (data.length >= 9) {
dateMonthTotal = Integer.parseInt(data[8]);
}
}
@Override
@@ -1,7 +1,7 @@
package com.bencodez.votingplugin.bungee;
public enum BungeeMethod {
MYSQL, PLUGINMESSAGING, SOCKETS;
MYSQL, PLUGINMESSAGING, SOCKETS, REDIS;
public static BungeeMethod getByName(String str) {
for (BungeeMethod method : values()) {
@@ -9,6 +9,6 @@ public enum BungeeMethod {
return method;
}
}
return SOCKETS;
return PLUGINMESSAGING;
}
}
@@ -5,14 +5,18 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.bencodez.votingplugin.bungee.proxy.VotingPluginProxyConfig;
import lombok.Getter;
import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration;
public class Config {
public class Config implements VotingPluginProxyConfig {
private VotingPluginBungee bungee;
@Getter
private Configuration data;
@@ -21,42 +25,30 @@ public class Config {
this.bungee = bungee;
}
public Map<String, Object> configToMap(Configuration config) {
Map<String, Object> map = new HashMap<>();
if (config != null) {
config.getKeys().forEach(key -> map.put(key, config.get(key)));
}
return map;
}
public boolean getAllowUnJoined() {
return getData().getBoolean("AllowUnJoined", false);
}
public String getBedrockPlayerPrefix() {
return getData().getString("BedrockPlayerPrefix", ".");
}
public List<String> getBlockedServers() {
return getData().getStringList("BlockedServers");
}
public List<String> getWhiteListedServers() {
return getData().getStringList("WhiteListedServers");
}
public boolean getBroadcast() {
return getData().getBoolean("Broadcast", false);
}
public boolean getGeyserSupport() {
return getData().getBoolean("GeyserSupport", false);
}
public String getGeyserPrefix() {
return getData().getString("GeyserPrefix", ".");
}
public boolean getOnlineMode() {
return getData().getBoolean("OnlineMode", true);
}
public boolean getGlobalDataEnabled() {
return getData().getBoolean("GlobalData.Enabled", false);
}
public boolean getGlobalDataUseMainMySQL() {
return getData().getBoolean("GlobalData.UseMainMySQL", true);
}
public String getBungeeHost() {
return getData().getString("BungeeServer.Host", "");
}
@@ -77,84 +69,188 @@ public class Config {
return getData().getBoolean("Debug", false);
}
public boolean getMultiProxySupport() {
return getData().getBoolean("MultiProxySupport", false);
public String getFallBack() {
return getData().getString("FallBackServer", "");
}
public int getMultiProxySocketHostPort() {
return getData().getInt("MultiProxySocketHost.Port", 1297);
public boolean getGlobalDataEnabled() {
return getData().getBoolean("GlobalData.Enabled", false);
}
public String getMultiProxySocketHostHost() {
return getData().getString("MultiProxySocketHost.Host", "");
public boolean getGlobalDataUseMainMySQL() {
return getData().getBoolean("GlobalData.UseMainMySQL", true);
}
public int getLimitVotePoints() {
return getData().getInt("LimitVotePoints", -1);
}
public int getMaxAmountOfVotesPerDay() {
return getData().getInt("MaxAmountOfVotesPerDay", -1);
}
public String getMultiProxyMethod() {
return getData().getString("MultiProxyMethod", "SOCKET");
}
public boolean getMultiProxyOneGlobalReward() {
return getData().getBoolean("MultiProxyOneGlobalReward", false);
}
public Configuration getMultiProxyServersConfiguration(String s) {
return getData().getSection("MultiProxyServers." + s);
public String getMultiProxyRedisHost() {
return getData().getString("MultiProxyRedis.Host", "");
}
public String getMultiProxyRedisPassword() {
return getData().getString("MultiProxyRedis.Password", "");
}
public int getMultiProxyRedisPort() {
return getData().getInt("MultiProxyRedis.Port", 6379);
}
public boolean getMultiProxyRedisUseExistingConnection() {
return getData().getBoolean("MultiProxyRedis.UseExistingConnection", false);
}
public String getMultiProxyRedisUsername() {
return getData().getString("MultiProxyRedis.Username", "");
}
public Collection<String> getMultiProxyServers() {
return getData().getSection("MultiProxyServers").getKeys();
}
public boolean getPrimaryServer() {
return getData().getBoolean("PrimaryServer", false);
public Map<String, Object> getMultiProxyServersConfiguration(String s) {
return configToMap(getData().getSection("MultiProxyServers." + s));
}
public String getFallBack() {
return getData().getString("FallBackServer", "");
public String getMultiProxySocketHostHost() {
return getData().getString("MultiProxySocketHost.Host", "");
}
public int getMultiProxySocketHostPort() {
return getData().getInt("MultiProxySocketHost.Port", 1297);
}
public boolean getMultiProxySupport() {
return getData().getBoolean("MultiProxySupport", false);
}
public boolean getOnlineMode() {
return getData().getBoolean("OnlineMode", true);
}
public int getPointsOnVote() {
return getData().getInt("PointsOnVote", 1);
}
public boolean getPrimaryServer() {
return getData().getBoolean("PrimaryServer", false);
}
public String getProxyServerName() {
return getData().getString("ProxyServerName", "SOCKET");
}
public List<String> getProxyServers() {
return getData().getStringList("ProxyServers");
}
public String getRedisHost() {
return getData().getString("Redis.Host", "");
}
public String getRedisPassword() {
return getData().getString("Redis.Password", "");
}
public int getRedisPort() {
return getData().getInt("Redis.Port", 6379);
}
public String getRedisPrefix() {
return getData().getString("Redis.Prefix", "");
}
public String getRedisUsername() {
return getData().getString("Redis.Username", "");
}
public boolean getSendVotesToAllServers() {
return getData().getBoolean("SendVotesToAllServers");
}
public Configuration getSpigotServerConfiguration(String s) {
return getData().getSection("SpigotServers." + s);
public Map<String, Object> getSpigotServerConfiguration(String s) {
return configToMap(getData().getSection("SpigotServers." + s));
}
public Collection<String> getSpigotServers() {
return getData().getSection("SpigotServers").getKeys();
}
public boolean getWaitForUserOnline() {
return getData().getBoolean("WaitForUserOnline", false);
public boolean getStoreMonthTotalsWithDate() {
return getData().getBoolean("StoreMonthTotalsWithDate", false);
}
public boolean getVotePartyEnabled() {
return getData().getBoolean("VoteParty.Enabled", false);
public boolean getTimeChangeFailSafeBypass() {
return getData().getBoolean("TimeChangeFailSafeBypass", false);
}
public boolean getVotePartySendToAllServers() {
return getData().getBoolean("VoteParty.SendToAllServers", true);
public int getTimeHourOffSet() {
return getData().getInt("TimeHourOffSet");
}
public int getVotePartyVotesRequired() {
return getData().getInt("VoteParty.VotesRequired", 100);
public String getTimeZone() {
return getData().getString("TimeZone", "");
}
public int getVotePartyIncreaseVotesRequired() {
return getData().getInt("VoteParty.IncreaseVotesRequired", 0);
public boolean getUseMonthDateTotalsAsPrimaryTotal() {
return getData().getBoolean("UseMonthDateTotalsAsPrimaryTotal", false);
}
public boolean getUUIDLookup() {
return getData().getBoolean("UUIDLookup", true);
}
public int getVoteCacheTime() {
return getData().getInt("VoteCacheTime", -1);
}
public String getVotePartyBroadcast() {
return getData().getString("VoteParty.Broadcast", "");
}
public List<String> getVotePartyBungeeCommands() {
return getData().getStringList("VoteParty.BungeeCommands");
}
public boolean getVotePartyEnabled() {
return getData().getBoolean("VoteParty.Enabled", false);
}
public int getVotePartyIncreaseVotesRequired() {
return getData().getInt("VoteParty.IncreaseVotesRequired", 0);
}
public boolean getVotePartySendToAllServers() {
return getData().getBoolean("VoteParty.SendToAllServers", true);
}
public List<String> getVotePartyServersToSend() {
return getData().getStringList("VoteParty.ServersToSend");
}
public List<String> getVotePartyBungeeCommands() {
return getData().getStringList("VoteParty.BungeeCommands");
public int getVotePartyVotesRequired() {
return getData().getInt("VoteParty.VotesRequired", 100);
}
public boolean getWaitForUserOnline() {
return getData().getBoolean("WaitForUserOnline", false);
}
public List<String> getWhiteListedServers() {
return getData().getStringList("WhiteListedServers");
}
public void load() {
@@ -188,4 +284,14 @@ public class Config {
}
}
@Override
public String getPluginMessageChannel() {
return getData().getString("PluginMessageChannel", "vp:vp");
}
@Override
public boolean getPluginMessageEncryption() {
return getData().getBoolean("PluginMessageEncryption", false);
}
}
@@ -20,14 +20,21 @@ public class NonVotedPlayersCache {
}
public void addPlayer(ProxiedPlayer proxiedPlayer) {
if (!bungee.getMysql().containsKeyQuery(proxiedPlayer.getUniqueId().toString())) {
if (!bungee.getVotingPluginProxy().getProxyMySQL().containsKeyQuery(proxiedPlayer.getUniqueId().toString())) {
addPlayer(proxiedPlayer.getUniqueId().toString(), proxiedPlayer.getName());
}
}
private void addPlayer(String uuid, String playerName) {
public void addPlayer(String uuid, String playerName) {
getData().set("NonVotedPlayers." + playerName + ".UUID", uuid);
getData().set("NonVotedPlayers." + playerName + ".LastTime", System.currentTimeMillis());
save();
}
public void addPlayerCheck(String uuid, String playerName) {
if (!bungee.getVotingPluginProxy().getProxyMySQL().containsKeyQuery(uuid)) {
addPlayer(uuid, playerName);
}
}
public void check() {
@@ -38,7 +45,7 @@ public class NonVotedPlayersCache {
} else {
String uuid = getData().getString("NonVotedPlayers." + player + ".UUID", "");
if (!uuid.isEmpty()) {
if (bungee.getMysql().containsKeyQuery(uuid)) {
if (bungee.getVotingPluginProxy().getProxyMySQL().containsKeyQuery(uuid)) {
remove(player);
}
} else {
@@ -21,28 +21,11 @@ public class VoteCache {
this.bungee = bungee;
}
public int getVotePartyCurrentVotes() {
return getData().getInt("VoteParty.CurrentVotes", 0);
}
public int getVotePartyInreaseVotesRequired() {
return getData().getInt("VoteParty.IncreaseVotes", 0);
}
public void setVotePartyCurrentVotes(int amount) {
getData().set("VoteParty.CurrentVotes", amount);
}
public void setVotePartyInreaseVotesRequired(int amount) {
getData().set("VoteParty.IncreaseVotes", amount);
}
public void setVotePartyCache(String server, int amount) {
getData().set("VoteParty.Cache." + server, amount);
}
public int getVotePartyCache(String server) {
return getData().getInt("VoteParty.Cache." + server, 0);
public void addTimedVote(int num, VoteTimeQueue voteTimedQueue) {
Configuration section = getData().getSection("TimedVoteCache." + num);
section.set("Name", voteTimedQueue.getName());
section.set("Service", voteTimedQueue.getService());
section.set("Time", voteTimedQueue.getTime());
}
public void addVote(String server, int num, OfflineBungeeVote voteData) {
@@ -55,13 +38,6 @@ public class VoteCache {
section.set("Text", voteData.getText());
}
public void addTimedVote(int num, VoteTimeQueue voteTimedQueue) {
Configuration section = getData().getSection("TimedVoteCache." + num);
section.set("Name", voteTimedQueue.getName());
section.set("Service", voteTimedQueue.getService());
section.set("Time", voteTimedQueue.getTime());
}
public void addVoteOnline(String player, int num, OfflineBungeeVote voteData) {
Configuration section = getData().getSection("OnlineCache." + player + "." + num);
section.set("Name", voteData.getPlayerName());
@@ -75,6 +51,7 @@ public class VoteCache {
public void clearData() {
getData().set("VoteCache", null);
getData().set("OnlineCache", null);
getData().set("TimedVoteCache", null);
save();
}
@@ -94,14 +71,6 @@ public class VoteCache {
return getData().getSection("VoteCache").getKeys();
}
public Configuration getTimedVoteCache(String key) {
return getData().getSection("TimedVoteCache." + key);
}
public Collection<String> getTimedVoteCache() {
return getData().getSection("TimedVoteCache").getKeys();
}
public Collection<String> getServerVotes(String server) {
return getData().getSection("VoteCache." + server).getKeys();
}
@@ -110,13 +79,33 @@ public class VoteCache {
return getData().getSection("VoteCache." + server + "." + num);
}
public Collection<String> getTimedVoteCache() {
return getData().getSection("TimedVoteCache").getKeys();
}
public Configuration getTimedVoteCache(String key) {
return getData().getSection("TimedVoteCache." + key);
}
public int getVotePartyCache(String server) {
return getData().getInt("VoteParty.Cache." + server, 0);
}
public int getVotePartyCurrentVotes() {
return getData().getInt("VoteParty.CurrentVotes", 0);
}
public int getVotePartyInreaseVotesRequired() {
return getData().getInt("VoteParty.IncreaseVotes", 0);
}
public void load() {
if (!bungee.getDataFolder().exists()) {
bungee.getDataFolder().mkdir();
}
File yamlFile = new File(bungee.getDataFolder(), "votecache.yml");
File file = new File(bungee.getDataFolder(), "votecache.json");
if (!file.exists()) {
@@ -136,10 +125,10 @@ public class VoteCache {
} catch (IOException e) {
e.printStackTrace();
}
save();
}
try {
data = ConfigurationProvider.getProvider(JsonConfiguration.class)
.load(new File(bungee.getDataFolder(), "votecache.json"));
@@ -157,4 +146,16 @@ public class VoteCache {
}
}
public void setVotePartyCache(String server, int amount) {
getData().set("VoteParty.Cache." + server, amount);
}
public void setVotePartyCurrentVotes(int amount) {
getData().set("VoteParty.CurrentVotes", amount);
}
public void setVotePartyInreaseVotesRequired(int amount) {
getData().set("VoteParty.IncreaseVotes", amount);
}
}
@@ -28,7 +28,7 @@ public class VoteEventBungee implements net.md_5.bungee.api.plugin.Listener {
vote.setServiceName(serviceSite);
}
plugin.vote(vote.getUsername(), serviceSite, true, true, 0, null, null);
plugin.getVotingPluginProxy().vote(vote.getUsername(), serviceSite, true, true, 0, null, null);
}
});
File diff suppressed because it is too large. Load diff
@@ -1,6 +1,6 @@
package com.bencodez.votingplugin.bungee;
import com.bencodez.advancedcore.api.time.TimeType;
import com.bencodez.votingplugin.bungee.proxy.VotingPluginProxyCommand;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.TextComponent;
@@ -17,76 +17,9 @@ public class VotingPluginBungeeCommand extends Command {
@Override
public void execute(CommandSender sender, String[] args) {
if (sender.hasPermission("votingplugin.admin")) {
if (args.length > 0) {
if (args[0].equalsIgnoreCase("reload")) {
bungee.reload(false);
sender.sendMessage(new TextComponent("Reloading VotingPluginBungee"));
}
if (args[0].equalsIgnoreCase("reloadmysql")) {
bungee.reload(true);
sender.sendMessage(new TextComponent("Reloading VotingPluginBungee with MySQL"));
}
if (args[0].equalsIgnoreCase("vote")) {
if (args.length >= 2) {
String user = args[1];
String site = args[2];
bungee.vote(user, site, false, true, 0, null, null);
sender.sendMessage(new TextComponent("Sending vote"));
}
}
if (args[0].equalsIgnoreCase("forcetimechange")) {
if (args.length >= 2) {
bungee.getBungeeTimeChecker().forceChanged(TimeType.getTimeType(args[1]));
sender.sendMessage(new TextComponent("Triggering time change: " + args[1]));
}
}
if (args[0].equalsIgnoreCase("status")) {
if (bungee.getMethod().equals(BungeeMethod.SOCKETS)) {
sender.sendMessage(new TextComponent(
"&aChecking status, waiting for response, check console, method: sockets"));
bungee.status(sender);
} else if (bungee.getMethod().equals(BungeeMethod.PLUGINMESSAGING)) {
sender.sendMessage(new TextComponent(
"&aChecking status, waiting for response, check console, method: plugin messaging"));
bungee.status(sender);
} else {
sender.sendMessage(
new TextComponent("&aNot using socket/pluginmessage method, command unavailable"));
}
}
if (args[0].equalsIgnoreCase("multiproxystatus")) {
bungee.sendMultiProxyServerMessage("Status");
sender.sendMessage(new TextComponent("&aSending status message"));
}
if (args[0].equalsIgnoreCase("help")) {
TextComponent[] msg = new TextComponent[7];
msg[0] = new TextComponent("&avotingpluginbungee reload - Reload plugin");
msg[1] = new TextComponent("&avotingpluginbungee reloadmysql - Reload plugin including mysql");
msg[2] = new TextComponent("&avotingpluginbungee vote (player) (servicesite) - Send bungee vote");
msg[3] = new TextComponent("&avotingpluginbungee status - Check socket connection status");
msg[4] = new TextComponent("&avotingpluginbungee forcetimechange (timetype) - Force a time change");
msg[5] = new TextComponent("&avotingpluginbungee voteparty force - Force a vote party");
msg[6] = new TextComponent(
"&avotingpluginbungee voteparty setvotecount (number) - Set current vote party votes");
sender.sendMessage(msg);
}
if (args[0].equalsIgnoreCase("voteparty")) {
if (args.length > 1) {
if (args[1].equalsIgnoreCase("Force")) {
bungee.setCurrentVotePartyVotes(bungee.getCurrentVotePartyVotesRequired());
bungee.checkVoteParty();
sender.sendMessage(new TextComponent("Vote party forced"));
}
if (args.length > 2) {
if (args[1].equalsIgnoreCase("SetVoteCount")) {
if (isInt(args[2])) {
bungee.setCurrentVotePartyVotes(Integer.parseInt(args[2]));
sender.sendMessage(new TextComponent("Set current vote party votes to " + args[2]));
}
}
}
}
}
String result = new VotingPluginProxyCommand(bungee.getVotingPluginProxy()).execute(args);
if (result != null) {
sender.sendMessage(new TextComponent(result.replace("&", "§")));
}
} else {
sender.sendMessage(new TextComponent("&cYou do not have permission to do this!"));
@@ -0,0 +1,226 @@
package com.bencodez.votingplugin.bungee.global.multiproxy;
import java.io.File;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import com.bencodez.advancedcore.api.misc.encryption.EncryptionHandler;
import com.bencodez.advancedcore.bungeeapi.redis.RedisHandler;
import com.bencodez.advancedcore.bungeeapi.redis.RedisListener;
import com.bencodez.advancedcore.bungeeapi.sockets.ClientHandler;
import com.bencodez.advancedcore.bungeeapi.sockets.SocketHandler;
import com.bencodez.advancedcore.bungeeapi.sockets.SocketReceiver;
import com.bencodez.votingplugin.bungee.BungeeMessageData;
import lombok.Getter;
public abstract class MultiProxyHandler {
private HashMap<String, ClientHandler> multiproxyClientHandles;
private SocketHandler multiproxySocketHandler;
@Getter
private RedisHandler multiProxyRedis;
public MultiProxyHandler() {
}
public abstract void addNonVotedPlayerCache(String string, String string2);
public abstract void clearVote(String string);
public void close() {
if (multiproxySocketHandler != null) {
multiproxySocketHandler.closeConnection();
multiproxySocketHandler = null;
}
if (multiProxyRedis != null && !getMultiProxyRedisUseExistingConnection()) {
multiProxyRedis.close();
}
}
public abstract boolean getDebug();
public abstract EncryptionHandler getEncryptionHandler();
public abstract MultiProxyMethod getMultiProxyMethod();
public abstract String getMultiProxyPassword();
public abstract String getMultiProxyRedisHost();
public abstract int getMultiProxyRedisPort();
public abstract boolean getMultiProxyRedisUseExistingConnection();
public abstract String getMultiProxyServerName();
public abstract Collection<String> getMultiProxyServers();
public abstract MultiProxyServerSocketConfiguration getMultiProxyServersConfiguration(String s);
public abstract String getMultiProxySocketHostHost();
public abstract int getMultiProxySocketHostPort();
public abstract boolean getMultiProxySupportEnabled();
public abstract String getMultiProxyUsername();
public abstract File getPluginDataFolder();
public abstract boolean getPrimaryServer();
public abstract List<String> getProxyServers();
public abstract RedisHandler getRedisHandler();
public abstract String getVersion();
public void loadMultiProxySupport() {
if (getMultiProxySupportEnabled()) {
if (getMultiProxyMethod().equals(MultiProxyMethod.SOCKETS)) {
if (getEncryptionHandler() == null) {
setEncryptionHandler(new EncryptionHandler(new File(getPluginDataFolder(), "secretkey.key")));
}
if (multiproxySocketHandler != null) {
multiproxySocketHandler.closeConnection();
multiproxySocketHandler = null;
}
multiproxySocketHandler = new SocketHandler(getVersion(), getMultiProxySocketHostHost(),
getMultiProxySocketHostPort(), getEncryptionHandler(), getDebug()) {
@Override
public void log(String str) {
logInfo(str);
}
};
multiproxySocketHandler.add(new SocketReceiver() {
@Override
public void onReceive(String[] data) {
if (data.length > 0) {
if (data[0].equalsIgnoreCase("Status")) {
logInfo("Multi-proxy status message received");
} else if (data[0].equalsIgnoreCase("ClearVote")) {
clearVote(data[2]);
if (getPrimaryServer()) {
sendMultiProxyServerMessage("ClearVotePrimary", data[1], data[2]);
}
} else if (data[0].equalsIgnoreCase("ClearVotePrimary")) {
clearVote(data[2]);
} else if (data[0].equalsIgnoreCase("login")) {
addNonVotedPlayerCache(data[1], data[2]);
// nonVotedPlayersCache.addPlayer(data[1], data[2]);
}
}
if (data.length > 8) {
if (data[0].equalsIgnoreCase("Vote")) {
triggerVote(data[2], data[3], Boolean.valueOf(data[7]), true, 0,
new BungeeMessageData(data[8]), data[1]);
} else if (data[0].equalsIgnoreCase("VoteOnline")) {
triggerVote(data[2], data[3], Boolean.valueOf(data[7]), true, 0,
new BungeeMessageData(data[8]), data[1]);
}
}
}
});
multiproxyClientHandles = new HashMap<>();
for (String s : getMultiProxyServers()) {
MultiProxyServerSocketConfiguration d = getMultiProxyServersConfiguration(s);
multiproxyClientHandles.put(s,
new ClientHandler(d.getHost(), d.getPort(), getEncryptionHandler(), getDebug()));
}
} else {
if (getMultiProxyRedisUseExistingConnection() && getRedisHandler() != null) {
multiProxyRedis = getRedisHandler();
} else {
multiProxyRedis = new RedisHandler(getMultiProxyRedisHost(), getMultiProxyRedisPort(),
getMultiProxyUsername(), getMultiProxyPassword()) {
@Override
public void debug(String message) {
if (getDebug()) {
logInfo("MultiProxyRedis: " + message);
}
}
@Override
public void onMessage(String channel, String[] data) {
if (data.length > 0) {
if (data[0].equalsIgnoreCase("Status")) {
logInfo("Multi-proxy status message received");
} else if (data[0].equalsIgnoreCase("ClearVote")) {
clearVote(data[2]);
if (getPrimaryServer()) {
sendMultiProxyServerMessage("ClearVotePrimary", data[1], data[2]);
}
} else if (data[0].equalsIgnoreCase("ClearVotePrimary")) {
clearVote(data[2]);
} else if (data[0].equalsIgnoreCase("login")) {
addNonVotedPlayerCache(data[1], data[2]);
// nonVotedPlayersCache.addPlayer(data[1], data[2]);
}
}
if (data.length > 8) {
if (data[0].equalsIgnoreCase("Vote")) {
triggerVote(data[2], data[3], Boolean.valueOf(data[7]), true, 0,
new BungeeMessageData(data[8]), data[1]);
} else if (data[0].equalsIgnoreCase("VoteOnline")) {
triggerVote(data[2], data[3], Boolean.valueOf(data[7]), true, 0,
new BungeeMessageData(data[8]), data[1]);
}
}
}
};
}
runAsnc(new Runnable() {
@Override
public void run() {
multiProxyRedis.loadListener(
new RedisListener(multiProxyRedis, "VotingPluginProxy_" + getMultiProxyServerName()));
}
});
}
logInfo("Loaded multi-proxy support: " + getMultiProxyMethod().toString());
}
}
public void login(String uuid, String playerName) {
if (!getMultiProxySupportEnabled() || getPrimaryServer()) {
return;
}
sendMultiProxyServerMessage("Login", uuid, playerName);
}
public abstract void logInfo(String msg);
public abstract void runAsnc(Runnable runnable);
public void sendMultiProxyServerMessage(String... messageData) {
if (getMultiProxyMethod().equals(MultiProxyMethod.SOCKETS)) {
for (ClientHandler h : multiproxyClientHandles.values()) {
h.sendMessage(messageData);
}
} else if (getMultiProxyMethod().equals(MultiProxyMethod.REDIS)) {
for (String server : getProxyServers()) {
multiProxyRedis.sendMessage("VotingPluginProxy_" + server, messageData);
}
}
}
public abstract void setEncryptionHandler(EncryptionHandler encryptionHandler);
public abstract void triggerVote(String player, String service, boolean realVote, boolean timeQueue, long queueTime,
BungeeMessageData text, String uuid);
}
@@ -0,0 +1,14 @@
package com.bencodez.votingplugin.bungee.global.multiproxy;
public enum MultiProxyMethod {
SOCKETS, REDIS;
public static MultiProxyMethod getByName(String str) {
for (MultiProxyMethod method : values()) {
if (method.toString().equalsIgnoreCase(str)) {
return method;
}
}
return MultiProxyMethod.SOCKETS;
}
}
@@ -0,0 +1,9 @@
package com.bencodez.votingplugin.bungee.global.multiproxy;
public interface MultiProxyServerSocketConfiguration {
String getHost();
int getPort();
String getServerName();
}
@@ -0,0 +1,37 @@
package com.bencodez.votingplugin.bungee.global.multiproxy;
import java.util.Map;
public class MultiProxyServerSocketConfigurationBungee implements MultiProxyServerSocketConfiguration {
private String server;
private String host = "";
private int port;
public MultiProxyServerSocketConfigurationBungee(String s, Map<String, Object> config) {
server = s;
if (config.containsKey("Host")) {
host = (String) config.get("Host");
}
if (config.containsKey("Port")) {
port = (int) config.get("Port");
} else {
port = 1298;
}
}
@Override
public String getHost() {
return host;
}
@Override
public int getPort() {
return port;
}
@Override
public String getServerName() {
return server;
}
}
@@ -0,0 +1,33 @@
package com.bencodez.votingplugin.bungee.global.multiproxy;
import ninja.leaping.configurate.ConfigurationNode;
public class MultiProxyServerSocketConfigurationVelocity implements MultiProxyServerSocketConfiguration {
private String server;
private String host;
private int port;
public MultiProxyServerSocketConfigurationVelocity(String s, ConfigurationNode config) {
server = s;
host = config.getNode("Host").getString("0.0.0.0");
port = config.getNode("Port").getInt(1298);
}
@Override
public String getHost() {
return host;
}
@Override
public int getPort() {
return port;
}
@Override
public String getServerName() {
return server;
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,121 @@
package com.bencodez.votingplugin.bungee.proxy;
import com.bencodez.advancedcore.api.time.TimeType;
import com.bencodez.votingplugin.bungee.BungeeMethod;
public class VotingPluginProxyCommand {
private VotingPluginProxy plugin;
public VotingPluginProxyCommand(VotingPluginProxy plugin) {
this.plugin = plugin;
}
/**
* Execute the command and return a message as a String.
*
* @param args Command arguments
* @return The resulting message to send
*/
public String execute(String[] args) {
if (args.length == 0)
return "&cPlease provide a valid command. Use 'help' to view all commands.";
switch (args[0].toLowerCase()) {
case "reload":
plugin.reloadCore(false);
return "&aReloading VotingPlugin";
case "reloadmysql":
plugin.reloadCore(true);
return "&aReloading VotingPlugin including MySQL";
case "vote":
if (args.length >= 3) {
String user = args[1];
String site = args[2];
plugin.vote(user, site, false, true, 0, null, null);
return "&aVote sent for " + user + " on " + site;
}
return "&cUsage: vote <player> <site>";
case "forcetimechange":
if (args.length >= 2) {
plugin.getBungeeTimeChecker().forceChanged(TimeType.getTimeType(args[1]));
return "&aTriggered time change to " + args[1];
}
return "&cUsage: forcetimechange <TimeType>";
case "status":
return handleStatusCommand();
case "multiproxystatus":
plugin.getMultiProxyHandler().sendMultiProxyServerMessage("Status");
return "&aSent status message across multi-proxy";
case "help":
return getHelpMessage();
case "voteparty":
return handleVotePartyCommand(args);
default:
return "&cUnknown command. Use 'help' to view all commands.";
}
}
private String handleStatusCommand() {
BungeeMethod method = plugin.getMethod();
switch (method) {
case SOCKETS:
plugin.status();
return "&aChecking status via sockets. Check console for details.";
case PLUGINMESSAGING:
case REDIS:
plugin.status();
plugin.sendServerNameMessage();
return "&aChecking status with method: " + method.toString().toLowerCase();
default:
return "&cStatus command unavailable for the current connection method.";
}
}
private String handleVotePartyCommand(String[] args) {
if (args.length > 1) {
if ("force".equalsIgnoreCase(args[1])) {
plugin.setCurrentVotePartyVotes(plugin.getCurrentVotePartyVotesRequired());
plugin.checkVoteParty();
return "&aVote party forced";
} else if ("setvotecount".equalsIgnoreCase(args[1]) && args.length > 2 && isInt(args[2])) {
plugin.setCurrentVotePartyVotes(Integer.parseInt(args[2]));
return "&aSet current vote party votes to " + args[2];
} else {
return "&cInvalid usage. Use 'help' for correct syntax.";
}
}
return "&cUsage: voteparty <force/setvotecount>";
}
private String getHelpMessage() {
StringBuilder helpBuilder = new StringBuilder("&aVotingPlugin Commands:\n");
helpBuilder.append("/votingplugin reload - Reload the plugin\n");
helpBuilder.append("/votingplugin reloadmysql - Reload the plugin including MySQL\n");
helpBuilder.append("/votingplugin vote <player> <site> - Send a vote\n");
helpBuilder.append("/votingplugin forcetimechange <TimeType> - Force a time change\n");
helpBuilder.append("/votingplugin status - Check connection status\n");
helpBuilder.append("/votingplugin multiproxystatus - Send status message across proxies\n");
helpBuilder.append("/votingplugin voteparty <force/setvotecount> - Trigger or modify vote party\n");
return helpBuilder.toString();
}
private boolean isInt(String str) {
try {
Integer.parseInt(str);
return true;
} catch (NumberFormatException e) {
return false;
}
}
}
@@ -0,0 +1,127 @@
package com.bencodez.votingplugin.bungee.proxy;
import java.util.Collection;
import java.util.List;
import java.util.Map;
public interface VotingPluginProxyConfig {
public boolean getAllowUnJoined();
public String getBedrockPlayerPrefix();
public List<String> getBlockedServers();
public boolean getBroadcast();
public String getBungeeHost();
public boolean getBungeeManageTotals();
public String getBungeeMethod();
public int getBungeePort();
public String getPluginMessageChannel();
public boolean getPluginMessageEncryption();
public boolean getDebug();
public String getFallBack();
public boolean getGlobalDataEnabled();
public boolean getGlobalDataUseMainMySQL();
public int getLimitVotePoints();
public int getMaxAmountOfVotesPerDay();
public String getMultiProxyMethod();
public boolean getMultiProxyOneGlobalReward();
public String getMultiProxyRedisHost();
public String getMultiProxyRedisPassword();
public int getMultiProxyRedisPort();
public boolean getMultiProxyRedisUseExistingConnection();
public String getMultiProxyRedisUsername();
public Collection<String> getMultiProxyServers();
public Map<String, Object> getMultiProxyServersConfiguration(String s);
public String getMultiProxySocketHostHost();
public int getMultiProxySocketHostPort();
public boolean getMultiProxySupport();
public boolean getOnlineMode();
public int getPointsOnVote();
public boolean getPrimaryServer();
public String getProxyServerName();
public List<String> getProxyServers();
public String getRedisHost();
public String getRedisPassword();
public int getRedisPort();
public String getRedisPrefix();
public String getRedisUsername();
public boolean getSendVotesToAllServers();
public Map<String, Object> getSpigotServerConfiguration(String s);
public Collection<String> getSpigotServers();
public boolean getStoreMonthTotalsWithDate();
public boolean getTimeChangeFailSafeBypass();
public int getTimeHourOffSet();
public String getTimeZone();
public boolean getUseMonthDateTotalsAsPrimaryTotal();
public boolean getUUIDLookup();
public int getVoteCacheTime();
public String getVotePartyBroadcast();
public List<String> getVotePartyBungeeCommands();
public boolean getVotePartyEnabled();
public int getVotePartyIncreaseVotesRequired();
public boolean getVotePartySendToAllServers();
public List<String> getVotePartyServersToSend();
public int getVotePartyVotesRequired();
public boolean getWaitForUserOnline();
public List<String> getWhiteListedServers();
public void load();
public void save();
}
@@ -2,16 +2,18 @@ package com.bencodez.votingplugin.bungee.velocity;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.checkerframework.checker.nullness.qual.NonNull;
import com.bencodez.advancedcore.bungeeapi.velocity.VelocityYMLFile;
import com.bencodez.simpleapi.file.velocity.VelocityYMLFile;
import com.bencodez.votingplugin.bungee.proxy.VotingPluginProxyConfig;
import ninja.leaping.configurate.ConfigurationNode;
public class Config extends VelocityYMLFile {
public class Config extends VelocityYMLFile implements VotingPluginProxyConfig {
public Config(File file) {
super(file);
@@ -21,28 +23,20 @@ public class Config extends VelocityYMLFile {
return getBoolean(getNode("AllowUnJoined"), false);
}
public List<String> getBlockedServers() {
return getStringList(getNode("BlockedServers"), new ArrayList<String>());
public String getBedrockPlayerPrefix() {
return getString(getNode("BedrockPlayerPrefix"), ".");
}
public List<String> getWhiteListedServers() {
return getStringList(getNode("WhiteListedServers"), new ArrayList<String>());
public List<String> getBlockedServers() {
return getStringList(getNode("BlockedServers"), new ArrayList<>());
}
public boolean getBroadcast() {
return getBoolean(getNode("Broadcast"), false);
}
public boolean getOnlineMode() {
return getBoolean(getNode("OnlineMode"), true);
}
public boolean getGlobalDataEnabled() {
return getBoolean(getNode("GlobalData", "Enabled"), false);
}
public boolean getGlobalDataUseMainMySQL() {
return getBoolean(getNode("GlobalData", "UseMainMySQL"), true);
public String getBungeeHost() {
return getString(getNode("BungeeServer", "Host"), "");
}
public boolean getBungeeManageTotals() {
@@ -53,10 +47,6 @@ public class Config extends VelocityYMLFile {
return getString(getNode("BungeeMethod"), "PLUGINMESSAGING");
}
public String getBungeeHost() {
return getString(getNode("BungeeServer", "Host"), "");
}
public int getBungeePort() {
return getInt(getNode("BungeeServer", "Port"), 1297);
}
@@ -69,88 +59,66 @@ public class Config extends VelocityYMLFile {
return getString(getNode("FallBackServer"), "");
}
public ConfigurationNode getMysqlNode() {
return getNode("MySQL");
public boolean getGlobalDataEnabled() {
return getBoolean(getNode("GlobalData", "Enabled"), false);
}
public int getPointsOnVote() {
return getInt(getNode("PointsOnVote"), 1);
public boolean getGlobalDataUseMainMySQL() {
return getBoolean(getNode("GlobalData", "UseMainMySQL"), true);
}
public boolean getSendVotesToAllServers() {
return getBoolean(getNode("SendVotesToAllServers"), true);
public int getLimitVotePoints() {
return getInt(getNode("LimitVotePoints"), -1);
}
public boolean getVotePartyEnabled() {
return getBoolean(getVotePartyNode().getNode("Enabled"), false);
public int getMaxAmountOfVotesPerDay() {
return getInt(getNode("MaxAmountOfVotesPerDay"), -1);
}
public ConfigurationNode getVotePartyNode() {
return getNode("VoteParty");
}
public boolean getVotePartySendToAllServers() {
return getBoolean(getVotePartyNode().getNode("SendToAllServers"), false);
}
public int getVotePartyVotesRequired() {
return getInt(getVotePartyNode().getNode("VotesRequired"), 100);
}
public int getVotePartyIncreaseVotesRequired() {
return getInt(getVotePartyNode().getNode("IncreaseVotesRequired"), 0);
}
public String getVotePartyBroadcast() {
return getString(getVotePartyNode().getNode("Broadcast"), "");
}
public List<String> getVotePartyServersToSend() {
return getStringList(getVotePartyNode().getNode("ServersToSend"), new ArrayList<String>());
}
public List<String> getVotePartyBungeeCommands() {
return getStringList(getVotePartyNode().getNode("BungeeCommands"), new ArrayList<String>());
}
public ConfigurationNode getSpigotServerConfiguration(String s) {
return getNode("SpigotServers", s);
}
public @NonNull Collection<? extends ConfigurationNode> getSpigotServers() {
return getNode("SpigotServers").getChildrenMap().values();
}
public boolean getWaitForUserOnline() {
return getBoolean(getNode("WaitForUserOnline"), false);
}
public boolean getMultiProxySupport() {
return getBoolean(getNode("MultiProxySupport"), false);
public String getMultiProxyMethod() {
return getString(getNode("MultiProxyMethod"), "SOCKET");
}
public boolean getMultiProxyOneGlobalReward() {
return getBoolean(getNode("MultiProxyOneGlobalReward"), false);
}
public boolean getGeyserSupport() {
return getBoolean(getNode("GeyserSupport"), false);
public String getMultiProxyRedisHost() {
return getString(getNode("MultiProxyRedis", "Host"), "");
}
public boolean getPrimaryServer() {
return getBoolean(getNode("PrimaryServer"), false);
public String getMultiProxyRedisPassword() {
return getString(getNode("MultiProxyRedis", "Password"), "");
}
public String getGeyserPrefix() {
return getString(getNode("GeyserPrefix"), "*");
public int getMultiProxyRedisPort() {
return getInt(getNode("MultiProxyRedis", "Port"), 6379);
}
public ConfigurationNode getMultiProxyServers(String s) {
return getNode("MultiProxyServers", s);
public boolean getMultiProxyRedisUseExistingConnection() {
return getBoolean(getNode("MultiProxyRedis", "UseExistingConnection"), false);
}
public @NonNull Collection<? extends ConfigurationNode> getMultiProxyServers() {
return getNode("MultiProxyServers").getChildrenMap().values();
public String getMultiProxyRedisUsername() {
return getString(getNode("MultiProxyRedis", "Username"), "");
}
public @NonNull List<String> getMultiProxyServers() {
return getChildrenAsList(getNode("MultiProxyServers"));
}
public List<String> getChildrenAsList(ConfigurationNode config) {
List<String> children = new ArrayList<>();
if (config != null) {
for (Map.Entry<Object, ? extends ConfigurationNode> entry : config.getChildrenMap().entrySet()) {
children.add(entry.getKey().toString());
}
}
return children;
}
public Map<String, Object> getMultiProxyServersConfiguration(String s) {
return configToMap(getNode("MultiProxyServers", s));
}
public String getMultiProxySocketHostHost() {
@@ -161,4 +129,160 @@ public class Config extends VelocityYMLFile {
return getInt(getNode("MultiProxySocketHost", "Port"), 1297);
}
public boolean getMultiProxySupport() {
return getBoolean(getNode("MultiProxySupport"), false);
}
public ConfigurationNode getMysqlNode() {
return getNode("MySQL");
}
public boolean getOnlineMode() {
return getBoolean(getNode("OnlineMode"), true);
}
public int getPointsOnVote() {
return getInt(getNode("PointsOnVote"), 1);
}
public boolean getPrimaryServer() {
return getBoolean(getNode("PrimaryServer"), false);
}
public String getProxyServerName() {
return getString(getNode("ProxyServerName"), "SOCKET");
}
public List<String> getProxyServers() {
return getStringList(getNode("ProxyServers"), new ArrayList<>());
}
public String getRedisHost() {
return getString(getNode("Redis", "Host"), "");
}
public String getRedisPassword() {
return getString(getNode("Redis", "Password"), "");
}
public int getRedisPort() {
return getInt(getNode("Redis", "Port"), 6379);
}
public String getRedisPrefix() {
return getString(getNode("Redis", "Prefix"), "");
}
public String getRedisUsername() {
return getString(getNode("Redis", "Username"), "");
}
public boolean getSendVotesToAllServers() {
return getBoolean(getNode("SendVotesToAllServers"), true);
}
public Map<String, Object> getSpigotServerConfiguration(String s) {
return configToMap(getNode("SpigotServers", s));
}
public Map<String, Object> configToMap(ConfigurationNode config) {
Map<String, Object> map = new HashMap<>();
if (config != null) {
for (Map.Entry<Object, ? extends ConfigurationNode> entry : config.getChildrenMap().entrySet()) {
map.put(entry.getKey().toString(), entry.getValue().getValue());
}
}
return map;
}
public @NonNull List<String> getSpigotServers() {
return getChildrenAsList(getNode("SpigotServers"));
}
public boolean getStoreMonthTotalsWithDate() {
return getBoolean(getNode("StoreMonthTotalsWithDate"), false);
}
public boolean getTimeChangeFailSafeBypass() {
return getBoolean(getNode("TimeChangeFailSafeBypass"), false);
}
public boolean getUseMonthDateTotalsAsPrimaryTotal() {
return getBoolean(getNode("UseMonthDateTotalsAsPrimaryTotal"), false);
}
public boolean getUUIDLookup() {
return getBoolean(getNode("UUIDLookup"), true);
}
public int getVoteCacheTime() {
return getInt(getNode("VoteCacheTime"), -1);
}
public String getVotePartyBroadcast() {
return getString(getVotePartyNode().getNode("Broadcast"), "");
}
public List<String> getVotePartyBungeeCommands() {
return getStringList(getVotePartyNode().getNode("BungeeCommands"), new ArrayList<>());
}
public boolean getVotePartyEnabled() {
return getBoolean(getVotePartyNode().getNode("Enabled"), false);
}
public int getVotePartyIncreaseVotesRequired() {
return getInt(getVotePartyNode().getNode("IncreaseVotesRequired"), 0);
}
public ConfigurationNode getVotePartyNode() {
return getNode("VoteParty");
}
public boolean getVotePartySendToAllServers() {
return getBoolean(getVotePartyNode().getNode("SendToAllServers"), false);
}
public List<String> getVotePartyServersToSend() {
return getStringList(getVotePartyNode().getNode("ServersToSend"), new ArrayList<>());
}
public int getVotePartyVotesRequired() {
return getInt(getVotePartyNode().getNode("VotesRequired"), 100);
}
public boolean getWaitForUserOnline() {
return getBoolean(getNode("WaitForUserOnline"), false);
}
public List<String> getWhiteListedServers() {
return getStringList(getNode("WhiteListedServers"), new ArrayList<>());
}
@Override
public int getTimeHourOffSet() {
return getInt(getNode("TimeHourOffSet"), 0);
}
@Override
public String getTimeZone() {
return getString(getNode("TimeZone"), "");
}
@Override
public void load() {
// TODO Auto-generated method stub
}
@Override
public String getPluginMessageChannel() {
return getString(getNode("PluginMessageChannel"), "vp:vp");
}
@Override
public boolean getPluginMessageEncryption() {
return getBoolean(getNode("PluginMessageEncryption"), false);
}
}
@@ -2,7 +2,7 @@ package com.bencodez.votingplugin.bungee.velocity;
import java.io.File;
import com.bencodez.advancedcore.bungeeapi.velocity.VelocityJSONFile;
import com.bencodez.simpleapi.file.velocity.VelocityJSONFile;
import com.velocitypowered.api.proxy.Player;
public class NonVotedPlayersCache extends VelocityJSONFile {
@@ -15,17 +15,23 @@ public class NonVotedPlayersCache extends VelocityJSONFile {
}
public void addPlayer(Player player) {
if (!plugin.getMysql().containsKeyQuery(player.getUniqueId().toString())) {
if (!plugin.getVotingPluginProxy().getProxyMySQL().containsKeyQuery(player.getUniqueId().toString())) {
addPlayer(player.getUniqueId().toString(), player.getUsername());
}
}
private void addPlayer(String uuid, String playerName) {
public void addPlayer(String uuid, String playerName) {
getNode("NonVotedPlayers", playerName, "UUID").setValue(uuid);
getNode("NonVotedPlayers", playerName, "LastTime").setValue(System.currentTimeMillis());
save();
}
public void addPlayerCheck(String uuid, String playerName) {
if (!plugin.getVotingPluginProxy().getProxyMySQL().containsKeyQuery(uuid)) {
addPlayer(uuid, playerName);
}
}
public void check() {
for (String player : getKeys(getNode("NonVotedPlayers"))) {
long time = getNode("NonVotedPlayers", player, "LastTime").getLong(0);
@@ -34,7 +40,7 @@ public class NonVotedPlayersCache extends VelocityJSONFile {
} else {
String uuid = getNode("NonVotedPlayers", player, "UUID").getString("");
if (!uuid.isEmpty()) {
if (plugin.getMysql().containsKeyQuery(uuid)) {
if (plugin.getVotingPluginProxy().getProxyMySQL().containsKeyQuery(uuid)) {
remove(player);
}
} else {
@@ -3,7 +3,7 @@ package com.bencodez.votingplugin.bungee.velocity;
import java.io.File;
import java.util.Collection;
import com.bencodez.advancedcore.bungeeapi.velocity.VelocityJSONFile;
import com.bencodez.simpleapi.file.velocity.VelocityJSONFile;
import com.bencodez.votingplugin.bungee.OfflineBungeeVote;
import com.bencodez.votingplugin.timequeue.VoteTimeQueue;
@@ -15,62 +15,36 @@ public class VoteCache extends VelocityJSONFile {
super(file);
}
public int getVotePartyCurrentVotes() {
return getInt(getNode("VoteParty").getNode("CurrentVotes"), 0);
}
public int getVotePartyInreaseVotesRequired() {
return getInt(getNode("VoteParty").getNode("IncreaseVotes"), 0);
}
public void setVotePartyCurrentVotes(int amount) {
getNode("VoteParty").getNode("CurrentVotes").setValue(amount);
}
public void setVotePartyInreaseVotesRequired(int amount) {
getNode("VoteParty").getNode("IncreaseVotes").setValue(amount);
}
public void setVotePartyCache(String server, int amount) {
getNode("VoteParty").getNode("Cache").getNode(server).setValue(amount);
}
public int getVotePartyCache(String server) {
return getNode("VoteParty").getNode("Cache").getNode(server).getInt(0);
public void addTimedVote(int num, VoteTimeQueue voteTimedQueue) {
getNode("TimedVoteCache", "" + num, "Name").setValue(voteTimedQueue.getName());
getNode("TimedVoteCache", "" + num, "Service").setValue(voteTimedQueue.getService());
getNode("TimedVoteCache", "" + num, "Time").setValue(voteTimedQueue.getTime());
}
public void addVote(String server, int num, OfflineBungeeVote voteData) {
String[] path = new String[] { "VoteCache", server, "" + num };
getNode(path, "Name").setValue(voteData.getPlayerName());
getNode(path, "Service").setValue(voteData.getService());
getNode(path, "UUID").setValue(voteData.getUuid());
getNode(path, "Time").setValue(voteData.getTime());
getNode(path, "Real").setValue(voteData.isRealVote());
getNode(path, "Text").setValue(voteData.getText());
}
public void addTimedVote(int num, VoteTimeQueue voteTimedQueue) {
String[] path = new String[] { "TimedVoteCache", "" + num };
getNode(path, "Name").setValue(voteTimedQueue.getName());
getNode(path, "Service").setValue(voteTimedQueue.getService());
getNode(path, "Time").setValue(voteTimedQueue.getTime());
getNode("VoteCache", server, "" + num, "Name").setValue(voteData.getPlayerName());
getNode("VoteCache", server, "" + num, "Service").setValue(voteData.getService());
getNode("VoteCache", server, "" + num, "UUID").setValue(voteData.getUuid());
getNode("VoteCache", server, "" + num, "Time").setValue(voteData.getTime());
getNode("VoteCache", server, "" + num, "Real").setValue(voteData.isRealVote());
getNode("VoteCache", server, "" + num, "Text").setValue(voteData.getText());
}
public void addVoteOnline(String player, int num, OfflineBungeeVote voteData) {
String[] path = new String[] { "OnlineCache", player, "" + num };
getNode(path, "Name").setValue(voteData.getPlayerName());
getNode(path, "Service").setValue(voteData.getService());
getNode(path, "UUID").setValue(voteData.getUuid());
getNode(path, "Time").setValue(voteData.getTime());
getNode(path, "Real").setValue(voteData.isRealVote());
getNode(path, "Text").setValue(voteData.getText());
getNode("OnlineCache", player, "" + num, "Name").setValue(voteData.getPlayerName());
getNode("OnlineCache", player, "" + num, "Service").setValue(voteData.getService());
getNode("OnlineCache", player, "" + num, "UUID").setValue(voteData.getUuid());
getNode("OnlineCache", player, "" + num, "Time").setValue(voteData.getTime());
getNode("OnlineCache", player, "" + num, "Real").setValue(voteData.isRealVote());
getNode("OnlineCache", player, "" + num, "Text").setValue(voteData.getText());
}
public void clearData() {
getNode("VoteCache").setValue(null);
getNode("OnlineCache").setValue(null);
getNode("TimedVoteCache").setValue(null);
save();
}
@@ -78,10 +52,6 @@ public class VoteCache extends VelocityJSONFile {
return getKeys(getNode("OnlineCache", name));
}
public ConfigurationNode getTimedVoteCache(String name) {
return getNode("TimedVoteCache", name);
}
public ConfigurationNode getOnlineVotes(String name, String num) {
return getNode("OnlineCache", name, num);
}
@@ -94,16 +64,44 @@ public class VoteCache extends VelocityJSONFile {
return getKeys(getNode("VoteCache"));
}
public Collection<String> getTimedVoteCache() {
return getKeys(getNode("TimedVoteCache"));
}
public Collection<String> getServerVotes(String server) {
return getKeys(getNode("OnlineCache", server));
return getKeys(getNode("VoteCache", server));
}
public ConfigurationNode getServerVotes(String server, String num) {
return getNode("VoteCache", server, num);
}
public Collection<String> getTimedVoteCache() {
return getKeys(getNode("TimedVoteCache"));
}
public ConfigurationNode getTimedVoteCache(String name) {
return getNode("TimedVoteCache", name);
}
public int getVotePartyCache(String server) {
return getNode("VoteParty").getNode("Cache").getNode(server).getInt(0);
}
public int getVotePartyCurrentVotes() {
return getInt(getNode("VoteParty").getNode("CurrentVotes"), 0);
}
public int getVotePartyInreaseVotesRequired() {
return getInt(getNode("VoteParty").getNode("IncreaseVotes"), 0);
}
public void setVotePartyCache(String server, int amount) {
getNode("VoteParty").getNode("Cache").getNode(server).setValue(amount);
}
public void setVotePartyCurrentVotes(int amount) {
getNode("VoteParty").getNode("CurrentVotes").setValue(amount);
}
public void setVotePartyInreaseVotesRequired(int amount) {
getNode("VoteParty").getNode("IncreaseVotes").setValue(amount);
}
}
@@ -9,7 +9,7 @@ public class VoteEventVelocity {
public VoteEventVelocity(VotingPluginVelocity plugin) {
this.plugin = plugin;
}
@Subscribe
public void onVotifierEvent(VotifierEvent event) {
final String serviceSiteVote = event.getVote().getServiceName();
@@ -24,7 +24,7 @@ public class VoteEventVelocity {
serviceSite = "Empty";
}
plugin.vote(name, serviceSite, true, false, 0, null, null);
plugin.getVotingPluginProxy().vote(name, serviceSite, true, false, 0, null, null);
}
});
File diff suppressed because it is too large. Load diff
@@ -1,12 +1,10 @@
package com.bencodez.votingplugin.bungee.velocity;
import com.bencodez.advancedcore.api.time.TimeType;
import com.bencodez.votingplugin.bungee.BungeeMethod;
import com.bencodez.votingplugin.bungee.proxy.VotingPluginProxyCommand;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.command.SimpleCommand;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
public class VotingPluginVelocityCommand implements SimpleCommand {
private VotingPluginVelocity plugin;
@@ -21,81 +19,16 @@ public class VotingPluginVelocityCommand implements SimpleCommand {
// Get the arguments after the command alias
String[] args = invocation.arguments();
if (args.length > 0) {
if (args[0].equalsIgnoreCase("reload")) {
plugin.reload(false);
source.sendMessage(Component.text("Reloading VotingPluginBungee").color(NamedTextColor.AQUA));
}
if (args[0].equalsIgnoreCase("reloadmysql")) {
plugin.reload(true);
source.sendMessage(Component.text("Reloading VotingPluginBungee MySQL").color(NamedTextColor.AQUA));
}
if (args[0].equalsIgnoreCase("vote")) {
if (args.length >= 2) {
String user = args[1];
String site = args[2];
plugin.vote(user, site, false, true, 0, null, null);
source.sendMessage(Component.text("Sending vote").color(NamedTextColor.AQUA));
}
}
if (args[0].equalsIgnoreCase("forcetimechange")) {
if (args.length >= 2) {
plugin.getBungeeTimeChecker().forceChanged(TimeType.getTimeType(args[1]));
source.sendMessage(Component.text("Triggering time change: " + args[1]).color(NamedTextColor.AQUA));
}
}
if (args[0].equalsIgnoreCase("status")) {
if (plugin.getMethod().equals(BungeeMethod.SOCKETS)) {
source.sendMessage(
Component.text("Checking status, waiting for response, check console, method: sockets")
.color(NamedTextColor.AQUA));
plugin.status();
} else if (plugin.getMethod().equals(BungeeMethod.PLUGINMESSAGING)) {
source.sendMessage(Component
.text("Checking status, waiting for response, check console, method: pluginmessaging")
.color(NamedTextColor.AQUA));
plugin.status();
} else {
source.sendMessage(Component.text("Not using socket/pluginmessage method, command unavailable")
.color(NamedTextColor.AQUA));
}
}
if (args[0].equalsIgnoreCase("multiproxystatus")) {
plugin.sendMultiProxyServerMessage("Status");
source.sendMessage(Component.text("Sending status message").color(NamedTextColor.AQUA));
}
if (args[0].equalsIgnoreCase("help")) {
String[] msg = new String[7];
msg[0] = "votingpluginbungee reload - Reload plugin";
msg[1] = "votingpluginbungee reloadmysql - Reload plugin including mysql";
msg[2] = "votingpluginbungee vote (player) (servicesite) - Send bungee vote";
msg[3] = "votingpluginbungee status - Check socket connection status";
msg[4] = "&avotingpluginbungee forcetimechange (timetype) - Force a time change";
msg[5] = "&avotingpluginbungee voteparty force - Force a vote party";
msg[6] = "&avotingpluginbungee voteparty setvotecount (number) - Set current vote party votes";
for (String m : msg) {
source.sendMessage(Component.text(m).color(NamedTextColor.AQUA));
}
}
if (args[0].equalsIgnoreCase("voteparty")) {
if (args.length > 1) {
if (args[1].equalsIgnoreCase("Force")) {
plugin.setCurrentVotePartyVotes(plugin.getCurrentVotePartyVotesRequired());
plugin.checkVoteParty();
source.sendMessage(Component.text("Vote party forced").color(NamedTextColor.AQUA));
}
if (args.length > 2) {
if (args[1].equalsIgnoreCase("SetVoteCount")) {
if (isInt(args[2])) {
plugin.setCurrentVotePartyVotes(Integer.parseInt(args[2]));
source.sendMessage(Component.text("Set current vote party votes to " + args[2])
.color(NamedTextColor.AQUA));
}
}
}
}
}
String result = new VotingPluginProxyCommand(plugin.getVotingPluginProxy()).execute(args);
if (result != null) {
source.sendMessage(Component.text(result));
}
}
@Override
public boolean hasPermission(final Invocation invocation) {
return invocation.source().hasPermission("votingpluginbungee.admin");
}
public boolean isInt(String st) {
@@ -111,9 +44,4 @@ public class VotingPluginVelocityCommand implements SimpleCommand {
return false;
}
}
@Override
public boolean hasPermission(final Invocation invocation) {
return invocation.source().hasPermission("votingpluginbungee.admin");
}
}
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.simpleapi.messages.MessageAPI;
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(MessageAPI.colorize(plugin.getConfigFile().getFormatInvalidCommandAdminVote()));
return true;
}
@@ -2,13 +2,13 @@ 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.misc.ArrayUtils;
import com.bencodez.simpleapi.array.ArrayUtils;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
// TODO: Auto-generated Javadoc
@@ -40,15 +40,15 @@ public class CommandAliases implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
ArrayList<String> argsNew = new ArrayList<String>();
ArrayList<String> argsNew = new ArrayList<>();
argsNew.add(cmdHandle.getArgs()[0]);
for (String arg : args) {
argsNew.add(arg);
}
plugin.debug("Attempting cmd...");
plugin.debug("Inputed args: " + ArrayUtils.getInstance().makeStringList(argsNew));
plugin.debug("Inputed args: " + ArrayUtils.makeStringList(argsNew));
ArrayList<CommandHandler> handles = new ArrayList<CommandHandler>();
ArrayList<CommandHandler> handles = new ArrayList<>();
if (adminCommand) {
handles.addAll(plugin.getAdminVoteCommand());
} else {
@@ -73,7 +73,7 @@ public class CommandAliases implements CommandExecutor {
}
if (argsMatch) {
if (cmdHandle.runCommand(sender, ArrayUtils.getInstance().convert(argsNew))) {
if (cmdHandle.runCommand(sender, ArrayUtils.convert(argsNew))) {
plugin.debug("cmd found, ran cmd");
return true;
}
@@ -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(MessageAPI.colorize(plugin.getConfigFile().getFormatInvalidCommandAdminVote()));
} else {
sender.sendMessage(ChatColor.RED + "No valid arguments, see /vote help!");
sender.sendMessage(MessageAPI.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.simpleapi.messages.MessageAPI;
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(MessageAPI.colorize(plugin.getConfigFile().getFormatInvalidCommandVote()));
return true;
}
@@ -19,15 +19,15 @@ import com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueLi
import com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueNumber;
import com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueString;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.advancedcore.api.misc.PlayerUtils;
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.simpleapi.array.ArrayUtils;
import com.bencodez.simpleapi.player.PlayerUtils;
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;
@@ -49,7 +49,7 @@ public class AdminGUI {
* @return ArrayList of buttons
*/
public ArrayList<BInventoryButton> adminGUIButtons() {
ArrayList<BInventoryButton> buttons = new ArrayList<BInventoryButton>();
ArrayList<BInventoryButton> buttons = new ArrayList<>();
buttons.add(new BInventoryButton("&cVoteSites",
new String[] { "&cOnly enabled sites are listed in this section", "&cMiddle Click to create" },
new ItemStack(Material.STONE)) {
@@ -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());
}
});
@@ -212,25 +241,27 @@ public class AdminGUI {
BInventory inv = new BInventory("VoteSites");
int count = 0;
for (VoteSite voteSite : plugin.getVoteSites()) {
ArrayList<String> lore = new ArrayList<String>();
ArrayList<String> lore = new ArrayList<>();
lore.add("Enabled: " + voteSite.isEnabled());
lore.add("Priority: " + voteSite.getPriority());
lore.add("Name: " + voteSite.getDisplayName());
lore.add("ServiceSite: " + voteSite.getServiceSite());
lore.add("VoteURL: " + voteSite.getVoteURL());
lore.add("VoteDelay: " + voteSite.getVoteDelay());
lore.add("VoteDelayMin: " + voteSite.getVoteDelayMin());
inv.addButton(count, new BInventoryButton(voteSite.getKey(), ArrayUtils.getInstance().convert(lore),
new ItemStack(Material.STONE)) {
inv.addButton(count,
new BInventoryButton(voteSite.getKey(), ArrayUtils.convert(lore), new ItemStack(Material.STONE)) {
@Override
public void onClick(ClickEvent event) {
@Override
public void onClick(ClickEvent event) {
Player player = event.getWhoClicked();
openAdminGUIVoteSiteSite(player, voteSite);
Player player = event.getWhoClicked();
openAdminGUIVoteSiteSite(player, voteSite);
}
});
}
});
count++;
}
inv.openInventory(player);
@@ -250,7 +281,7 @@ public class AdminGUI {
@Override
public void onClick(ClickEvent event) {
ArrayList<String> playerNames = new ArrayList<String>();
ArrayList<String> playerNames = new ArrayList<>();
for (Player p : Bukkit.getOnlinePlayers()) {
playerNames.add(p.getName());
}
@@ -258,7 +289,7 @@ public class AdminGUI {
@Override
public void onInput(Player player, String value) {
Object ob = PlayerUtils.getInstance().getPlayerMeta(player, "VoteSite");
Object ob = PlayerUtils.getPlayerMeta(plugin, player, "VoteSite");
if (ob != null) {
VoteSite site = (VoteSite) ob;
PlayerVoteEvent voteEvent = new PlayerVoteEvent(site, value, site.getServiceSite(), false);
@@ -271,8 +302,8 @@ public class AdminGUI {
});
}
}
}, ArrayUtils.getInstance().convert(playerNames)).usingMethod(InputMethod.INVENTORY)
.allowCustomOption(true).request(event.getWhoClicked());
}, ArrayUtils.convert(playerNames)).usingMethod(InputMethod.INVENTORY).allowCustomOption(true)
.request(event.getWhoClicked());
}
});
@@ -340,6 +371,17 @@ public class AdminGUI {
}
}));
inv.addButton(new EditGUIButton(new EditGUIValueNumber("VoteDelayDailyHour", voteSite.getVoteDelayDailyHour()) {
@Override
public void setValue(Player player, Number num) {
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
String siteName = voteSite.getKey();
plugin.getConfigVoteSites().setVoteDelay(siteName, num.intValue());
plugin.reload();
}
}));
inv.addButton(new EditGUIButton(new EditGUIValueBoolean("Enabled", voteSite.isEnabled()) {
@Override
@@ -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();
}
}
@@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
import com.bencodez.advancedcore.api.command.CommandHandler;
import com.bencodez.advancedcore.api.gui.GUIHandler;
import com.bencodez.advancedcore.api.gui.GUIMethod;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
import net.md_5.bungee.api.chat.TextComponent;
@@ -35,7 +35,7 @@ public class AdminVoteHelp extends GUIHandler {
*/
public ArrayList<TextComponent> adminHelp(CommandSender sender, int page) {
int pagesize = plugin.getConfigFile().getFormatPageSize();
ArrayList<TextComponent> msg = new ArrayList<TextComponent>();
ArrayList<TextComponent> msg = new ArrayList<>();
ArrayList<TextComponent> text = adminHelpText(sender);
int maxPage = text.size() / pagesize;
@@ -43,9 +43,9 @@ public class AdminVoteHelp extends GUIHandler {
maxPage++;
}
msg.add(StringParser.getInstance().stringToComp("&6&lVotingPlugin Admin Help " + (page) + "/" + maxPage));
msg.add(StringParser.getInstance().stringToComp("&6&l() = Needed"));
msg.add(StringParser.getInstance().stringToComp("&6&lAliases: adminvote, av"));
msg.add(MessageAPI.stringToComp("&6&lVotingPlugin Admin Help " + (page) + "/" + maxPage));
msg.add(MessageAPI.stringToComp("&6&l() = Needed"));
msg.add(MessageAPI.stringToComp("&6&lAliases: adminvote, av"));
for (int i = pagesize * (page - 1); (i < text.size()) && (i < ((page) * pagesize)); i++) {
msg.add(text.get(i));
@@ -61,17 +61,17 @@ public class AdminVoteHelp extends GUIHandler {
* @return the array list
*/
public ArrayList<TextComponent> adminHelpText(CommandSender sender) {
ArrayList<TextComponent> msg = new ArrayList<TextComponent>();
HashMap<String, TextComponent> unsorted = new HashMap<String, TextComponent>();
ArrayList<TextComponent> msg = new ArrayList<>();
HashMap<String, TextComponent> unsorted = new HashMap<>();
boolean requirePerms = plugin.getConfigFile().getFormatCommandsVoteHelpRequirePermission();
boolean requirePerms = plugin.getConfigFile().isFormatCommandsVoteHelpRequirePermission();
for (CommandHandler cmdHandle : plugin.getAdminVoteCommand()) {
if (!requirePerms || cmdHandle.hasPerm(sender)) {
unsorted.put(cmdHandle.getHelpLineCommand("/adminvote"), cmdHandle.getHelpLine("/adminvote"));
}
}
ArrayList<String> unsortedList = new ArrayList<String>();
ArrayList<String> unsortedList = new ArrayList<>();
unsortedList.addAll(unsorted.keySet());
Collections.sort(unsortedList, String.CASE_INSENSITIVE_ORDER);
for (String cmd : unsortedList) {
@@ -12,7 +12,7 @@ import org.bukkit.permissions.Permission;
import com.bencodez.advancedcore.api.command.CommandHandler;
import com.bencodez.advancedcore.api.gui.GUIHandler;
import com.bencodez.advancedcore.api.gui.GUIMethod;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.simpleapi.array.ArrayUtils;
import com.bencodez.votingplugin.VotingPluginMain;
public class AdminVotePerms extends GUIHandler {
@@ -40,7 +40,7 @@ public class AdminVotePerms extends GUIHandler {
}
public String[] listPerms(CommandSender sender) {
ArrayList<String> msg = new ArrayList<String>();
ArrayList<String> msg = new ArrayList<>();
for (CommandHandler handle : plugin.getVoteCommand()) {
if (sender instanceof Player) {
@@ -100,7 +100,7 @@ public class AdminVotePerms extends GUIHandler {
maxPage++;
}
ArrayList<String> text = new ArrayList<String>();
ArrayList<String> text = new ArrayList<>();
text.add("&c&lCommand : Permissions " + page + "/" + maxPage);
@@ -108,17 +108,17 @@ public class AdminVotePerms extends GUIHandler {
text.add(msg.get(i));
}
text = ArrayUtils.getInstance().colorize(text);
text = ArrayUtils.colorize(text);
return ArrayUtils.getInstance().convert(text);
return ArrayUtils.convert(text);
}
public ArrayList<String> listPerms(CommandSender sender, String player, int page) {
Player p = Bukkit.getPlayer(player);
ArrayList<String> text = new ArrayList<String>();
ArrayList<String> text = new ArrayList<>();
if (p != null) {
ArrayList<String> msg = new ArrayList<String>();
ArrayList<String> msg = new ArrayList<>();
for (CommandHandler handle : plugin.getVoteCommand()) {
if (handle.hasPerm(p)) {
@@ -158,7 +158,7 @@ public class AdminVotePerms extends GUIHandler {
}
}
msg = ArrayUtils.getInstance().colorize(msg);
msg = ArrayUtils.colorize(msg);
int pagesize = plugin.getConfigFile().getFormatPageSize();
@@ -175,12 +175,12 @@ public class AdminVotePerms extends GUIHandler {
} else {
text.add("&cPlayer not online: " + player);
}
return ArrayUtils.getInstance().colorize(text);
return ArrayUtils.colorize(text);
}
public String[] listPermsDev(CommandSender sender) {
ArrayList<String> msg = new ArrayList<String>();
ArrayList<String> msg = new ArrayList<>();
msg.add("Command");
msg.add(" Permissions (seperated by |");
msg.add(" Help messasge");
@@ -202,9 +202,9 @@ public class AdminVotePerms extends GUIHandler {
msg.add(perm.getName() + " : " + perm.getDescription());
}
msg = ArrayUtils.getInstance().colorize(msg);
msg = ArrayUtils.colorize(msg);
return ArrayUtils.getInstance().convert(msg);
return ArrayUtils.convert(msg);
}
@Override
@@ -48,7 +48,7 @@ public class AdminVotePlaceholders extends GUIHandler {
msg = "votingplugin_" + identifier + "";
}
Layout layout = new Layout(new ArrayList<String>(Arrays.asList("[Json]")));
Layout layout = new Layout(new ArrayList<>(Arrays.asList("[Json]")));
layout.replaceTextComponent("[Json]", BookUtil.TextBuilder.of(identifier).color(ChatColor.AQUA)
.onHover(BookUtil.HoverAction.showText(msg)).build());
book.addLayout(layout);
@@ -66,7 +66,7 @@ public class AdminVotePlaceholders extends GUIHandler {
msg = "votingplugin_" + identifier + "";
}
Layout layout = new Layout(new ArrayList<String>(Arrays.asList("[Json]")));
Layout layout = new Layout(new ArrayList<>(Arrays.asList("[Json]")));
layout.replaceTextComponent("[Json]", BookUtil.TextBuilder.of(identifier).color(ChatColor.AQUA)
.onHover(BookUtil.HoverAction.showText(msg)).build());
book.addLayout(layout);
@@ -79,7 +79,7 @@ public class AdminVotePlaceholders extends GUIHandler {
@Override
public void onChat(CommandSender sender) {
ArrayList<String> msg = new ArrayList<String>();
ArrayList<String> msg = new ArrayList<>();
msg.add("&cPlaceholders:");
for (PlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getPlaceholders()) {
String identifier = placeholder.getIdentifier().toLowerCase();
@@ -14,7 +14,6 @@ import com.bencodez.advancedcore.api.gui.GUIMethod;
import com.bencodez.advancedcore.api.placeholder.NonPlayerPlaceHolder;
import com.bencodez.advancedcore.api.placeholder.PlaceHolder;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.user.UserManager;
import com.bencodez.votingplugin.user.VotingPluginUser;
import xyz.upperlevel.spigot.book.BookUtil;
@@ -46,7 +45,7 @@ public class AdminVotePlaceholdersPlayer extends GUIHandler {
}
String value = placeholder.placeholderRequest(user, identifier);
String msg = identifier + " = " + value;
Layout layout = new Layout(new ArrayList<String>(Arrays.asList("[Json]")));
Layout layout = new Layout(new ArrayList<>(Arrays.asList("[Json]")));
layout.replaceTextComponent("[Json]", BookUtil.TextBuilder.of(msg).color(ChatColor.AQUA)
.onHover(BookUtil.HoverAction.showText(value)).build());
book.addLayout(layout);
@@ -61,7 +60,7 @@ public class AdminVotePlaceholdersPlayer extends GUIHandler {
String value = placeholder.placeholderRequest(identifier);
String msg = identifier + " = " + value;
Layout layout = new Layout(new ArrayList<String>(Arrays.asList("[Json]")));
Layout layout = new Layout(new ArrayList<>(Arrays.asList("[Json]")));
layout.replaceTextComponent("[Json]", BookUtil.TextBuilder.of(msg).color(ChatColor.AQUA)
.onHover(BookUtil.HoverAction.showText(value)).build());
book.addLayout(layout);
@@ -71,11 +70,11 @@ public class AdminVotePlaceholdersPlayer extends GUIHandler {
@Override
public void onChat(CommandSender sender) {
ArrayList<String> msg = new ArrayList<String>();
ArrayList<String> msg = new ArrayList<>();
msg.add("&cPlaceholders:");
VotingPluginUser placeholderUser = user;
if (plugin.getConfigFile().isUsePrimaryAccountForPlaceholders() && user.hasPrimaryAccount()) {
placeholderUser = UserManager.getInstance().getVotingPluginUser(user.getPrimaryAccount());
placeholderUser = plugin.getVotingPluginUserManager().getVotingPluginUser(user.getPrimaryAccount());
}
for (PlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getPlaceholders()) {
String identifier = placeholder.getIdentifier().toLowerCase();
@@ -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) {
@@ -44,7 +44,7 @@ public class AdminVoteVotePlayer extends GUIHandler {
EditGUI inv = new EditGUI("Trigger vote for " + playerName);
inv.requirePermission("VotingPlugin.Commands.AdminVote.Vote|VotingPlugin.Admin");
for (VoteSite site : plugin.getVoteSites()) {
for (VoteSite site : plugin.getVoteSitesEnabled()) {
inv.addButton(new BInventoryButton(site.getItem().setName(site.getKey())) {
@Override
@@ -12,12 +12,12 @@ import com.bencodez.advancedcore.api.inventory.BInventory;
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.messages.StringParser;
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.NumberListener;
import com.bencodez.advancedcore.command.gui.RewardEditGUI;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
public class AdminVoteCumulative extends GUIHandler {
@@ -52,9 +52,9 @@ public class AdminVoteCumulative extends GUIHandler {
@Override
public void onClick(ClickEvent clickEvent) {
ArrayList<Integer> nums = new ArrayList<Integer>();
ArrayList<Integer> nums = new ArrayList<>();
for (String num : plugin.getSpecialRewardsConfig().getCumulativeVotes()) {
if (StringParser.getInstance().isInt(num)) {
if (MessageAPI.isInt(num)) {
nums.add(Integer.parseInt(num));
}
}
@@ -63,7 +63,6 @@ public class AdminVoteCumulativeRemove extends GUIHandler {
}
}.open();
}
});
}
@@ -63,7 +63,6 @@ public class AdminVoteMilestoneRemove extends GUIHandler {
}
}.open();
}
});
}
@@ -12,12 +12,12 @@ import com.bencodez.advancedcore.api.inventory.BInventory;
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.messages.StringParser;
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.NumberListener;
import com.bencodez.advancedcore.command.gui.RewardEditGUI;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
public class AdminVoteMilestones extends GUIHandler {
@@ -52,9 +52,9 @@ public class AdminVoteMilestones extends GUIHandler {
@Override
public void onClick(ClickEvent clickEvent) {
ArrayList<Integer> nums = new ArrayList<Integer>();
ArrayList<Integer> nums = new ArrayList<>();
for (String num : plugin.getSpecialRewardsConfig().getMilestoneVotes()) {
if (StringParser.getInstance().isInt(num)) {
if (MessageAPI.isInt(num)) {
nums.add(Integer.parseInt(num));
}
}
@@ -59,7 +59,7 @@ public class AdminVoteVoteShop extends GUIHandler {
@Override
public void onInput(Player player, String value) {
plugin.getGui().createShop(value);
plugin.getShopFile().createShop(value);
plugin.reload();
}
});
@@ -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;
@@ -51,7 +53,7 @@ public class AdminVoteVoteShopItem extends GUIHandler {
inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.VoteShop");
// to add
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueString("Identifier_Name",
plugin.getGui().getChestShopIdentifierIdentifierName(identifier)) {
plugin.getShopFile().getShopIdentifierIdentifierName(identifier)) {
@Override
public void setValue(Player player, String name) {
@@ -59,7 +61,7 @@ public class AdminVoteVoteShopItem extends GUIHandler {
}
}));
inv.addButton(new EditGUIButton(new ItemBuilder(Material.OAK_DOOR, 1),
new EditGUIValueString("Permission", plugin.getGui().getChestVoteShopPermission(identifier)) {
new EditGUIValueString("Permission", plugin.getShopFile().getVoteShopPermission(identifier)) {
@Override
public void setValue(Player player, String name) {
@@ -67,7 +69,7 @@ public class AdminVoteVoteShopItem extends GUIHandler {
}
}));
inv.addButton(new EditGUIButton(new ItemBuilder(Material.EMERALD, 1),
new EditGUIValueNumber("Cost", plugin.getGui().getChestShopIdentifierCost(identifier)) {
new EditGUIValueNumber("Cost", plugin.getShopFile().getShopIdentifierCost(identifier)) {
@Override
public void setValue(Player player, Number num) {
@@ -75,7 +77,7 @@ public class AdminVoteVoteShopItem extends GUIHandler {
}
}));
inv.addButton(new EditGUIButton(new ItemBuilder(Material.BARRIER, 1),
new EditGUIValueNumber("Limit", plugin.getGui().getChestShopIdentifierLimit(identifier)) {
new EditGUIValueNumber("Limit", plugin.getShopFile().getShopIdentifierLimit(identifier)) {
@Override
public void setValue(Player player, Number num) {
@@ -84,7 +86,7 @@ public class AdminVoteVoteShopItem extends GUIHandler {
}));
// display item
ConfigurationSection displayItemData = plugin.getGui().getChestShopIdentifierSection(identifier);
ConfigurationSection displayItemData = plugin.getShopFile().getShopIdentifierSection(identifier);
inv.addButton(new EditGUIButton(new ItemBuilder(displayItemData.getString("Material")).setAmount(1),
new EditGUIValueString("Material", displayItemData.getString("Material")) {
@@ -109,12 +111,37 @@ 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
public void onClick(ClickEvent clickEvent) {
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
plugin.getRewardHandler().getDirectlyDefined("CHEST.Shop." + identifier + ".Rewards"));
plugin.getRewardHandler().getDirectlyDefined("Shop." + identifier + ".Rewards"));
}
});
@@ -129,8 +156,8 @@ public class AdminVoteVoteShopItem extends GUIHandler {
}
private void setPathData(String path, Object value) {
plugin.getGui().getData().set("CHEST.Shop." + identifier + "." + path, value);
plugin.getGui().saveData();
plugin.getShopFile().getData().set("Shop." + identifier + "." + path, value);
plugin.getShopFile().saveData();
plugin.reload();
}
@@ -42,9 +42,9 @@ public class AdminVoteVoteShopItemRemove extends GUIHandler {
BInventory inv = new BInventory("Edit VoteShop Remove Item");
inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.VoteShop");
for (final String identifier : plugin.getGui().getChestShopIdentifiers()) {
for (final String identifier : plugin.getShopFile().getShopIdentifiers()) {
inv.addButton(
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestShopIdentifierSection(identifier))
new BInventoryButton(new ItemBuilder(plugin.getShopFile().getShopIdentifierSection(identifier))
.addLoreLine("&c&lClick to remove")) {
@Override
@@ -54,7 +54,7 @@ public class AdminVoteVoteShopItemRemove extends GUIHandler {
@Override
public void onConfirm(Player p) {
plugin.getGui().removeShop(identifier);
plugin.getShopFile().removeShop(identifier);
p.sendMessage("Removed " + identifier);
plugin.reload();
}
@@ -65,7 +65,6 @@ public class AdminVoteVoteShopItemRemove extends GUIHandler {
}
}.open();
}
}.addData("ident", identifier));
}
@@ -41,9 +41,9 @@ public class AdminVoteVoteShopItems extends GUIHandler {
BInventory inv = new BInventory("Edit VoteShop Items");
inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.VoteShop");
for (String identifier : plugin.getGui().getChestShopIdentifiers()) {
for (String identifier : plugin.getShopFile().getShopIdentifiers()) {
inv.addButton(
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestShopIdentifierSection(identifier))) {
new BInventoryButton(new ItemBuilder(plugin.getShopFile().getShopIdentifierSection(identifier))) {
@Override
public void onClick(ClickEvent clickEvent) {
@@ -12,8 +12,9 @@ import com.bencodez.advancedcore.api.inventory.BInventory;
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.advancedcore.api.messages.PlaceholderUtils;
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
import com.bencodez.simpleapi.array.ArrayUtils;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.user.VotingPluginUser;
@@ -30,20 +31,20 @@ public class VoteBest extends GUIHandler {
@Override
public ArrayList<String> getChat(CommandSender sender) {
ArrayList<String> msg = new ArrayList<String>();
ArrayList<String> msg = new ArrayList<>();
msg.add(plugin.getConfigFile().getFormatCommandsVoteBestTitle());
msg.addAll(plugin.getConfigFile().getFormatCommandsVoteBestLines());
HashMap<String, String> placeholders = new HashMap<String, String>();
HashMap<String, String> placeholders = new HashMap<>();
placeholders.put("HighestDailyTotal", "" + user.getHighestDailyTotal());
placeholders.put("HighestWeeklyTotal", "" + user.getHighestWeeklyTotal());
placeholders.put("HighestMonthlyTotal", "" + user.getHighestMonthlyTotal());
placeholders.put("player", user.getPlayerName());
msg = ArrayUtils.getInstance().replacePlaceHolder(msg, placeholders);
msg = PlaceholderUtils.replacePlaceHolder(msg, placeholders);
return ArrayUtils.getInstance().colorize(msg);
return ArrayUtils.colorize(msg);
}
@Override
@@ -12,12 +12,11 @@ import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
import com.bencodez.advancedcore.api.rewards.RewardOptions;
import com.bencodez.simpleapi.array.ArrayUtils;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.user.UserManager;
import com.bencodez.votingplugin.user.VotingPluginUser;
public class VoteGUI extends GUIHandler {
@@ -40,19 +39,19 @@ public class VoteGUI extends GUIHandler {
ItemBuilder builder = new ItemBuilder(plugin.getGui().getChestVoteGUISlotSection(slot));
String[] lore = new String[1];
lore = ArrayUtils.getInstance().convert(plugin.getGui().getChestVoteGUISlotLore(slot));
lore = ArrayUtils.convert(plugin.getGui().getChestVoteGUISlotLore(slot));
String str = plugin.getConfigFile().getVoteTopDefault();
if (lore.length == 0) {
if (StringParser.getInstance().startsWithIgnoreCase(slot, "url")) {
if (MessageAPI.startsWithIgnoreCase(slot, "url")) {
lore = new String[] { "&aClick me" };
} else if (StringParser.getInstance().startsWithIgnoreCase(slot, "next")) {
lore = ArrayUtils.getInstance().convert(new VoteNext(plugin, player, user).getChat(player));
} else if (StringParser.getInstance().startsWithIgnoreCase(slot, "last")) {
lore = ArrayUtils.getInstance().convert(new VoteLast(plugin, player, user).getChat(player));
} else if (StringParser.getInstance().startsWithIgnoreCase(slot, "total")) {
lore = ArrayUtils.getInstance().convert(new VoteTotal(plugin, player, user).getChat(player));
} else if (StringParser.getInstance().startsWithIgnoreCase(slot, "top")) {
} else if (MessageAPI.startsWithIgnoreCase(slot, "next")) {
lore = ArrayUtils.convert(new VoteNext(plugin, player, user).getChat(player));
} else if (MessageAPI.startsWithIgnoreCase(slot, "last")) {
lore = ArrayUtils.convert(new VoteLast(plugin, player, user).getChat(player));
} else if (MessageAPI.startsWithIgnoreCase(slot, "total")) {
lore = ArrayUtils.convert(new VoteTotal(plugin, player, user).getChat(player));
} else if (MessageAPI.startsWithIgnoreCase(slot, "top")) {
if (str.equalsIgnoreCase("monthly")) {
lore = plugin.getTopVoterHandler().topVoterMonthly(1);
@@ -65,18 +64,18 @@ public class VoteGUI extends GUIHandler {
}
} else if (slot.equalsIgnoreCase("today")) {
String[] today = new VoteToday(plugin, player, user, 1).voteTodayGUI();
ArrayList<String> list = new ArrayList<String>();
ArrayList<String> list = new ArrayList<>();
if (today.length > 0) {
for (int i = today.length - 1; i < today.length && list.size() < 10 && i >= 0; i--) {
list.add(today[i]);
}
}
lore = ArrayUtils.getInstance().convert(list);
lore = ArrayUtils.convert(list);
} else if (slot.equalsIgnoreCase("help")) {
lore = new String[] { "Click to view help" };
}
}
builder.setLore(ArrayUtils.getInstance().convert(lore));
builder.setLore(ArrayUtils.convert(lore));
return builder;
}
@@ -122,7 +121,7 @@ public class VoteGUI extends GUIHandler {
@Override
public void onChest(Player player) {
if (this.user == null) {
user = UserManager.getInstance().getVotingPluginUser(player);
user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
}
BInventory inv = new BInventory(plugin.getGui().getChestVoteGUIName());
if (!plugin.getConfigFile().isAlwaysCloseInventory()) {
@@ -152,7 +151,8 @@ public class VoteGUI extends GUIHandler {
String cmd = plugin.getGui().getChestVoteGUISlotCommand(slot);
if (cmd.equalsIgnoreCase("none")) {
return;
} else if (!cmd.equals("")) {
}
if (!cmd.equals("")) {
event.runSync(new Runnable() {
@Override
@@ -163,13 +163,19 @@ public class VoteGUI extends GUIHandler {
} else {
plugin.getCommandLoader().processSlotClick(player, user, slot);
}
String prefix = "";
if (event.getButton().getBuilder().isConditional()) {
prefix = "Item.";
}
if (plugin.getRewardHandler().hasRewards(plugin.getGui().getData(), plugin.getGui()
.getChestVoteGUISlotRewardsPath(slot, event.getButton().getLastRewardsPath(player)))) {
plugin.getRewardHandler().giveReward(UserManager.getInstance().getVotingPluginUser(player),
if (plugin.getRewardHandler().hasRewards(plugin.getGui().getData(),
plugin.getGui().getChestVoteGUISlotRewardsPath(slot,
prefix + event.getButton().getLastRewardsPath(player)))) {
plugin.getRewardHandler().giveReward(
plugin.getVotingPluginUserManager().getVotingPluginUser(player),
plugin.getGui().getData(),
plugin.getGui().getChestVoteGUISlotRewardsPath(slot,
event.getButton().getLastRewardsPath(player)),
prefix + event.getButton().getLastRewardsPath(player)),
new RewardOptions().addPlaceholder("identifier", slot));
}
}
@@ -177,7 +183,7 @@ public class VoteGUI extends GUIHandler {
@Override
public ItemBuilder onUpdate(Player player) {
ItemBuilder item = getItemSlot(slot, player);
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
item.addPlaceholder("points", "" + user.getPoints());
item.addPlaceholder("player", user.getPlayerName());
item.addPlaceholder("top", plugin.getConfigFile().getVoteTopDefault());
@@ -10,8 +10,8 @@ import org.bukkit.entity.Player;
import com.bencodez.advancedcore.api.command.CommandHandler;
import com.bencodez.advancedcore.api.gui.GUIHandler;
import com.bencodez.advancedcore.api.gui.GUIMethod;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.nms.NMSManager;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.simpleapi.nms.NMSManager;
import com.bencodez.votingplugin.VotingPluginMain;
import net.md_5.bungee.api.ChatColor;
@@ -34,10 +34,10 @@ public class VoteHelp extends GUIHandler {
}
public ArrayList<TextComponent> helpText(CommandSender sender) {
ArrayList<TextComponent> msg = new ArrayList<TextComponent>();
HashMap<String, TextComponent> unsorted = new HashMap<String, TextComponent>();
ArrayList<TextComponent> msg = new ArrayList<>();
HashMap<String, TextComponent> unsorted = new HashMap<>();
boolean requirePerms = plugin.getConfigFile().getFormatCommandsVoteHelpRequirePermission();
boolean requirePerms = plugin.getConfigFile().isFormatCommandsVoteHelpRequirePermission();
String colorStr = plugin.getConfigFile().getFormatCommandsVoteHelpHoverColor();
ChatColor hoverColor = null;
@@ -54,7 +54,7 @@ public class VoteHelp extends GUIHandler {
plugin.getConfigFile().getFormatCommandsVoteHelpLine(), hoverColor));
}
}
ArrayList<String> unsortedList = new ArrayList<String>();
ArrayList<String> unsortedList = new ArrayList<>();
unsortedList.addAll(unsorted.keySet());
Collections.sort(unsortedList, String.CASE_INSENSITIVE_ORDER);
for (String cmd : unsortedList) {
@@ -65,10 +65,10 @@ public class VoteHelp extends GUIHandler {
}
public ArrayList<TextComponent> helpTextLegacy(CommandSender sender) {
ArrayList<TextComponent> msg = new ArrayList<TextComponent>();
HashMap<String, TextComponent> unsorted = new HashMap<String, TextComponent>();
ArrayList<TextComponent> msg = new ArrayList<>();
HashMap<String, TextComponent> unsorted = new HashMap<>();
boolean requirePerms = plugin.getConfigFile().getFormatCommandsVoteHelpRequirePermission();
boolean requirePerms = plugin.getConfigFile().isFormatCommandsVoteHelpRequirePermission();
for (CommandHandler cmdHandle : plugin.getVoteCommand()) {
if (!requirePerms || cmdHandle.hasPerm(sender)) {
@@ -76,7 +76,7 @@ public class VoteHelp extends GUIHandler {
cmdHandle.getHelpLine("/vote", plugin.getConfigFile().getFormatCommandsVoteHelpLine()));
}
}
ArrayList<String> unsortedList = new ArrayList<String>();
ArrayList<String> unsortedList = new ArrayList<>();
unsortedList.addAll(unsorted.keySet());
Collections.sort(unsortedList, String.CASE_INSENSITIVE_ORDER);
for (String cmd : unsortedList) {
@@ -108,8 +108,8 @@ public class VoteHelp extends GUIHandler {
public ArrayList<TextComponent> voteHelpText(CommandSender sender) {
int pagesize = plugin.getConfigFile().getFormatPageSize();
ArrayList<TextComponent> msg = new ArrayList<TextComponent>();
ArrayList<TextComponent> text = new ArrayList<TextComponent>();
ArrayList<TextComponent> msg = new ArrayList<>();
ArrayList<TextComponent> text = new ArrayList<>();
if (NMSManager.getInstance().isVersion("1.12")) {
text = helpTextLegacy(sender);
} else {
@@ -121,7 +121,7 @@ public class VoteHelp extends GUIHandler {
maxPage++;
}
msg.add(StringParser.getInstance()
msg.add(MessageAPI
.stringToComp(plugin.getConfigFile().getFormatCommandsVoteHelpTitle() + " " + page + "/" + maxPage));
for (int i = pagesize * (page - 1); (i < text.size()) && (i < ((page) * pagesize)); i++) {
@@ -8,16 +8,16 @@ import org.bukkit.entity.Player;
import com.bencodez.advancedcore.api.gui.GUIHandler;
import com.bencodez.advancedcore.api.gui.GUIMethod;
import com.bencodez.advancedcore.api.inventory.BInventory;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.advancedcore.api.messages.PlaceholderUtils;
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
import com.bencodez.simpleapi.array.ArrayUtils;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.objects.VoteSite;
import com.bencodez.votingplugin.user.UserManager;
import com.bencodez.votingplugin.user.VotingPluginUser;
public class VoteLast extends GUIHandler {
@@ -33,20 +33,20 @@ public class VoteLast extends GUIHandler {
@Override
public ArrayList<String> getChat(CommandSender sender) {
ArrayList<String> msg = new ArrayList<String>();
ArrayList<String> msg = new ArrayList<>();
String playerName = user.getPlayerName();
msg.add(StringParser.getInstance().replaceIgnoreCase(plugin.getConfigFile().getFormatCommandsVoteLastTitle(),
"%player%", playerName));
msg.add(MessageAPI.replaceIgnoreCase(plugin.getConfigFile().getFormatCommandsVoteLastTitle(), "%player%",
playerName));
for (VoteSite voteSite : plugin.getVoteSites()) {
for (VoteSite voteSite : plugin.getVoteSitesEnabled()) {
if (!voteSite.isHidden()) {
msg.add(user.voteCommandLastLine(voteSite));
}
}
return ArrayUtils.getInstance().colorize(msg);
return ArrayUtils.colorize(msg);
}
@Override
@@ -63,7 +63,7 @@ public class VoteLast extends GUIHandler {
public void onChest(Player player) {
BInventory inv = new BInventory(plugin.getGui().getChestVoteLastName());
inv.addPlaceholder("player", user.getPlayerName());
for (VoteSite site : plugin.getVoteSites()) {
for (VoteSite site : plugin.getVoteSitesEnabled()) {
if (!site.isHidden()) {
inv.addButton(inv.getNextSlot(),
new UpdatingBInventoryButton(plugin, site.getItem().setName(site.getDisplayName())
@@ -74,15 +74,16 @@ public class VoteLast extends GUIHandler {
if (plugin.getGui().isChestVoteLastClickableLinks()) {
Player player = event.getPlayer();
if (player != null) {
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
VotingPluginUser user = plugin.getVotingPluginUserManager()
.getVotingPluginUser(player);
user.sendMessage(
StringParser.getInstance()
PlaceholderUtils
.replacePlaceHolder(
StringParser.getInstance().replacePlaceHolder(
StringParser.getInstance()
.replacePlaceHolder(plugin.getGui()
PlaceholderUtils.replacePlaceHolder(
PlaceholderUtils.replacePlaceHolder(
plugin.getGui()
.getChestVoteURLURLText(),
"voteurl", site.getVoteURL()),
"voteurl", site.getVoteURL()),
"sitename", site.getDisplayName()),
"player", player.getName()));
@@ -115,7 +116,7 @@ public class VoteLast extends GUIHandler {
});
}
if (plugin.getGui().getChestVoteLastBackButton()) {
if (plugin.getGui().isChestVoteLastBackButton()) {
inv.addButton(plugin.getCommandLoader().getBackButton(user));
}
@@ -11,12 +11,13 @@ import com.bencodez.advancedcore.api.bookgui.Layout;
import com.bencodez.advancedcore.api.gui.GUIHandler;
import com.bencodez.advancedcore.api.gui.GUIMethod;
import com.bencodez.advancedcore.api.inventory.BInventory;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.messages.PlaceholderUtils;
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.objects.VoteSite;
import com.bencodez.votingplugin.user.VotingPluginUser;
@@ -36,23 +37,21 @@ public class VoteNext extends GUIHandler {
@Override
public ArrayList<String> getChat(CommandSender sender) {
ArrayList<String> msg = new ArrayList<String>();
ArrayList<String> msg = new ArrayList<>();
String playerName = user.getPlayerName();
msg.add(StringParser.getInstance().colorize(StringParser.getInstance()
msg.add(MessageAPI.colorize(MessageAPI
.replaceIgnoreCase(plugin.getConfigFile().getFormatCommandsVoteNextTitle(), "%player%", playerName)));
for (VoteSite voteSite : plugin.getVoteSites()) {
for (VoteSite voteSite : plugin.getVoteSitesEnabled()) {
if (!voteSite.isHidden()) {
String msgLine = plugin.getConfigFile().getFormatCommandsVoteNextLayout();
msgLine = StringParser.getInstance().replaceIgnoreCase(msgLine, "%info%",
user.voteCommandNextInfo(voteSite));
msgLine = MessageAPI.replaceIgnoreCase(msgLine, "%info%", user.voteCommandNextInfo(voteSite));
msgLine = StringParser.getInstance().replaceIgnoreCase(msgLine, "%SiteName%",
voteSite.getDisplayName());
msg.add(StringParser.getInstance().colorize(msgLine));
msgLine = MessageAPI.replaceIgnoreCase(msgLine, "%SiteName%", voteSite.getDisplayName());
msg.add(MessageAPI.colorize(msgLine));
}
}
return msg;
@@ -63,9 +62,9 @@ public class VoteNext extends GUIHandler {
BookWrapper book = new BookWrapper(plugin.getGui().getBookVoteURLBookGUITitle());
// add colors/config options
for (VoteSite site : plugin.getVoteSites()) {
for (VoteSite site : plugin.getVoteSitesEnabled()) {
if (!site.isHidden()) {
Layout nextLayout = new Layout(new ArrayList<String>(Arrays.asList("[Json]")));
Layout nextLayout = new Layout(new ArrayList<>(Arrays.asList("[Json]")));
nextLayout.replaceTextComponent("[Json]",
BookUtil.TextBuilder.of(book.colorize(site.getDisplayName()))
.onClick(BookUtil.ClickAction.openUrl(site.getVoteURLJsonStrip()))
@@ -87,17 +86,20 @@ public class VoteNext extends GUIHandler {
public void onChest(Player player) {
BInventory inv = new BInventory(plugin.getGui().getChestVoteNextName());
inv.addPlaceholder("player", user.getPlayerName());
for (VoteSite site : plugin.getVoteSites()) {
for (VoteSite site : plugin.getVoteSitesEnabled()) {
if (!site.isHidden()) {
String siteNameDisplay = plugin.getGui().getChestVoteNextCustomSiteNamesDisplays(site.getKey());
if (siteNameDisplay.isEmpty()) {
siteNameDisplay = site.getDisplayName();
}
inv.addButton(inv.getNextSlot(),
new UpdatingBInventoryButton(plugin, site.getItem().setName(siteNameDisplay)
.setLore(StringParser.getInstance().replacePlaceHolder(
plugin.getGui().getChestVoteNextLine(), "time", user.voteCommandNextInfo(site)))
.setAmountNone(1), 1000, 1000) {
new UpdatingBInventoryButton(plugin,
site.getItem().setName(siteNameDisplay)
.setLore(PlaceholderUtils.replacePlaceHolder(
plugin.getGui().getChestVoteNextLine(), "time",
user.voteCommandNextInfo(site)))
.setAmountNone(1),
1000, 1000) {
@Override
public void onClick(ClickEvent clickEvent) {
@@ -130,7 +132,7 @@ public class VoteNext extends GUIHandler {
});
}
if (plugin.getGui().getChestVoteNextBackButton()) {
if (plugin.getGui().isChestVoteNextBackButton()) {
inv.addButton(plugin.getCommandLoader().getBackButton(user));
}
inv.openInventory(player);
@@ -12,11 +12,11 @@ import com.bencodez.advancedcore.api.inventory.BInventory;
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.messages.PlaceholderUtils;
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
import com.bencodez.advancedcore.api.rewards.RewardOptions;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.user.UserManager;
import com.bencodez.votingplugin.user.VotingPluginUser;
public class VoteShop extends GUIHandler {
@@ -46,34 +46,45 @@ public class VoteShop extends GUIHandler {
@Override
public void onChest(Player player) {
if (!plugin.getGui().getChestVoteShopEnabled()) {
player.sendMessage(StringParser.getInstance().colorize(plugin.getGui().getChestVoteShopDisabled()));
if (!plugin.getShopFile().isVoteShopEnabled()) {
player.sendMessage(MessageAPI.colorize(plugin.getShopFile().getVoteShopDisabled()));
return;
}
if (this.user == null) {
user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
}
BInventory inv = new BInventory(plugin.getGui().getChestVoteShopName());
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
/*
* if (!plugin.getConfigFile().isExtraVoteShopCheck()) { user.cacheAsync(); }
*/
BInventory inv = new BInventory(plugin.getShopFile().getVoteShopName());
inv.addPlaceholder("points", "" + user.getPoints());
inv.addPlaceholder("sitesavailable", "" + user.getSitesNotVotedOn());
inv.dontClose();
for (final String identifier : plugin.getGui().getChestShopIdentifiers()) {
for (final String identifier : plugin.getShopFile().getShopIdentifiers()) {
String perm = plugin.getGui().getChestVoteShopPermission(identifier);
String perm = plugin.getShopFile().getVoteShopPermission(identifier);
boolean hasPerm = false;
if (perm.isEmpty()) {
hasPerm = true;
} else {
String p = "";
if (perm.startsWith("!")) {
hasPerm = !player.hasPermission(perm.substring(1));
p = PlaceholderUtils.replacePlaceHolders(player, perm.substring(1));
hasPerm = !player.hasPermission(p);
} else {
hasPerm = player.hasPermission(perm);
p = PlaceholderUtils.replacePlaceHolders(player, perm);
hasPerm = player.hasPermission(p);
}
if (!hasPerm) {
plugin.extraDebug("VoteShop: " + player.getName() + "/" + player.getUniqueId()
+ " does not have permission `" + p + "` for " + identifier);
}
}
int limit = plugin.getGui().getChestShopIdentifierLimit(identifier);
int limit = plugin.getShopFile().getShopIdentifierLimit(identifier);
boolean limitPass = true;
if (limit > 0) {
@@ -82,9 +93,10 @@ public class VoteShop extends GUIHandler {
}
}
if (!plugin.getGui().getChestVoteShopNotBuyable(identifier)) {
if (hasPerm && (limitPass || !plugin.getGui().isChestVoteShopHideLimitedReached())) {
ItemBuilder builder = new ItemBuilder(plugin.getGui().getChestShopIdentifierSection(identifier));
if (!plugin.getShopFile().getVoteShopNotBuyable(identifier)) {
if ((hasPerm || !plugin.getShopFile().getVoteShopHideOnNoPermission(identifier))
&& (limitPass || !plugin.getShopFile().isVoteShopHideLimitedReached())) {
ItemBuilder builder = new ItemBuilder(plugin.getShopFile().getShopIdentifierSection(identifier));
inv.addButton(new BInventoryButton(builder) {
@@ -92,12 +104,14 @@ public class VoteShop extends GUIHandler {
public void onClick(ClickEvent event) {
Player player = event.getWhoClicked();
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
user.cache();
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
if (plugin.getConfigFile().isExtraVoteShopCheck()) {
user.cache();
}
String identifier = (String) getData("identifier");
int limit = (int) getData("Limit");
int points = plugin.getGui().getChestShopIdentifierCost(identifier);
int points = plugin.getShopFile().getShopIdentifierCost(identifier);
if (identifier != null) {
// if (plugin.getGui().getChestVoteShopCloseGUI(identifier)) {
// event.closeInventory();
@@ -112,39 +126,52 @@ public class VoteShop extends GUIHandler {
}
if (limitPass) {
if (!plugin.getGui().isChestVoteShopRequireConfirmation(identifier)) {
HashMap<String, String> placeholders = new HashMap<String, String>();
if (!plugin.getShopFile().isVoteShopRequireConfirmation(identifier)) {
HashMap<String, String> placeholders = new HashMap<>();
placeholders.put("identifier",
plugin.getGui().getChestShopIdentifierIdentifierName(identifier));
plugin.getShopFile().getShopIdentifierIdentifierName(identifier));
placeholders.put("points", "" + points);
placeholders.put("limit", "" + limit);
if (user.removePoints(points)) {
if (user.removePoints(points, true)) {
plugin.getLogger().info("VoteShop: " + user.getPlayerName() + "/"
+ user.getUUID() + " bought " + identifier + " for " + points);
if (plugin.getConfigFile().isTrackShopPurchases()) {
plugin.getServerData().addVoteShopPurchase(identifier);
}
plugin.getRewardHandler().giveReward(user, plugin.getGui().getData(),
plugin.getGui().getChestShopIdentifierRewardsPath(identifier),
plugin.getRewardHandler().giveReward(user, plugin.getShopFile().getData(),
plugin.getShopFile().getShopIdentifierRewardsPath(identifier),
new RewardOptions().setPlaceholders(placeholders));
user.sendMessage(StringParser.getInstance().replacePlaceHolder(
plugin.getGui().getCHESTVoteShopPurchase(identifier),
user.sendMessage(PlaceholderUtils.replacePlaceHolder(
plugin.getShopFile().getVoteShopPurchase(identifier),
placeholders));
if (limit > 0) {
user.setVoteShopIdentifierLimit(identifier,
user.getVoteShopIdentifierLimit(identifier) + 1);
}
} else {
user.sendMessage(StringParser.getInstance().replacePlaceHolder(
user.sendMessage(PlaceholderUtils.replacePlaceHolder(
plugin.getConfigFile().getFormatShopFailedMsg(), placeholders));
}
} else {
new VoteShopConfirm(plugin, player, user, identifier).open(GUIMethod.CHEST);
plugin.getBukkitScheduler().runTask(plugin, new Runnable() {
@Override
public void run() {
new VoteShopConfirm(plugin, player, user, identifier)
.open(GUIMethod.CHEST);
}
});
}
} else {
user.sendMessage(plugin.getGui().getChestVoteShopLimitReached());
user.sendMessage(plugin.getShopFile().getVoteShopLimitReached());
}
plugin.getCommandLoader().processSlotClick(player, user, identifier);
if (plugin.getShopFile().isVoteShopReopenGUIOnPurchase()) {
plugin.getCommandLoader().processSlotClick(player, user, "shop");
}
}
}
@@ -152,7 +179,7 @@ public class VoteShop extends GUIHandler {
}
} else {
if (hasPerm) {
ItemBuilder builder = new ItemBuilder(plugin.getGui().getChestShopIdentifierSection(identifier));
ItemBuilder builder = new ItemBuilder(plugin.getShopFile().getShopIdentifierSection(identifier));
inv.addButton(new BInventoryButton(builder) {
@Override
@@ -165,20 +192,20 @@ public class VoteShop extends GUIHandler {
}
}
for (final String str : plugin.getGui().getChestGUIVoteShopExtraItems()) {
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIVoteShopExtraItems(str))) {
for (final String str : plugin.getShopFile().getVoteShopExtraItems()) {
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getShopFile().getGUIVoteShopExtraItems(str))) {
@Override
public void onClick(ClickEvent clickEvent) {
plugin.getCommandLoader().processSlotClick(player, user, str);
new RewardBuilder(plugin.getGui().getData(),
"CHEST.VoteShopExtraItems." + str + "." + clickEvent.getButton().getLastRewardsPath(player))
new RewardBuilder(plugin.getShopFile().getData(),
"ExtraItems." + str + "." + clickEvent.getButton().getLastRewardsPath(player))
.setGiveOffline(false).send(clickEvent.getPlayer());
}
});
}
if (plugin.getGui().getChestVoteShopBackButton()) {
if (plugin.getShopFile().isVoteShopBackButton()) {
inv.addButton(plugin.getCommandLoader().getBackButton(user));
}
@@ -12,9 +12,9 @@ import com.bencodez.advancedcore.api.inventory.BInventory;
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.misc.PlayerUtils;
import com.bencodez.advancedcore.api.messages.PlaceholderUtils;
import com.bencodez.advancedcore.api.rewards.RewardOptions;
import com.bencodez.simpleapi.player.PlayerUtils;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.user.VotingPluginUser;
@@ -46,38 +46,41 @@ public class VoteShopConfirm extends GUIHandler {
@Override
public void onChest(Player player) {
PlayerUtils.getInstance().setPlayerMeta(player, "ident", identifier);
BInventory inv = new BInventory(plugin.getGui().getChestShopConfirmPurchaseTitle());
PlayerUtils.setPlayerMeta(plugin, player, "ident", identifier);
BInventory inv = new BInventory(plugin.getShopFile().getShopConfirmPurchaseTitle());
inv.dontClose();
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestShopConfirmPurchaseYesItem())) {
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getShopFile().getShopConfirmPurchaseYesItem())) {
@Override
public void onClick(ClickEvent event) {
user.cache();
int points = plugin.getGui().getChestShopIdentifierCost(identifier);
int limit = plugin.getGui().getChestShopIdentifierLimit(identifier);
HashMap<String, String> placeholders = new HashMap<String, String>();
int points = plugin.getShopFile().getShopIdentifierCost(identifier);
int limit = plugin.getShopFile().getShopIdentifierLimit(identifier);
HashMap<String, String> placeholders = new HashMap<>();
placeholders.put("identifier", identifier);
placeholders.put("points", "" + points);
placeholders.put("limit", "" + limit);
if (user.removePoints(points)) {
if (user.removePoints(points, true)) {
plugin.getLogger().info("VoteShop: " + user.getPlayerName() + "/" + user.getUUID() + " bought "
+ identifier + " for " + points);
if (plugin.getConfigFile().isTrackShopPurchases()) {
plugin.getServerData().addVoteShopPurchase(identifier);
}
plugin.getRewardHandler().giveReward(user, plugin.getGui().getData(),
plugin.getGui().getChestShopIdentifierRewardsPath(identifier),
plugin.getRewardHandler().giveReward(user, plugin.getShopFile().getData(),
plugin.getShopFile().getShopIdentifierRewardsPath(identifier),
new RewardOptions().setPlaceholders(placeholders));
user.sendMessage(StringParser.getInstance()
.replacePlaceHolder(plugin.getGui().getCHESTVoteShopPurchase(identifier), placeholders));
user.sendMessage(PlaceholderUtils
.replacePlaceHolder(plugin.getShopFile().getVoteShopPurchase(identifier), placeholders));
if (limit > 0) {
user.setVoteShopIdentifierLimit(identifier, user.getVoteShopIdentifierLimit(identifier) + 1);
}
} else {
user.sendMessage(StringParser.getInstance()
user.sendMessage(PlaceholderUtils
.replacePlaceHolder(plugin.getConfigFile().getFormatShopFailedMsg(), placeholders));
}
if (plugin.getGui().getChestVoteShopCloseGUI(identifier)) {
if (plugin.getShopFile().getVoteShopCloseGUI(identifier)) {
event.getButton().getInv().closeInv(player, null);
} else {
new VoteShop(plugin, event.getPlayer(), user).open();
@@ -85,11 +88,11 @@ public class VoteShopConfirm extends GUIHandler {
}
});
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestShopConfirmPurchaseNoItem())) {
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getShopFile().getShopConfirmPurchaseNoItem())) {
@Override
public void onClick(ClickEvent event) {
if (plugin.getGui().getChestVoteShopCloseGUI(identifier)) {
if (plugin.getShopFile().getVoteShopCloseGUI(identifier)) {
event.getButton().getInv().closeInv(player, null);
} else {
new VoteShop(plugin, event.getPlayer(), user).open();
@@ -12,8 +12,9 @@ import com.bencodez.advancedcore.api.inventory.BInventory;
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.advancedcore.api.messages.PlaceholderUtils;
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
import com.bencodez.simpleapi.array.ArrayUtils;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.user.VotingPluginUser;
@@ -31,11 +32,11 @@ public class VoteStreak extends GUIHandler {
@Override
public ArrayList<String> getChat(CommandSender sender) {
ArrayList<String> msg = new ArrayList<String>();
ArrayList<String> msg = new ArrayList<>();
msg.add(plugin.getConfigFile().getFormatCommandsVoteStreakTitle());
msg.addAll(plugin.getConfigFile().getFormatCommandsVoteStreakLines());
HashMap<String, String> placeholders = new HashMap<String, String>();
HashMap<String, String> placeholders = new HashMap<>();
placeholders.put("DailyStreak", "" + user.getDayVoteStreak());
placeholders.put("WeeklyStreak", "" + user.getWeekVoteStreak());
placeholders.put("MonthlyStreak", "" + user.getMonthVoteStreak());
@@ -46,9 +47,9 @@ public class VoteStreak extends GUIHandler {
placeholders.put("player", user.getPlayerName());
msg = ArrayUtils.getInstance().replacePlaceHolder(msg, placeholders);
msg = PlaceholderUtils.replacePlaceHolder(msg, placeholders);
return ArrayUtils.getInstance().colorize(msg);
return ArrayUtils.colorize(msg);
}
@Override
@@ -136,7 +137,7 @@ public class VoteStreak extends GUIHandler {
});
}
if (plugin.getGui().getChestVoteStreakBackButton()) {
if (plugin.getGui().isChestVoteStreakBackButton()) {
inv.addButton(plugin.getCommandLoader().getBackButton(user));
}
@@ -16,14 +16,13 @@ import com.bencodez.advancedcore.api.inventory.BInventory;
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.advancedcore.api.messages.PlaceholderUtils;
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
import com.bencodez.advancedcore.nms.NMSManager;
import com.bencodez.simpleapi.array.ArrayUtils;
import com.bencodez.simpleapi.nms.NMSManager;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.objects.VoteSite;
import com.bencodez.votingplugin.topvoter.TopVoterPlayer;
import com.bencodez.votingplugin.user.UserManager;
import com.bencodez.votingplugin.user.VotingPluginUser;
public class VoteToday extends GUIHandler {
@@ -45,7 +44,7 @@ public class VoteToday extends GUIHandler {
if (page < 1) {
page = 1;
}
ArrayList<String> msg = new ArrayList<String>();
ArrayList<String> msg = new ArrayList<>();
String[] voteToday = voteToday();
int maxPage = voteToday.length / pagesize;
@@ -53,7 +52,7 @@ public class VoteToday extends GUIHandler {
maxPage++;
}
HashMap<String, String> placeholders = new HashMap<String, String>();
HashMap<String, String> placeholders = new HashMap<>();
placeholders.put("page", "" + page);
placeholders.put("maxpage", "" + maxPage);
@@ -67,7 +66,7 @@ public class VoteToday extends GUIHandler {
msg.add(voteToday[i]);
}
return ArrayUtils.getInstance().colorize(ArrayUtils.getInstance().replacePlaceHolder(msg, placeholders));
return ArrayUtils.colorize(PlaceholderUtils.replacePlaceHolder(msg, placeholders));
}
@Override
@@ -92,32 +91,32 @@ public class VoteToday extends GUIHandler {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(plugin.getConfigFile().getFormatTimeFormat());
String timeString = plugin.getVoteToday().get(user).get(voteSite).format(formatter);
String msg = plugin.getGui().getChestVoteTodayLine();
HashMap<String, String> placeholders = new HashMap<String, String>();
HashMap<String, String> placeholders = new HashMap<>();
placeholders.put("VoteSite", voteSite.getDisplayName());
placeholders.put("Time", timeString);
msg = StringParser.getInstance().replacePlaceHolder(msg, placeholders);
msg = PlaceholderUtils.replacePlaceHolder(msg, placeholders);
ItemBuilder item = null;
if (plugin.getGui().isChestVoteTodayUseSkull() && !NMSManager.getInstance().isVersion("1.12")) {
item = new ItemBuilder(user.getPlayerHead());
} else {
item = new ItemBuilder(plugin.getGui().getChestVoteTodayPlayerItem());
}
item.setName(StringParser.getInstance().replacePlaceHolder(plugin.getGui().getChestVoteTodayIconTitle(),
"player", user.getPlayerName()));
item.setName(PlaceholderUtils.replacePlaceHolder(plugin.getGui().getChestVoteTodayIconTitle(), "player",
user.getPlayerName()));
item.setLore(msg);
final UUID uuid = user.getUuid();
inv.addButton(inv.getNextSlot(), new BInventoryButton(item) {
@Override
public void onClick(ClickEvent clickEvent) {
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(uuid);
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(uuid);
new VoteGUI(plugin, player, user)
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodGUI().toUpperCase()));
}
});
}
}
String guiPath = "VoteToday";
for (final String str : plugin.getGui().getChestGUIExtraItems(guiPath)) {
inv.addButton(
@@ -131,10 +130,11 @@ public class VoteToday extends GUIHandler {
.setGiveOffline(false).send(clickEvent.getPlayer());
}
});
}
if (plugin.getGui().getChestVoteTodayBackButton()) {
if (plugin.getGui().isChestVoteTodayBackButton()) {
inv.addButton(plugin.getCommandLoader().getBackButton(user));
}
inv.openInventory(player);
@@ -146,28 +146,29 @@ public class VoteToday extends GUIHandler {
}
public String[] voteToday() {
ArrayList<String> msg = new ArrayList<String>();
ArrayList<String> msg = new ArrayList<>();
for (TopVoterPlayer user : plugin.getVoteToday().keySet()) {
for (VoteSite voteSite : plugin.getVoteToday().get(user).keySet()) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(plugin.getConfigFile().getFormatTimeFormat());
String timeString = plugin.getVoteToday().get(user).get(voteSite).format(formatter);
HashMap<String, String> placeholders = new HashMap<String, String>();
HashMap<String, String> placeholders = new HashMap<>();
placeholders.put("player", user.getPlayerName());
placeholders.put("votesite", voteSite.getKey());
placeholders.put("sitename", voteSite.getDisplayName());
placeholders.put("time", timeString);
msg.add(StringParser.getInstance()
.replacePlaceHolder(plugin.getConfigFile().getFormatCommandsVoteTodayLine(), placeholders));
msg.add(PlaceholderUtils.replacePlaceHolder(plugin.getConfigFile().getFormatCommandsVoteTodayLine(),
placeholders));
// msg.add("&6" + user.getPlayerName() + " : " + voteSite.getKey() + " : " +
// timeString);
}
}
msg = ArrayUtils.getInstance().colorize(msg);
return ArrayUtils.getInstance().convert(msg);
msg = ArrayUtils.colorize(msg);
return ArrayUtils.convert(msg);
}
public String[] voteTodayGUI() {
ArrayList<String> msg = new ArrayList<String>();
ArrayList<String> msg = new ArrayList<>();
for (TopVoterPlayer user : plugin.getVoteToday().keySet()) {
LocalDateTime mostRecent = null;
@@ -181,16 +182,17 @@ public class VoteToday extends GUIHandler {
if (mostRecent != null) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(plugin.getConfigFile().getFormatTimeFormat());
String timeString = mostRecent.format(formatter);
HashMap<String, String> placeholders = new HashMap<String, String>();
HashMap<String, String> placeholders = new HashMap<>();
placeholders.put("player", user.getPlayerName());
placeholders.put("votesite", mostRecentSite.getKey());
placeholders.put("sitename", mostRecentSite.getDisplayName());
placeholders.put("time", timeString);
msg.add(StringParser.getInstance()
.replacePlaceHolder(plugin.getConfigFile().getFormatCommandsVoteTodayLine(), placeholders));
msg.add(PlaceholderUtils.replacePlaceHolder(plugin.getConfigFile().getFormatCommandsVoteTodayLine(),
placeholders));
}
}
msg = ArrayUtils.getInstance().colorize(msg);
return ArrayUtils.getInstance().convert(msg);
msg = ArrayUtils.colorize(msg);
return ArrayUtils.convert(msg);
}
}
@@ -20,8 +20,8 @@ import com.bencodez.advancedcore.api.inventory.BInventory;
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
import com.bencodez.simpleapi.array.ArrayUtils;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.topvoter.TopVoter;
import com.bencodez.votingplugin.topvoter.TopVoterPlayer;
@@ -46,17 +46,17 @@ public class VoteTopVoter extends GUIHandler {
public ArrayList<String> getChat(CommandSender sender) {
switch (top) {
case AllTime:
return ArrayUtils.getInstance().convert(plugin.getTopVoterHandler().topVoterAllTime(page));
return ArrayUtils.convert(plugin.getTopVoterHandler().topVoterAllTime(page));
case Daily:
return ArrayUtils.getInstance().convert(plugin.getTopVoterHandler().topVoterDaily(page));
return ArrayUtils.convert(plugin.getTopVoterHandler().topVoterDaily(page));
case Monthly:
return ArrayUtils.getInstance().convert(plugin.getTopVoterHandler().topVoterMonthly(page));
return ArrayUtils.convert(plugin.getTopVoterHandler().topVoterMonthly(page));
case Weekly:
return ArrayUtils.getInstance().convert(plugin.getTopVoterHandler().topVoterWeekly(page));
return ArrayUtils.convert(plugin.getTopVoterHandler().topVoterWeekly(page));
default:
break;
}
return new ArrayList<String>();
return new ArrayList<>();
}
@Override
@@ -85,7 +85,7 @@ public class VoteTopVoter extends GUIHandler {
ConfigurationSection customization = plugin.getGui().getChestVoteTopCustomization();
boolean customzationEnabled = false;
Queue<Integer> playerSlots = new ConcurrentLinkedQueue<Integer>();
Queue<Integer> playerSlots = new ConcurrentLinkedQueue<>();
if (customization != null) {
customzationEnabled = customization.getBoolean("Enabled");
List<Integer> customizationPlayerSlots = customization.getIntegerList("PlayerSlots");
@@ -109,7 +109,7 @@ public class VoteTopVoter extends GUIHandler {
playerItem = new ItemBuilder(Material.valueOf(plugin.getGui().getChestVoteTopPlayerItemMaterial()));
}
playerItem.setLore(new ArrayList<String>());
playerItem.setLore(new ArrayList<>());
BInventoryButton button = new BInventoryButton(playerItem
.setName(plugin.getGui().getChestVoteTopItemName())
@@ -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());
@@ -65,7 +65,7 @@ public class VoteTopVoterLastMonth extends GUIHandler {
playerItem = new ItemBuilder(Material.valueOf(plugin.getGui().getChestVoteTopPlayerItemMaterial()));
}
playerItem.setLore(new ArrayList<String>());
playerItem.setLore(new ArrayList<>());
inv.addButton(new BInventoryButton(playerItem.setName(plugin.getGui().getChestVoteTopItemName())
.addLoreLine(plugin.getGui().getChestVoteTopItemLore()).addPlaceholder("position", "" + pos)
@@ -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));
}
@@ -0,0 +1,147 @@
package com.bencodez.votingplugin.commands.gui.player;
import java.time.YearMonth;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import java.util.stream.Collectors;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import com.bencodez.advancedcore.api.gui.GUIHandler;
import com.bencodez.advancedcore.api.gui.GUIMethod;
import com.bencodez.advancedcore.api.inventory.BInventory;
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.topvoter.TopVoterPlayer;
import com.bencodez.votingplugin.user.VotingPluginUser;
import net.md_5.bungee.api.ChatColor;
public class VoteTopVoterPreviousMonths extends GUIHandler {
private VotingPluginMain plugin;
private VotingPluginUser user;
private int index = -1;
public VoteTopVoterPreviousMonths(VotingPluginMain plugin, CommandSender player, VotingPluginUser user, int index) {
super(plugin, player);
this.plugin = plugin;
this.user = user;
this.index = index;
}
@Override
public ArrayList<String> getChat(CommandSender arg0) {
return null;
}
public void next(int index) {
}
@Override
public void onBook(Player player) {
// TODO
}
@Override
public void onChat(CommandSender sender) {
}
@Override
public void onChest(Player player) {
Set<YearMonth> months = plugin.getPreviousMonthsTopVoters().keySet();
List<YearMonth> yearMonthList = months.stream().sorted(Collections.reverseOrder()).collect(Collectors.toList());
YearMonth yearMonth = null;
if (index < 0) {
if (!yearMonthList.isEmpty()) {
yearMonth = yearMonthList.get(0);
}
player.sendMessage(ChatColor.RED + "Can't open previous months, no data");
return;
}
if (yearMonthList.size() <= index) {
player.sendMessage(ChatColor.RED + "Can't open previous months, no data for requested index");
return;
}
yearMonth = yearMonthList.get(index);
Set<Entry<TopVoterPlayer, Integer>> users = null;
if (!plugin.getPreviousMonthsTopVoters().containsKey(yearMonth)) {
player.sendMessage(ChatColor.RED + "Can't open previous months, no data");
return;
}
users = plugin.getPreviousMonthsTopVoters().get(yearMonth).entrySet();
BInventory inv = new BInventory(plugin.getGui().getChestVoteTopName());
inv.addPlaceholder("topvoter", yearMonth.toString());
if (!plugin.getConfigFile().isAlwaysCloseInventory()) {
inv.dontClose();
}
int pos = 1;
for (Entry<TopVoterPlayer, Integer> entry : users) {
ItemBuilder playerItem;
if (plugin.getGui().isChestVoteTopUseSkull()) {
playerItem = new ItemBuilder(entry.getKey().getPlayerHead());
} else {
playerItem = new ItemBuilder(Material.valueOf(plugin.getGui().getChestVoteTopPlayerItemMaterial()));
}
playerItem.setLore(new ArrayList<>());
inv.addButton(new BInventoryButton(playerItem.setName(plugin.getGui().getChestVoteTopItemName())
.addLoreLine(plugin.getGui().getChestVoteTopItemLore()).addPlaceholder("position", "" + pos)
.addPlaceholder("player", entry.getKey().getPlayerName())
.addPlaceholder("votes", "" + entry.getValue())) {
@Override
public void onClick(ClickEvent clickEvent) {
TopVoterPlayer user = (TopVoterPlayer) getData("User");
new VoteGUI(plugin, player, user.getUser())
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodGUI().toUpperCase()));
}
}.addData("player", entry.getKey().getPlayerName()).addData("User", entry.getKey()));
pos++;
}
inv.getPageButtons().add(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestVoteTopSwitchItem())
.addPlaceholder("Top", yearMonth.toString())) {
@Override
public void onClick(ClickEvent clickEvent) {
if (!clickEvent.getClick().equals(ClickType.RIGHT)) {
new VoteTopVoterPreviousMonths(plugin, player, user, index + 1).open(GUIMethod.CHEST);
} else {
new VoteTopVoterPreviousMonths(plugin, player, user, index - 1).open(GUIMethod.CHEST);
}
}
});
if (plugin.getGui().isChestVoteTopBackButton()) {
inv.getPageButtons().add(plugin.getCommandLoader().getBackButton(user).setSlot(1));
}
inv.setPages(true);
inv.setMaxInvSize(plugin.getGui().getChestVoteTopSize());
inv.openInventory(player);
}
@Override
public void open() {
open(GUIMethod.CHEST);
}
}
@@ -8,13 +8,13 @@ import org.bukkit.entity.Player;
import com.bencodez.advancedcore.api.gui.GUIHandler;
import com.bencodez.advancedcore.api.gui.GUIMethod;
import com.bencodez.advancedcore.api.inventory.BInventory;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
import com.bencodez.simpleapi.array.ArrayUtils;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.topvoter.TopVoter;
import com.bencodez.votingplugin.user.VotingPluginUser;
@@ -32,7 +32,7 @@ public class VoteTotal extends GUIHandler {
@Override
public ArrayList<String> getChat(CommandSender arg0) {
ArrayList<String> msg = new ArrayList<String>();
ArrayList<String> msg = new ArrayList<>();
int daily = user.getTotal(TopVoter.Daily);
int weekly = user.getTotal(TopVoter.Weekly);
@@ -40,15 +40,15 @@ public class VoteTotal extends GUIHandler {
int all = user.getTotal(TopVoter.AllTime);
for (String s : plugin.getConfigFile().getFormatCommandsVoteTotal()) {
String str = StringParser.getInstance().replaceIgnoreCase(s, "%DailyTotal%", "" + daily);
str = StringParser.getInstance().replaceIgnoreCase(str, "%WeeklyTotal%", "" + weekly);
str = StringParser.getInstance().replaceIgnoreCase(str, "%MonthlyTotal%", "" + month);
str = StringParser.getInstance().replaceIgnoreCase(str, "%AllTimeTotal%", "" + all);
str = StringParser.getInstance().replaceIgnoreCase(str, "%player%", user.getPlayerName());
String str = MessageAPI.replaceIgnoreCase(s, "%DailyTotal%", "" + daily);
str = MessageAPI.replaceIgnoreCase(str, "%WeeklyTotal%", "" + weekly);
str = MessageAPI.replaceIgnoreCase(str, "%MonthlyTotal%", "" + month);
str = MessageAPI.replaceIgnoreCase(str, "%AllTimeTotal%", "" + all);
str = MessageAPI.replaceIgnoreCase(str, "%player%", user.getPlayerName());
msg.add(str);
}
return ArrayUtils.getInstance().colorize(msg);
return ArrayUtils.colorize(msg);
}
@Override
@@ -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);
@@ -7,6 +7,7 @@ import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import com.bencodez.advancedcore.api.bookgui.BookWrapper;
import com.bencodez.advancedcore.api.bookgui.Layout;
@@ -18,13 +19,12 @@ import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.messages.MessageBuilder;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.advancedcore.api.messages.PlaceholderUtils;
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
import com.bencodez.simpleapi.array.ArrayUtils;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.objects.VoteSite;
import com.bencodez.votingplugin.topvoter.TopVoter;
import com.bencodez.votingplugin.user.UserManager;
import com.bencodez.votingplugin.user.VotingPluginUser;
import xyz.upperlevel.spigot.book.BookUtil;
@@ -41,51 +41,64 @@ public class VoteURL extends GUIHandler {
this.user = user;
this.json = json;
if (user == null && player instanceof Player) {
this.user = UserManager.getInstance().getVotingPluginUser((Player) player);
this.user = plugin.getVotingPluginUserManager().getVotingPluginUser((Player) player);
}
if (player != null && user != null && player.getName().equals(user.getPlayerName())) {
if (plugin.getConfigFile().isUsePrimaryAccountForPlaceholders() && user.hasPrimaryAccount()) {
user = UserManager.getInstance().getVotingPluginUser(user.getPrimaryAccount());
user = plugin.getVotingPluginUserManager().getVotingPluginUser(user.getPrimaryAccount());
}
}
}
@Override
public ArrayList<String> getChat(CommandSender arg0) {
ArrayList<String> sites = new ArrayList<String>();
public ArrayList<String> getChat(CommandSender sender) {
return getChat(sender, false);
}
public ArrayList<String> getChat(CommandSender sender, boolean bypassCanVote) {
ArrayList<String> sites = new ArrayList<>();
List<String> title = plugin.getConfigFile().getFormatCommandsVoteText();
if (title != null) {
sites.addAll(title);
}
if (plugin.getConfigFile().getFormatCommandsVoteAutoInputSites()) {
if (plugin.getConfigFile().isFormatCommandsVoteAutoInputSites()) {
int counter = 0;
for (VoteSite voteSite : plugin.getVoteSites()) {
for (VoteSite voteSite : plugin.getVoteSitesEnabled()) {
if (!voteSite.isHidden()) {
counter++;
String voteURL = voteSite.getVoteURL(json);
MessageBuilder message = new MessageBuilder(plugin.getConfigFile().getFormatCommandsVoteURLS());
message.replacePlaceholder("num", Integer.toString(counter)).replacePlaceholder("url", voteURL)
.replacePlaceholder("SiteName", voteSite.getDisplayName());
if (user != null && user.getPlayerName() != null) {
message.replacePlaceholder("player", "" + user.getPlayerName()).replacePlaceholder("Next",
"" + user.voteCommandNextInfo(voteSite));
if (voteSite.getPermissionToView().isEmpty()
|| sender.hasPermission(voteSite.getPermissionToView())) {
if (!plugin.getConfigFile().isFormatCommandsVoteOnlyShowSitesToVote()
|| user.canVoteSite(voteSite) || bypassCanVote) {
counter++;
String voteURL = voteSite.getVoteURL(json);
MessageBuilder message = new MessageBuilder(
plugin.getConfigFile().getFormatCommandsVoteURLS());
message.replacePlaceholder("num", Integer.toString(counter))
.replacePlaceholder("url", voteURL)
.replacePlaceholder("SiteName", voteSite.getDisplayName());
if (user != null && user.getPlayerName() != null) {
message.replacePlaceholder("player", "" + user.getPlayerName())
.replacePlaceholder("Next", "" + user.voteCommandNextInfo(voteSite));
}
sites.add(message.colorize().getText());
}
}
sites.add(message.colorize().getText());
}
}
}
if (user != null) {
HashMap<String, String> phs = new HashMap<String, String>();
HashMap<String, String> phs = new HashMap<>();
phs.put("DailyTotal", "" + user.getTotal(TopVoter.Daily));
phs.put("WeekTotal", "" + user.getTotal(TopVoter.Weekly));
phs.put("MonthTotal", "" + user.getTotal(TopVoter.Monthly));
phs.put("Total", "" + user.getTotal(TopVoter.AllTime));
sites = ArrayUtils.getInstance().replacePlaceHolder(sites, phs);
sites = PlaceholderUtils.replacePlaceHolder(sites, phs);
}
return ArrayUtils.getInstance().colorize(sites);
return ArrayUtils.colorize(sites);
}
private ItemBuilder getItemAll() {
@@ -118,13 +131,16 @@ public class VoteURL extends GUIHandler {
if (user.canVoteSite(voteSite)) {
builder = new ItemBuilder(plugin.getGui().getChestVoteURLCanVoteItemSection());
builder.setName(
plugin.getGui().getChestVoteURLGUISiteNameCanVote().replace("%Name%", voteSite.getDisplayName()));
builder.setName(plugin.getGui().getChestVoteURLGUISiteNameCanVote());
} else {
builder.setName(plugin.getGui().getChestVoteURLGUISiteName().replace("%Name%", voteSite.getDisplayName()));
builder.addLoreLine(
plugin.getGui().getChestVoteURLNextVote().replace("%Info%", user.voteCommandNextInfo(voteSite)));
builder.setName(plugin.getGui().getChestVoteURLGUISiteName());
builder.addLoreLine(plugin.getGui().getChestVoteURLNextVote());
}
builder.addPlaceholder("ServiceSite", voteSite.getServiceSite());
builder.addPlaceholder("Name", voteSite.getDisplayName());
builder.addPlaceholder("VoteDelay", "" + voteSite.getVoteDelay());
builder.addPlaceholder("VoteHour", "" + voteSite.getVoteDelayDailyHour());
builder.addPlaceholder("Info", user.voteCommandNextInfo(voteSite));
return builder;
}
@@ -133,21 +149,31 @@ public class VoteURL extends GUIHandler {
public void onBook(Player player) {
BookWrapper book = new BookWrapper(plugin.getGui().getBookVoteURLBookGUITitle());
for (VoteSite site : plugin.getVoteSites()) {
Layout layout = new Layout(plugin.getGui().getBookVoteURLBookGUILayout()).addPlaceholder("sitename",
site.getDisplayName());
String text = plugin.getGui().getBookVoteURLBookGUIAlreadyVotedText();
ChatColor color = ChatColor.valueOf(plugin.getGui().getBookVoteURLBookGUIAlreadyVotedColor());
if (user.canVoteSite(site)) {
color = ChatColor.valueOf(plugin.getGui().getBookVoteURLBookGUICanVoteColor());
text = plugin.getGui().getBookVoteURLBookGUICanVoteText();
}
String url = StringParser.getInstance().replacePlaceHolder(site.getVoteURLJsonStrip(), "player",
user.getPlayerName());
layout.replaceTextComponent("[UrlText]", BookUtil.TextBuilder.of(text).color(color)
.onClick(BookUtil.ClickAction.openUrl(url)).onHover(BookUtil.HoverAction.showText(url)).build());
if (plugin.getGui().isBookVoteURLBookGUIManual()) {
Layout layout = new Layout(plugin.getGui().getBookVoteURLBookGUITopLayout());
book.addLayout(layout);
}
int i = 1;
for (VoteSite site : plugin.getVoteSitesEnabled()) {
if (!site.isHidden()) {
if (site.getPermissionToView().isEmpty() || player.hasPermission(site.getPermissionToView())) {
Layout layout = new Layout(plugin.getGui().getBookVoteURLBookGUILayout())
.addPlaceholder("sitename", site.getDisplayName()).addPlaceholder("num", "" + i);
String text = plugin.getGui().getBookVoteURLBookGUIAlreadyVotedText();
ChatColor color = ChatColor.valueOf(plugin.getGui().getBookVoteURLBookGUIAlreadyVotedColor());
if (user.canVoteSite(site)) {
color = ChatColor.valueOf(plugin.getGui().getBookVoteURLBookGUICanVoteColor());
text = plugin.getGui().getBookVoteURLBookGUICanVoteText();
}
String url = PlaceholderUtils.replacePlaceHolder(PlaceholderUtils.replacePlaceHolder(
site.getVoteURLJsonStrip(), "player", user.getPlayerName()), "num", "" + i);
layout.replaceTextComponent("[UrlText]",
BookUtil.TextBuilder.of(text).color(color).onClick(BookUtil.ClickAction.openUrl(url))
.onHover(BookUtil.HoverAction.showText(url)).build());
book.addLayout(layout);
i++;
}
}
}
book.open(player);
@@ -162,16 +188,21 @@ public class VoteURL extends GUIHandler {
public void onChest(Player player) {
// normal GUI
BInventory inv = new BInventory(plugin.getGui().getChestVoteURLName());
if (plugin.getGui().getChestVoteURLViewAllUrlsButtonEnabled()) {
if (plugin.getGui().isChestVoteURLViewAllUrlsButtonEnabled()) {
ItemBuilder builderAll = getItemAll();
inv.addButton(new UpdatingBInventoryButton(plugin, builderAll, 5000, 5000) {
@Override
public void onClick(ClickEvent event) {
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(event.getPlayer());
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(event.getPlayer());
json = true;
user.sendMessage(getChat(player));
if (event.getClick().equals(ClickType.SHIFT_LEFT)
|| event.getClick().equals(ClickType.SHIFT_RIGHT)) {
user.sendMessage(getChat(player, true));
} else {
user.sendMessage(getChat(player, false));
}
}
@Override
@@ -182,41 +213,48 @@ public class VoteURL extends GUIHandler {
}
int startSlot = plugin.getGui().getChestVoteURLAllUrlsButtonStartSlot();
for (final VoteSite voteSite : plugin.getVoteSites()) {
for (final VoteSite voteSite : plugin.getVoteSitesEnabled()) {
if (!voteSite.isHidden()) {
ItemBuilder builder = getItemVoteSite(voteSite);
if (startSlot >= 0) {
builder.setSlot(startSlot);
startSlot++;
}
if (voteSite.getPermissionToView().isEmpty() || player.hasPermission(voteSite.getPermissionToView())) {
ItemBuilder builder = getItemVoteSite(voteSite);
if (startSlot >= 0) {
builder.setSlot(startSlot);
startSlot++;
}
inv.addButton(new UpdatingBInventoryButton(plugin, builder, 5000, 5000) {
inv.addButton(new UpdatingBInventoryButton(plugin, builder, 5000, 5000) {
@Override
public void onClick(ClickEvent event) {
Player player = event.getPlayer();
if (player != null) {
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
user.sendMessage(StringParser.getInstance().replacePlaceHolder(StringParser.getInstance()
.replacePlaceHolder(StringParser.getInstance().replacePlaceHolder(
plugin.getGui().getChestVoteURLURLText(), "voteurl", voteSite.getVoteURL()),
"sitename", voteSite.getDisplayName()),
"player", player.getName()));
@Override
public void onClick(ClickEvent event) {
Player player = event.getPlayer();
if (player != null) {
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
HashMap<String, String> placeholders = new HashMap<>();
placeholders.put("voteurl", voteSite.getVoteURL());
placeholders.put("sitename", voteSite.getDisplayName());
placeholders.put("player", player.getName());
placeholders.put("servicesite", voteSite.getServiceSite());
placeholders.put("VoteDelay", "" + voteSite.getVoteDelay());
placeholders.put("VoteHour", "" + voteSite.getVoteDelayDailyHour());
user.sendMessage(plugin.getGui().getChestVoteURLURLText(), placeholders);
}
}
}
@Override
public ItemBuilder onUpdate(Player player) {
return getItemVoteSite(voteSite);
}
@Override
public ItemBuilder onUpdate(Player player) {
return getItemVoteSite(voteSite);
}
});
});
}
}
}
for (final String str : plugin.getGui().getChestVoteURLExtraItems()) {
for (
final String str : plugin.getGui().getChestVoteURLExtraItems()) {
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestVoteURLExtraItemsItem(str))) {
@Override
@@ -229,7 +267,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);
@@ -10,8 +10,8 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import com.bencodez.advancedcore.api.command.TabCompleteHandler;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.command.AdvancedCoreTabCompleteHandler;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
/**
@@ -32,15 +32,15 @@ public class AdminVoteTabCompleter implements TabCompleter {
@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String alias, String[] args) {
List<String> tab = new ArrayList<String>();
List<String> tab = new ArrayList<>();
Set<String> cmds = new HashSet<String>();
Set<String> cmds = new HashSet<>();
cmds.addAll(TabCompleteHandler.getInstance().getTabCompleteOptions(plugin.getAdminVoteCommand(), sender, args,
args.length - 1));
cmds.addAll(AdvancedCoreTabCompleteHandler.getInstance().getTabCompleteOptions(plugin.getAdminVoteCommand(),
sender, args, args.length - 1));
for (String str : cmds) {
if (StringParser.getInstance().startsWithIgnoreCase(str, args[args.length - 1])) {
if (MessageAPI.startsWithIgnoreCase(str, args[args.length - 1])) {
tab.add(str);
}
}
@@ -12,9 +12,9 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import com.bencodez.advancedcore.api.command.CommandHandler;
import com.bencodez.advancedcore.api.command.TabCompleteHandler;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.simpleapi.array.ArrayUtils;
import com.bencodez.simpleapi.command.TabCompleteHandler;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
/**
@@ -39,19 +39,19 @@ public class AliasesTabCompleter implements TabCompleter {
*/
@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String alias, String[] argsIn) {
ArrayList<String> msgArray = new ArrayList<String>();
ArrayList<String> msgArray = new ArrayList<>();
msgArray.add("");
for (String arg : argsIn) {
msgArray.add(arg);
}
String[] args = ArrayUtils.getInstance().convert(msgArray);
String[] args = ArrayUtils.convert(msgArray);
ArrayList<String> tab = new ArrayList<String>();
ArrayList<String> tab = new ArrayList<>();
Set<String> cmds = new HashSet<String>();
Set<String> cmds = new HashSet<>();
ArrayList<CommandHandler> cmdHandlers = new ArrayList<CommandHandler>();
ArrayList<CommandHandler> cmdHandlers = new ArrayList<>();
if (adminCommand) {
cmdHandlers.addAll(plugin.getAdminVoteCommand());
@@ -88,7 +88,7 @@ public class AliasesTabCompleter implements TabCompleter {
}
for (String str : cmds) {
if (StringParser.getInstance().startsWithIgnoreCase(str, args[args.length - 1])) {
if (MessageAPI.startsWithIgnoreCase(str, args[args.length - 1])) {
tab.add(str);
}
}
@@ -10,8 +10,8 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import com.bencodez.advancedcore.api.command.TabCompleteHandler;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.command.AdvancedCoreTabCompleteHandler;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
// TODO: Auto-generated Javadoc
@@ -33,15 +33,15 @@ public class VoteTabCompleter implements TabCompleter {
@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String alias, String[] args) {
ArrayList<String> tab = new ArrayList<String>();
ArrayList<String> tab = new ArrayList<>();
Set<String> cmds = new HashSet<String>();
Set<String> cmds = new HashSet<>();
cmds.addAll(TabCompleteHandler.getInstance().getTabCompleteOptions(plugin.getVoteCommand(), sender, args,
args.length - 1));
cmds.addAll(AdvancedCoreTabCompleteHandler.getInstance().getTabCompleteOptions(plugin.getVoteCommand(), sender,
args, args.length - 1));
for (String str : cmds) {
if (StringParser.getInstance().startsWithIgnoreCase(str, args[args.length - 1])) {
if (MessageAPI.startsWithIgnoreCase(str, args[args.length - 1])) {
tab.add(str);
}
}
@@ -3,12 +3,12 @@ package com.bencodez.votingplugin.config;
import java.io.File;
import java.util.ArrayList;
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.ConfigDataListString;
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataString;
import com.bencodez.simpleapi.file.YMLFile;
import com.bencodez.simpleapi.file.annotation.AnnotationHandler;
import com.bencodez.simpleapi.file.annotation.ConfigDataBoolean;
import com.bencodez.simpleapi.file.annotation.ConfigDataInt;
import com.bencodez.simpleapi.file.annotation.ConfigDataListString;
import com.bencodez.simpleapi.file.annotation.ConfigDataString;
import com.bencodez.votingplugin.VotingPluginMain;
import lombok.Getter;
@@ -31,6 +31,34 @@ public class BungeeSettings extends YMLFile {
@Getter
private String bungeeMethod = "PLUGINMESSAGING";
@ConfigDataString(path = "Redis.Host")
@Getter
private String RedisHost = "";
@ConfigDataString(path = "Redis.Username")
@Getter
private String RedisUsername = "";
@ConfigDataString(path = "PluginMessageChannel")
@Getter
private String pluginMessagingChannel = "vp:vp";
@ConfigDataBoolean(path = "PluginMessageEncryption")
@Getter
private boolean pluginMessageEncryption = false;
@ConfigDataString(path = "Redis.Prefix")
@Getter
private String RedisPrefix = "";
@ConfigDataString(path = "Redis.Password")
@Getter
private String RedisPassword = "";
@ConfigDataInt(path = "Redis.Port")
@Getter
private int RedisPort = 6379;
@ConfigDataString(path = "BungeeServer.Host")
@Getter
private String bungeeServerHost = "";
@@ -47,6 +75,10 @@ public class BungeeSettings extends YMLFile {
@Getter
private boolean perServerMilestones = false;
@ConfigDataBoolean(path = "GiveExtraAllSitesRewards")
@Getter
private boolean giveExtraAllSitesRewards = false;
@ConfigDataBoolean(path = "PerServerRewards")
@Getter
private boolean perServerRewards = false;
@@ -93,7 +125,7 @@ public class BungeeSettings extends YMLFile {
@ConfigDataListString(path = "BungeeVotePartyGlobalCommands")
@Getter
private ArrayList<String> bungeeVotePartyGlobalCommands = new ArrayList<String>();
private ArrayList<String> bungeeVotePartyGlobalCommands = new ArrayList<>();
public BungeeSettings(VotingPluginMain plugin) {
super(plugin, new File(plugin.getDataFolder(), "BungeeSettings.yml"));
@@ -7,13 +7,14 @@ import java.util.Set;
import org.bukkit.configuration.ConfigurationSection;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
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.ConfigDataListString;
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataString;
import com.bencodez.simpleapi.array.ArrayUtils;
import com.bencodez.simpleapi.file.YMLFile;
import com.bencodez.simpleapi.file.annotation.AnnotationHandler;
import com.bencodez.simpleapi.file.annotation.ConfigDataBoolean;
import com.bencodez.simpleapi.file.annotation.ConfigDataInt;
import com.bencodez.simpleapi.file.annotation.ConfigDataKeys;
import com.bencodez.simpleapi.file.annotation.ConfigDataListString;
import com.bencodez.simpleapi.file.annotation.ConfigDataString;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.placeholders.PlaceholderCacheLevel;
import com.bencodez.votingplugin.topvoter.TopVoter;
@@ -34,14 +35,30 @@ public class Config extends YMLFile {
@Getter
private boolean addTotals = true;
@ConfigDataBoolean(path = "AddTotalsOffline")
@Getter
private boolean addTotalsOffline = true;
@ConfigDataBoolean(path = "LoadInteralExpansion")
@Getter
private boolean loadInteralExpansion = true;
@ConfigDataBoolean(path = "PerSiteCoolDownEvents")
@Getter
private boolean perSiteCoolDownEvents = false;
@ConfigDataInt(path = "LimitVotePoints")
@Getter
private int limitVotePoints = -1;
@ConfigDataBoolean(path = "QueueVotesDuringTimeChange")
@Getter
private boolean queueVotesDuringTimeChange = false;
@ConfigDataBoolean(path = "AdvancedServiceSiteHandling")
@Getter
private boolean advancedServiceSiteHandling = false;
@ConfigDataBoolean(path = "AllowUnjoined")
@Getter
private boolean allowUnjoined = false;
@@ -66,6 +83,14 @@ public class Config extends YMLFile {
@Getter
private boolean alwaysCloseInventory = false;
@ConfigDataBoolean(path = "ExtraVoteShopCheck")
@Getter
private boolean extraVoteShopCheck = true;
@ConfigDataBoolean(path = "TrackShopPurchases")
@Getter
private boolean trackShopPurchases = false;
@ConfigDataBoolean(path = "AlwaysUpdate")
@Getter
private boolean alwaysUpdate = false;
@@ -96,15 +121,15 @@ public class Config extends YMLFile {
@ConfigDataListString(path = "DisabledCommands")
@Getter
private ArrayList<String> disabledCommands = new ArrayList<String>();
private ArrayList<String> disabledCommands = new ArrayList<>();
@ConfigDataListString(path = "DisabledDefaultPermissions")
@Getter
private ArrayList<String> disabledDefaultPermissions = new ArrayList<String>();
private ArrayList<String> disabledDefaultPermissions = new ArrayList<>();
@ConfigDataListString(path = "CachedPlaceholders")
@Getter
private ArrayList<String> cachedPlaceholders = new ArrayList<String>();
private ArrayList<String> cachedPlaceholders = new ArrayList<>();
@ConfigDataBoolean(path = "DisableInteractEvent")
@Getter
@@ -158,6 +183,26 @@ public class Config extends YMLFile {
@Getter
private String formatCommandsVoteLastLastVoted = "%times% ago";
@ConfigDataString(path = "Format.Commands.Vote.GivePoints.NotEnoughPoints")
@Getter
private String formatCommandsVoteGivePointsNotEnoughPoints = "&cNot enough points";
@ConfigDataString(path = "Format.Commands.Vote.GivePoints.NotJoinedServer")
@Getter
private String formatCommandsVoteGivePointsNotJoinedServer = "&c%player% has not joined the server";
@ConfigDataString(path = "Format.Commands.Vote.GivePoints.NumberLowerThanZero")
@Getter
private String formatCommandsVoteGivePointsNumberLowerThanZero = "&cNumber of points needs to be greater than 0";
@ConfigDataString(path = "Format.Commands.Vote.GivePoints.TransferFrom")
@Getter
private String formatCommandsVoteGivePointsTransferFrom = "&c%transfer% points given to %touser%";
@ConfigDataString(path = "Format.Commands.Vote.GivePoints.TransferTo")
@Getter
private String formatCommandsVoteGivePointsTransferTo = "&cYou received %transfer points from %fromuser%";
@ConfigDataString(path = "Format.Commands.Vote.Last.Line", defaultValue = "&3%SiteName%: &6%timeSince% ago")
@Getter
private String formatCommandsVoteLastLine;
@@ -166,6 +211,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;
@@ -176,7 +225,7 @@ public class Config extends YMLFile {
@ConfigDataListString(path = "Format.Commands.Vote.Today.Title")
@Getter
private ArrayList<String> formatCommandsVoteTodayTitle = ArrayUtils.getInstance()
private ArrayList<String> formatCommandsVoteTodayTitle = ArrayUtils
.convert(new String[] { "&cToday's Votes %page%/%maxpage%", "&cPlayerName : VoteSite : Time" });
@ConfigDataString(path = "Format.Commands.Vote.ToggleBroadcasts.Disabled")
@@ -254,6 +303,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;
@@ -280,7 +337,269 @@ public class Config extends YMLFile {
@ConfigDataListString(path = "VotingBroadcastBlacklist")
@Getter
private ArrayList<String> votingBroadcastBlacklist = new ArrayList<String>();
private ArrayList<String> votingBroadcastBlacklist = new ArrayList<>();
@ConfigDataKeys(path = "CustomCommands")
@Getter
private Set<String> customCommands = new HashSet<>();
@ConfigDataKeys(path = "CustomPlaceholderReturns")
@Getter
private Set<String> customPlaceholderReturns = new HashSet<>();
@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;
@ConfigDataBoolean(path = "Format.Commands.Vote.AutoInputSites")
@Getter
private boolean formatCommandsVoteAutoInputSites = true;
@ConfigDataBoolean(path = "Format.Commands.Vote.OnlyShowSitesToVote")
@Getter
private boolean formatCommandsVoteOnlyShowSitesToVote = false;
@ConfigDataListString(path = "Format.Commands.Vote.Best.Lines")
@Getter
private ArrayList<String> formatCommandsVoteBestLines = new ArrayList<>();
@ConfigDataString(path = "Format.Commands.Vote.Best.Title")
@Getter
private String formatCommandsVoteBestTitle = "&3&l%player% Best Votes";
@ConfigDataString(path = "Format.Commands.Vote.Help.HoverColor")
@Getter
private String formatCommandsVoteHelpHoverColor = "AQUA";
@ConfigDataString(path = "Format.Commands.Vote.Help.Line")
@Getter
private String formatCommandsVoteHelpLine = "&6%Command% - &6%HelpMessage%";
@ConfigDataBoolean(path = "Format.Commands.Vote.Help.RequirePermission")
@Getter
private boolean formatCommandsVoteHelpRequirePermission = false;
@ConfigDataString(path = "Format.Commands.Vote.Help.Title")
@Getter
private String formatCommandsVoteHelpTitle = "&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!";
@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!";
@ConfigDataString(path = "Format.Commands.Vote.Next.Info.VoteDelayDaily")
@Getter
private String formatCommandsVoteNextInfoVoteDelayDaily = "%hours% Hours and %minutes% Minutes";
@ConfigDataString(path = "PlaceholderCacheLevel", options = { "AUTO", "SPECIFIC", "NONE" })
@Getter
private String placeholderCacheLevelString = "AUTO";
@ConfigDataString(path = "Format.Commands.Vote.Next.Layout")
@Getter
private String formatCommandsVoteNextLayout = "&3%SiteName%: &6%info%";
@ConfigDataString(path = "Format.Commands.Vote.Next.Title")
@Getter
private String formatCommandsVoteNextTitle = "&3&l%player% Next Votes:";
@ConfigDataString(path = "Format.Commands.Vote.Streak.Title")
@Getter
private String formatCommandsVoteStreakTitle = "&3&l%player% Vote Streak";
@ConfigDataString(path = "Format.Commands.Vote.Sites")
@Getter
private String formatCommandsVoteURLS = "&4%num%: &c&l%SiteName% - &c%url%";
@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%";
@ConfigDataString(path = "Format.Commands.Vote.Top.Title")
@Getter
private String formatCommandVoteTopTitle = "&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!";
@ConfigDataString(path = "Format.NotNumber")
@Getter
private String formatNotNumber = "&cError on &6%arg%&c, number expected!";
@ConfigDataString(path = "Format.PrevPage")
@Getter
private String formatPrevPage = "&aPrevious Page";
@ConfigDataString(path = "Format.ShopFailed")
@Getter
private String formatShopFailedMsg = "&cYou do not have %Points% points to purhcase this!";
@ConfigDataString(path = "Format.ShopNotPurchasable")
@Getter
private String formatShopNotPurchasable = "&cThis item is not buyable!";
@ConfigDataString(path = "Format.ShopPurchase")
@Getter
private String formatShopPurchaseMsg = "&aYou bought the %Identifier% for %Points% Points!";
@ConfigDataString(path = "Format.Signs.TopVoterSign.Line1")
@Getter
private String formatSignTopVoterSignLine1 = "TopVoter: %SiteName%";
@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%";
@ConfigDataString(path = "Format.TimeFormat")
@Getter
private String formatTimeFormat = "EEE, d MMM yyyy HH:mm";
@ConfigDataString(path = "Format.TopVoter.AllTime")
@Getter
private String formatTopVoterAllTime = "AllTime";
@ConfigDataString(path = "Format.TopVoter.Daily")
@Getter
private String formatTopVoterDaily = "Daily";
@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!";
@ConfigDataString(path = "Format.TopVoter.Weekly")
@Getter
private String formatTopVoterWeekly = "Weekly";
@ConfigDataString(path = "Format.UserNotExist")
@Getter
private String formatUserNotExist = "&cUser does not exist: %player%";
@ConfigDataString(path = "Format.InvalidCommand.Vote")
@Getter
private String formatInvalidCommandVote = "&4No valid arguments, see /vote help!";
@ConfigDataString(path = "Format.InvalidCommand.AdminVote")
@Getter
private String formatInvalidCommandAdminVote = "&4No valid arguments, see /adminvote help!";
@ConfigDataBoolean(path = "GiveDefaultPermission")
@Getter
private boolean giveDefaultPermission = true;
@ConfigDataBoolean(path = "LoadTopVoter.AllTime")
@Getter
private boolean loadTopVoterAllTime = true;
@ConfigDataBoolean(path = "LoadTopVoter.Monthly")
@Getter
private boolean loadTopVoterMonthly = true;
@ConfigDataBoolean(path = "LoadTopVoter.Daily")
@Getter
private boolean loadTopVoterDaily = false;
@ConfigDataBoolean(path = "LoadTopVoter.Weekly")
@Getter
private boolean loadTopVoterWeekly = false;
@ConfigDataInt(path = "PointsOnVote")
@Getter
private int pointsOnVote = 1;
@ConfigDataBoolean(path = "PurgeNoDataOnStartup")
@Getter
private boolean purgeNoDataOnStartup = false;
@ConfigDataBoolean(path = "StoreMonthTotalsWithDate")
@Getter
private boolean storeMonthTotalsWithDate = false;
@ConfigDataBoolean(path = "UseMonthDateTotalsAsPrimaryTotal")
@Getter
private boolean useMonthDateTotalsAsPrimaryTotal = false;
@ConfigDataString(path = "RequestAPI.DefaultMethod")
@Getter
private String requestAPIDefaultMethod = "ANVIL";
@ConfigDataListString(path = "RequestAPI.DisabledMethods")
@Getter
private ArrayList<String> requestAPIDisabledMethods = new ArrayList<>();
@ConfigDataBoolean(path = "StoreTopVoters.Daily")
@Getter
private boolean storeTopVotersDaily = false;
@ConfigDataBoolean(path = "StoreTopVoters.Weekly")
@Getter
private boolean storeTopVotersWeekly = false;
@ConfigDataBoolean(path = "TopVoterAwardsTies")
@Getter
private boolean topVoterAwardsTies = true;
@ConfigDataBoolean(path = "TopVoterIgnorePermission")
@Getter
private boolean topVoterIgnorePermission = false;
@ConfigDataBoolean(path = "VoteReminding.Enabled")
@Getter
private boolean voteRemindingEnabled = true;
@ConfigDataInt(path = "VoteReminding.RemindDelay")
@Getter
private int voteRemindingRemindDelay = 30;
@ConfigDataBoolean(path = "VoteReminding.RemindOnLogin")
@Getter
private boolean voteRemindingRemindOnLogin = false;
@ConfigDataBoolean(path = "VoteReminding.RemindOnlyOnce")
@Getter
private boolean voteRemindingRemindOnlyOnce = false;
@ConfigDataString(path = "VoteTopDefault")
@Getter
private String voteTopDefault = "Monthly";
public Config(VotingPluginMain plugin) {
super(plugin, new File(plugin.getDataFolder(), "Config.yml"));
@@ -293,175 +612,23 @@ public class Config extends YMLFile {
*/
@SuppressWarnings("unchecked")
public ArrayList<String> getBlackList() {
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;
}
public Set<String> getCustomPlaceholderReturns() {
Set<String> str = getData().getConfigurationSection("CustomPlaceholderReturns").getKeys(false);
if (str == null) {
str = new HashSet<String>();
}
return str;
}
public Set<String> getCustomPlaceholderReturns(String placeholder) {
Set<String> str = getData().getConfigurationSection("CustomPlaceholderReturns." + placeholder).getKeys(false);
if (str == null) {
str = new HashSet<String>();
}
return str;
}
public String getCustomPlaceholderReturns(String placeholder, String returnString) {
return getData().getString("CustomPlaceholderReturns." + placeholder + "." + returnString, "");
return (ArrayList<String>) getData().getList("BlackList", new ArrayList<>());
}
public ConfigurationSection getCustomCommands(String ident) {
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%");
public Set<String> getCustomPlaceholderReturns(String placeholder) {
Set<String> str = getData().getConfigurationSection("CustomPlaceholderReturns." + placeholder).getKeys(false);
if (str == null) {
str = new HashSet<>();
}
return str;
}
/**
* Gets the broadcast when online.
*
* @return the broadcast when online
*/
public boolean getFormatBroadcastWhenOnline() {
return getData().getBoolean("Format.BroadcastWhenOnline");
}
/**
* Gets the commands vote auto input sites.
*
* @return the commands vote auto input sites
*/
public boolean getFormatCommandsVoteAutoInputSites() {
return getData().getBoolean("Format.Commands.Vote.AutoInputSites");
}
@SuppressWarnings("unchecked")
public ArrayList<String> getFormatCommandsVoteBestLines() {
return (ArrayList<String>) getData().getList("Format.Commands.Vote.Best.Lines", new ArrayList<String>());
}
public String getFormatCommandsVoteBestTitle() {
return getData().getString("Format.Commands.Vote.Best.Title", "&3&l%player% Best Votes");
}
public String getFormatCommandsVoteHelpHoverColor() {
return getData().getString("Format.Commands.Vote.Help.HoverColor", "AQUA");
}
/**
* 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%");
}
/**
* 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");
}
/**
* 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");
}
/**
* 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:");
}
/**
* 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!");
}
/**
* 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");
}
public PlaceholderCacheLevel getPlaceholderCacheLevel() {
return PlaceholderCacheLevel.getCache(getData().getString("PlaceholderCacheLevel", "AUTO"));
}
/**
* 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%");
}
/**
* 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:");
public String getCustomPlaceholderReturns(String placeholder, String returnString) {
return getData().getString("CustomPlaceholderReturns." + placeholder + "." + returnString, "");
}
/**
@@ -471,7 +638,7 @@ public class Config extends YMLFile {
*/
@SuppressWarnings("unchecked")
public ArrayList<String> getFormatCommandsVoteParty() {
ArrayList<String> msg = new ArrayList<String>();
ArrayList<String> msg = new ArrayList<>();
msg.add("&cCurrently at &6%Votes%&c, &6%NeededVotes% &cmore votes to go to reach &6%VotesRequired%");
return (ArrayList<String>) getData().getList("Format.Commands.Vote.Party", msg);
@@ -479,11 +646,7 @@ public class Config extends YMLFile {
@SuppressWarnings("unchecked")
public ArrayList<String> getFormatCommandsVoteStreakLines() {
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");
return (ArrayList<String>) getData().getList("Format.Commands.Vote.Streak.Lines", new ArrayList<>());
}
/**
@@ -493,15 +656,14 @@ public class Config extends YMLFile {
*/
@SuppressWarnings("unchecked")
public ArrayList<String> getFormatCommandsVoteText() {
ArrayList<String> str = new ArrayList<String>();
ArrayList<String> str = new ArrayList<>();
str.add("&4&lVote for our server!");
return (ArrayList<String>) getData().getList("Format.Commands.Vote.Text", str);
}
@SuppressWarnings("unchecked")
public ArrayList<String> getFormatCommandsVoteTotal() {
ArrayList<String> list = (ArrayList<String>) getData().getList("Format.Commands.Vote.Total",
new ArrayList<String>());
ArrayList<String> list = (ArrayList<String>) getData().getList("Format.Commands.Vote.Total", new ArrayList<>());
if (list.isEmpty()) {
list.add("&3&l%player% Total Votes:");
list.add("&3&lDaily Total: &6&l%DailyTotal%");
@@ -516,7 +678,7 @@ public class Config extends YMLFile {
public ArrayList<String> getFormatCommandsVoteTotalAll() {
ArrayList<String> list = (ArrayList<String>) getData().getList("Format.Commands.Vote.TotalAll",
new ArrayList<String>());
new ArrayList<>());
if (list.isEmpty()) {
list.add("&3&lServer Total Votes:");
list.add("&3&lDaily Total: &6&l%DailyTotal%");
@@ -527,169 +689,6 @@ 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%");
}
/**
* 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!");
}
/**
* 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%");
}
/**
* 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%");
}
public String getFormatNextPage() {
return getData().getString("Format.NextPage", "&aNext Page");
}
/**
* Gets the format no perms.
*
* @return the format no perms
*/
public String getFormatNoPerms() {
return getData().getString("Format.NoPerms", "&cYou do not have enough permission!");
}
public String getFormatNotNumber() {
return getData().getString("Format.NotNumber", "&cError on &6%arg%&c, number expected!");
}
public String getFormatPrevPage() {
return getData().getString("Format.PrevPage", "&aPrevious Page");
}
public String getFormatShopFailedMsg() {
return getData().getString("Format.ShopFailed", "&cYou do not have %Points% points to purhcase this!");
}
public String getFormatShopNotPurchasable() {
return getData().getString("Format.ShopNotPurchasable", "&cThis item is not buyable!");
}
public String getFormatShopPurchaseMsg() {
return getData().getString("Format.ShopPurchase", "&aYou bought the %Identifier% for %Points% Points!");
}
/**
* 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%");
}
/**
* 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%");
}
/**
* 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%");
}
/**
* 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");
}
/**
* 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%");
}
/**
* 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%");
}
/**
* Gets the vote help.
*
@@ -697,135 +696,26 @@ public class Config extends YMLFile {
*/
@SuppressWarnings("unchecked")
public ArrayList<String> getFormatVoteHelp() {
return (ArrayList<String>) getData().getList("Format.Commands.Vote.Help.Lines", new ArrayList<String>());
}
public boolean getGiveDefaultPermission() {
return getData().getBoolean("GiveDefaultPermission", true);
return (ArrayList<String>) getData().getList("Format.Commands.Vote.Help.Lines", new ArrayList<>());
}
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);
}
public boolean getLoadTopVoterDaily() {
return getData().getBoolean("LoadTopVoter.Daily", false);
}
public boolean getLoadTopVoterMonthly() {
return getData().getBoolean("LoadTopVoter.Monthly", true);
}
public boolean getLoadTopVoterWeekly() {
return getData().getBoolean("LoadTopVoter.Weekly", false);
}
public int getPointsOnVote() {
return getData().getInt("PointsOnVote", 1);
}
public int getPurgeMin() {
return getData().getInt("PurgeMin", 90);
}
public boolean getPurgeOldData() {
return getData().getBoolean("PurgeOldData");
}
/**
* Gets the request API default method.
*
* @return the request API default method
*/
public String getRequestAPIDefaultMethod() {
return getData().getString("RequestAPI.DefaultMethod", "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>());
}
/**
* Gets the store top voters daily.
*
* @return the store top voters daily
*/
public boolean getStoreTopVotersDaily() {
return getData().getBoolean("StoreTopVoters.Daily");
}
/**
* Gets the store top voters weekly.
*
* @return the store top voters weekly
*/
public boolean getStoreTopVotersWeekly() {
return getData().getBoolean("StoreTopVoters.Weekly");
}
public boolean getTopVoterAwardsTies() {
return getData().getBoolean("TopVoterAwardsTies", true);
}
public boolean getTopVoterIgnorePermission() {
return getData().getBoolean("TopVoterIgnorePermission");
}
/**
* Gets the enabled.
*
* @return the enabled
*/
public boolean getVoteRemindingEnabled() {
return getData().getBoolean("VoteReminding.Enabled");
}
/**
* Gets the remind delay.
*
* @return the remind delay
*/
public int getVoteRemindingRemindDelay() {
return getData().getInt("VoteReminding.RemindDelay", 30);
}
/**
* Gets the remind on login.
*
* @return the remind on login
*/
public boolean getVoteRemindingRemindOnLogin() {
return getData().getBoolean("VoteReminding.RemindOnLogin");
}
/**
* Gets the remind only once.
*
* @return the remind only once
*/
public boolean getVoteRemindingRemindOnlyOnce() {
return getData().getBoolean("VoteReminding.RemindOnlyOnce");
public PlaceholderCacheLevel getPlaceholderCacheLevel() {
return PlaceholderCacheLevel.getCache(getPlaceholderCacheLevelString());
}
/**
@@ -837,10 +727,6 @@ public class Config extends YMLFile {
return "VoteReminding.Rewards";
}
public String getVoteTopDefault() {
return getData().getString("VoteTopDefault", "Monthly");
}
@Override
public void loadValues() {
new AnnotationHandler().load(getData(), this);
@@ -13,9 +13,10 @@ import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.advancedcore.api.yml.YMLFile;
import com.bencodez.advancedcore.api.rewards.DirectlyDefinedReward;
import com.bencodez.simpleapi.array.ArrayUtils;
import com.bencodez.simpleapi.file.YMLFile;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.objects.VoteSite;
@@ -47,16 +48,63 @@ public class ConfigVoteSites extends YMLFile {
setServiceSite(siteName, org);
setVoteURL(siteName, "VoteURL");
setVoteDelay(siteName, 24);
set(siteName, "DisplayItem.Material", "GRASS");
set(siteName, "DisplayItem.Material", "STONE");
set(siteName, "DisplayItem.Amount", 1);
set(siteName, "Rewards.Messages.Player", "&aThanks for voting on %ServiceSite%!");
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 "
+ siteName + ", please check console for details"));
p.sendMessage(MessageAPI.colorize("&cGenerating votesite for service site " + siteName
+ ", please check console for details"));
}
}
}
@@ -90,6 +138,10 @@ public class ConfigVoteSites extends YMLFile {
return getData(site).getConfigurationSection("Item");
}
public String getPermissionToView(String siteName) {
return getData(siteName).getString("PermissionToView", "");
}
/**
* Gets the priority.
*
@@ -120,10 +172,6 @@ public class ConfigVoteSites extends YMLFile {
return getData(siteName).getString("ServiceSite");
}
public int getTimeOffSet(String siteName) {
return getData(siteName).getInt("TimeOffSet", 0);
}
/**
* Gets the vote delay.
*
@@ -134,6 +182,10 @@ public class ConfigVoteSites extends YMLFile {
return getData(siteName).getDouble("VoteDelay", 24);
}
public int getVoteDelayDailyHour(String siteName) {
return getData(siteName).getInt("VoteDelayDailyHour", 0);
}
public double getVoteDelayMin(String siteName) {
return getData(siteName).getDouble("VoteDelayMin", 0);
}
@@ -191,7 +243,7 @@ public class ConfigVoteSites extends YMLFile {
* @return the vote sites load
*/
public ArrayList<VoteSite> getVoteSitesLoad() {
ArrayList<VoteSite> voteSites = new ArrayList<VoteSite>();
ArrayList<VoteSite> voteSites = new ArrayList<>();
ArrayList<String> voteSiteNames = getVoteSitesNames(true);
if (voteSiteNames != null) {
for (String site : voteSiteNames) {
@@ -228,9 +280,9 @@ public class ConfigVoteSites extends YMLFile {
}
public ArrayList<String> getVoteSitesNames(boolean checkEnabled) {
ArrayList<String> siteNames = new ArrayList<String>();
ArrayList<String> siteNames = new ArrayList<>();
if (getData().isConfigurationSection("VoteSites")) {
siteNames = ArrayUtils.getInstance().convert(getData().getConfigurationSection("VoteSites").getKeys(false));
siteNames = ArrayUtils.convert(getData().getConfigurationSection("VoteSites").getKeys(false));
}
for (int i = siteNames.size() - 1; i >= 0; i--) {
@@ -257,7 +309,7 @@ public class ConfigVoteSites extends YMLFile {
* @return the vote URL
*/
public String getVoteURL(String siteName) {
return getData(siteName).getString("VoteURL");
return getData(siteName).getString("VoteURL", "");
}
public boolean getWaitUntilVoteDelay(String siteName) {
@@ -7,13 +7,15 @@ import java.util.Set;
import org.bukkit.configuration.ConfigurationSection;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
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.ConfigDataListString;
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataString;
import com.bencodez.simpleapi.array.ArrayUtils;
import com.bencodez.simpleapi.file.YMLFile;
import com.bencodez.simpleapi.file.annotation.AnnotationHandler;
import com.bencodez.simpleapi.file.annotation.ConfigDataBoolean;
import com.bencodez.simpleapi.file.annotation.ConfigDataConfigurationSection;
import com.bencodez.simpleapi.file.annotation.ConfigDataInt;
import com.bencodez.simpleapi.file.annotation.ConfigDataKeys;
import com.bencodez.simpleapi.file.annotation.ConfigDataListString;
import com.bencodez.simpleapi.file.annotation.ConfigDataString;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.topvoter.TopVoter;
@@ -33,47 +35,27 @@ 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";
@ConfigDataListString(path = "BOOK.VoteURLBookGUI.Layout")
@Getter
private ArrayList<String> bookVoteURLBookGUILayout = ArrayUtils.getInstance()
private ArrayList<String> bookVoteURLBookGUILayout = ArrayUtils
.convert(new String[] { "&c%Sitename%", "[UrlText]" });
@ConfigDataListString(path = "BOOK.VoteURLBookGUI.TopLayout")
@Getter
private ArrayList<String> bookVoteURLBookGUITopLayout = new ArrayList<>();
@ConfigDataString(path = "BOOK.VoteURLBookGUI.Title")
@Getter
private String bookVoteURLBookGUITitle = "&cVoteURL";
@Getter
@ConfigDataConfigurationSection(path = "CHEST.ShopConfirmPurchase.NoItem")
private ConfigurationSection chestShopConfirmPurchaseNoItem;
@Getter
@ConfigDataString(path = "CHEST.ShopConfirmPurchase.Title")
private String chestShopConfirmPurchaseTitle = "Confirm Purchase?";
@Getter
@ConfigDataConfigurationSection(path = "CHEST.ShopConfirmPurchase.YesItem")
private ConfigurationSection chestShopConfirmPurchaseYesItem;
@Getter
@ConfigDataString(path = "CHEST.VoteShopDisabled")
private String chestVoteShopDisabled = "&cVote shop disabled";
@ConfigDataBoolean(path = "CHEST.VoteShopHideLimitedReached")
@Getter
private boolean chestVoteShopHideLimitedReached = true;
@ConfigDataString(path = "CHEST.VoteShopLimitReached")
@Getter
private String chestVoteShopLimitReached = "&aYou reached your limit";
@ConfigDataBoolean(path = "CHEST.VoteShopRequireConfirmation")
@Getter
private boolean chestVoteShopRequireConfirmation = false;
@ConfigDataBoolean(path = "CHEST.VoteBest.BackButton")
@Getter
private boolean chestVoteBestBackButton = true;
@@ -152,77 +134,244 @@ public class GUI extends YMLFile {
private VotingPluginMain plugin;
@ConfigDataConfigurationSection(path = "CHEST.BackButton")
@Getter
private ConfigurationSection CHESTBackButton;
@ConfigDataConfigurationSection(path = "CHEST.VoteBest.DayBest.Item")
@Getter
private ConfigurationSection chestVoteBestDayBestItem;
@ConfigDataConfigurationSection(path = "CHEST.VoteBest.MonthBest.Item")
@Getter
private ConfigurationSection chestVoteBestMonthBestItem;
@ConfigDataString(path = "CHEST.VoteBest.Name")
@Getter
private String chestVoteBestName = "VoteBest: %player%";
@ConfigDataConfigurationSection(path = "CHEST.VoteBest.WeekBest.Item")
@Getter
private ConfigurationSection chestVoteBestWeekBestItem;
@ConfigDataString(path = "CHEST.VoteGUIName")
@Getter
private String chestVoteGUIName = "&cVoteGUI: &c&l%player%";
@ConfigDataKeys(path = "CHEST.VoteGUI")
@Getter
private Set<String> chestVoteGUISlots = new HashSet<>();
@ConfigDataConfigurationSection(path = "CHEST.VoteTop.Customization")
@Getter
private ConfigurationSection chestVoteTopCustomization;
@ConfigDataBoolean(path = "CHEST.VoteLast.BackButton")
@Getter
private boolean chestVoteLastBackButton = false;
@ConfigDataString(path = "CHEST.VoteLast.Line")
@Getter
private String chestVoteLastLine = "&6%timeSince%";
@ConfigDataString(path = "CHEST.VoteLast.Name")
@Getter
private String chestVoteLastName = "VoteLast: %player%";
@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%";
@ConfigDataString(path = "CHEST.VoteRewardName")
@Getter
private String chestVoteRewardName = "VoteReward";
@ConfigDataBoolean(path = "CHEST.VoteStreak.BackButton")
@Getter
private boolean chestVoteStreakBackButton = false;
@ConfigDataConfigurationSection(path = "CHEST.VoteStreak.CurrentDayStreak.Item")
@Getter
private ConfigurationSection chestVoteStreakCurrentDayStreakItem;
@ConfigDataConfigurationSection(path = "CHEST.VoteStreak.CurrentMonthStreak.Item")
@Getter
private ConfigurationSection chestVoteStreakCurrentMonthStreakItem;
@ConfigDataConfigurationSection(path = "CHEST.VoteStreak.CurrentWeekStreak.Item")
@Getter
private ConfigurationSection chestVoteStreakCurrentWeekStreakItem;
@ConfigDataConfigurationSection(path = "CHEST.VoteStreak.HighestDayStreak.Item")
@Getter
private ConfigurationSection chestVoteStreakHighestDayStreakItem;
@ConfigDataConfigurationSection(path = "CHEST.VoteStreak.HighestMonthStreak.Item")
@Getter
private ConfigurationSection chestVoteStreakHighestMonthStreakItem;
@ConfigDataConfigurationSection(path = "CHEST.VoteStreak.HighestWeekStreak.Item")
@Getter
private ConfigurationSection chestVoteStreakHighestWeekStreakItem;
@ConfigDataString(path = "CHEST.VoteStreak.Name")
@Getter
private String chestVoteStreakName = "VoteStreak";
@ConfigDataBoolean(path = "CHEST.VoteToday.BackButton")
@Getter
private boolean chestVoteTodayBackButton = false;
@ConfigDataString(path = "CHEST.VoteToday.Name")
@Getter
private String chestVoteTodayName = "VoteToday";
@ConfigDataBoolean(path = "CHEST.VoteTop.BackButton")
@Getter
private boolean chestVoteTopBackButton = false;
@ConfigDataString(path = "CHEST.VoteTop.Item.Lore")
@Getter
private String chestVoteTopItemLore = "&3&lVotes: &3%votes%";
@ConfigDataString(path = "CHEST.VoteTop.Item.Name")
@Getter
private String chestVoteTopItemName = "&3&l%position%: &3%player%";
@ConfigDataString(path = "CHEST.VoteTop.Name")
@Getter
private String chestVoteTopName = "VoteTop %topvoter%";
@ConfigDataBoolean(path = "CHEST.VoteTop.OpenMainGUIOnClick")
@Getter
private boolean chestVoteTopOpenMainGUIOnClick = true;
@ConfigDataBoolean(path = "CHEST.VoteTop.CloseGUIOnClick")
@Getter
private boolean chestVoteTopCloseGUIOnClick = true;
@ConfigDataInt(path = "CHEST.VoteTop.Size")
@Getter
private int chestVoteTopSize = 27;
@ConfigDataConfigurationSection(path = "CHEST.VoteTop.SwitchItem")
@Getter
private ConfigurationSection chestVoteTopSwitchItem;
@ConfigDataListString(path = "CHEST.VoteTop.SwitchItem.TopVoters")
@Getter
private ArrayList<String> chestVoteTopSwitchItemTopVoters = new ArrayList<>();
@ConfigDataConfigurationSection(path = "CHEST.VoteTotal.AllTimeTotal.Item")
@Getter
private ConfigurationSection chestVoteTotalAllTimeTotalItem;
@ConfigDataBoolean(path = "CHEST.VoteTotal.BackButton")
@Getter
private boolean chestVoteTotalBackButton = false;
@ConfigDataConfigurationSection(path = "CHEST.VoteTotal.DayTotal.Item")
@Getter
private ConfigurationSection chestVoteTotalDayTotalItem;
@ConfigDataConfigurationSection(path = "CHEST.VoteTotal.MonthTotal.Item")
@Getter
private ConfigurationSection chestVoteTotalMonthTotalItem;
@ConfigDataString(path = "CHEST.VoteTotal.Name")
@Getter
private String chestVoteTotalName = "VoteTotal: %player%";
@ConfigDataConfigurationSection(path = "CHEST.VoteTotal.WeekTotal.Item")
@Getter
private ConfigurationSection chestVoteTotalWeekTotalItem;
@ConfigDataInt(path = "CHEST.VoteURL.AllUrlsButton.Slot")
@Getter
private int chestVoteURLAllUrlsButtonSlot = -1;
@ConfigDataInt(path = "CHEST.VoteURL.StartSlot")
@Getter
private int chestVoteURLAllUrlsButtonStartSlot = -1;
@ConfigDataConfigurationSection(path = "CHEST.VoteURL.AllUrlsButton.AlreadyVotedItem", secondPath = "CHEST.VoteURL.AlreadyVotedItem")
@Getter
private ConfigurationSection chestVoteURLAlreadyVotedAllUrlsButtonItemSection;
@ConfigDataConfigurationSection(path = "CHEST.VoteURL.AlreadyVotedItem")
@Getter
private ConfigurationSection chestVoteURLAlreadyVotedItemSection;
@ConfigDataBoolean(path = "CHEST.VoteURL.BackButton")
@Getter
private boolean chestVoteURLBackButton = false;
@ConfigDataConfigurationSection(path = "CHEST.VoteURL.AllUrlsButton.CanVoteItem", secondPath = "CHEST.VoteURL.CanVoteItem")
@Getter
private ConfigurationSection chestVoteURLCanVoteAllUrlsButtonItemSection;
@ConfigDataConfigurationSection(path = "CHEST.VoteURL.CanVoteItem")
@Getter
private ConfigurationSection chestVoteURLCanVoteItemSection;
@ConfigDataKeys(path = "CHEST.VoteURL.ExtraItems")
@Getter
private Set<String> chestVoteURLExtraItems = new HashSet<>();
@ConfigDataString(path = "CHEST.VoteURL.SiteName")
@Getter
private String chestVoteURLGUISiteName = "&c%Name%";
@ConfigDataString(path = "CHEST.VoteURL.SiteNameCanVote")
@Getter
private String chestVoteURLGUISiteNameCanVote = "&a%Name%";
@ConfigDataString(path = "CHEST.VoteURL.Name")
@Getter
private String chestVoteURLName = "&cVoteURL";
@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";
@ConfigDataString(path = "CHEST.VoteURLSite.Name")
@Getter
private String chestVoteURLSiteName = "VoteSite %site%";
@ConfigDataString(path = "CHEST.VoteURL.URLText")
@Getter
private String chestVoteURLURLText = "%VoteUrl%";
@ConfigDataBoolean(path = "CHEST.VoteURL.ViewAllUrlsButtonEnabled")
@Getter
private boolean chestVoteURLViewAllUrlsButtonEnabled = false;
public GUI(VotingPluginMain plugin) {
super(plugin, new File(plugin.getDataFolder(), "GUI.yml"));
this.plugin = plugin;
}
public void createShop(String value) {
ConfigurationSection shopData = getData().createSection("CHEST.Shop." + value);
shopData.set("Identifier_Name", value);
shopData.set("Material", "STONE");
shopData.set("Amount", 1);
shopData.set("Name", "&cPlaceholder item");
shopData.set("Cost", 1);
shopData.set("Permission", "");
shopData.set("CloseGUI", true);
shopData.set("RequireConfirmation", false);
shopData.set("Rewards.Items.Item1.Material", "STONE");
shopData.set("Rewards.Items.Item1.Amount", 1);
saveData();
}
public ConfigurationSection getCHESTBackButton() {
return getData().getConfigurationSection("CHEST.BackButton");
}
public int getChestShopIdentifierCost(String identifier) {
return getData().getInt("CHEST.Shop." + identifier + ".Cost");
}
public String getChestShopIdentifierIdentifierName(String identifier) {
return getData().getString("CHEST.Shop." + identifier + ".Identifier_Name", identifier);
}
public int getChestShopIdentifierLimit(String identifier) {
return getData().getInt("CHEST.Shop." + identifier + ".Limit", -1);
}
public String getChestShopIdentifierRewardsPath(String identifier) {
return "CHEST.Shop." + identifier + ".Rewards";
}
public Set<String> getChestShopIdentifiers() {
ConfigurationSection shop = getData().getConfigurationSection("CHEST.Shop");
if (shop != null) {
return shop.getKeys(false);
public Set<String> getChestGUIExtraItems(String gui) {
if (getData().isConfigurationSection("CHEST." + gui + ".ExtraItems")) {
return getData().getConfigurationSection("CHEST." + gui + ".ExtraItems").getKeys(false);
}
return new HashSet<String>();
return new HashSet<>();
}
public ConfigurationSection getChestShopIdentifierSection(String identifier) {
return getData().getConfigurationSection("CHEST.Shop." + identifier);
}
public ConfigurationSection getChestVoteBestDayBestItem() {
return getData().getConfigurationSection("CHEST.VoteBest.DayBest.Item");
}
public ConfigurationSection getChestVoteBestMonthBestItem() {
return getData().getConfigurationSection("CHEST.VoteBest.MonthBest.Item");
}
public String getChestVoteBestName() {
return getData().getString("CHEST.VoteBest.Name", "VoteBest: %player%");
}
public ConfigurationSection getChestVoteBestWeekBestItem() {
return getData().getConfigurationSection("CHEST.VoteBest.WeekBest.Item");
}
public String getChestVoteGUIName() {
return getData().getString("CHEST.VoteGUIName", "&cVoteGUI: &c&l%player%");
public ConfigurationSection getChestGUIExtraItemsItem(String gui, String item) {
return getData().getConfigurationSection("CHEST." + gui + ".ExtraItems." + item);
}
/**
@@ -244,34 +393,17 @@ public class GUI extends YMLFile {
*/
@SuppressWarnings("unchecked")
public ArrayList<String> getChestVoteGUISlotLore(String slot) {
return (ArrayList<String>) getData().getList("CHEST.VoteGUI." + slot + ".Item.Lore", new ArrayList<String>());
return (ArrayList<String>) getData().getList("CHEST.VoteGUI." + slot + ".Item.Lore", new ArrayList<>());
}
public String getChestVoteGUISlotRewardsPath(String slot, String lastPath) {
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>();
}
}
public ConfigurationSection getChestVoteGUISlotSection(String slot) {
return getData().getConfigurationSection("CHEST.VoteGUI." + slot + ".Item");
}
public ConfigurationSection getChestVoteTopCustomization() {
return getData().getConfigurationSection("CHEST.VoteTop.Customization");
}
/**
* Gets the vote GUI slot slot.
*
@@ -282,168 +414,10 @@ public class GUI extends YMLFile {
return getData().getInt("CHEST.VoteGUI." + slot + ".Slot", -1);
}
public boolean getChestVoteLastBackButton() {
return getData().getBoolean("CHEST.VoteLast.BackButton");
}
public String getChestVoteLastLine() {
return getData().getString("CHEST.VoteLast.Line", "&6%timeSince%");
}
public String getChestVoteLastName() {
return getData().getString("CHEST.VoteLast.Name", "VoteLast: %player%");
}
public boolean getChestVoteNextBackButton() {
return getData().getBoolean("CHEST.VoteNext.BackButton");
}
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");
}
public boolean getChestVoteShopBackButton() {
return getData().getBoolean("CHEST.VoteShopBackButton", true);
}
public boolean getChestVoteShopCloseGUI(String shop) {
return getData().getBoolean("CHEST.Shop." + shop + ".CloseGUI", true);
}
public boolean getChestVoteShopEnabled() {
return getData().getBoolean("CHEST.VoteShopEnabled", true);
}
public String getChestVoteShopName() {
return getData().getString("CHEST.VoteShopName", "VoteShop");
}
public boolean getChestVoteShopNotBuyable(String shop) {
return getData().getBoolean("CHEST.Shop." + shop + ".NotBuyable", false);
}
public String getChestVoteShopPermission(String ident) {
return getData().getString("CHEST.Shop." + ident + ".Permission", "");
}
public String getCHESTVoteShopPurchase(String identifier) {
return getData().getString("CHEST.Shop." + identifier + ".PurchaseMessage",
plugin.getConfigFile().getFormatShopPurchaseMsg());
}
public boolean getChestVoteShopResetDaily(String shop) {
return getData().getBoolean("CHEST.Shop." + shop + ".Reset.Daily", false);
}
public boolean getChestVoteShopResetMonthly(String shop) {
return getData().getBoolean("CHEST.Shop." + shop + ".Reset.Monthly", false);
}
public boolean getChestVoteShopResetWeekly(String shop) {
return getData().getBoolean("CHEST.Shop." + shop + ".Reset.Weekly", false);
}
public boolean getChestVoteStreakBackButton() {
return getData().getBoolean("CHEST.VoteStreak.BackButton");
}
public ConfigurationSection getChestVoteStreakCurrentDayStreakItem() {
return getData().getConfigurationSection("CHEST.VoteStreak.CurrentDayStreak.Item");
}
public ConfigurationSection getChestVoteStreakCurrentMonthStreakItem() {
return getData().getConfigurationSection("CHEST.VoteStreak.CurrentMonthStreak.Item");
}
public ConfigurationSection getChestVoteStreakCurrentWeekStreakItem() {
return getData().getConfigurationSection("CHEST.VoteStreak.CurrentWeekStreak.Item");
}
public ConfigurationSection getChestVoteStreakHighestDayStreakItem() {
return getData().getConfigurationSection("CHEST.VoteStreak.HighestDayStreak.Item");
}
public ConfigurationSection getChestVoteStreakHighestMonthStreakItem() {
return getData().getConfigurationSection("CHEST.VoteStreak.HighestMonthStreak.Item");
}
public ConfigurationSection getChestVoteStreakHighestWeekStreakItem() {
return getData().getConfigurationSection("CHEST.VoteStreak.HighestWeekStreak.Item");
}
public String getChestVoteStreakName() {
return getData().getString("CHEST.VoteStreak.Name", "VoteStreak");
}
public boolean getChestVoteTodayBackButton() {
return getData().getBoolean("CHEST.VoteToday.BackButton");
}
public String getChestVoteTodayName() {
return getData().getString("CHEST.VoteToday.Name", "VoteToday");
}
public boolean getChestVoteTopBackButton() {
return getData().getBoolean("CHEST.VoteTop.BackButton");
}
public String getChestVoteTopItemLore() {
return getData().getString("CHEST.VoteTop.Item.Lore", "&3&lVotes: &3%votes%");
}
public String getChestVoteTopItemName() {
return getData().getString("CHEST.VoteTop.Item.Name", "&3&l%position%: &3%player%");
}
public String getChestVoteTopName() {
return getData().getString("CHEST.VoteTop.Name", "VoteTop %topvoter%");
}
public boolean getChestVoteTopOpenMainGUIOnClick() {
return getData().getBoolean("CHEST.VoteTop.OpenMainGUIOnClick", true);
}
public boolean getChestVoteTopCloseGUIOnClick() {
return getData().getBoolean("CHEST.VoteTop.CloseGUIOnClick", true);
}
public int getChestVoteTopSize() {
return getData().getInt("CHEST.VoteTop.Size", 27);
}
public ConfigurationSection getChestVoteTopSwitchItem() {
return getData().getConfigurationSection("CHEST.VoteTop.SwitchItem");
}
@SuppressWarnings("unchecked")
public ArrayList<String> getChestVoteTopSwitchItemTopVoters() {
return (ArrayList<String>) getData().getList("CHEST.VoteTop.SwitchItem.TopVoters", new ArrayList<String>());
}
public ConfigurationSection getChestVoteTotalAllTimeTotalItem() {
return getData().getConfigurationSection("CHEST.VoteTotal.AllTimeTotal.Item");
}
public boolean getChestVoteTotalBackButton() {
return getData().getBoolean("CHEST.VoteTotal.BackButton");
}
public ConfigurationSection getChestVoteTotalDayTotalItem() {
return getData().getConfigurationSection("CHEST.VoteTotal.DayTotal.Item");
}
public ConfigurationSection getChestVoteTotalItem(TopVoter top) {
switch (top) {
case AllTime:
@@ -460,145 +434,10 @@ public class GUI extends YMLFile {
}
}
public ConfigurationSection getChestVoteTotalMonthTotalItem() {
return getData().getConfigurationSection("CHEST.VoteTotal.MonthTotal.Item");
}
public String getChestVoteTotalName() {
return getData().getString("CHEST.VoteTotal.Name", "VoteTotal: %player%");
}
public ConfigurationSection getChestVoteTotalWeekTotalItem() {
return getData().getConfigurationSection("CHEST.VoteTotal.WeekTotal.Item");
}
public int getChestVoteURLAllUrlsButtonSlot() {
return getData().getInt("CHEST.VoteURL.AllUrlsButton.Slot", -1);
}
public int getChestVoteURLAllUrlsButtonStartSlot() {
return getData().getInt("CHEST.VoteURL.StartSlot", -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");
}
}
public ConfigurationSection getChestVoteURLAlreadyVotedItemSection() {
return getData().getConfigurationSection("CHEST.VoteURL.AlreadyVotedItem");
}
public boolean getChestVoteURLBackButton() {
return getData().getBoolean("CHEST.VoteURL.BackButton");
}
public ConfigurationSection getChestVoteURLCanVoteAllUrlsButtonItemSection() {
if (getData().isConfigurationSection("CHEST.VoteURL.AllUrlsButton.CanVoteItem")) {
return getData().getConfigurationSection("CHEST.VoteURL.AllUrlsButton.CanVoteItem");
} else {
return getData().getConfigurationSection("CHEST.VoteURL.CanVoteItem");
}
}
public ConfigurationSection getChestVoteURLCanVoteItemSection() {
return getData().getConfigurationSection("CHEST.VoteURL.CanVoteItem");
}
public Set<String> getChestVoteURLExtraItems() {
if (getData().isConfigurationSection("CHEST.VoteURL.ExtraItems")) {
return getData().getConfigurationSection("CHEST.VoteURL.ExtraItems").getKeys(false);
}
return new HashSet<String>();
}
public ConfigurationSection getChestVoteURLExtraItemsItem(String item) {
return getData().getConfigurationSection("CHEST.VoteURL.ExtraItems." + item);
}
public Set<String> getChestGUIExtraItems(String gui) {
if (getData().isConfigurationSection("CHEST." + gui + ".ExtraItems")) {
return getData().getConfigurationSection("CHEST." + gui + ".ExtraItems").getKeys(false);
}
return new HashSet<String>();
}
public ConfigurationSection getChestGUIVoteShopExtraItems(String item) {
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>();
}
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%");
}
public String getChestVoteURLGUISiteNameCanVote() {
return getData().getString("CHEST.VoteURL.SiteNameCanVote", "&a%Name%");
}
public String getChestVoteURLName() {
return getData().getString("CHEST.VoteURL.Name", "&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%");
}
/**
* 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");
}
public String getChestVoteURLSiteName() {
return getData().getString("CHEST.VoteURLSite.Name", "VoteSite %site%");
}
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");
}
public boolean isChestVoteShopRequireConfirmation(String identifier) {
return getData().getBoolean("CHEST.Shop." + identifier + ".RequireConfirmation",
isChestVoteShopRequireConfirmation());
}
@Override
public void loadValues() {
new AnnotationHandler().load(getData(), this);
@@ -608,9 +447,4 @@ public class GUI extends YMLFile {
public void onFileCreation() {
plugin.saveResource("GUI.yml", true);
}
public void removeShop(String value) {
getData().set("CHEST.Shop." + value, null);
saveData();
}
}
@@ -0,0 +1,198 @@
package com.bencodez.votingplugin.config;
import java.io.File;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.configuration.ConfigurationSection;
import com.bencodez.simpleapi.file.YMLFile;
import com.bencodez.simpleapi.file.annotation.AnnotationHandler;
import com.bencodez.simpleapi.file.annotation.ConfigDataBoolean;
import com.bencodez.simpleapi.file.annotation.ConfigDataConfigurationSection;
import com.bencodez.simpleapi.file.annotation.ConfigDataKeys;
import com.bencodez.simpleapi.file.annotation.ConfigDataString;
import com.bencodez.votingplugin.VotingPluginMain;
import lombok.Getter;
public class ShopFile extends YMLFile {
@Getter
@ConfigDataConfigurationSection(path = "ShopConfirmPurchase.NoItem")
private ConfigurationSection shopConfirmPurchaseNoItem;
@Getter
@ConfigDataString(path = "ShopConfirmPurchase.Title")
private String shopConfirmPurchaseTitle = "Confirm Purchase?";
@Getter
@ConfigDataConfigurationSection(path = "ShopConfirmPurchase.YesItem")
private ConfigurationSection shopConfirmPurchaseYesItem;
@Getter
@ConfigDataString(path = "VoteShop.Disabled")
private String voteShopDisabled = "&cVote shop disabled";
@ConfigDataBoolean(path = "VoteShop.HideLimitedReached")
@Getter
private boolean voteShopHideLimitedReached = true;
@ConfigDataString(path = "VoteShop.LimitReached")
@Getter
private String voteShopLimitReached = "&aYou reached your limit";
@ConfigDataBoolean(path = "VoteShop.RequireConfirmation")
@Getter
private boolean voteShopRequireConfirmation = false;
private VotingPluginMain plugin;
@ConfigDataBoolean(path = "VoteShop.BackButton")
@Getter
private boolean voteShopBackButton = true;
@ConfigDataBoolean(path = "VoteShop.ReopenGUIOnPurchase")
@Getter
private boolean voteShopReopenGUIOnPurchase = true;
@ConfigDataBoolean(path = "VoteShop.Enabled")
@Getter
private boolean voteShopEnabled = true;
@ConfigDataString(path = "VoteShop.Name")
@Getter
private String voteShopName = "VoteShop";
@ConfigDataKeys(path = "ExtraItems")
@Getter
private Set<String> voteShopExtraItems = new HashSet<>();
public ShopFile(VotingPluginMain plugin) {
super(plugin, new File(plugin.getDataFolder(), "Shop.yml"));
this.plugin = plugin;
}
public void convertFromGUIFile() {
// booleans
setValue("VoteShop.Enabled", plugin.getGui().getData().getBoolean("CHEST.VoteShopEnabled"));
setValue("VoteShop.BackButton", plugin.getGui().getData().getBoolean("CHEST.VoteShopBackButton"));
setValue("VoteShop.HideLimitReached", plugin.getGui().getData().getBoolean("CHEST.VoteShopHideLimitedReached"));
setValue("VoteShop.RequireConfirmation",
plugin.getGui().getData().getBoolean("CHEST.VoteShopRequireConfirmation"));
setValue("VoteShop.ReopenGUIOnPurchase",
plugin.getGui().getData().getBoolean("CHEST.VoteShopReopenGUIOnPurchase"));
// strings
setValue("VoteShop.Name", plugin.getGui().getData().getString("CHEST.VoteShopName"));
setValue("VoteShop.LimitReached", plugin.getGui().getData().getString("CHEST.VoteShopLimitReached"));
setValue("VoteShop.Disabled", plugin.getGui().getData().getString("CHEST.VoteShopDisabled"));
// sections
setValue("Shop", plugin.getGui().getData().getConfigurationSection("CHEST.Shop"));
setValue("ExtraItems", plugin.getGui().getData().getConfigurationSection("CHEST.VoteShopExtraItems"));
setValue("ShopConfirmPurchase", plugin.getGui().getData().getConfigurationSection("CHEST.ShopConfirmPurchase"));
saveData();
}
public void createShop(String value) {
ConfigurationSection shopData = getData().createSection("Shop." + value);
shopData.set("Identifier_Name", value);
shopData.set("Material", "STONE");
shopData.set("Amount", 1);
shopData.set("Name", "&cPlaceholder item");
shopData.set("Cost", 1);
shopData.set("Permission", "");
shopData.set("CloseGUI", true);
shopData.set("RequireConfirmation", false);
shopData.set("Rewards.Items.Item1.Material", "STONE");
shopData.set("Rewards.Items.Item1.Amount", 1);
saveData();
}
public ConfigurationSection getGUIVoteShopExtraItems(String item) {
return getData().getConfigurationSection("ExtraItems." + item);
}
public int getShopIdentifierCost(String identifier) {
return getData().getInt("Shop." + identifier + ".Cost");
}
public String getShopIdentifierIdentifierName(String identifier) {
return getData().getString("Shop." + identifier + ".Identifier_Name", identifier);
}
public int getShopIdentifierLimit(String identifier) {
return getData().getInt("Shop." + identifier + ".Limit", -1);
}
public String getShopIdentifierRewardsPath(String identifier) {
return "Shop." + identifier + ".Rewards";
}
public Set<String> getShopIdentifiers() {
ConfigurationSection shop = getData().getConfigurationSection("Shop");
if (shop != null) {
return shop.getKeys(false);
}
return new HashSet<>();
}
public ConfigurationSection getShopIdentifierSection(String identifier) {
return getData().getConfigurationSection("Shop." + identifier);
}
public boolean getVoteShopCloseGUI(String shop) {
return getData().getBoolean("Shop." + shop + ".CloseGUI", true);
}
public boolean getVoteShopHideOnNoPermission(String shop) {
return getData().getBoolean("Shop." + shop + ".HideOnNoPermission", true);
}
public boolean getVoteShopNotBuyable(String shop) {
return getData().getBoolean("Shop." + shop + ".NotBuyable", false);
}
public String getVoteShopPermission(String ident) {
return getData().getString("Shop." + ident + ".Permission", "");
}
public String getVoteShopPurchase(String identifier) {
return getData().getString("Shop." + identifier + ".PurchaseMessage",
plugin.getConfigFile().getFormatShopPurchaseMsg());
}
public boolean getVoteShopResetDaily(String shop) {
return getData().getBoolean("Shop." + shop + ".Reset.Daily", false);
}
public boolean getVoteShopResetMonthly(String shop) {
return getData().getBoolean("Shop." + shop + ".Reset.Monthly", false);
}
public boolean getVoteShopResetWeekly(String shop) {
return getData().getBoolean("Shop." + shop + ".Reset.Weekly", false);
}
public boolean isVoteShopRequireConfirmation(String identifier) {
return getData().getBoolean("Shop." + identifier + ".RequireConfirmation", isVoteShopRequireConfirmation());
}
@Override
public void loadValues() {
new AnnotationHandler().load(getData(), this);
}
@Override
public void onFileCreation() {
plugin.saveResource("Shop.yml", true);
}
public void removeShop(String value) {
getData().set("Shop." + value, null);
saveData();
}
}
@@ -6,10 +6,15 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
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.simpleapi.file.YMLFile;
import com.bencodez.simpleapi.file.annotation.AnnotationHandler;
import com.bencodez.simpleapi.file.annotation.ConfigDataBoolean;
import com.bencodez.simpleapi.file.annotation.ConfigDataDouble;
import com.bencodez.simpleapi.file.annotation.ConfigDataInt;
import com.bencodez.simpleapi.file.annotation.ConfigDataKeys;
import com.bencodez.simpleapi.file.annotation.ConfigDataListInt;
import com.bencodez.simpleapi.file.annotation.ConfigDataListString;
import com.bencodez.simpleapi.file.annotation.ConfigDataString;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.topvoter.TopVoter;
@@ -63,6 +68,22 @@ public class SpecialRewardsConfig extends YMLFile {
@Getter
private boolean votePartyResetExtraVotesMonthly = false;
@ConfigDataBoolean(path = "VoteParty.ResetExtraVotesWeekly")
@Getter
private boolean votePartyResetExtraVotesWeekly = false;
@ConfigDataString(path = "VoteParty.VoteReminderBroadcast")
@Getter
private String votePartyVoteReminderBroadcast = "%votesrequired% left to go, go vote!";
@ConfigDataListInt(path = "VoteParty.VoteReminderAtVotes")
@Getter
private ArrayList<Integer> votePartyVoteReminderAtVotes = new ArrayList<>();
@ConfigDataListString(path = "VoteParty.GlobalRandomCommand")
@Getter
private ArrayList<String> votePartyGlobalRandomCommand = new ArrayList<>();
@Getter
private String votePartyRewardsPath = "VoteParty.Rewards";
@@ -82,19 +103,91 @@ public class SpecialRewardsConfig extends YMLFile {
@Getter
private double voteStreakRequirementWeek = 50;
@ConfigDataKeys(path = "Cumulative")
@Getter
private Set<String> cumulativeVotes = new HashSet<>();
@ConfigDataKeys(path = "DailyAwards")
@Getter
private Set<String> dailyPossibleRewardPlaces = new HashSet<>();
@ConfigDataKeys(path = "MileStones")
@Getter
private Set<String> milestoneVotes = new HashSet<>();
@ConfigDataBoolean(path = "ResetMilestonesMonthly")
@Getter
private boolean resetMilestonesMonthly = false;
@ConfigDataString(path = "VoteParty.Broadcast")
@Getter
private String votePartyBroadcast = "";
@ConfigDataListString(path = "VoteParty.GlobalCommands", secondPath = "VoteParty.Commands")
@Getter
private ArrayList<String> votePartyGlobalCommands = new ArrayList<>();
@ConfigDataBoolean(path = "VoteParty.CountFakeVotes")
@Getter
private boolean votePartyCountFakeVotes = true;
@ConfigDataBoolean(path = "VoteParty.CountOfflineVotes")
@Getter
private boolean votePartyCountOfflineVotes = true;
@ConfigDataBoolean(path = "VoteParty.Enabled")
@Getter
private boolean votePartyEnabled = false;
@ConfigDataBoolean(path = "VoteParty.GiveAllPlayers")
@Getter
private boolean votePartyGiveAllPlayers = false;
@Deprecated
@ConfigDataInt(path = "VoteParty.IncreaseVotesRquired")
@Getter
private int votePartyIncreaseVotesRquired = 0;
@ConfigDataInt(path = "VoteParty.IncreaseVotesRequired")
@Getter
private int votePartyIncreaseVotesRequired = 0;
@ConfigDataBoolean(path = "VoteParty.OnlyOncePerDay")
@Getter
private boolean votePartyOnlyOncePerDay = false;
@ConfigDataBoolean(path = "VoteParty.OnlyOncePerWeek")
@Getter
private boolean votePartyOnlyOncePerWeek = false;
@ConfigDataBoolean(path = "VoteParty.ResetEachDay")
@Getter
private boolean votePartyResetEachDay = false;
@ConfigDataBoolean(path = "VoteParty.ResetMonthly")
@Getter
private boolean votePartyResetMonthly = false;
@ConfigDataBoolean(path = "VoteParty.ResetWeekly")
@Getter
private boolean votePartyResetWeekly = false;
@ConfigDataInt(path = "VoteParty.UserVotesRequired")
@Getter
private int votePartyUserVotesRequired = 0;
@ConfigDataInt(path = "VoteParty.VotesRequired")
@Getter
private int votePartyVotesRequired = 0;
@ConfigDataKeys(path = "WeeklyAwards")
@Getter
private Set<String> weeklyPossibleRewardPlaces = new HashSet<>();
public SpecialRewardsConfig(VotingPluginMain plugin) {
super(plugin, new File(plugin.getDataFolder(), "SpecialRewards.yml"));
this.plugin = plugin;
}
public boolean getCumulativeRewardEnabled(int cumulative) {
return getData().getBoolean("Cumulative." + cumulative + ".Enabled");
}
public String getCumulativeRewardsPath(int cumulative) {
return "Cumulative." + cumulative + ".Rewards";
}
public List<Integer> getCumulativeBlackList(int cumulative) {
return getData().getIntegerList("Cumulative." + cumulative + ".BlackList");
}
@@ -103,29 +196,14 @@ 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>();
}
public boolean getCumulativeRewardEnabled(int cumulative) {
return getData().getBoolean("Cumulative." + cumulative + ".Enabled");
}
public String getCumulativeRewardsPath(int cumulative) {
return "Cumulative." + cumulative + ".Rewards";
}
/**
* 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");
@@ -146,9 +224,11 @@ public class SpecialRewardsConfig extends YMLFile {
if (str.isEmpty()) {
if (getCumulativeVotesInSameMonth(cumulative)) {
return TopVoter.Monthly.toString();
} else if (getCumulativeVotesInSameWeek(cumulative)) {
}
if (getCumulativeVotesInSameWeek(cumulative)) {
return TopVoter.Weekly.toString();
} else if (getCumulativeVotesInSameDay(cumulative)) {
}
if (getCumulativeVotesInSameDay(cumulative)) {
return TopVoter.Daily.toString();
}
}
@@ -159,20 +239,6 @@ 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>();
}
}
/**
* Gets the milestone reward enabled.
*
@@ -193,23 +259,6 @@ 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>();
}
}
public String getMonthlyAwardRewardsPath(String path) {
return "MonthlyAwards." + path + ".Rewards";
}
@@ -223,85 +272,16 @@ public class SpecialRewardsConfig extends YMLFile {
try {
return getData().getConfigurationSection("MonthlyAwards").getKeys(false);
} catch (Exception ex) {
return new HashSet<String>();
return new HashSet<>();
}
}
public boolean getResetMilestonesMonthly() {
return getData().getBoolean("ResetMilestonesMonthly");
}
public String getVotePartyBroadcast() {
return getData().getString("VoteParty.Broadcast", "");
}
@SuppressWarnings("unchecked")
public ArrayList<String> getVotePartyGlobalCommands() {
return (ArrayList<String>) getData().getList("VoteParty.GlobalCommands",
(ArrayList<String>) getData().getList("VoteParty.Commands", new ArrayList<String>()));
}
public boolean getVotePartyCountFakeVotes() {
return getData().getBoolean("VoteParty.CountFakeVotes", true);
}
public boolean getVotePartyCountOfflineVotes() {
return getData().getBoolean("VoteParty.CountOfflineVotes", true);
}
/**
* Gets the vote party enabled.
*
* @return the vote party enabled
*/
public boolean getVotePartyEnabled() {
return getData().getBoolean("VoteParty.Enabled");
}
/**
* Gets the vote party give all players.
*
* @return the vote party give all players
*/
public boolean getVotePartyGiveAllPlayers() {
return getData().getBoolean("VoteParty.GiveAllPlayers");
}
public int getVotePartyIncreaseVotesRquired() {
return getData().getInt("VoteParty.IncreaseVotesRquired", 0);
}
public boolean getVotePartyOnlyOncePerDay() {
return getData().getBoolean("VoteParty.OnlyOncePerDay");
}
public boolean getVotePartyOnlyOncePerWeek() {
return getData().getBoolean("VoteParty.OnlyOncePerWeek");
}
public boolean getVotePartyResetEachDay() {
return getData().getBoolean("VoteParty.ResetEachDay");
}
public boolean getVotePartyResetMontly() {
return getData().getBoolean("VoteParty.ResetMonthly");
}
public boolean getVotePartyResetWeekly() {
return getData().getBoolean("VoteParty.ResetWeekly");
}
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");
public int getVotePartyIncreaseVotesRequiredWithTypo() {
int increase = getVotePartyIncreaseVotesRequired();
if (increase > 0) {
return increase;
}
return getVotePartyIncreaseVotesRquired();
}
public boolean getVoteStreakRewardEnabled(String type, String s) {
@@ -318,9 +298,9 @@ public class SpecialRewardsConfig extends YMLFile {
if (set != null) {
return set;
}
return new HashSet<String>();
return new HashSet<>();
} catch (Exception ex) {
return new HashSet<String>();
return new HashSet<>();
}
}
@@ -328,19 +308,6 @@ 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>();
}
}
@Override
public void loadValues() {
new AnnotationHandler().load(getData(), this);
@@ -1,6 +1,8 @@
package com.bencodez.votingplugin.cooldown;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.UUID;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
@@ -14,28 +16,79 @@ import org.bukkit.event.Listener;
import com.bencodez.advancedcore.api.rewards.RewardOptions;
import com.bencodez.advancedcore.api.user.AdvancedCoreUser;
import com.bencodez.advancedcore.api.user.UserStartup;
import com.bencodez.advancedcore.api.user.userstorage.Column;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.events.PlayerVoteCoolDownEndEvent;
import com.bencodez.votingplugin.events.PlayerVoteSiteCoolDownEndEvent;
import com.bencodez.votingplugin.objects.VoteSite;
import com.bencodez.votingplugin.user.VotingPluginUser;
import lombok.Getter;
public class CoolDownCheck implements Listener {
private VotingPluginMain plugin;
private HashMap<UUID, ScheduledFuture<?>> perSiteTasks = new HashMap<UUID, ScheduledFuture<?>>();
private HashMap<UUID, ScheduledFuture<?>> perSiteTasks = new HashMap<>();
private HashMap<UUID, ScheduledFuture<?>> allSiteTasks = new HashMap<UUID, ScheduledFuture<?>>();
private HashMap<UUID, ScheduledFuture<?>> allSiteTasks = new HashMap<>();
@Getter
private ScheduledExecutorService timer;
private boolean cooldownCheckEnabled = false;
public CoolDownCheck(VotingPluginMain plugin) {
this.plugin = plugin;
this.timer = Executors.newScheduledThreadPool(1);
}
private ScheduledExecutorService timer;
public void check(UUID uuid) {
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(uuid);
if (!user.isOnline()) {
user.dontCache();
}
check(user);
}
private boolean cooldownCheckEnabled = false;
public synchronized void check(VotingPluginUser user) {
boolean coolDownCheck = user.getCoolDownCheck();
if (coolDownCheck) {
if (user.canVoteAll()) {
user.setCoolDownCheck(false);
PlayerVoteCoolDownEndEvent event = new PlayerVoteCoolDownEndEvent(user);
plugin.getServer().getPluginManager().callEvent(event);
allSiteTasks.remove(user.getJavaUUID());
} else {
schedulePerSite(user, false);
}
}
}
public void checkAllVoteSite(VoteSite site) {
plugin.getLogger().info("Checking vote cooldown rewards for all players: " + site.getKey());
HashMap<UUID, ArrayList<Column>> cols = plugin.getUserManager().getAllKeys();
for (Entry<UUID, ArrayList<Column>> playerData : cols.entrySet()) {
String uuid = playerData.getKey().toString();
if (plugin != null && plugin.isEnabled()) {
if (uuid != null && !uuid.isEmpty()) {
VotingPluginUser user = plugin.getVotingPluginUserManager()
.getVotingPluginUser(UUID.fromString(uuid), false);
user.dontCache();
user.updateTempCacheWithColumns(playerData.getValue());
cols.put(playerData.getKey(), null);
checkPerSite(user);
user.clearTempCache();
user = null;
}
}
}
cols.clear();
cols = null;
plugin.getLogger().info("Finished checking vote cooldown rewards for all players: " + site.getKey());
}
public void checkEnabled() {
if (!plugin.getConfigFile().isDisableCoolDownCheck() && plugin.getRewardHandler()
@@ -46,46 +99,24 @@ public class CoolDownCheck implements Listener {
}
}
public void check(UUID uuid) {
check(plugin.getVotingPluginUserManager().getVotingPluginUser(uuid));
}
public void checkPerSite(UUID uuid) {
checkPerSite(plugin.getVotingPluginUserManager().getVotingPluginUser(uuid));
}
public void vote(VotingPluginUser user, VoteSite site) {
if (cooldownCheckEnabled) {
schedule(user);
}
if (plugin.getConfigFile().isPerSiteCoolDownEvents()) {
user.setCoolDownCheckSite(site, Boolean.FALSE);
schedulePerSite(user);
}
}
public void check(VotingPluginUser user) {
boolean coolDownCheck = user.getCoolDownCheck();
if (user.canVoteAll() && coolDownCheck) {
user.setCoolDownCheck(false);
PlayerVoteCoolDownEndEvent event = new PlayerVoteCoolDownEndEvent(user);
plugin.getServer().getPluginManager().callEvent(event);
allSiteTasks.remove(user.getJavaUUID());
} else if (!coolDownCheck) {
schedule(user);
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(uuid);
if (!user.isOnline()) {
user.dontCache();
}
checkPerSite(user);
}
public synchronized void checkPerSite(VotingPluginUser user) {
if (plugin.getConfigFile().isPerSiteCoolDownEvents()) {
HashMap<VoteSite, Boolean> coolDownChecks = user.getCoolDownCheckSiteList();
HashMap<String, Boolean> coolDownChecks = user.getCoolDownCheckSiteList();
boolean changed = false;
for (VoteSite site : plugin.getVoteSites()) {
if (user.canVoteSite(site)) {
if (!coolDownChecks.containsKey(site) || !coolDownChecks.get(site).booleanValue()) {
coolDownChecks.put(site, Boolean.TRUE);
for (VoteSite site : plugin.getVoteSitesEnabled()) {
if (!coolDownChecks.containsKey(site.getKey()) || !coolDownChecks.get(site.getKey()).booleanValue()) {
if (user.canVoteSite(site)) {
coolDownChecks.put(site.getKey(), Boolean.TRUE);
changed = true;
plugin.extraDebug("Triggering votesitecooldownend event for " + user.getUUID());
PlayerVoteSiteCoolDownEndEvent event = new PlayerVoteSiteCoolDownEndEvent(user, site);
plugin.getServer().getPluginManager().callEvent(event);
}
@@ -94,69 +125,18 @@ public class CoolDownCheck implements Listener {
if (changed) {
user.setCoolDownCheckSite(coolDownChecks);
}
}
schedulePerSite(user);
}
public void schedulePerSite(VotingPluginUser user) {
final UUID uuid = UUID.fromString(user.getUUID());
long time = user.getNextTimeFirstSiteAvailable();
if (time > 0) {
if (perSiteTasks.containsKey(uuid)) {
perSiteTasks.get(uuid).cancel(false);
perSiteTasks.remove(uuid);
}
plugin.devDebug("PerSiteCoolDownEvent schedule time: " + time);
ScheduledFuture<?> scheduledFuture = timer.schedule(new Runnable() {
@Override
public void run() {
if (plugin != null && plugin.isEnabled()) {
checkPerSite(uuid);
}
}
}, time + 2, TimeUnit.SECONDS);
perSiteTasks.put(uuid, scheduledFuture);
}
}
public void schedule(VotingPluginUser user) {
final UUID uuid = UUID.fromString(user.getUUID());
long time = user.getNextTimeAllSitesAvailable();
if (time > 0) {
user.setCoolDownCheck(true);
if (allSiteTasks.containsKey(uuid)) {
allSiteTasks.get(uuid).cancel(false);
allSiteTasks.remove(uuid);
}
ScheduledFuture<?> scheduledFuture = timer.schedule(new Runnable() {
@Override
public void run() {
check(uuid);
}
}, time + 2, TimeUnit.SECONDS);
allSiteTasks.put(uuid, scheduledFuture);
schedulePerSite(user, false);
}
}
public void load() {
plugin.addUserStartup(new UserStartup() {
@Override
public void onStartUp(AdvancedCoreUser advancedcoreUser) {
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(advancedcoreUser);
if (cooldownCheckEnabled) {
check(user);
}
if (plugin.getConfigFile().isPerSiteCoolDownEvents()) {
checkPerSite(user);
}
public void onFinish() {
}
@Override
@@ -165,10 +145,18 @@ public class CoolDownCheck implements Listener {
}
@Override
public void onFinish() {
public void onStartUp(AdvancedCoreUser advancedcoreUser) {
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(advancedcoreUser);
user.dontCache();
if (cooldownCheckEnabled) {
check(user);
}
if (plugin.getConfigFile().isPerSiteCoolDownEvents()) {
checkPerSite(user);
}
}
});
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@@ -180,7 +168,72 @@ 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)));
}
public void schedule(VotingPluginUser user, boolean force) {
if (user.getSitesVotedOn() > 0 || force) {
final UUID uuid = UUID.fromString(user.getUUID());
long time = user.getNextTimeAllSitesAvailable();
if (allSiteTasks.containsKey(uuid)) {
allSiteTasks.get(uuid).cancel(false);
allSiteTasks.remove(uuid);
}
if (time > 0) {
user.setCoolDownCheck(true);
ScheduledFuture<?> scheduledFuture = timer.schedule(new Runnable() {
@Override
public void run() {
if (plugin != null && plugin.isEnabled()) {
check(uuid);
}
}
}, time + 2, TimeUnit.SECONDS);
allSiteTasks.put(uuid, scheduledFuture);
} else {
plugin.extraDebug(user.getUUID() + "/" + user.getPlayerName() + " not scheduling cooldown check");
}
}
}
public void schedulePerSite(VotingPluginUser user, boolean force) {
if (user.getSitesVotedOn() > 0 || force) {
final UUID uuid = UUID.fromString(user.getUUID());
long time = user.getNextTimeFirstSiteAvailable();
if (perSiteTasks.containsKey(uuid)) {
perSiteTasks.get(uuid).cancel(false);
perSiteTasks.remove(uuid);
}
if (time > 0) {
plugin.devDebug("PerSiteCoolDownEvent schedule time: " + time + " seconds");
ScheduledFuture<?> scheduledFuture = timer.schedule(new Runnable() {
@Override
public void run() {
if (plugin != null && plugin.isEnabled()) {
checkPerSite(uuid);
}
}
}, time + 2, TimeUnit.SECONDS);
perSiteTasks.put(uuid, scheduledFuture);
} else {
plugin.extraDebug(user.getUUID() + "/" + user.getPlayerName() + " not scheduling cooldown check");
}
}
}
public void vote(VotingPluginUser user, VoteSite site) {
if (cooldownCheckEnabled) {
schedule(user, true);
}
if (plugin.getConfigFile().isPerSiteCoolDownEvents()) {
user.setCoolDownCheckSite(site, Boolean.FALSE);
schedulePerSite(user, true);
}
}
}
@@ -6,12 +6,13 @@ import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.configuration.ConfigurationSection;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.simpleapi.array.ArrayUtils;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.signs.SignHandler;
import com.bencodez.votingplugin.timequeue.VoteTimeQueue;
@@ -31,40 +32,18 @@ public class ServerData {
public void addAutoCachedPlaceholder(String placeholder) {
List<String> p = getAutoCachedPlaceholder();
if (!ArrayUtils.getInstance().containsIgnoreCase(p, placeholder)) {
if (!ArrayUtils.containsIgnoreCase(p, placeholder)) {
p.add(placeholder);
setAutoCachedPlaceholder(p);
}
}
public void updatePlaceholders() {
boolean data = getData().getBoolean("AutoCacheUpdated", false);
if (!data) {
List<String> placeholders = getAutoCachedPlaceholder();
for (int i = 0; i < placeholders.size(); i++) {
placeholders.set(i, placeholders.get(i).toLowerCase());
}
setAutoCachedPlaceholder(placeholders);
getData().set("AutoCacheUpdated", true);
saveData();
}
}
public void setAutoCachedPlaceholder(List<String> placeholders) {
getData().set("AutoCachePlaceholders", placeholders);
saveData();
}
public List<String> getAutoCachedPlaceholder() {
return getData().getStringList("AutoCachePlaceholders");
}
public synchronized void addServiceSite(String site) {
ArrayList<String> l = getServiceSites();
if (!getServiceSites().contains(site)) {
l.add(site);
}
setServiceSites(ArrayUtils.getInstance().removeDuplicates(l));
setServiceSites(ArrayUtils.removeDuplicates(l));
}
/**
@@ -89,6 +68,34 @@ public class ServerData {
getSignSkullLocation("" + count), getSignData("" + count), getSignPosition("" + count)));
}
public void addTimeVoted(int num, VoteTimeQueue vote) {
getData().set("TimedVoteCache." + num + ".Name", vote.getName());
getData().set("TimedVoteCache." + num + ".Service", vote.getService());
getData().set("TimedVoteCache." + num + ".Time", vote.getTime());
saveData();
}
public void addVoteShopPurchase(String ident) {
setVoteShopPurchases(ident, (getVoteShopPurchases(ident) + 1));
}
public void clearTimedVoteCache() {
getData().set("TimedVoteCache", null);
saveData();
}
public List<String> getAutoCachedPlaceholder() {
return getData().getStringList("AutoCachePlaceholders");
}
public int getBungeeVotePartyCurrent() {
return getData().getInt("BungeeVotePartyCurrent");
}
public int getBungeeVotePartyRequired() {
return getData().getInt("BungeeVotePartyRequired");
}
/**
* Gets the data.
*
@@ -103,9 +110,13 @@ public class ServerData {
return data;
}
public List<String> getDisabledReminders() {
return getData().getStringList("DisabledReminders");
}
@SuppressWarnings("unchecked")
public ArrayList<String> getServiceSites() {
return (ArrayList<String>) getData().getList("ServiceSites", new ArrayList<String>());
return (ArrayList<String>) getData().getList("ServiceSites", new ArrayList<>());
}
/**
@@ -149,7 +160,7 @@ public class ServerData {
try {
return getData().getConfigurationSection("Signs").getKeys(false);
} catch (Exception ex) {
return new HashSet<String>();
return new HashSet<>();
}
}
@@ -168,10 +179,25 @@ public class ServerData {
getData().getDouble("Signs." + sign + ".Skull.Z"));
}
public Set<String> getTimedVoteCacheKeys() {
if (getData().isConfigurationSection("TimedVoteCache")) {
return getData().getConfigurationSection("TimedVoteCache").getKeys(false);
}
return new HashSet<>();
}
public ConfigurationSection getTimedVoteCacheSection(String num) {
return getData().getConfigurationSection("TimedVoteCache." + num);
}
public int getVotePartyExtraRequired() {
return getData().getInt("VotePartyExtraRequired", 0);
}
public int getVoteShopPurchases(String ident) {
return getData().getInt("VoteShopPurchases." + ident);
}
public boolean isLastVotePartySameDay() {
int num = getData().getInt("LastVoteParty", 0);
if (num == plugin.getTimeChecker().getTime().getDayOfYear()) {
@@ -189,6 +215,10 @@ public class ServerData {
return false;
}
public boolean isVoteShopConverted() {
return getData().getBoolean("VoteShopConverted");
}
/**
* Next sign number.
*
@@ -241,11 +271,40 @@ public class ServerData {
plugin.getServerDataFile().saveData();
}
public void saveDisabledReminders(ArrayList<UUID> disabledReminders) {
ArrayList<String> uuids = new ArrayList<>();
for (UUID uuid : disabledReminders) {
uuids.add(uuid.toString());
}
getData().set("DisabledReminders", uuids);
saveData();
}
public void setAutoCachedPlaceholder(List<String> placeholders) {
getData().set("AutoCachePlaceholders", placeholders);
saveData();
}
public void setBungeeVotePartyCurrent(int current) {
getData().set("BungeeVotePartyCurrent", current);
saveData();
}
public void setBungeeVotePartyRequired(int required) {
getData().set("BungeeVotePartyRequired", required);
saveData();
}
public void setServiceSites(ArrayList<String> list) {
getData().set("ServiceSites", list);
saveData();
}
public void setShopConverted(boolean value) {
getData().set("VoteShopConverted", value);
saveData();
}
public void setSign(String count, Location location, Location skullLocation, String data, int position) {
getData().set("Signs." + count + ".World", location.getWorld().getName());
@@ -285,6 +344,11 @@ public class ServerData {
saveData();
}
public void setVoteShopPurchases(String ident, int amount) {
getData().set("VoteShopPurchases." + ident, amount);
saveData();
}
public void updateLastVoteParty() {
getData().set("LastVoteParty", plugin.getTimeChecker().getTime().getDayOfYear());
saveData();
@@ -296,22 +360,17 @@ public class ServerData {
saveData();
}
public int getBungeeVotePartyCurrent() {
return getData().getInt("BungeeVotePartyCurrent");
}
public int getBungeeVotePartyRequired() {
return getData().getInt("BungeeVotePartyRequired");
}
public void setBungeeVotePartyCurrent(int current) {
getData().set("BungeeVotePartyCurrent", current);
saveData();
}
public void setBungeeVotePartyRequired(int required) {
getData().set("BungeeVotePartyRequired", required);
saveData();
public void updatePlaceholders() {
boolean data = getData().getBoolean("AutoCacheUpdated", false);
if (!data) {
List<String> placeholders = getAutoCachedPlaceholder();
for (int i = 0; i < placeholders.size(); i++) {
placeholders.set(i, placeholders.get(i).toLowerCase());
}
setAutoCachedPlaceholder(placeholders);
getData().set("AutoCacheUpdated", true);
saveData();
}
}
/**
@@ -320,28 +379,4 @@ public class ServerData {
public void updateValues() {
setVersion();
}
public void addTimeVoted(int num, VoteTimeQueue vote) {
getData().set("TimedVoteCache." + num + ".Name", vote.getName());
getData().set("TimedVoteCache." + num + ".Service", vote.getService());
getData().set("TimedVoteCache." + num + ".Time", vote.getTime());
saveData();
}
public Set<String> getTimedVoteCacheKeys() {
if (getData().isConfigurationSection("TimedVoteCache")) {
return getData().getConfigurationSection("TimedVoteCache").getKeys(false);
} else {
return new HashSet<String>();
}
}
public ConfigurationSection getTimedVoteCacheSection(String num) {
return getData().getConfigurationSection("TimedVoteCache." + num);
}
public void clearTimedVoteCache() {
getData().set("TimedVoteCache", null);
saveData();
}
}
@@ -56,16 +56,22 @@ public class PlayerPostVoteEvent extends Event {
@Setter
private VoteSite voteSite;
@Getter
@Setter
private long voteTime = 0;
@Getter
@Setter
private VotingPluginUser votingPluginUser;
public PlayerPostVoteEvent(VoteSite voteSite, VotingPluginUser user, boolean realVote, boolean forceBungee) {
public PlayerPostVoteEvent(VoteSite voteSite, VotingPluginUser user, boolean realVote, boolean forceBungee,
long voteTime) {
super(true);
this.user = user;
this.voteSite = voteSite;
this.realVote = realVote;
this.forceBungee = forceBungee;
this.voteTime = voteTime;
}
/*
@@ -1,6 +1,5 @@
package com.bencodez.votingplugin.listeners;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.block.Sign;
import org.bukkit.event.EventHandler;
@@ -39,7 +38,7 @@ public class BlockBreak implements Listener {
if (event.getBlock().getState() instanceof Sign) {
Sign s = (Sign) event.getBlock().getState();
final Location loc = s.getLocation();
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
plugin.getBukkitScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
@@ -1,7 +1,5 @@
package com.bencodez.votingplugin.listeners;
import org.bukkit.Bukkit;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.events.PlayerVoteEvent;
import com.vexsoftware.votifier.model.Vote;
@@ -10,7 +8,7 @@ import com.vexsoftware.votifier.model.VotifierEvent;
public class BungeeVotifierEvent {
public void send(VotingPluginMain plugin, PlayerVoteEvent event) {
plugin.debug("Triggering vote event");
Bukkit.getScheduler().runTask(plugin, new Runnable() {
plugin.getBukkitScheduler().runTask(plugin, new Runnable() {
@Override
public void run() {
@@ -9,10 +9,10 @@ import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import com.bencodez.advancedcore.api.misc.PlayerUtils;
import com.bencodez.advancedcore.api.misc.PlayerManager;
import com.bencodez.simpleapi.player.PlayerUtils;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.signs.SignHandler;
import com.bencodez.votingplugin.user.UserManager;
// TODO: Auto-generated Javadoc
/**
@@ -52,23 +52,23 @@ public class PlayerInteract implements Listener {
if (sign.isLocationSame(event.getClickedBlock().getLocation())) {
// plugin.debug(player.getName() +
// " right clicked a top voter sign, sending message");
UserManager.getInstance().getVotingPluginUser(player)
plugin.getVotingPluginUserManager().getVotingPluginUser(player)
.sendMessage(sign.getRightClickMessage());
if (!sign.isSkullSet()) {
if (PlayerUtils.getInstance().hasServerPermission(event.getPlayer().getName(),
if (PlayerManager.getInstance().hasServerPermission(event.getPlayer().getName(),
"VotingPlugin.Sign.Create")
|| PlayerUtils.getInstance().hasServerPermission(event.getPlayer().getName(),
|| PlayerManager.getInstance().hasServerPermission(event.getPlayer().getName(),
"VotingPlugin.Admin")) {
player.sendMessage("Skull not set, click to set skull");
PlayerUtils.getInstance().setPlayerMeta(player, "skullset", sign.getSign());
PlayerUtils.setPlayerMeta(plugin, player, "skullset", sign.getSign());
}
}
}
}
} else if (event.getClickedBlock().getState() instanceof Skull) {
Object ob = PlayerUtils.getInstance().getPlayerMeta(player, "skullset");
Object ob = PlayerUtils.getPlayerMeta(plugin, player, "skullset");
if (ob != null) {
String sign1 = (String) ob;
for (SignHandler sign : plugin.getSigns().getSigns()) {
@@ -79,7 +79,7 @@ public class PlayerInteract implements Listener {
player.sendMessage("Skull set");
}
}
PlayerUtils.getInstance().setPlayerMeta(player, "skullset", null);
PlayerUtils.setPlayerMeta(plugin, player, "skullset", null);
}
}
}
@@ -9,7 +9,6 @@ import org.bukkit.event.player.PlayerQuitEvent;
import com.bencodez.advancedcore.listeners.AdvancedCoreLoginEvent;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.bungee.BungeeMethod;
import com.bencodez.votingplugin.user.UserManager;
import com.bencodez.votingplugin.user.VotingPluginUser;
// TODO: Auto-generated Javadoc
@@ -31,7 +30,7 @@ public class PlayerJoinEvent implements Listener {
}
private void login(Player player) {
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
if (player.isOp() && plugin.isYmlError()) {
user.sendMessage("&cVotingPlugin: Detected yml error, please check console for details");
}
@@ -43,16 +42,19 @@ public class PlayerJoinEvent implements Listener {
if (data) {
// give offline vote (if they voted offline)
user.offVote();
} else {
plugin.debug("No data detected for " + player.getUniqueId().toString() + "/" + player.getName());
}
user.loginRewards();
plugin.getPlaceholders().onUpdate(user);
plugin.getPlaceholders().onUpdate(user, true);
if (plugin.getBungeeSettings().isUseBungeecoord()
&& plugin.getBungeeHandler().getMethod().equals(BungeeMethod.PLUGINMESSAGING)) {
plugin.getPluginMessaging().sendPluginMessage("Login", user.getPlayerName(), user.getUUID(),
plugin.getBungeeSettings().getServer());
&& (plugin.getBungeeHandler().getMethod().equals(BungeeMethod.PLUGINMESSAGING)
|| plugin.getBungeeHandler().getMethod().equals(BungeeMethod.REDIS))) {
plugin.getBungeeHandler().getGlobalMessageHandler().sendMessage("Login", user.getPlayerName(),
user.getUUID(), plugin.getBungeeSettings().getServer());
}
}
@@ -81,9 +83,10 @@ public class PlayerJoinEvent implements Listener {
public void run() {
VotingPluginMain.plugin.getAdvancedTab().remove(uuid);
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(uuid);
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(uuid);
user.dontCache();
user.logoutRewards();
plugin.getPlaceholders().onLogout(user);
}
});
}
@@ -10,14 +10,14 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.advancedcore.api.misc.PlayerUtils;
import com.bencodez.advancedcore.api.misc.PlayerManager;
import com.bencodez.simpleapi.array.ArrayUtils;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.bungee.BungeeMethod;
import com.bencodez.votingplugin.events.PlayerPostVoteEvent;
import com.bencodez.votingplugin.events.PlayerVoteEvent;
import com.bencodez.votingplugin.objects.VoteSite;
import com.bencodez.votingplugin.user.UserManager;
import com.bencodez.votingplugin.topvoter.TopVoter;
import com.bencodez.votingplugin.user.VotingPluginUser;
// TODO: Auto-generated Javadoc
@@ -50,12 +50,12 @@ public class PlayerVoteListener implements Listener {
}
String playerName = event.getPlayer();
plugin.debug("Processing PlayerVoteEvent: " + playerName + "/" + event.getServiceSite());
if (!PlayerUtils.getInstance().isValidUser(playerName, plugin.getConfigFile().isAllowUnJoinedCheckServer())) {
if (!PlayerManager.getInstance().isValidUser(playerName, plugin.getConfigFile().isAllowUnJoinedCheckServer())) {
if (!plugin.getConfigFile().isAllowUnjoined()) {
plugin.getLogger().warning("Player " + playerName
+ " has not joined before, disregarding vote, set AllowUnjoined to true to prevent this");
if (event.isBungee() && plugin.getBungeeSettings().isRemoveInvalidUsers()) {
UserManager.getInstance().getVotingPluginUser(playerName).remove();
plugin.getVotingPluginUserManager().getVotingPluginUser(playerName).remove();
}
return;
}
@@ -86,12 +86,11 @@ public class PlayerVoteListener implements Listener {
if (!plugin.getConfigFile().isDisableNoServiceSiteMessage()) {
plugin.getLogger().warning("No voting site with the service site: '" + event.getServiceSite() + "'");
ArrayList<String> services = new ArrayList<String>();
ArrayList<String> services = new ArrayList<>();
for (VoteSite site : plugin.getVoteSites()) {
services.add(site.getServiceSite());
}
plugin.getLogger()
.warning("Current known service sites: " + ArrayUtils.getInstance().makeStringList(services));
plugin.getLogger().warning("Currently set service sites: " + ArrayUtils.makeStringList(services));
}
return;
}
@@ -108,15 +107,23 @@ public class PlayerVoteListener implements Listener {
Player p = Bukkit.getPlayerExact(playerName);
if (p != null) {
// player online
user = UserManager.getInstance().getVotingPluginUser(p);
user = plugin.getVotingPluginUserManager().getVotingPluginUser(p);
} else {
user = UserManager.getInstance().getVotingPluginUser(playerName);
user = plugin.getVotingPluginUserManager().getVotingPluginUser(playerName);
}
}
if (voteSite.isWaitUntilVoteDelay() && !user.canVoteSite(voteSite)) {
plugin.getLogger().info(user.getPlayerName() + " must wait until votedelay is over, ignoring vote");
return;
if (!event.isRealVote()) {
plugin.getLogger().info(user.getPlayerName() + " did a not real vote, bypassing WaitUntilVoteDelay");
} else {
if (!user.hasPermission("VotingPlugin.BypassWaitUntilVoteDelay")) {
plugin.getLogger().info(user.getPlayerName() + " must wait until votedelay is over, ignoring vote");
return;
}
plugin.getLogger()
.info(user.getPlayerName() + " has bypass permission for WaitUntilVoteDelay, bypassing");
}
}
final String uuid = user.getUUID();
@@ -133,7 +140,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 +150,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 +174,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,21 +193,46 @@ 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();
}
user.checkDayVoteStreak(event.isForceBungee());
if (plugin.getConfigFile().isLimitMonthlyVotes()) {
int value = 0;
if (event.isBungee()) {
value = event.getBungeeTextTotals().getMonthTotal();
} else {
value = user.getTotal(TopVoter.Monthly);
}
LocalDateTime cTime = plugin.getTimeChecker().getTime();
int days = cTime.getDayOfMonth();
plugin.extraDebug("Current day of month: " + days + " Current total: " + value);
if (value >= days * plugin.getVoteSitesEnabled().size()) {
plugin.debug("Detected higher month total, changing. Current Total: " + value + " Days: " + days
+ " New Total: " + days * plugin.getVoteSitesEnabled().size());
user.setTotal(TopVoter.Monthly, days * plugin.getVoteSitesEnabled().size());
}
}
// other rewards
plugin.getSpecialRewards().checkAllSites(user, event.isForceBungee());
plugin.getSpecialRewards().checkAlmostAllSites(user, event.isForceBungee());
@@ -208,22 +243,26 @@ public class PlayerVoteListener implements Listener {
if (plugin.getBungeeSettings().isUseBungeecoord()) {
if (plugin.getBungeeHandler().getMethod().equals(BungeeMethod.MYSQL)) {
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
plugin.getBukkitScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
@Override
public void run() {
if (Bukkit.getOnlinePlayers().size() > 0) {
plugin.getPluginMessaging().sendPluginMessage("VoteUpdate", uuid);
plugin.getBungeeHandler().getGlobalMessageHandler().sendMessage("VoteUpdate", uuid);
}
}
}, 40);
}, 2);
}
}
PlayerPostVoteEvent postVoteEvent = new PlayerPostVoteEvent(voteSite, user, event.isRealVote(),
event.isForceBungee());
event.isForceBungee(), voteTime);
plugin.getServer().getPluginManager().callEvent(postVoteEvent);
if (user.isOnline()) {
plugin.getPlaceholders().onUpdate(user, true);
}
if (!user.isOnline()) {
user.clearCache();
}
@@ -1,12 +1,11 @@
package com.bencodez.votingplugin.listeners;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.SignChangeEvent;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.misc.PlayerUtils;
import com.bencodez.advancedcore.api.misc.PlayerManager;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
// TODO: Auto-generated Javadoc
@@ -35,8 +34,8 @@ public class SignChange implements Listener {
@EventHandler(ignoreCancelled = true)
public void onSignChange(SignChangeEvent event) {
if (event.getLine(0).equalsIgnoreCase("[VotingPlugin]")) {
if (PlayerUtils.getInstance().hasServerPermission(event.getPlayer().getName(), "VotingPlugin.Sign.Create")
|| PlayerUtils.getInstance().hasServerPermission(event.getPlayer().getName(),
if (PlayerManager.getInstance().hasServerPermission(event.getPlayer().getName(), "VotingPlugin.Sign.Create")
|| PlayerManager.getInstance().hasServerPermission(event.getPlayer().getName(),
"VotingPlugin.Admin")) {
String data = event.getLine(2);
if (!data.equalsIgnoreCase("all") && !data.equalsIgnoreCase("monthly")
@@ -46,8 +45,8 @@ public class SignChange implements Listener {
try {
plugin.getServerData().addSign(event.getBlock().getLocation(), event.getLine(2),
Integer.parseInt(event.getLine(1)));
event.getPlayer().sendMessage(StringParser.getInstance().colorize("&aAdded sign!"));
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
event.getPlayer().sendMessage(MessageAPI.colorize("&aAdded sign!"));
plugin.getBukkitScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
@@ -56,12 +55,11 @@ public class SignChange implements Listener {
}
});
} catch (Exception ex) {
event.getPlayer().sendMessage(StringParser.getInstance().colorize("&cError on sign creation!"));
event.getPlayer().sendMessage(MessageAPI.colorize("&cError on sign creation!"));
ex.printStackTrace();
}
} else {
event.getPlayer()
.sendMessage(StringParser.getInstance().colorize(plugin.getConfigFile().getFormatNoPerms()));
event.getPlayer().sendMessage(MessageAPI.colorize(plugin.getConfigFile().getFormatNoPerms()));
}
}
@@ -6,7 +6,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.simpleapi.array.ArrayUtils;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.bungee.BungeeMethod;
import com.bencodez.votingplugin.events.PlayerVoteEvent;
@@ -77,25 +77,34 @@ public class VotiferEvent implements Listener {
"Ignoring vote from votifier since pluginmessaging or socket bungee method is enabled, this means you aren't setup correctly for those methods, please check: https://github.com/BenCodez/VotingPlugin/wiki/Bungeecord-Setups");
return;
}
String voteSiteNameStr = plugin.getVoteSiteName(false, voteSite);
String matchSite = "";
if (plugin.getConfigFile().isAdvancedServiceSiteHandling()) {
if (plugin.getServiceSiteHandler() != null) {
matchSite = plugin.getServiceSiteHandler().matchReverse(voteSite);
}
}
String voteSiteNameStr = plugin.getVoteSiteName(false, voteSite, matchSite);
ArrayList<String> sites = plugin.getConfigVoteSites().getVoteSitesNames(false);
boolean createSite = false;
if (sites != null) {
if (!ArrayUtils.getInstance().containsIgnoreCase(sites, voteSiteNameStr)) {
if (!ArrayUtils.containsIgnoreCase(sites, voteSiteNameStr)) {
createSite = true;
}
} else {
createSite = true;
}
String serviceSite = voteSite;
if (plugin.getConfigFile().isAutoCreateVoteSites() && createSite) {
plugin.getLogger().warning("VoteSite with service site '" + voteSiteNameStr
+ "' does not exist, attempting to generate...");
plugin.getConfigVoteSites().generateVoteSite(voteSiteNameStr);
plugin.getLogger().info("Current known service sites: "
+ ArrayUtils.getInstance().makeStringList(plugin.getServerData().getServiceSites()));
+ ArrayUtils.makeStringList(plugin.getServerData().getServiceSites()));
}
if (plugin.getTimeChecker().isActiveProcessing()
@@ -107,7 +116,7 @@ public class VotiferEvent implements Listener {
return;
}
String voteSiteName = plugin.getVoteSiteName(true, voteSite);
String voteSiteName = plugin.getVoteSiteName(true, serviceSite, matchSite);
PlayerVoteEvent voteEvent = new PlayerVoteEvent(plugin.getVoteSite(voteSiteName, true),
voteUsername, voteSite, true);
@@ -10,13 +10,13 @@ import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.advancedcore.api.messages.PlaceholderUtils;
import com.bencodez.advancedcore.api.misc.MiscUtils;
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
import com.bencodez.simpleapi.array.ArrayUtils;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.bungee.BungeeMethod;
import com.bencodez.votingplugin.user.UserManager;
import com.bencodez.votingplugin.user.VotingPluginUser;
import lombok.Getter;
@@ -65,7 +65,7 @@ public class VoteSite {
@Getter
@Setter
private double timeOffSet;
private int voteDelayDailyHour;
@Getter
@Setter
@@ -82,6 +82,10 @@ public class VoteSite {
@Setter
private String voteURL;
@Getter
@Setter
private String permissionToView;
@Getter
@Setter
private boolean waitUntilVoteDelay;
@@ -127,18 +131,20 @@ public class VoteSite {
}
} else {
String bc = StringParser.getInstance().colorize(plugin.getConfigFile().getFormatBroadCastMsg());
HashMap<String, String> placeholders = new HashMap<String, String>();
String bc = MessageAPI.colorize(plugin.getConfigFile().getFormatBroadCastMsg());
HashMap<String, String> placeholders = new HashMap<>();
placeholders.put("player", playerName);
placeholders.put("nickname",
(user.getPlayer() != null) ? user.getPlayer().getDisplayName() : user.getPlayerName());
placeholders.put("sitename", getDisplayName());
placeholders.put("servicesite", getServiceSite());
bc = StringParser.getInstance().replacePlaceHolder(bc, placeholders);
bc = StringParser.getInstance().replacePlaceHolders(user.getOfflinePlayer(), bc);
ArrayList<Player> players = new ArrayList<Player>();
placeholders.put("votesrequired", "" + plugin.getVoteParty().getVotesRequired());
placeholders.put("neededvotes", "" + plugin.getVoteParty().getNeededVotes());
bc = PlaceholderUtils.replacePlaceHolder(bc, placeholders);
bc = PlaceholderUtils.replacePlaceHolders(user.getOfflinePlayer(), bc);
ArrayList<Player> players = new ArrayList<>();
for (Player p : Bukkit.getOnlinePlayers()) {
if (!UserManager.getInstance().getVotingPluginUser(p).getDisableBroadcast()) {
if (!plugin.getVotingPluginUserManager().getVotingPluginUser(p).getDisableBroadcast()) {
players.add(p);
}
}
@@ -158,9 +164,8 @@ public class VoteSite {
plugin.getLogger().warning("Invalid display item section in site: " + key);
return new ItemBuilder(Material.STONE, 1).setName("&cInvalid display item for site: " + key)
.setLore("&cInvalid display item for site: " + key);
} else {
return new ItemBuilder(item);
}
return new ItemBuilder(item);
}
public ConfigurationSection getSiteData() {
@@ -172,20 +177,18 @@ public class VoteSite {
}
public String getVoteURL(boolean json) {
if (!plugin.getConfigFile().isFormatCommandsVoteForceLinks() || !json
|| StringParser.getInstance().containsJson(voteURL)) {
if (!plugin.getConfigFile().isFormatCommandsVoteForceLinks() || !json || MessageAPI.containsJson(voteURL)) {
return voteURL;
} else {
if (!voteURL.startsWith("http")) {
return "[Text=\"" + voteURL + "\",url=\"http://" + voteURL + "\"]";
}
return "[Text=\"" + voteURL + "\",url=\"" + voteURL + "\"]";
}
if (!voteURL.startsWith("http")) {
return "[Text=\"" + voteURL + "\",url=\"http://" + voteURL + "\"]";
}
return "[Text=\"" + voteURL + "\",url=\"" + voteURL + "\"]";
}
public String getVoteURLJsonStrip() {
String url = ChatColor.stripColor(StringParser.getInstance()
.colorize(StringParser.getInstance().parseJson(getVoteURL(false)).toPlainText()));
String url = ChatColor
.stripColor(MessageAPI.colorize(PlaceholderUtils.parseJson(getVoteURL(false)).toPlainText()));
if (!url.startsWith("http")) {
if (!url.startsWith("www.")) {
url = "https://www." + url;
@@ -197,15 +200,16 @@ public class VoteSite {
}
public void giveRewards(VotingPluginUser user, boolean online, boolean bungee) {
new RewardBuilder(plugin.getConfigVoteSites().getData(), plugin.getConfigVoteSites().getEverySiteRewardPath())
.setOnline(online).withPlaceHolder("ServiceSite", getServiceSite())
.withPlaceHolder("SiteName", getDisplayName()).withPlaceHolder("VoteDelay", "" + getVoteDelay())
.withPlaceHolder("VoteURL", getVoteURL()).setServer(bungee).send(user);
new RewardBuilder(plugin.getConfigVoteSites().getData(), plugin.getConfigVoteSites().getRewardsPath(key))
.setOnline(online).withPlaceHolder("ServiceSite", getServiceSite())
.withPlaceHolder("SiteName", getDisplayName()).withPlaceHolder("VoteDelay", "" + getVoteDelay())
.withPlaceHolder("VoteURL", getVoteURL()).setServer(bungee).send(user);
new RewardBuilder(plugin.getConfigVoteSites().getData(), plugin.getConfigVoteSites().getEverySiteRewardPath())
.setOnline(online).withPlaceHolder("ServiceSite", getServiceSite())
.withPlaceHolder("SiteName", getDisplayName()).withPlaceHolder("VoteDelay", "" + getVoteDelay())
.withPlaceHolder("VoteURL", getVoteURL()).setServer(bungee).send(user);
}
public boolean hasRewards() {
@@ -231,13 +235,14 @@ public class VoteSite {
voteDelayDaily = plugin.getConfigVoteSites().getVoteSiteResetVoteDelayDaily(key);
giveOffline = plugin.getConfigVoteSites().getVoteSiteGiveOffline(key);
waitUntilVoteDelay = plugin.getConfigVoteSites().getWaitUntilVoteDelay(key);
timeOffSet = plugin.getConfigVoteSites().getTimeOffSet(key);
voteDelayDailyHour = plugin.getConfigVoteSites().getVoteDelayDailyHour(key);
hidden = plugin.getConfigVoteSites().getVoteSiteHidden(key);
ignoreCanVote = plugin.getConfigVoteSites().getVoteSiteIgnoreCanVote(key);
permissionToView = plugin.getConfigVoteSites().getPermissionToView(key);
}
public boolean isVaidServiceSite() {
return ArrayUtils.getInstance().containsIgnoreCase(plugin.getServerData().getServiceSites(), getServiceSite());
return ArrayUtils.containsIgnoreCase(plugin.getServerData().getServiceSites(), getServiceSite());
}
public String loadingDebug() {
@@ -248,7 +253,7 @@ public class VoteSite {
str += ", VoteDelayDaily: " + isVoteDelayDaily();
str += ", IsWaitUntilVoteDelay: " + isWaitUntilVoteDelay();
str += ", ServiceSite: " + getServiceSite();
str += ", TimeOffSet:" + getTimeOffSet();
str += ", VoteDelayDailyHour:" + getVoteDelayDailyHour();
str += ", Url: " + getVoteURL();
str += ", IgnoreCanVote: " + isIgnoreCanVote();
str += ", Hidden: " + isHidden();
@@ -5,7 +5,6 @@ import org.bukkit.Bukkit;
import com.bencodez.advancedcore.api.placeholder.NonPlayerPlaceHolder;
import com.bencodez.advancedcore.api.placeholder.PlaceHolder;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.user.UserManager;
import com.bencodez.votingplugin.user.VotingPluginUser;
import be.maximvdw.placeholderapi.PlaceholderAPI;
@@ -41,11 +40,12 @@ public class MVdWPlaceholders {
@Override
public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
VotingPluginUser user = UserManager.getInstance()
VotingPluginUser user = plugin.getVotingPluginUserManager()
.getVotingPluginUser(event.getOfflinePlayer());
if (plugin.getConfigFile().isUsePrimaryAccountForPlaceholders()
&& user.hasPrimaryAccount()) {
user = UserManager.getInstance().getVotingPluginUser(user.getPrimaryAccount());
user = plugin.getVotingPluginUserManager()
.getVotingPluginUser(user.getPrimaryAccount());
}
return place.placeholderRequest(user,
event.getPlaceholder().substring("VotingPlugin_".length()));
@@ -56,7 +56,8 @@ public class MVdWPlaceholders {
}
for (final NonPlayerPlaceHolder<VotingPluginUser> place : plugin.getPlaceholders().getNonPlayerPlaceholders()) {
for (final NonPlayerPlaceHolder<VotingPluginUser> place : plugin.getPlaceholders()
.getNonPlayerPlaceholders()) {
String str = place.getIdentifier();
if (!str.endsWith("_")) {
PlaceholderAPI.registerPlaceholder(VotingPluginMain.plugin, "VotingPlugin_" + str,
Loaded 100 of 117 files, more files were not shown because too many files have changed in this diff. Show more