Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8fd206b119 | ||
|
|
9c6e514234 | ||
|
|
eb66ccb90d | ||
|
|
c004dc6106 | ||
|
|
f54ccbd7b2 | ||
|
|
8cdd0b713b | ||
|
|
2562e749db | ||
|
|
1a1e5d84bb | ||
|
|
d4d23035e3 | ||
|
|
5e334e4a8a | ||
|
|
22991efccf | ||
|
|
5341fbc3ba | ||
|
|
2e0fbd01e6 | ||
|
|
d1d395d9b3 | ||
|
|
9aeedac2ad | ||
|
|
265ed68e0f | ||
|
|
b73daaf917 | ||
|
|
39d8e414f4 | ||
|
|
693541dd00 | ||
|
|
5dce8031c5 | ||
|
|
babef8ccf3 | ||
|
|
7a881206ca | ||
|
|
aed8ecca26 | ||
|
|
25dab3157a | ||
|
|
81d8b535ee | ||
|
|
c94802a141 | ||
|
|
85e31f8292 | ||
|
|
da642cb3b2 | ||
|
|
96c707eca4 | ||
|
|
ce5c469637 | ||
|
|
4126c4a7a1 | ||
|
|
fb430a930b | ||
|
|
2c6f8c79c2 | ||
|
|
1b94f23ff2 | ||
|
|
72c0a88fc1 | ||
|
|
e532987c6a | ||
|
|
2168d92b12 | ||
|
|
d68758f34e | ||
|
|
e1b7844501 | ||
|
|
01b6ed185b | ||
|
|
3ee31012ce | ||
|
|
ba312961b8 | ||
|
|
a2484969ee | ||
|
|
470196741c | ||
|
|
2abce5ebe7 | ||
|
|
20f775c119 | ||
|
|
e0821ed2b1 | ||
|
|
6fbcc89fc8 | ||
|
|
11f86194b0 | ||
|
|
46c112d2ea | ||
|
|
0269578e5e | ||
|
|
fc14b19d9f | ||
|
|
9c25f848c6 | ||
|
|
b7f53aabfb | ||
|
|
926a009085 | ||
|
|
f0737861de | ||
|
|
8e14a92813 | ||
|
|
78fc8069b3 | ||
|
|
eed98ed638 | ||
|
|
f3653c20f6 | ||
|
|
675f4bb6e9 | ||
|
|
4dbb8b7360 | ||
|
|
5040ee2946 | ||
|
|
d7e1408c30 | ||
|
|
73fda9027a | ||
|
|
b762c6000f | ||
|
|
16dcd85807 | ||
|
|
d9b5fcf250 | ||
|
|
b85f49010b | ||
|
|
42b64b86bd | ||
|
|
266014cbe2 | ||
|
|
1e27e28a33 | ||
|
|
1c530c18ce | ||
|
|
c2ebd2251e | ||
|
|
c2fb84dc61 | ||
|
|
39e21bffe7 | ||
|
|
226b6eb01e | ||
|
|
76a40fd889 | ||
|
|
32f43e7713 | ||
|
|
601e57572f | ||
|
|
4a8bd40a8b | ||
|
|
8294e99eeb | ||
|
|
162e7f7faa | ||
|
|
7463074b5a | ||
|
|
bbec19d5c9 | ||
|
|
72ed4223c4 | ||
|
|
603656248b | ||
|
|
4455a0254f | ||
|
|
3227c47d9b | ||
|
|
bf6885875f | ||
|
|
72934d1286 | ||
|
|
2a4840814d | ||
|
|
8b8e8acbc8 | ||
|
|
a4ff2d8dcf | ||
|
|
a6ca0c8121 | ||
|
|
f3e88859d3 | ||
|
|
7249159ec9 | ||
|
|
61c3eccb19 | ||
|
|
4ec800c83e | ||
|
|
20e42b0ae7 | ||
|
|
d95becce22 | ||
|
|
04fd38a10d | ||
|
|
a30b2319f5 | ||
|
|
a1b08f6dd0 | ||
|
|
614193716f | ||
|
|
b68ac4cdd5 | ||
|
|
3767ca2883 | ||
|
|
73b7abf3e6 | ||
|
|
285719ae28 | ||
|
|
22fd1ac1e4 | ||
|
|
6127a2ab23 | ||
|
|
0054b6e06f | ||
|
|
b0f1e0bcb6 | ||
|
|
ddd0dba728 | ||
|
|
9595164f69 | ||
|
|
66092ba3fd | ||
|
|
5c41c7f4c9 | ||
|
|
dfa772af4b | ||
|
|
78f33661aa | ||
|
|
45f2bb2c72 | ||
|
|
f20c7a58ac | ||
|
|
4d1b37c37b | ||
|
|
d323cd7691 | ||
|
|
67fc73b530 | ||
|
|
13872fd9d1 | ||
|
|
a76da52a0a | ||
|
|
36fabe10a6 | ||
|
|
eada7af420 | ||
|
|
63fc7d64be | ||
|
|
0ed5b12f8b | ||
|
|
504f9edbb2 | ||
|
|
8060ece2eb | ||
|
|
254442fa2e | ||
|
|
febead9d5a | ||
|
|
d8cd0c278d | ||
|
|
fe0d7cd671 | ||
|
|
c9d8878bb3 | ||
|
|
0f450e9b60 | ||
|
|
667d0b544e | ||
|
|
6e1e6bd928 | ||
|
|
1cfc447445 | ||
|
|
6d3e68e548 | ||
|
|
855dde196e | ||
|
|
d5a9e1012a | ||
|
|
f5d67833b2 | ||
|
|
a1eb2f63e5 | ||
|
|
a882b8d86f | ||
|
|
0a745ae4c0 | ||
|
|
d38a0549d3 | ||
|
|
6e6394f1fb | ||
|
|
ce58e12740 | ||
|
|
2411354a5f | ||
|
|
13efd0c482 | ||
|
|
8fce74f30d | ||
|
|
3f54c05f86 | ||
|
|
dd1cf02c49 | ||
|
|
b462373dfc | ||
|
|
c6e5d008d2 | ||
|
|
9a91561304 | ||
|
|
1c6981e538 | ||
|
|
b6e366ff9d | ||
|
|
ca0fbe7e3b | ||
|
|
27d8b3e718 | ||
|
|
8430609d0f | ||
|
|
8fe5e87999 | ||
|
|
6b985e19c2 | ||
|
|
4636cc78b2 | ||
|
|
8c66b50749 | ||
|
|
7f6e95d47e | ||
|
|
cd60ade45f | ||
|
|
f82945b97b | ||
|
|
a3e9651378 | ||
|
|
a764ca0ed7 | ||
|
|
d21464560a | ||
|
|
88c5dc7c86 | ||
|
|
b2b2c710c5 | ||
|
|
4175e2d36a | ||
|
|
a84adb367d | ||
|
|
7368158707 | ||
|
|
5d3c1cb553 | ||
|
|
cb1206db0b | ||
|
|
03396e447f | ||
|
|
6dec0826af | ||
|
|
f443f77dfe | ||
|
|
5c4636d8c2 | ||
|
|
51c6c4066b | ||
|
|
161fc6da95 | ||
|
|
aba23f355e | ||
|
|
ac78b4d350 | ||
|
|
0c01f8d3c1 | ||
|
|
77dc7d51f5 | ||
|
|
ee5c4db0c9 | ||
|
|
f9b47c5c63 | ||
|
|
d7dc82b1a7 | ||
|
|
c5041edd8a | ||
|
|
d52b7f85b3 | ||
|
|
3e4564578a | ||
|
|
65312cd2a1 | ||
|
|
b2db9675ca | ||
|
|
0a66c2dd7e | ||
|
|
7c02cb91f4 | ||
|
|
3a390659cd | ||
|
|
99bd32c8f5 | ||
|
|
de894a98b2 | ||
|
|
8c668289ce | ||
|
|
95e850cb84 | ||
|
|
d2134abc45 | ||
|
|
3316662889 | ||
|
|
5b3ced6ca9 | ||
|
|
50a5169543 | ||
|
|
c8d5e2f4b5 | ||
|
|
3dcd78e4f5 | ||
|
|
de570574c9 | ||
|
|
116eda2866 | ||
|
|
30f1576510 | ||
|
|
64e897615a | ||
|
|
2dfd8dcfa5 | ||
|
|
00791766f1 | ||
|
|
4d2c783d85 | ||
|
|
19f1664662 | ||
|
|
ca2e6fb530 | ||
|
|
eca7c6641a | ||
|
|
47fe6b57e2 | ||
|
|
911819c69b | ||
|
|
cda72b5c5b | ||
|
|
75a3da98fa | ||
|
|
ced74fdee3 | ||
|
|
b8460ff755 | ||
|
|
50bb1facc4 | ||
|
|
5ed21949e1 | ||
|
|
253e4937db | ||
|
|
192685ceec | ||
|
|
16de063e51 | ||
|
|
1d3ce9ed64 | ||
|
|
d357c927c8 | ||
|
|
1143595238 | ||
|
|
0917c36889 | ||
|
|
c113214ae0 | ||
|
|
b2c444d125 | ||
|
|
78fdce0eab | ||
|
|
feff09eccb | ||
|
|
d0646472bf | ||
|
|
8471f50402 | ||
|
|
621450dae4 | ||
|
|
84e415e4bc | ||
|
|
54bbc8c740 | ||
|
|
7b1ab7e833 | ||
|
|
acb8f8a43f | ||
|
|
279759b52f | ||
|
|
02ca0b1fc8 | ||
|
|
d57e3d1006 | ||
|
|
d54769eb82 | ||
|
|
35f6a3df15 | ||
|
|
46b66466ba | ||
|
|
53fbe4e5e2 | ||
|
|
53ef7a7086 | ||
|
|
b0e08721fa | ||
|
|
29dad6ca25 | ||
|
|
7c3e5eb09b | ||
|
|
a7776ec97c | ||
|
|
d598082c0a | ||
|
|
4539b5b22a | ||
|
|
02fe645d1e | ||
|
|
ee8af6a314 | ||
|
|
a4b78c7d16 | ||
|
|
d22fe462e5 | ||
|
|
c19182a2b4 | ||
|
|
6905c3988b | ||
|
|
23be120adc | ||
|
|
dae863f88f | ||
|
|
d12f73d2fa | ||
|
|
316ee90713 | ||
|
|
1495fad96f | ||
|
|
8e0de1709b | ||
|
|
ad22802e10 | ||
|
|
6de0345f06 | ||
|
|
7338a7d8ba | ||
|
|
3ca12f2c91 | ||
|
|
262e7c48c7 | ||
|
|
0b62d99f9d | ||
|
|
ea30de47d1 | ||
|
|
a76daf3aba | ||
|
|
e1ff13f4bf | ||
|
|
12f941cf83 | ||
|
|
243377a76a | ||
|
|
d7eab03860 | ||
|
|
ddd1f473f1 | ||
|
|
3e52bb0936 | ||
|
|
eb60220b1e | ||
|
|
00902bd597 | ||
|
|
d3606088cd | ||
|
|
ef2512e4e2 | ||
|
|
7f95a1c7c3 | ||
|
|
68a2fe27ff | ||
|
|
b05317c460 | ||
|
|
62fee6f347 | ||
|
|
ef7d4254e1 | ||
|
|
b6720ccc1f | ||
|
|
69d3d33008 | ||
|
|
7a193c87a9 | ||
|
|
f2cf2fb734 | ||
|
|
836079b5ea | ||
|
|
a7f6456480 | ||
|
|
82f25c3899 | ||
|
|
cb2cdbd4fc | ||
|
|
40d2b651a8 | ||
|
|
a999d9e9bb | ||
|
|
b144f2db9c | ||
|
|
24060a10ed | ||
|
|
4c8919804f | ||
|
|
66618260bb | ||
|
|
f441ede6b0 | ||
|
|
593ae76354 | ||
|
|
aa49dc5bc1 | ||
|
|
8941d909ca | ||
|
|
2946792dec | ||
|
|
0567f0ac66 | ||
|
|
fe78992477 | ||
|
|
195e1c82bd | ||
|
|
9479fe06c0 | ||
|
|
0807caed98 | ||
|
|
9fdcf5aa78 | ||
|
|
8d26e66dc0 | ||
|
|
14e61ba6bf | ||
|
|
6d361cc83f | ||
|
|
1e32fd65e0 | ||
|
|
5f0d8fff2f | ||
|
|
0d828a99bc | ||
|
|
0e8bd23784 | ||
|
|
a8af2a49ad | ||
|
|
54b08019ec | ||
|
|
27f01a6c3a | ||
|
|
337aab384f | ||
|
|
a94e1c1dd6 | ||
|
|
1445d97ce0 | ||
|
|
9e8abe0768 | ||
|
|
ca92a76b15 | ||
|
|
637c8a158b | ||
|
|
85b1ed9916 | ||
|
|
389c9a138e | ||
|
|
7dc5c32db3 | ||
|
|
dcc1e375a9 | ||
|
|
176373e2a4 | ||
|
|
2cd7d5db00 | ||
|
|
05fc747557 | ||
|
|
528ca45b26 | ||
|
|
b4b420479e | ||
|
|
10a44f5999 | ||
|
|
03f012eef4 | ||
|
|
e302c29a9e | ||
|
|
9d7454f9c3 | ||
|
|
0731288028 | ||
|
|
bb061c400f | ||
|
|
0ef664efcd | ||
|
|
0a6c64f9a1 | ||
|
|
3fd328ed91 | ||
|
|
4923ca6f64 | ||
|
|
7e88e4350d | ||
|
|
04ea20b2c2 | ||
|
|
8491e2e45b | ||
|
|
88c1d91675 | ||
|
|
c45c9dc970 | ||
|
|
63807f2617 | ||
|
|
bfeb112774 | ||
|
|
d45119ccca | ||
|
|
7d5f64636b | ||
|
|
fbb61808ba | ||
|
|
800c89f240 | ||
|
|
20cc999f0d | ||
|
|
3604abb307 | ||
|
|
4b56d642e5 | ||
|
|
81f0d46aea | ||
|
|
a2f7336b53 | ||
|
|
38ae2c32dc | ||
|
|
d6b2d21e7c | ||
|
|
83bcae4a59 | ||
|
|
b9c862580b | ||
|
|
c30f725ed2 | ||
|
|
ca8eb546a5 | ||
|
|
0335608162 | ||
|
|
593899a434 | ||
|
|
8eb8d746d9 | ||
|
|
b8ef63c9ba | ||
|
|
dfb8610489 | ||
|
|
3801059cf6 | ||
|
|
2b3aea7f83 | ||
|
|
af42aa4b50 | ||
|
|
2d2b35522e | ||
|
|
2a586324d4 | ||
|
|
5bd9c926ba | ||
|
|
e76c30fca2 | ||
|
|
e42bd3725a | ||
|
|
660c8d9501 | ||
|
|
44a65bc347 | ||
|
|
f3d27f4816 | ||
|
|
4c3891fa0a | ||
|
|
5072265549 | ||
|
|
788b58f9cd | ||
|
|
0db34f815f | ||
|
|
900237b7ea | ||
|
|
7fa7c2baf9 | ||
|
|
eec8d706ee | ||
|
|
d292ae4a18 | ||
|
|
f7d04f87db | ||
|
|
59e2f3da99 | ||
|
|
2a5b6c23da | ||
|
|
62560be2ab | ||
|
|
64993b8b53 | ||
|
|
18c4cd6b6d | ||
|
|
35e14f7a76 | ||
|
|
5c6490159b | ||
|
|
29f0c19a74 | ||
|
|
664500d61b | ||
|
|
e208cdf49b | ||
|
|
e295795ec4 | ||
|
|
c9d24b5e88 | ||
|
|
f09311e6fc | ||
|
|
02ea389f12 | ||
|
|
14ccfa3730 | ||
|
|
51ffe88557 | ||
|
|
7daa0545f3 | ||
|
|
ef7b9cb55a | ||
|
|
a410567de0 | ||
|
|
f00aeab649 | ||
|
|
a4494fc2e7 | ||
|
|
6333760508 | ||
|
|
012547f950 | ||
|
|
631d9c9a1c | ||
|
|
a61e3176a8 | ||
|
|
c013835725 | ||
|
|
ea8ed1e950 | ||
|
|
7dcb3a5f62 | ||
|
|
ed70727a76 | ||
|
|
3418d461e4 | ||
|
|
1e5ec8226a | ||
|
|
993fa19f85 | ||
|
|
7d3d777cb5 | ||
|
|
9829864a96 | ||
|
|
eec87f642f | ||
|
|
9cba16814a | ||
|
|
44ebd17356 | ||
|
|
ba2312ed46 | ||
|
|
2d8f9e1ca1 | ||
|
|
7556a203c2 | ||
|
|
67b8fbcc88 | ||
|
|
4c9f7f76b9 | ||
|
|
df388ca0e3 | ||
|
|
1d8fc309ff | ||
|
|
42a159ea82 | ||
|
|
a62187e0cb | ||
|
|
7896b2f08a | ||
|
|
034d031d79 | ||
|
|
e228fd6fed | ||
|
|
baa85d7222 | ||
|
|
5fd2d976a2 | ||
|
|
03ac8627df | ||
|
|
63d6f2829c | ||
|
|
9824a891b6 | ||
|
|
a648074757 | ||
|
|
5e3a3621bc | ||
|
|
01a645083f | ||
|
|
8b9aced63c | ||
|
|
6eba6aee3b | ||
|
|
0fbbaaee5d | ||
|
|
57e973b371 | ||
|
|
c93f8f06f2 | ||
|
|
6a742dbecc | ||
|
|
c3edbf946c | ||
|
|
24fcd076b8 | ||
|
|
a6ac022cb3 | ||
|
|
363c57158f | ||
|
|
d22e22480e | ||
|
|
daf1d95c82 | ||
|
|
35d588477d | ||
|
|
2ba3ee0323 | ||
|
|
ed1ccc0623 | ||
|
|
2332079002 | ||
|
|
3b7f8afe76 | ||
|
|
4c33f3d03c | ||
|
|
cfd317f5a8 | ||
|
|
063b44aa67 | ||
|
|
a42c00ecf5 | ||
|
|
9e36f0a500 | ||
|
|
f13386ad29 |
No files matched your search
@@ -2,30 +2,25 @@
|
||||
Plugin on SpigotMC
|
||||
https://www.spigotmc.org/resources/votingplugin.15358/
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## License
|
||||
### Creative Commons Arttribution 3.0 Unported
|
||||
https://github.com/Ben12345rocks/VotingPlugin/blob/master/VotingPlugin/Resources/LICENSE.txt
|
||||
https://github.com/BenCodez/VotingPlugin/blob/master/VotingPlugin/Resources/LICENSE.txt
|
||||
|
||||
### Maven:
|
||||
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
<id>BenCodez Repo</id>
|
||||
<url>https://nexus.bencodez.com/repository/maven-public/</url>
|
||||
</repository>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.BenCodez</groupId>
|
||||
<artifactId>VotingPlugin</artifactId>
|
||||
<groupId>com.bencodez</groupId>
|
||||
<artifactId>votingplugin</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependency>
|
||||
|
||||
Versions:
|
||||
LATEST - latest stable release
|
||||
BRANCH-SNAPHSOT - unstable builds
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="Resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
@@ -1,3 +1,7 @@
|
||||
/bin/
|
||||
/target/
|
||||
/doc/
|
||||
/doc/
|
||||
/.idea/
|
||||
/*.iml
|
||||
/.settings/
|
||||
/.classpath
|
||||
@@ -1,7 +0,0 @@
|
||||
add_todo=false
|
||||
eclipse.preferences.version=1
|
||||
include_subpackages=true
|
||||
mode=mode_replace
|
||||
project_specific_settings=true
|
||||
replacements=<?xml version\="1.0" standalone\="yes"?>\n\n<replacements>\n<replacement key\="get" scope\="1" mode\="0">Gets the</replacement>\n<replacement key\="set" scope\="1" mode\="0">Sets the</replacement>\n<replacement key\="add" scope\="1" mode\="0">Adds the</replacement>\n<replacement key\="edit" scope\="1" mode\="0">Edits the</replacement>\n<replacement key\="remove" scope\="1" mode\="0">Removes the</replacement>\n<replacement key\="init" scope\="1" mode\="0">Inits the</replacement>\n<replacement key\="parse" scope\="1" mode\="0">Parses the</replacement>\n<replacement key\="create" scope\="1" mode\="0">Creates the</replacement>\n<replacement key\="build" scope\="1" mode\="0">Builds the</replacement>\n<replacement key\="is" scope\="1" mode\="0">Checks if is</replacement>\n<replacement key\="print" scope\="1" mode\="0">Prints the</replacement>\n<replacement key\="has" scope\="1" mode\="0">Checks for</replacement>\n</replacements>\n\n
|
||||
use_internal_formatter=true
|
||||
@@ -1,4 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=Cp1252
|
||||
encoding/Resources=Cp1252
|
||||
encoding/src=Cp1252
|
||||
@@ -1,30 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.doc.comment.support=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
@@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
|
||||
@@ -1,4 +0,0 @@
|
||||
activeProfiles=dev
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
||||
@@ -1,3 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
project.repository.kind=github
|
||||
project.repository.url=http\://github.com/Ben12345rocks/VotingPlugin
|
||||
@@ -1,8 +0,0 @@
|
||||
DELEGATES_PREFERENCE=delegateValidatorList
|
||||
USER_BUILD_PREFERENCE=enabledBuildValidatorList
|
||||
USER_MANUAL_PREFERENCE=enabledManualValidatorList
|
||||
USER_PREFERENCE=overrideGlobalPreferencesfalse
|
||||
eclipse.preferences.version=1
|
||||
override=false
|
||||
suspend=false
|
||||
vf.version=3
|
||||
@@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.jboss.ide.eclipse.as.core.singledeployable.deployableList=\n
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,18 +1,18 @@
|
||||
# --------------------------
|
||||
##########################################
|
||||
# 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/Ben12345rocks/VotingPlugin/wiki/Bungeecoord-Setups
|
||||
# https://github.com/BenCodez/VotingPlugin/wiki/Bungeecord-Setups
|
||||
# Available:
|
||||
# SOCKETS
|
||||
# PLUGINMESSAGING
|
||||
# PLUGINMESSAGING (Recommended)
|
||||
# MYSQL
|
||||
BungeeMethod: PLUGINMESSAGING
|
||||
|
||||
@@ -29,12 +29,21 @@ BungeeBroadcast: false
|
||||
# Whether to broadcast on cached votes
|
||||
BungeeBroadcastAlways: false
|
||||
|
||||
# If true, the server won't broadcast votes
|
||||
# To be used in conjuction with Broadcast setting on bungee
|
||||
DisableBroadcast: false
|
||||
|
||||
# If true, offline rewards will be stored per server, rather than global
|
||||
# This shouldn't need to be set unless you get alot of cross server rewards issues
|
||||
# You can also specify the server within the rewards
|
||||
# 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,18 +56,55 @@ TriggerVotifierEvent: false
|
||||
# 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
|
||||
+292
-223
@@ -1,10 +1,14 @@
|
||||
# VotingPlugin by Ben12345rocks
|
||||
# VotingPlugin by BenCodez
|
||||
# Main Config
|
||||
# See wiki for help:
|
||||
# https://github.com/Ben12345rocks/VotingPlugin/wiki
|
||||
# https://github.com/BenCodez/VotingPlugin/wiki
|
||||
# Config is sorted in sections
|
||||
# Use Control + F to search with Notepad++
|
||||
#
|
||||
|
||||
|
||||
###########################################
|
||||
# User storage
|
||||
###########################################
|
||||
# Valid Options:
|
||||
# - SQLITE
|
||||
# - FLAT
|
||||
@@ -22,87 +26,52 @@ 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
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Mysql cache options
|
||||
# Clearing cache forces the plugin to pull from database
|
||||
# Not needed unless you are using multiple servers
|
||||
# If using a bungee setup most of these options are overriden automatically
|
||||
# ---------------------------------------------------------
|
||||
#MaxLifeTime: -1
|
||||
#Additional info on connection string
|
||||
#Line: ''
|
||||
#Attempt to use mariadb driver
|
||||
#UseMariaDB: false
|
||||
|
||||
# Clear cache on update, setting to true reduces update speed
|
||||
# Also may require AlwaysUpdate set to true
|
||||
ClearCacheOnUpdate: false
|
||||
|
||||
# Clear cache on player join always
|
||||
ClearCacheOnJoin: false
|
||||
|
||||
# Clears cache for the player who voted only
|
||||
# Only effects if using mysql
|
||||
# Would recommend for some bungee setups
|
||||
ClearCacheOnVote: false
|
||||
|
||||
# Clear cache when player leaves
|
||||
ClearCacheOnLeave: false
|
||||
|
||||
ClearCacheOnVoteShopPurchase: true
|
||||
|
||||
# --------------------
|
||||
# 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
|
||||
# as long as vote delays are done properly
|
||||
# as long as vote delays are done properly in votesites.yml
|
||||
VoteReminding:
|
||||
# Enable vote reminding
|
||||
# This will remind player when he can vote on all sites
|
||||
# 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"
|
||||
Enabled: true
|
||||
|
||||
# Will remind player on login if he can vote
|
||||
RemindOnLogin: true
|
||||
|
||||
# Whether or not to remind only once when the player can vote
|
||||
# Does not apply to login reminds.
|
||||
RemindOnlyOnce: true
|
||||
|
||||
# Will remind player on login if he can vote
|
||||
# Ignores value above
|
||||
RemindOnLogin: true
|
||||
|
||||
# Delay to remind votes in minutes
|
||||
# Only works if above is false
|
||||
# Set to -1 to disable
|
||||
RemindDelay: 30
|
||||
|
||||
# Run reward files on remind
|
||||
# By default, the reward file will be created for you
|
||||
# Run rewards
|
||||
# and have the default message
|
||||
# Edit the message at AdvancedCore/Rewards/Remind.yml (or any other reward listed)
|
||||
# Can add titles and more in the reward file
|
||||
# Can add titles and more in the reward
|
||||
# This can also be edited via /av gui
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aRemember to vote!'
|
||||
Player: '&aYou have %sitesavailable% sites to vote on still!'
|
||||
Title:
|
||||
Enabled: false
|
||||
Title: '&cRemember to vote!'
|
||||
@@ -114,9 +83,9 @@ VoteReminding:
|
||||
Message: '&cRemember to vote'
|
||||
Delay: 30
|
||||
|
||||
# ------------------------------------------------
|
||||
# Format
|
||||
# ------------------------------------------------
|
||||
###########################################
|
||||
# Format options
|
||||
###########################################
|
||||
|
||||
# Common PlacesHolders:
|
||||
# Special PlaceHolders will be commented where available
|
||||
@@ -132,7 +101,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
|
||||
@@ -140,6 +113,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
|
||||
@@ -231,6 +206,9 @@ Format:
|
||||
Title: '&6&lVoting Player Help'
|
||||
# Format for help message in /v help
|
||||
Line: '&6%Command% - &6%HelpMessage%'
|
||||
# Hover color for help message
|
||||
# Hex format: #HEXCOLOR
|
||||
HoverColor: AQUA
|
||||
# Require permission to see command in /v help or /av help
|
||||
RequirePermission: true
|
||||
|
||||
@@ -271,6 +249,10 @@ Format:
|
||||
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
|
||||
@@ -339,11 +321,19 @@ Format:
|
||||
Weekly: 'Weekly'
|
||||
Monthly: 'Monthly'
|
||||
AllTime: 'AllTime'
|
||||
|
||||
# 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
|
||||
@@ -371,7 +361,7 @@ LoadTopVoter:
|
||||
|
||||
# Maxium number of players to show on top voter
|
||||
# Set to -1 for no limit
|
||||
MaxiumNumberOfTopVotersToLoad: -1
|
||||
MaxiumNumberOfTopVotersToLoad: 1000
|
||||
|
||||
# When top voter awards are given (even if there are none listed) it will store top voters
|
||||
# Files will created in TopVoters folder.
|
||||
@@ -379,109 +369,13 @@ MaxiumNumberOfTopVotersToLoad: -1
|
||||
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
|
||||
@@ -503,16 +397,70 @@ 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:
|
||||
# AUTO - Auto cache after they have been used (Recommended)
|
||||
# SPECIFIC - Only cache certain placeholders
|
||||
# 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
|
||||
|
||||
###########################################
|
||||
# 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
|
||||
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
|
||||
@@ -523,6 +471,97 @@ DisableNoServiceSiteMessage: false
|
||||
# If true fake votes will give points and totals
|
||||
CountFakeVotes: true
|
||||
|
||||
# Whether or not to disable update checks
|
||||
DisableUpdateChecking: false
|
||||
|
||||
# Enable per site cooldown events, requires more resources to use
|
||||
# Requires restart
|
||||
PerSiteCoolDownEvents: false
|
||||
|
||||
# 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
|
||||
|
||||
# Set this to false to disable the plugin adding totals
|
||||
# Not really recommended
|
||||
AddTotals: true
|
||||
|
||||
# If false, votestreaks will be disabled
|
||||
UseVoteStreaks: true
|
||||
|
||||
# If false, storing best totals will be disabled
|
||||
UseHighestTotals: true
|
||||
|
||||
# Enable Geyser prefix support
|
||||
# Geyser support is hit or miss currently
|
||||
# May work best if players vote with prefix
|
||||
GeyserPrefixSupport: false
|
||||
GeyserPrefix: '*'
|
||||
|
||||
# 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
|
||||
|
||||
# If false plugin will use offline player UUIDs
|
||||
OnlineMode: true
|
||||
|
||||
# Disable checking on world change
|
||||
# May improve performance
|
||||
#DisableCheckOnWorldChange: false
|
||||
|
||||
###########################################
|
||||
# Skull settings
|
||||
###########################################
|
||||
|
||||
# Preload skulls to improve performance for vote top
|
||||
# when using skulls as the item to display players
|
||||
# If false, skulls will be cached as they are used
|
||||
# assuming loadskulls is enabled
|
||||
PreloadSkulls: false
|
||||
|
||||
# Setting to false disables saving skulls in a cache to improve speeds
|
||||
# Will reduce ram usage (very little) if disabled, but slow GUI speeds when using skulls
|
||||
LoadSkulls: true
|
||||
|
||||
###########################################
|
||||
# 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
|
||||
@@ -531,56 +570,17 @@ GiveDefaultPermission: true
|
||||
# Permissions listed here will no be accessible with the default permission
|
||||
DisabledDefaultPermissions: []
|
||||
|
||||
# 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
|
||||
|
||||
# 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
|
||||
|
||||
# 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
|
||||
|
||||
# Allow transfer of vote points between players
|
||||
AllowVotePointTransfers: false
|
||||
|
||||
# Disable this on a hub server for example
|
||||
# Still processes rewards for offline rewards (just won't give any)
|
||||
ProcessRewards: true
|
||||
# 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
|
||||
|
||||
# Wait until user is logged in with AuthMe
|
||||
# Requires AuthMe
|
||||
WaitUntilLoggedIn: true
|
||||
|
||||
# Preload skulls to improve performance
|
||||
# If false, skulls will be cached as they are used
|
||||
PreloadSkulls: false
|
||||
|
||||
# Setting to false disables saving skulls in a cache to improve speeds
|
||||
# Will reduce ram usage if disabled
|
||||
LoadSkulls: true
|
||||
|
||||
# Use vault for permission checks
|
||||
# May not work on some plugins
|
||||
UseVaultPermissions: false
|
||||
@@ -591,26 +591,101 @@ 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
|
||||
|
||||
# Limit number of users to load in a second
|
||||
# Effects background tasks mainly
|
||||
# set to -1 to disable (default value)
|
||||
#PlayerDataLoadLimit: 500
|
||||
|
||||
##########################################
|
||||
# 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: 350
|
||||
SpamClickTime: 150
|
||||
# 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
|
||||
|
||||
###########################################
|
||||
# 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
|
||||
##########################################
|
||||
|
||||
# Options for request api
|
||||
# Current methods:
|
||||
# ANVIL
|
||||
@@ -621,9 +696,3 @@ RequestAPI:
|
||||
DefaultMethod: 'Anvil'
|
||||
DisabledMethods: []
|
||||
|
||||
# Shouldn't need to change this
|
||||
#AutoKillInvs: true
|
||||
|
||||
# Disable checking on world change
|
||||
# May improve performance
|
||||
#DisableCheckOnWorldChange: false
|
||||
@@ -12,6 +12,7 @@ GUIMethod:
|
||||
Last: CHEST #BOOK not available (future update?)
|
||||
Next: CHEST
|
||||
Total: CHEST #BOOK not available (future update?)
|
||||
# GUI for /vote
|
||||
URL: CHEST
|
||||
Best: CHEST #BOOK not available (future update?)
|
||||
Streak: CHEST #BOOK not available (future update?)
|
||||
@@ -78,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:
|
||||
@@ -119,8 +120,10 @@ CHEST:
|
||||
Material: 'EMERALD_BLOCK'
|
||||
Data: 0
|
||||
Amount: 1
|
||||
# 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
|
||||
@@ -136,6 +139,7 @@ CHEST:
|
||||
# %time% = time, using timeformat below
|
||||
# %timesince% = time since vote
|
||||
Line: '&6%timeSince%'
|
||||
ClickableLinks: true
|
||||
VoteNext:
|
||||
Name: 'VoteNext: %player%'
|
||||
BackButton: true
|
||||
@@ -202,6 +206,7 @@ CHEST:
|
||||
Amount: 1
|
||||
VoteBest:
|
||||
Name: 'VoteBest: %player%'
|
||||
BackButton: true
|
||||
DayBest:
|
||||
Item:
|
||||
Material: 'CLOCK'
|
||||
|
||||
@@ -1,23 +1,38 @@
|
||||
# To disable reward set value to []
|
||||
# To disable reward set value to {}
|
||||
# or remove entirely
|
||||
# Eg:
|
||||
# FirstVote: [] (All in one line)
|
||||
# Rewards will be given if there is a reward to give
|
||||
# FirstVote: {} (All in one line)
|
||||
# Rewards will be given if there is a reward to give, otherwise they will be ignored
|
||||
|
||||
# First vote rewards
|
||||
FirstVote:
|
||||
Messages:
|
||||
Player: '&aYou voted for your first time!'
|
||||
|
||||
# First vote of the day reward
|
||||
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
|
||||
@@ -25,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
|
||||
@@ -34,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!'
|
||||
@@ -52,7 +72,7 @@ VoteParty:
|
||||
GiveAllPlayers: false
|
||||
# If true, give online players the vote party reward
|
||||
# Can also use RewardType: ONLINE if you wanted
|
||||
GiveOnlinePlayersOnly: false
|
||||
GiveOnlinePlayersOnly: true
|
||||
# If true, the vote count will reset each day
|
||||
ResetEachDay: false
|
||||
# If true, the vote count will reset each week
|
||||
@@ -61,6 +81,8 @@ VoteParty:
|
||||
ResetMonthly: false
|
||||
# If true, will give voteparty only once per day
|
||||
OnlyOncePerDay: false
|
||||
# If true, will give voteparty once per week only
|
||||
OnlyOncePerWeek: false
|
||||
# Reset extra votes
|
||||
ResetExtraVotesMonthly: false
|
||||
# Count votes from /av vote?
|
||||
@@ -73,7 +95,7 @@ VoteParty:
|
||||
Broadcast: '&cReached the vote party amount!'
|
||||
# List of commands to execute, these only execute once.
|
||||
# %player% does not work here
|
||||
Commands: []
|
||||
GlobalCommands: []
|
||||
# Rewards to give per player
|
||||
Rewards:
|
||||
# Uncomment below for online players to be rewarded only
|
||||
@@ -142,8 +164,10 @@ VoteStreak:
|
||||
Week: 50
|
||||
Month: 50
|
||||
|
||||
# Reward given when vote cooldown ended
|
||||
# Using this is a little memory intensive
|
||||
# Reward given when all votesites are available to vote on
|
||||
# Don't use this unless you really need it
|
||||
# Little performance intensive
|
||||
# Recommend add RewardType: ONLINE for it to only work online
|
||||
VoteCoolDownEndedReward: []
|
||||
|
||||
# ONLY USE THIS FOR TITLES/SOUNDS AND OTHER EFFECTS
|
||||
@@ -163,6 +187,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...
|
||||
|
||||
@@ -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"]'
|
||||
@@ -60,9 +61,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:
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
name: ${project.name}
|
||||
version: ${project.version}
|
||||
main: com.bencodez.votingplugin.bungee.VotingPluginBungee
|
||||
author: BenCodez
|
||||
author: BenCodez
|
||||
softDepends:
|
||||
- RedisBungee
|
||||
@@ -11,30 +11,80 @@ 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
|
||||
|
||||
# Online mode for UUIDS
|
||||
# Offline mode setups are not fully tested and are not supported currently
|
||||
OnlineMode: true
|
||||
|
||||
|
||||
####################################################################################
|
||||
# Global mysql data handle for between server commmunications
|
||||
# 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
|
||||
# If false, will send to online server only
|
||||
SendVotesToAllServers: true
|
||||
# List of servers the plugin won't send the vote to
|
||||
# Uses names from bungeecoord config if not using SOCKETS method
|
||||
# Uses names from bungeecoord config, only needed for non SOCKETS setup
|
||||
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/Ben12345rocks/VotingPlugin/wiki/Bungeecoord-Setups
|
||||
# https://github.com/BenCodez/VotingPlugin/wiki/Bungeecoord-Setups
|
||||
# Available:
|
||||
# SOCKETS
|
||||
# PLUGINMESSAGING
|
||||
# PLUGINMESSAGING (Recommended)
|
||||
# MYSQL
|
||||
BungeeMethod: PLUGINMESSAGING
|
||||
|
||||
@@ -43,45 +93,80 @@ BungeeMethod: PLUGINMESSAGING
|
||||
# This requires spigot servers AllowUnJoined to be set to true in Config.yml
|
||||
AllowUnJoined: false
|
||||
|
||||
# Points to give on vote
|
||||
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
|
||||
|
||||
# ----------------------------
|
||||
# PLUGINMESSAGING Settings
|
||||
# ----------------------------
|
||||
# Tell servers to broadcast
|
||||
# Set DisableBroadcast to true on spigot servers (BungeeSettings.yml) as well
|
||||
Broadcast: true
|
||||
|
||||
# Applies to PLUGINMESSAGING & when SendVotesToAllServers is true
|
||||
# Geyser settings
|
||||
# This may or may not work
|
||||
# Does not work on velocity currently
|
||||
GeyserSupport: false
|
||||
GeyserPrefix: '.'
|
||||
|
||||
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!'
|
||||
|
||||
|
||||
##########################################
|
||||
# PLUGINMESSAGING Settings
|
||||
##########################################
|
||||
|
||||
# Applies to PLUGINMESSAGING only
|
||||
# Votes will be forwarded when specific player is online
|
||||
WaitForUserOnline: false
|
||||
|
||||
# ----------------------------
|
||||
# SOCKET Settings, do not touch otherwise
|
||||
# ----------------------------
|
||||
|
||||
# Tell servers to broadcast
|
||||
# For socket method
|
||||
Broadcast: true
|
||||
##########################################
|
||||
# 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
|
||||
##########################################
|
||||
|
||||
# Server to send vote to if player is offline
|
||||
FallBackServer: factions
|
||||
# Support for redis
|
||||
# experimental
|
||||
MultiProxySupport: false
|
||||
|
||||
# Bungee communication, Add this to each spigot server
|
||||
# For socket method
|
||||
BungeeServer:
|
||||
Host: '127.0.0.1'
|
||||
Port: 1297
|
||||
|
||||
# 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
|
||||
# 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
|
||||
|
||||
# Set this for each proxy
|
||||
MultiProxySocketHost:
|
||||
Host: 0.0.0.0
|
||||
Port: 1234
|
||||
|
||||
# Set other sub proxies here
|
||||
MultiProxyServers:
|
||||
secondproxy:
|
||||
Host: 0.0.0.0
|
||||
Port: 1235
|
||||
+270
-250
@@ -1,250 +1,270 @@
|
||||
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]
|
||||
api-version: 1.13
|
||||
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
|
||||
|
||||
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.Any:
|
||||
description: Remind if player can vote on any website, rather than all
|
||||
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
|
||||
- DiscordSRV
|
||||
loadbefore:
|
||||
- MCPerks
|
||||
api-version: 1.13
|
||||
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
|
||||
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
|
||||
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
|
||||
adminvoteConvertToData:
|
||||
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
|
||||
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.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
|
||||
@@ -1,2 +1,4 @@
|
||||
time: '${timestamp}'
|
||||
profile: ${build.profile.id}
|
||||
profile: '${build.profile.id}'
|
||||
version: '${project.version}'
|
||||
buildnumber: '${build.number}'
|
||||
+195
-127
@@ -1,10 +1,8 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.bencodez</groupId>
|
||||
<artifactId>VotingPlugin</artifactId>
|
||||
<version>6.3.1</version>
|
||||
<artifactId>votingplugin</artifactId>
|
||||
<version>6.12</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>VotingPlugin</name>
|
||||
<properties>
|
||||
@@ -12,14 +10,8 @@
|
||||
<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>
|
||||
</properties>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>internal.repo</id>
|
||||
<name>Temporary Staging Repository</name>
|
||||
<url>file://${project.build.directory}/mvn-repo</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
@@ -79,7 +71,7 @@
|
||||
<plugin>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok-maven-plugin</artifactId>
|
||||
<version>1.18.12.0</version>
|
||||
<version>1.18.20.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>delombok</id>
|
||||
@@ -102,15 +94,19 @@
|
||||
<configuration>
|
||||
<shadedArtifactAttached>false</shadedArtifactAttached>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>mysql-connector-java</artifact>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</filter>
|
||||
</filters>
|
||||
<relocations>
|
||||
<!-- Lets relocate the shaded API so we dont cause any conflicts with
|
||||
other plugins -->
|
||||
<relocation>
|
||||
<pattern>com.bencodez.advancedcore</pattern>
|
||||
<shadedPattern>${project.groupId}.votingplugin.advancedcore</shadedPattern>
|
||||
</relocation>
|
||||
<!-- Lets relocate the shaded API so we dont cause any conflicts with
|
||||
other plugins -->
|
||||
<relocation>
|
||||
<pattern>net.pl3x.bukkit.chatapi</pattern>
|
||||
<shadedPattern>${project.groupId}.votingplugin</shadedPattern>
|
||||
@@ -128,8 +124,12 @@
|
||||
<shadedPattern>${project.groupId}.votingplugin.hikari</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>xyz.upperlevel.spigot.book</pattern>
|
||||
<shadedPattern>${project.groupId}.votingplugin.upperlevel.book</shadedPattern>
|
||||
<pattern>org.bstats</pattern>
|
||||
<shadedPattern>${project.groupId}.votingplugin.bstats</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>xyz.upperlevel.spigot</pattern>
|
||||
<shadedPattern>${project.groupId}.votingplugin.advancedcore.xyz.upperlevel.spigot</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
@@ -148,50 +148,16 @@
|
||||
</excludes>
|
||||
</artifactSet>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<phase>deploy</phase>
|
||||
<configuration>
|
||||
<sourcepath>${project.basedir}/target/delombok</sourcepath>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.github.github</groupId>
|
||||
<artifactId>site-maven-plugin</artifactId>
|
||||
<version>0.12</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>javadoc</id>
|
||||
<goals>
|
||||
<goal>site</goal>
|
||||
</goals>
|
||||
<phase>deploy</phase>
|
||||
<configuration>
|
||||
<message>Maven javadoc for ${project.version}</message>
|
||||
<noJekyll>true</noJekyll>
|
||||
<outputDirectory>${project.build.directory}/apidocs
|
||||
</outputDirectory>
|
||||
<branch>refs/heads/gh-pages</branch>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
<repositoryName>VotingPlugin</repositoryName>
|
||||
<repositoryOwner>BenCodez</repositoryOwner>
|
||||
<server>github</server>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
<exclude>META-INF/*.SF</exclude>
|
||||
<exclude>META-INF/*.DSA</exclude>
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
@@ -228,7 +194,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>
|
||||
@@ -242,15 +207,15 @@
|
||||
<url>https://nexus.velocitypowered.com/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>bintray-repo</id>
|
||||
<url>https://dl.bintray.com/ichbinjoe/public/</url>
|
||||
<id>bencodez repo</id>
|
||||
<url>https://nexus.bencodez.com/repository/maven-public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.16.5-R0.1-SNAPSHOT</version>
|
||||
<version>1.19.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -262,88 +227,191 @@
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>LATEST</version>
|
||||
<version>1.17-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vexsoftware</groupId>
|
||||
<artifactId>nuvotifier-universal</artifactId>
|
||||
<version>2.6.0</version>
|
||||
<version>2.7.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.tchristofferson</groupId>
|
||||
<artifactId>ConfigUpdater</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.6</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>be.maximvdw</groupId>
|
||||
<artifactId>MVdWPlaceholderAPI</artifactId>
|
||||
<artifactId>mvdwplaceholderapi</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.velocitypowered</groupId>
|
||||
<artifactId>velocity-api</artifactId>
|
||||
<version>1.1.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-velocity</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bencodez</groupId>
|
||||
<artifactId>advancedcore</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/Jars/MVdWPlaceholderAPI.jar</systemPath>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>prod</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<build.profile.id>prod</build.profile.id>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.github.bencodez</groupId>
|
||||
<artifactId>advancedcore</artifactId>
|
||||
<version>master-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>prod2</id>
|
||||
<properties>
|
||||
<build.profile.id>prod2</build.profile.id>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.bencodez</groupId>
|
||||
<artifactId>AdvancedCore</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>internal.repo</id>
|
||||
<name>Temporary Staging Repository</name>
|
||||
<url>file://${project.build.directory}/mvn-repo</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>dev</id>
|
||||
<id>deploy-snapshot</id>
|
||||
<properties>
|
||||
<build.profile.id>dev</build.profile.id>
|
||||
<build.profile.id>deploy-snapshot</build.profile.id>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.bencodez</groupId>
|
||||
<artifactId>AdvancedCore</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>nexus</id>
|
||||
<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>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>3.0.0-M1</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<version>1.5.1</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>deploy</id>
|
||||
<properties>
|
||||
<build.profile.id>deploy</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-releases/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<phase>deploy</phase>
|
||||
<configuration>
|
||||
<sourcepath>${project.basedir}/target/delombok</sourcepath>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>3.0.0-M1</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<version>1.5.1</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>
|
||||
<plugin>
|
||||
<groupId>com.github.github</groupId>
|
||||
<artifactId>site-maven-plugin</artifactId>
|
||||
<version>0.12</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>javadoc</id>
|
||||
<goals>
|
||||
<goal>site</goal>
|
||||
</goals>
|
||||
<phase>deploy</phase>
|
||||
<configuration>
|
||||
<message>Maven javadoc for ${project.version}</message>
|
||||
<noJekyll>true</noJekyll>
|
||||
<outputDirectory>${project.build.directory}/apidocs
|
||||
</outputDirectory>
|
||||
<branch>refs/heads/gh-pages</branch>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
<repositoryName>VotingPlugin</repositoryName>
|
||||
<repositoryOwner>BenCodez</repositoryOwner>
|
||||
<server>github</server>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
@@ -1,10 +1,29 @@
|
||||
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.globaldata.GlobalDataHandler;
|
||||
import com.bencodez.advancedcore.bungeeapi.globaldata.GlobalMySQL;
|
||||
import com.bencodez.advancedcore.bungeeapi.pluginmessage.PluginMessageHandler;
|
||||
import com.bencodez.advancedcore.bungeeapi.sockets.ClientHandler;
|
||||
import com.bencodez.advancedcore.bungeeapi.sockets.SocketHandler;
|
||||
@@ -18,7 +37,7 @@ import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
public class BungeeHandler {
|
||||
public class BungeeHandler implements Listener {
|
||||
@Getter
|
||||
private ClientHandler clientHandler;
|
||||
|
||||
@@ -29,16 +48,209 @@ public class BungeeHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
@Getter
|
||||
private int bungeeVotePartyCurrent = 0;
|
||||
|
||||
@Getter
|
||||
private int bungeeVotePartyRequired = 0;
|
||||
|
||||
@Getter
|
||||
private SocketHandler socketHandler;
|
||||
|
||||
private GlobalDataHandler globalDataHandler;
|
||||
|
||||
@Getter
|
||||
private ScheduledExecutorService timer;
|
||||
|
||||
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
|
||||
* 1) {
|
||||
plugin.getLogger().warning("Ignore bungee time change since it was more than 1 hour ago");
|
||||
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,11 +260,18 @@ public class BungeeHandler {
|
||||
|
||||
plugin.getLogger().info("Using BungeeMethod: " + method.toString());
|
||||
|
||||
loadGlobalMysql();
|
||||
|
||||
if (method.equals(BungeeMethod.MYSQL)) {
|
||||
plugin.registerBungeeChannels("vp:vp");
|
||||
} 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) {
|
||||
@@ -75,24 +294,60 @@ public class BungeeHandler {
|
||||
|
||||
BungeeMessageData text = new BungeeMessageData(args.get(6));
|
||||
|
||||
bungeeVotePartyCurrent = text.getVotePartyCurrent();
|
||||
bungeeVotePartyRequired = text.getVotePartyRequired();
|
||||
plugin.getPlaceholders().onBungeeVotePartyUpdate();
|
||||
plugin.getServerData().setBungeeVotePartyCurrent(bungeeVotePartyCurrent);
|
||||
plugin.getServerData().setBungeeVotePartyRequired(bungeeVotePartyRequired);
|
||||
|
||||
boolean setTotals = Boolean.valueOf(args.get(7));
|
||||
|
||||
user.clearCache();
|
||||
|
||||
user.bungeeVotePluginMessaging(service, time, text, !setTotals, wasOnline);
|
||||
if (plugin.getBungeeSettings().isPerServerPoints()) {
|
||||
user.addPoints(plugin.getConfigFile().getPointsOnVote());
|
||||
boolean broadcast = true;
|
||||
boolean bungeeBroadcast = false;
|
||||
|
||||
if (args.size() > 9) {
|
||||
bungeeBroadcast = Boolean.valueOf(args.get(9));
|
||||
}
|
||||
|
||||
if (!plugin.getBungeeSettings().isBungeeBroadcast()) {
|
||||
if (wasOnline || plugin.getBungeeSettings().isBungeeBroadcastAlways()) {
|
||||
VoteSite site = plugin.getVoteSite(service);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, false);
|
||||
} else {
|
||||
plugin.getLogger().warning("No votesite for " + service);
|
||||
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());
|
||||
}
|
||||
|
||||
if (Boolean.valueOf(args.get(5))) {
|
||||
@@ -119,6 +374,13 @@ public class BungeeHandler {
|
||||
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 = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid),
|
||||
@@ -133,17 +395,51 @@ public class BungeeHandler {
|
||||
|
||||
boolean wasOnline = Boolean.valueOf(args.get(4));
|
||||
|
||||
user.bungeeVotePluginMessaging(service, time, text, !setTotals, wasOnline);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if (!plugin.getBungeeSettings().isBungeeBroadcast()) {
|
||||
if (Boolean.valueOf(args.get(4)) || plugin.getBungeeSettings().isBungeeBroadcastAlways()) {
|
||||
VoteSite site = plugin.getVoteSite(service);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, 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());
|
||||
}
|
||||
|
||||
if (Boolean.valueOf(args.get(5))) {
|
||||
@@ -165,21 +461,51 @@ public class BungeeHandler {
|
||||
|
||||
user.offVote();
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getPluginMessaging().add(new PluginMessageHandler("BungeeTimeChange") {
|
||||
@Override
|
||||
public void onRecieve(String subChannel, ArrayList<String> args) {
|
||||
checkGlobalData();
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getPluginMessaging().add(new PluginMessageHandler("VoteBroadcast") {
|
||||
@Override
|
||||
public void onRecieve(String subChannel, ArrayList<String> args) {
|
||||
String uuid = args.get(0);
|
||||
String service = args.get(1);
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid));
|
||||
VoteSite site = plugin.getVoteSite(service);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, false);
|
||||
} else {
|
||||
plugin.getLogger().warning("No votesite for " + service);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getPluginMessaging().add(new PluginMessageHandler("VoteBroadcastOffline") {
|
||||
@Override
|
||||
public void onRecieve(String subChannel, ArrayList<String> args) {
|
||||
if (args.size() > 2) {
|
||||
String uuid = args.get(0);
|
||||
String votes = args.get(2);
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid),
|
||||
args.get(1));
|
||||
user.offlineBroadcast(user, false, Integer.parseInt(votes));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -193,6 +519,33 @@ public class BungeeHandler {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getPluginMessaging().add(new PluginMessageHandler("VotePartyBungee") {
|
||||
@Override
|
||||
public void onRecieve(String subChannel, ArrayList<String> args) {
|
||||
for (final String cmd : plugin.getBungeeSettings().getBungeeVotePartyGlobalCommands()) {
|
||||
Bukkit.getScheduler().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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getPluginMessaging().add(new PluginMessageHandler("VotePartyBroadcast") {
|
||||
@Override
|
||||
public void onRecieve(String subChannel, ArrayList<String> args) {
|
||||
String broadcast = args.get(0);
|
||||
MiscUtils.getInstance().broadcast(broadcast);
|
||||
}
|
||||
});
|
||||
|
||||
} else if (method.equals(BungeeMethod.SOCKETS)) {
|
||||
encryptionHandler = new EncryptionHandler(new File(plugin.getDataFolder(), "secretkey.key"));
|
||||
|
||||
@@ -202,7 +555,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") {
|
||||
|
||||
@@ -229,6 +588,14 @@ public class BungeeHandler {
|
||||
}
|
||||
});
|
||||
|
||||
socketHandler.add(new SocketReceiver("BungeeTimeChange") {
|
||||
|
||||
@Override
|
||||
public void onReceive(String[] data) {
|
||||
checkGlobalData();
|
||||
}
|
||||
});
|
||||
|
||||
socketHandler.add(new SocketReceiver("bungeevoteonline") {
|
||||
|
||||
@Override
|
||||
@@ -254,12 +621,25 @@ 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 = UserManager.getInstance().getVotingPluginUser(p);
|
||||
user.offlineBroadcast(user, false, Integer.parseInt(votes));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
socketHandler.add(new SocketReceiver("BungeeBroadcast") {
|
||||
|
||||
@Override
|
||||
public void onReceive(String[] data) {
|
||||
if (data.length > 2) {
|
||||
VoteSite site = plugin.getVoteSite(data[1]);
|
||||
VoteSite site = plugin.getVoteSite(data[1], true);
|
||||
String p = data[3];
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(p);
|
||||
if (site != null) {
|
||||
@@ -271,6 +651,23 @@ public class BungeeHandler {
|
||||
}
|
||||
});
|
||||
|
||||
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 = UserManager.getInstance().getVotingPluginUser(p);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, false);
|
||||
} else {
|
||||
plugin.getLogger().warning("No votesite for " + data[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
socketHandler.add(new SocketReceiver("Status") {
|
||||
|
||||
@Override
|
||||
@@ -291,6 +688,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) {
|
||||
|
||||
@@ -16,7 +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;
|
||||
|
||||
@@ -43,15 +46,13 @@ 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.UUID;
|
||||
import com.bencodez.advancedcore.api.user.UserStorage;
|
||||
import com.bencodez.advancedcore.logger.Logger;
|
||||
import com.bencodez.advancedcore.nms.NMSManager;
|
||||
import com.bencodez.votingplugin.broadcast.BroadcastHandler;
|
||||
@@ -80,8 +81,10 @@ import com.bencodez.votingplugin.placeholders.MVdWPlaceholders;
|
||||
import com.bencodez.votingplugin.placeholders.PlaceHolders;
|
||||
import com.bencodez.votingplugin.signs.Signs;
|
||||
import com.bencodez.votingplugin.specialrewards.SpecialRewards;
|
||||
import com.bencodez.votingplugin.timequeue.TimeQueueHandler;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoter;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoterHandler;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoterPlayer;
|
||||
import com.bencodez.votingplugin.updater.CheckUpdate;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
@@ -134,7 +137,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
private GUI gui;
|
||||
|
||||
@Getter
|
||||
private LinkedHashMap<VotingPluginUser, Integer> lastMonthTopVoter;
|
||||
private LinkedHashMap<TopVoterPlayer, Integer> lastMonthTopVoter;
|
||||
|
||||
@Getter
|
||||
private MVdWPlaceholders mvdwPlaceholders;
|
||||
@@ -145,6 +148,9 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
@Getter
|
||||
private String profile = "";
|
||||
|
||||
@Getter
|
||||
private String buildNumber = "NOTSET";
|
||||
|
||||
@Getter
|
||||
private ServerData serverData;
|
||||
|
||||
@@ -162,7 +168,8 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
private String time = "";
|
||||
|
||||
@Getter
|
||||
private LinkedHashMap<TopVoter, LinkedHashMap<VotingPluginUser, Integer>> topVoter;
|
||||
@Setter
|
||||
private LinkedHashMap<TopVoter, LinkedHashMap<TopVoterPlayer, Integer>> topVoter;
|
||||
|
||||
@Getter
|
||||
private TopVoterHandler topVoterHandler;
|
||||
@@ -195,15 +202,22 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
private List<VoteSite> voteSites;
|
||||
|
||||
@Getter
|
||||
private LinkedHashMap<VotingPluginUser, HashMap<VoteSite, LocalDateTime>> voteToday;
|
||||
@Setter
|
||||
private LinkedHashMap<TopVoterPlayer, HashMap<VoteSite, LocalDateTime>> voteToday;
|
||||
|
||||
private boolean votifierLoaded = true;
|
||||
|
||||
@Getter
|
||||
private boolean ymlError = false;
|
||||
|
||||
@Getter
|
||||
private ScheduledExecutorService voteTimer;
|
||||
|
||||
@Getter
|
||||
private UserManager votingPluginUserManager;
|
||||
|
||||
private void addDirectlyDefinedRewards(DirectlyDefinedReward directlyDefinedReward) {
|
||||
RewardHandler.getInstance().addDirectlyDefined(directlyDefinedReward);
|
||||
getRewardHandler().addDirectlyDefined(directlyDefinedReward);
|
||||
}
|
||||
|
||||
public void basicBungeeUpdate() {
|
||||
@@ -251,79 +265,8 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
}
|
||||
}
|
||||
|
||||
public void convertDataStorage(UserStorage from, UserStorage to) {
|
||||
if (from == null || to == null) {
|
||||
throw new RuntimeException("Invalid Storage Method");
|
||||
}
|
||||
UserStorage cur = getStorageType();
|
||||
getOptions().setStorageType(from);
|
||||
if (getStorageType().equals(UserStorage.MYSQL) && getMysql() != null) {
|
||||
getMysql().clearCache();
|
||||
}
|
||||
ArrayList<String> uuids = new ArrayList<String>(UserManager.getInstance().getAllUUIDs());
|
||||
|
||||
while (uuids.size() > 0) {
|
||||
HashMap<VotingPluginUser, HashMap<String, String>> data = new HashMap<VotingPluginUser, HashMap<String, String>>();
|
||||
getOptions().setStorageType(from);
|
||||
loadUserAPI(getOptions().getStorageType());
|
||||
// setStorageType(to);
|
||||
|
||||
if (getStorageType().equals(UserStorage.MYSQL) && getMysql() != null) {
|
||||
getMysql().clearCache();
|
||||
}
|
||||
|
||||
ArrayList<String> converted = new ArrayList<String>();
|
||||
int i = 0;
|
||||
while (i < configFile.getConvertAmount() && i < uuids.size()) {
|
||||
String uuid = uuids.get(i);
|
||||
try {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
|
||||
HashMap<String, String> values = new HashMap<String, String>();
|
||||
for (String key : user.getData().getKeys()) {
|
||||
String value = user.getData().getValue(key);
|
||||
if (value != null && !value.isEmpty() && !value.equalsIgnoreCase("null")) {
|
||||
values.put(key, value);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
converted.add(uuid);
|
||||
data.put(user, values);
|
||||
debug("[Convert] Added " + uuid);
|
||||
} catch (Exception e) {
|
||||
debug(e);
|
||||
plugin.getLogger().warning("Exception occoured for '" + uuid + "': " + e.getMessage()
|
||||
+ ", turn debug on to see full stack traces");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
wait(configFile.getConvertDelay());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
uuids.removeAll(converted);
|
||||
|
||||
plugin.getLogger().info("Finished getting data from " + from.toString() + " Converting " + data.size()
|
||||
+ " users, " + uuids.size() + " left to convert");
|
||||
|
||||
getOptions().setStorageType(to);
|
||||
loadUserAPI(getOptions().getStorageType());
|
||||
if (getStorageType().equals(UserStorage.MYSQL) && getMysql() != null) {
|
||||
getMysql().clearCache();
|
||||
}
|
||||
|
||||
writeConvertData(data);
|
||||
}
|
||||
|
||||
getOptions().setStorageType(cur);
|
||||
reload();
|
||||
|
||||
plugin.getLogger().info("Finished convertting");
|
||||
}
|
||||
|
||||
public ArrayList<VotingPluginUser> convertSet(Set<VotingPluginUser> set) {
|
||||
return new ArrayList<VotingPluginUser>(set);
|
||||
public ArrayList<TopVoterPlayer> convertSet(Set<TopVoterPlayer> set) {
|
||||
return new ArrayList<TopVoterPlayer>(set);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -331,8 +274,12 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
return configFile.getData();
|
||||
}
|
||||
|
||||
public LinkedHashMap<VotingPluginUser, Integer> getTopVoter(TopVoter top) {
|
||||
return topVoter.get(top);
|
||||
public LinkedHashMap<TopVoterPlayer, Integer> getTopVoter(TopVoter top) {
|
||||
LinkedHashMap<TopVoterPlayer, Integer> top1 = topVoter.get(top);
|
||||
if (top1 == null) {
|
||||
top1 = new LinkedHashMap<TopVoterPlayer, Integer>();
|
||||
}
|
||||
return top1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -373,20 +320,14 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vote site.
|
||||
*
|
||||
* @param site the site name
|
||||
* @return the vote site
|
||||
*/
|
||||
public VoteSite getVoteSite(String site) {
|
||||
String siteName = getVoteSiteName(site);
|
||||
public VoteSite getVoteSite(String site, boolean checkEnabled) {
|
||||
String siteName = getVoteSiteName(checkEnabled, site);
|
||||
for (VoteSite voteSite : getVoteSites()) {
|
||||
if (voteSite.getKey().equalsIgnoreCase(siteName) || voteSite.getDisplayName().equals(siteName)) {
|
||||
return voteSite;
|
||||
}
|
||||
}
|
||||
if (configFile.isAutoCreateVoteSites() && !configVoteSites.getVoteSitesNames().contains(siteName)) {
|
||||
if (configFile.isAutoCreateVoteSites() && !configVoteSites.getVoteSitesNames(false).contains(siteName)) {
|
||||
configVoteSites.generateVoteSite(siteName);
|
||||
return new VoteSite(plugin, siteName.replace(".", "_"));
|
||||
}
|
||||
@@ -394,14 +335,8 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vote site name.
|
||||
*
|
||||
* @param urls the url
|
||||
* @return the vote site name
|
||||
*/
|
||||
public String getVoteSiteName(String... urls) {
|
||||
ArrayList<String> sites = getConfigVoteSites().getVoteSitesNames();
|
||||
public String getVoteSiteName(boolean checkEnabled, String... urls) {
|
||||
ArrayList<String> sites = getConfigVoteSites().getVoteSitesNames(checkEnabled);
|
||||
for (String url : urls) {
|
||||
if (url == null) {
|
||||
return null;
|
||||
@@ -414,11 +349,10 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
return siteName;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String siteName : sites) {
|
||||
if (siteName.equalsIgnoreCase(url)) {
|
||||
return siteName;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return url;
|
||||
@@ -431,7 +365,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
}
|
||||
|
||||
public String getVoteSiteServiceSite(String name) {
|
||||
ArrayList<String> sites = getConfigVoteSites().getVoteSitesNames();
|
||||
ArrayList<String> sites = getConfigVoteSites().getVoteSitesNames(true);
|
||||
if (name == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -452,12 +386,8 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
|
||||
}
|
||||
|
||||
public UserManager getVotingPluginUserManager() {
|
||||
return UserManager.getInstance();
|
||||
}
|
||||
|
||||
public boolean hasVoteSite(String site) {
|
||||
String siteName = getVoteSiteName(site);
|
||||
String siteName = getVoteSiteName(false, site);
|
||||
for (VoteSite voteSite : getVoteSites()) {
|
||||
if (voteSite.getKey().equalsIgnoreCase(siteName) || voteSite.getDisplayName().equals(siteName)) {
|
||||
return true;
|
||||
@@ -476,7 +406,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
}
|
||||
|
||||
public void loadDirectlyDefined() {
|
||||
RewardHandler.getInstance().getDirectlyDefinedRewards().clear();
|
||||
getRewardHandler().getDirectlyDefinedRewards().clear();
|
||||
// AllSites reward
|
||||
addDirectlyDefinedRewards(new DirectlyDefinedReward("AllSites") {
|
||||
|
||||
@@ -501,6 +431,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") {
|
||||
|
||||
@@ -525,6 +478,29 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
}
|
||||
});
|
||||
|
||||
addDirectlyDefinedRewards(new DirectlyDefinedReward("FirstVoteToday") {
|
||||
|
||||
@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);
|
||||
}
|
||||
});
|
||||
|
||||
addDirectlyDefinedRewards(new DirectlyDefinedReward("VoteReminding.Rewards") {
|
||||
|
||||
@Override
|
||||
@@ -767,6 +743,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
|
||||
@@ -901,6 +900,28 @@ 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void loadTimer() {
|
||||
@@ -908,31 +929,25 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
|
||||
@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);
|
||||
|
||||
coolDownCheck.load();
|
||||
|
||||
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);
|
||||
@@ -944,6 +959,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
if (conf != null) {
|
||||
time = conf.getString("time", "");
|
||||
profile = conf.getString("profile", "");
|
||||
buildNumber = conf.getString("buildnumber", "NOTSET");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -982,13 +998,23 @@ 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;
|
||||
|
||||
@Override
|
||||
public void onPostLoad() {
|
||||
loadVersionFile();
|
||||
getOptions().setServer(bungeeSettings.getServer());
|
||||
|
||||
loadVoteTimer();
|
||||
|
||||
if (bungeeSettings.isUseBungeecoord()) {
|
||||
bungeeHandler = new BungeeHandler(this);
|
||||
bungeeHandler.load();
|
||||
@@ -1000,6 +1026,10 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
|
||||
}
|
||||
|
||||
if (!bungeeSettings.isUseBungeecoord() || !bungeeSettings.isGloblalDataEnabled()) {
|
||||
this.timeQueueHandler = new TimeQueueHandler(this);
|
||||
}
|
||||
|
||||
registerCommands();
|
||||
checkVotifier();
|
||||
registerEvents();
|
||||
@@ -1011,6 +1041,9 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
specialRewards = new SpecialRewards(this);
|
||||
signs = new Signs(this);
|
||||
|
||||
coolDownCheck.checkEnabled();
|
||||
coolDownCheck.load();
|
||||
|
||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
@@ -1020,7 +1053,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
});
|
||||
|
||||
topVoterHandler = new TopVoterHandler(this);
|
||||
lastMonthTopVoter = new LinkedHashMap<VotingPluginUser, Integer>();
|
||||
lastMonthTopVoter = new LinkedHashMap<TopVoterPlayer, Integer>();
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
@@ -1029,11 +1062,11 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
debug("Loaded last month top voters");
|
||||
}
|
||||
});
|
||||
topVoter = new LinkedHashMap<TopVoter, LinkedHashMap<VotingPluginUser, Integer>>();
|
||||
topVoter = new LinkedHashMap<TopVoter, LinkedHashMap<TopVoterPlayer, Integer>>();
|
||||
for (TopVoter top : TopVoter.values()) {
|
||||
topVoter.put(top, new LinkedHashMap<VotingPluginUser, Integer>());
|
||||
topVoter.put(top, new LinkedHashMap<TopVoterPlayer, Integer>());
|
||||
}
|
||||
voteToday = new LinkedHashMap<VotingPluginUser, HashMap<VoteSite, LocalDateTime>>();
|
||||
voteToday = new LinkedHashMap<TopVoterPlayer, HashMap<VoteSite, LocalDateTime>>();
|
||||
voteLog = new Logger(plugin, new File(plugin.getDataFolder() + File.separator + "Log", "votelog.txt"));
|
||||
|
||||
new AdminGUI(this).loadHook();
|
||||
@@ -1044,7 +1077,13 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
|
||||
topVoterHandler.register();
|
||||
|
||||
metrics();
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
metrics();
|
||||
}
|
||||
});
|
||||
|
||||
// javascript api
|
||||
getJavascriptEngineRequests().add(new JavascriptPlaceholderRequest("User") {
|
||||
@@ -1067,46 +1106,18 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
mvdwPlaceholders.loadMVdWPlaceholders();
|
||||
}
|
||||
|
||||
// set columns
|
||||
if (getStorageType().equals(UserStorage.MYSQL) && configFile.isAlterColumns()) {
|
||||
getMysql().alterColumnType("TopVoterIgnore", "VARCHAR(5)");
|
||||
getMysql().alterColumnType("CheckWorld", "VARCHAR(5)");
|
||||
getMysql().alterColumnType("Reminded", "VARCHAR(5)");
|
||||
getMysql().alterColumnType("DisableBroadcast", "VARCHAR(5)");
|
||||
getMysql().alterColumnType("LastOnline", "VARCHAR(20)");
|
||||
getMysql().alterColumnType("PlayerName", "VARCHAR(30)");
|
||||
getMysql().alterColumnType("DailyTotal", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("WeeklyTotal", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("DayVoteStreak", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("BestDayVoteStreak", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("WeekVoteStreak", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("BestWeekVoteStreak", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("VotePartyVotes", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("MonthVoteStreak", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("Points", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("HighestDailyTotal", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("AllTimeTotal", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("HighestMonthlyTotal", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("MilestoneCount", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("MonthTotal", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("HighestWeeklyTotal", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("LastMonthTotal", "INT DEFAULT '0'");
|
||||
getMysql().alterColumnType("OfflineRewards", "MEDIUMTEXT");
|
||||
getMysql().alterColumnType("DayVoteStreakLastUpdate", "MEDIUMTEXT");
|
||||
if (getOptions().isPerServerRewards()) {
|
||||
getMysql().alterColumnType("OfflineRewards" + getOptions().getServer(), "MEDIUMTEXT");
|
||||
}
|
||||
}
|
||||
// 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 = UserManager.getInstance().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
|
||||
@@ -1124,7 +1135,7 @@ 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,
|
||||
@@ -1143,7 +1154,7 @@ 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) {
|
||||
@@ -1159,11 +1170,12 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
}
|
||||
|
||||
plugin.getLogger().info("Enabled VotingPlugin " + plugin.getDescription().getVersion());
|
||||
if (getProfile().equals("dev")) {
|
||||
plugin.getLogger().warning("Using dev build, this is not a stable build, use at your own risk");
|
||||
if (getProfile().contains("dev")) {
|
||||
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;
|
||||
@@ -1172,7 +1184,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/Ben12345rocks/AdvancedCore/wiki/Rewards on how to add rewards");
|
||||
+ ". See https://github.com/BenCodez/VotingPlugin/wiki/Rewards");
|
||||
}
|
||||
|
||||
boolean contains = false;
|
||||
@@ -1194,7 +1206,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
@Override
|
||||
public void run() {
|
||||
plugin.getLogger().warning(
|
||||
"Detected an issue with voting sites, check the server startup log for more details");
|
||||
"Detected an issue with voting sites, check the server startup log for more details: https://github.com/BenCodez/VotingPlugin/wiki/Votifier-Troubleshooting");
|
||||
}
|
||||
}, 30l);
|
||||
}
|
||||
@@ -1227,7 +1239,10 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
|
||||
loadVoteSites();
|
||||
|
||||
setJenkinsSite("ben12345rocks.com");
|
||||
votingPluginUserManager = UserManager.getInstance();
|
||||
votingPluginUserManager.addCachingKeys();
|
||||
|
||||
setJenkinsSite("bencodez.com");
|
||||
updateAdvancedCoreHook();
|
||||
|
||||
}
|
||||
@@ -1239,8 +1254,6 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
*/
|
||||
@Override
|
||||
public void onUnLoad() {
|
||||
getSigns().storeSigns();
|
||||
HandlerList.unregisterAll(plugin);
|
||||
if (bungeeSettings.isUseBungeecoord()) {
|
||||
try {
|
||||
getBungeeHandler().close();
|
||||
@@ -1248,6 +1261,18 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
debug(e);
|
||||
}
|
||||
}
|
||||
voteTimer.shutdown();
|
||||
try {
|
||||
voteTimer.awaitTermination(10, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
voteTimer.shutdownNow();
|
||||
if (timeQueueHandler != null) {
|
||||
timeQueueHandler.save();
|
||||
}
|
||||
getSigns().storeSigns();
|
||||
HandlerList.unregisterAll(plugin);
|
||||
plugin = null;
|
||||
}
|
||||
|
||||
@@ -1268,8 +1293,10 @@ 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) {
|
||||
@@ -1302,6 +1329,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
|
||||
@@ -1327,8 +1358,6 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
}
|
||||
|
||||
private void reloadPlugin(boolean userStorage) {
|
||||
setUpdate(true);
|
||||
|
||||
configFile.reloadData();
|
||||
configFile.loadValues();
|
||||
|
||||
@@ -1339,10 +1368,14 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
gui.reloadData();
|
||||
|
||||
bungeeSettings.reloadData();
|
||||
|
||||
if (bungeeSettings.isUseBungeecoord()) {
|
||||
getBungeeHandler().loadGlobalMysql();
|
||||
}
|
||||
checkYMLError();
|
||||
|
||||
if (broadcastHandler != null) {
|
||||
broadcastHandler.schelude(getConfigFile().getFormatAlternateBroadcastDelay());
|
||||
broadcastHandler.schedule(getConfigFile().getFormatAlternateBroadcastDelay());
|
||||
}
|
||||
|
||||
updateAdvancedCoreHook();
|
||||
@@ -1350,15 +1383,14 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
loadDirectlyDefined();
|
||||
reloadAdvancedCore(userStorage);
|
||||
getOptions().setServer(bungeeSettings.getServer());
|
||||
placeholders.load();
|
||||
if (userStorage) {
|
||||
placeholders.load();
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
update();
|
||||
}
|
||||
});
|
||||
voteReminding.loadRemindChecking();
|
||||
coolDownCheck.checkEnabled();
|
||||
placeholders.reload();
|
||||
setUpdate(true);
|
||||
}
|
||||
|
||||
private void setupFiles() {
|
||||
@@ -1370,11 +1402,9 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
|
||||
specialRewardsConfig = new SpecialRewardsConfig(this);
|
||||
specialRewardsConfig.setup();
|
||||
// specialRewardsConfig.loadValues();
|
||||
|
||||
bungeeSettings = new BungeeSettings(this);
|
||||
bungeeSettings.setup();
|
||||
// bungeeSettings.loadValues();
|
||||
|
||||
gui = new GUI(this);
|
||||
gui.setup();
|
||||
@@ -1384,12 +1414,8 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
checkYMLError();
|
||||
|
||||
plugin.debug("Loaded Files");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update.
|
||||
*/
|
||||
public void update() {
|
||||
if (update || configFile.isAlwaysUpdate()) {
|
||||
if (!updateStarted && plugin != null) {
|
||||
@@ -1398,51 +1424,128 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
update = false;
|
||||
|
||||
synchronized (plugin) {
|
||||
if (getStorageType().equals(UserStorage.MYSQL)) {
|
||||
if (getMysql() == null) {
|
||||
plugin.debug("MySQL not loaded yet");
|
||||
return;
|
||||
} else if (configFile.isClearCacheOnUpdate() || bungeeSettings.isUseBungeecoord()) {
|
||||
getMysql().clearCache();
|
||||
} else {
|
||||
getMysql().clearCacheBasic();
|
||||
}
|
||||
}
|
||||
if (plugin != null && plugin.isEnabled()) {
|
||||
getUserManager().getDataManager().clearCacheBasic();
|
||||
|
||||
plugin.debug("Starting background task");
|
||||
long time = System.currentTimeMillis();
|
||||
try {
|
||||
ArrayList<String> uuids = UserManager.getInstance().getAllUUIDs();
|
||||
ArrayList<VotingPluginUser> users = new ArrayList<VotingPluginUser>();
|
||||
for (String uuid : uuids) {
|
||||
if (uuid != null && !uuid.isEmpty()) {
|
||||
VotingPluginUser user = UserManager.getInstance()
|
||||
.getVotingPluginUser(new UUID(uuid));
|
||||
users.add(user);
|
||||
// extraDebug("Loading " + uuid);
|
||||
// java.lang.Thread.sleep(5000);
|
||||
}
|
||||
}
|
||||
update = false;
|
||||
long time1 = ((System.currentTimeMillis() - time) / 1000);
|
||||
plugin.debug("Finished loading player data in " + time1 + " seconds, " + users.size()
|
||||
+ " users");
|
||||
topVoterHandler.updateTopVoters(users);
|
||||
updateVoteToday(users);
|
||||
serverData.updateValues();
|
||||
getSigns().updateSigns();
|
||||
plugin.debug("Starting background task, current cached users: "
|
||||
+ plugin.getUserManager().getDataManager().getUserDataCache().keySet().size());
|
||||
|
||||
if (!configFile.isExtraBackgroundUpdate()) {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
user.offVote();
|
||||
int dataLoadLimit = getConfigFile().getPlayerDataLoadLimit();
|
||||
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()
|
||||
.getTopVoterIgnorePermission();
|
||||
ArrayList<String> blackList = plugin.getConfigFile().getBlackList();
|
||||
|
||||
ArrayList<String> uuids = UserManager.getInstance().getAllUUIDs();
|
||||
int currentDay = LocalDateTime.now().getDayOfMonth();
|
||||
int currentDataLoad = 0;
|
||||
for (String uuid : uuids) {
|
||||
if (plugin != null && plugin.isEnabled()) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
if (plugin != null) {
|
||||
plugin.getPlaceholders().onUpdate(user);
|
||||
}
|
||||
user.clearTempCache();
|
||||
user = null;
|
||||
if (dataLoadLimit > 0) {
|
||||
currentDataLoad++;
|
||||
if (currentDataLoad >= dataLoadLimit) {
|
||||
currentDataLoad -= dataLoadLimit;
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
update = false;
|
||||
long time1 = ((System.currentTimeMillis() - startTime) / 1000);
|
||||
plugin.debug("Finished loading player data in " + time1 + " seconds, " + uuids.size()
|
||||
+ " users, " + plugin.getStorageType().toString() + ", data load limit: "
|
||||
+ dataLoadLimit);
|
||||
time1 = System.currentTimeMillis();
|
||||
|
||||
topVoterHandler.updateTopVoters(tempTopVoter);
|
||||
placeholders.onUpdate();
|
||||
setVoteToday(voteToday);
|
||||
serverData.updateValues();
|
||||
getSigns().updateSigns();
|
||||
|
||||
tempTopVoter = null;
|
||||
|
||||
checkFirstTimeLoaded();
|
||||
|
||||
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.getUserManager().getDataManager().clearNonNeededCachedUsers();
|
||||
plugin.extraDebug("Current cached users: "
|
||||
+ plugin.getUserManager().getDataManager().getUserDataCache().keySet().size());
|
||||
} catch (Exception ex) {
|
||||
if (plugin != null) {
|
||||
plugin.getLogger().info("Looks like something went wrong");
|
||||
}
|
||||
ex.printStackTrace();
|
||||
}
|
||||
time1 = ((System.currentTimeMillis() - time) / 1000);
|
||||
plugin.debug("Background task finished in " + time1 + " seconds");
|
||||
} catch (Exception ex) {
|
||||
plugin.getLogger().info("Looks like something went wrong");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1452,65 +1555,35 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean firstTimeLoaded = false;
|
||||
|
||||
public void checkFirstTimeLoaded() {
|
||||
if (!firstTimeLoaded) {
|
||||
|
||||
if (getGui().isChestVoteTopUseSkull()) {
|
||||
int maxToLoad = 200;
|
||||
for (TopVoter top : topVoter.keySet()) {
|
||||
int num = 1;
|
||||
Set<TopVoterPlayer> players = topVoter.get(top).keySet();
|
||||
for (TopVoterPlayer p : players) {
|
||||
if (num <= maxToLoad) {
|
||||
SkullHandler.getInstance().loadSkull(p.getPlayerName());
|
||||
}
|
||||
num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
firstTimeLoaded = true;
|
||||
}
|
||||
|
||||
public void updateAdvancedCoreHook() {
|
||||
getJavascriptEngine().put("VotingPlugin", this);
|
||||
allowDownloadingFromSpigot(15358);
|
||||
setConfigData(configFile.getData());
|
||||
if (bungeeSettings.isUseBungeecoord()) {
|
||||
getOptions().setClearCacheOnJoin(true);
|
||||
getOptions().setPerServerRewards(getBungeeSettings().isPerServerRewards());
|
||||
}
|
||||
}
|
||||
|
||||
public void updateVoteToday(ArrayList<VotingPluginUser> users) {
|
||||
plugin.getVoteToday().clear();
|
||||
|
||||
for (VotingPluginUser user : users) {
|
||||
HashMap<VoteSite, LocalDateTime> times = new HashMap<VoteSite, LocalDateTime>();
|
||||
for (VoteSite voteSite : plugin.getVoteSites()) {
|
||||
if (!voteSite.isHidden()) {
|
||||
long time = user.getTime(voteSite);
|
||||
if ((LocalDateTime.now().getDayOfMonth() == MiscUtils.getInstance().getDayFromMili(time))
|
||||
&& (LocalDateTime.now().getMonthValue() == MiscUtils.getInstance().getMonthFromMili(time))
|
||||
&& (LocalDateTime.now().getYear() == MiscUtils.getInstance().getYearFromMili(time))) {
|
||||
|
||||
times.put(voteSite,
|
||||
LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault()));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (times.keySet().size() > 0) {
|
||||
plugin.getVoteToday().put(user, times);
|
||||
}
|
||||
|
||||
}
|
||||
plugin.debug("Updated VoteToday");
|
||||
}
|
||||
|
||||
private void writeConvertData(HashMap<VotingPluginUser, HashMap<String, String>> data) {
|
||||
boolean checkInt = getStorageType().equals(UserStorage.MYSQL);
|
||||
for (Entry<VotingPluginUser, HashMap<String, String>> entry : data.entrySet()) {
|
||||
try {
|
||||
for (Entry<String, String> values : entry.getValue().entrySet()) {
|
||||
String value = values.getValue();
|
||||
if (value != null && !value.equalsIgnoreCase("null")) {
|
||||
if (checkInt) {
|
||||
if (StringParser.getInstance().isInt(value)) {
|
||||
entry.getKey().getData().setInt(values.getKey(), Integer.parseInt(value));
|
||||
} else {
|
||||
entry.getKey().getData().setString(values.getKey(), value);
|
||||
}
|
||||
} else {
|
||||
entry.getKey().getData().setString(values.getKey(), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
plugin.getLogger()
|
||||
.warning("Exception occoured for '" + entry.getKey().getUUID() + "': " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,54 +1,55 @@
|
||||
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;
|
||||
|
||||
public class VotingPluginMetrics {
|
||||
|
||||
public void load(VotingPluginMain plugin) {
|
||||
BStatsMetrics metrics = new BStatsMetrics(plugin);
|
||||
BStatsMetrics metrics = new BStatsMetrics(plugin, 38);
|
||||
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_firstvote") {
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_firstvote", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
if (RewardHandler.getInstance().hasRewards(plugin.getSpecialRewardsConfig().getData(),
|
||||
public String call() throws Exception {
|
||||
if (plugin.getRewardHandler().hasRewards(plugin.getSpecialRewardsConfig().getData(),
|
||||
plugin.getSpecialRewardsConfig().getFirstVoteRewardsPath())) {
|
||||
return "True";
|
||||
} else {
|
||||
return "False";
|
||||
}
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_everysite") {
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_everysite", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
if (RewardHandler.getInstance().hasRewards(plugin.getConfigVoteSites().getData(),
|
||||
public String call() throws Exception {
|
||||
if (plugin.getRewardHandler().hasRewards(plugin.getConfigVoteSites().getData(),
|
||||
plugin.getConfigVoteSites().getEverySiteRewardPath())) {
|
||||
return "True";
|
||||
} else {
|
||||
return "False";
|
||||
}
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_allsites") {
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_allsites", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
if (RewardHandler.getInstance().hasRewards(plugin.getSpecialRewardsConfig().getData(),
|
||||
public String call() throws Exception {
|
||||
if (plugin.getRewardHandler().hasRewards(plugin.getSpecialRewardsConfig().getData(),
|
||||
plugin.getSpecialRewardsConfig().getAllSitesRewardPath())) {
|
||||
return "True";
|
||||
} else {
|
||||
return "False";
|
||||
}
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_cumulative") {
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_cumulative", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
public String call() throws Exception {
|
||||
if (plugin.getSpecialRewardsConfig().getCumulativeVotes().size() == 0) {
|
||||
return "False";
|
||||
} else {
|
||||
@@ -60,22 +61,22 @@ public class VotingPluginMetrics {
|
||||
return "False";
|
||||
}
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_voteparty") {
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_voteparty", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
public String call() throws Exception {
|
||||
if (!plugin.getSpecialRewardsConfig().getVotePartyEnabled()) {
|
||||
return "False";
|
||||
} else {
|
||||
return "True";
|
||||
}
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_milestone") {
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_milestone", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
public String call() throws Exception {
|
||||
if (plugin.getSpecialRewardsConfig().getMilestoneVotes().size() == 0) {
|
||||
return "False";
|
||||
} else {
|
||||
@@ -87,27 +88,27 @@ public class VotingPluginMetrics {
|
||||
return "False";
|
||||
}
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_anysitereward") {
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_anysitereward", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
if (RewardHandler.getInstance().hasRewards(plugin.getSpecialRewardsConfig().getData(),
|
||||
public String call() throws Exception {
|
||||
if (plugin.getRewardHandler().hasRewards(plugin.getSpecialRewardsConfig().getData(),
|
||||
plugin.getSpecialRewardsConfig().getAnySiteRewardsPath())) {
|
||||
return "True";
|
||||
} else {
|
||||
return "False";
|
||||
}
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_votestreakday") {
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_votestreakday", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
public String call() throws Exception {
|
||||
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";
|
||||
}
|
||||
@@ -115,16 +116,16 @@ public class VotingPluginMetrics {
|
||||
}
|
||||
return "False";
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_votestreakweek") {
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_votestreakweek", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
public String call() throws Exception {
|
||||
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";
|
||||
}
|
||||
@@ -132,16 +133,16 @@ public class VotingPluginMetrics {
|
||||
|
||||
return "False";
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_votestreakmonth") {
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_votestreakmonth", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
public String call() throws Exception {
|
||||
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";
|
||||
}
|
||||
@@ -149,95 +150,215 @@ public class VotingPluginMetrics {
|
||||
|
||||
return "False";
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("numberofsites") {
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("numberofsites", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getVoteSites().size();
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("numberofrewards") {
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("numberofrewards", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return "" + RewardHandler.getInstance().getRewards().size();
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getRewardHandler().getRewards().size();
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("autocreatevotesites") {
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("autocreatevotesites", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getConfigFile().isAutoCreateVoteSites();
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("numberofusers") {
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("numberofusers", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
public String call() throws Exception {
|
||||
int total = UserManager.getInstance().getAllUUIDs().size();
|
||||
if (total < 1000) {
|
||||
return "<1000";
|
||||
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";
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("data_storage") {
|
||||
}));
|
||||
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("data_storage", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
public String call() throws Exception {
|
||||
return plugin.getOptions().getStorageType().toString();
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("DisableCheckOnWorldChange") {
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("DisableCheckOnWorldChange", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getOptions().isDisableCheckOnWorldChange();
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("votereminding_enabled") {
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("votereminding_enabled", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getConfigFile().getVoteRemindingEnabled();
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("LoadTopVoter_Monthly") {
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("LoadTopVoter_Monthly", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getConfigFile().getLoadTopVoterMonthly();
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("LoadTopVoter_Weekly") {
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("LoadTopVoter_Weekly", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getConfigFile().getLoadTopVoterWeekly();
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("LoadTopVoter_Daily") {
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("LoadTopVoter_Daily", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getConfigFile().getLoadTopVoterDaily();
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("bungeemethod") {
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("bungeemethod", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
public String call() throws Exception {
|
||||
if (plugin.getBungeeSettings().isUseBungeecoord()) {
|
||||
return "" + plugin.getBungeeHandler().getMethod().toString();
|
||||
} else {
|
||||
return "Disabled";
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
||||
if (plugin.getBungeeSettings().isUseBungeecoord()) {
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("bungeebroadcast", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getBungeeSettings().isBungeeBroadcast();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("bungeebroadcastalways", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getBungeeSettings().isBungeeBroadcastAlways();
|
||||
}
|
||||
}));
|
||||
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("perserverrewards", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getBungeeSettings().isPerServerRewards();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("perserverpoints", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getBungeeSettings().isPerServerPoints();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("triggervotifierevent", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
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("persitecooldownevents", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getConfigFile().isPerSiteCoolDownEvents();
|
||||
}
|
||||
}));
|
||||
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("geyserprefixsupport", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getOptions().isGeyserPrefixSupport();
|
||||
}
|
||||
}));
|
||||
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("using_dev_build", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getProfile().contains("dev");
|
||||
}
|
||||
}));
|
||||
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("votepointtransfering", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getConfigFile().isAllowVotePointTransfers();
|
||||
}
|
||||
}));
|
||||
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("votecooldown_check_enabled", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + (!plugin.getConfigFile().isDisableCoolDownCheck() && plugin.getRewardHandler()
|
||||
.hasRewards(plugin.getSpecialRewardsConfig().getData(), "VoteCoolDownEndedReward"));
|
||||
}
|
||||
}));
|
||||
|
||||
if (!plugin.getBuildNumber().equals("NOTSET")) {
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("dev_build_number", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getBuildNumber();
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,10 @@ 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;
|
||||
@@ -16,12 +17,12 @@ 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() {
|
||||
@@ -32,8 +33,16 @@ public class BroadcastHandler {
|
||||
}
|
||||
String bc = StringParser.getInstance()
|
||||
.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);
|
||||
placeholders.put("players", playersText);
|
||||
bc = StringParser.getInstance().replacePlaceHolder(bc, placeholders);
|
||||
ArrayList<Player> players = new ArrayList<Player>();
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
@@ -50,18 +59,19 @@ public class BroadcastHandler {
|
||||
votedPlayers.add(player);
|
||||
}
|
||||
|
||||
public void schelude(int delay) {
|
||||
public void schedule(int delay) {
|
||||
if (timer != null) {
|
||||
timer.cancel();
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import lombok.Getter;
|
||||
public class BungeeMessageData {
|
||||
|
||||
// Message string
|
||||
// alltimetotal//monthtotal//weeklytotal//dailytotal//points//milestonecount
|
||||
// alltimetotal//monthtotal//weeklytotal//dailytotal//points//milestonecount//votepartycurrent//votepartyrequired
|
||||
|
||||
@Getter
|
||||
private int allTimeTotal = 0;
|
||||
@@ -21,15 +21,21 @@ public class BungeeMessageData {
|
||||
private int points = 0;
|
||||
@Getter
|
||||
private int weeklyTotal = 0;
|
||||
@Getter
|
||||
private int votePartyCurrent = 0;
|
||||
@Getter
|
||||
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 +48,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,472 +0,0 @@
|
||||
package com.bencodez.votingplugin.bungee;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.bencodez.advancedcore.api.user.userstorage.mysql.api.queries.Query;
|
||||
import com.bencodez.advancedcore.api.user.userstorage.sql.Column;
|
||||
import com.bencodez.advancedcore.api.user.userstorage.sql.DataType;
|
||||
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
|
||||
public class BungeeMySQL {
|
||||
private List<String> columns = Collections.synchronizedList(new ArrayList<String>());
|
||||
|
||||
private List<String> intColumns = new ArrayList<String>();
|
||||
|
||||
// private HashMap<String, ArrayList<Column>> table;
|
||||
|
||||
// ConcurrentMap<String, ArrayList<Column>> table = new
|
||||
// ConcurrentHashMap<String, ArrayList<Column>>();
|
||||
|
||||
private com.bencodez.advancedcore.api.user.userstorage.mysql.api.MySQL mysql;
|
||||
|
||||
private String name;
|
||||
|
||||
private Object object2 = new Object();
|
||||
|
||||
private Object object3 = new Object();
|
||||
|
||||
private Object object4 = new Object();
|
||||
|
||||
private Set<String> uuids = Collections.synchronizedSet(new HashSet<String>());
|
||||
|
||||
public BungeeMySQL(String tableName, Configuration section) {
|
||||
String tablePrefix = section.getString("Prefix");
|
||||
String hostName = section.getString("Host");
|
||||
int port = section.getInt("Port");
|
||||
String user = section.getString("Username");
|
||||
String pass = section.getString("Password");
|
||||
String database = section.getString("Database");
|
||||
long lifeTime = section.getLong("MaxLifeTime", -1);
|
||||
int maxThreads = section.getInt("MaxConnections", 1);
|
||||
String str = section.getString("Line", "");
|
||||
if (maxThreads < 1) {
|
||||
maxThreads = 1;
|
||||
}
|
||||
boolean useSSL = section.getBoolean("UseSSL", false);
|
||||
boolean publicKeyRetrieval = section.getBoolean("PublicKeyRetrieval", false);
|
||||
if (!section.getString("Name", "").isEmpty()) {
|
||||
tableName = section.getString("Name", "");
|
||||
}
|
||||
|
||||
name = tableName;
|
||||
if (tablePrefix != null) {
|
||||
name = tablePrefix + tableName;
|
||||
}
|
||||
mysql = new com.bencodez.advancedcore.api.user.userstorage.mysql.api.MySQL(maxThreads);
|
||||
if (!mysql.connect(hostName, "" + port, user, pass, database, useSSL, lifeTime, str, publicKeyRetrieval)) {
|
||||
|
||||
}
|
||||
try {
|
||||
Query q = new Query(mysql, "USE " + database + ";");
|
||||
q.executeUpdateAsync();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String sql = "CREATE TABLE IF NOT EXISTS " + getName() + " (";
|
||||
sql += "uuid VARCHAR(37),";
|
||||
sql += "PRIMARY KEY ( uuid )";
|
||||
sql += ");";
|
||||
Query query;
|
||||
try {
|
||||
query = new Query(mysql, sql);
|
||||
|
||||
query.executeUpdateAsync();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
loadData();
|
||||
|
||||
// tempoary to improve performance from old tables
|
||||
// addToQue("ALTER TABLE " + getName() + " MODIFY uuid VARCHAR(37);");
|
||||
alterColumnType("uuid", "VARCHAR(37)");
|
||||
}
|
||||
|
||||
public void addColumn(String column, DataType dataType) {
|
||||
synchronized (object3) {
|
||||
String sql = "ALTER TABLE " + getName() + " ADD COLUMN " + column + " text" + ";";
|
||||
try {
|
||||
Query query = new Query(mysql, sql);
|
||||
query.executeUpdate();
|
||||
|
||||
getColumns().add(column);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void alterColumnType(String column, String newType) {
|
||||
checkColumn(column, DataType.STRING);
|
||||
if (newType.contains("INT")) {
|
||||
try {
|
||||
new Query(mysql, "UPDATE " + getName() + " SET " + column + " = '0' where trim(coalesce(" + column
|
||||
+ ", '')) = '';").executeUpdateAsync();
|
||||
} catch (SQLException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
;
|
||||
if (!intColumns.contains(column)) {
|
||||
intColumns.add(column);
|
||||
}
|
||||
}
|
||||
try {
|
||||
new Query(mysql, "ALTER TABLE " + getName() + " MODIFY " + column + " " + newType + ";")
|
||||
.executeUpdateAsync();
|
||||
} catch (SQLException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void checkColumn(String column, DataType dataType) {
|
||||
synchronized (object4) {
|
||||
if (!getColumns().contains(column)) {
|
||||
if (!getColumnsQueury().contains(column)) {
|
||||
addColumn(column, dataType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void clearCache() {
|
||||
clearCacheBasic();
|
||||
}
|
||||
|
||||
public void clearCacheBasic() {
|
||||
columns.clear();
|
||||
columns.addAll(getColumnsQueury());
|
||||
uuids.clear();
|
||||
uuids.addAll(getUuidsQuery());
|
||||
}
|
||||
|
||||
public void close() {
|
||||
mysql.disconnect();
|
||||
}
|
||||
|
||||
public boolean containsKeyQuery(String index) {
|
||||
String sqlStr = "SELECT uuid FROM " + getName() + ";";
|
||||
try (Connection conn = mysql.getConnectionManager().getConnection();
|
||||
PreparedStatement sql = conn.prepareStatement(sqlStr)) {
|
||||
ResultSet rs = sql.executeQuery();
|
||||
/*
|
||||
* Query query = new Query(mysql, sql); ResultSet rs = query.executeQuery();
|
||||
*/
|
||||
while (rs.next()) {
|
||||
if (rs.getString("uuid").equals(index)) {
|
||||
rs.close();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<String> getColumns() {
|
||||
if (columns == null || columns.size() == 0) {
|
||||
loadData();
|
||||
}
|
||||
return columns;
|
||||
}
|
||||
|
||||
public ArrayList<String> getColumnsQueury() {
|
||||
ArrayList<String> columns = new ArrayList<String>();
|
||||
try (Connection conn = mysql.getConnectionManager().getConnection();
|
||||
PreparedStatement sql = conn.prepareStatement("SELECT * FROM " + getName() + ";")) {
|
||||
ResultSet rs = sql.executeQuery();
|
||||
/*
|
||||
* Query query = new Query(mysql, "SELECT * FROM " + getName() + ";"); ResultSet
|
||||
* rs = query.executeQuery();
|
||||
*/
|
||||
|
||||
ResultSetMetaData metadata = rs.getMetaData();
|
||||
int columnCount = 0;
|
||||
if (metadata != null) {
|
||||
columnCount = metadata.getColumnCount();
|
||||
|
||||
for (int i = 1; i <= columnCount; i++) {
|
||||
String columnName = metadata.getColumnName(i);
|
||||
columns.add(columnName);
|
||||
}
|
||||
rs.close();
|
||||
return columns;
|
||||
}
|
||||
rs.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return columns;
|
||||
|
||||
}
|
||||
|
||||
public ArrayList<Column> getExactQuery(Column column) {
|
||||
ArrayList<Column> result = new ArrayList<>();
|
||||
String query = "SELECT * FROM " + getName() + " WHERE `" + column.getName() + "`='"
|
||||
+ column.getValue().toString() + "';";
|
||||
|
||||
try (Connection conn = mysql.getConnectionManager().getConnection();
|
||||
PreparedStatement sql = conn.prepareStatement(query)) {
|
||||
ResultSet rs = sql.executeQuery();
|
||||
|
||||
/*
|
||||
* Query sql = new Query(mysql, query); sql.setParameter(1,
|
||||
* column.getValue().toString()); ResultSet rs = sql.executeQuery();
|
||||
*/
|
||||
if (rs.next()) {
|
||||
for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
|
||||
String columnName = rs.getMetaData().getColumnLabel(i);
|
||||
Column rCol = null;
|
||||
if (intColumns.contains(columnName)) {
|
||||
rCol = new Column(columnName, DataType.INTEGER);
|
||||
} else {
|
||||
rCol = new Column(columnName, DataType.STRING);
|
||||
}
|
||||
// System.out.println(i + " " +
|
||||
// rs.getMetaData().getColumnLabel(i));
|
||||
rCol.setValue(rs.getString(i));
|
||||
// System.out.println(rCol.getValue());
|
||||
result.add(rCol);
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
return result;
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
}
|
||||
|
||||
for (String col : getColumns()) {
|
||||
result.add(new Column(col, DataType.STRING));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ArrayList<String> getNamesQuery() {
|
||||
ArrayList<String> uuids = new ArrayList<String>();
|
||||
|
||||
checkColumn("PlayerName", DataType.STRING);
|
||||
ArrayList<Column> rows = getRowsNameQuery();
|
||||
if (rows != null) {
|
||||
for (Column c : rows) {
|
||||
uuids.add((String) c.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
return uuids;
|
||||
}
|
||||
|
||||
public ArrayList<Column> getRowsNameQuery() {
|
||||
ArrayList<Column> result = new ArrayList<Column>();
|
||||
String sqlStr = "SELECT PlayerName FROM " + getName() + ";";
|
||||
|
||||
try (Connection conn = mysql.getConnectionManager().getConnection();
|
||||
PreparedStatement sql = conn.prepareStatement(sqlStr)) {
|
||||
ResultSet rs = sql.executeQuery();
|
||||
/*
|
||||
* Query query = new Query(mysql, sql); ResultSet rs = query.executeQuery();
|
||||
*/
|
||||
|
||||
while (rs.next()) {
|
||||
Column rCol = new Column("PlayerName", rs.getString("PlayerName"), DataType.STRING);
|
||||
result.add(rCol);
|
||||
}
|
||||
sql.close();
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public ArrayList<Column> getRowsQuery() {
|
||||
ArrayList<Column> result = new ArrayList<Column>();
|
||||
String sqlStr = "SELECT uuid FROM " + getName() + ";";
|
||||
|
||||
try (Connection conn = mysql.getConnectionManager().getConnection();
|
||||
PreparedStatement sql = conn.prepareStatement(sqlStr)) {
|
||||
ResultSet rs = sql.executeQuery();
|
||||
/*
|
||||
* Query query = new Query(mysql, sql); ResultSet rs = query.executeQuery();
|
||||
*/
|
||||
|
||||
while (rs.next()) {
|
||||
Column rCol = new Column("uuid", rs.getString("uuid"), DataType.STRING);
|
||||
result.add(rCol);
|
||||
}
|
||||
rs.close();
|
||||
} catch (SQLException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getUUID(String playerName) {
|
||||
String query = "SELECT uuid FROM " + getName() + " WHERE " + "PlayerName" + "='" + playerName + "';";
|
||||
try (Connection conn = mysql.getConnectionManager().getConnection();
|
||||
PreparedStatement sql = conn.prepareStatement(query)) {
|
||||
ResultSet rs = sql.executeQuery();
|
||||
/*
|
||||
* Query sql = new Query(mysql, query); ResultSet rs = sql.executeQuery();
|
||||
*/
|
||||
if (rs.next()) {
|
||||
String uuid = rs.getString("uuid");
|
||||
if (uuid != null && !uuid.isEmpty()) {
|
||||
rs.close();
|
||||
return uuid;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Set<String> getUuids() {
|
||||
if (uuids == null || uuids.size() == 0) {
|
||||
uuids.clear();
|
||||
uuids.addAll(getUuidsQuery());
|
||||
return uuids;
|
||||
}
|
||||
return uuids;
|
||||
}
|
||||
|
||||
public ArrayList<String> getUuidsQuery() {
|
||||
ArrayList<String> uuids = new ArrayList<String>();
|
||||
|
||||
ArrayList<Column> rows = getRowsQuery();
|
||||
for (Column c : rows) {
|
||||
uuids.add((String) c.getValue());
|
||||
}
|
||||
|
||||
return uuids;
|
||||
}
|
||||
|
||||
public void insert(String index, String column, Object value, DataType dataType) {
|
||||
insertQuery(index, Arrays.asList(new Column(column, value, dataType)));
|
||||
}
|
||||
|
||||
public void insertQuery(String index, List<Column> cols) {
|
||||
String query = "INSERT " + getName() + " ";
|
||||
|
||||
query += "set uuid='" + index + "', ";
|
||||
|
||||
for (int i = 0; i < cols.size(); i++) {
|
||||
Column col = cols.get(i);
|
||||
if (i == cols.size() - 1) {
|
||||
query += col.getName() + "='" + col.getValue().toString() + "';";
|
||||
} else {
|
||||
query += col.getName() + "='" + col.getValue().toString() + "', ";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
uuids.add(index);
|
||||
new Query(mysql, query).executeUpdateAsync();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isIntColumn(String key) {
|
||||
return intColumns.contains(key);
|
||||
}
|
||||
|
||||
public void loadData() {
|
||||
columns = getColumnsQueury();
|
||||
}
|
||||
|
||||
public void update(String index, List<Column> cols, boolean queue) {
|
||||
for (Column col : cols) {
|
||||
checkColumn(col.getName(), col.getDataType());
|
||||
}
|
||||
if (getUuids().contains(index)) {
|
||||
synchronized (object2) {
|
||||
|
||||
String query = "UPDATE " + getName() + " SET ";
|
||||
|
||||
for (int i = 0; i < cols.size(); i++) {
|
||||
Column col = cols.get(i);
|
||||
if (i == cols.size() - 1) {
|
||||
if (col.getDataType().equals(DataType.STRING)) {
|
||||
query += col.getName() + "='" + col.getValue().toString() + "';";
|
||||
} else {
|
||||
query += col.getName() + "=" + col.getValue().toString() + ";";
|
||||
}
|
||||
} else {
|
||||
if (col.getDataType().equals(DataType.STRING)) {
|
||||
query += col.getName() + "='" + col.getValue().toString() + "', ";
|
||||
} else {
|
||||
query += col.getName() + "=" + col.getValue().toString() + ", ";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
query += " WHERE `uuid`=";
|
||||
query += "'" + index + "';";
|
||||
|
||||
try {
|
||||
Query q = new Query(mysql, query);
|
||||
q.executeUpdateAsync();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
insertQuery(index, cols);
|
||||
}
|
||||
}
|
||||
|
||||
public void update(String index, String column, Object value, DataType dataType) {
|
||||
checkColumn(column, dataType);
|
||||
if (getUuids().contains(index)) {
|
||||
synchronized (object2) {
|
||||
String query = "UPDATE " + getName() + " SET ";
|
||||
|
||||
if (dataType == DataType.STRING) {
|
||||
query += column + "='" + value.toString() + "'";
|
||||
} else {
|
||||
query += column + "=" + value;
|
||||
|
||||
}
|
||||
query += " WHERE `uuid`=";
|
||||
query += "'" + index + "';";
|
||||
|
||||
try {
|
||||
Query q = new Query(mysql, query);
|
||||
q.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
insert(index, column, value, dataType);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -29,10 +29,34 @@ public class Config {
|
||||
return getData().getStringList("BlockedServers");
|
||||
}
|
||||
|
||||
public List<String> getWhiteListedServers() {
|
||||
return getData().getStringList("WhiteListedServers");
|
||||
}
|
||||
|
||||
public boolean getBroadcast() {
|
||||
return getData().getBoolean("Broadcast", false);
|
||||
}
|
||||
|
||||
public boolean getGeyserSupport() {
|
||||
return getData().getBoolean("GeyserSupport", false);
|
||||
}
|
||||
|
||||
public String getGeyserPrefix() {
|
||||
return getData().getString("GeyserPrefix", ".");
|
||||
}
|
||||
|
||||
public boolean getOnlineMode() {
|
||||
return getData().getBoolean("OnlineMode", true);
|
||||
}
|
||||
|
||||
public boolean getGlobalDataEnabled() {
|
||||
return getData().getBoolean("GlobalData.Enabled", false);
|
||||
}
|
||||
|
||||
public boolean getGlobalDataUseMainMySQL() {
|
||||
return getData().getBoolean("GlobalData.UseMainMySQL", true);
|
||||
}
|
||||
|
||||
public String getBungeeHost() {
|
||||
return getData().getString("BungeeServer.Host", "");
|
||||
}
|
||||
@@ -53,6 +77,34 @@ public class Config {
|
||||
return getData().getBoolean("Debug", false);
|
||||
}
|
||||
|
||||
public boolean getMultiProxySupport() {
|
||||
return getData().getBoolean("MultiProxySupport", false);
|
||||
}
|
||||
|
||||
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 +129,34 @@ 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 String getVotePartyBroadcast() {
|
||||
return getData().getString("VoteParty.Broadcast", "");
|
||||
}
|
||||
|
||||
public List<String> getVotePartyServersToSend() {
|
||||
return getData().getStringList("VoteParty.ServersToSend");
|
||||
}
|
||||
|
||||
public List<String> getVotePartyBungeeCommands() {
|
||||
return getData().getStringList("VoteParty.BungeeCommands");
|
||||
}
|
||||
|
||||
public void load() {
|
||||
if (!bungee.getDataFolder().exists()) {
|
||||
bungee.getDataFolder().mkdir();
|
||||
|
||||
@@ -4,6 +4,8 @@ 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;
|
||||
@@ -18,6 +20,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());
|
||||
@@ -26,7 +52,13 @@ public class VoteCache {
|
||||
section.set("Time", voteData.getTime());
|
||||
section.set("Real", voteData.isRealVote());
|
||||
section.set("Text", voteData.getText());
|
||||
save();
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -37,7 +69,6 @@ public class VoteCache {
|
||||
section.set("Time", voteData.getTime());
|
||||
section.set("Real", voteData.isRealVote());
|
||||
section.set("Text", voteData.getText());
|
||||
save();
|
||||
}
|
||||
|
||||
public void clearData() {
|
||||
@@ -62,6 +93,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();
|
||||
}
|
||||
|
||||
@@ -14,10 +14,24 @@ public class VoteEventBungee implements net.md_5.bungee.api.plugin.Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onVote(VotifierEvent event) {
|
||||
Vote vote = event.getVote();
|
||||
plugin.getLogger().info("Vote received " + vote.getUsername() + " from service site " + vote.getServiceName());
|
||||
plugin.getProxy().getScheduler().runAsync(plugin, new Runnable() {
|
||||
|
||||
plugin.vote(vote.getUsername(), vote.getServiceName(), true);
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void run() {
|
||||
Vote vote = event.getVote();
|
||||
String serviceSite = vote.getServiceName();
|
||||
plugin.getLogger().info("Vote received " + vote.getUsername() + " from service site " + serviceSite);
|
||||
|
||||
if (serviceSite.isEmpty()) {
|
||||
serviceSite = "Empty";
|
||||
vote.setServiceName(serviceSite);
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -17,41 +19,91 @@ public class VotingPluginBungeeCommand extends Command {
|
||||
if (sender.hasPermission("votingplugin.admin")) {
|
||||
if (args.length > 0) {
|
||||
if (args[0].equalsIgnoreCase("reload")) {
|
||||
bungee.reload();
|
||||
bungee.reload(false);
|
||||
sender.sendMessage(new TextComponent("Reloading VotingPluginBungee"));
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("reloadmysql")) {
|
||||
bungee.reload(true);
|
||||
sender.sendMessage(new TextComponent("Reloading VotingPluginBungee with MySQL"));
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("vote")) {
|
||||
if (args.length >= 2) {
|
||||
String user = args[1];
|
||||
String site = args[2];
|
||||
bungee.vote(user, site, false);
|
||||
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(
|
||||
"Checking status, waiting for response, check console, method: sockets"));
|
||||
"&aChecking status, waiting for response, check console, method: sockets"));
|
||||
bungee.status(sender);
|
||||
} else if (bungee.getMethod().equals(BungeeMethod.PLUGINMESSAGING)) {
|
||||
sender.sendMessage(new TextComponent(
|
||||
"Checking status, waiting for response, check console, method: plugin messaging"));
|
||||
"&aChecking status, waiting for response, check console, method: plugin messaging"));
|
||||
bungee.status(sender);
|
||||
} else {
|
||||
sender.sendMessage(
|
||||
new TextComponent("Not using socket/pluginmessage method, command unavailable"));
|
||||
new TextComponent("&aNot using socket/pluginmessage method, command unavailable"));
|
||||
}
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("multiproxystatus")) {
|
||||
bungee.sendMultiProxyServerMessage("Status");
|
||||
sender.sendMessage(new TextComponent("&aSending status message"));
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("help")) {
|
||||
TextComponent[] msg = new TextComponent[3];
|
||||
TextComponent[] msg = new TextComponent[7];
|
||||
msg[0] = new TextComponent("&avotingpluginbungee reload - Reload plugin");
|
||||
msg[1] = new TextComponent("&avotingpluginbungee vote (player) (servicesite) - Send bungee vote");
|
||||
msg[2] = new TextComponent("&avotingplugin status - Check socket connection status");
|
||||
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("You do not have permission to do this!"));
|
||||
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,164 @@
|
||||
package com.bencodez.votingplugin.bungee.velocity;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import com.bencodez.advancedcore.bungeeapi.velocity.VelocityYMLFile;
|
||||
|
||||
import ninja.leaping.configurate.ConfigurationNode;
|
||||
|
||||
public class Config extends VelocityYMLFile {
|
||||
|
||||
public Config(File file) {
|
||||
super(file);
|
||||
}
|
||||
|
||||
public boolean getAllowUnJoined() {
|
||||
return getBoolean(getNode("AllowUnJoined"), false);
|
||||
}
|
||||
|
||||
public List<String> getBlockedServers() {
|
||||
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 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() {
|
||||
return getBoolean(getNode("BungeeManageTotals"), true);
|
||||
}
|
||||
|
||||
public String getBungeeMethod() {
|
||||
return getString(getNode("BungeeMethod"), "PLUGINMESSAGING");
|
||||
}
|
||||
|
||||
public String getBungeeHost() {
|
||||
return getString(getNode("BungeeServer", "Host"), "");
|
||||
}
|
||||
|
||||
public int getBungeePort() {
|
||||
return getInt(getNode("BungeeServer", "Port"), 1297);
|
||||
}
|
||||
|
||||
public boolean getDebug() {
|
||||
return getBoolean(getNode("Debug"), false);
|
||||
}
|
||||
|
||||
public String getFallBack() {
|
||||
return getString(getNode("FallBackServer"), "");
|
||||
}
|
||||
|
||||
public ConfigurationNode getMysqlNode() {
|
||||
return getNode("MySQL");
|
||||
}
|
||||
|
||||
public int getPointsOnVote() {
|
||||
return getInt(getNode("PointsOnVote"), 1);
|
||||
}
|
||||
|
||||
public boolean getSendVotesToAllServers() {
|
||||
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 @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 getGeyserSupport() {
|
||||
return getBoolean(getNode("GeyserSupport"), false);
|
||||
}
|
||||
|
||||
public boolean getPrimaryServer() {
|
||||
return getBoolean(getNode("PrimaryServer"), false);
|
||||
}
|
||||
|
||||
public String getGeyserPrefix() {
|
||||
return getString(getNode("GeyserPrefix"), "*");
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.bencodez.votingplugin.bungee.velocity;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.bencodez.advancedcore.bungeeapi.velocity.VelocityYMLFile;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
|
||||
public class NonVotedPlayersCache extends VelocityYMLFile {
|
||||
|
||||
private VotingPluginVelocity plugin;
|
||||
|
||||
public NonVotedPlayersCache(File file, VotingPluginVelocity plugin) {
|
||||
super(file);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public void addPlayer(Player player) {
|
||||
if (!plugin.getMysql().containsKeyQuery(player.getUniqueId().toString())) {
|
||||
addPlayer(player.getUniqueId().toString(), player.getUsername());
|
||||
}
|
||||
}
|
||||
|
||||
private void addPlayer(String uuid, String playerName) {
|
||||
getNode("NonVotedPlayers", playerName, "UUID").setValue(uuid);
|
||||
getNode("NonVotedPlayers", playerName, "LastTime").setValue(System.currentTimeMillis());
|
||||
save();
|
||||
}
|
||||
|
||||
public void check() {
|
||||
for (String player : getKeys(getNode("NonVotedPlayers"))) {
|
||||
long time = getNode("NonVotedPlayers", player, "LastTime").getLong(0);
|
||||
if ((System.currentTimeMillis() - time) > 1000 * 60 * 60 * 24 * 5) {
|
||||
remove(player);
|
||||
} else {
|
||||
String uuid = getNode("NonVotedPlayers", player, "UUID").getString("");
|
||||
if (!uuid.isEmpty()) {
|
||||
if (plugin.getMysql().containsKeyQuery(uuid)) {
|
||||
remove(player);
|
||||
}
|
||||
} else {
|
||||
remove(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
save();
|
||||
}
|
||||
|
||||
public String playerExists(String playerName) {
|
||||
if (!getNode("NonVotedPlayers", playerName).isEmpty()) {
|
||||
return getNode("NonVotedPlayers", playerName, "UUID").getString("");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private void remove(String player) {
|
||||
plugin.debug("Removing nonvotedplayer: " + player);
|
||||
|
||||
getNode("NonVotedPlayers", player).setValue(null);
|
||||
|
||||
save();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.bencodez.votingplugin.bungee.velocity;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
|
||||
import com.bencodez.advancedcore.bungeeapi.velocity.VelocityYMLFile;
|
||||
import com.bencodez.votingplugin.bungee.OfflineBungeeVote;
|
||||
import com.bencodez.votingplugin.timequeue.VoteTimeQueue;
|
||||
|
||||
import ninja.leaping.configurate.ConfigurationNode;
|
||||
|
||||
public class VoteCache extends VelocityYMLFile {
|
||||
|
||||
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 };
|
||||
|
||||
getNode(path, "Name").setValue(voteData.getPlayerName());
|
||||
getNode(path, "Service").setValue(voteData.getService());
|
||||
getNode(path, "UUID").setValue(voteData.getUuid());
|
||||
getNode(path, "Time").setValue(voteData.getTime());
|
||||
getNode(path, "Real").setValue(voteData.isRealVote());
|
||||
getNode(path, "Text").setValue(voteData.getText());
|
||||
}
|
||||
|
||||
public void addTimedVote(int num, VoteTimeQueue voteTimedQueue) {
|
||||
String[] path = new String[] { "TimedVoteCache", "" + num };
|
||||
getNode(path, "Name").setValue(voteTimedQueue.getName());
|
||||
getNode(path, "Service").setValue(voteTimedQueue.getService());
|
||||
getNode(path, "Time").setValue(voteTimedQueue.getTime());
|
||||
}
|
||||
|
||||
public void addVoteOnline(String player, int num, OfflineBungeeVote voteData) {
|
||||
String[] path = new String[] { "OnlineCache", player, "" + num };
|
||||
|
||||
getNode(path, "Name").setValue(voteData.getPlayerName());
|
||||
getNode(path, "Service").setValue(voteData.getService());
|
||||
getNode(path, "UUID").setValue(voteData.getUuid());
|
||||
getNode(path, "Time").setValue(voteData.getTime());
|
||||
getNode(path, "Real").setValue(voteData.isRealVote());
|
||||
getNode(path, "Text").setValue(voteData.getText());
|
||||
}
|
||||
|
||||
public void clearData() {
|
||||
getNode("VoteCache").setValue(null);
|
||||
getNode("OnlineCache").setValue(null);
|
||||
save();
|
||||
}
|
||||
|
||||
public Collection<String> getOnlineVotes(String name) {
|
||||
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);
|
||||
}
|
||||
|
||||
public Collection<String> getPlayers() {
|
||||
return getKeys(getNode("OnlineCache"));
|
||||
}
|
||||
|
||||
public Collection<String> getServers() {
|
||||
return getKeys(getNode("VoteCache"));
|
||||
}
|
||||
|
||||
public Collection<String> getTimedVoteCache() {
|
||||
return getKeys(getNode("TimedVoteCache"));
|
||||
}
|
||||
|
||||
public Collection<String> getServerVotes(String server) {
|
||||
return getKeys(getNode("OnlineCache", server));
|
||||
}
|
||||
|
||||
public ConfigurationNode getServerVotes(String server, String num) {
|
||||
return getNode("VoteCache", server, num);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.bencodez.votingplugin.bungee.velocity;
|
||||
|
||||
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||
|
||||
public class VotingPluginChannelIdentifier implements ChannelIdentifier {
|
||||
public VotingPluginChannelIdentifier() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return "vp:vp";
|
||||
}
|
||||
|
||||
}
|
||||
+1489
File diff suppressed because it is too large.
Load diff
+119
@@ -0,0 +1,119 @@
|
||||
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;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
|
||||
public class VotingPluginVelocityCommand implements SimpleCommand {
|
||||
private VotingPluginVelocity plugin;
|
||||
|
||||
public VotingPluginVelocityCommand(VotingPluginVelocity plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(final Invocation invocation) {
|
||||
CommandSource source = invocation.source();
|
||||
// Get the arguments after the command alias
|
||||
String[] args = invocation.arguments();
|
||||
|
||||
if (args.length > 0) {
|
||||
if (args[0].equalsIgnoreCase("reload")) {
|
||||
plugin.reload(false);
|
||||
source.sendMessage(Component.text("Reloading VotingPluginBungee").color(NamedTextColor.AQUA));
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("reloadmysql")) {
|
||||
plugin.reload(true);
|
||||
source.sendMessage(Component.text("Reloading VotingPluginBungee MySQL").color(NamedTextColor.AQUA));
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("vote")) {
|
||||
if (args.length >= 2) {
|
||||
String user = args[1];
|
||||
String site = args[2];
|
||||
plugin.vote(user, site, false, true, 0, null, null);
|
||||
source.sendMessage(Component.text("Sending vote").color(NamedTextColor.AQUA));
|
||||
}
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("forcetimechange")) {
|
||||
if (args.length >= 2) {
|
||||
plugin.getBungeeTimeChecker().forceChanged(TimeType.getTimeType(args[1]));
|
||||
source.sendMessage(Component.text("Triggering time change: " + args[1]).color(NamedTextColor.AQUA));
|
||||
}
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("status")) {
|
||||
if (plugin.getMethod().equals(BungeeMethod.SOCKETS)) {
|
||||
source.sendMessage(
|
||||
Component.text("Checking status, waiting for response, check console, method: sockets")
|
||||
.color(NamedTextColor.AQUA));
|
||||
plugin.status();
|
||||
} else if (plugin.getMethod().equals(BungeeMethod.PLUGINMESSAGING)) {
|
||||
source.sendMessage(Component
|
||||
.text("Checking status, waiting for response, check console, method: pluginmessaging")
|
||||
.color(NamedTextColor.AQUA));
|
||||
plugin.status();
|
||||
} else {
|
||||
source.sendMessage(Component.text("Not using socket/pluginmessage method, command unavailable")
|
||||
.color(NamedTextColor.AQUA));
|
||||
}
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("multiproxystatus")) {
|
||||
plugin.sendMultiProxyServerMessage("Status");
|
||||
source.sendMessage(Component.text("Sending status message").color(NamedTextColor.AQUA));
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("help")) {
|
||||
String[] msg = new String[7];
|
||||
msg[0] = "votingpluginbungee reload - Reload plugin";
|
||||
msg[1] = "votingpluginbungee reloadmysql - Reload plugin including mysql";
|
||||
msg[2] = "votingpluginbungee vote (player) (servicesite) - Send bungee vote";
|
||||
msg[3] = "votingpluginbungee status - Check socket connection status";
|
||||
msg[4] = "&avotingpluginbungee forcetimechange (timetype) - Force a time change";
|
||||
msg[5] = "&avotingpluginbungee voteparty force - Force a vote party";
|
||||
msg[6] = "&avotingpluginbungee voteparty setvotecount (number) - Set current vote party votes";
|
||||
for (String m : msg) {
|
||||
source.sendMessage(Component.text(m).color(NamedTextColor.AQUA));
|
||||
}
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("voteparty")) {
|
||||
if (args.length > 1) {
|
||||
if (args[1].equalsIgnoreCase("Force")) {
|
||||
plugin.setCurrentVotePartyVotes(plugin.getCurrentVotePartyVotesRequired());
|
||||
plugin.checkVoteParty();
|
||||
source.sendMessage(Component.text("Vote party forced").color(NamedTextColor.AQUA));
|
||||
}
|
||||
if (args.length > 2) {
|
||||
if (args[1].equalsIgnoreCase("SetVoteCount")) {
|
||||
if (isInt(args[2])) {
|
||||
plugin.setCurrentVotePartyVotes(Integer.parseInt(args[2]));
|
||||
source.sendMessage(Component.text("Set current vote party votes to " + args[2])
|
||||
.color(NamedTextColor.AQUA));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(final Invocation invocation) {
|
||||
return invocation.source().hasPermission("votingpluginbungee.admin");
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.bencodez.votingplugin.commands;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -29,11 +28,10 @@ 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.misc.PlayerUtils;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardHandler;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardOptions;
|
||||
import com.bencodez.advancedcore.api.updater.Updater;
|
||||
import com.bencodez.advancedcore.api.user.UUID;
|
||||
import com.bencodez.advancedcore.api.user.UserStorage;
|
||||
import com.bencodez.advancedcore.api.user.userstorage.DataType;
|
||||
import com.bencodez.advancedcore.api.valuerequest.ValueRequest;
|
||||
import com.bencodez.advancedcore.api.valuerequest.listeners.BooleanListener;
|
||||
import com.bencodez.advancedcore.api.valuerequest.listeners.StringListener;
|
||||
@@ -47,6 +45,7 @@ import com.bencodez.votingplugin.commands.gui.admin.AdminVotePerms;
|
||||
import com.bencodez.votingplugin.commands.gui.admin.AdminVotePlaceholders;
|
||||
import com.bencodez.votingplugin.commands.gui.admin.AdminVotePlaceholdersPlayer;
|
||||
import com.bencodez.votingplugin.commands.gui.admin.AdminVoteVoteParty;
|
||||
import com.bencodez.votingplugin.commands.gui.admin.AdminVoteVotePlayer;
|
||||
import com.bencodez.votingplugin.commands.gui.admin.cumulative.AdminVoteCumulative;
|
||||
import com.bencodez.votingplugin.commands.gui.admin.milestones.AdminVoteMilestones;
|
||||
import com.bencodez.votingplugin.commands.gui.admin.voteshop.AdminVoteVoteShop;
|
||||
@@ -70,7 +69,6 @@ import com.bencodez.votingplugin.test.VoteTester;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoter;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
import com.tchristofferson.configupdater.ConfigUpdater;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
@@ -258,38 +256,37 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "ResyncMilestones" },
|
||||
"VotingPlugin.Commands.AdminVote.ResyncMilestones|" + adminPerm, "Resync Milestones") {
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "ResyncMilestones" },
|
||||
"VotingPlugin.Commands.AdminVote.ResyncMilestones|" + adminPerm,
|
||||
"Resync Milestones to all time total") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
sendMessage(sender, "&cStarting...");
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
VotingPluginUser user = UserManager.getInstance()
|
||||
.getVotingPluginUser(UUID.fromString(uuid));
|
||||
user.dontCache();
|
||||
user.setMilestoneCount(user.getTotal(TopVoter.AllTime));
|
||||
}
|
||||
sendMessage(sender, "&cFinished sync milestonecount with all time total");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "ResetMilestoneCount" },
|
||||
"VotingPlugin.Commands.AdminVote.ResetMilestoneCount|" + adminPerm, "Resets milestone count to 0") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
sendMessage(sender, "&cStarting...");
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
user.setMilestoneCount(user.getTotal(TopVoter.AllTime));
|
||||
}
|
||||
sendMessage(sender, "&cStarting to clear milestonecounts...");
|
||||
plugin.getTopVoterHandler().resetMilestoneCount();
|
||||
sendMessage(sender, "&cFinished");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "ResetMilestoneCount" },
|
||||
"VotingPlugin.Commands.AdminVote.ResetMilestoneCount|" + adminPerm,
|
||||
"Resets milestone count to alltimetotal") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
sendMessage(sender, "&cStarting to clear milestonecounts...");
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
user.setMilestoneCount(0);
|
||||
}
|
||||
sendMessage(sender, "&cFinished");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "ResyncMilestonesAlreadyGiven" },
|
||||
"VotingPlugin.Commands.AdminVote.ResyncMilestonesGiven|" + adminPerm,
|
||||
@@ -308,7 +305,9 @@ public class CommandLoader {
|
||||
}
|
||||
}
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
VotingPluginUser user = UserManager.getInstance()
|
||||
.getVotingPluginUser(UUID.fromString(uuid));
|
||||
user.dontCache();
|
||||
int milestoneCount = user.getMilestoneCount();
|
||||
for (int num : nums) {
|
||||
if (milestoneCount >= num) {
|
||||
@@ -320,6 +319,16 @@ public class CommandLoader {
|
||||
+ user.getMilestoneCount());
|
||||
user.setHasGotteMilestone(num, true);
|
||||
}
|
||||
} else {
|
||||
if (user.hasGottenMilestone(num)) {
|
||||
sendMessage(sender,
|
||||
"&cMilestone " + num + " for " + user.getPlayerName()
|
||||
+ " already given when it shouldn't be, Current AllTimeTotal: "
|
||||
+ user.getTotal(TopVoter.AllTime) + ", Current MileStoneCount: "
|
||||
+ user.getMilestoneCount());
|
||||
user.setHasGotteMilestone(num, false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -336,10 +345,8 @@ public class CommandLoader {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
sendMessage(sender, "&cStarting...");
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
user.setPoints(0);
|
||||
}
|
||||
plugin.getUserManager().removeAllKeyValues("Points", DataType.INTEGER);
|
||||
plugin.getUserManager().getDataManager().clearCache();
|
||||
sendMessage(sender, "&cFinished");
|
||||
|
||||
}
|
||||
@@ -366,12 +373,14 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
synchronized (pointLock) {
|
||||
user.addPoints(Integer.parseInt(args[3]));
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
user.cache();
|
||||
int newTotal = 0;
|
||||
newTotal = user.addPoints(Integer.parseInt(args[3]));
|
||||
sender.sendMessage(StringParser.getInstance().colorize("&cGave " + args[1] + " " + args[3]
|
||||
+ " points" + ", " + args[1] + " now has " + newTotal + " points"));
|
||||
}
|
||||
sender.sendMessage(StringParser.getInstance().colorize("&cGave " + args[1] + " " + args[3]
|
||||
+ " points" + ", " + args[1] + " now has " + user.getPoints() + " points"));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -382,6 +391,7 @@ public class CommandLoader {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
user.cache();
|
||||
user.removePoints(Integer.parseInt(args[3]));
|
||||
sender.sendMessage(StringParser.getInstance().colorize("&cRemoved " + args[3] + " points from "
|
||||
+ args[1] + ", " + args[1] + " now has " + user.getPoints() + " points"));
|
||||
@@ -410,7 +420,7 @@ public class CommandLoader {
|
||||
for (String serviceSite : serviceSites) {
|
||||
boolean hasSite = plugin.hasVoteSite(serviceSite);
|
||||
if (hasSite) {
|
||||
String siteName = plugin.getVoteSiteName(serviceSite);
|
||||
String siteName = plugin.getVoteSiteName(true, serviceSite);
|
||||
sendMessage(sender, serviceSite + " : Current site = " + siteName);
|
||||
} else {
|
||||
sendMessage(sender, serviceSite
|
||||
@@ -430,7 +440,6 @@ public class CommandLoader {
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
int page = Integer.parseInt(args[1]);
|
||||
new AdminVoteHelp(plugin, sender, page).open();
|
||||
;
|
||||
|
||||
}
|
||||
});
|
||||
@@ -626,6 +635,12 @@ public class CommandLoader {
|
||||
|
||||
sendMessage(sender,
|
||||
"Using AdvancedCore " + plugin.getVersion() + "' built on '" + plugin.getBuildTime());
|
||||
if (!plugin.getAdvancedCoreBuildNumber().equals("NOTSET")) {
|
||||
sendMessage(sender, "AdvancedCore Jenkins build number: " + plugin.getAdvancedCoreBuildNumber());
|
||||
}
|
||||
if (!plugin.getBuildNumber().equals("NOTSET")) {
|
||||
sendMessage(sender, "Using votingplugin jenkins build: " + plugin.getBuildNumber());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -654,7 +669,7 @@ public class CommandLoader {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
new AdminGUI(plugin).openAdminGUIVoteSiteSite((Player) sender, plugin.getVoteSite(args[1]));
|
||||
new AdminGUI(plugin).openAdminGUIVoteSiteSite((Player) sender, plugin.getVoteSite(args[1], false));
|
||||
} else {
|
||||
sender.sendMessage("Must be a player to do this");
|
||||
}
|
||||
@@ -680,7 +695,7 @@ public class CommandLoader {
|
||||
try {
|
||||
sender.sendMessage(ChatColor.GREEN + "PlayerName of player " + ChatColor.DARK_GREEN + args[1]
|
||||
+ ChatColor.GREEN + " is: " + PlayerUtils.getInstance().getPlayerName(
|
||||
UserManager.getInstance().getVotingPluginUser(new UUID(args[1])), args[1]));
|
||||
UserManager.getInstance().getVotingPluginUser(UUID.fromString(args[1])), args[1]));
|
||||
} catch (IllegalArgumentException e) {
|
||||
sendMessage(sender, "&cInvalid uuid");
|
||||
}
|
||||
@@ -699,16 +714,16 @@ public class CommandLoader {
|
||||
return;
|
||||
}
|
||||
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
user.clearTotals();
|
||||
for (TopVoter top : TopVoter.values()) {
|
||||
plugin.getUserManager().removeAllKeyValues(top.getColumnName(), DataType.INTEGER);
|
||||
}
|
||||
plugin.getUserManager().getDataManager().clearCache();
|
||||
sender.sendMessage(StringParser.getInstance().colorize("&cCleared totals for everyone"));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "ClearOfflineRewards" },
|
||||
"VotingPlugin.Commands.AdminVote.ClearOfflineRewards|" + adminPerm, "Reset offline votes/rewards") {
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "ClearOfflineVoteRewards" },
|
||||
"VotingPlugin.Commands.AdminVote.ClearOfflineVoteRewards|" + adminPerm, "Reset offline votes/rewards") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
@@ -717,34 +732,52 @@ public class CommandLoader {
|
||||
StringParser.getInstance().colorize("&cThis command can not be done from ingame"));
|
||||
return;
|
||||
}
|
||||
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
user.clearOfflineRewards();
|
||||
}
|
||||
sender.sendMessage(StringParser.getInstance().colorize("&cCleared totals for everyone"));
|
||||
plugin.getUserManager().removeAllKeyValues("OfflineVotes", DataType.STRING);
|
||||
plugin.getUserManager().removeAllKeyValues(plugin.getUserManager().getOfflineRewardsPath(),
|
||||
DataType.STRING);
|
||||
plugin.getUserManager().getDataManager().clearCache();
|
||||
sender.sendMessage(StringParser.getInstance().colorize("&cCleared offline votes/rewards"));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "ConvertFromData", "(userstorage)" },
|
||||
"VotingPlugin.Commands.AdminVote.ConvertFromData",
|
||||
"Convert from selected user storage to current user storage") {
|
||||
.add(new CommandHandler(new String[] { "User", "(player)", "SetVoteStreak", "DAY", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.SetVoteStreak.Day|" + adminPerm, "Set votestreak for player") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
sender.sendMessage(StringParser.getInstance().colorize("&cThis can not be done ingame"));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
sender.sendMessage("Starting to convert");
|
||||
UserStorage prevStorage = UserStorage.valueOf(args[1].toUpperCase());
|
||||
plugin.convertDataStorage(prevStorage, VotingPluginMain.plugin.getStorageType());
|
||||
sender.sendMessage("Finished converting!");
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
UserManager.getInstance().getVotingPluginUser(args[1])
|
||||
.setDayVoteStreak(Integer.parseInt(args[4]));
|
||||
sender.sendMessage(StringParser.getInstance()
|
||||
.colorize("&cSet votestreak day for '" + args[1] + "' to " + args[4]));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "User", "(player)", "SetVoteStreak", "WEEK", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.SetVoteStreak.Week|" + adminPerm,
|
||||
"Set votestreak for player") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
UserManager.getInstance().getVotingPluginUser(args[1])
|
||||
.setWeekVoteStreak(Integer.parseInt(args[4]));
|
||||
sender.sendMessage(StringParser.getInstance()
|
||||
.colorize("&cSet votestreak week for '" + args[1] + "' to " + args[4]));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "User", "(player)", "SetVoteStreak", "MONTH", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.SetVoteStreak.Month|" + adminPerm,
|
||||
"Set votestreak for player") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
UserManager.getInstance().getVotingPluginUser(args[1])
|
||||
.setMonthVoteStreak(Integer.parseInt(args[4]));
|
||||
sender.sendMessage(StringParser.getInstance()
|
||||
.colorize("&cSet votestreak month for '" + args[1] + "' to " + args[4]));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -797,6 +830,7 @@ public class CommandLoader {
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
user.setMilestoneCount(user.getMilestoneCount() + Integer.parseInt(args[3]));
|
||||
plugin.getSpecialRewards().checkMilestone(user, null, false);
|
||||
sender.sendMessage(
|
||||
StringParser.getInstance().colorize("&cAdded milestonecount for " + args[1]));
|
||||
}
|
||||
@@ -815,6 +849,20 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "User", "(player)", "ClearGottenMilestones" },
|
||||
"VotingPlugin.Commands.AdminVote.ClearGottenMilestones|" + adminPerm,
|
||||
"Clears received milestones") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
user.setHasGottenMilestone(new HashMap<String, Boolean>());
|
||||
sender.sendMessage(
|
||||
StringParser.getInstance().colorize("&cClearing gotten milestones for " + args[1]));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "Vote", "(player)", "All" },
|
||||
"VotingPlugin.Commands.AdminVote.Vote|" + adminPerm, "Trigger manual vote") {
|
||||
|
||||
@@ -822,15 +870,22 @@ public class CommandLoader {
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
sendMessage(sender, "&cTriggering vote for all voting sites...");
|
||||
for (VoteSite site : plugin.getVoteSites()) {
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(site, args[1], site.getServiceSite(), false);
|
||||
if (voteEvent.getVoteSite() != null) {
|
||||
if (!voteEvent.getVoteSite().isVaidServiceSite()) {
|
||||
sendMessage(sender,
|
||||
"&cPossible issue with service site, has the server gotten the vote from "
|
||||
+ voteEvent.getServiceSite() + "?");
|
||||
plugin.getVoteTimer().submit(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(site, args[1], site.getServiceSite(),
|
||||
false);
|
||||
if (voteEvent.getVoteSite() != null) {
|
||||
if (!voteEvent.getVoteSite().isVaidServiceSite()) {
|
||||
sendMessage(sender,
|
||||
"&cPossible issue with service site, has the server gotten the vote from "
|
||||
+ voteEvent.getServiceSite() + "?");
|
||||
}
|
||||
}
|
||||
plugin.getServer().getPluginManager().callEvent(voteEvent);
|
||||
}
|
||||
}
|
||||
plugin.getServer().getPluginManager().callEvent(voteEvent);
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.isYmlError()) {
|
||||
@@ -845,23 +900,72 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(plugin.getVoteSite(args[2]), args[1], args[2], false);
|
||||
sendMessage(sender, "&cTriggering vote...");
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(plugin.getVoteSite(args[2], true), args[1], args[2],
|
||||
false);
|
||||
if (voteEvent.getVoteSite() != null) {
|
||||
if (!voteEvent.getVoteSite().isVaidServiceSite()) {
|
||||
sendMessage(sender, "&cPossible issue with service site, has the server gotten the vote from "
|
||||
+ voteEvent.getServiceSite() + "?");
|
||||
}
|
||||
}
|
||||
plugin.getServer().getPluginManager().callEvent(voteEvent);
|
||||
sendMessage(sender, "&cTriggering vote...");
|
||||
|
||||
if (plugin.isYmlError()) {
|
||||
sendMessage(sender, "&3Detected yml error, please check server log for details");
|
||||
plugin.getVoteTimer().submit(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
plugin.getServer().getPluginManager().callEvent(voteEvent);
|
||||
}
|
||||
});
|
||||
|
||||
if (plugin.isYmlError()) {
|
||||
sendMessage(sender, "&3Detected yml error, please check server log for details");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "VoteExact", "(PlayerExact)", "(Sitename)" },
|
||||
"VotingPlugin.Commands.AdminVote.VoteExact|" + adminPerm,
|
||||
"Trigger manual vote with exact player name") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(plugin.getVoteSite(args[2], true), args[1],
|
||||
args[2], false);
|
||||
sendMessage(sender, "&cTriggering vote...");
|
||||
if (voteEvent.getVoteSite() != null) {
|
||||
if (!voteEvent.getVoteSite().isVaidServiceSite()) {
|
||||
sendMessage(sender,
|
||||
"&cPossible issue with service site, has the server gotten the vote from "
|
||||
+ voteEvent.getServiceSite() + "?");
|
||||
}
|
||||
}
|
||||
plugin.getVoteTimer().submit(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
plugin.getServer().getPluginManager().callEvent(voteEvent);
|
||||
}
|
||||
});
|
||||
|
||||
if (plugin.isYmlError()) {
|
||||
sendMessage(sender, "&3Detected yml error, please check server log for details");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "Vote", "(player)", },
|
||||
"VotingPlugin.Commands.AdminVote.Vote|" + adminPerm, "Trigger manual vote via GUI", false) {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
new AdminVoteVotePlayer(plugin, sender, args[1]).open();
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "Vote" },
|
||||
"VotingPlugin.Commands.AdminVote.Vote|" + adminPerm, "Manual vote syntax") {
|
||||
|
||||
@@ -902,8 +1006,8 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(plugin.getVoteSite(args[3]), args[1], args[3],
|
||||
false);
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(plugin.getVoteSite(args[3], true), args[1],
|
||||
args[3], false);
|
||||
sendMessage(sender, "&cTriggering vote...");
|
||||
if (voteEvent.getVoteSite() != null) {
|
||||
if (!voteEvent.getVoteSite().isVaidServiceSite()) {
|
||||
@@ -917,6 +1021,21 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "User", "(Player)", "ForceCoolDownEndRewards", "(Sitename)" },
|
||||
"VotingPlugin.Commands.AdminVote.ForceCoolDownEndRewards|" + adminPerm,
|
||||
"Trigger CoolDownEndRewards manually") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
plugin.getRewardHandler().giveReward(user, plugin.getVoteSite(args[3], true).getSiteData(),
|
||||
"CoolDownEndRewards", new RewardOptions());
|
||||
sendMessage(sender, "&cCoolDownEndRewards forced on votesite " + args[3]);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "VoteSite", "(sitename)", "Create" },
|
||||
"VotingPlugin.Commands.AdminVote.VoteSite.Edit|" + adminPerm, "Create VoteSite") {
|
||||
|
||||
@@ -941,26 +1060,6 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "Config", "Update" },
|
||||
"VotingPlugin.Commands.AdminVote.Config.Edit|" + adminPerm, "Updates config with missing values") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
ArrayList<String> ignoreSections = new ArrayList<String>();
|
||||
ignoreSections.add("VoteReminding");
|
||||
|
||||
File file = new File(plugin.getDataFolder(), "Config.yml");
|
||||
try {
|
||||
ConfigUpdater.update(plugin, "Config.yml", file, ignoreSections);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
plugin.getConfigFile().reloadData();
|
||||
plugin.getConfigFile().loadValues();
|
||||
sendMessage(sender, "&cUpdated config with new values");
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "Config", "TempExtraDebug" },
|
||||
"VotingPlugin.Commands.AdminVote.Config.Edit|" + adminPerm,
|
||||
@@ -978,7 +1077,7 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
String voteSite = plugin.getVoteSiteName(args[1]);
|
||||
String voteSite = plugin.getVoteSiteName(true, args[1]);
|
||||
String serviceSite = args[3];
|
||||
plugin.getConfigVoteSites().setServiceSite(voteSite, serviceSite);
|
||||
sender.sendMessage(StringParser.getInstance()
|
||||
@@ -992,7 +1091,7 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
String voteSite = plugin.getVoteSiteName(args[1]);
|
||||
String voteSite = plugin.getVoteSiteName(true, args[1]);
|
||||
String url = args[3];
|
||||
plugin.getConfigVoteSites().setVoteURL(voteSite, url);
|
||||
sender.sendMessage(StringParser.getInstance()
|
||||
@@ -1006,7 +1105,7 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
String voteSite = plugin.getVoteSiteName(args[1]);
|
||||
String voteSite = plugin.getVoteSiteName(true, args[1]);
|
||||
int value = Integer.parseInt(args[3]);
|
||||
plugin.getConfigVoteSites().setPriority(voteSite, value);
|
||||
sender.sendMessage(StringParser.getInstance()
|
||||
@@ -1021,7 +1120,7 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
String voteSite = plugin.getVoteSiteName(args[1]);
|
||||
String voteSite = plugin.getVoteSiteName(true, args[1]);
|
||||
int delay = Integer.parseInt(args[3]);
|
||||
plugin.getConfigVoteSites().setVoteDelay(voteSite, delay);
|
||||
sender.sendMessage(StringParser.getInstance()
|
||||
@@ -1077,7 +1176,7 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
String voteSite = plugin.getVoteSiteName(args[1]);
|
||||
String voteSite = plugin.getVoteSiteName(false, args[1]);
|
||||
boolean value = Boolean.parseBoolean(args[3]);
|
||||
|
||||
plugin.getConfigVoteSites().setEnabled(voteSite, value);
|
||||
@@ -1126,32 +1225,20 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "SetVotePartyCount", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.SetVotePartyCount|" + adminPerm, "Set voteparty count") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
plugin.getVoteParty().setTotalVotes(Integer.parseInt(args[1]));
|
||||
sendMessage(sender, "&cSet vote party count to " + args[1]);
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "ClearOfflineVotes" },
|
||||
"VotingPlugin.Commands.AdminVote.ClearOfflineVotes|" + adminPerm, "Clear all offline votes") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
user.setOfflineVotes(new ArrayList<String>());
|
||||
}
|
||||
sender.sendMessage(StringParser.getInstance().colorize("&cCleared"));
|
||||
plugin.getUserManager().removeAllKeyValues("OfflineVotes", DataType.STRING);
|
||||
plugin.getUserManager().getDataManager().clearCache();
|
||||
sender.sendMessage(StringParser.getInstance().colorize("&cOffline votes Cleared"));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "Test", "(Player)", "(sitename)", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.Test|" + adminPerm, "Test voting times") {
|
||||
"VotingPlugin.Commands.AdminVote.Test|" + adminPerm, "Test voting speed, for debug") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
@@ -1162,9 +1249,22 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "TestSpam", "(Player)", "(sitename)", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.TestSpam|" + adminPerm, "Test voting spam speed, for debug") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
VoteTester.getInstance().testSpam(Integer.parseInt(args[3]), args[1], args[2]);
|
||||
if (isPlayer(sender)) {
|
||||
sendMessage(sender, "&cSee console for details");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "TestReward", "(Player)", "(reward)", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.TestReward|" + adminPerm, "Test reward times") {
|
||||
"VotingPlugin.Commands.AdminVote.TestReward|" + adminPerm, "Test reward speed, for debug") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
@@ -1187,25 +1287,51 @@ public class CommandLoader {
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "ForceVoteParty" },
|
||||
"VotingPlugin.Commands.AdminVote.ForceVoteParty|" + adminPerm,
|
||||
.add(new CommandHandler(new String[] { "VoteParty", "Force" },
|
||||
"VotingPlugin.Commands.AdminVote.VoteParty.Force|" + adminPerm,
|
||||
"Force a voteparty reward, resets vote count") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
plugin.getVoteParty().giveRewards(plugin.getBungeeSettings().isUseBungeecoord());
|
||||
plugin.getVoteParty().giveRewards(null, plugin.getBungeeSettings().isUseBungeecoord());
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "VoteParty", "SetVoteCount", "(Number)" },
|
||||
"VotingPlugin.Commands.AdminVote.VoteParty.SetVoteCount|" + adminPerm, "Set voteparty count") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
int num = Integer.parseInt(args[2]);
|
||||
if (num == 0) {
|
||||
plugin.getVoteParty().reset(true);
|
||||
sendMessage(sender, "&cVoteparty totals have been set to 0 and all been reset");
|
||||
} else {
|
||||
plugin.getVoteParty().setTotalVotes(num);
|
||||
sendMessage(sender, "&cVoteparty total votes has been set to " + args[2]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "VoteParty", "AddVoteCount", "(Number)" },
|
||||
"VotingPlugin.Commands.AdminVote.VoteParty.SetVoteCount|" + adminPerm, "Add voteparty count") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
int num = plugin.getVoteParty().getTotalVotes() + Integer.parseInt(args[2]);
|
||||
plugin.getVoteParty().setTotalVotes(num);
|
||||
sendMessage(sender, "&cVoteparty total votes has been set to " + num);
|
||||
}
|
||||
});
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "VotePartyExtraRequired", "(Number)" },
|
||||
.add(new CommandHandler(new String[] { "VoteParty", "SetExtraRequired", "(Number)" },
|
||||
"VotingPlugin.Commands.AdminVote.VoteParty.SetExtraRequired|" + adminPerm,
|
||||
"Force a voteparty reward, resets vote count") {
|
||||
"Set VotePartyExtraRequired value") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
plugin.getServerData().setVotePartyExtraRequired(Integer.parseInt(args[1]));
|
||||
sendMessage(sender, "&cSet VotePartyExtraRequired to " + args[1]);
|
||||
plugin.getServerData().setVotePartyExtraRequired(Integer.parseInt(args[2]));
|
||||
sendMessage(sender, "&cSet VotePartyExtraRequired to " + args[2]);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1216,7 +1342,7 @@ public class CommandLoader {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
RewardHandler.getInstance().giveReward(user, plugin.getConfigFile().getData(),
|
||||
plugin.getRewardHandler().giveReward(user, plugin.getConfigFile().getData(),
|
||||
plugin.getGui().getChestShopIdentifierRewardsPath(args[3]), new RewardOptions());
|
||||
sendMessage(sender, "&cVoteShop " + args[3] + " forced");
|
||||
}
|
||||
@@ -1322,6 +1448,18 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "User", "(player)", "ForceAlmostAllSites" },
|
||||
"VotingPlugin.Commands.AdminVote.ForceAllSites|" + adminPerm, "Force a almostallsites reward") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
plugin.getSpecialRewards().giveAlmostAllSitesRewards(user, user.isOnline(),
|
||||
plugin.getBungeeSettings().isUseBungeecoord());
|
||||
sendMessage(sender, "&cAlmostAllSites forced");
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "User", "(player)", "ForceFirstVote" },
|
||||
"VotingPlugin.Commands.AdminVote.ForceFirstVote|" + adminPerm, "Force a firstvote reward") {
|
||||
|
||||
@@ -1334,6 +1472,18 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "User", "(player)", "ForceFirstVoteToday" },
|
||||
"VotingPlugin.Commands.AdminVote.ForceFirstVoteToday|" + adminPerm, "Force a firstvotetoday reward") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
plugin.getSpecialRewards().giveFirstVoteTodayRewards(user, user.isOnline(),
|
||||
plugin.getBungeeSettings().isUseBungeecoord());
|
||||
sendMessage(sender, "&cFirstVoteToday forced");
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "Placeholders", "(player)" },
|
||||
"VotingPlugin.Commands.AdminVote.Placeholders.Players|" + adminPerm,
|
||||
@@ -1343,7 +1493,7 @@ public class CommandLoader {
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
new AdminVotePlaceholdersPlayer(plugin, sender,
|
||||
UserManager.getInstance().getVotingPluginUser(args[1])).open();
|
||||
;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1462,7 +1612,6 @@ public class CommandLoader {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1500,7 +1649,7 @@ public class CommandLoader {
|
||||
@Override
|
||||
public void onInput(Player player, String value) {
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(
|
||||
plugin.getVoteSite(value),
|
||||
plugin.getVoteSite(value, true),
|
||||
UserGUI.getInstance().getCurrentPlayer(player),
|
||||
plugin.getVoteSiteServiceSite(value), false);
|
||||
plugin.getServer().getPluginManager().callEvent(voteEvent);
|
||||
@@ -1697,6 +1846,26 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getVoteCommand().add(new CommandHandler(new String[] { "ToggleReminders" },
|
||||
"VotingPlugin.Commands.Vote.ToggleReminders", "Enable/disable vote reminders", false) {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
Player p = (Player) sender;
|
||||
boolean value = false;
|
||||
if (plugin.getVoteReminding().getRemindersEnabled().containsKey(p.getUniqueId())) {
|
||||
value = !plugin.getVoteReminding().getRemindersEnabled().get(p.getUniqueId());
|
||||
}
|
||||
plugin.getVoteReminding().getRemindersEnabled().put(p.getUniqueId(), value);
|
||||
|
||||
if (value) {
|
||||
sendMessage(sender, plugin.getConfigFile().getFormatCommandsVoteToggleRemindersEnabled());
|
||||
} else {
|
||||
sendMessage(sender, plugin.getConfigFile().getFormatCommandsVoteToggleRemindersDisabled());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (plugin.getGui().getChestVoteShopEnabled()) {
|
||||
plugin.getVoteCommand().add(new CommandHandler(new String[] { "Shop" },
|
||||
"VotingPlugin.Commands.Vote.Shop|" + playerPerm, "Open VoteShop GUI", false) {
|
||||
@@ -1746,7 +1915,7 @@ public class CommandLoader {
|
||||
|
||||
if (!plugin.getGui().getChestVoteShopNotBuyable(identifier)) {
|
||||
if (hasPerm) {
|
||||
user.clearCache();
|
||||
user.cache();
|
||||
int points = plugin.getGui().getChestShopIdentifierCost(identifier);
|
||||
if (identifier != null) {
|
||||
|
||||
@@ -1757,7 +1926,7 @@ public class CommandLoader {
|
||||
placeholders.put("limit", "" + limit);
|
||||
if (user.removePoints(points)) {
|
||||
|
||||
RewardHandler.getInstance().giveReward(user, plugin.getGui().getData(),
|
||||
plugin.getRewardHandler().giveReward(user, plugin.getGui().getData(),
|
||||
plugin.getGui().getChestShopIdentifierRewardsPath(identifier),
|
||||
new RewardOptions().setPlaceholders(placeholders));
|
||||
|
||||
@@ -1811,7 +1980,7 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (com.bencodez.advancedcore.api.user.UserManager.getInstance().userExist(args[1])) {
|
||||
if (plugin.getUserManager().userExist(args[1])) {
|
||||
new VoteLast(plugin, sender, UserManager.getInstance().getVotingPluginUser(args[1])).open();
|
||||
} else {
|
||||
sendMessage(sender, StringParser.getInstance()
|
||||
@@ -1853,7 +2022,7 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (com.bencodez.advancedcore.api.user.UserManager.getInstance().userExist(args[1])) {
|
||||
if (plugin.getUserManager().userExist(args[1])) {
|
||||
new VoteNext(plugin, sender, UserManager.getInstance().getVotingPluginUser(args[1])).open();
|
||||
} else {
|
||||
sendMessage(sender, StringParser.getInstance()
|
||||
@@ -1867,7 +2036,7 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (com.bencodez.advancedcore.api.user.UserManager.getInstance().userExist(args[1])) {
|
||||
if (plugin.getUserManager().userExist(args[1])) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
String msg = plugin.getConfigFile().getFormatCommandVotePoints()
|
||||
.replace("%Player%", user.getPlayerName()).replace("%Points%", "" + user.getPoints());
|
||||
@@ -1910,7 +2079,7 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (com.bencodez.advancedcore.api.user.UserManager.getInstance().userExist(args[1])) {
|
||||
if (plugin.getUserManager().userExist(args[1])) {
|
||||
new VoteGUI(plugin, sender, UserManager.getInstance().getVotingPluginUser(args[1])).open();
|
||||
} else {
|
||||
sendMessage(sender, StringParser.getInstance()
|
||||
@@ -1929,7 +2098,7 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
if (plugin.getGui().isLastMonthGUI()) {
|
||||
if (plugin.getGui().isLastMonthGUI() || plugin.getOptions().getDebug().equals(DebugLevel.DEV)) {
|
||||
plugin.getVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "LastMonthTop" },
|
||||
"VotingPlugin.Commands.Vote.LastMonthTop|" + playerPerm,
|
||||
@@ -1966,7 +2135,8 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
new VoteTopVoter(plugin, sender, null, top, 1).open(GUIMethod.CHAT);
|
||||
new VoteTopVoter(plugin, sender, null, top, 1)
|
||||
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodTopVoter().toUpperCase()));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1976,7 +2146,8 @@ public class CommandLoader {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
int page = Integer.parseInt(args[2]);
|
||||
new VoteTopVoter(plugin, sender, null, top, page).open(GUIMethod.CHAT);
|
||||
new VoteTopVoter(plugin, sender, null, top, page)
|
||||
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodTopVoter().toUpperCase()));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1988,7 +2159,8 @@ public class CommandLoader {
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
int page = Integer.parseInt(args[1]);
|
||||
|
||||
new VoteTopVoter(plugin, sender, null, TopVoter.getDefault(), page).open(GUIMethod.CHAT);
|
||||
new VoteTopVoter(plugin, sender, null, TopVoter.getDefault(), page)
|
||||
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodTopVoter().toUpperCase()));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2035,12 +2207,41 @@ public class CommandLoader {
|
||||
int month = 0;
|
||||
int all = 0;
|
||||
|
||||
for (String uuid : uuids) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
daily += user.getTotal(TopVoter.Daily);
|
||||
weekly += user.getTotal(TopVoter.Weekly);
|
||||
month += user.getTotal(TopVoter.Monthly);
|
||||
all += user.getTotal(TopVoter.AllTime);
|
||||
if (plugin.getOptions().getStorageType().equals(UserStorage.MYSQL)) {
|
||||
for (TopVoter top : TopVoter.values()) {
|
||||
int cTotal = 0;
|
||||
ArrayList<Integer> nums = plugin.getMysql().getNumbersInColumn(top.getColumnName());
|
||||
for (Integer num : nums) {
|
||||
cTotal += num.intValue();
|
||||
}
|
||||
switch (top) {
|
||||
case AllTime:
|
||||
all = cTotal;
|
||||
break;
|
||||
case Daily:
|
||||
daily = cTotal;
|
||||
break;
|
||||
case Monthly:
|
||||
month = cTotal;
|
||||
break;
|
||||
case Weekly:
|
||||
weekly = cTotal;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
for (String uuid : uuids) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid));
|
||||
user.dontCache();
|
||||
daily += user.getTotal(TopVoter.Daily);
|
||||
weekly += user.getTotal(TopVoter.Weekly);
|
||||
month += user.getTotal(TopVoter.Monthly);
|
||||
all += user.getTotal(TopVoter.AllTime);
|
||||
}
|
||||
}
|
||||
|
||||
for (String s : plugin.getConfigFile().getFormatCommandsVoteTotalAll()) {
|
||||
@@ -2062,7 +2263,7 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (com.bencodez.advancedcore.api.user.UserManager.getInstance().userExist(args[1])) {
|
||||
if (plugin.getUserManager().userExist(args[1])) {
|
||||
new VoteTotal(plugin, sender, UserManager.getInstance().getVotingPluginUser(args[1])).open();
|
||||
} else {
|
||||
sendMessage(sender, StringParser.getInstance()
|
||||
@@ -2095,7 +2296,7 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (com.bencodez.advancedcore.api.user.UserManager.getInstance().userExist(args[1])) {
|
||||
if (plugin.getUserManager().userExist(args[1])) {
|
||||
new VoteBest(plugin, sender, UserManager.getInstance().getVotingPluginUser(args[1])).open();
|
||||
} else {
|
||||
sendMessage(sender, StringParser.getInstance()
|
||||
@@ -2118,7 +2319,7 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (com.bencodez.advancedcore.api.user.UserManager.getInstance().userExist(args[1])) {
|
||||
if (plugin.getUserManager().userExist(args[1])) {
|
||||
new VoteStreak(plugin, sender, UserManager.getInstance().getVotingPluginUser(args[1])).open();
|
||||
} else {
|
||||
sendMessage(sender, StringParser.getInstance()
|
||||
@@ -2135,21 +2336,28 @@ public class CommandLoader {
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (plugin.getConfigFile().isAllowVotePointTransfers()) {
|
||||
VotingPluginUser cPlayer = UserManager.getInstance().getVotingPluginUser((Player) sender);
|
||||
cPlayer.cache();
|
||||
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
int pointsToGive = Integer.parseInt(args[2]);
|
||||
if (pointsToGive > 0) {
|
||||
if (cPlayer.getPoints() >= pointsToGive) {
|
||||
user.addPoints(pointsToGive);
|
||||
cPlayer.removePoints(pointsToGive);
|
||||
sendMessage(sender, "&c" + pointsToGive + " points given to " + user.getPlayerName());
|
||||
user.sendMessage(
|
||||
"&cYou received " + pointsToGive + " points from " + cPlayer.getPlayerName());
|
||||
if (plugin.getUserManager().userExist(args[1])) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
user.dontCache();
|
||||
int pointsToGive = Integer.parseInt(args[2]);
|
||||
if (pointsToGive > 0) {
|
||||
if (cPlayer.getPoints() >= pointsToGive) {
|
||||
user.addPoints(pointsToGive);
|
||||
cPlayer.removePoints(pointsToGive);
|
||||
sendMessage(sender,
|
||||
"&c" + pointsToGive + " points given to " + user.getPlayerName());
|
||||
user.sendMessage("&cYou received " + pointsToGive + " points from "
|
||||
+ cPlayer.getPlayerName());
|
||||
} else {
|
||||
sendMessage(sender, "&cNot enough points");
|
||||
}
|
||||
} else {
|
||||
sendMessage(sender, "&cNot enough points");
|
||||
sendMessage(sender, "&cNumber of points needs to be greater than 0");
|
||||
}
|
||||
} else {
|
||||
sendMessage(sender, "&cNumber of points needs to be greater than 0");
|
||||
sendMessage(sender, "&c" + args[1] + " has not joined the server");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueSt
|
||||
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;
|
||||
@@ -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,15 @@ 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")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
|
||||
plugin.getRewardHandler().getDirectlyDefined("FirstVoteToday"));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -119,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"));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -128,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"));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -137,11 +154,20 @@ 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(Material.GRASS_BLOCK).setName("&cEdit BungeeSettings.yml")) {
|
||||
buttons.add(new BInventoryButton(new ItemBuilder(Material.STONE, 1).setName("&cEdit BungeeVotePartyRewards")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
|
||||
plugin.getRewardHandler().getDirectlyDefined("BungeeVotePartyRewards"));
|
||||
}
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton(new ItemBuilder("GRASS_BLOCK").setName("&cEdit BungeeSettings.yml")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
@@ -225,7 +251,13 @@ public class AdminGUI {
|
||||
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)
|
||||
@@ -347,12 +379,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);
|
||||
}
|
||||
}
|
||||
+10
-1
@@ -18,7 +18,7 @@ public class AdminVoteBungeeSettings extends GUIHandler {
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteBungeeSettings(VotingPluginMain plugin, CommandSender player) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -95,6 +95,15 @@ public class AdminVoteBungeeSettings extends GUIHandler {
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(
|
||||
new EditGUIValueBoolean("PerServerMilestones", plugin.getBungeeSettings().isPerServerMilestones()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean value) {
|
||||
setPathData(getKey(), value);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(
|
||||
new EditGUIValueBoolean("PerServerPoints", plugin.getBungeeSettings().isPerServerPoints()) {
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ public abstract class AdminVoteConfirmation extends GUIHandler {
|
||||
private String title;
|
||||
|
||||
public AdminVoteConfirmation(VotingPluginMain plugin, CommandSender player, String title) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class AdminVoteHelp extends GUIHandler {
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteHelp(VotingPluginMain plugin, CommandSender player, int page) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
@@ -22,13 +22,13 @@ public class AdminVotePerms extends GUIHandler {
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVotePerms(VotingPluginMain plugin, CommandSender player, int page) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public AdminVotePerms(VotingPluginMain plugin, CommandSender player, int page, String playerName) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.page = page;
|
||||
this.playerName = playerName;
|
||||
|
||||
+4
-4
@@ -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;
|
||||
@@ -19,11 +20,10 @@ import xyz.upperlevel.spigot.book.BookUtil;
|
||||
|
||||
public class AdminVotePlaceholders extends GUIHandler {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVotePlaceholders(VotingPluginMain plugin, CommandSender player) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ 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();
|
||||
if (identifier.endsWith("_")) {
|
||||
@@ -93,7 +93,7 @@ public class AdminVotePlaceholders extends GUIHandler {
|
||||
}
|
||||
}
|
||||
|
||||
for (PlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getNonPlayerPlaceholders()) {
|
||||
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getNonPlayerPlaceholders()) {
|
||||
String identifier = placeholder.getIdentifier();
|
||||
if (identifier.endsWith("_")) {
|
||||
identifier += "#";
|
||||
|
||||
+8
-10
@@ -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.UserManager;
|
||||
@@ -20,12 +21,11 @@ import xyz.upperlevel.spigot.book.BookUtil;
|
||||
|
||||
public class AdminVotePlaceholdersPlayer extends GUIHandler {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private VotingPluginMain plugin;
|
||||
private VotingPluginUser user;
|
||||
|
||||
public AdminVotePlaceholdersPlayer(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public class AdminVotePlaceholdersPlayer extends GUIHandler {
|
||||
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)
|
||||
@@ -52,13 +52,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();
|
||||
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]")));
|
||||
@@ -82,18 +82,16 @@ public class AdminVotePlaceholdersPlayer extends GUIHandler {
|
||||
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()) {
|
||||
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getNonPlayerPlaceholders()) {
|
||||
String identifier = placeholder.getIdentifier();
|
||||
if (identifier.endsWith("_")) {
|
||||
identifier += "1";
|
||||
}
|
||||
|
||||
msg.add("VotingPlugin_" + identifier + " = "
|
||||
+ placeholder.placeholderRequest(user.getOfflinePlayer(), placeholderUser, identifier));
|
||||
msg.add("VotingPlugin_" + identifier + " = " + placeholder.placeholderRequest(identifier));
|
||||
}
|
||||
sendMessage(msg);
|
||||
}
|
||||
|
||||
+4
-5
@@ -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;
|
||||
@@ -28,7 +27,7 @@ public class AdminVoteVoteParty extends GUIHandler {
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteVoteParty(VotingPluginMain plugin, CommandSender player) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -93,7 +92,7 @@ public class AdminVoteVoteParty extends GUIHandler {
|
||||
}, new Number[] { 0, 10, 50, 100 })
|
||||
.currentValue("" + plugin.getServerData().getVotePartyExtraRequired()).allowCustomOption(true)
|
||||
.request(clickEvent.getPlayer());
|
||||
;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
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.BInventory.ClickEvent;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
|
||||
import com.bencodez.advancedcore.api.inventory.editgui.EditGUI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.events.PlayerVoteEvent;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
|
||||
public class AdminVoteVotePlayer extends GUIHandler {
|
||||
|
||||
private String playerName;
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteVotePlayer(VotingPluginMain plugin, CommandSender player, String playerName) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.playerName = playerName;
|
||||
}
|
||||
|
||||
@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("Trigger vote for " + playerName);
|
||||
inv.requirePermission("VotingPlugin.Commands.AdminVote.Vote|VotingPlugin.Admin");
|
||||
|
||||
for (VoteSite site : plugin.getVoteSites()) {
|
||||
inv.addButton(new BInventoryButton(site.getItem().setName(site.getKey())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
VoteSite site = (VoteSite) getData("site");
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(site, playerName, site.getServiceSite(), false);
|
||||
sendMessage(clickEvent.getPlayer(), "&cTriggering vote...");
|
||||
if (voteEvent.getVoteSite() != null) {
|
||||
if (!voteEvent.getVoteSite().isVaidServiceSite()) {
|
||||
sendMessage(clickEvent.getPlayer(),
|
||||
"&cPossible issue with service site, has the server gotten the vote from "
|
||||
+ voteEvent.getServiceSite() + "?");
|
||||
}
|
||||
}
|
||||
plugin.getServer().getPluginManager().callEvent(voteEvent);
|
||||
|
||||
if (plugin.isYmlError()) {
|
||||
sendMessage(clickEvent.getPlayer(),
|
||||
"&3Detected yml error, please check server log for details");
|
||||
}
|
||||
}
|
||||
}.addData("site", site));
|
||||
}
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHEST);
|
||||
}
|
||||
|
||||
}
|
||||
+3
-4
@@ -13,7 +13,6 @@ 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;
|
||||
@@ -26,7 +25,7 @@ public class AdminVoteCumulative extends GUIHandler {
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteCumulative(VotingPluginMain plugin, CommandSender player) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ public class AdminVoteCumulativeRemove extends GUIHandler {
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteCumulativeRemove(VotingPluginMain plugin, CommandSender player) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class AdminVoteCumulativeRemove extends GUIHandler {
|
||||
new AdminVoteCumulative(plugin, p);
|
||||
}
|
||||
}.open();
|
||||
;
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ public class AdminVoteMilestoneRemove extends GUIHandler {
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteMilestoneRemove(VotingPluginMain plugin, CommandSender player) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class AdminVoteMilestoneRemove extends GUIHandler {
|
||||
new AdminVoteMilestones(plugin, p);
|
||||
}
|
||||
}.open();
|
||||
;
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
+3
-4
@@ -13,7 +13,6 @@ 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;
|
||||
@@ -26,7 +25,7 @@ public class AdminVoteMilestones extends GUIHandler {
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteMilestones(VotingPluginMain plugin, CommandSender player) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -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
-1
@@ -21,7 +21,7 @@ public class AdminVoteVoteShop extends GUIHandler {
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteVoteShop(VotingPluginMain plugin, CommandSender player) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
+3
-4
@@ -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.command.gui.RewardEditGUI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
@@ -27,7 +26,7 @@ public class AdminVoteVoteShopItem extends GUIHandler {
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteVoteShopItem(VotingPluginMain plugin, CommandSender player, String identifier) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.identifier = identifier;
|
||||
}
|
||||
@@ -86,7 +85,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
|
||||
@@ -115,7 +114,7 @@ public class AdminVoteVoteShopItem extends GUIHandler {
|
||||
@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"));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ public class AdminVoteVoteShopItemRemove extends GUIHandler {
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteVoteShopItemRemove(VotingPluginMain plugin, CommandSender player) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class AdminVoteVoteShopItemRemove extends GUIHandler {
|
||||
new AdminVoteVoteShop(plugin, p).open();
|
||||
}
|
||||
}.open();
|
||||
;
|
||||
|
||||
|
||||
}
|
||||
}.addData("ident", identifier));
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ public class AdminVoteVoteShopItems extends GUIHandler {
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteVoteShopItems(VotingPluginMain plugin, CommandSender player) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -13,17 +13,17 @@ 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.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteBest extends GUIHandler {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private VotingPluginMain plugin;
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteBest(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
}
|
||||
@@ -88,6 +88,25 @@ 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 + ".Rewards").setGiveOffline(false)
|
||||
.send(clickEvent.getPlayer());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
|
||||
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.RewardOptions;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoter;
|
||||
@@ -25,7 +24,7 @@ public class VoteGUI extends GUIHandler {
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteGUI(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
}
|
||||
@@ -128,6 +127,12 @@ public class VoteGUI extends GUIHandler {
|
||||
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());
|
||||
@@ -171,12 +176,16 @@ public class VoteGUI extends GUIHandler {
|
||||
new VoteShop(plugin, player, user).open(GUIMethod.CHEST);
|
||||
} else if (slot.equalsIgnoreCase("lastmonth")) {
|
||||
new VoteTopVoterLastMonth(plugin, player, user).open(GUIMethod.CHEST);
|
||||
} else if (slot.equalsIgnoreCase("best")) {
|
||||
new VoteBest(plugin, player, user).open(GUIMethod.CHEST);
|
||||
} else if (slot.equalsIgnoreCase("streak")) {
|
||||
new VoteStreak(plugin, player, user).open(GUIMethod.CHEST);
|
||||
}
|
||||
}
|
||||
|
||||
if (RewardHandler.getInstance().hasRewards(plugin.getGui().getData(),
|
||||
if (plugin.getRewardHandler().hasRewards(plugin.getGui().getData(),
|
||||
plugin.getGui().getChestVoteGUISlotRewardsPath(slot))) {
|
||||
RewardHandler.getInstance().giveReward(UserManager.getInstance().getVotingPluginUser(player),
|
||||
plugin.getRewardHandler().giveReward(UserManager.getInstance().getVotingPluginUser(player),
|
||||
plugin.getGui().getData(), plugin.getGui().getChestVoteGUISlotRewardsPath(slot),
|
||||
new RewardOptions().addPlaceholder("identifier", slot));
|
||||
}
|
||||
|
||||
@@ -11,8 +11,10 @@ import com.bencodez.advancedcore.api.command.CommandHandler;
|
||||
import com.bencodez.advancedcore.api.gui.GUIHandler;
|
||||
import com.bencodez.advancedcore.api.gui.GUIMethod;
|
||||
import com.bencodez.advancedcore.api.messages.StringParser;
|
||||
import com.bencodez.advancedcore.nms.NMSManager;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
|
||||
public class VoteHelp extends GUIHandler {
|
||||
@@ -21,7 +23,7 @@ public class VoteHelp extends GUIHandler {
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public VoteHelp(VotingPluginMain plugin, CommandSender player, int page) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.page = page;
|
||||
}
|
||||
@@ -37,6 +39,37 @@ public class VoteHelp extends GUIHandler {
|
||||
|
||||
boolean requirePerms = plugin.getConfigFile().getFormatCommandsVoteHelpRequirePermission();
|
||||
|
||||
String colorStr = plugin.getConfigFile().getFormatCommandsVoteHelpHoverColor();
|
||||
ChatColor hoverColor = null;
|
||||
try {
|
||||
hoverColor = ChatColor.of(colorStr);
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().warning("Failed to get color for hover help message");
|
||||
e.printStackTrace();
|
||||
hoverColor = ChatColor.AQUA;
|
||||
}
|
||||
for (CommandHandler cmdHandle : plugin.getVoteCommand()) {
|
||||
if (!requirePerms || cmdHandle.hasPerm(sender)) {
|
||||
unsorted.put(cmdHandle.getHelpLineCommand("/vote"), cmdHandle.getHelpLine("/vote",
|
||||
plugin.getConfigFile().getFormatCommandsVoteHelpLine(), hoverColor));
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
public ArrayList<TextComponent> helpTextLegacy(CommandSender sender) {
|
||||
ArrayList<TextComponent> msg = new ArrayList<TextComponent>();
|
||||
HashMap<String, TextComponent> unsorted = new HashMap<String, TextComponent>();
|
||||
|
||||
boolean requirePerms = plugin.getConfigFile().getFormatCommandsVoteHelpRequirePermission();
|
||||
|
||||
for (CommandHandler cmdHandle : plugin.getVoteCommand()) {
|
||||
if (!requirePerms || cmdHandle.hasPerm(sender)) {
|
||||
unsorted.put(cmdHandle.getHelpLineCommand("/vote"),
|
||||
@@ -76,7 +109,12 @@ 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) {
|
||||
|
||||
@@ -8,13 +8,16 @@ import org.bukkit.entity.Player;
|
||||
import com.bencodez.advancedcore.api.gui.GUIHandler;
|
||||
import com.bencodez.advancedcore.api.gui.GUIMethod;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
|
||||
import com.bencodez.advancedcore.api.inventory.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.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteLast extends GUIHandler {
|
||||
@@ -23,7 +26,7 @@ public class VoteLast extends GUIHandler {
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteLast(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
}
|
||||
@@ -67,8 +70,24 @@ public class VoteLast extends GUIHandler {
|
||||
.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 = UserManager.getInstance().getVotingPluginUser(player);
|
||||
user.sendMessage(
|
||||
StringParser.getInstance()
|
||||
.replacePlaceHolder(
|
||||
StringParser.getInstance().replacePlaceHolder(
|
||||
StringParser.getInstance()
|
||||
.replacePlaceHolder(plugin.getGui()
|
||||
.getChestVoteURLURLText(),
|
||||
"voteurl", site.getVoteURL()),
|
||||
"sitename", site.getDisplayName()),
|
||||
"player", player.getName()));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,6 +99,21 @@ public class VoteLast extends GUIHandler {
|
||||
}
|
||||
}
|
||||
|
||||
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 + ".Rewards").setGiveOffline(false)
|
||||
.send(clickEvent.getPlayer());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().getChestVoteLastBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
}
|
||||
|
||||
@@ -11,10 +11,12 @@ import com.bencodez.advancedcore.api.bookgui.Layout;
|
||||
import com.bencodez.advancedcore.api.gui.GUIHandler;
|
||||
import com.bencodez.advancedcore.api.gui.GUIMethod;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
|
||||
import com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton;
|
||||
import com.bencodez.advancedcore.api.item.ItemBuilder;
|
||||
import com.bencodez.advancedcore.api.messages.StringParser;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
@@ -27,7 +29,7 @@ public class VoteNext extends GUIHandler {
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteNext(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
}
|
||||
@@ -43,7 +45,6 @@ public class VoteNext extends GUIHandler {
|
||||
|
||||
for (VoteSite voteSite : plugin.getVoteSites()) {
|
||||
if (!voteSite.isHidden()) {
|
||||
|
||||
String msgLine = plugin.getConfigFile().getFormatCommandsVoteNextLayout();
|
||||
|
||||
msgLine = StringParser.getInstance().replaceIgnoreCase(msgLine, "%info%",
|
||||
@@ -63,12 +64,14 @@ public class VoteNext extends GUIHandler {
|
||||
|
||||
// add colors/config options
|
||||
for (VoteSite site : plugin.getVoteSites()) {
|
||||
Layout nextLayout = new Layout(new ArrayList<String>(Arrays.asList("[Json]")));
|
||||
nextLayout.replaceTextComponent("[Json]",
|
||||
BookUtil.TextBuilder.of(book.colorize(site.getDisplayName()))
|
||||
.onClick(BookUtil.ClickAction.openUrl(site.getVoteURLJsonStrip()))
|
||||
.onHover(BookUtil.HoverAction.showText(user.voteCommandNextInfo(site))).build());
|
||||
book.addLayout(nextLayout);
|
||||
if (!site.isHidden()) {
|
||||
Layout nextLayout = new Layout(new ArrayList<String>(Arrays.asList("[Json]")));
|
||||
nextLayout.replaceTextComponent("[Json]",
|
||||
BookUtil.TextBuilder.of(book.colorize(site.getDisplayName()))
|
||||
.onClick(BookUtil.ClickAction.openUrl(site.getVoteURLJsonStrip()))
|
||||
.onHover(BookUtil.HoverAction.showText(user.voteCommandNextInfo(site))).build());
|
||||
book.addLayout(nextLayout);
|
||||
}
|
||||
}
|
||||
book.addLine();
|
||||
|
||||
@@ -85,20 +88,39 @@ public class VoteNext extends GUIHandler {
|
||||
BInventory inv = new BInventory(plugin.getGui().getChestVoteNextName());
|
||||
inv.addPlaceholder("player", user.getPlayerName());
|
||||
for (VoteSite site : plugin.getVoteSites()) {
|
||||
inv.addButton(inv.getNextSlot(), new UpdatingBInventoryButton(site.getItem().setName(site.getDisplayName())
|
||||
.setLore(user.voteCommandNextInfo(site)).setAmountNone(1), 1000, 1000) {
|
||||
if (!site.isHidden()) {
|
||||
inv.addButton(inv.getNextSlot(),
|
||||
new UpdatingBInventoryButton(site.getItem().setName(site.getDisplayName())
|
||||
.setLore(user.voteCommandNextInfo(site)).setAmountNone(1), 1000, 1000) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemBuilder onUpdate(Player player) {
|
||||
return site.getItem().setName(site.getDisplayName()).setLore(user.voteCommandNextInfo(site))
|
||||
.setAmountNone(1).addPlaceholder("player", user.getPlayerName());
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public ItemBuilder onUpdate(Player player) {
|
||||
return site.getItem().setName(site.getDisplayName())
|
||||
.setLore(user.voteCommandNextInfo(site)).setAmountNone(1)
|
||||
.addPlaceholder("player", user.getPlayerName());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
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 + ".Rewards").setGiveOffline(false)
|
||||
.send(clickEvent.getPlayer());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().getChestVoteNextBackButton()) {
|
||||
|
||||
@@ -13,7 +13,6 @@ 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.rewards.RewardOptions;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
@@ -25,7 +24,7 @@ public class VoteShop extends GUIHandler {
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteShop(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
}
|
||||
@@ -51,7 +50,11 @@ public class VoteShop extends GUIHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.user == null) {
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
|
||||
}
|
||||
BInventory inv = new BInventory(plugin.getGui().getChestVoteShopName());
|
||||
inv.addPlaceholder("points", "" + user.getPoints());
|
||||
inv.dontClose();
|
||||
|
||||
for (final String identifier : plugin.getGui().getChestShopIdentifiers()) {
|
||||
@@ -61,14 +64,17 @@ 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;
|
||||
}
|
||||
@@ -85,16 +91,14 @@ public class VoteShop extends GUIHandler {
|
||||
Player player = event.getWhoClicked();
|
||||
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
if (plugin.getConfigFile().isClearCacheOnVoteShopPurchase()
|
||||
|| plugin.getBungeeSettings().isUseBungeecoord()) {
|
||||
user.clearCache();
|
||||
}
|
||||
user.clearCache();
|
||||
|
||||
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);
|
||||
event.closeInventory();
|
||||
}
|
||||
|
||||
// limit fail-safe, should never be needed, except in rare cases
|
||||
@@ -113,8 +117,10 @@ public class VoteShop extends GUIHandler {
|
||||
placeholders.put("points", "" + points);
|
||||
placeholders.put("limit", "" + limit);
|
||||
if (user.removePoints(points)) {
|
||||
plugin.getLogger().info("VoteShop: " + user.getPlayerName() + "/"
|
||||
+ user.getUUID() + " bought " + identifier + " for " + points);
|
||||
|
||||
RewardHandler.getInstance().giveReward(user, plugin.getGui().getData(),
|
||||
plugin.getRewardHandler().giveReward(user, plugin.getGui().getData(),
|
||||
plugin.getGui().getChestShopIdentifierRewardsPath(identifier),
|
||||
new RewardOptions().setPlaceholders(placeholders));
|
||||
|
||||
@@ -131,7 +137,7 @@ public class VoteShop extends GUIHandler {
|
||||
}
|
||||
} else {
|
||||
new VoteShopConfirm(plugin, player, user, identifier).open(GUIMethod.CHEST);
|
||||
;
|
||||
|
||||
}
|
||||
} else {
|
||||
user.sendMessage(plugin.getGui().getChestVoteShopLimitReached());
|
||||
|
||||
@@ -14,7 +14,6 @@ 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.rewards.RewardOptions;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
@@ -26,7 +25,7 @@ public class VoteShopConfirm extends GUIHandler {
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteShopConfirm(VotingPluginMain plugin, CommandSender player, VotingPluginUser user, String identifier) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
this.identifier = identifier;
|
||||
@@ -49,10 +48,12 @@ public class VoteShopConfirm extends GUIHandler {
|
||||
public void onChest(Player player) {
|
||||
PlayerUtils.getInstance().setPlayerMeta(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();
|
||||
int points = plugin.getGui().getChestShopIdentifierCost(identifier);
|
||||
int limit = plugin.getGui().getChestShopIdentifierLimit(identifier);
|
||||
HashMap<String, String> placeholders = new HashMap<String, String>();
|
||||
@@ -60,8 +61,10 @@ public class VoteShopConfirm extends GUIHandler {
|
||||
placeholders.put("points", "" + points);
|
||||
placeholders.put("limit", "" + limit);
|
||||
if (user.removePoints(points)) {
|
||||
plugin.getLogger().info("VoteShop: " + user.getPlayerName() + "/" + user.getUUID() + " bought "
|
||||
+ identifier + " for " + points);
|
||||
|
||||
RewardHandler.getInstance().giveReward(user, plugin.getGui().getData(),
|
||||
plugin.getRewardHandler().giveReward(user, plugin.getGui().getData(),
|
||||
plugin.getGui().getChestShopIdentifierRewardsPath(identifier),
|
||||
new RewardOptions().setPlaceholders(placeholders));
|
||||
|
||||
@@ -77,7 +80,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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -89,7 +92,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();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -13,6 +13,7 @@ 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.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
@@ -23,7 +24,7 @@ public class VoteStreak extends GUIHandler {
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteStreak(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
}
|
||||
@@ -118,6 +119,21 @@ public class VoteStreak extends GUIHandler {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
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 + ".Rewards").setGiveOffline(false)
|
||||
.send(clickEvent.getPlayer());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().getChestVoteStreakBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -17,10 +18,11 @@ import com.bencodez.advancedcore.api.inventory.BInventoryButton;
|
||||
import com.bencodez.advancedcore.api.item.ItemBuilder;
|
||||
import com.bencodez.advancedcore.api.messages.StringParser;
|
||||
import com.bencodez.advancedcore.api.misc.ArrayUtils;
|
||||
import com.bencodez.advancedcore.api.user.UUID;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.advancedcore.nms.NMSManager;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoterPlayer;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
@@ -31,7 +33,7 @@ public class VoteToday extends GUIHandler {
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteToday(VotingPluginMain plugin, CommandSender player, VotingPluginUser user, int page) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
this.page = page;
|
||||
@@ -84,7 +86,7 @@ public class VoteToday extends GUIHandler {
|
||||
if (!plugin.getConfigFile().isAlwaysCloseInventory()) {
|
||||
inv.dontClose();
|
||||
}
|
||||
for (VotingPluginUser user : plugin.getVoteToday().keySet()) {
|
||||
for (TopVoterPlayer user : plugin.getVoteToday().keySet()) {
|
||||
|
||||
for (VoteSite voteSite : plugin.getVoteToday().get(user).keySet()) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(plugin.getConfigFile().getFormatTimeFormat());
|
||||
@@ -103,18 +105,33 @@ public class VoteToday extends GUIHandler {
|
||||
item.setName(StringParser.getInstance().replacePlaceHolder(plugin.getGui().getChestVoteTodayIconTitle(),
|
||||
"player", user.getPlayerName()));
|
||||
item.setLore(msg);
|
||||
final String uuid = user.getUUID();
|
||||
final UUID uuid = user.getUuid();
|
||||
inv.addButton(inv.getNextSlot(), new BInventoryButton(item) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
VotingPluginUser user = UserManager.getInstance().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 + ".Rewards").setGiveOffline(false)
|
||||
.send(clickEvent.getPlayer());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().getChestVoteTodayBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
@@ -129,7 +146,7 @@ public class VoteToday extends GUIHandler {
|
||||
|
||||
public String[] voteToday() {
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
for (VotingPluginUser user : plugin.getVoteToday().keySet()) {
|
||||
for (TopVoterPlayer user : plugin.getVoteToday().keySet()) {
|
||||
|
||||
for (VoteSite voteSite : plugin.getVoteToday().get(user).keySet()) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(plugin.getConfigFile().getFormatTimeFormat());
|
||||
@@ -150,7 +167,7 @@ public class VoteToday extends GUIHandler {
|
||||
|
||||
public String[] voteTodayGUI() {
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
for (VotingPluginUser user : plugin.getVoteToday().keySet()) {
|
||||
for (TopVoterPlayer user : plugin.getVoteToday().keySet()) {
|
||||
|
||||
LocalDateTime mostRecent = null;
|
||||
VoteSite mostRecentSite = null;
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.bencodez.advancedcore.api.item.ItemBuilder;
|
||||
import com.bencodez.advancedcore.api.misc.ArrayUtils;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoter;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoterPlayer;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteTopVoter extends GUIHandler {
|
||||
@@ -29,7 +30,7 @@ public class VoteTopVoter extends GUIHandler {
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteTopVoter(VotingPluginMain plugin, CommandSender player, VotingPluginUser user, TopVoter top, int page) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
this.top = top;
|
||||
@@ -69,11 +70,11 @@ public class VoteTopVoter extends GUIHandler {
|
||||
if (top == null) {
|
||||
top = TopVoter.getDefault();
|
||||
}
|
||||
Set<Entry<VotingPluginUser, Integer>> users = null;
|
||||
Set<Entry<TopVoterPlayer, Integer>> users = null;
|
||||
|
||||
String topVoter = top.getName();
|
||||
@SuppressWarnings("unchecked")
|
||||
LinkedHashMap<VotingPluginUser, Integer> topVotes = (LinkedHashMap<VotingPluginUser, Integer>) plugin
|
||||
LinkedHashMap<TopVoterPlayer, Integer> topVotes = (LinkedHashMap<TopVoterPlayer, Integer>) plugin
|
||||
.getTopVoter(top).clone();
|
||||
users = topVotes.entrySet();
|
||||
|
||||
@@ -84,8 +85,8 @@ public class VoteTopVoter extends GUIHandler {
|
||||
}
|
||||
|
||||
int pos = 1;
|
||||
for (Entry<VotingPluginUser, Integer> entry : users) {
|
||||
ItemBuilder playerItem;
|
||||
for (Entry<TopVoterPlayer, Integer> entry : users) {
|
||||
ItemBuilder playerItem = new ItemBuilder(Material.PAPER);
|
||||
|
||||
if (plugin.getGui().isChestVoteTopUseSkull()) {
|
||||
playerItem = new ItemBuilder(entry.getKey().getPlayerHead());
|
||||
@@ -103,8 +104,8 @@ public class VoteTopVoter extends GUIHandler {
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
if (plugin.getGui().getChestVoteTopOpenMainGUIOnClick()) {
|
||||
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()));
|
||||
} else {
|
||||
getInv().forceClose(clickEvent.getPlayer());
|
||||
|
||||
+6
-5
@@ -15,6 +15,7 @@ import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
|
||||
import com.bencodez.advancedcore.api.item.ItemBuilder;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoterPlayer;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteTopVoterLastMonth extends GUIHandler {
|
||||
@@ -23,7 +24,7 @@ public class VoteTopVoterLastMonth extends GUIHandler {
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteTopVoterLastMonth(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
}
|
||||
@@ -44,7 +45,7 @@ public class VoteTopVoterLastMonth extends GUIHandler {
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
Set<Entry<VotingPluginUser, Integer>> users = null;
|
||||
Set<Entry<TopVoterPlayer, Integer>> users = null;
|
||||
|
||||
users = plugin.getLastMonthTopVoter().entrySet();
|
||||
|
||||
@@ -55,7 +56,7 @@ public class VoteTopVoterLastMonth extends GUIHandler {
|
||||
}
|
||||
|
||||
int pos = 1;
|
||||
for (Entry<VotingPluginUser, Integer> entry : users) {
|
||||
for (Entry<TopVoterPlayer, Integer> entry : users) {
|
||||
ItemBuilder playerItem;
|
||||
|
||||
if (plugin.getGui().isChestVoteTopUseSkull()) {
|
||||
@@ -73,8 +74,8 @@ 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()));
|
||||
|
||||
@@ -8,23 +8,24 @@ import org.bukkit.entity.Player;
|
||||
import com.bencodez.advancedcore.api.gui.GUIHandler;
|
||||
import com.bencodez.advancedcore.api.gui.GUIMethod;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
|
||||
import com.bencodez.advancedcore.api.inventory.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.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoter;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteTotal extends GUIHandler {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private VotingPluginMain plugin;
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteTotal(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
}
|
||||
@@ -85,6 +86,21 @@ public class VoteTotal extends GUIHandler {
|
||||
});
|
||||
}
|
||||
|
||||
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 + ".Rewards").setGiveOffline(false)
|
||||
.send(clickEvent.getPlayer());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().getChestVoteTotalBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class VoteURL extends GUIHandler {
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteURL(VotingPluginMain plugin, CommandSender player, VotingPluginUser user, boolean json) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
this.json = json;
|
||||
@@ -165,7 +165,7 @@ public class VoteURL extends GUIHandler {
|
||||
if (plugin.getGui().getChestVoteURLViewAllUrlsButtonEnabled()) {
|
||||
ItemBuilder builderAll = getItemAll();
|
||||
|
||||
inv.addButton(new UpdatingBInventoryButton(builderAll, 1000, 1000) {
|
||||
inv.addButton(new UpdatingBInventoryButton(builderAll, 5000, 5000) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -190,7 +190,7 @@ public class VoteURL extends GUIHandler {
|
||||
startSlot++;
|
||||
}
|
||||
|
||||
inv.addButton(new UpdatingBInventoryButton(builder, 1000, 1000) {
|
||||
inv.addButton(new UpdatingBInventoryButton(builder, 5000, 5000) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -223,7 +223,7 @@ public class VoteURL extends GUIHandler {
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new RewardBuilder(plugin.getGui().getData(), "CHEST.VoteURL.ExtraItems." + str + ".Rewards")
|
||||
.setGiveOffline(false).send(clickEvent.getPlayer());
|
||||
;
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class VoteURLVoteSite extends GUIHandler {
|
||||
private String voteSite;
|
||||
|
||||
public VoteURLVoteSite(VotingPluginMain plugin, CommandSender player, VotingPluginUser user, String voteSite) {
|
||||
super(player);
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
this.voteSite = voteSite;
|
||||
@@ -51,7 +51,7 @@ public class VoteURLVoteSite extends GUIHandler {
|
||||
player.sendMessage("Not a valid votesite");
|
||||
return;
|
||||
}
|
||||
VoteSite site = plugin.getVoteSite(voteSite);
|
||||
VoteSite site = plugin.getVoteSite(voteSite, true);
|
||||
BInventory inv = new BInventory(plugin.getGui().getChestVoteURLSiteName());
|
||||
inv.addPlaceholder("site", site.getDisplayName());
|
||||
inv.setMeta(player, "VoteSite", site);
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.bencodez.votingplugin.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.bencodez.advancedcore.api.yml.YMLFile;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.AnnotationHandler;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataBoolean;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataInt;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataListString;
|
||||
import com.bencodez.advancedcore.api.yml.annotation.ConfigDataString;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
@@ -41,6 +43,10 @@ public class BungeeSettings extends YMLFile {
|
||||
@Getter
|
||||
private boolean perServerPoints = false;
|
||||
|
||||
@ConfigDataBoolean(path = "PerServerMilestones")
|
||||
@Getter
|
||||
private boolean perServerMilestones = false;
|
||||
|
||||
@ConfigDataBoolean(path = "PerServerRewards")
|
||||
@Getter
|
||||
private boolean perServerRewards = false;
|
||||
@@ -73,10 +79,30 @@ public class BungeeSettings extends YMLFile {
|
||||
@Getter
|
||||
private boolean votifierBypass = false;
|
||||
|
||||
@ConfigDataBoolean(path = "DisableBroadcast")
|
||||
@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"));
|
||||
}
|
||||
|
||||
public String getServerNameStorage() {
|
||||
return getServer().replace("-", "_");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadValues() {
|
||||
new AnnotationHandler().load(getData(), this);
|
||||
|
||||
@@ -15,6 +15,7 @@ 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.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.placeholders.PlaceholderCacheLevel;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoter;
|
||||
|
||||
import lombok.Getter;
|
||||
@@ -33,22 +34,34 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private boolean addTotals = true;
|
||||
|
||||
@ConfigDataBoolean(path = "PerSiteCoolDownEvents")
|
||||
@Getter
|
||||
private boolean perSiteCoolDownEvents = false;
|
||||
|
||||
@ConfigDataBoolean(path = "QueueVotesDuringTimeChange")
|
||||
@Getter
|
||||
private boolean queueVotesDuringTimeChange = false;
|
||||
|
||||
@ConfigDataBoolean(path = "AllowUnjoined")
|
||||
@Getter
|
||||
private boolean allowUnjoined = false;
|
||||
|
||||
@ConfigDataBoolean(path = "PreloadSkulls")
|
||||
@Getter
|
||||
private boolean preloadSkulls = false;
|
||||
|
||||
@ConfigDataBoolean(path = "AllowUnJoinedCheckServer")
|
||||
@Getter
|
||||
private boolean allowUnJoinedCheckServer = true;
|
||||
|
||||
@ConfigDataInt(path = "PlayerDataLoadLimit")
|
||||
@Getter
|
||||
private int playerDataLoadLimit = -1;
|
||||
|
||||
@ConfigDataBoolean(path = "AllowVotePointTransfers")
|
||||
@Getter
|
||||
private boolean allowVotePointTransfers = false;
|
||||
|
||||
@ConfigDataBoolean(path = "AlterColumns")
|
||||
@Getter
|
||||
private boolean alterColumns = true;
|
||||
|
||||
@ConfigDataBoolean(path = "AlternateUUIDLookup")
|
||||
@Getter
|
||||
private boolean alternateUUIDLookup = false;
|
||||
@@ -61,10 +74,6 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private boolean alwaysUpdate = false;
|
||||
|
||||
@ConfigDataBoolean(path = "AlwaysWaitForCachePlaceholders")
|
||||
@Getter
|
||||
private boolean alwaysWaitForCachePlaceholders = false;
|
||||
|
||||
@ConfigDataBoolean(path = "AutoCreateVoteSites")
|
||||
@Getter
|
||||
private boolean autoCreateVoteSites = true;
|
||||
@@ -73,26 +82,6 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private boolean broadcastVotesEnabled = true;
|
||||
|
||||
@ConfigDataBoolean(path = "clearCacheOnUpdate")
|
||||
@Getter
|
||||
private boolean clearCacheOnUpdate = false;
|
||||
|
||||
@ConfigDataBoolean(path = "ClearCacheOnVote")
|
||||
@Getter
|
||||
private boolean clearCacheOnVote = false;
|
||||
|
||||
@ConfigDataBoolean(path = "ClearCacheOnVoteShopPurchase")
|
||||
@Getter
|
||||
private boolean clearCacheOnVoteShopPurchase = true;
|
||||
|
||||
@ConfigDataInt(path = "ConvertAmount")
|
||||
@Getter
|
||||
private int convertAmount = 250;
|
||||
|
||||
@ConfigDataInt(path = "ConvertDelay", defaultValue = 30000)
|
||||
@Getter
|
||||
private int convertDelay;
|
||||
|
||||
@ConfigDataBoolean(path = "CountFakeVotes")
|
||||
@Getter
|
||||
private boolean countFakeVotes = true;
|
||||
@@ -101,10 +90,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;
|
||||
@@ -121,6 +106,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;
|
||||
@@ -137,6 +126,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;
|
||||
@@ -153,6 +146,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;
|
||||
@@ -190,6 +191,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;
|
||||
|
||||
@@ -239,7 +248,7 @@ public class Config extends YMLFile {
|
||||
|
||||
@ConfigDataInt(path = "MaxiumNumberOfTopVotersToLoad")
|
||||
@Getter
|
||||
private int MaxiumNumberOfTopVotersToLoad = -1;
|
||||
private int MaxiumNumberOfTopVotersToLoad = 1000;
|
||||
|
||||
@ConfigDataBoolean(path = "OverrideVersionDisable")
|
||||
@Getter
|
||||
@@ -341,6 +350,10 @@ public class Config extends YMLFile {
|
||||
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.
|
||||
*
|
||||
@@ -412,6 +425,10 @@ public class Config extends YMLFile {
|
||||
"%hours% Hours and %minutes% Minutes");
|
||||
}
|
||||
|
||||
public PlaceholderCacheLevel getPlaceholderCacheLevel() {
|
||||
return PlaceholderCacheLevel.getCache(getData().getString("PlaceholderCacheLevel", "AUTO"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the commands vote next layout.
|
||||
*
|
||||
|
||||
@@ -41,8 +41,8 @@ public class ConfigVoteSites extends YMLFile {
|
||||
if (plugin.getConfigFile().isAutoCreateVoteSites()) {
|
||||
String org = siteName;
|
||||
siteName = siteName.replace(".", "_");
|
||||
plugin.getLogger().warning("VoteSite " + siteName
|
||||
+ " does not exist, creating one, set AutoCreateVoteSites to false to prevent this");
|
||||
plugin.getLogger().warning("VoteSite " + siteName + " does not exist with the servicesite '" + org
|
||||
+ "', creating one, set AutoCreateVoteSites to false to prevent this");
|
||||
setEnabled(siteName, true);
|
||||
setServiceSite(siteName, org);
|
||||
setVoteURL(siteName, "VoteURL");
|
||||
@@ -69,6 +69,9 @@ public class ConfigVoteSites extends YMLFile {
|
||||
* @return the data
|
||||
*/
|
||||
public ConfigurationSection getData(String siteName) {
|
||||
if (!getData().isConfigurationSection("VoteSites." + siteName)) {
|
||||
plugin.getLogger().warning("VoteSites." + siteName + " is not a configuration section");
|
||||
}
|
||||
return getData().getConfigurationSection("VoteSites." + siteName);
|
||||
}
|
||||
|
||||
@@ -127,12 +130,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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,14 +192,16 @@ public class ConfigVoteSites extends YMLFile {
|
||||
*/
|
||||
public ArrayList<VoteSite> getVoteSitesLoad() {
|
||||
ArrayList<VoteSite> voteSites = new ArrayList<VoteSite>();
|
||||
ArrayList<String> voteSiteNames = getVoteSitesNames();
|
||||
ArrayList<String> voteSiteNames = getVoteSitesNames(true);
|
||||
if (voteSiteNames != null) {
|
||||
for (String site : voteSiteNames) {
|
||||
if (getVoteSiteEnabled(site) && !site.equalsIgnoreCase("null")) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,12 +227,7 @@ public class ConfigVoteSites extends YMLFile {
|
||||
return voteSites;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vote sites names.
|
||||
*
|
||||
* @return the vote sites names
|
||||
*/
|
||||
public ArrayList<String> getVoteSitesNames() {
|
||||
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));
|
||||
@@ -235,11 +235,14 @@ public class ConfigVoteSites extends YMLFile {
|
||||
|
||||
for (int i = siteNames.size() - 1; i >= 0; i--) {
|
||||
// plugin.getLogger().info(siteNames.get(i));
|
||||
if (!getVoteSiteEnabled(siteNames.get(i)) || siteNames.get(i).equalsIgnoreCase("null")
|
||||
|| !siteCheck(siteNames.get(i))) {
|
||||
if (!getData().isConfigurationSection("VoteSites." + siteNames.get(i))) {
|
||||
plugin.getLogger()
|
||||
.warning("VoteSites." + siteNames.get(i) + " is not a configuration section, please remove");
|
||||
siteNames.remove(i);
|
||||
} else if (siteNames.get(i).equalsIgnoreCase("null")
|
||||
|| (!getVoteSiteEnabled(siteNames.get(i)) && checkEnabled) || !siteCheck(siteNames.get(i))) {
|
||||
// plugin.getLogger().info("Removed: " + siteNames.get(i));
|
||||
siteNames.remove(i);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -392,7 +395,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,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 +146,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) {
|
||||
@@ -491,6 +499,17 @@ public class GUI extends YMLFile {
|
||||
return getData().getConfigurationSection("CHEST.VoteURL.ExtraItems." + item);
|
||||
}
|
||||
|
||||
public Set<String> getChestGUIExtraItems(String gui) {
|
||||
if (getData().isConfigurationSection("CHEST." + gui + ".ExtraItems")) {
|
||||
return getData().getConfigurationSection("CHEST." + gui + ".ExtraItems").getKeys(false);
|
||||
}
|
||||
return new HashSet<String>();
|
||||
}
|
||||
|
||||
public ConfigurationSection getChestGUIExtraItemsItem(String gui, String item) {
|
||||
return getData().getConfigurationSection("CHEST." + gui + ".ExtraItems." + item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vote URL site name.
|
||||
*
|
||||
|
||||
@@ -3,6 +3,7 @@ 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;
|
||||
@@ -19,6 +20,9 @@ public class SpecialRewardsConfig extends YMLFile {
|
||||
@Getter
|
||||
private String allSitesRewardPath = "AllSites";
|
||||
|
||||
@Getter
|
||||
private String almostAllSitesRewardPath = "AlmostAllSites";
|
||||
|
||||
@Getter
|
||||
private String anySiteRewardsPath = "AnySiteRewards";
|
||||
|
||||
@@ -34,9 +38,16 @@ public class SpecialRewardsConfig extends YMLFile {
|
||||
@Getter
|
||||
private boolean enableWeeklyAwards = false;
|
||||
|
||||
@ConfigDataBoolean(path = "OnlyOneCumulative")
|
||||
@Getter
|
||||
private boolean onlyOneCumulative = false;
|
||||
|
||||
@Getter
|
||||
private String firstVoteRewardsPath = "FirstVote";
|
||||
|
||||
@Getter
|
||||
private String firstVoteTodayRewardsPath = "FirstVoteToday";
|
||||
|
||||
/** The plugin. */
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
@@ -84,6 +95,14 @@ public class SpecialRewardsConfig extends YMLFile {
|
||||
return "Cumulative." + cumulative + ".Rewards";
|
||||
}
|
||||
|
||||
public List<Integer> getCumulativeBlackList(int cumulative) {
|
||||
return getData().getIntegerList("Cumulative." + cumulative + ".BlackList");
|
||||
}
|
||||
|
||||
public boolean getCumulativeRecurring(int cumulative) {
|
||||
return getData().getBoolean("Cumulative." + cumulative + ".Recurring", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cumulative votes.
|
||||
*
|
||||
@@ -133,7 +152,7 @@ public class SpecialRewardsConfig extends YMLFile {
|
||||
return TopVoter.Daily.toString();
|
||||
}
|
||||
}
|
||||
return TopVoter.AllTime.toString();
|
||||
return str;
|
||||
}
|
||||
|
||||
public String getDailyAwardRewardsPath(String path) {
|
||||
@@ -217,8 +236,9 @@ public class SpecialRewardsConfig extends YMLFile {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ArrayList<String> getVotePartyCommands() {
|
||||
return (ArrayList<String>) getData().getList("VoteParty.Commands", new ArrayList<String>());
|
||||
public ArrayList<String> getVotePartyGlobalCommands() {
|
||||
return (ArrayList<String>) getData().getList("VoteParty.GlobalCommands",
|
||||
(ArrayList<String>) getData().getList("VoteParty.Commands", new ArrayList<String>()));
|
||||
}
|
||||
|
||||
public boolean getVotePartyCountFakeVotes() {
|
||||
@@ -255,6 +275,10 @@ public class SpecialRewardsConfig extends YMLFile {
|
||||
return getData().getBoolean("VoteParty.OnlyOncePerDay");
|
||||
}
|
||||
|
||||
public boolean getVotePartyOnlyOncePerWeek() {
|
||||
return getData().getBoolean("VoteParty.OnlyOncePerWeek");
|
||||
}
|
||||
|
||||
public boolean getVotePartyResetEachDay() {
|
||||
return getData().getBoolean("VoteParty.ResetEachDay");
|
||||
}
|
||||
@@ -346,8 +370,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,86 +1,186 @@
|
||||
package com.bencodez.votingplugin.cooldown;
|
||||
|
||||
import java.util.TimerTask;
|
||||
import java.util.HashMap;
|
||||
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.time.events.DateChangedEvent;
|
||||
import com.bencodez.advancedcore.api.user.UUID;
|
||||
import com.bencodez.advancedcore.api.user.AdvancedCoreUser;
|
||||
import com.bencodez.advancedcore.api.user.UserStartup;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.events.PlayerVoteCoolDownEndEvent;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.events.PlayerVoteSiteCoolDownEndEvent;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class VoteReminding.
|
||||
*/
|
||||
public class CoolDownCheck implements Listener {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
/**
|
||||
* Instantiates a new vote reminding.
|
||||
*
|
||||
* @param plugin the plugin
|
||||
*/
|
||||
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 = Executors.newScheduledThreadPool(1);
|
||||
}
|
||||
|
||||
public void checkAll() {
|
||||
if (!plugin.getConfigFile().isDisableCoolDownCheck() && RewardHandler.getInstance()
|
||||
private ScheduledExecutorService timer;
|
||||
|
||||
private boolean cooldownCheckEnabled = false;
|
||||
|
||||
public void checkEnabled() {
|
||||
if (!plugin.getConfigFile().isDisableCoolDownCheck() && plugin.getRewardHandler()
|
||||
.hasRewards(plugin.getSpecialRewardsConfig().getData(), "VoteCoolDownEndedReward")) {
|
||||
plugin.getTimer().schedule(new TimerTask() {
|
||||
cooldownCheckEnabled = true;
|
||||
} else {
|
||||
cooldownCheckEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void check(UUID uuid) {
|
||||
check(plugin.getVotingPluginUserManager().getVotingPluginUser(uuid));
|
||||
}
|
||||
|
||||
public void checkPerSite(UUID uuid) {
|
||||
checkPerSite(plugin.getVotingPluginUserManager().getVotingPluginUser(uuid));
|
||||
}
|
||||
|
||||
public void vote(VotingPluginUser user, VoteSite site) {
|
||||
if (cooldownCheckEnabled) {
|
||||
schedule(user);
|
||||
}
|
||||
|
||||
if (plugin.getConfigFile().isPerSiteCoolDownEvents()) {
|
||||
user.setCoolDownCheckSite(site, Boolean.FALSE);
|
||||
schedulePerSite(user);
|
||||
}
|
||||
}
|
||||
|
||||
public void check(VotingPluginUser user) {
|
||||
boolean coolDownCheck = user.getCoolDownCheck();
|
||||
if (user.canVoteAll() && coolDownCheck) {
|
||||
user.setCoolDownCheck(false);
|
||||
PlayerVoteCoolDownEndEvent event = new PlayerVoteCoolDownEndEvent(user);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
allSiteTasks.remove(user.getJavaUUID());
|
||||
} else if (!coolDownCheck) {
|
||||
schedule(user);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void checkPerSite(VotingPluginUser user) {
|
||||
if (plugin.getConfigFile().isPerSiteCoolDownEvents()) {
|
||||
HashMap<VoteSite, Boolean> coolDownChecks = user.getCoolDownCheckSiteList();
|
||||
boolean changed = false;
|
||||
for (VoteSite site : plugin.getVoteSites()) {
|
||||
if (user.canVoteSite(site)) {
|
||||
if (!coolDownChecks.containsKey(site) || !coolDownChecks.get(site).booleanValue()) {
|
||||
coolDownChecks.put(site, Boolean.TRUE);
|
||||
changed = true;
|
||||
PlayerVoteSiteCoolDownEndEvent event = new PlayerVoteSiteCoolDownEndEvent(user, site);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
user.setCoolDownCheckSite(coolDownChecks);
|
||||
}
|
||||
}
|
||||
|
||||
schedulePerSite(user);
|
||||
|
||||
}
|
||||
|
||||
public void schedulePerSite(VotingPluginUser user) {
|
||||
final UUID uuid = UUID.fromString(user.getUUID());
|
||||
long time = user.getNextTimeFirstSiteAvailable();
|
||||
if (time > 0) {
|
||||
if (perSiteTasks.containsKey(uuid)) {
|
||||
perSiteTasks.get(uuid).cancel(false);
|
||||
perSiteTasks.remove(uuid);
|
||||
}
|
||||
plugin.devDebug("PerSiteCoolDownEvent schedule time: " + time);
|
||||
ScheduledFuture<?> scheduledFuture = timer.schedule(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (VotingPluginMain.plugin != null) {
|
||||
if (!plugin.getConfigFile().isDisableCoolDownCheck() && RewardHandler.getInstance()
|
||||
.hasRewards(plugin.getSpecialRewardsConfig().getData(), "VoteCoolDownEndedReward")) {
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
if (VotingPluginMain.plugin != null) {
|
||||
VotingPluginUser user = UserManager.getInstance()
|
||||
.getVotingPluginUser(new UUID(uuid));
|
||||
if (user.getUserData().hasData() && user.hasLoggedOnBefore()) {
|
||||
user.checkCoolDownEvents();
|
||||
}
|
||||
} else {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
plugin.debug("Not enabling cooldown check reward");
|
||||
cancel();
|
||||
}
|
||||
} else {
|
||||
cancel();
|
||||
if (plugin != null && plugin.isEnabled()) {
|
||||
checkPerSite(uuid);
|
||||
}
|
||||
}
|
||||
}, 1000 * 60 * 5, 1000 * 60 * 30);
|
||||
} else {
|
||||
plugin.debug("Not enabling cooldown check reward");
|
||||
}, time + 2, TimeUnit.SECONDS);
|
||||
perSiteTasks.put(uuid, scheduledFuture);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void schedule(VotingPluginUser user) {
|
||||
final UUID uuid = UUID.fromString(user.getUUID());
|
||||
long time = user.getNextTimeAllSitesAvailable();
|
||||
if (time > 0) {
|
||||
user.setCoolDownCheck(true);
|
||||
if (allSiteTasks.containsKey(uuid)) {
|
||||
allSiteTasks.get(uuid).cancel(false);
|
||||
allSiteTasks.remove(uuid);
|
||||
}
|
||||
ScheduledFuture<?> scheduledFuture = timer.schedule(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
check(uuid);
|
||||
}
|
||||
}, time + 2, TimeUnit.SECONDS);
|
||||
allSiteTasks.put(uuid, scheduledFuture);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void load() {
|
||||
checkAll();
|
||||
|
||||
plugin.addUserStartup(new UserStartup() {
|
||||
|
||||
@Override
|
||||
public void onStartUp(AdvancedCoreUser advancedcoreUser) {
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(advancedcoreUser);
|
||||
if (cooldownCheckEnabled) {
|
||||
check(user);
|
||||
}
|
||||
if (plugin.getConfigFile().isPerSiteCoolDownEvents()) {
|
||||
checkPerSite(user);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onCoolDownEnd(PlayerVoteCoolDownEndEvent event) {
|
||||
RewardHandler.getInstance().giveReward(event.getPlayer(), plugin.getSpecialRewardsConfig().getData(),
|
||||
"VoteCoolDownEndedReward",
|
||||
new RewardOptions().addPlaceholder("Votesite", event.getVoteSite().getDisplayName()));
|
||||
plugin.getRewardHandler().giveReward(event.getPlayer(), plugin.getSpecialRewardsConfig().getData(),
|
||||
"VoteCoolDownEndedReward", new RewardOptions());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onDayChangeEnd(DateChangedEvent event) {
|
||||
checkAll();
|
||||
public void onCoolDownEnd(PlayerVoteSiteCoolDownEndEvent event) {
|
||||
plugin.getRewardHandler().giveReward(event.getPlayer(), event.getSite().getSiteData(), "CoolDownEndRewards",
|
||||
new RewardOptions());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
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 org.bukkit.Bukkit;
|
||||
@@ -11,6 +14,7 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
import com.bencodez.advancedcore.api.misc.ArrayUtils;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.signs.SignHandler;
|
||||
import com.bencodez.votingplugin.timequeue.VoteTimeQueue;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
@@ -24,6 +28,23 @@ public class ServerData {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public void addAutoCachedPlaceholder(String placeholder) {
|
||||
List<String> p = getAutoCachedPlaceholder();
|
||||
if (!ArrayUtils.getInstance().containsIgnoreCase(p, placeholder)) {
|
||||
p.add(placeholder);
|
||||
setAutoCachedPlaceholder(p);
|
||||
}
|
||||
}
|
||||
|
||||
public void setAutoCachedPlaceholder(List<String> placeholders) {
|
||||
getData().set("AutoCachePlaceholders", placeholders);
|
||||
saveData();
|
||||
}
|
||||
|
||||
public List<String> getAutoCachedPlaceholder() {
|
||||
return getData().getStringList("AutoCachePlaceholders");
|
||||
}
|
||||
|
||||
public synchronized void addServiceSite(String site) {
|
||||
ArrayList<String> l = getServiceSites();
|
||||
if (!getServiceSites().contains(site)) {
|
||||
@@ -139,7 +160,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 +276,58 @@ 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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,81 @@
|
||||
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 VotingPluginUser votingPluginUser;
|
||||
|
||||
public PlayerPostVoteEvent(VoteSite voteSite, VotingPluginUser user, boolean realVote, boolean forceBungee) {
|
||||
super(true);
|
||||
this.user = user;
|
||||
this.voteSite = voteSite;
|
||||
this.realVote = realVote;
|
||||
this.forceBungee = forceBungee;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.bukkit.event.Event#getHandlers()
|
||||
*/
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,6 @@ 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;
|
||||
@@ -35,14 +34,9 @@ public class PlayerVoteCoolDownEndEvent extends Event {
|
||||
@Setter
|
||||
private VotingPluginUser player;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private VoteSite voteSite;
|
||||
|
||||
public PlayerVoteCoolDownEndEvent(VotingPluginUser user, VoteSite site) {
|
||||
public PlayerVoteCoolDownEndEvent(VotingPluginUser user) {
|
||||
super(true);
|
||||
player = user;
|
||||
voteSite = site;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -76,6 +76,14 @@ public class PlayerVoteEvent extends Event {
|
||||
@Setter
|
||||
private boolean wasOnline;
|
||||
|
||||
@Getter
|
||||
@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, MILESTONE, VOTESTREAK;
|
||||
ALLSITE, CUMMULATIVE, FIRSTVOTE, FIRSTVOTETODAY, MILESTONE, VOTESTREAK, ALMOSTALLSITES;
|
||||
|
||||
@Getter
|
||||
private int amount = -1;
|
||||
|
||||
@@ -18,7 +18,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 +26,7 @@ public class BlockBreak implements Listener {
|
||||
* @param plugin the plugin
|
||||
*/
|
||||
public BlockBreak(VotingPluginMain plugin) {
|
||||
BlockBreak.plugin = plugin;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
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;
|
||||
@@ -8,8 +10,14 @@ import com.vexsoftware.votifier.model.VotifierEvent;
|
||||
public class BungeeVotifierEvent {
|
||||
public void send(VotingPluginMain plugin, PlayerVoteEvent event) {
|
||||
plugin.debug("Triggering vote event");
|
||||
VotifierEvent e = new VotifierEvent(
|
||||
new Vote(event.getServiceSite(), event.getPlayer(), "VotingPlugin", "" + event.getTime()));
|
||||
plugin.getServer().getPluginManager().callEvent(e);
|
||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
VotifierEvent e = new VotifierEvent(
|
||||
new Vote(event.getServiceSite(), event.getPlayer(), "VotingPlugin", "" + event.getTime()));
|
||||
plugin.getServer().getPluginManager().callEvent(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,15 +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;
|
||||
|
||||
@@ -20,7 +19,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.
|
||||
@@ -28,7 +27,7 @@ public class PlayerJoinEvent implements Listener {
|
||||
* @param plugin the plugin
|
||||
*/
|
||||
public PlayerJoinEvent(VotingPluginMain plugin) {
|
||||
PlayerJoinEvent.plugin = plugin;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
private void login(Player player) {
|
||||
@@ -47,6 +46,14 @@ public class PlayerJoinEvent implements Listener {
|
||||
}
|
||||
|
||||
user.loginRewards();
|
||||
|
||||
plugin.getPlaceholders().onUpdate(user);
|
||||
|
||||
if (plugin.getBungeeSettings().isUseBungeecoord()
|
||||
&& plugin.getBungeeHandler().getMethod().equals(BungeeMethod.PLUGINMESSAGING)) {
|
||||
plugin.getPluginMessaging().sendPluginMessage("Login", user.getPlayerName(), user.getUUID(),
|
||||
plugin.getBungeeSettings().getServer());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,42 +63,29 @@ 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 = UserManager.getInstance().getVotingPluginUser(uuid);
|
||||
user.dontCache();
|
||||
user.logoutRewards();
|
||||
}
|
||||
});
|
||||
}
|
||||
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.logoutRewards();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ 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;
|
||||
@@ -13,6 +14,7 @@ import com.bencodez.advancedcore.api.misc.ArrayUtils;
|
||||
import com.bencodez.advancedcore.api.misc.PlayerUtils;
|
||||
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;
|
||||
@@ -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,7 +44,12 @@ 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();
|
||||
plugin.debug("Processing PlayerVoteEvent: " + playerName + "/" + event.getServiceSite());
|
||||
if (!PlayerUtils.getInstance().isValidUser(playerName, plugin.getConfigFile().isAllowUnJoinedCheckServer())) {
|
||||
if (!plugin.getConfigFile().isAllowUnjoined()) {
|
||||
plugin.getLogger().warning("Player " + playerName
|
||||
@@ -57,7 +62,7 @@ public class PlayerVoteListener implements Listener {
|
||||
}
|
||||
|
||||
if (playerName.isEmpty()) {
|
||||
plugin.getLogger().warning("Empty player name for vote");
|
||||
plugin.getLogger().warning("Empty player name from vote, ignoring");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,6 +77,10 @@ public class PlayerVoteListener implements Listener {
|
||||
|
||||
VoteSite voteSite = event.getVoteSite();
|
||||
|
||||
if (voteSite == null) {
|
||||
voteSite = plugin.getVoteSite(plugin.getVoteSiteName(true, event.getServiceSite()), true);
|
||||
}
|
||||
|
||||
// check valid service sites
|
||||
if (voteSite == null) {
|
||||
if (!plugin.getConfigFile().isDisableNoServiceSiteMessage()) {
|
||||
@@ -87,16 +96,22 @@ public class PlayerVoteListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!voteSite.isEnabled()) {
|
||||
plugin.debug("Votesite: " + voteSite.getKey() + " is not enabled");
|
||||
return;
|
||||
}
|
||||
|
||||
VotingPluginUser user = null;
|
||||
if (event.getVotingPluginUser() != null) {
|
||||
user = event.getVotingPluginUser();
|
||||
} else {
|
||||
user = UserManager.getInstance().getVotingPluginUser(playerName);
|
||||
}
|
||||
user.updateName(true);
|
||||
|
||||
if (plugin.getConfigFile().isClearCacheOnVote() || plugin.getBungeeSettings().isUseBungeecoord()) {
|
||||
user.clearCache();
|
||||
Player p = Bukkit.getPlayerExact(playerName);
|
||||
if (p != null) {
|
||||
// player online
|
||||
user = UserManager.getInstance().getVotingPluginUser(p);
|
||||
} else {
|
||||
user = UserManager.getInstance().getVotingPluginUser(playerName);
|
||||
}
|
||||
}
|
||||
|
||||
if (voteSite.isWaitUntilVoteDelay() && !user.canVoteSite(voteSite)) {
|
||||
@@ -104,11 +119,18 @@ public class PlayerVoteListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
synchronized (object) {
|
||||
final String uuid = user.getUUID();
|
||||
|
||||
// vote party
|
||||
plugin.getVoteParty().vote(user, event.isRealVote(), event.isForceBungee());
|
||||
// reupdate cache
|
||||
user.clearCache();
|
||||
user.cache();
|
||||
|
||||
user.updateName(true);
|
||||
|
||||
// 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())) {
|
||||
@@ -116,89 +138,100 @@ public class PlayerVoteListener implements Listener {
|
||||
voteSite.broadcastVote(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.getBroadcastHandler() != null) {
|
||||
plugin.getBroadcastHandler().onVote(playerName);
|
||||
}
|
||||
if (plugin.getBroadcastHandler() != null) {
|
||||
plugin.getBroadcastHandler().onVote(playerName);
|
||||
}
|
||||
|
||||
// update last vote time
|
||||
if (event.getTime() != 0) {
|
||||
user.setTime(voteSite, event.getTime());
|
||||
} else {
|
||||
user.setTime(voteSite);
|
||||
}
|
||||
user.setLastVoteCoolDownCheck(false, voteSite);
|
||||
// update last vote time
|
||||
if (event.getTime() != 0) {
|
||||
user.setTime(voteSite, event.getTime());
|
||||
} else {
|
||||
user.setTime(voteSite);
|
||||
}
|
||||
|
||||
// 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());
|
||||
|
||||
if (user.isReminded()) {
|
||||
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.sendVoteEffects(online);
|
||||
user.closeInv();
|
||||
} else {
|
||||
user.addOfflineVote(voteSite.getKey());
|
||||
plugin.debug(
|
||||
"Offline vote set for " + playerName + " (" + user.getUUID() + ") on " + voteSite.getKey());
|
||||
}
|
||||
|
||||
// add to total votes
|
||||
if ((plugin.getConfigFile().isCountFakeVotes() || event.isRealVote()) && event.isAddTotals()) {
|
||||
if (plugin.getConfigFile().isAddTotals()) {
|
||||
user.addTotal();
|
||||
user.addTotalDaily();
|
||||
user.addTotalWeekly();
|
||||
}
|
||||
user.addPoints();
|
||||
}
|
||||
|
||||
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(
|
||||
PlayerUtils.getInstance().getRandomOnlinePlayer(), "VoteUpdate", uuid);
|
||||
}
|
||||
}
|
||||
}, 40);
|
||||
}
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
||||
// 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()) && plugin.getOptions().isProcessRewards())
|
||||
|| event.isBungee()) {
|
||||
boolean online = true;
|
||||
if (event.isBungee()) {
|
||||
online = event.isWasOnline();
|
||||
}
|
||||
user.playerVote(voteSite, online, false, event.isForceBungee());
|
||||
if (event.getVoteNumber() == 1) {
|
||||
user.sendVoteEffects(online);
|
||||
}
|
||||
if (plugin.getConfigFile().isCloseInventoryOnVote()) {
|
||||
user.closeInv();
|
||||
}
|
||||
} else {
|
||||
user.addOfflineVote(voteSite.getKey());
|
||||
plugin.debug("Offline vote set for " + playerName + " (" + user.getUUID() + ") on " + voteSite.getKey());
|
||||
}
|
||||
|
||||
// add to total votes
|
||||
if ((plugin.getConfigFile().isCountFakeVotes() || event.isRealVote()) && event.isAddTotals()) {
|
||||
if (plugin.getConfigFile().isAddTotals()) {
|
||||
user.addTotal();
|
||||
user.addTotalDaily();
|
||||
user.addTotalWeekly();
|
||||
}
|
||||
user.addPoints();
|
||||
}
|
||||
user.checkDayVoteStreak(event.isForceBungee());
|
||||
|
||||
// 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)) {
|
||||
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (Bukkit.getOnlinePlayers().size() > 0) {
|
||||
plugin.getPluginMessaging().sendPluginMessage("VoteUpdate", uuid);
|
||||
}
|
||||
}
|
||||
}, 40);
|
||||
}
|
||||
}
|
||||
|
||||
PlayerPostVoteEvent postVoteEvent = new PlayerPostVoteEvent(voteSite, user, event.isRealVote(),
|
||||
event.isForceBungee());
|
||||
plugin.getServer().getPluginManager().callEvent(postVoteEvent);
|
||||
|
||||
if (!user.isOnline()) {
|
||||
user.clearCache();
|
||||
}
|
||||
|
||||
plugin.setUpdate(true);
|
||||
|
||||
plugin.extraDebug("Finished vote processing: " + playerName + "/" + uuid);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,7 +16,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 +24,7 @@ public class SignChange implements Listener {
|
||||
* @param plugin the plugin
|
||||
*/
|
||||
public SignChange(VotingPluginMain plugin) {
|
||||
SignChange.plugin = plugin;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,6 @@ 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;
|
||||
@@ -41,20 +40,17 @@ public class VotiferEvent implements Listener {
|
||||
public void onVotiferEvent(VotifierEvent event) {
|
||||
|
||||
Vote vote = event.getVote();
|
||||
final String voteSite = vote.getServiceName();
|
||||
String str = vote.getServiceName();
|
||||
if (str.isEmpty()) {
|
||||
str = "Empty";
|
||||
}
|
||||
final String voteSite = str;
|
||||
final String IP = vote.getAddress();
|
||||
final String voteUsername = vote.getUsername().trim();
|
||||
if (IP.equals("VotingPlugin")) {
|
||||
// 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);
|
||||
@@ -68,51 +64,66 @@ 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 voteSiteNameStr = plugin.getVoteSiteName(false, 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");
|
||||
return;
|
||||
}
|
||||
String voteSiteName = plugin.getVoteSiteName(voteSite);
|
||||
|
||||
ArrayList<String> sites = plugin.getConfigVoteSites().getVoteSitesNames();
|
||||
boolean createSite = false;
|
||||
if (sites != null) {
|
||||
if (!sites.contains(voteSiteName)) {
|
||||
ArrayList<String> sites = plugin.getConfigVoteSites().getVoteSitesNames(false);
|
||||
boolean createSite = false;
|
||||
if (sites != null) {
|
||||
if (!ArrayUtils.getInstance().containsIgnoreCase(sites, voteSiteNameStr)) {
|
||||
createSite = true;
|
||||
}
|
||||
} else {
|
||||
createSite = true;
|
||||
}
|
||||
} else {
|
||||
createSite = true;
|
||||
}
|
||||
|
||||
if (plugin.getConfigFile().isAutoCreateVoteSites() && createSite) {
|
||||
plugin.getLogger().warning("VoteSite with service site '" + voteSiteName
|
||||
+ "' does not exist, attempting to generaterate...");
|
||||
plugin.getConfigVoteSites().generateVoteSite(voteSiteName);
|
||||
if (plugin.getConfigFile().isAutoCreateVoteSites() && createSite) {
|
||||
plugin.getLogger().warning("VoteSite with service site '" + voteSiteNameStr
|
||||
+ "' does not exist, attempting to generate...");
|
||||
plugin.getConfigVoteSites().generateVoteSite(voteSiteNameStr);
|
||||
|
||||
plugin.getLogger().info("Current known service sites: "
|
||||
+ ArrayUtils.getInstance().makeStringList(plugin.getServerData().getServiceSites()));
|
||||
}
|
||||
plugin.getLogger().info("Current known service sites: "
|
||||
+ ArrayUtils.getInstance().makeStringList(plugin.getServerData().getServiceSites()));
|
||||
}
|
||||
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(plugin.getVoteSite(voteSiteName), 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, voteSite);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,9 +13,7 @@ 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.misc.MiscUtils;
|
||||
import com.bencodez.advancedcore.api.misc.PlayerUtils;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardHandler;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.bungee.BungeeMethod;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
@@ -109,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)) {
|
||||
@@ -119,17 +122,11 @@ public class VoteSite {
|
||||
String service = getServiceSite();
|
||||
|
||||
if (Bukkit.getOnlinePlayers().size() > 0) {
|
||||
plugin.getPluginMessaging().sendPluginMessage(PlayerUtils.getInstance().getRandomOnlinePlayer(),
|
||||
"VoteBroadcast", uuid, service);
|
||||
plugin.getPluginMessaging().sendPluginMessage("VoteBroadcast", uuid, service);
|
||||
}
|
||||
}
|
||||
|
||||
} 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());
|
||||
HashMap<String, String> placeholders = new HashMap<String, String>();
|
||||
placeholders.put("player", playerName);
|
||||
@@ -175,7 +172,8 @@ public class VoteSite {
|
||||
}
|
||||
|
||||
public String getVoteURL(boolean json) {
|
||||
if (!plugin.getConfigFile().isFormatCommandsVoteForceLinks() || !json) {
|
||||
if (!plugin.getConfigFile().isFormatCommandsVoteForceLinks() || !json
|
||||
|| StringParser.getInstance().containsJson(voteURL)) {
|
||||
return voteURL;
|
||||
} else {
|
||||
if (!voteURL.startsWith("http")) {
|
||||
@@ -211,7 +209,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));
|
||||
}
|
||||
|
||||
@@ -242,4 +240,19 @@ public class VoteSite {
|
||||
return ArrayUtils.getInstance().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 += ", TimeOffSet:" + getTimeOffSet();
|
||||
str += ", Url: " + getVoteURL();
|
||||
str += ", IgnoreCanVote: " + isIgnoreCanVote();
|
||||
str += ", Hidden: " + isHidden();
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ 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;
|
||||
@@ -46,7 +47,7 @@ public class MVdWPlaceholders {
|
||||
&& user.hasPrimaryAccount()) {
|
||||
user = UserManager.getInstance().getVotingPluginUser(user.getPrimaryAccount());
|
||||
}
|
||||
return place.placeholderRequest(event.getOfflinePlayer(), user,
|
||||
return place.placeholderRequest(user,
|
||||
event.getPlaceholder().substring("VotingPlugin_".length()));
|
||||
}
|
||||
|
||||
@@ -55,7 +56,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 +64,7 @@ public class MVdWPlaceholders {
|
||||
|
||||
@Override
|
||||
public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
|
||||
return place.placeholderRequest(event.getOfflinePlayer(), null,
|
||||
return place.placeholderRequest(
|
||||
event.getPlaceholder().substring("VotingPlugin_".length()));
|
||||
}
|
||||
|
||||
|
||||
@@ -5,18 +5,26 @@ import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.bencodez.advancedcore.api.messages.StringParser;
|
||||
import com.bencodez.advancedcore.api.placeholder.NonPlayerPlaceHolder;
|
||||
import com.bencodez.advancedcore.api.placeholder.PlaceHolder;
|
||||
import com.bencodez.advancedcore.api.user.AdvancedCoreUser;
|
||||
import com.bencodez.advancedcore.api.user.UserDataChanged;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoter;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoterPlayer;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
@@ -29,7 +37,7 @@ import lombok.Getter;
|
||||
public class PlaceHolders {
|
||||
|
||||
@Getter
|
||||
private ArrayList<PlaceHolder<VotingPluginUser>> nonPlayerPlaceholders = new ArrayList<PlaceHolder<VotingPluginUser>>();
|
||||
private ArrayList<NonPlayerPlaceHolder<VotingPluginUser>> nonPlayerPlaceholders = new ArrayList<NonPlayerPlaceHolder<VotingPluginUser>>();
|
||||
|
||||
@Getter
|
||||
private ArrayList<PlaceHolder<VotingPluginUser>> placeholders = new ArrayList<PlaceHolder<VotingPluginUser>>();
|
||||
@@ -38,46 +46,137 @@ public class PlaceHolders {
|
||||
|
||||
public PlaceHolders(VotingPluginMain plugin) {
|
||||
this.plugin = plugin;
|
||||
cacheLevel = plugin.getConfigFile().getPlaceholderCacheLevel();
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
cacheLevel = plugin.getConfigFile().getPlaceholderCacheLevel();
|
||||
}
|
||||
|
||||
private ArrayList<String> cachedPlaceholders = new ArrayList<String>();
|
||||
|
||||
private ConcurrentLinkedQueue<String> placeholdersToSetCacheOn = new ConcurrentLinkedQueue<String>();
|
||||
|
||||
@Getter
|
||||
private PlaceholderCacheLevel cacheLevel;
|
||||
|
||||
public String getPlaceHolder(OfflinePlayer p, String identifier) {
|
||||
if (plugin.getConfigFile().isUseJavascriptPlaceholders()) {
|
||||
return getPlaceHolder(p, identifier, true);
|
||||
}
|
||||
|
||||
public String getPlaceHolder(OfflinePlayer p, String identifier, boolean javascript) {
|
||||
boolean forceProcess = false;
|
||||
boolean useCache = true;
|
||||
if (identifier.endsWith("_process")) {
|
||||
forceProcess = true;
|
||||
identifier = identifier.replaceAll("_process", "");
|
||||
}
|
||||
if (identifier.endsWith("_nocache")) {
|
||||
useCache = false;
|
||||
identifier = identifier.replaceAll("_nocache", "");
|
||||
}
|
||||
if (getCacheLevel().equals(PlaceholderCacheLevel.NONE)) {
|
||||
useCache = false;
|
||||
}
|
||||
|
||||
if (plugin.getConfigFile().isUseJavascriptPlaceholders() && javascript && p != null) {
|
||||
identifier = StringParser.getInstance().replaceJavascript(p, identifier);
|
||||
}
|
||||
|
||||
for (PlaceHolder<VotingPluginUser> placeholder : nonPlayerPlaceholders) {
|
||||
if (placeholder.matches(identifier)) {
|
||||
return placeholder.placeholderRequest(p, null, identifier);
|
||||
if (!identifier.endsWith("Position")) {
|
||||
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : nonPlayerPlaceholders) {
|
||||
if (placeholder.matches(identifier)) {
|
||||
String str = placeholder.placeholderRequest(identifier);
|
||||
if (str != null) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(p);
|
||||
if (Bukkit.isPrimaryThread() || plugin.getConfigFile().isAlwaysWaitForCachePlaceholders()) {
|
||||
user.setWaitForCache(false);
|
||||
if (p == null) {
|
||||
return "no player";
|
||||
}
|
||||
if (plugin.getConfigFile().isUsePrimaryAccountForPlaceholders() && user.hasPrimaryAccount()) {
|
||||
user = UserManager.getInstance().getVotingPluginUser(user.getPrimaryAccount());
|
||||
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(p);
|
||||
if (useCache) {
|
||||
if (!cachedPlaceholders.contains(identifier)) {
|
||||
// not cached placeholder
|
||||
if (!forceProcess) {
|
||||
for (PlaceHolder<VotingPluginUser> placeholder : placeholders) {
|
||||
if (placeholder.matches(identifier)) {
|
||||
if (getCacheLevel().shouldCache()) {
|
||||
if (!placeholdersToSetCacheOn.contains(identifier)) {
|
||||
placeholdersToSetCacheOn.add(identifier);
|
||||
schedulePlaceholderCheck(user);
|
||||
}
|
||||
}
|
||||
return "..";
|
||||
}
|
||||
}
|
||||
return "Not a valid placeholder";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (plugin.getConfigFile().isUsePrimaryAccountForPlaceholders()) {
|
||||
if (user.hasPrimaryAccount()) {
|
||||
user = UserManager.getInstance().getVotingPluginUser(user.getPrimaryAccount());
|
||||
}
|
||||
}
|
||||
|
||||
for (PlaceHolder<VotingPluginUser> placeholder : placeholders) {
|
||||
try {
|
||||
if (placeholder.matches(identifier)) {
|
||||
return placeholder.placeholderRequest(p, user, identifier);
|
||||
if (useCache) {
|
||||
if (placeholder.isUsesCache() && placeholder.isCached(identifier)) {
|
||||
ConcurrentHashMap<UUID, String> cache = placeholder.getCache().get(identifier);
|
||||
if (cache.containsKey(p.getUniqueId())) {
|
||||
return cache.get(p.getUniqueId());
|
||||
} else if (!forceProcess) {
|
||||
schedulePlaceholderCheck(user);
|
||||
return "...";
|
||||
}
|
||||
}
|
||||
|
||||
if (forceProcess) {
|
||||
if (getCacheLevel().shouldCache()) {
|
||||
if (!placeholdersToSetCacheOn.contains(identifier)
|
||||
&& !cachedPlaceholders.contains(identifier)) {
|
||||
placeholdersToSetCacheOn.add(identifier);
|
||||
schedulePlaceholderCheck(user);
|
||||
}
|
||||
}
|
||||
return placeholder.placeholderRequest(user, identifier);
|
||||
} else {
|
||||
if (getCacheLevel().shouldCache()) {
|
||||
if (!placeholdersToSetCacheOn.contains(identifier)
|
||||
&& !cachedPlaceholders.contains(identifier)) {
|
||||
placeholdersToSetCacheOn.add(identifier);
|
||||
schedulePlaceholderCheck(user);
|
||||
}
|
||||
}
|
||||
return ".";
|
||||
}
|
||||
} else {
|
||||
return placeholder.placeholderRequest(user, identifier);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
plugin.debug(e);
|
||||
return "...";
|
||||
return "Error";
|
||||
}
|
||||
}
|
||||
|
||||
return "Not a valid placeholder";
|
||||
|
||||
}
|
||||
|
||||
public String getPlaceHolder(Player p, String identifier) {
|
||||
if (plugin.getConfigFile().isUseJavascriptPlaceholders()) {
|
||||
identifier = StringParser.getInstance().replaceJavascript(p, identifier);
|
||||
}
|
||||
return getPlaceHolder((OfflinePlayer) p, identifier);
|
||||
return getPlaceHolder(p, identifier, false);
|
||||
}
|
||||
|
||||
public void load() {
|
||||
@@ -88,54 +187,54 @@ public class PlaceHolders {
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("total") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return Integer.toString(user.getTotal(TopVoter.Monthly));
|
||||
}
|
||||
}.withDescription("Month total"));
|
||||
}.withDescription("Month total").updateDataKey("MonthTotal"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("alltimetotal") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return Integer.toString(user.getTotal(TopVoter.AllTime));
|
||||
}
|
||||
}.withDescription("Alltime total"));
|
||||
}.withDescription("Alltime total").updateDataKey("AllTimeTotal"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("lastmonthtotal") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return Integer.toString(user.getLastMonthTotal());
|
||||
}
|
||||
}.withDescription("Last month total"));
|
||||
}.withDescription("Last month total").updateDataKey("LastMonthTotal"));
|
||||
|
||||
// end of older placeholders
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("DisableBroadcast") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return "" + user.getDisableBroadcast();
|
||||
}
|
||||
}.withDescription("Returns true/false if user has broadcast disabled"));
|
||||
}.withDescription("Returns true/false if user has broadcast disabled").updateDataKey("DisableBroadcast"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("MilestoneCount") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return "" + user.getMilestoneCount();
|
||||
}
|
||||
}.withDescription("User milestonecount"));
|
||||
}.withDescription("User milestonecount").updateDataKey("MilestoneCount"));
|
||||
|
||||
for (final String identifier : plugin.getGui().getChestShopIdentifiers()) {
|
||||
if (plugin.getGui().getChestShopIdentifierLimit(identifier) > 0) {
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("VoteShopLimit_" + identifier) {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String ident) {
|
||||
public String placeholderRequest(VotingPluginUser user, String ident) {
|
||||
return "" + user.getVoteShopIdentifierLimit(identifier);
|
||||
}
|
||||
}.withDescription("User voteshop limit for " + identifier));
|
||||
}.withDescription("User voteshop limit for " + identifier).updateDataKey("VoteShopLimit" + identifier));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,113 +242,121 @@ public class PlaceHolders {
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Total_" + top.toString()) {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return Integer.toString(user.getTotal(top));
|
||||
}
|
||||
}.withDescription("User total for " + top.getName()));
|
||||
}.withDescription("User total for " + top.getName()).updateDataKey(top.getColumnName()));
|
||||
}
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("BestDailyTotal") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return Integer.toString(user.getHighestDailyTotal());
|
||||
}
|
||||
}.withDescription("Best daily total"));
|
||||
}.withDescription("Best daily total").updateDataKey("HighestDailyTotal"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("BestWeeklyTotal") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return Integer.toString(user.getHighestWeeklyTotal());
|
||||
}
|
||||
}.withDescription("Best weekly total"));
|
||||
}.withDescription("Best weekly total").updateDataKey("HighestWeeklyTotal"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("BestMonthlyTotal") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return Integer.toString(user.getHighestMonthlyTotal());
|
||||
}
|
||||
}.withDescription("Best monthly total"));
|
||||
}.withDescription("Best monthly total").updateDataKey("HighestMonthlyTotal"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("DailyVoteStreak") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return Integer.toString(user.getDayVoteStreak());
|
||||
}
|
||||
}.withDescription("Current daily votestreak"));
|
||||
}.withDescription("Current daily votestreak").updateDataKey("DayVoteStreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("WeeklyVoteStreak") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return Integer.toString(user.getWeekVoteStreak());
|
||||
}
|
||||
}.withDescription("Current weekly votestreak"));
|
||||
}.withDescription("Current weekly votestreak").updateDataKey("WeekVoteStreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("MonthVoteStreak") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return Integer.toString(user.getMonthVoteStreak());
|
||||
}
|
||||
}.withDescription("Current month votestreak"));
|
||||
}.withDescription("Current month votestreak").updateDataKey("MonthVoteStreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("BestDailyVoteStreak") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return Integer.toString(user.getBestDayVoteStreak());
|
||||
}
|
||||
}.withDescription("Best daily votestreak"));
|
||||
}.withDescription("Best daily votestreak").updateDataKey("BestDayVoteStreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("BestWeeklyVoteStreak") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return Integer.toString(user.getBestWeekVoteStreak());
|
||||
}
|
||||
}.withDescription("Best weekly votestreak"));
|
||||
}.withDescription("Best weekly votestreak").updateDataKey("BestWeekVoteStreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("BestMonthVoteStreak") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return Integer.toString(user.getBestMonthVoteStreak());
|
||||
}
|
||||
}.withDescription("Best month votestreak"));
|
||||
}.withDescription("Best month votestreak").updateDataKey("BestMonthVoteStreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Points") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return Integer.toString(user.getPoints());
|
||||
}
|
||||
}.withDescription("User points"));
|
||||
}.withDescription("User points").updateDataKey("Points"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Points_Format") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.US);
|
||||
return numberFormat.format(user.getPoints());
|
||||
}
|
||||
}.withDescription("User points"));
|
||||
}.withDescription("User points").updateDataKey("Points"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("CanVote") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return Boolean.toString(user.canVoteAll());
|
||||
}
|
||||
}.withDescription("Return true/false if player can vote on all sites"));
|
||||
}.withDescription("Return true/false if player can vote on all sites").updateDataKey("LastVotes"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("CanVoteSites") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return "" + user.getSitesNotVotedOn();
|
||||
}
|
||||
}.withDescription("Return number of votesites available").updateDataKey("LastVotes"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Next_AnySite") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
if (user.canVoteAny()) {
|
||||
return plugin.getConfigFile().getFormatCommandsVoteNextInfoCanVote();
|
||||
}
|
||||
@@ -273,39 +380,40 @@ public class PlaceHolders {
|
||||
|
||||
return "Error";
|
||||
}
|
||||
}.withDescription("How long until user can vote on anysite"));
|
||||
}.withDescription("How long until user can vote on anysite").updateDataKey("LastVotes"));
|
||||
|
||||
for (final VoteSite voteSite : plugin.getVoteSites()) {
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Next_" + voteSite.getKey()) {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return user.voteCommandNextInfo(voteSite);
|
||||
}
|
||||
}.withDescription("How long until user can vote on " + voteSite.getKey()));
|
||||
}.withDescription("How long until user can vote on " + voteSite.getKey()).updateDataKey("LastVotes"));
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Last_" + voteSite.getKey()) {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return user.voteCommandLastDuration(voteSite);
|
||||
}
|
||||
}.withDescription("How long ago user voted on " + voteSite.getKey()));
|
||||
}.withDescription("How long ago user voted on " + voteSite.getKey()).updateDataKey("LastVotes"));
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("CanVote_" + voteSite.getKey()) {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return "" + user.canVoteSite(voteSite);
|
||||
}
|
||||
}.withDescription("Whether or not player can vote on " + voteSite.getKey()));
|
||||
}.withDescription("Whether or not player can vote on " + voteSite.getKey()).updateDataKey("LastVotes"));
|
||||
}
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Top_All_Position") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
int num = 1;
|
||||
for (Entry<VotingPluginUser, Integer> entry : plugin.getTopVoter(TopVoter.AllTime).entrySet()) {
|
||||
if (entry.getKey().getUUID().equals(p.getUniqueId().toString())) {
|
||||
UUID toMatch = UUID.fromString(user.getUUID());
|
||||
for (Entry<TopVoterPlayer, Integer> entry : plugin.getTopVoter(TopVoter.AllTime).entrySet()) {
|
||||
if (entry.getKey().getUuid().equals(toMatch)) {
|
||||
return "" + num;
|
||||
}
|
||||
num++;
|
||||
@@ -314,15 +422,15 @@ public class PlaceHolders {
|
||||
}
|
||||
}.withDescription("Get user top voter position"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Top_AllVotes_") {
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("Top_AllVotes_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<VotingPluginUser, Integer> entry : plugin.getTopVoter(TopVoter.AllTime).entrySet()) {
|
||||
for (Entry<TopVoterPlayer, Integer> entry : plugin.getTopVoter(TopVoter.AllTime).entrySet()) {
|
||||
if (num == number) {
|
||||
return "" + entry.getKey().getTotal(TopVoter.AllTime);
|
||||
return "" + entry.getValue().intValue();
|
||||
}
|
||||
num++;
|
||||
}
|
||||
@@ -330,13 +438,16 @@ public class PlaceHolders {
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user votes at position in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Top_All_") {
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("Top_All_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(String identifier) {
|
||||
if (!StringParser.getInstance().isInt(identifier.split("_")[2])) {
|
||||
return null;
|
||||
}
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<VotingPluginUser, Integer> entry : plugin.getTopVoter(TopVoter.AllTime).entrySet()) {
|
||||
for (Entry<TopVoterPlayer, Integer> entry : plugin.getTopVoter(TopVoter.AllTime).entrySet()) {
|
||||
if (num == number) {
|
||||
return entry.getKey().getPlayerName();
|
||||
}
|
||||
@@ -349,10 +460,11 @@ public class PlaceHolders {
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Top_Month_Position") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
int num = 1;
|
||||
for (Entry<VotingPluginUser, Integer> entry : plugin.getTopVoter(TopVoter.Monthly).entrySet()) {
|
||||
if (entry.getKey().getUUID().equals(p.getUniqueId().toString())) {
|
||||
UUID toMatch = UUID.fromString(user.getUUID());
|
||||
for (Entry<TopVoterPlayer, Integer> entry : plugin.getTopVoter(TopVoter.Monthly).entrySet()) {
|
||||
if (entry.getKey().getUuid().equals(toMatch)) {
|
||||
return "" + num;
|
||||
}
|
||||
num++;
|
||||
@@ -361,13 +473,16 @@ public class PlaceHolders {
|
||||
}
|
||||
}.withDescription("Get user top voter position"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Top_Month_") {
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("Top_Month_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(String identifier) {
|
||||
if (!StringParser.getInstance().isInt(identifier.split("_")[2])) {
|
||||
return null;
|
||||
}
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<VotingPluginUser, Integer> entry : plugin.getTopVoter(TopVoter.Monthly).entrySet()) {
|
||||
for (Entry<TopVoterPlayer, Integer> entry : plugin.getTopVoter(TopVoter.Monthly).entrySet()) {
|
||||
if (num == number) {
|
||||
return entry.getKey().getPlayerName();
|
||||
}
|
||||
@@ -377,15 +492,15 @@ public class PlaceHolders {
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user at position in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Top_MonthVotes_") {
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("Top_MonthVotes_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<VotingPluginUser, Integer> entry : plugin.getTopVoter(TopVoter.Monthly).entrySet()) {
|
||||
for (Entry<TopVoterPlayer, Integer> entry : plugin.getTopVoter(TopVoter.Monthly).entrySet()) {
|
||||
if (num == number) {
|
||||
return "" + entry.getKey().getTotal(TopVoter.Monthly);
|
||||
return "" + entry.getValue().intValue();
|
||||
}
|
||||
num++;
|
||||
}
|
||||
@@ -396,10 +511,11 @@ public class PlaceHolders {
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Top_Week_Position") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
int num = 1;
|
||||
for (Entry<VotingPluginUser, Integer> entry : plugin.getTopVoter(TopVoter.Weekly).entrySet()) {
|
||||
if (entry.getKey().getUUID().equals(p.getUniqueId().toString())) {
|
||||
UUID toMatch = UUID.fromString(user.getUUID());
|
||||
for (Entry<TopVoterPlayer, Integer> entry : plugin.getTopVoter(TopVoter.Weekly).entrySet()) {
|
||||
if (entry.getKey().getUuid().equals(toMatch)) {
|
||||
return "" + num;
|
||||
}
|
||||
num++;
|
||||
@@ -408,13 +524,16 @@ public class PlaceHolders {
|
||||
}
|
||||
}.withDescription("Get user top voter position"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Top_Week_") {
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("Top_Week_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(String identifier) {
|
||||
if (!StringParser.getInstance().isInt(identifier.split("_")[2])) {
|
||||
return null;
|
||||
}
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<VotingPluginUser, Integer> entry : plugin.getTopVoter(TopVoter.Weekly).entrySet()) {
|
||||
for (Entry<TopVoterPlayer, Integer> entry : plugin.getTopVoter(TopVoter.Weekly).entrySet()) {
|
||||
if (num == number) {
|
||||
return entry.getKey().getPlayerName();
|
||||
}
|
||||
@@ -424,15 +543,15 @@ public class PlaceHolders {
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user at postion in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Top_WeekVotes_") {
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("Top_WeekVotes_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<VotingPluginUser, Integer> entry : plugin.getTopVoter(TopVoter.Weekly).entrySet()) {
|
||||
for (Entry<TopVoterPlayer, Integer> entry : plugin.getTopVoter(TopVoter.Weekly).entrySet()) {
|
||||
if (num == number) {
|
||||
return "" + entry.getKey().getTotal(TopVoter.Weekly);
|
||||
return "" + entry.getValue().intValue();
|
||||
}
|
||||
num++;
|
||||
}
|
||||
@@ -443,10 +562,11 @@ public class PlaceHolders {
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Top_Daily_Position") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
int num = 1;
|
||||
for (Entry<VotingPluginUser, Integer> entry : plugin.getTopVoter(TopVoter.Daily).entrySet()) {
|
||||
if (entry.getKey().getUUID().equals(p.getUniqueId().toString())) {
|
||||
UUID toMatch = UUID.fromString(user.getUUID());
|
||||
for (Entry<TopVoterPlayer, Integer> entry : plugin.getTopVoter(TopVoter.Daily).entrySet()) {
|
||||
if (entry.getKey().getUuid().equals(toMatch)) {
|
||||
return "" + num;
|
||||
}
|
||||
num++;
|
||||
@@ -455,13 +575,16 @@ public class PlaceHolders {
|
||||
}
|
||||
}.withDescription("Get user top voter position"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Top_Daily_") {
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("Top_Daily_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(String identifier) {
|
||||
if (!StringParser.getInstance().isInt(identifier.split("_")[2])) {
|
||||
return null;
|
||||
}
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<VotingPluginUser, Integer> entry : plugin.getTopVoter(TopVoter.Daily).entrySet()) {
|
||||
for (Entry<TopVoterPlayer, Integer> entry : plugin.getTopVoter(TopVoter.Daily).entrySet()) {
|
||||
if (num == number) {
|
||||
return entry.getKey().getPlayerName();
|
||||
}
|
||||
@@ -474,20 +597,20 @@ public class PlaceHolders {
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("VotePartyContributedVotes") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(VotingPluginUser user, String identifier) {
|
||||
return "" + user.getVotePartyVotes();
|
||||
}
|
||||
}.useStartsWith().withDescription("See vote party placeholders contributed"));
|
||||
}.useStartsWith().withDescription("See vote party placeholders contributed").updateDataKey("VotePartyVotes"));
|
||||
|
||||
placeholders.add(new PlaceHolder<VotingPluginUser>("Top_DailyVotes_") {
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("Top_DailyVotes_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<VotingPluginUser, Integer> entry : plugin.getTopVoter(TopVoter.Daily).entrySet()) {
|
||||
for (Entry<TopVoterPlayer, Integer> entry : plugin.getTopVoter(TopVoter.Daily).entrySet()) {
|
||||
if (num == number) {
|
||||
return "" + entry.getKey().getTotal(TopVoter.Daily);
|
||||
return "" + entry.getValue().intValue();
|
||||
}
|
||||
num++;
|
||||
}
|
||||
@@ -497,34 +620,68 @@ public class PlaceHolders {
|
||||
|
||||
// non players
|
||||
|
||||
nonPlayerPlaceholders.add(new PlaceHolder<VotingPluginUser>("VotePartyVotesCurrent") {
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("VotePartyVotesCurrent") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(String identifier) {
|
||||
return Integer.toString(plugin.getVoteParty().getTotalVotes());
|
||||
}
|
||||
}.withDescription("Current amount of voteparty votes"));
|
||||
|
||||
nonPlayerPlaceholders.add(new PlaceHolder<VotingPluginUser>("VotePartyVotesNeeded") {
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("VotePartyVotesNeeded") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(String identifier) {
|
||||
return Integer.toString(plugin.getVoteParty().getNeededVotes());
|
||||
}
|
||||
}.withDescription("Voteparty votes needed"));
|
||||
|
||||
nonPlayerPlaceholders.add(new PlaceHolder<VotingPluginUser>("VotePartyVotesRequired") {
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("VotePartyVotesRequired") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(String identifier) {
|
||||
return Integer.toString(plugin.getVoteParty().getVotesRequired());
|
||||
}
|
||||
}.withDescription("Amount of votes needed for voteparty"));
|
||||
|
||||
nonPlayerPlaceholders.add(new PlaceHolder<VotingPluginUser>("GlobalMonthTotal") {
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("BungeeVotePartyVotesCurrent") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(String identifier) {
|
||||
if (plugin.getBungeeHandler() != null) {
|
||||
return Integer.toString(plugin.getBungeeHandler().getBungeeVotePartyCurrent());
|
||||
}
|
||||
return "" + 0;
|
||||
}
|
||||
}.withDescription("Current amount of bungee voteparty votes"));
|
||||
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("BungeeVotePartyVotesNeeded") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(String identifier) {
|
||||
if (plugin.getBungeeHandler() != null) {
|
||||
return Integer.toString(plugin.getBungeeHandler().getBungeeVotePartyRequired()
|
||||
- plugin.getBungeeHandler().getBungeeVotePartyCurrent());
|
||||
}
|
||||
return "" + 0;
|
||||
}
|
||||
}.withDescription("Voteparty bungee votes needed"));
|
||||
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("BungeeVotePartyVotesRequired") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(String identifier) {
|
||||
if (plugin.getBungeeHandler() != null) {
|
||||
return Integer.toString(plugin.getBungeeHandler().getBungeeVotePartyRequired());
|
||||
}
|
||||
return "" + 0;
|
||||
}
|
||||
}.withDescription("Amount of votes needed for bungee voteparty"));
|
||||
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("GlobalMonthTotal") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(String identifier) {
|
||||
int total = 0;
|
||||
for (int num : VotingPluginMain.plugin.getTopVoter(TopVoter.Monthly).values()) {
|
||||
total += num;
|
||||
@@ -533,10 +690,10 @@ public class PlaceHolders {
|
||||
}
|
||||
}.withDescription("Global month total"));
|
||||
|
||||
nonPlayerPlaceholders.add(new PlaceHolder<VotingPluginUser>("GlobalAllTimeTotal") {
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("GlobalAllTimeTotal") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(String identifier) {
|
||||
int total = 0;
|
||||
for (int num : VotingPluginMain.plugin.getTopVoter(TopVoter.AllTime).values()) {
|
||||
total += num;
|
||||
@@ -545,10 +702,10 @@ public class PlaceHolders {
|
||||
}
|
||||
}.withDescription("Global alltime total"));
|
||||
|
||||
nonPlayerPlaceholders.add(new PlaceHolder<VotingPluginUser>("GlobalWeeklyTotal") {
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("GlobalWeeklyTotal") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(String identifier) {
|
||||
int total = 0;
|
||||
for (int num : VotingPluginMain.plugin.getTopVoter(TopVoter.Weekly).values()) {
|
||||
total += num;
|
||||
@@ -557,10 +714,10 @@ public class PlaceHolders {
|
||||
}
|
||||
}.withDescription("Global weekly total"));
|
||||
|
||||
nonPlayerPlaceholders.add(new PlaceHolder<VotingPluginUser>("GlobalDailyTotal") {
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("GlobalDailyTotal") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(String identifier) {
|
||||
int total = 0;
|
||||
for (int num : VotingPluginMain.plugin.getTopVoter(TopVoter.Daily).values()) {
|
||||
total += num;
|
||||
@@ -569,10 +726,10 @@ public class PlaceHolders {
|
||||
}
|
||||
}.withDescription("Global daily total"));
|
||||
|
||||
nonPlayerPlaceholders.add(new PlaceHolder<VotingPluginUser>("TimeUntilDayReset") {
|
||||
nonPlayerPlaceholders.add(new NonPlayerPlaceHolder<VotingPluginUser>("TimeUntilDayReset") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, VotingPluginUser user, String identifier) {
|
||||
public String placeholderRequest(String identifier) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime offsetoclocktoday = plugin.getTimeChecker().getTime().withHour(0).withMinute(0);
|
||||
LocalDateTime offsetoclocktomorrow = plugin.getTimeChecker().getTime().plusDays(1).withHour(0)
|
||||
@@ -606,5 +763,151 @@ public class PlaceHolders {
|
||||
|
||||
}
|
||||
}.withDescription("Time until plugin time day changes"));
|
||||
|
||||
Set<String> placeholdersSet = new HashSet<String>();
|
||||
placeholdersSet.addAll(plugin.getConfigFile().getCachedPlaceholders());
|
||||
if (getCacheLevel().equals(PlaceholderCacheLevel.AUTO)) {
|
||||
placeholdersSet.addAll(plugin.getServerData().getAutoCachedPlaceholder());
|
||||
}
|
||||
|
||||
for (String toCache : placeholdersSet) {
|
||||
if (toCache.startsWith("votingplugin")) {
|
||||
toCache = toCache.substring("votingplugin_".length());
|
||||
}
|
||||
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : nonPlayerPlaceholders) {
|
||||
if (placeholder.matches(toCache)) {
|
||||
placeholder.setUseCache(true, toCache);
|
||||
cachedPlaceholders.add(toCache);
|
||||
plugin.extraDebug("Caching placeholder " + toCache);
|
||||
}
|
||||
}
|
||||
|
||||
for (PlaceHolder<VotingPluginUser> placeholder : placeholders) {
|
||||
if (placeholder.matches(toCache)) {
|
||||
placeholder.setUseCache(true, toCache);
|
||||
cachedPlaceholders.add(toCache);
|
||||
plugin.extraDebug("Caching placeholder " + toCache);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugin.getUserManager().getUserDataChange().add(new UserDataChanged() {
|
||||
|
||||
@Override
|
||||
public void onChange(AdvancedCoreUser user, String... keys) {
|
||||
VotingPluginUser vpUser = UserManager.getInstance().getVotingPluginUser(user);
|
||||
if (!vpUser.isCached()) {
|
||||
vpUser.dontCache();
|
||||
}
|
||||
for (PlaceHolder<VotingPluginUser> placeholder : placeholders) {
|
||||
if (placeholder.isUsesCache()) {
|
||||
for (String key : keys) {
|
||||
if (placeholder.getUpdateDataKey().equalsIgnoreCase(key)) {
|
||||
for (String ident : placeholder.getCache().keySet()) {
|
||||
String value = placeholder.placeholderRequest(vpUser, ident);
|
||||
placeholder.getCache().get(ident).put(vpUser.getJavaUUID(), value);
|
||||
plugin.devDebug("Updated placeholder cache for " + vpUser.getUUID() + " on " + key
|
||||
+ " with " + value);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onVotePartyUpdate() {
|
||||
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : nonPlayerPlaceholders) {
|
||||
if (placeholder.isUsesCache()) {
|
||||
if (placeholder.getIdentifier().startsWith("VoteParty")) {
|
||||
for (String ident : placeholder.getCache().keySet()) {
|
||||
placeholder.getCache().put(ident, placeholder.placeholderRequest(ident));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onBungeeVotePartyUpdate() {
|
||||
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : nonPlayerPlaceholders) {
|
||||
if (placeholder.isUsesCache()) {
|
||||
if (placeholder.getIdentifier().startsWith("BungeeVoteParty")) {
|
||||
for (String ident : placeholder.getCache().keySet()) {
|
||||
placeholder.getCache().put(ident, placeholder.placeholderRequest(ident));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onUpdate(VotingPluginUser user) {
|
||||
for (PlaceHolder<VotingPluginUser> placeholder : placeholders) {
|
||||
if (placeholder.isUsesCache()) {
|
||||
for (String ident : placeholder.getCache().keySet()) {
|
||||
placeholder.getCache().get(ident).put(user.getJavaUUID(),
|
||||
placeholder.placeholderRequest(user, ident));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void checkNonCachedPlaceholders() {
|
||||
while (!placeholdersToSetCacheOn.isEmpty()) {
|
||||
String toCache = placeholdersToSetCacheOn.poll().toLowerCase();
|
||||
if (toCache.startsWith("votingplugin")) {
|
||||
toCache = toCache.substring("votingplugin_".length());
|
||||
}
|
||||
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : nonPlayerPlaceholders) {
|
||||
if (placeholder.matches(toCache)) {
|
||||
placeholder.setUseCache(true, toCache);
|
||||
cachedPlaceholders.add(toCache);
|
||||
plugin.getServerData().addAutoCachedPlaceholder(toCache);
|
||||
plugin.extraDebug("Auto Caching placeholder " + toCache);
|
||||
}
|
||||
|
||||
}
|
||||
for (PlaceHolder<VotingPluginUser> placeholder : placeholders) {
|
||||
if (placeholder.matches(toCache)) {
|
||||
placeholder.setUseCache(true, toCache);
|
||||
cachedPlaceholders.add(toCache);
|
||||
plugin.getServerData().addAutoCachedPlaceholder(toCache);
|
||||
plugin.extraDebug("Auto Caching placeholder " + toCache);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void schedulePlaceholderCheck(VotingPluginUser user) {
|
||||
plugin.getTimer().execute(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
checkNonCachedPlaceholders();
|
||||
onUpdate(user);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
checkNonCachedPlaceholders();
|
||||
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : nonPlayerPlaceholders) {
|
||||
if (placeholder.isUsesCache()) {
|
||||
for (String ident : placeholder.getCache().keySet()) {
|
||||
if (ident != null) {
|
||||
String str = placeholder.placeholderRequest(ident);
|
||||
if (str != null) {
|
||||
placeholder.getCache().put(ident, str);
|
||||
}
|
||||
} else {
|
||||
plugin.debug("ident null: " + placeholder.getIdentifier());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.bencodez.votingplugin.placeholders;
|
||||
|
||||
public enum PlaceholderCacheLevel {
|
||||
NONE, SPECIFC, AUTO;
|
||||
|
||||
public static PlaceholderCacheLevel getCache(String str) {
|
||||
for (PlaceholderCacheLevel v : PlaceholderCacheLevel.values()) {
|
||||
if (v.toString().equalsIgnoreCase(str)) {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
return AUTO;
|
||||
}
|
||||
|
||||
public boolean shouldCache() {
|
||||
switch (this) {
|
||||
case AUTO:
|
||||
return true;
|
||||
case NONE:
|
||||
return false;
|
||||
case SPECIFC:
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,7 +16,7 @@ import com.bencodez.advancedcore.api.misc.MiscUtils;
|
||||
import com.bencodez.advancedcore.nms.NMSManager;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoter;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoterPlayer;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -79,9 +79,11 @@ public class SignHandler {
|
||||
@SuppressWarnings("deprecation")
|
||||
private boolean checkSkull(Block block) {
|
||||
if (block.getState() instanceof Skull) {
|
||||
Skull skull = (Skull) block.getState();
|
||||
skull.setOwner(playerName);
|
||||
skull.update();
|
||||
if (!playerName.equals("No Player")) {
|
||||
Skull skull = (Skull) block.getState();
|
||||
skull.setOwner(playerName);
|
||||
skull.update();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -91,7 +93,7 @@ public class SignHandler {
|
||||
* Check skulls.
|
||||
*/
|
||||
public void checkSkulls() {
|
||||
if (playerName.equalsIgnoreCase("No Player") || playerName.equals("")) {
|
||||
if (noNameAvailable()) {
|
||||
return;
|
||||
}
|
||||
if (skullLocation != null) {
|
||||
@@ -151,6 +153,10 @@ public class SignHandler {
|
||||
return skullLocation != null;
|
||||
}
|
||||
|
||||
public boolean noNameAvailable() {
|
||||
return playerName.equalsIgnoreCase("No Player") || playerName.equals("");
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the sign.
|
||||
*/
|
||||
@@ -181,7 +187,7 @@ public class SignHandler {
|
||||
lines.add(line3);
|
||||
lines.add(line4);
|
||||
|
||||
ArrayList<VotingPluginUser> users = null;
|
||||
ArrayList<TopVoterPlayer> users = null;
|
||||
if (data.equalsIgnoreCase("all")) {
|
||||
users = plugin.convertSet(plugin.getTopVoter(TopVoter.AllTime).keySet());
|
||||
} else if (data.equalsIgnoreCase("monthly")) {
|
||||
@@ -193,7 +199,7 @@ public class SignHandler {
|
||||
}
|
||||
|
||||
if (users != null && users.size() >= position) {
|
||||
VotingPluginUser user = users.get(position - 1);
|
||||
TopVoterPlayer user = users.get(position - 1);
|
||||
playerName = user.getPlayerName();
|
||||
|
||||
votes = 0;
|
||||
@@ -251,6 +257,7 @@ public class SignHandler {
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
plugin.debug("Failed to update sign at " + getLocation().toString());
|
||||
VotingPluginMain.plugin.debug(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class Signs {
|
||||
}
|
||||
}
|
||||
|
||||
plugin.debug("Signs updated");
|
||||
plugin.debug(getSigns().size() + " Signs updated");
|
||||
}
|
||||
|
||||
}
|
||||
Loaded 100 of 112 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user