Compare commits

...
656 Commits
Author SHA1 Message Date
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
BenCodez b217edeadf Update version number to 6.13 2023-05-14 13:15:00 -04:00
BenCodez aa4ad384c1 Adjustments to remove static usuage 2023-05-14 13:03:43 -04:00
BenCodez 8021024b48 Small change to reduce RAM usuage 2023-05-13 20:32:19 -04:00
BenCodez d3f246d048 Add extra customization to vote next GUI 2023-05-13 08:34:05 -04:00
BenCodez 9c2dfcab06 A lot of changes to getting all player data to prevent possible issues 2023-05-13 08:23:48 -04:00
BenCodez 8b4224a034 Add stats for background task time taken and remove playerdataloadlimit 2023-05-12 20:28:06 -04:00
BenCodez 61bf0007c1 Minor change to time changes 2023-05-10 20:44:56 -04:00
BenCodez 151559c50e Support time zones of proxies, improve speed of time changes 2023-05-10 20:24:45 -04:00
BenCodez 2dccf6e790 Add random player placeholder for vote party 2023-05-10 16:53:53 -04:00
BenCodez bc510b1ba0 Remove use of using 2 tasks 2023-05-09 20:57:03 -04:00
BenCodez 0253d86b8d Properly account canvote placeholder with timeoffsets and votedelaydaily 2023-05-07 21:12:38 -04:00
BenCodez 59cd31a6c8 Improve speed of background task 2023-05-07 20:52:35 -04:00
BenCodez 068b24bd39 Account for time offset in canvote placeholders 2023-05-07 19:03:56 -04:00
BenCodez 7f06797f5f Add placeholder for next available milestone data 2023-05-07 13:28:14 -04:00
BenCodez 3e2bdf4772 Remove duplicate placeholder cache update 2023-05-07 13:12:45 -04:00
BenCodez 3b049299b1 Adjust handling of recaching to optimize performance 2023-05-06 20:04:08 -04:00
BenCodez 05670bebeb Update placeholder cache on vote 2023-05-05 19:47:48 -04:00
BenCodez 81f73590a6 Switch to json files on velocity for vote caches 2023-05-04 20:47:51 -04:00
BenCodez 163e4cdadb Convert yaml files to json on bungeecord due to yaml size limit 2023-05-04 20:14:26 -04:00
BenCodez 512c02e501 Change default return of custom placeholders to return the value instead 2023-05-01 17:27:55 -04:00
BenCodez 25ef8ba315 Adjust to advancedcore changes 2023-05-01 17:24:17 -04:00
BenCodez 8966feb35a Change placeholder name to avoid conflict 2023-05-01 16:41:09 -04:00
BenCodez 0d29be48c7 Update version number to 6.12.2 2023-04-30 18:59:03 -04:00
BenCodez bc2827659d Add placeholder for number of votes until milestone 2023-04-30 16:17:35 -04:00
BenCodez 0a72247a5d Added a one time placeholder auto caching update 2023-04-30 14:59:22 -04:00
BenCodez a102ec3566 Revert placeholder reloading change 2023-04-30 14:39:39 -04:00
BenCodez f91b02d572 Change handling of placeholder reloading 2023-04-30 14:30:26 -04:00
BenCodez 0f00741151 Add extra failsafe on combined total on top voter storing 2023-04-30 14:10:20 -04:00
BenCodez 922302082f Implement new placeholder replacement system 2023-04-30 13:20:20 -04:00
BenCodez 24e1fbb6e5 Fix error 2023-04-30 12:51:45 -04:00
BenCodez 3026a2d48f Fix issue with placeholder 2023-04-30 12:42:02 -04:00
BenCodez 58101bfea0 Fixed top voter changes not working with sqlite 2023-04-30 12:40:22 -04:00
BenCodez 0a9e46ee85 Add placeholder %votingplugin_points_<number>% 2023-04-30 12:34:49 -04:00
BenCodez fd67e45c58 Add option for closing gui on click for top voter 2023-04-28 18:30:15 -04:00
BenCodez b6af6de2df Fix a few things 2023-04-27 17:00:01 -04:00
BenCodez 173051829e Implement close click handling to regular voteshop items 2023-04-26 19:44:30 -04:00
BenCodez 8a9ef4811f Make changes to CloseGUI option handling 2023-04-26 19:43:21 -04:00
BenCodez 4fd6d580b1 Implement same slot click system for vote shop extra items 2023-04-25 17:26:05 -04:00
BenCodez 415970101c Add CloseGUI option for VoteGUI 2023-04-24 18:52:35 -04:00
BenCodez 668dcdd8b4 Don't match exactly for votegui slots 2023-04-24 18:46:43 -04:00
BenCodez bf24533b54 Remove FLAT option 2023-04-23 20:31:40 -04:00
BenCodez b2daada576 Fix votetop GUI 2023-04-23 15:40:41 -04:00
BenCodez 9dd2c58134 Fix switch item 2023-04-23 15:30:55 -04:00
BenCodez 7674c68bc7 Add support for conditional items for rewards 2023-04-23 15:09:16 -04:00
BenCodez 0b3b0b29f5 Add more customization to top voter GUI 2023-04-23 14:29:41 -04:00
BenCodez 60370a1a83 Reload placeholder cache on reload 2023-04-23 12:43:58 -04:00
BenCodez 3bf273e854 Add to javascript engine main plugin instance 2023-04-22 15:38:33 -04:00
BenCodez a8e53c9b62 Added commands to reset voted sites 2023-04-22 15:27:16 -04:00
BenCodez 3015cd9604 Add placeholder for votegui 2023-04-22 09:02:16 -04:00
BenCodez 839119e0a9 Add sitesavailable placeholder for voteshop 2023-04-22 08:46:06 -04:00
BenCodez 409a0665cc Change multi-proxy socket handling for reloads 2023-04-21 21:32:07 -04:00
BenCodez 0549fe9c21 Add exit option to GUI for backbutton 2023-04-21 16:58:19 -04:00
BenCodez f047bb6176 Hide error for global data handling 2023-04-20 20:22:30 -04:00
BenCodez ad04b7e966 Fix voteshop message not working 2023-04-20 16:42:23 -04:00
BenCodez 2591cbf029 Add not buyable message to shop items 2023-04-19 19:15:21 -04:00
BenCodez 8213e07c74 Add support for extra items to voteshop 2023-04-19 19:08:29 -04:00
BenCodez 972f9581e3 Make /av placeholders command show placeholders as lowercase 2023-04-17 17:15:48 -04:00
BenCodez 2e17b3defd Update version number to 6.12.1 2023-04-17 17:05:28 -04:00
BenCodez 76dbfb8fdf Fixed issues with uppercase placeholders 2023-04-17 17:04:31 -04:00
BenCodez 8fd206b119 Fixed missing column types for mysql 2023-04-15 20:27:14 -04:00
BenCodez 9c6e514234 Update version number to 6.12 2023-04-15 20:09:36 -04:00
BenCodez eb66ccb90d Fix auto caching placeholders not saving for restarts 2023-04-15 20:07:30 -04:00
BenCodez c004dc6106 Fixed trying to cache invalid placeholders 2023-04-15 19:49:09 -04:00
BenCodez f54ccbd7b2 Improve config some more 2023-04-15 19:35:39 -04:00
BenCodez 8cdd0b713b More optimizations on time changes 2023-04-10 19:34:05 -04:00
BenCodez 2562e749db Optimize time change events even more 2023-04-10 17:49:29 -04:00
BenCodez 1a1e5d84bb Improve time change events performance if settings are disabled 2023-04-10 17:44:15 -04:00
BenCodez d4d23035e3 Update pom.xml 2023-04-07 16:46:56 -04:00
BenCodez 5e334e4a8a Update pom.xml 2023-04-07 16:45:16 -04:00
Ben 22991efccf Delete jitpack.yml 2023-04-07 16:39:51 -04:00
Ben 5341fbc3ba Update README.md 2023-04-07 16:09:53 -04:00
BenCodez 2e0fbd01e6 Check for vanish on vote reminding 2023-04-05 16:44:57 -04:00
BenCodez d1d395d9b3 Reformat config to improve overall look 2023-04-04 19:43:02 -04:00
BenCodez 9aeedac2ad Extra check on background task to make sure plugin is enabled 2023-04-02 19:36:56 -04:00
BenCodez 265ed68e0f Add extra check on background task if plugin is enabled 2023-04-01 15:37:04 -04:00
BenCodez b73daaf917 Improve /vote total all command speeds 2023-04-01 15:36:01 -04:00
BenCodez 39d8e414f4 Fix error on shutdown 2023-03-31 16:58:48 -04:00
BenCodez 693541dd00 Add support for extra items on other GUI's 2023-03-30 20:27:05 -04:00
BenCodez 5dce8031c5 More changes to placeholder caching 2023-03-29 17:32:37 -04:00
BenCodez babef8ccf3 Changes to placeholder caching 2023-03-29 17:10:01 -04:00
BenCodez 7a881206ca Change name of vote party one time commands option to avoid confusion 2023-03-28 19:42:52 -04:00
BenCodez aed8ecca26 Fix command help messages being wrong 2023-03-28 19:15:46 -04:00
BenCodez 25dab3157a Add improved placeholder controls 2023-03-27 20:28:54 -04:00
BenCodez 81d8b535ee Adjust caching setting 2023-03-26 17:47:01 -04:00
BenCodez c94802a141 Add global vote party bungee commands reward and edit commands 2023-03-25 19:56:18 -04:00
BenCodez 85e31f8292 Add config option to always use cache for placeholders - WIP 2023-03-25 19:03:59 -04:00
BenCodez da642cb3b2 Stop background task on plugin disable 2023-03-23 16:44:04 -04:00
BenCodez 96c707eca4 Changes to reloading multiproxy support 2023-03-22 19:26:14 -04:00
BenCodez ce5c469637 Update to 6.11.3 2023-03-18 19:17:00 -04:00
BenCodez 4126c4a7a1 Change default maven profile 2023-03-18 16:03:30 -04:00
Ben fb430a930b Create jitpack.yml 2023-03-18 15:57:25 -04:00
BenCodez 2c6f8c79c2 Shutdown multiproxy socket on reload if disabled 2023-03-18 14:52:23 -04:00
BenCodez 1b94f23ff2 Remove softdepend 2023-03-16 17:16:19 -04:00
BenCodez 72c0a88fc1 Load multiproxy support on reload 2023-03-15 16:49:19 -04:00
BenCodez e532987c6a Update to 1.19.4 2023-03-14 16:55:04 -04:00
BenCodez 2168d92b12 Cache almostallsites key 2023-03-07 18:46:26 -05:00
BenCodez d68758f34e Optimize placeholder caching updates 2023-03-05 17:12:32 -05:00
BenCodez e1b7844501 Undo change to bungee handling 2023-03-05 12:39:05 -05:00
BenCodez 01b6ed185b Changes to handling bungee votes 2023-03-04 18:56:35 -05:00
BenCodez 3ee31012ce Update version number to 6.11.2 2023-02-18 19:09:15 -05:00
BenCodez ba312961b8 Optimize player vote event even more 2023-02-12 20:20:50 -05:00
BenCodez a2484969ee Improve vote handling to deal with large databases 2023-02-12 18:51:32 -05:00
BenCodez 470196741c Improve getting user object 2023-02-12 17:17:23 -05:00
BenCodez 2abce5ebe7 Improve background task 2023-02-12 17:14:33 -05:00
BenCodez 20f775c119 Don't always run login/logout rewards unless needed 2023-02-12 13:53:04 -05:00
BenCodez e0821ed2b1 Minor log message change 2023-02-11 21:19:17 -05:00
BenCodez 6fbcc89fc8 Optimize player vote listener slightly 2023-02-11 17:51:13 -05:00
BenCodez 11f86194b0 Changes to how reload is handled 2023-02-11 15:55:21 -05:00
BenCodez 46c112d2ea Don't reload background task on plugin reload 2023-02-10 21:18:07 -05:00
BenCodez 0269578e5e More changes to background task 2023-02-10 21:17:17 -05:00
BenCodez fc14b19d9f Changes to vote processing 2023-02-10 21:11:49 -05:00
BenCodez 9c25f848c6 Add another test command 2023-02-09 19:16:50 -05:00
BenCodez b7f53aabfb Bug fix 2023-02-08 16:57:02 -05:00
BenCodez 926a009085 Remove extra checks 2023-02-08 16:54:34 -05:00
BenCodez f0737861de Add support for whitelist instead of blocked list on proxy 2023-02-07 19:55:00 -05:00
BenCodez 8e14a92813 Add metrics for multi-proxy support 2023-02-05 20:27:32 -05:00
BenCodez 78fc8069b3 More changes to background vote processing handling 2023-02-05 15:40:42 -05:00
BenCodez eed98ed638 Try different locking system for votes 2023-02-05 14:40:39 -05:00
BenCodez f3653c20f6 Silence no votifierevent message when using multiproxy setup 2023-02-05 12:18:59 -05:00
BenCodez 675f4bb6e9 Changes to vote handling 2023-02-04 18:05:13 -05:00
BenCodez 4dbb8b7360 Minor change to background task 2023-02-04 17:38:43 -05:00
BenCodez 5040ee2946 Support velocity booting without nuvotifier installed 2023-02-04 17:24:07 -05:00
BenCodez d7e1408c30 Fix offline broadcast not working correctly on bungee setups 2023-01-29 15:56:49 -05:00
BenCodez 73fda9027a Implement offline broadcast to bungee setups 2023-01-29 15:52:05 -05:00
BenCodez b762c6000f Fix double rewards with mutli-proxy setup 2023-01-29 14:41:08 -05:00
BenCodez 16dcd85807 Fix issues with offline voting on velocity 2023-01-29 14:32:18 -05:00
BenCodez d9b5fcf250 Fix issue on velocity 2023-01-29 14:02:29 -05:00
BenCodez b85f49010b Bug fix 2023-01-29 13:52:17 -05:00
BenCodez 42b64b86bd Add debug messages to multi-proxy setup 2023-01-29 13:28:46 -05:00
BenCodez 266014cbe2 Added /votingpluginbungee multiproxystatus 2023-01-29 13:11:10 -05:00
BenCodez 1e27e28a33 Implement multi-proxy support to velocity 2023-01-29 12:58:23 -05:00
BenCodez 1c530c18ce Change debug to log message 2023-01-27 19:24:41 -05:00
BenCodez c2ebd2251e Bug fix for multi-proxy setup 2023-01-27 19:22:23 -05:00
BenCodez c2fb84dc61 Added extra debug message 2023-01-27 18:56:08 -05:00
BenCodez 39e21bffe7 Minor fixes on multi-proxy handling 2023-01-27 16:58:28 -05:00
BenCodez 226b6eb01e Fix an issue 2023-01-27 16:49:47 -05:00
BenCodez 76a40fd889 Change handling on multi-proxy setup 2023-01-26 19:20:09 -05:00
BenCodez 32f43e7713 Fix issue on bungee login 2023-01-22 16:49:06 -05:00
BenCodez 601e57572f Update version number to 6.11.1 2023-01-21 20:38:01 -05:00
BenCodez 4a8bd40a8b Remove log message 2023-01-21 19:43:32 -05:00
BenCodez 8294e99eeb Change votifier processing 2023-01-21 19:42:16 -05:00
BenCodez 162e7f7faa Change timer handling 2023-01-21 19:11:30 -05:00
BenCodez 7463074b5a Add extra log message 2023-01-21 15:25:12 -05:00
BenCodez bbec19d5c9 Add config option to enable/disable vote queues during time change 2023-01-21 15:23:58 -05:00
BenCodez 72ed4223c4 Improve log messages on vote 2023-01-20 20:50:59 -05:00
BenCodez 603656248b Add another log message 2023-01-20 20:47:04 -05:00
BenCodez 4455a0254f Add extra debug message 2023-01-20 20:04:07 -05:00
BenCodez 3227c47d9b Changes to vote queue 2023-01-19 20:55:53 -05:00
BenCodez bf6885875f Smarter json parsing on voteurl 2023-01-19 19:15:34 -05:00
BenCodez 72934d1286 Change handling of voteparty to better handle last voted player 2023-01-18 19:59:06 -05:00
BenCodez 2a4840814d Fix offline vote processing on bungee 2023-01-17 19:00:17 -05:00
BenCodez 8b8e8acbc8 Modify handling of login on bungee 2023-01-17 17:19:36 -05:00
BenCodez a4ff2d8dcf Fix issues with velocity 2023-01-16 16:43:02 -05:00
BenCodez a6ca0c8121 Update version number to 6.11 2023-01-15 13:48:24 -05:00
BenCodez f3e88859d3 Fix a few issues 2023-01-15 13:37:33 -05:00
BenCodez 7249159ec9 Add more metrics 2023-01-15 12:51:58 -05:00
BenCodez 61c3eccb19 Changes to metrics 2023-01-14 20:41:28 -05:00
BenCodez 4ec800c83e Changes to metrics handling 2023-01-14 19:41:31 -05:00
BenCodez 20e42b0ae7 Fix issue with velocity startup 2023-01-14 15:07:17 -05:00
BenCodez d95becce22 Add geyser prefix to name on vote if needed 2023-01-11 19:06:24 -05:00
BenCodez 04fd38a10d Remove bungee geyser handle 2023-01-11 17:10:16 -05:00
BenCodez a30b2319f5 load metrics async 2023-01-11 17:00:01 -05:00
BenCodez a1b08f6dd0 Small change to voting 2023-01-10 16:50:16 -05:00
BenCodez 614193716f Change order of method 2023-01-09 18:45:15 -05:00
BenCodez b68ac4cdd5 Attempt to get geyser uuid 2023-01-09 18:44:04 -05:00
BenCodez 3767ca2883 Load secretkey.key file if using redis support and not socket method 2023-01-09 17:48:36 -05:00
BenCodez 73b7abf3e6 Add geyser prefix on bungee 2023-01-08 17:29:28 -05:00
BenCodez 285719ae28 Add geyser support to bungee 2023-01-08 17:08:59 -05:00
BenCodez 22fd1ac1e4 Fix listener not registering 2023-01-08 15:07:56 -05:00
BenCodez 6127a2ab23 Add cooldown end rewards per votesite & improve reward edit GUI's 2023-01-07 19:40:03 -05:00
BenCodez 0054b6e06f Add local time change queue handling (non bungee setups) 2023-01-06 20:59:38 -05:00
BenCodez b0f1e0bcb6 Fix vote shop closing 2023-01-06 18:59:25 -05:00
BenCodez ddd0dba728 Implement a better system to test for online servers with global data 2023-01-03 20:22:27 -05:00
BenCodez 9595164f69 Bug fixes 2023-01-03 16:43:10 -05:00
BenCodez 66092ba3fd Fix bungee time queue to actually remember time of vote 2023-01-02 20:37:50 -05:00
BenCodez 5c41c7f4c9 Improve global time handle 2023-01-02 19:36:15 -05:00
BenCodez dfa772af4b Minor change to vote party handling 2023-01-02 14:42:22 -05:00
BenCodez 78f33661aa Improvements to global data handler, handle resets, pause incoming votes 2023-01-01 22:07:52 -05:00
BenCodez 45f2bb2c72 Minor improvements to global data handling 2023-01-01 16:56:23 -05:00
BenCodez f20c7a58ac Add global data handler, WIP 2023-01-01 16:18:02 -05:00
BenCodez 4d1b37c37b Add AlmostAllSites reward 2023-01-01 16:16:43 -05:00
BenCodez d323cd7691 Store top voters before processing rest of time change event 2022-12-27 10:15:19 -05:00
BenCodez 67fc73b530 Delay top voter resetting to improve synchronization between servers 2022-12-27 10:13:38 -05:00
BenCodez 13872fd9d1 Rewrite all sites cooldown event to be a little more efficient 2022-12-19 21:09:00 -05:00
BenCodez a76da52a0a Add per site cooldown end event, enabled with config option 2022-12-19 21:01:58 -05:00
BenCodez 36fabe10a6 Add support for offline mode on bungee 2022-12-17 18:28:55 -05:00
BenCodez eada7af420 Replace placeholderapi placeholders in vote party command 2022-12-13 17:28:22 -05:00
BenCodez 63fc7d64be Update to 6.10.0 2022-12-10 19:42:03 -05:00
BenCodez 0ed5b12f8b Update to 1.19.3 2022-12-08 20:28:00 -05:00
BenCodez 504f9edbb2 Handle invalid materials on voteshop edits 2022-12-02 17:54:37 -05:00
BenCodez 8060ece2eb Update use of timers 2022-11-27 17:03:28 -05:00
BenCodez 254442fa2e Improve new topvoter sorting 2022-11-20 17:48:05 -05:00
BenCodez febead9d5a Bug fix 2022-11-20 17:27:55 -05:00
BenCodez d8cd0c278d Don't cache when sorting top voter 2022-11-20 17:10:54 -05:00
BenCodez fe0d7cd671 Change order of top voter to better handle ties 2022-11-20 14:06:07 -05:00
BenCodez c9d8878bb3 Add extra sorting to top voters 2022-11-20 14:04:30 -05:00
BenCodez 0f450e9b60 Catch NumberFormatException 2022-11-14 18:30:04 -05:00
BenCodez 667d0b544e More changes to timers 2022-10-31 18:44:24 -04:00
BenCodez 6e1e6bd928 Change to ScheduledExecutorService 2022-10-31 17:03:01 -04:00
BenCodez 1cfc447445 Add temp workaround to fix some issues 2022-10-31 16:55:27 -04:00
BenCodez 6d3e68e548 Add placeholder for players that voted in alternate broadcast 2022-10-13 15:53:12 -04:00
BenCodez 855dde196e More improvements for anysitereward with pluginmessaging 2022-10-06 20:39:21 -04:00
BenCodez d5a9e1012a Changes to pluginmessaging to fix anysiterewards 2022-10-05 16:47:36 -04:00
BenCodez f5d67833b2 Update version number to 6.9.5 2022-09-25 15:00:56 -04:00
BenCodez a1eb2f63e5 Fix cache issues on player vote 2022-09-14 20:28:19 -04:00
BenCodez a882b8d86f Undo minor change for cache on vote 2022-09-14 15:42:32 -04:00
BenCodez 0a745ae4c0 Fix issues with cache delays for cumulative/milestones 2022-09-10 15:00:48 -04:00
BenCodez d38a0549d3 Add 1 total to cumulative on local votes to prevent cumulative delay 2022-09-09 20:23:37 -04:00
BenCodez 6e6394f1fb Always update placeholder cache on background update 2022-09-08 19:21:54 -04:00
BenCodez ce58e12740 Fix error with sockets method on broadcasts 2022-09-03 20:46:51 -04:00
BenCodez 2411354a5f Added extra debug for reminders 2022-09-02 20:10:47 -04:00
BenCodez 13efd0c482 Add option for voteparty once per week 2022-08-30 19:36:06 -04:00
BenCodez 8fce74f30d Always store bungee voteparty info incase of restart 2022-08-27 20:14:36 -04:00
BenCodez 3f54c05f86 Update version number to 6.9.4 2022-08-27 19:30:43 -04:00
BenCodez dd1cf02c49 Fix voteparty setextrarequired command 2022-08-22 15:43:35 -04:00
BenCodez b462373dfc Run bstats metrics async 2022-08-20 07:54:20 -04:00
BenCodez c6e5d008d2 Update to 1.19.2 2022-08-07 14:07:31 -04:00
BenCodez 9a91561304 Improve addpoints command 2022-08-04 15:36:19 -04:00
BenCodez 1c6981e538 Change name of plugin in softdepend 2022-07-28 15:48:15 -04:00
BenCodez b6e366ff9d Update to 1.19.1 2022-07-27 18:59:58 -04:00
BenCodez ca0fbe7e3b Update version number to 6.9.3 2022-07-23 16:21:02 -04:00
BenCodez 27d8b3e718 Change gottenmilestones column to be bigger 2022-07-22 20:11:38 -04:00
BenCodez 8430609d0f Fix error on velocity if mysql is not set 2022-07-16 17:16:55 -04:00
BenCodez 8fe5e87999 Improve config comments 2022-07-10 15:06:43 -04:00
BenCodez 6b985e19c2 Add new experimental support for redis, new fully tested 2022-07-03 21:22:17 -04:00
BenCodez 4636cc78b2 Fix an error on velocity 2022-07-03 12:01:12 -04:00
BenCodez 8c66b50749 Fix spelling 2022-06-30 07:57:10 -04:00
BenCodez 7f6e95d47e Clicking icons in /votelast can now open links (if enabled) 2022-06-27 08:11:54 -04:00
BenCodez cd60ade45f Add additional debug for loading votesites 2022-06-26 12:39:24 -04:00
BenCodez f82945b97b Fix typo 2022-06-21 19:37:51 -04:00
BenCodez a3e9651378 Add config option to always process placeholders 2022-06-21 19:14:23 -04:00
BenCodez a764ca0ed7 Undo change 2022-06-21 19:03:51 -04:00
BenCodez d21464560a Minor change in placeholder handling 2022-06-21 19:01:31 -04:00
BenCodez 88c5dc7c86 Update version number to 6.9.2 2022-06-07 16:01:30 -04:00
BenCodez b2b2c710c5 Open gui on votesite creation 2022-06-07 14:09:50 -04:00
BenCodez 4175e2d36a Update 1.19 2022-06-07 13:29:33 -04:00
BenCodez a84adb367d Modify delay to login event 2022-06-02 17:10:46 -04:00
BenCodez 7368158707 Add command /av voteexact 2022-06-02 17:01:36 -04:00
BenCodez 5d3c1cb553 Use exact player name in /av user for forcing a vote 2022-05-29 13:04:58 -04:00
BenCodez cb1206db0b Updates to pluginmessaging and sockets 2022-05-18 20:12:45 -04:00
BenCodez 03396e447f Fix color codes on bungee commands 2022-05-17 20:56:58 -04:00
BenCodez 6dec0826af Update version number to 6.9.1 2022-05-15 15:33:12 -04:00
BenCodez f443f77dfe Add option to set cumulative as recurring 2022-05-13 17:04:04 -04:00
BenCodez 5c4636d8c2 Fixed issues with settings points to quickly, causing lost points 2022-05-12 20:55:22 -04:00
BenCodez 51c6c4066b Add cumulative blacklist 2022-05-12 19:27:02 -04:00
BenCodez 161fc6da95 Improve config comment on bungee 2022-05-08 12:11:10 -04:00
BenCodez aba23f355e Fix some issues with points within rewards 2022-05-07 19:37:59 -04:00
BenCodez ac78b4d350 Fix error on bungee 2022-04-27 17:30:41 -04:00
BenCodez 0c01f8d3c1 Update version number to 6.9 2022-04-24 15:15:57 -04:00
BenCodez 77dc7d51f5 Fix alternate broadcast broadcasting 0 votes on each login 2022-04-24 14:48:27 -04:00
BenCodez ee5c4db0c9 Fix playerjoinevent not working 2022-04-24 14:46:06 -04:00
BenCodez f9b47c5c63 Fix vote point adding in rewards 2022-04-18 16:59:56 -04:00
BenCodez d7dc82b1a7 Add extra checks 2022-04-18 16:57:57 -04:00
BenCodez c5041edd8a Add exr 2022-04-18 16:57:20 -04:00
BenCodez d52b7f85b3 use new method to get reward handler 2022-04-15 20:15:58 -04:00
BenCodez 3e4564578a CHange points reward handling 2022-04-15 14:35:07 -04:00
BenCodez 65312cd2a1 Add config option to only broadcast once for offline votes 2022-04-14 20:36:19 -04:00
BenCodez b2db9675ca Add ability to check if player doesn't have permission for vote shop 2022-04-13 16:47:09 -04:00
BenCodez 0a66c2dd7e Synchronize points adding 2022-04-06 17:36:20 -04:00
BenCodez 7c02cb91f4 Update version number to 6.8.4 2022-03-26 21:16:18 -04:00
BenCodez 3a390659cd Reenable config option 2022-03-26 20:16:11 -04:00
BenCodez 99bd32c8f5 Improve placeholder cache 2022-03-24 19:59:00 -04:00
BenCodez de894a98b2 Disable auto cache placeholders when no config option present 2022-03-24 17:35:00 -04:00
BenCodez 8c668289ce Add config options for mysql 2022-03-20 14:14:04 -04:00
BenCodez 95e850cb84 Add blacklist for rewards broadcasts 2022-03-20 12:48:03 -04:00
BenCodez d2134abc45 Fix broadcast blacklist not working on bungee setups 2022-03-19 17:10:47 -04:00
BenCodez 3316662889 Add default top voter material item 2022-03-05 21:57:15 -05:00
BenCodez 5b3ced6ca9 Attempt to fix /vote help for 1.12 2022-03-05 18:54:37 -05:00
BenCodez 50a5169543 Add extra check for background task for shutdowns 2022-03-03 16:52:23 -05:00
BenCodez c8d5e2f4b5 Have placeholders return error message rather than dots 2022-03-02 17:33:05 -05:00
BenCodez 3dcd78e4f5 change vote processing to java timers (hopes to reduce thread usage) 2022-02-22 16:51:18 -05:00
BenCodez de570574c9 Fix potential NPE on velocity shutdown 2022-02-20 16:52:32 -05:00
BenCodez 116eda2866 Update version number to 6.8.3 2022-02-20 13:44:33 -05:00
BuildTools 30f1576510 Fix creating milestones in GUI not working correctly 2022-02-19 17:00:05 -05:00
BuildTools 64e897615a use java timer for login/logout event 2022-02-18 19:16:18 -05:00
BuildTools 2dfd8dcfa5 Update version number to 6.8.2 2022-02-13 15:59:08 -05:00
BuildTools 00791766f1 Change default value of config option 2022-02-13 14:28:26 -05:00
ben 4d2c783d85 Improve getting uuid on proxy setups, more efficient 2022-02-11 17:14:05 -05:00
ben 19f1664662 Ignore casing when checking for disabled votesites 2022-02-06 12:34:01 -05:00
ben ca2e6fb530 Add extra null check 2022-02-02 16:57:28 -05:00
Ben eca7c6641a Merge pull request #1220 from pseudoforceyt/patch-1
Fix bungee setup wiki link
2022-01-24 16:46:52 -05:00
Ilamparithi M 47fe6b57e2 Fix bungee setup wiki link 2022-01-24 19:34:57 +05:30
ben 911819c69b Fix weekly top voters rewards feeding off monthly top voters 2022-01-23 14:03:25 -05:00
ben cda72b5c5b Let AdvancedCore handle vanished players 2022-01-23 13:18:16 -05:00
ben 75a3da98fa Change dependency 2022-01-22 15:24:13 -05:00
ben ced74fdee3 Changes to vanish event 2022-01-22 14:22:58 -05:00
ben b8460ff755 Add debug message for vanish login 2022-01-21 22:08:29 -05:00
ben 50bb1facc4 Modify event handling for playershowevent 2022-01-21 21:20:54 -05:00
ben 5ed21949e1 Add soft depends 2022-01-19 21:28:09 -05:00
ben 253e4937db Fix playershowevent not working completely 2022-01-19 19:51:32 -05:00
ben 192685ceec Add playershowevent for vanished players 2022-01-19 17:10:38 -05:00
BenCodez 16de063e51 Update version number to 6.8.1 2022-01-15 20:43:35 -05:00
BenCodez 1d3ce9ed64 Add another check 2022-01-14 21:50:21 -05:00
BenCodez d357c927c8 Add extra checks to ensure plugin is enabled before processing a vote 2022-01-14 21:47:33 -05:00
BenCodez 1143595238 modify placeholders 2022-01-13 20:57:33 -05:00
BenCodez 0917c36889 Add null check for player in placeholders 2022-01-12 18:57:12 -05:00
BenCodez c113214ae0 Add extra check on placeholders 2022-01-12 16:44:47 -05:00
BenCodez b2c444d125 Add PlayerPostVoteEvent 2022-01-11 21:04:50 -05:00
BenCodez 78fdce0eab fix npe 2022-01-10 18:51:02 -05:00
BenCodez feff09eccb Fix potential NPE 2022-01-09 17:35:57 -05:00
BenCodez d0646472bf Fix typos in votesites.yml 2022-01-09 11:22:29 -05:00
BenCodez 8471f50402 Fix certain placeholders not working 2022-01-06 19:28:13 -05:00
BenCodez 621450dae4 Add option to enable/disable auto placeholder cache 2022-01-03 21:15:16 -05:00
BenCodez 84e415e4bc Update version number to 6.8 2022-01-03 10:41:31 -05:00
BenCodez 54bbc8c740 Adding auto placeholder caching 2022-01-03 10:02:45 -05:00
BenCodez 7b1ab7e833 Code cleanup 2021-12-30 20:27:21 -05:00
BenCodez acb8f8a43f Code cleanup 2021-12-30 20:20:44 -05:00
BenCodez 279759b52f Code cleanup 2021-12-30 20:13:27 -05:00
BenCodez 02ca0b1fc8 Give players vote party reward, even if player has no reward data 2021-12-29 18:36:27 -05:00
BenCodez d57e3d1006 Add option to limit player data loading 2021-12-28 17:35:39 -05:00
BenCodez d54769eb82 Add command alias 2021-12-23 21:57:47 -05:00
BenCodez 35f6a3df15 Start progress on bungee time handling, keeps bungee in sync 2021-12-23 19:35:30 -05:00
BenCodez 46b66466ba Add ability to toggle vote reminders 2021-12-23 19:05:26 -05:00
BenCodez 53fbe4e5e2 Changes to placeholders 2021-12-21 18:55:12 -05:00
BenCodez 53ef7a7086 Add another event 2021-12-20 16:46:36 -05:00
BenCodez b0e08721fa Add scope to redis dependency 2021-12-19 21:00:20 -05:00
BenCodez 29dad6ca25 Add null check for redis 2021-12-19 17:48:03 -05:00
BenCodez 7c3e5eb09b Add bungee vote party placeholders 2021-12-19 14:40:50 -05:00
BenCodez a7776ec97c Hide socket settings by default to avoid confusion 2021-12-19 13:18:27 -05:00
BenCodez d598082c0a Add cache system for placeholders 2021-12-18 21:19:38 -05:00
BenCodez 4539b5b22a Add extra permission checks 2021-12-14 16:53:49 -05:00
BenCodez 02fe645d1e More changes to vote party commands 2021-12-12 12:52:37 -05:00
BenCodez ee8af6a314 Modify voteparty commands, add new ones to set/add totals 2021-12-12 12:49:50 -05:00
BenCodez a4b78c7d16 More fixes for redis 2021-12-11 08:20:20 -05:00
BenCodez d22fe462e5 Test change for redis 2021-12-10 17:02:53 -05:00
BenCodez c19182a2b4 Reuse config option 2021-12-07 17:32:03 -05:00
BenCodez 6905c3988b Remove option, auto enable redis support 2021-12-07 17:28:08 -05:00
BenCodez 23be120adc Small changes 2021-12-07 17:18:19 -05:00
BenCodez dae863f88f Bug fix 2021-12-07 17:07:54 -05:00
BenCodez d12f73d2fa Add option for redis bungee 2021-12-07 17:01:51 -05:00
BenCodez 316ee90713 Slight improvement to login events on bungee 2021-12-07 16:57:13 -05:00
BenCodez 1495fad96f Add softdepend 2021-12-07 16:47:23 -05:00
BenCodez 8e0de1709b Add permission requirements to base admin command 2021-12-06 18:52:57 -05:00
BenCodez ad22802e10 Remove unused command in plugin.yml 2021-12-06 16:53:21 -05:00
BenCodez 6de0345f06 Add option for backbutton on best GUI 2021-12-05 14:20:38 -05:00
BenCodez 7338a7d8ba added best and streak GUI's to vote gui ability to open 2021-12-05 13:32:44 -05:00
BenCodez 3ca12f2c91 Add expiremental redis support, untested 2021-12-05 12:51:13 -05:00
BenCodez 262e7c48c7 Fix socket method on velocity 2021-12-04 18:46:38 -05:00
BenCodez 0b62d99f9d Add debug for velocity socket method 2021-12-04 14:59:31 -05:00
BenCodez ea30de47d1 Update version number to 6.7.1 2021-11-28 19:11:17 -05:00
BenCodez a76daf3aba Modify debug on bungee 2021-11-28 16:46:58 -05:00
BenCodez e1ff13f4bf Add more debug for bungee for testing 2021-11-28 16:35:53 -05:00
BenCodez 12f941cf83 Add option for per server milestones 2021-11-27 20:21:42 -05:00
BenCodez 243377a76a More changes for 1.18 support 2021-11-27 19:38:15 -05:00
BenCodez d7eab03860 Fix bungee debug always active when it shouldn't 2021-11-27 17:21:10 -05:00
BenCodez ddd1f473f1 Properly reset gotten milestones on /av resyncmilestonesalreadygiven 2021-11-23 16:51:57 -05:00
BenCodez 3e52bb0936 Update library to support 1.18 2021-11-21 20:56:55 -05:00
BenCodez eb60220b1e Undo vote thread changes 2021-11-17 16:41:49 -05:00
BenCodez 00902bd597 Add a vote thread to prevent hitting resource limit 2021-11-15 17:22:48 -05:00
BenCodez d3606088cd Add option to only give 1 cumulative at a time 2021-11-07 13:55:18 -05:00
BenCodez ef2512e4e2 Change log level to info for using dev build 2021-11-01 16:41:55 -04:00
BenCodez 7f95a1c7c3 Fix issue with votereminding on shutdown 2021-10-21 16:42:54 -04:00
BenCodez 68a2fe27ff Update version number to 6.7 2021-10-10 14:08:38 -04:00
BenCodez b05317c460 Fix a few things with bungee voteparty 2021-10-10 13:50:47 -04:00
BenCodez 62fee6f347 Fix voteshop confirm not going back to main voteshop gui when it should 2021-10-05 20:25:44 -04:00
BenCodez ef7d4254e1 Fix more issues with velocity 2021-10-03 14:07:36 -04:00
BenCodez b6720ccc1f Fix issue on velocity 2021-10-03 13:52:43 -04:00
BenCodez 69d3d33008 Fix issue on velocity 2021-10-03 12:33:18 -04:00
BenCodez 7a193c87a9 Add vote party on bungee, online only, partly tested 2021-09-27 20:16:25 -04:00
BenCodez f2cf2fb734 Fix top voter clicking in GUI 2021-09-25 15:43:53 -04:00
BenCodez 836079b5ea Prevent NPE 2021-09-19 12:02:55 -04:00
BenCodez a7f6456480 Add option for closing inventory on vote 2021-09-17 17:15:51 -04:00
BenCodez 82f25c3899 Add debug message for disabled milstone 2021-09-13 17:23:22 -04:00
BenCodez cb2cdbd4fc Add points placeholder to vote shop 2021-09-08 16:59:15 -04:00
117 changed files with 10697 additions and 4016 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.
-17
View File
@@ -2,10 +2,6 @@
Plugin on SpigotMC
https://www.spigotmc.org/resources/votingplugin.15358/
![img](http://badge.henrya.org/spigot/downloads?id=15358&color=green)
![img2](http://badge.henrya.org/spigot/version?id=15358&color=red)
## License
### Creative Commons Arttribution 3.0 Unported
https://github.com/BenCodez/VotingPlugin/blob/master/VotingPlugin/Resources/LICENSE.txt
@@ -23,19 +19,6 @@ https://github.com/BenCodez/VotingPlugin/blob/master/VotingPlugin/Resources/LICE
<version>LATEST</version>
<scope>provided</scope>
</dependency>
BACKUP/OLD WAY
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.BenCodez</groupId>
<artifactId>VotingPlugin</artifactId>
<version>LATEST</version>
<scope>provided</scope>
</dependency>
Versions:
LATEST - latest stable release
+1
View File
@@ -5,3 +5,4 @@
/*.iml
/.settings/
/.classpath
/.factorypath
+78 -18
View File
@@ -1,21 +1,32 @@
# --------------------------
##########################################
# Bungee Setup
# Only if using votingplugin bungee to send votes
# REQUIRES RESTART FOR CHANGES TO TAKE EFFECT
# --------------------------
##########################################
# Plugin using bungee, requires plugin on bungee server
UseBungeecord: false
# What type of bungee setup
# Requires restart and set on all servers
# https://github.com/BenCodez/VotingPlugin/wiki/Bungeecoord-Setups
# https://github.com/BenCodez/VotingPlugin/wiki/Bungeecord-Setups
# Available:
# SOCKETS
# PLUGINMESSAGING
# 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
@@ -39,6 +50,11 @@ DisableBroadcast: false
# Requires server name below to be correct
PerServerRewards: false
# If true, milestones work per server
# Please note totals still sync, but milestones can be claimed on each server
# Needs to be set across all needed servers
PerServerMilestones: false
# If true, points will be given on a per server level
# Points will be added when server gets vote from bungee
PerServerPoints: false
@@ -47,22 +63,66 @@ 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
# -----------------------------
# For socket setup below only
# -----------------------------
# Rewards from bungee vote party
# Gives to only players only
# Use regular voteparty rewards otherwise
# Can edit via /av gui
BungeeVotePartyRewards: {}
# Bungee communication, add bungee host/port here
# For socket method
BungeeServer:
Host: '127.0.0.1'
Port: 1297
# Bungee communication, add this to bungee server
# For socket method
SpigotServer:
Host: '127.0.0.1'
Port: 1298
# List of commands to run on bungee party
# This runs a one time command only
BungeeVotePartyGlobalCommands: []
####################################################################################
# Global mysql data handle for between server commmunications
# This is NOT required for bungee voting to work
# This is still a WIP, use with caution
# This will create a different table then from users storing server info to process
#
# If you use this you need to enable this on BungeeSettings.yml on each server with votingplugin
# Make sure server name is set correctly in BungeeSettings.yml or this will not work correctly
#
# Please use PLUGINMESSAGING for this, SOCKETS should work as well, but not fully tested
#
# This will make votes cache until time change has finished processing
# In the event a server is offline or time change fails, the time change process
# will continue after a set amount of time (in essense skipping a specific server)
# This will also respect blocked servers in bungeeconfig.yml
GlobalData:
Enabled: false
# Use existing mysql connection from config.yml
UseMainMySQL: true
# Mysql settings only used if above is false
Host: ''
# Default port is 3306
Port: 3306
Database: ''
Username: ''
Password: ''
# Max number of connections
MaxConnections: 1
# Must be the same on all servers
Prefix: ''
#UseSSL: true
#PublicKeyRetrieval: false
#Attempt to use mariadb driver
#UseMariaDB: false
##########################################
# For socket setup
# Recommend to try PLUGINMESSAGING setup first
# Options hidden by default to avoid confusion
##########################################
# Options available here:
# https://github.com/BenCodez/VotingPlugin/wiki/Bungee-Setup-SOCKETS
+325 -176
View File
@@ -4,10 +4,13 @@
# https://github.com/BenCodez/VotingPlugin/wiki
# Config is sorted in sections
# Use Control + F to search with Notepad++
#
###########################################
# User storage
###########################################
# Valid Options:
# - SQLITE
# - FLAT
# - MYSQL
DataStorage: SQLITE
@@ -22,34 +25,21 @@ MySQL:
Password: ''
# Max number of connections
MaxConnections: 1
# Maxium size of caching mysql
# -1 for no limit
# Affecting this value may affect performance
MaxSize: -1
# Table name prefix, for use with mutliple servers
# Don't use with PLUGINMESSAGING bungee setup
Prefix: ''
#UseSSL: true
#PublicKeyRetrieval: false
#MaxLifeTime: -1
#Additional info on connection string
#Line: ''
#Attempt to use mariadb driver
#UseMariaDB: false
# --------------------
# AllowUnJoined options
# May need to set to true for bungee setup
# --------------------
# Let players who never joined before vote
# Recommend: False (Will prevent creating random user data)
AllowUnjoined: false
# Use server lookup for when allowunjoined is set to false
# Recommend leaving enabled unless you face issues
AllowUnJoinedCheckServer: true
# ------------------------------------------------
###########################################
# VoteReminding
# ------------------------------------------------
###########################################
# Configuration for VoteReminding
# By default this should be all setup to work
@@ -60,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
@@ -80,7 +70,7 @@ VoteReminding:
# This can also be edited via /av gui
Rewards:
Messages:
Player: '&aYou have %sitesavailable% to vote on still!'
Player: '&aYou have %sitesavailable% sites to vote on still!'
Title:
Enabled: false
Title: '&cRemember to vote!'
@@ -92,9 +82,9 @@ VoteReminding:
Message: '&cRemember to vote'
Delay: 30
# ------------------------------------------------
# Format
# ------------------------------------------------
###########################################
# Format options
###########################################
# Common PlacesHolders:
# Special PlaceHolders will be commented where available
@@ -110,7 +100,11 @@ Format:
# Broadcast vote message
# Set to an empty message to disable
# Use %NewLine% for a new line
BroadcastMsg: '&6[&4Broadcast&6] &2Thanks &c%player% &2for voting on %SiteName%'
# If true uses broadcast setting below for offline votes
OnlyOneOfflineBroadcast: false
OfflineBroadcast: '&6[&4Broadcast&6] &2Thanks &c%player% &2for voting on %numberofvotes% times!'
# Broadcast only when player is online
BroadcastWhenOnline: false
@@ -118,6 +112,8 @@ Format:
# Broadcast every x number of minutes with number of players that voted
AlternateBroadcast:
Enabled: false
# Use %players% for all players names
# Use %numberofplayers% for number of players that voted
Broadcast: '&6[&4Broadcast&6] &2%numberofplayers% voted in the last half hour! /vote'
# Delay in minutes
Delay: 30
@@ -176,6 +172,8 @@ Format:
TimeFormat: '%amount% %TimeType%'
LastVoted: '%times% ago'
NeverVoted: 'Never voted'
# Whether or not to include seconds into last voted time
IncludeSeconds: true
# Format for /vote total
Total:
@@ -249,9 +247,23 @@ 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'
ToggleReminders:
Enabled: '&cVote reminders enabled'
Disabled: '&cVote reminders disabled'
# Msg on top voter award, will only send message if that place has a reward set
# %place% = place - 1,2,3,etc
@@ -296,6 +308,7 @@ Format:
# Shop messages when using the /vote shop
ShopPurchase: '&aYou bought the %Identifier% for %Points% Points!'
ShopFailed: '&cYou do not have %Points% points to purchase this!'
ShopNotPurchasable: '&cThis item is not buyable!'
# User not exist message, from commands such as /vote next (player)
UserNotExist: '&cUser does not exist: %player%'
@@ -320,11 +333,24 @@ 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
VotingBroadcastBlacklist: []
# ------------------------------------------------
# Playernames to not be broadcasted when broadcast comes from reward file
# case sensitive
BroadcastBlacklist: []
###########################################
# Top Voter
# Top voter rewards available in specialrewards.yml
# ------------------------------------------------
###########################################
# Top voter blacklist
# Hide these names from top voter lists
@@ -360,109 +386,13 @@ MaxiumNumberOfTopVotersToLoad: 1000
StoreTopVoters:
Weekly: false
Daily: false
# ------------------------------------------------
# Advanced
# Most of these values can be left untouched for most setups
# ------------------------------------------------
# If true vanished players are treated as if they are offline
TreatVanishAsOffline: false
# If true, cooldown check is disabled
DisableCoolDownCheck: false
# If true, disable PlayerInteractEvent (for clicking signs and skulls)
DisableInteractEvent: false
# Delays login event, delays vote reminding and more
# In ticks
DelayLoginEvent: 0
# If false, votestreaks will be disabled
UseVoteStreaks: true
# If false, storing best totals will be disabled
UseHighestTotals: true
# If true, /vote will open /vote gui by default
UseVoteGUIMainCommand: false
# Number of points to give on vote
# Set to 0 to give no points
PointsOnVote: 1
# Set this to false to disable the plugin adding totals
# Not really recommended
AddTotals: true
# If true, items given for rewards are dropped on the ground
# If false, items will be given when there is space
DropOnFullInv: true
# If true, allsites will have an extra check to prevent duplicate allsites from being given
ExtraAllSitesCheck: false
# Click sound when using gui
# Set to none for no sound
ClickSound:
Sound: 'UI_BUTTON_CLICK'
Volume: 1.0
Pitch: 1.0
# Playernames to not be broadcasted when voting
# case sensitive
VotingBroadcastBlacklist: []
# When enabled, javascript will be parsed on placeholders (from placeholderapi)
# allows more fancy placeholders with math for example
UseJavascriptPlaceholders: false
# Limit monthly votes to number of days of a month multipled by the number of sites
LimitMonthlyVotes: false
# This is an extra safe guard to prevent milestones
# from being executed more than once
# Shoudn't be needed, but enable if you have trouble with milestones
PreventRepeatMilestones: false
# When enabled the command /vote setprimaryaccount (playername)
# will be shown (after restart)
# Primary account will be used instead of the players account to get
# placeholder and other data such as vote reminding
# Mainly to be used for alts and such
UsePrimaryAccountForPlaceholders: false
# Always force placeholders to return value if the value isn't cached
# This should prevent server from crashing when pulling placeholders on main thread
# Only affects placeholderapi placeholders
AlwaysWaitForCachePlaceholders: false
# If true, permissions will be handled differently
MultiplePermissionsCheck: false
AddCustomCommands: false
# Injects custom command to /vote
# Requires AddCustomCommand: true to be set
CustomCommands:
# identifier, not specific name
command1:
Args:
- token
# Message to send on command
Message: 'token message'
# Permission for this command
Permission: 'votingplugin.commands.vote.token'
# help message
HelpMessage: 'See tokens'
# Forces player to run this command
Commands:
- tokencommand
######################
###########################################
# Debug
######################
###########################################
# Debug levels:
# NONE
@@ -484,16 +414,83 @@ DebugInGame: false
# Not recommended though
LogVotesToFile: false
# Only update in the background when needed when set to false
AlwaysUpdate: false
###########################################
# Placeholderapi placeholders settings
###########################################
# Update in the background only if players are online
UpdateWithPlayersOnlineOnly: false
# When enabled the command /vote setprimaryaccount (playername)
# will be shown (after restart)
# Primary account will be used instead of the players account to get
# placeholder and other data such as vote reminding
# Mainly to be used for alts and such
UsePrimaryAccountForPlaceholders: false
# Delay between background updates like signs and more
# Default: 3 Minutes
# Longer times result in longer wait in stuff updating after a vote, like topvoter
DelayBetweenUpdates: 3
# Valid Options:
# 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
# Placeholder controls
# Add _process to end of placeholder to force a return value rather than . or .. if no cached value is ready
# Add _nocache to end of placeholder to skip cache and retrive a live value, uses a direct mysql connection, do not use on main thread
#
# Set which placeholders to cache at all times
# Use for placeholders to are pulled constantly or on the main thread
# Mainly aimed for scoreboards that pull placeholders often
# Placeholders may auto cache in certain conditions (if enabled above)
# Will use additional memory, but not a lot
# Still in early stages, please report bugs
# Please remove VotingPlugin_ from the placeholder listed here
CachedPlaceholders: []
#- Total_AllTime
# When enabled, javascript will be parsed on placeholders (from placeholderapi)
# allows more fancy placeholders with math for example
UseJavascriptPlaceholders: false
# Custom placeholder returns
# For the example below use %votingplugin_custom_enoughpoints_5%
# DO NOT USE ON MAIN THREAD IF POSSIBLE
# Keep everything lowercase
# Example:
#CustomPlaceholderReturns:
# 'enoughpoints_5':
# 'true': 'User has enough points'
# 'false': 'User does not have enough points'
CustomPlaceholderReturns: {}
###########################################
# Login options
###########################################
# If true vanished players are treated as if they are offline
TreatVanishAsOffline: false
# Delays login event, delays vote reminding and more
# In miliseconds, 1000 = 1 second
DelayLoginEvent: 0
# Wait until user is logged in with AuthMe
# Requires AuthMe or LoginSecurity
WaitUntilLoggedIn: true
###########################################
# Disable/Enable features
###########################################
# If true, cooldown check is disabled
DisableCoolDownCheck: false
# If true, disable PlayerInteractEvent (for clicking signs and skulls)
DisableInteractEvent: false
# Disable this on a hub server for example
# Still processes rewards for offline rewards (just won't give any)
ProcessRewards: true
# Set to true to disable no service site message on voting
# You should never have to touch this if everything is setup properly
@@ -504,55 +501,88 @@ DisableNoServiceSiteMessage: false
# If true fake votes will give points and totals
CountFakeVotes: true
# Give VotingPlugin.Player by default
# Requires restart to take affect
GiveDefaultPermission: true
# Whether or not to disable update checks
DisableUpdateChecking: false
# Permissions given by VotingPlugin.Player by default
# Permissions listed here will no be accessible with the default permission
DisabledDefaultPermissions: []
# Enable per site cooldown events, requires more resources to use
# Requires restart
PerSiteCoolDownEvents: false
# Remove old player files
# Happens on startup or /av purge
PurgeOldData: false
# Minimum number of days offline in order to purge
PurgeMin: 90
# Whether or not to create daily backups. (Only the most recent ones get kept)
CreateBackups: true
# Queue votes during a time change (doesn't apply to bungee voting)
# Votes will be given when time change is completed
QueueVotesDuringTimeChange: false
# If true, plugin will automaticly generate votesites
# Disable this if you experience issues with sites being created randomly
# 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
# 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
# Automaticly download the latest version
# Will require a restart to actually update
# Note: It takes 30-40 minutes before being able to download the latest build
# You can also use /av download
AutoDownload: false
# Whether or not to disable update checks
DisableUpdateChecking: false
# If false plugin will use offline player UUIDs
OnlineMode: true
# Allow transfer of vote points between players
AllowVotePointTransfers: false
# Disable checking on world change
# May improve performance
#DisableCheckOnWorldChange: false
# Disable this on a hub server for example
# Still processes rewards for offline rewards (just won't give any)
ProcessRewards: true
# Disable javascript processing in messages/rewards
DisableJavascript: false
# Disable checking permissions on tab complete
DisableAdvancedTab: 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
# Load command aliases, such as /avgui
# Requires restart to take effect
LoadCommandAliases: true
# Limits about of offline votesites
# Does not currently work with bungee votes from votingplugin
OfflineVotesLimit:
# Enable or disable
Enabled: false
# Limit of votes per votesite
Amount: 5
# Default worlds set for all rewards
DefaultRewardWorlds: []
# Wait until user is logged in with AuthMe
# Requires AuthMe
WaitUntilLoggedIn: true
# Default blackedlisted worlds set for all rewards
DefaultRewardBlackListedWorlds: []
###########################################
# Skull settings
###########################################
# Preload skulls to improve performance for vote top
# when using skulls as the item to display players
@@ -564,6 +594,54 @@ PreloadSkulls: false
# Will reduce ram usage (very little) if disabled, but slow GUI speeds when using skulls
LoadSkulls: true
###########################################
# Extra checks on vote
###########################################
# If true, allsites will have an extra check to prevent duplicate allsites from being given
ExtraAllSitesCheck: false
# This is an extra safe guard to prevent milestones
# from being executed more than once
# Shoudn't be needed, but enable if you have trouble with milestones
PreventRepeatMilestones: false
# Number of points to give on vote
# Set to 0 to give no points
PointsOnVote: 1
# May need to enable this for bungee setups
# Let players who never joined before vote
# Recommend: False (Will prevent creating random user data)
AllowUnjoined: false
# Use server lookup for when allowunjoined is set to false
# Recommend leaving enabled unless you face issues
AllowUnJoinedCheckServer: true
##############################################
# Command/Permission settings
##############################################
# Give VotingPlugin.Player by default
# Requires restart to take affect
GiveDefaultPermission: true
# Permissions given by VotingPlugin.Player by default
# Permissions listed here will no be accessible with the default permission
DisabledDefaultPermissions: []
# If true, /vote will open /vote gui by default
UseVoteGUIMainCommand: false
# Disable checking permissions on tab complete
# Could increase performance slightly, but probably not
DisableAdvancedTab: false
# Load command aliases, such as /avgui
# Requires restart to take effect
LoadCommandAliases: true
# Use vault for permission checks
# May not work on some plugins
UseVaultPermissions: false
@@ -574,27 +652,104 @@ UseVaultPermissions: false
# - PERMISSION
DisabledCommands: []
# Enable Geyser prefix support
GeyserPrefixSupport: false
GeyserPrefix: '*'
# If true, permissions will be handled differently
MultiplePermissionsCheck: false
# Allow transfer of vote points between players
# Requires restart for command to load
# Command: /vote givepoints (player) (points)
AllowVotePointTransfers: false
AddCustomCommands: false
# Injects custom command to /vote
# Requires AddCustomCommand: true to be set
CustomCommands:
# identifier, not specific name
command1:
Args:
- token
# Message to send on command
Message: 'token message'
# Permission for this command
Permission: 'votingplugin.commands.vote.token'
# help message
HelpMessage: 'See tokens'
# Forces player to run this command
Commands:
- tokencommand
##############################################
# Background task settings
##############################################
# Only update in the background when needed when set to false
AlwaysUpdate: false
# Update in the background only if players are online
UpdateWithPlayersOnlineOnly: false
# Delay between background updates like signs and more
# Default: 3 Minutes
# Longer times result in longer wait in stuff updating after a vote, like topvoter
DelayBetweenUpdates: 3
# Enable to true for extra player checks
# Recommend leaving this to false
ExtraBackgroundUpdate: false
##########################################
# Inventory controls
##########################################
# Click sound when using gui
# Set to none for no sound
ClickSound:
Sound: 'UI_BUTTON_CLICK'
Volume: 1.0
Pitch: 1.0
# If true, items given for rewards are dropped on the ground
# If false, items will be given when there is space
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'
# ###############################################################
# Deprecated options, don't recommend using any of these
# Will force GUI's to close on every click
AlwaysCloseInventory: false
# Close inventory on player vote
# This is to prevent any possible exploits
CloseInventoryOnVote: true
# This will close GUI's if you shift click them rather than a regular
# This can help prevent exploits
CloseGUIOnShiftClick: false
###########################################
# Purge settings
###########################################
# Remove old player files
# Happens on startup or /av purge
PurgeOldData: false
# Minimum number of days offline in order to purge
PurgeMin: 90
##########################################
# Extra options
# 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
@@ -605,9 +760,3 @@ RequestAPI:
DefaultMethod: 'Anvil'
DisabledMethods: []
# Shouldn't need to change this
#AutoKillInvs: true
# Disable checking on world change
# May improve performance
#DisableCheckOnWorldChange: false
+40 -4
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'
@@ -79,8 +79,8 @@ CHEST:
# Name: 'Extra item'
## Works on most GUI items
# Slot: 10
## Send rewards on click, run commands, check conditions, etc
# Rewards: []
## Send rewards on click, run commands, check conditions, etc
# Rewards: []
# GUI for /vote url, /vote
VoteURL:
@@ -123,6 +123,7 @@ CHEST:
# URL when clicking item in /vote (GUI version)
URLText: '%VoteUrl%'
# #Add Extra items
# This extra item format works across other gui settings below
# ExtraItems:
# Item1:
# Material: DIRT
@@ -138,9 +139,14 @@ CHEST:
# %time% = time, using timeformat below
# %timesince% = time since vote
Line: '&6%timeSince%'
ClickableLinks: true
VoteNext:
Name: 'VoteNext: %player%'
BackButton: true
# Extra customization for displaying site names in GUI only
#CustomSiteNamesDisplays:
# Site1: site name display
LoreLine: '%time%'
VoteToday:
Name: 'VoteToday'
Line: '&6%VoteSite% : %Time%'
@@ -160,11 +166,17 @@ CHEST:
Lore: '&3&lVotes: &3%votes%'
# Opens main GUI of the specific player that gets clicked
OpenMainGUIOnClick: true
# Close GUI when clicking on a player item
CloseGUIOnClick: true
SwitchItem:
Name: '&3Switch TopVoter'
Lore: '&bCurrently: %Top%'
Material: 'OAK_SIGN'
Amount: 1
# Top voters for the switch item to use
#TopVoters:
#- ALLTIME
#- MONTHLY
# 8 Slots over from the bottom left
# Bottom of GUI
Slot: 7
@@ -175,6 +187,15 @@ CHEST:
# Item for player in GUI if use skull is false
PlayerItem:
Material: 'PAPER'
Customization:
Enabled: false
# List of slots for top voter
PlayerSlots: []
# Add extra items
ExtraItems: {}
RemoveBottomBar: false
# Set slot for backbutton
BackButtonSlot: 0
VoteTotal:
Name: 'VoteTotal: %player%'
BackButton: true
@@ -204,6 +225,7 @@ CHEST:
Amount: 1
VoteBest:
Name: 'VoteBest: %player%'
BackButton: true
DayBest:
Item:
Material: 'CLOCK'
@@ -276,6 +298,8 @@ CHEST:
OpenVoteURL: false
# If true, backbutton will be the last slot of the GUI
EndOfGUI: false
# If true, this item will become an exit button instead
Exit: false
VoteShopBackButton: true
VoteShopEnabled: true
@@ -285,6 +309,12 @@ CHEST:
VoteShopLimitReached: '&aYou reached your limit'
VoteShopRequireConfirmation: false
VoteShopDisabled: '&cVote shop disabled'
# If true, shop gui will reopen, updating all placeholders
VoteShopReopenGUIOnPurchase: false
# VoteShop extra items for display only
#VoteShopExtraItems:
#Item:
#...
Shop:
# Identifier
# Used in placeholders for formats
@@ -305,6 +335,8 @@ CHEST:
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
@@ -348,7 +380,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]'
+39 -5
View File
@@ -13,14 +13,26 @@ FirstVote:
FirstVoteToday: {}
# All vote rewards
# Reward for voting on all sites in one day
# One time reward for voting on all sites in one day
# Enable ExtraAllSitesCheck if you get double rewards
AllSites:
Messages:
Player: '&aYou voted on all sites in 1 day!'
# Give a reward for voting on all sites minus 1
# Similar to allsites
#AlmostAllSites:
# Messages:
# Player: '&aYou almost voted on all sites in 1 day!'
# If true only cumulative reward at a time can be given
# The cumulative rewards will go in order as listed under Cumulative, so if true
# the first cumulative (in the order as listed) that can be given will, then will ignore the rest
OnlyOneCumulative: false
# NOTE: This is not a 1 time reward, that's what milestones are for!
# If total votes (Can be changed) divided by cumulative amount
# and as no remainder (So divides perfectly)then a reward is given
# and with no remainder (So divides perfectly) then a reward is given
Cumulative:
# Number of votes required
# Allows multiple cumulative rewards
@@ -28,7 +40,7 @@ Cumulative:
# Can have multiple listed here
'20':
Enabled: false
# Wether or not votes must be made in same day/week
# Whether or not votes must be made in same day/week
# Useful if you want to require a certain number of voting sites to be voted on
# for a daily/weekly reward instead of all of them
# Valid options
@@ -37,6 +49,11 @@ Cumulative:
# Weekly
# Daily
TotalToUse: AllTime
# Blacklist recurring votes
#BlackList:
#- 40
# Whether or not to gives cumulative reward for every x number of votes, default: true
#Recurring: true
Rewards:
Messages:
Player: '&aYou got %cumulative% cumulative votes!'
@@ -64,7 +81,11 @@ VoteParty:
ResetMonthly: false
# If true, will give voteparty only once per day
OnlyOncePerDay: false
# Reset extra votes
# If true, will give voteparty once per week only
OnlyOncePerWeek: false
# Reset extra votes weekly
ResetExtraVotesWeekly: false
# Reset extra votes monthly
ResetExtraVotesMonthly: false
# Count votes from /av vote?
CountFakeVotes: true
@@ -74,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!'
# List of votes required amounts for when to send vote party reminders
VoteReminderAtVotes: []
# List of commands to execute, these only execute once.
# %player% does not work here
Commands: []
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
@@ -109,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
@@ -168,6 +197,11 @@ LogoutRewards: {}
EnableMonthlyAwards: true
# TopVoter Placeholders:
#%place% - place in topvoter
#%topvoter% - topvoter type
#%votes% - current total votes related to top voter
# Rewards to give
MonthlyAwards:
# Position. 1 is first in top voter, 2 is second, etc...
+16 -5
View File
@@ -2,6 +2,7 @@ VoteSites:
# VoteSite key
# Used for saving data for votesites
# Use a short name if you can
# No spaces or dots
ExampleVoteSite:
# Enable voteSite
# If false, votesite will not be loaded by plugin
@@ -26,7 +27,7 @@ VoteSites:
ServiceSite: 'PlanetMinecraft.com'
# vote url for /vote
# Format for this can be set in Format.yml
# Format for this can be set in Config.yml
# Do not include colors here
# If you need to force a url set the url as this:
# VoteURL: '[Text="ANY TEXT TO CLICK ON HERE",url="URLHERE"]'
@@ -37,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
@@ -47,8 +49,11 @@ VoteSites:
# Recommend: false
VoteDelayDaily: false
#Offset time for /vote next caculations
#TimeOffSet: 0
# Replaces offset, set the exact hour based on server time
# Include server time offset when setting this
# 2 = 2 am server time
# Use 1-24
#VoteDelayDailyHour: 14
# If true, rewards can be executed offline (requires ForceOffline to be true in the reward)
# Setting this to true will execute the reward offline while the player is offline
@@ -60,9 +65,15 @@ VoteSites:
DisplayItem:
Material: 'DIAMOND'
Amount: 1
# Reward to run when cooldown ends for this votesite
# Enable PerSiteCoolDownEvents in Config.yml to use this
#CoolDownEndRewards:
# Messages:
# Player: '&aTime to go vote on site1'
# Rewards to give
# https://github.com/Ben12345rocks/AdvancedCore/wiki/Rewards
# https://github.com/BenCodez/AdvancedCore/wiki/Rewards
Rewards:
# Execute console commands
Commands:
@@ -108,7 +119,7 @@ VoteSites:
Messages:
Player: 'You got unlucky'
# Give 1 diamond
# Give 1 diamond regardless of above
Items:
item1:
Material: DIAMOND
+3 -1
View File
@@ -1,4 +1,6 @@
name: ${project.name}
version: ${project.version}
main: com.bencodez.votingplugin.bungee.VotingPluginBungee
author: BenCodez
author: BenCodez
softDepends:
- RedisBungee
+165 -29
View File
@@ -11,14 +11,55 @@ Username: ''
Password: ''
# Max number of connections
MaxConnections: 1
# Maxium size of caching mysql
# -1 for no limit
# Affecting this value may affect performance
MaxSize: -1
# Table name prefix, for use with mutliple servers
# Don't use with PLUGINMESSAGING bungee setup
Prefix: ''
#UseSSL: true
#PublicKeyRetrieval: false
#Attempt to use mariadb driver
#UseMariaDB: false
####################################################################################
# Global mysql data handle for between server commmunications
# This is NOT required for bungee voting to work
# This is still a WIP, use with caution
# This will create a different table then from users storing server info to process
#
# If you use this you need to enable this on BungeeSettings.yml on each server with votingplugin
# Make sure server name is set correctly in BungeeSettings.yml or this will not work correctly
#
# Please use PLUGINMESSAGING for this, SOCKETS should work as well, but not fully tested
#
# This will make votes cache until time change has finished processing
# In the event a server is offline or time change fails, the time change process
# will continue after a set amount of time (in essense skipping a specific server)
# This will also respect blocked servers
GlobalData:
Enabled: false
# Use existing connection above
UseMainMySQL: true
# Mysql settings only used if above is false
Host: ''
# Default port is 3306
Port: 3306
Database: ''
Username: ''
Password: ''
# Max number of connections
MaxConnections: 1
# Must be the same on all servers
Prefix: ''
#UseSSL: true
#PublicKeyRetrieval: false
#Attempt to use mariadb driver
#UseMariaDB: false
# Time offset for time changes
# Must match on all servers
TimeHourOffSet: 0
####################################################################################
Debug: false
# Have a reward on each server
@@ -29,15 +70,30 @@ SendVotesToAllServers: true
BlockedServers:
- hub
# Similar to BlockServers
# If a server is listed then blockedservers is ignored
WhiteListedServers: []
# What type of bungee setup
# Requires restart and set on all servers
# https://github.com/BenCodez/VotingPlugin/wiki/Bungeecoord-Setups
# Available:
# SOCKETS
# PLUGINMESSAGING
# PLUGINMESSAGING (Recommended)
# MYSQL
# REDIS
BungeeMethod: PLUGINMESSAGING
# 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
@@ -48,42 +104,122 @@ PointsOnVote: 1
# If true, bungee will handle adding totals
# If false, spigot servers will EACH set their own totals
# If false, AllowUnJoined should false on bungee, spigot servers will handle that
# Recommened to leave true, setting to false setups are currently unsupported
# If false, AllowUnJoined should be enabled on bungee, spigot servers will handle that
# Recommeneded to leave enabled, setups with this disabled are currently unsupported
BungeeManageTotals: true
# Tell servers to broadcast
# Set DisableBroadcast to true on spigot servers (BungeeSettings.yml) as well
Broadcast: true
# ----------------------------
# 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
VoteParty:
# If enabled, will trigger vote party reward
# in BungeeSettings.yml under BungeeVotePartyReward
# Only runs rewards for online players
Enabled: false
# Votes required
VotesRequired: 100
# Increase amount required on each vote party
IncreaseVotesRequired: 0
# If false, will only send to servers listed below
SendToAllServers: true
# Servers to send to, if SendToAllServers is false
ServersToSend: []
# List of commands to run on bungee server
# Set spigot commands in BungeeSettings.yml
BungeeCommands: []
Broadcast: '&aVote party has been reached!'
# Online mode for UUIDS
# Offline mode setups are not fully tested and are not supported currently
OnlineMode: true
##########################################
# PLUGINMESSAGING Settings
# ----------------------------
##########################################
# 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
# ----------------------------
# SOCKET Settings
# ONLY for SOCKET method
# ----------------------------
# Server to send vote to if player is offline
FallBackServer: factions
##########################################
# Multi-proxy setup
# This is still a WIP, use with caution
# 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
##########################################
# Bungee communication, Add this to each spigot server
# For socket method
BungeeServer:
Host: '127.0.0.1'
Port: 1297
# Support for multiple proxies
MultiProxySupport: false
# Enable on primary proxy server with votifier
PrimaryServer: false
# If enabled, player will only get 1 reward on a server on the network
# Must be enabled on all proxies for this to work
# 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: ''
# Bungee communication, add each spigot server here
# For socket method
SpigotServers:
lobby:
Host: '127.0.0.1'
Port: 1298
factions:
Host: '127.0.0.1'
Port: 1999
# 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
Port: 1235
+271 -261
View File
@@ -1,261 +1,271 @@
name: ${project.name}
version: ${project.version}
main: com.bencodez.votingplugin.VotingPluginMain
description: Highly Customizable Voting Listener!
website: https://www.spigotmc.org/resources/votingplugin.15358/
author: BenCodez
softdepend: [MVdWPlaceholders, Votifier, VotifierPlus, NuVotifier, CMI, Vault, PlaceholderAPI, ProtocolLib, MVdWPlaceholderAPI, AuthMe]
loadbefore: [MCPerks]
api-version: 1.13
libraries:
- org.openjdk.nashorn:nashorn-core:15.2
commands:
vote:
description: Vote command
adminvote:
description: Admin commands for VotingPlugin
av:
description: Admin commands for VotingPlugin
votehelp:
description: See access to a list of commands, Formated in Format.yml
aliases: vhelp
votetotal:
description: See totals of votes
aliases: vtotal
votelast:
description: See the last time you voted
aliases: vlast
votenext:
description: See when you can vote next
aliases: vnext
votetop:
description: See top voters
aliases: vtop
votetoday:
description: See who voted today
aliases: vtoday
votegui:
description: Open VoteGUI
aliases: vgui
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
voteshop:
description: A command
aliases: vshop
votebest:
description: A command
aliases: vbest
votestreak:
description: A command
aliases: vstreak
votetogglebroadcast:
description: A command
aliases: vtogglebroadcast
votepoints:
description: A command
aliases: vpoints
votelist:
description: A command
aliases: vlist
voteall:
description: A command
aliases: vall
votechoices:
description: A command
alaises: vchoices
votegivepoints:
description: A command
alaises: vgivepoints
adminvotehelp:
description: Open adminvote help
aliases: avhelp
adminvote?:
description: Open adminvote help
aliases: av?
adminvotereport:
description: Command Alias
aliases: avreport
adminvoteperms:
description: Command Alias
aliases: avperms
adminvoteDownload:
description: Command Alias
aliases: avdownload
adminvotereload:
description: Command Alias
aliases: avreload
adminvotetestreward:
description: Command Alias
aliases: avtestreward
adminvoteversion:
description: Command Alias
aliases: avversion
adminvotesites:
description: Command Alias
aliases: avsites
adminvoterewards:
description: Command Alias
aliases: avrewards
adminvoteuuid:
description: Command Alias
aliases: avuuid
adminvotevotesite:
description: Command Alias
aliases: avvotesite
adminvoteconfig:
description: Command Alias
aliases: avconfig
adminvoteupdatecheck:
description: Command Alias
aliases: avupdatecheck
adminvotevote:
description: Command Alias
aliases: [avvote, fakevote]
adminvotegui:
description: Command Alias
aliases: avgui
adminvotegivereward:
description: Command Alias
aliases: avgivereward
adminvoteConvertFromData:
description: Command Alias
aliases: avConvertFromData
adminvoteClearTotal:
description: Command Alias
adminvoteBackgroundUpdate:
description: Command Alias
aliases: avBackgroundUpdate
adminvoteClearCache:
description: Command Alias
aliases: avClearCache
adminvoteServiceSites:
description: Command Alias
aliases: avServiceSites
adminvoteSetVotePartyCount:
description: Command Alias
aliases: avSetVotePartyCount
adminvoteChoices:
description: Command Alias
aliases: avChoices
adminvoteReloadAll:
description: Command Alias
aliases: avReloadAll
adminvotePermsPlayer:
description: Command Alias
aliases: avPermsPlayer
adminvoteResyncMilestonesAlreadyGiven:
description: Command Alias
aliases: avResyncMilestonesAlreadyGiven
voteSetPrimaryAccount:
description: Command Alias
adminvoteClearOfflineVotes:
description: Command Alias
aliases: avClearOfflineVotes
adminvoteGiveAll:
description: Command Alias
aliases: avGiveAll
adminvoteGiveAllOnline:
description: Command Alias
aliases: avGiveAllOnline
adminvoteForceTimeChanged:
description: Command Alias
aliases: avForceTimeChanged
adminvoteplayername:
description: Command Alias
aliases: avplayername
adminvoteResyncMilestones:
description: Command Alias
aliases: avResyncMilestones
adminvoteClearOfflineRewards:
description: Command Alias
aliases: avClearOfflineRewards
adminvoteUserRemove:
description: Command Alias
aliases: avUserRemove
adminvotePurge:
description: Command Alias
aliases: avPurge
adminvoteJavascript:
description: Command Alias
aliases: avJavascript
adminvoteStatus:
description: Command Alias
aliases: avStatus
adminvoteTest:
description: Command Alias
aliases: avTest
adminvotePlaceholders:
description: Command Alias
aliases: avPlaceholders
adminvoteDownloadJenkins:
description: Command Alias
aliases: avDownloadJenkins
adminvoteForceVoteParty:
description: Command Alias
aliases: avForceVoteParty
adminvoteSetRequestMethod:
description: Command Alias
aliases: avSetRequestMethod
adminvoteUser:
description: Command Alias
aliases: avUser
adminvoteCurrentPluginTime:
description: Command Alias
aliases: avCurrentPluginTime
adminvoteResetPoints:
description: Command Alias
aliases: avResetPoints
adminvoteVotePartyExtraRequired:
description: Command Alias
aliases: avVotePartyExtraRequired
adminvoteRunCMD:
description: Command Alias
aliases: avRunCMD
adminvoteuseruuidremove:
description: Command Alias
aliases: avuseruuidremove
adminvoteedit:
description: Command Alias
aliases: avedit
adminvoteResetMilestoneCount:
description: Command Alias
aliases: avResetMilestoneCount
permissions:
VotingPlugin.Player:
description: Allows basic access player commands
VotingPlugin.Mod:
description: Allows mod commands
VotingPlugin.Admin:
description: Allows admincommands
VotingPlugin.Login.RemindVotes:
description: Allows players to get remined on login if they can vote
default: true
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.Sign.Create:
description: Permission to create sign
VotingPlugin.Admin.GenerateServiceSite:
description: Permission for generating votesite message
VotingPlugin.Login.RemindVotes:
description: Permission to allow timed reminders
VotingPlugin.Login.RemindVotes.All:
description: Remind if player can vote on all votesites, rather than any
default: false
name: ${project.name}
version: ${project.version}
main: com.bencodez.votingplugin.VotingPluginMain
description: Highly Customizable Voting Listener!
website: https://www.spigotmc.org/resources/votingplugin.15358/
author: BenCodez
softdepend:
- MVdWPlaceholders
- Votifier
- VotifierPlus
- NuVotifier
- Vault
- PlaceholderAPI
- ProtocolLib
- MVdWPlaceholderAPI
- AuthMe
- SuperVanish
- PremiumVanish
- LuckPerms
loadbefore:
- MCPerks
api-version: 1.13
folia-supported: true
libraries:
- org.openjdk.nashorn:nashorn-core:15.3
commands:
vote:
description: Vote command
adminvote:
description: Admin commands for VotingPlugin
av:
description: Admin commands for VotingPlugin
votehelp:
description: See access to a list of commands, Formated in Format.yml
aliases: vhelp
votetotal:
description: See totals of votes
aliases: vtotal
votelast:
description: See the last time you voted
aliases: vlast
votenext:
description: See when you can vote next
aliases: vnext
votetop:
description: See top voters
aliases: vtop
votetoday:
description: See who voted today
aliases: vtoday
votegui:
description: Open VoteGUI
aliases: vgui
voteurl:
description: Open VoteURL
aliases: vurl
votereward:
description: Open VoteReward GUI
aliases: vreward
voteparty:
description: A command
aliases: vparty
voteshop:
description: A command
aliases: vshop
votebest:
description: A command
aliases: vbest
votestreak:
description: A command
aliases: vstreak
votetogglebroadcast:
description: A command
aliases: vtogglebroadcast
votepoints:
description: A command
aliases: vpoints
votetogglereminders:
aliases:
- vtogglereminder
- vtoggle
votelist:
description: A command
aliases: vlist
voteall:
description: A command
aliases: vall
votechoices:
description: A command
alaises: vchoices
votegivepoints:
description: A command
alaises: vgivepoints
adminvotehelp:
description: Open adminvote help
aliases: avhelp
adminvote?:
description: Open adminvote help
aliases: av?
adminvotereport:
description: Command Alias
aliases: avreport
adminvoteperms:
description: Command Alias
aliases: avperms
adminvotereload:
description: Command Alias
aliases: avreload
adminvotetestreward:
description: Command Alias
aliases: avtestreward
adminvoteversion:
description: Command Alias
aliases: avversion
adminvotesites:
description: Command Alias
aliases: avsites
adminvoterewards:
description: Command Alias
aliases: avrewards
adminvoteuuid:
description: Command Alias
aliases: avuuid
adminvotevotesite:
description: Command Alias
aliases: avvotesite
adminvoteconfig:
description: Command Alias
aliases: avconfig
adminvoteupdatecheck:
description: Command Alias
aliases: avupdatecheck
adminvotevote:
description: Command Alias
aliases:
- avvote
- fakevote
adminvotegui:
description: Command Alias
aliases: avgui
adminvotegivereward:
description: Command Alias
aliases: avgivereward
adminvoteconvertfromdata:
description: Command Alias
aliases: avconvertfromdata
adminvoteonverttodata:
description: Command Alias
aliases: avconverttodata
adminvotecleartotal:
description: Command Alias
adminvotebackgroundupdate:
description: Command Alias
aliases: avbackgroundupdate
adminvoteclearcache:
description: Command Alias
aliases: avclearcache
adminvoteservicesites:
description: Command Alias
aliases: avservicesites
adminvotevoteparty:
description: Command Alias
aliases: avvoteparty
adminvotechoices:
description: Command Alias
aliases: avchoices
adminvotereloadall:
description: Command Alias
aliases: avreloadall
adminvotepermsplayer:
description: Command Alias
aliases: avpermsplayer
adminvoteresyncmilestonesalreadygiven:
description: Command Alias
aliases: avresyncmilestonesalreadygiven
votesetprimaryaccount:
description: Command Alias
adminvoteclearofflinevotes:
description: Command Alias
aliases: avclearofflinevotes
adminvotegiveall:
description: Command Alias
aliases: avgiveall
adminvotegiveallonline:
description: Command Alias
aliases: avgiveallonline
adminvoteforcetimechanged:
description: Command Alias
aliases: avforcetimechanged
adminvoteplayername:
description: Command Alias
aliases: avplayername
adminvoteresyncmilestones:
description: Command Alias
aliases: avresyncmilestones
adminvoteclearofflinerewards:
description: Command Alias
aliases: avclearofflinerewards
adminvoteuserremove:
description: Command Alias
aliases: avuserremove
adminvotepurge:
description: Command Alias
aliases: avpurge
adminvotejavascript:
description: Command Alias
aliases: avjavascript
adminvotestatus:
description: Command Alias
aliases: avstatus
adminvotetest:
description: Command Alias
aliases: avtest
adminvoteplaceholders:
description: Command Alias
aliases: avplaceholders
adminvotedownloadjenkins:
description: Command Alias
aliases: avdownloadjenkins
adminvotesetrequestmethod:
description: Command Alias
aliases: avsetrequestmethod
adminvoteuser:
description: Command Alias
aliases: avuser
adminvotecurrentplugintime:
description: Command Alias
aliases: avcurrentplugintime
adminvoteresetpoints:
description: Command Alias
aliases: avresetpoints
adminvoteruncmd:
description: Command Alias
aliases: avruncmd
adminvoteuseruuidremove:
description: Command Alias
aliases: avuseruuidremove
adminvoteedit:
description: Command Alias
aliases: avedit
adminvoteresetmilestonecount:
description: Command Alias
aliases: avresetmilestonecount
permissions:
VotingPlugin.Player:
description: Allows basic access player commands
VotingPlugin.Mod:
description: Allows mod commands
VotingPlugin.Admin:
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:
description: Permission for generating votesite message
VotingPlugin.Login.RemindVotes:
description: Permission to allow timed reminders
VotingPlugin.Login.RemindVotes.All:
description: Remind if player can vote on all votesites, rather than any
default: false
+179 -40
View File
@@ -3,13 +3,11 @@
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.6.3</version>
<artifactId>${version.art}</artifactId>
<version>6.16.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>
@@ -63,7 +61,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<version>3.4.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
@@ -92,7 +90,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<version>3.5.3</version>
<configuration>
<shadedArtifactAttached>false</shadedArtifactAttached>
<minimizeJar>true</minimizeJar>
@@ -105,9 +103,15 @@
</filter>
</filters>
<relocations>
<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>
@@ -115,24 +119,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>
@@ -143,7 +153,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>
@@ -166,7 +177,7 @@
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<version>3.3.1</version>
<executions>
<execution>
<id>copy-resources</id>
@@ -196,7 +207,6 @@
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>maven-central</id>
<url>https://oss.sonatype.org/content/groups/public</url>
@@ -213,24 +223,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.17.1-R0.1-SNAPSHOT</version>
<version>1.20.6-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.2</version>
<version>1.18.32</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.2</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -248,36 +267,56 @@
<dependency>
<groupId>com.velocitypowered</groupId>
<artifactId>velocity-api</artifactId>
<version>1.1.5</version>
<version>3.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-velocity</artifactId>
<version>2.2.1</version>
<version>3.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>prod</id>
<properties>
<build.profile.id>prod</build.profile.id>
</properties>
<id>normal</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<properties>
<build.profile.id>normal</build.profile.id>
<version.art>votingplugin</version.art>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.github.bencodez</groupId>
<groupId>com.bencodez</groupId>
<artifactId>advancedcore</artifactId>
<version>master-SNAPSHOT</version>
<version>LATEST</version>
<scope>compile</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>normal-folia</id>
<properties>
<build.profile.id>normal</build.profile.id>
<version.art>votingplugin-folia</version.art>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.bencodez</groupId>
<artifactId>advancedcore-folia</artifactId>
<version>LATEST</version>
<scope>compile</scope>
</dependency>
</dependencies>
@@ -285,6 +324,9 @@
<profile>
<id>prod2</id>
<properties>
<version.art>votingplugin</version.art>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<build.profile.id>prod2</build.profile.id>
</properties>
<distributionManagement>
@@ -304,10 +346,23 @@
</dependencies>
</profile>
<profile>
<id>dev</id>
<id>deploy-snapshot</id>
<properties>
<build.profile.id>dev</build.profile.id>
<version.art>votingplugin</version.art>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<build.profile.id>deploy-snapshot</build.profile.id>
</properties>
<distributionManagement>
<snapshotRepository>
<id>nexus</id>
<url>https://nexus.bencodez.com/repository/maven-snapshots/</url>
</snapshotRepository>
<repository>
<id>nexus</id>
<url>https://nexus.bencodez.com/repository/maven-snapshots/</url>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>com.bencodez</groupId>
@@ -316,12 +371,95 @@
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
<configuration>
<serverId>nexus</serverId>
<nexusUrl>https://nexus.bencodez.com/nexus/</nexusUrl>
<skipStaging>true</skipStaging>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>javadoc</id>
<properties>
<version.art>votingplugin</version.art>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<build.profile.id>javadoc</build.profile.id>
</properties>
<distributionManagement>
<repository>
<id>internal.repo</id>
<name>Temporary Staging Repository</name>
<url>file://${project.build.directory}/mvn-repo</url>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>com.bencodez</groupId>
<artifactId>advancedcore</artifactId>
<version>LATEST</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<phase>deploy</phase>
<configuration>
<sourcepath>
${project.basedir}/target/delombok</sourcepath>
<outputDirectory>
${project.basedir}/target/apidocs</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>deploy</id>
<properties>
<version.art>votingplugin</version.art>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<build.profile.id>deploy</build.profile.id>
</properties>
<dependencies>
<dependency>
<groupId>com.bencodez</groupId>
@@ -345,7 +483,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<version>3.6.3</version>
<executions>
<execution>
<id>attach-javadocs</id>
@@ -354,7 +492,8 @@
</goals>
<phase>deploy</phase>
<configuration>
<sourcepath>${project.basedir}/target/delombok</sourcepath>
<sourcepath>
${project.basedir}/target/delombok</sourcepath>
</configuration>
</execution>
</executions>
@@ -362,7 +501,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<version>3.1.2</version>
<configuration>
<skip>true</skip>
</configuration>
@@ -370,7 +509,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.5.1</version>
<version>1.6.13</version>
<executions>
<execution>
<id>default-deploy</id>
@@ -386,7 +525,7 @@
<skipStaging>true</skipStaging>
</configuration>
</plugin>
<plugin>
<!--<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.12</version>
@@ -412,7 +551,7 @@
</configuration>
</execution>
</executions>
</plugin>
</plugin>-->
</plugins>
</build>
</profile>
@@ -2,7 +2,7 @@ package com.Ben12345rocks.VotingPlugin.Objects;
import org.bukkit.entity.Player;
import com.bencodez.votingplugin.user.UserManager;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.user.VotingPluginUser;
@Deprecated
@@ -10,7 +10,7 @@ public class User {
private VotingPluginUser user;
public User(Player p) {
user = UserManager.getInstance().getVotingPluginUser(p);
user = VotingPluginMain.plugin.getVotingPluginUserManager().getVotingPluginUser(p);
}
public void addPoints(int points) {
@@ -1,24 +1,47 @@
package com.bencodez.votingplugin;
import java.io.File;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.UUID;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import com.bencodez.advancedcore.api.misc.MiscUtils;
import com.bencodez.advancedcore.api.misc.encryption.EncryptionHandler;
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
import com.bencodez.advancedcore.api.time.TimeType;
import com.bencodez.advancedcore.api.user.UserStorage;
import com.bencodez.advancedcore.api.user.usercache.value.DataValue;
import com.bencodez.advancedcore.api.user.usercache.value.DataValueBoolean;
import com.bencodez.advancedcore.api.user.userstorage.mysql.api.config.MysqlConfigSpigot;
import com.bencodez.advancedcore.bungeeapi.GlobalMessage.GlobalMessageHandler;
import com.bencodez.advancedcore.bungeeapi.GlobalMessage.GlobalMessageListener;
import com.bencodez.advancedcore.bungeeapi.globaldata.GlobalDataHandler;
import com.bencodez.advancedcore.bungeeapi.globaldata.GlobalMySQL;
import com.bencodez.advancedcore.bungeeapi.pluginmessage.PluginMessageHandler;
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.simpleapi.array.ArrayUtils;
import com.bencodez.votingplugin.bungee.BungeeMessageData;
import com.bencodez.votingplugin.bungee.BungeeMethod;
import com.bencodez.votingplugin.bungee.BungeeVersion;
import com.bencodez.votingplugin.objects.VoteSite;
import com.bencodez.votingplugin.user.UserManager;
import com.bencodez.votingplugin.user.VotingPluginUser;
import lombok.Getter;
public class BungeeHandler {
public class BungeeHandler implements Listener {
@Getter
private ClientHandler clientHandler;
@@ -29,16 +52,217 @@ public class BungeeHandler {
private VotingPluginMain plugin;
@Getter
private int bungeeVotePartyCurrent = -2;
@Getter
private int bungeeVotePartyRequired = -2;
@Getter
private SocketHandler socketHandler;
private GlobalDataHandler globalDataHandler;
@Getter
private ScheduledExecutorService timer;
@Getter
private RedisHandler redisHandler;
@Getter
private GlobalMessageHandler globalMessageHandler;
private Thread redisThread;
public BungeeHandler(VotingPluginMain plugin) {
this.plugin = plugin;
}
public void close() {
socketHandler.closeConnection();
clientHandler.stopConnection();
if (socketHandler != null) {
socketHandler.closeConnection();
}
if (clientHandler != null) {
clientHandler.stopConnection();
}
plugin.getServerData().setBungeeVotePartyCurrent(bungeeVotePartyCurrent);
plugin.getServerData().setBungeeVotePartyRequired(bungeeVotePartyRequired);
if (globalDataHandler != null) {
globalDataHandler.getGlobalMysql().close();
}
}
/*
* @EventHandler public void onDateChange(DateChangedEvent event) { if
* (method.equals(BungeeMethod.PLUGINMESSAGING)) {
* plugin.getPluginMessaging().sendPluginMessage("timeupdate",
* plugin.getServerDataFile().getPrevMonth() + "//" +
* plugin.getServerDataFile().getPrevDay() + "//" +
* plugin.getServerDataFile().getPrevWeekDay()); } }
*/
public void checkGlobalData() {
HashMap<String, DataValue> data = globalDataHandler.getExact(plugin.getBungeeSettings().getServer());
// plugin.debug(data.toString());
if (data.containsKey("ForceUpdate")) {
boolean b = checkGlobalDataTimeValue(data.get("ForceUpdate"));
if (b) {
if (plugin.getStorageType().equals(UserStorage.MYSQL)) {
plugin.getMysql().clearCacheBasic();
}
plugin.getUserManager().getDataManager().clearCache();
plugin.setUpdate(true);
plugin.update();
globalDataHandler.setBoolean(plugin.getBungeeSettings().getServer(), "ForceUpdate", false);
}
}
boolean forceUpdate = false;
if (checkGlobalDataTime(TimeType.MONTH, data)) {
forceUpdate = true;
}
if (checkGlobalDataTime(TimeType.WEEK, data)) {
forceUpdate = true;
}
if (checkGlobalDataTime(TimeType.DAY, data)) {
forceUpdate = true;
}
if (forceUpdate) {
HashMap<String, DataValue> dataToSet = new HashMap<String, DataValue>();
dataToSet.put("FinishedProcessing", new DataValueBoolean(true));
dataToSet.put("Processing", new DataValueBoolean(false));
globalDataHandler.setData(plugin.getBungeeSettings().getServer(), dataToSet);
}
}
public boolean checkGlobalDataTimeValue(DataValue data) {
if (data.isBoolean()) {
return data.getBoolean();
}
return Boolean.valueOf(data.getString());
}
public boolean checkGlobalDataTime(TimeType type, HashMap<String, DataValue> data) {
boolean isProcessing = false;
if (data.containsKey(type.toString())) {
DataValue value = data.get(type.toString());
boolean b = checkGlobalDataTimeValue(value);
if (b) {
long lastUpdated = Long.valueOf(data.get("LastUpdated").getString()).longValue();
plugin.debug("LastUpdated: " + lastUpdated);
if (LocalDateTime.now().atZone(ZoneOffset.UTC).toInstant().toEpochMilli() - lastUpdated > 1000 * 60 * 60
* 2) {
plugin.getLogger().warning("Ignoring bungee time change since it was more than 2 hours ago");
globalDataHandler.setBoolean(plugin.getBungeeSettings().getServer(), type.toString(), false);
return false;
}
globalDataHandler.setBoolean(plugin.getBungeeSettings().getServer(), "Processing", true);
isProcessing = true;
plugin.debug("Detected time change from bungee: " + type.toString());
plugin.getTimeChecker().forceChanged(type, false, true, true);
globalDataHandler.setBoolean(plugin.getBungeeSettings().getServer(), type.toString(), false);
}
}
return isProcessing;
}
public void loadGlobalMysql() {
if (plugin.getBungeeSettings().isGloblalDataEnabled()) {
if (timer != null) {
timer.shutdown();
try {
timer.awaitTermination(5, TimeUnit.SECONDS);
} catch (InterruptedException e) {
e.printStackTrace();
}
timer.shutdownNow();
}
timer = Executors.newScheduledThreadPool(1);
timer.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
checkGlobalData();
}
}, 60, 10, TimeUnit.SECONDS);
timer.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
globalDataHandler.setString(plugin.getBungeeSettings().getServer(), "LastOnline",
"" + LocalDateTime.now().atZone(ZoneOffset.UTC).toInstant().toEpochMilli());
}
}, 1, 60, TimeUnit.MINUTES);
if (globalDataHandler != null) {
globalDataHandler.getGlobalMysql().close();
}
if (plugin.getBungeeSettings().isGloblalDataUseMainMySQL()
&& plugin.getStorageType().equals(UserStorage.MYSQL)) {
globalDataHandler = new GlobalDataHandler(
new GlobalMySQL("VotingPlugin_GlobalData", plugin.getMysql().getMysql()) {
@Override
public void warning(String text) {
plugin.getLogger().warning(text);
}
@Override
public void severe(String text) {
plugin.getLogger().severe(text);
}
@Override
public void debug(Exception e) {
plugin.debug(e);
}
@Override
public void debug(String text) {
plugin.debug(text);
}
});
} else {
globalDataHandler = new GlobalDataHandler(
new GlobalMySQL("VotingPlugin_GlobalData", new MysqlConfigSpigot(
plugin.getBungeeSettings().getData().getConfigurationSection("GlobalData"))) {
@Override
public void warning(String text) {
plugin.getLogger().warning(text);
}
@Override
public void severe(String text) {
plugin.getLogger().severe(text);
}
@Override
public void debug(Exception e) {
plugin.debug(e);
}
@Override
public void debug(String text) {
plugin.debug(text);
}
});
}
globalDataHandler.getGlobalMysql().alterColumnType("IgnoreTime", "VARCHAR(5)");
globalDataHandler.getGlobalMysql().alterColumnType("MONTH", "VARCHAR(5)");
globalDataHandler.getGlobalMysql().alterColumnType("WEEK", "VARCHAR(5)");
globalDataHandler.getGlobalMysql().alterColumnType("DAY", "VARCHAR(5)");
globalDataHandler.getGlobalMysql().alterColumnType("FinishedProcessing", "VARCHAR(5)");
globalDataHandler.getGlobalMysql().alterColumnType("Processing", "VARCHAR(5)");
globalDataHandler.getGlobalMysql().alterColumnType("LastUpdated", "MEDIUMTEXT");
globalDataHandler.getGlobalMysql().alterColumnType("ForceUpdate", "VARCHAR(5)");
plugin.getTimeChecker().setProcessingEnabled(false);
}
}
public void load() {
@@ -48,50 +272,91 @@ public class BungeeHandler {
plugin.getLogger().info("Using BungeeMethod: " + method.toString());
if (method.equals(BungeeMethod.MYSQL)) {
plugin.registerBungeeChannels("vp:vp");
} else if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
plugin.registerBungeeChannels("vp:vp");
loadGlobalMysql();
plugin.getPluginMessaging().setDebug(true);
globalMessageHandler = new GlobalMessageHandler() {
plugin.getPluginMessaging().add(new PluginMessageHandler("Vote") {
@Override
public void onRecieve(String subChannel, ArrayList<String> args) {
if (args.size() > 8) {
int bungeeVersion = Integer.parseInt(args.get(8));
if (bungeeVersion != BungeeVersion.getPluginMessageVersion()) {
plugin.getLogger().warning("Incompatible version with bungee, please update all servers");
return;
}
@Override
public void sendMessage(String subChannel, String... messageData) {
if (method.equals(BungeeMethod.MYSQL)) {
plugin.getPluginMessaging().sendPluginMessage(subChannel, messageData);
} else if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
plugin.getPluginMessaging().sendPluginMessage(subChannel, messageData);
} else if (method.equals(BungeeMethod.SOCKETS)) {
ArrayList<String> list = new ArrayList<String>();
list.add(subChannel);
list.addAll(ArrayUtils.convert(messageData));
sendData(ArrayUtils.convert(list));
} else if (method.equals(BungeeMethod.REDIS)) {
ArrayList<String> list = new ArrayList<String>();
list.add(subChannel);
list.addAll(ArrayUtils.convert(messageData));
redisHandler.sendMessage(plugin.getBungeeSettings().getRedisPrefix() + "VotingPlugin",
ArrayUtils.convert(list));
}
}
};
String player = args.get(0);
String uuid = args.get(1);
String service = args.get(2);
long time = Long.parseLong(args.get(3));
plugin.debug("pluginmessaging vote received from " + player + "/" + uuid + " on " + service);
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid),
player);
globalMessageHandler.addListener(new GlobalMessageListener("Vote") {
boolean wasOnline = Boolean.valueOf(args.get(4));
@Override
public void onReceive(ArrayList<String> args) {
if (args.size() > 8) {
int bungeeVersion = Integer.parseInt(args.get(8));
if (bungeeVersion != BungeeVersion.getPluginMessageVersion()) {
plugin.getLogger().warning("Incompatible version with bungee, please update all servers"
+ bungeeVersion + ":" + BungeeVersion.getPluginMessageVersion());
return;
}
BungeeMessageData text = new BungeeMessageData(args.get(6));
String player = args.get(0);
String uuid = args.get(1);
String service = args.get(2);
long time = Long.parseLong(args.get(3));
plugin.debug("pluginmessaging vote received from " + player + "/" + uuid + " on " + service);
VotingPluginUser user = plugin.getVotingPluginUserManager()
.getVotingPluginUser(UUID.fromString(uuid), player);
boolean setTotals = Boolean.valueOf(args.get(7));
boolean wasOnline = Boolean.valueOf(args.get(4));
user.clearCache();
BungeeMessageData text = new BungeeMessageData(args.get(6));
boolean broadcast = true;
boolean bungeeBroadcast = false;
bungeeVotePartyCurrent = text.getVotePartyCurrent();
bungeeVotePartyRequired = text.getVotePartyRequired();
plugin.getPlaceholders().onBungeeVotePartyUpdate();
plugin.getServerData().setBungeeVotePartyCurrent(bungeeVotePartyCurrent);
plugin.getServerData().setBungeeVotePartyRequired(bungeeVotePartyRequired);
if (args.size() > 9) {
bungeeBroadcast = Boolean.valueOf(args.get(9));
}
boolean setTotals = Boolean.valueOf(args.get(7));
if (!bungeeBroadcast) {
if (!plugin.getBungeeSettings().isBungeeBroadcast()
&& !plugin.getBungeeSettings().isDisableBroadcast()) {
if (wasOnline || plugin.getBungeeSettings().isBungeeBroadcastAlways()) {
user.cache();
boolean broadcast = true;
boolean bungeeBroadcast = false;
if (args.size() > 9) {
bungeeBroadcast = Boolean.valueOf(args.get(9));
}
int num = 1;
if (args.size() > 10) {
num = Integer.valueOf(args.get(10));
}
int numberOfVotes = 1;
if (args.size() > 11) {
numberOfVotes = Integer.valueOf(args.get(11));
}
if (!bungeeBroadcast) {
if (!plugin.getBungeeSettings().isBungeeBroadcast()
&& !plugin.getBungeeSettings().isDisableBroadcast()) {
if (wasOnline || plugin.getBungeeSettings().isBungeeBroadcastAlways()) {
if (plugin.getConfigFile().isFormatOnlyOneOfflineBroadcast() && !wasOnline) {
if (num == 1) {
user.offlineBroadcast(user, plugin.getBungeeSettings().isUseBungeecoord(),
numberOfVotes);
}
} else {
VoteSite site = plugin.getVoteSite(service, true);
if (site != null) {
site.broadcastVote(user, false);
@@ -100,131 +365,352 @@ public class BungeeHandler {
plugin.getLogger().warning("No votesite for " + service);
}
}
}
} else {
broadcast = false;
}
user.bungeeVotePluginMessaging(service, time, text, !setTotals, wasOnline, broadcast);
if (plugin.getBungeeSettings().isPerServerPoints()) {
user.addPoints(plugin.getConfigFile().getPointsOnVote());
}
if (Boolean.valueOf(args.get(5))) {
plugin.getServerData().addServiceSite(service);
}
} else {
plugin.getLogger().warning("Incompatible version with bungee, please update all servers");
broadcast = false;
}
user.bungeeVotePluginMessaging(service, time, text, !setTotals, wasOnline, broadcast, num);
if (plugin.getBungeeSettings().isPerServerPoints()) {
user.addPoints(plugin.getConfigFile().getPointsOnVote());
}
plugin.getSpecialRewards().bungeeAllSitesCheck(user, numberOfVotes, num);
if (Boolean.valueOf(args.get(5))) {
plugin.getServerData().addServiceSite(service);
}
} else {
plugin.getLogger().warning("Incompatible version with bungee, please update all servers");
}
}
});
globalMessageHandler.addListener(new GlobalMessageListener("VoteOnline") {
@Override
public void onReceive(ArrayList<String> args) {
if (args.size() > 8) {
int bungeeVersion = Integer.parseInt(args.get(8));
if (bungeeVersion != BungeeVersion.getPluginMessageVersion()) {
plugin.getLogger().warning("Incompatible version with bungee, please update all servers");
return;
}
String player = args.get(0);
String uuid = args.get(1);
String service = args.get(2);
long time = Long.parseLong(args.get(3));
BungeeMessageData text = new BungeeMessageData(args.get(6));
bungeeVotePartyCurrent = text.getVotePartyCurrent();
bungeeVotePartyRequired = text.getVotePartyRequired();
plugin.getPlaceholders().onBungeeVotePartyUpdate();
plugin.getServerData().setBungeeVotePartyCurrent(bungeeVotePartyCurrent);
plugin.getServerData().setBungeeVotePartyRequired(bungeeVotePartyRequired);
plugin.debug("pluginmessaging voteonline received from " + player + "/" + uuid + " on " + service);
VotingPluginUser user = plugin.getVotingPluginUserManager()
.getVotingPluginUser(UUID.fromString(uuid), player);
user.cache();
if (plugin.getBungeeSettings().isPerServerPoints()) {
user.addPoints(plugin.getConfigFile().getPointsOnVote());
}
boolean setTotals = Boolean.valueOf(args.get(7));
boolean wasOnline = Boolean.valueOf(args.get(4));
boolean broadcast = true;
boolean bungeeBroadcast = false;
if (args.size() > 9) {
bungeeBroadcast = Boolean.valueOf(args.get(9));
}
int num = 1;
if (args.size() > 10) {
num = Integer.valueOf(args.get(10));
}
int numberOfVotes = 1;
if (args.size() > 11) {
numberOfVotes = Integer.valueOf(args.get(11));
}
if (!bungeeBroadcast) {
if (!plugin.getBungeeSettings().isBungeeBroadcast()
&& !plugin.getBungeeSettings().isDisableBroadcast()) {
if (wasOnline || plugin.getBungeeSettings().isBungeeBroadcastAlways()) {
if (plugin.getConfigFile().isFormatOnlyOneOfflineBroadcast() && !wasOnline) {
if (num == 1) {
user.offlineBroadcast(user, plugin.getBungeeSettings().isUseBungeecoord(),
numberOfVotes);
}
} else {
VoteSite site = plugin.getVoteSite(service, true);
if (site != null) {
site.broadcastVote(user, false);
broadcast = false;
} else {
plugin.getLogger().warning("No votesite for " + service);
}
}
}
}
} else {
broadcast = false;
}
user.bungeeVotePluginMessaging(service, time, text, !setTotals, wasOnline, broadcast, num);
if (plugin.getBungeeSettings().isPerServerPoints()) {
user.addPoints(plugin.getConfigFile().getPointsOnVote());
}
plugin.getSpecialRewards().bungeeAllSitesCheck(user, numberOfVotes, num);
if (Boolean.valueOf(args.get(5))) {
plugin.getServerData().addServiceSite(service);
}
} else {
plugin.getLogger().warning("Incompatible version with bungee, please update all servers");
}
}
});
globalMessageHandler.addListener(new GlobalMessageListener("VoteUpdate") {
@Override
public void onReceive(ArrayList<String> args) {
String player = args.get(0);
plugin.debug("pluginmessaging voteupdate received for " + player);
VotingPluginUser user = plugin.getVotingPluginUserManager()
.getVotingPluginUser(UUID.fromString(player));
user.cache();
user.offVote();
if (args.size() > 3 && plugin.getBungeeSettings().isPerServerMilestones()) {
BungeeMessageData text = new BungeeMessageData(args.get(3));
plugin.getSpecialRewards().checkMilestone(user, text, true);
}
if (args.size() > 2) {
bungeeVotePartyCurrent = Integer.parseInt(args.get(1));
bungeeVotePartyRequired = Integer.parseInt(args.get(2));
plugin.getServerData().setBungeeVotePartyCurrent(bungeeVotePartyCurrent);
plugin.getServerData().setBungeeVotePartyRequired(bungeeVotePartyRequired);
}
plugin.setUpdate(true);
}
});
globalMessageHandler.addListener(new GlobalMessageListener("BungeeTimeChange") {
@Override
public void onReceive(ArrayList<String> args) {
checkGlobalData();
}
});
globalMessageHandler.addListener(new GlobalMessageListener("VoteBroadcast") {
@Override
public void onReceive(ArrayList<String> args) {
if (args.size() > 2) {
String uuid = args.get(0);
String service = args.get(2);
VotingPluginUser user = plugin.getVotingPluginUserManager()
.getVotingPluginUser(UUID.fromString(uuid), args.get(1));
VoteSite site = plugin.getVoteSite(service, true);
if (site != null) {
site.broadcastVote(user, false);
} else {
plugin.getLogger().warning("No votesite for " + service);
}
}
}
});
globalMessageHandler.addListener(new GlobalMessageListener("VoteBroadcastOffline") {
@Override
public void onReceive(ArrayList<String> args) {
if (args.size() > 2) {
String uuid = args.get(0);
String votes = args.get(2);
VotingPluginUser user = plugin.getVotingPluginUserManager()
.getVotingPluginUser(UUID.fromString(uuid), args.get(1));
user.offlineBroadcast(user, false, Integer.parseInt(votes));
}
}
});
globalMessageHandler.addListener(new GlobalMessageListener("Status") {
@Override
public void onReceive(ArrayList<String> args) {
String server = args.get(0);
sendMessage(globalMessageHandler, "statusokay", server);
}
});
globalMessageHandler.addListener(new GlobalMessageListener("ServerName") {
@Override
public void onReceive(ArrayList<String> args) {
String server = args.get(0);
if (!plugin.getOptions().getServer().equals(server)) {
plugin.getLogger().warning("Server name doesn't match in BungeeSettings.yml, should be " + server);
}
}
});
globalMessageHandler.addListener(new GlobalMessageListener("VotePartyBungee") {
@Override
public void onReceive(ArrayList<String> args) {
for (final String cmd : plugin.getBungeeSettings().getBungeeVotePartyGlobalCommands()) {
plugin.getBukkitScheduler().runTask(plugin, new Runnable() {
@Override
public void run() {
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd);
}
});
}
for (Player p : Bukkit.getOnlinePlayers()) {
new RewardBuilder(plugin.getBungeeSettings().getData(), "BungeeVotePartyRewards").send(p);
}
}
});
globalMessageHandler.addListener(new GlobalMessageListener("VotePartyBroadcast") {
@Override
public void onReceive(ArrayList<String> args) {
String broadcast = args.get(0);
MiscUtils.getInstance().broadcast(broadcast);
}
});
if (method.equals(BungeeMethod.MYSQL)) {
plugin.registerBungeeChannels("vp:vp");
} else if (method.equals(BungeeMethod.REDIS)) {
redisHandler = new RedisHandler(plugin.getBungeeSettings().getRedisHost(),
plugin.getBungeeSettings().getRedisPort(), plugin.getBungeeSettings().getRedisUsername(),
plugin.getBungeeSettings().getRedisPassword()) {
@Override
protected void onMessage(String channel, String[] message) {
plugin.getLogger().info(channel + ArrayUtils.makeStringList(ArrayUtils.convert(message)));
if (message.length > 0) {
ArrayList<String> list = new ArrayList<String>();
for (int i = 1; i < message.length; i++) {
list.add(message[i]);
}
globalMessageHandler.onMessage(message[0], list);
}
}
@Override
public void debug(String message) {
if (plugin.getBungeeSettings().isBungeeDebug()) {
plugin.debug(message);
}
}
};
redisThread = new Thread(new Runnable() {
@Override
public void run() {
if (plugin.isEnabled()) {
redisHandler.loadListener(
new RedisListener(redisHandler, plugin.getBungeeSettings().getRedisPrefix()
+ "VotingPlugin_" + plugin.getBungeeSettings().getServer()));
}
}
});
redisThread.start();
} else if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
plugin.registerBungeeChannels("vp:vp");
bungeeVotePartyCurrent = plugin.getServerData().getBungeeVotePartyCurrent();
bungeeVotePartyRequired = plugin.getServerData().getBungeeVotePartyRequired();
plugin.getPluginMessaging().setDebug(plugin.getBungeeSettings().isBungeeDebug());
plugin.getPluginMessaging().add(new PluginMessageHandler("Vote") {
@Override
public void onRecieve(String subChannel, ArrayList<String> args) {
globalMessageHandler.onMessage("Vote", args);
}
});
plugin.getPluginMessaging().add(new PluginMessageHandler("VoteOnline") {
@Override
public void onRecieve(String subChannel, ArrayList<String> args) {
if (args.size() > 8) {
int bungeeVersion = Integer.parseInt(args.get(8));
if (bungeeVersion != BungeeVersion.getPluginMessageVersion()) {
plugin.getLogger().warning("Incompatible version with bungee, please update all servers");
return;
}
String player = args.get(0);
String uuid = args.get(1);
String service = args.get(2);
long time = Long.parseLong(args.get(3));
BungeeMessageData text = new BungeeMessageData(args.get(6));
plugin.debug(
"pluginmessaging voteonline received from " + player + "/" + uuid + " on " + service);
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid),
player);
user.clearCache();
if (plugin.getBungeeSettings().isPerServerPoints()) {
user.addPoints(plugin.getConfigFile().getPointsOnVote());
}
boolean setTotals = Boolean.valueOf(args.get(7));
boolean wasOnline = Boolean.valueOf(args.get(4));
boolean broadcast = true;
boolean bungeeBroadcast = false;
if (args.size() > 9) {
bungeeBroadcast = Boolean.valueOf(args.get(9));
}
if (!bungeeBroadcast) {
if (!plugin.getBungeeSettings().isBungeeBroadcast()
&& !plugin.getBungeeSettings().isDisableBroadcast()) {
if (Boolean.valueOf(args.get(4))
|| plugin.getBungeeSettings().isBungeeBroadcastAlways()) {
VoteSite site = plugin.getVoteSite(service, true);
if (site != null) {
site.broadcastVote(user, false);
broadcast = false;
} else {
plugin.getLogger().warning("No votesite for " + service);
}
}
}
} else {
broadcast = false;
}
user.bungeeVotePluginMessaging(service, time, text, !setTotals, wasOnline, broadcast);
if (plugin.getBungeeSettings().isPerServerPoints()) {
user.addPoints(plugin.getConfigFile().getPointsOnVote());
}
if (Boolean.valueOf(args.get(5))) {
plugin.getServerData().addServiceSite(service);
}
} else {
plugin.getLogger().warning("Incompatible version with bungee, please update all servers");
}
globalMessageHandler.onMessage("VoteOnline", args);
}
});
plugin.getPluginMessaging().add(new PluginMessageHandler("VoteUpdate") {
@Override
public void onRecieve(String subChannel, ArrayList<String> args) {
String player = args.get(0);
plugin.debug("pluginmessaging voteupdate received for " + player);
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(player));
user.clearCache();
globalMessageHandler.onMessage("VoteUpdate", args);
}
});
user.offVote();
plugin.getPluginMessaging().add(new PluginMessageHandler("BungeeTimeChange") {
@Override
public void onRecieve(String subChannel, ArrayList<String> args) {
globalMessageHandler.onMessage("BungeeTimeChange", args);
plugin.setUpdate(true);
}
});
plugin.getPluginMessaging().add(new PluginMessageHandler("VoteBroadcast") {
@Override
public void onRecieve(String subChannel, ArrayList<String> args) {
if (args.size() > 2) {
String uuid = args.get(0);
String service = args.get(2);
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid),
args.get(1));
VoteSite site = plugin.getVoteSite(service, true);
if (site != null) {
site.broadcastVote(user, false);
} else {
plugin.getLogger().warning("No votesite for " + service);
}
}
globalMessageHandler.onMessage("VoteBroadcast", args);
}
});
plugin.getPluginMessaging().add(new PluginMessageHandler("VoteBroadcastOffline") {
@Override
public void onRecieve(String subChannel, ArrayList<String> args) {
globalMessageHandler.onMessage("VoteBroadcastOffline", args);
}
});
plugin.getPluginMessaging().add(new PluginMessageHandler("Status") {
@Override
public void onRecieve(String subChannel, ArrayList<String> args) {
String server = args.get(0);
plugin.getPluginMessaging().sendPluginMessage("statusokay", server);
globalMessageHandler.onMessage("Status", args);
}
});
plugin.getPluginMessaging().add(new PluginMessageHandler("ServerName") {
@Override
public void onRecieve(String subChannel, ArrayList<String> args) {
globalMessageHandler.onMessage("ServerName", args);
}
});
plugin.getPluginMessaging().add(new PluginMessageHandler("VotePartyBungee") {
@Override
public void onRecieve(String subChannel, ArrayList<String> args) {
globalMessageHandler.onMessage("VotePartyBungee", args);
}
});
plugin.getPluginMessaging().add(new PluginMessageHandler("VotePartyBroadcast") {
@Override
public void onRecieve(String subChannel, ArrayList<String> args) {
globalMessageHandler.onMessage("VotePartyBroadcast", args);
}
});
@@ -237,7 +723,13 @@ public class BungeeHandler {
socketHandler = new SocketHandler(plugin.getVersion(), plugin.getBungeeSettings().getSpigotServerHost(),
plugin.getBungeeSettings().getSpigotServerPort(), encryptionHandler,
plugin.getBungeeSettings().isBungeeDebug());
plugin.getBungeeSettings().isBungeeDebug()) {
@Override
public void log(String str) {
plugin.getLogger().info(str);
}
};
socketHandler.add(new SocketReceiver("bungeevote") {
@@ -248,12 +740,12 @@ public class BungeeHandler {
String uuid = data[1];
VotingPluginUser user = null;
if (!uuid.isEmpty()) {
user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid));
user = plugin.getVotingPluginUserManager().getVotingPluginUser(UUID.fromString(uuid));
} else {
user = UserManager.getInstance().getVotingPluginUser(data[2]);
user = plugin.getVotingPluginUserManager().getVotingPluginUser(data[2]);
}
user.clearCache();
user.cache();
if (plugin.getBungeeSettings().isPerServerPoints()) {
user.addPoints(plugin.getConfigFile().getPointsOnVote());
@@ -264,6 +756,14 @@ public class BungeeHandler {
}
});
socketHandler.add(new SocketReceiver("BungeeTimeChange") {
@Override
public void onReceive(String[] data) {
checkGlobalData();
}
});
socketHandler.add(new SocketReceiver("bungeevoteonline") {
@Override
@@ -273,12 +773,12 @@ public class BungeeHandler {
String uuid = data[1];
VotingPluginUser user = null;
if (!uuid.isEmpty()) {
user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid));
user = plugin.getVotingPluginUserManager().getVotingPluginUser(UUID.fromString(uuid));
} else {
user = UserManager.getInstance().getVotingPluginUser(data[2]);
user = plugin.getVotingPluginUserManager().getVotingPluginUser(data[2]);
}
user.clearCache();
user.cache();
if (plugin.getBungeeSettings().isPerServerPoints()) {
user.addPoints(plugin.getConfigFile().getPointsOnVote());
@@ -289,6 +789,19 @@ public class BungeeHandler {
}
});
socketHandler.add(new SocketReceiver("BroadcastOffline") {
@Override
public void onReceive(String[] data) {
if (data.length > 2) {
String votes = data[0];
String p = data[1];
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(p);
user.offlineBroadcast(user, false, Integer.parseInt(votes));
}
}
});
socketHandler.add(new SocketReceiver("BungeeBroadcast") {
@Override
@@ -296,7 +809,24 @@ public class BungeeHandler {
if (data.length > 2) {
VoteSite site = plugin.getVoteSite(data[1], true);
String p = data[3];
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(p);
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(p);
if (site != null) {
site.broadcastVote(user, false);
} else {
plugin.getLogger().warning("No votesite for " + data[1]);
}
}
}
});
socketHandler.add(new SocketReceiver("Broadcast") {
@Override
public void onReceive(String[] data) {
if (data.length > 2) {
VoteSite site = plugin.getVoteSite(data[1], true);
String p = data[2];
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(p);
if (site != null) {
site.broadcastVote(user, false);
} else {
@@ -326,6 +856,25 @@ public class BungeeHandler {
}
});
socketHandler.add(new SocketReceiver("VotePartyBungee") {
@Override
public void onReceive(String[] data) {
for (Player p : Bukkit.getOnlinePlayers()) {
new RewardBuilder(plugin.getBungeeSettings().getData(), "BungeeVotePartyRewards").send(p);
}
}
});
socketHandler.add(new SocketReceiver("VotePartyBroadcast") {
@Override
public void onReceive(String[] data) {
String broadcast = data[0];
MiscUtils.getInstance().broadcast(broadcast);
}
});
if (plugin.getOptions().getServer().equalsIgnoreCase("pleaseset")) {
plugin.getLogger().warning("Server name for bungee voting is not set, please set it");
}
@@ -2,7 +2,6 @@ package com.bencodez.votingplugin;
import org.bukkit.entity.Player;
import com.bencodez.advancedcore.api.rewards.RewardHandler;
import com.bencodez.advancedcore.api.rewards.injected.RewardInject;
import com.bencodez.advancedcore.api.rewards.injectedrequirement.RequirementInject;
import com.bencodez.votingplugin.user.UserManager;
@@ -16,11 +15,11 @@ public class VotingPluginHooks {
}
public void addCustomRequirement(RequirementInject inject) {
RewardHandler.getInstance().addInjectedRequirements(inject);
getMainClass().getRewardHandler().addInjectedRequirements(inject);
}
public void addCustomReward(RewardInject inject) {
RewardHandler.getInstance().addInjectedReward(inject);
getMainClass().getRewardHandler().addInjectedReward(inject);
}
public void backgroundUpdate(Player player) {
@@ -34,7 +33,7 @@ public class VotingPluginHooks {
}
public UserManager getUserManager() {
return UserManager.getInstance();
return getMainClass().getVotingPluginUserManager();
}
}
@@ -16,8 +16,10 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TimerTask;
import java.util.UUID;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -39,21 +41,22 @@ 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.RewardHandler;
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.user.userstorage.Column;
import com.bencodez.advancedcore.api.yml.YMLConfig;
import com.bencodez.advancedcore.logger.Logger;
import com.bencodez.advancedcore.nms.NMSManager;
import com.bencodez.simpleapi.nms.NMSManager;
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;
@@ -78,8 +81,12 @@ 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;
import com.bencodez.votingplugin.timequeue.TimeQueueHandler;
import com.bencodez.votingplugin.topvoter.TopVoter;
import com.bencodez.votingplugin.topvoter.TopVoterHandler;
import com.bencodez.votingplugin.topvoter.TopVoterPlayer;
@@ -143,6 +150,9 @@ public class VotingPluginMain extends AdvancedCorePlugin {
@Getter
private PlaceHolders placeholders;
@Getter
private VoteTester voteTester;
@Getter
private String profile = "";
@@ -208,17 +218,20 @@ public class VotingPluginMain extends AdvancedCorePlugin {
@Getter
private boolean ymlError = false;
@Getter
private ScheduledExecutorService voteTimer;
@Getter
private UserManager votingPluginUserManager;
private void addDirectlyDefinedRewards(DirectlyDefinedReward directlyDefinedReward) {
RewardHandler.getInstance().addDirectlyDefined(directlyDefinedReward);
public void addDirectlyDefinedRewards(DirectlyDefinedReward directlyDefinedReward) {
getRewardHandler().addDirectlyDefined(directlyDefinedReward);
}
public void basicBungeeUpdate() {
for (Player player : Bukkit.getOnlinePlayers()) {
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
user.clearCache();
VotingPluginUser user = getVotingPluginUserManager().getVotingPluginUser(player);
user.cache();
user.offVote();
user.checkOfflineRewards();
}
@@ -250,13 +263,13 @@ public class VotingPluginMain extends AdvancedCorePlugin {
}
if (ymlError) {
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
plugin.getBukkitScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
@Override
public void run() {
plugin.getLogger().severe("Failed to load a file, check startup log");
}
}, 10);
}, 1);
}
}
@@ -270,7 +283,11 @@ public class VotingPluginMain extends AdvancedCorePlugin {
}
public LinkedHashMap<TopVoterPlayer, Integer> getTopVoter(TopVoter top) {
return topVoter.get(top);
LinkedHashMap<TopVoterPlayer, Integer> top1 = topVoter.get(top);
if (top1 == null) {
top1 = new LinkedHashMap<TopVoterPlayer, Integer>();
}
return top1;
}
/**
@@ -280,7 +297,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() {
@@ -326,29 +343,41 @@ public class VotingPluginMain extends AdvancedCorePlugin {
}
public ArrayList<VoteSite> getVoteSitesEnabled() {
ArrayList<VoteSite> sites = new ArrayList<VoteSite>();
for (VoteSite site : getVoteSites()) {
if (site.isEnabled()) {
sites.add(site);
}
}
return sites;
}
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;
}
}
}
for (String siteName : sites) {
if (siteName.equalsIgnoreCase(url)) {
return siteName;
}
}
}
return url;
}
for (String url : urls) {
return url;
}
@@ -398,7 +427,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
}
public void loadDirectlyDefined() {
RewardHandler.getInstance().getDirectlyDefinedRewards().clear();
getRewardHandler().getDirectlyDefinedRewards().clear();
// AllSites reward
addDirectlyDefinedRewards(new DirectlyDefinedReward("AllSites") {
@@ -423,6 +452,29 @@ public class VotingPluginMain extends AdvancedCorePlugin {
}
});
addDirectlyDefinedRewards(new DirectlyDefinedReward("AlmostAllSites") {
@Override
public void createSection(String key) {
getSpecialRewardsConfig().createSection(key);
}
@Override
public ConfigurationSection getFileData() {
return getSpecialRewardsConfig().getData();
}
@Override
public void save() {
getSpecialRewardsConfig().saveData();
}
@Override
public void setData(String path, Object value) {
getSpecialRewardsConfig().setValue(path, value);
}
});
// FirstVote
addDirectlyDefinedRewards(new DirectlyDefinedReward("FirstVote") {
@@ -712,6 +764,29 @@ public class VotingPluginMain extends AdvancedCorePlugin {
getConfigVoteSites().setValue(path, value);
}
});
addDirectlyDefinedRewards(new DirectlyDefinedReward("VoteSites." + site.getKey() + ".CoolDownEndRewards") {
@Override
public void createSection(String key) {
getConfigVoteSites().createSection(key);
}
@Override
public ConfigurationSection getFileData() {
return getConfigVoteSites().getData();
}
@Override
public void save() {
getConfigVoteSites().saveData();
}
@Override
public void setData(String path, Object value) {
getConfigVoteSites().setValue(path, value);
}
});
}
// vote streaks
@@ -846,39 +921,60 @@ public class VotingPluginMain extends AdvancedCorePlugin {
});
}
addDirectlyDefinedRewards(new DirectlyDefinedReward("BungeeVotePartyRewards") {
@Override
public void createSection(String key) {
getBungeeSettings().createSection(key);
}
@Override
public ConfigurationSection getFileData() {
return getBungeeSettings().getData();
}
@Override
public void save() {
getBungeeSettings().saveData();
}
@Override
public void setData(String path, Object value) {
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() {
getTimer().schedule(new TimerTask() {
getTimer().scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
if (plugin != null) {
update();
} else {
cancel();
}
}
}, 1000, 1000 * 60 * configFile.getDelayBetweenUpdates());
}, 1000, 1000 * 60 * configFile.getDelayBetweenUpdates(), TimeUnit.MILLISECONDS);
getTimer().schedule(new TimerTask() {
getTimer().scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
if (plugin != null && configFile.isExtraBackgroundUpdate()) {
basicBungeeUpdate();
} else {
cancel();
}
}
}, 1000, 1000 * 30);
}, 1000, 1000 * 30, TimeUnit.MILLISECONDS);
}
}, 40L);
}, 2);
}
@@ -926,22 +1022,45 @@ public class VotingPluginMain extends AdvancedCorePlugin {
* Metrics.
*/
private void metrics() {
new VotingPluginMetrics().load(this);
new VotingPluginMetrics().load(plugin);
}
private void loadVoteTimer() {
voteTimer = Executors.newSingleThreadScheduledExecutor();
}
@Getter
private TimeQueueHandler timeQueueHandler;
private void loadBungeeHandler() {
bungeeHandler = new BungeeHandler(this);
bungeeHandler.load();
if (getOptions().getServer().equalsIgnoreCase("PleaseSet")) {
getLogger().warning("Bungeecoord is true and server name is not set, bungeecoord features may not work");
}
}
@Override
public void onPostLoad() {
loadVersionFile();
getOptions().setServer(bungeeSettings.getServer());
voteTester = new VoteTester(plugin);
loadVoteTimer();
if (bungeeSettings.isUseBungeecoord()) {
bungeeHandler = new BungeeHandler(this);
bungeeHandler.load();
loadBungeeHandler();
}
if (getOptions().getServer().equalsIgnoreCase("PleaseSet")) {
getLogger()
.warning("Bungeecoord is true and server name is not set, bungeecoord features may not work");
}
if (!bungeeSettings.isUseBungeecoord() || !bungeeSettings.isGloblalDataEnabled()) {
this.timeQueueHandler = new TimeQueueHandler(this);
}
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
new VotingPluginExpansion(this).register();
getLogger().info("Loading PlaceholderAPI expansion");
}
registerCommands();
@@ -952,13 +1071,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() {
@@ -968,7 +1088,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
topVoterHandler = new TopVoterHandler(this);
lastMonthTopVoter = new LinkedHashMap<TopVoterPlayer, Integer>();
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
plugin.getBukkitScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
@@ -991,7 +1111,13 @@ public class VotingPluginMain extends AdvancedCorePlugin {
topVoterHandler.register();
metrics();
plugin.getBukkitScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
metrics();
}
});
// javascript api
getJavascriptEngineRequests().add(new JavascriptPlaceholderRequest("User") {
@@ -1002,11 +1128,13 @@ public class VotingPluginMain extends AdvancedCorePlugin {
}
});
getJavascriptEngine().put("VotingPluginHooks", VotingPluginHooks.getInstance());
getJavascriptEngine().put("VotingPlugin", this);
loadTimer();
// placeholderapi loading
placeholders = new PlaceHolders(this);
getServerData().updatePlaceholders();
placeholders.load();
if (Bukkit.getPluginManager().isPluginEnabled("MVdWPlaceholderAPI")) {
@@ -1015,15 +1143,17 @@ public class VotingPluginMain extends AdvancedCorePlugin {
}
// Add rewards
RewardHandler.getInstance().addInjectedReward(new RewardInjectInt("Points", 0) {
getRewardHandler().addInjectedReward(new RewardInjectInt("Points", 0) {
@Override
public String onRewardRequest(Reward reward, com.bencodez.advancedcore.api.user.AdvancedCoreUser user,
int num, HashMap<String, String> placeholders) {
UserManager.getInstance().getVotingPluginUser(user).addPoints(num);
return null;
VotingPluginUser vpUser = getVotingPluginUserManager().getVotingPluginUser(user);
String str = "" + vpUser.addPoints(num);
debug("Setting points to " + str);
return str;
}
}.synchronize().addEditButton(
}.synchronize().asPlaceholder("newpoints").addEditButton(
new EditGUIButton(new ItemBuilder(Material.PAPER), new EditGUIValueNumber("Points", null) {
@Override
@@ -1041,17 +1171,17 @@ public class VotingPluginMain extends AdvancedCorePlugin {
}
}));
RewardHandler.getInstance().addInjectedReward(new RewardInjectConfigurationSection("VoteBossBar") {
getRewardHandler().addInjectedReward(new RewardInjectConfigurationSection("VoteBossBar") {
@Override
public String onRewardRequested(Reward arg0, com.bencodez.advancedcore.api.user.AdvancedCoreUser user,
ConfigurationSection section, HashMap<String, String> placeholders) {
if (section.getBoolean("Enabled")) {
user.sendBossBar(
StringParser.getInstance().replacePlaceHolder(section.getString("Message", ""),
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));
}
@@ -1060,11 +1190,11 @@ public class VotingPluginMain extends AdvancedCorePlugin {
});
for (final TopVoter top : TopVoter.values()) {
RewardHandler.getInstance().addPlaceholder(new RewardPlaceholderHandle("Total_" + top.toString()) {
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);
}
});
@@ -1077,11 +1207,11 @@ public class VotingPluginMain extends AdvancedCorePlugin {
plugin.getLogger().info("Enabled VotingPlugin " + plugin.getDescription().getVersion());
if (getProfile().contains("dev")) {
plugin.getLogger().warning(
plugin.getLogger().info(
"Using dev build, this is not a stable build, use at your own risk. Build number: " + buildNumber);
}
boolean hasRewards = RewardHandler.getInstance().hasRewards(getConfigVoteSites().getData(),
boolean hasRewards = getRewardHandler().hasRewards(getConfigVoteSites().getData(),
getConfigVoteSites().getEverySiteRewardPath());
boolean issues = true;
@@ -1090,7 +1220,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
if (!site.hasRewards() && !hasRewards) {
issues = false;
plugin.getLogger().warning("No rewards detected for the site: " + site.getKey()
+ ". See https://github.com/BenCodez/VotingPlugin/wiki/Rewards on how to add rewards");
+ ". See https://github.com/BenCodez/VotingPlugin/wiki/Rewards");
}
boolean contains = false;
@@ -1107,18 +1237,29 @@ 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);
}
}
@Getter
private ServiceSiteHandler serviceSiteHandler;
/*
* (non-Javadoc)
*
@@ -1145,7 +1286,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
loadVoteSites();
votingPluginUserManager = UserManager.getInstance();
votingPluginUserManager = new UserManager(this);
votingPluginUserManager.addCachingKeys();
setJenkinsSite("bencodez.com");
@@ -1160,8 +1301,6 @@ public class VotingPluginMain extends AdvancedCorePlugin {
*/
@Override
public void onUnLoad() {
getSigns().storeSigns();
HandlerList.unregisterAll(plugin);
if (bungeeSettings.isUseBungeecoord()) {
try {
getBungeeHandler().close();
@@ -1169,6 +1308,18 @@ public class VotingPluginMain extends AdvancedCorePlugin {
debug(e);
}
}
voteTimer.shutdown();
try {
voteTimer.awaitTermination(1, TimeUnit.SECONDS);
} catch (InterruptedException e) {
e.printStackTrace();
}
voteTimer.shutdownNow();
if (timeQueueHandler != null) {
timeQueueHandler.save();
}
getSigns().storeSigns();
HandlerList.unregisterAll(plugin);
plugin = null;
}
@@ -1189,12 +1340,14 @@ public class VotingPluginMain extends AdvancedCorePlugin {
// /adminvote, /av
getCommand("adminvote").setExecutor(new CommandAdminVote(this));
getCommand("adminvote").setTabCompleter(new AdminVoteTabCompleter());
getCommand("adminvote").setPermission("VotingPlugin.Commands.AdminVote");
getCommand("av").setExecutor(new CommandAdminVote(this));
getCommand("av").setTabCompleter(new AdminVoteTabCompleter());
getCommand("av").setPermission("VotingPlugin.Commands.AdminVote");
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 {
@@ -1223,6 +1376,10 @@ public class VotingPluginMain extends AdvancedCorePlugin {
pm.registerEvents(new PlayerInteract(this), this);
}
if (timeQueueHandler != null) {
pm.registerEvents(timeQueueHandler, plugin);
}
pm.registerEvents(new VotingPluginUpdateEvent(this), this);
/*
* if (!NMSManager.getInstance().isVersion("1.12")) { pm.registerEvents(new
@@ -1248,8 +1405,6 @@ public class VotingPluginMain extends AdvancedCorePlugin {
}
private void reloadPlugin(boolean userStorage) {
setUpdate(true);
configFile.reloadData();
configFile.loadValues();
@@ -1260,29 +1415,48 @@ public class VotingPluginMain extends AdvancedCorePlugin {
gui.reloadData();
bungeeSettings.reloadData();
if (bungeeSettings.isUseBungeecoord()) {
if (getBungeeHandler() == null) {
loadBungeeHandler();
}
if (userStorage) {
getBungeeHandler().loadGlobalMysql();
}
}
checkYMLError();
if (broadcastHandler != null) {
broadcastHandler.schelude(getConfigFile().getFormatAlternateBroadcastDelay());
broadcastHandler.schedule(getConfigFile().getFormatAlternateBroadcastDelay());
}
updateAdvancedCoreHook();
plugin.loadVoteSites();
loadDirectlyDefined();
reloadAdvancedCore(userStorage);
getOptions().setServer(bungeeSettings.getServer());
placeholders.load();
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();
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
update();
}
});
setUpdate(true);
}
private void setupFiles() {
@@ -1308,6 +1482,9 @@ public class VotingPluginMain extends AdvancedCorePlugin {
plugin.debug("Loaded Files");
}
@Getter
private long lastBackgroundTaskTimeTaken = -1;
public void update() {
if (update || configFile.isAlwaysUpdate()) {
if (!updateStarted && plugin != null) {
@@ -1316,98 +1493,130 @@ public class VotingPluginMain extends AdvancedCorePlugin {
update = false;
synchronized (plugin) {
getUserManager().getDataManager().clearCacheBasic();
if (plugin != null && plugin.isEnabled()) {
getUserManager().getDataManager().clearCacheBasic();
plugin.debug("Starting background task, current cached users: "
+ plugin.getUserManager().getDataManager().getUserDataCache().keySet().size());
try {
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>>();
ArrayList<TopVoter> topVotersToCheck = new ArrayList<TopVoter>();
for (TopVoter top : TopVoter.values()) {
if (plugin.getConfigFile().getLoadTopVoter(top)) {
topVotersToCheck.add(top);
tempTopVoter.put(top, new LinkedHashMap<TopVoterPlayer, Integer>());
}
}
boolean topVoterIgnorePermissionUse = plugin.getConfigFile().getTopVoterIgnorePermission();
ArrayList<String> blackList = plugin.getConfigFile().getBlackList();
ArrayList<String> uuids = UserManager.getInstance().getAllUUIDs();
int currentDay = LocalDateTime.now().getDayOfMonth();
for (String uuid : uuids) {
if (uuid != null && !uuid.isEmpty()) {
VotingPluginUser user = UserManager.getInstance()
.getVotingPluginUser(UUID.fromString(uuid), false);
user.dontCache();
user.tempCache();
user.getUserData().updateCacheWithTemp();
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();
}
}
user.clearTempCache();
user = null;
}
}
update = false;
long time1 = ((System.currentTimeMillis() - startTime) / 1000);
plugin.debug("Finished loading player data in " + time1 + " seconds, " + uuids.size()
+ " users, " + plugin.getStorageType().toString());
time1 = System.currentTimeMillis();
topVoterHandler.updateTopVoters(tempTopVoter);
setVoteToday(voteToday);
serverData.updateValues();
getSigns().updateSigns();
tempTopVoter = null;
time1 = ((System.currentTimeMillis() - time1) / 1000);
long totalTime = ((System.currentTimeMillis() - startTime) / 1000);
plugin.debug("Background task finished. Final processing took " + time1
+ " seconds. Total time: " + totalTime + " seconds");
plugin.extraDebug("Current cached users: "
plugin.debug("Starting background task, current cached users: "
+ plugin.getUserManager().getDataManager().getUserDataCache().keySet().size());
checkFirstTimeLoaded();
} catch (Exception ex) {
plugin.getLogger().info("Looks like something went wrong");
ex.printStackTrace();
try {
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>>();
ArrayList<TopVoter> topVotersToCheck = new ArrayList<TopVoter>();
for (TopVoter top : TopVoter.values()) {
if (plugin == null) {
return;
}
if (plugin.getConfigFile().getLoadTopVoter(top)) {
topVotersToCheck.add(top);
tempTopVoter.put(top, new LinkedHashMap<TopVoterPlayer, Integer>());
}
}
boolean topVoterIgnorePermissionUse = plugin.getConfigFile()
.isTopVoterIgnorePermission();
ArrayList<String> blackList = plugin.getConfigFile().getBlackList();
// ArrayList<String> uuids = getVotingPluginUserManager().getAllUUIDs();
int currentDay = LocalDateTime.now().getDayOfMonth();
HashMap<UUID, ArrayList<Column>> cols = plugin.getUserManager().getAllKeys();
long time1 = ((System.currentTimeMillis() - startTime) / 1000);
plugin.debug("Finished getting player data in " + time1 + " seconds, " + cols.size()
+ " users, " + plugin.getStorageType().toString());
time1 = System.currentTimeMillis();
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 = 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<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) {
if (!plugin.getPlaceholders().getCacheLevel().onlineOnly()
|| user.isOnline()) {
plugin.getPlaceholders().onUpdate(user, false);
}
}
user.clearTempCache();
user = null;
}
} else {
return;
}
}
cols.clear();
cols = null;
topVoterHandler.updateTopVoters(tempTopVoter);
placeholders.onUpdate();
setVoteToday(voteToday);
serverData.updateValues();
getSigns().updateSigns();
checkFirstTimeLoaded();
plugin.getUserManager().getDataManager().clearNonNeededCachedUsers();
plugin.extraDebug("Current cached users: "
+ plugin.getUserManager().getDataManager().getUserDataCache().keySet().size());
update = false;
tempTopVoter = null;
time1 = ((System.currentTimeMillis() - time1) / 1000);
long totalTime = ((System.currentTimeMillis() - startTime) / 1000);
lastBackgroundTaskTimeTaken = totalTime;
plugin.debug("Background task finished. Final processing took " + time1
+ " seconds. Total time: " + totalTime + " seconds");
} catch (Exception ex) {
if (plugin != null) {
plugin.getLogger().info("Looks like something went wrong");
}
ex.printStackTrace();
}
}
}
@@ -1421,6 +1630,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
public void checkFirstTimeLoaded() {
if (!firstTimeLoaded) {
if (getGui().isChestVoteTopUseSkull()) {
int maxToLoad = 200;
for (TopVoter top : topVoter.keySet()) {
@@ -1441,7 +1651,23 @@ public class VotingPluginMain extends AdvancedCorePlugin {
public void updateAdvancedCoreHook() {
getJavascriptEngine().put("VotingPlugin", this);
allowDownloadingFromSpigot(15358);
setConfigData(configFile.getData());
setConfigData(new YMLConfig(this, configFile.getData()) {
@Override
public void setValue(String path, Object value) {
configFile.setValue(path, value);
}
@Override
public void saveData() {
configFile.saveData();
}
@Override
public void createSection(String key) {
configFile.createSection(key);
}
});
if (bungeeSettings.isUseBungeecoord()) {
getOptions().setPerServerRewards(getBungeeSettings().isPerServerRewards());
}
@@ -2,9 +2,7 @@ package com.bencodez.votingplugin;
import java.util.concurrent.Callable;
import com.bencodez.advancedcore.api.metrics.BStatsMetrics;
import com.bencodez.advancedcore.api.rewards.RewardHandler;
import com.bencodez.votingplugin.user.UserManager;
import com.bencodez.simpleapi.metrics.BStatsMetrics;
public class VotingPluginMetrics {
@@ -15,7 +13,7 @@ public class VotingPluginMetrics {
@Override
public String call() throws Exception {
if (RewardHandler.getInstance().hasRewards(plugin.getSpecialRewardsConfig().getData(),
if (plugin.getRewardHandler().hasRewards(plugin.getSpecialRewardsConfig().getData(),
plugin.getSpecialRewardsConfig().getFirstVoteRewardsPath())) {
return "True";
} else {
@@ -27,7 +25,7 @@ public class VotingPluginMetrics {
@Override
public String call() throws Exception {
if (RewardHandler.getInstance().hasRewards(plugin.getConfigVoteSites().getData(),
if (plugin.getRewardHandler().hasRewards(plugin.getConfigVoteSites().getData(),
plugin.getConfigVoteSites().getEverySiteRewardPath())) {
return "True";
} else {
@@ -39,7 +37,7 @@ public class VotingPluginMetrics {
@Override
public String call() throws Exception {
if (RewardHandler.getInstance().hasRewards(plugin.getSpecialRewardsConfig().getData(),
if (plugin.getRewardHandler().hasRewards(plugin.getSpecialRewardsConfig().getData(),
plugin.getSpecialRewardsConfig().getAllSitesRewardPath())) {
return "True";
} else {
@@ -67,13 +65,20 @@ public class VotingPluginMetrics {
@Override
public String call() throws Exception {
if (!plugin.getSpecialRewardsConfig().getVotePartyEnabled()) {
if (!plugin.getSpecialRewardsConfig().isVotePartyEnabled()) {
return "False";
} else {
return "True";
}
}
}));
metrics.addCustomChart(new BStatsMetrics.SimplePie("placeholder_cache_level", new Callable<String>() {
@Override
public String call() throws Exception {
return plugin.getPlaceholders().getCacheLevel().toString();
}
}));
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_milestone", new Callable<String>() {
@Override
@@ -94,7 +99,7 @@ public class VotingPluginMetrics {
@Override
public String call() throws Exception {
if (RewardHandler.getInstance().hasRewards(plugin.getSpecialRewardsConfig().getData(),
if (plugin.getRewardHandler().hasRewards(plugin.getSpecialRewardsConfig().getData(),
plugin.getSpecialRewardsConfig().getAnySiteRewardsPath())) {
return "True";
} else {
@@ -109,7 +114,7 @@ public class VotingPluginMetrics {
for (String s : plugin.getSpecialRewardsConfig().getVoteStreakVotes("Day")) {
if (plugin.getSpecialRewardsConfig().getVoteStreakRewardEnabled("Day", s)
&& RewardHandler.getInstance().hasRewards(plugin.getSpecialRewardsConfig().getData(),
&& plugin.getRewardHandler().hasRewards(plugin.getSpecialRewardsConfig().getData(),
plugin.getSpecialRewardsConfig().getVoteStreakRewardsPath("Day", s))) {
return "True";
}
@@ -126,7 +131,7 @@ public class VotingPluginMetrics {
for (String s : plugin.getSpecialRewardsConfig().getVoteStreakVotes("Week")) {
if (plugin.getSpecialRewardsConfig().getVoteStreakRewardEnabled("Week", s)
&& RewardHandler.getInstance().hasRewards(plugin.getSpecialRewardsConfig().getData(),
&& plugin.getRewardHandler().hasRewards(plugin.getSpecialRewardsConfig().getData(),
plugin.getSpecialRewardsConfig().getVoteStreakRewardsPath("Week", s))) {
return "True";
}
@@ -143,7 +148,7 @@ public class VotingPluginMetrics {
for (String s : plugin.getSpecialRewardsConfig().getVoteStreakVotes("Month")) {
if (plugin.getSpecialRewardsConfig().getVoteStreakRewardEnabled("Month", s)
&& RewardHandler.getInstance().hasRewards(plugin.getSpecialRewardsConfig().getData(),
&& plugin.getRewardHandler().hasRewards(plugin.getSpecialRewardsConfig().getData(),
plugin.getSpecialRewardsConfig().getVoteStreakRewardsPath("Month", s))) {
return "True";
}
@@ -156,14 +161,14 @@ 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>() {
@Override
public String call() throws Exception {
return "" + RewardHandler.getInstance().getRewards().size();
return "" + plugin.getRewardHandler().getRewards().size();
}
}));
metrics.addCustomChart(new BStatsMetrics.SimplePie("autocreatevotesites", new Callable<String>() {
@@ -178,38 +183,30 @@ public class VotingPluginMetrics {
@Override
public String call() throws Exception {
int total = UserManager.getInstance().getAllUUIDs().size();
if (total < 1000) {
return "<1000";
int total = plugin.getUserManager().getAllUUIDs().size();
if (total > 800000) {
return ">800000";
} else if (total > 700000) {
return "700000-800000";
} else if (total > 600000) {
return "600000-700000";
} else if (total > 500000) {
return "500000-600000";
} else if (total > 400000) {
return "400000-500000";
} else if (total > 300000) {
return "300000-400000";
} else if (total > 200000) {
return "200000-300000";
} else if (total > 100000) {
return "100000-200000";
} else if (total > 10000) {
return ">10000";
} else {
return "1000-10000";
return ">10000-100000";
}
return "<10000";
}
}));
int users = UserManager.getInstance().getAllUUIDs().size();
if (users > 1000) {
metrics.addCustomChart(new BStatsMetrics.SimplePie("number_of_users_in_thousands", new Callable<String>() {
@Override
public String call() throws Exception {
int total = UserManager.getInstance().getAllUUIDs().size() / 1000;
return "" + total;
}
}));
}
if (users > 10000) {
metrics.addCustomChart(new BStatsMetrics.SimplePie("number_of_users_in_thousands_plus_10", new Callable<String>() {
@Override
public String call() throws Exception {
int total = UserManager.getInstance().getAllUUIDs().size() / 1000;
return "" + total;
}
}));
}
metrics.addCustomChart(new BStatsMetrics.SimplePie("data_storage", new Callable<String>() {
@Override
@@ -228,28 +225,28 @@ public class VotingPluginMetrics {
@Override
public String call() throws Exception {
return "" + plugin.getConfigFile().getVoteRemindingEnabled();
return "" + plugin.getConfigFile().isVoteRemindingEnabled();
}
}));
metrics.addCustomChart(new BStatsMetrics.SimplePie("LoadTopVoter_Monthly", new Callable<String>() {
@Override
public String call() throws Exception {
return "" + plugin.getConfigFile().getLoadTopVoterMonthly();
return "" + plugin.getConfigFile().isLoadTopVoterMonthly();
}
}));
metrics.addCustomChart(new BStatsMetrics.SimplePie("LoadTopVoter_Weekly", new Callable<String>() {
@Override
public String call() throws Exception {
return "" + plugin.getConfigFile().getLoadTopVoterWeekly();
return "" + plugin.getConfigFile().isLoadTopVoterWeekly();
}
}));
metrics.addCustomChart(new BStatsMetrics.SimplePie("LoadTopVoter_Daily", new Callable<String>() {
@Override
public String call() throws Exception {
return "" + plugin.getConfigFile().getLoadTopVoterDaily();
return "" + plugin.getConfigFile().isLoadTopVoterDaily();
}
}));
metrics.addCustomChart(new BStatsMetrics.SimplePie("bungeemethod", new Callable<String>() {
@@ -300,13 +297,38 @@ public class VotingPluginMetrics {
return "" + plugin.getBungeeSettings().isTriggerVotifierEvent();
}
}));
metrics.addCustomChart(new BStatsMetrics.SimplePie("globaldata_enabled", new Callable<String>() {
@Override
public String call() throws Exception {
return "" + plugin.getBungeeSettings().isGloblalDataEnabled();
}
}));
if (plugin.getBungeeSettings().isGloblalDataEnabled()) {
metrics.addCustomChart(new BStatsMetrics.SimplePie("globaldata_usemainmysql", new Callable<String>() {
@Override
public String call() throws Exception {
return "" + plugin.getBungeeSettings().isGloblalDataUseMainMySQL();
}
}));
}
}
metrics.addCustomChart(new BStatsMetrics.SimplePie("geyserprefixsupport", new Callable<String>() {
metrics.addCustomChart(new BStatsMetrics.SimplePie("persitecooldownevents", new Callable<String>() {
@Override
public String call() throws Exception {
return "" + plugin.getOptions().isGeyserPrefixSupport();
return "" + plugin.getConfigFile().isPerSiteCoolDownEvents();
}
}));
metrics.addCustomChart(new BStatsMetrics.SimplePie("bedrockplayerprefix", new Callable<String>() {
@Override
public String call() throws Exception {
return "" + plugin.getOptions().getBedrockPlayerPrefix();
}
}));
@@ -330,11 +352,19 @@ public class VotingPluginMetrics {
@Override
public String call() throws Exception {
return "" + (!plugin.getConfigFile().isDisableCoolDownCheck() && RewardHandler.getInstance()
return "" + (!plugin.getConfigFile().isDisableCoolDownCheck() && plugin.getRewardHandler()
.hasRewards(plugin.getSpecialRewardsConfig().getData(), "VoteCoolDownEndedReward"));
}
}));
metrics.addCustomChart(new BStatsMetrics.SimplePie("background_task_time_taken", new Callable<String>() {
@Override
public String call() throws Exception {
return "" + plugin.getLastBackgroundTaskTimeTaken();
}
}));
if (!plugin.getBuildNumber().equals("NOTSET")) {
metrics.addCustomChart(new BStatsMetrics.SimplePie("dev_build_number", new Callable<String>() {
@@ -2,26 +2,27 @@ package com.bencodez.votingplugin.broadcast;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
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 Timer timer;
private ScheduledExecutorService timer;
ConcurrentLinkedQueue<String> votedPlayers = new ConcurrentLinkedQueue<String>();
public BroadcastHandler(VotingPluginMain plugin, int delay) {
this.plugin = plugin;
schelude(delay);
schedule(delay);
}
public void check() {
@@ -30,14 +31,21 @@ 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();
if (!votedPlayers.isEmpty()) {
playersText += ", ";
}
}
HashMap<String, String> placeholders = new HashMap<String, String>();
placeholders.put("numberofplayers", "" + size);
bc = StringParser.getInstance().replacePlaceHolder(bc, placeholders);
placeholders.put("players", playersText);
bc = PlaceholderUtils.replacePlaceHolder(bc, placeholders);
ArrayList<Player> players = new ArrayList<Player>();
for (Player p : Bukkit.getOnlinePlayers()) {
if (!UserManager.getInstance().getVotingPluginUser(p).getDisableBroadcast()) {
if (!plugin.getVotingPluginUserManager().getVotingPluginUser(p).getDisableBroadcast()) {
players.add(p);
}
}
@@ -50,19 +58,19 @@ public class BroadcastHandler {
votedPlayers.add(player);
}
public void schelude(int delay) {
public void schedule(int delay) {
if (timer != null) {
timer.cancel();
timer = new Timer();
timer.shutdownNow();
timer = Executors.newScheduledThreadPool(1);
} else {
timer = new Timer();
timer = Executors.newScheduledThreadPool(1);
}
timer.schedule(new TimerTask() {
timer.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
check();
}
}, 1000 * 60, 1000 * 60 * delay);
}, 60, 60 * delay, TimeUnit.SECONDS);
}
}
@@ -3,33 +3,48 @@ 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
// alltimetotal//monthtotal//weeklytotal//dailytotal//points//milestonecount//votepartycurrent//votepartyrequired
@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 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 milestoneCount, int votePartyCurrent, int votePartyRequired) {
this.allTimeTotal = allTimeTotal;
this.monthTotal = monthTotal;
this.weeklyTotal = weeklyTotal;
this.dailyTotal = dailyTotal;
this.points = points;
this.milestoneCount = milestoneCount;
this.votePartyCurrent = votePartyCurrent;
this.votePartyRequired = votePartyRequired;
}
public BungeeMessageData(String str) {
@@ -42,12 +57,16 @@ public class BungeeMessageData {
points = Integer.parseInt(data[4]);
milestoneCount = Integer.parseInt(data[5]);
}
if (data.length >= 8) {
votePartyCurrent = Integer.parseInt(data[6]);
votePartyRequired = Integer.parseInt(data[7]);
}
}
@Override
public String toString() {
return allTimeTotal + "//" + monthTotal + "//" + weeklyTotal + "//" + dailyTotal + "//" + points + "//"
+ milestoneCount;
+ milestoneCount + "//" + votePartyCurrent + "//" + votePartyRequired;
}
}
@@ -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;
}
}
@@ -21,6 +21,26 @@ public class Config {
this.bungee = bungee;
}
public String getRedisHost() {
return getData().getString("Redis.Host", "");
}
public int getRedisPort() {
return getData().getInt("Redis.Port", 6379);
}
public String getRedisUsername() {
return getData().getString("Redis.Username", "");
}
public String getRedisPrefix() {
return getData().getString("Redis.Prefix", "");
}
public String getRedisPassword() {
return getData().getString("Redis.Password", "");
}
public boolean getAllowUnJoined() {
return getData().getBoolean("AllowUnJoined", false);
}
@@ -29,10 +49,30 @@ public class Config {
return getData().getStringList("BlockedServers");
}
public List<String> getWhiteListedServers() {
return getData().getStringList("WhiteListedServers");
}
public boolean getBroadcast() {
return getData().getBoolean("Broadcast", false);
}
public String getBedrockPlayerPrefix() {
return getData().getString("BedrockPlayerPrefix", ".");
}
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", "");
}
@@ -53,6 +93,38 @@ public class Config {
return getData().getBoolean("Debug", false);
}
public boolean getMultiProxySupport() {
return getData().getBoolean("MultiProxySupport", false);
}
public int getMaxAmountOfVotesPerDay() {
return getData().getInt("MaxAmountOfVotesPerDay", -1);
}
public int getMultiProxySocketHostPort() {
return getData().getInt("MultiProxySocketHost.Port", 1297);
}
public String getMultiProxySocketHostHost() {
return getData().getString("MultiProxySocketHost.Host", "");
}
public boolean getMultiProxyOneGlobalReward() {
return getData().getBoolean("MultiProxyOneGlobalReward", false);
}
public Configuration getMultiProxyServersConfiguration(String s) {
return getData().getSection("MultiProxyServers." + s);
}
public Collection<String> getMultiProxyServers() {
return getData().getSection("MultiProxyServers").getKeys();
}
public boolean getPrimaryServer() {
return getData().getBoolean("PrimaryServer", false);
}
public String getFallBack() {
return getData().getString("FallBackServer", "");
}
@@ -77,6 +149,70 @@ public class Config {
return getData().getBoolean("WaitForUserOnline", false);
}
public boolean getVotePartyEnabled() {
return getData().getBoolean("VoteParty.Enabled", false);
}
public boolean getVotePartySendToAllServers() {
return getData().getBoolean("VoteParty.SendToAllServers", true);
}
public int getVotePartyVotesRequired() {
return getData().getInt("VoteParty.VotesRequired", 100);
}
public int getVotePartyIncreaseVotesRequired() {
return getData().getInt("VoteParty.IncreaseVotesRequired", 0);
}
public int getVoteCacheTime() {
return getData().getInt("VoteCacheTime", -1);
}
public String getVotePartyBroadcast() {
return getData().getString("VoteParty.Broadcast", "");
}
public String getMultiProxyMethod() {
return getData().getString("MultiProxyMethod", "SOCKET");
}
public String getProxyServerName() {
return getData().getString("ProxyServerName", "SOCKET");
}
public List<String> getProxyServers() {
return getData().getStringList("ProxyServers");
}
public boolean getMultiProxyRedisUseExistingConnection() {
return getData().getBoolean("MultiProxyRedis.UseExistingConnection", false);
}
public List<String> getVotePartyServersToSend() {
return getData().getStringList("VoteParty.ServersToSend");
}
public List<String> getVotePartyBungeeCommands() {
return getData().getStringList("VoteParty.BungeeCommands");
}
public String getMultiProxyRedisHost() {
return getData().getString("MultiProxyRedis.Host", "");
}
public int getMultiProxyRedisPort() {
return getData().getInt("MultiProxyRedis.Port", 6379);
}
public String getMultiProxyRedisUsername() {
return getData().getString("MultiProxyRedis.Username", "");
}
public String getMultiProxyRedisPassword() {
return getData().getString("MultiProxyRedis.Password", "");
}
public void load() {
if (!bungee.getDataFolder().exists()) {
bungee.getDataFolder().mkdir();
@@ -7,6 +7,7 @@ import lombok.Getter;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.JsonConfiguration;
import net.md_5.bungee.config.YamlConfiguration;
public class NonVotedPlayersCache {
@@ -24,9 +25,16 @@ public class NonVotedPlayersCache {
}
}
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.getMysql().containsKeyQuery(uuid)) {
addPlayer(uuid, playerName);
}
}
public void check() {
@@ -53,7 +61,8 @@ public class NonVotedPlayersCache {
bungee.getDataFolder().mkdir();
}
File file = new File(bungee.getDataFolder(), "nonvotedplayerscache.yml");
File yamlFile = new File(bungee.getDataFolder(), "nonvotedplayerscache.yml");
File file = new File(bungee.getDataFolder(), "nonvotedplayerscache.json");
if (!file.exists()) {
try {
@@ -62,9 +71,24 @@ public class NonVotedPlayersCache {
e.printStackTrace();
}
}
if (yamlFile.exists()) {
try {
data = ConfigurationProvider.getProvider(YamlConfiguration.class)
.load(new File(bungee.getDataFolder(), "nonvotedplayerscache.yml"));
yamlFile.renameTo(new File(bungee.getDataFolder(), "oldnonvotedplayerscache.yml"));
ConfigurationProvider.getProvider(YamlConfiguration.class).save(data,
new File(bungee.getDataFolder(), "oldnonvotedplayerscache.yml"));
} catch (IOException e) {
e.printStackTrace();
}
save();
}
try {
data = ConfigurationProvider.getProvider(YamlConfiguration.class)
.load(new File(bungee.getDataFolder(), "nonvotedplayerscache.yml"));
data = ConfigurationProvider.getProvider(JsonConfiguration.class)
.load(new File(bungee.getDataFolder(), "nonvotedplayerscache.json"));
} catch (IOException e) {
e.printStackTrace();
}
@@ -84,8 +108,8 @@ public class NonVotedPlayersCache {
public void save() {
try {
ConfigurationProvider.getProvider(YamlConfiguration.class).save(data,
new File(bungee.getDataFolder(), "nonvotedplayerscache.yml"));
ConfigurationProvider.getProvider(JsonConfiguration.class).save(data,
new File(bungee.getDataFolder(), "nonvotedplayerscache.json"));
} catch (IOException e) {
e.printStackTrace();
}
@@ -4,9 +4,12 @@ import java.io.File;
import java.io.IOException;
import java.util.Collection;
import com.bencodez.votingplugin.timequeue.VoteTimeQueue;
import lombok.Getter;
import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.JsonConfiguration;
import net.md_5.bungee.config.YamlConfiguration;
public class VoteCache {
@@ -18,6 +21,30 @@ 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 addVote(String server, int num, OfflineBungeeVote voteData) {
Configuration section = getData().getSection("VoteCache." + server + "." + num);
section.set("Name", voteData.getPlayerName());
@@ -28,6 +55,13 @@ 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());
@@ -60,6 +94,14 @@ 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();
}
@@ -73,7 +115,9 @@ public class VoteCache {
bungee.getDataFolder().mkdir();
}
File file = new File(bungee.getDataFolder(), "votecache.yml");
File yamlFile = new File(bungee.getDataFolder(), "votecache.yml");
File file = new File(bungee.getDataFolder(), "votecache.json");
if (!file.exists()) {
try {
@@ -82,9 +126,23 @@ public class VoteCache {
e.printStackTrace();
}
}
if (yamlFile.exists()) {
try {
data = ConfigurationProvider.getProvider(YamlConfiguration.class)
.load(new File(bungee.getDataFolder(), "votecache.yml"));
yamlFile.renameTo(new File(bungee.getDataFolder(), "oldvotecache.yml"));
ConfigurationProvider.getProvider(YamlConfiguration.class).save(data,
new File(bungee.getDataFolder(), "oldvotecache.yml"));
} catch (IOException e) {
e.printStackTrace();
}
save();
}
try {
data = ConfigurationProvider.getProvider(YamlConfiguration.class)
.load(new File(bungee.getDataFolder(), "votecache.yml"));
data = ConfigurationProvider.getProvider(JsonConfiguration.class)
.load(new File(bungee.getDataFolder(), "votecache.json"));
} catch (IOException e) {
e.printStackTrace();
}
@@ -92,8 +150,8 @@ public class VoteCache {
public void save() {
try {
ConfigurationProvider.getProvider(YamlConfiguration.class).save(data,
new File(bungee.getDataFolder(), "votecache.yml"));
ConfigurationProvider.getProvider(JsonConfiguration.class).save(data,
new File(bungee.getDataFolder(), "votecache.json"));
} catch (IOException e) {
e.printStackTrace();
}
@@ -16,6 +16,7 @@ public class VoteEventBungee implements net.md_5.bungee.api.plugin.Listener {
public void onVote(VotifierEvent event) {
plugin.getProxy().getScheduler().runAsync(plugin, new Runnable() {
@SuppressWarnings("deprecation")
@Override
public void run() {
Vote vote = event.getVote();
@@ -24,11 +25,13 @@ public class VoteEventBungee implements net.md_5.bungee.api.plugin.Listener {
if (serviceSite.isEmpty()) {
serviceSite = "Empty";
vote.setServiceName(serviceSite);
}
plugin.vote(vote.getUsername(), serviceSite, true);
plugin.vote(vote.getUsername(), serviceSite, true, true, 0, null, null);
}
});
}
}
File diff suppressed because it is too large. Load diff
@@ -1,5 +1,7 @@
package com.bencodez.votingplugin.bungee;
import com.bencodez.advancedcore.api.time.TimeType;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.plugin.Command;
@@ -18,20 +20,26 @@ public class VotingPluginBungeeCommand extends Command {
if (args.length > 0) {
if (args[0].equalsIgnoreCase("reload")) {
bungee.reload(false);
sender.sendMessage(new TextComponent("&aReloading VotingPluginBungee"));
sender.sendMessage(new TextComponent("Reloading VotingPluginBungee"));
}
if (args[0].equalsIgnoreCase("reloadmysql")) {
bungee.reload(true);
sender.sendMessage(new TextComponent("&aReloading VotingPluginBungee with MySQL"));
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);
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(
@@ -41,22 +49,67 @@ public class VotingPluginBungeeCommand extends Command {
sender.sendMessage(new TextComponent(
"&aChecking status, waiting for response, check console, method: plugin messaging"));
bungee.status(sender);
bungee.sendServerNameMessage();
} else if (bungee.getMethod().equals(BungeeMethod.REDIS)) {
sender.sendMessage(new TextComponent(
"&aChecking status, waiting for response, check console, method: redis"));
bungee.status(sender);
bungee.sendServerNameMessage();
} else {
sender.sendMessage(
new TextComponent("&aNot using socket/pluginmessage method, command unavailable"));
new TextComponent("&aNot using socket/pluginmessage/redis method, command unavailable"));
}
}
if (args[0].equalsIgnoreCase("multiproxystatus")) {
bungee.getMultiProxyHandler().sendMultiProxyServerMessage("Status");
sender.sendMessage(new TextComponent("Sending status message"));
}
if (args[0].equalsIgnoreCase("help")) {
TextComponent[] msg = new TextComponent[4];
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]));
}
}
}
}
}
}
} else {
sender.sendMessage(new TextComponent("&cYou do not have permission to do this!"));
}
}
public boolean isInt(String st) {
if (st == null) {
return false;
}
try {
@SuppressWarnings("unused")
int num = Integer.parseInt(st);
return true;
} catch (NumberFormatException ex) {
return false;
}
}
}
@@ -0,0 +1,229 @@
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 {
public abstract boolean getMultiProxySupportEnabled();
public abstract EncryptionHandler getEncryptionHandler();
public abstract File getPluginDataFolder();
public abstract void setEncryptionHandler(EncryptionHandler encryptionHandler);
public abstract void logInfo(String msg);
public abstract boolean getDebug();
public abstract String getVersion();
private HashMap<String, ClientHandler> multiproxyClientHandles;
private SocketHandler multiproxySocketHandler;
@Getter
private RedisHandler multiProxyRedis;
public MultiProxyHandler() {
}
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 List<String> getProxyServers();
public void close() {
if (multiproxySocketHandler != null) {
multiproxySocketHandler.closeConnection();
multiproxySocketHandler = null;
}
if (multiProxyRedis != null && !getMultiProxyRedisUseExistingConnection()) {
multiProxyRedis.close();
}
}
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<String, ClientHandler>();
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 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]);
}
}
}
@Override
public void debug(String message) {
if (getDebug()) {
logInfo("MultiProxyRedis: " + message);
}
}
};
}
runAsnc(new Runnable() {
@Override
public void run() {
multiProxyRedis.loadListener(
new RedisListener(multiProxyRedis, "VotingPluginProxy_" + getMultiProxyServerName()));
}
});
}
logInfo("Loaded multi-proxy support: " + getMultiProxyMethod().toString());
}
}
public abstract void runAsnc(Runnable runnable);
public abstract MultiProxyMethod getMultiProxyMethod();
public abstract RedisHandler getRedisHandler();
public abstract boolean getMultiProxyRedisUseExistingConnection();
public abstract String getMultiProxyPassword();
public abstract String getMultiProxyUsername();
public abstract String getMultiProxyServerName();
public abstract int getMultiProxyRedisPort();
public abstract String getMultiProxyRedisHost();
public abstract boolean getPrimaryServer();
public void login(String uuid, String playerName) {
if (!getMultiProxySupportEnabled()) {
return;
}
if (getPrimaryServer()) {
return;
}
sendMultiProxyServerMessage("Login", uuid, playerName);
}
public abstract int getMultiProxySocketHostPort();
public abstract String getMultiProxySocketHostHost();
public abstract MultiProxyServerSocketConfiguration getMultiProxyServersConfiguration(String s);
public abstract Collection<String> getMultiProxyServers();
public abstract void triggerVote(String player, String service, boolean realVote, boolean timeQueue, long queueTime,
BungeeMessageData text, String uuid);
public abstract void addNonVotedPlayerCache(String string, String string2);
public abstract void clearVote(String string);
}
@@ -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 getServerName();
String getHost();
int getPort();
}
@@ -0,0 +1,31 @@
package com.bencodez.votingplugin.bungee.global.multiproxy;
import net.md_5.bungee.config.Configuration;
public class MultiProxyServerSocketConfigurationBungee implements MultiProxyServerSocketConfiguration {
private String server;
private String host;
private int port;
public MultiProxyServerSocketConfigurationBungee(String s, Configuration config) {
server = s;
host = config.getString("Host", "");
port = config.getInt("Port", 1234);
}
@Override
public String getServerName() {
return server;
}
@Override
public String getHost() {
return host;
}
@Override
public int getPort() {
return port;
}
}
@@ -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 getServerName() {
return server;
}
@Override
public String getHost() {
return host;
}
@Override
public int getPort() {
return port;
}
}
@@ -5,7 +5,9 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import com.bencodez.advancedcore.bungeeapi.velocity.VelocityYMLFile;
import org.checkerframework.checker.nullness.qual.NonNull;
import com.bencodez.simpleapi.file.velocity.VelocityYMLFile;
import ninja.leaping.configurate.ConfigurationNode;
@@ -23,12 +25,24 @@ public class Config extends VelocityYMLFile {
return getStringList(getNode("BlockedServers"), new ArrayList<String>());
}
public List<String> getWhiteListedServers() {
return getStringList(getNode("WhiteListedServers"), new ArrayList<String>());
}
public boolean getBroadcast() {
return getBoolean(getNode("Broadcast"), false);
}
public String getBungeeHost() {
return getString(getNode("BungeeServer", "Host"), "");
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 boolean getBungeeManageTotals() {
@@ -39,10 +53,42 @@ public class Config extends VelocityYMLFile {
return getString(getNode("BungeeMethod"), "PLUGINMESSAGING");
}
public String getRedisHost() {
return getString(getNode("Redis", "Host"), "");
}
public int getRedisPort() {
return getInt(getNode("Redis", "Port"), 6379);
}
public String getRedisUsername() {
return getString(getNode("Redis", "Username"), "");
}
public String getRedisPrefix() {
return getString(getNode("Redis", "Prefix"), "");
}
public String getRedisPassword() {
return getString(getNode("Redis", "Password"), "");
}
public String getBungeeHost() {
return getString(getNode("BungeeServer", "Host"), "");
}
public int getBungeePort() {
return getInt(getNode("BungeeServer", "Port"), 1297);
}
public int getMaxAmountOfVotesPerDay() {
return getInt(getNode("MaxAmountOfVotesPerDay"), -1);
}
public int getVoteCacheTime() {
return getInt(getNode("VoteCacheTime"), -1);
}
public boolean getDebug() {
return getBoolean(getNode("Debug"), false);
}
@@ -63,19 +109,112 @@ public class Config extends VelocityYMLFile {
return getBoolean(getNode("SendVotesToAllServers"), true);
}
public boolean getVotePartyEnabled() {
return getBoolean(getVotePartyNode().getNode("Enabled"), false);
}
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 Collection<String> getSpigotServers() {
ArrayList<String> list = new ArrayList<String>();
for (ConfigurationNode conf : getNode("SpigotServers").getChildrenList()) {
list.add(conf.getKey().toString());
}
return list;
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 boolean getMultiProxyOneGlobalReward() {
return getBoolean(getNode("MultiProxyOneGlobalReward"), false);
}
public boolean getPrimaryServer() {
return getBoolean(getNode("PrimaryServer"), false);
}
public String getBedrockPlayerPrefix() {
return getString(getNode("BedrockPlayerPrefix"), ".");
}
public ConfigurationNode getMultiProxyServers(String s) {
return getNode("MultiProxyServers", s);
}
public @NonNull Collection<? extends ConfigurationNode> getMultiProxyServers() {
return getNode("MultiProxyServers").getChildrenMap().values();
}
public String getMultiProxySocketHostHost() {
return getString(getNode("MultiProxySocketHost", "Host"), "");
}
public int getMultiProxySocketHostPort() {
return getInt(getNode("MultiProxySocketHost", "Port"), 1297);
}
public String getMultiProxyMethod() {
return getString(getNode("MultiProxyMethod"), "SOCKET");
}
public String getProxyServerName() {
return getString(getNode("ProxyServerName"), "SOCKET");
}
public List<String> getProxyServers() {
return getStringList(getNode("ProxyServers"), new ArrayList<String>());
}
public boolean getMultiProxyRedisUseExistingConnection() {
return getBoolean(getNode("MultiProxyRedis", "UseExistingConnection"), false);
}
public String getMultiProxyRedisHost() {
return getString(getNode("MultiProxyRedis", "Host"), "");
}
public int getMultiProxyRedisPort() {
return getInt(getNode("MultiProxyRedis", "Port"), 6379);
}
public String getMultiProxyRedisUsername() {
return getString(getNode("MultiProxyRedis", "Username"), "");
}
public String getMultiProxyRedisPassword() {
return getString(getNode("MultiProxyRedis", "Password"), "");
}
}
@@ -2,10 +2,10 @@ package com.bencodez.votingplugin.bungee.velocity;
import java.io.File;
import com.bencodez.advancedcore.bungeeapi.velocity.VelocityYMLFile;
import com.bencodez.simpleapi.file.velocity.VelocityJSONFile;
import com.velocitypowered.api.proxy.Player;
public class NonVotedPlayersCache extends VelocityYMLFile {
public class NonVotedPlayersCache extends VelocityJSONFile {
private VotingPluginVelocity plugin;
@@ -20,12 +20,18 @@ public class NonVotedPlayersCache extends VelocityYMLFile {
}
}
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.getMysql().containsKeyQuery(uuid)) {
addPlayer(uuid, playerName);
}
}
public void check() {
for (String player : getKeys(getNode("NonVotedPlayers"))) {
long time = getNode("NonVotedPlayers", player, "LastTime").getLong(0);
@@ -3,17 +3,42 @@ package com.bencodez.votingplugin.bungee.velocity;
import java.io.File;
import java.util.Collection;
import com.bencodez.advancedcore.bungeeapi.velocity.VelocityYMLFile;
import com.bencodez.simpleapi.file.velocity.VelocityJSONFile;
import com.bencodez.votingplugin.bungee.OfflineBungeeVote;
import com.bencodez.votingplugin.timequeue.VoteTimeQueue;
import ninja.leaping.configurate.ConfigurationNode;
public class VoteCache extends VelocityYMLFile {
public class VoteCache extends VelocityJSONFile {
public VoteCache(File file) {
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 addVote(String server, int num, OfflineBungeeVote voteData) {
String[] path = new String[] { "VoteCache", server, "" + num };
@@ -25,6 +50,13 @@ public class VoteCache extends VelocityYMLFile {
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());
}
public void addVoteOnline(String player, int num, OfflineBungeeVote voteData) {
String[] path = new String[] { "OnlineCache", player, "" + num };
@@ -46,6 +78,10 @@ public class VoteCache extends VelocityYMLFile {
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);
}
@@ -58,6 +94,10 @@ public class VoteCache extends VelocityYMLFile {
return getKeys(getNode("VoteCache"));
}
public Collection<String> getTimedVoteCache() {
return getKeys(getNode("TimedVoteCache"));
}
public Collection<String> getServerVotes(String server) {
return getKeys(getNode("OnlineCache", server));
}
@@ -0,0 +1,32 @@
package com.bencodez.votingplugin.bungee.velocity;
import com.velocitypowered.api.event.Subscribe;
import com.vexsoftware.votifier.velocity.event.VotifierEvent;
public class VoteEventVelocity {
private VotingPluginVelocity plugin;
public VoteEventVelocity(VotingPluginVelocity plugin) {
this.plugin = plugin;
}
@Subscribe
public void onVotifierEvent(VotifierEvent event) {
final String serviceSiteVote = event.getVote().getServiceName();
final String name = event.getVote().getUsername();
plugin.getTimer().execute(new Runnable() {
@Override
public void run() {
String serviceSite = serviceSiteVote;
plugin.getLogger().info("Vote received " + name + " from service site " + serviceSite);
if (serviceSite.isEmpty()) {
serviceSite = "Empty";
}
plugin.vote(name, serviceSite, true, false, 0, null, null);
}
});
}
}
File diff suppressed because it is too large. Load diff
@@ -1,5 +1,6 @@
package com.bencodez.votingplugin.bungee.velocity;
import com.bencodez.advancedcore.api.time.TimeType;
import com.bencodez.votingplugin.bungee.BungeeMethod;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.command.SimpleCommand;
@@ -33,10 +34,16 @@ public class VotingPluginVelocityCommand implements SimpleCommand {
if (args.length >= 2) {
String user = args[1];
String site = args[2];
plugin.vote(user, site, false);
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(
@@ -48,22 +55,68 @@ public class VotingPluginVelocityCommand implements SimpleCommand {
.text("Checking status, waiting for response, check console, method: pluginmessaging")
.color(NamedTextColor.AQUA));
plugin.status();
plugin.sendServerNameMessage();
} else if (plugin.getMethod().equals(BungeeMethod.REDIS)) {
source.sendMessage(
Component.text("Checking status, waiting for response, check console, method: redis")
.color(NamedTextColor.AQUA));
plugin.status();
plugin.sendServerNameMessage();
} else {
source.sendMessage(Component.text("Not using socket/pluginmessage method, command unavailable")
.color(NamedTextColor.AQUA));
}
}
if (args[0].equalsIgnoreCase("multiproxystatus")) {
plugin.getMultiProxyHandler().sendMultiProxyServerMessage("Status");
source.sendMessage(Component.text("Sending status message").color(NamedTextColor.AQUA));
}
if (args[0].equalsIgnoreCase("help")) {
String[] msg = new String[4];
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));
}
}
}
}
}
}
}
public boolean isInt(String st) {
if (st == null) {
return false;
}
try {
@SuppressWarnings("unused")
int num = Integer.parseInt(st);
return true;
} catch (NumberFormatException ex) {
return false;
}
}
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
@@ -46,7 +46,7 @@ public class CommandAliases implements CommandExecutor {
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>();
if (adminCommand) {
@@ -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,11 @@ 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,16 +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.rewards.RewardHandler;
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;
@@ -66,6 +65,7 @@ public class AdminGUI {
plugin.getConfigVoteSites().generateVoteSite(value);
player.sendMessage("Generated site");
plugin.reload();
openAdminGUIVoteSiteSite(player, plugin.getVoteSite(value, true));
}
});
} else {
@@ -110,7 +110,7 @@ public class AdminGUI {
@Override
public void onClick(ClickEvent clickEvent) {
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
RewardHandler.getInstance().getDirectlyDefined("FirstVote"));
plugin.getRewardHandler().getDirectlyDefined("FirstVote"));
}
});
buttons.add(new BInventoryButton(new ItemBuilder(Material.STONE, 1).setName("&cEdit FirstVoteToday reward")) {
@@ -118,7 +118,7 @@ public class AdminGUI {
@Override
public void onClick(ClickEvent clickEvent) {
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
RewardHandler.getInstance().getDirectlyDefined("FirstVoteToday"));
plugin.getRewardHandler().getDirectlyDefined("FirstVoteToday"));
}
});
@@ -127,7 +127,16 @@ public class AdminGUI {
@Override
public void onClick(ClickEvent clickEvent) {
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
RewardHandler.getInstance().getDirectlyDefined("AllSites"));
plugin.getRewardHandler().getDirectlyDefined("AllSites"));
}
});
buttons.add(new BInventoryButton(new ItemBuilder(Material.STONE, 1).setName("&cEdit AlmostAllSites reward")) {
@Override
public void onClick(ClickEvent clickEvent) {
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
plugin.getRewardHandler().getDirectlyDefined("AlmostAllSites"));
}
});
@@ -136,7 +145,7 @@ public class AdminGUI {
@Override
public void onClick(ClickEvent clickEvent) {
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
RewardHandler.getInstance().getDirectlyDefined("AnySiteRewards"));
plugin.getRewardHandler().getDirectlyDefined("AnySiteRewards"));
}
});
@@ -145,15 +154,53 @@ public class AdminGUI {
@Override
public void onClick(ClickEvent clickEvent) {
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
RewardHandler.getInstance().getDirectlyDefined("EverySiteReward"));
plugin.getRewardHandler().getDirectlyDefined("EverySiteReward"));
}
});
buttons.add(new BInventoryButton(new ItemBuilder("GRASS_BLOCK").setName("&cEdit BungeeSettings.yml")) {
buttons.add(new BInventoryButton(new ItemBuilder(Material.STONE, 1).setName("&cEdit BungeeVotePartyRewards")) {
@Override
public void onClick(ClickEvent clickEvent) {
new AdminVoteBungeeSettings(plugin, clickEvent.getPlayer()).open();
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
plugin.getRewardHandler().getDirectlyDefined("BungeeVotePartyRewards"));
}
});
buttons.add(new BInventoryButton(
new ItemBuilder("GRASS_BLOCK").setName("&cEdit BungeeSettings.yml").addLoreLine("&aCurrently WIP")) {
@Override
public void onClick(ClickEvent clickEvent) {
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());
}
});
@@ -165,6 +212,17 @@ public class AdminGUI {
}
});
buttons.add(new BInventoryButton(
new ItemBuilder(Material.STONE, 1).setName("&cBackground task time").addLoreLine("&aClick to see")) {
@Override
public void onClick(ClickEvent event) {
event.getPlayer().sendMessage("Last background task time: " + plugin.getLastBackgroundTaskTimeTaken());
}
});
return buttons;
}
@@ -184,14 +242,16 @@ public class AdminGUI {
int count = 0;
for (VoteSite voteSite : plugin.getVoteSites()) {
ArrayList<String> lore = new ArrayList<String>();
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),
inv.addButton(count, new BInventoryButton(voteSite.getKey(), ArrayUtils.convert(lore),
new ItemStack(Material.STONE)) {
@Override
@@ -229,14 +289,20 @@ 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);
plugin.getServer().getPluginManager().callEvent(voteEvent);
plugin.getVoteTimer().submit(new Runnable() {
@Override
public void run() {
plugin.getServer().getPluginManager().callEvent(voteEvent);
}
});
}
}
}, ArrayUtils.getInstance().convert(playerNames)).usingMethod(InputMethod.INVENTORY)
}, ArrayUtils.convert(playerNames)).usingMethod(InputMethod.INVENTORY)
.allowCustomOption(true).request(event.getWhoClicked());
}
});
@@ -305,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
@@ -355,12 +432,35 @@ public class AdminGUI {
@Override
public void onClick(ClickEvent clickEvent) {
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(), RewardHandler.getInstance()
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(), plugin.getRewardHandler()
.getDirectlyDefined("VoteSites." + voteSite.getKey() + ".Rewards"));
}
});
}
if (voteSite.getSiteData().isList("CoolDownEndRewards")) {
inv.addButton(new EditGUIButton(new EditGUIValueList("CoolDownEndRewards",
voteSite.getSiteData().getStringList("CoolDownEndRewards")) {
@Override
public void setValue(Player p, ArrayList<String> rewards) {
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
plugin.getConfigVoteSites().set(voteSite.getKey(), "CoolDownEndRewards", rewards);
plugin.reload();
}
}));
} else {
inv.addButton(new BInventoryButton(new ItemBuilder(Material.DISPENSER, 1).setName("&cCoolDownEndRewards")) {
@Override
public void onClick(ClickEvent clickEvent) {
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(), plugin.getRewardHandler()
.getDirectlyDefined("VoteSites." + voteSite.getKey() + ".CoolDownEndRewards"));
}
});
}
inv.openInventory(player);
}
}
@@ -1,138 +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("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;
@@ -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));
@@ -64,7 +64,7 @@ public class AdminVoteHelp extends GUIHandler {
ArrayList<TextComponent> msg = new ArrayList<TextComponent>();
HashMap<String, TextComponent> unsorted = new HashMap<String, TextComponent>();
boolean requirePerms = plugin.getConfigFile().getFormatCommandsVoteHelpRequirePermission();
boolean requirePerms = plugin.getConfigFile().isFormatCommandsVoteHelpRequirePermission();
for (CommandHandler cmdHandle : plugin.getAdminVoteCommand()) {
if (!requirePerms || cmdHandle.hasPerm(sender)) {
@@ -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 {
@@ -108,9 +108,9 @@ 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) {
@@ -158,7 +158,7 @@ public class AdminVotePerms extends GUIHandler {
}
}
msg = ArrayUtils.getInstance().colorize(msg);
msg = ArrayUtils.colorize(msg);
int pagesize = plugin.getConfigFile().getFormatPageSize();
@@ -175,7 +175,7 @@ public class AdminVotePerms extends GUIHandler {
} else {
text.add("&cPlayer not online: " + player);
}
return ArrayUtils.getInstance().colorize(text);
return ArrayUtils.colorize(text);
}
@@ -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
@@ -11,6 +11,7 @@ import com.bencodez.advancedcore.api.bookgui.BookWrapper;
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.placeholder.NonPlayerPlaceHolder;
import com.bencodez.advancedcore.api.placeholder.PlaceHolder;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.user.VotingPluginUser;
@@ -37,14 +38,14 @@ public class AdminVotePlaceholders extends GUIHandler {
for (PlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getPlaceholders()) {
String msg = "";
String identifier = placeholder.getIdentifier();
String identifier = placeholder.getIdentifier().toLowerCase();
if (identifier.endsWith("_")) {
identifier += "#";
}
if (placeholder.hasDescription()) {
msg = "VotingPlugin_" + identifier + " - " + placeholder.getDescription();
msg = "votingplugin_" + identifier + " - " + placeholder.getDescription();
} else {
msg = "VotingPlugin_" + identifier + "";
msg = "votingplugin_" + identifier + "";
}
Layout layout = new Layout(new ArrayList<String>(Arrays.asList("[Json]")));
@@ -53,16 +54,16 @@ public class AdminVotePlaceholders extends GUIHandler {
book.addLayout(layout);
}
for (PlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getNonPlayerPlaceholders()) {
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getNonPlayerPlaceholders()) {
String msg = "";
String identifier = placeholder.getIdentifier();
String identifier = placeholder.getIdentifier().toLowerCase();
if (identifier.endsWith("_")) {
identifier += "#";
}
if (placeholder.hasDescription()) {
msg = "VotingPlugin_" + identifier + " - " + placeholder.getDescription();
msg = "votingplugin_" + identifier + " - " + placeholder.getDescription();
} else {
msg = "VotingPlugin_" + identifier + "";
msg = "votingplugin_" + identifier + "";
}
Layout layout = new Layout(new ArrayList<String>(Arrays.asList("[Json]")));
@@ -81,26 +82,26 @@ public class AdminVotePlaceholders extends GUIHandler {
ArrayList<String> msg = new ArrayList<String>();
msg.add("&cPlaceholders:");
for (PlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getPlaceholders()) {
String identifier = placeholder.getIdentifier();
String identifier = placeholder.getIdentifier().toLowerCase();
if (identifier.endsWith("_")) {
identifier += "#";
}
if (placeholder.hasDescription()) {
msg.add("VotingPlugin_" + identifier + " - " + placeholder.getDescription());
msg.add("votingplugin_" + identifier + " - " + placeholder.getDescription());
} else {
msg.add("VotingPlugin_" + identifier + "");
msg.add("votingplugin_" + identifier + "");
}
}
for (PlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getNonPlayerPlaceholders()) {
String identifier = placeholder.getIdentifier();
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getNonPlayerPlaceholders()) {
String identifier = placeholder.getIdentifier().toLowerCase();
if (identifier.endsWith("_")) {
identifier += "#";
}
if (placeholder.hasDescription()) {
msg.add("VotingPlugin_" + identifier + " - " + placeholder.getDescription());
msg.add("votingplugin_" + identifier + " - " + placeholder.getDescription());
} else {
msg.add("VotingPlugin_" + identifier + "");
msg.add("votingplugin_" + identifier + "");
}
}
@@ -11,9 +11,9 @@ import com.bencodez.advancedcore.api.bookgui.BookWrapper;
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.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;
@@ -39,11 +39,11 @@ public class AdminVotePlaceholdersPlayer extends GUIHandler {
BookWrapper book = new BookWrapper("Placeholders");
for (PlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getPlaceholders()) {
String identifier = placeholder.getIdentifier();
String identifier = placeholder.getIdentifier().toLowerCase();
if (identifier.endsWith("_")) {
identifier += "1";
}
String value = placeholder.placeholderRequest(user.getOfflinePlayer(), user, identifier);
String value = placeholder.placeholderRequest(user, identifier);
String msg = identifier + " = " + value;
Layout layout = new Layout(new ArrayList<String>(Arrays.asList("[Json]")));
layout.replaceTextComponent("[Json]", BookUtil.TextBuilder.of(msg).color(ChatColor.AQUA)
@@ -51,13 +51,13 @@ public class AdminVotePlaceholdersPlayer extends GUIHandler {
book.addLayout(layout);
}
for (PlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getNonPlayerPlaceholders()) {
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getNonPlayerPlaceholders()) {
String identifier = placeholder.getIdentifier();
String identifier = placeholder.getIdentifier().toLowerCase();
if (identifier.endsWith("_")) {
identifier += "1";
}
String value = placeholder.placeholderRequest(user.getOfflinePlayer(), user, identifier);
String value = placeholder.placeholderRequest(identifier);
String msg = identifier + " = " + value;
Layout layout = new Layout(new ArrayList<String>(Arrays.asList("[Json]")));
@@ -74,25 +74,23 @@ public class AdminVotePlaceholdersPlayer extends GUIHandler {
msg.add("&cPlaceholders:");
VotingPluginUser placeholderUser = user;
if (plugin.getConfigFile().isUsePrimaryAccountForPlaceholders() && user.hasPrimaryAccount()) {
placeholderUser = UserManager.getInstance().getVotingPluginUser(user.getPrimaryAccount());
placeholderUser = plugin.getVotingPluginUserManager().getVotingPluginUser(user.getPrimaryAccount());
}
for (PlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getPlaceholders()) {
String identifier = placeholder.getIdentifier();
String identifier = placeholder.getIdentifier().toLowerCase();
if (identifier.endsWith("_")) {
identifier += "1";
}
msg.add("VotingPlugin_" + identifier + " = "
+ placeholder.placeholderRequest(user.getOfflinePlayer(), placeholderUser, identifier));
msg.add("votingplugin_" + identifier + " = " + placeholder.placeholderRequest(placeholderUser, identifier));
}
for (PlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getNonPlayerPlaceholders()) {
String identifier = placeholder.getIdentifier();
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getNonPlayerPlaceholders()) {
String identifier = placeholder.getIdentifier().toLowerCase();
if (identifier.endsWith("_")) {
identifier += "1";
}
msg.add("VotingPlugin_" + identifier + " = "
+ placeholder.placeholderRequest(user.getOfflinePlayer(), placeholderUser, identifier));
msg.add("votingplugin_" + identifier + " = " + placeholder.placeholderRequest(identifier));
}
sendMessage(msg);
}
@@ -17,7 +17,6 @@ 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.rewards.RewardHandler;
import com.bencodez.advancedcore.api.valuerequest.ValueRequestBuilder;
import com.bencodez.advancedcore.api.valuerequest.listeners.NumberListener;
import com.bencodez.advancedcore.command.gui.RewardEditGUI;
@@ -53,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) {
@@ -71,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) {
@@ -93,7 +92,7 @@ public class AdminVoteVoteParty extends GUIHandler {
}, new Number[] { 0, 10, 50, 100 })
.currentValue("" + plugin.getServerData().getVotePartyExtraRequired()).allowCustomOption(true)
.request(clickEvent.getPlayer());
;
}
});
@@ -107,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) {
@@ -125,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) {
@@ -134,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) {
@@ -143,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) {
@@ -152,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) {
@@ -170,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) {
@@ -179,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) {
@@ -197,7 +196,7 @@ public class AdminVoteVoteParty extends GUIHandler {
}));
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1),
new EditGUIValueList("Commands", plugin.getSpecialRewardsConfig().getVotePartyCommands()) {
new EditGUIValueList("Commands", plugin.getSpecialRewardsConfig().getVotePartyGlobalCommands()) {
@Override
public void setValue(Player player, ArrayList<String> value) {
@@ -212,7 +211,7 @@ public class AdminVoteVoteParty extends GUIHandler {
@Override
public void onClick(ClickEvent clickEvent) {
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
RewardHandler.getInstance().getDirectlyDefined("VoteParty.Rewards"));
plugin.getRewardHandler().getDirectlyDefined("VoteParty.Rewards"));
}
});
@@ -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,13 +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.rewards.RewardHandler;
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 {
@@ -55,7 +54,7 @@ public class AdminVoteCumulative extends GUIHandler {
public void onClick(ClickEvent clickEvent) {
ArrayList<Integer> nums = new ArrayList<Integer>();
for (String num : plugin.getSpecialRewardsConfig().getCumulativeVotes()) {
if (StringParser.getInstance().isInt(num)) {
if (MessageAPI.isInt(num)) {
nums.add(Integer.parseInt(num));
}
}
@@ -68,12 +67,12 @@ public class AdminVoteCumulative extends GUIHandler {
@Override
public void onInput(Player player, Number value) {
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
RewardHandler.getInstance()
plugin.getRewardHandler()
.getDirectlyDefined("Cumulative." + value.intValue() + ".Rewards"));
}
}, options).allowCustomOption(false).usingMethod(InputMethod.INVENTORY)
.request(clickEvent.getPlayer());
;
}
});
@@ -62,7 +62,7 @@ public class AdminVoteCumulativeRemove extends GUIHandler {
new AdminVoteCumulative(plugin, p);
}
}.open();
;
}
});
@@ -62,7 +62,7 @@ public class AdminVoteMilestoneRemove extends GUIHandler {
new AdminVoteMilestones(plugin, p);
}
}.open();
;
}
});
@@ -12,13 +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.rewards.RewardHandler;
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 {
@@ -55,7 +54,7 @@ public class AdminVoteMilestones extends GUIHandler {
public void onClick(ClickEvent clickEvent) {
ArrayList<Integer> nums = new ArrayList<Integer>();
for (String num : plugin.getSpecialRewardsConfig().getMilestoneVotes()) {
if (StringParser.getInstance().isInt(num)) {
if (MessageAPI.isInt(num)) {
nums.add(Integer.parseInt(num));
}
}
@@ -68,12 +67,12 @@ public class AdminVoteMilestones extends GUIHandler {
@Override
public void onInput(Player player, Number value) {
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
RewardHandler.getInstance()
plugin.getRewardHandler()
.getDirectlyDefined("MileStones." + value.intValue() + ".Rewards"));
}
}, options).allowCustomOption(false).usingMethod(InputMethod.INVENTORY)
.request(clickEvent.getPlayer());
;
}
});
@@ -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;
@@ -17,7 +19,6 @@ 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.rewards.RewardHandler;
import com.bencodez.advancedcore.command.gui.RewardEditGUI;
import com.bencodez.votingplugin.VotingPluginMain;
@@ -86,7 +87,7 @@ public class AdminVoteVoteShopItem extends GUIHandler {
// display item
ConfigurationSection displayItemData = plugin.getGui().getChestShopIdentifierSection(identifier);
inv.addButton(new EditGUIButton(new ItemBuilder(Material.valueOf(displayItemData.getString("Material")), 1),
inv.addButton(new EditGUIButton(new ItemBuilder(displayItemData.getString("Material")).setAmount(1),
new EditGUIValueString("Material", displayItemData.getString("Material")) {
@Override
@@ -110,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(),
RewardHandler.getInstance().getDirectlyDefined("CHEST.Shop." + identifier + ".Rewards"));
plugin.getRewardHandler().getDirectlyDefined("CHEST.Shop." + identifier + ".Rewards"));
}
});
@@ -64,7 +64,7 @@ public class AdminVoteVoteShopItemRemove extends GUIHandler {
new AdminVoteVoteShop(plugin, p).open();
}
}.open();
;
}
}.addData("ident", identifier));
@@ -49,7 +49,7 @@ public class AdminVoteVoteShopItems extends GUIHandler {
public void onClick(ClickEvent clickEvent) {
new AdminVoteVoteShopItem(plugin, clickEvent.getPlayer(), (String) getData("ident"))
.open(GUIMethod.CHEST);
;
}
}.addData("ident", identifier));
}
@@ -12,7 +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;
@@ -40,9 +42,9 @@ public class VoteBest 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
@@ -87,6 +89,26 @@ public class VoteBest extends GUIHandler {
}
});
if (plugin.getGui().isChestVoteBestBackButton()) {
inv.addButton(plugin.getCommandLoader().getBackButton(user));
}
String guiPath = "VoteBest";
for (final String str : plugin.getGui().getChestGUIExtraItems(guiPath)) {
inv.addButton(
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIExtraItemsItem(guiPath, str))) {
@Override
public void onClick(ClickEvent clickEvent) {
new RewardBuilder(plugin.getGui().getData(),
"CHEST." + guiPath + ".ExtraItems." + str + "."
+ clickEvent.getButton().getLastRewardsPath(player))
.setGiveOffline(false).send(clickEvent.getPlayer());
}
});
}
inv.openInventory(player);
}
@@ -9,14 +9,14 @@ 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.inventory.UpdatingBInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.advancedcore.api.rewards.RewardHandler;
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.topvoter.TopVoter;
import com.bencodez.votingplugin.user.UserManager;
import com.bencodez.votingplugin.user.VotingPluginUser;
public class VoteGUI extends GUIHandler {
@@ -39,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 (slot.equalsIgnoreCase("url")) {
if (MessageAPI.startsWithIgnoreCase(slot, "url")) {
lore = new String[] { "&aClick me" };
} else if (slot.equalsIgnoreCase("next")) {
lore = ArrayUtils.getInstance().convert(new VoteNext(plugin, player, user).getChat(player));
} else if (slot.equalsIgnoreCase("last")) {
lore = ArrayUtils.getInstance().convert(new VoteLast(plugin, player, user).getChat(player));
} else if (slot.equalsIgnoreCase("total")) {
lore = ArrayUtils.getInstance().convert(new VoteTotal(plugin, player, user).getChat(player));
} else if (slot.equalsIgnoreCase("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);
@@ -70,12 +70,12 @@ public class VoteGUI extends GUIHandler {
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;
}
@@ -121,21 +121,28 @@ 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()) {
inv.dontClose();
}
if (player.getUniqueId().toString().equals(user.getUUID())) {
inv.requirePermission("VotingPlugin.Commands.Vote.GUI");
} else {
inv.requirePermission("VotingPlugin.Commands.Vote.GUI.Other");
}
inv.addPlaceholder("points", "" + user.getPoints());
inv.addPlaceholder("player", user.getPlayerName());
inv.addPlaceholder("top", plugin.getConfigFile().getVoteTopDefault());
inv.addPlaceholder("sitesavailable", "" + user.getSitesNotVotedOn());
for (String slot : plugin.getGui().getChestVoteGUISlots()) {
for (final String slot : plugin.getGui().getChestVoteGUISlots()) {
ItemBuilder builder = getItemSlot(slot, player);
inv.addButton(new UpdatingBInventoryButton(builder, 1000, 1000) {
inv.addButton(new UpdatingBInventoryButton(plugin, builder, 1000, 1000) {
@Override
public void onClick(ClickEvent event) {
@@ -153,31 +160,21 @@ public class VoteGUI extends GUIHandler {
}
});
} else {
if (slot.equalsIgnoreCase("url")) {
new VoteURL(plugin, player, user, true).open();
} else if (slot.equalsIgnoreCase("next")) {
new VoteNext(plugin, player, user).open(GUIMethod.CHEST);
} else if (slot.equalsIgnoreCase("last")) {
new VoteLast(plugin, player, user).open(GUIMethod.CHEST);
} else if (slot.equalsIgnoreCase("total")) {
new VoteTotal(plugin, player, user).open(GUIMethod.CHEST);
} else if (slot.equalsIgnoreCase("top")) {
new VoteTopVoter(plugin, player, user, TopVoter.getDefault(), 1).open(GUIMethod.CHEST);
} else if (slot.equalsIgnoreCase("today")) {
new VoteToday(plugin, player, user, 1).open(GUIMethod.CHEST);
} else if (slot.equalsIgnoreCase("help")) {
player.performCommand("vote help");
} else if (slot.equalsIgnoreCase("shop")) {
new VoteShop(plugin, player, user).open(GUIMethod.CHEST);
} else if (slot.equalsIgnoreCase("lastmonth")) {
new VoteTopVoterLastMonth(plugin, player, user).open(GUIMethod.CHEST);
}
plugin.getCommandLoader().processSlotClick(player, user, slot);
}
String prefix = "";
if (event.getButton().getBuilder().isConditional()) {
prefix = "Item.";
}
if (RewardHandler.getInstance().hasRewards(plugin.getGui().getData(),
plugin.getGui().getChestVoteGUISlotRewardsPath(slot))) {
RewardHandler.getInstance().giveReward(UserManager.getInstance().getVotingPluginUser(player),
plugin.getGui().getData(), plugin.getGui().getChestVoteGUISlotRewardsPath(slot),
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,
prefix + event.getButton().getLastRewardsPath(player)),
new RewardOptions().addPlaceholder("identifier", slot));
}
}
@@ -185,16 +182,33 @@ 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());
item.addPlaceholder("sitesavailable", "" + user.getSitesNotVotedOn());
return item;
}
});
}
String guiPath = "VoteGUI";
for (final String str : plugin.getGui().getChestGUIExtraItems(guiPath)) {
inv.addButton(
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIExtraItemsItem(guiPath, str))) {
@Override
public void onClick(ClickEvent clickEvent) {
new RewardBuilder(plugin.getGui().getData(),
"CHEST." + guiPath + ".ExtraItems." + str + "."
+ clickEvent.getButton().getLastRewardsPath(player))
.setGiveOffline(false).send(clickEvent.getPlayer());
}
});
}
inv.openInventory(player);
}
@@ -10,7 +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.simpleapi.messages.MessageAPI;
import com.bencodez.simpleapi.nms.NMSManager;
import com.bencodez.votingplugin.VotingPluginMain;
import net.md_5.bungee.api.ChatColor;
@@ -36,7 +37,7 @@ public class VoteHelp extends GUIHandler {
ArrayList<TextComponent> msg = new ArrayList<TextComponent>();
HashMap<String, TextComponent> unsorted = new HashMap<String, TextComponent>();
boolean requirePerms = plugin.getConfigFile().getFormatCommandsVoteHelpRequirePermission();
boolean requirePerms = plugin.getConfigFile().isFormatCommandsVoteHelpRequirePermission();
String colorStr = plugin.getConfigFile().getFormatCommandsVoteHelpHoverColor();
ChatColor hoverColor = null;
@@ -63,6 +64,28 @@ public class VoteHelp extends GUIHandler {
return msg;
}
public ArrayList<TextComponent> helpTextLegacy(CommandSender sender) {
ArrayList<TextComponent> msg = new ArrayList<TextComponent>();
HashMap<String, TextComponent> unsorted = new HashMap<String, TextComponent>();
boolean requirePerms = plugin.getConfigFile().isFormatCommandsVoteHelpRequirePermission();
for (CommandHandler cmdHandle : plugin.getVoteCommand()) {
if (!requirePerms || cmdHandle.hasPerm(sender)) {
unsorted.put(cmdHandle.getHelpLineCommand("/vote"),
cmdHandle.getHelpLine("/vote", plugin.getConfigFile().getFormatCommandsVoteHelpLine()));
}
}
ArrayList<String> unsortedList = new ArrayList<String>();
unsortedList.addAll(unsorted.keySet());
Collections.sort(unsortedList, String.CASE_INSENSITIVE_ORDER);
for (String cmd : unsortedList) {
msg.add(unsorted.get(cmd));
}
return msg;
}
@Override
public void onBook(Player player) {
@@ -86,14 +109,19 @@ 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 = helpText(sender);
ArrayList<TextComponent> text = new ArrayList<TextComponent>();
if (NMSManager.getInstance().isVersion("1.12")) {
text = helpTextLegacy(sender);
} else {
text = helpText(sender);
}
int maxPage = text.size() / pagesize;
if ((text.size() % pagesize) != 0) {
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++) {
@@ -9,10 +9,13 @@ 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.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.VotingPluginUser;
@@ -34,16 +37,16 @@ public class VoteLast extends GUIHandler {
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
@@ -60,15 +63,32 @@ 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(site.getItem().setName(site.getDisplayName())
new UpdatingBInventoryButton(plugin, site.getItem().setName(site.getDisplayName())
.setLore(user.voteCommandLastGUILine(site)).setAmountNone(1), 1000, 1000) {
@Override
public void onClick(ClickEvent clickEvent) {
public void onClick(ClickEvent event) {
if (plugin.getGui().isChestVoteLastClickableLinks()) {
Player player = event.getPlayer();
if (player != null) {
VotingPluginUser user = plugin.getVotingPluginUserManager()
.getVotingPluginUser(player);
user.sendMessage(
PlaceholderUtils
.replacePlaceHolder(
PlaceholderUtils.replacePlaceHolder(
PlaceholderUtils
.replacePlaceHolder(plugin.getGui()
.getChestVoteURLURLText(),
"voteurl", site.getVoteURL()),
"sitename", site.getDisplayName()),
"player", player.getName()));
}
}
}
@Override
@@ -80,7 +100,23 @@ public class VoteLast extends GUIHandler {
}
}
if (plugin.getGui().getChestVoteLastBackButton()) {
String guiPath = "VoteLast";
for (final String str : plugin.getGui().getChestGUIExtraItems(guiPath)) {
inv.addButton(
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIExtraItemsItem(guiPath, str))) {
@Override
public void onClick(ClickEvent clickEvent) {
new RewardBuilder(plugin.getGui().getData(),
"CHEST." + guiPath + ".ExtraItems." + str + "."
+ clickEvent.getButton().getLastRewardsPath(player))
.setGiveOffline(false).send(clickEvent.getPlayer());
}
});
}
if (plugin.getGui().isChestVoteLastBackButton()) {
inv.addButton(plugin.getCommandLoader().getBackButton(user));
}
@@ -12,9 +12,12 @@ 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.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;
@@ -38,19 +41,17 @@ public class VoteNext extends GUIHandler {
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;
@@ -61,7 +62,7 @@ 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]")));
nextLayout.replaceTextComponent("[Json]",
@@ -85,11 +86,17 @@ 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(site.getItem().setName(site.getDisplayName())
.setLore(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) {
@@ -106,7 +113,23 @@ public class VoteNext extends GUIHandler {
}
}
if (plugin.getGui().getChestVoteNextBackButton()) {
String guiPath = "VoteNext";
for (final String str : plugin.getGui().getChestGUIExtraItems(guiPath)) {
inv.addButton(
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIExtraItemsItem(guiPath, str))) {
@Override
public void onClick(ClickEvent clickEvent) {
new RewardBuilder(plugin.getGui().getData(),
"CHEST." + guiPath + ".ExtraItems." + str + "."
+ clickEvent.getButton().getLastRewardsPath(player))
.setGiveOffline(false).send(clickEvent.getPlayer());
}
});
}
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.rewards.RewardHandler;
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,12 +46,21 @@ 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.getGui().isChestVoteShopEnabled()) {
player.sendMessage(MessageAPI.colorize(plugin.getGui().getChestVoteShopDisabled()));
return;
}
if (this.user == null) {
user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
}
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
/*
* if (!plugin.getConfigFile().isExtraVoteShopCheck()) { user.cacheAsync(); }
*/
BInventory inv = new BInventory(plugin.getGui().getChestVoteShopName());
inv.addPlaceholder("points", "" + user.getPoints());
inv.addPlaceholder("sitesavailable", "" + user.getSitesNotVotedOn());
inv.dontClose();
for (final String identifier : plugin.getGui().getChestShopIdentifiers()) {
@@ -61,21 +70,25 @@ public class VoteShop extends GUIHandler {
if (perm.isEmpty()) {
hasPerm = true;
} else {
hasPerm = player.hasPermission(perm);
if (perm.startsWith("!")) {
hasPerm = !player.hasPermission(perm.substring(1));
} else {
hasPerm = player.hasPermission(perm);
}
}
int limit = plugin.getGui().getChestShopIdentifierLimit(identifier);
boolean limitPass = true;
if (limit > 0) {
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
if (user.getVoteShopIdentifierLimit(identifier) >= limit) {
limitPass = false;
}
}
if (!plugin.getGui().getChestVoteShopNotBuyable(identifier)) {
if (hasPerm && (limitPass || !plugin.getGui().isChestVoteShopHideLimitedReached())) {
if ((hasPerm || !plugin.getGui().getChestVoteShopHideOnNoPermission(identifier))
&& (limitPass || !plugin.getGui().isChestVoteShopHideLimitedReached())) {
ItemBuilder builder = new ItemBuilder(plugin.getGui().getChestShopIdentifierSection(identifier));
inv.addButton(new BInventoryButton(builder) {
@@ -84,16 +97,18 @@ public class VoteShop extends GUIHandler {
public void onClick(ClickEvent event) {
Player player = event.getWhoClicked();
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
user.clearCache();
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);
if (identifier != null) {
if (plugin.getGui().getChestVoteShopCloseGUI(identifier)) {
event.getButton().getInv().closeInv(player, null);
}
// if (plugin.getGui().getChestVoteShopCloseGUI(identifier)) {
// event.closeInventory();
// }
// limit fail-safe, should never be needed, except in rare cases
boolean limitPass = true;
@@ -110,15 +125,18 @@ public class VoteShop extends GUIHandler {
plugin.getGui().getChestShopIdentifierIdentifierName(identifier));
placeholders.put("points", "" + points);
placeholders.put("limit", "" + limit);
if (user.removePoints(points)) {
if (user.removePoints(points, true)) {
plugin.getLogger().info("VoteShop: " + user.getPlayerName() + "/"
+ user.getUUID() + " bought " + identifier + " for " + points);
if (plugin.getConfigFile().isTrackShopPurchases()) {
plugin.getServerData().addVoteShopPurchase(identifier);
}
RewardHandler.getInstance().giveReward(user, plugin.getGui().getData(),
plugin.getRewardHandler().giveReward(user, plugin.getGui().getData(),
plugin.getGui().getChestShopIdentifierRewardsPath(identifier),
new RewardOptions().setPlaceholders(placeholders));
user.sendMessage(StringParser.getInstance().replacePlaceHolder(
user.sendMessage(PlaceholderUtils.replacePlaceHolder(
plugin.getGui().getCHESTVoteShopPurchase(identifier),
placeholders));
if (limit > 0) {
@@ -126,16 +144,27 @@ public class VoteShop extends GUIHandler {
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());
}
plugin.getCommandLoader().processSlotClick(player, user, identifier);
if (plugin.getGui().isChestVoteShopReopenGUIOnPurchase()) {
plugin.getCommandLoader().processSlotClick(player, user, "shop");
}
}
}
@@ -148,15 +177,28 @@ public class VoteShop extends GUIHandler {
@Override
public void onClick(ClickEvent event) {
user.sendMessage(plugin.getConfigFile().getFormatShopNotPurchasable());
}
}.dontClose().addData("identifier", identifier).addData("Limit", limit));
}.addData("identifier", identifier).addData("Limit", limit));
}
}
}
if (plugin.getGui().getChestVoteShopBackButton()) {
for (final String str : plugin.getGui().getChestGUIVoteShopExtraItems()) {
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIVoteShopExtraItems(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))
.setGiveOffline(false).send(clickEvent.getPlayer());
}
});
}
if (plugin.getGui().isChestVoteShopBackButton()) {
inv.addButton(plugin.getCommandLoader().getBackButton(user));
}
@@ -12,10 +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.rewards.RewardHandler;
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;
@@ -47,35 +46,38 @@ public class VoteShopConfirm extends GUIHandler {
@Override
public void onChest(Player player) {
PlayerUtils.getInstance().setPlayerMeta(player, "ident", identifier);
PlayerUtils.setPlayerMeta(plugin, player, "ident", identifier);
BInventory inv = new BInventory(plugin.getGui().getChestShopConfirmPurchaseTitle());
inv.dontClose();
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestShopConfirmPurchaseYesItem())) {
@Override
public void onClick(ClickEvent event) {
user.clearCache();
user.cache();
int points = plugin.getGui().getChestShopIdentifierCost(identifier);
int limit = plugin.getGui().getChestShopIdentifierLimit(identifier);
HashMap<String, String> placeholders = new HashMap<String, String>();
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);
}
RewardHandler.getInstance().giveReward(user, plugin.getGui().getData(),
plugin.getRewardHandler().giveReward(user, plugin.getGui().getData(),
plugin.getGui().getChestShopIdentifierRewardsPath(identifier),
new RewardOptions().setPlaceholders(placeholders));
user.sendMessage(StringParser.getInstance()
user.sendMessage(PlaceholderUtils
.replacePlaceHolder(plugin.getGui().getCHESTVoteShopPurchase(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)) {
@@ -93,7 +95,7 @@ public class VoteShopConfirm extends GUIHandler {
if (plugin.getGui().getChestVoteShopCloseGUI(identifier)) {
event.getButton().getInv().closeInv(player, null);
} else {
new VoteShop(plugin, event.getPlayer(), user);
new VoteShop(plugin, event.getPlayer(), user).open();
}
}
});
@@ -12,7 +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;
@@ -45,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
@@ -119,7 +121,23 @@ public class VoteStreak extends GUIHandler {
}
});
if (plugin.getGui().getChestVoteStreakBackButton()) {
String guiPath = "VoteStreak";
for (final String str : plugin.getGui().getChestGUIExtraItems(guiPath)) {
inv.addButton(
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIExtraItemsItem(guiPath, str))) {
@Override
public void onClick(ClickEvent clickEvent) {
new RewardBuilder(plugin.getGui().getData(),
"CHEST." + guiPath + ".ExtraItems." + str + "."
+ clickEvent.getButton().getLastRewardsPath(player))
.setGiveOffline(false).send(clickEvent.getPlayer());
}
});
}
if (plugin.getGui().isChestVoteStreakBackButton()) {
inv.addButton(plugin.getCommandLoader().getBackButton(user));
}
@@ -16,13 +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.nms.NMSManager;
import com.bencodez.advancedcore.api.messages.PlaceholderUtils;
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
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 {
@@ -66,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
@@ -94,14 +94,14 @@ public class VoteToday extends GUIHandler {
HashMap<String, String> placeholders = new HashMap<String, String>();
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(),
item.setName(PlaceholderUtils.replacePlaceHolder(plugin.getGui().getChestVoteTodayIconTitle(),
"player", user.getPlayerName()));
item.setLore(msg);
final UUID uuid = user.getUuid();
@@ -109,20 +109,31 @@ public class VoteToday extends GUIHandler {
@Override
public void onClick(ClickEvent clickEvent) {
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(uuid);
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(uuid);
new VoteGUI(plugin, player, user)
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodGUI().toUpperCase()));
}
});
}
}
String guiPath = "VoteToday";
for (final String str : plugin.getGui().getChestGUIExtraItems(guiPath)) {
inv.addButton(
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIExtraItemsItem(guiPath, str))) {
@Override
public void onClick(ClickEvent clickEvent) {
new RewardBuilder(plugin.getGui().getData(),
"CHEST." + guiPath + ".ExtraItems." + str + "." + clickEvent.getButton().getLastRewardsPath(player))
.setGiveOffline(false).send(clickEvent.getPlayer());
if (plugin.getGui().getChestVoteTodayBackButton()) {
inv.addButton(plugin.getCommandLoader().getBackButton(user));
}
inv.openInventory(player);
}
});}
if(plugin.getGui().isChestVoteTodayBackButton()){inv.addButton(plugin.getCommandLoader().getBackButton(user));}inv.openInventory(player);}
@Override
public void open() {
open(GUIMethod.valueOf(plugin.getGui().getGuiMethodToday().toUpperCase()));
@@ -139,14 +150,14 @@ public class VoteToday extends GUIHandler {
placeholders.put("player", user.getPlayerName());
placeholders.put("votesite", voteSite.getKey());
placeholders.put("time", timeString);
msg.add(StringParser.getInstance()
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() {
@@ -168,12 +179,12 @@ public class VoteToday extends GUIHandler {
placeholders.put("player", user.getPlayerName());
placeholders.put("votesite", mostRecentSite.getKey());
placeholders.put("time", timeString);
msg.add(StringParser.getInstance()
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);
}
}
@@ -2,11 +2,15 @@ package com.bencodez.votingplugin.commands.gui.player;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
@@ -16,7 +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;
@@ -41,13 +46,13 @@ 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;
}
@@ -78,6 +83,15 @@ public class VoteTopVoter extends GUIHandler {
.getTopVoter(top).clone();
users = topVotes.entrySet();
ConfigurationSection customization = plugin.getGui().getChestVoteTopCustomization();
boolean customzationEnabled = false;
Queue<Integer> playerSlots = new ConcurrentLinkedQueue<Integer>();
if (customization != null) {
customzationEnabled = customization.getBoolean("Enabled");
List<Integer> customizationPlayerSlots = customization.getIntegerList("PlayerSlots");
playerSlots.addAll(customizationPlayerSlots);
}
BInventory inv = new BInventory(plugin.getGui().getChestVoteTopName());
inv.addPlaceholder("topvoter", topVoter);
if (!plugin.getConfigFile().isAlwaysCloseInventory()) {
@@ -86,7 +100,8 @@ public class VoteTopVoter extends GUIHandler {
int pos = 1;
for (Entry<TopVoterPlayer, Integer> entry : users) {
ItemBuilder playerItem;
ItemBuilder playerItem = new ItemBuilder(Material.PAPER);
if (plugin.getGui().isChestVoteTopUseSkull()) {
playerItem = new ItemBuilder(entry.getKey().getPlayerHead());
@@ -96,44 +111,97 @@ public class VoteTopVoter extends GUIHandler {
playerItem.setLore(new ArrayList<String>());
inv.addButton(new BInventoryButton(playerItem.setName(plugin.getGui().getChestVoteTopItemName())
BInventoryButton button = 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) {
if (plugin.getGui().getChestVoteTopOpenMainGUIOnClick()) {
VotingPluginUser user = (VotingPluginUser) getData("User");
new VoteGUI(plugin, player, user)
if (plugin.getGui().isChestVoteTopOpenMainGUIOnClick()) {
TopVoterPlayer user = (TopVoterPlayer) getData("User");
new VoteGUI(plugin, player, user.getUser())
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodGUI().toUpperCase()));
} else {
getInv().forceClose(clickEvent.getPlayer());
}
}
}.addData("player", entry.getKey().getPlayerName()).addData("User", entry.getKey()));
}.addData("player", entry.getKey().getPlayerName()).addData("User", entry.getKey());
if (customzationEnabled && !playerSlots.isEmpty()) {
button.setSlot(playerSlots.remove());
}
inv.setCloseInv(plugin.getGui().isChestVoteTopCloseGUIOnClick());
inv.addButton(button);
pos++;
}
final TopVoter cur = top;
inv.getPageButtons().add(new BInventoryButton(
new ItemBuilder(plugin.getGui().getChestVoteTopSwitchItem()).addPlaceholder("Top", topVoter)) {
@Override
public void onClick(ClickEvent clickEvent) {
if (!clickEvent.getClick().equals(ClickType.RIGHT)) {
new VoteTopVoter(plugin, player, user, cur.next(), 0).open(GUIMethod.CHEST);
} else {
new VoteTopVoter(plugin, player, user, cur.prev(), 0).open(GUIMethod.CHEST);
}
TopVoter newTops = top;
ArrayList<String> tops = plugin.getGui().getChestVoteTopSwitchItemTopVoters();
if (!tops.isEmpty()) {
for (String name : tops) {
newTops.getSwitchItems().add(TopVoter.getTopVoter(name));
}
});
if (plugin.getGui().getChestVoteTopBackButton()) {
inv.getPageButtons().add(plugin.getCommandLoader().getBackButton(user).setSlot(1));
}
inv.setPages(true);
final TopVoter cur = newTops;
if (!customzationEnabled) {
inv.getPageButtons().add(new BInventoryButton(
new ItemBuilder(plugin.getGui().getChestVoteTopSwitchItem()).addPlaceholder("Top", topVoter)) {
@Override
public void onClick(ClickEvent clickEvent) {
if (!clickEvent.getClick().equals(ClickType.RIGHT)) {
new VoteTopVoter(plugin, player, user, cur.next(), 0).open(GUIMethod.CHEST);
} else {
new VoteTopVoter(plugin, player, user, cur.prev(), 0).open(GUIMethod.CHEST);
}
}
});
} else {
inv.addButton(new BInventoryButton(
new ItemBuilder(plugin.getGui().getChestVoteTopSwitchItem()).addPlaceholder("Top", topVoter)) {
@Override
public void onClick(ClickEvent clickEvent) {
if (!clickEvent.getClick().equals(ClickType.RIGHT)) {
new VoteTopVoter(plugin, player, user, cur.next(), 0).open(GUIMethod.CHEST);
} else {
new VoteTopVoter(plugin, player, user, cur.prev(), 0).open(GUIMethod.CHEST);
}
}
});
}
if (plugin.getGui().isChestVoteTopBackButton()) {
if (customzationEnabled) {
inv.addButton(plugin.getCommandLoader().getBackButton(user)
.setSlot(customization.getInt("BackButtonSlot", 0)));
} else {
inv.getPageButtons().add(plugin.getCommandLoader().getBackButton(user).setSlot(1));
}
}
String guiPath = "VoteTop.Customization";
for (final String str : plugin.getGui().getChestGUIExtraItems(guiPath)) {
inv.addButton(
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIExtraItemsItem(guiPath, str))) {
@Override
public void onClick(ClickEvent clickEvent) {
plugin.getCommandLoader().processSlotClick(player, user, str);
new RewardBuilder(plugin.getGui().getData(),
"CHEST." + guiPath + ".ExtraItems." + str + ".Rewards").setGiveOffline(false)
.send(clickEvent.getPlayer());
}
});
}
if (customization == null || !customzationEnabled || !customization.getBoolean("RemoveBottomBar")) {
inv.setPages(true);
}
inv.setMaxInvSize(plugin.getGui().getChestVoteTopSize());
inv.openInventory(player);
} catch (Exception e) {
@@ -74,15 +74,15 @@ public class VoteTopVoterLastMonth extends GUIHandler {
@Override
public void onClick(ClickEvent clickEvent) {
VotingPluginUser user = (VotingPluginUser) getData("User");
new VoteGUI(plugin, player, user)
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++;
}
if (plugin.getGui().getChestVoteTopBackButton()) {
if (plugin.getGui().isChestVoteTopBackButton()) {
inv.getPageButtons().add(plugin.getCommandLoader().getBackButton(user).setSlot(1));
}
@@ -9,10 +9,12 @@ 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.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;
@@ -38,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
@@ -65,7 +67,7 @@ public class VoteTotal extends GUIHandler {
inv.addPlaceholder("player", user.getPlayerName());
for (final TopVoter top : TopVoter.values()) {
inv.addButton(new UpdatingBInventoryButton(
inv.addButton(new UpdatingBInventoryButton(plugin,
new ItemBuilder(plugin.getGui().getChestVoteTotalItem(top))
.addPlaceholder("Total", "" + user.getTotal(top)).addPlaceholder("topvoter", top.getName()),
1000, 1000) {
@@ -84,7 +86,23 @@ public class VoteTotal extends GUIHandler {
});
}
if (plugin.getGui().getChestVoteTotalBackButton()) {
String guiPath = "VoteTotal";
for (final String str : plugin.getGui().getChestGUIExtraItems(guiPath)) {
inv.addButton(
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIExtraItemsItem(guiPath, str))) {
@Override
public void onClick(ClickEvent clickEvent) {
new RewardBuilder(plugin.getGui().getData(),
"CHEST." + guiPath + ".ExtraItems." + str + "."
+ clickEvent.getButton().getLastRewardsPath(player))
.setGiveOffline(false).send(clickEvent.getPlayer());
}
});
}
if (plugin.getGui().isChestVoteTotalBackButton()) {
inv.addButton(plugin.getCommandLoader().getBackButton(user));
}
inv.openInventory(player);
@@ -18,13 +18,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,11 +40,11 @@ public class VoteURL extends GUIHandler {
this.user = user;
this.json = json;
if (user == null && player instanceof Player) {
this.user = UserManager.getInstance().getVotingPluginUser((Player) player);
this.user = plugin.getVotingPluginUserManager().getVotingPluginUser((Player) player);
}
if (player != null && user != null && player.getName().equals(user.getPlayerName())) {
if (plugin.getConfigFile().isUsePrimaryAccountForPlaceholders() && user.hasPrimaryAccount()) {
user = UserManager.getInstance().getVotingPluginUser(user.getPrimaryAccount());
user = plugin.getVotingPluginUserManager().getVotingPluginUser(user.getPrimaryAccount());
}
}
}
@@ -58,9 +57,9 @@ public class VoteURL extends GUIHandler {
if (title != null) {
sites.addAll(title);
}
if (plugin.getConfigFile().getFormatCommandsVoteAutoInputSites()) {
if (plugin.getConfigFile().isFormatCommandsVoteAutoInputSites()) {
int counter = 0;
for (VoteSite voteSite : plugin.getVoteSites()) {
for (VoteSite voteSite : plugin.getVoteSitesEnabled()) {
if (!voteSite.isHidden()) {
counter++;
String voteURL = voteSite.getVoteURL(json);
@@ -82,10 +81,10 @@ public class VoteURL extends GUIHandler {
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 +117,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,7 +135,12 @@ public class VoteURL extends GUIHandler {
public void onBook(Player player) {
BookWrapper book = new BookWrapper(plugin.getGui().getBookVoteURLBookGUITitle());
for (VoteSite site : plugin.getVoteSites()) {
if (plugin.getGui().isBookVoteURLBookGUIManual()) {
Layout layout = new Layout(plugin.getGui().getBookVoteURLBookGUITopLayout());
book.addLayout(layout);
}
int i = 1;
for (VoteSite site : plugin.getVoteSitesEnabled()) {
Layout layout = new Layout(plugin.getGui().getBookVoteURLBookGUILayout()).addPlaceholder("sitename",
site.getDisplayName());
String text = plugin.getGui().getBookVoteURLBookGUIAlreadyVotedText();
@@ -142,12 +149,12 @@ public class VoteURL extends GUIHandler {
color = ChatColor.valueOf(plugin.getGui().getBookVoteURLBookGUICanVoteColor());
text = plugin.getGui().getBookVoteURLBookGUICanVoteText();
}
String url = StringParser.getInstance().replacePlaceHolder(site.getVoteURLJsonStrip(), "player",
user.getPlayerName());
String url = 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,14 +169,14 @@ public class VoteURL extends GUIHandler {
public void onChest(Player player) {
// normal GUI
BInventory inv = new BInventory(plugin.getGui().getChestVoteURLName());
if (plugin.getGui().getChestVoteURLViewAllUrlsButtonEnabled()) {
if (plugin.getGui().isChestVoteURLViewAllUrlsButtonEnabled()) {
ItemBuilder builderAll = getItemAll();
inv.addButton(new UpdatingBInventoryButton(builderAll, 5000, 5000) {
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));
}
@@ -182,7 +189,7 @@ 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) {
@@ -190,18 +197,21 @@ public class VoteURL extends GUIHandler {
startSlot++;
}
inv.addButton(new UpdatingBInventoryButton(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()));
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
HashMap<String, String> placeholders = new HashMap<String, String>();
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);
}
@@ -221,14 +231,15 @@ public class VoteURL extends GUIHandler {
@Override
public void onClick(ClickEvent clickEvent) {
new RewardBuilder(plugin.getGui().getData(), "CHEST.VoteURL.ExtraItems." + str + ".Rewards")
new RewardBuilder(plugin.getGui().getData(),
"CHEST.VoteURL.ExtraItems." + str + "." + clickEvent.getButton().getLastRewardsPath(player))
.setGiveOffline(false).send(clickEvent.getPlayer());
;
}
});
}
if (plugin.getGui().getChestVoteURLBackButton()) {
if (plugin.getGui().isChestVoteURLBackButton()) {
inv.addButton(plugin.getCommandLoader().getBackButton(user));
}
@@ -69,7 +69,7 @@ public class VoteURLVoteSite extends GUIHandler {
}
});
inv.addButton(new UpdatingBInventoryButton(
inv.addButton(new UpdatingBInventoryButton(plugin,
new ItemBuilder(Material.COMPASS).setName("&4Next Vote").addLoreLine(user.voteCommandNextInfo(site)),
1000, 1000) {
@@ -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;
/**
@@ -36,11 +36,11 @@ public class AdminVoteTabCompleter implements TabCompleter {
Set<String> cmds = new HashSet<String>();
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;
/**
@@ -45,7 +45,7 @@ public class AliasesTabCompleter implements TabCompleter {
msgArray.add(arg);
}
String[] args = ArrayUtils.getInstance().convert(msgArray);
String[] args = ArrayUtils.convert(msgArray);
ArrayList<String> tab = new ArrayList<String>();
@@ -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
@@ -37,11 +37,11 @@ public class VoteTabCompleter implements TabCompleter {
Set<String> cmds = new HashSet<String>();
cmds.addAll(TabCompleteHandler.getInstance().getTabCompleteOptions(plugin.getVoteCommand(), sender, args,
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);
}
}
@@ -1,12 +1,14 @@
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.ConfigDataString;
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;
@@ -29,6 +31,26 @@ 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 = "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 = "";
@@ -41,6 +63,14 @@ public class BungeeSettings extends YMLFile {
@Getter
private boolean perServerPoints = false;
@ConfigDataBoolean(path = "PerServerMilestones")
@Getter
private boolean perServerMilestones = false;
@ConfigDataBoolean(path = "GiveExtraAllSitesRewards")
@Getter
private boolean giveExtraAllSitesRewards = false;
@ConfigDataBoolean(path = "PerServerRewards")
@Getter
private boolean perServerRewards = false;
@@ -77,6 +107,18 @@ public class BungeeSettings extends YMLFile {
@Getter
private boolean disableBroadcast = false;
@ConfigDataBoolean(path = "GlobalData.UseMainMySQL")
@Getter
private boolean globlalDataUseMainMySQL = true;
@ConfigDataBoolean(path = "GlobalData.Enabled")
@Getter
private boolean globlalDataEnabled = false;
@ConfigDataListString(path = "BungeeVotePartyGlobalCommands")
@Getter
private ArrayList<String> bungeeVotePartyGlobalCommands = new ArrayList<String>();
public BungeeSettings(VotingPluginMain plugin) {
super(plugin, new File(plugin.getDataFolder(), "BungeeSettings.yml"));
}
@@ -7,14 +7,16 @@ 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.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;
import lombok.Getter;
@@ -33,6 +35,22 @@ public class Config extends YMLFile {
@Getter
private boolean addTotals = true;
@ConfigDataBoolean(path = "AddTotalsOffline")
@Getter
private boolean addTotalsOffline = true;
@ConfigDataBoolean(path = "PerSiteCoolDownEvents")
@Getter
private boolean perSiteCoolDownEvents = false;
@ConfigDataBoolean(path = "QueueVotesDuringTimeChange")
@Getter
private boolean queueVotesDuringTimeChange = false;
@ConfigDataBoolean(path = "AdvancedServiceSiteHandling")
@Getter
private boolean advancedServiceSiteHandling = false;
@ConfigDataBoolean(path = "AllowUnjoined")
@Getter
private boolean allowUnjoined = false;
@@ -57,14 +75,18 @@ 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;
@ConfigDataBoolean(path = "AlwaysWaitForCachePlaceholders")
@Getter
private boolean alwaysWaitForCachePlaceholders = false;
@ConfigDataBoolean(path = "AutoCreateVoteSites")
@Getter
private boolean autoCreateVoteSites = true;
@@ -81,10 +103,6 @@ public class Config extends YMLFile {
@Getter
private int delayBetweenUpdates = 3;
@ConfigDataInt(path = "DelayLoginEvent")
@Getter
private int delayLoginEvent = 0;
@ConfigDataBoolean(path = "DisableAdvancedTab")
@Getter
private boolean disableAdvancedTab = false;
@@ -101,6 +119,10 @@ public class Config extends YMLFile {
@Getter
private ArrayList<String> disabledDefaultPermissions = new ArrayList<String>();
@ConfigDataListString(path = "CachedPlaceholders")
@Getter
private ArrayList<String> cachedPlaceholders = new ArrayList<String>();
@ConfigDataBoolean(path = "DisableInteractEvent")
@Getter
private boolean disableInteractEvent = false;
@@ -117,6 +139,10 @@ public class Config extends YMLFile {
@Getter
private boolean extraAllSitesCheck = false;
@ConfigDataBoolean(path = "CloseInventoryOnVote")
@Getter
private boolean closeInventoryOnVote = true;
@ConfigDataBoolean(path = "ExtraBackgroundUpdate")
@Getter
private boolean extraBackgroundUpdate = false;
@@ -133,6 +159,14 @@ public class Config extends YMLFile {
@Getter
private boolean formatAlternateBroadcastEnabled = false;
@ConfigDataBoolean(path = "Format.OnlyOneOfflineBroadcast")
@Getter
private boolean formatOnlyOneOfflineBroadcast = false;
@ConfigDataString(path = "Format.OfflineBroadcast")
@Getter
private String formatOfflineBroadcast = "&6[&4Broadcast&6] &2Thanks &c%player% &2for voting on %numberofvotes% times!";
@ConfigDataBoolean(path = "Format.Commands.Vote.ForceLinks")
@Getter
private boolean formatCommandsVoteForceLinks = true;
@@ -141,6 +175,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;
@@ -149,6 +203,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;
@@ -159,7 +217,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")
@@ -170,6 +228,14 @@ public class Config extends YMLFile {
@Getter
private String formatCommandsVoteToggleBroadcastEnabled = "&cYou will now see vote broadcasts";
@ConfigDataString(path = "Format.Commands.Vote.ToggleReminders.Disabled")
@Getter
private String formatCommandsVoteToggleRemindersDisabled = "&cVote reminders disabled";
@ConfigDataString(path = "Format.Commands.Vote.ToggleReminders.Enabled")
@Getter
private String formatCommandsVoteToggleRemindersEnabled = "&cVote reminders enabled";
@Getter
private int formatPageSize = 10;
@@ -229,6 +295,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;
@@ -271,149 +345,101 @@ public class Config extends YMLFile {
return (ArrayList<String>) getData().getList("BlackList", new ArrayList<String>());
}
public Set<String> getCustomCommands() {
Set<String> str = getData().getConfigurationSection("CustomCommands").getKeys(false);
@ConfigDataKeys(path = "CustomCommands")
@Getter
private Set<String> customCommands = new HashSet<String>();
@ConfigDataKeys(path = "CustomPlaceholderReturns")
@Getter
private Set<String> customPlaceholderReturns = new HashSet<String>();
public Set<String> getCustomPlaceholderReturns(String placeholder) {
Set<String> str = getData().getConfigurationSection("CustomPlaceholderReturns." + placeholder).getKeys(false);
if (str == null) {
str = new HashSet<String>();
}
return str;
}
public String getCustomPlaceholderReturns(String placeholder, String returnString) {
return getData().getString("CustomPlaceholderReturns." + placeholder + "." + returnString, "");
}
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%");
@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;
@ConfigDataListString(path = "Format.Commands.Vote.Best.Lines")
@Getter
private ArrayList<String> formatCommandsVoteBestLines = new ArrayList<String>();
@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";
public PlaceholderCacheLevel getPlaceholderCacheLevel() {
return PlaceholderCacheLevel.getCache(getPlaceholderCacheLevelString());
}
/**
* Gets the broadcast when online.
*
* @return the broadcast when online
*/
public boolean getFormatBroadcastWhenOnline() {
return getData().getBoolean("Format.BroadcastWhenOnline");
}
@ConfigDataString(path = "Format.Commands.Vote.Next.Layout")
@Getter
private String formatCommandsVoteNextLayout = "&3%SiteName%: &6%info%";
/**
* 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");
}
/**
* 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:");
}
@ConfigDataString(path = "Format.Commands.Vote.Next.Title")
@Getter
private String formatCommandsVoteNextTitle = "&3&l%player% Next Votes:";
/**
* Gets the commands vote party.
@@ -433,9 +459,9 @@ public class Config extends YMLFile {
return (ArrayList<String>) getData().getList("Format.Commands.Vote.Streak.Lines", new ArrayList<String>());
}
public String getFormatCommandsVoteStreakTitle() {
return getData().getString("Format.Commands.Vote.Streak.Title", "&3&l%player% Vote Streak");
}
@ConfigDataString(path = "Format.Commands.Vote.Streak.Title")
@Getter
private String formatCommandsVoteStreakTitle = "&3&l%player% Vote Streak";
/**
* Gets the commands vote text.
@@ -478,167 +504,103 @@ public class Config extends YMLFile {
return list;
}
/**
* Gets the commands vote URLS.
*
* @return the commands vote URLS
*/
public String getFormatCommandsVoteURLS() {
return getData().getString("Format.Commands.Vote.Sites", "&4%num%: &c&l%SiteName% - &c%url%");
}
@ConfigDataString(path = "Format.Commands.Vote.Sites")
@Getter
private String formatCommandsVoteURLS = "&4%num%: &c&l%SiteName% - &c%url%";
/**
* Gets the command vote points.
*
* @return the command vote points
*/
public String getFormatCommandVotePoints() {
return getData().getString("Format.Commands.Vote.Points", "&a%Player% currently has &a&l%Points%&a Points!");
@ConfigDataString(path = "Format.Commands.Vote.Points")
@Getter
private String formatCommandsVotePoints = "&a%Player% currently has &a&l%Points%&a Points!";
}
@ConfigDataString(path = "Format.Commands.Vote.Top.Line")
@Getter
private String formatCommandsVoteTopLine = "&c%num%: &6%player%, %votes%";
/**
* Gets the command vote top line.
*
* @return the command vote top line
*/
public String getFormatCommandVoteTopLine() {
return getData().getString("Format.Commands.Vote.Top.Line", "&c%num%: &6%player%, %votes%");
}
@ConfigDataString(path = "Format.Commands.Vote.Top.Title")
@Getter
private String formatCommandVoteTopTitle = "&3Top %Top% Voters %page%/%maxpages%";
/**
* Gets the command vote top title.
*
* @return the command vote top title
*/
public String getFormatCommandVoteTopTitle() {
return getData().getString("Format.Commands.Vote.Top.Title", "&3Top %Top% Voters %page%/%maxpages%");
@ConfigDataString(path = "Format.NextPage")
@Getter
private String formatNextPage = "&aNext Page";
}
@ConfigDataString(path = "Format.NoPerms")
@Getter
private String formatNoPerms = "&cYou do not have enough permission!";
public String getFormatNextPage() {
return getData().getString("Format.NextPage", "&aNext Page");
}
@ConfigDataString(path = "Format.NotNumber")
@Getter
private String formatNotNumber = "&cError on &6%arg%&c, number expected!";
/**
* Gets the format no perms.
*
* @return the format no perms
*/
public String getFormatNoPerms() {
return getData().getString("Format.NoPerms", "&cYou do not have enough permission!");
}
@ConfigDataString(path = "Format.PrevPage")
@Getter
private String formatPrevPage = "&aPrevious Page";
public String getFormatNotNumber() {
return getData().getString("Format.NotNumber", "&cError on &6%arg%&c, number expected!");
}
@ConfigDataString(path = "Format.ShopFailed")
@Getter
private String formatShopFailedMsg = "&cYou do not have %Points% points to purhcase this!";
public String getFormatPrevPage() {
return getData().getString("Format.PrevPage", "&aPrevious Page");
}
@ConfigDataString(path = "Format.ShopNotPurchasable")
@Getter
private String formatShopNotPurchasable = "&cThis item is not buyable!";
public String getFormatShopFailedMsg() {
String msg = getData().getString("Format.ShopFailed", "&cYou do not have %Points% points to purhcase this!");
@ConfigDataString(path = "Format.ShopPurchase")
@Getter
private String formatShopPurchaseMsg = "&aYou bought the %Identifier% for %Points% Points!";
return msg;
@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";
public String getFormatShopPurchaseMsg() {
return getData().getString("Format.ShopPurchase", "&aYou bought the %Identifier% for %Points% Points!");
@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";
/**
* Gets the sign top voter sign line 1.
*
* @return the sign top voter sign line 1
*/
public String getFormatSignTopVoterSignLine1() {
return getData().getString("Format.Signs.TopVoterSign.Line1", "TopVoter: %SiteName%");
@ConfigDataString(path = "Format.TopVoter.AllTime")
@Getter
private String formatTopVoterAllTime = "AllTime";
}
@ConfigDataString(path = "Format.TopVoter.Daily")
@Getter
private String formatTopVoterDaily = "Daily";
/**
* Gets the sign top voter sign line 2.
*
* @return the sign top voter sign line 2
*/
public String getFormatSignTopVoterSignLine2() {
return getData().getString("Format.Signs.TopVoterSign.Line2", "#%position%");
}
@ConfigDataString(path = "Format.TopVoter.Monthly")
@Getter
private String formatTopVoterMonthly = "Monthly";
/**
* Gets the sign top voter sign line 3.
*
* @return the sign top voter sign line 3
*/
public String getFormatSignTopVoterSignLine3() {
return getData().getString("Format.Signs.TopVoterSign.Line3", "%player%");
@ConfigDataString(path = "Format.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";
/**
* Gets the sign top voter sign line 4.
*
* @return the sign top voter sign line 4
*/
public String getFormatSignTopVoterSignLine4() {
return getData().getString("Format.Signs.TopVoterSign.Line4", "%votes% Votes");
@ConfigDataString(path = "Format.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!";
/**
* 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%");
}
@ConfigDataString(path = "Format.InvalidCommand.AdminVote")
@Getter
private String formatInvalidCommandAdminVote = "&4No valid arguments, see /adminvote help!";
/**
* Gets the vote help.
@@ -650,133 +612,92 @@ public class Config extends YMLFile {
return (ArrayList<String>) getData().getList("Format.Commands.Vote.Help.Lines", new ArrayList<String>());
}
public boolean getGiveDefaultPermission() {
return getData().getBoolean("GiveDefaultPermission", true);
}
@ConfigDataBoolean(path = "GiveDefaultPermission")
@Getter
private boolean giveDefaultPermission = true;
public boolean getLoadTopVoter(TopVoter top) {
switch (top) {
case AllTime:
return getLoadTopVoterAllTime();
return isLoadTopVoterAllTime();
case Daily:
return getLoadTopVoterDaily();
return isLoadTopVoterDaily();
case Monthly:
return getLoadTopVoterMonthly();
return isLoadTopVoterMonthly();
case Weekly:
return getLoadTopVoterWeekly();
return isLoadTopVoterWeekly();
default:
return false;
}
}
public boolean getLoadTopVoterAllTime() {
return getData().getBoolean("LoadTopVoter.AllTime", true);
}
@ConfigDataBoolean(path = "LoadTopVoter.AllTime")
@Getter
private boolean loadTopVoterAllTime = true;
public boolean getLoadTopVoterDaily() {
return getData().getBoolean("LoadTopVoter.Daily", false);
}
@ConfigDataBoolean(path = "LoadTopVoter.Monthly")
@Getter
private boolean loadTopVoterMonthly = true;
public boolean getLoadTopVoterMonthly() {
return getData().getBoolean("LoadTopVoter.Monthly", true);
}
@ConfigDataBoolean(path = "LoadTopVoter.Daily")
@Getter
private boolean loadTopVoterDaily = false;
public boolean getLoadTopVoterWeekly() {
return getData().getBoolean("LoadTopVoter.Weekly", false);
}
@ConfigDataBoolean(path = "LoadTopVoter.Weekly")
@Getter
private boolean loadTopVoterWeekly = false;
public int getPointsOnVote() {
return getData().getInt("PointsOnVote", 1);
}
@ConfigDataInt(path = "PointsOnVote")
@Getter
private int pointsOnVote = 1;
public int getPurgeMin() {
return getData().getInt("PurgeMin", 90);
}
@ConfigDataInt(path = "PurgeMin")
@Getter
private int purgeMin = 90;
public boolean getPurgeOldData() {
return getData().getBoolean("PurgeOldData");
}
@ConfigDataBoolean(path = "PurgeOldData")
@Getter
private boolean purgeOldData = false;
/**
* Gets the request API default method.
*
* @return the request API default method
*/
public String getRequestAPIDefaultMethod() {
return getData().getString("RequestAPI.DefaultMethod", "Anvil");
}
@ConfigDataString(path = "RequestAPI.DefaultMethod")
@Getter
private String requestAPIDefaultMethod = "ANVIL";
/**
* Gets the request API disabled methods.
*
* @return the request API disabled methods
*/
@SuppressWarnings("unchecked")
public ArrayList<String> getRequestAPIDisabledMethods() {
return (ArrayList<String>) getData().getList("RequestAPI.DisabledMethods", new ArrayList<String>());
}
@ConfigDataListString(path = "RequestAPI.DisabledMethods")
@Getter
private ArrayList<String> requestAPIDisabledMethods = new ArrayList<String>();
/**
* Gets the store top voters daily.
*
* @return the store top voters daily
*/
public boolean getStoreTopVotersDaily() {
return getData().getBoolean("StoreTopVoters.Daily");
}
@ConfigDataBoolean(path = "StoreTopVoters.Daily")
@Getter
private boolean storeTopVotersDaily = false;
/**
* Gets the store top voters weekly.
*
* @return the store top voters weekly
*/
public boolean getStoreTopVotersWeekly() {
return getData().getBoolean("StoreTopVoters.Weekly");
}
@ConfigDataBoolean(path = "StoreTopVoters.Weekly")
@Getter
private boolean storeTopVotersWeekly = false;
public boolean getTopVoterAwardsTies() {
return getData().getBoolean("TopVoterAwardsTies", true);
}
@ConfigDataBoolean(path = "TopVoterAwardsTies")
@Getter
private boolean topVoterAwardsTies = true;
public boolean getTopVoterIgnorePermission() {
return getData().getBoolean("TopVoterIgnorePermission");
}
@ConfigDataBoolean(path = "TopVoterIgnorePermission")
@Getter
private boolean topVoterIgnorePermission = false;
/**
* Gets the enabled.
*
* @return the enabled
*/
public boolean getVoteRemindingEnabled() {
return getData().getBoolean("VoteReminding.Enabled");
}
@ConfigDataBoolean(path = "VoteReminding.Enabled")
@Getter
private boolean voteRemindingEnabled = true;
/**
* Gets the remind delay.
*
* @return the remind delay
*/
public int getVoteRemindingRemindDelay() {
return getData().getInt("VoteReminding.RemindDelay", 30);
}
@ConfigDataInt(path = "VoteReminding.RemindDelay")
@Getter
private int voteRemindingRemindDelay = 30;
/**
* Gets the remind on login.
*
* @return the remind on login
*/
public boolean getVoteRemindingRemindOnLogin() {
return getData().getBoolean("VoteReminding.RemindOnLogin");
}
@ConfigDataBoolean(path = "VoteReminding.RemindOnLogin")
@Getter
private boolean voteRemindingRemindOnLogin = false;
/**
* Gets the remind only once.
*
* @return the remind only once
*/
public boolean getVoteRemindingRemindOnlyOnce() {
return getData().getBoolean("VoteReminding.RemindOnlyOnce");
}
@ConfigDataBoolean(path = "VoteReminding.RemindOnlyOnce")
@Getter
private boolean voteRemindingRemindOnlyOnce = false;
/**
* Gets the rewards.
@@ -787,9 +708,9 @@ public class Config extends YMLFile {
return "VoteReminding.Rewards";
}
public String getVoteTopDefault() {
return getData().getString("VoteTopDefault", "Monthly");
}
@ConfigDataString(path = "VoteTopDefault")
@Getter
private String voteTopDefault = "Monthly";
@Override
public void loadValues() {
@@ -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.rewards.DirectlyDefinedReward;
import com.bencodez.advancedcore.api.yml.YMLFile;
import com.bencodez.simpleapi.array.ArrayUtils;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.objects.VoteSite;
@@ -47,15 +48,62 @@ 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 "
p.sendMessage(MessageAPI.colorize("&cGenerating votesite for service site "
+ siteName + ", please check console for details"));
}
}
@@ -120,8 +168,8 @@ public class ConfigVoteSites extends YMLFile {
return getData(siteName).getString("ServiceSite");
}
public int getTimeOffSet(String siteName) {
return getData(siteName).getInt("TimeOffSet", 0);
public int getVoteDelayDailyHour(String siteName) {
return getData(siteName).getInt("VoteDelayDailyHour", 0);
}
/**
@@ -130,12 +178,12 @@ public class ConfigVoteSites extends YMLFile {
* @param siteName the site name
* @return the vote delay
*/
public int getVoteDelay(String siteName) {
return getData(siteName).getInt("VoteDelay", 24);
public double getVoteDelay(String siteName) {
return getData(siteName).getDouble("VoteDelay", 24);
}
public int getVoteDelayMin(String siteName) {
return getData(siteName).getInt("VoteDelayMin", 0);
public double getVoteDelayMin(String siteName) {
return getData(siteName).getDouble("VoteDelayMin", 0);
}
/**
@@ -199,7 +247,9 @@ public class ConfigVoteSites extends YMLFile {
if (!siteCheck(site)) {
plugin.getLogger().warning("Failed to load site " + site + ", see above");
} else {
voteSites.add(new VoteSite(plugin, site));
VoteSite voteSite = new VoteSite(plugin, site);
plugin.debug(voteSite.loadingDebug());
voteSites.add(voteSite);
}
}
}
@@ -228,7 +278,7 @@ public class ConfigVoteSites extends YMLFile {
public ArrayList<String> getVoteSitesNames(boolean checkEnabled) {
ArrayList<String> siteNames = new ArrayList<String>();
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--) {
@@ -393,7 +443,7 @@ public class ConfigVoteSites extends YMLFile {
* @param siteName the site name
* @param voteDelay the vote delay
*/
public void setVoteDelay(String siteName, int voteDelay) {
public void setVoteDelay(String siteName, double voteDelay) {
set(siteName, "VoteDelay", voteDelay);
}
@@ -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.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,15 +35,23 @@ 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<String>();
@ConfigDataString(path = "BOOK.VoteURLBookGUI.Title")
@Getter
private String bookVoteURLBookGUITitle = "&cVoteURL";
@@ -74,6 +84,10 @@ public class GUI extends YMLFile {
@Getter
private boolean chestVoteShopRequireConfirmation = false;
@ConfigDataBoolean(path = "CHEST.VoteBest.BackButton")
@Getter
private boolean chestVoteBestBackButton = true;
@ConfigDataString(path = "CHEST.VoteToday.IconTitle")
@Getter
private String chestVoteTodayIconTitle = "%player%";
@@ -142,6 +156,10 @@ public class GUI extends YMLFile {
@Getter
private boolean lastMonthGUI = false;
@ConfigDataBoolean(path = "CHEST.VoteLast.ClickableLinks")
@Getter
private boolean chestVoteLastClickableLinks = true;
private VotingPluginMain plugin;
public GUI(VotingPluginMain plugin) {
@@ -165,9 +183,9 @@ public class GUI extends YMLFile {
saveData();
}
public ConfigurationSection getCHESTBackButton() {
return getData().getConfigurationSection("CHEST.BackButton");
}
@ConfigDataConfigurationSection(path = "CHEST.BackButton")
@Getter
private ConfigurationSection CHESTBackButton;
public int getChestShopIdentifierCost(String identifier) {
return getData().getInt("CHEST.Shop." + identifier + ".Cost");
@@ -183,7 +201,6 @@ public class GUI extends YMLFile {
public String getChestShopIdentifierRewardsPath(String identifier) {
return "CHEST.Shop." + identifier + ".Rewards";
}
public Set<String> getChestShopIdentifiers() {
@@ -198,25 +215,25 @@ public class GUI extends YMLFile {
return getData().getConfigurationSection("CHEST.Shop." + identifier);
}
public ConfigurationSection getChestVoteBestDayBestItem() {
return getData().getConfigurationSection("CHEST.VoteBest.DayBest.Item");
}
@ConfigDataConfigurationSection(path = "CHEST.VoteBest.DayBest.Item")
@Getter
private ConfigurationSection chestVoteBestDayBestItem;
public ConfigurationSection getChestVoteBestMonthBestItem() {
return getData().getConfigurationSection("CHEST.VoteBest.MonthBest.Item");
}
@ConfigDataConfigurationSection(path = "CHEST.VoteBest.MonthBest.Item")
@Getter
private ConfigurationSection chestVoteBestMonthBestItem;
public String getChestVoteBestName() {
return getData().getString("CHEST.VoteBest.Name", "VoteBest: %player%");
}
@ConfigDataString(path = "CHEST.VoteBest.Name")
@Getter
private String chestVoteBestName = "VoteBest: %player%";
public ConfigurationSection getChestVoteBestWeekBestItem() {
return getData().getConfigurationSection("CHEST.VoteBest.WeekBest.Item");
}
@ConfigDataConfigurationSection(path = "CHEST.VoteBest.WeekBest.Item")
@Getter
private ConfigurationSection chestVoteBestWeekBestItem;
public String getChestVoteGUIName() {
return getData().getString("CHEST.VoteGUIName", "&cVoteGUI: &c&l%player%");
}
@ConfigDataString(path = "CHEST.VoteGUIName")
@Getter
private String chestVoteGUIName = "&cVoteGUI: &c&l%player%";
/**
* Gets the vote GUI slot command.
@@ -240,27 +257,22 @@ public class GUI extends YMLFile {
return (ArrayList<String>) getData().getList("CHEST.VoteGUI." + slot + ".Item.Lore", new ArrayList<String>());
}
public String getChestVoteGUISlotRewardsPath(String slot) {
return "CHEST.VoteGUI." + slot + ".Rewards";
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>();
}
}
@ConfigDataKeys(path = "CHEST.VoteGUI")
@Getter
private Set<String> chestVoteGUISlots = new HashSet<String>();
public ConfigurationSection getChestVoteGUISlotSection(String slot) {
return getData().getConfigurationSection("CHEST.VoteGUI." + slot + ".Item");
}
@ConfigDataConfigurationSection(path = "CHEST.VoteTop.Customization")
@Getter
private ConfigurationSection chestVoteTopCustomization;
/**
* Gets the vote GUI slot slot.
*
@@ -271,45 +283,61 @@ public class GUI extends YMLFile {
return getData().getInt("CHEST.VoteGUI." + slot + ".Slot", -1);
}
public boolean getChestVoteLastBackButton() {
return getData().getBoolean("CHEST.VoteLast.BackButton");
@ConfigDataBoolean(path = "CHEST.VoteLast.BackButton")
@Getter
private boolean chestVoteLastBackButton = false;
@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%";
public String getChestVoteNextCustomSiteNamesDisplays(String site) {
return getData().getString("CHEST.VoteNext.CustomSiteNamesDisplays." + site, "");
}
public String getChestVoteLastLine() {
return getData().getString("CHEST.VoteLast.Line", "&6%timeSince%");
}
@ConfigDataString(path = "CHEST.VoteRewardName")
@Getter
private String chestVoteRewardName = "VoteReward";
public String getChestVoteLastName() {
return getData().getString("CHEST.VoteLast.Name", "VoteLast: %player%");
}
@ConfigDataBoolean(path = "CHEST.VoteShopBackButton")
@Getter
private boolean chestVoteShopBackButton = true;
public boolean getChestVoteNextBackButton() {
return getData().getBoolean("CHEST.VoteNext.BackButton");
}
public String getChestVoteNextName() {
return getData().getString("CHEST.VoteNext.Name", "VoteNext: %player%");
}
public String getChestVoteRewardName() {
return getData().getString("CHEST.VoteRewardName", "VoteReward");
}
public boolean getChestVoteShopBackButton() {
return getData().getBoolean("CHEST.VoteShopBackButton", true);
}
@ConfigDataBoolean(path = "CHEST.VoteShopReopenGUIOnPurchase")
@Getter
private boolean chestVoteShopReopenGUIOnPurchase = true;
public boolean getChestVoteShopCloseGUI(String shop) {
return getData().getBoolean("CHEST.Shop." + shop + ".CloseGUI", true);
}
public boolean getChestVoteShopEnabled() {
return getData().getBoolean("CHEST.VoteShopEnabled", true);
public boolean getChestVoteShopHideOnNoPermission(String shop) {
return getData().getBoolean("CHEST.Shop." + shop + ".HideOnNoPermission", true);
}
public String getChestVoteShopName() {
return getData().getString("CHEST.VoteShopName", "VoteShop");
}
@ConfigDataBoolean(path = "CHEST.VoteShopEnabled")
@Getter
private boolean chestVoteShopEnabled = true;
@ConfigDataString(path = "CHEST.VoteShopName")
@Getter
private String chestVoteShopName = "VoteShop";
public boolean getChestVoteShopNotBuyable(String shop) {
return getData().getBoolean("CHEST.Shop." + shop + ".NotBuyable", false);
@@ -336,85 +364,93 @@ public class GUI extends YMLFile {
return getData().getBoolean("CHEST.Shop." + shop + ".Reset.Weekly", false);
}
public boolean getChestVoteStreakBackButton() {
return getData().getBoolean("CHEST.VoteStreak.BackButton");
}
@ConfigDataBoolean(path = "CHEST.VoteStreak.BackButton")
@Getter
private boolean chestVoteStreakBackButton = false;
public ConfigurationSection getChestVoteStreakCurrentDayStreakItem() {
return getData().getConfigurationSection("CHEST.VoteStreak.CurrentDayStreak.Item");
}
@ConfigDataConfigurationSection(path = "CHEST.VoteStreak.CurrentDayStreak.Item")
@Getter
private ConfigurationSection chestVoteStreakCurrentDayStreakItem;
public ConfigurationSection getChestVoteStreakCurrentMonthStreakItem() {
return getData().getConfigurationSection("CHEST.VoteStreak.CurrentMonthStreak.Item");
}
@ConfigDataConfigurationSection(path = "CHEST.VoteStreak.CurrentMonthStreak.Item")
@Getter
private ConfigurationSection chestVoteStreakCurrentMonthStreakItem;
public ConfigurationSection getChestVoteStreakCurrentWeekStreakItem() {
return getData().getConfigurationSection("CHEST.VoteStreak.CurrentWeekStreak.Item");
}
@ConfigDataConfigurationSection(path = "CHEST.VoteStreak.CurrentWeekStreak.Item")
@Getter
private ConfigurationSection chestVoteStreakCurrentWeekStreakItem;
public ConfigurationSection getChestVoteStreakHighestDayStreakItem() {
return getData().getConfigurationSection("CHEST.VoteStreak.HighestDayStreak.Item");
}
@ConfigDataConfigurationSection(path = "CHEST.VoteStreak.HighestDayStreak.Item")
@Getter
private ConfigurationSection chestVoteStreakHighestDayStreakItem;
public ConfigurationSection getChestVoteStreakHighestMonthStreakItem() {
return getData().getConfigurationSection("CHEST.VoteStreak.HighestMonthStreak.Item");
}
@ConfigDataConfigurationSection(path = "CHEST.VoteStreak.HighestMonthStreak.Item")
@Getter
private ConfigurationSection chestVoteStreakHighestMonthStreakItem;
public ConfigurationSection getChestVoteStreakHighestWeekStreakItem() {
return getData().getConfigurationSection("CHEST.VoteStreak.HighestWeekStreak.Item");
}
@ConfigDataConfigurationSection(path = "CHEST.VoteStreak.HighestWeekStreak.Item")
@Getter
private ConfigurationSection chestVoteStreakHighestWeekStreakItem;
public String getChestVoteStreakName() {
return getData().getString("CHEST.VoteStreak.Name", "VoteStreak");
}
@ConfigDataString(path = "CHEST.VoteStreak.Name")
@Getter
private String chestVoteStreakName = "VoteStreak";
public boolean getChestVoteTodayBackButton() {
return getData().getBoolean("CHEST.VoteToday.BackButton");
}
@ConfigDataBoolean(path = "CHEST.VoteToday.BackButton")
@Getter
private boolean chestVoteTodayBackButton = false;
public String getChestVoteTodayName() {
return getData().getString("CHEST.VoteToday.Name", "VoteToday");
}
@ConfigDataString(path = "CHEST.VoteToday.Name")
@Getter
private String chestVoteTodayName = "VoteToday";
public boolean getChestVoteTopBackButton() {
return getData().getBoolean("CHEST.VoteTop.BackButton");
}
@ConfigDataBoolean(path = "CHEST.VoteTop.BackButton")
@Getter
private boolean chestVoteTopBackButton = false;
public String getChestVoteTopItemLore() {
return getData().getString("CHEST.VoteTop.Item.Lore", "&3&lVotes: &3%votes%");
}
@ConfigDataString(path = "CHEST.VoteTop.Item.Lore")
@Getter
private String chestVoteTopItemLore = "&3&lVotes: &3%votes%";
public String getChestVoteTopItemName() {
return getData().getString("CHEST.VoteTop.Item.Name", "&3&l%position%: &3%player%");
}
@ConfigDataString(path = "CHEST.VoteTop.Item.Name")
@Getter
private String chestVoteTopItemName = "&3&l%position%: &3%player%";
public String getChestVoteTopName() {
return getData().getString("CHEST.VoteTop.Name", "VoteTop %topvoter%");
}
@ConfigDataString(path = "CHEST.VoteTop.Name")
@Getter
private String chestVoteTopName = "VoteTop %topvoter%";
public boolean getChestVoteTopOpenMainGUIOnClick() {
return getData().getBoolean("CHEST.VoteTop.OpenMainGUIOnClick", true);
}
@ConfigDataBoolean(path = "CHEST.VoteTop.OpenMainGUIOnClick")
@Getter
private boolean chestVoteTopOpenMainGUIOnClick = true;
public int getChestVoteTopSize() {
return getData().getInt("CHEST.VoteTop.Size", 27);
}
@ConfigDataBoolean(path = "CHEST.VoteTop.CloseGUIOnClick")
@Getter
private boolean chestVoteTopCloseGUIOnClick = true;
public ConfigurationSection getChestVoteTopSwitchItem() {
return getData().getConfigurationSection("CHEST.VoteTop.SwitchItem");
}
@ConfigDataInt(path = "CHEST.VoteTop.Size")
@Getter
private int chestVoteTopSize = 27;
public ConfigurationSection getChestVoteTotalAllTimeTotalItem() {
return getData().getConfigurationSection("CHEST.VoteTotal.AllTimeTotal.Item");
}
@ConfigDataConfigurationSection(path = "CHEST.VoteTop.SwitchItem")
@Getter
private ConfigurationSection chestVoteTopSwitchItem;
public boolean getChestVoteTotalBackButton() {
return getData().getBoolean("CHEST.VoteTotal.BackButton");
}
@ConfigDataListString(path = "CHEST.VoteTop.SwitchItem.TopVoters")
@Getter
private ArrayList<String> chestVoteTopSwitchItemTopVoters = new ArrayList<String>();
public ConfigurationSection getChestVoteTotalDayTotalItem() {
return getData().getConfigurationSection("CHEST.VoteTotal.DayTotal.Item");
}
@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;
public ConfigurationSection getChestVoteTotalItem(TopVoter top) {
switch (top) {
@@ -432,117 +468,104 @@ public class GUI extends YMLFile {
}
}
public ConfigurationSection getChestVoteTotalMonthTotalItem() {
return getData().getConfigurationSection("CHEST.VoteTotal.MonthTotal.Item");
}
@ConfigDataConfigurationSection(path = "CHEST.VoteTotal.MonthTotal.Item")
@Getter
private ConfigurationSection chestVoteTotalMonthTotalItem;
public String getChestVoteTotalName() {
return getData().getString("CHEST.VoteTotal.Name", "VoteTotal: %player%");
}
@ConfigDataString(path = "CHEST.VoteTotal.Name")
@Getter
private String chestVoteTotalName = "VoteTotal: %player%";
public ConfigurationSection getChestVoteTotalWeekTotalItem() {
return getData().getConfigurationSection("CHEST.VoteTotal.WeekTotal.Item");
}
@ConfigDataConfigurationSection(path = "CHEST.VoteTotal.WeekTotal.Item")
@Getter
private ConfigurationSection chestVoteTotalWeekTotalItem;
public int getChestVoteURLAllUrlsButtonSlot() {
return getData().getInt("CHEST.VoteURL.AllUrlsButton.Slot", -1);
}
@ConfigDataInt(path = "CHEST.VoteURL.AllUrlsButton.Slot")
@Getter
private int chestVoteURLAllUrlsButtonSlot = -1;
public int getChestVoteURLAllUrlsButtonStartSlot() {
return getData().getInt("CHEST.VoteURL.StartSlot", -1);
}
@ConfigDataInt(path = "CHEST.VoteURL.StartSlot")
@Getter
private int chestVoteURLAllUrlsButtonStartSlot = -1;
public ConfigurationSection getChestVoteURLAlreadyVotedAllUrlsButtonItemSection() {
if (getData().isConfigurationSection("CHEST.VoteURL.AllUrlsButton.AlreadyVotedItem")) {
return getData().getConfigurationSection("CHEST.VoteURL.AllUrlsButton.AlreadyVotedItem");
} else {
return getData().getConfigurationSection("CHEST.VoteURL.AlreadyVotedItem");
}
}
@ConfigDataConfigurationSection(path = "CHEST.VoteURL.AllUrlsButton.AlreadyVotedItem", secondPath = "CHEST.VoteURL.AlreadyVotedItem")
@Getter
private ConfigurationSection chestVoteURLAlreadyVotedAllUrlsButtonItemSection;
public ConfigurationSection getChestVoteURLAlreadyVotedItemSection() {
return getData().getConfigurationSection("CHEST.VoteURL.AlreadyVotedItem");
}
@ConfigDataConfigurationSection(path = "CHEST.VoteURL.AlreadyVotedItem")
@Getter
private ConfigurationSection chestVoteURLAlreadyVotedItemSection;
public boolean getChestVoteURLBackButton() {
return getData().getBoolean("CHEST.VoteURL.BackButton");
}
@ConfigDataBoolean(path = "CHEST.VoteURL.BackButton")
@Getter
private boolean chestVoteURLBackButton = false;
public ConfigurationSection getChestVoteURLCanVoteAllUrlsButtonItemSection() {
if (getData().isConfigurationSection("CHEST.VoteURL.AllUrlsButton.CanVoteItem")) {
return getData().getConfigurationSection("CHEST.VoteURL.AllUrlsButton.CanVoteItem");
} else {
return getData().getConfigurationSection("CHEST.VoteURL.CanVoteItem");
}
}
@ConfigDataConfigurationSection(path = "CHEST.VoteURL.AllUrlsButton.CanVoteItem", secondPath = "CHEST.VoteURL.CanVoteItem")
@Getter
private ConfigurationSection chestVoteURLCanVoteAllUrlsButtonItemSection;
public ConfigurationSection getChestVoteURLCanVoteItemSection() {
return getData().getConfigurationSection("CHEST.VoteURL.CanVoteItem");
}
@ConfigDataConfigurationSection(path = "CHEST.VoteURL.CanVoteItem")
@Getter
private ConfigurationSection chestVoteURLCanVoteItemSection;
public Set<String> getChestVoteURLExtraItems() {
if (getData().isConfigurationSection("CHEST.VoteURL.ExtraItems")) {
return getData().getConfigurationSection("CHEST.VoteURL.ExtraItems").getKeys(false);
}
return new HashSet<String>();
}
@ConfigDataKeys(path = "CHEST.VoteURL.ExtraItems")
@Getter
private Set<String> chestVoteURLExtraItems = new HashSet<String>();
public ConfigurationSection getChestVoteURLExtraItemsItem(String item) {
return getData().getConfigurationSection("CHEST.VoteURL.ExtraItems." + item);
}
/**
* Gets the vote URL site name.
*
* @return the vote URL site name
*/
public String getChestVoteURLGUISiteName() {
return getData().getString("CHEST.VoteURL.SiteName", "&c%Name%");
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 String getChestVoteURLGUISiteNameCanVote() {
return getData().getString("CHEST.VoteURL.SiteNameCanVote", "&a%Name%");
public ConfigurationSection getChestGUIVoteShopExtraItems(String item) {
return getData().getConfigurationSection("CHEST.VoteShopExtraItems." + item);
}
public String getChestVoteURLName() {
return getData().getString("CHEST.VoteURL.Name", "&cVoteURL");
@ConfigDataKeys(path = "CHEST.VoteShopExtraItems")
@Getter
private Set<String> chestGUIVoteShopExtraItems = new HashSet<String>();
public ConfigurationSection getChestGUIExtraItemsItem(String gui, String item) {
return getData().getConfigurationSection("CHEST." + gui + ".ExtraItems." + item);
}
/**
* Gets the vote URL next vote.
*
* @return the vote URL next vote
*/
public String getChestVoteURLNextVote() {
return getData().getString("CHEST.VoteURL.NextVote", "&cCan Vote In: %Info%");
@ConfigDataString(path = "CHEST.VoteURL.SiteName")
@Getter
private String chestVoteURLGUISiteName = "&c%Name%";
}
@ConfigDataString(path = "CHEST.VoteURL.SiteNameCanVote")
@Getter
private String chestVoteURLGUISiteNameCanVote = "&a%Name%";
/**
* Gets the vote URL see URL.
*
* @return the vote URL see URL
*/
public String getChestVoteURLSeeURL() {
return getData().getString("CHEST.VoteURL.SeeURL", "&cClick to see URL");
}
@ConfigDataString(path = "CHEST.VoteURL.Name")
@Getter
private String chestVoteURLName = "&cVoteURL";
public String getChestVoteURLSiteName() {
return getData().getString("CHEST.VoteURLSite.Name", "VoteSite %site%");
}
@ConfigDataString(path = "CHEST.VoteURL.NextVote")
@Getter
private String chestVoteURLNextVote = "&cCan Vote In: %Info%";
public String getChestVoteURLURLText() {
return getData().getString("CHEST.VoteURL.URLText", "%VoteUrl%");
}
@ConfigDataString(path = "CHEST.VoteURL.SeeURL")
@Getter
private String chestVoteURLSeeURL = "&cClick to see URL";
/**
* 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");
}
@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 boolean isChestVoteShopRequireConfirmation(String identifier) {
return getData().getBoolean("CHEST.Shop." + identifier + ".RequireConfirmation",
@@ -3,12 +3,17 @@ package com.bencodez.votingplugin.config;
import java.io.File;
import java.util.ArrayList;
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.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.ConfigDataListString;
import com.bencodez.simpleapi.file.annotation.ConfigDataString;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.topvoter.TopVoter;
@@ -19,6 +24,9 @@ public class SpecialRewardsConfig extends YMLFile {
@Getter
private String allSitesRewardPath = "AllSites";
@Getter
private String almostAllSitesRewardPath = "AlmostAllSites";
@Getter
private String anySiteRewardsPath = "AnySiteRewards";
@@ -34,6 +42,10 @@ public class SpecialRewardsConfig extends YMLFile {
@Getter
private boolean enableWeeklyAwards = false;
@ConfigDataBoolean(path = "OnlyOneCumulative")
@Getter
private boolean onlyOneCumulative = false;
@Getter
private String firstVoteRewardsPath = "FirstVote";
@@ -54,6 +66,22 @@ public class SpecialRewardsConfig extends YMLFile {
@ConfigDataBoolean(path = "VoteParty.ResetExtraVotesMonthly")
@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!";
@ConfigDataListString(path = "VoteParty.VoteReminderAtVotes")
@Getter
private ArrayList<String> votePartyVoteReminderAtVotes = new ArrayList<String>();
@ConfigDataListString(path = "VoteParty.GlobalRandomCommand")
@Getter
private ArrayList<String> votePartyGlobalRandomCommand = new ArrayList<String>();
@Getter
private String votePartyRewardsPath = "VoteParty.Rewards";
@@ -87,29 +115,18 @@ public class SpecialRewardsConfig extends YMLFile {
return "Cumulative." + cumulative + ".Rewards";
}
/**
* Gets the cumulative votes.
*
* @return the cumulative votes
*/
public Set<String> getCumulativeVotes() {
try {
Set<String> set = getData().getConfigurationSection("Cumulative").getKeys(false);
if (set != null) {
return set;
}
return new HashSet<String>();
} catch (Exception ex) {
return new HashSet<String>();
}
public List<Integer> getCumulativeBlackList(int cumulative) {
return getData().getIntegerList("Cumulative." + cumulative + ".BlackList");
}
/**
* Gets the cumulative votes in same day.
*
* @param cumulative the cumulative
* @return the cumulative votes in same day
*/
public boolean getCumulativeRecurring(int cumulative) {
return getData().getBoolean("Cumulative." + cumulative + ".Recurring", true);
}
@ConfigDataKeys(path = "Cumulative")
@Getter
private Set<String> cumulativeVotes = new HashSet<String>();
@Deprecated
public boolean getCumulativeVotesInSameDay(int cumulative) {
return getData().getBoolean("Cumulative." + cumulative + ".VotesInSameDay");
@@ -143,19 +160,9 @@ public class SpecialRewardsConfig extends YMLFile {
return "DailyAwards." + path + ".Rewards";
}
/**
* Gets the daily possible reward places.
*
* @return the daily possible reward places
*/
public Set<String> getDailyPossibleRewardPlaces() {
try {
return getData().getConfigurationSection("DailyAwards").getKeys(false);
} catch (Exception ex) {
return new HashSet<String>();
}
}
@ConfigDataKeys(path = "DailyAwards")
@Getter
private Set<String> dailyPossibleRewardPlaces = new HashSet<String>();
/**
* Gets the milestone reward enabled.
@@ -177,22 +184,9 @@ public class SpecialRewardsConfig extends YMLFile {
return "MileStones." + milestones + ".Rewards";
}
/**
* Gets the milestone votes.
*
* @return the milestone votes
*/
public Set<String> getMilestoneVotes() {
try {
Set<String> set = getData().getConfigurationSection("MileStones").getKeys(false);
if (set != null) {
return set;
}
return new HashSet<String>();
} catch (Exception ex) {
return new HashSet<String>();
}
}
@ConfigDataKeys(path = "MileStones")
@Getter
private Set<String> milestoneVotes = new HashSet<String>();
public String getMonthlyAwardRewardsPath(String path) {
return "MonthlyAwards." + path + ".Rewards";
@@ -211,77 +205,64 @@ public class SpecialRewardsConfig extends YMLFile {
}
}
public boolean getResetMilestonesMonthly() {
return getData().getBoolean("ResetMilestonesMonthly");
}
@ConfigDataBoolean(path = "ResetMilestonesMonthly")
@Getter
private boolean resetMilestonesMonthly = false;
@ConfigDataString(path = "VoteParty.Broadcast")
@Getter
private String votePartyBroadcast = "";
public String getVotePartyBroadcast() {
return getData().getString("VoteParty.Broadcast", "");
}
@ConfigDataListString(path = "VoteParty.GlobalCommands", secondPath = "VoteParty.Commands")
@Getter
private ArrayList<String> votePartyGlobalCommands = new ArrayList<String>();
@SuppressWarnings("unchecked")
public ArrayList<String> getVotePartyCommands() {
return (ArrayList<String>) getData().getList("VoteParty.Commands", new ArrayList<String>());
}
@ConfigDataBoolean(path = "VoteParty.CountFakeVotes")
@Getter
private boolean votePartyCountFakeVotes = true;
public boolean getVotePartyCountFakeVotes() {
return getData().getBoolean("VoteParty.CountFakeVotes", true);
}
@ConfigDataBoolean(path = "VoteParty.CountOfflineVotes")
@Getter
private boolean votePartyCountOfflineVotes = true;
public boolean getVotePartyCountOfflineVotes() {
return getData().getBoolean("VoteParty.CountOfflineVotes", true);
}
@ConfigDataBoolean(path = "VoteParty.Enabled")
@Getter
private boolean votePartyEnabled = false;
/**
* Gets the vote party enabled.
*
* @return the vote party enabled
*/
public boolean getVotePartyEnabled() {
return getData().getBoolean("VoteParty.Enabled");
}
@ConfigDataBoolean(path = "VoteParty.GiveAllPlayers")
@Getter
private boolean votePartyGiveAllPlayers = false;
/**
* Gets the vote party give all players.
*
* @return the vote party give all players
*/
public boolean getVotePartyGiveAllPlayers() {
return getData().getBoolean("VoteParty.GiveAllPlayers");
}
@ConfigDataInt(path = "VoteParty.IncreaseVotesRquired")
@Getter
private int votePartyIncreaseVotesRequired = 0;
public int getVotePartyIncreaseVotesRquired() {
return getData().getInt("VoteParty.IncreaseVotesRquired", 0);
}
@ConfigDataBoolean(path = "VoteParty.OnlyOncePerDay")
@Getter
private boolean votePartyOnlyOncePerDay = false;
public boolean getVotePartyOnlyOncePerDay() {
return getData().getBoolean("VoteParty.OnlyOncePerDay");
}
@ConfigDataBoolean(path = "VoteParty.OnlyOncePerWeek")
@Getter
private boolean votePartyOnlyOncePerWeek = false;
public boolean getVotePartyResetEachDay() {
return getData().getBoolean("VoteParty.ResetEachDay");
}
@ConfigDataBoolean(path = "VoteParty.ResetEachDay")
@Getter
private boolean votePartyResetEachDay = false;
public boolean getVotePartyResetMontly() {
return getData().getBoolean("VoteParty.ResetMonthly");
}
@ConfigDataBoolean(path = "VoteParty.ResetMonthly")
@Getter
private boolean votePartyResetMonthly = false;
public boolean getVotePartyResetWeekly() {
return getData().getBoolean("VoteParty.ResetWeekly");
}
@ConfigDataBoolean(path = "VoteParty.ResetWeekly")
@Getter
private boolean votePartyResetWeekly = false;
public int getVotePartyUserVotesRequired() {
return getData().getInt("VoteParty.UserVotesRequired");
}
@ConfigDataInt(path = "VoteParty.UserVotesRequired")
@Getter
private int votePartyUserVotesRequired = 0;
/**
* Gets the vote party votes required.
*
* @return the vote party votes required
*/
public int getVotePartyVotesRequired() {
return getData().getInt("VoteParty.VotesRequired");
}
@ConfigDataInt(path = "VoteParty.VotesRequired")
@Getter
private int votePartyVotesRequired = 0;
public boolean getVoteStreakRewardEnabled(String type, String s) {
return getData().getBoolean("VoteStreak." + type + "." + s + ".Enabled");
@@ -307,18 +288,9 @@ public class SpecialRewardsConfig extends YMLFile {
return "WeeklyAwards." + path + ".Rewards";
}
/**
* Gets the weekly possible reward places.
*
* @return the weekly possible reward places
*/
public Set<String> getWeeklyPossibleRewardPlaces() {
try {
return getData().getConfigurationSection("WeeklyAwards").getKeys(false);
} catch (Exception ex) {
return new HashSet<String>();
}
}
@ConfigDataKeys(path = "WeeklyAwards")
@Getter
private Set<String> weeklyPossibleRewardPlaces = new HashSet<String>();
@Override
public void loadValues() {
@@ -349,8 +321,8 @@ public class SpecialRewardsConfig extends YMLFile {
}
public void setMilestone(int intValue) {
getData().set("Milestones." + intValue + ".Enabled", true);
getData().set("Milestones." + intValue + ".Rewards.Messages.Player", "&aYou got %milestone% milestone votes!");
getData().set("MileStones." + intValue + ".Enabled", true);
getData().set("MileStones." + intValue + ".Rewards.Messages.Player", "&aYou got %milestone% milestone votes!");
saveData();
}
}
@@ -1,40 +1,50 @@
package com.bencodez.votingplugin.cooldown;
import java.util.HashSet;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
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;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import com.bencodez.advancedcore.api.rewards.RewardHandler;
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 Set<UUID> uuids = new HashSet<UUID>();
private HashMap<UUID, ScheduledFuture<?>> perSiteTasks = new HashMap<UUID, ScheduledFuture<?>>();
private HashMap<UUID, ScheduledFuture<?>> allSiteTasks = new HashMap<UUID, ScheduledFuture<?>>();
public CoolDownCheck(VotingPluginMain plugin) {
this.plugin = plugin;
this.timer = new Timer();
this.timer = Executors.newScheduledThreadPool(1);
}
private Timer timer;
@Getter
private ScheduledExecutorService timer;
private boolean cooldownCheckEnabled = false;
public void checkEnabled() {
if (!plugin.getConfigFile().isDisableCoolDownCheck() && RewardHandler.getInstance()
if (!plugin.getConfigFile().isDisableCoolDownCheck() && plugin.getRewardHandler()
.hasRewards(plugin.getSpecialRewardsConfig().getData(), "VoteCoolDownEndedReward")) {
cooldownCheckEnabled = true;
} else {
@@ -43,74 +53,187 @@ public class CoolDownCheck implements Listener {
}
public void check(UUID uuid) {
check(plugin.getVotingPluginUserManager().getVotingPluginUser(uuid));
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(uuid);
if (!user.isOnline()) {
user.dontCache();
}
check(user);
}
public void vote(VotingPluginUser user) {
public void checkPerSite(UUID uuid) {
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(uuid);
if (!user.isOnline()) {
user.dontCache();
}
checkPerSite(user);
}
public void vote(VotingPluginUser user, VoteSite site) {
if (cooldownCheckEnabled) {
UUID uuid = UUID.fromString(user.getUUID());
if (!uuids.contains(uuid)) {
schedule(user);
schedule(user, true);
}
if (plugin.getConfigFile().isPerSiteCoolDownEvents()) {
user.setCoolDownCheckSite(site, Boolean.FALSE);
schedulePerSite(user, true);
}
}
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 check(VotingPluginUser user) {
boolean coolDownCheck = user.getCoolDownCheck();
if (user.canVoteAll() && coolDownCheck) {
user.setCoolDownCheck(false);
PlayerVoteCoolDownEndEvent event = new PlayerVoteCoolDownEndEvent(user);
plugin.getServer().getPluginManager().callEvent(event);
uuids.remove(UUID.fromString(user.getUUID()));
} else if (!coolDownCheck) {
schedule(user);
public synchronized void checkPerSite(VotingPluginUser user) {
if (plugin.getConfigFile().isPerSiteCoolDownEvents()) {
HashMap<String, Boolean> coolDownChecks = user.getCoolDownCheckSiteList();
boolean changed = false;
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);
}
}
}
if (changed) {
user.setCoolDownCheckSite(coolDownChecks);
}
schedulePerSite(user, false);
}
}
public void schedule(VotingPluginUser user) {
final UUID uuid = UUID.fromString(user.getUUID());
long time = user.getNextTimeAllSitesAvailable();
if (time > 0) {
user.setCoolDownCheck(true);
uuids.add(uuid);
timer.schedule(new TimerTask() {
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() {
check(uuid);
}
}, time * 1000 + 1500);
@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 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 load() {
if (cooldownCheckEnabled) {
plugin.addUserStartup(new UserStartup() {
plugin.addUserStartup(new UserStartup() {
@Override
public void onStartUp(AdvancedCoreUser advancedcoreUser) {
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(advancedcoreUser);
@Override
public void onStartUp(AdvancedCoreUser advancedcoreUser) {
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(advancedcoreUser);
user.dontCache();
if (cooldownCheckEnabled) {
check(user);
}
@Override
public void onStart() {
if (plugin.getConfigFile().isPerSiteCoolDownEvents()) {
checkPerSite(user);
}
}
@Override
public void onFinish() {
@Override
public void onStart() {
}
@Override
public void onFinish() {
}
});
}
public void checkAllVoteSite(VoteSite site) {
plugin.getLogger().info("Checking vote cooldown rewards for all players: " + site.getKey());
HashMap<UUID, ArrayList<Column>> cols = plugin.getUserManager().getAllKeys();
for (Entry<UUID, ArrayList<Column>> playerData : cols.entrySet()) {
String uuid = playerData.getKey().toString();
if (plugin != null && plugin.isEnabled()) {
if (uuid != null && !uuid.isEmpty()) {
VotingPluginUser user = plugin.getVotingPluginUserManager()
.getVotingPluginUser(UUID.fromString(uuid), false);
user.dontCache();
user.updateTempCacheWithColumns(playerData.getValue());
cols.put(playerData.getKey(), null);
checkPerSite(user);
user.clearTempCache();
user = null;
}
});
}
}
cols.clear();
cols = null;
plugin.getLogger().info("Finished checking vote cooldown rewards for all players: " + site.getKey());
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onCoolDownEnd(PlayerVoteCoolDownEndEvent event) {
RewardHandler.getInstance().giveReward(event.getPlayer(), plugin.getSpecialRewardsConfig().getData(),
plugin.getRewardHandler().giveReward(event.getPlayer(), plugin.getSpecialRewardsConfig().getData(),
"VoteCoolDownEndedReward", new RewardOptions());
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onCoolDownEnd(PlayerVoteSiteCoolDownEndEvent event) {
plugin.getRewardHandler().giveReward(event.getPlayer(), event.getSite().getSiteData(), "CoolDownEndRewards",
new RewardOptions().addPlaceholder("sitename", event.getSite().getDisplayName()).addPlaceholder("url",
event.getSite().getVoteURL(false)));
}
}
@@ -1,16 +1,21 @@
package com.bencodez.votingplugin.data;
import java.time.temporal.WeekFields;
import java.util.ArrayList;
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;
// TODO: Auto-generated Javadoc
/**
@@ -24,12 +29,60 @@ public class ServerData {
this.plugin = plugin;
}
public void addAutoCachedPlaceholder(String placeholder) {
List<String> p = getAutoCachedPlaceholder();
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 addVoteShopPurchase(String ident) {
setVoteShopPurchases(ident, (getVoteShopPurchases(ident) + 1));
}
public void setVoteShopPurchases(String ident, int amount) {
getData().set("VoteShopPurchases." + ident, amount);
saveData();
}
public int getVoteShopPurchases(String ident) {
return getData().getInt("VoteShopPurchases." + ident);
}
public void setAutoCachedPlaceholder(List<String> placeholders) {
getData().set("AutoCachePlaceholders", placeholders);
saveData();
}
public List<String> getAutoCachedPlaceholder() {
return getData().getStringList("AutoCachePlaceholders");
}
public List<String> getDisabledReminders() {
return getData().getStringList("DisabledReminders");
}
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));
}
/**
@@ -139,7 +192,16 @@ public class ServerData {
public boolean isLastVotePartySameDay() {
int num = getData().getInt("LastVoteParty", 0);
if (num != plugin.getTimeChecker().getTime().getDayOfYear()) {
if (num == plugin.getTimeChecker().getTime().getDayOfYear()) {
return true;
}
return false;
}
public boolean isLastVotePartySameWeek() {
int num = getData().getInt("LastVotePartyWeek", -1);
if (num == plugin.getTimeChecker().getTime().get(WeekFields.of(Locale.getDefault()).weekOfYear())
&& num != -1) {
return true;
}
return false;
@@ -246,10 +308,67 @@ public class ServerData {
saveData();
}
public void updateLastVotePartyWeek() {
getData().set("LastVotePartyWeek",
plugin.getTimeChecker().getTime().get(WeekFields.of(Locale.getDefault()).weekOfYear()));
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 saveDisabledReminders(ArrayList<UUID> disabledReminders) {
ArrayList<String> uuids = new ArrayList<String>();
for (UUID uuid : disabledReminders) {
uuids.add(uuid.toString());
}
getData().set("DisabledReminders", uuids);
saveData();
}
/**
* Update values.
*/
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();
}
}
@@ -0,0 +1,86 @@
package com.bencodez.votingplugin.events;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import com.bencodez.votingplugin.bungee.BungeeMessageData;
import com.bencodez.votingplugin.objects.VoteSite;
import com.bencodez.votingplugin.user.VotingPluginUser;
import lombok.Getter;
import lombok.Setter;
// TODO: Auto-generated Javadoc
/**
* The Class PlayerVoteEvent.
*/
public class PlayerPostVoteEvent extends Event {
/** The Constant handlers. */
private static final HandlerList handlers = new HandlerList();
/**
* Gets the handler list.
*
* @return the handler list
*/
public static HandlerList getHandlerList() {
return handlers;
}
@Getter
@Setter
private boolean bungee = false;
@Getter
@Setter
private BungeeMessageData bungeeTextTotals;
@Getter
@Setter
private boolean cancelled;
@Getter
@Setter
private boolean forceBungee = false;
@Getter
@Setter
private VotingPluginUser user;
@Getter
@Setter
private boolean realVote = true;
@Getter
@Setter
private VoteSite voteSite;
@Getter
@Setter
private long voteTime = 0;
@Getter
@Setter
private VotingPluginUser votingPluginUser;
public PlayerPostVoteEvent(VoteSite voteSite, VotingPluginUser user, boolean realVote, boolean forceBungee, long voteTime) {
super(true);
this.user = user;
this.voteSite = voteSite;
this.realVote = realVote;
this.forceBungee = forceBungee;
this.voteTime = voteTime;
}
/*
* (non-Javadoc)
*
* @see org.bukkit.event.Event#getHandlers()
*/
@Override
public HandlerList getHandlers() {
return handlers;
}
}
@@ -80,6 +80,10 @@ public class PlayerVoteEvent extends Event {
@Setter
private boolean broadcast = true;
@Getter
@Setter
private int voteNumber = 1;
public PlayerVoteEvent(VoteSite voteSite, String voteUsername, String serviceSite, boolean realVote) {
super(true);
this.player = voteUsername;
@@ -0,0 +1,58 @@
package com.bencodez.votingplugin.events;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import com.bencodez.votingplugin.objects.VoteSite;
import com.bencodez.votingplugin.user.VotingPluginUser;
import lombok.Getter;
import lombok.Setter;
// TODO: Auto-generated Javadoc
/**
* The Class PlayerVoteEvent.
*/
public class PlayerVoteSiteCoolDownEndEvent extends Event {
/** The Constant handlers. */
private static final HandlerList handlers = new HandlerList();
/**
* Gets the handler list.
*
* @return the handler list
*/
public static HandlerList getHandlerList() {
return handlers;
}
@Getter
@Setter
private boolean cancelled;
@Getter
@Setter
private VotingPluginUser player;
@Getter
@Setter
private VoteSite site;
public PlayerVoteSiteCoolDownEndEvent(VotingPluginUser user, VoteSite site) {
super(true);
player = user;
this.site = site;
}
/*
* (non-Javadoc)
*
* @see org.bukkit.event.Event#getHandlers()
*/
@Override
public HandlerList getHandlers() {
return handlers;
}
}
@@ -3,7 +3,7 @@ package com.bencodez.votingplugin.events;
import lombok.Getter;
public enum SpecialRewardType {
ALLSITE, CUMMULATIVE, FIRSTVOTE, FIRSTVOTETODAY, MILESTONE, VOTESTREAK;
ALLSITE, CUMMULATIVE, FIRSTVOTE, FIRSTVOTETODAY, MILESTONE, VOTESTREAK, ALMOSTALLSITES;
@Getter
private int amount = -1;
@@ -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;
@@ -18,7 +17,7 @@ import com.bencodez.votingplugin.signs.SignHandler;
public class BlockBreak implements Listener {
/** The plugin. */
private static VotingPluginMain plugin;
private VotingPluginMain plugin;
/**
* Instantiates a new block break.
@@ -26,7 +25,7 @@ public class BlockBreak implements Listener {
* @param plugin the plugin
*/
public BlockBreak(VotingPluginMain plugin) {
BlockBreak.plugin = plugin;
this.plugin = plugin;
}
/**
@@ -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
/**
@@ -21,7 +21,7 @@ import com.bencodez.votingplugin.user.UserManager;
public class PlayerInteract implements Listener {
/** The plugin. */
private static VotingPluginMain plugin;
private VotingPluginMain plugin;
/**
* Instantiates a new player interact.
@@ -29,7 +29,7 @@ public class PlayerInteract implements Listener {
* @param plugin the plugin
*/
public PlayerInteract(VotingPluginMain plugin) {
PlayerInteract.plugin = plugin;
this.plugin = plugin;
}
/**
@@ -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);
}
}
}
@@ -1,17 +1,14 @@
package com.bencodez.votingplugin.listeners;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import com.bencodez.advancedcore.api.user.UserStorage;
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
@@ -21,7 +18,7 @@ import com.bencodez.votingplugin.user.VotingPluginUser;
public class PlayerJoinEvent implements Listener {
/** The plugin. */
private static VotingPluginMain plugin;
private VotingPluginMain plugin;
/**
* Instantiates a new player join event.
@@ -29,11 +26,11 @@ public class PlayerJoinEvent implements Listener {
* @param plugin the plugin
*/
public PlayerJoinEvent(VotingPluginMain plugin) {
PlayerJoinEvent.plugin = plugin;
this.plugin = plugin;
}
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");
}
@@ -49,9 +46,13 @@ public class PlayerJoinEvent implements Listener {
user.loginRewards();
plugin.getPlaceholders().onUpdate(user, true);
if (plugin.getBungeeSettings().isUseBungeecoord()
&& plugin.getBungeeHandler().getMethod().equals(BungeeMethod.PLUGINMESSAGING)) {
plugin.getPluginMessaging().sendPluginMessage("Login", user.getPlayerName(), user.getUUID());
&& (plugin.getBungeeHandler().getMethod().equals(BungeeMethod.PLUGINMESSAGING)
|| plugin.getBungeeHandler().getMethod().equals(BungeeMethod.REDIS))) {
plugin.getBungeeHandler().getGlobalMessageHandler().sendMessage("Login", user.getPlayerName(),
user.getUUID(), plugin.getBungeeSettings().getServer());
}
}
@@ -62,43 +63,30 @@ public class PlayerJoinEvent implements Listener {
*/
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerLogin(AdvancedCoreLoginEvent event) {
if (event.getPlayer() == null || (VotingPluginMain.plugin.getStorageType().equals(UserStorage.MYSQL)
&& VotingPluginMain.plugin.getMysql() == null)) {
if (event.getPlayer() == null || !plugin.isMySQLOkay()) {
return;
}
int delay = plugin.getConfigFile().getDelayLoginEvent();
if (delay <= 0) {
login(event.getPlayer());
} else {
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
@Override
public void run() {
login(event.getPlayer());
}
}, delay);
}
login(event.getPlayer());
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerQuit(PlayerQuitEvent event) {
if (plugin.getConfigFile().isDisableAdvancedTab()) {
return;
if (plugin != null && plugin.isEnabled()) {
final java.util.UUID uuid = event.getPlayer().getUniqueId();
plugin.getLoginTimer().execute(new Runnable() {
@Override
public void run() {
VotingPluginMain.plugin.getAdvancedTab().remove(uuid);
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(uuid);
user.dontCache();
user.logoutRewards();
plugin.getPlaceholders().onLogout(user);
}
});
}
final java.util.UUID uuid = event.getPlayer().getUniqueId();
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
VotingPluginMain.plugin.getAdvancedTab().remove(uuid);
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(uuid);
user.dontCache();
user.logoutRewards();
}
});
}
}
@@ -5,17 +5,19 @@ import java.time.ZoneId;
import java.util.ArrayList;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
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
@@ -24,8 +26,6 @@ import com.bencodez.votingplugin.user.VotingPluginUser;
*/
public class PlayerVoteListener implements Listener {
private static Object object = new Object();
private VotingPluginMain plugin;
/**
@@ -44,20 +44,25 @@ public class PlayerVoteListener implements Listener {
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onplayerVote(PlayerVoteEvent event) {
if (!plugin.isEnabled()) {
plugin.getLogger().warning("Plugin disabled, ignoring vote");
return;
}
String playerName = event.getPlayer();
if (!PlayerUtils.getInstance().isValidUser(playerName, plugin.getConfigFile().isAllowUnJoinedCheckServer())) {
plugin.debug("Processing PlayerVoteEvent: " + playerName + "/" + event.getServiceSite());
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;
}
}
if (playerName.isEmpty()) {
plugin.getLogger().warning("Empty player name for vote");
plugin.getLogger().warning("Empty player name from vote, ignoring");
return;
}
@@ -86,7 +91,7 @@ public class PlayerVoteListener implements Listener {
services.add(site.getServiceSite());
}
plugin.getLogger()
.warning("Current known service sites: " + ArrayUtils.getInstance().makeStringList(services));
.warning("Currently set service sites: " + ArrayUtils.makeStringList(services));
}
return;
}
@@ -100,119 +105,169 @@ public class PlayerVoteListener implements Listener {
if (event.getVotingPluginUser() != null) {
user = event.getVotingPluginUser();
} else {
user = UserManager.getInstance().getVotingPluginUser(playerName);
Player p = Bukkit.getPlayerExact(playerName);
if (p != null) {
// player online
user = plugin.getVotingPluginUserManager().getVotingPluginUser(p);
} else {
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() + " has bypass permission for WaitUntilVoteDelay, bypassing");
} else {
plugin.getLogger().info(user.getPlayerName() + " must wait until votedelay is over, ignoring vote");
return;
}
}
}
synchronized (object) {
// reupdate cache
user.clearCache();
user.cache();
final String uuid = user.getUUID();
user.updateName(true);
// reupdate cache
user.cache();
// vote party
plugin.getVoteParty().vote(user, event.isRealVote(), event.isForceBungee());
user.updateName(true);
if (event.isBroadcast() && !plugin.getBungeeSettings().isDisableBroadcast() ) {
// broadcast vote if enabled in config
if (plugin.getConfigFile().isBroadcastVotesEnabled()
&& (plugin.getBungeeSettings().isBungeeBroadcast() || !event.isBungee())) {
if (!plugin.getConfigFile().getFormatBroadcastWhenOnline() || user.isOnline()) {
voteSite.broadcastVote(user);
}
// vote party
plugin.getVoteParty().vote(user, event.isRealVote(), event.isForceBungee());
if (event.isBroadcast() && !plugin.getBungeeSettings().isDisableBroadcast()) {
// broadcast vote if enabled in config
if (plugin.getConfigFile().isBroadcastVotesEnabled()
&& (plugin.getBungeeSettings().isBungeeBroadcast() || !event.isBungee())) {
if (!plugin.getConfigFile().isFormatBroadcastWhenOnline() || user.isOnline()) {
voteSite.broadcastVote(user);
}
}
}
if (plugin.getBroadcastHandler() != null) {
plugin.getBroadcastHandler().onVote(playerName);
if (plugin.getBroadcastHandler() != null) {
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
if (plugin.getConfigFile().isLogVotesToFile()) {
try {
plugin.logVote(LocalDateTime.now().atZone(ZoneId.systemDefault()).toLocalDateTime(), playerName,
voteSite.getKey());
} catch (Exception e) {
e.printStackTrace();
}
}
// update last vote time
if (event.getTime() != 0) {
user.setTime(voteSite, event.getTime());
} else {
user.setTime(voteSite);
// check first vote rewards
plugin.getSpecialRewards().checkFirstVote(user, event.isForceBungee());
plugin.getSpecialRewards().checkFirstVoteToday(user, event.isForceBungee());
if (user.isReminded() && plugin.getConfigFile().isVoteRemindingRemindOnlyOnce()) {
user.setReminded(false);
}
// check if player has voted on all sites in one day
if (((user.isOnline() || voteSite.isGiveOffline()) && plugin.getOptions().isProcessRewards())
|| event.isBungee()) {
boolean online = true;
if (event.isBungee()) {
online = event.isWasOnline();
}
plugin.getCoolDownCheck().vote(user);
// try logging to file
if (plugin.getConfigFile().isLogVotesToFile()) {
try {
VotingPluginMain.plugin.logVote(
LocalDateTime.now().atZone(ZoneId.systemDefault()).toLocalDateTime(), playerName,
voteSite.getKey());
} catch (Exception e) {
e.printStackTrace();
}
}
// check first vote rewards
plugin.getSpecialRewards().checkFirstVote(user, event.isForceBungee());
plugin.getSpecialRewards().checkFirstVoteToday(user, event.isForceBungee());
if (user.isReminded() && plugin.getConfigFile().getVoteRemindingRemindOnlyOnce()) {
user.setReminded(false);
}
// check if player has voted on all sites in one day
if (((user.isOnline() || voteSite.isGiveOffline())
&& VotingPluginMain.plugin.getOptions().isProcessRewards()) || event.isBungee()) {
boolean online = true;
if (event.isBungee()) {
online = event.isWasOnline();
}
user.playerVote(voteSite, online, false, event.isForceBungee());
user.playerVote(voteSite, online, false, event.isForceBungee());
if (event.getVoteNumber() == 1) {
user.sendVoteEffects(online);
}
if (plugin.getConfigFile().isCloseInventoryOnVote()) {
user.closeInv();
} else {
}
} else {
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()) {
// add to total votes
if ((plugin.getConfigFile().isCountFakeVotes() || event.isRealVote()) && event.isAddTotals()) {
if (plugin.getConfigFile().isAddTotals()) {
if (plugin.getConfigFile().isAddTotalsOffline() || user.isOnline()) {
user.addTotal();
user.addTotalDaily();
user.addTotalWeekly();
}
user.addPoints();
}
user.addPoints();
}
user.checkDayVoteStreak(event.isForceBungee());
user.checkDayVoteStreak(event.isForceBungee());
// other rewards
plugin.getSpecialRewards().checkAllSites(user, event.isForceBungee());
plugin.getSpecialRewards().checkCumualativeVotes(user, event.getBungeeTextTotals(), event.isForceBungee());
plugin.getSpecialRewards().checkMilestone(user, event.getBungeeTextTotals(), event.isForceBungee());
if (plugin.getBungeeSettings().isUseBungeecoord()) {
if (plugin.getBungeeHandler().getMethod().equals(BungeeMethod.MYSQL)) {
final String uuid = user.getUUID();
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
@Override
public void run() {
if (Bukkit.getOnlinePlayers().size() > 0) {
plugin.getPluginMessaging().sendPluginMessage("VoteUpdate", uuid);
}
}
}, 40);
}
if (plugin.getConfigFile().isLimitMonthlyVotes()) {
int value = 0;
if (event.isBungee()) {
value = event.getBungeeTextTotals().getMonthTotal();
} else {
value = user.getTotal(TopVoter.Monthly);
}
if (!user.isOnline()) {
user.clearCache();
LocalDateTime cTime = plugin.getTimeChecker().getTime();
int days = cTime.getDayOfMonth();
if (value >= 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());
plugin.getSpecialRewards().checkCumualativeVotes(user, event.getBungeeTextTotals(), event.isForceBungee());
plugin.getSpecialRewards().checkMilestone(user, event.getBungeeTextTotals(), event.isForceBungee());
plugin.getCoolDownCheck().vote(user, voteSite);
if (plugin.getBungeeSettings().isUseBungeecoord()) {
if (plugin.getBungeeHandler().getMethod().equals(BungeeMethod.MYSQL)) {
plugin.getBukkitScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
@Override
public void run() {
if (Bukkit.getOnlinePlayers().size() > 0) {
plugin.getBungeeHandler().getGlobalMessageHandler().sendMessage("VoteUpdate", uuid);
}
}
}, 2);
}
}
PlayerPostVoteEvent postVoteEvent = new PlayerPostVoteEvent(voteSite, user, event.isRealVote(),
event.isForceBungee(), voteTime);
plugin.getServer().getPluginManager().callEvent(postVoteEvent);
if (user.isOnline()) {
plugin.getPlaceholders().onUpdate(user, true);
}
if (!user.isOnline()) {
user.clearCache();
}
plugin.setUpdate(true);
plugin.extraDebug("Finished vote processing: " + playerName + "/" + uuid);
}
}
@@ -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
@@ -16,7 +15,7 @@ import com.bencodez.votingplugin.VotingPluginMain;
public class SignChange implements Listener {
/** The plugin. */
private static VotingPluginMain plugin;
private VotingPluginMain plugin;
/**
* Instantiates a new sign change.
@@ -24,7 +23,7 @@ public class SignChange implements Listener {
* @param plugin the plugin
*/
public SignChange(VotingPluginMain plugin) {
SignChange.plugin = plugin;
this.plugin = plugin;
}
/**
@@ -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()));
}
}
@@ -2,12 +2,11 @@ package com.bencodez.votingplugin.listeners;
import java.util.ArrayList;
import org.bukkit.Bukkit;
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;
@@ -52,13 +51,6 @@ public class VotiferEvent implements Listener {
// ignore own plugin calls of event
return;
}
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
plugin.getServerData().addServiceSite(voteSite);
}
});
if (voteUsername.length() == 0) {
plugin.getLogger().warning("No name from vote on " + voteSite);
@@ -72,53 +64,75 @@ public class VotiferEvent implements Listener {
plugin.debug("VoteSite: " + voteSite);
plugin.debug("IP: " + IP);
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
plugin.getVoteTimer().submit(new Runnable() {
@Override
public void run() {
try {
plugin.getServerData().addServiceSite(voteSite);
if (plugin.getBungeeSettings().isUseBungeecoord() && !plugin.getBungeeSettings().isVotifierBypass()
&& (plugin.getBungeeHandler().getMethod().equals(BungeeMethod.PLUGINMESSAGING)
|| plugin.getBungeeHandler().getMethod().equals(BungeeMethod.SOCKETS))) {
plugin.getLogger().severe(
"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 matchSite = "";
if (plugin.getConfigFile().isAdvancedServiceSiteHandling()) {
if (plugin.getServiceSiteHandler() != null) {
matchSite = plugin.getServiceSiteHandler().matchReverse(voteSite);
}
}
if (plugin.getBungeeSettings().isUseBungeecoord() && !plugin.getBungeeSettings().isVotifierBypass()
&& (plugin.getBungeeHandler().getMethod().equals(BungeeMethod.PLUGINMESSAGING)
|| plugin.getBungeeHandler().getMethod().equals(BungeeMethod.SOCKETS))) {
plugin.getLogger().severe(
"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 voteSiteNameStr = plugin.getVoteSiteName(false, voteSite, matchSite);
ArrayList<String> sites = plugin.getConfigVoteSites().getVoteSitesNames(false);
boolean createSite = false;
if (sites != null) {
if (!sites.contains(voteSiteNameStr)) {
ArrayList<String> sites = plugin.getConfigVoteSites().getVoteSitesNames(false);
boolean createSite = false;
if (sites != null) {
if (!ArrayUtils.containsIgnoreCase(sites, voteSiteNameStr)) {
createSite = true;
}
} else {
createSite = true;
}
} else {
createSite = true;
}
if (plugin.getConfigFile().isAutoCreateVoteSites() && createSite) {
plugin.getLogger().warning("VoteSite with service site '" + voteSiteNameStr
+ "' does not exist, attempting to generaterate...");
plugin.getConfigVoteSites().generateVoteSite(voteSiteNameStr);
String serviceSite = voteSite;
plugin.getLogger().info("Current known service sites: "
+ ArrayUtils.getInstance().makeStringList(plugin.getServerData().getServiceSites()));
}
if (plugin.getConfigFile().isAutoCreateVoteSites() && createSite) {
plugin.getLogger().warning("VoteSite with service site '" + voteSiteNameStr
+ "' does not exist, attempting to generate...");
plugin.getConfigVoteSites().generateVoteSite(voteSiteNameStr);
String voteSiteName = plugin.getVoteSiteName(true, voteSite);
plugin.getLogger().info("Current known service sites: "
+ ArrayUtils.makeStringList(plugin.getServerData().getServiceSites()));
}
PlayerVoteEvent voteEvent = new PlayerVoteEvent(plugin.getVoteSite(voteSiteName, true), voteUsername,
voteSite, true);
plugin.getServer().getPluginManager().callEvent(voteEvent);
if (plugin.getTimeChecker().isActiveProcessing()
&& plugin.getConfigFile().isQueueVotesDuringTimeChange()) {
// time change in progress
plugin.debug("Adding vote to time queue " + voteUsername + "/" + voteSite);
plugin.getTimeQueueHandler().addVote(voteUsername, voteSite);
if (voteEvent.isCancelled()) {
plugin.debug("Vote cancelled");
return;
return;
}
String voteSiteName = plugin.getVoteSiteName(true, serviceSite, matchSite);
PlayerVoteEvent voteEvent = new PlayerVoteEvent(plugin.getVoteSite(voteSiteName, true),
voteUsername, voteSite, true);
plugin.getServer().getPluginManager().callEvent(voteEvent);
if (voteEvent.isCancelled()) {
plugin.debug("Vote cancelled");
return;
}
} catch (Exception e) {
plugin.getLogger().severe("Error occured during vote processing");
e.printStackTrace();
}
}
});
}
}
@@ -14,7 +14,7 @@ import com.bencodez.votingplugin.VotingPluginMain;
public class VotingPluginUpdateEvent implements Listener {
/** The plugin. */
private static VotingPluginMain plugin;
private VotingPluginMain plugin;
/**
* Instantiates a new advanced core update event.
@@ -22,7 +22,7 @@ public class VotingPluginUpdateEvent implements Listener {
* @param plugin the plugin
*/
public VotingPluginUpdateEvent(VotingPluginMain plugin) {
VotingPluginUpdateEvent.plugin = plugin;
this.plugin = plugin;
}
/**
@@ -10,14 +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.advancedcore.api.rewards.RewardHandler;
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;
@@ -66,7 +65,7 @@ public class VoteSite {
@Getter
@Setter
private double timeOffSet;
private int voteDelayDailyHour;
@Getter
@Setter
@@ -108,6 +107,11 @@ public class VoteSite {
return;
}
if (!user.isVanished()) {
String playerName = user.getPlayerName();
if (plugin.getConfigFile().getVotingBroadcastBlacklist().contains(playerName)) {
plugin.getLogger().info("Not broadcasting for " + playerName + ", in blacklist");
return;
}
if (checkBungee && plugin.getBungeeSettings().isBungeeBroadcast()
&& plugin.getBungeeSettings().isUseBungeecoord()) {
if (plugin.getBungeeHandler().getMethod().equals(BungeeMethod.SOCKETS)) {
@@ -123,23 +127,20 @@ public class VoteSite {
}
} else {
String playerName = user.getPlayerName();
if (plugin.getConfigFile().getVotingBroadcastBlacklist().contains(playerName)) {
plugin.getLogger().info("Not broadcasting for " + playerName + ", in blacklist");
return;
}
String bc = StringParser.getInstance().colorize(plugin.getConfigFile().getFormatBroadCastMsg());
String bc = MessageAPI.colorize(plugin.getConfigFile().getFormatBroadCastMsg());
HashMap<String, String> placeholders = new HashMap<String, String>();
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);
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<Player>();
for (Player p : Bukkit.getOnlinePlayers()) {
if (!UserManager.getInstance().getVotingPluginUser(p).getDisableBroadcast()) {
if (!plugin.getVotingPluginUserManager().getVotingPluginUser(p).getDisableBroadcast()) {
players.add(p);
}
}
@@ -173,7 +174,8 @@ public class VoteSite {
}
public String getVoteURL(boolean json) {
if (!plugin.getConfigFile().isFormatCommandsVoteForceLinks() || !json) {
if (!plugin.getConfigFile().isFormatCommandsVoteForceLinks() || !json
|| MessageAPI.containsJson(voteURL)) {
return voteURL;
} else {
if (!voteURL.startsWith("http")) {
@@ -184,8 +186,8 @@ public class VoteSite {
}
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;
@@ -209,7 +211,7 @@ public class VoteSite {
}
public boolean hasRewards() {
return RewardHandler.getInstance().hasRewards(plugin.getConfigVoteSites().getData(),
return plugin.getRewardHandler().hasRewards(plugin.getConfigVoteSites().getData(),
plugin.getConfigVoteSites().getRewardsPath(key));
}
@@ -231,13 +233,28 @@ 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);
}
public boolean isVaidServiceSite() {
return ArrayUtils.getInstance().containsIgnoreCase(plugin.getServerData().getServiceSites(), getServiceSite());
return ArrayUtils.containsIgnoreCase(plugin.getServerData().getServiceSites(), getServiceSite());
}
public String loadingDebug() {
String str = "Loading votesite key: " + key;
str += ", Displayname: " + displayName;
str += ", VoteDelay: " + getVoteDelay();
str += ", VoteDelayMin: " + getVoteDelayMin();
str += ", VoteDelayDaily: " + isVoteDelayDaily();
str += ", IsWaitUntilVoteDelay: " + isWaitUntilVoteDelay();
str += ", ServiceSite: " + getServiceSite();
str += ", VoteDelayDailyHour:" + getVoteDelayDailyHour();
str += ", Url: " + getVoteURL();
str += ", IgnoreCanVote: " + isIgnoreCanVote();
str += ", Hidden: " + isHidden();
return str;
}
}
@@ -2,9 +2,9 @@ package com.bencodez.votingplugin.placeholders;
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;
@@ -40,13 +40,13 @@ 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(event.getOfflinePlayer(), user,
return place.placeholderRequest(user,
event.getPlaceholder().substring("VotingPlugin_".length()));
}
@@ -55,7 +55,7 @@ public class MVdWPlaceholders {
}
for (final PlaceHolder<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,
@@ -63,7 +63,7 @@ public class MVdWPlaceholders {
@Override
public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
return place.placeholderRequest(event.getOfflinePlayer(), null,
return place.placeholderRequest(
event.getPlaceholder().substring("VotingPlugin_".length()));
}
File diff suppressed because it is too large. Load diff
Loaded 100 of 117 files, more files were not shown because too many files have changed in this diff. Show more