Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f898d46c95
|
||
|
|
05c0c298ec
|
||
|
|
b6d0d224d8 | ||
|
|
26afe69a95 | ||
|
|
d38e70e012 | ||
|
|
12b77c50ce | ||
|
|
0fbcd8ca11 | ||
|
|
2e68f4e058 | ||
|
|
8b538ad86e | ||
|
|
1d4973f550 | ||
|
|
b13e4f9635 | ||
|
|
b075866f83 | ||
|
|
68896b32c3 | ||
|
|
8e81dc99c5 | ||
|
|
1b202f246f | ||
|
|
79bea20039 | ||
|
|
63905004b6 | ||
|
|
f326e2cbbb | ||
|
|
9f6edca531 | ||
|
|
3e277a4a76 | ||
|
|
3b33e5e4a7 | ||
|
|
b5f35038fa | ||
|
|
b937d30213 | ||
|
|
d43cf53276 | ||
|
|
6a7b677322 | ||
|
|
b309537f97 | ||
|
|
7e34dd89b8 | ||
|
|
5dcc0a1b33 | ||
|
|
36f8b3fbe8 | ||
|
|
df298fd66c | ||
|
|
c93aff6c20 | ||
|
|
b8acfe20ec | ||
|
|
110aaf096e | ||
|
|
171975c3d3 | ||
|
|
ac96d277c5 | ||
|
|
b1ad952950 | ||
|
|
ca30bcb183 | ||
|
|
eecd975731 | ||
|
|
aa55b10e50 | ||
|
|
64f59f8195 | ||
|
|
a51e041430 | ||
|
|
b39f768a46 | ||
|
|
e98bc49add | ||
|
|
8b2209aa59 | ||
|
|
58a0e85d00 | ||
|
|
3febfa4056 | ||
|
|
e5668c862a | ||
|
|
fd4c6a3954 | ||
|
|
9e9472680a | ||
|
|
cbecd7be30 | ||
|
|
fcb1af77cf | ||
|
|
5d9b5b7b6c | ||
|
|
d26d61a6f0 | ||
|
|
3f885aa358 | ||
|
|
d088f2e91a | ||
|
|
a536c53dd9 | ||
|
|
5d2d6f0763 | ||
|
|
0848ed83c2 | ||
|
|
1771fe0889 | ||
|
|
ce5b197e8b | ||
|
|
15489d9c64 | ||
|
|
758632b5a5 | ||
|
|
3dc45b6a63 | ||
|
|
26c9ad98bc | ||
|
|
ee2531af1e | ||
|
|
461e5f8413 | ||
|
|
1c5acbd1a1 | ||
|
|
e855c01854 | ||
|
|
aeec7d9d17 | ||
|
|
4861c041e4 | ||
|
|
d1c6752240 | ||
|
|
caa7058363 | ||
|
|
b67f6a509c | ||
|
|
0edc09dc80 | ||
|
|
19e597e094 | ||
|
|
bfc838bfaa | ||
|
|
9cda17e89e | ||
|
|
54a573a445 | ||
|
|
5432b2a0d3 | ||
|
|
13d3a614ed | ||
|
|
f9641e158d | ||
|
|
a0c1f64aac | ||
|
|
1f88cb0261 | ||
|
|
71ccf6a7b0 | ||
|
|
47a42d2bc8 | ||
|
|
ac41787c1e | ||
|
|
ed4e3968da | ||
|
|
09da81cc4e | ||
|
|
fd35c43c16 | ||
|
|
8060f594c3 | ||
|
|
39aa7062a5 | ||
|
|
7ff7fbb7cb | ||
|
|
231817314b | ||
|
|
a20f10d978 | ||
|
|
997beaae28 | ||
|
|
9acc5861b7 | ||
|
|
f299847d46 | ||
|
|
87ff48366c | ||
|
|
3dde76dcde | ||
|
|
237713a799 | ||
|
|
23141d4ec1 | ||
|
|
2cfbaf4de8 | ||
|
|
c31b83fcd3 | ||
|
|
4cfd887c33 | ||
|
|
f04930e437 | ||
|
|
c45e8356bb | ||
|
|
2f78b7784a | ||
|
|
911642f57f | ||
|
|
5e63c04f6c | ||
|
|
e368f30dd9 | ||
|
|
5d5e8b0d55 | ||
|
|
16e52a4fd7 | ||
|
|
331c8fedf5 | ||
|
|
c085d6823e | ||
|
|
47680b2646 | ||
|
|
60ed0ce73d | ||
|
|
e5ae3184e0 | ||
|
|
dca9c6fe18 | ||
|
|
083e90706f | ||
|
|
fed96bcda1 | ||
|
|
5bad8c8f98 | ||
|
|
e31326395c | ||
|
|
f5b2d27b9e | ||
|
|
42626e3789 | ||
|
|
b35ff9454d | ||
|
|
9ee1547691 | ||
|
|
cb1599fe56 | ||
|
|
59a206617c | ||
|
|
699d74ca3f | ||
|
|
ad6d411e64 | ||
|
|
1b430dc4b8 | ||
|
|
526dcc830e | ||
|
|
75aaae7016 | ||
|
|
89d3372701 | ||
|
|
209f1dbc25 | ||
|
|
bb67de8d0e | ||
|
|
b4d57c7eae | ||
|
|
2ac6609d8e | ||
|
|
9eec6525c0 | ||
|
|
858b8b7b3c | ||
|
|
0aaef50a82 | ||
|
|
365f06d2ed | ||
|
|
a1b7370da0 | ||
|
|
2f52576bc4 | ||
|
|
bac19aecb9 | ||
|
|
3ad6ce247d | ||
|
|
bb78792e27 | ||
|
|
726b116c20 | ||
|
|
f731f82b01 | ||
|
|
939c431bcf | ||
|
|
87ed9dfe39 | ||
|
|
eceacf607f | ||
|
|
8d6db5b94f | ||
|
|
700300a293 | ||
|
|
5e5e208de0 | ||
|
|
b48662acfe | ||
|
|
0aed3068db | ||
|
|
25a3ff904d | ||
|
|
bb7adc409a | ||
|
|
1b28966798 | ||
|
|
f5d34ad84a | ||
|
|
abd86834a6 | ||
|
|
c6647d7cc3 | ||
|
|
a3851f9bf2 | ||
|
|
a951aae0de | ||
|
|
826fc95131 | ||
|
|
dea13f6ff1 | ||
|
|
bab55de93b | ||
|
|
1c112688b1 | ||
|
|
bc0e82f68f | ||
|
|
a82397a67f | ||
|
|
b1ffce516c | ||
|
|
f48a008040 | ||
|
|
90c8255894 | ||
|
|
4001e865f5 | ||
|
|
77b7659cb6 | ||
|
|
bc073857f6 | ||
|
|
9c2a41c9b5 | ||
|
|
972f5350a1 | ||
|
|
66df9d85da | ||
|
|
4046dd9d7f | ||
|
|
d89aa6ccb2 | ||
|
|
813ffed723 | ||
|
|
c0bc1b2730 | ||
|
|
1217e63583 | ||
|
|
cd6ed92e4f | ||
|
|
07c9eda769 | ||
|
|
ef0f73ba32 | ||
|
|
10b0fd3b11 | ||
|
|
a4aa209aa7 | ||
|
|
70af742083 | ||
|
|
0463700037 | ||
|
|
69d9c09b06 | ||
|
|
4455cc96b9 | ||
|
|
0ee7c1f2e8 | ||
|
|
4b3cc8c8e0 | ||
|
|
c2fe26aaea | ||
|
|
2aa84c90e8 | ||
|
|
c8cace388e | ||
|
|
1da028476f | ||
|
|
c28bddd0ba | ||
|
|
1afd8253a5 | ||
|
|
a3a1b4604f | ||
|
|
3bd41af200 | ||
|
|
0042045d9b | ||
|
|
76d7579c7d | ||
|
|
f591b863f1 | ||
|
|
b43c4b89a8 | ||
|
|
bc49aae401 | ||
|
|
f9d7f5a136 | ||
|
|
338853a29f | ||
|
|
7d0722d5c4 | ||
|
|
86e6bca31d | ||
|
|
8488233be1 | ||
|
|
ba5f8dfa6d | ||
|
|
dc865f1d20 | ||
|
|
5dedb644b2 | ||
|
|
c041c7c33a | ||
|
|
bbc0c4a88e | ||
|
|
4d200f6675 | ||
|
|
ad7970c99d | ||
|
|
2ab6ff5105 | ||
|
|
0470993b81 | ||
|
|
7de3dff221 | ||
|
|
c17f6facbb | ||
|
|
d0e2a7987b | ||
|
|
c9d3b1655d | ||
|
|
348ad9d3d5 | ||
|
|
f90b87fa5a | ||
|
|
5b19d3397a | ||
|
|
dad0f88865 | ||
|
|
3e862efff2 | ||
|
|
52ca5467f7 | ||
|
|
61657dc670 | ||
|
|
4bac98c015 | ||
|
|
1215d224b4 | ||
|
|
6dde613558 | ||
|
|
99e34b5cd4 | ||
|
|
e049329f41 | ||
|
|
8fe4661fe1 | ||
|
|
af8cfc94a9 | ||
|
|
d98a9a9152 | ||
|
|
749ef7fa45 | ||
|
|
3f2a2fa33a | ||
|
|
2cb48d655a | ||
|
|
573315dd18 | ||
|
|
63091ad815 | ||
|
|
9e88f57bfb | ||
|
|
86d38d6ac9 | ||
|
|
e752d111a0 | ||
|
|
0a09d13bb3 | ||
|
|
08a6d91996 | ||
|
|
1082c47297 | ||
|
|
531812d800 | ||
|
|
903a7232de | ||
|
|
ed1a0c0708 | ||
|
|
15f12220a3 | ||
|
|
c24871c34d | ||
|
|
65e180ccf8 | ||
|
|
4cc523429d | ||
|
|
01b5e5f8a1 | ||
|
|
944458d858 | ||
|
|
9beaa4e440 | ||
|
|
3c78db5fe6 | ||
|
|
9400a4fa08 | ||
|
|
b4519bc6e7 | ||
|
|
f698481b97 | ||
|
|
927641f005 | ||
|
|
d85ad022fb | ||
|
|
e39fcd78ca | ||
|
|
6800ccd4a7 | ||
|
|
3065e57b44 | ||
|
|
fdcf092c7f | ||
|
|
7b9e734ccd | ||
|
|
5718e3261a | ||
|
|
e391ba88e4 | ||
|
|
b7942e763c | ||
|
|
cb039e052c | ||
|
|
07a4350f10 | ||
|
|
44130f6a52 | ||
|
|
6caf9afc1d | ||
|
|
7428581b4c | ||
|
|
a2dc362456 | ||
|
|
8d8e904a5f | ||
|
|
4485006fbb | ||
|
|
6fc3cb9096 | ||
|
|
cdf14896f0 | ||
|
|
bdd73b2873 | ||
|
|
e8781a0abe | ||
|
|
0d26b59777 | ||
|
|
fa0535cf32 | ||
|
|
2353ec321c | ||
|
|
cb4646f67d | ||
|
|
7a500f9cca | ||
|
|
b583b71721 | ||
|
|
c2fa7c4f90 | ||
|
|
2b82b8db82 | ||
|
|
c130004201 | ||
|
|
4829c772cb | ||
|
|
e8bf487d74 | ||
|
|
f5e9a450f9 | ||
|
|
ebb44330fd | ||
|
|
616a102d73 | ||
|
|
a5b741d92b | ||
|
|
e7f5000a56 | ||
|
|
0615f61f0b | ||
|
|
2ae913c743 | ||
|
|
4ec5bfef4f | ||
|
|
33e173448a | ||
|
|
20671c4504 | ||
|
|
16705c5707 | ||
|
|
549309ee8c | ||
|
|
2bb3fac778 | ||
|
|
1e84f3cbc6 | ||
|
|
98a0c9944e | ||
|
|
8016240445 | ||
|
|
4dc5e5c3b6 | ||
|
|
5a4f361d3f | ||
|
|
2542cc87d3 | ||
|
|
b13afd53c1 | ||
|
|
c1f9ba24a7 | ||
|
|
1c20ac60e5 | ||
|
|
98a4d7062b | ||
|
|
b08edc007a | ||
|
|
054c8d0361 | ||
|
|
c78141357e | ||
|
|
5efd5646f2 | ||
|
|
e1c1d7b530 | ||
|
|
f436b03584 | ||
|
|
e34f5f077f | ||
|
|
e1a059b766 | ||
|
|
9cb7158d84 | ||
|
|
35ce6cc68e | ||
|
|
a7832692b7 | ||
|
|
8fd7a30720 | ||
|
|
fdd8f28a29 | ||
|
|
f9d41d49b2 | ||
|
|
456e43b37a | ||
|
|
2cbf12cf1e | ||
|
|
aeac53a5a7 | ||
|
|
2ea402b67c | ||
|
|
ba1b8cafcd | ||
|
|
5984ee15b5 | ||
|
|
a13b5ee7a2 | ||
|
|
56e6a659fe | ||
|
|
56f5611a96 | ||
|
|
a828450846 | ||
|
|
3f8495d0f7 | ||
|
|
bbb2df5f16 | ||
|
|
40eb9b0afc | ||
|
|
545eb0cd69 | ||
|
|
050bfb3055 | ||
|
|
3ce40de5f6 | ||
|
|
095cd2a422 | ||
|
|
5e7cc2b7ad | ||
|
|
38c61ce669 | ||
|
|
9de71167ec | ||
|
|
e8b9c9fbc2 | ||
|
|
60ac9fcd46 | ||
|
|
a0d334c88b | ||
|
|
b90b4964e4 | ||
|
|
a0fbdaa2a0 | ||
|
|
17066cb679 | ||
|
|
9eb1ba82af | ||
|
|
06b12c9599 | ||
|
|
fe277d8bfd | ||
|
|
86cba23568 | ||
|
|
5a6140020f | ||
|
|
cb203edecf | ||
|
|
5510e3bb98 | ||
|
|
470c52e6e3 | ||
|
|
03e4c2165e | ||
|
|
45d617106b | ||
|
|
58869742bc | ||
|
|
a8841ca732 | ||
|
|
96ef82aef0 | ||
|
|
5a33b5b892 | ||
|
|
ed2fb77a7b | ||
|
|
8a1c820e42 | ||
|
|
43c5419453 | ||
|
|
4f2caf67d0 | ||
|
|
8b17e43ce0 | ||
|
|
05db0b189b | ||
|
|
93f91923bb | ||
|
|
6dca3ad152 | ||
|
|
637db5afdb | ||
|
|
029fa00e3a | ||
|
|
e1bb95c482 | ||
|
|
667b1b082d | ||
|
|
2097fc4b86 | ||
|
|
49d20c0bc8 | ||
|
|
fe2ac4f02c | ||
|
|
4859c37ef8 | ||
|
|
c818007426 | ||
|
|
c86f07aeb6 | ||
|
|
0a74e338c2 | ||
|
|
d1dc8b392f | ||
|
|
bd5234b479 | ||
|
|
cca9e3dc58 | ||
|
|
c3df294ce6 | ||
|
|
d81a113240 | ||
|
|
f2feafa45a | ||
|
|
f63a743c2c | ||
|
|
2d9c6482fc | ||
|
|
448a9eeea9 | ||
|
|
c8e32696af | ||
|
|
36eb6eafb3 | ||
|
|
040fafe33a | ||
|
|
040e467761 | ||
|
|
e0d28be260 | ||
|
|
1ef2440bf9 | ||
|
|
2a5d5d3bea | ||
|
|
419153d654 | ||
|
|
ed8c504c27 | ||
|
|
2c29f11a8b | ||
|
|
c442cd1deb | ||
|
|
770e3e866c | ||
|
|
4014046444 | ||
|
|
6f378297dd | ||
|
|
1c5c33be6a | ||
|
|
206665a40b | ||
|
|
159eb54e4e | ||
|
|
f63ab7b693 | ||
|
|
97e5f73774 | ||
|
|
9f85149776 | ||
|
|
d6fa68dead | ||
|
|
5e42fdbfbe | ||
|
|
9b20d1754b | ||
|
|
d310fa3688 | ||
|
|
7ab3e8040c | ||
|
|
5173c24546 | ||
|
|
0c1cccfdcd | ||
|
|
d36cd47597 | ||
|
|
6f34d11138 | ||
|
|
bf3f7bb6ad | ||
|
|
28f74aa50a | ||
|
|
dc3c605315 | ||
|
|
5abc8004c7 | ||
|
|
bf1e971edd | ||
|
|
37c767dc74 | ||
|
|
8257b4f7f6 | ||
|
|
0340f4512e | ||
|
|
c45ce0d090 | ||
|
|
add3dcaa26 | ||
|
|
4a88b10e61 | ||
|
|
7001d0f7fc | ||
|
|
fdf72b14eb | ||
|
|
830de0388a | ||
|
|
4a77c6bdd3 | ||
|
|
579844f193 | ||
|
|
4c6073c02a | ||
|
|
b1eb591e20 | ||
|
|
f5ee776586 | ||
|
|
a2bf7c3dfc | ||
|
|
0543a91c5a | ||
|
|
d88868c4f7 | ||
|
|
86dc52f131 | ||
|
|
f7d88a26ef | ||
|
|
ab1468d03a | ||
|
|
3c65365b83 | ||
|
|
bfefbb59d6 | ||
|
|
9d74b5e428 | ||
|
|
f131ce948c | ||
|
|
1a78a23e7c | ||
|
|
16cdfec4d5 | ||
|
|
243300534c | ||
|
|
ea646b8e6f | ||
|
|
bd5532aa71 | ||
|
|
be033793c2 | ||
|
|
28ce76bc60 | ||
|
|
10732ee978 | ||
|
|
7deccf2e26 | ||
|
|
8873fc8263 | ||
|
|
aaaaf2c670 | ||
|
|
1e8421f83f | ||
|
|
a29a7bf5c3 | ||
|
|
fae67a49ce | ||
|
|
c48a0c1083 | ||
|
|
37e29b8643 | ||
|
|
f683cc66c1 | ||
|
|
2059832df8 | ||
|
|
bda5e61898 | ||
|
|
dcb5f67ba8 | ||
|
|
e6065f85cc | ||
|
|
e0d3d36349 | ||
|
|
ab4d2069eb | ||
|
|
84f8f9073d | ||
|
|
1e9828f594 | ||
|
|
a01050125b | ||
|
|
60957be6fe | ||
|
|
a2b094f7d8 | ||
|
|
56e9705a6e | ||
|
|
ad62da3221 | ||
|
|
c1421d6324 | ||
|
|
068c2b704e | ||
|
|
89d21044d2 | ||
|
|
98246613ca | ||
|
|
ee884ee06a | ||
|
|
355ca2cdf0 | ||
|
|
abc37be619 | ||
|
|
20d9c08630 | ||
|
|
523c9e4ef9 | ||
|
|
76b19f7fb3 | ||
|
|
d776d0d798 | ||
|
|
b63da09fe8 | ||
|
|
d626210804 | ||
|
|
777c198471 | ||
|
|
dbd52a9114 | ||
|
|
3208b865e6 | ||
|
|
a78624eafb | ||
|
|
3249a43f4a | ||
|
|
8e15ba0a3a | ||
|
|
25969f35e0 | ||
|
|
6625bf9830 | ||
|
|
a925dcfd88 | ||
|
|
40357def84 | ||
|
|
b4806abf70 | ||
|
|
f847c033fd | ||
|
|
2919d23fd5 | ||
|
|
78412f4717 | ||
|
|
438504a344 | ||
|
|
d27bc2580f | ||
|
|
665865c5b3 | ||
|
|
d4124c78c2 | ||
|
|
63acc39588 | ||
|
|
46d7a3e95c | ||
|
|
39e5b54af6 | ||
|
|
1a47862d22 | ||
|
|
63c73b8871 | ||
|
|
3bfab3518b | ||
|
|
843d47cfb5 | ||
|
|
f7617eba61 | ||
|
|
1c95d37ce4 | ||
|
|
db65b564a5 | ||
|
|
6f88e126e4 | ||
|
|
25ea0b3a37 | ||
|
|
d3bdcc762f | ||
|
|
d72eb0e2a7 | ||
|
|
7b3a458b25 | ||
|
|
e2b79072d0 | ||
|
|
7845741cec | ||
|
|
6e2497dee7 | ||
|
|
7982c3df80 | ||
|
|
a7701f27f1 | ||
|
|
bbe95bf83a | ||
|
|
4e944df7f2 | ||
|
|
6461aac03d | ||
|
|
1ece7935a2 | ||
|
|
e130261a75 | ||
|
|
c65c241b4d | ||
|
|
9876e8e77b | ||
|
|
674c41fec2 | ||
|
|
6c295ec07f | ||
|
|
332b7b667e | ||
|
|
173bd381a5 | ||
|
|
6154efdd50 | ||
|
|
ee0dcf8019 | ||
|
|
6a4740f729 | ||
|
|
ccf58be365 | ||
|
|
b871278d82 | ||
|
|
90bc2dd3ee | ||
|
|
a85b9dce23 | ||
|
|
a171fad307 | ||
|
|
eba230e5c0 | ||
|
|
ffd1f616d4 | ||
|
|
4dfbf0c71f | ||
|
|
c97616eb8d | ||
|
|
6039bb12b8 | ||
|
|
11bf99faf9 | ||
|
|
cbfde9bedd | ||
|
|
0ab0fa5fb5 | ||
|
|
fd460787c3 | ||
|
|
524d22d37a | ||
|
|
220368d037 | ||
|
|
5d86c5297d | ||
|
|
7d69f1e496 | ||
|
|
e2784c6b17 | ||
|
|
f9ce8f325d | ||
|
|
b059fc644a | ||
|
|
5c7e5d2d59 | ||
|
|
3b4dde335d | ||
|
|
f00ca81c28 | ||
|
|
36ef5e15cf | ||
|
|
9a122fb46d | ||
|
|
17fc78a15f | ||
|
|
0718f0976d | ||
|
|
580e7d3061 | ||
|
|
29af36a9e9 | ||
|
|
56d39722cb | ||
|
|
6a202d4768 | ||
|
|
d399684bfa | ||
|
|
1a0da65c66 | ||
|
|
463b303f2e | ||
|
|
abf0e2bebb | ||
|
|
29670f8c22 | ||
|
|
7b08d6806b | ||
|
|
3211e22963 | ||
|
|
2634639f6b | ||
|
|
0798110743 | ||
|
|
2f90e112b1 | ||
|
|
661ea3ce94 | ||
|
|
8d6e95927c | ||
|
|
c138edccc8 | ||
|
|
e59b171aae | ||
|
|
36cfe6c9c6 | ||
|
|
45a413c3a6 | ||
|
|
a640582278 | ||
|
|
94122a1c80 | ||
|
|
0448278ba1 | ||
|
|
097bff23a2 | ||
|
|
be76d8f4af | ||
|
|
6122805c0d | ||
|
|
392d5cb17a | ||
|
|
ec1352d52b | ||
|
|
c3a4db1ac8 | ||
|
|
442eb35a4f | ||
|
|
d0851a9365 | ||
|
|
5273745be5 | ||
|
|
ca937f6879 | ||
|
|
a4c4fa5556 | ||
|
|
480c303f2f | ||
|
|
347640f346 | ||
|
|
1d8314c0eb | ||
|
|
20d95baea9 | ||
|
|
510f400c1b | ||
|
|
c49d0b3ede | ||
|
|
ff197cb6b6 | ||
|
|
9e4605258b | ||
|
|
c54e8bc8bd | ||
|
|
fe937b8f8d | ||
|
|
d262b3689a | ||
|
|
aac5226fce | ||
|
|
1d1b9722ac | ||
|
|
94193501ba | ||
|
|
2b142316dc | ||
|
|
a06124e49c | ||
|
|
c1bd04f117 | ||
|
|
4272d15a8b | ||
|
|
0537dad68e | ||
|
|
c1f09a6bd9 | ||
|
|
69ea7c71b3 | ||
|
|
3052f28b2c | ||
|
|
892d23e0d0 | ||
|
|
b217edeadf | ||
|
|
aa4ad384c1 | ||
|
|
8021024b48 | ||
|
|
d3f246d048 | ||
|
|
9c2dfcab06 | ||
|
|
8b4224a034 | ||
|
|
61bf0007c1 | ||
|
|
151559c50e | ||
|
|
2dccf6e790 | ||
|
|
bc510b1ba0 | ||
|
|
0253d86b8d | ||
|
|
59cd31a6c8 | ||
|
|
068b24bd39 | ||
|
|
7f06797f5f | ||
|
|
3e2bdf4772 | ||
|
|
3b049299b1 | ||
|
|
05670bebeb | ||
|
|
81f73590a6 | ||
|
|
163e4cdadb | ||
|
|
512c02e501 | ||
|
|
25ef8ba315 | ||
|
|
8966feb35a | ||
|
|
0d29be48c7 | ||
|
|
bc2827659d | ||
|
|
0a72247a5d | ||
|
|
a102ec3566 | ||
|
|
f91b02d572 | ||
|
|
0f00741151 | ||
|
|
922302082f | ||
|
|
24e1fbb6e5 | ||
|
|
3026a2d48f | ||
|
|
58101bfea0 | ||
|
|
0a9e46ee85 | ||
|
|
fd67e45c58 | ||
|
|
b6af6de2df | ||
|
|
173051829e | ||
|
|
8a9ef4811f | ||
|
|
4fd6d580b1 | ||
|
|
415970101c | ||
|
|
668dcdd8b4 | ||
|
|
bf24533b54 | ||
|
|
b2daada576 | ||
|
|
9dd2c58134 | ||
|
|
7674c68bc7 | ||
|
|
0b3b0b29f5 | ||
|
|
60370a1a83 | ||
|
|
3bf273e854 | ||
|
|
a8e53c9b62 | ||
|
|
3015cd9604 | ||
|
|
839119e0a9 | ||
|
|
409a0665cc | ||
|
|
0549fe9c21 | ||
|
|
f047bb6176 | ||
|
|
ad04b7e966 | ||
|
|
2591cbf029 | ||
|
|
8213e07c74 | ||
|
|
972f9581e3 | ||
|
|
2e17b3defd | ||
|
|
76dbfb8fdf | ||
|
|
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 | ||
|
|
1c3dbcc8d6 | ||
|
|
1d4f34ec84 | ||
|
|
2ef4194a51 | ||
|
|
98f60f1350 | ||
|
|
02f98c739f | ||
|
|
766fa58157 | ||
|
|
ebf0c2fb4f | ||
|
|
bc3cfc7986 | ||
|
|
e516f5ee87 | ||
|
|
7abe7c6224 | ||
|
|
e46a9c7476 | ||
|
|
891f4a9d24 | ||
|
|
df6d771e4d | ||
|
|
0f861c4ab7 | ||
|
|
510d4d1895 | ||
|
|
cd4af0ff5d | ||
|
|
77f508682e | ||
|
|
3a41a94f47 | ||
|
|
cba19065a4 | ||
|
|
19a652a1fa | ||
|
|
c8f8077159 | ||
|
|
60db0e87f4 | ||
|
|
f581ce26fb | ||
|
|
0cc06a0b1f | ||
|
|
27dfa7e481 | ||
|
|
0659fd8b84 | ||
|
|
8512eef6c0 | ||
|
|
e860195847 | ||
|
|
3c34798d1a | ||
|
|
1275a10de5 | ||
|
|
99c2e9aa1f | ||
|
|
d3b0787f90 | ||
|
|
faad7d3b85 | ||
|
|
099596fdde | ||
|
|
ab202ffe1c | ||
|
|
b935d7f578 | ||
|
|
d505d197ba | ||
|
|
12c9aab745 | ||
|
|
3c10cb2340 | ||
|
|
f57cc3bc06 | ||
|
|
eb4afec6db | ||
|
|
35b4df196d | ||
|
|
038e8fb98a | ||
|
|
b84a14f849 | ||
|
|
eeda3875e4 | ||
|
|
a584a78734 | ||
|
|
e408c07f85 | ||
|
|
4700684f03 | ||
|
|
8ef7631eed | ||
|
|
825d736a58 | ||
|
|
b3f5aac192 | ||
|
|
e06b21d69c | ||
|
|
9dc3a99885 | ||
|
|
18145b8340 | ||
|
|
f25bbf3437 | ||
|
|
2d53ae7452 | ||
|
|
0f67c0db36 | ||
|
|
436dc01edd | ||
|
|
a1bee2fa05 | ||
|
|
78ab2de0e9 | ||
|
|
76823d74f1 | ||
|
|
db51306ef9 | ||
|
|
b95f2beaf5 | ||
|
|
7be07b0102 | ||
|
|
6eeee7ca02 | ||
|
|
7bbddc9a8a | ||
|
|
ac994ac864 | ||
|
|
1aca211e71 | ||
|
|
c7d0b09706 | ||
|
|
5999b778b3 | ||
|
|
04d21ccb4e | ||
|
|
3ba63bfaec | ||
|
|
eeb7d3da1d | ||
|
|
cfaae26c16 | ||
|
|
5806e6adad | ||
|
|
6718b49e49 | ||
|
|
403fe20f68 | ||
|
|
2dd6ef4da5 | ||
|
|
42fd72723d | ||
|
|
8ea599d739 | ||
|
|
104baa80eb | ||
|
|
9c700268a6 | ||
|
|
e158f43c11 | ||
|
|
617f8a9a7d | ||
|
|
63edc5bf4f | ||
|
|
492dca7a22 | ||
|
|
69a6485317 | ||
|
|
1b75dfb886 | ||
|
|
652deabf83 | ||
|
|
1c4b0c687b | ||
|
|
80455d68e2 | ||
|
|
0d8dd6eb60 | ||
|
|
7cfd3e5a94 | ||
|
|
46d9b07db3 | ||
|
|
ac4f5a4b02 | ||
|
|
5bfa59508a | ||
|
|
9d53af3059 | ||
|
|
82c32c6ed1 | ||
|
|
af5b4231c2 | ||
|
|
00c1830ced | ||
|
|
335888d0ad | ||
|
|
397f71020c | ||
|
|
31ea9f8413 | ||
|
|
bfcbcb8802 | ||
|
|
30bf07edc7 | ||
|
|
be3de852ce | ||
|
|
d9f3c4a465 | ||
|
|
b3c3a30ea4 | ||
|
|
f785b1256d | ||
|
|
5b4d93197c | ||
|
|
d1d159ba90 | ||
|
|
8501c351dd | ||
|
|
a61d8bbd04 | ||
|
|
ccd39ebc89 | ||
|
|
da04ddad7d | ||
|
|
498210d709 | ||
|
|
c128bec2af | ||
|
|
84ce9275f0 | ||
|
|
66bdd9b5c7 | ||
|
|
b02ab916cd | ||
|
|
a2068da36b | ||
|
|
83c43331a9 | ||
|
|
afe68ef229 | ||
|
|
7eec56ee2a | ||
|
|
2ed462b61c | ||
|
|
dd142d20fe | ||
|
|
8a340dc292 | ||
|
|
e77201613e | ||
|
|
710ad17f47 | ||
|
|
a617625b87 | ||
|
|
e8a5319544 | ||
|
|
86e737892a | ||
|
|
3fd7a40421 | ||
|
|
a70e5aa54c | ||
|
|
593aae1e67 | ||
|
|
e88849854b | ||
|
|
738fd5645e | ||
|
|
22ac364f8a | ||
|
|
5d78d3a734 | ||
|
|
e83b12a248 | ||
|
|
0f50998519 | ||
|
|
1768d4490f | ||
|
|
2a3635b805 | ||
|
|
a5be973fd4 | ||
|
|
c8a76f38f9 | ||
|
|
273edaf101 | ||
|
|
d1a90676fc | ||
|
|
ff6119050d | ||
|
|
0a0b95097d | ||
|
|
ace42a5a1f | ||
|
|
1a23648b91 | ||
|
|
65b5a46525 | ||
|
|
462d99c0e5 | ||
|
|
04636dd5af | ||
|
|
d5b5b6cec0 | ||
|
|
921fdac8bb | ||
|
|
6b9bc60785 | ||
|
|
ff01c73193 | ||
|
|
a6cb4c3a8c | ||
|
|
43d33277ba | ||
|
|
9badb50075 | ||
|
|
ad6a09ba85 | ||
|
|
1791ec5e46 | ||
|
|
46457a9e61 | ||
|
|
38ab221fd8 | ||
|
|
fc2317655e | ||
|
|
fb183b9f1f | ||
|
|
64057723b6 | ||
|
|
703662c0c0 | ||
|
|
ac72b47362 | ||
|
|
6ca0e26e9c | ||
|
|
168f2fbce2 | ||
|
|
a45370011e | ||
|
|
f85c97f50a | ||
|
|
1651f8b626 | ||
|
|
ad08e4cfcf | ||
|
|
91ec3456f5 | ||
|
|
4c4f0ef6ae | ||
|
|
17a899407d | ||
|
|
1a194c684d | ||
|
|
93e06e431d | ||
|
|
8fede65b79 | ||
|
|
601d23d5cc | ||
|
|
536bacb96a | ||
|
|
07b4c36490 | ||
|
|
39a86b824e | ||
|
|
204c17affc | ||
|
|
ff92dccf47 | ||
|
|
ec69a4db70 | ||
|
|
c9e0880ce9 | ||
|
|
8b03792a52 | ||
|
|
42d9f413f5 | ||
|
|
fdb8a86def | ||
|
|
b54cda1834 | ||
|
|
824a740c96 | ||
|
|
63ed67b137 | ||
|
|
6fd008e1a8 | ||
|
|
13afac8da2 | ||
|
|
31565f20fb | ||
|
|
d4abcec817 | ||
|
|
6675f12205 | ||
|
|
66d2903ff5 | ||
|
|
fffeea6435 | ||
|
|
b9ae8b8c6f | ||
|
|
974029523e | ||
|
|
70abbcc119 | ||
|
|
927be61e93 | ||
|
|
8a3341e7b9 | ||
|
|
e3ace6cf12 | ||
|
|
b84f230179 | ||
|
|
e2fd7347b4 | ||
|
|
223ba96a95 | ||
|
|
766efe0cda | ||
|
|
ab792de3c7 | ||
|
|
7807ef6d88 | ||
|
|
ba7407cca6 | ||
|
|
b83249187e | ||
|
|
2b22e7ea6f | ||
|
|
86b18f3bea | ||
|
|
f3c844b2f8 | ||
|
|
53568b6c6f | ||
|
|
35b034b9e7 | ||
|
|
45367d59d2 | ||
|
|
1ded5a4369 | ||
|
|
940f9a5662 | ||
|
|
319d4ead82 | ||
|
|
cd87ccf6ff | ||
|
|
9604c6c156 | ||
|
|
5b47d1b198 | ||
|
|
97d265045c | ||
|
|
ce508c4009 | ||
|
|
8094e8acec | ||
|
|
2d2cfe8ccf | ||
|
|
cb6d17c6e3 | ||
|
|
1811e18420 | ||
|
|
964aeef138 | ||
|
|
524d001c28 | ||
|
|
976a8f4f62 | ||
|
|
b30ea9c7d3 | ||
|
|
ae60182cd7 | ||
|
|
b28cfac096 | ||
|
|
4b93353022 | ||
|
|
7715b3d66d | ||
|
|
5fbecec78b | ||
|
|
64f15a1bf2 | ||
|
|
9ab08c22be | ||
|
|
f29e4d99ba | ||
|
|
fdb53d550e | ||
|
|
c2ac312522 | ||
|
|
c87b5e5728 | ||
|
|
1eeea835aa | ||
|
|
cf6a6200ca | ||
|
|
885ec12d88 | ||
|
|
c23911b14a | ||
|
|
da9a5b88aa | ||
|
|
d96490e60b | ||
|
|
2198c5d4a0 | ||
|
|
776179e41d | ||
|
|
7bda38ff48 | ||
|
|
a23ead4d9c | ||
|
|
0f820738c6 | ||
|
|
30d912114d | ||
|
|
567288309c | ||
|
|
7cd67f55f1 | ||
|
|
59e7dcd8e8 | ||
|
|
90e55a0a7d | ||
|
|
a280d91c05 | ||
|
|
feb54aeb9e | ||
|
|
ee96bf500e | ||
|
|
91a266889f | ||
|
|
6051138613 | ||
|
|
d9780f9954 | ||
|
|
453287dc1c | ||
|
|
8f119862d0 | ||
|
|
df1fc4a734 | ||
|
|
a545462410 | ||
|
|
bb7cc4d6e7 | ||
|
|
eb69cf41a5 | ||
|
|
642164b1b4 | ||
|
|
ff99a462d7 | ||
|
|
e7de87e8aa | ||
|
|
e5d91037cb | ||
|
|
e7db5b8aa2 | ||
|
|
551c962cd2 | ||
|
|
5ada4e05a2 | ||
|
|
1f3243e362 | ||
|
|
303b944128 | ||
|
|
989e8fd7a2 | ||
|
|
9a21e37516 | ||
|
|
29a27477b6 | ||
|
|
0ebc5a4c6e | ||
|
|
1c6131589f | ||
|
|
a183335df7 | ||
|
|
c0447ab6e0 | ||
|
|
0c9c2dacfa | ||
|
|
48dbd26d24 | ||
|
|
65de370539 | ||
|
|
1ffb050939 | ||
|
|
0f15c69831 | ||
|
|
5d99ea6154 | ||
|
|
7224cb76de | ||
|
|
1ac9df057d | ||
|
|
033941388c | ||
|
|
fc979bc6bf | ||
|
|
f1860f2934 | ||
|
|
ab8696a3a4 | ||
|
|
09cd00a563 | ||
|
|
f2ca7c3240 | ||
|
|
6928c15147 | ||
|
|
9e278de881 | ||
|
|
af9e207012 | ||
|
|
c667a6ba56 | ||
|
|
37c6888962 | ||
|
|
5729968630 | ||
|
|
5fb377da21 | ||
|
|
92f0c284cd | ||
|
|
7c8be94d88 | ||
|
|
19690712ba | ||
|
|
7c32a0c883 | ||
|
|
df87848caa | ||
|
|
534253fbfc | ||
|
|
afbbbcfd45 | ||
|
|
f5ea7e8490 | ||
|
|
c0b1c82ec4 | ||
|
|
99eb028a62 | ||
|
|
ce3a40a155 | ||
|
|
da5e71a614 | ||
|
|
c2e509e4c7 | ||
|
|
a068c0b1db | ||
|
|
b1fa69ed26 | ||
|
|
d91f485f1e | ||
|
|
0252dd3535 | ||
|
|
21cf18f34e | ||
|
|
892cae605b | ||
|
|
c97fd708e0 | ||
|
|
12dd52af3d | ||
|
|
3a3d784d6d | ||
|
|
86c98ccae1 | ||
|
|
e004121081 | ||
|
|
27c3bf71ec | ||
|
|
c5da78712f | ||
|
|
7cd12844fd | ||
|
|
f04d03fa90 | ||
|
|
10af3797d1 | ||
|
|
5dd9de8310 | ||
|
|
75c7b6b703 | ||
|
|
70ef27deb8 | ||
|
|
007f2e7b73 | ||
|
|
f7cafaefdc | ||
|
|
cb6e27e700 | ||
|
|
fd5ba1f98e | ||
|
|
e63fd4d79c | ||
|
|
be2a7e2ee3 | ||
|
|
85a8a29e69 | ||
|
|
b07fe783dd | ||
|
|
75e4f45e9f | ||
|
|
826d353bfd | ||
|
|
2891607947 | ||
|
|
b7a4955766 | ||
|
|
d1f7c78bbe | ||
|
|
289980aa41 | ||
|
|
217d1b60a3 | ||
|
|
fce1b38a24 | ||
|
|
6538465add | ||
|
|
a70b9e46a8 | ||
|
|
22d7c75261 | ||
|
|
1cdf7a1033 | ||
|
|
27afaf8e1b | ||
|
|
019699ae75 | ||
|
|
745df69024 | ||
|
|
6e84130261 | ||
|
|
124485b4f0 | ||
|
|
f6f9028680 | ||
|
|
7fab7c5ca8 | ||
|
|
355bcfa4d1 | ||
|
|
87715a1e93 | ||
|
|
cf5faca040 | ||
|
|
099ceb3bca | ||
|
|
56dd38b6e0 | ||
|
|
ad752e024a | ||
|
|
fc6f1052d6 | ||
|
|
f663b06626 | ||
|
|
7a38a4d7f8 | ||
|
|
28b8c04f95 | ||
|
|
85bc09c3da | ||
|
|
b817ea25e6 | ||
|
|
25ba2f597e | ||
|
|
321b3fbf3a | ||
|
|
df6a4e4a35 | ||
|
|
7c0031b265 | ||
|
|
e99ec75a0f | ||
|
|
15f851e825 | ||
|
|
0579e7a2fd | ||
|
|
1c0b7dc0b1 | ||
|
|
40d002fbfa | ||
|
|
e665eb668f | ||
|
|
05239717a5 | ||
|
|
b91f9bedfa | ||
|
|
12261ece0e | ||
|
|
bef017c12d | ||
|
|
a6544a399f | ||
|
|
60b61ae49d | ||
|
|
93ccd5f392 | ||
|
|
8169ed413c | ||
|
|
1a42dfadc0 | ||
|
|
c5a5573652 | ||
|
|
f7c3093478 | ||
|
|
6000e1fab9 | ||
|
|
2ac42539aa | ||
|
|
6d25b02975 | ||
|
|
f3582627fb | ||
|
|
9e98c2db78 | ||
|
|
d387b632dd | ||
|
|
69d4a49462 | ||
|
|
5f648983c8 | ||
|
|
d98bfd45fc | ||
|
|
a38931ca23 | ||
|
|
508fcb2f29 | ||
|
|
d280e4b131 | ||
|
|
48c014227d | ||
|
|
21c4be4148 | ||
|
|
d44290dcdc | ||
|
|
702c739ec8 | ||
|
|
c1122bd939 | ||
|
|
bdaa896fc1 | ||
|
|
3b1c051fd2 | ||
|
|
11194f819e | ||
|
|
662eb16fdd | ||
|
|
d65070973c | ||
|
|
cef41348cc | ||
|
|
bcba694308 | ||
|
|
fbd7c6d3fc | ||
|
|
f842c08d62 | ||
|
|
4e58a6915f | ||
|
|
4336644fbc | ||
|
|
e32909ac58 | ||
|
|
bd16e2ccaf | ||
|
|
36fa55139e | ||
|
|
b128280d5f | ||
|
|
51e3f05031 | ||
|
|
19b83070c6 | ||
|
|
5622956e75 | ||
|
|
1ac3ea4916 | ||
|
|
391cc0edf1 | ||
|
|
a59a98f8cb | ||
|
|
e62213bfd5 | ||
|
|
61b77c4754 | ||
|
|
758aaa3dd7 | ||
|
|
51389a27fb | ||
|
|
37b94cc36c | ||
|
|
1e4796d418 | ||
|
|
62b0d6012d | ||
|
|
52726c8bb3 | ||
|
|
ede06e0923 | ||
|
|
6eb2c95cc0 | ||
|
|
835dff8620 | ||
|
|
1019b0b83b | ||
|
|
a44070b505 | ||
|
|
58bd4e2d9d | ||
|
|
cff346e6a4 | ||
|
|
0331e34e91 | ||
|
|
26ff8d8588 | ||
|
|
9a38826cf7 | ||
|
|
b854631990 | ||
|
|
5d1cd97ebd | ||
|
|
c21feb74d1 | ||
|
|
052e2f2541 | ||
|
|
1270b57afa | ||
|
|
cf8b219b9d | ||
|
|
689133aab8 | ||
|
|
019c0f01eb | ||
|
|
743cac217b | ||
|
|
5f19cb1ec8 | ||
|
|
ac5ffa0f7c | ||
|
|
114e07eb01 | ||
|
|
8ba1d75ab3 | ||
|
|
b3555918ed | ||
|
|
0759c05ed1 | ||
|
|
278a8f70f2 | ||
|
|
fb5dc9923f | ||
|
|
f942505e62 | ||
|
|
2d2b2db0a7 | ||
|
|
18d5078842 | ||
|
|
074b2c51e2 | ||
|
|
539194720a | ||
|
|
19fc5865fa | ||
|
|
f0d58e0c6a | ||
|
|
ddc2bea418 | ||
|
|
24da6893ac | ||
|
|
7268017dc1 | ||
|
|
4133480750 | ||
|
|
006a265c7a | ||
|
|
6850ef8a7d | ||
|
|
497f556ba6 | ||
|
|
d62da744cd | ||
|
|
864482e393 | ||
|
|
e41c25ed5d | ||
|
|
3e429b83a8 | ||
|
|
cd1af401ba | ||
|
|
26e04bd890 | ||
|
|
b6d70fac9c | ||
|
|
9e572c786c | ||
|
|
4e44ce3ab8 | ||
|
|
74c7fcb4da | ||
|
|
ef64d52ad1 | ||
|
|
ab7bbec563 | ||
|
|
6afe4ab9d6 | ||
|
|
12f43e3691 | ||
|
|
1e7cf2a1ba | ||
|
|
90636250cb | ||
|
|
838451f956 | ||
|
|
cc85d999e1 | ||
|
|
0013013cd2 | ||
|
|
bfd04cf8a2 | ||
|
|
beb1b70f50 | ||
|
|
f52edad583 | ||
|
|
0a1283de4b | ||
|
|
bed263aa87 | ||
|
|
55d8d20f88 | ||
|
|
3a59e2cdc2 | ||
|
|
57fb754bc0 | ||
|
|
052b48348b | ||
|
|
5d15747c4e | ||
|
|
ce09359445 | ||
|
|
c22792bd9b | ||
|
|
4ab36c355e | ||
|
|
0b3829c1b4 | ||
|
|
ae4883f099 | ||
|
|
2e3cf25e57 | ||
|
|
e65b831f35 | ||
|
|
b6dc426eed | ||
|
|
a4f7619ca3 | ||
|
|
4e38dd0f1a | ||
|
|
2264db76cc | ||
|
|
28082abde5 | ||
|
|
4814cfae86 | ||
|
|
3aa7820239 | ||
|
|
c4a7232bca | ||
|
|
ee390ac0b1 | ||
|
|
187ee01d82 | ||
|
|
64f3d89abb | ||
|
|
bc33cef53f | ||
|
|
199936262a | ||
|
|
3b6eb22c16 | ||
|
|
0dc2ada7bc | ||
|
|
f591756697 | ||
|
|
86175dc284 | ||
|
|
d69970acdd | ||
|
|
8242c4a977 | ||
|
|
f319bce854 | ||
|
|
8bd1bfc3e0 | ||
|
|
cec3232b51 | ||
|
|
7dcd892106 | ||
|
|
78ca13fcb7 | ||
|
|
48d37045d2 | ||
|
|
92e4ec5ddb | ||
|
|
6d760e2c5b | ||
|
|
ee4eb6d86c | ||
|
|
44cea60852 | ||
|
|
4f68c6677e | ||
|
|
018aa632c9 | ||
|
|
ac1f19817f | ||
|
|
365ece55b1 | ||
|
|
8bbbfc6c7c | ||
|
|
5fb3c34745 | ||
|
|
8f32a7fed8 | ||
|
|
6a9a48fa81 | ||
|
|
2cd3ddf7e0 | ||
|
|
c110a53494 | ||
|
|
944ef03f80 | ||
|
|
654ee73945 | ||
|
|
b113a068fd | ||
|
|
216f9e878f | ||
|
|
3c1404c429 | ||
|
|
80d7251540 | ||
|
|
5d4fa15a0b | ||
|
|
02258478bb | ||
|
|
c4274e30ff | ||
|
|
aade5c2a80 | ||
|
|
a09113f2c6 | ||
|
|
d5cd6cd16a | ||
|
|
fc7ad2a3ff | ||
|
|
1539d4199c | ||
|
|
bf4fc1cb56 | ||
|
|
9bc2ec59e5 | ||
|
|
32baf04a75 | ||
|
|
a62da35686 | ||
|
|
7a9f409b59 | ||
|
|
12c103e354 | ||
|
|
cd62cbf576 | ||
|
|
e550d93ca5 | ||
|
|
25effd4805 | ||
|
|
bb6066d867 | ||
|
|
c44f40afd0 | ||
|
|
fa677ace84 | ||
|
|
37e312a6d9 | ||
|
|
1358e32470 | ||
|
|
e08eddb0c0 | ||
|
|
f7ac8b5fa4 | ||
|
|
7d192be572 | ||
|
|
7984dec523 | ||
|
|
bb420bc709 | ||
|
|
78b9a336d9 | ||
|
|
667a4ea749 | ||
|
|
4ede4ff88b | ||
|
|
e26043958a | ||
|
|
d3a6c267c6 | ||
|
|
0d92dfa563 | ||
|
|
6e9916fcbd | ||
|
|
e81c3e27bc | ||
|
|
f4613cdce4 | ||
|
|
799340ce06 | ||
|
|
ea1a033f2e | ||
|
|
dabdd8ae8f | ||
|
|
3e2b7eede9 | ||
|
|
f941deed79 | ||
|
|
f601b4a134 | ||
|
|
26630725bd | ||
|
|
7faa90ce43 | ||
|
|
4c99b6b06e | ||
|
|
2f2d8278a4 | ||
|
|
e8be2974f9 | ||
|
|
4930feff94 | ||
|
|
132d871039 | ||
|
|
aea6954dbb | ||
|
|
1ee8819e4c | ||
|
|
41e3b7fbf6 | ||
|
|
4218d240bc | ||
|
|
683d6fcc42 | ||
|
|
c9f6ab2fa6 | ||
|
|
c99d3baa3c | ||
|
|
d0ade2feff | ||
|
|
dcebe5a701 | ||
|
|
d33791fb28 | ||
|
|
8512b3ab4f | ||
|
|
4395d8cc89 | ||
|
|
55f4e6872c | ||
|
|
6699a9204c | ||
|
|
14e1a975c9 | ||
|
|
7ab3c4bcf9 | ||
|
|
1866196571 | ||
|
|
301c21ed20 | ||
|
|
2d5208a568 | ||
|
|
44a543e64c | ||
|
|
458c66819a | ||
|
|
dcf4f3f15d | ||
|
|
e33ef5420a | ||
|
|
8d1c3a05ce | ||
|
|
9a167a46d8 | ||
|
|
ffe60808b6 | ||
|
|
1affd6c2fa | ||
|
|
17225dca5b | ||
|
|
fc9f55ead8 | ||
|
|
eec877623e | ||
|
|
a06b0573c5 | ||
|
|
dfcfee302f | ||
|
|
cb1cc27c60 | ||
|
|
aed30a94c0 | ||
|
|
8e172e2647 | ||
|
|
ca355e1a01 | ||
|
|
b0e18d5224 | ||
|
|
f5fc80ef14 | ||
|
|
21f846f0bc | ||
|
|
a6a742b91e | ||
|
|
4ca6510910 | ||
|
|
e06ea06884 | ||
|
|
2c79dff678 | ||
|
|
56c4a094cf | ||
|
|
1898af9fea | ||
|
|
885d2bc019 | ||
|
|
12c604d09c | ||
|
|
7b48699b39 | ||
|
|
3b5593882f |
No files matched your search
@@ -0,0 +1 @@
|
||||
.gitea/CODEOWNERS linguist-detectable=false
|
||||
@@ -0,0 +1,3 @@
|
||||
# Pull requests request review from the eligible staff team(s).
|
||||
# One approval from either an Admin or Developer satisfies branch protection.
|
||||
* @trueog/Admins @trueog/Developers
|
||||
@@ -0,0 +1,5 @@
|
||||
.gradle/
|
||||
.classpath
|
||||
.project
|
||||
.settings/
|
||||
build/
|
||||
File renamed without changes.
@@ -2,26 +2,21 @@
|
||||
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/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.Ben12345rocks</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 +0,0 @@
|
||||
/bin/
|
||||
/target/
|
||||
/doc/
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>VotingPlugin</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -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,123 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
|
||||
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
|
||||
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
|
||||
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
|
||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||
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.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deadCode=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
|
||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
||||
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.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
|
||||
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.missingOverrideAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
||||
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=info
|
||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
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=
|
||||
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,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.jboss.ide.eclipse.as.core.singledeployable.deployableList=\n
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,907 +0,0 @@
|
||||
# VotingPlugin by Ben12345rocks
|
||||
# Main Config
|
||||
# See wiki for help:
|
||||
# https://github.com/Ben12345rocks/VotingPlugin/wiki
|
||||
|
||||
# Valid Options:
|
||||
# - SQLITE
|
||||
# - FLAT
|
||||
# - MYSQL
|
||||
DataStorage: SQLITE
|
||||
|
||||
# Information for mysql
|
||||
# See the end of the config for cache options
|
||||
MySQL:
|
||||
Host: ''
|
||||
# Default port is 3306
|
||||
Port: 3306
|
||||
Database: ''
|
||||
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
|
||||
Prefix: ''
|
||||
#UseSSL: true
|
||||
|
||||
# Let players who never joined before vote
|
||||
# Recommend: False (Will prevent creating random user data)
|
||||
AllowUnjoined: false
|
||||
|
||||
# ------------------------------------------------
|
||||
# VoteReminding
|
||||
# ------------------------------------------------
|
||||
|
||||
# Configuration for VoteReminding
|
||||
# By default this should be all setup to work
|
||||
# as long as vote delays are done properly
|
||||
VoteReminding:
|
||||
# Enable vote reminding
|
||||
# This will remind player when he can vote on all sites
|
||||
# Requires VoteDelay's to be setup properly
|
||||
# Use /vote next to see when you can be reminded
|
||||
# Players require the perm "VotingPlugin.Login.RemindVotes" or "VotingPlugin.Player"
|
||||
Enabled: true
|
||||
|
||||
# Wether or t 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
|
||||
RemindDelay: 30
|
||||
|
||||
# Run reward files on remind
|
||||
# By default, the reward file will be created for you
|
||||
# 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
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aRemember to vote!'
|
||||
Title:
|
||||
Enabled: false
|
||||
Title: '&cRemember to vote!'
|
||||
SubTitle: '&aType /vote'
|
||||
FadeIn: 10
|
||||
ShowTime: 50
|
||||
FadeOut: 10
|
||||
ActionBar:
|
||||
Message: '&cRemember to vote'
|
||||
Delay: 30
|
||||
|
||||
# ------------------------------------------------
|
||||
# Format
|
||||
# ------------------------------------------------
|
||||
|
||||
# Common PlacesHolders:
|
||||
# Please Note: Not all are usable in all sections
|
||||
# Special PlaceHolders will be commented where available
|
||||
# %player% = player name
|
||||
# %SiteName% = vote site name
|
||||
#
|
||||
# Set Message to '' (2 ') to disable message
|
||||
|
||||
Commands:
|
||||
# Wether or not the following commands will open GUIs rather than display text
|
||||
UseGUI:
|
||||
Today: true
|
||||
TopVoter: true
|
||||
Last: true
|
||||
Next: true
|
||||
Total: true
|
||||
Vote: true
|
||||
Best: true
|
||||
Streak: true
|
||||
# If true, you can right click a votesite from /vote (gui version) and open the vote reward gui for that site
|
||||
# Can be used to display rewards for that site
|
||||
VoteRewardFromVoteURL: false
|
||||
# disable /vote reward commands
|
||||
# Effective after restart
|
||||
DisableVoteRewardGUIs: false
|
||||
|
||||
Format:
|
||||
# CommandHandler help message
|
||||
HelpLine: '&3&l%Command% - &3%HelpMessage%'
|
||||
|
||||
# Broadcast vote message
|
||||
# Set to an empty message to disable
|
||||
BroadcastMsg: '&6[&4Broadcast&6] &2Thanks &c%player% &2for voting on %SiteName%'
|
||||
|
||||
# Broadcast only when player is online
|
||||
BroadcastWhenOnline: false
|
||||
|
||||
Commands:
|
||||
# Format for /vote
|
||||
# %num% = the number of the site, for a numbered list
|
||||
# %url% = site URL
|
||||
Vote:
|
||||
Text:
|
||||
- '&4&lVote for our server!'
|
||||
|
||||
# If you want to want to use the feature below where the plugin will
|
||||
# automaticly list the sites then set the message in the text above
|
||||
AutoInputSites: true
|
||||
# For each VoteSite
|
||||
# make sure to set VoteURL in your VoteSites
|
||||
# Requires above to be true
|
||||
# Text will be sent before this
|
||||
Sites: '&4%num%: &c&l%SiteName% - &c%url%'
|
||||
|
||||
# Format for /vote next
|
||||
Next:
|
||||
# First line
|
||||
Title: '&3&l%player% Next Votes:'
|
||||
|
||||
# How each line is setup for each vote site
|
||||
# %info% = Info - See Below
|
||||
# %SiteName% = site name from vote
|
||||
Layout: '&3%SiteName%: &6%info%'
|
||||
|
||||
Info:
|
||||
# Message when player can vote
|
||||
CanVote: 'Go Vote!'
|
||||
# Time until vote msg
|
||||
# %hours% = hours until next vote
|
||||
# %minutes% = minutes until next vote
|
||||
TimeUntilVote: '%hours% Hours and %minutes% Minutes'
|
||||
# If there is an error finding out time until next vote
|
||||
Error: '&cCould not caculate time until next vote!'
|
||||
# For sites that have this, requires votedelaydaily to be set to true in the site
|
||||
VoteDelayDaily: '%hours% Hours and %minutes% Minutes'
|
||||
|
||||
# Format for /vote last
|
||||
Last:
|
||||
# First line
|
||||
Title: '&3&l%player% Last Vote Times:'
|
||||
# Lines for each vote site
|
||||
# %time% = time, using timeformat below
|
||||
# %timesince% = time since vote
|
||||
Line: '&3%SiteName%: &6%timeSince%'
|
||||
# Spelling of TimeType can be changed under Format.Commands.TimeFormats
|
||||
TimeFormat: '%amount% %TimeType%'
|
||||
LastVoted: '%times% ago'
|
||||
NeverVoted: 'Never voted'
|
||||
|
||||
# Format for /vote total
|
||||
Total:
|
||||
- '&3&l%player% Total Votes:'
|
||||
- '&3&lDaily Total: &6&l%DailyTotal%'
|
||||
- '&3&lWeekly Total: &6&l%WeeklyTotal%'
|
||||
- '&3&lMonthly Total: &6&l%MonthlyTotal%'
|
||||
- '&3&lAllTime Total: &6&l%AllTimeTotal%'
|
||||
|
||||
# Format for /vote total all
|
||||
TotalAll:
|
||||
- '&3&lServer Total Votes:'
|
||||
- '&3&lDaily Total: &6&l%DailyTotal%'
|
||||
- '&3&lWeekly Total: &6&l%WeeklyTotal%'
|
||||
- '&3&lMonthly Total: &6&l%MonthlyTotal%'
|
||||
- '&3&lAllTime Total: &6&l%AllTimeTotal%'
|
||||
|
||||
# Format for /vote top
|
||||
Top:
|
||||
# First line
|
||||
# %page% = current page
|
||||
# %maxpages% = max number of pages
|
||||
# %Top% = Monthly/Weekly/Daily (depending on command)
|
||||
Title: '&3Top %Top% Voters %page%/%maxpages%'
|
||||
# Line for each player in that page
|
||||
Line: '&c%num%: &6%player%, %votes%'
|
||||
|
||||
# Format for /vote help
|
||||
Help:
|
||||
# Title of /vote help
|
||||
Title: '&3&lVoting Player Help'
|
||||
# Format for help message in /v help
|
||||
Line: '&3&l%Command% - &3%HelpMessage%'
|
||||
# Require permission to see command in /v help or /av help
|
||||
RequirePermission: true
|
||||
|
||||
Best:
|
||||
Title: '&3&l%player% Best Votes'
|
||||
Lines:
|
||||
- '&3Highest Daily Total: &3&l%HighestDailyTotal%'
|
||||
- '&3Highest Week Total: &3&l%HighestWeeklyTotal%'
|
||||
- '&3Highest Month Total: &3&l%HighestMonthlyTotal%'
|
||||
|
||||
Streak:
|
||||
Title: '&3&l%player% Vote Streak'
|
||||
Lines:
|
||||
- '&3Current Daily Streak: &3&l%DailyStreak%'
|
||||
- '&3Current Week Streak: &3&l%WeeklyStreak%'
|
||||
- '&3Current Month Streak: &3&l%MonthlyStreak%'
|
||||
- '&3&lHighest Streaks:'
|
||||
- '&3Highest Daily Streak: &3&l%BestDailyStreak%'
|
||||
- '&3Highest Week Streak: &3&l%BestWeeklyStreak%'
|
||||
- '&3Highest Month Streak: &3&l%BestMonthlyStreak%'
|
||||
|
||||
# PlaceHolders:
|
||||
# %VotesRequired% = VotesRequired
|
||||
# %NeededVotes% = Number of votes needed to reach VotesRequired
|
||||
# %Votes% = Number of votes
|
||||
Party:
|
||||
- '&cCurrently at &6%Votes%&c, &6%NeededVotes% &cmore votes to go to reach &6%VotesRequired%'
|
||||
|
||||
# %Points% = player points
|
||||
Points: '&a%Player% currently has &a&l%Points%&a Points!'
|
||||
|
||||
ToggleBroadcast:
|
||||
Enabled: '&cYou will now see vote broadcasts'
|
||||
Disabled: '&cYou will no longer see vote broadcasts'
|
||||
|
||||
# Msg on top voter award, will only send message if that place has a reward set
|
||||
# %place% = place - 1,2,3,etc
|
||||
TopVoterAwardMsg: '&aYou came in %place% in top voters of the month! Here is an award!'
|
||||
|
||||
# Time Format
|
||||
# See https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
|
||||
TimeFormat: 'EEE, d MMM yyyy HH:mm'
|
||||
|
||||
TimeFormats:
|
||||
Day: 'Day'
|
||||
Days: 'Days'
|
||||
Hour: 'Hour'
|
||||
Hours: 'Hours'
|
||||
Minute: 'Minute'
|
||||
Minutes: 'Minutes'
|
||||
Second: 'Second'
|
||||
Seconds: 'Seconds'
|
||||
|
||||
# Format for signs
|
||||
# SiteName may be all, depending on sign
|
||||
# %position% = position of player, set by sign
|
||||
# %votes% = Number of votes
|
||||
Signs:
|
||||
TopVoterSign:
|
||||
Line1: 'TopVoter: %SiteName%'
|
||||
Line2: '#%position%'
|
||||
Line3: '%player%'
|
||||
Line4: '%votes% Votes'
|
||||
# Message when right clicking sign, uses same placeholders as above
|
||||
RightClickMessage: '&c&l%player% &cis &c&l%position% &cwith &c&l%votes% &cvotes in &c&l%SiteName%'
|
||||
|
||||
# Message when player tries to run command without required permissions
|
||||
NoPerms: '&cYou do not have enough permission!'
|
||||
|
||||
# Message when player types a command but does not input a number where needed
|
||||
NotNumber: '&cError on &6%arg%&c, number expected!'
|
||||
|
||||
# Shop messages when using the /vote shop
|
||||
ShopPurchase: '&aYou bought the %Identifier% for %Points% Points!'
|
||||
ShopFailed: '&cYou do not have %Points% points to purchase this!'
|
||||
|
||||
# User not exist message, from commands such as /vote next (player)
|
||||
UserNotExist: '&cUser does not exist: %player%'
|
||||
|
||||
# Text for page buttons in inventories
|
||||
PrevPage: '&aPrevious Page'
|
||||
NextPage: '&aNext Page'
|
||||
|
||||
InvFull: '&cInventory full, dropping items on ground'
|
||||
|
||||
# Display text
|
||||
# Used in /vote top (GUI)
|
||||
TopVoter:
|
||||
Daily: 'Daily'
|
||||
Weekly: 'Weekly'
|
||||
Monthly: 'Monthly'
|
||||
AllTime: 'AllTime'
|
||||
|
||||
# ------------------------------------------------
|
||||
# GUI Options
|
||||
# ------------------------------------------------
|
||||
|
||||
# Configure GUI's here
|
||||
# Note: Slots start at 0 instead of 1, max slot is 53 (don't go over) (E.g: last slot in first row of inventory is 8)
|
||||
# Item Material's can be found here: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html
|
||||
GUI:
|
||||
# GUI for /vote gui, /vgui, votegui
|
||||
VoteGUI:
|
||||
# Items will be orders as it is below
|
||||
URL:
|
||||
# Standard item format, lore is automaticly applied
|
||||
Item:
|
||||
Material: 'BOW'
|
||||
Data: 0
|
||||
Amount: 1
|
||||
Name: '&4URL'
|
||||
# You can set skulls of the player using the following
|
||||
# Remove the # to enable
|
||||
#Skull: '%Player%'
|
||||
Next:
|
||||
Item:
|
||||
Material: 'COMPASS'
|
||||
Data: 0
|
||||
Amount: 1
|
||||
Name: '&4Next'
|
||||
Last:
|
||||
Item:
|
||||
Material: 'CLOCK'
|
||||
Data: 0
|
||||
Amount: 1
|
||||
Name: '&4Last'
|
||||
Total:
|
||||
Item:
|
||||
Material: 'CHEST'
|
||||
Data: 0
|
||||
Amount: 1
|
||||
Name: '&4Total'
|
||||
Top:
|
||||
Item:
|
||||
Material: 'SIGN'
|
||||
Data: 0
|
||||
Amount: 1
|
||||
Name: '&4Top'
|
||||
Today:
|
||||
Item:
|
||||
Material: 'BOOK'
|
||||
Data: 0
|
||||
Amount: 1
|
||||
Name: '&4Today'
|
||||
Shop:
|
||||
Item:
|
||||
Material: 'DIAMOND'
|
||||
Data: 0
|
||||
Amount: 1
|
||||
Name: '&4Vote Shop'
|
||||
Lore:
|
||||
- '&aYou currently have %points% points'
|
||||
|
||||
# GUI for /vote url
|
||||
# And /vote if enabled in Config.yml
|
||||
VoteURL:
|
||||
# GUI Name
|
||||
Name: '&cVoteURL'
|
||||
BackButton: true
|
||||
SiteName: '&c%Name%'
|
||||
SeeURL: '&cClick to see URL'
|
||||
NextVote: '&cCan Vote In: %Info%'
|
||||
ViewAllUrlsButtonEnabled: true
|
||||
AllUrlsButton:
|
||||
AlreadyVotedItem:
|
||||
Material: 'REDSTONE_BLOCK'
|
||||
Data: 0
|
||||
Amount: 1
|
||||
Name: '&4All Voting Sites'
|
||||
Lore:
|
||||
- '&cClick Me'
|
||||
CanVoteItem:
|
||||
Material: 'EMERALD_BLOCK'
|
||||
Data: 0
|
||||
Amount: 1
|
||||
Name: '&4All Voting Sites'
|
||||
Lore:
|
||||
- '&cClick Me'
|
||||
AlreadyVotedItem:
|
||||
Material: 'REDSTONE_BLOCK'
|
||||
Data: 0
|
||||
Amount: 1
|
||||
CanVoteItem:
|
||||
Material: 'EMERALD_BLOCK'
|
||||
Data: 0
|
||||
Amount: 1
|
||||
URLText: '%VoteUrl%'
|
||||
|
||||
VoteRewardBackButton: false
|
||||
# Customize /vote reward
|
||||
# Show players what you get when you vote on each site
|
||||
VoteReward:
|
||||
# Name of votesite
|
||||
ExampleVoteSite:
|
||||
# items in /vote reward sitename
|
||||
Items:
|
||||
# Item
|
||||
# This is not the item display name
|
||||
# Do not have 2 of the same items
|
||||
Diamond:
|
||||
# Item ID
|
||||
Material: 'DIAMOND'
|
||||
# Item Data (Eg 1:4, data is 4)
|
||||
Data: 0
|
||||
# Amount of items
|
||||
# Should be greater than 0
|
||||
Amount: 1
|
||||
# Item name
|
||||
# Remove this line for no name
|
||||
Name: '&4Example'
|
||||
# Lore
|
||||
# Remove this line for no lore
|
||||
Lore:
|
||||
- '&4Line 1'
|
||||
VoteLast:
|
||||
Name: 'VoteLast: %player%'
|
||||
BackButton: true
|
||||
VoteNext:
|
||||
Name: 'VoteNext: %player%'
|
||||
BackButton: true
|
||||
VoteToday:
|
||||
Name: 'VoteToday'
|
||||
BackButton: true
|
||||
VoteTop:
|
||||
Name: 'VoteTop %topvoter%'
|
||||
BackButton: false
|
||||
Item:
|
||||
Name: '&3&l%position%: &3%player%'
|
||||
Lore: '&3&lVotes: &3%votes%'
|
||||
SwitchItem:
|
||||
Name: 'Switch TopVoter'
|
||||
Lore: 'Currently: %Top%'
|
||||
Material: 'SIGN'
|
||||
Amount: 1
|
||||
# 8 Slots over from the bottom left
|
||||
Slot: 7
|
||||
# Number of topvoters to display on page +9
|
||||
# 9 Slots on the botton are used for page buttons
|
||||
Size: 27
|
||||
VoteTotal:
|
||||
Name: 'VoteTotal: %player%'
|
||||
BackButton: true
|
||||
DayTotal:
|
||||
Item:
|
||||
Material: 'CLOCK'
|
||||
Name: '&cDaily Total'
|
||||
Lore: '&c&lTotal: &c%Total%'
|
||||
Amount: 1
|
||||
WeekTotal:
|
||||
Item:
|
||||
Material: 'CLOCK'
|
||||
Name: '&cWeekly Total'
|
||||
Lore: '&c&lTotal: &c%Total%'
|
||||
Amount: 1
|
||||
MonthTotal:
|
||||
Item:
|
||||
Material: 'CLOCK'
|
||||
Name: '&cMonthly Total'
|
||||
Lore: '&c&lTotal: &c%Total%'
|
||||
Amount: 1
|
||||
AllTimeTotal:
|
||||
Item:
|
||||
Material: 'CLOCK'
|
||||
Name: '&cAllTime Total'
|
||||
Lore: '&c&lTotal: &c%Total%'
|
||||
Amount: 1
|
||||
VoteBest:
|
||||
Name: 'VoteBest: %player%'
|
||||
DayBest:
|
||||
Item:
|
||||
Material: 'CLOCK'
|
||||
Name: '&cDaily Best'
|
||||
Lore: '&c&lBest: &c%Best%'
|
||||
Amount: 1
|
||||
WeekBest:
|
||||
Item:
|
||||
Material: 'CLOCK'
|
||||
Name: '&cWeekly Best'
|
||||
Lore: '&c&lBest: &c%Best%'
|
||||
Amount: 1
|
||||
MonthBest:
|
||||
Item:
|
||||
Material: 'CLOCK'
|
||||
Name: '&cMonthly Best'
|
||||
Lore: '&c&lBest: &c%Best%'
|
||||
Amount: 1
|
||||
VoteStreak:
|
||||
Name: 'VoteStreak: %player%'
|
||||
BackButton: false
|
||||
CurrentDayStreak:
|
||||
Item:
|
||||
Material: 'CLOCK'
|
||||
Name: '&cCurrent Daily Streak'
|
||||
Lore: '&c&lStreak: &c%Streak%'
|
||||
Amount: 1
|
||||
CurrentWeekStreak:
|
||||
Item:
|
||||
Material: 'CLOCK'
|
||||
Name: '&cCurrent Weekly Streak'
|
||||
Lore: '&c&lStreak: &c%Streak%'
|
||||
Amount: 1
|
||||
CurrentMonthStreak:
|
||||
Item:
|
||||
Material: 'CLOCK'
|
||||
Name: '&cCurrent Monthly Streak'
|
||||
Lore: '&c&lStreak: &c%Streak%'
|
||||
Amount: 1
|
||||
HighestDayStreak:
|
||||
Item:
|
||||
Material: 'CLOCK'
|
||||
Name: '&cHighest Daily Streak'
|
||||
Lore: '&c&lStreak: &c%Streak%'
|
||||
Amount: 1
|
||||
HighestWeekStreak:
|
||||
Item:
|
||||
Material: 'CLOCK'
|
||||
Name: '&cHighest Weekly Streak'
|
||||
Lore: '&c&lStreak: &c%Streak%'
|
||||
Amount: 1
|
||||
HighestMonthStreak:
|
||||
Item:
|
||||
Material: 'CLOCK'
|
||||
Name: '&cHighest Monthly Streak'
|
||||
Lore: '&c&lStreak: &c%Streak%'
|
||||
Amount: 1
|
||||
VoteURLSite:
|
||||
Name: 'VoteSite: %site%'
|
||||
VoteGUIName: '&cVoteGUI: &c&l%player%'
|
||||
VoteRewardName: 'VoteReward'
|
||||
VoteShopName: 'VoteShop'
|
||||
|
||||
BackButton:
|
||||
Material: 'PAPER'
|
||||
Data: 0
|
||||
Amount: 1
|
||||
Name: '&8Back to VoteGUI'
|
||||
|
||||
VoteShopBackButton: true
|
||||
VoteShopEnabled: true
|
||||
Shop:
|
||||
# Identifier
|
||||
# Used in placeholders for formats
|
||||
Diamond:
|
||||
# Item
|
||||
Material: 'DIAMOND'
|
||||
Data: 0
|
||||
Amount: 1
|
||||
Name: '&4Buy A Diamond'
|
||||
# You can set skulls of the player using the following
|
||||
# Remove the # to enable
|
||||
#Skull: '%Player%'
|
||||
Lore:
|
||||
- '&c&lCost: &c3 Voting Points'
|
||||
# Number of voting points this cost
|
||||
Cost: 3
|
||||
# Permission required, leave blank for no permission
|
||||
Permission: ''
|
||||
# Limit how many times you can buy this
|
||||
#Limit: 3
|
||||
# Rewards to run if player buys succesfully
|
||||
Rewards:
|
||||
Items:
|
||||
Diamond:
|
||||
Material: 'DIAMOND'
|
||||
Amount: 1
|
||||
|
||||
# ------------------------------------------------
|
||||
# Extra Rewards
|
||||
# ------------------------------------------------
|
||||
|
||||
# To disable reward set value to []
|
||||
# Eg:
|
||||
# FirstVote: [] (All in one line)
|
||||
# By default all rewards are disabled
|
||||
|
||||
# First vote rewards
|
||||
FirstVote:
|
||||
Messages:
|
||||
Player: '&aYou voted for your first time!'
|
||||
Money: 100
|
||||
|
||||
# All vote rewards
|
||||
# Reward for voting on all sites in one day
|
||||
AllSites:
|
||||
Messages:
|
||||
Player: '&aYou voted on all sites in 1 day!'
|
||||
|
||||
Cumulative:
|
||||
# Number of votes required
|
||||
# Allows multiple cumulative rewards
|
||||
# Number be be around ' (E.g. '1')
|
||||
# Can have multiple listed here
|
||||
'20':
|
||||
Enabled: false
|
||||
# Wether 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
|
||||
VotesInSameDay: false
|
||||
VotesInSameWeek: false
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou got %cumulative% cumulative votes!'
|
||||
|
||||
VoteParty:
|
||||
# Wether or not vote party is enabled
|
||||
Enabled: false
|
||||
# Number of votes required to give rewards
|
||||
VotesRequired: 20
|
||||
# Increase the amount of votes required on each vote party reached
|
||||
#IncreaseVotesRquired: 10
|
||||
# If true, players who did not vote to reach the votes required will
|
||||
# recieve the reward
|
||||
GiveAllPlayers: false
|
||||
# If true, the vote count will reset each day
|
||||
ResetEachDay: false
|
||||
# Reset at the end of the month
|
||||
ResetMonthly: false
|
||||
# Count votes from /av vote?
|
||||
CountFakeVotes: true
|
||||
# Number of user votes that apply to vote party total the user needs to get rewards
|
||||
UserVotesRequired: 0
|
||||
# Broadcast when vote party reached
|
||||
Broadcast: '&cReached the vote party amount!'
|
||||
# List of commands to execute, these only execute once.
|
||||
# %player% does not work here
|
||||
Commands: []
|
||||
# Rewards to give
|
||||
Rewards:
|
||||
Commands:
|
||||
- say %player%
|
||||
Items:
|
||||
DIAMOND:
|
||||
Material: 'DIAMOND'
|
||||
Amount: 1
|
||||
|
||||
# Reset milestones at end of the month
|
||||
ResetMilestonesMonthly: false
|
||||
|
||||
MileStones:
|
||||
# Number of votes required
|
||||
# Allows multiple milestones
|
||||
# Number be be around ' (E.g. '1')
|
||||
# Can have multiple listed here
|
||||
'20':
|
||||
Enabled: false
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou got %milestone% milestone votes!'
|
||||
|
||||
VoteStreak:
|
||||
# Valid options: Day, Week, Month
|
||||
Day:
|
||||
# Number of days in a row
|
||||
# Each day requires one vote
|
||||
# Add a - to give a reward for every multiple (e.g. 2- = 2,4,6,8, and so on)
|
||||
'2':
|
||||
# Enabled or not
|
||||
Enabled: false
|
||||
# Rewards to give
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: "&aYou voted for %Streak% %Type%'s in a row!"
|
||||
Week:
|
||||
# Number of weeks in a row
|
||||
# Requires atleast one vote per week
|
||||
'2':
|
||||
# Enabled or not
|
||||
Enabled: false
|
||||
# Rewards to give
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: "&aYou voted for %Streak% %Type%'s in a row!"
|
||||
Month:
|
||||
# Number of months in a row
|
||||
# Requires atleast 1 vote per month
|
||||
'2':
|
||||
# Enabled or not
|
||||
Enabled: false
|
||||
# Rewards to give
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: "&aYou voted for %Streak% %Type%'s in a row!"
|
||||
|
||||
|
||||
# ONLY USE THIS FOR TITLES/SOUNDS AND OTHER EFFECTS
|
||||
# IT WILL ONLY RUN ONE TIME FOR ANY NUMBER OF OFFLINE VOTES (3 offline votes = 1 AnySiteReward)
|
||||
# Any reward files listed here are ran on vote of any site
|
||||
# It is recommended to add rewards to each site instead of here
|
||||
# Using forceoffline won't work here
|
||||
# Use EverySiteReward in VoteSites.yml for a global reward for each site
|
||||
AnySiteRewards: []
|
||||
|
||||
|
||||
# ------------------------------------------------
|
||||
# Top Voter
|
||||
# ------------------------------------------------
|
||||
|
||||
# Top voter blacklist
|
||||
# Hide these names from top voter lists
|
||||
BlackList:
|
||||
- 'Notch'
|
||||
|
||||
# If true players with the permission 'VotingPlugin.TopVoter.Ignore' will act
|
||||
# as if there name was added on the the blacklist above
|
||||
# This also applies for players with op
|
||||
TopVoterIgnorePermission: false
|
||||
|
||||
# /vote top default data displayed
|
||||
# Valid Options: AllTime, Monthly, Weekly, Daily
|
||||
VoteTopDefault: Monthly
|
||||
|
||||
# Whether or not to have ties on top voter rewards
|
||||
TopVoterAwardsTies: true
|
||||
|
||||
# These are required to be enabled in order for top voter awards to work
|
||||
LoadTopVoter:
|
||||
AllTime: true
|
||||
Monthly: true
|
||||
Weekly: false
|
||||
Daily: false
|
||||
|
||||
# When top voter awards are given (even if there are none listed) it will store top voters
|
||||
# Files will created in TopVoters folder.
|
||||
StoreTopVoters:
|
||||
Monthly: true
|
||||
Weekly: false
|
||||
Daily: false
|
||||
|
||||
EnableMonthlyAwards: true
|
||||
# Rewards to give
|
||||
MonthlyAwards:
|
||||
# Position. 1 is first in top voter, 2 is second, etc...
|
||||
# Using 1-10 will reward players in first to tenth place with the same reward
|
||||
1:
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou came in first place in %TopVoter%!'
|
||||
2:
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou came in second place in %TopVoter%!'
|
||||
|
||||
EnableWeeklyAwards: false
|
||||
# Rewards to give on weekly top voter
|
||||
WeeklyAwards:
|
||||
# Position. 1 is first in top voter, 2 is second, etc...
|
||||
1:
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou came in first place in %TopVoter%!'
|
||||
2:
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou came in second place in %TopVoter%!'
|
||||
|
||||
EnableDailyRewards: false
|
||||
# Rewards to give on daily top voter
|
||||
DailyAwards:
|
||||
# Position. 1 is first in top voter, 2 is second, etc...
|
||||
1:
|
||||
# Reward files to give
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou came in first place in %TopVoter%!'
|
||||
2:
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou came in second place in %TopVoter%!'
|
||||
|
||||
# ------------------------------------------------
|
||||
# Advanced
|
||||
# Most of these values can be left untouched for most setups
|
||||
# ------------------------------------------------
|
||||
|
||||
# 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
|
||||
|
||||
# Debug
|
||||
Debug: false
|
||||
|
||||
# Extra Debug
|
||||
# Only needed in extreme cases
|
||||
ExtraDebug: false
|
||||
|
||||
# Debug info ingame
|
||||
# Players with permission "VotingPlugin.Debug"
|
||||
# will see debug info if debug is true
|
||||
DebugInGame: false
|
||||
|
||||
# Will log debug messages to VotingPlugin/Log/log.txt
|
||||
# Requires Debug to be on
|
||||
LogDebugToFile: false
|
||||
|
||||
# Options for request api
|
||||
# Current methods
|
||||
# ANVIL
|
||||
# BOOK
|
||||
# CHAT
|
||||
# This is mainly used for admin gui's to type in values
|
||||
RequestAPI:
|
||||
DefaultMethod: 'Anvil'
|
||||
DisabledMethods: []
|
||||
|
||||
# Wether or not to log every vote to a file
|
||||
# Use this if you wanna track player votes
|
||||
# Not recommended though
|
||||
LogVotesToFile: false
|
||||
|
||||
# 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
|
||||
|
||||
# Set to true to disable no service site message on voting
|
||||
# You should never have to touch this if everything is setup properly
|
||||
# Will also disable a few other warnings about vote sites
|
||||
DisableNoServiceSiteMessage: false
|
||||
|
||||
# Count fake votes
|
||||
# If true fake votes will give points and totals
|
||||
CountFakeVotes: true
|
||||
|
||||
# Give VotingPlugin.Player by default
|
||||
# Requires restart to take affect
|
||||
GiveDefaultPermission: true
|
||||
|
||||
# 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 send scoreboards on some commands
|
||||
SendScoreboards: 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
|
||||
|
||||
# Disable this on a hub server for example
|
||||
# Still processes rewards for offline rewards (just won't give any)
|
||||
ProcessRewards: true
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Mysql cache options
|
||||
# Clearing cache forces the plugin to pull from database
|
||||
# ---------------------------------------------------------
|
||||
|
||||
# Clear cache on update, setting to true reduces update speed
|
||||
ClearCacheOnUpdate: false
|
||||
|
||||
# Clear mysql 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
|
||||
|
||||
# ###############################################################
|
||||
# Deprecated options, don't recommend using any of these
|
||||
|
||||
# Whether or not to disable checking names on mojang, disable if you hit the rate limit
|
||||
# Shouldn't make a noticeable impact if set to false
|
||||
#CheckNameMojang: false
|
||||
|
||||
# Shouldn't need to change this
|
||||
#AutoKillInvs: true
|
||||
|
||||
# Used in special cases
|
||||
# Much slower, but may work better
|
||||
# Not recommended in newer versions
|
||||
#AlternateUUIDLookup: false
|
||||
|
||||
# Disable checking on world change
|
||||
# May improve performance
|
||||
#DisableCheckOnWorldChange: false
|
||||
@@ -1,59 +0,0 @@
|
||||
VoteSites:
|
||||
# VoteSite name
|
||||
ExampleVoteSite:
|
||||
# Enable voteSite
|
||||
# If false, votesite will not be loaded by plugin
|
||||
# Default: false
|
||||
Enabled: false
|
||||
|
||||
# Display name of voting site
|
||||
Name: 'ExampleVoteSite'
|
||||
|
||||
# Priority of this site
|
||||
# Used for sorted list
|
||||
# High prority, higher on the list
|
||||
Priority: 5
|
||||
|
||||
# The serviceName from the vote, has to be correct to work correctly
|
||||
# Gotten from voting on the site (will be in console/log)
|
||||
# Usually is the main part of the url(e.g. PlanetMinecraft.com)
|
||||
ServiceSite: 'PlanetMinecraft.com'
|
||||
|
||||
# vote url for /vote
|
||||
# Format for this can be set in Format.yml
|
||||
# Do not include colors here
|
||||
VoteURL: 'link to vote URL here, used in /vote'
|
||||
|
||||
# Time between votes in hours (used for /vote next)
|
||||
# Most sites are 24 hours
|
||||
VoteDelay: 24
|
||||
|
||||
# Require waiting until votedelay time has pasted in order to accept vote
|
||||
WaitUntilVoteDelay: false
|
||||
|
||||
# Reset vote delay each day (for certain sites that do this)
|
||||
VoteDelayDaily: false
|
||||
|
||||
# If true, rewards can be executed offline (requires ForceOffline to be true in the reward)
|
||||
# Setting this to true will execute the reward offline while the player is offline
|
||||
# This basiclly disables offline voting if set to true, don't misinterpret this option
|
||||
ForceOffline: false
|
||||
|
||||
# VoteSite Material for GUI's
|
||||
# Removing this may result in an error, required on each site
|
||||
Item:
|
||||
Material: 'DIAMOND'
|
||||
Amount: 1
|
||||
|
||||
# Rewards to give
|
||||
# https://github.com/Ben12345rocks/AdvancedCore/wiki/Rewards
|
||||
Rewards:
|
||||
Commands:
|
||||
- 'say hello'
|
||||
Messages:
|
||||
Player: 'You voted'
|
||||
|
||||
# Reward for any site
|
||||
# Similar to AnySiteReward
|
||||
# This requires the site to be configured in order to get the reward.
|
||||
EverySiteReward: []
|
||||
@@ -1,282 +0,0 @@
|
||||
<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.Ben12345rocks</groupId>
|
||||
<artifactId>VotingPlugin</artifactId>
|
||||
<version>5.17</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>VotingPlugin</name>
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<github.global.server>github</github.global.server>
|
||||
<project.build.sourceEncoding>Cp1252</project.build.sourceEncoding>
|
||||
</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>
|
||||
<directory>Resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>plugin.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>Resources</directory>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
<artifactId>lifecycle-mapping</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<configuration>
|
||||
<lifecycleMappingMetadata>
|
||||
<pluginExecutions>
|
||||
<pluginExecution>
|
||||
<pluginExecutionFilter>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok-maven-plugin</artifactId>
|
||||
<versionRange>[1,)</versionRange>
|
||||
<goals>
|
||||
<goal>delombok</goal>
|
||||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<ignore />
|
||||
</action>
|
||||
</pluginExecution>
|
||||
</pluginExecutions>
|
||||
</lifecycleMappingMetadata>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<finalName>${project.name}</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok-maven-plugin</artifactId>
|
||||
<version>1.18.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>delombok</id>
|
||||
<phase>deploy</phase>
|
||||
<goals>
|
||||
<goal>delombok</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<addOutputDirectory>false</addOutputDirectory>
|
||||
<outputDirectory>${project.basedir}/target/delombok</outputDirectory>
|
||||
<sourceDirectory>${project.basedir}/src</sourceDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.4.3</version>
|
||||
<configuration>
|
||||
<shadedArtifactAttached>false</shadedArtifactAttached>
|
||||
<relocations>
|
||||
<!-- Lets relocate the shaded API so we dont cause any conflicts with
|
||||
other plugins -->
|
||||
<relocation>
|
||||
<pattern>com.Ben12345rocks.AdvancedCore</pattern>
|
||||
<shadedPattern>${project.groupId}.${project.artifactId}.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}.${project.artifactId}</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>me.mrten.mysqlapi</pattern>
|
||||
<shadedPattern>${project.groupId}.${project.artifactId}.mysqlapi</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.zaxxer.HikariCP</pattern>
|
||||
<shadedPattern>${project.groupId}.${project.artifactId}.HikariCP</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.slf4j.slf4j-simple</pattern>
|
||||
<shadedPattern>${project.groupId}.${project.artifactId}.slf4j-simple</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<!-- Lets exclude google code, because the server already has this
|
||||
code in it (guava, etc) -->
|
||||
<excludes>
|
||||
<exclude>com.google.*:*</exclude>
|
||||
</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>Ben12345rocks</repositoryOwner>
|
||||
<server>github</server>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resources</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${user.home}/Documents/Test Server/plugins</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${basedir}/target</directory>
|
||||
<includes>
|
||||
<include>${project.artifactId}.jar</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<overwrite>true</overwrite>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.github.Ben12345rocks</groupId>
|
||||
<artifactId>AdvancedCore</artifactId>
|
||||
<version>master-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- <dependency> <groupId>com.Ben12345rocks</groupId> <artifactId>AdvancedCore</artifactId>
|
||||
<version>LATEST</version> <scope>compile</scope> </dependency> -->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vexsoftware</groupId>
|
||||
<artifactId>votifier</artifactId>
|
||||
<version>1.9</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/Jars/Votifier.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.swifteh</groupId>
|
||||
<artifactId>GAL</artifactId>
|
||||
<version>1.3.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/Jars/GAListener.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mythicacraft</groupId>
|
||||
<artifactId>voteroulette</artifactId>
|
||||
<version>3.2.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/Jars/VoteRoulette.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.mimimum.minecraft</groupId>
|
||||
<artifactId>SuperbVote</artifactId>
|
||||
<version>0.5.3</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/Jars/SuperbVote-0.5.3.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,934 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Commands;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.Permission;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.AdvancedCoreHook;
|
||||
import com.Ben12345rocks.AdvancedCore.CommandAPI.CommandHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.UserManager.UUID;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.MiscUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.StringUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Scoreboards.SimpleScoreboard;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.ConfigVoteSites;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.VoteSite;
|
||||
import com.Ben12345rocks.VotingPlugin.TopVoter.TopVoter;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class Commands.
|
||||
*/
|
||||
public class Commands {
|
||||
|
||||
/** The config. */
|
||||
static Config config = Config.getInstance();
|
||||
|
||||
/** The config vote sites. */
|
||||
static ConfigVoteSites configVoteSites = ConfigVoteSites.getInstance();
|
||||
|
||||
/** The instance. */
|
||||
static Commands instance = new Commands();
|
||||
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
/**
|
||||
* Gets the single instance of Commands.
|
||||
*
|
||||
* @return single instance of Commands
|
||||
*/
|
||||
public static Commands getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new commands.
|
||||
*/
|
||||
private Commands() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new commands.
|
||||
*
|
||||
* @param plugin
|
||||
* the plugin
|
||||
*/
|
||||
public Commands(Main plugin) {
|
||||
Commands.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin help.
|
||||
*
|
||||
* @param sender
|
||||
* the sender
|
||||
* @param page
|
||||
* the page
|
||||
* @return the array list
|
||||
*/
|
||||
public ArrayList<TextComponent> adminHelp(CommandSender sender, int page) {
|
||||
int pagesize = Config.getInstance().getFormatPageSize();
|
||||
ArrayList<TextComponent> msg = new ArrayList<TextComponent>();
|
||||
ArrayList<TextComponent> text = adminHelpText(sender);
|
||||
|
||||
int maxPage = text.size() / pagesize;
|
||||
if ((text.size() % pagesize) != 0) {
|
||||
maxPage++;
|
||||
}
|
||||
|
||||
msg.add(StringUtils.getInstance().stringToComp("&3&lVotingPlugin Admin Help " + (page + 1) + "/" + maxPage));
|
||||
msg.add(StringUtils.getInstance().stringToComp("&3&l() = Needed"));
|
||||
msg.add(StringUtils.getInstance().stringToComp("&3&lAliases: adminvote, av"));
|
||||
|
||||
for (int i = pagesize * page; (i < text.size()) && (i < ((page + 1) * pagesize) - 1); i++) {
|
||||
msg.add(text.get(i));
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin help text.
|
||||
*
|
||||
* @param sender
|
||||
* the sender
|
||||
* @return the array list
|
||||
*/
|
||||
public ArrayList<TextComponent> adminHelpText(CommandSender sender) {
|
||||
ArrayList<TextComponent> msg = new ArrayList<TextComponent>();
|
||||
HashMap<String, TextComponent> unsorted = new HashMap<String, TextComponent>();
|
||||
|
||||
boolean requirePerms = Config.getInstance().getFormatCommandsVoteHelpRequirePermission();
|
||||
|
||||
for (CommandHandler cmdHandle : plugin.getAdminVoteCommand()) {
|
||||
if (sender.hasPermission(cmdHandle.getPerm()) && requirePerms) {
|
||||
unsorted.put(cmdHandle.getHelpLineCommand("/adminvote"), cmdHandle.getHelpLine("/adminvote"));
|
||||
} else {
|
||||
unsorted.put(cmdHandle.getHelpLineCommand("/adminvote"), cmdHandle.getHelpLine("/adminvote"));
|
||||
}
|
||||
}
|
||||
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 String[] best(CommandSender sender, String name) {
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
msg.add(config.getFormatCommandsVoteBestTitle());
|
||||
msg.addAll(config.getFormatCommandsVoteBestLines());
|
||||
|
||||
User user = UserManager.getInstance().getVotingPluginUser(name);
|
||||
|
||||
HashMap<String, String> placeholders = new HashMap<String, String>();
|
||||
placeholders.put("HighestDailyTotal", "" + user.getHighestDailyTotal());
|
||||
placeholders.put("HighestWeeklyTotal", "" + user.getHighestWeeklyTotal());
|
||||
placeholders.put("HighestMonthlyTotal", "" + user.getHighestMonthlyTotal());
|
||||
|
||||
placeholders.put("player", name);
|
||||
|
||||
msg = ArrayUtils.getInstance().replacePlaceHolder(msg, placeholders);
|
||||
|
||||
return ArrayUtils.getInstance().convert(ArrayUtils.getInstance().colorize(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* Command vote today.
|
||||
*
|
||||
* @param page
|
||||
* the page
|
||||
* @return the string[]
|
||||
*/
|
||||
public String[] commandVoteToday(int page) {
|
||||
int pagesize = Config.getInstance().getFormatPageSize();
|
||||
if (page < 1) {
|
||||
page = 1;
|
||||
}
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
String[] voteToday = voteToday();
|
||||
|
||||
int maxPage = voteToday.length / pagesize;
|
||||
if ((voteToday.length % pagesize) != 0) {
|
||||
maxPage++;
|
||||
}
|
||||
|
||||
msg.add("&cToday's Votes " + page + "/" + maxPage);
|
||||
msg.add("&cPlayerName : VoteSite : Time");
|
||||
page--;
|
||||
|
||||
for (int i = pagesize * page; (i < voteToday.length) && (i < ((page + 1) * pagesize)); i++) {
|
||||
msg.add(voteToday[i]);
|
||||
}
|
||||
|
||||
msg = ArrayUtils.getInstance().colorize(msg);
|
||||
return ArrayUtils.getInstance().convert(msg);
|
||||
}
|
||||
|
||||
public String[] listPerms(CommandSender sender) {
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
msg.add("&c&lCommand : Permissions (seperated by |)");
|
||||
|
||||
for (CommandHandler handle : plugin.getVoteCommand()) {
|
||||
if (sender instanceof Player) {
|
||||
if (handle.hasPerm(sender)) {
|
||||
msg.add("&a" + handle.getHelpLineCommand("/vote") + " : " + handle.getPerm() + " : true");
|
||||
} else {
|
||||
msg.add("&c" + handle.getHelpLineCommand("/vote") + " : " + handle.getPerm() + " : false");
|
||||
}
|
||||
} else {
|
||||
msg.add(handle.getHelpLineCommand("/vote") + " : " + handle.getPerm());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (CommandHandler handle : plugin.getAdminVoteCommand()) {
|
||||
if (sender instanceof Player) {
|
||||
if (handle.hasPerm(sender)) {
|
||||
msg.add("&a" + handle.getHelpLineCommand("/av") + " : " + handle.getPerm() + " : true");
|
||||
} else {
|
||||
msg.add("&c" + handle.getHelpLineCommand("/av") + " : " + handle.getPerm() + " : false");
|
||||
}
|
||||
} else {
|
||||
msg.add(handle.getHelpLineCommand("/av") + " : " + handle.getPerm());
|
||||
}
|
||||
}
|
||||
|
||||
for (Permission perm : plugin.getDescription().getPermissions()) {
|
||||
if (sender instanceof Player) {
|
||||
if (sender.hasPermission(perm)) {
|
||||
msg.add("&a" + perm.getName() + " : true");
|
||||
} else {
|
||||
msg.add("&c" + perm.getName() + " : false");
|
||||
}
|
||||
} else {
|
||||
msg.add(perm.getName());
|
||||
}
|
||||
}
|
||||
|
||||
msg = ArrayUtils.getInstance().colorize(msg);
|
||||
|
||||
return ArrayUtils.getInstance().convert(msg);
|
||||
}
|
||||
|
||||
public void listPerms(CommandSender sender, String player, int page) {
|
||||
Player p = Bukkit.getPlayer(player);
|
||||
if (p != null) {
|
||||
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
ArrayList<String> text = new ArrayList<String>();
|
||||
|
||||
for (CommandHandler handle : plugin.getVoteCommand()) {
|
||||
if (handle.hasPerm(p)) {
|
||||
msg.add("&a" + handle.getHelpLineCommand("/vote") + " : " + handle.getPerm() + " : true");
|
||||
} else {
|
||||
msg.add("&c" + handle.getHelpLineCommand("/vote") + " : " + handle.getPerm() + " : false");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (CommandHandler handle : plugin.getAdminVoteCommand()) {
|
||||
if (handle.hasPerm(p)) {
|
||||
msg.add("&a" + handle.getHelpLineCommand("/av") + " : " + handle.getPerm() + " : true");
|
||||
} else {
|
||||
msg.add("&c" + handle.getHelpLineCommand("/av") + " : " + handle.getPerm() + " : false");
|
||||
}
|
||||
}
|
||||
|
||||
for (Permission perm : plugin.getDescription().getPermissions()) {
|
||||
if (p.hasPermission(perm)) {
|
||||
msg.add("&a" + perm.getName() + " : true");
|
||||
} else {
|
||||
msg.add("&c" + perm.getName() + " : false");
|
||||
}
|
||||
}
|
||||
|
||||
msg = ArrayUtils.getInstance().colorize(msg);
|
||||
|
||||
int pagesize = Config.getInstance().getFormatPageSize();
|
||||
|
||||
int maxPage = msg.size() / pagesize;
|
||||
if ((msg.size() % pagesize) != 0) {
|
||||
maxPage++;
|
||||
}
|
||||
|
||||
text.add("&c&lCommand : Permissions (seperated by |) " + page + "/" + maxPage);
|
||||
|
||||
for (int i = pagesize * page - pagesize; i < msg.size() && i < pagesize * page; i++) {
|
||||
text.add(msg.get(i));
|
||||
}
|
||||
sender.sendMessage(ArrayUtils.getInstance().convert(ArrayUtils.getInstance().colorize(text)));
|
||||
} else {
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&cPlayer not online: " + player));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Player info.
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
* @return the string[]
|
||||
*/
|
||||
public String[] playerInfo(User user) {
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
|
||||
// title
|
||||
msg.add("&cPlayer '" + user.getPlayerName() + "' Info");
|
||||
|
||||
// last vote
|
||||
msg.addAll(ArrayUtils.getInstance().convert(voteCommandLast(user)));
|
||||
|
||||
// next vote
|
||||
msg.addAll(ArrayUtils.getInstance().convert(voteCommandNext(user)));
|
||||
|
||||
// total
|
||||
msg.addAll(ArrayUtils.getInstance().convert(voteCommandTotal(user)));
|
||||
|
||||
msg = ArrayUtils.getInstance().colorize(msg);
|
||||
return ArrayUtils.getInstance().convert(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send top voter monthly score board.
|
||||
*
|
||||
* @param player
|
||||
* the player
|
||||
* @param page
|
||||
* the page
|
||||
*/
|
||||
public void sendTopVoterAllTimeScoreBoard(final Player player, int page) {
|
||||
if (AdvancedCoreHook.getInstance().getOptions().isSendScoreboards()) {
|
||||
int pagesize = Config.getInstance().getFormatPageSize();
|
||||
ArrayList<User> users = plugin.convertSet(plugin.getTopVoter(TopVoter.AllTime).keySet());
|
||||
|
||||
int pageSize = (users.size() / pagesize);
|
||||
if ((users.size() % pagesize) != 0) {
|
||||
pageSize++;
|
||||
}
|
||||
|
||||
String title = StringUtils.getInstance().colorize(config.getFormatCommandVoteTopTitle()
|
||||
.replace("%page%", "" + page).replace("%maxpages%", "" + pageSize).replace("%Top%", "All"));
|
||||
|
||||
SimpleScoreboard scoreboard = new SimpleScoreboard(title);
|
||||
|
||||
for (int i = (page - 1) * pagesize; (i < users.size()) && (i < (((page - 1) * pagesize) + 10)); i++) {
|
||||
scoreboard.add("" + (i + 1) + ": " + users.get(i).getPlayerName(),
|
||||
plugin.getTopVoter(TopVoter.AllTime).get(users.get(i)));
|
||||
}
|
||||
scoreboard.build();
|
||||
scoreboard.send(player);
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
}
|
||||
}, 90);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send top voter daily score board.
|
||||
*
|
||||
* @param player
|
||||
* the player
|
||||
* @param page
|
||||
* the page
|
||||
*/
|
||||
public void sendTopVoterDailyScoreBoard(final Player player, int page) {
|
||||
if (AdvancedCoreHook.getInstance().getOptions().isSendScoreboards()) {
|
||||
int pagesize = Config.getInstance().getFormatPageSize();
|
||||
ArrayList<User> users = plugin.convertSet(plugin.getTopVoter(TopVoter.Daily).keySet());
|
||||
|
||||
int pageSize = (users.size() / pagesize);
|
||||
if ((users.size() % pagesize) != 0) {
|
||||
pageSize++;
|
||||
}
|
||||
|
||||
String title = StringUtils.getInstance().colorize(config.getFormatCommandVoteTopTitle()
|
||||
.replace("%page%", "" + page).replace("%maxpages%", "" + pageSize).replace("%Top%", "Daily"));
|
||||
|
||||
SimpleScoreboard scoreboard = new SimpleScoreboard(title);
|
||||
|
||||
for (int i = (page - 1) * pagesize; (i < users.size()) && (i < (((page - 1) * pagesize) + 10)); i++) {
|
||||
scoreboard.add("" + (i + 1) + ": " + users.get(i).getPlayerName(),
|
||||
plugin.getTopVoter(TopVoter.Daily).get(users.get(i)));
|
||||
}
|
||||
scoreboard.build();
|
||||
scoreboard.send(player);
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
}
|
||||
}, 90);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send top voter monthly score board.
|
||||
*
|
||||
* @param player
|
||||
* the player
|
||||
* @param page
|
||||
* the page
|
||||
*/
|
||||
public void sendTopVoterMonthlyScoreBoard(final Player player, int page) {
|
||||
if (AdvancedCoreHook.getInstance().getOptions().isSendScoreboards()) {
|
||||
int pagesize = Config.getInstance().getFormatPageSize();
|
||||
ArrayList<User> users = plugin.convertSet(plugin.getTopVoter(TopVoter.Monthly).keySet());
|
||||
|
||||
int pageSize = (users.size() / pagesize);
|
||||
if ((users.size() % pagesize) != 0) {
|
||||
pageSize++;
|
||||
}
|
||||
|
||||
String title = StringUtils.getInstance().colorize(config.getFormatCommandVoteTopTitle()
|
||||
.replace("%page%", "" + page).replace("%maxpages%", "" + pageSize).replace("%Top%", "Monthly"));
|
||||
|
||||
SimpleScoreboard scoreboard = new SimpleScoreboard(title);
|
||||
|
||||
for (int i = (page - 1) * pagesize; (i < users.size()) && (i < (((page - 1) * pagesize) + 10)); i++) {
|
||||
scoreboard.add("" + (i + 1) + ": " + users.get(i).getPlayerName(),
|
||||
plugin.getTopVoter(TopVoter.Monthly).get(users.get(i)));
|
||||
}
|
||||
scoreboard.build();
|
||||
scoreboard.send(player);
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
}
|
||||
}, 90);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send top voter weekly score board.
|
||||
*
|
||||
* @param player
|
||||
* the player
|
||||
* @param page
|
||||
* the page
|
||||
*/
|
||||
public void sendTopVoterWeeklyScoreBoard(final Player player, int page) {
|
||||
if (AdvancedCoreHook.getInstance().getOptions().isSendScoreboards()) {
|
||||
int pagesize = Config.getInstance().getFormatPageSize();
|
||||
ArrayList<User> users = plugin.convertSet(plugin.getTopVoter(TopVoter.Weekly).keySet());
|
||||
|
||||
int pageSize = (users.size() / pagesize);
|
||||
if ((users.size() % pagesize) != 0) {
|
||||
pageSize++;
|
||||
}
|
||||
|
||||
String title = StringUtils.getInstance().colorize(config.getFormatCommandVoteTopTitle()
|
||||
.replace("%page%", "" + page).replace("%maxpages%", "" + pageSize).replace("%Top%", "Weekly"));
|
||||
|
||||
SimpleScoreboard scoreboard = new SimpleScoreboard(title);
|
||||
|
||||
for (int i = (page - 1) * pagesize; (i < users.size()) && (i < (((page - 1) * pagesize) + 10)); i++) {
|
||||
scoreboard.add("" + (i + 1) + ": " + users.get(i).getPlayerName(),
|
||||
plugin.getTopVoter(TopVoter.Weekly).get(users.get(i)));
|
||||
}
|
||||
scoreboard.build();
|
||||
scoreboard.send(player);
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
}
|
||||
}, 90);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send vote today score board.
|
||||
*
|
||||
* @param player
|
||||
* the player
|
||||
* @param page
|
||||
* the page
|
||||
*/
|
||||
public void sendVoteTodayScoreBoard(final Player player, int page) {
|
||||
if (AdvancedCoreHook.getInstance().getOptions().isSendScoreboards()) {
|
||||
int pagesize = Config.getInstance().getFormatPageSize();
|
||||
|
||||
String[] voteToday = voteToday();
|
||||
|
||||
int maxPage = voteToday.length / pagesize;
|
||||
if ((voteToday.length % pagesize) != 0) {
|
||||
maxPage++;
|
||||
}
|
||||
|
||||
SimpleScoreboard scoreboard = new SimpleScoreboard("&cToday's Votes " + page + "/" + maxPage);
|
||||
|
||||
for (int i = pagesize * page; (i < voteToday.length) && (i < ((page + 1) * pagesize)); i++) {
|
||||
scoreboard.add(voteToday[i], i);
|
||||
}
|
||||
scoreboard.build();
|
||||
scoreboard.send(player);
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
}
|
||||
}, 90);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public String[] streak(CommandSender sender, String name) {
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
msg.add(config.getFormatCommandsVoteStreakTitle());
|
||||
msg.addAll(config.getFormatCommandsVoteStreakLines());
|
||||
|
||||
User user = UserManager.getInstance().getVotingPluginUser(name);
|
||||
|
||||
HashMap<String, String> placeholders = new HashMap<String, String>();
|
||||
placeholders.put("DailyStreak", "" + user.getDayVoteStreak());
|
||||
placeholders.put("WeeklyStreak", "" + user.getWeekVoteStreak());
|
||||
placeholders.put("MonthlyStreak", "" + user.getMonthVoteStreak());
|
||||
|
||||
placeholders.put("BestDailyStreak", "" + user.getBestDayVoteStreak());
|
||||
placeholders.put("BestWeeklyStreak", "" + user.getBestWeekVoteStreak());
|
||||
placeholders.put("BestMonthlyStreak", "" + user.getBestMonthVoteStreak());
|
||||
|
||||
placeholders.put("player", name);
|
||||
|
||||
msg = ArrayUtils.getInstance().replacePlaceHolder(msg, placeholders);
|
||||
|
||||
return ArrayUtils.getInstance().convert(ArrayUtils.getInstance().colorize(msg));
|
||||
}
|
||||
|
||||
public void updateVoteToday(ArrayList<User> users) {
|
||||
plugin.getVoteToday().clear();
|
||||
|
||||
for (User user : users) {
|
||||
HashMap<VoteSite, LocalDateTime> times = new HashMap<VoteSite, LocalDateTime>();
|
||||
for (VoteSite voteSite : plugin.getVoteSites()) {
|
||||
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");
|
||||
}
|
||||
|
||||
/**
|
||||
* Vote command last.
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
* @return the string[]
|
||||
*/
|
||||
public String[] voteCommandLast(User user) {
|
||||
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
|
||||
String playerName = user.getPlayerName();
|
||||
|
||||
msg.add(StringUtils.getInstance().replaceIgnoreCase(config.getFormatCommandsVoteLastTitle(), "%player%",
|
||||
playerName));
|
||||
|
||||
for (VoteSite voteSite : plugin.getVoteSites()) {
|
||||
msg.add(voteCommandLastLine(user, voteSite));
|
||||
}
|
||||
|
||||
msg = ArrayUtils.getInstance().colorize(msg);
|
||||
return ArrayUtils.getInstance().convert(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vote command last date.
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
* @param voteSite
|
||||
* the vote site
|
||||
* @return the string
|
||||
*/
|
||||
@Deprecated
|
||||
public String voteCommandLastDate(User user, VoteSite voteSite) {
|
||||
long time = user.getTime(voteSite);
|
||||
if (time > 0) {
|
||||
Date date = new Date(time);
|
||||
String timeString = new SimpleDateFormat(config.getFormatTimeFormat()).format(date);
|
||||
return timeString;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String voteCommandLastDuration(User user, VoteSite voteSite) {
|
||||
long time = user.getTime(voteSite);
|
||||
if (time > 0) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime lastVote = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault());
|
||||
|
||||
Duration dur = Duration.between(lastVote, now);
|
||||
|
||||
long diffSecond = dur.getSeconds();
|
||||
int diffDays = (int) (diffSecond / 60 / 60 / 24);
|
||||
int diffHours = (int) (diffSecond / 60 / 60 - diffDays * 24);
|
||||
int diffMinutes = (int) (diffSecond / 60 - diffHours * 60 - diffDays * 24 * 60);
|
||||
int diffSeconds = (int) (diffSecond - diffMinutes * 60 - diffHours * 60 * 60 - diffDays * 24 * 60 * 60);
|
||||
|
||||
String info = "";
|
||||
if (diffDays == 1) {
|
||||
info += StringUtils.getInstance()
|
||||
.replacePlaceHolder(StringUtils.getInstance().replacePlaceHolder(
|
||||
Config.getInstance().getFormatCommandsVoteLastTimeFormat(), "TimeType",
|
||||
Config.getInstance().getFormatTimeFormatsDay()), "amount", "" + diffDays);
|
||||
info += " ";
|
||||
} else if (diffDays > 1) {
|
||||
info += StringUtils.getInstance()
|
||||
.replacePlaceHolder(StringUtils.getInstance().replacePlaceHolder(
|
||||
Config.getInstance().getFormatCommandsVoteLastTimeFormat(), "TimeType",
|
||||
Config.getInstance().getFormatTimeFormatsDays()), "amount", "" + diffDays);
|
||||
info += " ";
|
||||
}
|
||||
|
||||
if (diffHours == 1) {
|
||||
info += StringUtils.getInstance()
|
||||
.replacePlaceHolder(StringUtils.getInstance().replacePlaceHolder(
|
||||
Config.getInstance().getFormatCommandsVoteLastTimeFormat(), "TimeType",
|
||||
Config.getInstance().getFormatTimeFormatsHour()), "amount", "" + diffHours);
|
||||
info += " ";
|
||||
} else if (diffHours > 1) {
|
||||
info += StringUtils.getInstance()
|
||||
.replacePlaceHolder(StringUtils.getInstance().replacePlaceHolder(
|
||||
Config.getInstance().getFormatCommandsVoteLastTimeFormat(), "TimeType",
|
||||
Config.getInstance().getFormatTimeFormatsHours()), "amount", "" + diffHours);
|
||||
info += " ";
|
||||
}
|
||||
|
||||
if (diffMinutes == 1) {
|
||||
info += StringUtils.getInstance()
|
||||
.replacePlaceHolder(StringUtils.getInstance().replacePlaceHolder(
|
||||
Config.getInstance().getFormatCommandsVoteLastTimeFormat(), "TimeType",
|
||||
Config.getInstance().getFormatTimeFormatsMinute()), "amount", "" + diffMinutes);
|
||||
info += " ";
|
||||
} else if (diffMinutes > 1) {
|
||||
info += StringUtils.getInstance().replacePlaceHolder(StringUtils.getInstance().replacePlaceHolder(
|
||||
Config.getInstance().getFormatCommandsVoteLastTimeFormat(), "TimeType",
|
||||
Config.getInstance().getFormatTimeFormatsMinutes()), "amount", "" + diffMinutes);
|
||||
info += " ";
|
||||
}
|
||||
|
||||
if (diffSeconds == 1) {
|
||||
info += StringUtils.getInstance()
|
||||
.replacePlaceHolder(StringUtils.getInstance().replacePlaceHolder(
|
||||
Config.getInstance().getFormatCommandsVoteLastTimeFormat(), "TimeType",
|
||||
Config.getInstance().getFormatTimeFormatsSecond()), "amount", "" + diffSeconds);
|
||||
} else {
|
||||
info += StringUtils.getInstance().replacePlaceHolder(StringUtils.getInstance().replacePlaceHolder(
|
||||
Config.getInstance().getFormatCommandsVoteLastTimeFormat(), "TimeType",
|
||||
Config.getInstance().getFormatTimeFormatsSeconds()), "amount", "" + diffSeconds);
|
||||
}
|
||||
|
||||
info = StringUtils.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getFormatCommandsVoteLastLastVoted(), "times", info);
|
||||
|
||||
return info;
|
||||
}
|
||||
return Config.getInstance().getFormatCommandsVoteLastNeverVoted();
|
||||
}
|
||||
|
||||
public String voteCommandLastLine(User user, VoteSite voteSite) {
|
||||
String timeString = voteCommandLastDate(user, voteSite);
|
||||
String timeSince = voteCommandLastDuration(user, voteSite);
|
||||
|
||||
HashMap<String, String> placeholders = new HashMap<String, String>();
|
||||
placeholders.put("time", timeString);
|
||||
placeholders.put("SiteName", voteSite.getDisplayName());
|
||||
placeholders.put("timesince", timeSince);
|
||||
|
||||
return StringUtils.getInstance().replacePlaceHolder(Config.getInstance().getFormatCommandsVoteLastLine(),
|
||||
placeholders);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vote command next.
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
* @return the string[]
|
||||
*/
|
||||
public String[] voteCommandNext(User user) {
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
|
||||
String playerName = user.getPlayerName();
|
||||
|
||||
msg.add(StringUtils.getInstance().colorize(StringUtils.getInstance()
|
||||
.replaceIgnoreCase(config.getFormatCommandsVoteNextTitle(), "%player%", playerName)));
|
||||
|
||||
for (VoteSite voteSite : plugin.getVoteSites()) {
|
||||
|
||||
String msgLine = config.getFormatCommandsVoteNextLayout();
|
||||
|
||||
msgLine = StringUtils.getInstance().replaceIgnoreCase(msgLine, "%info%",
|
||||
voteCommandNextInfo(user, voteSite));
|
||||
|
||||
msgLine = StringUtils.getInstance().replaceIgnoreCase(msgLine, "%SiteName%", voteSite.getDisplayName());
|
||||
msg.add(StringUtils.getInstance().colorize(msgLine));
|
||||
|
||||
}
|
||||
return ArrayUtils.getInstance().convert(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vote command next info.
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
* @param voteSite
|
||||
* the vote site
|
||||
* @return the string
|
||||
*/
|
||||
public String voteCommandNextInfo(User user, VoteSite voteSite) {
|
||||
String info = new String();
|
||||
|
||||
long time = user.getTime(voteSite);
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime lastVote = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault());
|
||||
|
||||
if (!voteSite.isVoteDelayDaily()) {
|
||||
double votedelay = voteSite.getVoteDelay();
|
||||
if (votedelay == 0) {
|
||||
String errorMsg = config.getFormatCommandsVoteNextInfoError();
|
||||
info = errorMsg;
|
||||
} else {
|
||||
|
||||
LocalDateTime nextvote = lastVote.plusHours((long) votedelay);
|
||||
|
||||
if (time == 0 || now.isAfter(nextvote)) {
|
||||
info = config.getFormatCommandsVoteNextInfoCanVote();
|
||||
} else {
|
||||
Duration dur = Duration.between(now, nextvote);
|
||||
|
||||
long diffHours = dur.getSeconds() / (60 * 60);
|
||||
long diffMinutes = dur.getSeconds() / 60 - diffHours * 60;
|
||||
|
||||
String timeMsg = config.getFormatCommandsVoteNextInfoTime();
|
||||
timeMsg = StringUtils.getInstance().replaceIgnoreCase(timeMsg, "%hours%", Long.toString(diffHours));
|
||||
timeMsg = StringUtils.getInstance().replaceIgnoreCase(timeMsg, "%minutes%",
|
||||
Long.toString(diffMinutes));
|
||||
info = timeMsg;
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (lastVote.getDayOfYear() == now.getDayOfYear() && lastVote.getYear() == now.getYear()) {
|
||||
LocalDateTime midnight = LocalDateTime.now().plusDays(1).withHour(0).withMinute(0);
|
||||
Duration dur = Duration.between(now, midnight);
|
||||
|
||||
int diffHours = (int) (dur.getSeconds() / (60 * 60));
|
||||
long diffMinutes = dur.getSeconds() / 60 - diffHours * 60;
|
||||
|
||||
String timeMsg = config.getFormatCommandsVoteNextInfoVoteDelayDaily();
|
||||
timeMsg = StringUtils.getInstance().replaceIgnoreCase(timeMsg, "%hours%", Integer.toString(diffHours));
|
||||
timeMsg = StringUtils.getInstance().replaceIgnoreCase(timeMsg, "%minutes%", Long.toString(diffMinutes));
|
||||
info = timeMsg;
|
||||
|
||||
} else {
|
||||
info = config.getFormatCommandsVoteNextInfoCanVote();
|
||||
}
|
||||
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Vote command total.
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
* @return the string[]
|
||||
*/
|
||||
public String[] voteCommandTotal(User user) {
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
|
||||
int daily = user.getTotal(TopVoter.Daily);
|
||||
int weekly = user.getTotal(TopVoter.Weekly);
|
||||
int month = user.getTotal(TopVoter.Monthly);
|
||||
int all = user.getTotal(TopVoter.AllTime);
|
||||
|
||||
for (String s : config.getFormatCommandsVoteTotal()) {
|
||||
String str = StringUtils.getInstance().replaceIgnoreCase(s, "%DailyTotal%", "" + daily);
|
||||
str = StringUtils.getInstance().replaceIgnoreCase(str, "%WeeklyTotal%", "" + weekly);
|
||||
str = StringUtils.getInstance().replaceIgnoreCase(str, "%MonthlyTotal%", "" + month);
|
||||
str = StringUtils.getInstance().replaceIgnoreCase(str, "%AllTimeTotal%", "" + all);
|
||||
str = StringUtils.getInstance().replaceIgnoreCase(str, "%player%", user.getPlayerName());
|
||||
msg.add(str);
|
||||
}
|
||||
|
||||
msg = ArrayUtils.getInstance().colorize(msg);
|
||||
return ArrayUtils.getInstance().convert(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vote command total all.
|
||||
*
|
||||
* @return the string[]
|
||||
*/
|
||||
public String[] voteCommandTotalAll() {
|
||||
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
|
||||
ArrayList<String> uuids = UserManager.getInstance().getAllUUIDs();
|
||||
|
||||
int daily = 0;
|
||||
int weekly = 0;
|
||||
int month = 0;
|
||||
int all = 0;
|
||||
|
||||
for (String uuid : uuids) {
|
||||
User 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);
|
||||
}
|
||||
|
||||
for (String s : config.getFormatCommandsVoteTotalAll()) {
|
||||
String str = StringUtils.getInstance().replaceIgnoreCase(s, "%DailyTotal%", "" + daily);
|
||||
str = StringUtils.getInstance().replaceIgnoreCase(str, "%WeeklyTotal%", "" + weekly);
|
||||
str = StringUtils.getInstance().replaceIgnoreCase(str, "%MonthlyTotal%", "" + month);
|
||||
str = StringUtils.getInstance().replaceIgnoreCase(str, "%AllTimeTotal%", "" + all);
|
||||
msg.add(str);
|
||||
}
|
||||
|
||||
msg = ArrayUtils.getInstance().colorize(msg);
|
||||
return ArrayUtils.getInstance().convert(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vote help text.
|
||||
*
|
||||
* @param sender
|
||||
* the sender
|
||||
* @return the array list
|
||||
*/
|
||||
public ArrayList<TextComponent> voteHelpText(CommandSender sender) {
|
||||
ArrayList<TextComponent> texts = new ArrayList<TextComponent>();
|
||||
HashMap<String, TextComponent> unsorted = new HashMap<String, TextComponent>();
|
||||
texts.add(StringUtils.getInstance().stringToComp(config.getFormatCommandsVoteHelpTitle()));
|
||||
|
||||
boolean requirePerms = config.getFormatCommandsVoteHelpRequirePermission();
|
||||
|
||||
for (CommandHandler cmdHandle : plugin.getVoteCommand()) {
|
||||
if (cmdHandle.hasPerm(sender)) {
|
||||
unsorted.put(cmdHandle.getHelpLineCommand("/vote"), cmdHandle.getHelpLine("/vote"));
|
||||
} else if (!requirePerms) {
|
||||
unsorted.put(cmdHandle.getHelpLineCommand("/vote"), cmdHandle.getHelpLine("/vote"));
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<String> unsortedList = new ArrayList<String>();
|
||||
unsortedList.addAll(unsorted.keySet());
|
||||
Collections.sort(unsortedList, String.CASE_INSENSITIVE_ORDER);
|
||||
for (String cmd : unsortedList) {
|
||||
texts.add(unsorted.get(cmd));
|
||||
}
|
||||
return texts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Vote today.
|
||||
*
|
||||
* @return the string[]
|
||||
*/
|
||||
public String[] voteToday() {
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
for (User user : plugin.getVoteToday().keySet()) {
|
||||
|
||||
for (VoteSite voteSite : plugin.getVoteToday().get(user).keySet()) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(Config.getInstance().getFormatTimeFormat());
|
||||
String timeString = plugin.getVoteToday().get(user).get(voteSite).format(formatter);
|
||||
msg.add("&6" + user.getPlayerName() + " : " + voteSite.getKey() + " : " + timeString);
|
||||
}
|
||||
}
|
||||
msg = ArrayUtils.getInstance().colorize(msg);
|
||||
return ArrayUtils.getInstance().convert(msg);
|
||||
}
|
||||
|
||||
public String[] voteURLs(User user) {
|
||||
ArrayList<String> sites = new ArrayList<String>();
|
||||
|
||||
List<String> title = config.getFormatCommandsVoteText();
|
||||
if (title != null) {
|
||||
sites.addAll(title);
|
||||
}
|
||||
if (config.getFormatCommandsVoteAutoInputSites()) {
|
||||
int counter = 0;
|
||||
for (VoteSite voteSite : plugin.getVoteSites()) {
|
||||
counter++;
|
||||
String voteURL = voteSite.getVoteURL();
|
||||
String msg = config.getFormatCommandsVoteURLS();
|
||||
msg = StringUtils.getInstance().colorize(msg);
|
||||
msg = StringUtils.getInstance().replaceIgnoreCase(msg, "%num%", Integer.toString(counter));
|
||||
msg = StringUtils.getInstance().replaceIgnoreCase(msg, "%url%", voteURL);
|
||||
msg = StringUtils.getInstance().replaceIgnoreCase(msg, "%SiteName%", voteSite.getDisplayName());
|
||||
msg = StringUtils.getInstance().replaceIgnoreCase(msg, "%player%", user.getPlayerName());
|
||||
msg = StringUtils.getInstance().replacePlaceHolder(msg, "Next",
|
||||
"" + voteCommandNextInfo(user, voteSite));
|
||||
sites.add(msg);
|
||||
}
|
||||
}
|
||||
if (user != null) {
|
||||
HashMap<String, String> phs = new HashMap<String, String>();
|
||||
phs.put("DailyTotal", "" + user.getTotal(TopVoter.Daily));
|
||||
phs.put("WeekTotal", "" + user.getTotal(TopVoter.Weekly));
|
||||
phs.put("MonthTotal", "" + user.getTotal(TopVoter.Monthly));
|
||||
phs.put("Total", "" + user.getTotal(TopVoter.AllTime));
|
||||
|
||||
sites = ArrayUtils.getInstance().replacePlaceHolder(sites, phs);
|
||||
}
|
||||
sites = ArrayUtils.getInstance().colorize(sites);
|
||||
return ArrayUtils.getInstance().convert(sites);
|
||||
}
|
||||
|
||||
}
|
||||
-76
@@ -1,76 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Commands.Executers;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.CommandAPI.CommandHandler;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.ConfigVoteSites;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class CommandAdminVote.
|
||||
*/
|
||||
public class CommandAdminVote implements CommandExecutor {
|
||||
|
||||
/** The instance. */
|
||||
private static CommandAdminVote instance = new CommandAdminVote();
|
||||
|
||||
/**
|
||||
* Gets the single instance of CommandAdminVote.
|
||||
*
|
||||
* @return single instance of CommandAdminVote
|
||||
*/
|
||||
public static CommandAdminVote getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/** The config. */
|
||||
Config config = Config.getInstance();
|
||||
|
||||
/** The plugin. */
|
||||
private Main plugin = Main.plugin;
|
||||
|
||||
/** The vote sites. */
|
||||
ConfigVoteSites voteSites = ConfigVoteSites.getInstance();
|
||||
|
||||
/**
|
||||
* Instantiates a new command admin vote.
|
||||
*/
|
||||
private CommandAdminVote() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new command admin vote.
|
||||
*
|
||||
* @param plugin
|
||||
* the plugin
|
||||
*/
|
||||
public CommandAdminVote(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.bukkit.command.CommandExecutor#onCommand(org.bukkit.command.
|
||||
* CommandSender , org.bukkit.command.Command, java.lang.String,
|
||||
* java.lang.String[])
|
||||
*/
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
for (CommandHandler commandHandler : plugin.getAdminVoteCommand()) {
|
||||
if (commandHandler.runCommand(sender, args)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// invalid command
|
||||
sender.sendMessage(ChatColor.RED + "No valid arguments, see /adminvote help!");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,262 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Commands.GUI;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Util.EditGUI.EditGUI;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.EditGUI.EditGUIButton;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.EditGUI.EditGUIValueType;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Inventory.BInventory;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Inventory.BInventory.ClickEvent;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Inventory.BInventoryButton;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Item.ItemBuilder;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.PlayerUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.ValueRequest.InputMethod;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.ValueRequest.ValueRequest;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.ValueRequest.ValueRequestBuilder;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.ValueRequest.Listeners.StringListener;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.ConfigVoteSites;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.PlayerVoteEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.VoteSite;
|
||||
|
||||
public class AdminGUI {
|
||||
static AdminGUI instance = new AdminGUI();
|
||||
|
||||
/**
|
||||
* Gets the single instance of Commands.
|
||||
*
|
||||
* @return single instance of Commands
|
||||
*/
|
||||
public static AdminGUI getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/** The plugin. */
|
||||
Main plugin = Main.plugin;
|
||||
|
||||
/**
|
||||
* Instantiates a new commands.
|
||||
*/
|
||||
private AdminGUI() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Open admin GUI.
|
||||
*
|
||||
* @return ArrayList of buttons
|
||||
*/
|
||||
public ArrayList<BInventoryButton> adminGUIButtons() {
|
||||
ArrayList<BInventoryButton> buttons = new ArrayList<BInventoryButton>();
|
||||
buttons.add(new BInventoryButton("&cVoteSites",
|
||||
new String[] { "&cOnly enabled sites are listed in this section", "&cMiddle Click to create" },
|
||||
new ItemStack(Material.STONE)) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (event.getClick().equals(ClickType.MIDDLE)) {
|
||||
new ValueRequest().requestString(player, new StringListener() {
|
||||
|
||||
@Override
|
||||
public void onInput(Player player, String value) {
|
||||
ConfigVoteSites.getInstance().generateVoteSite(value);
|
||||
player.sendMessage("Generated site");
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
openAdminGUIVoteSites(player);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton("&cReload Plugin", new String[] {}, new ItemStack(Material.STONE, 1)) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
plugin.reload();
|
||||
}
|
||||
|
||||
});
|
||||
return buttons;
|
||||
}
|
||||
|
||||
public void loadHook() {
|
||||
for (BInventoryButton b : adminGUIButtons()) {
|
||||
com.Ben12345rocks.AdvancedCore.Commands.GUI.AdminGUI.getInstance().addButton(b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Open admin GUI vote sites.
|
||||
*
|
||||
* @param player
|
||||
* the player
|
||||
*/
|
||||
public void openAdminGUIVoteSites(Player player) {
|
||||
BInventory inv = new BInventory("VoteSites");
|
||||
int count = 0;
|
||||
for (VoteSite voteSite : plugin.getVoteSites()) {
|
||||
ArrayList<String> lore = new ArrayList<String>();
|
||||
lore.add("Priority: " + voteSite.getPriority());
|
||||
lore.add("Name: " + voteSite.getDisplayName());
|
||||
lore.add("ServiceSite: " + voteSite.getServiceSite());
|
||||
lore.add("VoteURL: " + voteSite.getVoteURL());
|
||||
lore.add("VoteDelay: " + voteSite.getVoteDelay());
|
||||
|
||||
inv.addButton(count, new BInventoryButton(voteSite.getKey(), ArrayUtils.getInstance().convert(lore),
|
||||
new ItemStack(Material.STONE)) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
Player player = event.getWhoClicked();
|
||||
openAdminGUIVoteSiteSite(player, voteSite);
|
||||
|
||||
}
|
||||
});
|
||||
count++;
|
||||
}
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open admin GUI vote site site.
|
||||
*
|
||||
* @param player
|
||||
* the player
|
||||
* @param voteSite
|
||||
* the vote site
|
||||
*/
|
||||
public void openAdminGUIVoteSiteSite(Player player, VoteSite voteSite) {
|
||||
EditGUI inv = new EditGUI("VoteSite: " + voteSite.getDisplayName());
|
||||
inv.setMeta(player, "VoteSite", voteSite);
|
||||
|
||||
inv.addButton(new BInventoryButton(voteSite.getItem().setName("&cForce vote")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
ArrayList<String> playerNames = new ArrayList<String>();
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
playerNames.add(p.getName());
|
||||
}
|
||||
new ValueRequestBuilder(new StringListener() {
|
||||
|
||||
@Override
|
||||
public void onInput(Player player, String value) {
|
||||
Object ob = PlayerUtils.getInstance().getPlayerMeta(player, "VoteSite");
|
||||
if (ob != null) {
|
||||
VoteSite site = (VoteSite) ob;
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(site, value, site.getServiceSite(), false);
|
||||
plugin.getServer().getPluginManager().callEvent(voteEvent);
|
||||
}
|
||||
}
|
||||
}, ArrayUtils.getInstance().convert(playerNames)).usingMethod(InputMethod.INVENTORY)
|
||||
.allowCustomOption(true).request(event.getWhoClicked());
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.DIAMOND), "Priority", voteSite.getPriority(),
|
||||
EditGUIValueType.NUMBER) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Object value) {
|
||||
VoteSite voteSite = (VoteSite) getMeta(player, "VoteSite");
|
||||
ConfigVoteSites.getInstance().setPriority(voteSite.getKey(), (int) value);
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.DIAMOND), "ServiceSite", voteSite.getServiceSite(),
|
||||
EditGUIValueType.STRING) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Object value) {
|
||||
VoteSite voteSite = (VoteSite) getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
ConfigVoteSites.getInstance().setServiceSite(siteName, (String) value);
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.DIAMOND), "Name", voteSite.getDisplayName(),
|
||||
EditGUIValueType.STRING) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Object value) {
|
||||
VoteSite voteSite = (VoteSite) getMeta(player, "VoteSite");
|
||||
ConfigVoteSites.getInstance().setDisplayName(voteSite.getKey(), (String) value);
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.DIAMOND), "VoteURL", voteSite.getVoteURL(),
|
||||
EditGUIValueType.STRING) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Object value) {
|
||||
VoteSite voteSite = (VoteSite) getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
ConfigVoteSites.getInstance().setVoteURL(siteName, (String) value);
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.DIAMOND), "VoteDelay", voteSite.getVoteDelay(),
|
||||
EditGUIValueType.NUMBER) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Object value) {
|
||||
VoteSite voteSite = (VoteSite) getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
ConfigVoteSites.getInstance().setVoteDelay(siteName, (int) value);
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.DIAMOND), "Enabled", voteSite.isEnabled(),
|
||||
EditGUIValueType.BOOLEAN) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Object value) {
|
||||
VoteSite voteSite = (VoteSite) getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
ConfigVoteSites.getInstance().setEnabled(siteName, (boolean) value);
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.DIAMOND), "ForceOffline", voteSite.isGiveOffline(),
|
||||
EditGUIValueType.BOOLEAN) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Object value) {
|
||||
VoteSite voteSite = (VoteSite) getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
ConfigVoteSites.getInstance().setForceOffline(siteName, (boolean) value);
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.DIAMOND), "VoteDelayDaily",
|
||||
voteSite.isVoteDelayDaily(), EditGUIValueType.BOOLEAN) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Object value) {
|
||||
VoteSite voteSite = (VoteSite) getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
ConfigVoteSites.getInstance().setVoteDelayDaily(siteName, (boolean) value);
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
}
|
||||
@@ -1,752 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Commands.GUI;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.AdvancedCoreHook;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardOptions;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Inventory.BInventory;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Inventory.BInventory.ClickEvent;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Inventory.BInventoryButton;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Item.ItemBuilder;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.MiscUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.PlayerUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.StringUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Commands.Commands;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.VoteSite;
|
||||
import com.Ben12345rocks.VotingPlugin.TopVoter.TopVoter;
|
||||
import com.Ben12345rocks.VotingPlugin.TopVoter.TopVoterHandler;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
|
||||
public class PlayerGUIs {
|
||||
static PlayerGUIs instance = new PlayerGUIs();
|
||||
|
||||
/**
|
||||
* Gets the single instance of Commands.
|
||||
*
|
||||
* @return single instance of Commands
|
||||
*/
|
||||
public static PlayerGUIs getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/** The plugin. */
|
||||
Main plugin = Main.plugin;
|
||||
|
||||
/**
|
||||
* Instantiates a new commands.
|
||||
*/
|
||||
private PlayerGUIs() {
|
||||
}
|
||||
|
||||
public ItemBuilder getBackButton() {
|
||||
ConfigurationSection sec = Config.getInstance().getBackButton();
|
||||
if (sec != null) {
|
||||
return new ItemBuilder(sec);
|
||||
}
|
||||
return new ItemBuilder(Material.PAPER, 1).setName("&8Back to VoteGUI");
|
||||
}
|
||||
|
||||
public User getSelectedPlayer(Player player) {
|
||||
User str = (User) PlayerUtils.getInstance().getPlayerMeta(player, "SelectedPlayerGUIs");
|
||||
return str;
|
||||
}
|
||||
|
||||
public void openVoteBest(Player player, User user) {
|
||||
setSelectedPlayer(player, user);
|
||||
BInventory inv = new BInventory(StringUtils.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getGUIVoteBestName(), "player", user.getPlayerName()));
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteBestDayBestItem())
|
||||
.addPlaceholder("Best", "" + user.getBestDayVoteStreak())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteBestWeekBestItem())
|
||||
.addPlaceholder("Best", "" + user.getBestWeekVoteStreak())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteBestMonthBestItem())
|
||||
.addPlaceholder("Best", "" + user.getBestMonthVoteStreak())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
public void openVoteGUI(Player player, User user) {
|
||||
if (user == null) {
|
||||
user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
setSelectedPlayer(player, user);
|
||||
}
|
||||
if ((!player.getName().equals(user.getPlayerName())
|
||||
&& !player.hasPermission("VotingPlugin.Commands.Vote.GUI.Other")
|
||||
&& !player.hasPermission("VotingPlugin.Mod"))
|
||||
|| (!player.hasPermission("VotingPlugin.Commands.Vote.GUI")
|
||||
&& !player.hasPermission("VotingPlugin.Player"))) {
|
||||
player.sendMessage(
|
||||
StringUtils.getInstance().colorize(AdvancedCoreHook.getInstance().getOptions().getFormatNoPerms()));
|
||||
return;
|
||||
}
|
||||
setSelectedPlayer(player, user);
|
||||
BInventory inv = new BInventory(StringUtils.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getGUIVoteGUIName(), "player", user.getPlayerName()));
|
||||
|
||||
for (String slot : Config.getInstance().getVoteGUISlots()) {
|
||||
ItemBuilder builder = new ItemBuilder(Config.getInstance().getVoteGUISlotSection(slot));
|
||||
|
||||
String[] lore = new String[1];
|
||||
|
||||
lore = ArrayUtils.getInstance().convert(Config.getInstance().getVoteGUISlotLore(slot));
|
||||
|
||||
if (lore.length == 0) {
|
||||
if (slot.equalsIgnoreCase("url")) {
|
||||
lore = Commands.getInstance().voteURLs(user);
|
||||
} else if (slot.equalsIgnoreCase("next")) {
|
||||
lore = Commands.getInstance().voteCommandNext(user);
|
||||
} else if (slot.equalsIgnoreCase("last")) {
|
||||
lore = Commands.getInstance().voteCommandLast(user);
|
||||
} else if (slot.equalsIgnoreCase("total")) {
|
||||
lore = Commands.getInstance().voteCommandTotal(user);
|
||||
} else if (slot.equalsIgnoreCase("top")) {
|
||||
String str = Config.getInstance().getVoteTopDefault();
|
||||
if (str.equalsIgnoreCase("monthly")) {
|
||||
lore = TopVoterHandler.getInstance().topVoterMonthly(1);
|
||||
} else if (str.equalsIgnoreCase("weekly")) {
|
||||
lore = TopVoterHandler.getInstance().topVoterWeekly(1);
|
||||
} else if (str.equalsIgnoreCase("daily")) {
|
||||
lore = TopVoterHandler.getInstance().topVoterDaily(1);
|
||||
} else {
|
||||
lore = TopVoterHandler.getInstance().topVoterAllTime(1);
|
||||
}
|
||||
} else if (slot.equalsIgnoreCase("today")) {
|
||||
lore = Commands.getInstance().voteToday();
|
||||
} else if (slot.equalsIgnoreCase("help")) {
|
||||
lore = new String[] { "Click to view help" };
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<String, String> placeholders = new HashMap<String, String>();
|
||||
placeholders.put("points", "" + user.getPoints());
|
||||
|
||||
builder.setPlaceholders(placeholders);
|
||||
builder.setLore(ArrayUtils.getInstance().convert(lore));
|
||||
|
||||
inv.addButton(new BInventoryButton(builder) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Player player = event.getWhoClicked();
|
||||
String cmd = Config.getInstance().getVoteGUISlotCommand(slot);
|
||||
User user = getSelectedPlayer(player);
|
||||
if (!cmd.equals("")) {
|
||||
player.performCommand(cmd);
|
||||
} else {
|
||||
if (slot.equalsIgnoreCase("url")) {
|
||||
openVoteURL(player);
|
||||
} else if (slot.equalsIgnoreCase("next")) {
|
||||
openVoteNext(player, user);
|
||||
} else if (slot.equalsIgnoreCase("last")) {
|
||||
openVoteLast(player, user);
|
||||
} else if (slot.equalsIgnoreCase("total")) {
|
||||
openVoteTotal(player, user);
|
||||
} else if (slot.equalsIgnoreCase("top")) {
|
||||
openVoteTop(player, null);
|
||||
} else if (slot.equalsIgnoreCase("today")) {
|
||||
openVoteToday(player);
|
||||
} else if (slot.equalsIgnoreCase("help")) {
|
||||
player.performCommand("vote help");
|
||||
} else if (slot.equalsIgnoreCase("shop")) {
|
||||
openVoteShop(player);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
public void openVoteLast(Player player, User user) {
|
||||
setSelectedPlayer(player, user);
|
||||
BInventory inv = new BInventory(StringUtils.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getGUIVoteLastName(), "player", user.getPlayerName()));
|
||||
for (VoteSite site : plugin.getVoteSites()) {
|
||||
inv.addButton(inv.getNextSlot(), new BInventoryButton(site.getItem().setName(site.getDisplayName())
|
||||
.setLore(Commands.getInstance().voteCommandLastLine(user, site)).setAmountNone(1)) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (Config.getInstance().getGUIVoteLastBackButton()) {
|
||||
inv.addButton(new BInventoryButton(getBackButton()) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
openVoteGUI(event.getPlayer(), getSelectedPlayer(event.getPlayer()));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
public void openVoteNext(Player player, User user) {
|
||||
setSelectedPlayer(player, user);
|
||||
BInventory inv = new BInventory(StringUtils.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getGUIVoteNextName(), "player", user.getPlayerName()));
|
||||
for (VoteSite site : plugin.getVoteSites()) {
|
||||
inv.addButton(inv.getNextSlot(), new BInventoryButton(site.getItem().setName(site.getDisplayName())
|
||||
.setLore(Commands.getInstance().voteCommandNextInfo(user, site)).setAmountNone(1)) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (Config.getInstance().getGUIVoteNextBackButton()) {
|
||||
inv.addButton(new BInventoryButton(getBackButton()) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
openVoteGUI(event.getPlayer(), getSelectedPlayer(event.getPlayer()));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
public void openVoteShop(Player player) {
|
||||
if (!Config.getInstance().getVoteShopEnabled()) {
|
||||
player.sendMessage(StringUtils.getInstance().colorize("&cVote shop disabled"));
|
||||
return;
|
||||
}
|
||||
|
||||
BInventory inv = new BInventory(Config.getInstance().getVoteShopName());
|
||||
|
||||
for (final String identifier : Config.getInstance().getIdentifiers()) {
|
||||
|
||||
String perm = Config.getInstance().getVoteShopPermission(identifier);
|
||||
boolean hasPerm = false;
|
||||
if (perm.isEmpty()) {
|
||||
hasPerm = true;
|
||||
} else {
|
||||
hasPerm = player.hasPermission(perm);
|
||||
}
|
||||
|
||||
int limit = Config.getInstance().getIdentifierLimit(identifier);
|
||||
|
||||
boolean limitPass = true;
|
||||
if (limit > 0) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
if (user.getVoteShopIdentifierLimit(identifier) >= limit) {
|
||||
limitPass = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasPerm && limitPass) {
|
||||
ItemBuilder builder = new ItemBuilder(Config.getInstance().getIdentifierSection(identifier));
|
||||
|
||||
inv.addButton(new BInventoryButton(builder) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Player player = event.getWhoClicked();
|
||||
|
||||
User user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
user.clearCache();
|
||||
String identifier = (String) getData("identifier");
|
||||
int limit = (int) getData("Limit");
|
||||
int points = Config.getInstance().getIdentifierCost(identifier);
|
||||
if (identifier != null) {
|
||||
|
||||
// limit fail-safe, should never be needed, except in rare cases
|
||||
boolean limitPass = true;
|
||||
if (limit > 0) {
|
||||
if (user.getVoteShopIdentifierLimit(identifier) >= limit) {
|
||||
limitPass = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (limitPass) {
|
||||
HashMap<String, String> placeholders = new HashMap<String, String>();
|
||||
placeholders.put("identifier", identifier);
|
||||
placeholders.put("points", "" + points);
|
||||
placeholders.put("limit", "" + limit);
|
||||
if (user.removePoints(points)) {
|
||||
|
||||
RewardHandler.getInstance().giveReward(user, Config.getInstance().getData(),
|
||||
Config.getInstance().getIdentifierRewardsPath(identifier),
|
||||
new RewardOptions().setPlaceholders(placeholders));
|
||||
|
||||
user.sendMessage(StringUtils.getInstance().replacePlaceHolder(
|
||||
Config.getInstance().getFormatShopPurchaseMsg(), placeholders));
|
||||
if (limit > 0) {
|
||||
user.setVoteShopIdentifierLimit(identifier,
|
||||
user.getVoteShopIdentifierLimit(identifier) + 1);
|
||||
}
|
||||
} else {
|
||||
user.sendMessage(StringUtils.getInstance().replacePlaceHolder(
|
||||
Config.getInstance().getFormatShopFailedMsg(), placeholders));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}.addData("identifier", identifier).addData("Limit", limit));
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.getInstance().getVoteShopBackButton()) {
|
||||
inv.addButton(new BInventoryButton(PlayerGUIs.getInstance().getBackButton()) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
PlayerGUIs.getInstance().openVoteGUI(event.getPlayer(),
|
||||
UserManager.getInstance().getVotingPluginUser(player));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
public void openVoteStreak(Player player, User user) {
|
||||
setSelectedPlayer(player, user);
|
||||
BInventory inv = new BInventory(StringUtils.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getGUIVoteStreakName(), "player", user.getPlayerName()));
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteStreakCurrentDayStreakItem())
|
||||
.addPlaceholder("Streak", "" + user.getDayVoteStreak())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteStreakCurrentWeekStreakItem())
|
||||
.addPlaceholder("Streak", "" + user.getWeekVoteStreak())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(
|
||||
new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteStreakCurrentMonthStreakItem())
|
||||
.addPlaceholder("Streak", "" + user.getMonthVoteStreak())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteStreakHighestDayStreakItem())
|
||||
.addPlaceholder("Streak", "" + user.getBestDayVoteStreak())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteStreakHighestWeekStreakItem())
|
||||
.addPlaceholder("Streak", "" + user.getBestWeekVoteStreak())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(
|
||||
new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteStreakHighestMonthStreakItem())
|
||||
.addPlaceholder("Streak", "" + user.getBestMonthVoteStreak())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if (Config.getInstance().getGUIVoteStreakBackButton()) {
|
||||
inv.addButton(new BInventoryButton(getBackButton()) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
openVoteGUI(event.getPlayer(), getSelectedPlayer(event.getPlayer()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
public void openVoteToday(Player player) {
|
||||
setSelectedPlayer(player, null);
|
||||
BInventory inv = new BInventory(Config.getInstance().getGUIVoteTodayName());
|
||||
for (User user : plugin.getVoteToday().keySet()) {
|
||||
|
||||
for (VoteSite voteSite : plugin.getVoteToday().get(user).keySet()) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(Config.getInstance().getFormatTimeFormat());
|
||||
String timeString = plugin.getVoteToday().get(user).get(voteSite).format(formatter);
|
||||
String msg = "&6" + voteSite.getDisplayName() + " : " + timeString;
|
||||
inv.addButton(inv.getNextSlot(), new BInventoryButton(user.getPlayerName(), new String[] { msg },
|
||||
MiscUtils.getInstance().setSkullOwner(user.getOfflinePlayer())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
User user = UserManager.getInstance()
|
||||
.getVotingPluginUser(clickEvent.getClickedItem().getItemMeta().getDisplayName());
|
||||
openVoteGUI(player, user);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.getInstance().getGUIVoteTodayBackButton()) {
|
||||
inv.addButton(new BInventoryButton(getBackButton()) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
openVoteGUI(event.getPlayer(), getSelectedPlayer(event.getPlayer()));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
public void openVoteTop(Player player, TopVoter top) {
|
||||
if (top == null) {
|
||||
top = TopVoter.getDefault();
|
||||
}
|
||||
Set<Entry<User, Integer>> users = null;
|
||||
|
||||
String topVoter = top.getName();
|
||||
users = plugin.getTopVoter(top).entrySet();
|
||||
|
||||
BInventory inv = new BInventory(StringUtils.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getGUIVoteTopName(), "topvoter", topVoter));
|
||||
|
||||
int pos = 1;
|
||||
for (Entry<User, Integer> entry : users) {
|
||||
|
||||
inv.addButton(new BInventoryButton(
|
||||
new ItemBuilder(MiscUtils.getInstance().setSkullOwner(entry.getKey().getOfflinePlayer()))
|
||||
.setName(Config.getInstance().getGUIVoteTopItemName())
|
||||
.addLoreLine(Config.getInstance().getGUIVoteTopItemLore())
|
||||
.addPlaceholder("position", "" + pos)
|
||||
.addPlaceholder("player", entry.getKey().getPlayerName())
|
||||
.addPlaceholder("votes", "" + entry.getValue())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
// ItemBuilder item = new ItemBuilder(clickEvent.getClickedItem());
|
||||
// String name = ChatColor.stripColor(item.getName()).split(":")[1].trim();
|
||||
String name = (String) clickEvent.getButton().getData("player");
|
||||
|
||||
User user = UserManager.getInstance().getVotingPluginUser(name);
|
||||
openVoteGUI(player, user);
|
||||
}
|
||||
}.addData("player", entry.getKey().getPlayerName()));
|
||||
pos++;
|
||||
}
|
||||
|
||||
final TopVoter cur = top;
|
||||
inv.getPageButtons().add(new BInventoryButton(
|
||||
new ItemBuilder(Config.getInstance().getGUIVoteTopSwitchItem()).addPlaceholder("Top", topVoter)) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
if (!clickEvent.getClick().equals(ClickType.RIGHT)) {
|
||||
openVoteTop(player, cur.next());
|
||||
} else {
|
||||
openVoteTop(player, cur.prev());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (Config.getInstance().getGUIVoteTopBackButton()) {
|
||||
inv.getPageButtons().add(new BInventoryButton(getBackButton().setSlot(1)) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
openVoteGUI(event.getPlayer(), getSelectedPlayer(event.getPlayer()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
inv.setPages(true);
|
||||
inv.setMaxInvSize(Config.getInstance().getGUIVoteTopSize());
|
||||
inv.openInventory(player);
|
||||
|
||||
}
|
||||
|
||||
public void openVoteTotal(Player player, User user) {
|
||||
setSelectedPlayer(player, user);
|
||||
BInventory inv = new BInventory(StringUtils.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getGUIVoteTotalName(), "player", user.getPlayerName()));
|
||||
|
||||
for (TopVoter top : TopVoter.values()) {
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteTotalItem(top))
|
||||
.addPlaceholder("Total", "" + user.getTotal(top)).addPlaceholder("topvoter", top.getName())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (Config.getInstance().getGUIVoteTotalBackButton()) {
|
||||
inv.addButton(new BInventoryButton(getBackButton()) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
openVoteGUI(event.getPlayer(), getSelectedPlayer(event.getPlayer()));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vote URL.
|
||||
*
|
||||
* @param player
|
||||
* the player
|
||||
*/
|
||||
public void openVoteURL(Player player) {
|
||||
setSelectedPlayer(player, null);
|
||||
BInventory inv = new BInventory(Config.getInstance().getGUIVoteURLName());
|
||||
|
||||
User user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
|
||||
int count = 0;
|
||||
if (Config.getInstance().getVoteURLViewAllUrlsButtonEnabled()) {
|
||||
ItemBuilder builderAll = new ItemBuilder(
|
||||
Config.getInstance().getVoteURLAlreadyVotedAllUrlsButtonItemSection());
|
||||
if (user.canVoteAll()) {
|
||||
builderAll = new ItemBuilder(Config.getInstance().getVoteURLCanVoteAllUrlsButtonItemSection());
|
||||
}
|
||||
|
||||
if (!builderAll.hasCustomDisplayName()) {
|
||||
builderAll.setName("&4All Voting Sites");
|
||||
}
|
||||
if (!builderAll.hasCustomLore()) {
|
||||
builderAll.setLore("&cClick Me");
|
||||
}
|
||||
|
||||
inv.addButton(count, new BInventoryButton(builderAll) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(event.getPlayer());
|
||||
user.sendMessage(Commands.getInstance().voteURLs(user));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
for (final VoteSite voteSite : plugin.getVoteSites()) {
|
||||
ItemBuilder builder = new ItemBuilder(Config.getInstance().getVoteURLAlreadyVotedItemSection());
|
||||
if (user.canVoteSite(voteSite)) {
|
||||
builder = new ItemBuilder(Config.getInstance().getVoteURLCanVoteItemSection());
|
||||
} else {
|
||||
builder.addLoreLine(Config.getInstance().getVoteURLNextVote().replace("%Info%",
|
||||
Commands.getInstance().voteCommandNextInfo(user, voteSite)));
|
||||
}
|
||||
|
||||
builder.setName(Config.getInstance().getVoteURLSiteName().replace("%Name%", voteSite.getDisplayName()));
|
||||
|
||||
inv.addButton(count, new BInventoryButton(builder) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (player != null) {
|
||||
if (Config.getInstance().isCommandsVoteRewardFromVoteURL()
|
||||
&& event.getClick().equals(ClickType.RIGHT)) {
|
||||
voteReward(player, voteSite.getKey());
|
||||
} else {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
user.sendMessage(StringUtils.getInstance().replacePlaceHolder(StringUtils.getInstance()
|
||||
.replacePlaceHolder(StringUtils.getInstance().replacePlaceHolder(
|
||||
Config.getInstance().getGUIVoteURLURLText(), "voteurl",
|
||||
voteSite.getVoteURL()), "sitename", voteSite.getDisplayName()),
|
||||
"player", player.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
count++;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getGUIVoteURLBackButton()) {
|
||||
inv.addButton(new BInventoryButton(getBackButton()) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
openVoteGUI(event.getPlayer(), getSelectedPlayer(event.getPlayer()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
inv.openInventory(player);
|
||||
|
||||
}
|
||||
|
||||
public void openVoteURL(Player player, String voteSite) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
VoteSite site = plugin.getVoteSite(voteSite);
|
||||
BInventory inv = new BInventory(StringUtils.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getGUIVoteURLSiteName(), "site", site.getDisplayName()));
|
||||
inv.setMeta(player, "VoteSite", site);
|
||||
|
||||
inv.addButton(
|
||||
new BInventoryButton(new ItemBuilder(Material.BOW).setName("&4URL").addLoreLine("Click to see URL")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
VoteSite site = (VoteSite) clickEvent.getMeta("VoteSite");
|
||||
clickEvent.getWhoClicked().sendMessage(site.getVoteURL());
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.COMPASS).setName("&4Next Vote")
|
||||
.addLoreLine(Commands.getInstance().voteCommandNextInfo(user, site))) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
openVoteURL(clickEvent.getPlayer());
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.CLOCK).setName("&4Last Vote")
|
||||
.addLoreLine(Commands.getInstance().voteCommandLastLine(user, site))) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
openVoteURL(clickEvent.getPlayer());
|
||||
}
|
||||
});
|
||||
|
||||
if (Config.getInstance().getGUIVoteURLBackButton()) {
|
||||
inv.addButton(new BInventoryButton(getBackButton()) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
openVoteGUI(event.getPlayer(), getSelectedPlayer(event.getPlayer()));
|
||||
}
|
||||
});
|
||||
}
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
public void setSelectedPlayer(Player player, User user) {
|
||||
PlayerUtils.getInstance().setPlayerMeta(player, "SelectedPlayerGUIs", user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vote reward.
|
||||
*
|
||||
* @param player
|
||||
* the player
|
||||
* @param siteName
|
||||
* the site name
|
||||
*/
|
||||
public void voteReward(Player player, String siteName) {
|
||||
BInventory inv = new BInventory(Config.getInstance().getGUIVoteRewardName());
|
||||
|
||||
if ((siteName == null) || (siteName == "")) {
|
||||
for (VoteSite voteSite : plugin.getVoteSites()) {
|
||||
try {
|
||||
ItemBuilder builder = voteSite.getItem();
|
||||
|
||||
inv.addButton(new BInventoryButton(builder) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Player player = event.getWhoClicked();
|
||||
|
||||
voteReward(player, (String) getData("site"));
|
||||
}
|
||||
}.addData("site", voteSite.getKey()));
|
||||
} catch (Exception ex) {
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (String itemName : Config.getInstance().getVoteSiteItems(siteName)) {
|
||||
ItemBuilder builder = new ItemBuilder(Config.getInstance().getVoteSiteItemsSection(siteName, itemName));
|
||||
|
||||
inv.addButton(Config.getInstance().getVoteSiteItemsSlot(siteName, itemName),
|
||||
new BInventoryButton(builder) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.getInstance().isVoteRewardBackButton()) {
|
||||
inv.addButton(new BInventoryButton(getBackButton()) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
openVoteGUI(event.getPlayer(), getSelectedPlayer(event.getPlayer()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,256 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Signs.SignHandler;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class ServerData.
|
||||
*/
|
||||
public class ServerData {
|
||||
|
||||
/** The instance. */
|
||||
static ServerData instance = new ServerData();
|
||||
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
/**
|
||||
* Gets the single instance of ServerData.
|
||||
*
|
||||
* @return single instance of ServerData
|
||||
*/
|
||||
public static ServerData getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new server data.
|
||||
*/
|
||||
private ServerData() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new server data.
|
||||
*
|
||||
* @param plugin
|
||||
* the plugin
|
||||
*/
|
||||
public ServerData(Main plugin) {
|
||||
ServerData.plugin = plugin;
|
||||
}
|
||||
|
||||
public synchronized void addServiceSite(String site) {
|
||||
ArrayList<String> l = getServiceSites();
|
||||
if (!getServiceSites().contains(site)) {
|
||||
l.add(site);
|
||||
}
|
||||
setServiceSites(ArrayUtils.getInstance().removeDuplicates(l));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the sign.
|
||||
*
|
||||
* @param location
|
||||
* the location
|
||||
* @param data
|
||||
* the data
|
||||
* @param position
|
||||
* the position
|
||||
*/
|
||||
public void addSign(Location location, String data, int position) {
|
||||
|
||||
int count = nextSignNumber();
|
||||
|
||||
getData().set("Signs." + count + ".World", location.getWorld().getName());
|
||||
getData().set("Signs." + count + ".X", location.getBlockX());
|
||||
getData().set("Signs." + count + ".Y", location.getBlockY());
|
||||
getData().set("Signs." + count + ".Z", location.getBlockZ());
|
||||
getData().set("Signs." + count + ".Data", data);
|
||||
getData().set("Signs." + count + ".Position", position);
|
||||
saveData();
|
||||
plugin.getSigns().add(new SignHandler("" + count, getSignLocation("" + count), getSignData("" + count),
|
||||
getSignPosition("" + count)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the data.
|
||||
*
|
||||
* @return the data
|
||||
*/
|
||||
public ConfigurationSection getData() {
|
||||
ConfigurationSection data = com.Ben12345rocks.AdvancedCore.Data.ServerData.getInstance().getData()
|
||||
.getConfigurationSection("VotingPlugin");
|
||||
if (data == null) {
|
||||
com.Ben12345rocks.AdvancedCore.Data.ServerData.getInstance().getData().createSection("VotingPlugin");
|
||||
data = com.Ben12345rocks.AdvancedCore.Data.ServerData.getInstance().getData()
|
||||
.getConfigurationSection("VotingPlugin");
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ArrayList<String> getServiceSites() {
|
||||
return (ArrayList<String>) getData().getList("ServiceSites", new ArrayList<String>());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sign data.
|
||||
*
|
||||
* @param sign
|
||||
* the sign
|
||||
* @return the sign data
|
||||
*/
|
||||
public String getSignData(String sign) {
|
||||
return getData().getString("Signs." + sign + ".Data");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sign location.
|
||||
*
|
||||
* @param sign
|
||||
* the sign
|
||||
* @return the sign location
|
||||
*/
|
||||
public Location getSignLocation(String sign) {
|
||||
return new Location(Bukkit.getWorld(getData().getString("Signs." + sign + ".World")),
|
||||
getData().getDouble("Signs." + sign + ".X"), getData().getDouble("Signs." + sign + ".Y"),
|
||||
getData().getDouble("Signs." + sign + ".Z"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sign position.
|
||||
*
|
||||
* @param sign
|
||||
* the sign
|
||||
* @return the sign position
|
||||
*/
|
||||
public int getSignPosition(String sign) {
|
||||
return getData().getInt("Signs." + sign + ".Position");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the signs.
|
||||
*
|
||||
* @return the signs
|
||||
*/
|
||||
public Set<String> getSigns() {
|
||||
try {
|
||||
return getData().getConfigurationSection("Signs").getKeys(false);
|
||||
} catch (Exception ex) {
|
||||
return new HashSet<String>();
|
||||
}
|
||||
}
|
||||
|
||||
public int getVotePartyExtraRequired() {
|
||||
return getData().getInt("VotePartyExtraRequired", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Next sign number.
|
||||
*
|
||||
* @return the int
|
||||
*/
|
||||
public int nextSignNumber() {
|
||||
Set<String> signs = getSigns();
|
||||
|
||||
if (signs != null) {
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
if (!signs.contains(Integer.toString(i))) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload data.
|
||||
*/
|
||||
public void reloadData() {
|
||||
com.Ben12345rocks.AdvancedCore.Data.ServerData.getInstance().reloadData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the sign.
|
||||
*
|
||||
* @param sign
|
||||
* the sign
|
||||
*/
|
||||
public void removeSign(String sign) {
|
||||
getData().set("Signs." + sign + ".World", null);
|
||||
getData().set("Signs." + sign + ".X", null);
|
||||
getData().set("Signs." + sign + ".Y", null);
|
||||
getData().set("Signs." + sign + ".Z", null);
|
||||
getData().set("Signs." + sign + ".Data", null);
|
||||
getData().set("Signs." + sign + ".Position", null);
|
||||
getData().set("Signs." + sign, null);
|
||||
saveData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save data.
|
||||
*/
|
||||
public synchronized void saveData() {
|
||||
com.Ben12345rocks.AdvancedCore.Data.ServerData.getInstance().saveData();
|
||||
}
|
||||
|
||||
public void setServiceSites(ArrayList<String> list) {
|
||||
getData().set("ServiceSites", list);
|
||||
saveData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sign.
|
||||
*
|
||||
* @param count
|
||||
* the count
|
||||
* @param location
|
||||
* the location
|
||||
* @param data
|
||||
* the data
|
||||
* @param position
|
||||
* the position
|
||||
*/
|
||||
public void setSign(String count, Location location, String data, int position) {
|
||||
|
||||
getData().set("Signs." + count + ".World", location.getWorld().getName());
|
||||
int x = (int) location.getX();
|
||||
int z = (int) location.getZ();
|
||||
getData().set("Signs." + count + ".X", x);
|
||||
getData().set("Signs." + count + ".Y", location.getY());
|
||||
getData().set("Signs." + count + ".Z", z);
|
||||
getData().set("Signs." + count + ".Data", data);
|
||||
getData().set("Signs." + count + ".Position", position);
|
||||
saveData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the version.
|
||||
*/
|
||||
public void setVersion() {
|
||||
getData().set("Version", Bukkit.getVersion());
|
||||
saveData();
|
||||
}
|
||||
|
||||
public void setVotePartyExtraRequired(int value) {
|
||||
getData().set("VotePartyExtraRequired", value);
|
||||
saveData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update values.
|
||||
*/
|
||||
public void updateValues() {
|
||||
setVersion();
|
||||
}
|
||||
}
|
||||
-44
@@ -1,44 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Listeners;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandSendEvent;
|
||||
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Commands.CommandLoader;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class PlayerJoinEvent.
|
||||
*/
|
||||
public class PlayerCommandSendListener implements Listener {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static Main plugin;
|
||||
|
||||
public PlayerCommandSendListener(Main plugin) {
|
||||
PlayerCommandSendListener.plugin = plugin;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onTab(PlayerCommandSendEvent event) {
|
||||
ArrayList<String> removeCmds = new ArrayList<String>();
|
||||
ArrayList<String> whiteListed = new ArrayList<String>();
|
||||
for (String cmd : event.getCommands()) {
|
||||
if (CommandLoader.getInstance().isVotingPluginCommand(event.getPlayer(), cmd)) {
|
||||
if (!CommandLoader.getInstance().hasPermission(event.getPlayer(), cmd) && !whiteListed.contains(cmd)) {
|
||||
removeCmds.add(cmd);
|
||||
// plugin.debug("removed " + cmd);
|
||||
} else {
|
||||
removeCmds.remove(cmd);
|
||||
whiteListed.add(cmd);
|
||||
// plugin.debug("has " + cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
event.getCommands().removeAll(removeCmds);
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Listeners;
|
||||
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Signs.SignHandler;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class PlayerInteract.
|
||||
*/
|
||||
public class PlayerInteract implements Listener {
|
||||
|
||||
/** The plugin. */
|
||||
private static Main plugin;
|
||||
|
||||
/**
|
||||
* Instantiates a new player interact.
|
||||
*
|
||||
* @param plugin
|
||||
* the plugin
|
||||
*/
|
||||
public PlayerInteract(Main plugin) {
|
||||
PlayerInteract.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* On player interact.
|
||||
*
|
||||
* @param event
|
||||
* the event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
// plugin.debug("Checking for sign click");
|
||||
if (event.getClickedBlock().getState() instanceof Sign) {
|
||||
// plugin.debug(player.getName() + " right clicked a sign");
|
||||
for (SignHandler sign : plugin.getSigns()) {
|
||||
if (sign.isLocationSame(event.getClickedBlock().getLocation())) {
|
||||
// plugin.debug(player.getName() +
|
||||
// " right clicked a top voter sign, sending message");
|
||||
UserManager.getInstance().getVotingPluginUser(player).sendMessage(sign.getRightClickMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Listeners;
|
||||
|
||||
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.PlayerLoginEvent;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.AdvancedCoreHook;
|
||||
import com.Ben12345rocks.AdvancedCore.UserManager.UserStorage;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class PlayerJoinEvent.
|
||||
*/
|
||||
public class PlayerJoinEvent implements Listener {
|
||||
|
||||
/** The plugin. */
|
||||
private static Main plugin;
|
||||
|
||||
/**
|
||||
* Instantiates a new player join event.
|
||||
*
|
||||
* @param plugin
|
||||
* the plugin
|
||||
*/
|
||||
public PlayerJoinEvent(Main plugin) {
|
||||
PlayerJoinEvent.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* On player login.
|
||||
*
|
||||
* @param event
|
||||
* the event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||
plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (event.getPlayer() == null
|
||||
|| (AdvancedCoreHook.getInstance().getStorageType().equals(UserStorage.MYSQL)
|
||||
&& AdvancedCoreHook.getInstance().getMysql() == null)) {
|
||||
return;
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player != null) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
|
||||
// run remind
|
||||
user.loginMessage();
|
||||
|
||||
if (user.getData().hasData()) {
|
||||
// give offline vote (if they voted offline)
|
||||
user.offVote();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 20L);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Listeners;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.AdvancedCoreHook;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.PlayerUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.ConfigVoteSites;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.PlayerVoteEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.VoteSite;
|
||||
import com.Ben12345rocks.VotingPlugin.SpecialRewards.SpecialRewards;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
import com.Ben12345rocks.VotingPlugin.VoteParty.VoteParty;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class VotiferEvent.
|
||||
*/
|
||||
public class PlayerVoteListener implements Listener {
|
||||
|
||||
/** The config. */
|
||||
static Config config = Config.getInstance();
|
||||
|
||||
/** The config vote sites. */
|
||||
static ConfigVoteSites configVoteSites = ConfigVoteSites.getInstance();
|
||||
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
private static Object object = new Object();
|
||||
|
||||
/**
|
||||
* Instantiates a new votifer event.
|
||||
*
|
||||
* @param plugin
|
||||
* the plugin
|
||||
*/
|
||||
public PlayerVoteListener(Main plugin) {
|
||||
PlayerVoteListener.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* On votifer event.
|
||||
*
|
||||
* @param event
|
||||
* the event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onplayerVote(PlayerVoteEvent event) {
|
||||
String playerName = event.getPlayer();
|
||||
if (!PlayerUtils.getInstance().isValidUser(playerName)) {
|
||||
if (!config.isAllowUnjoined()) {
|
||||
plugin.getLogger().warning("Player " + playerName
|
||||
+ " has not joined before, disregarding vote, set AllowUnjoined to true to prevent this");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
VoteSite voteSite = event.getVoteSite();
|
||||
|
||||
// check valid service sites
|
||||
if (voteSite == null) {
|
||||
if (!Config.getInstance().isDisableNoServiceSiteMessage()) {
|
||||
plugin.getLogger().warning("No voting site with the service site: '" + event.getServiceSite() + "'");
|
||||
plugin.getLogger().warning(
|
||||
"Please read here on how to fix it: https://github.com/Ben12345rocks/VotingPlugin/wiki/Common-Problems");
|
||||
|
||||
ArrayList<String> services = new ArrayList<String>();
|
||||
for (VoteSite site : plugin.getVoteSites()) {
|
||||
services.add(site.getServiceSite());
|
||||
}
|
||||
plugin.getLogger()
|
||||
.warning("Current known service sites: " + ArrayUtils.getInstance().makeStringList(services));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
User user = UserManager.getInstance().getVotingPluginUser(playerName);
|
||||
user.updateName();
|
||||
|
||||
if (Config.getInstance().isClearCacheOnVote()) {
|
||||
user.clearCache();
|
||||
}
|
||||
|
||||
if (voteSite.isWaitUntilVoteDelay() && !user.canVoteSite(voteSite)) {
|
||||
plugin.getLogger().info(user.getPlayerName() + " must wait until votedelay is over, ignoring vote");
|
||||
return;
|
||||
}
|
||||
|
||||
synchronized (object) {
|
||||
|
||||
// vote party
|
||||
VoteParty.getInstance().vote(user, event.isRealVote());
|
||||
|
||||
// broadcast vote if enabled in config
|
||||
if (config.isBroadcastVotesEnabled()) {
|
||||
if (!Config.getInstance().getFormatBroadcastWhenOnline() || user.isOnline()) {
|
||||
voteSite.broadcastVote(user);
|
||||
}
|
||||
}
|
||||
|
||||
// update last vote time
|
||||
user.setTime(voteSite);
|
||||
|
||||
// check first vote rewards
|
||||
SpecialRewards.getInstance().checkFirstVote(user);
|
||||
|
||||
if (user.isReminded()) {
|
||||
user.setReminded(false);
|
||||
}
|
||||
|
||||
// check if player has voted on all sites in one day
|
||||
|
||||
if ((user.isOnline() || voteSite.isGiveOffline())
|
||||
&& AdvancedCoreHook.getInstance().getOptions().isProcessRewards()) {
|
||||
user.playerVote(voteSite, true, false);
|
||||
user.closeInv();
|
||||
} else {
|
||||
user.addOfflineVote(voteSite.getKey());
|
||||
plugin.debug(
|
||||
"Offline vote set for " + playerName + " (" + user.getUUID() + ") on " + voteSite.getKey());
|
||||
}
|
||||
|
||||
// add to total votes
|
||||
if (Config.getInstance().isCountFakeVotes() || event.isRealVote()) {
|
||||
if (Config.getInstance().isAddTotals()) {
|
||||
user.addTotal();
|
||||
user.addTotalDaily();
|
||||
user.addTotalWeekly();
|
||||
}
|
||||
user.addPoints();
|
||||
}
|
||||
|
||||
// other rewards
|
||||
SpecialRewards.getInstance().checkAllSites(user);
|
||||
SpecialRewards.getInstance().checkCumualativeVotes(user);
|
||||
SpecialRewards.getInstance().checkMilestone(user);
|
||||
}
|
||||
|
||||
plugin.setUpdate(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Listeners;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.PlayerUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.StringUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Data.ServerData;
|
||||
import com.Ben12345rocks.VotingPlugin.Signs.Signs;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class SignChange.
|
||||
*/
|
||||
public class SignChange implements Listener {
|
||||
|
||||
/** The plugin. */
|
||||
private static Main plugin;
|
||||
|
||||
/**
|
||||
* Instantiates a new sign change.
|
||||
*
|
||||
* @param plugin
|
||||
* the plugin
|
||||
*/
|
||||
public SignChange(Main plugin) {
|
||||
SignChange.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* On sign change.
|
||||
*
|
||||
* @param event
|
||||
* the event
|
||||
*/
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onSignChange(SignChangeEvent event) {
|
||||
if (event.getLine(0).equalsIgnoreCase("[VotingPlugin]")) {
|
||||
if (PlayerUtils.getInstance().hasServerPermission(event.getPlayer().getName(), "VotingPlugin.Sign.Create")
|
||||
|| PlayerUtils.getInstance().hasServerPermission(event.getPlayer().getName(),
|
||||
"VotingPlugin.Admin")) {
|
||||
String data = event.getLine(2);
|
||||
if (!data.equalsIgnoreCase("all") && !data.equalsIgnoreCase("monthly")
|
||||
&& !data.equalsIgnoreCase("weekly") && !data.equalsIgnoreCase("daily")) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
ServerData.getInstance().addSign(event.getBlock().getLocation(), event.getLine(2),
|
||||
Integer.parseInt(event.getLine(1)));
|
||||
event.getPlayer().sendMessage(StringUtils.getInstance().colorize("&aAdded sign!"));
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Signs.getInstance().updateSigns();
|
||||
}
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
event.getPlayer().sendMessage(StringUtils.getInstance().colorize("&cError on sign creation!"));
|
||||
ex.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
event.getPlayer()
|
||||
.sendMessage(StringUtils.getInstance().colorize(Config.getInstance().getFormatNoPerms()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Listeners;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.ConfigVoteSites;
|
||||
import com.Ben12345rocks.VotingPlugin.Data.ServerData;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.PlayerVoteEvent;
|
||||
import com.vexsoftware.votifier.model.Vote;
|
||||
import com.vexsoftware.votifier.model.VotifierEvent;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class VotiferEvent.
|
||||
*/
|
||||
public class VotiferEvent implements Listener {
|
||||
|
||||
/** The config. */
|
||||
static Config config = Config.getInstance();
|
||||
|
||||
/** The config vote sites. */
|
||||
static ConfigVoteSites configVoteSites = ConfigVoteSites.getInstance();
|
||||
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
/**
|
||||
* Instantiates a new votifer event.
|
||||
*
|
||||
* @param plugin
|
||||
* the plugin
|
||||
*/
|
||||
public VotiferEvent(Main plugin) {
|
||||
VotiferEvent.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* On votifer event.
|
||||
*
|
||||
* @param event
|
||||
* the event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onVotiferEvent(VotifierEvent event) {
|
||||
|
||||
Vote vote = event.getVote();
|
||||
final String voteSite = vote.getServiceName();
|
||||
final String voteUsername = vote.getUsername().trim();
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
ServerData.getInstance().addServiceSite(voteSite);
|
||||
}
|
||||
});
|
||||
|
||||
if (voteUsername.length() == 0) {
|
||||
plugin.getLogger().warning("No name from vote on " + voteSite);
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.getLogger().info("Recieved a vote from '" + voteSite + "' by player '" + voteUsername + "'!");
|
||||
|
||||
plugin.debug("PlayerUsername: " + voteUsername);
|
||||
plugin.debug("VoteSite: " + voteSite);
|
||||
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
String voteSiteName = plugin.getVoteSiteName(voteSite);
|
||||
|
||||
ArrayList<String> sites = configVoteSites.getVoteSitesNames();
|
||||
if (sites != null) {
|
||||
if (!sites.contains(voteSiteName) && Config.getInstance().isAutoCreateVoteSites()) {
|
||||
plugin.getLogger()
|
||||
.warning("VoteSite " + voteSiteName + " doe not exist, generaterating one...");
|
||||
ConfigVoteSites.getInstance().generateVoteSite(voteSiteName);
|
||||
}
|
||||
} else if (Config.getInstance().isAutoCreateVoteSites()) {
|
||||
plugin.getLogger().warning("VoteSite " + voteSiteName + " doe not exist, generaterating one...");
|
||||
ConfigVoteSites.getInstance().generateVoteSite(voteSiteName);
|
||||
}
|
||||
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(plugin.getVoteSite(voteSiteName), voteUsername,
|
||||
voteSite, true);
|
||||
plugin.getServer().getPluginManager().callEvent(voteEvent);
|
||||
|
||||
if (voteEvent.isCancelled()) {
|
||||
plugin.debug("Vote cancelled");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,809 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Objects;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.AdvancedCoreHook;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardBuilder;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardOptions;
|
||||
import com.Ben12345rocks.AdvancedCore.UserManager.UUID;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.MiscUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.StringUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.ConfigVoteSites;
|
||||
import com.Ben12345rocks.VotingPlugin.SpecialRewards.SpecialRewards;
|
||||
import com.Ben12345rocks.VotingPlugin.TopVoter.TopVoter;
|
||||
import com.Ben12345rocks.VotingPlugin.VoteParty.VoteParty;
|
||||
import com.Ben12345rocks.VotingPlugin.VoteReminding.VoteReminding;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class User.
|
||||
*/
|
||||
public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
/**
|
||||
* Instantiates a new user.
|
||||
*
|
||||
* @param player
|
||||
* the player
|
||||
*/
|
||||
@Deprecated
|
||||
public User(Player player) {
|
||||
super(plugin, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new user.
|
||||
*
|
||||
* @param playerName
|
||||
* the player name
|
||||
*/
|
||||
@Deprecated
|
||||
public User(String playerName) {
|
||||
super(plugin, playerName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new user.
|
||||
*
|
||||
* @param uuid
|
||||
* the uuid
|
||||
*/
|
||||
@Deprecated
|
||||
public User(UUID uuid) {
|
||||
super(plugin, uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new user.
|
||||
*
|
||||
* @param uuid
|
||||
* the uuid
|
||||
* @param loadName
|
||||
* the load name
|
||||
*/
|
||||
@Deprecated
|
||||
public User(UUID uuid, boolean loadName) {
|
||||
super(plugin, uuid, loadName);
|
||||
}
|
||||
|
||||
public void addAllTimeTotal() {
|
||||
setAllTimeTotal(getAllTimeTotal() + 1);
|
||||
}
|
||||
|
||||
public void addDayVoteStreak() {
|
||||
setDayVoteStreak(getDayVoteStreak() + 1);
|
||||
}
|
||||
|
||||
public void addMonthTotal() {
|
||||
setMonthTotal(getMonthTotal() + 1);
|
||||
}
|
||||
|
||||
public void addMonthVoteStreak() {
|
||||
setMonthVoteStreak(getMonthVoteStreak() + 1);
|
||||
}
|
||||
|
||||
public void addOfflineOtherReward(String reward) {
|
||||
ArrayList<String> offlineOtherRewards = getOfflineOtherRewards();
|
||||
offlineOtherRewards.add(reward);
|
||||
setOfflineOtherRewards(offlineOtherRewards);
|
||||
}
|
||||
|
||||
public void addOfflineVote(String voteSiteName) {
|
||||
ArrayList<String> offlineVotes = getOfflineVotes();
|
||||
offlineVotes.add(voteSiteName);
|
||||
setOfflineVotes(offlineVotes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the points.
|
||||
*/
|
||||
public void addPoints() {
|
||||
int points = Config.getInstance().getPointsOnVote();
|
||||
if (points != 0) {
|
||||
addPoints(points);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the points.
|
||||
*
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
public void addPoints(int value) {
|
||||
setPoints(getPoints() + value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the total.
|
||||
*
|
||||
*/
|
||||
public void addTotal() {
|
||||
setMilestoneCount(getMilestoneCount() + 1);
|
||||
addMonthTotal();
|
||||
addAllTimeTotal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the total daily.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public void addTotalDaily() {
|
||||
setDailyTotal(getDailyTotal() + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the total weekly.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public void addTotalWeekly() {
|
||||
setWeeklyTotal(getWeeklyTotal() + 1);
|
||||
}
|
||||
|
||||
public void addWeekVoteStreak() {
|
||||
setWeekVoteStreak(getWeekVoteStreak() + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Can vote all.
|
||||
*
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean canVoteAll() {
|
||||
for (VoteSite voteSite : plugin.getVoteSites()) {
|
||||
boolean canVote = canVoteSite(voteSite);
|
||||
if (!canVote) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can vote site.
|
||||
*
|
||||
* @param voteSite
|
||||
* the vote site
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean canVoteSite(VoteSite voteSite) {
|
||||
|
||||
String siteName = voteSite.getKey();
|
||||
long time = getTime(voteSite);
|
||||
if (time == 0) {
|
||||
return true;
|
||||
}
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime lastVote = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault());
|
||||
|
||||
if (!voteSite.isVoteDelayDaily()) {
|
||||
int votedelay = ConfigVoteSites.getInstance().getVoteDelay(siteName);
|
||||
|
||||
if (votedelay == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LocalDateTime nextvote = lastVote.plusHours(votedelay);
|
||||
|
||||
return now.isAfter(nextvote);
|
||||
} else {
|
||||
if (now.getDayOfYear() != lastVote.getDayOfYear() || now.getYear() != lastVote.getYear()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Check all votes.
|
||||
*
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean checkAllVotes() {
|
||||
User user = this;
|
||||
|
||||
ArrayList<Integer> months = new ArrayList<Integer>();
|
||||
ArrayList<Integer> days = new ArrayList<Integer>();
|
||||
|
||||
for (VoteSite voteSite : plugin.getVoteSites()) {
|
||||
long time = user.getTime(voteSite);
|
||||
if (time != 0) {
|
||||
months.add(MiscUtils.getInstance().getMonthFromMili(time));
|
||||
days.add(MiscUtils.getInstance().getDayFromMili(time));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// check months
|
||||
for (int i = 0; i < months.size(); i++) {
|
||||
if (!months.get(0).equals(months.get(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// check days
|
||||
for (int i = 0; i < days.size(); i++) {
|
||||
if (!days.get(0).equals(days.get(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void clearOfflineRewards() {
|
||||
setOfflineVotes(new ArrayList<String>());
|
||||
setOfflineRewards(new ArrayList<String>());
|
||||
setOfflineOtherRewards(new ArrayList<String>());
|
||||
}
|
||||
|
||||
public void clearTotals() {
|
||||
for (TopVoter top : TopVoter.values()) {
|
||||
resetTotals(top);
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int getAllTimeTotal() {
|
||||
return getUserData().getInt("AllTimeTotal");
|
||||
}
|
||||
|
||||
public int getBestDayVoteStreak() {
|
||||
return getData().getInt("BestDayVoteStreak");
|
||||
}
|
||||
|
||||
public int getBestMonthVoteStreak() {
|
||||
return getData().getInt("BestMonthVoteStreak");
|
||||
}
|
||||
|
||||
public int getBestWeekVoteStreak() {
|
||||
return getData().getInt("BestWeekVoteStreak");
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int getDailyTotal() {
|
||||
return getUserData().getInt("DailyTotal");
|
||||
}
|
||||
|
||||
public int getDayVoteStreak() {
|
||||
return getData().getInt("DayVoteStreak");
|
||||
}
|
||||
|
||||
public boolean getDisableBroadcast() {
|
||||
return getUserData().getBoolean("DisableBroadcast");
|
||||
}
|
||||
|
||||
public HashMap<String, Boolean> getHasGottenMilestone() {
|
||||
HashMap<String, Boolean> hasGottenMilestone = new HashMap<String, Boolean>();
|
||||
ArrayList<String> milestoneList = getUserData().getStringList("GottenMileStones");
|
||||
for (String str : milestoneList) {
|
||||
String[] data = str.split("//");
|
||||
if (data.length > 1) {
|
||||
boolean gotten = Boolean.parseBoolean(data[1]);
|
||||
hasGottenMilestone.put(data[0], gotten);
|
||||
}
|
||||
}
|
||||
return hasGottenMilestone;
|
||||
}
|
||||
|
||||
public int getHighestDailyTotal() {
|
||||
return getData().getInt("HighestDailyTotal");
|
||||
}
|
||||
|
||||
public int getHighestMonthlyTotal() {
|
||||
return getData().getInt("HighestMonthlyTotal");
|
||||
}
|
||||
|
||||
public int getHighestWeeklyTotal() {
|
||||
return getData().getInt("HighestWeeklyTotal");
|
||||
}
|
||||
|
||||
public int getLastMonthTotal() {
|
||||
return getData().getInt("LastMonthTotal");
|
||||
}
|
||||
|
||||
public HashMap<VoteSite, Long> getLastVotes() {
|
||||
HashMap<VoteSite, Long> lastVotes = new HashMap<VoteSite, Long>();
|
||||
ArrayList<String> LastVotesList = getUserData().getStringList("LastVotes");
|
||||
for (String str : LastVotesList) {
|
||||
String[] data = str.split("//");
|
||||
if (data.length > 1 && plugin.hasVoteSite(data[0])) {
|
||||
VoteSite site = plugin.getVoteSite(data[0]);
|
||||
if (site != null) {
|
||||
long time = 0;
|
||||
try {
|
||||
time = Long.parseLong(data[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
time = 0;
|
||||
plugin.debug("Not long: " + data[1]);
|
||||
}
|
||||
lastVotes.put(site, time);
|
||||
}
|
||||
}
|
||||
}
|
||||
return lastVotes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last vote times sorted.
|
||||
*
|
||||
* @return the last vote times sorted
|
||||
*/
|
||||
public HashMap<VoteSite, Long> getLastVoteTimesSorted() {
|
||||
LinkedHashMap<VoteSite, Long> times = new LinkedHashMap<VoteSite, Long>();
|
||||
|
||||
for (VoteSite voteSite : plugin.getVoteSites()) {
|
||||
times.put(voteSite, getTime(voteSite));
|
||||
}
|
||||
LinkedHashMap<VoteSite, Long> sorted = (LinkedHashMap<VoteSite, Long>) times.entrySet().stream()
|
||||
.sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
return sorted;
|
||||
}
|
||||
|
||||
public int getMilestoneCount() {
|
||||
return getData().getInt("MilestoneCount", getAllTimeTotal());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int getMonthTotal() {
|
||||
return getData().getInt("MonthTotal");
|
||||
}
|
||||
|
||||
public int getMonthVoteStreak() {
|
||||
return getData().getInt("MonthVoteStreak");
|
||||
}
|
||||
|
||||
public ArrayList<String> getOfflineOtherRewards() {
|
||||
return getUserData().getStringList("OfflineOtherRewards");
|
||||
}
|
||||
|
||||
public ArrayList<String> getOfflineVotes() {
|
||||
return getUserData().getStringList("OfflineVotes");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the points.
|
||||
*
|
||||
* @return the points
|
||||
*/
|
||||
public int getPoints() {
|
||||
return getUserData().getInt("Points");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the time.
|
||||
*
|
||||
* @param voteSite
|
||||
* the vote site
|
||||
* @return the time
|
||||
*/
|
||||
public long getTime(VoteSite voteSite) {
|
||||
HashMap<VoteSite, Long> lastVotes = getLastVotes();
|
||||
if (lastVotes.containsKey(voteSite)) {
|
||||
return lastVotes.get(voteSite);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getTotal(TopVoter top) {
|
||||
switch (top) {
|
||||
case AllTime:
|
||||
return getUserData().getInt("AllTimeTotal");
|
||||
case Daily:
|
||||
return getUserData().getInt("DailyTotal");
|
||||
case Monthly:
|
||||
return getData().getInt("MonthTotal");
|
||||
case Weekly:
|
||||
return getUserData().getInt("WeeklyTotal");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getVotePartyVotes() {
|
||||
return getUserData().getInt("VotePartyVotes");
|
||||
}
|
||||
|
||||
public int getVoteShopIdentifierLimit(String identifier) {
|
||||
return getData().getInt("VoteShopLimit" + identifier);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int getWeeklyTotal() {
|
||||
return getUserData().getInt("WeeklyTotal");
|
||||
}
|
||||
|
||||
public int getWeekVoteStreak() {
|
||||
return getData().getInt("WeekVoteStreak");
|
||||
}
|
||||
|
||||
public void giveDailyTopVoterAward(int place, String path) {
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getDailyAwardRewardsPath(path))
|
||||
.withPlaceHolder("place", "" + place).withPlaceHolder("topvoter", "Daily").send(this);
|
||||
}
|
||||
|
||||
public void giveMonthlyTopVoterAward(int place, String path) {
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getMonthlyAwardRewardsPath(path))
|
||||
.withPlaceHolder("place", "" + place).withPlaceHolder("topvoter", "Monthly").send(this);
|
||||
}
|
||||
|
||||
public void giveOfflineOtherRewards() {
|
||||
ArrayList<String> offlineRewards = getOfflineOtherRewards();
|
||||
for (String str : offlineRewards) {
|
||||
if (str.equalsIgnoreCase("FirstVote")) {
|
||||
SpecialRewards.getInstance().giveFirstVoteRewards(this, false);
|
||||
} else if (str.equalsIgnoreCase("AllSites")) {
|
||||
SpecialRewards.getInstance().giveAllSitesRewards(this, false);
|
||||
} else if (str.equalsIgnoreCase("VoteParty")) {
|
||||
VoteParty.getInstance().giveReward(this, false);
|
||||
} else if (str.contains("Cumulative")) {
|
||||
String st = str.substring("Cumulative".length());
|
||||
if (StringUtils.getInstance().isInt(st)) {
|
||||
int votesRequired = Integer.parseInt(st);
|
||||
if (votesRequired != 0) {
|
||||
if (Config.getInstance().getCumulativeRewardEnabled(votesRequired)) {
|
||||
SpecialRewards.getInstance().giveCumulativeVoteReward(this, false, votesRequired);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (str.contains("MileStone")) {
|
||||
String st = str.substring("MileStone".length());
|
||||
if (StringUtils.getInstance().isInt(st)) {
|
||||
int votesRequired = Integer.parseInt(st);
|
||||
if (votesRequired > 0) {
|
||||
if (Config.getInstance().getMilestoneRewardEnabled(votesRequired)) {
|
||||
SpecialRewards.getInstance().giveMilestoneVoteReward(this, true, votesRequired);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (str.contains("VoteStreak")) {
|
||||
String[] args = str.split("_");
|
||||
if (args.length > 2) {
|
||||
String type = args[1];
|
||||
String st = args[2];
|
||||
|
||||
if (Config.getInstance().getVoteStreakRewardEnabled(type, st)) {
|
||||
SpecialRewards.getInstance().giveVoteStreakReward(this, false, type, "" + st, -1);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
plugin.debug("Reward handle for " + str + " does not exist!");
|
||||
}
|
||||
|
||||
}
|
||||
if (!offlineRewards.isEmpty()) {
|
||||
setOfflineOtherRewards(new ArrayList<String>());
|
||||
}
|
||||
}
|
||||
|
||||
public void giveWeeklyTopVoterAward(int place, String path) {
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getWeeklyAwardRewardsPath(path))
|
||||
.withPlaceHolder("place", "" + place).withPlaceHolder("topvoter", "Weekly").send(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for gotten first vote.
|
||||
*
|
||||
* @return true if user got the first vote reward
|
||||
*/
|
||||
public boolean hasGottenFirstVote() {
|
||||
return getTotal(TopVoter.AllTime) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for gotten milestone.
|
||||
*
|
||||
* @param votesRequired
|
||||
* the votes required
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean hasGottenMilestone(int votesRequired) {
|
||||
HashMap<String, Boolean> hasGottenMilestone = getHasGottenMilestone();
|
||||
if (hasGottenMilestone.containsKey("" + votesRequired)) {
|
||||
return hasGottenMilestone.get("" + votesRequired);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isReminded() {
|
||||
return getUserData().getBoolean("Reminded");
|
||||
}
|
||||
|
||||
public boolean isTopVoterIgnore() {
|
||||
return getUserData().getBoolean("TopVoterIgnore");
|
||||
}
|
||||
|
||||
/**
|
||||
* Login message.
|
||||
*/
|
||||
public void loginMessage() {
|
||||
if (Config.getInstance().getVoteRemindingRemindOnLogin()) {
|
||||
VoteReminding.getInstance().runRemindLogin(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Off vote.
|
||||
*/
|
||||
public void offVote() {
|
||||
if (!AdvancedCoreHook.getInstance().getOptions().isProcessRewards()) {
|
||||
AdvancedCoreHook.getInstance().debug("Processing rewards is disabled");
|
||||
return;
|
||||
}
|
||||
AdvancedCoreHook.getInstance().extraDebug("Checking offline vote site votes");
|
||||
Player player = getPlayer();
|
||||
if (player != null) {
|
||||
boolean topVoterIngorePerm = player.hasPermission("VotingPlugin.TopVoter.Ignore");
|
||||
if (isTopVoterIgnore() != topVoterIngorePerm) {
|
||||
setTopVoterIgnore(topVoterIngorePerm);
|
||||
}
|
||||
ArrayList<String> offlineVotes = getOfflineVotes();
|
||||
// plugin.debug(ArrayUtils.getInstance().makeStringList(offlineVotes));
|
||||
if (offlineVotes.size() > 0) {
|
||||
sendVoteEffects(true);
|
||||
}
|
||||
|
||||
for (int i = 0; i < offlineVotes.size(); i++) {
|
||||
if (plugin.hasVoteSite(offlineVotes.get(i))) {
|
||||
plugin.debug("Giving offline site reward: " + offlineVotes.get(i));
|
||||
playerVote(plugin.getVoteSite(offlineVotes.get(i)), false, true);
|
||||
} else {
|
||||
plugin.debug("Site doesn't exist: " + offlineVotes.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
setOfflineVotes(new ArrayList<String>());
|
||||
|
||||
giveOfflineOtherRewards();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Player vote.
|
||||
*
|
||||
* @param voteSite
|
||||
* the vote site
|
||||
* @param online
|
||||
* the online
|
||||
* @param broadcast
|
||||
* the broadcast
|
||||
*/
|
||||
public void playerVote(VoteSite voteSite, boolean online, boolean broadcast) {
|
||||
if (Config.getInstance().getFormatBroadcastWhenOnline() && Config.getInstance().isBroadcastVotesEnabled()
|
||||
&& broadcast) {
|
||||
voteSite.broadcastVote(this);
|
||||
}
|
||||
voteSite.giveRewards(this, online);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the points.
|
||||
*
|
||||
* @param points
|
||||
* the points
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean removePoints(int points) {
|
||||
if (getPoints() >= points) {
|
||||
setPoints(getPoints() - points);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void resetTotals(TopVoter topVoter) {
|
||||
if (topVoter.equals(TopVoter.Monthly)) {
|
||||
setLastMonthTotal(getTotal(TopVoter.Monthly));
|
||||
}
|
||||
setTotal(topVoter, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send vote effects.
|
||||
*
|
||||
* @param online
|
||||
* the online
|
||||
*/
|
||||
public void sendVoteEffects(boolean online) {
|
||||
RewardHandler.getInstance().giveReward(this, Config.getInstance().getData(),
|
||||
Config.getInstance().getAnySiteRewardsPath(), new RewardOptions().setOnline(online));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setAllTimeTotal(int allTimeTotal) {
|
||||
getUserData().setInt("AllTimeTotal", allTimeTotal);
|
||||
}
|
||||
|
||||
public void setBestDayVoteStreak(int streak) {
|
||||
getData().setInt("BestDayVoteStreak", streak);
|
||||
}
|
||||
|
||||
public void setBestMonthVoteStreak(int streak) {
|
||||
getData().setInt("BestMonthVoteStreak", streak);
|
||||
}
|
||||
|
||||
public void setBestWeekVoteStreak(int streak) {
|
||||
getData().setInt("BestWeekVoteStreak", streak);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setDailyTotal(int total) {
|
||||
getUserData().setInt("DailyTotal", total);
|
||||
}
|
||||
|
||||
public void setDayVoteStreak(int streak) {
|
||||
getData().setInt("DayVoteStreak", streak);
|
||||
if (getBestDayVoteStreak() < streak) {
|
||||
setBestDayVoteStreak(streak);
|
||||
}
|
||||
}
|
||||
|
||||
public void setDisableBroadcast(boolean value) {
|
||||
getUserData().setBoolean("DisableBroadcast", value);
|
||||
}
|
||||
|
||||
public void setHasGotteMilestone(int votesRequired, boolean b) {
|
||||
HashMap<String, Boolean> hasGottenMilestone = getHasGottenMilestone();
|
||||
hasGottenMilestone.put("" + votesRequired, b);
|
||||
setHasGottenMilestone(hasGottenMilestone);
|
||||
}
|
||||
|
||||
public void setHasGottenMilestone(HashMap<String, Boolean> hasGottenMilestone) {
|
||||
ArrayList<String> data = new ArrayList<String>();
|
||||
for (Entry<String, Boolean> entry : hasGottenMilestone.entrySet()) {
|
||||
String str = entry.getKey() + "//" + entry.getValue().booleanValue();
|
||||
data.add(str);
|
||||
}
|
||||
getUserData().setStringList("GottenMileStones", data);
|
||||
}
|
||||
|
||||
public void setHighestDailyTotal(int total) {
|
||||
getData().setInt("HighestDailyTotal", total);
|
||||
}
|
||||
|
||||
public void setHighestMonthlyTotal(int total) {
|
||||
getData().setInt("HighestMonthlyTotal", total);
|
||||
}
|
||||
|
||||
public void setHighestWeeklyTotal(int total) {
|
||||
getData().setInt("HighestWeeklyTotal", total);
|
||||
}
|
||||
|
||||
public void setLastMonthTotal(int total) {
|
||||
getData().setInt("LastMonthTotal", total);
|
||||
}
|
||||
|
||||
public void setLastVotes(HashMap<VoteSite, Long> lastVotes) {
|
||||
ArrayList<String> data = new ArrayList<String>();
|
||||
for (Entry<VoteSite, Long> entry : lastVotes.entrySet()) {
|
||||
String str = entry.getKey().getKey() + "//" + entry.getValue().longValue();
|
||||
data.add(str);
|
||||
}
|
||||
getUserData().setStringList("LastVotes", data);
|
||||
}
|
||||
|
||||
public void setMilestoneCount(int value) {
|
||||
getData().setInt("MilestoneCount", value);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setMonthTotal(int total) {
|
||||
getData().setInt("MonthTotal", total);
|
||||
}
|
||||
|
||||
public void setMonthVoteStreak(int streak) {
|
||||
getData().setInt("MonthVoteStreak", streak);
|
||||
if (getBestMonthVoteStreak() < streak) {
|
||||
setBestMonthVoteStreak(streak);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOfflineOtherRewards(ArrayList<String> offlineOtherRewards) {
|
||||
getUserData().setStringList("OfflineOtherRewards", offlineOtherRewards);
|
||||
}
|
||||
|
||||
public void setOfflineVotes(ArrayList<String> offlineVotes) {
|
||||
getUserData().setStringList("OfflineVotes", offlineVotes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the points.
|
||||
*
|
||||
* @param value
|
||||
* the new points
|
||||
*/
|
||||
public void setPoints(int value) {
|
||||
getUserData().setInt("Points", value);
|
||||
}
|
||||
|
||||
public void setReminded(boolean reminded) {
|
||||
getUserData().setString("Reminded", "" + reminded);
|
||||
}
|
||||
|
||||
public void setTime(VoteSite voteSite) {
|
||||
setTime(voteSite, LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
|
||||
}
|
||||
|
||||
public void setTime(VoteSite voteSite, Long time) {
|
||||
HashMap<VoteSite, Long> lastVotes = getLastVotes();
|
||||
lastVotes.put(voteSite, time);
|
||||
setLastVotes(lastVotes);
|
||||
}
|
||||
|
||||
public void setTopVoterIgnore(boolean topVoterIgnore) {
|
||||
getUserData().setString("TopVoterIgnore", "" + topVoterIgnore);
|
||||
}
|
||||
|
||||
public void setTotal(TopVoter top, int value) {
|
||||
switch (top) {
|
||||
case AllTime:
|
||||
getUserData().setInt("AllTimeTotal", value);
|
||||
break;
|
||||
case Daily:
|
||||
getUserData().setInt("DailyTotal", value);
|
||||
break;
|
||||
case Monthly:
|
||||
getData().setInt("MonthTotal", value);
|
||||
break;
|
||||
case Weekly:
|
||||
getUserData().setInt("WeeklyTotal", value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void setVotePartyVotes(int value) {
|
||||
getUserData().setInt("VotePartyVotes", value);
|
||||
}
|
||||
|
||||
public void setVoteShopIdentifierLimit(String identifier, int value) {
|
||||
getData().setInt("VoteShopLimit" + identifier, value);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setWeeklyTotal(int total) {
|
||||
getUserData().setInt("WeeklyTotal", total);
|
||||
}
|
||||
|
||||
public void setWeekVoteStreak(int streak) {
|
||||
getData().setInt("WeekVoteStreak", streak);
|
||||
if (getBestWeekVoteStreak() < streak) {
|
||||
setBestWeekVoteStreak(streak);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean shouldBeReminded() {
|
||||
Player player = getPlayer();
|
||||
if (player != null) {
|
||||
if (player.hasPermission("VotingPlugin.NoRemind")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,191 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Objects;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardBuilder;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Item.ItemBuilder;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.MiscUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.StringUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.ConfigVoteSites;
|
||||
import com.Ben12345rocks.VotingPlugin.Data.ServerData;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* The Class VoteSite.
|
||||
*/
|
||||
public class VoteSite {
|
||||
|
||||
/** The config. */
|
||||
static Config config = Config.getInstance();
|
||||
|
||||
/** The config vote sites. */
|
||||
static ConfigVoteSites configVoteSites = ConfigVoteSites.getInstance();
|
||||
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private String voteURL;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private String serviceSite;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private String key;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private String displayName;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private double voteDelay;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean enabled;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean voteDelayDaily;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private int priority;
|
||||
|
||||
@Setter
|
||||
private ConfigurationSection item;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean giveOffline;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean waitUntilVoteDelay;
|
||||
|
||||
/**
|
||||
* Instantiates a new vote site.
|
||||
*
|
||||
* @param plugin
|
||||
* the plugin
|
||||
*/
|
||||
public VoteSite(Main plugin) {
|
||||
VoteSite.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new vote site.
|
||||
*
|
||||
* @param siteName
|
||||
* the site name
|
||||
*/
|
||||
public VoteSite(String siteName) {
|
||||
key = siteName.replace(".", "_");
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcast vote.
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
*/
|
||||
public void broadcastVote(User user) {
|
||||
if (!user.isVanished()) {
|
||||
String playerName = user.getPlayerName();
|
||||
String bc = StringUtils.getInstance().colorize(config.getFormatBroadCastMsg());
|
||||
HashMap<String, String> placeholders = new HashMap<String, String>();
|
||||
placeholders.put("player", playerName);
|
||||
placeholders.put("nickname",
|
||||
(user.getPlayer() != null) ? user.getPlayer().getDisplayName() : user.getPlayerName());
|
||||
placeholders.put("sitename", getDisplayName());
|
||||
placeholders.put("servicesite", getServiceSite());
|
||||
bc = StringUtils.getInstance().replacePlaceHolder(bc, placeholders);
|
||||
ArrayList<Player> players = new ArrayList<Player>();
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (!UserManager.getInstance().getVotingPluginUser(p).getDisableBroadcast()) {
|
||||
players.add(p);
|
||||
}
|
||||
}
|
||||
|
||||
MiscUtils.getInstance().broadcast(bc, players);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the item
|
||||
*/
|
||||
public ItemBuilder getItem() {
|
||||
if (item == null) {
|
||||
plugin.getLogger().warning("Invalid item section in site: " + key);
|
||||
return new ItemBuilder(Material.STONE, 1).setName("&cInvalid item for site: " + key)
|
||||
.setLore("&cInvalid item for site: " + key);
|
||||
} else {
|
||||
return new ItemBuilder(item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Give rewards.
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
* @param online
|
||||
* the online
|
||||
*/
|
||||
public void giveRewards(User user, boolean online) {
|
||||
new RewardBuilder(configVoteSites.getData(), configVoteSites.getRewardsPath(key)).setOnline(online)
|
||||
.withPlaceHolder("ServiceSite", getServiceSite()).withPlaceHolder("SiteName", getDisplayName())
|
||||
.withPlaceHolder("VoteDelay", "" + getVoteDelay()).withPlaceHolder("VoteURL", getVoteURL()).send(user);
|
||||
|
||||
new RewardBuilder(configVoteSites.getData(), configVoteSites.getEverySiteRewardPath()).setOnline(online)
|
||||
.withPlaceHolder("ServiceSite", getServiceSite()).withPlaceHolder("SiteName", getDisplayName())
|
||||
.withPlaceHolder("VoteDelay", "" + getVoteDelay()).withPlaceHolder("VoteURL", getVoteURL()).send(user);
|
||||
}
|
||||
|
||||
public boolean hasRewards() {
|
||||
return RewardHandler.getInstance().hasRewards(configVoteSites.getData(), configVoteSites.getRewardsPath(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* Inits the.
|
||||
*/
|
||||
public void init() {
|
||||
setVoteURL(configVoteSites.getVoteURL(key));
|
||||
setServiceSite(configVoteSites.getServiceSite(key));
|
||||
setVoteDelay(configVoteSites.getVoteDelay(key));
|
||||
setEnabled(configVoteSites.getVoteSiteEnabled(key));
|
||||
setPriority(configVoteSites.getPriority(key));
|
||||
displayName = configVoteSites.getDisplayName(key);
|
||||
if (displayName == null || displayName.equals("")) {
|
||||
displayName = key;
|
||||
}
|
||||
item = configVoteSites.getItem(key);
|
||||
voteDelayDaily = configVoteSites.getVoteSiteResetVoteDelayDaily(key);
|
||||
giveOffline = configVoteSites.getVoteSiteGiveOffline(key);
|
||||
waitUntilVoteDelay = configVoteSites.getWaitUntilVoteDelay(key);
|
||||
}
|
||||
|
||||
public boolean isVaidServiceSite() {
|
||||
return ArrayUtils.getInstance().containsIgnoreCase(ServerData.getInstance().getServiceSites(),
|
||||
getServiceSite());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Signs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Data.ServerData;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class Signs.
|
||||
*/
|
||||
public class Signs {
|
||||
|
||||
/** The instance. */
|
||||
static Signs instance = new Signs();
|
||||
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
/**
|
||||
* Gets the single instance of Signs.
|
||||
*
|
||||
* @return single instance of Signs
|
||||
*/
|
||||
public static Signs getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new signs.
|
||||
*/
|
||||
private Signs() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new signs.
|
||||
*
|
||||
* @param plugin
|
||||
* the plugin
|
||||
*/
|
||||
public Signs(Main plugin) {
|
||||
Signs.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sign from location.
|
||||
*
|
||||
* @param loc
|
||||
* the loc
|
||||
* @return the sign from location
|
||||
*/
|
||||
public String getSignFromLocation(Location loc) {
|
||||
for (String sign : ServerData.getInstance().getSigns()) {
|
||||
if (ServerData.getInstance().getSignLocation(sign).equals(loc)) {
|
||||
return sign;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load signs.
|
||||
*/
|
||||
public void loadSigns() {
|
||||
plugin.setSigns(new ArrayList<SignHandler>());
|
||||
for (String sign : ServerData.getInstance().getSigns()) {
|
||||
// plugin.getLogger().info("Loading sign " + sign);
|
||||
plugin.getSigns().add(new SignHandler(sign, ServerData.getInstance().getSignLocation(sign),
|
||||
ServerData.getInstance().getSignData(sign), ServerData.getInstance().getSignPosition(sign)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store signs.
|
||||
*/
|
||||
public void storeSigns() {
|
||||
for (SignHandler sign : plugin.getSigns()) {
|
||||
sign.storeSign();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update signs.
|
||||
*/
|
||||
public void updateSigns() {
|
||||
int time = 0;
|
||||
for (int i = plugin.getSigns().size() - 1; i >= 0; i--) {
|
||||
if (!plugin.getSigns().get(i).isValid()) {
|
||||
plugin.debug("Sign " + i + " invalid, removing from data.");
|
||||
plugin.getSigns().get(i).removeSign();
|
||||
plugin.getSigns().remove(i);
|
||||
} else {
|
||||
plugin.getSigns().get(i).updateLines();
|
||||
plugin.getSigns().get(i).updateSign(time);
|
||||
time += 5;
|
||||
}
|
||||
}
|
||||
|
||||
plugin.debug("Signs updated");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,318 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.SpecialRewards;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardBuilder;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardOptions;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.StringUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.ConfigVoteSites;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.PlayerSpecialRewardEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.SpecialRewardType;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.TopVoter.TopVoter;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class OtherVoteReward.
|
||||
*/
|
||||
public class SpecialRewards {
|
||||
|
||||
/** The config. */
|
||||
static Config config = Config.getInstance();
|
||||
|
||||
/** The config vote sites. */
|
||||
static ConfigVoteSites configVoteSites = ConfigVoteSites.getInstance();
|
||||
|
||||
/** The instance. */
|
||||
static SpecialRewards instance = new SpecialRewards();
|
||||
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
/**
|
||||
* Gets the single instance of OtherVoteReward.
|
||||
*
|
||||
* @return single instance of OtherVoteReward
|
||||
*/
|
||||
public static SpecialRewards getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new other vote reward.
|
||||
*/
|
||||
private SpecialRewards() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new other vote reward.
|
||||
*
|
||||
* @param plugin
|
||||
* the plugin
|
||||
*/
|
||||
public SpecialRewards(Main plugin) {
|
||||
SpecialRewards.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check all sites.
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean checkAllSites(User user) {
|
||||
boolean checkAllVotes = user.checkAllVotes();
|
||||
if (checkAllVotes) {
|
||||
giveAllSitesRewards(user, user.isOnline());
|
||||
}
|
||||
return checkAllVotes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check cumualative votes.
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean checkCumualativeVotes(User user) {
|
||||
boolean gotCumulative = false;
|
||||
Set<String> votes = Config.getInstance().getCumulativeVotes();
|
||||
for (String vote : votes) {
|
||||
if (StringUtils.getInstance().isInt(vote)) {
|
||||
int votesRequired = Integer.parseInt(vote);
|
||||
if (votesRequired != 0) {
|
||||
if (Config.getInstance().getCumulativeRewardEnabled(votesRequired)
|
||||
&& RewardHandler.getInstance().hasRewards(Config.getInstance().getData(),
|
||||
Config.getInstance().getCumulativeRewardsPath(votesRequired))) {
|
||||
int total = 0;
|
||||
if (Config.getInstance().getCumulativeVotesInSameDay(votesRequired)) {
|
||||
total = user.getTotal(TopVoter.Daily);
|
||||
} else if (Config.getInstance().getCumulativeVotesInSameWeek(votesRequired)) {
|
||||
total = user.getTotal(TopVoter.Weekly);
|
||||
} else {
|
||||
total = user.getTotal(TopVoter.AllTime);
|
||||
}
|
||||
|
||||
if ((total % votesRequired) == 0 && total != 0) {
|
||||
giveCumulativeVoteReward(user, user.isOnline(), votesRequired);
|
||||
gotCumulative = true;
|
||||
}
|
||||
|
||||
if (gotCumulative) {
|
||||
plugin.debug(user.getPlayerName() + " got cumulative " + votesRequired);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
plugin.debug("Invalid cumulative number: " + vote);
|
||||
}
|
||||
}
|
||||
return gotCumulative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check first vote.
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean checkFirstVote(User user) {
|
||||
if (RewardHandler.getInstance().hasRewards(Config.getInstance().getData(),
|
||||
Config.getInstance().getFirstVoteRewardsPath())) {
|
||||
if (!user.hasGottenFirstVote()) {
|
||||
giveFirstVoteRewards(user, user.isOnline());
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check milestone.
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean checkMilestone(User user) {
|
||||
boolean gotMilestone = false;
|
||||
Set<String> votes = Config.getInstance().getMilestoneVotes();
|
||||
for (String vote : votes) {
|
||||
if (StringUtils.getInstance().isInt(vote)) {
|
||||
int votesRequired = Integer.parseInt(vote);
|
||||
if (votesRequired != 0) {
|
||||
if (Config.getInstance().getMilestoneRewardEnabled(votesRequired)
|
||||
&& RewardHandler.getInstance().hasRewards(Config.getInstance().getData(),
|
||||
Config.getInstance().getMilestoneRewardsPath(votesRequired))) {
|
||||
|
||||
int userVotesTotal = user.getMilestoneCount();
|
||||
if (userVotesTotal >= votesRequired && !user.hasGottenMilestone(votesRequired)) {
|
||||
giveMilestoneVoteReward(user, user.isOnline(), votesRequired);
|
||||
user.setHasGotteMilestone(votesRequired, true);
|
||||
plugin.debug(user.getPlayerName() + " got milestone " + votesRequired);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
plugin.debug("Invalid milestone number: " + vote);
|
||||
}
|
||||
}
|
||||
return gotMilestone;
|
||||
}
|
||||
|
||||
public boolean checkVoteStreak(User user, String type) {
|
||||
boolean gotReward = false;
|
||||
|
||||
Set<String> streaks = Config.getInstance().getVoteStreakVotes(type);
|
||||
for (String streak : streaks) {
|
||||
String s = streak.replaceAll("-", "");
|
||||
boolean multiple = false;
|
||||
if (streak.contains("-")) {
|
||||
// multiple
|
||||
multiple = true;
|
||||
}
|
||||
if (StringUtils.getInstance().isInt(s)) {
|
||||
int streakRequired = Integer.parseInt(s);
|
||||
if (streakRequired != 0) {
|
||||
if (Config.getInstance().getVoteStreakRewardEnabled(type, streak)
|
||||
&& RewardHandler.getInstance().hasRewards(Config.getInstance().getData(),
|
||||
Config.getInstance().getVoteStreakRewardsPath(type, "" + streak))) {
|
||||
int curStreak = 0;
|
||||
if (type.equalsIgnoreCase("day")) {
|
||||
curStreak = user.getDayVoteStreak();
|
||||
} else if (type.equalsIgnoreCase("week")) {
|
||||
curStreak = user.getWeekVoteStreak();
|
||||
} else if (type.equalsIgnoreCase("month")) {
|
||||
curStreak = user.getMonthVoteStreak();
|
||||
}
|
||||
if (!multiple) {
|
||||
if (curStreak == streakRequired) {
|
||||
giveVoteStreakReward(user, user.isOnline(), type, "" + streakRequired, curStreak);
|
||||
gotReward = true;
|
||||
plugin.debug(
|
||||
user.getPlayerName() + " got VoteStreak " + streakRequired + " for " + type);
|
||||
}
|
||||
} else {
|
||||
if (curStreak != 0 && curStreak % streakRequired == 0) {
|
||||
giveVoteStreakReward(user, user.isOnline(), type, streakRequired + "-", curStreak);
|
||||
gotReward = true;
|
||||
plugin.debug(
|
||||
user.getPlayerName() + " got VoteStreak " + streakRequired + "* for " + type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return gotReward;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Give all sites rewards.
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
* @param online
|
||||
* the online
|
||||
*/
|
||||
public void giveAllSitesRewards(User user, boolean online) {
|
||||
PlayerSpecialRewardEvent event = new PlayerSpecialRewardEvent(user, SpecialRewardType.ALLSITE);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
RewardHandler.getInstance().giveReward(user, Config.getInstance().getData(),
|
||||
Config.getInstance().getAllSitesRewardPath(), new RewardOptions().setOnline(online));
|
||||
}
|
||||
|
||||
/**
|
||||
* Give cumulative vote reward.
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
* @param online
|
||||
* the online
|
||||
* @param cumulative
|
||||
* the cumulative
|
||||
*/
|
||||
public void giveCumulativeVoteReward(User user, boolean online, int cumulative) {
|
||||
PlayerSpecialRewardEvent event = new PlayerSpecialRewardEvent(user,
|
||||
SpecialRewardType.CUMMULATIVE.setAmount(cumulative));
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getCumulativeRewardsPath(cumulative))
|
||||
.setOnline(online).withPlaceHolder("Cumulative", "" + cumulative).send(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Give first vote rewards.
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
* @param online
|
||||
* the online
|
||||
*/
|
||||
public void giveFirstVoteRewards(User user, boolean online) {
|
||||
PlayerSpecialRewardEvent event = new PlayerSpecialRewardEvent(user, SpecialRewardType.FIRSTVOTE);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
RewardHandler.getInstance().giveReward(user, Config.getInstance().getData(),
|
||||
Config.getInstance().getFirstVoteRewardsPath(), new RewardOptions().setOnline(online));
|
||||
}
|
||||
|
||||
/**
|
||||
* Give milestone vote reward.
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
* @param online
|
||||
* the online
|
||||
* @param milestone
|
||||
* the milestone
|
||||
*/
|
||||
public void giveMilestoneVoteReward(User user, boolean online, int milestone) {
|
||||
PlayerSpecialRewardEvent event = new PlayerSpecialRewardEvent(user,
|
||||
SpecialRewardType.MILESTONE.setAmount(milestone));
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getMilestoneRewardsPath(milestone))
|
||||
.setOnline(online).withPlaceHolder("Milestone", "" + milestone).send(user);
|
||||
}
|
||||
|
||||
public void giveVoteStreakReward(User user, boolean online, String type, String string, int votes) {
|
||||
PlayerSpecialRewardEvent event = new PlayerSpecialRewardEvent(user,
|
||||
SpecialRewardType.VOTESTREAK.setType(type).setAmount(votes));
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getVoteStreakRewardsPath(type, string))
|
||||
.setOnline(online).withPlaceHolder("Type", type).withPlaceHolder("Streak", "" + votes).send(user);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.AdvancedCoreHook;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.PlayerVoteEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
|
||||
public class VoteTester {
|
||||
|
||||
private static VoteTester instance = new VoteTester();
|
||||
|
||||
public static VoteTester getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private Main plugin = Main.plugin;
|
||||
|
||||
public void testVotes(int amount, String name, String site) {
|
||||
long time1 = System.currentTimeMillis();
|
||||
ArrayList<Long> timesPerVote = new ArrayList<Long>();
|
||||
for (int i = 0; i < amount; i++) {
|
||||
long start1 = System.currentTimeMillis();
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(plugin.getVoteSite(site), name,
|
||||
plugin.getVoteSiteServiceSite(site), false);
|
||||
plugin.getServer().getPluginManager().callEvent(voteEvent);
|
||||
long start2 = System.currentTimeMillis();
|
||||
timesPerVote.add(start2 - start1);
|
||||
}
|
||||
long time2 = System.currentTimeMillis();
|
||||
long time = time2 - time1;
|
||||
long timeTotal = 0;
|
||||
for (Long t : timesPerVote) {
|
||||
timeTotal += t.longValue();
|
||||
}
|
||||
long timePerVoteAvg = timeTotal / timesPerVote.size();
|
||||
Main.plugin.getLogger()
|
||||
.info("Time to process votes (" + amount + "): " + time + " ms, average per vote " + timePerVoteAvg
|
||||
+ " ms. " + AdvancedCoreHook.getInstance().getStorageType() + ", "
|
||||
+ UserManager.getInstance().getAllUUIDs().size() + " users. "
|
||||
+ Main.plugin.getVoteSites().size() + " votesites");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.TopVoter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
|
||||
public enum TopVoter {
|
||||
AllTime, Monthly, Weekly, Daily;
|
||||
|
||||
public static TopVoter getDefault() {
|
||||
TopVoter top = getTopVoter(Config.getInstance().getVoteTopDefault());
|
||||
if (top != null) {
|
||||
return top;
|
||||
}
|
||||
return AllTime;
|
||||
}
|
||||
|
||||
public static TopVoter getTopVoter(String str) {
|
||||
for (TopVoter value : values()) {
|
||||
if (value.toString().equalsIgnoreCase(str)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return AllTime;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if (this.equals(TopVoter.Monthly)) {
|
||||
return Config.getInstance().getFormatTopVoterMonthly();
|
||||
} else if (this.equals(TopVoter.Weekly)) {
|
||||
return Config.getInstance().getFormatTopVoterWeekly();
|
||||
} else if (this.equals(TopVoter.Daily)) {
|
||||
return Config.getInstance().getFormatTopVoterDaily();
|
||||
} else {
|
||||
return Config.getInstance().getFormatTopVoterAllTime();
|
||||
}
|
||||
}
|
||||
|
||||
public TopVoter next() {
|
||||
ArrayList<TopVoter> list = new ArrayList<TopVoter>();
|
||||
if (Config.getInstance().getLoadTopVoterAllTime()) {
|
||||
list.add(TopVoter.AllTime);
|
||||
}
|
||||
if (Config.getInstance().getLoadTopVoterMonthly()) {
|
||||
list.add(TopVoter.Monthly);
|
||||
}
|
||||
if (Config.getInstance().getLoadTopVoterWeekly()) {
|
||||
list.add(TopVoter.Weekly);
|
||||
}
|
||||
if (Config.getInstance().getLoadTopVoterDaily()) {
|
||||
list.add(TopVoter.Daily);
|
||||
}
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (list.get(i).equals(this)) {
|
||||
int next = i + 1;
|
||||
if (next > list.size() - 1) {
|
||||
next = 0;
|
||||
}
|
||||
return TopVoter.values()[next];
|
||||
}
|
||||
}
|
||||
return TopVoter.AllTime;
|
||||
}
|
||||
|
||||
public TopVoter prev() {
|
||||
ArrayList<TopVoter> list = new ArrayList<TopVoter>();
|
||||
if (Config.getInstance().getLoadTopVoterAllTime()) {
|
||||
list.add(TopVoter.AllTime);
|
||||
}
|
||||
if (Config.getInstance().getLoadTopVoterMonthly()) {
|
||||
list.add(TopVoter.Monthly);
|
||||
}
|
||||
if (Config.getInstance().getLoadTopVoterWeekly()) {
|
||||
list.add(TopVoter.Weekly);
|
||||
}
|
||||
if (Config.getInstance().getLoadTopVoterDaily()) {
|
||||
list.add(TopVoter.Daily);
|
||||
}
|
||||
for (int i = list.size() - 1; i >= 0; i--) {
|
||||
if (list.get(i).equals(this)) {
|
||||
int prev = i - 1;
|
||||
if (prev < 0) {
|
||||
prev = list.size() - 1;
|
||||
}
|
||||
return TopVoter.values()[prev];
|
||||
}
|
||||
}
|
||||
return TopVoter.AllTime;
|
||||
}
|
||||
}
|
||||
@@ -1,592 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.TopVoter;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.AdvancedCoreHook;
|
||||
import com.Ben12345rocks.AdvancedCore.TimeChecker.Events.DateChangedEvent;
|
||||
import com.Ben12345rocks.AdvancedCore.TimeChecker.Events.DayChangeEvent;
|
||||
import com.Ben12345rocks.AdvancedCore.TimeChecker.Events.MonthChangeEvent;
|
||||
import com.Ben12345rocks.AdvancedCore.TimeChecker.Events.PreDateChangedEvent;
|
||||
import com.Ben12345rocks.AdvancedCore.TimeChecker.Events.WeekChangeEvent;
|
||||
import com.Ben12345rocks.AdvancedCore.UserManager.UUID;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.StringUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.YML.YMLFileHandler;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.SpecialRewards.SpecialRewards;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
|
||||
public class TopVoterHandler implements Listener {
|
||||
/** The instance. */
|
||||
static TopVoterHandler instance = new TopVoterHandler();
|
||||
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
/**
|
||||
* Gets the single instance of TopVoter.
|
||||
*
|
||||
* @return single instance of TopVoter
|
||||
*/
|
||||
public static TopVoterHandler getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new top voter.
|
||||
*/
|
||||
private TopVoterHandler() {
|
||||
}
|
||||
|
||||
public ArrayList<String> getTopVoterBlackList() {
|
||||
return Config.getInstance().getBlackList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Top voters weekly.
|
||||
*
|
||||
* @return the string[]
|
||||
*/
|
||||
|
||||
public String[] getTopVotersWeekly() {
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
ArrayList<User> users = plugin.convertSet(plugin.getTopVoter(TopVoter.Weekly).keySet());
|
||||
for (int i = 0; i < users.size(); i++) {
|
||||
String line = Config.getInstance().getFormatCommandVoteTopLine().replace("%num%", "" + (i + 1))
|
||||
.replace("%player%", users.get(i).getPlayerName())
|
||||
.replace("%votes%", "" + plugin.getTopVoter(TopVoter.Weekly).get(users.get(i)));
|
||||
msg.add(line);
|
||||
}
|
||||
msg = ArrayUtils.getInstance().colorize(msg);
|
||||
return ArrayUtils.getInstance().convert(msg);
|
||||
}
|
||||
|
||||
private HashMap<Integer, String> handlePlaces(Set<String> places) {
|
||||
HashMap<Integer, String> place = new HashMap<Integer, String>();
|
||||
for (String p : places) {
|
||||
String[] data = p.split("-");
|
||||
try {
|
||||
if (data.length > 1) {
|
||||
for (int i = Integer.parseInt(data[0]); i < Integer.parseInt(data[1]); i++) {
|
||||
place.put(i, p);
|
||||
}
|
||||
} else {
|
||||
place.put(Integer.parseInt(data[0]), p);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return place;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onDateChanged(DateChangedEvent event) {
|
||||
plugin.setUpdate(true);
|
||||
plugin.update();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onDayChange(DayChangeEvent event) {
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
if (user.getTotal(TopVoter.Daily) == 0 && user.getDayVoteStreak() != 0) {
|
||||
user.setDayVoteStreak(0);
|
||||
} else {
|
||||
user.addDayVoteStreak();
|
||||
SpecialRewards.getInstance().checkVoteStreak(user, "Day");
|
||||
}
|
||||
|
||||
if (user.getHighestDailyTotal() < user.getTotal(TopVoter.Daily)) {
|
||||
user.setHighestDailyTotal(user.getTotal(TopVoter.Daily));
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.getInstance().getStoreTopVotersDaily()) {
|
||||
plugin.debug("Storing TopVoters Daily");
|
||||
storeTopVoters(TopVoter.Daily);
|
||||
}
|
||||
|
||||
if (Config.getInstance().isEnableDailyRewards()) {
|
||||
HashMap<Integer, String> places = handlePlaces(Config.getInstance().getDailyPossibleRewardPlaces());
|
||||
int i = 0;
|
||||
int lastTotal = -1;
|
||||
for (User user : plugin.getTopVoter(TopVoter.Daily).keySet()) {
|
||||
if (!Config.getInstance().getTopVoterIgnorePermission() || !user.isTopVoterIgnore()) {
|
||||
if (Config.getInstance().getTopVoterAwardsTies()) {
|
||||
if (user.getTotal(TopVoter.Daily) != lastTotal) {
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
if (places.containsKey(i)) {
|
||||
user.giveDailyTopVoterAward(i, places.get(i));
|
||||
}
|
||||
}
|
||||
lastTotal = user.getTotal(TopVoter.Daily);
|
||||
}
|
||||
}
|
||||
resetTotals(TopVoter.Daily);
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onMonthChange(MonthChangeEvent event) {
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
if (user.getTotal(TopVoter.Monthly) == 0 && user.getMonthVoteStreak() != 0) {
|
||||
user.setMonthVoteStreak(0);
|
||||
} else {
|
||||
user.addMonthVoteStreak();
|
||||
SpecialRewards.getInstance().checkVoteStreak(user, "Month");
|
||||
}
|
||||
|
||||
if (user.getHighestMonthlyTotal() < user.getTotal(TopVoter.Monthly)) {
|
||||
user.setHighestMonthlyTotal(user.getTotal(TopVoter.Monthly));
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.getInstance().getStoreTopVotersMonthly()) {
|
||||
plugin.debug("Storing TopVoters Monthly");
|
||||
storeTopVoters(TopVoter.Monthly);
|
||||
}
|
||||
|
||||
if (Config.getInstance().isEnableMonthlyAwards()) {
|
||||
HashMap<Integer, String> places = handlePlaces(Config.getInstance().getMonthlyPossibleRewardPlaces());
|
||||
int i = 0;
|
||||
int lastTotal = -1;
|
||||
for (User user : plugin.getTopVoter(TopVoter.Monthly).keySet()) {
|
||||
|
||||
if (!Config.getInstance().getTopVoterIgnorePermission() || !user.isTopVoterIgnore()) {
|
||||
if (Config.getInstance().getTopVoterAwardsTies()) {
|
||||
if (user.getTotal(TopVoter.Monthly) != lastTotal) {
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
if (places.containsKey(i)) {
|
||||
user.giveMonthlyTopVoterAward(i, places.get(i));
|
||||
}
|
||||
}
|
||||
lastTotal = user.getTotal(TopVoter.Monthly);
|
||||
}
|
||||
}
|
||||
resetTotals(TopVoter.Monthly);
|
||||
|
||||
if (Config.getInstance().getResetMilestonesMonthly()) {
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
user.setMilestoneCount(0);
|
||||
user.setHasGottenMilestone(new HashMap<String, Boolean>());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onPreDateChanged(PreDateChangedEvent event) {
|
||||
plugin.setUpdate(true);
|
||||
plugin.update();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onWeekChange(WeekChangeEvent event) {
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
if (user.getTotal(TopVoter.Weekly) == 0 && user.getWeekVoteStreak() != 0) {
|
||||
user.setWeekVoteStreak(0);
|
||||
} else {
|
||||
user.addWeekVoteStreak();
|
||||
SpecialRewards.getInstance().checkVoteStreak(user, "Week");
|
||||
}
|
||||
|
||||
if (user.getHighestWeeklyTotal() < user.getTotal(TopVoter.Weekly)) {
|
||||
user.setHighestWeeklyTotal(user.getTotal(TopVoter.Weekly));
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.getInstance().getStoreTopVotersWeekly()) {
|
||||
plugin.debug("Storing TopVoters Weekly");
|
||||
storeTopVoters(TopVoter.Weekly);
|
||||
}
|
||||
|
||||
if (Config.getInstance().isEnableWeeklyAwards()) {
|
||||
HashMap<Integer, String> places = handlePlaces(Config.getInstance().getWeeklyPossibleRewardPlaces());
|
||||
int i = 0;
|
||||
int lastTotal = -1;
|
||||
for (User user : plugin.getTopVoter(TopVoter.Weekly).keySet()) {
|
||||
if (!Config.getInstance().getTopVoterIgnorePermission() || !user.isTopVoterIgnore()) {
|
||||
if (Config.getInstance().getTopVoterAwardsTies()) {
|
||||
if (user.getTotal(TopVoter.Weekly) != lastTotal) {
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
if (places.containsKey(i)) {
|
||||
user.giveWeeklyTopVoterAward(i, places.get(i));
|
||||
}
|
||||
}
|
||||
lastTotal = user.getTotal(TopVoter.Weekly);
|
||||
}
|
||||
}
|
||||
resetTotals(TopVoter.Weekly);
|
||||
|
||||
}
|
||||
|
||||
public void register() {
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
}
|
||||
|
||||
public void resetTotals(TopVoter topVoter) {
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
if (user.getTotal(topVoter) != 0) {
|
||||
user.resetTotals(topVoter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public LinkedHashMap<User, Integer> sortByValues(LinkedHashMap<User, Integer> topVoterAllTime,
|
||||
final boolean order) {
|
||||
|
||||
List<Entry<User, Integer>> list = new LinkedList<Entry<User, Integer>>(topVoterAllTime.entrySet());
|
||||
|
||||
// Sorting the list based on values
|
||||
Collections.sort(list, new Comparator<Entry<User, Integer>>() {
|
||||
@Override
|
||||
public int compare(Entry<User, Integer> o1, Entry<User, Integer> o2) {
|
||||
if (order) {
|
||||
return o1.getValue().compareTo(o2.getValue());
|
||||
} else {
|
||||
return o2.getValue().compareTo(o1.getValue());
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Maintaining insertion order with the help of LinkedList
|
||||
LinkedHashMap<User, Integer> sortedMap = new LinkedHashMap<User, Integer>();
|
||||
for (Entry<User, Integer> entry : list) {
|
||||
sortedMap.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
return sortedMap;
|
||||
}
|
||||
|
||||
public void storeTopVoters(TopVoter top) {
|
||||
LocalDateTime time = LocalDateTime.now().minusDays(1);
|
||||
String month = time.getMonth().toString();
|
||||
int year = time.getYear();
|
||||
int week = time.getDayOfYear();
|
||||
int day = time.getDayOfMonth();
|
||||
String fileName = "TopVoter" + File.separator + top.toString() + File.separator + year + "_" + month;
|
||||
|
||||
if (top.equals(TopVoter.Daily)) {
|
||||
fileName += "_" + day;
|
||||
} else if (top.equals(TopVoter.Weekly)) {
|
||||
fileName += "_" + week;
|
||||
}
|
||||
fileName += ".yml";
|
||||
|
||||
YMLFileHandler file = new YMLFileHandler(new File(plugin.getDataFolder(), fileName));
|
||||
file.setup();
|
||||
ArrayList<String> topVoters = new ArrayList<String>();
|
||||
int count = 1;
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(top).entrySet()) {
|
||||
topVoters.add(count + ": " + entry.getKey().getPlayerName() + ": " + entry.getValue());
|
||||
count++;
|
||||
}
|
||||
file.getData().set(top.toString(), topVoters);
|
||||
file.saveData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Top voter all time
|
||||
*
|
||||
* @param page
|
||||
* the page
|
||||
* @return the string[]
|
||||
*/
|
||||
public String[] topVoterAllTime(int page) {
|
||||
int pagesize = Config.getInstance().getFormatPageSize();
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
ArrayList<String> topVoters = new ArrayList<String>();
|
||||
int count = 1;
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.AllTime).entrySet()) {
|
||||
String line = Config.getInstance().getFormatCommandVoteTopLine();
|
||||
line = line.replace("%num%", "" + count);
|
||||
line = line.replace("%player%", entry.getKey().getPlayerName());
|
||||
line = line.replace("%votes%", "" + entry.getValue());
|
||||
topVoters.add(line);
|
||||
count++;
|
||||
}
|
||||
|
||||
int pageSize = (topVoters.size() / pagesize);
|
||||
if ((topVoters.size() % pagesize) != 0) {
|
||||
pageSize++;
|
||||
}
|
||||
|
||||
String title = Config.getInstance().getFormatCommandVoteTopTitle();
|
||||
title = title.replace("%page%", "" + page);
|
||||
title = title.replace("%maxpages%", "" + pageSize);
|
||||
title = title.replace("%Top%", "All Time");
|
||||
msg.add(StringUtils.getInstance().colorize(title));
|
||||
|
||||
for (int i = (page - 1) * pagesize; (i < topVoters.size()) && (i < (((page - 1) * pagesize) + 10)); i++) {
|
||||
msg.add(topVoters.get(i));
|
||||
}
|
||||
|
||||
msg = ArrayUtils.getInstance().colorize(msg);
|
||||
return ArrayUtils.getInstance().convert(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Top voter weekly.
|
||||
*
|
||||
* @param page
|
||||
* the page
|
||||
* @return the string[]
|
||||
*/
|
||||
public String[] topVoterDaily(int page) {
|
||||
int pagesize = Config.getInstance().getFormatPageSize();
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
ArrayList<String> topVoters = new ArrayList<String>();
|
||||
int count = 1;
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Daily).entrySet()) {
|
||||
String line = Config.getInstance().getFormatCommandVoteTopLine();
|
||||
line = line.replace("%num%", "" + count);
|
||||
line = line.replace("%player%", entry.getKey().getPlayerName());
|
||||
line = line.replace("%votes%", "" + entry.getValue());
|
||||
topVoters.add(line);
|
||||
count++;
|
||||
}
|
||||
|
||||
int pageSize = (topVoters.size() / pagesize);
|
||||
if ((topVoters.size() % pagesize) != 0) {
|
||||
pageSize++;
|
||||
}
|
||||
|
||||
String title = Config.getInstance().getFormatCommandVoteTopTitle();
|
||||
title = title.replace("%page%", "" + page);
|
||||
title = title.replace("%maxpages%", "" + pageSize);
|
||||
title = title.replace("%Top%", "Daily");
|
||||
msg.add(StringUtils.getInstance().colorize(title));
|
||||
|
||||
for (int i = (page - 1) * pagesize; (i < topVoters.size()) && (i < (((page - 1) * pagesize) + 10)); i++) {
|
||||
msg.add(topVoters.get(i));
|
||||
}
|
||||
|
||||
msg = ArrayUtils.getInstance().colorize(msg);
|
||||
return ArrayUtils.getInstance().convert(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Top voter monthly
|
||||
*
|
||||
* @param page
|
||||
* the page
|
||||
* @return the string[]
|
||||
*/
|
||||
public String[] topVoterMonthly(int page) {
|
||||
int pagesize = Config.getInstance().getFormatPageSize();
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
ArrayList<String> topVoters = new ArrayList<String>();
|
||||
int count = 1;
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Monthly).entrySet()) {
|
||||
String line = Config.getInstance().getFormatCommandVoteTopLine();
|
||||
line = line.replace("%num%", "" + count);
|
||||
line = line.replace("%player%", entry.getKey().getPlayerName());
|
||||
line = line.replace("%votes%", "" + entry.getValue());
|
||||
topVoters.add(line);
|
||||
count++;
|
||||
}
|
||||
|
||||
int pageSize = (topVoters.size() / pagesize);
|
||||
if ((topVoters.size() % pagesize) != 0) {
|
||||
pageSize++;
|
||||
}
|
||||
|
||||
String title = Config.getInstance().getFormatCommandVoteTopTitle();
|
||||
title = title.replace("%page%", "" + page);
|
||||
title = title.replace("%maxpages%", "" + pageSize);
|
||||
title = title.replace("%Top%", "Monthly");
|
||||
msg.add(StringUtils.getInstance().colorize(title));
|
||||
|
||||
for (int i = (page - 1) * pagesize; (i < topVoters.size()) && (i < (((page - 1) * pagesize) + 10)); i++) {
|
||||
msg.add(topVoters.get(i));
|
||||
}
|
||||
|
||||
msg = ArrayUtils.getInstance().colorize(msg);
|
||||
return ArrayUtils.getInstance().convert(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Top voters all time
|
||||
*
|
||||
* @return the string[]
|
||||
*/
|
||||
public String[] topVotersAllTime() {
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
List<Entry<User, Integer>> list = new LinkedList<Entry<User, Integer>>(
|
||||
plugin.getTopVoter(TopVoter.AllTime).entrySet());
|
||||
int i = 0;
|
||||
for (Entry<User, Integer> entry : list) {
|
||||
String line = "%num%: %player%, %votes%";
|
||||
line = line.replace("%num%", "" + (i + 1));
|
||||
try {
|
||||
line = line.replace("%player%", entry.getKey().getPlayerName());
|
||||
} catch (Exception ex) {
|
||||
AdvancedCoreHook.getInstance().debug(ex);
|
||||
}
|
||||
line = line.replace("%votes%", "" + entry.getValue());
|
||||
|
||||
msg.add(line);
|
||||
i++;
|
||||
}
|
||||
|
||||
msg = ArrayUtils.getInstance().colorize(msg);
|
||||
return ArrayUtils.getInstance().convert(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Top voters daily.
|
||||
*
|
||||
* @return the string[]
|
||||
*/
|
||||
|
||||
public String[] topVotersDaily() {
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
ArrayList<User> users = plugin.convertSet(plugin.getTopVoter(TopVoter.Daily).keySet());
|
||||
for (int i = 0; i < users.size(); i++) {
|
||||
String line = "%num%: %player%, %votes%";
|
||||
line = line.replace("%num%", "" + (i + 1));
|
||||
try {
|
||||
line = line.replace("%player%", users.get(i).getPlayerName());
|
||||
} catch (Exception ex) {
|
||||
AdvancedCoreHook.getInstance().debug(ex);
|
||||
}
|
||||
line = line.replace("%votes%", "" + plugin.getTopVoter(TopVoter.Monthly).get(users.get(i)));
|
||||
msg.add(line);
|
||||
}
|
||||
|
||||
msg = ArrayUtils.getInstance().colorize(msg);
|
||||
return ArrayUtils.getInstance().convert(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Top voters.
|
||||
*
|
||||
* @return the string[]
|
||||
*/
|
||||
public String[] topVotersMonthly() {
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
List<Entry<User, Integer>> list = new LinkedList<Entry<User, Integer>>(
|
||||
plugin.getTopVoter(TopVoter.Monthly).entrySet());
|
||||
int i = 0;
|
||||
for (Entry<User, Integer> entry : list) {
|
||||
String line = "%num%: %player%, %votes%";
|
||||
line = line.replace("%num%", "" + (i + 1));
|
||||
try {
|
||||
line = line.replace("%player%", entry.getKey().getPlayerName());
|
||||
} catch (Exception ex) {
|
||||
AdvancedCoreHook.getInstance().debug(ex);
|
||||
}
|
||||
line = line.replace("%votes%", "" + entry.getValue());
|
||||
|
||||
msg.add(line);
|
||||
i++;
|
||||
}
|
||||
|
||||
msg = ArrayUtils.getInstance().colorize(msg);
|
||||
return ArrayUtils.getInstance().convert(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Top voter weekly.
|
||||
*
|
||||
* @param page
|
||||
* the page
|
||||
* @return the string[]
|
||||
*/
|
||||
public String[] topVoterWeekly(int page) {
|
||||
int pagesize = Config.getInstance().getFormatPageSize();
|
||||
ArrayList<String> msg = new ArrayList<String>();
|
||||
ArrayList<String> topVoters = new ArrayList<String>();
|
||||
int count = 1;
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Weekly).entrySet()) {
|
||||
String line = Config.getInstance().getFormatCommandVoteTopLine();
|
||||
line = line.replace("%num%", "" + count);
|
||||
line = line.replace("%player%", entry.getKey().getPlayerName());
|
||||
line = line.replace("%votes%", "" + entry.getValue());
|
||||
topVoters.add(line);
|
||||
count++;
|
||||
}
|
||||
|
||||
int pageSize = (topVoters.size() / pagesize);
|
||||
if ((topVoters.size() % pagesize) != 0) {
|
||||
pageSize++;
|
||||
}
|
||||
|
||||
String title = Config.getInstance().getFormatCommandVoteTopTitle();
|
||||
title = title.replace("%page%", "" + page);
|
||||
title = title.replace("%maxpages%", "" + pageSize);
|
||||
title = title.replace("%Top%", "Weekly");
|
||||
msg.add(StringUtils.getInstance().colorize(title));
|
||||
|
||||
for (int i = (page - 1) * pagesize; (i < topVoters.size()) && (i < (((page - 1) * pagesize) + 10)); i++) {
|
||||
msg.add(topVoters.get(i));
|
||||
}
|
||||
|
||||
msg = ArrayUtils.getInstance().colorize(msg);
|
||||
return ArrayUtils.getInstance().convert(msg);
|
||||
}
|
||||
|
||||
public synchronized void updateTopVoters(ArrayList<User> users1) {
|
||||
ArrayList<User> users = new ArrayList<User>();
|
||||
ArrayList<String> blackList = getTopVoterBlackList();
|
||||
for (User user : users1) {
|
||||
if (!blackList.contains(user.getPlayerName())) {
|
||||
if ((!Config.getInstance().getTopVoterIgnorePermission() || !user.isTopVoterIgnore())
|
||||
&& !user.isBanned()) {
|
||||
users.add(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (TopVoter top : TopVoter.values()) {
|
||||
plugin.getTopVoter(top).clear();
|
||||
if (Config.getInstance().getLoadTopVoter(top)) {
|
||||
for (User user : users) {
|
||||
int total = user.getTotal(top);
|
||||
if (total > 0) {
|
||||
plugin.getTopVoter(top).put(user, total);
|
||||
}
|
||||
}
|
||||
plugin.getTopVoter().put(top, sortByValues(plugin.getTopVoter(top), false));
|
||||
plugin.debug(top.toString() + " TopVoter loaded");
|
||||
}
|
||||
}
|
||||
|
||||
plugin.debug("Updated TopVoter");
|
||||
}
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Updater;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Updater.Updater;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class CheckUpdate.
|
||||
*/
|
||||
public class CheckUpdate {
|
||||
|
||||
/** The instance. */
|
||||
static CheckUpdate instance = new CheckUpdate();
|
||||
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
/**
|
||||
* Gets the single instance of CheckUpdate.
|
||||
*
|
||||
* @return single instance of CheckUpdate
|
||||
*/
|
||||
public static CheckUpdate getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new check update.
|
||||
*/
|
||||
private CheckUpdate() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new check update.
|
||||
*
|
||||
* @param plugin
|
||||
* the plugin
|
||||
*/
|
||||
public CheckUpdate(Main plugin) {
|
||||
CheckUpdate.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check update.
|
||||
*/
|
||||
public void checkUpdate() {
|
||||
if (Config.getInstance().isDisableUpdateChecking()) {
|
||||
return;
|
||||
}
|
||||
plugin.setUpdater(new Updater(plugin, 15358, false));
|
||||
final Updater.UpdateResult result = plugin.getUpdater().getResult();
|
||||
switch (result) {
|
||||
case FAIL_SPIGOT: {
|
||||
plugin.getLogger().info("Failed to check for update for " + plugin.getName() + "!");
|
||||
break;
|
||||
}
|
||||
case NO_UPDATE: {
|
||||
plugin.getLogger()
|
||||
.info(plugin.getName() + " is up to date! Version: " + plugin.getUpdater().getVersion());
|
||||
break;
|
||||
}
|
||||
case UPDATE_AVAILABLE: {
|
||||
plugin.getLogger()
|
||||
.info(plugin.getName() + " has an update available! Your Version: "
|
||||
+ plugin.getDescription().getVersion() + " New Version: "
|
||||
+ plugin.getUpdater().getVersion() + " Use /av download to get the latest update!");
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void checkUpdateBasic() {
|
||||
if (Config.getInstance().isDisableUpdateChecking()) {
|
||||
return;
|
||||
}
|
||||
plugin.setUpdater(new Updater(plugin, 15358, false));
|
||||
final Updater.UpdateResult result = plugin.getUpdater().getResult();
|
||||
switch (result) {
|
||||
case UPDATE_AVAILABLE: {
|
||||
plugin.getLogger()
|
||||
.info(plugin.getName() + " has an update available! Your Version: "
|
||||
+ plugin.getDescription().getVersion() + " New Version: "
|
||||
+ plugin.getUpdater().getVersion() + " Use /av download to get the latest update!");
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start up.
|
||||
*/
|
||||
public void startUp() {
|
||||
if (Config.getInstance().isDisableUpdateChecking()) {
|
||||
return;
|
||||
}
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
checkUpdate();
|
||||
new Timer().schedule(new TimerTask() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
checkUpdateBasic();
|
||||
}
|
||||
}, 1000 * 60 * 1200, 1000 * 60 * 1200);
|
||||
|
||||
}
|
||||
}, 10l);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.UserManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.UserManager.UUID;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
|
||||
public class UserManager {
|
||||
/** The instance. */
|
||||
static UserManager instance = new UserManager();
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
/**
|
||||
* Gets the single instance of UserManager.
|
||||
*
|
||||
* @return single instance of UserManager
|
||||
*/
|
||||
public static UserManager getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public UserManager() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ArrayList<String> getAllUUIDs() {
|
||||
return com.Ben12345rocks.AdvancedCore.UserManager.UserManager.getInstance().getAllUUIDs();
|
||||
}
|
||||
|
||||
public User getVotingPluginUser(java.util.UUID uuid) {
|
||||
return getVotingPluginUser(new UUID(uuid.toString()));
|
||||
}
|
||||
|
||||
public User getVotingPluginUser(OfflinePlayer player) {
|
||||
return getVotingPluginUser(player.getName());
|
||||
}
|
||||
|
||||
public User getVotingPluginUser(Player player) {
|
||||
return getVotingPluginUser(player.getName());
|
||||
}
|
||||
|
||||
public User getVotingPluginUser(com.Ben12345rocks.AdvancedCore.UserManager.User user) {
|
||||
return getVotingPluginUser(java.util.UUID.fromString(user.getUUID()));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public User getVotingPluginUser(String playerName) {
|
||||
return new User(com.Ben12345rocks.AdvancedCore.UserManager.UserManager.getInstance().getProperName(playerName));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public User getVotingPluginUser(UUID uuid) {
|
||||
return new User(uuid);
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Util.PlaceHolders;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.StringUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
public abstract class PlaceHolder {
|
||||
@Getter
|
||||
private String identifier;
|
||||
@Getter
|
||||
private boolean useStartsWith = false;
|
||||
@Getter
|
||||
private String description;
|
||||
|
||||
public PlaceHolder(String identifier) {
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
public PlaceHolder(String identifier, boolean useStartsWith) {
|
||||
this.identifier = identifier;
|
||||
this.useStartsWith = useStartsWith;
|
||||
}
|
||||
|
||||
public boolean matches(String identifier) {
|
||||
if (isUseStartsWith()) {
|
||||
if (StringUtils.getInstance().startsWithIgnoreCase(identifier, getIdentifier())) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (getIdentifier().equalsIgnoreCase(identifier)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public abstract String placeholderRequest(OfflinePlayer p, User user, String identifier);
|
||||
|
||||
public PlaceHolder useStartsWith() {
|
||||
useStartsWith = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PlaceHolder withDescription(String desc) {
|
||||
description = desc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean hasDescription() {
|
||||
return description != null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,484 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Util.PlaceHolders;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.StringUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Commands.Commands;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.VoteSite;
|
||||
import com.Ben12345rocks.VotingPlugin.TopVoter.TopVoter;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
import com.Ben12345rocks.VotingPlugin.VoteParty.VoteParty;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class PlaceHolders.
|
||||
*/
|
||||
public class PlaceHolders {
|
||||
|
||||
/** The instance. */
|
||||
static PlaceHolders instance = new PlaceHolders();
|
||||
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
/**
|
||||
* Gets the single instance of PlaceHolders.
|
||||
*
|
||||
* @return single instance of PlaceHolders
|
||||
*/
|
||||
public static PlaceHolders getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Getter
|
||||
private ArrayList<PlaceHolder> placeholders = new ArrayList<PlaceHolder>();
|
||||
|
||||
@Getter
|
||||
private ArrayList<PlaceHolder> nonPlayerPlaceholders = new ArrayList<PlaceHolder>();
|
||||
|
||||
/**
|
||||
* Instantiates a new place holders.
|
||||
*/
|
||||
private PlaceHolders() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new place holders.
|
||||
*
|
||||
* @param plugin
|
||||
* the plugin
|
||||
*/
|
||||
public PlaceHolders(Main plugin) {
|
||||
PlaceHolders.plugin = plugin;
|
||||
}
|
||||
|
||||
public String getPlaceHolder(OfflinePlayer p, String identifier) {
|
||||
identifier = StringUtils.getInstance().replaceJavascript(p, identifier);
|
||||
|
||||
for (PlaceHolder placeholder : nonPlayerPlaceholders) {
|
||||
if (placeholder.matches(identifier)) {
|
||||
return placeholder.placeholderRequest(p, null, identifier);
|
||||
}
|
||||
}
|
||||
|
||||
User user = UserManager.getInstance().getVotingPluginUser(p);
|
||||
|
||||
for (PlaceHolder placeholder : placeholders) {
|
||||
if (placeholder.matches(identifier)) {
|
||||
return placeholder.placeholderRequest(p, user, identifier);
|
||||
}
|
||||
}
|
||||
|
||||
return identifier;
|
||||
}
|
||||
|
||||
public String getPlaceHolder(Player p, String identifier) {
|
||||
identifier = StringUtils.getInstance().replaceJavascript(p, identifier);
|
||||
return getPlaceHolder((OfflinePlayer) p, identifier);
|
||||
}
|
||||
|
||||
public void load() {
|
||||
placeholders.clear();
|
||||
nonPlayerPlaceholders.clear();
|
||||
|
||||
// older placeholders, might be removed in the future
|
||||
placeholders.add(new PlaceHolder("total") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getTotal(TopVoter.Monthly));
|
||||
}
|
||||
}.withDescription("Month total"));
|
||||
|
||||
placeholders.add(new PlaceHolder("alltimetotal") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getTotal(TopVoter.AllTime));
|
||||
}
|
||||
}.withDescription("Alltime total"));
|
||||
|
||||
placeholders.add(new PlaceHolder("lastmonthtotal") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getLastMonthTotal());
|
||||
}
|
||||
}.withDescription("Last month total"));
|
||||
|
||||
// end of older placeholders
|
||||
|
||||
placeholders.add(new PlaceHolder("DisableBroadcast") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return "" + user.getDisableBroadcast();
|
||||
}
|
||||
}.withDescription("Returns true/false if user has broadcast disabled"));
|
||||
|
||||
placeholders.add(new PlaceHolder("MilestoneCount") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return "" + user.getMilestoneCount();
|
||||
}
|
||||
}.withDescription("User milestonecount"));
|
||||
|
||||
for (final String identifier : Config.getInstance().getIdentifiers()) {
|
||||
if (Config.getInstance().getIdentifierLimit(identifier) > 0) {
|
||||
placeholders.add(new PlaceHolder("VoteShopLimit_" + identifier) {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String ident) {
|
||||
return "" + user.getVoteShopIdentifierLimit(identifier);
|
||||
}
|
||||
}.withDescription("User voteshop limit for " + identifier));
|
||||
}
|
||||
}
|
||||
|
||||
for (final TopVoter top : TopVoter.values()) {
|
||||
placeholders.add(new PlaceHolder("Total_" + top.toString()) {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getTotal(top));
|
||||
}
|
||||
}.withDescription("User total for " + top.getName()));
|
||||
}
|
||||
|
||||
placeholders.add(new PlaceHolder("BestDailyTotal") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getHighestDailyTotal());
|
||||
}
|
||||
}.withDescription("Best daily total"));
|
||||
|
||||
placeholders.add(new PlaceHolder("BestWeeklyTotal") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getHighestWeeklyTotal());
|
||||
}
|
||||
}.withDescription("Best weekly total"));
|
||||
|
||||
placeholders.add(new PlaceHolder("BestMonthlyTotal") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getHighestMonthlyTotal());
|
||||
}
|
||||
}.withDescription("Best monthly total"));
|
||||
|
||||
placeholders.add(new PlaceHolder("DailyVoteStreak") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getDayVoteStreak());
|
||||
}
|
||||
}.withDescription("Current daily votestreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder("WeeklyVoteStreak") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getWeekVoteStreak());
|
||||
}
|
||||
}.withDescription("Current weekly votestreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder("MonthVoteStreak") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getMonthVoteStreak());
|
||||
}
|
||||
}.withDescription("Current month votestreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder("BestDailyVoteStreak") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getBestDayVoteStreak());
|
||||
}
|
||||
}.withDescription("Best daily votestreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder("BestWeeklyVoteStreak") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getBestWeekVoteStreak());
|
||||
}
|
||||
}.withDescription("Best weekly votestreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder("BestMonthVoteStreak") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getBestMonthVoteStreak());
|
||||
}
|
||||
}.withDescription("Best month votestreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Points") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getPoints());
|
||||
}
|
||||
}.withDescription("User points"));
|
||||
|
||||
placeholders.add(new PlaceHolder("CanVote") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Boolean.toString(user.canVoteAll());
|
||||
}
|
||||
}.withDescription("Return true/false if player can vote on all sites"));
|
||||
|
||||
for (final VoteSite voteSite : plugin.getVoteSites()) {
|
||||
placeholders.add(new PlaceHolder("Next_" + voteSite.getKey()) {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Commands.getInstance().voteCommandNextInfo(user, voteSite);
|
||||
}
|
||||
}.withDescription("How long until user can vote on " + voteSite.getKey()));
|
||||
placeholders.add(new PlaceHolder("Last_" + voteSite.getKey()) {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Commands.getInstance().voteCommandLastDuration(user, voteSite);
|
||||
}
|
||||
}.withDescription("How long ago user voted on " + voteSite.getKey()));
|
||||
placeholders.add(new PlaceHolder("CanVote_" + voteSite.getKey()) {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return "" + user.canVoteSite(voteSite);
|
||||
}
|
||||
}.withDescription("Whether or not player can vote on " + voteSite.getKey()));
|
||||
}
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_All_Position") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.AllTime).entrySet()) {
|
||||
if (entry.getKey().getUUID().equals(p.getUniqueId().toString())) {
|
||||
return "" + num;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.withDescription("Get user top voter position"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_AllVotes_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.AllTime).entrySet()) {
|
||||
if (num == number) {
|
||||
return "" + entry.getKey().getTotal(TopVoter.AllTime);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user votes at postion in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_All_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.AllTime).entrySet()) {
|
||||
if (num == number) {
|
||||
return entry.getKey().getPlayerName();
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user at postion in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_Month_Position") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Monthly).entrySet()) {
|
||||
if (entry.getKey().getUUID().equals(p.getUniqueId().toString())) {
|
||||
return "" + num;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.withDescription("Get user top voter position"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_Month_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Monthly).entrySet()) {
|
||||
if (num == number) {
|
||||
return entry.getKey().getPlayerName();
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user at postion in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_MonthVotes_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Monthly).entrySet()) {
|
||||
if (num == number) {
|
||||
return "" + entry.getKey().getTotal(TopVoter.Monthly);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user votes at postion in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_Week_Position") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Weekly).entrySet()) {
|
||||
if (entry.getKey().getUUID().equals(p.getUniqueId().toString())) {
|
||||
return "" + num;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.withDescription("Get user top voter position"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_Week_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Weekly).entrySet()) {
|
||||
if (num == number) {
|
||||
return entry.getKey().getPlayerName();
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user at postion in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_WeekVotes_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Weekly).entrySet()) {
|
||||
if (num == number) {
|
||||
return "" + entry.getKey().getTotal(TopVoter.Weekly);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user votes at postion in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_Daily_Position") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Daily).entrySet()) {
|
||||
if (entry.getKey().getUUID().equals(p.getUniqueId().toString())) {
|
||||
return "" + num;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.withDescription("Get user top voter position"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_Daily_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Daily).entrySet()) {
|
||||
if (num == number) {
|
||||
return entry.getKey().getPlayerName();
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user at postion in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_DailyVotes_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Daily).entrySet()) {
|
||||
if (num == number) {
|
||||
return "" + entry.getKey().getTotal(TopVoter.Daily);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user votes at postion in top voter"));
|
||||
|
||||
// non players
|
||||
|
||||
nonPlayerPlaceholders.add(new PlaceHolder("VotePartyVotesCurrent") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(VoteParty.getInstance().getTotalVotes());
|
||||
}
|
||||
}.withDescription("Current amount of voteparty votes"));
|
||||
|
||||
nonPlayerPlaceholders.add(new PlaceHolder("VotePartyVotesNeeded") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(VoteParty.getInstance().getNeededVotes());
|
||||
}
|
||||
}.withDescription("Voteparty votes needed"));
|
||||
|
||||
nonPlayerPlaceholders.add(new PlaceHolder("VotePartyVotesRequired") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(VoteParty.getInstance().getVotesRequired());
|
||||
}
|
||||
}.withDescription("Amount of votes needed for voteparty"));
|
||||
}
|
||||
}
|
||||
@@ -1,284 +0,0 @@
|
||||
|
||||
package com.Ben12345rocks.VotingPlugin.VoteParty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardBuilder;
|
||||
import com.Ben12345rocks.AdvancedCore.TimeChecker.Events.DayChangeEvent;
|
||||
import com.Ben12345rocks.AdvancedCore.TimeChecker.Events.MonthChangeEvent;
|
||||
import com.Ben12345rocks.AdvancedCore.UserManager.UUID;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.MiscUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.StringUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Data.ServerData;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.VotePartyEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class VoteParty.
|
||||
*/
|
||||
public class VoteParty implements Listener {
|
||||
|
||||
/** The instance. */
|
||||
static VoteParty instance = new VoteParty();
|
||||
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
/**
|
||||
* Gets the single instance of VoteParty.
|
||||
*
|
||||
* @return single instance of VoteParty
|
||||
*/
|
||||
public static VoteParty getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new vote party.
|
||||
*/
|
||||
private VoteParty() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new vote party.
|
||||
*
|
||||
* @param plugin
|
||||
* the plugin
|
||||
*/
|
||||
public VoteParty(Main plugin) {
|
||||
VoteParty.plugin = plugin;
|
||||
}
|
||||
|
||||
public void addTotal(User user) {
|
||||
setTotalVotes(getTotalVotes() + 1);
|
||||
user.setVotePartyVotes(user.getVotePartyVotes() + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the vote player.
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
*/
|
||||
public void addVotePlayer(User user) {
|
||||
String uuid = user.getUUID();
|
||||
ArrayList<String> voted = getVotedUsers();
|
||||
if (voted == null) {
|
||||
voted = new ArrayList<String>();
|
||||
}
|
||||
if (!voted.contains(uuid)) {
|
||||
voted.add(uuid);
|
||||
setVotedUsers(voted);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check.
|
||||
*/
|
||||
public void check() {
|
||||
if (getTotalVotes() >= getVotesRequired()) {
|
||||
setTotalVotes(getTotalVotes() - getVotesRequired());
|
||||
|
||||
VotePartyEvent event = new VotePartyEvent();
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
MiscUtils.getInstance().broadcast(Config.getInstance().getVotePartyBroadcast());
|
||||
giveRewards();
|
||||
|
||||
if (Config.getInstance().getVotePartyIncreaseVotesRquired() > 0) {
|
||||
ServerData.getInstance().setVotePartyExtraRequired(ServerData.getInstance().getVotePartyExtraRequired()
|
||||
+ Config.getInstance().getVotePartyIncreaseVotesRquired());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Command vote party.
|
||||
*
|
||||
* @param sender
|
||||
* the sender
|
||||
*/
|
||||
public void commandVoteParty(CommandSender sender) {
|
||||
if (Config.getInstance().getVotePartyEnabled()) {
|
||||
ArrayList<String> msg = Config.getInstance().getFormatCommandsVoteParty();
|
||||
int votesRequired = getVotesRequired();
|
||||
int votes = getTotalVotes();
|
||||
int neededVotes = votesRequired - votes;
|
||||
HashMap<String, String> placeholders = new HashMap<String, String>();
|
||||
placeholders.put("votesrequired", "" + votesRequired);
|
||||
placeholders.put("neededvotes", "" + neededVotes);
|
||||
placeholders.put("votes", "" + votes);
|
||||
msg = ArrayUtils.getInstance().colorize(ArrayUtils.getInstance().replacePlaceHolder(msg, placeholders));
|
||||
sender.sendMessage(ArrayUtils.getInstance().convert(msg));
|
||||
} else {
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&cVoteParty not enabled"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the needed votes.
|
||||
*
|
||||
* @return the needed votes
|
||||
*/
|
||||
public int getNeededVotes() {
|
||||
int votesRequired = getVotesRequired();
|
||||
int votes = getTotalVotes();
|
||||
int neededVotes = votesRequired - votes;
|
||||
return neededVotes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the total votes.
|
||||
*
|
||||
* @return the total votes
|
||||
*/
|
||||
public int getTotalVotes() {
|
||||
return ServerData.getInstance().getData().getInt("VoteParty.Total");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the voted users.
|
||||
*
|
||||
* @return the voted users
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public ArrayList<String> getVotedUsers() {
|
||||
ArrayList<String> list = (ArrayList<String>) ServerData.getInstance().getData().getList("VoteParty.Voted");
|
||||
if (list != null) {
|
||||
return list;
|
||||
}
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
|
||||
public int getVotesRequired() {
|
||||
int required = Config.getInstance().getVotePartyVotesRequired();
|
||||
int extra = ServerData.getInstance().getVotePartyExtraRequired();
|
||||
if (extra > 0) {
|
||||
return required + extra;
|
||||
}
|
||||
return required;
|
||||
}
|
||||
|
||||
public void giveReward(User user, boolean online) {
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getVotePartyRewardsPath())
|
||||
.setOnline(online)
|
||||
.withPlaceHolder("VotesRequired", "" + Config.getInstance().getVotePartyVotesRequired()).send(user);
|
||||
}
|
||||
|
||||
public void giveReward(User user) {
|
||||
if (Config.getInstance().getVotePartyUserVotesRequired() > 0) {
|
||||
if (user.getVotePartyVotes() < Config.getInstance().getVotePartyUserVotesRequired()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
giveReward(user, user.isOnline());
|
||||
}
|
||||
|
||||
/**
|
||||
* Give rewards.
|
||||
*/
|
||||
public void giveRewards() {
|
||||
for (final String cmd : Config.getInstance().getVotePartyCommands()) {
|
||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
if (Config.getInstance().getVotePartyGiveAllPlayers()) {
|
||||
plugin.debug("Giving all players vote party");
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
giveReward(user);
|
||||
}
|
||||
} else {
|
||||
plugin.debug(ArrayUtils.getInstance().makeStringList(getVotedUsers()));
|
||||
for (String uuid : getVotedUsers()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
giveReward(user);
|
||||
}
|
||||
}
|
||||
reset();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDayChange(DayChangeEvent event) {
|
||||
if (Config.getInstance().getVotePartyResetEachDay()) {
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMonthChange(MonthChangeEvent event) {
|
||||
if (Config.getInstance().getVotePartyResetMontly()) {
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
public void register() {
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
setVotedUsers(new ArrayList<String>());
|
||||
setTotalVotes(0);
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
if (user.getVotePartyVotes() != 0) {
|
||||
user.setVotePartyVotes(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the total votes.
|
||||
*
|
||||
* @param value
|
||||
* the new total votes
|
||||
*/
|
||||
public void setTotalVotes(int value) {
|
||||
ServerData.getInstance().getData().set("VoteParty.Total", value);
|
||||
ServerData.getInstance().saveData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the voted users.
|
||||
*
|
||||
* @param value
|
||||
* the new voted users
|
||||
*/
|
||||
public void setVotedUsers(ArrayList<String> value) {
|
||||
ServerData.getInstance().getData().set("VoteParty.Voted", value);
|
||||
ServerData.getInstance().saveData();
|
||||
}
|
||||
|
||||
public synchronized void vote(User user, boolean realVote) {
|
||||
if (Config.getInstance().getVotePartyEnabled()) {
|
||||
if (Config.getInstance().getVotePartyCountFakeVotes() || realVote) {
|
||||
addTotal(user);
|
||||
addVotePlayer(user);
|
||||
check();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
package com.Ben12345rocks.VotingPlugin.VoteReminding;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardBuilder;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.PlayerUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class VoteReminding.
|
||||
*/
|
||||
public class VoteReminding {
|
||||
|
||||
/** The instance. */
|
||||
static VoteReminding instance = new VoteReminding();
|
||||
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
/**
|
||||
* Gets the single instance of VoteReminding.
|
||||
*
|
||||
* @return single instance of VoteReminding
|
||||
*/
|
||||
public static VoteReminding getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new vote reminding.
|
||||
*/
|
||||
private VoteReminding() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new vote reminding.
|
||||
*
|
||||
* @param plugin
|
||||
* the plugin
|
||||
*/
|
||||
public VoteReminding(Main plugin) {
|
||||
VoteReminding.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check remind.
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
*/
|
||||
public void checkRemind(User user) {
|
||||
String playerName = user.getPlayerName();
|
||||
|
||||
if (PlayerUtils.getInstance().hasServerPermission(playerName, "VotingPlugin.Login.RemindVotes")
|
||||
|| PlayerUtils.getInstance().hasServerPermission(playerName, "VotingPlugin.Player")) {
|
||||
if (user.canVoteAll()) {
|
||||
Player player = Bukkit.getPlayer(playerName);
|
||||
if (player != null) {
|
||||
if (!Config.getInstance().getVoteRemindingRemindOnlyOnce()) {
|
||||
runRemind(user);
|
||||
user.setReminded(true);
|
||||
} else if (!user.isReminded()) {
|
||||
runRemind(user);
|
||||
user.setReminded(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void giveReward(User user) {
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getVoteRemindingRewardsPath())
|
||||
.setGiveOffline(false).send(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load remind checking.
|
||||
*/
|
||||
public void loadRemindChecking() {
|
||||
Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
checkRemind(user);
|
||||
}
|
||||
}
|
||||
}, 10, Config.getInstance().getVoteRemindingRemindDelay() * 20 * 60);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run remind.
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
*/
|
||||
public void runRemind(User user) {
|
||||
if (Config.getInstance().getVoteRemindingEnabled() && user.canVoteAll() && user.shouldBeReminded()) {
|
||||
user.setReminded(true);
|
||||
giveReward(user);
|
||||
|
||||
plugin.debug(user.getPlayerName() + " was reminded!");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void runRemindLogin(User user) {
|
||||
if (Config.getInstance().getVoteRemindingEnabled()
|
||||
&& (!UserManager.getInstance().getAllUUIDs().contains(user.getUUID()) || user.canVoteAll())
|
||||
&& user.shouldBeReminded()) {
|
||||
giveReward(user);
|
||||
if (user.getData().hasData()) {
|
||||
user.setReminded(true);
|
||||
}
|
||||
plugin.debug(user.getPlayerName() + " was reminded!");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.jvm.toolchain.JvmVendorSpec
|
||||
|
||||
plugins {
|
||||
id("java")
|
||||
eclipse
|
||||
id("com.gradleup.shadow") version "8.3.9"
|
||||
}
|
||||
|
||||
group = "com.bencodez"
|
||||
version = "6.19.1-SNAPSHOT"
|
||||
description = "VotingPlugin"
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(17))
|
||||
vendor.set(JvmVendorSpec.GRAAL_VM)
|
||||
}
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = uri("https://oss.sonatype.org/content/groups/public") }
|
||||
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
|
||||
maven { url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") }
|
||||
maven { url = uri("https://repo.papermc.io/repository/maven-public/") }
|
||||
maven {
|
||||
url = uri("https://nexus.velocitypowered.com/repository/maven-public/")
|
||||
content { includeGroup("com.velocitypowered") }
|
||||
}
|
||||
maven { url = uri("https://nexus.bencodez.com/repository/maven-public/") }
|
||||
maven { url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/") }
|
||||
maven { url = uri("https://nexus.scarsz.me/content/groups/public/") }
|
||||
maven { url = uri("https://repo.purpurmc.org/snapshots") }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT")
|
||||
compileOnly("org.projectlombok:lombok:1.18.38")
|
||||
annotationProcessor("org.projectlombok:lombok:1.18.38")
|
||||
compileOnly("net.md-5:bungeecord-api:1.21-R0.3")
|
||||
compileOnly("com.vexsoftware:nuvotifier-universal:2.7.2")
|
||||
compileOnly("be.maximvdw:mvdwplaceholderapi:3.1.1")
|
||||
compileOnly("com.velocitypowered:velocity-api:3.1.2-SNAPSHOT")
|
||||
implementation("org.bstats:bstats-velocity:3.1.0")
|
||||
compileOnly("me.clip:placeholderapi:2.11.6")
|
||||
implementation("com.bencodez:advancedcore:3.7.19-SNAPSHOT")
|
||||
compileOnly("com.discordsrv:discordsrv:1.30.0")
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
options.encoding = "Cp1252"
|
||||
}
|
||||
|
||||
val buildProfileId = (findProperty("buildProfile") ?: System.getenv("BUILD_PROFILE") ?: "default").toString()
|
||||
val buildNumber = (findProperty("buildNumber") ?: System.getenv("BUILD_NUMBER") ?: "NOTSET").toString()
|
||||
val timestamp = System.currentTimeMillis().toString()
|
||||
val apiVersion = "1.19"
|
||||
val resourceProps = mapOf(
|
||||
"name" to project.name,
|
||||
"version" to project.version.toString(),
|
||||
"apiVersion" to apiVersion,
|
||||
"timestamp" to timestamp,
|
||||
"build" to mapOf(
|
||||
"profile" to mapOf("id" to buildProfileId),
|
||||
"number" to buildNumber
|
||||
)
|
||||
)
|
||||
|
||||
tasks.processResources {
|
||||
filteringCharset = "Cp1252"
|
||||
inputs.properties(resourceProps)
|
||||
filesMatching(listOf("plugin.yml", "bungee.yml", "votingpluginversion.yml")) {
|
||||
expand(resourceProps)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.jar { enabled = false }
|
||||
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
archiveBaseName.set("VotingPlugin")
|
||||
archiveVersion.set("")
|
||||
archiveClassifier.set("")
|
||||
mergeServiceFiles()
|
||||
exclude("META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA", "module-info.class")
|
||||
dependencies { exclude(dependency("com.google.*:.*")) }
|
||||
relocate("com.tcoded.folialib", "${project.group}.votingplugin.simpleapi.folialib")
|
||||
relocate("com.bencodez.simpleapi", "${project.group}.votingplugin.simpleapi")
|
||||
relocate("com.bencodez.advancedcore", "${project.group}.votingplugin.advancedcore")
|
||||
relocate("net.pl3x.bukkit.chatapi", "${project.group}.votingplugin")
|
||||
relocate("me.mrten.mysqlapi", "${project.group}.votingplugin.mysqlapi")
|
||||
relocate("com.zaxxer.hikari", "${project.group}.votingplugin.simpleapi.hikari")
|
||||
relocate("org.bstats", "${project.group}.votingplugin.bstats")
|
||||
relocate("xyz.upperlevel.spigot", "${project.group}.votingplugin.advancedcore.xyz.upperlevel.spigot")
|
||||
manifest { attributes(mapOf("paperweight-mappings-namespace" to "mojang")) }
|
||||
}
|
||||
|
||||
tasks.build { dependsOn(tasks.named("shadowJar")) }
|
||||
|
||||
tasks.register<Copy>("copyToTestServer") {
|
||||
dependsOn(tasks.named("shadowJar"))
|
||||
from(tasks.named("shadowJar"))
|
||||
into("${System.getProperty("user.home")}/Documents/Test_Server/plugins")
|
||||
}
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+7
@@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -0,0 +1,251 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+94
@@ -0,0 +1,94 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -0,0 +1,2 @@
|
||||
rootProject.name = "VotingPlugin"
|
||||
|
||||
@@ -0,0 +1,805 @@
|
||||
package com.bencodez.votingplugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.SQLException;
|
||||
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 java.util.regex.Pattern;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
||||
|
||||
import com.bencodez.advancedcore.api.misc.MiscUtils;
|
||||
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.bungeeapi.globaldata.GlobalDataHandler;
|
||||
import com.bencodez.advancedcore.bungeeapi.globaldata.GlobalMySQL;
|
||||
import com.bencodez.simpleapi.array.ArrayUtils;
|
||||
import com.bencodez.simpleapi.encryption.EncryptionHandler;
|
||||
import com.bencodez.simpleapi.messages.MessageAPI;
|
||||
import com.bencodez.simpleapi.servercomm.global.GlobalMessageHandler;
|
||||
import com.bencodez.simpleapi.servercomm.global.GlobalMessageListener;
|
||||
import com.bencodez.simpleapi.servercomm.mqtt.MqttHandler;
|
||||
import com.bencodez.simpleapi.servercomm.mqtt.MqttHandler.MessageHandler;
|
||||
import com.bencodez.simpleapi.servercomm.mqtt.MqttServerComm;
|
||||
import com.bencodez.simpleapi.servercomm.mysql.BackendMessenger;
|
||||
import com.bencodez.simpleapi.servercomm.pluginmessage.PluginMessageHandler;
|
||||
import com.bencodez.simpleapi.servercomm.redis.RedisHandler;
|
||||
import com.bencodez.simpleapi.servercomm.redis.RedisListener;
|
||||
import com.bencodez.simpleapi.servercomm.sockets.ClientHandler;
|
||||
import com.bencodez.simpleapi.servercomm.sockets.SocketHandler;
|
||||
import com.bencodez.simpleapi.servercomm.sockets.SocketReceiver;
|
||||
import com.bencodez.simpleapi.sql.data.DataValue;
|
||||
import com.bencodez.simpleapi.sql.data.DataValueBoolean;
|
||||
import com.bencodez.simpleapi.sql.mysql.config.MysqlConfigSpigot;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
import com.bencodez.votingplugin.proxy.BungeeMessageData;
|
||||
import com.bencodez.votingplugin.proxy.BungeeMethod;
|
||||
import com.bencodez.votingplugin.proxy.BungeeVersion;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
public class BungeeHandler implements Listener {
|
||||
@Getter
|
||||
private ClientHandler clientHandler;
|
||||
|
||||
private EncryptionHandler encryptionHandler;
|
||||
|
||||
@Getter
|
||||
private BungeeMethod method;
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
@Getter
|
||||
private int bungeeVotePartyCurrent = -2;
|
||||
|
||||
@Getter
|
||||
private int bungeeVotePartyRequired = -2;
|
||||
|
||||
@Getter
|
||||
private SocketHandler socketHandler;
|
||||
|
||||
private GlobalDataHandler globalDataHandler;
|
||||
|
||||
@Getter
|
||||
private ScheduledExecutorService timer;
|
||||
|
||||
@Getter
|
||||
private RedisHandler redisHandler;
|
||||
|
||||
@Getter
|
||||
private GlobalMessageHandler globalMessageHandler;
|
||||
|
||||
private Thread redisThread;
|
||||
|
||||
@Getter
|
||||
private BackendMessenger backendMysqlMessenger;
|
||||
|
||||
public BungeeHandler(VotingPluginMain plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
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<>();
|
||||
dataToSet.put("FinishedProcessing", new DataValueBoolean(true));
|
||||
dataToSet.put("Processing", new DataValueBoolean(false));
|
||||
globalDataHandler.setData(plugin.getBungeeSettings().getServer(), dataToSet);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @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 boolean checkGlobalDataTime(TimeType type, HashMap<String, DataValue> data) {
|
||||
boolean isProcessing = false;
|
||||
if (data.containsKey(type.toString())) {
|
||||
|
||||
DataValue value = data.get(type.toString());
|
||||
boolean b = checkGlobalDataTimeValue(value);
|
||||
if (b) {
|
||||
long lastUpdated = Long.valueOf(data.get("LastUpdated").getString()).longValue();
|
||||
plugin.debug("LastUpdated: " + lastUpdated);
|
||||
if (LocalDateTime.now().atZone(ZoneOffset.UTC).toInstant().toEpochMilli() - lastUpdated > 1000 * 60 * 60
|
||||
* 2) {
|
||||
plugin.getLogger().warning("Ignoring bungee time change since it was more than 2 hours ago");
|
||||
globalDataHandler.setBoolean(plugin.getBungeeSettings().getServer(), type.toString(), false);
|
||||
return false;
|
||||
}
|
||||
|
||||
globalDataHandler.setBoolean(plugin.getBungeeSettings().getServer(), "Processing", true);
|
||||
isProcessing = true;
|
||||
|
||||
plugin.debug("Detected time change from bungee: " + type.toString());
|
||||
plugin.getTimeChecker().forceChanged(type, false, true, true);
|
||||
globalDataHandler.setBoolean(plugin.getBungeeSettings().getServer(), type.toString(), false);
|
||||
getGlobalMessageHandler().sendMessage("TimeChangeFinished",
|
||||
"" + plugin.getBungeeSettings().getServer());
|
||||
}
|
||||
}
|
||||
return isProcessing;
|
||||
}
|
||||
|
||||
public boolean checkGlobalDataTimeValue(DataValue data) {
|
||||
if (data.isBoolean()) {
|
||||
return data.getBoolean();
|
||||
}
|
||||
return Boolean.valueOf(data.getString());
|
||||
}
|
||||
|
||||
public void close() {
|
||||
if (backendMysqlMessenger != null) {
|
||||
backendMysqlMessenger.shutdown();
|
||||
}
|
||||
|
||||
if (socketHandler != null) {
|
||||
socketHandler.closeConnection();
|
||||
}
|
||||
if (clientHandler != null) {
|
||||
clientHandler.stopConnection();
|
||||
}
|
||||
plugin.getServerData().setBungeeVotePartyCurrent(bungeeVotePartyCurrent);
|
||||
plugin.getServerData().setBungeeVotePartyRequired(bungeeVotePartyRequired);
|
||||
if (globalDataHandler != null) {
|
||||
globalDataHandler.getGlobalMysql().close();
|
||||
}
|
||||
}
|
||||
|
||||
public void load() {
|
||||
plugin.debug("Loading bungee handler");
|
||||
|
||||
method = BungeeMethod.getByName(plugin.getBungeeSettings().getBungeeMethod());
|
||||
|
||||
plugin.getLogger().info("Using BungeeMethod: " + method.toString());
|
||||
|
||||
loadGlobalMysql();
|
||||
|
||||
globalMessageHandler = new GlobalMessageHandler() {
|
||||
|
||||
@Override
|
||||
public void sendMessage(String subChannel, String... messageData) {
|
||||
if (method.equals(BungeeMethod.MYSQL)) {
|
||||
// plugin.getPluginMessaging().sendPluginMessage(subChannel, messageData);
|
||||
|
||||
try {
|
||||
backendMysqlMessenger.sendToProxy(subChannel + "%l%" + String.join("%l%", messageData));
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
|
||||
plugin.getPluginMessaging().sendPluginMessage(subChannel, messageData);
|
||||
} else if (method.equals(BungeeMethod.SOCKETS)) {
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
list.add(subChannel);
|
||||
list.addAll(ArrayUtils.convert(messageData));
|
||||
sendData(ArrayUtils.convert(list));
|
||||
} else if (method.equals(BungeeMethod.REDIS)) {
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
list.add(subChannel);
|
||||
list.addAll(ArrayUtils.convert(messageData));
|
||||
redisHandler.sendMessage(plugin.getBungeeSettings().getRedisPrefix() + "VotingPlugin",
|
||||
ArrayUtils.convert(list));
|
||||
} else if (method.equals(BungeeMethod.MQTT)) {
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
list.add(subChannel);
|
||||
list.addAll(ArrayUtils.convert(messageData));
|
||||
try {
|
||||
mqttHandler.publish(plugin.getBungeeSettings().getMqttPrefix() + "votingplugin/servers/proxy",
|
||||
String.join(":", list));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
globalMessageHandler.addListener(new GlobalMessageListener("Vote") {
|
||||
|
||||
@Override
|
||||
public void onReceive(ArrayList<String> args) {
|
||||
if (args.size() > 8) {
|
||||
int bungeeVersion = Integer.parseInt(args.get(8));
|
||||
if (bungeeVersion != BungeeVersion.getPluginMessageVersion()) {
|
||||
plugin.getLogger().warning("Incompatible version with bungee, please update all servers"
|
||||
+ bungeeVersion + ":" + BungeeVersion.getPluginMessageVersion());
|
||||
return;
|
||||
}
|
||||
|
||||
String player = args.get(0);
|
||||
String uuid = args.get(1);
|
||||
String service = args.get(2);
|
||||
long time = Long.parseLong(args.get(3));
|
||||
plugin.debug("pluginmessaging vote received from " + player + "/" + uuid + " on " + service);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager()
|
||||
.getVotingPluginUser(UUID.fromString(uuid), player);
|
||||
|
||||
boolean wasOnline = Boolean.valueOf(args.get(4));
|
||||
|
||||
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.cache();
|
||||
|
||||
boolean broadcast = true;
|
||||
boolean bungeeBroadcast = false;
|
||||
|
||||
if (args.size() > 9) {
|
||||
bungeeBroadcast = Boolean.valueOf(args.get(9));
|
||||
}
|
||||
|
||||
int num = 1;
|
||||
if (args.size() > 10) {
|
||||
num = Integer.valueOf(args.get(10));
|
||||
}
|
||||
int numberOfVotes = 1;
|
||||
if (args.size() > 11) {
|
||||
numberOfVotes = Integer.valueOf(args.get(11));
|
||||
}
|
||||
|
||||
if (!bungeeBroadcast) {
|
||||
if (!plugin.getBungeeSettings().isBungeeBroadcast()
|
||||
&& !plugin.getBungeeSettings().isDisableBroadcast()) {
|
||||
if (wasOnline || plugin.getBungeeSettings().isBungeeBroadcastAlways()) {
|
||||
if (plugin.getConfigFile().isFormatOnlyOneOfflineBroadcast() && !wasOnline) {
|
||||
if (num == 1) {
|
||||
user.offlineBroadcast(user, plugin.getBungeeSettings().isUseBungeecoord(),
|
||||
numberOfVotes);
|
||||
}
|
||||
} else {
|
||||
VoteSite site = plugin.getVoteSite(service, true);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, false);
|
||||
broadcast = false;
|
||||
} else {
|
||||
plugin.getLogger().warning("No votesite for " + service);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
broadcast = false;
|
||||
}
|
||||
|
||||
user.bungeeVotePluginMessaging(service, time, text, !setTotals, wasOnline, broadcast, num);
|
||||
if (plugin.getBungeeSettings().isPerServerPoints()) {
|
||||
user.addPoints(plugin.getConfigFile().getPointsOnVote());
|
||||
}
|
||||
|
||||
plugin.getSpecialRewards().bungeeAllSitesCheck(user, numberOfVotes, num);
|
||||
|
||||
if (Boolean.valueOf(args.get(5))) {
|
||||
plugin.getServerData().addServiceSite(service);
|
||||
}
|
||||
} else {
|
||||
plugin.getLogger().warning("Incompatible version with bungee, please update all servers");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
globalMessageHandler.addListener(new GlobalMessageListener("VoteOnline") {
|
||||
|
||||
@Override
|
||||
public void onReceive(ArrayList<String> args) {
|
||||
if (args.size() > 8) {
|
||||
int bungeeVersion = Integer.parseInt(args.get(8));
|
||||
if (bungeeVersion != BungeeVersion.getPluginMessageVersion()) {
|
||||
plugin.getLogger().warning("Incompatible version with bungee, please update all servers");
|
||||
return;
|
||||
}
|
||||
String player = args.get(0);
|
||||
String uuid = args.get(1);
|
||||
String service = args.get(2);
|
||||
long time = Long.parseLong(args.get(3));
|
||||
BungeeMessageData text = new BungeeMessageData(args.get(6));
|
||||
|
||||
bungeeVotePartyCurrent = text.getVotePartyCurrent();
|
||||
bungeeVotePartyRequired = text.getVotePartyRequired();
|
||||
plugin.getPlaceholders().onBungeeVotePartyUpdate();
|
||||
plugin.getServerData().setBungeeVotePartyCurrent(bungeeVotePartyCurrent);
|
||||
plugin.getServerData().setBungeeVotePartyRequired(bungeeVotePartyRequired);
|
||||
|
||||
plugin.debug("pluginmessaging voteonline received from " + player + "/" + uuid + " on " + service);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager()
|
||||
.getVotingPluginUser(UUID.fromString(uuid), player);
|
||||
user.cache();
|
||||
|
||||
boolean setTotals = Boolean.valueOf(args.get(7));
|
||||
|
||||
boolean wasOnline = Boolean.valueOf(args.get(4));
|
||||
|
||||
boolean broadcast = true;
|
||||
boolean bungeeBroadcast = false;
|
||||
|
||||
if (args.size() > 9) {
|
||||
bungeeBroadcast = Boolean.valueOf(args.get(9));
|
||||
}
|
||||
|
||||
int num = 1;
|
||||
if (args.size() > 10) {
|
||||
num = Integer.valueOf(args.get(10));
|
||||
}
|
||||
|
||||
int numberOfVotes = 1;
|
||||
if (args.size() > 11) {
|
||||
numberOfVotes = Integer.valueOf(args.get(11));
|
||||
}
|
||||
|
||||
if (!bungeeBroadcast) {
|
||||
if (!plugin.getBungeeSettings().isBungeeBroadcast()
|
||||
&& !plugin.getBungeeSettings().isDisableBroadcast()) {
|
||||
if (wasOnline || plugin.getBungeeSettings().isBungeeBroadcastAlways()) {
|
||||
if (plugin.getConfigFile().isFormatOnlyOneOfflineBroadcast() && !wasOnline) {
|
||||
if (num == 1) {
|
||||
user.offlineBroadcast(user, plugin.getBungeeSettings().isUseBungeecoord(),
|
||||
numberOfVotes);
|
||||
}
|
||||
} else {
|
||||
VoteSite site = plugin.getVoteSite(service, true);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, false);
|
||||
broadcast = false;
|
||||
} else {
|
||||
plugin.getLogger().warning("No votesite for " + service);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
broadcast = false;
|
||||
}
|
||||
|
||||
user.bungeeVotePluginMessaging(service, time, text, !setTotals, wasOnline, broadcast, num);
|
||||
if (plugin.getBungeeSettings().isPerServerPoints()) {
|
||||
user.addPoints(plugin.getConfigFile().getPointsOnVote());
|
||||
}
|
||||
|
||||
plugin.getSpecialRewards().bungeeAllSitesCheck(user, numberOfVotes, num);
|
||||
|
||||
if (Boolean.valueOf(args.get(5))) {
|
||||
plugin.getServerData().addServiceSite(service);
|
||||
}
|
||||
} else {
|
||||
plugin.getLogger().warning("Incompatible version with bungee, please update all servers");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
globalMessageHandler.addListener(new GlobalMessageListener("VoteUpdate") {
|
||||
|
||||
@Override
|
||||
public void onReceive(ArrayList<String> args) {
|
||||
String player = args.get(0);
|
||||
plugin.debug("pluginmessaging voteupdate received for " + player);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager()
|
||||
.getVotingPluginUser(UUID.fromString(player));
|
||||
user.cache();
|
||||
|
||||
user.offVote();
|
||||
|
||||
if (args.size() > 2) {
|
||||
bungeeVotePartyCurrent = Integer.parseInt(args.get(1));
|
||||
bungeeVotePartyRequired = Integer.parseInt(args.get(2));
|
||||
plugin.getServerData().setBungeeVotePartyCurrent(bungeeVotePartyCurrent);
|
||||
plugin.getServerData().setBungeeVotePartyRequired(bungeeVotePartyRequired);
|
||||
}
|
||||
|
||||
if (args.size() > 3 && plugin.getBungeeSettings().isPerServerMilestones()) {
|
||||
BungeeMessageData text = new BungeeMessageData(args.get(3));
|
||||
plugin.getSpecialRewards().checkMilestone(user, text, true);
|
||||
}
|
||||
|
||||
if (args.size() > 5) {
|
||||
String service = args.get(4);
|
||||
String data = args.get(5);
|
||||
if (MessageAPI.isLong(data)) {
|
||||
long time = Long.valueOf(data);
|
||||
if (time > 0) {
|
||||
user.setTime(plugin.getVoteSite(service, true), time);
|
||||
} else {
|
||||
if (plugin.getBungeeSettings().isBungeeDebug()) {
|
||||
plugin.debug("Invalid last vote time received from bungee: " + time);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugin.setUpdate(true);
|
||||
}
|
||||
});
|
||||
|
||||
globalMessageHandler.addListener(new GlobalMessageListener("BungeeTimeChange") {
|
||||
|
||||
@Override
|
||||
public void onReceive(ArrayList<String> args) {
|
||||
checkGlobalData();
|
||||
}
|
||||
});
|
||||
|
||||
globalMessageHandler.addListener(new GlobalMessageListener("VoteBroadcast") {
|
||||
|
||||
@Override
|
||||
public void onReceive(ArrayList<String> args) {
|
||||
if (args.size() > 2) {
|
||||
String uuid = args.get(0);
|
||||
String service = args.get(2);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager()
|
||||
.getVotingPluginUser(UUID.fromString(uuid), args.get(1));
|
||||
VoteSite site = plugin.getVoteSite(service, true);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, false);
|
||||
} else {
|
||||
plugin.getLogger().warning("No votesite for " + service);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
globalMessageHandler.addListener(new GlobalMessageListener("VoteBroadcastOffline") {
|
||||
|
||||
@Override
|
||||
public void onReceive(ArrayList<String> args) {
|
||||
if (args.size() > 2) {
|
||||
String uuid = args.get(0);
|
||||
String votes = args.get(2);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager()
|
||||
.getVotingPluginUser(UUID.fromString(uuid), args.get(1));
|
||||
user.offlineBroadcast(user, false, Integer.parseInt(votes));
|
||||
}
|
||||
}
|
||||
});
|
||||
globalMessageHandler.addListener(new GlobalMessageListener("Status") {
|
||||
|
||||
@Override
|
||||
public void onReceive(ArrayList<String> args) {
|
||||
String server = args.get(0);
|
||||
sendMessage(globalMessageHandler, "statusokay", server);
|
||||
}
|
||||
});
|
||||
globalMessageHandler.addListener(new GlobalMessageListener("ServerName") {
|
||||
|
||||
@Override
|
||||
public void onReceive(ArrayList<String> args) {
|
||||
String server = args.get(0);
|
||||
if (!plugin.getOptions().getServer().equals(server)) {
|
||||
plugin.getLogger().warning("Server name doesn't match in BungeeSettings.yml, should be " + server);
|
||||
}
|
||||
}
|
||||
});
|
||||
globalMessageHandler.addListener(new GlobalMessageListener("VotePartyBungee") {
|
||||
|
||||
@Override
|
||||
public void onReceive(ArrayList<String> args) {
|
||||
for (final String cmd : plugin.getBungeeSettings().getBungeeVotePartyGlobalCommands()) {
|
||||
plugin.getBukkitScheduler().runTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
new RewardBuilder(plugin.getBungeeSettings().getData(), "BungeeVotePartyRewards").send(p);
|
||||
}
|
||||
}
|
||||
});
|
||||
globalMessageHandler.addListener(new GlobalMessageListener("VotePartyBroadcast") {
|
||||
|
||||
@Override
|
||||
public void onReceive(ArrayList<String> args) {
|
||||
String broadcast = args.get(0);
|
||||
MiscUtils.getInstance().broadcast(broadcast);
|
||||
}
|
||||
});
|
||||
|
||||
if (method.equals(BungeeMethod.MYSQL)) {
|
||||
plugin.registerBungeeChannels(plugin.getBungeeSettings().getPluginMessagingChannel());
|
||||
|
||||
try {
|
||||
backendMysqlMessenger = new BackendMessenger("VotingPlugin",
|
||||
plugin.getMysql().getMysql().getConnectionManager().getDataSource(),
|
||||
plugin.getOptions().getServer(), msg -> {
|
||||
plugin.debug("Proxy sent: " + msg.payload);
|
||||
|
||||
String[] message = msg.payload.split(Pattern.quote("%l%"));
|
||||
if (message.length > 0) {
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
for (int i = 1; i < message.length; i++) {
|
||||
list.add(message[i]);
|
||||
}
|
||||
globalMessageHandler.onMessage(message[0], list);
|
||||
}
|
||||
|
||||
});
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if (method.equals(BungeeMethod.REDIS)) {
|
||||
redisHandler = new RedisHandler(plugin.getBungeeSettings().getRedisHost(),
|
||||
plugin.getBungeeSettings().getRedisPort(), plugin.getBungeeSettings().getRedisUsername(),
|
||||
plugin.getBungeeSettings().getRedisPassword()) {
|
||||
|
||||
@Override
|
||||
public void debug(String message) {
|
||||
if (plugin.getBungeeSettings().isBungeeDebug()) {
|
||||
plugin.debug(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMessage(String channel, String[] message) {
|
||||
if (plugin.getBungeeSettings().isBungeeDebug()) {
|
||||
plugin.debug(channel + " " + ArrayUtils.makeStringList(ArrayUtils.convert(message)));
|
||||
}
|
||||
if (message.length > 0) {
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
for (int i = 1; i < message.length; i++) {
|
||||
list.add(message[i]);
|
||||
}
|
||||
globalMessageHandler.onMessage(message[0], list);
|
||||
}
|
||||
}
|
||||
};
|
||||
redisThread = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (plugin.isEnabled()) {
|
||||
redisHandler.loadListener(
|
||||
new RedisListener(redisHandler, plugin.getBungeeSettings().getRedisPrefix()
|
||||
+ "VotingPlugin_" + plugin.getBungeeSettings().getServer()));
|
||||
}
|
||||
}
|
||||
});
|
||||
redisThread.start();
|
||||
|
||||
} else if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
|
||||
plugin.registerBungeeChannels(plugin.getBungeeSettings().getPluginMessagingChannel());
|
||||
|
||||
if (plugin.getBungeeSettings().isPluginMessageEncryption()) {
|
||||
encryptionHandler = new EncryptionHandler(plugin.getName(),
|
||||
new File(plugin.getDataFolder(), "secretkey.key"));
|
||||
plugin.getPluginMessaging().setEncryptionHandler(encryptionHandler);
|
||||
}
|
||||
|
||||
plugin.getPluginMessaging().setDebug(plugin.getBungeeSettings().isBungeeDebug());
|
||||
|
||||
plugin.getPluginMessaging().add(new PluginMessageHandler() {
|
||||
@Override
|
||||
public void onRecieve(String subChannel, ArrayList<String> args) {
|
||||
globalMessageHandler.onMessage(subChannel, args);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
} else if (method.equals(BungeeMethod.SOCKETS)) {
|
||||
encryptionHandler = new EncryptionHandler(plugin.getName(),
|
||||
new File(plugin.getDataFolder(), "secretkey.key"));
|
||||
|
||||
clientHandler = new ClientHandler(plugin.getBungeeSettings().getBungeeServerHost(),
|
||||
plugin.getBungeeSettings().getBungeeServerPort(), encryptionHandler,
|
||||
plugin.getBungeeSettings().isBungeeDebug());
|
||||
|
||||
socketHandler = new SocketHandler(plugin.getVersion(), plugin.getBungeeSettings().getSpigotServerHost(),
|
||||
plugin.getBungeeSettings().getSpigotServerPort(), encryptionHandler,
|
||||
plugin.getBungeeSettings().isBungeeDebug()) {
|
||||
|
||||
@Override
|
||||
public void log(String str) {
|
||||
plugin.getLogger().info(str);
|
||||
}
|
||||
};
|
||||
|
||||
socketHandler.add(new SocketReceiver() {
|
||||
|
||||
@Override
|
||||
public void onReceive(String[] data) {
|
||||
globalMessageHandler.onMessage(data[0], ArrayUtils.convertAndRemoveFirst(data));
|
||||
}
|
||||
});
|
||||
|
||||
} else if (method.equals(BungeeMethod.MQTT)) {
|
||||
try {
|
||||
String id = plugin.getBungeeSettings().getMqttClientID();
|
||||
if (id.isEmpty()) {
|
||||
id = plugin.getOptions().getServer();
|
||||
}
|
||||
mqttHandler = new MqttHandler(new MqttServerComm(plugin.getBungeeSettings().getMqttClientID(),
|
||||
plugin.getBungeeSettings().getMqttBrokerURL(), plugin.getBungeeSettings().getMqttUsername(),
|
||||
plugin.getBungeeSettings().getMqttPassword()), 2);
|
||||
mqttHandler.subscribe(plugin.getBungeeSettings().getMqttPrefix() + "votingplugin/servers/"
|
||||
+ plugin.getOptions().getServer(), new MessageHandler() {
|
||||
|
||||
@Override
|
||||
public void onMessage(String topic, String payload) {
|
||||
String[] message = payload.split(":");
|
||||
|
||||
if (message.length > 0) {
|
||||
globalMessageHandler.onMessage(message[0],
|
||||
ArrayUtils.convertAndRemoveFirst(message));
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (MqttException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
bungeeVotePartyCurrent = plugin.getServerData().getBungeeVotePartyCurrent();
|
||||
bungeeVotePartyRequired = plugin.getServerData().getBungeeVotePartyRequired();
|
||||
|
||||
if (plugin.getOptions().getServer().equalsIgnoreCase("pleaseset")) {
|
||||
plugin.getLogger().warning("Server name for bungee voting is not set, please set it");
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
private MqttHandler mqttHandler;
|
||||
|
||||
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 debugEx(Exception e) {
|
||||
plugin.debug(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debugLog(String text) {
|
||||
plugin.debug(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(String text) {
|
||||
plugin.getLogger().info(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logSevere(String text) {
|
||||
plugin.getLogger().severe(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warning(String text) {
|
||||
plugin.getLogger().warning(text);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
globalDataHandler = new GlobalDataHandler(
|
||||
new GlobalMySQL("VotingPlugin_GlobalData", new MysqlConfigSpigot(
|
||||
plugin.getBungeeSettings().getData().getConfigurationSection("GlobalData"))) {
|
||||
|
||||
@Override
|
||||
public void debugEx(Exception e) {
|
||||
plugin.debug(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debugLog(String text) {
|
||||
plugin.debug(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(String text) {
|
||||
plugin.getLogger().info(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logSevere(String text) {
|
||||
plugin.getLogger().severe(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warning(String text) {
|
||||
plugin.getLogger().warning(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 sendData(String... strings) {
|
||||
clientHandler.sendMessage(strings);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.bencodez.votingplugin;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.bencodez.advancedcore.api.rewards.injected.RewardInject;
|
||||
import com.bencodez.advancedcore.api.rewards.injectedrequirement.RequirementInject;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VotingPluginHooks {
|
||||
private static VotingPluginHooks instance = new VotingPluginHooks();
|
||||
|
||||
public static VotingPluginHooks getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void addCustomRequirement(RequirementInject inject) {
|
||||
getMainClass().getRewardHandler().addInjectedRequirements(inject);
|
||||
}
|
||||
|
||||
public void addCustomReward(RewardInject inject) {
|
||||
getMainClass().getRewardHandler().addInjectedReward(inject);
|
||||
}
|
||||
|
||||
public void backgroundUpdate(Player player) {
|
||||
VotingPluginUser user = getUserManager().getVotingPluginUser(player);
|
||||
user.offVote();
|
||||
user.checkOfflineRewards();
|
||||
}
|
||||
|
||||
public VotingPluginMain getMainClass() {
|
||||
return VotingPluginMain.plugin;
|
||||
}
|
||||
|
||||
public UserManager getUserManager() {
|
||||
return getMainClass().getVotingPluginUserManager();
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,372 @@
|
||||
package com.bencodez.votingplugin;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import com.bencodez.simpleapi.metrics.BStatsMetrics;
|
||||
|
||||
public class VotingPluginMetrics {
|
||||
|
||||
public void load(VotingPluginMain plugin) {
|
||||
BStatsMetrics metrics = new BStatsMetrics(plugin, 38);
|
||||
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_firstvote", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
if (plugin.getRewardHandler().hasRewards(plugin.getSpecialRewardsConfig().getData(),
|
||||
plugin.getSpecialRewardsConfig().getFirstVoteRewardsPath())) {
|
||||
return "True";
|
||||
}
|
||||
return "False";
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_everysite", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
if (plugin.getRewardHandler().hasRewards(plugin.getConfigVoteSites().getData(),
|
||||
plugin.getConfigVoteSites().getEverySiteRewardPath())) {
|
||||
return "True";
|
||||
}
|
||||
return "False";
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_allsites", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
if (plugin.getRewardHandler().hasRewards(plugin.getSpecialRewardsConfig().getData(),
|
||||
plugin.getSpecialRewardsConfig().getAllSitesRewardPath())) {
|
||||
return "True";
|
||||
}
|
||||
return "False";
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_cumulative", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
if (plugin.getSpecialRewardsConfig().getCumulativeVotes().size() == 0) {
|
||||
return "False";
|
||||
}
|
||||
for (String cum : plugin.getSpecialRewardsConfig().getCumulativeVotes()) {
|
||||
if (plugin.getSpecialRewardsConfig().getCumulativeRewardEnabled(Integer.parseInt(cum))) {
|
||||
return "True";
|
||||
}
|
||||
}
|
||||
return "False";
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_voteparty", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
if (!plugin.getSpecialRewardsConfig().isVotePartyEnabled()) {
|
||||
return "False";
|
||||
}
|
||||
return "True";
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("placeholder_cache_level", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return plugin.getPlaceholders().getCacheLevel().toString();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_milestone", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
if (plugin.getSpecialRewardsConfig().getMilestoneVotes().size() == 0) {
|
||||
return "False";
|
||||
}
|
||||
for (String milestone : plugin.getSpecialRewardsConfig().getMilestoneVotes()) {
|
||||
if (plugin.getSpecialRewardsConfig().getMilestoneRewardEnabled(Integer.parseInt(milestone))) {
|
||||
return "True";
|
||||
}
|
||||
}
|
||||
return "False";
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_anysitereward", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
if (plugin.getRewardHandler().hasRewards(plugin.getSpecialRewardsConfig().getData(),
|
||||
plugin.getSpecialRewardsConfig().getAnySiteRewardsPath())) {
|
||||
return "True";
|
||||
}
|
||||
return "False";
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_votestreakday", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
for (String s : plugin.getSpecialRewardsConfig().getVoteStreakVotes("Day")) {
|
||||
|
||||
if (plugin.getSpecialRewardsConfig().getVoteStreakRewardEnabled("Day", s)
|
||||
&& plugin.getRewardHandler().hasRewards(plugin.getSpecialRewardsConfig().getData(),
|
||||
plugin.getSpecialRewardsConfig().getVoteStreakRewardsPath("Day", s))) {
|
||||
return "True";
|
||||
}
|
||||
|
||||
}
|
||||
return "False";
|
||||
}
|
||||
}));
|
||||
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_votestreakweek", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
for (String s : plugin.getSpecialRewardsConfig().getVoteStreakVotes("Week")) {
|
||||
|
||||
if (plugin.getSpecialRewardsConfig().getVoteStreakRewardEnabled("Week", s)
|
||||
&& plugin.getRewardHandler().hasRewards(plugin.getSpecialRewardsConfig().getData(),
|
||||
plugin.getSpecialRewardsConfig().getVoteStreakRewardsPath("Week", s))) {
|
||||
return "True";
|
||||
}
|
||||
}
|
||||
|
||||
return "False";
|
||||
}
|
||||
}));
|
||||
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_votestreakmonth", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
for (String s : plugin.getSpecialRewardsConfig().getVoteStreakVotes("Month")) {
|
||||
|
||||
if (plugin.getSpecialRewardsConfig().getVoteStreakRewardEnabled("Month", s)
|
||||
&& plugin.getRewardHandler().hasRewards(plugin.getSpecialRewardsConfig().getData(),
|
||||
plugin.getSpecialRewardsConfig().getVoteStreakRewardsPath("Month", s))) {
|
||||
return "True";
|
||||
}
|
||||
}
|
||||
|
||||
return "False";
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("numberofsites", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getVoteSitesEnabled().size();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("numberofrewards", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getRewardHandler().getRewards().size();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("autocreatevotesites", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getConfigFile().isAutoCreateVoteSites();
|
||||
}
|
||||
}));
|
||||
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("numberofusers", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
int total = plugin.getUserManager().getAllUUIDs().size();
|
||||
if (total > 800000) {
|
||||
return ">800000";
|
||||
}
|
||||
if (total > 700000) {
|
||||
return "700000-800000";
|
||||
}
|
||||
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-100000";
|
||||
}
|
||||
return "<10000";
|
||||
}
|
||||
}));
|
||||
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("data_storage", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return plugin.getOptions().getStorageType().toString();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("DisableCheckOnWorldChange", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getOptions().isDisableCheckOnWorldChange();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("votereminding_enabled", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getConfigFile().isVoteRemindingEnabled();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("LoadTopVoter_Monthly", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getConfigFile().isLoadTopVoterMonthly();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("LoadTopVoter_Weekly", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getConfigFile().isLoadTopVoterWeekly();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("LoadTopVoter_Daily", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getConfigFile().isLoadTopVoterDaily();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("bungeemethod", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
if (plugin.getBungeeSettings().isUseBungeecoord()) {
|
||||
return "" + plugin.getBungeeHandler().getMethod().toString();
|
||||
}
|
||||
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("bedrockplayerprefix", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getOptions().getBedrockPlayerPrefix();
|
||||
}
|
||||
}));
|
||||
|
||||
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"));
|
||||
}
|
||||
}));
|
||||
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("background_task_time_taken", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getLastBackgroundTaskTimeTaken();
|
||||
}
|
||||
}));
|
||||
|
||||
if (!plugin.getBuildNumber().equals("NOTSET")) {
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("dev_build_number", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getBuildNumber();
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.bencodez.votingplugin.broadcast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.bencodez.advancedcore.api.messages.PlaceholderUtils;
|
||||
import com.bencodez.advancedcore.api.misc.MiscUtils;
|
||||
import com.bencodez.simpleapi.messages.MessageAPI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
public class BroadcastHandler {
|
||||
private VotingPluginMain plugin;
|
||||
private ScheduledExecutorService timer;
|
||||
ConcurrentLinkedQueue<String> votedPlayers = new ConcurrentLinkedQueue<>();
|
||||
|
||||
public BroadcastHandler(VotingPluginMain plugin, int delay) {
|
||||
this.plugin = plugin;
|
||||
schedule(delay);
|
||||
}
|
||||
|
||||
public void check() {
|
||||
int size = votedPlayers.size();
|
||||
if (size > 0) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
votedPlayers.poll();
|
||||
}
|
||||
String bc = MessageAPI.colorize(plugin.getConfigFile().getFormatAlternateBroadcastBroadcast());
|
||||
String playersText = "";
|
||||
while (!votedPlayers.isEmpty()) {
|
||||
playersText += votedPlayers.remove();
|
||||
if (!votedPlayers.isEmpty()) {
|
||||
playersText += ", ";
|
||||
}
|
||||
}
|
||||
HashMap<String, String> placeholders = new HashMap<>();
|
||||
placeholders.put("numberofplayers", "" + size);
|
||||
placeholders.put("players", playersText);
|
||||
bc = PlaceholderUtils.replacePlaceHolder(bc, placeholders);
|
||||
ArrayList<Player> players = new ArrayList<>();
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (!plugin.getVotingPluginUserManager().getVotingPluginUser(p).getDisableBroadcast()) {
|
||||
players.add(p);
|
||||
}
|
||||
}
|
||||
|
||||
MiscUtils.getInstance().broadcast(bc, players);
|
||||
}
|
||||
}
|
||||
|
||||
public void onVote(String player) {
|
||||
votedPlayers.add(player);
|
||||
}
|
||||
|
||||
public void schedule(int delay) {
|
||||
if (timer != null) {
|
||||
timer.shutdownNow();
|
||||
timer = Executors.newScheduledThreadPool(1);
|
||||
} else {
|
||||
timer = Executors.newScheduledThreadPool(1);
|
||||
}
|
||||
timer.scheduleWithFixedDelay(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
check();
|
||||
}
|
||||
}, 60, 60 * delay, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,44 @@
|
||||
package com.bencodez.votingplugin.commands.executers;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.bencodez.advancedcore.api.command.CommandHandler;
|
||||
import com.bencodez.simpleapi.messages.MessageAPI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class CommandAdminVote.
|
||||
*/
|
||||
public class CommandAdminVote implements CommandExecutor {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public CommandAdminVote(VotingPluginMain plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.bukkit.command.CommandExecutor#onCommand(org.bukkit.command.
|
||||
* CommandSender , org.bukkit.command.Command, java.lang.String,
|
||||
* java.lang.String[])
|
||||
*/
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
for (CommandHandler commandHandler : plugin.getAdminVoteCommand()) {
|
||||
if (commandHandler.runCommand(sender, args)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// invalid command
|
||||
sender.sendMessage(MessageAPI.colorize(plugin.getConfigFile().getFormatInvalidCommandAdminVote()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+100
-99
@@ -1,99 +1,100 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Commands.Executers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.CommandAPI.CommandHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class CommandAliases.
|
||||
*/
|
||||
public class CommandAliases implements CommandExecutor {
|
||||
|
||||
/** The plugin. */
|
||||
private Main plugin = Main.plugin;
|
||||
|
||||
/** The cmd handle. */
|
||||
private CommandHandler cmdHandle;
|
||||
|
||||
private boolean adminCommand;
|
||||
|
||||
public CommandAliases(CommandHandler cmdHandle, boolean adminCommand) {
|
||||
this.cmdHandle = cmdHandle;
|
||||
this.adminCommand = adminCommand;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.bukkit.command.CommandExecutor#onCommand(org.bukkit.command.
|
||||
* CommandSender , org.bukkit.command.Command, java.lang.String,
|
||||
* java.lang.String[])
|
||||
*/
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
|
||||
ArrayList<String> argsNew = new ArrayList<String>();
|
||||
argsNew.add(cmdHandle.getArgs()[0]);
|
||||
for (String arg : args) {
|
||||
argsNew.add(arg);
|
||||
}
|
||||
plugin.debug("Attempting cmd...");
|
||||
plugin.debug("Inputed args: " + ArrayUtils.getInstance().makeStringList(argsNew));
|
||||
|
||||
ArrayList<CommandHandler> handles = new ArrayList<CommandHandler>();
|
||||
if (adminCommand) {
|
||||
handles.addAll(plugin.getAdminVoteCommand());
|
||||
} else {
|
||||
handles.addAll(plugin.getVoteCommand());
|
||||
}
|
||||
|
||||
for (CommandHandler cmdHandle : handles) {
|
||||
if (cmdHandle.getArgs().length > args.length) {
|
||||
for (String arg : cmdHandle.getArgs()[0].split("&")) {
|
||||
if (cmd.getName().equalsIgnoreCase("vote" + arg)
|
||||
|| cmd.getName().equalsIgnoreCase("adminvote" + arg)) {
|
||||
argsNew.set(0, arg);
|
||||
|
||||
boolean argsMatch = true;
|
||||
for (int i = 0; i < argsNew.size(); i++) {
|
||||
if (i < cmdHandle.getArgs().length) {
|
||||
if (!cmdHandle.argsMatch(argsNew.get(i), i)) {
|
||||
argsMatch = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (argsMatch) {
|
||||
if (cmdHandle.runCommand(sender, ArrayUtils.getInstance().convert(argsNew))) {
|
||||
plugin.debug("cmd found, ran cmd");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* for (String arg : cmdHandle.getArgs()[0].split("&")) { argsNew.set(0, arg);
|
||||
* if (cmdHandle.runCommand(sender, Utils.getInstance().convertArray(argsNew)))
|
||||
* { plugin.debug( "cmd found, ran cmd"); return true; } }
|
||||
*/
|
||||
|
||||
// invalid command
|
||||
if (adminCommand) {
|
||||
sender.sendMessage(ChatColor.RED + "No valid arguments, see /adminvote help!");
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "No valid arguments, see /vote help!");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
package com.bencodez.votingplugin.commands.executers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.bencodez.advancedcore.api.command.CommandHandler;
|
||||
import com.bencodez.simpleapi.array.ArrayUtils;
|
||||
import com.bencodez.simpleapi.messages.MessageAPI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class CommandAliases.
|
||||
*/
|
||||
public class CommandAliases implements CommandExecutor {
|
||||
|
||||
private boolean adminCommand;
|
||||
|
||||
/** The cmd handle. */
|
||||
private CommandHandler cmdHandle;
|
||||
|
||||
/** The plugin. */
|
||||
private VotingPluginMain plugin = VotingPluginMain.plugin;
|
||||
|
||||
public CommandAliases(CommandHandler cmdHandle, boolean adminCommand) {
|
||||
this.cmdHandle = cmdHandle;
|
||||
this.adminCommand = adminCommand;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.bukkit.command.CommandExecutor#onCommand(org.bukkit.command.
|
||||
* CommandSender , org.bukkit.command.Command, java.lang.String,
|
||||
* java.lang.String[])
|
||||
*/
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
|
||||
ArrayList<String> argsNew = new ArrayList<>();
|
||||
argsNew.add(cmdHandle.getArgs()[0]);
|
||||
for (String arg : args) {
|
||||
argsNew.add(arg);
|
||||
}
|
||||
plugin.debug("Attempting cmd...");
|
||||
plugin.debug("Inputed args: " + ArrayUtils.makeStringList(argsNew));
|
||||
|
||||
ArrayList<CommandHandler> handles = new ArrayList<>();
|
||||
if (adminCommand) {
|
||||
handles.addAll(plugin.getAdminVoteCommand());
|
||||
} else {
|
||||
handles.addAll(plugin.getVoteCommand());
|
||||
}
|
||||
|
||||
for (CommandHandler cmdHandle : handles) {
|
||||
if (cmdHandle.getArgs().length > args.length) {
|
||||
for (String arg : cmdHandle.getArgs()[0].split("&")) {
|
||||
if (cmd.getName().equalsIgnoreCase("vote" + arg)
|
||||
|| cmd.getName().equalsIgnoreCase("adminvote" + arg)) {
|
||||
argsNew.set(0, arg);
|
||||
|
||||
boolean argsMatch = true;
|
||||
for (int i = 0; i < argsNew.size(); i++) {
|
||||
if (i < cmdHandle.getArgs().length) {
|
||||
if (!cmdHandle.argsMatch(argsNew.get(i), i)) {
|
||||
argsMatch = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (argsMatch) {
|
||||
if (cmdHandle.runCommand(sender, ArrayUtils.convert(argsNew))) {
|
||||
plugin.debug("cmd found, ran cmd");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* for (String arg : cmdHandle.getArgs()[0].split("&")) { argsNew.set(0, arg);
|
||||
* if (cmdHandle.runCommand(sender, Utils.getInstance().convertArray(argsNew)))
|
||||
* { plugin.debug( "cmd found, ran cmd"); return true; } }
|
||||
*/
|
||||
|
||||
// invalid command
|
||||
if (adminCommand) {
|
||||
sender.sendMessage(MessageAPI.colorize(plugin.getConfigFile().getFormatInvalidCommandAdminVote()));
|
||||
} else {
|
||||
sender.sendMessage(MessageAPI.colorize(plugin.getConfigFile().getFormatInvalidCommandVote()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+68
-68
@@ -1,68 +1,68 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Commands.Executers;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.CommandAPI.CommandHandler;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class CommandVote.
|
||||
*/
|
||||
public class CommandVote implements CommandExecutor {
|
||||
|
||||
/** The instance. */
|
||||
private static CommandVote instance = new CommandVote();
|
||||
|
||||
/** The plugin. */
|
||||
private static Main plugin;
|
||||
|
||||
/**
|
||||
* Gets the single instance of CommandVote.
|
||||
*
|
||||
* @return single instance of CommandVote
|
||||
*/
|
||||
public static CommandVote getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new command vote.
|
||||
*/
|
||||
private CommandVote() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new command vote.
|
||||
*
|
||||
* @param plugin
|
||||
* the plugin
|
||||
*/
|
||||
public CommandVote(Main plugin) {
|
||||
CommandVote.plugin = plugin;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.bukkit.command.CommandExecutor#onCommand(org.bukkit.command.
|
||||
* CommandSender , org.bukkit.command.Command, java.lang.String,
|
||||
* java.lang.String[])
|
||||
*/
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
|
||||
for (CommandHandler commandHandler : plugin.getVoteCommand()) {
|
||||
if (commandHandler.runCommand(sender, args)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// invalid command
|
||||
sender.sendMessage(ChatColor.RED + "No valid arguments, see /vote help!");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
package com.bencodez.votingplugin.commands.executers;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.bencodez.advancedcore.api.command.CommandHandler;
|
||||
import com.bencodez.simpleapi.messages.MessageAPI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class CommandVote.
|
||||
*/
|
||||
public class CommandVote implements CommandExecutor {
|
||||
|
||||
/** The instance. */
|
||||
private static CommandVote instance = new CommandVote();
|
||||
|
||||
/** The plugin. */
|
||||
private static VotingPluginMain plugin;
|
||||
|
||||
/**
|
||||
* Gets the single instance of CommandVote.
|
||||
*
|
||||
* @return single instance of CommandVote
|
||||
*/
|
||||
public static CommandVote getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new command vote.
|
||||
*/
|
||||
private CommandVote() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new command vote.
|
||||
*
|
||||
* @param plugin the plugin
|
||||
*/
|
||||
public CommandVote(VotingPluginMain plugin) {
|
||||
CommandVote.plugin = plugin;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.bukkit.command.CommandExecutor#onCommand(org.bukkit.command.
|
||||
* CommandSender , org.bukkit.command.Command, java.lang.String,
|
||||
* java.lang.String[])
|
||||
*/
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
|
||||
for (CommandHandler commandHandler : plugin.getVoteCommand()) {
|
||||
if (commandHandler.runCommand(sender, args)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// invalid command
|
||||
sender.sendMessage(MessageAPI.colorize(plugin.getConfigFile().getFormatInvalidCommandVote()));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,466 @@
|
||||
package com.bencodez.votingplugin.commands.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.bencodez.advancedcore.api.gui.GUIMethod;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
|
||||
import com.bencodez.advancedcore.api.inventory.editgui.EditGUI;
|
||||
import com.bencodez.advancedcore.api.inventory.editgui.EditGUIButton;
|
||||
import com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueBoolean;
|
||||
import com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueList;
|
||||
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.valuerequest.InputMethod;
|
||||
import com.bencodez.advancedcore.api.valuerequest.ValueRequest;
|
||||
import com.bencodez.advancedcore.api.valuerequest.ValueRequestBuilder;
|
||||
import com.bencodez.advancedcore.api.valuerequest.listeners.StringListener;
|
||||
import com.bencodez.advancedcore.api.yml.editor.ConfigEditor;
|
||||
import com.bencodez.advancedcore.command.gui.RewardEditGUI;
|
||||
import com.bencodez.simpleapi.array.ArrayUtils;
|
||||
import com.bencodez.simpleapi.player.PlayerUtils;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.commands.gui.admin.AdminVoteVoteParty;
|
||||
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;
|
||||
import com.bencodez.votingplugin.events.PlayerVoteEvent;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
|
||||
public class AdminGUI {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminGUI(VotingPluginMain plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open admin GUI.
|
||||
*
|
||||
* @return ArrayList of buttons
|
||||
*/
|
||||
public ArrayList<BInventoryButton> adminGUIButtons() {
|
||||
ArrayList<BInventoryButton> buttons = new ArrayList<>();
|
||||
buttons.add(new BInventoryButton("&cVoteSites",
|
||||
new String[] { "&cOnly enabled sites are listed in this section", "&cMiddle Click to create" },
|
||||
new ItemStack(Material.STONE)) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (event.getClick().equals(ClickType.MIDDLE)) {
|
||||
new ValueRequest().requestString(player, new StringListener() {
|
||||
|
||||
@Override
|
||||
public void onInput(Player player, String value) {
|
||||
plugin.getConfigVoteSites().generateVoteSite(value);
|
||||
player.sendMessage("Generated site");
|
||||
plugin.reload();
|
||||
openAdminGUIVoteSiteSite(player, plugin.getVoteSite(value, true));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
openAdminGUIVoteSites(player);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton(new ItemBuilder(Material.CHEST, 1).setName("&cEdit VoteShop")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new AdminVoteVoteShop(plugin, clickEvent.getPlayer()).open(GUIMethod.CHEST);
|
||||
}
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton(new ItemBuilder(Material.DIAMOND_BLOCK, 1).setName("&cEdit Milestones")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new AdminVoteMilestones(plugin, clickEvent.getPlayer()).open(GUIMethod.CHEST);
|
||||
}
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton(new ItemBuilder(Material.COBBLESTONE, 1).setName("&cEdit Cumulative")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new AdminVoteCumulative(plugin, clickEvent.getPlayer()).open(GUIMethod.CHEST);
|
||||
}
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton(new ItemBuilder(Material.STONE, 1).setName("&cEdit VoteParty")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new AdminVoteVoteParty(plugin, clickEvent.getPlayer()).open(GUIMethod.CHEST);
|
||||
}
|
||||
});
|
||||
buttons.add(new BInventoryButton(new ItemBuilder(Material.STONE, 1).setName("&cEdit FirstVote reward")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
|
||||
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"));
|
||||
}
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton(new ItemBuilder(Material.STONE, 1).setName("&cEdit AllSites reward")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
|
||||
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"));
|
||||
}
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton(new ItemBuilder(Material.STONE, 1).setName("&cEdit AnySiteRewards")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
|
||||
plugin.getRewardHandler().getDirectlyDefined("AnySiteRewards"));
|
||||
}
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton(new ItemBuilder(Material.STONE, 1).setName("&cEdit EverySiteReward")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
|
||||
plugin.getRewardHandler().getDirectlyDefined("EverySiteReward"));
|
||||
}
|
||||
});
|
||||
|
||||
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").addLoreLine("&aCurrently WIP")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new ConfigEditor(plugin, plugin.getBungeeSettings()).open(clickEvent.getPlayer());
|
||||
}
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton(
|
||||
new ItemBuilder("GRASS_BLOCK").setName("&cEdit Config.yml").addLoreLine("&aCurrently WIP")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new ConfigEditor(plugin, plugin.getConfigFile(), plugin.getOptions().getYmlConfig(),
|
||||
plugin.getOptions().getClass()).open(clickEvent.getPlayer());
|
||||
}
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton(
|
||||
new ItemBuilder(Material.CHEST).setName("&cEdit GUI.yml").addLoreLine("&aCurrently WIP")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new ConfigEditor(plugin, plugin.getGui()).open(clickEvent.getPlayer());
|
||||
}
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton(
|
||||
new ItemBuilder("GRASS_BLOCK").setName("&cEdit SpecialRewards.yml").addLoreLine("&aCurrently WIP")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new ConfigEditor(plugin, plugin.getSpecialRewardsConfig()).open(clickEvent.getPlayer());
|
||||
}
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton("&cReload Plugin", new String[] {}, new ItemStack(Material.BUCKET, 1)) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
plugin.reload();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton(
|
||||
new ItemBuilder(Material.STONE, 1).setName("&cBackground task time").addLoreLine("&aClick to see")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
event.getPlayer().sendMessage("Last background task time: " + plugin.getLastBackgroundTaskTimeTaken());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return buttons;
|
||||
}
|
||||
|
||||
public void loadHook() {
|
||||
for (BInventoryButton b : adminGUIButtons()) {
|
||||
com.bencodez.advancedcore.command.gui.AdminGUI.getInstance().addButton(b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Open admin GUI vote sites.
|
||||
*
|
||||
* @param player the player
|
||||
*/
|
||||
public void openAdminGUIVoteSites(Player player) {
|
||||
BInventory inv = new BInventory("VoteSites");
|
||||
int count = 0;
|
||||
for (VoteSite voteSite : plugin.getVoteSites()) {
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add("Enabled: " + voteSite.isEnabled());
|
||||
lore.add("Priority: " + voteSite.getPriority());
|
||||
|
||||
lore.add("Name: " + voteSite.getDisplayName());
|
||||
lore.add("ServiceSite: " + voteSite.getServiceSite());
|
||||
lore.add("VoteURL: " + voteSite.getVoteURL());
|
||||
lore.add("VoteDelay: " + voteSite.getVoteDelay());
|
||||
lore.add("VoteDelayMin: " + voteSite.getVoteDelayMin());
|
||||
|
||||
inv.addButton(count,
|
||||
new BInventoryButton(voteSite.getKey(), ArrayUtils.convert(lore), new ItemStack(Material.STONE)) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
Player player = event.getWhoClicked();
|
||||
openAdminGUIVoteSiteSite(player, voteSite);
|
||||
|
||||
}
|
||||
});
|
||||
count++;
|
||||
}
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open admin GUI vote site site.
|
||||
*
|
||||
* @param player the player
|
||||
* @param voteSite the vote site
|
||||
*/
|
||||
public void openAdminGUIVoteSiteSite(Player player, VoteSite voteSite) {
|
||||
EditGUI inv = new EditGUI("VoteSite: " + voteSite.getDisplayName());
|
||||
inv.setMeta(player, "VoteSite", voteSite);
|
||||
|
||||
inv.addButton(new BInventoryButton(voteSite.getItem().setName("&cForce vote")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
ArrayList<String> playerNames = new ArrayList<>();
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
playerNames.add(p.getName());
|
||||
}
|
||||
new ValueRequestBuilder(new StringListener() {
|
||||
|
||||
@Override
|
||||
public void onInput(Player player, String value) {
|
||||
Object ob = PlayerUtils.getPlayerMeta(plugin, player, "VoteSite");
|
||||
if (ob != null) {
|
||||
VoteSite site = (VoteSite) ob;
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(site, value, site.getServiceSite(), false);
|
||||
plugin.getVoteTimer().submit(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
plugin.getServer().getPluginManager().callEvent(voteEvent);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}, ArrayUtils.convert(playerNames)).usingMethod(InputMethod.INVENTORY).allowCustomOption(true)
|
||||
.request(event.getWhoClicked());
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueNumber("Priority", voteSite.getPriority()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Number num) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
plugin.getConfigVoteSites().setPriority(voteSite.getKey(), num.intValue());
|
||||
plugin.reload();
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueString("ServiceSite", voteSite.getServiceSite()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, String value) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
plugin.getConfigVoteSites().setServiceSite(siteName, value);
|
||||
plugin.reload();
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueString("Name", voteSite.getDisplayName()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, String value) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
plugin.getConfigVoteSites().setDisplayName(voteSite.getKey(), value);
|
||||
plugin.reload();
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueString("VoteURL", voteSite.getVoteURL()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, String value) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
plugin.getConfigVoteSites().setVoteURL(siteName, value);
|
||||
plugin.reload();
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueNumber("VoteDelay", voteSite.getVoteDelay()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Number num) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
plugin.getConfigVoteSites().setVoteDelay(siteName, num.intValue());
|
||||
plugin.reload();
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueNumber("VoteDelayMin", voteSite.getVoteDelay()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Number num) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
plugin.getConfigVoteSites().setVoteDelay(siteName, num.intValue());
|
||||
plugin.reload();
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueNumber("VoteDelayDailyHour", voteSite.getVoteDelayDailyHour()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Number num) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
plugin.getConfigVoteSites().setVoteDelay(siteName, num.intValue());
|
||||
plugin.reload();
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueBoolean("Enabled", voteSite.isEnabled()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean value) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
plugin.getConfigVoteSites().setEnabled(siteName, value);
|
||||
plugin.reload();
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueBoolean("ForceOffline", voteSite.isGiveOffline()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean value) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
plugin.getConfigVoteSites().setForceOffline(siteName, value);
|
||||
plugin.reload();
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueBoolean("VoteDelayDaily", voteSite.isVoteDelayDaily()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean value) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
plugin.getConfigVoteSites().setVoteDelayDaily(siteName, value);
|
||||
plugin.reload();
|
||||
}
|
||||
}));
|
||||
|
||||
if (voteSite.getSiteData().isList("Rewards")) {
|
||||
|
||||
inv.addButton(
|
||||
new EditGUIButton(new EditGUIValueList("Rewards", voteSite.getSiteData().getStringList("Rewards")) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player p, ArrayList<String> rewards) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
plugin.getConfigVoteSites().set(voteSite.getKey(), "Rewards", rewards);
|
||||
plugin.reload();
|
||||
}
|
||||
}));
|
||||
} else {
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.DISPENSER, 1).setName("&cRewards")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(), plugin.getRewardHandler()
|
||||
.getDirectlyDefined("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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.bencodez.votingplugin.commands.gui.admin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Material;
|
||||
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;
|
||||
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;
|
||||
|
||||
public abstract class AdminVoteConfirmation extends GUIHandler {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private VotingPluginMain plugin;
|
||||
private String title;
|
||||
|
||||
public AdminVoteConfirmation(VotingPluginMain plugin, CommandSender player, String title) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@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) {
|
||||
BInventory inv = new BInventory(title);
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.EMERALD_BLOCK).setName("&aConfirm")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
onConfirm(clickEvent.getPlayer());
|
||||
}
|
||||
});
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.REDSTONE_BLOCK).setName("&aCancel")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
onDeny(clickEvent.getPlayer());
|
||||
}
|
||||
});
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
public abstract void onConfirm(Player p);
|
||||
|
||||
public abstract void onDeny(Player p);
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHEST);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.bencodez.votingplugin.commands.gui.admin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.bencodez.advancedcore.api.command.CommandHandler;
|
||||
import com.bencodez.advancedcore.api.gui.GUIHandler;
|
||||
import com.bencodez.advancedcore.api.gui.GUIMethod;
|
||||
import com.bencodez.simpleapi.messages.MessageAPI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
|
||||
public class AdminVoteHelp extends GUIHandler {
|
||||
|
||||
private int page;
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteHelp(VotingPluginMain plugin, CommandSender player, int page) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin help.
|
||||
*
|
||||
* @param sender the sender
|
||||
* @param page the page
|
||||
* @return the array list
|
||||
*/
|
||||
public ArrayList<TextComponent> adminHelp(CommandSender sender, int page) {
|
||||
int pagesize = plugin.getConfigFile().getFormatPageSize();
|
||||
ArrayList<TextComponent> msg = new ArrayList<>();
|
||||
ArrayList<TextComponent> text = adminHelpText(sender);
|
||||
|
||||
int maxPage = text.size() / pagesize;
|
||||
if ((text.size() % pagesize) != 0) {
|
||||
maxPage++;
|
||||
}
|
||||
|
||||
msg.add(MessageAPI.stringToComp("&6&lVotingPlugin Admin Help " + (page) + "/" + maxPage));
|
||||
msg.add(MessageAPI.stringToComp("&6&l() = Needed"));
|
||||
msg.add(MessageAPI.stringToComp("&6&lAliases: adminvote, av"));
|
||||
|
||||
for (int i = pagesize * (page - 1); (i < text.size()) && (i < ((page) * pagesize)); i++) {
|
||||
msg.add(text.get(i));
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin help text.
|
||||
*
|
||||
* @param sender the sender
|
||||
* @return the array list
|
||||
*/
|
||||
public ArrayList<TextComponent> adminHelpText(CommandSender sender) {
|
||||
ArrayList<TextComponent> msg = new ArrayList<>();
|
||||
HashMap<String, TextComponent> unsorted = new HashMap<>();
|
||||
|
||||
boolean requirePerms = plugin.getConfigFile().isFormatCommandsVoteHelpRequirePermission();
|
||||
|
||||
for (CommandHandler cmdHandle : plugin.getAdminVoteCommand()) {
|
||||
if (!requirePerms || cmdHandle.hasPerm(sender)) {
|
||||
unsorted.put(cmdHandle.getHelpLineCommand("/adminvote"), cmdHandle.getHelpLine("/adminvote"));
|
||||
}
|
||||
}
|
||||
ArrayList<String> unsortedList = new ArrayList<>();
|
||||
unsortedList.addAll(unsorted.keySet());
|
||||
Collections.sort(unsortedList, String.CASE_INSENSITIVE_ORDER);
|
||||
for (String cmd : unsortedList) {
|
||||
msg.add(unsorted.get(cmd));
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
sendMessageJson(adminHelp(sender, page));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHAT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
package com.bencodez.votingplugin.commands.gui.admin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.Permission;
|
||||
|
||||
import com.bencodez.advancedcore.api.command.CommandHandler;
|
||||
import com.bencodez.advancedcore.api.gui.GUIHandler;
|
||||
import com.bencodez.advancedcore.api.gui.GUIMethod;
|
||||
import com.bencodez.simpleapi.array.ArrayUtils;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
public class AdminVotePerms extends GUIHandler {
|
||||
|
||||
private int page;
|
||||
private String playerName;
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVotePerms(VotingPluginMain plugin, CommandSender player, int page) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public AdminVotePerms(VotingPluginMain plugin, CommandSender player, int page, String playerName) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.page = page;
|
||||
this.playerName = playerName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String[] listPerms(CommandSender sender) {
|
||||
ArrayList<String> msg = new ArrayList<>();
|
||||
|
||||
for (CommandHandler handle : plugin.getVoteCommand()) {
|
||||
if (sender instanceof Player) {
|
||||
if (handle.hasPerm(sender)) {
|
||||
msg.add("&6" + handle.getHelpLineCommand("/vote") + " : "
|
||||
+ handle.getPerm().split(Pattern.quote("|"))[0] + " : &atrue");
|
||||
} else {
|
||||
msg.add("&6" + handle.getHelpLineCommand("/vote") + " : "
|
||||
+ handle.getPerm().split(Pattern.quote("|"))[0] + " : &cfalse");
|
||||
}
|
||||
} else {
|
||||
msg.add(handle.getHelpLineCommand("/vote") + " : " + handle.getPerm().split(Pattern.quote("|"))[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (CommandHandler handle : plugin.getAdminVoteCommand()) {
|
||||
if (sender instanceof Player) {
|
||||
if (handle.hasPerm(sender)) {
|
||||
msg.add("&6" + handle.getHelpLineCommand("/av") + " : "
|
||||
+ handle.getPerm().split(Pattern.quote("|"))[0] + " : &atrue");
|
||||
} else {
|
||||
msg.add("&6" + handle.getHelpLineCommand("/av") + " : "
|
||||
+ handle.getPerm().split(Pattern.quote("|"))[0] + " : &cfalse");
|
||||
}
|
||||
} else {
|
||||
msg.add(handle.getHelpLineCommand("/av") + " : " + handle.getPerm().split(Pattern.quote("|"))[0]);
|
||||
}
|
||||
}
|
||||
|
||||
for (Permission perm : plugin.getDescription().getPermissions()) {
|
||||
if (sender instanceof Player) {
|
||||
Set<String> child = perm.getChildren().keySet();
|
||||
if (child.size() > 0) {
|
||||
if (sender.hasPermission(perm)) {
|
||||
msg.add("&6" + perm.getName() + " : &atrue");
|
||||
} else {
|
||||
msg.add("&6" + perm.getName() + " : &cfalse");
|
||||
}
|
||||
} else {
|
||||
if (sender.hasPermission(perm)) {
|
||||
msg.add("&6" + perm.getName() + " : &atrue");
|
||||
} else {
|
||||
msg.add("&6" + perm.getName() + " : &cfalse");
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
msg.add(perm.getName());
|
||||
}
|
||||
}
|
||||
|
||||
int pagesize = plugin.getConfigFile().getFormatPageSize();
|
||||
|
||||
int maxPage = msg.size() / pagesize;
|
||||
if ((msg.size() % pagesize) != 0) {
|
||||
maxPage++;
|
||||
}
|
||||
|
||||
ArrayList<String> text = new ArrayList<>();
|
||||
|
||||
text.add("&c&lCommand : Permissions " + page + "/" + maxPage);
|
||||
|
||||
for (int i = pagesize * page - pagesize; i < msg.size() && i < pagesize * page; i++) {
|
||||
text.add(msg.get(i));
|
||||
}
|
||||
|
||||
text = ArrayUtils.colorize(text);
|
||||
|
||||
return ArrayUtils.convert(text);
|
||||
}
|
||||
|
||||
public ArrayList<String> listPerms(CommandSender sender, String player, int page) {
|
||||
Player p = Bukkit.getPlayer(player);
|
||||
ArrayList<String> text = new ArrayList<>();
|
||||
if (p != null) {
|
||||
|
||||
ArrayList<String> msg = new ArrayList<>();
|
||||
|
||||
for (CommandHandler handle : plugin.getVoteCommand()) {
|
||||
if (handle.hasPerm(p)) {
|
||||
msg.add("&6" + handle.getHelpLineCommand("/vote") + " : "
|
||||
+ handle.getPerm().split(Pattern.quote("|"))[0] + " : &atrue");
|
||||
} else {
|
||||
msg.add("&6" + handle.getHelpLineCommand("/vote") + " : "
|
||||
+ handle.getPerm().split(Pattern.quote("|"))[0] + " : &cfalse");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (CommandHandler handle : plugin.getAdminVoteCommand()) {
|
||||
if (handle.hasPerm(p)) {
|
||||
msg.add("&6" + handle.getHelpLineCommand("/av") + " : "
|
||||
+ handle.getPerm().split(Pattern.quote("|"))[0] + " : &atrue");
|
||||
} else {
|
||||
msg.add("&6" + handle.getHelpLineCommand("/av") + " : "
|
||||
+ handle.getPerm().split(Pattern.quote("|"))[0] + " : &cfalse");
|
||||
}
|
||||
}
|
||||
|
||||
for (Permission perm : plugin.getDescription().getPermissions()) {
|
||||
Set<String> child = perm.getChildren().keySet();
|
||||
if (child.size() > 0) {
|
||||
if (p.hasPermission(perm)) {
|
||||
msg.add("&6" + perm.getName() + " : &atrue");
|
||||
} else {
|
||||
msg.add("&6" + perm.getName() + " : &cfalse");
|
||||
}
|
||||
} else {
|
||||
if (p.hasPermission(perm)) {
|
||||
msg.add("&6" + perm.getName() + " : &atrue");
|
||||
} else {
|
||||
msg.add("&6" + perm.getName() + " : &cfalse");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
msg = ArrayUtils.colorize(msg);
|
||||
|
||||
int pagesize = plugin.getConfigFile().getFormatPageSize();
|
||||
|
||||
int maxPage = msg.size() / pagesize;
|
||||
if ((msg.size() % pagesize) != 0) {
|
||||
maxPage++;
|
||||
}
|
||||
|
||||
text.add("&c&lCommand : Permissions for " + player + " " + page + "/" + maxPage);
|
||||
|
||||
for (int i = pagesize * page - pagesize; i < msg.size() && i < pagesize * page; i++) {
|
||||
text.add(msg.get(i));
|
||||
}
|
||||
} else {
|
||||
text.add("&cPlayer not online: " + player);
|
||||
}
|
||||
return ArrayUtils.colorize(text);
|
||||
|
||||
}
|
||||
|
||||
public String[] listPermsDev(CommandSender sender) {
|
||||
ArrayList<String> msg = new ArrayList<>();
|
||||
msg.add("Command");
|
||||
msg.add(" Permissions (seperated by |");
|
||||
msg.add(" Help messasge");
|
||||
msg.add(" ");
|
||||
|
||||
for (CommandHandler handle : plugin.getVoteCommand()) {
|
||||
msg.add(handle.getHelpLineCommand("/vote"));
|
||||
msg.add(" " + handle.getPerm());
|
||||
msg.add(" " + handle.getHelpMessage());
|
||||
}
|
||||
|
||||
for (CommandHandler handle : plugin.getAdminVoteCommand()) {
|
||||
msg.add(handle.getHelpLineCommand("/av"));
|
||||
msg.add(" " + handle.getPerm());
|
||||
msg.add(" " + handle.getHelpMessage());
|
||||
}
|
||||
|
||||
for (Permission perm : plugin.getDescription().getPermissions()) {
|
||||
msg.add(perm.getName() + " : " + perm.getDescription());
|
||||
}
|
||||
|
||||
msg = ArrayUtils.colorize(msg);
|
||||
|
||||
return ArrayUtils.convert(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
if (playerName != null) {
|
||||
sendMessage(listPerms(sender, playerName, page));
|
||||
} else {
|
||||
sendMessage(listPerms(sender));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHAT);
|
||||
}
|
||||
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
package com.bencodez.votingplugin.commands.gui.admin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
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;
|
||||
|
||||
import xyz.upperlevel.spigot.book.BookUtil;
|
||||
|
||||
public class AdminVotePlaceholders extends GUIHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVotePlaceholders(VotingPluginMain plugin, CommandSender player) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
BookWrapper book = new BookWrapper("Placeholders");
|
||||
|
||||
for (PlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getPlaceholders()) {
|
||||
String msg = "";
|
||||
String identifier = placeholder.getIdentifier().toLowerCase();
|
||||
if (identifier.endsWith("_")) {
|
||||
identifier += "#";
|
||||
}
|
||||
if (placeholder.hasDescription()) {
|
||||
msg = "votingplugin_" + identifier + " - " + placeholder.getDescription();
|
||||
} else {
|
||||
msg = "votingplugin_" + identifier + "";
|
||||
}
|
||||
|
||||
Layout layout = new Layout(new ArrayList<>(Arrays.asList("[Json]")));
|
||||
layout.replaceTextComponent("[Json]", BookUtil.TextBuilder.of(identifier).color(ChatColor.AQUA)
|
||||
.onHover(BookUtil.HoverAction.showText(msg)).build());
|
||||
book.addLayout(layout);
|
||||
}
|
||||
|
||||
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getNonPlayerPlaceholders()) {
|
||||
String msg = "";
|
||||
String identifier = placeholder.getIdentifier().toLowerCase();
|
||||
if (identifier.endsWith("_")) {
|
||||
identifier += "#";
|
||||
}
|
||||
if (placeholder.hasDescription()) {
|
||||
msg = "votingplugin_" + identifier + " - " + placeholder.getDescription();
|
||||
} else {
|
||||
msg = "votingplugin_" + identifier + "";
|
||||
}
|
||||
|
||||
Layout layout = new Layout(new ArrayList<>(Arrays.asList("[Json]")));
|
||||
layout.replaceTextComponent("[Json]", BookUtil.TextBuilder.of(identifier).color(ChatColor.AQUA)
|
||||
.onHover(BookUtil.HoverAction.showText(msg)).build());
|
||||
book.addLayout(layout);
|
||||
|
||||
}
|
||||
|
||||
book.open(player);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
ArrayList<String> msg = new ArrayList<>();
|
||||
msg.add("&cPlaceholders:");
|
||||
for (PlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getPlaceholders()) {
|
||||
String identifier = placeholder.getIdentifier().toLowerCase();
|
||||
if (identifier.endsWith("_")) {
|
||||
identifier += "#";
|
||||
}
|
||||
if (placeholder.hasDescription()) {
|
||||
msg.add("votingplugin_" + identifier + " - " + placeholder.getDescription());
|
||||
} else {
|
||||
msg.add("votingplugin_" + identifier + "");
|
||||
}
|
||||
}
|
||||
|
||||
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getNonPlayerPlaceholders()) {
|
||||
String identifier = placeholder.getIdentifier().toLowerCase();
|
||||
if (identifier.endsWith("_")) {
|
||||
identifier += "#";
|
||||
}
|
||||
if (placeholder.hasDescription()) {
|
||||
msg.add("votingplugin_" + identifier + " - " + placeholder.getDescription());
|
||||
} else {
|
||||
msg.add("votingplugin_" + identifier + "");
|
||||
}
|
||||
}
|
||||
|
||||
sendMessage(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHAT);
|
||||
}
|
||||
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
package com.bencodez.votingplugin.commands.gui.admin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
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;
|
||||
|
||||
import xyz.upperlevel.spigot.book.BookUtil;
|
||||
|
||||
public class AdminVotePlaceholdersPlayer extends GUIHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
private VotingPluginUser user;
|
||||
|
||||
public AdminVotePlaceholdersPlayer(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
BookWrapper book = new BookWrapper("Placeholders");
|
||||
|
||||
for (PlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getPlaceholders()) {
|
||||
String identifier = placeholder.getIdentifier().toLowerCase();
|
||||
if (identifier.endsWith("_")) {
|
||||
identifier += "1";
|
||||
}
|
||||
String value = placeholder.placeholderRequest(user, identifier);
|
||||
String msg = identifier + " = " + value;
|
||||
Layout layout = new Layout(new ArrayList<>(Arrays.asList("[Json]")));
|
||||
layout.replaceTextComponent("[Json]", BookUtil.TextBuilder.of(msg).color(ChatColor.AQUA)
|
||||
.onHover(BookUtil.HoverAction.showText(value)).build());
|
||||
book.addLayout(layout);
|
||||
}
|
||||
|
||||
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getNonPlayerPlaceholders()) {
|
||||
|
||||
String identifier = placeholder.getIdentifier().toLowerCase();
|
||||
if (identifier.endsWith("_")) {
|
||||
identifier += "1";
|
||||
}
|
||||
String value = placeholder.placeholderRequest(identifier);
|
||||
String msg = identifier + " = " + value;
|
||||
|
||||
Layout layout = new Layout(new ArrayList<>(Arrays.asList("[Json]")));
|
||||
layout.replaceTextComponent("[Json]", BookUtil.TextBuilder.of(msg).color(ChatColor.AQUA)
|
||||
.onHover(BookUtil.HoverAction.showText(value)).build());
|
||||
book.addLayout(layout);
|
||||
}
|
||||
book.open(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
ArrayList<String> msg = new ArrayList<>();
|
||||
msg.add("&cPlaceholders:");
|
||||
VotingPluginUser placeholderUser = user;
|
||||
if (plugin.getConfigFile().isUsePrimaryAccountForPlaceholders() && user.hasPrimaryAccount()) {
|
||||
placeholderUser = plugin.getVotingPluginUserManager().getVotingPluginUser(user.getPrimaryAccount());
|
||||
}
|
||||
for (PlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getPlaceholders()) {
|
||||
String identifier = placeholder.getIdentifier().toLowerCase();
|
||||
if (identifier.endsWith("_")) {
|
||||
identifier += "1";
|
||||
}
|
||||
msg.add("votingplugin_" + identifier + " = " + placeholder.placeholderRequest(placeholderUser, identifier));
|
||||
}
|
||||
|
||||
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getNonPlayerPlaceholders()) {
|
||||
String identifier = placeholder.getIdentifier().toLowerCase();
|
||||
if (identifier.endsWith("_")) {
|
||||
identifier += "1";
|
||||
}
|
||||
|
||||
msg.add("votingplugin_" + identifier + " = " + placeholder.placeholderRequest(identifier));
|
||||
}
|
||||
sendMessage(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHAT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
package com.bencodez.votingplugin.commands.gui.admin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.bencodez.advancedcore.api.gui.GUIHandler;
|
||||
import com.bencodez.advancedcore.api.gui.GUIMethod;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
|
||||
import com.bencodez.advancedcore.api.item.ItemBuilder;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.commands.gui.player.VoteGUI;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoterPlayer;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class AdminVoteTopPoints extends GUIHandler {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int page;
|
||||
private VotingPluginMain plugin;
|
||||
private VotingPluginUser user;
|
||||
|
||||
public AdminVoteTopPoints(VotingPluginMain plugin, CommandSender player, VotingPluginUser user, int page) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
@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) {
|
||||
try {
|
||||
Set<Entry<TopVoterPlayer, Integer>> users = null;
|
||||
|
||||
LinkedHashMap<TopVoterPlayer, Integer> topPoints1 = new LinkedHashMap<TopVoterPlayer, Integer>();
|
||||
|
||||
for (String uuid : plugin.getVotingPluginUserManager().getAllUUIDs()) {
|
||||
VotingPluginUser vpUser = plugin.getVotingPluginUserManager()
|
||||
.getVotingPluginUser(UUID.fromString(uuid));
|
||||
vpUser.dontCache();
|
||||
int points = vpUser.getPoints();
|
||||
if (points > 0) {
|
||||
topPoints1.put(vpUser.getTopVoterPlayer(), points);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
LinkedHashMap<TopVoterPlayer, Integer> topPoints = plugin.getTopVoterHandler().sortByValues(topPoints1,
|
||||
false);
|
||||
|
||||
users = topPoints.entrySet();
|
||||
|
||||
ConfigurationSection customization = plugin.getGui().getChestVoteTopCustomization();
|
||||
boolean customzationEnabled = false;
|
||||
Queue<Integer> playerSlots = new ConcurrentLinkedQueue<>();
|
||||
if (customization != null) {
|
||||
customzationEnabled = customization.getBoolean("Enabled");
|
||||
List<Integer> customizationPlayerSlots = customization.getIntegerList("PlayerSlots");
|
||||
playerSlots.addAll(customizationPlayerSlots);
|
||||
}
|
||||
|
||||
BInventory inv = new BInventory("Top Points");
|
||||
if (!plugin.getConfigFile().isAlwaysCloseInventory()) {
|
||||
inv.dontClose();
|
||||
}
|
||||
|
||||
int pos = 1;
|
||||
for (Entry<TopVoterPlayer, Integer> entry : users) {
|
||||
|
||||
ItemBuilder playerItem = new ItemBuilder(Material.PAPER);
|
||||
|
||||
if (plugin.getGui().isChestVoteTopUseSkull()) {
|
||||
playerItem = new ItemBuilder(entry.getKey().getPlayerHead());
|
||||
} else {
|
||||
playerItem = new ItemBuilder(Material.valueOf(plugin.getGui().getChestVoteTopPlayerItemMaterial()));
|
||||
}
|
||||
|
||||
playerItem.setLore(new ArrayList<>());
|
||||
|
||||
BInventoryButton button = new BInventoryButton(playerItem
|
||||
.setName(plugin.getGui().getChestVoteTopItemName())
|
||||
.addLoreLine(plugin.getGui().getChestVoteTopItemLore()).addPlaceholder("position", "" + pos)
|
||||
.addPlaceholder("player", entry.getKey().getPlayerName())
|
||||
.addPlaceholder("votes", "" + entry.getValue())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
if (plugin.getGui().isChestVoteTopOpenMainGUIOnClick()) {
|
||||
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());
|
||||
|
||||
if (customzationEnabled && !playerSlots.isEmpty()) {
|
||||
button.setSlot(playerSlots.remove());
|
||||
}
|
||||
|
||||
inv.setCloseInv(plugin.getGui().isChestVoteTopCloseGUIOnClick());
|
||||
|
||||
inv.addButton(button);
|
||||
pos++;
|
||||
}
|
||||
|
||||
if (plugin.getGui().isChestVoteTopBackButton()) {
|
||||
if (customzationEnabled) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user)
|
||||
.setSlot(customization.getInt("BackButtonSlot", 0)));
|
||||
} else {
|
||||
inv.getPageButtons().add(plugin.getCommandLoader().getBackButton(user).setSlot(1));
|
||||
}
|
||||
}
|
||||
|
||||
String guiPath = "VoteTop.Customization";
|
||||
for (final String str : plugin.getGui().getChestGUIExtraItems(guiPath)) {
|
||||
inv.addButton(
|
||||
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIExtraItemsItem(guiPath, str))) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
plugin.getCommandLoader().processSlotClick(player, user, str);
|
||||
new RewardBuilder(plugin.getGui().getData(),
|
||||
"CHEST." + guiPath + ".ExtraItems." + str + ".Rewards").setGiveOffline(false)
|
||||
.send(clickEvent.getPlayer());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (customization == null || !customzationEnabled || !customization.getBoolean("RemoveBottomBar")) {
|
||||
inv.setPages(true);
|
||||
}
|
||||
inv.setMaxInvSize(plugin.getGui().getChestVoteTopSize());
|
||||
inv.openInventory(player);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHEST);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
package com.bencodez.votingplugin.commands.gui.admin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Material;
|
||||
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.advancedcore.api.inventory.editgui.EditGUIButton;
|
||||
import com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueBoolean;
|
||||
import com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueList;
|
||||
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.valuerequest.ValueRequestBuilder;
|
||||
import com.bencodez.advancedcore.api.valuerequest.listeners.NumberListener;
|
||||
import com.bencodez.advancedcore.command.gui.RewardEditGUI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
public class AdminVoteVoteParty extends GUIHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteVoteParty(VotingPluginMain plugin, CommandSender player) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
EditGUI inv = new EditGUI("Edit VoteParty");
|
||||
inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.VoteParty");
|
||||
|
||||
// to add
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1),
|
||||
new EditGUIValueBoolean("Enabled", plugin.getSpecialRewardsConfig().isVotePartyEnabled()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean name) {
|
||||
setPathData(getKey(), name);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.EMERALD, 1),
|
||||
new EditGUIValueNumber("VotesRequired", plugin.getSpecialRewardsConfig().getVotePartyVotesRequired()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Number num) {
|
||||
setPathData(getKey(), num.intValue());
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.LADDER, 1), new EditGUIValueNumber(
|
||||
"IncreaseVotesRquired", plugin.getSpecialRewardsConfig().getVotePartyIncreaseVotesRequired()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Number num) {
|
||||
setPathData(getKey(), num.intValue());
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.LADDER).setName("&cCurrent increase amount")
|
||||
.addLoreLine("&cCurrent value: " + plugin.getServerData().getVotePartyExtraRequired())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new ValueRequestBuilder(new NumberListener() {
|
||||
|
||||
@Override
|
||||
public void onInput(Player player, Number value) {
|
||||
plugin.getServerData().setVotePartyExtraRequired(value.intValue());
|
||||
}
|
||||
}, new Number[] { 0, 10, 50, 100 })
|
||||
.currentValue("" + plugin.getServerData().getVotePartyExtraRequired()).allowCustomOption(true)
|
||||
.request(clickEvent.getPlayer());
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.EMERALD, 1), new EditGUIValueNumber(
|
||||
"UserVotesRequired", plugin.getSpecialRewardsConfig().getVotePartyUserVotesRequired()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Number num) {
|
||||
setPathData(getKey(), num.intValue());
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean("GiveAllPlayers",
|
||||
plugin.getSpecialRewardsConfig().isVotePartyGiveAllPlayers()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean name) {
|
||||
setPathData(getKey(), name);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean(
|
||||
"GiveOnlinePlayersOnly", plugin.getSpecialRewardsConfig().isVotePartyGiveOnlinePlayersOnly()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean name) {
|
||||
setPathData(getKey(), name);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1),
|
||||
new EditGUIValueBoolean("ResetEachDay", plugin.getSpecialRewardsConfig().isVotePartyResetEachDay()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean name) {
|
||||
setPathData(getKey(), name);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1),
|
||||
new EditGUIValueBoolean("ResetWeekly", plugin.getSpecialRewardsConfig().isVotePartyResetWeekly()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean name) {
|
||||
setPathData(getKey(), name);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1),
|
||||
new EditGUIValueBoolean("ResetMonthly", plugin.getSpecialRewardsConfig().isVotePartyResetMonthly()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean name) {
|
||||
setPathData(getKey(), name);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean("OnlyOncePerDay",
|
||||
plugin.getSpecialRewardsConfig().isVotePartyOnlyOncePerDay()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean name) {
|
||||
setPathData(getKey(), name);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean(
|
||||
"ResetExtraVotesMonthly", plugin.getSpecialRewardsConfig().isVotePartyResetExtraVotesMonthly()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean name) {
|
||||
setPathData(getKey(), name);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean("CountFakeVotes",
|
||||
plugin.getSpecialRewardsConfig().isVotePartyCountFakeVotes()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean name) {
|
||||
setPathData(getKey(), name);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean("CountOfflineVotes",
|
||||
plugin.getSpecialRewardsConfig().isVotePartyCountOfflineVotes()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean name) {
|
||||
setPathData(getKey(), name);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1),
|
||||
new EditGUIValueString("Broadcast", plugin.getSpecialRewardsConfig().getVotePartyBroadcast()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, String name) {
|
||||
setPathData(getKey(), name);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1),
|
||||
new EditGUIValueList("Commands", plugin.getSpecialRewardsConfig().getVotePartyGlobalCommands()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, ArrayList<String> value) {
|
||||
setPathData(getKey(), value);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.DISPENSER, 1).setName("&cRewards")
|
||||
.addLoreLine("&aUse this for per player rewards, also set online only rewards here as well")
|
||||
.addLoreLine("&cTo set rewards to be given to players online only, set RewardType to ONLINE")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
|
||||
plugin.getRewardHandler().getDirectlyDefined("VoteParty.Rewards"));
|
||||
}
|
||||
});
|
||||
|
||||
// implement item reward?
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHEST);
|
||||
}
|
||||
|
||||
private void setPathData(String path, Object value) {
|
||||
plugin.getSpecialRewardsConfig().getData().set("VoteParty." + path, value);
|
||||
plugin.getSpecialRewardsConfig().saveData();
|
||||
plugin.reload();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.getVoteSitesEnabled()) {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
package com.bencodez.votingplugin.commands.gui.admin.cumulative;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Material;
|
||||
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;
|
||||
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.valuerequest.InputMethod;
|
||||
import com.bencodez.advancedcore.api.valuerequest.ValueRequest;
|
||||
import com.bencodez.advancedcore.api.valuerequest.ValueRequestBuilder;
|
||||
import com.bencodez.advancedcore.api.valuerequest.listeners.NumberListener;
|
||||
import com.bencodez.advancedcore.command.gui.RewardEditGUI;
|
||||
import com.bencodez.simpleapi.messages.MessageAPI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
public class AdminVoteCumulative extends GUIHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteCumulative(VotingPluginMain plugin, CommandSender player) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
BInventory inv = new BInventory("Edit Cumulative");
|
||||
inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.Cumulative");
|
||||
inv.addButton(
|
||||
new BInventoryButton(new ItemBuilder(Material.PAPER).setName("&cEdit existing cumulative rewards")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
ArrayList<Integer> nums = new ArrayList<>();
|
||||
for (String num : plugin.getSpecialRewardsConfig().getCumulativeVotes()) {
|
||||
if (MessageAPI.isInt(num)) {
|
||||
nums.add(Integer.parseInt(num));
|
||||
}
|
||||
}
|
||||
Number[] options = new Number[nums.size()];
|
||||
for (int i = 0; i < nums.size(); i++) {
|
||||
options[i] = nums.get(i);
|
||||
}
|
||||
new ValueRequestBuilder(new NumberListener() {
|
||||
|
||||
@Override
|
||||
public void onInput(Player player, Number value) {
|
||||
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
|
||||
plugin.getRewardHandler()
|
||||
.getDirectlyDefined("Cumulative." + value.intValue() + ".Rewards"));
|
||||
}
|
||||
}, options).allowCustomOption(false).usingMethod(InputMethod.INVENTORY)
|
||||
.request(clickEvent.getPlayer());
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.EMERALD_BLOCK).setName("&aAdd cumulative reward")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new ValueRequest().requestNumber(player, new NumberListener() {
|
||||
|
||||
@Override
|
||||
public void onInput(Player player, Number value) {
|
||||
plugin.getSpecialRewardsConfig().setCumulative(value.intValue());
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.REDSTONE_BLOCK).setName("&cRemove cumulative")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new AdminVoteCumulativeRemove(plugin, clickEvent.getPlayer()).open();
|
||||
}
|
||||
});
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHEST);
|
||||
}
|
||||
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
package com.bencodez.votingplugin.commands.gui.admin.cumulative;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Material;
|
||||
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;
|
||||
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.commands.gui.admin.AdminVoteConfirmation;
|
||||
|
||||
public class AdminVoteCumulativeRemove extends GUIHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteCumulativeRemove(VotingPluginMain plugin, CommandSender player) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
BInventory inv = new BInventory("Remove cumulative");
|
||||
inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.Cumulative");
|
||||
for (final String votes : plugin.getSpecialRewardsConfig().getCumulativeVotes()) {
|
||||
inv.addButton(new BInventoryButton(
|
||||
new ItemBuilder(Material.PAPER, 1).setName(votes).addLoreLine("&c&lClick to remove")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new AdminVoteConfirmation(plugin, clickEvent.getPlayer(), "Remove cumulative " + votes + "?") {
|
||||
|
||||
@Override
|
||||
public void onConfirm(Player p) {
|
||||
plugin.getSpecialRewardsConfig().removeCumulative(votes);
|
||||
p.sendMessage("Removed cumulative " + votes);
|
||||
plugin.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeny(Player p) {
|
||||
new AdminVoteCumulative(plugin, p);
|
||||
}
|
||||
}.open();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHEST);
|
||||
}
|
||||
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
package com.bencodez.votingplugin.commands.gui.admin.milestones;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Material;
|
||||
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;
|
||||
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.commands.gui.admin.AdminVoteConfirmation;
|
||||
|
||||
public class AdminVoteMilestoneRemove extends GUIHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteMilestoneRemove(VotingPluginMain plugin, CommandSender player) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
BInventory inv = new BInventory("Remove milestones");
|
||||
inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.MileStones");
|
||||
for (final String votes : plugin.getSpecialRewardsConfig().getMilestoneVotes()) {
|
||||
inv.addButton(new BInventoryButton(
|
||||
new ItemBuilder(Material.PAPER, 1).setName(votes).addLoreLine("&c&lClick to remove")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new AdminVoteConfirmation(plugin, clickEvent.getPlayer(), "Remove milestone " + votes + "?") {
|
||||
|
||||
@Override
|
||||
public void onConfirm(Player p) {
|
||||
plugin.getSpecialRewardsConfig().removeMilestone(votes);
|
||||
p.sendMessage("Removed milestone " + votes);
|
||||
plugin.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeny(Player p) {
|
||||
new AdminVoteMilestones(plugin, p);
|
||||
}
|
||||
}.open();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHEST);
|
||||
}
|
||||
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
package com.bencodez.votingplugin.commands.gui.admin.milestones;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Material;
|
||||
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;
|
||||
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.valuerequest.InputMethod;
|
||||
import com.bencodez.advancedcore.api.valuerequest.ValueRequest;
|
||||
import com.bencodez.advancedcore.api.valuerequest.ValueRequestBuilder;
|
||||
import com.bencodez.advancedcore.api.valuerequest.listeners.NumberListener;
|
||||
import com.bencodez.advancedcore.command.gui.RewardEditGUI;
|
||||
import com.bencodez.simpleapi.messages.MessageAPI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
public class AdminVoteMilestones extends GUIHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteMilestones(VotingPluginMain plugin, CommandSender player) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
BInventory inv = new BInventory("Edit MileStones");
|
||||
inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.MileStones");
|
||||
inv.addButton(
|
||||
new BInventoryButton(new ItemBuilder(Material.PAPER).setName("&cEdit existing milestone rewards")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
ArrayList<Integer> nums = new ArrayList<>();
|
||||
for (String num : plugin.getSpecialRewardsConfig().getMilestoneVotes()) {
|
||||
if (MessageAPI.isInt(num)) {
|
||||
nums.add(Integer.parseInt(num));
|
||||
}
|
||||
}
|
||||
Number[] options = new Number[nums.size()];
|
||||
for (int i = 0; i < nums.size(); i++) {
|
||||
options[i] = nums.get(i);
|
||||
}
|
||||
new ValueRequestBuilder(new NumberListener() {
|
||||
|
||||
@Override
|
||||
public void onInput(Player player, Number value) {
|
||||
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
|
||||
plugin.getRewardHandler()
|
||||
.getDirectlyDefined("MileStones." + value.intValue() + ".Rewards"));
|
||||
}
|
||||
}, options).allowCustomOption(false).usingMethod(InputMethod.INVENTORY)
|
||||
.request(clickEvent.getPlayer());
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.EMERALD_BLOCK).setName("&aAdd milestone")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new ValueRequest().requestNumber(player, new NumberListener() {
|
||||
|
||||
@Override
|
||||
public void onInput(Player player, Number value) {
|
||||
plugin.getSpecialRewardsConfig().setMilestone(value.intValue());
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.REDSTONE_BLOCK).setName("&cRemove milestone")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new AdminVoteMilestoneRemove(plugin, clickEvent.getPlayer()).open();
|
||||
}
|
||||
});
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHEST);
|
||||
}
|
||||
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
package com.bencodez.votingplugin.commands.gui.admin.voteshop;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Material;
|
||||
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;
|
||||
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.valuerequest.ValueRequest;
|
||||
import com.bencodez.advancedcore.api.valuerequest.listeners.StringListener;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
public class AdminVoteVoteShop extends GUIHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteVoteShop(VotingPluginMain plugin, CommandSender player) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
BInventory inv = new BInventory("Edit VoteShop");
|
||||
inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.VoteShop");
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.DIAMOND).setName("&cEdit existing item")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new AdminVoteVoteShopItems(plugin, clickEvent.getPlayer()).open(GUIMethod.CHEST);
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.EMERALD_BLOCK).setName("&aAdd voteshop item")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new ValueRequest().requestString(player, new StringListener() {
|
||||
|
||||
@Override
|
||||
public void onInput(Player player, String value) {
|
||||
plugin.getShopFile().createShop(value);
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.REDSTONE_BLOCK).setName("&cRemove item")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new AdminVoteVoteShopItemRemove(plugin, clickEvent.getPlayer()).open();
|
||||
}
|
||||
});
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHEST);
|
||||
}
|
||||
|
||||
}
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
package com.bencodez.votingplugin.commands.gui.admin.voteshop;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
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.advancedcore.api.inventory.editgui.EditGUIButton;
|
||||
import com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueList;
|
||||
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.command.gui.RewardEditGUI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
public class AdminVoteVoteShopItem extends GUIHandler {
|
||||
|
||||
private String identifier;
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteVoteShopItem(VotingPluginMain plugin, CommandSender player, String identifier) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
EditGUI inv = new EditGUI("Edit VoteShop Item: " + identifier);
|
||||
inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.VoteShop");
|
||||
// to add
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueString("Identifier_Name",
|
||||
plugin.getShopFile().getShopIdentifierIdentifierName(identifier)) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, String name) {
|
||||
setPathData(getKey(), name);
|
||||
}
|
||||
}));
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.OAK_DOOR, 1),
|
||||
new EditGUIValueString("Permission", plugin.getShopFile().getVoteShopPermission(identifier)) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, String name) {
|
||||
setPathData(getKey(), name);
|
||||
}
|
||||
}));
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.EMERALD, 1),
|
||||
new EditGUIValueNumber("Cost", plugin.getShopFile().getShopIdentifierCost(identifier)) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Number num) {
|
||||
setPathData(getKey(), num.intValue());
|
||||
}
|
||||
}));
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.BARRIER, 1),
|
||||
new EditGUIValueNumber("Limit", plugin.getShopFile().getShopIdentifierLimit(identifier)) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Number num) {
|
||||
setPathData(getKey(), num.intValue());
|
||||
}
|
||||
}));
|
||||
|
||||
// display item
|
||||
ConfigurationSection displayItemData = plugin.getShopFile().getShopIdentifierSection(identifier);
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(displayItemData.getString("Material")).setAmount(1),
|
||||
new EditGUIValueString("Material", displayItemData.getString("Material")) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, String name) {
|
||||
setPathData(getKey(), name);
|
||||
}
|
||||
}));
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1),
|
||||
new EditGUIValueString("Name", displayItemData.getString("Name")) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, String name) {
|
||||
setPathData(getKey(), name);
|
||||
}
|
||||
}));
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.BOOK, 1),
|
||||
new EditGUIValueList("Lore", displayItemData.getStringList("Lore")) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, ArrayList<String> value) {
|
||||
setPathData(getKey(), value);
|
||||
}
|
||||
}));
|
||||
inv.addButton(new BInventoryButton(
|
||||
new ItemBuilder(player.getInventory().getItemInMainHand().clone()).addLoreLine("&cClick to add")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
ItemBuilder item = new ItemBuilder(clickEvent.getPlayer().getInventory().getItemInMainHand().clone());
|
||||
Map<String, Object> map = item.getConfiguration(false);
|
||||
for (Entry<String, Object> entry : map.entrySet()) {
|
||||
setPathData(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(player.getInventory().getItemInMainHand().clone())
|
||||
.addLoreLine("&cClick to add with exact data")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
ItemBuilder item = new ItemBuilder(clickEvent.getPlayer().getInventory().getItemInMainHand().clone());
|
||||
Map<String, Object> map = item.getConfiguration(true);
|
||||
for (Entry<String, Object> entry : map.entrySet()) {
|
||||
setPathData("ItemStack." + entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(Material.DISPENSER, 1).setName("&cRewards")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
|
||||
plugin.getRewardHandler().getDirectlyDefined("Shop." + identifier + ".Rewards"));
|
||||
}
|
||||
});
|
||||
|
||||
// implement item reward?
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHEST);
|
||||
}
|
||||
|
||||
private void setPathData(String path, Object value) {
|
||||
plugin.getShopFile().getData().set("Shop." + identifier + "." + path, value);
|
||||
plugin.getShopFile().saveData();
|
||||
plugin.reload();
|
||||
}
|
||||
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
package com.bencodez.votingplugin.commands.gui.admin.voteshop;
|
||||
|
||||
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;
|
||||
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.commands.gui.admin.AdminVoteConfirmation;
|
||||
|
||||
public class AdminVoteVoteShopItemRemove extends GUIHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteVoteShopItemRemove(VotingPluginMain plugin, CommandSender player) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
BInventory inv = new BInventory("Edit VoteShop Remove Item");
|
||||
inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.VoteShop");
|
||||
|
||||
for (final String identifier : plugin.getShopFile().getShopIdentifiers()) {
|
||||
inv.addButton(
|
||||
new BInventoryButton(new ItemBuilder(plugin.getShopFile().getShopIdentifierSection(identifier))
|
||||
.addLoreLine("&c&lClick to remove")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new AdminVoteConfirmation(plugin, clickEvent.getPlayer(),
|
||||
"Remove shop item " + identifier + "?") {
|
||||
|
||||
@Override
|
||||
public void onConfirm(Player p) {
|
||||
plugin.getShopFile().removeShop(identifier);
|
||||
p.sendMessage("Removed " + identifier);
|
||||
plugin.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeny(Player p) {
|
||||
new AdminVoteVoteShop(plugin, p).open();
|
||||
}
|
||||
}.open();
|
||||
|
||||
}
|
||||
}.addData("ident", identifier));
|
||||
}
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHEST);
|
||||
}
|
||||
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package com.bencodez.votingplugin.commands.gui.admin.voteshop;
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
public class AdminVoteVoteShopItems extends GUIHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public AdminVoteVoteShopItems(VotingPluginMain plugin, CommandSender player) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
BInventory inv = new BInventory("Edit VoteShop Items");
|
||||
inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.VoteShop");
|
||||
|
||||
for (String identifier : plugin.getShopFile().getShopIdentifiers()) {
|
||||
inv.addButton(
|
||||
new BInventoryButton(new ItemBuilder(plugin.getShopFile().getShopIdentifierSection(identifier))) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new AdminVoteVoteShopItem(plugin, clickEvent.getPlayer(), (String) getData("ident"))
|
||||
.open(GUIMethod.CHEST);
|
||||
|
||||
}
|
||||
}.addData("ident", identifier));
|
||||
}
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHEST);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.bencodez.votingplugin.commands.gui.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
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;
|
||||
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.PlaceholderUtils;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.simpleapi.array.ArrayUtils;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteBest extends GUIHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteBest(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
ArrayList<String> msg = new ArrayList<>();
|
||||
msg.add(plugin.getConfigFile().getFormatCommandsVoteBestTitle());
|
||||
msg.addAll(plugin.getConfigFile().getFormatCommandsVoteBestLines());
|
||||
|
||||
HashMap<String, String> placeholders = new HashMap<>();
|
||||
placeholders.put("HighestDailyTotal", "" + user.getHighestDailyTotal());
|
||||
placeholders.put("HighestWeeklyTotal", "" + user.getHighestWeeklyTotal());
|
||||
placeholders.put("HighestMonthlyTotal", "" + user.getHighestMonthlyTotal());
|
||||
|
||||
placeholders.put("player", user.getPlayerName());
|
||||
|
||||
msg = PlaceholderUtils.replacePlaceHolder(msg, placeholders);
|
||||
|
||||
return ArrayUtils.colorize(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
sendMessage(getChat(sender));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
BInventory inv = new BInventory(plugin.getGui().getChestVoteBestName());
|
||||
inv.addPlaceholder("player", user.getPlayerName());
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestVoteBestDayBestItem())
|
||||
.addPlaceholder("Best", "" + user.getBestDayVoteStreak())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestVoteBestWeekBestItem())
|
||||
.addPlaceholder("Best", "" + user.getBestWeekVoteStreak())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestVoteBestMonthBestItem())
|
||||
.addPlaceholder("Best", "" + user.getBestMonthVoteStreak())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if (plugin.getGui().isChestVoteBestBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
}
|
||||
|
||||
String guiPath = "VoteBest";
|
||||
for (final String str : plugin.getGui().getChestGUIExtraItems(guiPath)) {
|
||||
inv.addButton(
|
||||
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIExtraItemsItem(guiPath, str))) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new RewardBuilder(plugin.getGui().getData(),
|
||||
"CHEST." + guiPath + ".ExtraItems." + str + "."
|
||||
+ clickEvent.getButton().getLastRewardsPath(player))
|
||||
.setGiveOffline(false).send(clickEvent.getPlayer());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.valueOf(plugin.getGui().getGuiMethodBest().toUpperCase()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
package com.bencodez.votingplugin.commands.gui.player;
|
||||
|
||||
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;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
|
||||
import com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton;
|
||||
import com.bencodez.advancedcore.api.item.ItemBuilder;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardOptions;
|
||||
import com.bencodez.simpleapi.array.ArrayUtils;
|
||||
import com.bencodez.simpleapi.messages.MessageAPI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteGUI extends GUIHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteGUI(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender arg0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private ItemBuilder getItemSlot(String slot, Player player) {
|
||||
ItemBuilder builder = new ItemBuilder(plugin.getGui().getChestVoteGUISlotSection(slot));
|
||||
|
||||
String[] lore = new String[1];
|
||||
lore = ArrayUtils.convert(plugin.getGui().getChestVoteGUISlotLore(slot));
|
||||
|
||||
String str = plugin.getConfigFile().getVoteTopDefault();
|
||||
if (lore.length == 0) {
|
||||
if (MessageAPI.startsWithIgnoreCase(slot, "url")) {
|
||||
lore = new String[] { "&aClick me" };
|
||||
} else if (MessageAPI.startsWithIgnoreCase(slot, "next")) {
|
||||
lore = ArrayUtils.convert(new VoteNext(plugin, player, user).getChat(player));
|
||||
} else if (MessageAPI.startsWithIgnoreCase(slot, "last")) {
|
||||
lore = ArrayUtils.convert(new VoteLast(plugin, player, user).getChat(player));
|
||||
} else if (MessageAPI.startsWithIgnoreCase(slot, "total")) {
|
||||
lore = ArrayUtils.convert(new VoteTotal(plugin, player, user).getChat(player));
|
||||
} else if (MessageAPI.startsWithIgnoreCase(slot, "top")) {
|
||||
|
||||
if (str.equalsIgnoreCase("monthly")) {
|
||||
lore = plugin.getTopVoterHandler().topVoterMonthly(1);
|
||||
} else if (str.equalsIgnoreCase("weekly")) {
|
||||
lore = plugin.getTopVoterHandler().topVoterWeekly(1);
|
||||
} else if (str.equalsIgnoreCase("daily")) {
|
||||
lore = plugin.getTopVoterHandler().topVoterDaily(1);
|
||||
} else {
|
||||
lore = plugin.getTopVoterHandler().topVoterAllTime(1);
|
||||
}
|
||||
} else if (slot.equalsIgnoreCase("today")) {
|
||||
String[] today = new VoteToday(plugin, player, user, 1).voteTodayGUI();
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
if (today.length > 0) {
|
||||
for (int i = today.length - 1; i < today.length && list.size() < 10 && i >= 0; i--) {
|
||||
list.add(today[i]);
|
||||
}
|
||||
}
|
||||
lore = ArrayUtils.convert(list);
|
||||
} else if (slot.equalsIgnoreCase("help")) {
|
||||
lore = new String[] { "Click to view help" };
|
||||
}
|
||||
}
|
||||
builder.setLore(ArrayUtils.convert(lore));
|
||||
return builder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
/*
|
||||
* BookWrapper book = new
|
||||
* BookWrapper(plugin.getGui().getBookVoteURLBookGUITitle());
|
||||
*
|
||||
* // url - click to open Layout urlLayout = new Layout(new
|
||||
* ArrayList<String>(Arrays.asList("[Json]")));
|
||||
* urlLayout.replaceTextComponent("[Json]",
|
||||
* BookUtil.TextBuilder.of(book.colorize("Click me")).onClick(BookUtil.
|
||||
* ClickAction.runCommand("/vote url"))
|
||||
* .onHover(BookUtil.HoverAction.showText("Clicking me opens url GUI")).build())
|
||||
* ; book.addLayout(urlLayout); book.addLine();
|
||||
*
|
||||
* // next - click to open for (VoteSite site : plugin.getVoteSites()) { Layout
|
||||
* nextLayout = new Layout(new ArrayList<String>(Arrays.asList("[Json]")));
|
||||
* nextLayout.replaceTextComponent("[Json]",
|
||||
* BookUtil.TextBuilder.of(site.getDisplayName())
|
||||
* .onClick(BookUtil.ClickAction.openUrl(site.getVoteURLJsonStrip()))
|
||||
* .onHover(BookUtil.HoverAction.showText(user.voteCommandNextInfo(site))).build
|
||||
* ()); book.addLayout(nextLayout); } book.addLine();
|
||||
*
|
||||
* // total - click to open
|
||||
*
|
||||
* // top = click to open
|
||||
*
|
||||
* // today - click to open
|
||||
*
|
||||
* // shop - click to open
|
||||
*
|
||||
* book.open(player);
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
// not available
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
if (this.user == null) {
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
|
||||
}
|
||||
BInventory inv = new BInventory(plugin.getGui().getChestVoteGUIName());
|
||||
if (!plugin.getConfigFile().isAlwaysCloseInventory()) {
|
||||
inv.dontClose();
|
||||
}
|
||||
|
||||
if (player.getUniqueId().toString().equals(user.getUUID())) {
|
||||
inv.requirePermission("VotingPlugin.Commands.Vote.GUI");
|
||||
} else {
|
||||
inv.requirePermission("VotingPlugin.Commands.Vote.GUI.Other");
|
||||
}
|
||||
|
||||
inv.addPlaceholder("points", "" + user.getPoints());
|
||||
inv.addPlaceholder("player", user.getPlayerName());
|
||||
inv.addPlaceholder("top", plugin.getConfigFile().getVoteTopDefault());
|
||||
inv.addPlaceholder("sitesavailable", "" + user.getSitesNotVotedOn());
|
||||
|
||||
for (final String slot : plugin.getGui().getChestVoteGUISlots()) {
|
||||
ItemBuilder builder = getItemSlot(slot, player);
|
||||
|
||||
inv.addButton(new UpdatingBInventoryButton(plugin, builder, 1000, 1000) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
Player player = event.getWhoClicked();
|
||||
String cmd = plugin.getGui().getChestVoteGUISlotCommand(slot);
|
||||
if (cmd.equalsIgnoreCase("none")) {
|
||||
return;
|
||||
}
|
||||
if (!cmd.equals("")) {
|
||||
event.runSync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
player.performCommand(cmd);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
plugin.getCommandLoader().processSlotClick(player, user, slot);
|
||||
}
|
||||
String prefix = "";
|
||||
if (event.getButton().getBuilder().isConditional()) {
|
||||
prefix = "Item.";
|
||||
}
|
||||
|
||||
if (plugin.getRewardHandler().hasRewards(plugin.getGui().getData(),
|
||||
plugin.getGui().getChestVoteGUISlotRewardsPath(slot,
|
||||
prefix + event.getButton().getLastRewardsPath(player)))) {
|
||||
plugin.getRewardHandler().giveReward(
|
||||
plugin.getVotingPluginUserManager().getVotingPluginUser(player),
|
||||
plugin.getGui().getData(),
|
||||
plugin.getGui().getChestVoteGUISlotRewardsPath(slot,
|
||||
prefix + event.getButton().getLastRewardsPath(player)),
|
||||
new RewardOptions().addPlaceholder("identifier", slot));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemBuilder onUpdate(Player player) {
|
||||
ItemBuilder item = getItemSlot(slot, player);
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
|
||||
item.addPlaceholder("points", "" + user.getPoints());
|
||||
item.addPlaceholder("player", user.getPlayerName());
|
||||
item.addPlaceholder("top", plugin.getConfigFile().getVoteTopDefault());
|
||||
item.addPlaceholder("sitesavailable", "" + user.getSitesNotVotedOn());
|
||||
return item;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
String guiPath = "VoteGUI";
|
||||
for (final String str : plugin.getGui().getChestGUIExtraItems(guiPath)) {
|
||||
inv.addButton(
|
||||
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIExtraItemsItem(guiPath, str))) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new RewardBuilder(plugin.getGui().getData(),
|
||||
"CHEST." + guiPath + ".ExtraItems." + str + "."
|
||||
+ clickEvent.getButton().getLastRewardsPath(player))
|
||||
.setGiveOffline(false).send(clickEvent.getPlayer());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.valueOf(plugin.getGui().getGuiMethodGUI().toUpperCase()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.bencodez.votingplugin.commands.gui.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.bencodez.advancedcore.api.command.CommandHandler;
|
||||
import com.bencodez.advancedcore.api.gui.GUIHandler;
|
||||
import com.bencodez.advancedcore.api.gui.GUIMethod;
|
||||
import com.bencodez.simpleapi.messages.MessageAPI;
|
||||
import com.bencodez.simpleapi.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 {
|
||||
|
||||
private int page;
|
||||
private VotingPluginMain plugin;
|
||||
|
||||
public VoteHelp(VotingPluginMain plugin, CommandSender player, int page) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ArrayList<TextComponent> helpText(CommandSender sender) {
|
||||
ArrayList<TextComponent> msg = new ArrayList<>();
|
||||
HashMap<String, TextComponent> unsorted = new HashMap<>();
|
||||
|
||||
boolean requirePerms = plugin.getConfigFile().isFormatCommandsVoteHelpRequirePermission();
|
||||
|
||||
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<>();
|
||||
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<>();
|
||||
HashMap<String, TextComponent> unsorted = new HashMap<>();
|
||||
|
||||
boolean requirePerms = plugin.getConfigFile().isFormatCommandsVoteHelpRequirePermission();
|
||||
|
||||
for (CommandHandler cmdHandle : plugin.getVoteCommand()) {
|
||||
if (!requirePerms || cmdHandle.hasPerm(sender)) {
|
||||
unsorted.put(cmdHandle.getHelpLineCommand("/vote"),
|
||||
cmdHandle.getHelpLine("/vote", plugin.getConfigFile().getFormatCommandsVoteHelpLine()));
|
||||
}
|
||||
}
|
||||
ArrayList<String> unsortedList = new ArrayList<>();
|
||||
unsortedList.addAll(unsorted.keySet());
|
||||
Collections.sort(unsortedList, String.CASE_INSENSITIVE_ORDER);
|
||||
for (String cmd : unsortedList) {
|
||||
msg.add(unsorted.get(cmd));
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
sendMessageJson(voteHelpText(sender));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHAT);
|
||||
}
|
||||
|
||||
public ArrayList<TextComponent> voteHelpText(CommandSender sender) {
|
||||
int pagesize = plugin.getConfigFile().getFormatPageSize();
|
||||
ArrayList<TextComponent> msg = new ArrayList<>();
|
||||
ArrayList<TextComponent> text = new ArrayList<>();
|
||||
if (NMSManager.getInstance().isVersion("1.12")) {
|
||||
text = helpTextLegacy(sender);
|
||||
} else {
|
||||
text = helpText(sender);
|
||||
}
|
||||
|
||||
int maxPage = text.size() / pagesize;
|
||||
if ((text.size() % pagesize) != 0) {
|
||||
maxPage++;
|
||||
}
|
||||
|
||||
msg.add(MessageAPI
|
||||
.stringToComp(plugin.getConfigFile().getFormatCommandsVoteHelpTitle() + " " + page + "/" + maxPage));
|
||||
|
||||
for (int i = pagesize * (page - 1); (i < text.size()) && (i < ((page) * pagesize)); i++) {
|
||||
msg.add(text.get(i));
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.bencodez.votingplugin.commands.gui.player;
|
||||
|
||||
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;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
|
||||
import com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton;
|
||||
import com.bencodez.advancedcore.api.item.ItemBuilder;
|
||||
import com.bencodez.advancedcore.api.messages.PlaceholderUtils;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.simpleapi.array.ArrayUtils;
|
||||
import com.bencodez.simpleapi.messages.MessageAPI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteLast extends GUIHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteLast(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
ArrayList<String> msg = new ArrayList<>();
|
||||
|
||||
String playerName = user.getPlayerName();
|
||||
|
||||
msg.add(MessageAPI.replaceIgnoreCase(plugin.getConfigFile().getFormatCommandsVoteLastTitle(), "%player%",
|
||||
playerName));
|
||||
|
||||
for (VoteSite voteSite : plugin.getVoteSitesEnabled()) {
|
||||
if (!voteSite.isHidden()) {
|
||||
msg.add(user.voteCommandLastLine(voteSite));
|
||||
}
|
||||
}
|
||||
|
||||
return ArrayUtils.colorize(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
sendMessage(getChat(sender));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
BInventory inv = new BInventory(plugin.getGui().getChestVoteLastName());
|
||||
inv.addPlaceholder("player", user.getPlayerName());
|
||||
for (VoteSite site : plugin.getVoteSitesEnabled()) {
|
||||
if (!site.isHidden()) {
|
||||
inv.addButton(inv.getNextSlot(),
|
||||
new UpdatingBInventoryButton(plugin, site.getItem().setName(site.getDisplayName())
|
||||
.setLore(user.voteCommandLastGUILine(site)).setAmountNone(1), 1000, 1000) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
if (plugin.getGui().isChestVoteLastClickableLinks()) {
|
||||
Player player = event.getPlayer();
|
||||
if (player != null) {
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager()
|
||||
.getVotingPluginUser(player);
|
||||
user.sendMessage(
|
||||
PlaceholderUtils
|
||||
.replacePlaceHolder(
|
||||
PlaceholderUtils.replacePlaceHolder(
|
||||
PlaceholderUtils.replacePlaceHolder(
|
||||
plugin.getGui()
|
||||
.getChestVoteURLURLText(),
|
||||
"voteurl", site.getVoteURL()),
|
||||
"sitename", site.getDisplayName()),
|
||||
"player", player.getName()));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemBuilder onUpdate(Player p) {
|
||||
return site.getItem().setName(site.getDisplayName())
|
||||
.setLore(user.voteCommandLastGUILine(site)).setAmountNone(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
String guiPath = "VoteLast";
|
||||
for (final String str : plugin.getGui().getChestGUIExtraItems(guiPath)) {
|
||||
inv.addButton(
|
||||
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIExtraItemsItem(guiPath, str))) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new RewardBuilder(plugin.getGui().getData(),
|
||||
"CHEST." + guiPath + ".ExtraItems." + str + "."
|
||||
+ clickEvent.getButton().getLastRewardsPath(player))
|
||||
.setGiveOffline(false).send(clickEvent.getPlayer());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().isChestVoteLastBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
}
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.valueOf(plugin.getGui().getGuiMethodLast().toUpperCase()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.bencodez.votingplugin.commands.gui.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
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.inventory.BInventory;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
|
||||
import com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton;
|
||||
import com.bencodez.advancedcore.api.item.ItemBuilder;
|
||||
import com.bencodez.advancedcore.api.messages.PlaceholderUtils;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.simpleapi.messages.MessageAPI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
import xyz.upperlevel.spigot.book.BookUtil;
|
||||
|
||||
public class VoteNext extends GUIHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteNext(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
ArrayList<String> msg = new ArrayList<>();
|
||||
|
||||
String playerName = user.getPlayerName();
|
||||
|
||||
msg.add(MessageAPI.colorize(MessageAPI
|
||||
.replaceIgnoreCase(plugin.getConfigFile().getFormatCommandsVoteNextTitle(), "%player%", playerName)));
|
||||
|
||||
for (VoteSite voteSite : plugin.getVoteSitesEnabled()) {
|
||||
if (!voteSite.isHidden()) {
|
||||
String msgLine = plugin.getConfigFile().getFormatCommandsVoteNextLayout();
|
||||
|
||||
msgLine = MessageAPI.replaceIgnoreCase(msgLine, "%info%", user.voteCommandNextInfo(voteSite));
|
||||
|
||||
msgLine = MessageAPI.replaceIgnoreCase(msgLine, "%SiteName%", voteSite.getDisplayName());
|
||||
msg.add(MessageAPI.colorize(msgLine));
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
BookWrapper book = new BookWrapper(plugin.getGui().getBookVoteURLBookGUITitle());
|
||||
|
||||
// add colors/config options
|
||||
for (VoteSite site : plugin.getVoteSitesEnabled()) {
|
||||
if (!site.isHidden()) {
|
||||
Layout nextLayout = new Layout(new ArrayList<>(Arrays.asList("[Json]")));
|
||||
nextLayout.replaceTextComponent("[Json]",
|
||||
BookUtil.TextBuilder.of(book.colorize(site.getDisplayName()))
|
||||
.onClick(BookUtil.ClickAction.openUrl(site.getVoteURLJsonStrip()))
|
||||
.onHover(BookUtil.HoverAction.showText(user.voteCommandNextInfo(site))).build());
|
||||
book.addLayout(nextLayout);
|
||||
}
|
||||
}
|
||||
book.addLine();
|
||||
|
||||
book.open(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
sendMessage(getChat(sender));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
BInventory inv = new BInventory(plugin.getGui().getChestVoteNextName());
|
||||
inv.addPlaceholder("player", user.getPlayerName());
|
||||
for (VoteSite site : plugin.getVoteSitesEnabled()) {
|
||||
if (!site.isHidden()) {
|
||||
String siteNameDisplay = plugin.getGui().getChestVoteNextCustomSiteNamesDisplays(site.getKey());
|
||||
if (siteNameDisplay.isEmpty()) {
|
||||
siteNameDisplay = site.getDisplayName();
|
||||
}
|
||||
inv.addButton(inv.getNextSlot(),
|
||||
new UpdatingBInventoryButton(plugin,
|
||||
site.getItem().setName(siteNameDisplay)
|
||||
.setLore(PlaceholderUtils.replacePlaceHolder(
|
||||
plugin.getGui().getChestVoteNextLine(), "time",
|
||||
user.voteCommandNextInfo(site)))
|
||||
.setAmountNone(1),
|
||||
1000, 1000) {
|
||||
|
||||
@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());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
String guiPath = "VoteNext";
|
||||
for (final String str : plugin.getGui().getChestGUIExtraItems(guiPath)) {
|
||||
inv.addButton(
|
||||
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIExtraItemsItem(guiPath, str))) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new RewardBuilder(plugin.getGui().getData(),
|
||||
"CHEST." + guiPath + ".ExtraItems." + str + "."
|
||||
+ clickEvent.getButton().getLastRewardsPath(player))
|
||||
.setGiveOffline(false).send(clickEvent.getPlayer());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().isChestVoteNextBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
}
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.valueOf(plugin.getGui().getGuiMethodNext().toUpperCase()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
package com.bencodez.votingplugin.commands.gui.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
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;
|
||||
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.PlaceholderUtils;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardOptions;
|
||||
import com.bencodez.simpleapi.messages.MessageAPI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteShop extends GUIHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteShop(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender arg0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
if (!plugin.getShopFile().isVoteShopEnabled()) {
|
||||
player.sendMessage(MessageAPI.colorize(plugin.getShopFile().getVoteShopDisabled()));
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.user == null) {
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
|
||||
}
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
|
||||
/*
|
||||
* if (!plugin.getConfigFile().isExtraVoteShopCheck()) { user.cacheAsync(); }
|
||||
*/
|
||||
BInventory inv = new BInventory(plugin.getShopFile().getVoteShopName());
|
||||
inv.addPlaceholder("points", "" + user.getPoints());
|
||||
inv.addPlaceholder("sitesavailable", "" + user.getSitesNotVotedOn());
|
||||
inv.dontClose();
|
||||
|
||||
for (final String identifier : plugin.getShopFile().getShopIdentifiers()) {
|
||||
|
||||
String perm = plugin.getShopFile().getVoteShopPermission(identifier);
|
||||
boolean hasPerm = false;
|
||||
if (perm.isEmpty()) {
|
||||
hasPerm = true;
|
||||
} else {
|
||||
String p = "";
|
||||
if (perm.startsWith("!")) {
|
||||
p = PlaceholderUtils.replacePlaceHolders(player, perm.substring(1));
|
||||
hasPerm = !player.hasPermission(p);
|
||||
} else {
|
||||
p = PlaceholderUtils.replacePlaceHolders(player, perm);
|
||||
hasPerm = player.hasPermission(p);
|
||||
}
|
||||
if (!hasPerm) {
|
||||
plugin.extraDebug("VoteShop: " + player.getName() + "/" + player.getUniqueId()
|
||||
+ " does not have permission `" + p + "` for " + identifier);
|
||||
}
|
||||
}
|
||||
|
||||
int limit = plugin.getShopFile().getShopIdentifierLimit(identifier);
|
||||
|
||||
boolean limitPass = true;
|
||||
if (limit > 0) {
|
||||
if (user.getVoteShopIdentifierLimit(identifier) >= limit) {
|
||||
limitPass = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!plugin.getShopFile().getVoteShopNotBuyable(identifier)) {
|
||||
if ((hasPerm || !plugin.getShopFile().getVoteShopHideOnNoPermission(identifier))
|
||||
&& (limitPass || !plugin.getShopFile().isVoteShopHideLimitedReached())) {
|
||||
ItemBuilder builder = new ItemBuilder(plugin.getShopFile().getShopIdentifierSection(identifier));
|
||||
|
||||
inv.addButton(new BInventoryButton(builder) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Player player = event.getWhoClicked();
|
||||
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
|
||||
if (plugin.getConfigFile().isExtraVoteShopCheck()) {
|
||||
user.cache();
|
||||
}
|
||||
|
||||
String identifier = (String) getData("identifier");
|
||||
int limit = (int) getData("Limit");
|
||||
int points = plugin.getShopFile().getShopIdentifierCost(identifier);
|
||||
if (identifier != null) {
|
||||
// if (plugin.getGui().getChestVoteShopCloseGUI(identifier)) {
|
||||
// event.closeInventory();
|
||||
// }
|
||||
|
||||
// limit fail-safe, should never be needed, except in rare cases
|
||||
boolean limitPass = true;
|
||||
if (limit > 0) {
|
||||
if (user.getVoteShopIdentifierLimit(identifier) >= limit) {
|
||||
limitPass = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (limitPass) {
|
||||
if (!plugin.getShopFile().isVoteShopRequireConfirmation(identifier)) {
|
||||
HashMap<String, String> placeholders = new HashMap<>();
|
||||
placeholders.put("identifier",
|
||||
plugin.getShopFile().getShopIdentifierIdentifierName(identifier));
|
||||
placeholders.put("points", "" + points);
|
||||
placeholders.put("limit", "" + limit);
|
||||
if (user.removePoints(points, true)) {
|
||||
plugin.getLogger().info("VoteShop: " + user.getPlayerName() + "/"
|
||||
+ user.getUUID() + " bought " + identifier + " for " + points);
|
||||
if (plugin.getConfigFile().isTrackShopPurchases()) {
|
||||
plugin.getServerData().addVoteShopPurchase(identifier);
|
||||
}
|
||||
|
||||
plugin.getRewardHandler().giveReward(user, plugin.getShopFile().getData(),
|
||||
plugin.getShopFile().getShopIdentifierRewardsPath(identifier),
|
||||
new RewardOptions().setPlaceholders(placeholders));
|
||||
|
||||
user.sendMessage(PlaceholderUtils.replacePlaceHolder(
|
||||
plugin.getShopFile().getVoteShopPurchase(identifier),
|
||||
placeholders));
|
||||
if (limit > 0) {
|
||||
user.setVoteShopIdentifierLimit(identifier,
|
||||
user.getVoteShopIdentifierLimit(identifier) + 1);
|
||||
}
|
||||
} else {
|
||||
user.sendMessage(PlaceholderUtils.replacePlaceHolder(
|
||||
plugin.getConfigFile().getFormatShopFailedMsg(), placeholders));
|
||||
}
|
||||
} else {
|
||||
plugin.getBukkitScheduler().runTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new VoteShopConfirm(plugin, player, user, identifier)
|
||||
.open(GUIMethod.CHEST);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
} else {
|
||||
user.sendMessage(plugin.getShopFile().getVoteShopLimitReached());
|
||||
}
|
||||
plugin.getCommandLoader().processSlotClick(player, user, identifier);
|
||||
if (plugin.getShopFile().isVoteShopReopenGUIOnPurchase()) {
|
||||
plugin.getCommandLoader().processSlotClick(player, user, "shop");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}.addData("identifier", identifier).addData("Limit", limit));
|
||||
}
|
||||
} else {
|
||||
if (hasPerm) {
|
||||
ItemBuilder builder = new ItemBuilder(plugin.getShopFile().getShopIdentifierSection(identifier));
|
||||
inv.addButton(new BInventoryButton(builder) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
user.sendMessage(plugin.getConfigFile().getFormatShopNotPurchasable());
|
||||
}
|
||||
|
||||
}.addData("identifier", identifier).addData("Limit", limit));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (final String str : plugin.getShopFile().getVoteShopExtraItems()) {
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getShopFile().getGUIVoteShopExtraItems(str))) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
plugin.getCommandLoader().processSlotClick(player, user, str);
|
||||
new RewardBuilder(plugin.getShopFile().getData(),
|
||||
"ExtraItems." + str + "." + clickEvent.getButton().getLastRewardsPath(player))
|
||||
.setGiveOffline(false).send(clickEvent.getPlayer());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getShopFile().isVoteShopBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
}
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHEST);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.bencodez.votingplugin.commands.gui.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
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;
|
||||
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.PlaceholderUtils;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardOptions;
|
||||
import com.bencodez.simpleapi.player.PlayerUtils;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteShopConfirm extends GUIHandler {
|
||||
|
||||
private String identifier;
|
||||
private VotingPluginMain plugin;
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteShopConfirm(VotingPluginMain plugin, CommandSender player, VotingPluginUser user, String identifier) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender arg0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
PlayerUtils.setPlayerMeta(plugin, player, "ident", identifier);
|
||||
BInventory inv = new BInventory(plugin.getShopFile().getShopConfirmPurchaseTitle());
|
||||
inv.dontClose();
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getShopFile().getShopConfirmPurchaseYesItem())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
user.cache();
|
||||
int points = plugin.getShopFile().getShopIdentifierCost(identifier);
|
||||
int limit = plugin.getShopFile().getShopIdentifierLimit(identifier);
|
||||
HashMap<String, String> placeholders = new HashMap<>();
|
||||
placeholders.put("identifier", identifier);
|
||||
placeholders.put("points", "" + points);
|
||||
placeholders.put("limit", "" + limit);
|
||||
if (user.removePoints(points, true)) {
|
||||
plugin.getLogger().info("VoteShop: " + user.getPlayerName() + "/" + user.getUUID() + " bought "
|
||||
+ identifier + " for " + points);
|
||||
if (plugin.getConfigFile().isTrackShopPurchases()) {
|
||||
plugin.getServerData().addVoteShopPurchase(identifier);
|
||||
}
|
||||
|
||||
plugin.getRewardHandler().giveReward(user, plugin.getShopFile().getData(),
|
||||
plugin.getShopFile().getShopIdentifierRewardsPath(identifier),
|
||||
new RewardOptions().setPlaceholders(placeholders));
|
||||
|
||||
user.sendMessage(PlaceholderUtils
|
||||
.replacePlaceHolder(plugin.getShopFile().getVoteShopPurchase(identifier), placeholders));
|
||||
if (limit > 0) {
|
||||
user.setVoteShopIdentifierLimit(identifier, user.getVoteShopIdentifierLimit(identifier) + 1);
|
||||
}
|
||||
} else {
|
||||
user.sendMessage(PlaceholderUtils
|
||||
.replacePlaceHolder(plugin.getConfigFile().getFormatShopFailedMsg(), placeholders));
|
||||
}
|
||||
if (plugin.getShopFile().getVoteShopCloseGUI(identifier)) {
|
||||
event.getButton().getInv().closeInv(player, null);
|
||||
} else {
|
||||
new VoteShop(plugin, event.getPlayer(), user).open();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getShopFile().getShopConfirmPurchaseNoItem())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
if (plugin.getShopFile().getVoteShopCloseGUI(identifier)) {
|
||||
event.getButton().getInv().closeInv(player, null);
|
||||
} else {
|
||||
new VoteShop(plugin, event.getPlayer(), user).open();
|
||||
}
|
||||
}
|
||||
});
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHEST);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package com.bencodez.votingplugin.commands.gui.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
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;
|
||||
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.PlaceholderUtils;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.simpleapi.array.ArrayUtils;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteStreak extends GUIHandler {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private VotingPluginMain plugin;
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteStreak(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
ArrayList<String> msg = new ArrayList<>();
|
||||
msg.add(plugin.getConfigFile().getFormatCommandsVoteStreakTitle());
|
||||
msg.addAll(plugin.getConfigFile().getFormatCommandsVoteStreakLines());
|
||||
|
||||
HashMap<String, String> placeholders = new HashMap<>();
|
||||
placeholders.put("DailyStreak", "" + user.getDayVoteStreak());
|
||||
placeholders.put("WeeklyStreak", "" + user.getWeekVoteStreak());
|
||||
placeholders.put("MonthlyStreak", "" + user.getMonthVoteStreak());
|
||||
|
||||
placeholders.put("BestDailyStreak", "" + user.getBestDayVoteStreak());
|
||||
placeholders.put("BestWeeklyStreak", "" + user.getBestWeekVoteStreak());
|
||||
placeholders.put("BestMonthlyStreak", "" + user.getBestMonthVoteStreak());
|
||||
|
||||
placeholders.put("player", user.getPlayerName());
|
||||
|
||||
msg = PlaceholderUtils.replacePlaceHolder(msg, placeholders);
|
||||
|
||||
return ArrayUtils.colorize(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
sendMessage(getChat(sender));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
BInventory inv = new BInventory(plugin.getGui().getChestVoteStreakName());
|
||||
inv.addPlaceholder("player", user.getPlayerName());
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestVoteStreakCurrentDayStreakItem())
|
||||
.addPlaceholder("Streak", "" + user.getDayVoteStreak())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestVoteStreakCurrentWeekStreakItem())
|
||||
.addPlaceholder("Streak", "" + user.getWeekVoteStreak())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestVoteStreakCurrentMonthStreakItem())
|
||||
.addPlaceholder("Streak", "" + user.getMonthVoteStreak())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestVoteStreakHighestDayStreakItem())
|
||||
.addPlaceholder("Streak", "" + user.getBestDayVoteStreak())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestVoteStreakHighestWeekStreakItem())
|
||||
.addPlaceholder("Streak", "" + user.getBestWeekVoteStreak())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestVoteStreakHighestMonthStreakItem())
|
||||
.addPlaceholder("Streak", "" + user.getBestMonthVoteStreak())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
String guiPath = "VoteStreak";
|
||||
for (final String str : plugin.getGui().getChestGUIExtraItems(guiPath)) {
|
||||
inv.addButton(
|
||||
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIExtraItemsItem(guiPath, str))) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new RewardBuilder(plugin.getGui().getData(),
|
||||
"CHEST." + guiPath + ".ExtraItems." + str + "."
|
||||
+ clickEvent.getButton().getLastRewardsPath(player))
|
||||
.setGiveOffline(false).send(clickEvent.getPlayer());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().isChestVoteStreakBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
}
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.valueOf(plugin.getGui().getGuiMethodStreak().toUpperCase()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
package com.bencodez.votingplugin.commands.gui.player;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
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;
|
||||
|
||||
import com.bencodez.advancedcore.api.gui.GUIHandler;
|
||||
import com.bencodez.advancedcore.api.gui.GUIMethod;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
|
||||
import com.bencodez.advancedcore.api.item.ItemBuilder;
|
||||
import com.bencodez.advancedcore.api.messages.PlaceholderUtils;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.simpleapi.array.ArrayUtils;
|
||||
import com.bencodez.simpleapi.nms.NMSManager;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoterPlayer;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteToday extends GUIHandler {
|
||||
|
||||
private int page;
|
||||
private VotingPluginMain plugin;
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteToday(VotingPluginMain plugin, CommandSender player, VotingPluginUser user, int page) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender arg0) {
|
||||
int pagesize = plugin.getConfigFile().getFormatPageSize();
|
||||
if (page < 1) {
|
||||
page = 1;
|
||||
}
|
||||
ArrayList<String> msg = new ArrayList<>();
|
||||
String[] voteToday = voteToday();
|
||||
|
||||
int maxPage = voteToday.length / pagesize;
|
||||
if ((voteToday.length % pagesize) != 0) {
|
||||
maxPage++;
|
||||
}
|
||||
|
||||
HashMap<String, String> placeholders = new HashMap<>();
|
||||
placeholders.put("page", "" + page);
|
||||
placeholders.put("maxpage", "" + maxPage);
|
||||
|
||||
for (String m : plugin.getConfigFile().getFormatCommandsVoteTodayTitle()) {
|
||||
msg.add(m);
|
||||
}
|
||||
|
||||
page--;
|
||||
|
||||
for (int i = pagesize * page; (i < voteToday.length) && (i < ((page + 1) * pagesize)); i++) {
|
||||
msg.add(voteToday[i]);
|
||||
}
|
||||
|
||||
return ArrayUtils.colorize(PlaceholderUtils.replacePlaceHolder(msg, placeholders));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
sendMessage(getChat(sender));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
BInventory inv = new BInventory(plugin.getGui().getChestVoteTodayName());
|
||||
if (!plugin.getConfigFile().isAlwaysCloseInventory()) {
|
||||
inv.dontClose();
|
||||
}
|
||||
for (TopVoterPlayer user : plugin.getVoteToday().keySet()) {
|
||||
|
||||
for (VoteSite voteSite : plugin.getVoteToday().get(user).keySet()) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(plugin.getConfigFile().getFormatTimeFormat());
|
||||
String timeString = plugin.getVoteToday().get(user).get(voteSite).format(formatter);
|
||||
String msg = plugin.getGui().getChestVoteTodayLine();
|
||||
HashMap<String, String> placeholders = new HashMap<>();
|
||||
placeholders.put("VoteSite", voteSite.getDisplayName());
|
||||
placeholders.put("Time", timeString);
|
||||
msg = PlaceholderUtils.replacePlaceHolder(msg, placeholders);
|
||||
ItemBuilder item = null;
|
||||
if (plugin.getGui().isChestVoteTodayUseSkull() && !NMSManager.getInstance().isVersion("1.12")) {
|
||||
item = new ItemBuilder(user.getPlayerHead());
|
||||
} else {
|
||||
item = new ItemBuilder(plugin.getGui().getChestVoteTodayPlayerItem());
|
||||
}
|
||||
item.setName(PlaceholderUtils.replacePlaceHolder(plugin.getGui().getChestVoteTodayIconTitle(), "player",
|
||||
user.getPlayerName()));
|
||||
item.setLore(msg);
|
||||
final UUID uuid = user.getUuid();
|
||||
inv.addButton(inv.getNextSlot(), new BInventoryButton(item) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(uuid);
|
||||
new VoteGUI(plugin, player, user)
|
||||
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodGUI().toUpperCase()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
String guiPath = "VoteToday";
|
||||
for (final String str : plugin.getGui().getChestGUIExtraItems(guiPath)) {
|
||||
inv.addButton(
|
||||
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIExtraItemsItem(guiPath, str))) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new RewardBuilder(plugin.getGui().getData(),
|
||||
"CHEST." + guiPath + ".ExtraItems." + str + "."
|
||||
+ clickEvent.getButton().getLastRewardsPath(player))
|
||||
.setGiveOffline(false).send(clickEvent.getPlayer());
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().isChestVoteTodayBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
}
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.valueOf(plugin.getGui().getGuiMethodToday().toUpperCase()));
|
||||
}
|
||||
|
||||
public String[] voteToday() {
|
||||
ArrayList<String> msg = new ArrayList<>();
|
||||
for (TopVoterPlayer user : plugin.getVoteToday().keySet()) {
|
||||
|
||||
for (VoteSite voteSite : plugin.getVoteToday().get(user).keySet()) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(plugin.getConfigFile().getFormatTimeFormat());
|
||||
String timeString = plugin.getVoteToday().get(user).get(voteSite).format(formatter);
|
||||
HashMap<String, String> placeholders = new HashMap<>();
|
||||
placeholders.put("player", user.getPlayerName());
|
||||
placeholders.put("votesite", voteSite.getKey());
|
||||
placeholders.put("sitename", voteSite.getDisplayName());
|
||||
placeholders.put("time", timeString);
|
||||
msg.add(PlaceholderUtils.replacePlaceHolder(plugin.getConfigFile().getFormatCommandsVoteTodayLine(),
|
||||
placeholders));
|
||||
// msg.add("&6" + user.getPlayerName() + " : " + voteSite.getKey() + " : " +
|
||||
// timeString);
|
||||
}
|
||||
}
|
||||
msg = ArrayUtils.colorize(msg);
|
||||
return ArrayUtils.convert(msg);
|
||||
}
|
||||
|
||||
public String[] voteTodayGUI() {
|
||||
ArrayList<String> msg = new ArrayList<>();
|
||||
for (TopVoterPlayer user : plugin.getVoteToday().keySet()) {
|
||||
|
||||
LocalDateTime mostRecent = null;
|
||||
VoteSite mostRecentSite = null;
|
||||
for (Entry<VoteSite, LocalDateTime> entry : plugin.getVoteToday().get(user).entrySet()) {
|
||||
if (mostRecent == null || entry.getValue().isAfter(mostRecent)) {
|
||||
mostRecent = entry.getValue();
|
||||
mostRecentSite = entry.getKey();
|
||||
}
|
||||
}
|
||||
if (mostRecent != null) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(plugin.getConfigFile().getFormatTimeFormat());
|
||||
String timeString = mostRecent.format(formatter);
|
||||
HashMap<String, String> placeholders = new HashMap<>();
|
||||
placeholders.put("player", user.getPlayerName());
|
||||
placeholders.put("votesite", mostRecentSite.getKey());
|
||||
placeholders.put("sitename", mostRecentSite.getDisplayName());
|
||||
placeholders.put("time", timeString);
|
||||
msg.add(PlaceholderUtils.replacePlaceHolder(plugin.getConfigFile().getFormatCommandsVoteTodayLine(),
|
||||
placeholders));
|
||||
}
|
||||
}
|
||||
msg = ArrayUtils.colorize(msg);
|
||||
return ArrayUtils.convert(msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
package com.bencodez.votingplugin.commands.gui.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import com.bencodez.advancedcore.api.gui.GUIHandler;
|
||||
import com.bencodez.advancedcore.api.gui.GUIMethod;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
|
||||
import com.bencodez.advancedcore.api.item.ItemBuilder;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.simpleapi.array.ArrayUtils;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoter;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoterPlayer;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteTopVoter extends GUIHandler {
|
||||
|
||||
private int page;
|
||||
private VotingPluginMain plugin;
|
||||
private TopVoter top;
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteTopVoter(VotingPluginMain plugin, CommandSender player, VotingPluginUser user, TopVoter top, int page) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
this.top = top;
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
switch (top) {
|
||||
case AllTime:
|
||||
return ArrayUtils.convert(plugin.getTopVoterHandler().topVoterAllTime(page));
|
||||
case Daily:
|
||||
return ArrayUtils.convert(plugin.getTopVoterHandler().topVoterDaily(page));
|
||||
case Monthly:
|
||||
return ArrayUtils.convert(plugin.getTopVoterHandler().topVoterMonthly(page));
|
||||
case Weekly:
|
||||
return ArrayUtils.convert(plugin.getTopVoterHandler().topVoterWeekly(page));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
sendMessage(getChat(sender));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
try {
|
||||
if (top == null) {
|
||||
top = TopVoter.getDefault();
|
||||
}
|
||||
Set<Entry<TopVoterPlayer, Integer>> users = null;
|
||||
|
||||
String topVoter = top.getName();
|
||||
@SuppressWarnings("unchecked")
|
||||
LinkedHashMap<TopVoterPlayer, Integer> topVotes = (LinkedHashMap<TopVoterPlayer, Integer>) plugin
|
||||
.getTopVoter(top).clone();
|
||||
users = topVotes.entrySet();
|
||||
|
||||
ConfigurationSection customization = plugin.getGui().getChestVoteTopCustomization();
|
||||
boolean customzationEnabled = false;
|
||||
Queue<Integer> playerSlots = new ConcurrentLinkedQueue<>();
|
||||
if (customization != null) {
|
||||
customzationEnabled = customization.getBoolean("Enabled");
|
||||
List<Integer> customizationPlayerSlots = customization.getIntegerList("PlayerSlots");
|
||||
playerSlots.addAll(customizationPlayerSlots);
|
||||
}
|
||||
|
||||
BInventory inv = new BInventory(plugin.getGui().getChestVoteTopName());
|
||||
inv.addPlaceholder("topvoter", topVoter);
|
||||
if (!plugin.getConfigFile().isAlwaysCloseInventory()) {
|
||||
inv.dontClose();
|
||||
}
|
||||
|
||||
int pos = 1;
|
||||
for (Entry<TopVoterPlayer, Integer> entry : users) {
|
||||
|
||||
ItemBuilder playerItem = new ItemBuilder(Material.PAPER);
|
||||
|
||||
if (plugin.getGui().isChestVoteTopUseSkull()) {
|
||||
playerItem = new ItemBuilder(entry.getKey().getPlayerHead());
|
||||
} else {
|
||||
playerItem = new ItemBuilder(Material.valueOf(plugin.getGui().getChestVoteTopPlayerItemMaterial()));
|
||||
}
|
||||
|
||||
playerItem.setLore(new ArrayList<>());
|
||||
|
||||
BInventoryButton button = new BInventoryButton(playerItem
|
||||
.setName(plugin.getGui().getChestVoteTopItemName())
|
||||
.addLoreLine(plugin.getGui().getChestVoteTopItemLore()).addPlaceholder("position", "" + pos)
|
||||
.addPlaceholder("player", entry.getKey().getPlayerName())
|
||||
.addPlaceholder("votes", "" + entry.getValue())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
if (plugin.getGui().isChestVoteTopOpenMainGUIOnClick()) {
|
||||
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());
|
||||
|
||||
if (customzationEnabled && !playerSlots.isEmpty()) {
|
||||
button.setSlot(playerSlots.remove());
|
||||
}
|
||||
|
||||
inv.setCloseInv(plugin.getGui().isChestVoteTopCloseGUIOnClick());
|
||||
|
||||
inv.addButton(button);
|
||||
pos++;
|
||||
}
|
||||
|
||||
TopVoter newTops = top;
|
||||
ArrayList<String> tops = plugin.getGui().getChestVoteTopSwitchItemTopVoters();
|
||||
if (!tops.isEmpty()) {
|
||||
for (String name : tops) {
|
||||
newTops.getSwitchItems().add(TopVoter.getTopVoter(name));
|
||||
}
|
||||
}
|
||||
|
||||
final TopVoter cur = newTops;
|
||||
if (!customzationEnabled) {
|
||||
inv.getPageButtons().add(new BInventoryButton(
|
||||
new ItemBuilder(plugin.getGui().getChestVoteTopSwitchItem()).addPlaceholder("Top", topVoter)) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
if (!clickEvent.getClick().equals(ClickType.RIGHT)) {
|
||||
new VoteTopVoter(plugin, player, user, cur.next(), 0).open(GUIMethod.CHEST);
|
||||
} else {
|
||||
new VoteTopVoter(plugin, player, user, cur.prev(), 0).open(GUIMethod.CHEST);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
inv.addButton(new BInventoryButton(
|
||||
new ItemBuilder(plugin.getGui().getChestVoteTopSwitchItem()).addPlaceholder("Top", topVoter)) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
if (!clickEvent.getClick().equals(ClickType.RIGHT)) {
|
||||
new VoteTopVoter(plugin, player, user, cur.next(), 0).open(GUIMethod.CHEST);
|
||||
} else {
|
||||
new VoteTopVoter(plugin, player, user, cur.prev(), 0).open(GUIMethod.CHEST);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().isChestVoteTopBackButton()) {
|
||||
if (customzationEnabled) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user)
|
||||
.setSlot(customization.getInt("BackButtonSlot", 0)));
|
||||
} else {
|
||||
inv.getPageButtons().add(plugin.getCommandLoader().getBackButton(user).setSlot(1));
|
||||
}
|
||||
}
|
||||
|
||||
String guiPath = "VoteTop.Customization";
|
||||
for (final String str : plugin.getGui().getChestGUIExtraItems(guiPath)) {
|
||||
inv.addButton(
|
||||
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIExtraItemsItem(guiPath, str))) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
plugin.getCommandLoader().processSlotClick(player, user, str);
|
||||
new RewardBuilder(plugin.getGui().getData(),
|
||||
"CHEST." + guiPath + ".ExtraItems." + str + ".Rewards").setGiveOffline(false)
|
||||
.send(clickEvent.getPlayer());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (customization == null || !customzationEnabled || !customization.getBoolean("RemoveBottomBar")) {
|
||||
inv.setPages(true);
|
||||
}
|
||||
inv.setMaxInvSize(plugin.getGui().getChestVoteTopSize());
|
||||
inv.openInventory(player);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.valueOf(plugin.getGui().getGuiMethodTopVoter().toUpperCase()));
|
||||
}
|
||||
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
package com.bencodez.votingplugin.commands.gui.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
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;
|
||||
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 {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteTopVoterLastMonth(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender arg0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
Set<Entry<TopVoterPlayer, Integer>> users = null;
|
||||
|
||||
users = plugin.getLastMonthTopVoter().entrySet();
|
||||
|
||||
BInventory inv = new BInventory(plugin.getGui().getChestVoteTopName());
|
||||
inv.addPlaceholder("topvoter", "Last Month");
|
||||
if (!plugin.getConfigFile().isAlwaysCloseInventory()) {
|
||||
inv.dontClose();
|
||||
}
|
||||
|
||||
int pos = 1;
|
||||
for (Entry<TopVoterPlayer, Integer> entry : users) {
|
||||
ItemBuilder playerItem;
|
||||
|
||||
if (plugin.getGui().isChestVoteTopUseSkull()) {
|
||||
playerItem = new ItemBuilder(entry.getKey().getPlayerHead());
|
||||
} else {
|
||||
playerItem = new ItemBuilder(Material.valueOf(plugin.getGui().getChestVoteTopPlayerItemMaterial()));
|
||||
}
|
||||
|
||||
playerItem.setLore(new ArrayList<>());
|
||||
|
||||
inv.addButton(new BInventoryButton(playerItem.setName(plugin.getGui().getChestVoteTopItemName())
|
||||
.addLoreLine(plugin.getGui().getChestVoteTopItemLore()).addPlaceholder("position", "" + pos)
|
||||
.addPlaceholder("player", entry.getKey().getPlayerName())
|
||||
.addPlaceholder("votes", "" + entry.getValue())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
TopVoterPlayer user = (TopVoterPlayer) getData("User");
|
||||
new VoteGUI(plugin, player, user.getUser())
|
||||
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodGUI().toUpperCase()));
|
||||
}
|
||||
}.addData("player", entry.getKey().getPlayerName()).addData("User", entry.getKey()));
|
||||
pos++;
|
||||
}
|
||||
|
||||
if (plugin.getGui().isChestVoteTopBackButton()) {
|
||||
inv.getPageButtons().add(plugin.getCommandLoader().getBackButton(user).setSlot(1));
|
||||
}
|
||||
|
||||
inv.setPages(true);
|
||||
inv.setMaxInvSize(plugin.getGui().getChestVoteTopSize());
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHEST);
|
||||
}
|
||||
|
||||
}
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
package com.bencodez.votingplugin.commands.gui.player;
|
||||
|
||||
import java.time.YearMonth;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import com.bencodez.advancedcore.api.gui.GUIHandler;
|
||||
import com.bencodez.advancedcore.api.gui.GUIMethod;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
|
||||
import com.bencodez.advancedcore.api.item.ItemBuilder;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoterPlayer;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
|
||||
public class VoteTopVoterPreviousMonths extends GUIHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
private VotingPluginUser user;
|
||||
private int index = -1;
|
||||
|
||||
public VoteTopVoterPreviousMonths(VotingPluginMain plugin, CommandSender player, VotingPluginUser user, int index) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender arg0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void next(int index) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
|
||||
Set<YearMonth> months = plugin.getPreviousMonthsTopVoters().keySet();
|
||||
|
||||
List<YearMonth> yearMonthList = months.stream().sorted(Collections.reverseOrder()).collect(Collectors.toList());
|
||||
YearMonth yearMonth = null;
|
||||
|
||||
if (index < 0) {
|
||||
if (!yearMonthList.isEmpty()) {
|
||||
yearMonth = yearMonthList.get(0);
|
||||
}
|
||||
player.sendMessage(Component.text("Can't open previous months, no data", NamedTextColor.RED));
|
||||
return;
|
||||
}
|
||||
if (yearMonthList.size() <= index) {
|
||||
player.sendMessage(
|
||||
Component.text("Can't open previous months, no data for requested index", NamedTextColor.RED));
|
||||
return;
|
||||
}
|
||||
yearMonth = yearMonthList.get(index);
|
||||
|
||||
Set<Entry<TopVoterPlayer, Integer>> users = null;
|
||||
if (!plugin.getPreviousMonthsTopVoters().containsKey(yearMonth)) {
|
||||
player.sendMessage(Component.text("Can't open previous months, no data", NamedTextColor.RED));
|
||||
return;
|
||||
}
|
||||
users = plugin.getPreviousMonthsTopVoters().get(yearMonth).entrySet();
|
||||
|
||||
BInventory inv = new BInventory(plugin.getGui().getChestVoteTopName());
|
||||
inv.addPlaceholder("topvoter", yearMonth.toString());
|
||||
if (!plugin.getConfigFile().isAlwaysCloseInventory()) {
|
||||
inv.dontClose();
|
||||
}
|
||||
|
||||
int pos = 1;
|
||||
for (Entry<TopVoterPlayer, Integer> entry : users) {
|
||||
ItemBuilder playerItem;
|
||||
|
||||
if (plugin.getGui().isChestVoteTopUseSkull()) {
|
||||
playerItem = new ItemBuilder(entry.getKey().getPlayerHead());
|
||||
} else {
|
||||
playerItem = new ItemBuilder(Material.valueOf(plugin.getGui().getChestVoteTopPlayerItemMaterial()));
|
||||
}
|
||||
|
||||
playerItem.setLore(new ArrayList<>());
|
||||
|
||||
inv.addButton(new BInventoryButton(playerItem.setName(plugin.getGui().getChestVoteTopItemName())
|
||||
.addLoreLine(plugin.getGui().getChestVoteTopItemLore()).addPlaceholder("position", "" + pos)
|
||||
.addPlaceholder("player", entry.getKey().getPlayerName())
|
||||
.addPlaceholder("votes", "" + entry.getValue())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
TopVoterPlayer user = (TopVoterPlayer) getData("User");
|
||||
new VoteGUI(plugin, player, user.getUser())
|
||||
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodGUI().toUpperCase()));
|
||||
}
|
||||
}.addData("player", entry.getKey().getPlayerName()).addData("User", entry.getKey()));
|
||||
pos++;
|
||||
}
|
||||
|
||||
inv.getPageButtons().add(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestVoteTopSwitchItem())
|
||||
.addPlaceholder("Top", yearMonth.toString())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
if (!clickEvent.getClick().equals(ClickType.RIGHT)) {
|
||||
new VoteTopVoterPreviousMonths(plugin, player, user, index + 1).open(GUIMethod.CHEST);
|
||||
} else {
|
||||
new VoteTopVoterPreviousMonths(plugin, player, user, index - 1).open(GUIMethod.CHEST);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (plugin.getGui().isChestVoteTopBackButton()) {
|
||||
inv.getPageButtons().add(plugin.getCommandLoader().getBackButton(user).setSlot(1));
|
||||
}
|
||||
|
||||
inv.setPages(true);
|
||||
inv.setMaxInvSize(plugin.getGui().getChestVoteTopSize());
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHEST);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.bencodez.votingplugin.commands.gui.player;
|
||||
|
||||
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;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
|
||||
import com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton;
|
||||
import com.bencodez.advancedcore.api.item.ItemBuilder;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.simpleapi.array.ArrayUtils;
|
||||
import com.bencodez.simpleapi.messages.MessageAPI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoter;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteTotal extends GUIHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteTotal(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender arg0) {
|
||||
ArrayList<String> msg = new ArrayList<>();
|
||||
|
||||
int daily = user.getTotal(TopVoter.Daily);
|
||||
int weekly = user.getTotal(TopVoter.Weekly);
|
||||
int month = user.getTotal(TopVoter.Monthly);
|
||||
int all = user.getTotal(TopVoter.AllTime);
|
||||
|
||||
for (String s : plugin.getConfigFile().getFormatCommandsVoteTotal()) {
|
||||
String str = MessageAPI.replaceIgnoreCase(s, "%DailyTotal%", "" + daily);
|
||||
str = MessageAPI.replaceIgnoreCase(str, "%WeeklyTotal%", "" + weekly);
|
||||
str = MessageAPI.replaceIgnoreCase(str, "%MonthlyTotal%", "" + month);
|
||||
str = MessageAPI.replaceIgnoreCase(str, "%AllTimeTotal%", "" + all);
|
||||
str = MessageAPI.replaceIgnoreCase(str, "%player%", user.getPlayerName());
|
||||
msg.add(str);
|
||||
}
|
||||
|
||||
return ArrayUtils.colorize(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
// future release?
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
sendMessage(getChat(sender));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
BInventory inv = new BInventory(plugin.getGui().getChestVoteTotalName());
|
||||
inv.addPlaceholder("player", user.getPlayerName());
|
||||
|
||||
for (final TopVoter top : TopVoter.values()) {
|
||||
inv.addButton(new UpdatingBInventoryButton(plugin,
|
||||
new ItemBuilder(plugin.getGui().getChestVoteTotalItem(top))
|
||||
.addPlaceholder("Total", "" + user.getTotal(top)).addPlaceholder("topvoter", top.getName()),
|
||||
1000, 1000) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemBuilder onUpdate(Player arg0) {
|
||||
return new ItemBuilder(plugin.getGui().getChestVoteTotalItem(top))
|
||||
.addPlaceholder("Total", "" + user.getTotal(top)).addPlaceholder("topvoter", top.getName())
|
||||
.addPlaceholder("player", user.getPlayerName());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
String guiPath = "VoteTotal";
|
||||
for (final String str : plugin.getGui().getChestGUIExtraItems(guiPath)) {
|
||||
inv.addButton(
|
||||
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIExtraItemsItem(guiPath, str))) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new RewardBuilder(plugin.getGui().getData(),
|
||||
"CHEST." + guiPath + ".ExtraItems." + str + "."
|
||||
+ clickEvent.getButton().getLastRewardsPath(player))
|
||||
.setGiveOffline(false).send(clickEvent.getPlayer());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().isChestVoteTotalBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
}
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.valueOf(plugin.getGui().getGuiMethodTotal().toUpperCase()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,297 @@
|
||||
package com.bencodez.votingplugin.commands.gui.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import com.bencodez.advancedcore.api.bookgui.BookWrapper;
|
||||
import com.bencodez.advancedcore.api.bookgui.Layout;
|
||||
import com.bencodez.advancedcore.api.gui.GUIHandler;
|
||||
import com.bencodez.advancedcore.api.gui.GUIMethod;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
|
||||
import com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton;
|
||||
import com.bencodez.advancedcore.api.item.ItemBuilder;
|
||||
import com.bencodez.advancedcore.api.messages.MessageBuilder;
|
||||
import com.bencodez.advancedcore.api.messages.PlaceholderUtils;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.simpleapi.array.ArrayUtils;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoter;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
import xyz.upperlevel.spigot.book.BookUtil;
|
||||
|
||||
public class VoteURL extends GUIHandler {
|
||||
|
||||
private boolean json;
|
||||
private VotingPluginMain plugin;
|
||||
private VotingPluginUser user;
|
||||
|
||||
public VoteURL(VotingPluginMain plugin, CommandSender player, VotingPluginUser user, boolean json) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
this.json = json;
|
||||
if (user == null && player instanceof Player) {
|
||||
this.user = plugin.getVotingPluginUserManager().getVotingPluginUser((Player) player);
|
||||
}
|
||||
if (player != null && user != null && player.getName().equals(user.getPlayerName())) {
|
||||
if (plugin.getConfigFile().isUsePrimaryAccountForPlaceholders() && user.hasPrimaryAccount()) {
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(user.getPrimaryAccount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender sender) {
|
||||
return getChat(sender, false);
|
||||
}
|
||||
|
||||
public ArrayList<String> getChat(CommandSender sender, boolean bypassCanVote) {
|
||||
ArrayList<String> sites = new ArrayList<>();
|
||||
|
||||
List<String> title = plugin.getConfigFile().getFormatCommandsVoteText();
|
||||
if (title != null) {
|
||||
sites.addAll(title);
|
||||
}
|
||||
if (plugin.getConfigFile().isFormatCommandsVoteAutoInputSites()) {
|
||||
int counter = 0;
|
||||
for (VoteSite voteSite : plugin.getVoteSitesEnabled()) {
|
||||
if (!voteSite.isHidden()) {
|
||||
if (voteSite.getPermissionToView().isEmpty()
|
||||
|| sender.hasPermission(voteSite.getPermissionToView())) {
|
||||
if (!plugin.getConfigFile().isFormatCommandsVoteOnlyShowSitesToVote()
|
||||
|| user.canVoteSite(voteSite) || bypassCanVote) {
|
||||
counter++;
|
||||
String voteURL = voteSite.getVoteURL(json);
|
||||
MessageBuilder message = new MessageBuilder(
|
||||
plugin.getConfigFile().getFormatCommandsVoteURLS());
|
||||
message.replacePlaceholder("num", Integer.toString(counter))
|
||||
.replacePlaceholder("url", voteURL)
|
||||
.replacePlaceholder("SiteName", voteSite.getDisplayName());
|
||||
if (user != null && user.getPlayerName() != null) {
|
||||
message.replacePlaceholder("player", "" + user.getPlayerName())
|
||||
.replacePlaceholder("Next", "" + user.voteCommandNextInfo(voteSite));
|
||||
}
|
||||
|
||||
sites.add(message.colorize().getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (user != null) {
|
||||
HashMap<String, String> phs = new HashMap<>();
|
||||
phs.put("DailyTotal", "" + user.getTotal(TopVoter.Daily));
|
||||
phs.put("WeekTotal", "" + user.getTotal(TopVoter.Weekly));
|
||||
phs.put("MonthTotal", "" + user.getTotal(TopVoter.Monthly));
|
||||
phs.put("Total", "" + user.getTotal(TopVoter.AllTime));
|
||||
|
||||
sites = PlaceholderUtils.replacePlaceHolder(sites, phs);
|
||||
}
|
||||
|
||||
return ArrayUtils.colorize(sites);
|
||||
}
|
||||
|
||||
private ItemBuilder getItemAll() {
|
||||
ItemBuilder builderAll = new ItemBuilder(plugin.getGui().getChestVoteURLAlreadyVotedAllUrlsButtonItemSection());
|
||||
if (plugin.getGui().isChestVoteURLAllUrlsButtonrequireAllSitesVoted()) {
|
||||
if (user.canVoteAny()) {
|
||||
builderAll = new ItemBuilder(plugin.getGui().getChestVoteURLCanVoteAllUrlsButtonItemSection());
|
||||
}
|
||||
} else {
|
||||
if (user.canVoteAll()) {
|
||||
builderAll = new ItemBuilder(plugin.getGui().getChestVoteURLCanVoteAllUrlsButtonItemSection());
|
||||
}
|
||||
}
|
||||
|
||||
if (!builderAll.hasCustomDisplayName()) {
|
||||
builderAll.setName("&4All Voting Sites");
|
||||
}
|
||||
if (!builderAll.hasCustomLore()) {
|
||||
builderAll.setLore("&cClick Me");
|
||||
}
|
||||
int slot = plugin.getGui().getChestVoteURLAllUrlsButtonSlot();
|
||||
if (slot >= 0) {
|
||||
builderAll.setSlot(slot);
|
||||
}
|
||||
return builderAll;
|
||||
}
|
||||
|
||||
private ItemBuilder getItemVoteSite(VoteSite voteSite) {
|
||||
ItemBuilder builder = new ItemBuilder(plugin.getGui().getChestVoteURLAlreadyVotedItemSection());
|
||||
|
||||
if (user.canVoteSite(voteSite)) {
|
||||
builder = new ItemBuilder(plugin.getGui().getChestVoteURLCanVoteItemSection());
|
||||
builder.setName(plugin.getGui().getChestVoteURLGUISiteNameCanVote());
|
||||
} else {
|
||||
builder.setName(plugin.getGui().getChestVoteURLGUISiteName());
|
||||
builder.addLoreLine(plugin.getGui().getChestVoteURLNextVote());
|
||||
}
|
||||
builder.addPlaceholder("ServiceSite", voteSite.getServiceSite());
|
||||
builder.addPlaceholder("Name", voteSite.getDisplayName());
|
||||
builder.addPlaceholder("VoteDelay", "" + voteSite.getVoteDelay());
|
||||
builder.addPlaceholder("VoteHour", "" + voteSite.getVoteDelayDailyHour());
|
||||
builder.addPlaceholder("Info", user.voteCommandNextInfo(voteSite));
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
BookWrapper book = new BookWrapper(plugin.getGui().getBookVoteURLBookGUITitle());
|
||||
|
||||
if (plugin.getGui().isBookVoteURLBookGUIManual()) {
|
||||
Layout layout = new Layout(plugin.getGui().getBookVoteURLBookGUITopLayout());
|
||||
book.addLayout(layout);
|
||||
}
|
||||
int i = 1;
|
||||
for (VoteSite site : plugin.getVoteSitesEnabled()) {
|
||||
if (!site.isHidden()) {
|
||||
if (site.getPermissionToView().isEmpty() || player.hasPermission(site.getPermissionToView())) {
|
||||
Layout layout = new Layout(plugin.getGui().getBookVoteURLBookGUILayout())
|
||||
.addPlaceholder("sitename", site.getDisplayName()).addPlaceholder("num", "" + i);
|
||||
String text = plugin.getGui().getBookVoteURLBookGUIAlreadyVotedText();
|
||||
ChatColor color = ChatColor.valueOf(plugin.getGui().getBookVoteURLBookGUIAlreadyVotedColor());
|
||||
if (user.canVoteSite(site)) {
|
||||
color = ChatColor.valueOf(plugin.getGui().getBookVoteURLBookGUICanVoteColor());
|
||||
text = plugin.getGui().getBookVoteURLBookGUICanVoteText();
|
||||
}
|
||||
String url = PlaceholderUtils.replacePlaceHolder(PlaceholderUtils.replacePlaceHolder(
|
||||
site.getVoteURLJsonStrip(), "player", user.getPlayerName()), "num", "" + i);
|
||||
layout.replaceTextComponent("[UrlText]",
|
||||
BookUtil.TextBuilder.of(text).color(color).onClick(BookUtil.ClickAction.openUrl(url))
|
||||
.onHover(BookUtil.HoverAction.showText(url)).build());
|
||||
book.addLayout(layout);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
book.open(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
sendMessage(getChat(sender));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
|
||||
BInventory inv = new BInventory(plugin.getGui().getChestVoteURLName());
|
||||
|
||||
if (!plugin.getConfigFile().isAlwaysCloseInventory()) {
|
||||
inv.dontClose();
|
||||
}
|
||||
|
||||
for (final String str : plugin.getGui().getChestVoteURLExtraItems()) {
|
||||
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestVoteURLExtraItemsItem(str))) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new RewardBuilder(plugin.getGui().getData(),
|
||||
"CHEST.VoteURL.ExtraItems." + str + "." + clickEvent.getButton().getLastRewardsPath(player))
|
||||
.setGiveOffline(false).send(clickEvent.getPlayer());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (plugin.getGui().isChestVoteURLViewAllUrlsButtonEnabled()) {
|
||||
ItemBuilder builderAll = getItemAll();
|
||||
|
||||
inv.addButton(new UpdatingBInventoryButton(plugin, builderAll, 5000, 5000) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
event.closeInventory();
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(event.getPlayer());
|
||||
json = true;
|
||||
if (event.getClick().equals(ClickType.SHIFT_LEFT)
|
||||
|| event.getClick().equals(ClickType.SHIFT_RIGHT)) {
|
||||
user.sendMessage(getChat(player, true));
|
||||
} else {
|
||||
user.sendMessage(getChat(player, false));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemBuilder onUpdate(Player player) {
|
||||
return getItemAll();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
int startSlot = plugin.getGui().getChestVoteURLAllUrlsButtonStartSlot();
|
||||
for (final VoteSite voteSite : plugin.getVoteSitesEnabled()) {
|
||||
if (!voteSite.isHidden()) {
|
||||
if (voteSite.getPermissionToView().isEmpty() || player.hasPermission(voteSite.getPermissionToView())) {
|
||||
ItemBuilder builder = getItemVoteSite(voteSite);
|
||||
if (startSlot >= 0) {
|
||||
if (inv.isSlotTaken(startSlot)) {
|
||||
boolean found = false;
|
||||
while (!found) {
|
||||
startSlot++;
|
||||
if (!inv.isSlotTaken(startSlot)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
builder.setSlot(startSlot);
|
||||
startSlot++;
|
||||
}
|
||||
|
||||
inv.addButton(new UpdatingBInventoryButton(plugin, builder, 5000, 5000) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
event.closeInventory();
|
||||
Player player = event.getPlayer();
|
||||
if (player != null) {
|
||||
VotingPluginUser user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
|
||||
HashMap<String, String> placeholders = new HashMap<>();
|
||||
placeholders.put("voteurl", voteSite.getVoteURL());
|
||||
placeholders.put("sitename", voteSite.getDisplayName());
|
||||
placeholders.put("player", player.getName());
|
||||
placeholders.put("servicesite", voteSite.getServiceSite());
|
||||
placeholders.put("VoteDelay", "" + voteSite.getVoteDelay());
|
||||
placeholders.put("VoteHour", "" + voteSite.getVoteDelayDailyHour());
|
||||
user.sendMessage(plugin.getGui().getChestVoteURLURLText(), placeholders);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemBuilder onUpdate(Player player) {
|
||||
return getItemVoteSite(voteSite);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.getGui().isChestVoteURLBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
}
|
||||
|
||||
inv.openInventory(player);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.valueOf(plugin.getGui().getGuiMethodURL().toUpperCase()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.bencodez.votingplugin.commands.gui.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Material;
|
||||
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;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
|
||||
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
|
||||
import com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton;
|
||||
import com.bencodez.advancedcore.api.item.ItemBuilder;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.objects.VoteSite;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
|
||||
public class VoteURLVoteSite extends GUIHandler {
|
||||
|
||||
private VotingPluginMain plugin;
|
||||
private VotingPluginUser user;
|
||||
private String voteSite;
|
||||
|
||||
public VoteURLVoteSite(VotingPluginMain plugin, CommandSender player, VotingPluginUser user, String voteSite) {
|
||||
super(plugin, player);
|
||||
this.plugin = plugin;
|
||||
this.user = user;
|
||||
this.voteSite = voteSite;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getChat(CommandSender arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBook(Player player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChat(CommandSender sender) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChest(Player player) {
|
||||
if (!plugin.isVoteSite(voteSite)) {
|
||||
player.sendMessage("Not a valid votesite");
|
||||
return;
|
||||
}
|
||||
VoteSite site = plugin.getVoteSite(voteSite, true);
|
||||
BInventory inv = new BInventory(plugin.getGui().getChestVoteURLSiteName());
|
||||
inv.addPlaceholder("site", site.getDisplayName());
|
||||
inv.setMeta(player, "VoteSite", site);
|
||||
if (!plugin.getConfigFile().isAlwaysCloseInventory()) {
|
||||
inv.dontClose();
|
||||
}
|
||||
|
||||
inv.addButton(
|
||||
new BInventoryButton(new ItemBuilder(Material.BOW).setName("&4URL").addLoreLine("Click to see URL")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
VoteSite site = (VoteSite) clickEvent.getMeta("VoteSite");
|
||||
clickEvent.getWhoClicked().sendMessage(site.getVoteURL());
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new UpdatingBInventoryButton(plugin,
|
||||
new ItemBuilder(Material.COMPASS).setName("&4Next Vote").addLoreLine(user.voteCommandNextInfo(site)),
|
||||
1000, 1000) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new VoteURL(plugin, clickEvent.getPlayer(), user, true).open();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemBuilder onUpdate(Player arg0) {
|
||||
return new ItemBuilder(Material.COMPASS).setName("&4Next Vote")
|
||||
.addLoreLine(user.voteCommandNextInfo(site));
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new BInventoryButton(
|
||||
new ItemBuilder(Material.CLOCK).setName("&4Last Vote").addLoreLine(user.voteCommandLastLine(site))) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
new VoteURL(plugin, clickEvent.getPlayer(), user, true).open();
|
||||
}
|
||||
});
|
||||
|
||||
if (plugin.getGui().isChestVoteURLBackButton()) {
|
||||
inv.addButton(plugin.getCommandLoader().getBackButton(user));
|
||||
}
|
||||
inv.openInventory(player);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
open(GUIMethod.CHEST);
|
||||
}
|
||||
|
||||
}
|
||||
+53
-52
@@ -1,52 +1,53 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Commands.TabCompleter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.CommandAPI.TabCompleteHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.StringUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
|
||||
/**
|
||||
* The Class AdminVoteTabCompleter.
|
||||
*/
|
||||
public class AdminVoteTabCompleter implements TabCompleter {
|
||||
|
||||
/** The plugin. */
|
||||
Main plugin = Main.plugin;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.bukkit.command.TabCompleter#onTabComplete(org.bukkit.command.
|
||||
* CommandSender, org.bukkit.command.Command, java.lang.String,
|
||||
* java.lang.String[])
|
||||
*/
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String alias, String[] args) {
|
||||
|
||||
List<String> tab = new ArrayList<String>();
|
||||
|
||||
Set<String> cmds = new HashSet<String>();
|
||||
|
||||
cmds.addAll(TabCompleteHandler.getInstance().getTabCompleteOptions(plugin.getAdminVoteCommand(), sender, args,
|
||||
args.length - 1));
|
||||
|
||||
for (String str : cmds) {
|
||||
if (StringUtils.getInstance().startsWithIgnoreCase(str, args[args.length - 1])) {
|
||||
tab.add(str);
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(tab, String.CASE_INSENSITIVE_ORDER);
|
||||
return tab;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
package com.bencodez.votingplugin.commands.tabcompleter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
|
||||
import com.bencodez.advancedcore.api.command.AdvancedCoreTabCompleteHandler;
|
||||
import com.bencodez.simpleapi.messages.MessageAPI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
/**
|
||||
* The Class AdminVoteTabCompleter.
|
||||
*/
|
||||
public class AdminVoteTabCompleter implements TabCompleter {
|
||||
|
||||
/** The plugin. */
|
||||
VotingPluginMain plugin = VotingPluginMain.plugin;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.bukkit.command.TabCompleter#onTabComplete(org.bukkit.command.
|
||||
* CommandSender, org.bukkit.command.Command, java.lang.String,
|
||||
* java.lang.String[])
|
||||
*/
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String alias, String[] args) {
|
||||
|
||||
List<String> tab = new ArrayList<>();
|
||||
|
||||
Set<String> cmds = new HashSet<>();
|
||||
|
||||
cmds.addAll(AdvancedCoreTabCompleteHandler.getInstance().getTabCompleteOptions(plugin.getAdminVoteCommand(),
|
||||
sender, args, args.length - 1));
|
||||
|
||||
for (String str : cmds) {
|
||||
if (MessageAPI.startsWithIgnoreCase(str, args[args.length - 1])) {
|
||||
tab.add(str);
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(tab, String.CASE_INSENSITIVE_ORDER);
|
||||
return tab;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+107
-106
@@ -1,106 +1,107 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Commands.TabCompleter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.CommandAPI.CommandHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.CommandAPI.TabCompleteHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.StringUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
|
||||
/**
|
||||
* The Class AliasesTabCompleter.
|
||||
*/
|
||||
public class AliasesTabCompleter implements TabCompleter {
|
||||
|
||||
/** The plugin. */
|
||||
Main plugin = Main.plugin;
|
||||
|
||||
/** The cmd handle. */
|
||||
public CommandHandler cmdHandle;
|
||||
|
||||
private boolean adminCommand;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.bukkit.command.TabCompleter#onTabComplete(org.bukkit.command.
|
||||
* CommandSender, org.bukkit.command.Command, java.lang.String,
|
||||
* java.lang.String[])
|
||||
*/
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String alias, String[] argsIn) {
|
||||
ArrayList<String> msgArray = new ArrayList<String>();
|
||||
msgArray.add("");
|
||||
for (String arg : argsIn) {
|
||||
msgArray.add(arg);
|
||||
}
|
||||
|
||||
String[] args = ArrayUtils.getInstance().convert(msgArray);
|
||||
|
||||
ArrayList<String> tab = new ArrayList<String>();
|
||||
|
||||
Set<String> cmds = new HashSet<String>();
|
||||
|
||||
ArrayList<CommandHandler> cmdHandlers = new ArrayList<CommandHandler>();
|
||||
|
||||
if (adminCommand) {
|
||||
cmdHandlers.addAll(plugin.getAdminVoteCommand());
|
||||
} else {
|
||||
cmdHandlers.addAll(plugin.getVoteCommand());
|
||||
}
|
||||
ConcurrentHashMap<String, ArrayList<String>> tabCompletes = TabCompleteHandler.getInstance()
|
||||
.getTabCompleteOptions();
|
||||
for (CommandHandler cmdHandle : cmdHandlers) {
|
||||
if (cmdHandle.getArgs().length >= argsIn.length) {
|
||||
for (String arg : cmdHandle.getArgs()[0].split("&")) {
|
||||
if (cmd.getName().equalsIgnoreCase("vote" + arg)
|
||||
|| cmd.getName().equalsIgnoreCase("adminvote" + arg)) {
|
||||
// plugin.debug("Found cmd... attempting to get tab
|
||||
// complete");
|
||||
args[0] = arg;
|
||||
boolean argsMatch = true;
|
||||
for (int i = 0; i < argsIn.length; i++) {
|
||||
if (args.length >= i) {
|
||||
if (!cmdHandle.argsMatch(args[i], i)) {
|
||||
argsMatch = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (argsMatch) {
|
||||
|
||||
cmds.addAll(cmdHandle.getTabCompleteOptions(sender, args, argsIn.length, tabCompletes));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (String str : cmds) {
|
||||
if (StringUtils.getInstance().startsWithIgnoreCase(str, args[args.length - 1])) {
|
||||
tab.add(str);
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(tab, String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
return tab;
|
||||
}
|
||||
|
||||
public AliasesTabCompleter setCMDHandle(CommandHandler cmd, boolean adminCommand) {
|
||||
cmdHandle = cmd;
|
||||
this.adminCommand = adminCommand;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
package com.bencodez.votingplugin.commands.tabcompleter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
|
||||
import com.bencodez.advancedcore.api.command.CommandHandler;
|
||||
import com.bencodez.simpleapi.array.ArrayUtils;
|
||||
import com.bencodez.simpleapi.command.TabCompleteHandler;
|
||||
import com.bencodez.simpleapi.messages.MessageAPI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
/**
|
||||
* The Class AliasesTabCompleter.
|
||||
*/
|
||||
public class AliasesTabCompleter implements TabCompleter {
|
||||
|
||||
private boolean adminCommand;
|
||||
|
||||
/** The cmd handle. */
|
||||
public CommandHandler cmdHandle;
|
||||
|
||||
/** The plugin. */
|
||||
VotingPluginMain plugin = VotingPluginMain.plugin;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.bukkit.command.TabCompleter#onTabComplete(org.bukkit.command.
|
||||
* CommandSender, org.bukkit.command.Command, java.lang.String,
|
||||
* java.lang.String[])
|
||||
*/
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String alias, String[] argsIn) {
|
||||
ArrayList<String> msgArray = new ArrayList<>();
|
||||
msgArray.add("");
|
||||
for (String arg : argsIn) {
|
||||
msgArray.add(arg);
|
||||
}
|
||||
|
||||
String[] args = ArrayUtils.convert(msgArray);
|
||||
|
||||
ArrayList<String> tab = new ArrayList<>();
|
||||
|
||||
Set<String> cmds = new HashSet<>();
|
||||
|
||||
ArrayList<CommandHandler> cmdHandlers = new ArrayList<>();
|
||||
|
||||
if (adminCommand) {
|
||||
cmdHandlers.addAll(plugin.getAdminVoteCommand());
|
||||
} else {
|
||||
cmdHandlers.addAll(plugin.getVoteCommand());
|
||||
}
|
||||
ConcurrentHashMap<String, ArrayList<String>> tabCompletes = TabCompleteHandler.getInstance()
|
||||
.getTabCompleteOptions();
|
||||
for (CommandHandler cmdHandle : cmdHandlers) {
|
||||
if (cmdHandle.getArgs().length >= argsIn.length) {
|
||||
for (String arg : cmdHandle.getArgs()[0].split("&")) {
|
||||
if (cmd.getName().equalsIgnoreCase("vote" + arg)
|
||||
|| cmd.getName().equalsIgnoreCase("adminvote" + arg)) {
|
||||
// plugin.debug("Found cmd... attempting to get tab
|
||||
// complete");
|
||||
args[0] = arg;
|
||||
boolean argsMatch = true;
|
||||
for (int i = 0; i < argsIn.length; i++) {
|
||||
if (args.length >= i) {
|
||||
if (!cmdHandle.argsMatch(args[i], i)) {
|
||||
argsMatch = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (argsMatch) {
|
||||
|
||||
cmds.addAll(cmdHandle.getTabCompleteOptions(sender, args, argsIn.length, tabCompletes));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (String str : cmds) {
|
||||
if (MessageAPI.startsWithIgnoreCase(str, args[args.length - 1])) {
|
||||
tab.add(str);
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(tab, String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
return tab;
|
||||
}
|
||||
|
||||
public AliasesTabCompleter setCMDHandle(CommandHandler cmd, boolean adminCommand) {
|
||||
cmdHandle = cmd;
|
||||
this.adminCommand = adminCommand;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
+54
-53
@@ -1,53 +1,54 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Commands.TabCompleter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.CommandAPI.TabCompleteHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.StringUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class VoteTabCompleter.
|
||||
*/
|
||||
public class VoteTabCompleter implements TabCompleter {
|
||||
|
||||
/** The plugin. */
|
||||
Main plugin = Main.plugin;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.bukkit.command.TabCompleter#onTabComplete(org.bukkit.command.
|
||||
* CommandSender, org.bukkit.command.Command, java.lang.String,
|
||||
* java.lang.String[])
|
||||
*/
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String alias, String[] args) {
|
||||
|
||||
ArrayList<String> tab = new ArrayList<String>();
|
||||
|
||||
Set<String> cmds = new HashSet<String>();
|
||||
|
||||
cmds.addAll(TabCompleteHandler.getInstance().getTabCompleteOptions(plugin.getVoteCommand(), sender, args,
|
||||
args.length - 1));
|
||||
|
||||
for (String str : cmds) {
|
||||
if (StringUtils.getInstance().startsWithIgnoreCase(str, args[args.length - 1])) {
|
||||
tab.add(str);
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(tab, String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
return tab;
|
||||
}
|
||||
|
||||
}
|
||||
package com.bencodez.votingplugin.commands.tabcompleter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
|
||||
import com.bencodez.advancedcore.api.command.AdvancedCoreTabCompleteHandler;
|
||||
import com.bencodez.simpleapi.messages.MessageAPI;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class VoteTabCompleter.
|
||||
*/
|
||||
public class VoteTabCompleter implements TabCompleter {
|
||||
|
||||
/** The plugin. */
|
||||
VotingPluginMain plugin = VotingPluginMain.plugin;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.bukkit.command.TabCompleter#onTabComplete(org.bukkit.command.
|
||||
* CommandSender, org.bukkit.command.Command, java.lang.String,
|
||||
* java.lang.String[])
|
||||
*/
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String alias, String[] args) {
|
||||
|
||||
ArrayList<String> tab = new ArrayList<>();
|
||||
|
||||
Set<String> cmds = new HashSet<>();
|
||||
|
||||
cmds.addAll(AdvancedCoreTabCompleteHandler.getInstance().getTabCompleteOptions(plugin.getVoteCommand(), sender,
|
||||
args, args.length - 1));
|
||||
|
||||
for (String str : cmds) {
|
||||
if (MessageAPI.startsWithIgnoreCase(str, args[args.length - 1])) {
|
||||
tab.add(str);
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(tab, String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
return tab;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package com.bencodez.votingplugin.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.bencodez.simpleapi.file.YMLFile;
|
||||
import com.bencodez.simpleapi.file.annotation.AnnotationHandler;
|
||||
import com.bencodez.simpleapi.file.annotation.ConfigDataBoolean;
|
||||
import com.bencodez.simpleapi.file.annotation.ConfigDataInt;
|
||||
import com.bencodez.simpleapi.file.annotation.ConfigDataListString;
|
||||
import com.bencodez.simpleapi.file.annotation.ConfigDataString;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
public class BungeeSettings extends YMLFile {
|
||||
|
||||
@ConfigDataBoolean(path = "BungeeBroadcast")
|
||||
@Getter
|
||||
private boolean bungeeBroadcast = false;
|
||||
|
||||
@ConfigDataBoolean(path = "BungeeBroadcastAlways")
|
||||
@Getter
|
||||
private boolean bungeeBroadcastAlways = false;
|
||||
|
||||
@ConfigDataBoolean(path = "BungeeDebug")
|
||||
@Getter
|
||||
private boolean bungeeDebug = false;
|
||||
|
||||
@ConfigDataString(path = "BungeeMethod")
|
||||
@Getter
|
||||
private String bungeeMethod = "PLUGINMESSAGING";
|
||||
|
||||
@ConfigDataString(path = "Redis.Host")
|
||||
@Getter
|
||||
private String RedisHost = "";
|
||||
|
||||
@ConfigDataString(path = "Redis.Username")
|
||||
@Getter
|
||||
private String RedisUsername = "";
|
||||
|
||||
@ConfigDataString(path = "PluginMessageChannel")
|
||||
@Getter
|
||||
private String pluginMessagingChannel = "vp:vp";
|
||||
|
||||
@ConfigDataBoolean(path = "PluginMessageEncryption")
|
||||
@Getter
|
||||
private boolean pluginMessageEncryption = false;
|
||||
|
||||
@ConfigDataString(path = "Redis.Prefix")
|
||||
@Getter
|
||||
private String RedisPrefix = "";
|
||||
|
||||
@ConfigDataString(path = "Redis.Password")
|
||||
@Getter
|
||||
private String RedisPassword = "";
|
||||
|
||||
@ConfigDataInt(path = "Redis.Port")
|
||||
@Getter
|
||||
private int RedisPort = 6379;
|
||||
|
||||
@ConfigDataString(path = "MQTT.ClientID")
|
||||
@Getter
|
||||
private String mqttClientID = "";
|
||||
|
||||
@ConfigDataString(path = "MQTT.BrokerURL")
|
||||
@Getter
|
||||
private String mqttBrokerURL = "tcp://localhost:1883";
|
||||
|
||||
@ConfigDataString(path = "MQTT.Username")
|
||||
@Getter
|
||||
private String mqttUsername = "";
|
||||
|
||||
@ConfigDataString(path = "MQTT.Password")
|
||||
@Getter
|
||||
private String mqttPassword = "";
|
||||
|
||||
@ConfigDataString(path = "MQTT.Prefix")
|
||||
@Getter
|
||||
private String mqttPrefix = "";
|
||||
|
||||
@ConfigDataString(path = "BungeeServer.Host")
|
||||
@Getter
|
||||
private String bungeeServerHost = "";
|
||||
|
||||
@ConfigDataInt(path = "BungeeServer.Port")
|
||||
@Getter
|
||||
private int bungeeServerPort = 1297;
|
||||
|
||||
@ConfigDataBoolean(path = "PerServerPoints")
|
||||
@Getter
|
||||
private boolean perServerPoints = false;
|
||||
|
||||
@ConfigDataBoolean(path = "PerServerMilestones")
|
||||
@Getter
|
||||
private boolean perServerMilestones = false;
|
||||
|
||||
@ConfigDataBoolean(path = "GiveExtraAllSitesRewards")
|
||||
@Getter
|
||||
private boolean giveExtraAllSitesRewards = false;
|
||||
|
||||
@ConfigDataBoolean(path = "PerServerRewards")
|
||||
@Getter
|
||||
private boolean perServerRewards = false;
|
||||
|
||||
@ConfigDataBoolean(path = "RemoveInvalidUsers")
|
||||
@Getter
|
||||
private boolean removeInvalidUsers = false;
|
||||
|
||||
@ConfigDataString(path = "Server")
|
||||
@Getter
|
||||
private String server = "PleaseSet";
|
||||
|
||||
@ConfigDataString(path = "SpigotServer.Host")
|
||||
@Getter
|
||||
private String spigotServerHost = "";
|
||||
|
||||
@ConfigDataInt(path = "SpigotServer.Port")
|
||||
@Getter
|
||||
private int spigotServerPort = 1298;
|
||||
|
||||
@ConfigDataBoolean(path = "TriggerVotifierEvent")
|
||||
@Getter
|
||||
private boolean triggerVotifierEvent = false;
|
||||
|
||||
@ConfigDataBoolean(path = "UseBungeecord", secondPath = "UseBungeecoord")
|
||||
@Getter
|
||||
private boolean useBungeecoord = false;
|
||||
|
||||
@ConfigDataBoolean(path = "VotifierBypass")
|
||||
@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<>();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFileCreation() {
|
||||
getPlugin().saveResource("BungeeSettings.yml", true);
|
||||
}
|
||||
}
|
||||
Loaded 100 of 192 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user