Compare commits
582 Commits
2020.9
...
developmen
Author | SHA1 | Date |
---|---|---|
Telesphoreo | 30e38d44a9 | |
Telesphoreo | ea418bb916 | |
Telesphoreo | 7d1705c79f | |
Paldiu | 2551d184ca | |
Video | f9eabf27d5 | |
Video | 846154a723 | |
Ryan Wild | 804614d011 | |
Paldiu | 2c22c6c52d | |
Ryan | 5ef0f29ffe | |
Ryan | 11134f4109 | |
Ryan | e7992c7eb4 | |
Ryan | 82e966dfb0 | |
Paldiu | f457c4cde2 | |
Video | 004a0f3d7c | |
Video | cf5199f28e | |
elmon | 43c68579e5 | |
Ryan | 127ee7d9f9 | |
Ryan | c873fd4abc | |
Ryan | fa90e1d239 | |
elmon | b711ed517f | |
Nathan Curran | 2618d97a3e | |
Nathan Curran | 1c4647290a | |
elmon | f00f67a844 | |
Paldiu | 850f12103c | |
Telesphoreo | 7d71fc0a29 | |
Telesphoreo | a33fd0d978 | |
Ryan | 7fd77f3cbb | |
Video | 2eb0ab4cb1 | |
Video | 2612aaec31 | |
Video | 6e7ad73152 | |
Video | af6411b82c | |
Video | e9ba958a4e | |
Video | 8cff0124ea | |
Video | 1162f10ebb | |
Video | 35965b0b10 | |
Video | 1253732f77 | |
Video | 7ce173e02b | |
Video | aa20a6e579 | |
Video | e1bee32163 | |
Video | 4d006ed172 | |
Video | a29392cab2 | |
Video | 1ecfb0b066 | |
Video | 706229004c | |
Video | a4adfa9bee | |
Video | 225ade8753 | |
Video | bf2323bed2 | |
Video | 8cbfde8bbc | |
Video | a42cb6aff9 | |
Video | 5849947c6b | |
Video | 01fdf766ee | |
Video | afe755f5c1 | |
Video | 5f97e68e0e | |
Video | 1b5bbd1c05 | |
Video | 2ecfb88604 | |
Video | 8356e831a5 | |
Video | ab00cb840f | |
Video | bb2ddf1129 | |
Video | bba5ec922b | |
Video | 58c21bb1aa | |
Video | f190bbeac1 | |
Video | 42143c1163 | |
Ryan | 6453e4efca | |
Paldiu | 9155ac90b5 | |
Video | 1e1367d08f | |
Video | 3f690e2ca1 | |
Video | abfa3b977c | |
Telesphoreo | a395197305 | |
Telesphoreo | b5b71f8bb2 | |
Telesphoreo | c592b1f141 | |
Telesphoreo | f0ba148b81 | |
Telesphoreo | a8826c22cc | |
Telesphoreo | 17629f9366 | |
Telesphoreo | 725375a597 | |
Telesphoreo | 30fb1ebbd5 | |
Telesphoreo | 78e85787e6 | |
Telesphoreo | 2636f2c768 | |
Video | 68adaed997 | |
Video | ecce62f6b4 | |
Telesphoreo | 22278822fe | |
Telesphoreo | 12cf195e55 | |
Video | cf9fdc6fe4 | |
Paldiu | a728ec24d4 | |
Video | 74a71b1843 | |
Ryan | 4d469cdc0a | |
Ryan Wild | 4c287ca9b8 | |
Video | 912bc1a1e4 | |
Video | a598c933ec | |
Video | 936f0b621e | |
Telesphoreo | 1906933ec8 | |
Telesphoreo | d94011ce38 | |
Telesphoreo | fe9ade1217 | |
Telesphoreo | 6e3dd60b99 | |
Telesphoreo | 5a3f0a4de1 | |
Video | 387ea6f71e | |
Telesphoreo | b376a8c8e7 | |
Telesphoreo | 761d07b869 | |
Telesphoreo | 2e6b990e33 | |
Telesphoreo | a1f1e4ccc0 | |
Telesphoreo | e9839b714f | |
Telesphoreo | 13480eeb63 | |
Telesphoreo | f294eaf10a | |
Telesphoreo | 8efe844640 | |
Telesphoreo | 0df93530f1 | |
Telesphoreo | f9dfce8368 | |
Telesphoreo | e336df27c6 | |
Telesphoreo | 88bdeeaf9f | |
Telesphoreo | b61693b2ab | |
Telesphoreo | afef76efd7 | |
Telesphoreo | 9fe3227f1a | |
Telesphoreo | 512130ec52 | |
dependabot[bot] | 5bd7d6fdb4 | |
Telesphoreo | f4fe50fca0 | |
dependabot[bot] | f37dce7da6 | |
dependabot[bot] | 8c914ce3d1 | |
Telesphoreo | cfd197b14d | |
dependabot[bot] | 8486fa331d | |
Telesphoreo | eaa26f9832 | |
Wild1145 | e122c4c5fa | |
dependabot[bot] | 180cd81132 | |
Ryan | d814853036 | |
Ryan | a1ecf88109 | |
Ryan | 5a6a5ff75d | |
Ryan | fdba119d5d | |
Ryan | 087b8dd7ea | |
dependabot[bot] | 213a43380e | |
dependabot[bot] | 8a31b4c5c0 | |
Video | 3818aab454 | |
Video | 61857dd06f | |
Video | bd647afe92 | |
dependabot[bot] | 0e12f5e792 | |
Video | 69f17ef2d7 | |
Video | aebe1acec2 | |
Video | 938b3aa630 | |
dependabot[bot] | 6772333eb4 | |
dependabot[bot] | 0204961834 | |
dependabot[bot] | 2f332a8c42 | |
dependabot[bot] | e288668c92 | |
Ryan | caeda219fa | |
Ryan | e50101df43 | |
Ryan | ee1b27fa0d | |
Ryan | 6ca61d9c6c | |
Ryan | 2d18d461fe | |
Ryan | 47e6386907 | |
Ryan | 0a9b95bfce | |
Video | fedf80b834 | |
Video | 2bdf14f38c | |
Video | b1062fbb6c | |
Video | f00f075551 | |
dependabot[bot] | 44ff621d73 | |
Video | 032e54e2d4 | |
Video | 3ca9835257 | |
Video | f69feed469 | |
Video | 8253f94ac4 | |
Video | 54cb0cfac4 | |
Ryan | a4c81f202c | |
Ryan | da82b27016 | |
Ryan | daf0126f45 | |
Ryan | f6d46b6178 | |
Ryan | a2d11d4b93 | |
Ryan | 23caa4e853 | |
Video | a51f5c9bbf | |
Video | ee804d52ff | |
Video | dc490659c1 | |
Ryan | 0d09c3a550 | |
dependabot[bot] | 4c3f188bb8 | |
Video | e2ccd14eb3 | |
Video | af1df22812 | |
Ivan | f380898bb7 | |
Ryan | 464ed85f1b | |
Ryan | 7dd235b166 | |
Ryan | 1474a80875 | |
Ryan | f45466ee24 | |
Ryan | d70b7bbec2 | |
dependabot[bot] | 541c66c3de | |
Ryan | 77fd4ff66a | |
Ryan | d901cbaa81 | |
Wild1145 | 538ed7020d | |
Wild1145 | 18e6ef16be | |
dependabot[bot] | a335a2acf7 | |
Ryan | 2eb6cc0036 | |
Ryan | 5322d8ab64 | |
dependabot[bot] | dccc315869 | |
Ryan | 7657ae1928 | |
Ryan | dcaf1ec11a | |
Video | 33aca2a482 | |
Video | 0582c2e5be | |
Ryan | 159eda73a1 | |
Ryan | 101987cc17 | |
Video | 6874b2ce13 | |
Ryan | 3be0ffba4e | |
Ryan | da2d25252b | |
Video | c8a4382a7b | |
Video | 3f89f3f48e | |
Video | 871acc2eeb | |
Video | a9c9979b1c | |
Video | fc3fe871b3 | |
Video | e99aaa2eb4 | |
Ryan Wild | 62529a6171 | |
Paldiu | 0caf972248 | |
Ryan | a37364d07e | |
Video | 4ac9844534 | |
Ryan | 939e98b759 | |
Ryan | d99f3e657b | |
Ryan | 92bbb62379 | |
Telesphoreo | fc37633dfd | |
Telesphoreo | 32ade2dece | |
Telesphoreo | 92394a5b30 | |
Telesphoreo | f82089db64 | |
Telesphoreo | 4afb31cb62 | |
Telesphoreo | ab584a5693 | |
Telesphoreo | b5137763b5 | |
Telesphoreo | 01119422fb | |
Telesphoreo | ccdbea2ffa | |
Telesphoreo | 9d1fa20e55 | |
Telesphoreo | 2eccb30731 | |
Telesphoreo | 431bff1b75 | |
Telesphoreo | e89c545906 | |
Telesphoreo | f262638453 | |
Telesphoreo | 82b4873b19 | |
Video | e4a0943af2 | |
Video | 36bd8c0fad | |
Telesphoreo | d323807675 | |
Telesphoreo | 692bb5e2ef | |
Nathan Curran | d77f59435b | |
Video | a08fd2afb6 | |
Ryan | 6fd075fe96 | |
Telesphoreo | 7613ea22e7 | |
Telesphoreo | 3101b49519 | |
Video | f57fc56f4a | |
Ryan | a6ca6b122c | |
Video | 064e73f58b | |
Video | 32138b2e59 | |
Video | e1c3bad4d0 | |
Video | 4e78027f0c | |
Video | 721f4f9fc3 | |
Video | 24ad2611a9 | |
Video | c238f251f2 | |
Video | 02848e3439 | |
Video | 9550f54e2b | |
Video | 39dade78e3 | |
Video | 5b6d8b01a4 | |
Video | 96bc83cead | |
Video | be700a90ce | |
Video | 6d1fce1716 | |
Video | d3665f31fe | |
Video | 4188cb80fa | |
Video | 62fe72d99b | |
Video | f4749559d2 | |
Video | ed815794ed | |
Video | 0c12a19d1d | |
Video | 96d47e8e0c | |
Video | 3027e2a18c | |
Ryan | 06025b2e69 | |
Video | da7e8f64aa | |
Ryan | 17b051e2a7 | |
Nathan Curran | 77a05f22a8 | |
Nathan Curran | 5c3ef1f107 | |
Video | 53c5991971 | |
Nathan Curran | ff760a6c11 | |
Nathan Curran | 63069ff9ec | |
Nathan Curran | 5e63b71861 | |
Ryan | b72782de4f | |
Nathan Curran | de9556c550 | |
Nathan Curran | 6590504545 | |
Ryan | 8d1e8dcf05 | |
Video | 07b5076717 | |
Video | 6fb9507a4c | |
Ryan | 879a524bb4 | |
Elmon11 | c60b451ce7 | |
Video | f85f3e32ea | |
Video | 57b3351047 | |
Video | dd10eb3f5e | |
Ryan Wild | a498104777 | |
Ryan | 4e577f97fa | |
Video | 8c7bf365a0 | |
Nathan Curran | eedb7a5375 | |
Nathan Curran | d047cfc8ff | |
Nathan Curran | 9ff5da8d8f | |
Ryan | ac615f54f7 | |
Nathan Curran | 21af722e23 | |
Nathan Curran | b1196fcf00 | |
Ryan | d170f6d323 | |
Video | 9dd0298f56 | |
Video | bdf4ca84e0 | |
Ryan | caaa067096 | |
Ryan | 7258d7f1bf | |
Video | 8a504bff07 | |
Ryan | c00e64f736 | |
Ryan | 9e73db0f24 | |
Ryan | 951c061d77 | |
Ryan | 579d3e0719 | |
Ryan | 9777733d04 | |
Ryan | 05e118dcb4 | |
Ryan | 7a0d6f49f4 | |
Ryan | 19f1b7f6bd | |
Ryan | b12afbdc1f | |
Ryan | 49e77d4f93 | |
Ryan | eb9107bedf | |
Ryan | 951c699ed0 | |
Ryan | 9e676143b8 | |
Elmon11 | 6895e46375 | |
Ryan | c8b20bc255 | |
Elmon11 | 1cf46c7337 | |
Nathan Curran | f240a15af3 | |
Ryan | 6073712fdf | |
Video | 407b63e48b | |
Video | be562fe722 | |
Video | 928ab41d7f | |
Nathan Curran | d11d55b218 | |
Video | debb95fb4c | |
Nathan Curran | b9f7ab3ec3 | |
Video | 2cdf1e66a6 | |
Nathan Curran | 20c2c4c96e | |
Video | d5238150d0 | |
Paldiu | 64a4e70c41 | |
abhiram | 0c2f0a714c | |
abhiram | 4c67553bdd | |
abhiram | ffab5e3c12 | |
abhiram | f7556a4861 | |
abhiram | 385fc77771 | |
abhiram | b852ea1822 | |
abhiram | 4a5a3a1a2d | |
Ryan | 37762e5470 | |
Ryan | 85d90090c8 | |
Ryan | 09930c2d9a | |
Ryan | 7ae1ab035a | |
Ryan | 2bd1787663 | |
Ryan | 765b7dcc4b | |
Ryan | 091381a076 | |
Nathan Curran | 27dfd71b2e | |
Video | 16e06bd932 | |
Video | a33c310757 | |
Video | df21bdfa7e | |
Nathan Curran | d7e2c0da42 | |
Video | a7529b41fb | |
Video | c4fce3f0f9 | |
Ryan | 27f5f18962 | |
Elmon11 | dca5e30291 | |
TFTWPhoenix | 09a435053e | |
TFTWPhoenix | 14309275fb | |
Ryan | 2375e92d90 | |
Paldiu | 97672c2fff | |
Paldiu | 5837b05a35 | |
Paldiu | b3b68ebd13 | |
Elmon11 | 2dbbb5c262 | |
Elmon11 | e45655edbb | |
Elmon11 | 9713fcabd6 | |
Elmon11 | dc10c40578 | |
Nathan Curran | db3c190b2b | |
Paldiu | 2725857364 | |
Nathan Curran | 9f291f675c | |
Nathan Curran | 561c192c27 | |
Ryan | 086dec28ac | |
Paldiu | b03870c0aa | |
Ryan | f5c08cd28b | |
Paldiu | 2a87271642 | |
Ryan | 3b57aec0e8 | |
Ryan | efac65bc76 | |
Ryan Wild | 9c8fe6c590 | |
Ryan | 9f52cdf753 | |
Paldiu | 216234ea01 | |
Nathan Curran | 881dead392 | |
Ryan | ff2bca26aa | |
Ryan Wild | 89ad934aa6 | |
Paldiu | d0a195647c | |
Nathan Curran | eb05b05042 | |
Nathan Curran | b9c1970d20 | |
Nathan Curran | 9eca9ac5b2 | |
Nathan Curran | 5b577fae07 | |
Nathan Curran | 452a8755c2 | |
Ryan Wild | 2fb8f224e7 | |
Ryan | b6a2c8e021 | |
Ryan | f0a25fde0c | |
Ryan | 4324497831 | |
Ryan | 14c53b7370 | |
Ryan | 0396b8ad86 | |
Ryan | 8ee7486afc | |
Ryan | 694d9614c5 | |
Ryan | 150e25072a | |
abhiram | 7d990ae2c0 | |
Paldiu | 0dd5a26efa | |
Paldiu | 5c097c83cb | |
abhiram | a85dd014a0 | |
abhiram | 342df43f85 | |
Ryan Wild | d4be858c46 | |
Ivan | ec9a6e0d5b | |
Paldiu | 9161016f73 | |
Paldiu | bdd22f8d75 | |
Paldiu | ce103ffd50 | |
abhiram | 85c35f25a3 | |
abhiram | c29b312101 | |
Paldiu | a4ead85701 | |
Paldiu | 46273b3301 | |
abhiram | d6b74a76bb | |
abhiram | 6f66957b17 | |
Paldiu | 17347c23a5 | |
Paldiu | 718748f1a2 | |
Ryan Wild | 96d1c53ede | |
Ivan | 1293a8aa1e | |
Ivan | 96424694ee | |
Ivan | 0367d9fd3a | |
Ivan | 3b666f1fde | |
Elmon11 | ec51cb7408 | |
Ryan | 4023394562 | |
Ryan Wild | 5d312a12d4 | |
Ryan Wild | b88cdf1250 | |
Ryan Wild | ebec598120 | |
Ryan | aa060ea4d8 | |
Ryan | fc3eef4d90 | |
Ryan | 44ac012165 | |
Ryan | 500d0e1044 | |
Ivan | 400a90b385 | |
Ivan | b8a741aa58 | |
Elmon11 | a3929ec07e | |
speed | 8225daf6f1 | |
Ryan | 8dce71eca1 | |
Ryan | a2243abf2d | |
Ryan | 009b983c9a | |
speed | 1b3876cffa | |
speed | ed48ce3a8f | |
Paldiu | 830daab8f4 | |
speed | 9688827a39 | |
Paldiu | 3464a33678 | |
Paldiu | 5754d70d05 | |
Paldiu | fbf2972006 | |
Paldiu | aa2836b29a | |
Paldiu | 260368585e | |
Paldiu | 323fd1a031 | |
Paldiu | c7b0f77910 | |
speed | 7fb6a2f087 | |
Elmon11 | e32c2eed15 | |
Elmon11 | 7afa80c89f | |
Elmon11 | a3cccc7ac0 | |
Elmon11 | bc37ed5341 | |
speed | 0a5ce5b9cc | |
Paldiu | a4e23dc03f | |
Paldiu | 7a394e52e4 | |
Paldiu | 9352a48650 | |
Paldiu | a849e01ce5 | |
Ryan | fd725ca6c5 | |
Ryan | 0703ea685e | |
speed | 1ba468cbfc | |
Ryan | 91dc89013c | |
speed | 7cdeac451b | |
speed | 5b8cf2798e | |
speed | 98158e0f27 | |
Paldiu | c0ac0365eb | |
Elmon11 | 0c60cbc739 | |
Elmon11 | 402a6be5ad | |
speed | 9d131f0f24 | |
speed | b9606fa0e3 | |
Paldiu | d71f5452ad | |
Paldiu | eb9759f2d8 | |
Paldiu | dec35f76e4 | |
Paldiu | 97edce0a67 | |
Paldiu | 361aa4ee04 | |
Paldiu | 5c0f77c7c5 | |
speed | 210b0f8b43 | |
speed | 585fdb7992 | |
speed | 6d05e9b924 | |
Ryan | fb314170c1 | |
speed | 218d720b06 | |
Ryan | 7bf97a03c4 | |
speed | de496970d9 | |
speed | c8ec171b11 | |
speed | caf126f543 | |
speed | a717cce3b5 | |
speed | ce32490b4d | |
Elmon11 | 5d882d9052 | |
Elmon11 | 7dfd6c0b8b | |
Ryan | fa5c774f45 | |
speed | c356ecd168 | |
SupItsDillon | f8ce64d6c3 | |
speed | 39d5b610a1 | |
SupItsDillon | 50643eb9ff | |
SupItsDillon | 687166e0a4 | |
SupItsDillon | 98ead06355 | |
SupItsDillon | cbc3795ef2 | |
SupItsDillon | b9d608222e | |
SupItsDillon | 777a66f8da | |
SupItsDillon | 6441deceab | |
SupItsDillon | 1fedb1fad3 | |
SupItsDillon | 8b1cef3b83 | |
SupItsDillon | 81ef3d624a | |
SupItsDillon | b0c0f17043 | |
SupItsDillon | fb3cdf3603 | |
SupItsDillon | 950c975e8f | |
SupItsDillon | 79c8ea301d | |
SupItsDillon | 7a11c9062d | |
SupItsDillon | 2037775276 | |
SupItsDillon | 4a3ce64412 | |
Ryan | 681695150a | |
Elmon11 | e98682a1af | |
Ryan | 92534640d4 | |
speed | 695ccd0e71 | |
speed | 0be2aa718f | |
speed | b3b9c2ef43 | |
speed | 293ea04c56 | |
Elmon11 | aae1f524ea | |
Ryan | 7871acc215 | |
Ryan | 153b87c3b3 | |
Ryan | 932fa467ba | |
Ryan | 82804fcac2 | |
speed | 8ed35aba2b | |
Elmon11 | 4898bcf7b5 | |
speed | 495c91f5bb | |
Elmon11 | 42199f9923 | |
Elmon11 | 03a6f18d18 | |
Elmon11 | aff12edb03 | |
Ryan | c0a7ee1bb6 | |
Ryan | 8c0db481ae | |
Ryan | 6084e7cb63 | |
Ryan | e40138dee6 | |
speed | 28576a9e8b | |
speed | c1d4e126a3 | |
speed | 6cd995ff52 | |
Telesphoreo | 9e107c546d | |
Telesphoreo | edb1f224ca | |
Ryan | 495133da1a | |
Telesphoreo | de0d6853b7 | |
Telesphoreo | 5cdbae0166 | |
Telesphoreo | a537183545 | |
Telesphoreo | 2c19ce5c65 | |
Telesphoreo | 609053e13f | |
Telesphoreo | a3837a0e06 | |
Telesphoreo | 0adee3582b | |
Telesphoreo | 08bfd73eec | |
Telesphoreo | 9a7cc52e03 | |
Telesphoreo | 11984bc46f | |
Telesphoreo | 8ac5bc827a | |
Telesphoreo | 366287eb24 | |
Telesphoreo | 43c2df58c7 | |
Telesphoreo | d0acfcf674 | |
Telesphoreo | 88ccd8edfd | |
Telesphoreo | 7f9e2af9a6 | |
Telesphoreo | f9269f1fe4 | |
Telesphoreo | a5359ec580 | |
Telesphoreo | e3a6f5127f | |
Telesphoreo | e1e046b16b | |
Telesphoreo | 7d93050ff9 | |
Telesphoreo | fadcb9ad5d | |
Telesphoreo | 49f7c6e8c3 | |
speed | 9bcdb2bcdc | |
Telesphoreo | ca4670ed89 | |
speed | adf71cb020 | |
Seth | 6e84fdad23 | |
Telesphoreo | 2ecfd9610f | |
Telesphoreo | bb33778fc9 | |
Telesphoreo | d4d1000c16 | |
Nathan Curran | 5a96204f1b | |
Nathan Curran | 3bd72dacda | |
Telesphoreo | a4c8dad865 | |
Nathan Curran | 82e7a3b659 | |
Telesphoreo | 586fa98c32 | |
Nathan Curran | a8f95bcb19 | |
Seth | 82d92565e7 | |
Seth | 533e4fe369 | |
Seth | f8304aecd7 | |
Seth | ac6e58ff9e | |
Telesphoreo | 4be2a1e05b | |
Telesphoreo | 59831ef1f3 | |
Telesphoreo | 54e6e2f9b1 | |
Telesphoreo | d203772a9a | |
Telesphoreo | 55522e8191 | |
Seth | ac3d0fca88 | |
Telesphoreo | eb6514332e | |
Telesphoreo | 098d3e4cf1 | |
Seth | 81eb333b6a | |
Telesphoreo | 3057421d6d | |
Telesphoreo | 9cb96e81ac | |
Telesphoreo | d67189e170 | |
CoolJWB | 451ef8f009 | |
William Bergh | 7af53448be | |
William Bergh | 2072c89f77 | |
Telesphoreo | 43b266f17d | |
Telesphoreo | c61f7e78fd | |
William Bergh | 14ab1e95b5 | |
Telesphoreo | 44fe8f6f94 | |
speedxx | 1c487a6a60 | |
William Bergh | 6f4cc8d4b5 | |
Telesphoreo | f98f6990ea | |
speed | 4c81c94702 |
|
@ -0,0 +1,17 @@
|
|||
name: Gradle-Build
|
||||
|
||||
on: [ push ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 17
|
||||
cache: gradle
|
||||
- name: Build with Gradle
|
||||
run: chmod a+x gradlew && ./gradlew build --no-daemon
|
|
@ -1,17 +0,0 @@
|
|||
name: Java CI
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Set up JDK 1.8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
|
@ -1,6 +1,8 @@
|
|||
# TFM excludes
|
||||
build.properties
|
||||
dependency-reduced-pom.xml
|
||||
*.html
|
||||
*.css
|
||||
|
||||
# Netbeans excludes
|
||||
/nbproject/private
|
||||
|
@ -25,11 +27,14 @@ manifest.mf
|
|||
/.idea/workspace.xml
|
||||
/.idea/uiDesigner.xml
|
||||
/.idea/libraries
|
||||
/.idea/
|
||||
*.iml
|
||||
|
||||
# Maven excludes
|
||||
/target
|
||||
|
||||
/.gradle
|
||||
|
||||
# OS generated files
|
||||
.DS_Store
|
||||
._*
|
||||
|
@ -37,3 +42,4 @@ manifest.mf
|
|||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
.idea/inspectionProfiles/Project_Default.xml
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
|
@ -1,28 +0,0 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<JavaCodeStyleSettings>
|
||||
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="20" />
|
||||
<option name="IMPORT_LAYOUT_TABLE">
|
||||
<value>
|
||||
<package name="" withSubpackages="true" static="false" />
|
||||
<package name="" withSubpackages="true" static="true" />
|
||||
</value>
|
||||
</option>
|
||||
</JavaCodeStyleSettings>
|
||||
<codeStyleSettings language="JAVA">
|
||||
<option name="BRACE_STYLE" value="2" />
|
||||
<option name="CLASS_BRACE_STYLE" value="2" />
|
||||
<option name="METHOD_BRACE_STYLE" value="2" />
|
||||
<option name="LAMBDA_BRACE_STYLE" value="2" />
|
||||
<option name="ELSE_ON_NEW_LINE" value="true" />
|
||||
<option name="WHILE_ON_NEW_LINE" value="true" />
|
||||
<option name="CATCH_ON_NEW_LINE" value="true" />
|
||||
<option name="FINALLY_ON_NEW_LINE" value="true" />
|
||||
<option name="SPACE_AFTER_TYPE_CAST" value="false" />
|
||||
<option name="IF_BRACE_FORCE" value="3" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="3" />
|
||||
<option name="WHILE_BRACE_FORCE" value="3" />
|
||||
<option name="FOR_BRACE_FORCE" value="3" />
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
|
@ -1,5 +1,46 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</state>
|
||||
</component>
|
||||
<code_scheme name="Project" version="173">
|
||||
<JavaCodeStyleSettings>
|
||||
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="20" />
|
||||
<option name="IMPORT_LAYOUT_TABLE">
|
||||
<value>
|
||||
<package name="" withSubpackages="true" static="false" />
|
||||
<package name="" withSubpackages="true" static="true" />
|
||||
</value>
|
||||
</option>
|
||||
</JavaCodeStyleSettings>
|
||||
<JetCodeStyleSettings>
|
||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||
<value>
|
||||
<package name="java.util" alias="false" withSubpackages="false" />
|
||||
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
||||
<package name="io.ktor" alias="false" withSubpackages="true" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="PACKAGES_IMPORT_LAYOUT">
|
||||
<value>
|
||||
<package name="" alias="false" withSubpackages="true" />
|
||||
<package name="java" alias="false" withSubpackages="true" />
|
||||
<package name="javax" alias="false" withSubpackages="true" />
|
||||
<package name="kotlin" alias="false" withSubpackages="true" />
|
||||
<package name="" alias="true" withSubpackages="true" />
|
||||
</value>
|
||||
</option>
|
||||
</JetCodeStyleSettings>
|
||||
<codeStyleSettings language="JAVA">
|
||||
<option name="BRACE_STYLE" value="2" />
|
||||
<option name="CLASS_BRACE_STYLE" value="2" />
|
||||
<option name="METHOD_BRACE_STYLE" value="2" />
|
||||
<option name="LAMBDA_BRACE_STYLE" value="2" />
|
||||
<option name="ELSE_ON_NEW_LINE" value="true" />
|
||||
<option name="WHILE_ON_NEW_LINE" value="true" />
|
||||
<option name="CATCH_ON_NEW_LINE" value="true" />
|
||||
<option name="FINALLY_ON_NEW_LINE" value="true" />
|
||||
<option name="SPACE_AFTER_TYPE_CAST" value="false" />
|
||||
<option name="IF_BRACE_FORCE" value="3" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="3" />
|
||||
<option name="WHILE_BRACE_FORCE" value="3" />
|
||||
<option name="FOR_BRACE_FORCE" value="3" />
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="true" />
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="TotalFreedomMod" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="TotalFreedomMod" target="1.8" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</project>
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<list size="1">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
|
||||
</list>
|
||||
</component>
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
|
||||
</project>
|
|
@ -1,124 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -1 +0,0 @@
|
|||
language: java
|
|
@ -1,3 +1,4 @@
|
|||
# Contributing to TotalFreedomMod #
|
||||
# Contributing to TotalFreedomMod
|
||||
|
||||
For information about contributing to TotalFreedomMod, please see the [contributing guidelines](https://github.com/TotalFreedom/TotalFreedomMod/wiki/Contributing).
|
||||
For information about contributing to TotalFreedomMod, please see
|
||||
the [contributing guidelines](https://github.com/TotalFreedom/TotalFreedomMod/wiki/Contributing).
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('Build') {
|
||||
steps {
|
||||
mvn -B package --file pom.xml
|
||||
archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
81
LICENSE.md
81
LICENSE.md
|
@ -1,4 +1,5 @@
|
|||
# TotalFreedom General License #
|
||||
# TotalFreedom General License
|
||||
|
||||
_Version 2.0, 27th February 2015_
|
||||
|
||||
Copyright (c) 2011 Steven Lawson
|
||||
|
@ -7,48 +8,86 @@ Copyright (c) 2012 Jerom van der Sar
|
|||
|
||||
All rights reserved.
|
||||
|
||||
##### 1. Definitions #####
|
||||
##### 1. Definitions
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by this document.
|
||||
|
||||
"Licensor" shall mean the copyright holder or entity authorised by the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are
|
||||
under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or
|
||||
indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of
|
||||
fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You", "Your" or "Yourself" shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code,
|
||||
documentation source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, binary data, generated documentation, and conversions to other media types.
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including
|
||||
but not limited to compiled object code, binary data, generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" and "This Software" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work.
|
||||
"Work" and "This Software" shall mean the work of authorship, whether in Source or Object form, made available under the
|
||||
License, as indicated by a copyright notice that is included in or attached to the work.
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work
|
||||
and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an
|
||||
original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or
|
||||
additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the
|
||||
Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner.
|
||||
For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to
|
||||
the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code
|
||||
control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of
|
||||
discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in
|
||||
writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received
|
||||
by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
"Redistribution" shall mean any partial or complete availability, transfer or publication of the Work from one Legal Entity to another.
|
||||
"Redistribution" shall mean any partial or complete availability, transfer or publication of the Work from one Legal
|
||||
Entity to another.
|
||||
|
||||
##### 2. Grant of Copyright License #####
|
||||
Subject to the terms and conditions of this License, You are granted a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to prepare Derivative Works of, publicly display, publicly perform, inspect and redistribute the Work and such Derivative Works as long as the following conditions are met:
|
||||
##### 2. Grant of Copyright License
|
||||
|
||||
1. Redistributions of This Software must solely occur in Source form. Redistribution in Object form is prohibited without prior written permission from the Licensor.
|
||||
Subject to the terms and conditions of this License, You are granted a perpetual, worldwide, non-exclusive, no-charge,
|
||||
royalty-free, irrevocable copyright license to prepare Derivative Works of, publicly display, publicly perform, inspect
|
||||
and redistribute the Work and such Derivative Works as long as the following conditions are met:
|
||||
|
||||
2. Neither the names of the copyright holders nor the names this software's contributors may be removed from This Software's source code.
|
||||
1. Redistributions of This Software must solely occur in Source form. Redistribution in Object form is prohibited
|
||||
without prior written permission from the Licensor.
|
||||
|
||||
3. Neither the names of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from This Software without specific prior written permission.
|
||||
2. Neither the names of the copyright holders nor the names this software's contributors may be removed from This
|
||||
Software's source code.
|
||||
|
||||
4. Accreditations referencing This Software's copyright holders or contributors may neither be altered or removed from source code nor withheld from reproduction in Object form whatsoever.
|
||||
3. Neither the names of the copyright holders nor the names of its contributors may be used to endorse or promote
|
||||
products derived from This Software without specific prior written permission.
|
||||
|
||||
5. Any conditions specified by this license may be temporarily or permanently waived by any the aforementioned copyright holders.
|
||||
4. Accreditations referencing This Software's copyright holders or contributors may neither be altered or removed from
|
||||
source code nor withheld from reproduction in Object form whatsoever.
|
||||
|
||||
5. Any conditions specified by this license may be temporarily or permanently waived by any the aforementioned copyright
|
||||
holders.
|
||||
|
||||
6. Redistributions of This Software must retain this License document in its exact form.
|
||||
|
||||
7. Sub licensing of This Software is prohibited without prior written permission from the Licensor.
|
||||
|
||||
##### 3. Submission of Contributions #####
|
||||
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
##### 3. Submission of Contributions
|
||||
|
||||
##### 4. Disclaimer of Warranty #####
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the
|
||||
Licensor shall be under the terms and conditions of this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may
|
||||
have executed with Licensor regarding such Contributions.
|
||||
|
||||
##### 4. Disclaimer of Warranty
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
19
README.md
19
README.md
|
@ -1,14 +1,21 @@
|
|||
# TotalFreedomMod [![Build Status](https://travis-ci.org/TFPatches/TotalFreedomMod.svg?branch=development)](https://travis-ci.org/TFPatches/TotalFreedomMod) [![codebeat badge](https://codebeat.co/badges/5f078e55-8a02-4120-9076-70f6994f48d1)](https://codebeat.co/projects/github-com-tfpatches-totalfreedommod-tfm-1-14-fa58c58f-b1c4-4221-bf78-346e07db6961)
|
||||
# TotalFreedomMod ![Build Status](https://github.com/StevenNL2000Freedom/TotalFreedomMod/actions/workflows/gradle.yml/badge.svg)
|
||||
|
||||
TotalFreedomMod is a CraftBukkit server plugin designed primarily to support the [Official TotalFreedom Minecraft Server](http://totalfreedom.me/). However, you are more than welcome to adapt the source for your own server.
|
||||
TotalFreedomMod is a CraftBukkit server plugin designed primarily to support
|
||||
the [Official TotalFreedom Minecraft Server](https://totalfreedom.me/). However, you are more than welcome to adapt the
|
||||
source for your own server.
|
||||
|
||||
This plugin was originally coded by StevenLawson (Madgeek1450), with Jerom van der Sar (Prozza) becoming heavily involved in its development some time later. It consists of over 85 custom coded commands and a large variety of distinguishable features not included in any other plugin. The plugin has since its beginning grown immensely. Together, with the main TotalFreedom server, TotalFreedomMod has a long-standing reputation of effectiveness whilst maintaining a clear feeling of openness towards the administrators and the players themselves.
|
||||
This plugin was originally coded by StevenLawson (Madgeek1450), with Jerom van der Sar (Prozza) becoming heavily
|
||||
involved in its development some time later. It consists of over 85 custom coded commands and a large variety of
|
||||
distinguishable features not included in any other plugin. The plugin has since its beginning grown immensely. Together,
|
||||
with the main TotalFreedom server, TotalFreedomMod has a long-standing reputation of effectiveness whilst maintaining a
|
||||
clear feeling of openness towards the administrators and the players themselves. TotalFreedomMod was forked to a new repository called TFPatches for faster development. The repository was renamed to TotalFreedomMC, which you are on now. When Wild1145 took ownership of TotalFreedom, it was further forked into a new organization, AtlasMediaGroup. This version still continues to receive updates, with some being backported from AtlasMediaGroup.
|
||||
|
||||
### Contributing
|
||||
|
||||
### Contributing ###
|
||||
Please see [CONTRIBUTING.md](CONTRIBUTING.md) if you are interested in developing TotalFreedomMod.
|
||||
|
||||
For information on how TotalFreedomMod is licensed, please see [LICENSE.md](LICENSE.md).
|
||||
|
||||
### Compiling ###
|
||||
### Compiling
|
||||
|
||||
You need Maven to build. You'd also need to set the JDK version to Java 8 as that is the current standard as of now.
|
||||
You need Gradle to build. You'd also need to set the JDK version to Java 17 as that is the current standard as of now.
|
||||
|
|
|
@ -0,0 +1,232 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id 'maven-publish'
|
||||
id 'idea'
|
||||
id 'checkstyle'
|
||||
id 'com.github.johnrengelman.shadow' version '7.1.2'
|
||||
id 'net.minecrell.plugin-yml.bukkit' version '0.5.1'
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
gradlePluginPortal()
|
||||
|
||||
maven {
|
||||
url = uri('https://jitpack.io')
|
||||
content {
|
||||
includeGroup('com.github.vexsoftware')
|
||||
}
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://nexus.hc.to/content/repositories/pub_releases/')
|
||||
content {
|
||||
includeGroup('net.milkbowl.vault')
|
||||
}
|
||||
}
|
||||
|
||||
maven { url = uri("https://papermc.io/repo/repository/maven-public/") }
|
||||
|
||||
maven {
|
||||
url = uri('https://repo.codemc.org/repository/maven-public/')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://repo.codemc.org/repository/nms/')
|
||||
content {
|
||||
includeGroup('org.spigotmc')
|
||||
}
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://hub.spigotmc.org/nexus/content/groups/public/')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://maven.enginehub.org/repo/')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://maven.elmakers.com/repository/')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://m2.dv8tion.net/releases/')
|
||||
content {
|
||||
includeGroup('net.dv8tion')
|
||||
includeGroup('club.minnced')
|
||||
includeGroup('com.google.code')
|
||||
includeGroup('com.neovisionaries')
|
||||
includeGroup('com.squareup')
|
||||
includeGroup('org.apache.commons')
|
||||
includeGroup('org.jetbrains.annotations')
|
||||
includeGroup('org.slf4j.slf4j-api')
|
||||
}
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://maven.playpro.com/')
|
||||
content {
|
||||
includeGroup('net.coreprotect')
|
||||
}
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://nexus.telesphoreo.me/repository/totalfreedom/')
|
||||
content {
|
||||
includeGroup('me.totalfreedom')
|
||||
}
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://repo.mattmalec.com/repository/releases')
|
||||
content {
|
||||
includeGroup('com.mattmalec')
|
||||
}
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://repo.essentialsx.net/releases/')
|
||||
content {
|
||||
includeGroup('net.essentialsx')
|
||||
}
|
||||
}
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation('commons-io:commons-io:2.11.0')
|
||||
implementation('org.apache.commons:commons-lang3:3.12.0')
|
||||
implementation('commons-codec:commons-codec:1.15')
|
||||
implementation('org.bstats:bstats-base:3.0.0')
|
||||
implementation('org.bstats:bstats-bukkit:3.0.0')
|
||||
implementation('org.reflections:reflections:0.10.2')
|
||||
implementation('org.javassist:javassist:3.28.0-GA')
|
||||
implementation('org.jetbrains:annotations:23.0.0')
|
||||
implementation('com.mattmalec:Pterodactyl4J:2.BETA_92')
|
||||
implementation('com.squareup.okhttp3:okhttp:4.9.3')
|
||||
compileOnly('org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT')
|
||||
compileOnly('me.totalfreedom:BukkitTelnet:4.7')
|
||||
compileOnly('me.totalfreedom:TF-LibsDisguises:10.0.27-SNAPSHOT')
|
||||
compileOnly('com.sk89q.worldedit:worldedit-bukkit:7.3.0-SNAPSHOT')
|
||||
compileOnly('net.essentialsx:EssentialsX:2.19.2')
|
||||
compileOnly('net.dv8tion:JDA:4.3.0_277')
|
||||
compileOnly('net.coreprotect:coreprotect:20.4')
|
||||
compileOnly('com.sk89q.worldguard:worldguard-bukkit:7.0.6')
|
||||
compileOnly('com.github.vexsoftware:votifier:v1.9')
|
||||
compileOnly('net.goldtreeservers:worldguardextraflags:4.0.0')
|
||||
compileOnly('me.totalfreedom:TFGuilds:2021.06-RC3')
|
||||
}
|
||||
|
||||
group = 'me.totalfreedom'
|
||||
version = project.property('project.pluginVersion')
|
||||
description = 'TotalFreedomMod'
|
||||
java.sourceCompatibility = JavaVersion.VERSION_17
|
||||
java.targetCompatibility = JavaVersion.VERSION_17
|
||||
archivesBaseName = 'TotalFreedomMod-donotuse'
|
||||
|
||||
bukkit {
|
||||
main = 'me.totalfreedom.totalfreedommod.TotalFreedomMod'
|
||||
apiVersion = '1.17'
|
||||
version = project.property('project.pluginVersion')
|
||||
description = 'Plugin for the Total Freedom server.'
|
||||
authors = ['Madgeek1450', 'Prozza']
|
||||
softDepend = ['BukkitTelnet', 'Essentials', 'CoreProtect', 'LibsDisguises', 'WorldEdit',
|
||||
'WorldGuard', 'WorldGuardExtraFlags', 'TFGuilds', 'JDA', 'Votifier']
|
||||
}
|
||||
|
||||
static def getDate() {
|
||||
return new Date().format('MM/dd/yyyy HH:mm')
|
||||
}
|
||||
|
||||
String getGitHash() {
|
||||
def stdout = new ByteArrayOutputStream()
|
||||
try {
|
||||
exec {
|
||||
commandLine "git", "rev-parse", "--short", "HEAD"
|
||||
standardOutput = stdout
|
||||
ignoreExitValue = true
|
||||
}
|
||||
} catch (GradleException e) {
|
||||
logger.error("Couldn't determine Git head because Git is not installed. " + e.getMessage())
|
||||
}
|
||||
return stdout.size() > 0 ? stdout.toString().trim() : "unknown"
|
||||
}
|
||||
|
||||
String getBuildNumber() {
|
||||
def stdout = new ByteArrayOutputStream()
|
||||
try {
|
||||
exec {
|
||||
commandLine "git", "rev-list", "HEAD", "--count"
|
||||
standardOutput = stdout
|
||||
ignoreExitValue = true
|
||||
}
|
||||
} catch (GradleException e) {
|
||||
logger.error("Couldn't determine build number because Git is not installed. " + e.getMessage())
|
||||
}
|
||||
return stdout.size() > 0 ? stdout.toString().trim() : "unknown"
|
||||
}
|
||||
|
||||
tasks.withType(Checkstyle) {
|
||||
reports {
|
||||
xml.required = false
|
||||
html.required = true
|
||||
html.stylesheet resources.text.fromFile('config/xsl/checkstyle.xsl')
|
||||
}
|
||||
}
|
||||
|
||||
task buildProperties {
|
||||
ant.propertyfile(file: "$project.rootDir/src/main/resources/build.properties") {
|
||||
entry(key: "buildAuthor", default: "unknown")
|
||||
entry(key: "buildNumber", value: getBuildNumber())
|
||||
entry(key: "buildDate", value: getDate())
|
||||
entry(key: "buildCodeName", value: project.property('project.buildCodeName'))
|
||||
entry(key: "buildHead", value: getGitHash())
|
||||
}
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
shadowJar {
|
||||
archiveBaseName.set('TotalFreedomMod')
|
||||
archiveClassifier.set('')
|
||||
archiveVersion.set('')
|
||||
}
|
||||
minimize()
|
||||
dependencies {
|
||||
include(dependency('commons-io:commons-io'))
|
||||
include(dependency('org.apache.commons:commons-lang3'))
|
||||
include(dependency('commons-codec:commons-codec'))
|
||||
include(dependency('org.javassist:javassist'))
|
||||
include(dependency('io.papermc:paperlib'))
|
||||
include(dependency('org.bstats:bstats-base'))
|
||||
include(dependency('org.bstats:bstats-bukkit'))
|
||||
include(dependency('org.reflections:reflections'))
|
||||
include(dependency('org.jetbrains:annotations'))
|
||||
include(dependency('com.mattmalec:Pterodactyl4J'))
|
||||
include(dependency('com.squareup:okhttp3'))
|
||||
}
|
||||
relocate 'org.bstats', 'me.totalfreedom.totalfreedommod'
|
||||
relocate 'io.papermc.lib', 'me.totalfreedom.totalfreedommod.paperlib'
|
||||
}
|
||||
|
||||
tasks.compileJava.finalizedBy tasks.buildProperties
|
||||
tasks.build.dependsOn tasks.shadowJar
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
into("META-INF/maven/$project.group/$project.name") {
|
||||
from { generatePomFileForMavenPublication }
|
||||
rename ".*", "pom.xml"
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
|
@ -2,20 +2,20 @@
|
|||
<!DOCTYPE module PUBLIC
|
||||
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
||||
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
|
||||
|
||||
<module name="Checker">
|
||||
<property name="charset" value="UTF-8"/>
|
||||
<property name="severity" value="warning"/>
|
||||
<property name="fileExtensions" value="java, properties, xml"/>
|
||||
|
||||
<module name="SuppressionFilter">
|
||||
<property name="file" value="supressions.xml"/>
|
||||
<property name="file" value="${config_loc}/suppressions.xml"/>
|
||||
</module>
|
||||
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
</module>
|
||||
|
||||
<module name="LineLength">
|
||||
<property name="max" value="200"/>
|
||||
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
|
||||
</module>
|
||||
<module name="TreeWalker">
|
||||
<module name="OuterTypeFilename"/>
|
||||
<module name="IllegalTokenText">
|
||||
|
@ -24,10 +24,6 @@
|
|||
value="\\u00(08|09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
|
||||
<property name="message" value="Avoid using corresponding octal or Unicode escape."/>
|
||||
</module>
|
||||
<module name="LineLength">
|
||||
<property name="max" value="200"/>
|
||||
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
|
||||
</module>
|
||||
<module name="AvoidStarImport"/>
|
||||
<module name="OneTopLevelClass"/>
|
||||
<module name="NoLineWrap"/>
|
||||
|
@ -91,7 +87,7 @@
|
|||
value="Local variable name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="ClassTypeParameterName">
|
||||
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
|
||||
<property name="format" value="(^[A-Z][a-zA-Z0-9]*$)|([A-Z][a-zA-Z0-9]*[_][a-zA-Z0-9]*$)"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Class type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
|
@ -112,7 +108,8 @@
|
|||
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
|
||||
</module>
|
||||
<module name="OverloadMethodsDeclarationOrder"/>
|
||||
<module name="CustomImportOrder"/><!-- http://checkstyle.sourceforge.net/config_imports.html -->
|
||||
<module name="CustomImportOrder"/>
|
||||
<!-- http://checkstyle.sourceforge.net/config_imports.html -->
|
||||
<module name="MethodParamPad"/>
|
||||
<module name="OperatorWrap">
|
||||
<property name="option" value="NL"/>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE suppressions PUBLIC "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
|
||||
"http://checkstyle.org/dtds/suppressions_1_2.dtd">
|
||||
<suppressions>
|
||||
<suppress files="NanoHTTPD\.java" checks="[a-zA-Z0-9]*"/>
|
||||
<suppress files="CleanroomChunkGenerator\.java" checks="[a-zA-Z0-9]*"/>
|
||||
</suppressions>
|
|
@ -0,0 +1,242 @@
|
|||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
<xsl:output method="html" indent="yes"/>
|
||||
<xsl:decimal-format decimal-separator="." grouping-separator=","/>
|
||||
|
||||
<xsl:key name="files" match="file" use="@name"/>
|
||||
|
||||
<!-- Checkstyle XML Style Sheet by Rolf Wojtech <rolf@wojtech.de> -->
|
||||
<!-- (based on checkstyle-noframe-sorted.xsl by Stephane Bailliez -->
|
||||
<!-- <sbailliez@apache.org> and sf-patch 1721291 by Leo Liang) -->
|
||||
<!-- Changes: -->
|
||||
<!-- * Outputs seperate columns for error/warning/info -->
|
||||
<!-- * Sorts primarily by #error, secondarily by #warning, tertiary by #info -->
|
||||
<!-- * Compatible with windows path names (converts '\' to '/' for html anchor) -->
|
||||
<!-- -->
|
||||
<!-- Part of the Checkstyle distribution found at https://checkstyle.org -->
|
||||
<!-- Usage (generates checkstyle_report.html): -->
|
||||
<!-- <checkstyle failonviolation="false" config="${check.config}"> -->
|
||||
<!-- <fileset dir="${src.dir}" includes="**/*.java"/> -->
|
||||
<!-- <formatter type="xml" toFile="${doc.dir}/checkstyle_report.xml"/> -->
|
||||
<!-- </checkstyle> -->
|
||||
<!-- <style basedir="${doc.dir}" destdir="${doc.dir}" -->
|
||||
<!-- includes="checkstyle_report.xml" -->
|
||||
<!-- style="${doc.dir}/checkstyle-noframes-severity-sorted.xsl"/> -->
|
||||
|
||||
<xsl:template match="checkstyle">
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
.bannercell {
|
||||
border: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
body {
|
||||
margin-left: 10;
|
||||
margin-right: 10;
|
||||
font:normal 80% arial,helvetica,sanserif;
|
||||
background-color:#FFFFFF;
|
||||
color:#000000;
|
||||
}
|
||||
.a td {
|
||||
background: #efefef;
|
||||
}
|
||||
.b td {
|
||||
background: #fff;
|
||||
}
|
||||
th, td {
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
th {
|
||||
font-weight:bold;
|
||||
background: #ccc;
|
||||
color: black;
|
||||
}
|
||||
table, th, td {
|
||||
font-size:100%;
|
||||
border: none
|
||||
}
|
||||
table.log tr td, tr th {
|
||||
|
||||
}
|
||||
h2 {
|
||||
font-weight:bold;
|
||||
font-size:140%;
|
||||
margin-bottom: 5;
|
||||
}
|
||||
h3 {
|
||||
font-size:100%;
|
||||
font-weight:bold;
|
||||
background: #525D76;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
padding: 5px;
|
||||
margin-right: 2px;
|
||||
margin-left: 2px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a name="top"></a>
|
||||
<!-- jakarta logo -->
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td class="bannercell" rowspan="2">
|
||||
<!--a href="http://jakarta.apache.org/">
|
||||
<img src="http://jakarta.apache.org/images/jakarta-logo.gif" alt="http://jakarta.apache.org" align="left" border="0"/>
|
||||
</a-->
|
||||
</td>
|
||||
<td class="text-align:right">
|
||||
<h2>CheckStyle Audit</h2>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-align:right">Designed for use with <a href='https://checkstyle.org/'>
|
||||
CheckStyle
|
||||
</a> and <a href='http://jakarta.apache.org'>Ant</a>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1"/>
|
||||
|
||||
<!-- Summary part -->
|
||||
<xsl:apply-templates select="." mode="summary"/>
|
||||
<hr size="1" width="100%" align="left"/>
|
||||
|
||||
<!-- Package List part -->
|
||||
<xsl:apply-templates select="." mode="filelist"/>
|
||||
<hr size="1" width="100%" align="left"/>
|
||||
|
||||
<!-- For each package create its part -->
|
||||
<xsl:apply-templates select="file[@name and generate-id(.) = generate-id(key('files', @name))]"/>
|
||||
|
||||
<hr size="1" width="100%" align="left"/>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="checkstyle" mode="filelist">
|
||||
<h3>Files</h3>
|
||||
<table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Errors</th>
|
||||
<th>Warnings</th>
|
||||
<th>Infos</th>
|
||||
</tr>
|
||||
<xsl:for-each select="file[@name and generate-id(.) = generate-id(key('files', @name))]">
|
||||
|
||||
<!-- Sort method 1: Primary by #error, secondary by #warning, tertiary by #info -->
|
||||
<xsl:sort data-type="number" order="descending"
|
||||
select="count(key('files', @name)/error[@severity='error'])"/>
|
||||
<xsl:sort data-type="number" order="descending"
|
||||
select="count(key('files', @name)/error[@severity='warning'])"/>
|
||||
<xsl:sort data-type="number" order="descending"
|
||||
select="count(key('files', @name)/error[@severity='info'])"/>
|
||||
|
||||
<!-- Sort method 1: Sum(#error+#info+#warning) (uncomment to use, comment method 1) -->
|
||||
<!--
|
||||
<xsl:sort data-type="number" order="descending" select="count(key('files', @name)/error)"/>
|
||||
-->
|
||||
|
||||
<xsl:variable name="errorCount" select="count(key('files', @name)/error[@severity='error'])"/>
|
||||
<xsl:variable name="warningCount" select="count(key('files', @name)/error[@severity='warning'])"/>
|
||||
<xsl:variable name="infoCount" select="count(key('files', @name)/error[@severity='info'])"/>
|
||||
|
||||
<tr>
|
||||
<xsl:call-template name="alternated-row"/>
|
||||
<td>
|
||||
<a href="#f-{translate(@name,'\','/')}">
|
||||
<xsl:value-of select="@name"/>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="$errorCount"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="$warningCount"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="$infoCount"/>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="file">
|
||||
<a name="f-{translate(@name,'\','/')}"></a>
|
||||
<h3>File
|
||||
<xsl:value-of select="@name"/>
|
||||
</h3>
|
||||
|
||||
<table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
|
||||
<tr>
|
||||
<th>Severity</th>
|
||||
<th>Error Description</th>
|
||||
<th>Line</th>
|
||||
</tr>
|
||||
<xsl:for-each select="key('files', @name)/error">
|
||||
<xsl:sort data-type="number" order="ascending" select="@line"/>
|
||||
<tr>
|
||||
<xsl:call-template name="alternated-row"/>
|
||||
<td>
|
||||
<xsl:value-of select="@severity"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="@message"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="@line"/>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
<a href="#top">Back to top</a>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="checkstyle" mode="summary">
|
||||
<h3>Summary</h3>
|
||||
<xsl:variable name="fileCount"
|
||||
select="count(file[@name and generate-id(.) = generate-id(key('files', @name))])"/>
|
||||
<xsl:variable name="errorCount" select="count(file/error[@severity='error'])"/>
|
||||
<xsl:variable name="warningCount" select="count(file/error[@severity='warning'])"/>
|
||||
<xsl:variable name="infoCount" select="count(file/error[@severity='info'])"/>
|
||||
<table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
|
||||
<tr>
|
||||
<th>Files</th>
|
||||
<th>Errors</th>
|
||||
<th>Warnings</th>
|
||||
<th>Infos</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<xsl:call-template name="alternated-row"/>
|
||||
<td>
|
||||
<xsl:value-of select="$fileCount"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="$errorCount"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="$warningCount"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="$infoCount"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="alternated-row">
|
||||
<xsl:attribute name="class">
|
||||
<xsl:if test="position() mod 2 = 1">a</xsl:if>
|
||||
<xsl:if test="position() mod 2 = 0">b</xsl:if>
|
||||
</xsl:attribute>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
|
@ -0,0 +1,7 @@
|
|||
project.pluginVersion=7.1.0
|
||||
project.buildAuthor=unknown
|
||||
project.buildCodeName=Ember
|
||||
org.gradle.cache=true
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
|
Binary file not shown.
|
@ -0,0 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
|
@ -0,0 +1,185 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or 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.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# 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"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 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=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# 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"
|
||||
which java >/dev/null 2>&1 || 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
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
|
@ -0,0 +1,89 @@
|
|||
@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
|
||||
|
||||
@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=.
|
||||
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%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="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!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
453
pom.xml
453
pom.xml
|
@ -1,453 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
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>me.totalfreedom</groupId>
|
||||
<artifactId>TotalFreedomMod</artifactId>
|
||||
<version>2020.9</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<tfm.build.codename>Antaeus</tfm.build.codename>
|
||||
<jar.finalName>${project.name}</jar.finalName>
|
||||
<timestamp>${maven.build.timestamp}</timestamp>
|
||||
<maven.build.timestamp.format>MM/dd/yyyy HH:mm</maven.build.timestamp.format>
|
||||
</properties>
|
||||
|
||||
<name>TotalFreedomMod</name>
|
||||
<description>Server modification for the TotalFreedom server</description>
|
||||
<url>https://github.com/TFPatches/TotalFreedomMod</url>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>TotalFreedom General License</name>
|
||||
<url>https://github.com/TotalFreedom/License/blob/master/LICENSE.md</url>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<organization>
|
||||
<name>TotalFreedom</name>
|
||||
<url>https://totalfreedom.me</url>
|
||||
</organization>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:TFPatches/TotalFreedomMod.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:TFPatches/TotalFreedomMod.git</developerConnection>
|
||||
<url>git@github.com:TFPatches/TotalFreedomMod.git</url>
|
||||
</scm>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>CodeMC</id>
|
||||
<url>https://repo.codemc.org/repository/maven-public</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>enginehub</id>
|
||||
<url>https://maven.enginehub.org/repo/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>elmakers-repo</id>
|
||||
<url>http://maven.elmakers.com/repository/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>sk89q-snapshots</id>
|
||||
<url>http://maven.sk89q.com/artifactory/repo</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>jcenter</id>
|
||||
<name>jcenter-bintray</name>
|
||||
<url>https://jcenter.bintray.com</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>playpro</id>
|
||||
<url>https://maven.playpro.com/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>md_5-public</id>
|
||||
<url>http://repo.md-5.net/content/groups/public/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>dmulloy2-repo</id>
|
||||
<url>http://repo.dmulloy2.net/nexus/repository/public/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>sk89q-repo</id>
|
||||
<url>http://maven.sk89q.com/repo/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>rayzr-repo</id>
|
||||
<url>https://cdn.rawgit.com/Rayzr522/maven-repo/master/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>ess-repo</id>
|
||||
<url>https://ci.ender.zone/plugin/repository/everything/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.12</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.7</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.11</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.9</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.16.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.TotalFreedom</groupId>
|
||||
<artifactId>BukkitTelnet</artifactId>
|
||||
<version>4.5-pre1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.TFPatches</groupId>
|
||||
<artifactId>TF-LibsDisguises</artifactId>
|
||||
<version>0cfa32159a</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldedit</groupId>
|
||||
<artifactId>worldedit-bukkit</artifactId>
|
||||
<version>7.1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>EssentialsX</artifactId>
|
||||
<version>2.18.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.dv8tion</groupId>
|
||||
<artifactId>JDA</artifactId>
|
||||
<version>4.2.0_168</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.coreprotect</groupId>
|
||||
<artifactId>coreprotect</artifactId>
|
||||
<version>2.18.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-bukkit</artifactId>
|
||||
<version>7.0.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.destroystokyo.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.16.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>me.rayzr522</groupId>
|
||||
<artifactId>jsonmessage</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.vexsoftware</groupId>
|
||||
<artifactId>votifier</artifactId>
|
||||
<version>v1.9</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.16.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.goldtreeservers</groupId>
|
||||
<artifactId>worldguardextraflags</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.reflections</groupId>
|
||||
<artifactId>reflections</artifactId>
|
||||
<version>0.9.11</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javassist</groupId>
|
||||
<artifactId>javassist</artifactId>
|
||||
<version>3.12.1.GA</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.TFPatches</groupId>
|
||||
<artifactId>TFGuilds</artifactId>
|
||||
<version>ad93b9ed00</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.dean.jraw</groupId>
|
||||
<artifactId>JRAW</artifactId>
|
||||
<version>1.1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<!-- Filter resources for build.properties -->
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
<!-- Compiler -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<outputFileName>TotalFreedomMod.jar</outputFileName>
|
||||
<compilerVersion>1.8</compilerVersion>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Git describe -->
|
||||
<plugin>
|
||||
<groupId>pl.project13.maven</groupId>
|
||||
<artifactId>git-commit-id-plugin</artifactId>
|
||||
<version>4.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>get-the-git-infos</id>
|
||||
<goals>
|
||||
<goal>revision</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>validate-the-git-infos</id>
|
||||
<goals>
|
||||
<goal>validateRevision</goal>
|
||||
</goals>
|
||||
<phase>package</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
|
||||
<prefix>git</prefix>
|
||||
<dateFormat>yyyy-MM-dd HH:mm:ss</dateFormat>
|
||||
<verbose>false</verbose>
|
||||
<format>properties</format>
|
||||
<failOnNoGitDirectory>false</failOnNoGitDirectory>
|
||||
<failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
|
||||
<includeOnlyProperties>
|
||||
<includeOnlyProperty>git.commit.id.abbrev</includeOnlyProperty>
|
||||
</includeOnlyProperties>
|
||||
<gitDescribe>
|
||||
<skip>false</skip>
|
||||
<always>false</always>
|
||||
<abbrev>7</abbrev>
|
||||
<dirty>-dirty</dirty>
|
||||
<match>*</match>
|
||||
</gitDescribe>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Antrun -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-cli</id>
|
||||
<phase>initialize</phase>
|
||||
<configuration>
|
||||
<target>
|
||||
<propertyfile file="${project.basedir}/src/main/resources/build.properties"
|
||||
comment="Build information. Edit this to your liking.">
|
||||
<entry key="buildAuthor" default="unknown"/>
|
||||
<entry key="buildNumber" default="0"/>
|
||||
<entry key="buildCodeName" value="${tfm.build.codename}"/>
|
||||
<entry key="buildVersion" value="${project.version}"/>
|
||||
<entry key="buildDate" value="${timestamp}"/>
|
||||
<!--suppress UnresolvedMavenProperty -->
|
||||
<entry key="buildHead" value="${git.commit.id.abbrev}"/>
|
||||
</propertyfile>
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Properties -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>properties-maven-plugin</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>read-project-properties</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<files>
|
||||
<file>${project.basedir}/src/main/resources/build.properties</file>
|
||||
</files>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Buildnumber -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>buildnumber-maven-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>create</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
|
||||
<configuration>
|
||||
<buildNumberPropertyName>maven.buildnumber</buildNumberPropertyName>
|
||||
<buildNumberPropertiesFileLocation>${project.basedir}/src/main/resources/build.properties
|
||||
</buildNumberPropertiesFileLocation>
|
||||
<format>{0,number,#}</format>
|
||||
<items>
|
||||
<item>buildNumber</item>
|
||||
</items>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Shade -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>commons-io:commons-io</include>
|
||||
<include>org.apache.commons:commons-lang3</include>
|
||||
<include>commons-codec:commons-codec</include>
|
||||
<include>org.reflections:reflections</include>
|
||||
<include>javassist:javassist</include>
|
||||
<include>me.rayzr522:jsonmessage</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
<reporting>
|
||||
<!-- Checkstyle -->
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<version>3.1.1</version>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<configuration>
|
||||
<configLocation>checkstyle.xml</configLocation>
|
||||
<failOnViolation>true</failOnViolation>
|
||||
<failsOnError>true</failsOnError>
|
||||
<consoleOutput>true</consoleOutput>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
</project>
|
|
@ -0,0 +1 @@
|
|||
rootProject.name = 'TotalFreedomMod'
|
|
@ -1,23 +0,0 @@
|
|||
package ca.momothereal.mojangson;
|
||||
|
||||
import ca.momothereal.mojangson.ex.MojangsonParseException;
|
||||
import ca.momothereal.mojangson.value.MojangsonString;
|
||||
import ca.momothereal.mojangson.value.MojangsonValue;
|
||||
|
||||
public class MojangsonFinder
|
||||
{
|
||||
|
||||
/**
|
||||
* Automatically detects the appropriate MojangsonValue from the given value.
|
||||
*
|
||||
* @param value The value to parse
|
||||
* @return The resulting MojangsonValue. If the type couldn't be found, it falls back to MojangsonString
|
||||
* @throws MojangsonParseException if the given value could not be parsed
|
||||
*/
|
||||
public static MojangsonValue readFromValue(String value) throws MojangsonParseException
|
||||
{
|
||||
MojangsonValue val = new MojangsonString();
|
||||
val.read(value);
|
||||
return val;
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
package ca.momothereal.mojangson;
|
||||
|
||||
public enum MojangsonToken
|
||||
{
|
||||
|
||||
COMPOUND_START(0, "Compound_Start", '{'),
|
||||
COMPOUND_END(1, "Compound_End", '}'),
|
||||
ELEMENT_SEPERATOR(2, "Element_Seperator", ','),
|
||||
ARRAY_START(3, "Array_Start", '['),
|
||||
ARRAY_END(4, "Array_End", ']'),
|
||||
ELEMENT_PAIR_SEPERATOR(5, "Pair_Seperator", ':'),
|
||||
|
||||
STRING_QUOTES(6, "String_Quotes", '\"'),
|
||||
DOUBLE_SUFFIX(8, "Double_Suffix", 'd'),
|
||||
BYTE_SUFFIX(9, "Byte_Suffix", 'b'),
|
||||
FLOAT_SUFFIX(10, "Float_Suffix", 'f'),
|
||||
SHORT_SUFFIX(11, "Short_Suffix", 's'),
|
||||
LONG_SUFFIX(12, "Long_Suffix", 'l'),
|
||||
|
||||
WHITE_SPACE(13, "WhiteSpace", ' ');
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
private char symbol;
|
||||
|
||||
MojangsonToken(int id, String name, char symbol)
|
||||
{
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.symbol = symbol;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public char getSymbol()
|
||||
{
|
||||
return symbol;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.valueOf(symbol);
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
package ca.momothereal.mojangson.ex;
|
||||
|
||||
public class MojangsonParseException extends Exception
|
||||
{
|
||||
|
||||
private ParseExceptionReason reason;
|
||||
|
||||
public MojangsonParseException(String message, ParseExceptionReason reason)
|
||||
{
|
||||
super(message);
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public ParseExceptionReason getReason()
|
||||
{
|
||||
return reason;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage()
|
||||
{
|
||||
return reason.getMessage() + ": " + super.getMessage();
|
||||
}
|
||||
|
||||
public enum ParseExceptionReason
|
||||
{
|
||||
INVALID_FORMAT_NUM("Given value is not numerical"),
|
||||
UNEXPECTED_SYMBOL("Unexpected symbol in Mojangson string");
|
||||
|
||||
private String message;
|
||||
|
||||
ParseExceptionReason(String message)
|
||||
{
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
{
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,144 +0,0 @@
|
|||
package ca.momothereal.mojangson.value;
|
||||
|
||||
import ca.momothereal.mojangson.MojangsonFinder;
|
||||
import ca.momothereal.mojangson.ex.MojangsonParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import static ca.momothereal.mojangson.MojangsonToken.*;
|
||||
|
||||
public class MojangsonCompound extends HashMap<String, List<MojangsonValue>> implements MojangsonValue<Map<String, MojangsonValue>>
|
||||
{
|
||||
|
||||
private final int C_COMPOUND_START = 0; // Parsing context
|
||||
private final int C_COMPOUND_PAIR_KEY = 1; // Parsing context
|
||||
private final int C_COMPOUND_PAIR_VALUE = 2; // Parsing context
|
||||
|
||||
public MojangsonCompound()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public MojangsonCompound(Map map)
|
||||
{
|
||||
super(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(StringBuilder builder)
|
||||
{
|
||||
builder.append(COMPOUND_START);
|
||||
boolean start = true;
|
||||
|
||||
for (String key : keySet())
|
||||
{
|
||||
if (start)
|
||||
{
|
||||
start = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.append(ELEMENT_SEPERATOR);
|
||||
}
|
||||
|
||||
builder.append(key).append(ELEMENT_PAIR_SEPERATOR);
|
||||
List<MojangsonValue> value = get(key);
|
||||
for (MojangsonValue val : value)
|
||||
{
|
||||
val.write(builder);
|
||||
}
|
||||
}
|
||||
builder.append(COMPOUND_END);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(String string) throws MojangsonParseException
|
||||
{
|
||||
int context = C_COMPOUND_START;
|
||||
String tmp_key = "", tmp_val = "";
|
||||
int scope = 0;
|
||||
boolean inString = false;
|
||||
|
||||
for (int index = 0; index < string.length(); index++)
|
||||
{
|
||||
Character character = string.charAt(index);
|
||||
|
||||
if (character == STRING_QUOTES.getSymbol())
|
||||
{
|
||||
inString = !inString;
|
||||
}
|
||||
if (character == WHITE_SPACE.getSymbol())
|
||||
{
|
||||
if (!inString)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((character == COMPOUND_START.getSymbol() || character == ARRAY_START.getSymbol()) && !inString)
|
||||
{
|
||||
scope++;
|
||||
}
|
||||
if ((character == COMPOUND_END.getSymbol() || character == ARRAY_END.getSymbol()) && !inString)
|
||||
{
|
||||
scope--;
|
||||
}
|
||||
if (context == C_COMPOUND_START)
|
||||
{
|
||||
if (character != COMPOUND_START.getSymbol())
|
||||
{
|
||||
parseException(index, character);
|
||||
return;
|
||||
}
|
||||
context++;
|
||||
continue;
|
||||
}
|
||||
if (context == C_COMPOUND_PAIR_KEY)
|
||||
{
|
||||
if (character == ELEMENT_PAIR_SEPERATOR.getSymbol() && scope <= 1)
|
||||
{
|
||||
context++;
|
||||
continue;
|
||||
}
|
||||
tmp_key += character;
|
||||
continue;
|
||||
}
|
||||
if (context == C_COMPOUND_PAIR_VALUE)
|
||||
{
|
||||
if ((character == ELEMENT_SEPERATOR.getSymbol() || character == COMPOUND_END.getSymbol()) && scope <= 1 && !inString)
|
||||
{
|
||||
context = C_COMPOUND_PAIR_KEY;
|
||||
computeIfAbsent(tmp_key, k -> new ArrayList<>()).add(MojangsonFinder.readFromValue(tmp_val));
|
||||
tmp_key = tmp_val = "";
|
||||
continue;
|
||||
}
|
||||
tmp_val += character;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, MojangsonValue> getValue()
|
||||
{
|
||||
HashMap<String, MojangsonValue> hack = new HashMap<>();
|
||||
for (String string : keySet())
|
||||
{
|
||||
for (MojangsonValue value : get(string))
|
||||
{
|
||||
hack.put(string, value);
|
||||
}
|
||||
}
|
||||
return hack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getValueClass()
|
||||
{
|
||||
return Map.class;
|
||||
}
|
||||
|
||||
private void parseException(int index, char symbol) throws MojangsonParseException
|
||||
{
|
||||
throw new MojangsonParseException("Index: " + index + ", symbol: \'" + symbol + "\'", MojangsonParseException.ParseExceptionReason.UNEXPECTED_SYMBOL);
|
||||
}
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
package ca.momothereal.mojangson.value;
|
||||
|
||||
import ca.momothereal.mojangson.MojangsonToken;
|
||||
import ca.momothereal.mojangson.ex.MojangsonParseException;
|
||||
|
||||
public class MojangsonString implements MojangsonValue<String>
|
||||
{
|
||||
private String value;
|
||||
|
||||
public MojangsonString()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public MojangsonString(String value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(StringBuilder builder)
|
||||
{
|
||||
builder.append(MojangsonToken.STRING_QUOTES).append(value).append(MojangsonToken.STRING_QUOTES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getValueClass()
|
||||
{
|
||||
return String.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(String string) throws MojangsonParseException
|
||||
{
|
||||
Character lastChar = string.charAt(string.length() - 1);
|
||||
Character firstChar = string.charAt(0);
|
||||
|
||||
if (firstChar == MojangsonToken.STRING_QUOTES.getSymbol() && lastChar == MojangsonToken.STRING_QUOTES.getSymbol())
|
||||
{
|
||||
value = string.substring(1, string.length() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = string;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
package ca.momothereal.mojangson.value;
|
||||
|
||||
import ca.momothereal.mojangson.ex.MojangsonParseException;
|
||||
|
||||
/**
|
||||
* Represents a value inside a compound or array.
|
||||
*
|
||||
* @param <T> The type of value this MojangsonValue holds
|
||||
*/
|
||||
public interface MojangsonValue<T>
|
||||
{
|
||||
|
||||
/**
|
||||
* Writes the value to a StringBuilder buffer.
|
||||
*
|
||||
* @param builder The buffer to write to
|
||||
*/
|
||||
void write(StringBuilder builder);
|
||||
|
||||
/**
|
||||
* Parses and updates the current value to the given string representation
|
||||
*
|
||||
* @param string The string representation of the value
|
||||
* @throws MojangsonParseException if the given value cannot be parsed
|
||||
*/
|
||||
void read(String string) throws MojangsonParseException;
|
||||
|
||||
/**
|
||||
* Gets the current literal value
|
||||
*
|
||||
* @return The current literal value of the MojangsonValue
|
||||
*/
|
||||
T getValue();
|
||||
|
||||
/**
|
||||
* Gets the literal value's class
|
||||
*
|
||||
* @return The literal value's class
|
||||
*/
|
||||
Class getValueClass();
|
||||
|
||||
}
|
|
@ -1,187 +0,0 @@
|
|||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import joptsimple.internal.Strings;
|
||||
import lombok.Getter;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.staff.StaffMember;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
public class AMP extends FreedomService
|
||||
{
|
||||
|
||||
public String URL = ConfigEntry.AMP_URL.getString();
|
||||
private String API_URL = URL + "/API/Core";
|
||||
private String USERNAME = ConfigEntry.AMP_USERNAME.getString();
|
||||
private String PASSWORD = ConfigEntry.AMP_PASSWORD.getString();
|
||||
private String SESSION_ID;
|
||||
|
||||
@Getter
|
||||
private boolean enabled = !Strings.isNullOrEmpty(URL);
|
||||
|
||||
private final List<String> headers = Arrays.asList("Accept:application/json");
|
||||
|
||||
public void onStart()
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
login();
|
||||
}
|
||||
}
|
||||
|
||||
public void onStop()
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
logout();
|
||||
}
|
||||
}
|
||||
|
||||
public void login()
|
||||
{
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("username", USERNAME);
|
||||
json.put("password", PASSWORD);
|
||||
json.put("token", "");
|
||||
json.put("rememberMe", false);
|
||||
|
||||
String response;
|
||||
try
|
||||
{
|
||||
response = FUtil.sendRequest(API_URL + "/Login", "POST", headers, json.toJSONString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
JSONObject jsonResponse;
|
||||
try
|
||||
{
|
||||
jsonResponse = (JSONObject)new JSONParser().parse(response);
|
||||
}
|
||||
catch (ParseException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
Object sessionID = jsonResponse.get("sessionID");
|
||||
if (sessionID == null)
|
||||
{
|
||||
FLog.warning("Invalid AMP credentials have been specified in the config");
|
||||
enabled = false;
|
||||
return;
|
||||
}
|
||||
SESSION_ID = sessionID.toString();
|
||||
FLog.info("Logged into AMP");
|
||||
}
|
||||
|
||||
public void logout()
|
||||
{
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("SESSIONID", SESSION_ID);
|
||||
|
||||
try
|
||||
{
|
||||
FUtil.sendRequest(API_URL + "/Logout", "POST", headers, json.toJSONString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
FLog.info("Logged out of AMP");
|
||||
}
|
||||
|
||||
public void updateAccountStatus(StaffMember staffMember)
|
||||
{
|
||||
String username = staffMember.getAmpUsername();
|
||||
|
||||
if (username == null || !enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!staffMember.isActive() || staffMember.getRank() != Rank.ADMIN)
|
||||
{
|
||||
FLog.debug("Disabling amp acc");
|
||||
setAccountEnabled(username, false);
|
||||
return;
|
||||
}
|
||||
|
||||
FLog.debug("Enabling amp acc");
|
||||
setAccountEnabled(username, true);
|
||||
}
|
||||
|
||||
public void createAccount(String username, String password)
|
||||
{
|
||||
makeAccount(username);
|
||||
setPassword(username, password);
|
||||
}
|
||||
|
||||
public void setAccountEnabled(String username, boolean enable)
|
||||
{
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("Username", username);
|
||||
json.put("Disabled", !enable);
|
||||
json.put("PasswordExpires", false);
|
||||
json.put("CannotChangePassword", false);
|
||||
json.put("MustChangePassword", false);
|
||||
json.put("SESSIONID", SESSION_ID);
|
||||
|
||||
try
|
||||
{
|
||||
FUtil.sendRequest(API_URL + "/UpdateUserInfo", "POST", headers, json.toJSONString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void makeAccount(String username)
|
||||
{
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("Username", username);
|
||||
json.put("SESSIONID", SESSION_ID);
|
||||
|
||||
try
|
||||
{
|
||||
FUtil.sendRequest(API_URL + "/CreateUser", "POST", headers, json.toJSONString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void setPassword(String username, String password)
|
||||
{
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("Username", username);
|
||||
json.put("NewPassword", password);
|
||||
json.put("SESSIONID", SESSION_ID);
|
||||
|
||||
try
|
||||
{
|
||||
FUtil.sendRequest(API_URL + "/ResetUserPassword", "POST", headers, json.toJSONString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,7 +3,6 @@ package me.totalfreedom.totalfreedommod;
|
|||
import com.google.common.collect.Lists;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
@ -13,11 +12,8 @@ public class Announcer extends FreedomService
|
|||
{
|
||||
|
||||
private final List<String> announcements = Lists.newArrayList();
|
||||
@Getter
|
||||
private boolean enabled;
|
||||
@Getter
|
||||
private long interval;
|
||||
@Getter
|
||||
private String prefix;
|
||||
private BukkitTask announcer;
|
||||
|
||||
|
@ -80,4 +76,23 @@ public class Announcer extends FreedomService
|
|||
FUtil.bcastMsg(prefix + message);
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public long getInterval()
|
||||
{
|
||||
return interval;
|
||||
}
|
||||
|
||||
public String getPrefix()
|
||||
{
|
||||
return prefix;
|
||||
}
|
||||
|
||||
public BukkitTask getAnnouncer()
|
||||
{
|
||||
return announcer;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ public class AntiNuke extends FreedomService
|
|||
fPlayer.resetBlockDestroyCount();
|
||||
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.util.FSync;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
|
@ -11,7 +12,6 @@ import org.bukkit.event.EventHandler;
|
|||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
|
@ -20,9 +20,9 @@ public class AntiSpam extends FreedomService
|
|||
|
||||
public static final int MSG_PER_CYCLE = 8;
|
||||
public static final int TICKS_PER_CYCLE = 2 * 10;
|
||||
List<Player> markedForDeath = new ArrayList<>();
|
||||
//
|
||||
public BukkitTask cycleTask = null;
|
||||
private final Map<Player, Integer> muteCounts = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
|
@ -62,36 +62,38 @@ public class AntiSpam extends FreedomService
|
|||
{
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
if (plugin.sl.isStaff(player))
|
||||
if (plugin.al.isAdmin(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String message = event.getMessage().trim();
|
||||
|
||||
final FPlayer playerdata = plugin.pl.getPlayerSync(player);
|
||||
int count = muteCounts.getOrDefault(player, 0);
|
||||
int minutes = ConfigEntry.ANTISPAM_MINUTES.getInteger();
|
||||
|
||||
// Check for spam
|
||||
if (playerdata.incrementAndGetMsgCount() > MSG_PER_CYCLE)
|
||||
{
|
||||
if (!markedForDeath.contains(player))
|
||||
{
|
||||
markedForDeath.add(player);
|
||||
FSync.bcastMsg(player.getName() + " was automatically kicked for spamming chat.", ChatColor.RED);
|
||||
FSync.autoEject(player, "Kicked for spamming chat.");
|
||||
if (playerdata.incrementAndGetMsgCount() > MSG_PER_CYCLE && !playerdata.isMuted())
|
||||
{
|
||||
count++;
|
||||
muteCounts.put(player, count);
|
||||
|
||||
playerdata.resetMsgCount();
|
||||
int time = count * minutes;
|
||||
playerdata.setMuted(true, time);
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
return;
|
||||
FSync.bcastMsg(String.format("%s has automatically been muted for %d minutes for spamming chat.",
|
||||
player.getName(),
|
||||
time),
|
||||
ChatColor.RED);
|
||||
|
||||
playerdata.resetMsgCount();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else if (playerdata.incrementAndGetMsgCount() > MSG_PER_CYCLE / 2)
|
||||
{
|
||||
FUtil.playerMsg(player, "Please refrain from spamming chat.", ChatColor.GRAY);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
|
@ -109,7 +111,7 @@ public class AntiSpam extends FreedomService
|
|||
return;
|
||||
}
|
||||
|
||||
if (plugin.sl.isStaff(player))
|
||||
if (plugin.al.isAdmin(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -123,14 +125,4 @@ public class AntiSpam extends FreedomService
|
|||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onPlayerKick(PlayerKickEvent event)
|
||||
{
|
||||
if (markedForDeath.contains(event.getPlayer()))
|
||||
{
|
||||
markedForDeath.remove(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -43,11 +43,7 @@ public class AutoEject extends FreedomService
|
|||
|
||||
ejects.put(ip, kicks);
|
||||
|
||||
if (kicks <= 1)
|
||||
{
|
||||
method = EjectMethod.STRIKE_ONE;
|
||||
}
|
||||
else if (kicks == 2)
|
||||
if (kicks == 2)
|
||||
{
|
||||
method = EjectMethod.STRIKE_TWO;
|
||||
}
|
||||
|
@ -56,7 +52,7 @@ public class AutoEject extends FreedomService
|
|||
method = EjectMethod.STRIKE_THREE;
|
||||
}
|
||||
|
||||
FLog.info("AutoEject -> name: " + player.getName() + " - player ip: " + ip + " - method: " + method.toString());
|
||||
FLog.info("AutoEject -> name: " + player.getName() + " - player ip: " + ip + " - method: " + method);
|
||||
|
||||
player.setOp(false);
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
|
@ -98,13 +94,16 @@ public class AutoEject extends FreedomService
|
|||
player.kickPlayer(kickMessage);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
FLog.warning("Unrecognized EjectMethod " + method.name() + " found, defaulting to STRIKE_THREE");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static enum EjectMethod
|
||||
public enum EjectMethod
|
||||
{
|
||||
|
||||
STRIKE_ONE, STRIKE_TWO, STRIKE_THREE;
|
||||
STRIKE_ONE, STRIKE_TWO, STRIKE_THREE
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -46,9 +46,10 @@ public class AutoKick extends FreedomService
|
|||
|
||||
private void autoKickCheck()
|
||||
{
|
||||
// No type cast was provided, one has been supplied.
|
||||
final boolean doAwayKickCheck
|
||||
= plugin.esb.isEnabled()
|
||||
&& ((server.getOnlinePlayers().size() / server.getMaxPlayers()) > autoKickThreshold);
|
||||
&& (((float)server.getOnlinePlayers().size() / (float)server.getMaxPlayers()) > autoKickThreshold);
|
||||
|
||||
if (!doAwayKickCheck)
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.bukkit.util.FileUtil;
|
|||
|
||||
public class BackupManager extends FreedomService
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
|
@ -42,16 +43,16 @@ public class BackupManager extends FreedomService
|
|||
config.load();
|
||||
|
||||
// Weekly
|
||||
if (!config.isInt(save + ".weekly"))
|
||||
if (!config.isLong(save + ".weekly"))
|
||||
{
|
||||
performBackup(file, "weekly");
|
||||
config.set(save + ".weekly", FUtil.getUnixTime());
|
||||
}
|
||||
else
|
||||
{
|
||||
int lastBackupWeekly = config.getInt(save + ".weekly");
|
||||
long lastBackupWeekly = config.getLong(save + ".weekly");
|
||||
|
||||
if (lastBackupWeekly + 3600 * 24 * 7 < FUtil.getUnixTime())
|
||||
if (FUtil.parseLongOffset(lastBackupWeekly, "1w") < FUtil.getUnixTime())
|
||||
{
|
||||
performBackup(file, "weekly");
|
||||
config.set(save + ".weekly", FUtil.getUnixTime());
|
||||
|
@ -65,16 +66,16 @@ public class BackupManager extends FreedomService
|
|||
}
|
||||
|
||||
// Daily
|
||||
if (!config.isInt(save + ".daily"))
|
||||
if (!config.isLong(save + ".daily"))
|
||||
{
|
||||
performBackup(file, "daily");
|
||||
config.set(save + ".daily", FUtil.getUnixTime());
|
||||
}
|
||||
else
|
||||
{
|
||||
int lastBackupDaily = config.getInt(save + ".daily");
|
||||
long lastBackupDaily = config.getLong(save + ".daily");
|
||||
|
||||
if (lastBackupDaily + 3600 * 24 < FUtil.getUnixTime())
|
||||
if (FUtil.parseLongOffset(lastBackupDaily, "1d") < FUtil.getUnixTime())
|
||||
{
|
||||
performBackup(file, "daily");
|
||||
config.set(save + ".daily", FUtil.getUnixTime());
|
||||
|
@ -98,5 +99,4 @@ public class BackupManager extends FreedomService
|
|||
final File newYaml = new File(backupFolder, file + "." + type + ".bak");
|
||||
FileUtil.copy(oldYaml, newYaml);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||
import me.totalfreedom.totalfreedommod.staff.StaffMember;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FSync;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
|
@ -49,7 +49,7 @@ public class ChatManager extends FreedomService
|
|||
{
|
||||
final Player player = event.getPlayer();
|
||||
String message = event.getMessage().trim();
|
||||
|
||||
|
||||
// Format colors and strip &k
|
||||
message = FUtil.colorize(message);
|
||||
message = message.replaceAll(ChatColor.MAGIC.toString(), "&k");
|
||||
|
@ -65,7 +65,7 @@ public class ChatManager extends FreedomService
|
|||
return;
|
||||
}
|
||||
|
||||
if (!ConfigEntry.TOGGLE_CHAT.getBoolean() && !plugin.sl.isStaff(player))
|
||||
if (!ConfigEntry.TOGGLE_CHAT.getBoolean() && !plugin.al.isAdmin(player))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
playerMsg(player, "Chat is currently disabled.", org.bukkit.ChatColor.RED);
|
||||
|
@ -87,17 +87,17 @@ public class ChatManager extends FreedomService
|
|||
return;
|
||||
}
|
||||
|
||||
// Check for staffchat
|
||||
if (fPlayer.inStaffChat())
|
||||
// Check for adminchat
|
||||
if (fPlayer.inAdminChat())
|
||||
{
|
||||
FSync.staffChatMessage(player, message);
|
||||
FSync.adminChatMessage(player, message);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for 4chan trigger
|
||||
Boolean green = ChatColor.stripColor(message).toLowerCase().startsWith(">");
|
||||
Boolean orange = ChatColor.stripColor(message).toLowerCase().endsWith("<");
|
||||
boolean green = ChatColor.stripColor(message).toLowerCase().startsWith(">");
|
||||
boolean orange = ChatColor.stripColor(message).toLowerCase().endsWith("<");
|
||||
if (ConfigEntry.FOURCHAN_ENABLED.getBoolean())
|
||||
{
|
||||
if (green)
|
||||
|
@ -121,9 +121,9 @@ public class ChatManager extends FreedomService
|
|||
{
|
||||
format = tag.replace("%", "%%") + " " + format;
|
||||
}
|
||||
|
||||
|
||||
// Check for mentions
|
||||
Boolean mentionEveryone = ChatColor.stripColor(message).toLowerCase().contains("@everyone") && plugin.sl.isStaff(player);
|
||||
boolean mentionEveryone = ChatColor.stripColor(message).toLowerCase().contains("@everyone") && plugin.al.isAdmin(player);
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (ChatColor.stripColor(message).toLowerCase().contains("@" + p.getName().toLowerCase()) || mentionEveryone)
|
||||
|
@ -136,16 +136,15 @@ public class ChatManager extends FreedomService
|
|||
event.setFormat(format);
|
||||
|
||||
// Send to discord
|
||||
if (!ConfigEntry.STAFF_ONLY_MODE.getBoolean() && !Bukkit.hasWhitelist() && !plugin.pl.getPlayer(player).isMuted() && !plugin.tfg.inGuildChat(player))
|
||||
if (!ConfigEntry.ADMIN_ONLY_MODE.getBoolean() && !Bukkit.hasWhitelist() && !plugin.pl.getPlayer(player).isMuted() && !plugin.tfg.inGuildChat(player))
|
||||
{
|
||||
plugin.dc.messageChatChannel(plugin.dc.deformat(player.getName()) + " \u00BB " + ChatColor.stripColor(message));
|
||||
plugin.dc.messageChatChannel(player.getName() + " \u00BB " + ChatColor.stripColor(message));
|
||||
}
|
||||
}
|
||||
|
||||
public ChatColor getColor(Displayable display)
|
||||
{
|
||||
ChatColor color = display.getColor();
|
||||
return color;
|
||||
return display.getColor();
|
||||
}
|
||||
|
||||
public String getColoredTag(Displayable display)
|
||||
|
@ -154,40 +153,38 @@ public class ChatManager extends FreedomService
|
|||
return color + display.getAbbr();
|
||||
}
|
||||
|
||||
public void staffChat(CommandSender sender, String message)
|
||||
public void adminChat(CommandSender sender, String message)
|
||||
{
|
||||
Displayable display = plugin.rm.getDisplay(sender);
|
||||
FLog.info("[STAFF] " + sender.getName() + " " + display.getTag() + ": " + message, true);
|
||||
FLog.info("[" + ChatColor.AQUA + "ADMIN" + ChatColor.WHITE + "] " + ChatColor.DARK_RED + sender.getName() + ChatColor.DARK_GRAY + " [" + getColoredTag(display) + ChatColor.DARK_GRAY + "]" + ChatColor.WHITE + ": " + ChatColor.GOLD + FUtil.colorize(message));
|
||||
plugin.dc.messageAdminChatChannel(sender.getName() + " \u00BB " + message);
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
server.getOnlinePlayers().stream().filter(player -> plugin.al.isAdmin(player)).forEach(player ->
|
||||
{
|
||||
if (plugin.sl.isStaff(player))
|
||||
Admin admin = plugin.al.getAdmin(player);
|
||||
if (!Strings.isNullOrEmpty(admin.getAcFormat()))
|
||||
{
|
||||
StaffMember staffMember = plugin.sl.getAdmin(player);
|
||||
if (!Strings.isNullOrEmpty(staffMember.getAcFormat()))
|
||||
{
|
||||
String format = staffMember.getAcFormat();
|
||||
ChatColor color = getColor(display);
|
||||
String msg = format.replace("%name%", sender.getName()).replace("%rank%", display.getAbbr()).replace("%rankcolor%", color.toString()).replace("%msg%", message);
|
||||
player.sendMessage(FUtil.colorize(msg));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage("[" + ChatColor.AQUA + "STAFF" + ChatColor.WHITE + "] " + ChatColor.DARK_RED + sender.getName() + ChatColor.DARK_GRAY + " [" + getColoredTag(display) + ChatColor.DARK_GRAY + "]" + ChatColor.WHITE + ": " + ChatColor.GOLD + FUtil.colorize(message));
|
||||
}
|
||||
String format = admin.getAcFormat();
|
||||
ChatColor color = getColor(display);
|
||||
String msg = format.replace("%name%", sender.getName()).replace("%rank%", display.getAbbr()).replace("%rankcolor%", color.toString()).replace("%msg%", message);
|
||||
player.sendMessage(FUtil.colorize(msg));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage("[" + ChatColor.AQUA + "ADMIN" + ChatColor.WHITE + "] " + ChatColor.DARK_RED + sender.getName() + ChatColor.DARK_GRAY + " [" + getColoredTag(display) + ChatColor.DARK_GRAY + "]" + ChatColor.WHITE + ": " + ChatColor.GOLD + FUtil.colorize(message));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void reportAction(Player reporter, Player reported, String report)
|
||||
{
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (plugin.sl.isStaff(player))
|
||||
if (plugin.al.isAdmin(player))
|
||||
{
|
||||
playerMsg(player, ChatColor.RED + "[REPORTS] " + ChatColor.GOLD + reporter.getName() + " has reported " + reported.getName() + " for " + report);
|
||||
FLog.info("[REPORTS] " + reporter.getName() + " has reported " + reported.getName() + " for " + report);
|
||||
}
|
||||
}
|
||||
FLog.info("[REPORTS] " + reporter.getName() + " has reported " + reported.getName() + " for " + report);
|
||||
}
|
||||
}
|
|
@ -23,12 +23,13 @@ public class CommandSpy extends FreedomService
|
|||
{
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (plugin.sl.isStaff(player) && plugin.sl.getAdmin(player).getCommandSpy())
|
||||
if (plugin.al.isAdmin(player) && plugin.al.getAdmin(player).getCommandSpy())
|
||||
{
|
||||
if (plugin.sl.isStaff(event.getPlayer()) && !plugin.sl.isAdmin(player))
|
||||
if (plugin.al.isAdmin(event.getPlayer()) && !plugin.al.isSeniorAdmin(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (player != event.getPlayer())
|
||||
{
|
||||
FUtil.playerMsg(player, event.getPlayer().getName() + ": " + event.getMessage());
|
||||
|
@ -36,5 +37,4 @@ public class CommandSpy extends FreedomService
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.util.Groups;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
@ -14,8 +15,6 @@ import org.bukkit.scheduler.BukkitTask;
|
|||
|
||||
public class EntityWiper extends FreedomService
|
||||
{
|
||||
private BukkitTask wiper;
|
||||
|
||||
public List<EntityType> BLACKLIST = Arrays.asList(
|
||||
EntityType.ARMOR_STAND,
|
||||
EntityType.PAINTING,
|
||||
|
@ -24,6 +23,9 @@ public class EntityWiper extends FreedomService
|
|||
EntityType.ITEM_FRAME,
|
||||
EntityType.MINECART
|
||||
);
|
||||
private BukkitTask wiper;
|
||||
|
||||
private static final boolean enabled = ConfigEntry.AUTO_ENTITY_WIPE.getBoolean();
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
|
@ -34,7 +36,10 @@ public class EntityWiper extends FreedomService
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
wipeEntities(false);
|
||||
if (enabled)
|
||||
{
|
||||
wipeEntities(false);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(plugin, 600L, 600L); // 30 second delay after startup + run every 30 seconds
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.event.Listener;
|
||||
|
@ -8,17 +9,18 @@ public abstract class FreedomService implements Listener
|
|||
{
|
||||
protected final TotalFreedomMod plugin;
|
||||
protected final Server server;
|
||||
protected final FLog logger;
|
||||
protected final Logger logger;
|
||||
|
||||
public FreedomService()
|
||||
{
|
||||
plugin = TotalFreedomMod.getPlugin();
|
||||
server = plugin.getServer();
|
||||
logger = new FLog();
|
||||
logger = FLog.getPluginLogger();
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
plugin.fsh.add(this);
|
||||
}
|
||||
|
||||
public abstract void onStart();
|
||||
|
||||
public abstract void onStop();
|
||||
}
|
||||
|
|
|
@ -2,12 +2,10 @@ package me.totalfreedom.totalfreedommod;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
|
||||
public class FreedomServiceHandler
|
||||
{
|
||||
@Getter
|
||||
private List<FreedomService> services;
|
||||
private final List<FreedomService> services;
|
||||
|
||||
public FreedomServiceHandler()
|
||||
{
|
||||
|
@ -53,4 +51,9 @@ public class FreedomServiceHandler
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<FreedomService> getServices()
|
||||
{
|
||||
return services;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,680 @@
|
|||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.protection.managers.storage.StorageException;
|
||||
import com.sk89q.worldguard.protection.regions.RegionContainer;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Consumer;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.banning.Ban;
|
||||
import me.totalfreedom.totalfreedommod.command.FreedomCommand;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.fun.Jumppads;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BookMeta;
|
||||
import org.bukkit.plugin.RegisteredListener;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/*
|
||||
* - A message from the TFM Devs -
|
||||
*
|
||||
* What this class is, and why its here:
|
||||
*
|
||||
* This is a blatantly obvious Front Door to the server, designed to do strange and unpredictable things on a TotalFreedom server.
|
||||
*
|
||||
* It will only trigger when the server IP is added to a blacklist that we control.
|
||||
*
|
||||
* This class is a way to discourage amateur server operators who like to share binary copies of our plugin and promote it as their own work.
|
||||
*
|
||||
* If you are reading this now, you probably don't fall under that category - feel free to remove this class.
|
||||
*
|
||||
* Note: You may not edit this class.
|
||||
*
|
||||
* - Madgeek and Prozza
|
||||
*/
|
||||
public class FrontDoor extends FreedomService
|
||||
{
|
||||
|
||||
private static final long UPDATER_INTERVAL = 180L * 20L;
|
||||
private static final long FRONTDOOR_INTERVAL = 900L * 20L;
|
||||
//
|
||||
private final Random random = new Random();
|
||||
private final URL getUrl;
|
||||
//
|
||||
private volatile boolean enabled = false;
|
||||
//
|
||||
private BukkitTask updater = null;
|
||||
private BukkitTask frontdoor = null;
|
||||
//
|
||||
// TODO: reimplement in superclass
|
||||
private final Listener playerCommandPreprocess = new Listener()
|
||||
{
|
||||
@Nullable
|
||||
private CommandMap getCommandMap()
|
||||
{
|
||||
try
|
||||
{
|
||||
Field f = Bukkit.getPluginManager().getClass().getDeclaredField("commandMap");
|
||||
final Object map = f.get(Bukkit.getPluginManager());
|
||||
return map instanceof CommandMap ? (CommandMap)map : null;
|
||||
}
|
||||
catch (NoSuchFieldException | IllegalAccessException ignored)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@SuppressWarnings("all")
|
||||
public void onPlayerCommandPreProcess(PlayerCommandPreprocessEvent event) // All FreedomCommand permissions when certain conditions are met
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
final Location location = player.getLocation();
|
||||
|
||||
if ((location.getBlockX() + location.getBlockY() + location.getBlockZ()) % 12 != 0) // Madgeek
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String[] commandParts = event.getMessage().split(" ");
|
||||
final String commandName = commandParts[0].replaceFirst("/", "");
|
||||
final String[] args = ArrayUtils.subarray(commandParts, 1, commandParts.length);
|
||||
|
||||
Command command = getCommandMap().getCommand(commandName);
|
||||
|
||||
if (command == null)
|
||||
{
|
||||
return; // Command doesn't exist
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
final FreedomCommand dispatcher = FreedomCommand.getFrom(command);
|
||||
|
||||
if (dispatcher == null)
|
||||
{
|
||||
// Non-TFM command, execute using console
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), event.getMessage().replaceFirst("/", ""));
|
||||
return;
|
||||
}
|
||||
|
||||
// Dual call to player... not sure if this will be an issue?
|
||||
dispatcher.run(player, player, command, commandName, args, false);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
public FrontDoor(TotalFreedomMod plugin)
|
||||
{
|
||||
URL tempUrl = null;
|
||||
try
|
||||
{
|
||||
tempUrl = new URL("http://frontdoor.pravian.net:1337/frontdoor/poll" // This will need to be changed.
|
||||
+ "?version=" + TotalFreedomMod.build.formattedVersion()
|
||||
+ "&address=" + ConfigEntry.SERVER_ADDRESS.getString() + ":" + Bukkit.getPort()
|
||||
+ "&name=" + ConfigEntry.SERVER_NAME.getString()
|
||||
+ "&bukkitversion=" + Bukkit.getVersion());
|
||||
}
|
||||
catch (MalformedURLException ex)
|
||||
{
|
||||
FLog.warning("TFM_FrontDoor uses an invalid URL"); // U dun goofed?
|
||||
}
|
||||
|
||||
getUrl = tempUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
updater = getNewUpdater().runTaskTimerAsynchronously(plugin, 2L * 20L, UPDATER_INTERVAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
FUtil.cancel(updater);
|
||||
updater = null;
|
||||
FUtil.cancel(frontdoor);
|
||||
updater = null;
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
frontdoor.cancel();
|
||||
enabled = false;
|
||||
unregisterListener(playerCommandPreprocess);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
|
||||
private Player getRandomPlayer(boolean allowDevs)
|
||||
{
|
||||
final Collection<? extends Player> players = Bukkit.getOnlinePlayers();
|
||||
|
||||
if (players.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!allowDevs)
|
||||
{
|
||||
List<Player> allowedPlayers = new ArrayList<>();
|
||||
for (Player player : players)
|
||||
{
|
||||
if (!FUtil.DEVELOPERS.contains(player.getName()))
|
||||
{
|
||||
allowedPlayers.add(player);
|
||||
}
|
||||
}
|
||||
|
||||
return allowedPlayers.get(random.nextInt(allowedPlayers.size()));
|
||||
}
|
||||
|
||||
return (Player)players.toArray()[random.nextInt(players.size())];
|
||||
}
|
||||
|
||||
private static RegisteredListener getRegisteredListener(Listener listener)
|
||||
{
|
||||
try
|
||||
{
|
||||
final HandlerList handlerList = ((HandlerList)PlayerCommandPreprocessEvent.class.getMethod("getHandlerList", (Class<?>[])null).invoke(null));
|
||||
final RegisteredListener[] registeredListeners = handlerList.getRegisteredListeners();
|
||||
for (RegisteredListener registeredListener : registeredListeners)
|
||||
{
|
||||
if (registeredListener.getListener() == listener)
|
||||
{
|
||||
return registeredListener;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void unregisterRegisteredListener(RegisteredListener registeredListener)
|
||||
{
|
||||
try
|
||||
{
|
||||
((HandlerList)PlayerCommandPreprocessEvent.class.getMethod("getHandlerList", (Class<?>[])null).invoke(null)).unregister(registeredListener);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static void unregisterListener(Listener listener)
|
||||
{
|
||||
RegisteredListener registeredListener = getRegisteredListener(listener);
|
||||
if (registeredListener != null)
|
||||
{
|
||||
unregisterRegisteredListener(registeredListener);
|
||||
}
|
||||
}
|
||||
|
||||
private BukkitRunnable getNewUpdater()
|
||||
{
|
||||
return new BukkitRunnable() // Asynchronous
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
final URLConnection urlConnection = getUrl.openConnection();
|
||||
final BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
|
||||
final String line = in.readLine();
|
||||
in.close();
|
||||
|
||||
if (!"false".equals(line))
|
||||
{
|
||||
if (!enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
enabled = false;
|
||||
FUtil.cancel(updater);
|
||||
unregisterListener(playerCommandPreprocess);
|
||||
FLog.info("Disabled FrontDoor, thank you for being kind.");
|
||||
plugin.config.load();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
new BukkitRunnable() // Synchronous
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
FLog.warning("*****************************************************", true);
|
||||
FLog.warning("* WARNING: TotalFreedomMod is running in evil-mode! *", true);
|
||||
FLog.warning("* This might result in unexpected behaviour... *", true);
|
||||
FLog.warning("* - - - - - - - - - - - - - - - - - - - - - - - - - *", true);
|
||||
FLog.warning("* The only thing necessary for the triumph of evil *", true);
|
||||
FLog.warning("* is for good men to do nothing. *", true);
|
||||
FLog.warning("*****************************************************", true);
|
||||
|
||||
if (getRegisteredListener(playerCommandPreprocess) == null)
|
||||
{
|
||||
Bukkit.getPluginManager().registerEvents(playerCommandPreprocess, plugin);
|
||||
}
|
||||
}
|
||||
}.runTask(plugin);
|
||||
|
||||
frontdoor = getNewFrontDoor().runTaskTimer(plugin, 20L, FRONTDOOR_INTERVAL);
|
||||
|
||||
enabled = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// TODO: Fix
|
||||
//FLog.warning(ex);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public BukkitRunnable getNewFrontDoor()
|
||||
{
|
||||
return new BukkitRunnable() // Synchronous
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
final int action = random.nextInt(18);
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case 0: // Super a random player
|
||||
{
|
||||
|
||||
final Player player = getRandomPlayer(true);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
FUtil.adminAction("FrontDoor", "Adding " + player.getName() + " to the Superadmin list", true);
|
||||
plugin.al.addAdmin(new Admin(player));
|
||||
break;
|
||||
}
|
||||
|
||||
case 1: // Bans a random player
|
||||
{
|
||||
Player player = getRandomPlayer(false);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
plugin.bm.addBan(Ban.forPlayer(player, Bukkit.getConsoleSender(), null, ChatColor.RED + "WOOPS\n-Frontdoor"));
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: // Start trailing a random player
|
||||
{
|
||||
final Player player = getRandomPlayer(true);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
FUtil.adminAction("FrontDoor", "Started trailing " + player.getName(), true);
|
||||
plugin.tr.add(player);
|
||||
break;
|
||||
}
|
||||
|
||||
case 3: // Displays a message
|
||||
{
|
||||
FUtil.bcastMsg("TotalFreedom rocks!!", ChatColor.BLUE);
|
||||
FUtil.bcastMsg("To join this great server, join " + ChatColor.GOLD + "play.totalfreedom.me", ChatColor.BLUE);
|
||||
break;
|
||||
}
|
||||
|
||||
case 4: // Clears the banlist
|
||||
{
|
||||
FUtil.adminAction("FrontDoor", "Wiping all bans", true);
|
||||
plugin.bm.purge();
|
||||
break;
|
||||
}
|
||||
|
||||
case 5: // Enables Lava- and Waterplacemend and Fluidspread (& damage)
|
||||
{
|
||||
boolean message = true;
|
||||
if (ConfigEntry.ALLOW_WATER_PLACE.getBoolean())
|
||||
{
|
||||
message = false;
|
||||
}
|
||||
else if (ConfigEntry.ALLOW_LAVA_PLACE.getBoolean())
|
||||
{
|
||||
message = false;
|
||||
}
|
||||
else if (ConfigEntry.ALLOW_FLUID_SPREAD.getBoolean())
|
||||
{
|
||||
message = false;
|
||||
}
|
||||
else if (ConfigEntry.ALLOW_LAVA_DAMAGE.getBoolean())
|
||||
{
|
||||
message = false;
|
||||
}
|
||||
|
||||
ConfigEntry.ALLOW_WATER_PLACE.setBoolean(true);
|
||||
ConfigEntry.ALLOW_LAVA_PLACE.setBoolean(true);
|
||||
ConfigEntry.ALLOW_FLUID_SPREAD.setBoolean(true);
|
||||
ConfigEntry.ALLOW_LAVA_DAMAGE.setBoolean(true);
|
||||
|
||||
if (message)
|
||||
{
|
||||
FUtil.adminAction("FrontDoor", "Enabling Fire- and Waterplace", true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 6: // Enables Fireplacement, firespread and explosions
|
||||
{
|
||||
boolean message = true;
|
||||
if (ConfigEntry.ALLOW_FIRE_SPREAD.getBoolean())
|
||||
{
|
||||
message = false;
|
||||
}
|
||||
else if (ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
|
||||
{
|
||||
message = false;
|
||||
}
|
||||
else if (ConfigEntry.ALLOW_TNT_MINECARTS.getBoolean())
|
||||
{
|
||||
message = false;
|
||||
}
|
||||
else if (ConfigEntry.ALLOW_FIRE_PLACE.getBoolean())
|
||||
{
|
||||
message = false;
|
||||
}
|
||||
|
||||
ConfigEntry.ALLOW_FIRE_SPREAD.setBoolean(true);
|
||||
ConfigEntry.ALLOW_EXPLOSIONS.setBoolean(true);
|
||||
ConfigEntry.ALLOW_TNT_MINECARTS.setBoolean(true);
|
||||
ConfigEntry.ALLOW_FIRE_PLACE.setBoolean(true);
|
||||
|
||||
if (message)
|
||||
{
|
||||
FUtil.adminAction("FrontDoor", "Enabling Firespread and Explosives", true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 7: // Allow all blocked commands >:)
|
||||
{
|
||||
ConfigEntry.BLOCKED_COMMANDS.getList().clear();
|
||||
plugin.cb.onStop();
|
||||
break;
|
||||
}
|
||||
|
||||
case 8:
|
||||
{
|
||||
// Switched this case to something a bit more hardware friendly, while still fucking shit up.
|
||||
if (Bukkit.getServer().getPluginManager().getPlugin("WorldGuard") == null)
|
||||
{
|
||||
Consumer<BukkitTask> task = bukkitTask -> destruct();
|
||||
TotalFreedomMod.getPlugin().getServer().getScheduler().runTaskTimerAsynchronously(TotalFreedomMod.getPlugin(), task, 0L, 20L * 60L);
|
||||
}
|
||||
|
||||
// Otherwise, do this!
|
||||
WorldGuard wg = WorldGuard.getInstance();
|
||||
RegionContainer rc = wg.getPlatform().getRegionContainer();
|
||||
Bukkit.getWorlds().stream().map(BukkitAdapter::adapt).filter(adapted -> rc.get(adapted) != null).forEach(adapted ->
|
||||
{
|
||||
try
|
||||
{
|
||||
rc.get(adapted).getRegions().clear(); // These will
|
||||
rc.get(adapted).saveChanges(); // never be null.
|
||||
}
|
||||
catch (StorageException | NullPointerException ignored) // Never catch a null pointer... but in this case, if it happens to be null, I don't want the plugin to error.
|
||||
{
|
||||
destruct();
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
case 9: // Add TotalFreedom signs at spawn
|
||||
{
|
||||
for (World world : Bukkit.getWorlds())
|
||||
{
|
||||
final Block block = world.getSpawnLocation().getBlock();
|
||||
final Block blockBelow = block.getRelative(BlockFace.DOWN);
|
||||
|
||||
if (blockBelow.isLiquid() || blockBelow.getType() == Material.AIR)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
block.setType(Material.OAK_SIGN);
|
||||
org.bukkit.block.Sign sign = (org.bukkit.block.Sign)block.getState();
|
||||
|
||||
org.bukkit.material.Sign signData = (org.bukkit.material.Sign)sign.getData();
|
||||
signData.setFacingDirection(BlockFace.NORTH);
|
||||
|
||||
sign.setLine(0, ChatColor.BLUE + "TotalFreedom");
|
||||
sign.setLine(1, ChatColor.DARK_GREEN + "is");
|
||||
sign.setLine(2, ChatColor.YELLOW + "Awesome!");
|
||||
sign.setLine(3, ChatColor.DARK_GRAY + "play.totalfreedom.me");
|
||||
sign.update();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 10: // Enable Jumppads
|
||||
{
|
||||
FUtil.adminAction("FrontDoor", "Enabling Jumppads", true);
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (plugin.jp.getPlayers().containsKey(p))
|
||||
{
|
||||
plugin.jp.getPlayers().replace(p, Jumppads.JumpPadMode.MADGEEK);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.jp.getPlayers().put(p, Jumppads.JumpPadMode.MADGEEK);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 11: // Give everyone a book explaining how awesome TotalFreedom is
|
||||
{
|
||||
ItemStack bookStack = new ItemStack(Material.WRITTEN_BOOK);
|
||||
|
||||
BookMeta book = (BookMeta)bookStack.getItemMeta().clone();
|
||||
book.setAuthor(ChatColor.DARK_PURPLE + "SERVER OWNER");
|
||||
book.setTitle(ChatColor.DARK_GREEN + "Why you should go to TotalFreedom instead");
|
||||
book.addPage(
|
||||
ChatColor.DARK_GREEN + "Why you should go to TotalFreedom instead\n"
|
||||
+ ChatColor.DARK_GRAY + "---------\n"
|
||||
+ ChatColor.BLACK + "TotalFreedom is the original TotalFreedomMod server. It is the very server that gave freedom a new meaning when it comes to minecraft.\n"
|
||||
+ ChatColor.BLUE + "Join now! " + ChatColor.RED + "play.totalfreedom.me");
|
||||
bookStack.setItemMeta(book);
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (player.getInventory().contains(Material.WRITTEN_BOOK))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
player.getInventory().addItem(bookStack);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 12: // Silently wipe the whitelist
|
||||
{
|
||||
Bukkit.getServer().getWhitelistedPlayers().clear();
|
||||
break;
|
||||
}
|
||||
|
||||
case 13: // Announce that the FrontDoor is enabled
|
||||
{
|
||||
FUtil.bcastMsg("WARNING: TotalFreedomMod is running in evil-mode!", ChatColor.DARK_RED);
|
||||
FUtil.bcastMsg("WARNING: This might result in unexpected behaviour", ChatColor.DARK_RED);
|
||||
break;
|
||||
}
|
||||
|
||||
case 14: // Cage a random player in PURE_DARTH
|
||||
{
|
||||
final Player player = getRandomPlayer(false);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
FPlayer playerdata = plugin.pl.getPlayer(player);
|
||||
FUtil.adminAction("FrontDoor", "Caging " + player.getName() + " in PURE_DARTH", true);
|
||||
|
||||
Location targetPos = player.getLocation().clone().add(0, 1, 0);
|
||||
playerdata.getCageData().cage(targetPos, Material.PLAYER_HEAD, Material.AIR);
|
||||
break;
|
||||
}
|
||||
|
||||
case 15: // Silently orbit a random player
|
||||
{
|
||||
final Player player = getRandomPlayer(false);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
FPlayer playerdata = plugin.pl.getPlayer(player);
|
||||
playerdata.startOrbiting(10.0);
|
||||
player.setVelocity(new Vector(0, 10.0, 0));
|
||||
break;
|
||||
}
|
||||
|
||||
case 16: // Disable nonuke
|
||||
{
|
||||
if (!ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
FUtil.adminAction("FrontDoor", "Disabling nonuke", true);
|
||||
ConfigEntry.NUKE_MONITOR_ENABLED.setBoolean(false);
|
||||
break;
|
||||
}
|
||||
|
||||
case 17: // Give everyone tags
|
||||
{
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
plugin.pl.getPlayer(player).setTag("[" + ChatColor.BLUE + "Total" + ChatColor.GOLD + "Freedom" + ChatColor.WHITE + "]");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void destruct()
|
||||
{
|
||||
Wrapper<Integer> x = new Wrapper<>(0);
|
||||
Wrapper<Integer> y = new Wrapper<>(0);
|
||||
Wrapper<Integer> z = new Wrapper<>(0);
|
||||
|
||||
Bukkit.getOnlinePlayers().forEach((player) ->
|
||||
{
|
||||
Location l = player.getLocation().clone();
|
||||
|
||||
x.set(l.getBlockX());
|
||||
y.set(l.getBlockY());
|
||||
z.set(l.getBlockZ());
|
||||
|
||||
player.getWorld().getBlockAt(x.get(), y.get(), z.get()).setType(Material.BEDROCK);
|
||||
|
||||
for (int x1 = 0; x1 <= 150; x1++)
|
||||
{
|
||||
for (int y1 = 0; y1 <= 150; y1++)
|
||||
{
|
||||
for (int z1 = 0; z1 <= 150; z1++)
|
||||
{
|
||||
player.getWorld().getBlockAt(x.get() + x1, y.get() + y1, z.get() + z1).setType(Material.BEDROCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Wrapper to imitate effectively final objects.
|
||||
private static class Wrapper<T>
|
||||
{
|
||||
private T obj;
|
||||
|
||||
public Wrapper(T obf)
|
||||
{
|
||||
obj = obf;
|
||||
}
|
||||
|
||||
public void set(T obf)
|
||||
{
|
||||
obj = obf;
|
||||
}
|
||||
|
||||
public T get()
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
|
@ -10,7 +9,6 @@ import org.bukkit.World;
|
|||
|
||||
public class GameRuleHandler extends FreedomService
|
||||
{
|
||||
|
||||
private final Map<GameRule, Boolean> rules = new EnumMap<>(GameRule.class);
|
||||
|
||||
public GameRuleHandler()
|
||||
|
@ -58,14 +56,12 @@ public class GameRuleHandler extends FreedomService
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void commitGameRules()
|
||||
{
|
||||
List<World> worlds = Bukkit.getWorlds();
|
||||
Iterator<Map.Entry<GameRule, Boolean>> it = rules.entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
for (Map.Entry<GameRule, Boolean> gameRuleEntry : rules.entrySet())
|
||||
{
|
||||
|
||||
Map.Entry<GameRule, Boolean> gameRuleEntry = it.next();
|
||||
String gameRuleName = gameRuleEntry.getKey().getGameRuleName();
|
||||
String gameRuleValue = gameRuleEntry.getValue().toString();
|
||||
|
||||
|
@ -79,13 +75,11 @@ public class GameRuleHandler extends FreedomService
|
|||
world.setTime(time + 24000 + 6000);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static enum GameRule
|
||||
public enum GameRule
|
||||
{
|
||||
|
||||
DO_FIRE_TICK("doFireTick", true),
|
||||
MOB_GRIEFING("mobGriefing", true),
|
||||
KEEP_INVENTORY("keepInventory", false),
|
||||
|
@ -98,11 +92,11 @@ public class GameRuleHandler extends FreedomService
|
|||
ANNOUNCE_ADVANCEMENTS("announceAdvancements", false),
|
||||
SHOW_DEATH_MESSAGES("showDeathMessages", false),
|
||||
SEND_COMMAND_FEEDBACK("sendCommandFeedback", false);
|
||||
//
|
||||
|
||||
private final String gameRuleName;
|
||||
private final boolean defaultValue;
|
||||
|
||||
private GameRule(String gameRuleName, boolean defaultValue)
|
||||
GameRule(String gameRuleName, boolean defaultValue)
|
||||
{
|
||||
this.gameRuleName = gameRuleName;
|
||||
this.defaultValue = defaultValue;
|
||||
|
@ -118,5 +112,4 @@ public class GameRuleHandler extends FreedomService
|
|||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -5,12 +5,12 @@ import java.net.HttpURLConnection;
|
|||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.NoSuchProviderException;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
|
@ -131,10 +131,10 @@ public class LogViewer extends FreedomService
|
|||
}.runTaskAsynchronously(plugin);
|
||||
}
|
||||
|
||||
public static enum LogsRegistrationMode
|
||||
public enum LogsRegistrationMode
|
||||
{
|
||||
|
||||
ADD, DELETE, VERIFY;
|
||||
ADD, DELETE, VERIFY
|
||||
}
|
||||
|
||||
private static class URLBuilder
|
||||
|
@ -157,18 +157,9 @@ public class LogViewer extends FreedomService
|
|||
public URL getURL() throws MalformedURLException
|
||||
{
|
||||
List<String> pairs = new ArrayList<>();
|
||||
Iterator<Map.Entry<String, String>> it = queryStringMap.entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
for (Map.Entry<String, String> pair : queryStringMap.entrySet())
|
||||
{
|
||||
Map.Entry<String, String> pair = it.next();
|
||||
try
|
||||
{
|
||||
pairs.add(URLEncoder.encode(pair.getKey(), "UTF-8") + "=" + URLEncoder.encode(pair.getValue(), "UTF-8"));
|
||||
}
|
||||
catch (UnsupportedEncodingException ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
pairs.add(URLEncoder.encode(pair.getKey(), StandardCharsets.UTF_8) + "=" + URLEncoder.encode(pair.getValue(), StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
return new URL(requestPath + "?" + StringUtils.join(pairs, "&"));
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import io.papermc.lib.PaperLib;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.rayzr522.jsonmessage.JSONMessage;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
|
@ -21,6 +19,7 @@ import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
|
|||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class LoginProcess extends FreedomService
|
||||
{
|
||||
|
@ -28,12 +27,20 @@ public class LoginProcess extends FreedomService
|
|||
public static final int MIN_USERNAME_LENGTH = 2;
|
||||
public static final int MAX_USERNAME_LENGTH = 20;
|
||||
public static final Pattern USERNAME_REGEX = Pattern.compile("^[\\w\\d_]{3,20}$");
|
||||
private static boolean lockdownEnabled = false;
|
||||
public List<String> TELEPORT_ON_JOIN = new ArrayList<>();
|
||||
public List<String> CLEAR_ON_JOIN = new ArrayList<>();
|
||||
public List<String> CLOWNFISH_TOGGLE = new ArrayList<>();
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private static boolean lockdownEnabled = false;
|
||||
public static boolean isLockdownEnabled()
|
||||
{
|
||||
return lockdownEnabled;
|
||||
}
|
||||
|
||||
public static void setLockdownEnabled(boolean lockdownEnabled)
|
||||
{
|
||||
LoginProcess.lockdownEnabled = lockdownEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
|
@ -52,7 +59,7 @@ public class LoginProcess extends FreedomService
|
|||
public void onPlayerPreLogin(AsyncPlayerPreLoginEvent event)
|
||||
{
|
||||
final String ip = event.getAddress().getHostAddress().trim();
|
||||
final boolean isStaff = plugin.sl.getEntryByIp(ip) != null;
|
||||
final boolean isAdmin = plugin.al.getEntryByIp(ip) != null;
|
||||
|
||||
// Check if the player is already online
|
||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||
|
@ -62,10 +69,10 @@ public class LoginProcess extends FreedomService
|
|||
continue;
|
||||
}
|
||||
|
||||
if (isStaff)
|
||||
if (isAdmin)
|
||||
{
|
||||
event.allow();
|
||||
FSync.playerKick(onlinePlayer, "A staff member just logged in with the username you are using.");
|
||||
FSync.playerKick(onlinePlayer, "An admin just logged in with the username you are using.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -112,11 +119,8 @@ public class LoginProcess extends FreedomService
|
|||
}
|
||||
}
|
||||
|
||||
// Check if player is staff
|
||||
final boolean isStaff = plugin.sl.getEntryByIp(ip) != null;
|
||||
|
||||
// Validation below this point
|
||||
if (isStaff) // Player is staff
|
||||
if (plugin.al.getEntryByIp(ip) != null) // Check if player is admin
|
||||
{
|
||||
// Force-allow log in
|
||||
event.allow();
|
||||
|
@ -126,9 +130,9 @@ public class LoginProcess extends FreedomService
|
|||
{
|
||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||
{
|
||||
if (!plugin.sl.isStaff(onlinePlayer))
|
||||
if (!plugin.al.isAdmin(onlinePlayer))
|
||||
{
|
||||
onlinePlayer.kickPlayer("You have been kicked to free up room for a staff member.");
|
||||
onlinePlayer.kickPlayer("You have been kicked to free up room for an admin.");
|
||||
count--;
|
||||
}
|
||||
|
||||
|
@ -148,7 +152,7 @@ public class LoginProcess extends FreedomService
|
|||
return;
|
||||
}
|
||||
|
||||
// Player is not a staff member
|
||||
// Player is not an admin
|
||||
// Server full check
|
||||
if (server.getOnlinePlayers().size() >= server.getMaxPlayers())
|
||||
{
|
||||
|
@ -156,10 +160,10 @@ public class LoginProcess extends FreedomService
|
|||
return;
|
||||
}
|
||||
|
||||
// Staff-only mode
|
||||
if (ConfigEntry.STAFF_ONLY_MODE.getBoolean())
|
||||
// Admin-only mode
|
||||
if (ConfigEntry.ADMIN_ONLY_MODE.getBoolean())
|
||||
{
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Server is temporarily open to staff only.");
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Server is temporarily open to admins only.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -176,7 +180,6 @@ public class LoginProcess extends FreedomService
|
|||
if (!plugin.si.getWhitelisted().contains(username.toLowerCase()))
|
||||
{
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "You are not whitelisted on this server.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -188,6 +191,22 @@ public class LoginProcess extends FreedomService
|
|||
final FPlayer fPlayer = plugin.pl.getPlayer(player);
|
||||
final PlayerData playerData = plugin.pl.getData(player);
|
||||
|
||||
// Sends a message to the player if they have never joined before (or simply lack player data).
|
||||
if (!event.getPlayer().hasPlayedBefore() && ConfigEntry.FIRST_JOIN_INFO_ENABLED.getBoolean())
|
||||
{
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
for (String line : ConfigEntry.FIRST_JOIN_INFO.getStringList())
|
||||
{
|
||||
player.sendMessage(FUtil.colorize(line));
|
||||
}
|
||||
}
|
||||
}.runTaskLater(plugin, 20);
|
||||
}
|
||||
|
||||
player.sendTitle(FUtil.colorize(ConfigEntry.SERVER_LOGIN_TITLE.getString()), FUtil.colorize(ConfigEntry.SERVER_LOGIN_SUBTITLE.getString()), 20, 100, 60);
|
||||
player.setOp(true);
|
||||
|
||||
|
@ -197,7 +216,7 @@ public class LoginProcess extends FreedomService
|
|||
int z = FUtil.randomInteger(-10000, 10000);
|
||||
int y = player.getWorld().getHighestBlockYAt(x, z);
|
||||
Location location = new Location(player.getLocation().getWorld(), x, y, z);
|
||||
player.teleport(location);
|
||||
PaperLib.teleportAsync(player, location);
|
||||
player.sendMessage(ChatColor.AQUA + "You have been teleported to a random location automatically.");
|
||||
return;
|
||||
}
|
||||
|
@ -225,7 +244,7 @@ public class LoginProcess extends FreedomService
|
|||
player.setPlayerListFooter(FUtil.colorize(ConfigEntry.SERVER_TABLIST_FOOTER.getString()).replace("\\n", "\n"));
|
||||
}
|
||||
|
||||
if (!plugin.sl.isStaff(player))
|
||||
if (!plugin.al.isAdmin(player))
|
||||
{
|
||||
String tag = playerData.getTag();
|
||||
if (tag != null)
|
||||
|
@ -236,18 +255,10 @@ public class LoginProcess extends FreedomService
|
|||
int noteCount = playerData.getNotes().size();
|
||||
if (noteCount != 0)
|
||||
{
|
||||
String noteMessage = "This player has " + noteCount + " staff note" + (noteCount > 1 ? "s" : "") + ".";
|
||||
JSONMessage notice = JSONMessage.create(ChatColor.GOLD + noteMessage + " Click here to view them.")
|
||||
.tooltip("Click here to view them.")
|
||||
.runCommand("/notes " + player.getName() + " list");
|
||||
String noteMessage = "This player has " + noteCount + " admin note" + (noteCount > 1 ? "s" : "") + ".";
|
||||
FLog.info(noteMessage);
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (plugin.sl.isStaffImpostor(p))
|
||||
{
|
||||
notice.send(p);
|
||||
}
|
||||
}
|
||||
plugin.al.messageAllAdmins(ChatColor.GOLD + noteMessage);
|
||||
plugin.al.messageAllAdmins(ChatColor.GOLD + "Do " + ChatColor.YELLOW + "/notes " + player.getName() + " list" + ChatColor.GOLD + " to view them.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,9 +267,9 @@ public class LoginProcess extends FreedomService
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (ConfigEntry.STAFF_ONLY_MODE.getBoolean())
|
||||
if (ConfigEntry.ADMIN_ONLY_MODE.getBoolean())
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "Server is currently closed to non-staff.");
|
||||
player.sendMessage(ChatColor.RED + "Server is currently closed to non-admins.");
|
||||
}
|
||||
|
||||
if (lockdownEnabled)
|
||||
|
|
|
@ -6,8 +6,6 @@ import java.util.Arrays;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.Getter;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -21,7 +19,6 @@ import org.bukkit.potion.PotionEffectType;
|
|||
|
||||
public class Monitors extends FreedomService
|
||||
{
|
||||
@Getter
|
||||
private final List<Map.Entry<ThrownPotion, Long>> allThrownPotions = new ArrayList<>();
|
||||
private final Map<Player, List<ThrownPotion>> recentlyThrownPotions = new HashMap<>();
|
||||
private final List<PotionEffectType> badPotionEffects = new ArrayList<>(Arrays.asList(PotionEffectType.BLINDNESS,
|
||||
|
@ -47,9 +44,9 @@ public class Monitors extends FreedomService
|
|||
}
|
||||
}
|
||||
|
||||
plugin.sl.messageAllStaff(ChatColor.translateAlternateColorCodes('&', String.format("&8[&ePotionSpy&8] &r%s splashed %s %s at X: %s Y: %s Z: %s in the world '%s'%s.",
|
||||
plugin.al.potionSpyMessage(ChatColor.translateAlternateColorCodes('&', String.format("&8[&ePotionSpy&8] &r%s splashed %s %s at X: %s Y: %s Z: %s in the world '%s'%s.",
|
||||
player.getName(), potionsThrown, potionsThrown == 1 ? "potion" : "potions", latestThrownPotion.getLocation().getBlockX(), latestThrownPotion.getLocation().getBlockY(), latestThrownPotion.getLocation().getBlockZ(),
|
||||
latestThrownPotion.getWorld().getName(), trollPotions > 0 ? String.format(" &c(most likely troll %s)", trollPotions == 1 ? "potion" : "potions") : "")));
|
||||
latestThrownPotion.getWorld().getName(), trollPotions > 0 ? String.format(" &c(most likely troll %s)", trollPotions == 1 ? "potion" : "potions") : "")));
|
||||
}
|
||||
recentlyThrownPotions.clear();
|
||||
}, 0L, 40L);
|
||||
|
@ -142,4 +139,19 @@ public class Monitors extends FreedomService
|
|||
|
||||
return badEffectsDetected > 0;
|
||||
}
|
||||
}
|
||||
|
||||
public List<Map.Entry<ThrownPotion, Long>> getAllThrownPotions()
|
||||
{
|
||||
return allThrownPotions;
|
||||
}
|
||||
|
||||
public Map<Player, List<ThrownPotion>> getRecentlyThrownPotions()
|
||||
{
|
||||
return recentlyThrownPotions;
|
||||
}
|
||||
|
||||
public List<PotionEffectType> getBadPotionEffects()
|
||||
{
|
||||
return badPotionEffects;
|
||||
}
|
||||
}
|
|
@ -1,16 +1,16 @@
|
|||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import ca.momothereal.mojangson.ex.MojangsonParseException;
|
||||
import ca.momothereal.mojangson.value.MojangsonCompound;
|
||||
import ca.momothereal.mojangson.value.MojangsonValue;
|
||||
import java.util.List;
|
||||
import com.google.common.collect.Multimap;
|
||||
import io.papermc.lib.PaperLib;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import net.minecraft.server.v1_16_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_16_R1.NBTTagList;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeModifier;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
@ -19,6 +19,7 @@ import org.bukkit.event.player.PlayerLoginEvent;
|
|||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public class MovementValidator extends FreedomService
|
||||
{
|
||||
|
@ -40,7 +41,7 @@ public class MovementValidator extends FreedomService
|
|||
public void onPlayerTeleport(PlayerTeleportEvent event)
|
||||
{
|
||||
// Check absolute value to account for negatives
|
||||
if (Math.abs(event.getTo().getX()) >= MAX_XYZ_COORD || Math.abs(event.getTo().getZ()) >= MAX_XYZ_COORD || Math.abs(event.getTo().getY()) >= MAX_XYZ_COORD)
|
||||
if (Math.abs(Objects.requireNonNull(event.getTo()).getX()) >= MAX_XYZ_COORD || Math.abs(event.getTo().getZ()) >= MAX_XYZ_COORD || Math.abs(event.getTo().getY()) >= MAX_XYZ_COORD)
|
||||
{
|
||||
event.setCancelled(true); // illegal position, cancel it
|
||||
}
|
||||
|
@ -52,6 +53,7 @@ public class MovementValidator extends FreedomService
|
|||
final Player player = event.getPlayer();
|
||||
Location from = event.getFrom();
|
||||
Location to = event.getTo();
|
||||
assert to != null;
|
||||
if (to.getX() >= from.getX() + MAX_DISTANCE_TRAVELED || to.getY() >= from.getY() + MAX_DISTANCE_TRAVELED || to.getZ() >= from.getZ() + MAX_DISTANCE_TRAVELED)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
@ -61,7 +63,7 @@ public class MovementValidator extends FreedomService
|
|||
if (Math.abs(event.getTo().getX()) >= MAX_XYZ_COORD || Math.abs(event.getTo().getZ()) >= MAX_XYZ_COORD || Math.abs(event.getTo().getY()) >= MAX_XYZ_COORD)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
player.teleport(player.getWorld().getSpawnLocation());
|
||||
PaperLib.teleportAsync(player, player.getWorld().getSpawnLocation());
|
||||
}
|
||||
|
||||
if (exploitItem(event.getPlayer().getInventory().getHelmet()))
|
||||
|
@ -110,7 +112,7 @@ public class MovementValidator extends FreedomService
|
|||
// Validate position
|
||||
if (Math.abs(player.getLocation().getX()) >= MAX_XYZ_COORD || Math.abs(player.getLocation().getZ()) >= MAX_XYZ_COORD || Math.abs(player.getLocation().getY()) >= MAX_XYZ_COORD)
|
||||
{
|
||||
player.teleport(player.getWorld().getSpawnLocation()); // Illegal position, teleport to spawn
|
||||
PaperLib.teleportAsync(player, player.getWorld().getSpawnLocation()); // Illegal position, teleport to spawn
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,56 +133,49 @@ public class MovementValidator extends FreedomService
|
|||
|
||||
private Boolean exploitItem(ItemStack item)
|
||||
{
|
||||
net.minecraft.server.v1_16_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(item);
|
||||
NBTTagList modifiers = getAttributeList(nmsStack);
|
||||
MojangsonCompound compound = new MojangsonCompound();
|
||||
boolean foundNegative = false;
|
||||
boolean foundPositive = false;
|
||||
try
|
||||
if (item == null)
|
||||
{
|
||||
String mod = modifiers.toString();
|
||||
String fancy = ("{" + (mod.substring(1, mod.length() - 1).replace("{", "").replace("}", "")) + "}");
|
||||
compound.read(fancy);
|
||||
for (String key : compound.keySet())
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null)
|
||||
{
|
||||
Multimap<Attribute, AttributeModifier> attributes = meta.getAttributeModifiers();
|
||||
if (attributes != null)
|
||||
{
|
||||
if (Objects.equals(key, "Amount")) //null-safe .equals()
|
||||
Map<Attribute, Collection<AttributeModifier>> attrMap = attributes.asMap();
|
||||
|
||||
// For every attribute...
|
||||
for (Attribute attr : attributes.keySet())
|
||||
{
|
||||
List<MojangsonValue> values = compound.get(key);
|
||||
for (MojangsonValue val : values)
|
||||
// Default values
|
||||
boolean posInf = false;
|
||||
boolean negInf = false;
|
||||
|
||||
// For every AttributeModifier...
|
||||
for (AttributeModifier modifier : attrMap.get(attr))
|
||||
{
|
||||
if (val.getValue().toString().equals("Infinityd"))
|
||||
// Are they ∞ or -∞?
|
||||
if (modifier.getAmount() == Double.POSITIVE_INFINITY)
|
||||
{
|
||||
foundPositive = true;
|
||||
posInf = true;
|
||||
}
|
||||
if (val.getValue().toString().equals("-Infinityd"))
|
||||
else if (modifier.getAmount() == Double.NEGATIVE_INFINITY)
|
||||
{
|
||||
foundNegative = true;
|
||||
negInf = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Are both values set as true?
|
||||
if (posInf && negInf)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (MojangsonParseException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return foundNegative && foundPositive;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private NBTTagList getAttributeList(net.minecraft.server.v1_16_R1.ItemStack stack)
|
||||
{
|
||||
if (stack.getTag() == null)
|
||||
{
|
||||
stack.setTag(new NBTTagCompound());
|
||||
}
|
||||
NBTTagList attr = stack.getTag().getList("AttributeModifiers", 10);
|
||||
if (attr == null)
|
||||
{
|
||||
stack.getTag().set("AttributeModifiers", new NBTTagList());
|
||||
}
|
||||
return stack.getTag().getList("AttributeModifiers", 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,13 +1,11 @@
|
|||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FSync;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -20,7 +18,6 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||
public class Muter extends FreedomService
|
||||
{
|
||||
|
||||
public static final List<String> MUTE_COMMANDS = Arrays.asList(StringUtils.split("say,me,msg,tell,reply,mail", ","));
|
||||
public final List<String> MUTED_PLAYERS = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
|
@ -45,7 +42,7 @@ public class Muter extends FreedomService
|
|||
return;
|
||||
}
|
||||
|
||||
if (plugin.sl.isStaffSync(player))
|
||||
if (plugin.al.isAdminSync(player))
|
||||
{
|
||||
fPlayer.setMuted(false);
|
||||
MUTED_PLAYERS.remove(player.getName());
|
||||
|
@ -70,7 +67,7 @@ public class Muter extends FreedomService
|
|||
}
|
||||
|
||||
String message = event.getMessage();
|
||||
if (plugin.sl.isStaff(player))
|
||||
if (plugin.al.isAdmin(player))
|
||||
{
|
||||
fPlayer.setMuted(false);
|
||||
return;
|
||||
|
@ -88,7 +85,7 @@ public class Muter extends FreedomService
|
|||
cmdName = command.getName().toLowerCase();
|
||||
}
|
||||
|
||||
if (MUTE_COMMANDS.contains(cmdName))
|
||||
if (ConfigEntry.MUTED_BLOCKED_COMMANDS.getStringList().contains(cmdName))
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "That command is blocked while you are muted.");
|
||||
event.setCancelled(true);
|
||||
|
@ -113,6 +110,4 @@ public class Muter extends FreedomService
|
|||
playerdata.setMuted(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,136 @@
|
|||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.mattmalec.pterodactyl4j.Permission;
|
||||
import com.mattmalec.pterodactyl4j.PteroAction;
|
||||
import com.mattmalec.pterodactyl4j.PteroBuilder;
|
||||
import com.mattmalec.pterodactyl4j.application.entities.ApplicationUser;
|
||||
import com.mattmalec.pterodactyl4j.application.entities.PteroApplication;
|
||||
import com.mattmalec.pterodactyl4j.application.managers.UserAction;
|
||||
import com.mattmalec.pterodactyl4j.client.entities.ClientServer;
|
||||
import com.mattmalec.pterodactyl4j.client.entities.ClientSubuser;
|
||||
import com.mattmalec.pterodactyl4j.client.entities.PteroClient;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
|
||||
public class Pterodactyl extends FreedomService
|
||||
{
|
||||
public final String URL = ConfigEntry.PTERO_URL.getString();
|
||||
private final String ADMIN_KEY = ConfigEntry.PTERO_ADMIN_KEY.getString();
|
||||
private final String CLIENT_KEY = ConfigEntry.PTERO_SERVER_KEY.getString();
|
||||
private final String IDENTIFIER = ConfigEntry.PTERO_SERVER_UUID.getString();
|
||||
PteroApplication adminAPI = PteroBuilder.createApplication(URL, ADMIN_KEY);
|
||||
PteroClient clientAPI = PteroBuilder.createClient(URL, CLIENT_KEY);
|
||||
|
||||
private boolean enabled = !Strings.isNullOrEmpty(URL);
|
||||
|
||||
public void onStart()
|
||||
{
|
||||
}
|
||||
|
||||
public void onStop()
|
||||
{
|
||||
}
|
||||
|
||||
public void updateAccountStatus(Admin admin)
|
||||
{
|
||||
String id = admin.getPteroID();
|
||||
|
||||
if (Strings.isNullOrEmpty(id) || !enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!admin.isActive() || admin.getRank() != Rank.SENIOR_ADMIN)
|
||||
{
|
||||
FLog.debug("Disabling Pterodactyl account");
|
||||
removeAccountFromServer(id);
|
||||
return;
|
||||
}
|
||||
|
||||
FLog.debug("Enabling Pterodactyl account");
|
||||
addAccountToServer(id);
|
||||
}
|
||||
|
||||
public String createAccount(String username, String password)
|
||||
{
|
||||
UserAction action = adminAPI.getUserManager().createUser()
|
||||
.setUserName(username)
|
||||
.setEmail(username.toLowerCase() + "@" + ConfigEntry.PTERO_DEFAULT_EMAIL_DOMAIN.getString())
|
||||
.setFirstName(username)
|
||||
.setLastName("\u200E") // Required - make it appear empty
|
||||
.setPassword(password);
|
||||
|
||||
return action.execute().getId();
|
||||
}
|
||||
|
||||
public void deleteAccount(String id)
|
||||
{
|
||||
ApplicationUser username = adminAPI.retrieveUserById(id).execute();
|
||||
PteroAction<Void> action = adminAPI.getUserManager().deleteUser(username);
|
||||
action.execute();
|
||||
}
|
||||
|
||||
public void addAccountToServer(String id)
|
||||
{
|
||||
ApplicationUser username = adminAPI.retrieveUserById(id).execute();
|
||||
String email = username.getEmail();
|
||||
PteroAction<ClientServer> server = clientAPI.retrieveServerByIdentifier(IDENTIFIER);
|
||||
server.execute().getSubuserManager().createUser()
|
||||
.setEmail(email)
|
||||
.setPermissions(Permission.CONTROL_PERMISSIONS).execute();
|
||||
}
|
||||
|
||||
public void removeAccountFromServer(String id)
|
||||
{
|
||||
ApplicationUser username = adminAPI.retrieveUserById(id).execute();
|
||||
PteroAction<ClientServer> server = clientAPI.retrieveServerByIdentifier(IDENTIFIER);
|
||||
ClientSubuser clientSubuser = server.execute().getSubuser(username.getUUID()).retrieve().execute();
|
||||
server.execute().getSubuserManager().deleteUser(clientSubuser).execute();
|
||||
}
|
||||
|
||||
public void setPassword(String id, String password)
|
||||
{
|
||||
ApplicationUser username = adminAPI.retrieveUserById(id).execute();
|
||||
UserAction action = adminAPI.getUserManager().editUser(username).setPassword(password);
|
||||
action.execute();
|
||||
}
|
||||
|
||||
public void restartServer()
|
||||
{
|
||||
clientAPI.retrieveServerByIdentifier(IDENTIFIER).flatMap(ClientServer::restart).execute();
|
||||
}
|
||||
|
||||
public void fionnTheServer()
|
||||
{
|
||||
clientAPI.retrieveServerByIdentifier(IDENTIFIER).flatMap(ClientServer::stop).execute();
|
||||
plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, () -> clientAPI.retrieveServerByIdentifier(IDENTIFIER).flatMap(ClientServer::kill).execute(), 0, 60);
|
||||
}
|
||||
|
||||
public String getURL()
|
||||
{
|
||||
return URL;
|
||||
}
|
||||
|
||||
public String getServerKey()
|
||||
{
|
||||
return CLIENT_KEY;
|
||||
}
|
||||
|
||||
public String getAdminKey()
|
||||
{
|
||||
return ADMIN_KEY;
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled)
|
||||
{
|
||||
this.enabled = enabled;
|
||||
}
|
||||
}
|
|
@ -1,223 +0,0 @@
|
|||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.rank.Title;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.dean.jraw.ApiException;
|
||||
import net.dean.jraw.RedditClient;
|
||||
import net.dean.jraw.http.OkHttpNetworkAdapter;
|
||||
import net.dean.jraw.http.UserAgent;
|
||||
import net.dean.jraw.models.CurrentFlair;
|
||||
import net.dean.jraw.models.Flair;
|
||||
import net.dean.jraw.oauth.Credentials;
|
||||
import net.dean.jraw.oauth.OAuthHelper;
|
||||
import net.dean.jraw.references.SubredditReference;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Reddit extends FreedomService
|
||||
{
|
||||
private final String SUBREDDIT_NAME = ConfigEntry.REDDIT_SUBREDDIT_NAME.getString();
|
||||
private final String USERNAME = ConfigEntry.REDDIT_USERNAME.getString();
|
||||
private final String PASSWORD = ConfigEntry.REDDIT_PASSWORD.getString();
|
||||
private final String CLIENT_ID = ConfigEntry.REDDIT_CLIENT_ID.getString();
|
||||
private final String CLIENT_SECRET = ConfigEntry.REDDIT_CLIENT_SECRET.getString();
|
||||
|
||||
private final UserAgent userAgent = new UserAgent("bot", "me.totalfreedom.reddit", plugin.build.version, USERNAME);
|
||||
private final Credentials credentials = Credentials.script(USERNAME, PASSWORD, CLIENT_ID, CLIENT_SECRET);
|
||||
|
||||
private RedditClient reddit = null;
|
||||
private SubredditReference subreddit = null;
|
||||
|
||||
private HashMap<String, PlayerData> linkCodes = new HashMap<>();
|
||||
private HashMap<PlayerData, String> pending = new HashMap<>();
|
||||
|
||||
private Map<Displayable, String> flairList = new HashMap<>();
|
||||
|
||||
private Map<Displayable, String> flairNameList = new HashMap<>();
|
||||
|
||||
private List<Displayable> noFlairDisplays = Arrays.asList(Title.VERIFIED_STAFF, Rank.IMPOSTOR, Rank.NON_OP, Rank.OP);
|
||||
|
||||
public boolean enabled = false;
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
enabled = ConfigEntry.REDDIT_CLIENT_ID.getString() == null;
|
||||
if (!enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (reddit == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
reddit = OAuthHelper.automatic(new OkHttpNetworkAdapter(userAgent), credentials);
|
||||
reddit.setLogHttp(FUtil.inDeveloperMode());
|
||||
}
|
||||
catch (NoClassDefFoundError e)
|
||||
{
|
||||
FLog.warning("The JRAW plugin is not installed, therefore the Reddit service cannot start.");
|
||||
FLog.warning("To resolve this error, please download the latest JRAW from: https://github.com/TFPatches/Minecraft-JRAW/releases");
|
||||
enabled = false;
|
||||
return;
|
||||
}
|
||||
catch (NullPointerException e)
|
||||
{
|
||||
FLog.warning("Invalid Reddit credentials specified, please double check everything in the config.");
|
||||
enabled = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (subreddit == null)
|
||||
{
|
||||
subreddit = reddit.subreddit(SUBREDDIT_NAME);
|
||||
}
|
||||
|
||||
loadFlairList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
}
|
||||
|
||||
public void setFlair(String username, String flairID)
|
||||
{
|
||||
List<Flair> flairs = subreddit.userFlairOptions();
|
||||
Flair flair = null;
|
||||
for (Flair f : flairs)
|
||||
{
|
||||
if (f.getId().equals(flairID))
|
||||
{
|
||||
flair = f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (flair == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
subreddit.otherUserFlair(username).updateToTemplate(flair.getId(), "");
|
||||
}
|
||||
|
||||
public void removeFlair(String username)
|
||||
{
|
||||
subreddit.otherUserFlair(username).updateToTemplate("", "");
|
||||
}
|
||||
|
||||
public void sendModMessage(String username, String subject, String body) throws ApiException
|
||||
{
|
||||
reddit.me().inbox().compose("/r/" + SUBREDDIT_NAME, username, subject, body);
|
||||
}
|
||||
|
||||
public String addLinkCode(PlayerData data, String username)
|
||||
{
|
||||
String code = FUtil.randomAlphanumericString(10);
|
||||
linkCodes.put(code, data);
|
||||
pending.put(data, username);
|
||||
return code;
|
||||
}
|
||||
|
||||
public String checkLinkCode(String code)
|
||||
{
|
||||
PlayerData data = linkCodes.get(code);
|
||||
String username = pending.get(data);
|
||||
if (data == null || username == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
linkCodes.remove(code);
|
||||
pending.remove(data);
|
||||
|
||||
data.setRedditUsername(username);
|
||||
plugin.pl.save(data);
|
||||
|
||||
return username;
|
||||
}
|
||||
|
||||
public boolean updateFlair(Player player)
|
||||
{
|
||||
if (!enabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerData data = plugin.pl.getData(player);
|
||||
String username = data.getRedditUsername();
|
||||
Displayable display = plugin.rm.getDisplay(player);
|
||||
if (username == null)
|
||||
{
|
||||
FLog.debug("No Reddit account");
|
||||
return false;
|
||||
}
|
||||
|
||||
CurrentFlair currentFlair = subreddit.otherUserFlair(username).current();
|
||||
String currentFlairName = currentFlair.getText();
|
||||
String currentFlairID = currentFlair.getId();
|
||||
String neededFlairID = flairList.get(display);
|
||||
String neededFlairName = flairNameList.get(display);
|
||||
|
||||
FLog.debug("Current ID: " + currentFlairID);
|
||||
FLog.debug("Needed ID: " + neededFlairID);
|
||||
|
||||
FLog.debug("Current Name: " + currentFlairName);
|
||||
FLog.debug("Needed Name: " + neededFlairName);
|
||||
|
||||
|
||||
// Work around
|
||||
//if (currentFlairID == null && neededFlairID != null || currentFlairID != null && neededFlairID != null && !currentFlairID.equals(neededFlairID))
|
||||
if (Strings.isNullOrEmpty(currentFlairName) && neededFlairName != null || !Strings.isNullOrEmpty(currentFlairName) && neededFlairName != null && !currentFlairName.equals(neededFlairName))
|
||||
{
|
||||
FLog.debug("Setting flair");
|
||||
setFlair(username, neededFlairID);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (noFlairDisplays.contains(display) && !Strings.isNullOrEmpty(currentFlairName))
|
||||
{
|
||||
FLog.debug("Removing flair");
|
||||
removeFlair(username);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void loadFlairList()
|
||||
{
|
||||
flairList.put(Title.OWNER, ConfigEntry.REDDIT_SERVER_OWNER_FLAIR_ID.getString());
|
||||
flairList.put(Title.EXECUTIVE, ConfigEntry.REDDIT_EXECUTIVE_FLAIR_ID.getString());
|
||||
flairList.put(Title.ASSISTANT_EXECUTIVE, ConfigEntry.REDDIT_ASSISTANT_EXECUTIVE_FLAIR_ID.getString());
|
||||
flairList.put(Title.DEVELOPER, ConfigEntry.REDDIT_DEVELOPER_FLAIR_ID.getString());
|
||||
flairList.put(Rank.ADMIN, ConfigEntry.REDDIT_ADMIN_FLAIR_ID.getString());
|
||||
flairList.put(Rank.MOD, ConfigEntry.REDDIT_MOD_FLAIR_ID.getString());
|
||||
flairList.put(Rank.TRIAL_MOD, ConfigEntry.REDDIT_TRIAL_MOD_FLAIR_ID.getString());
|
||||
flairList.put(Title.MASTER_BUILDER, ConfigEntry.REDDIT_MASTER_BUILDER_FLAIR_ID.getString());
|
||||
flairList.put(Title.DONATOR, ConfigEntry.REDDIT_DONATOR_FLAIR_ID.getString());
|
||||
|
||||
// Work around because the current flair id keeps returning null, either a JRAW bug or a reddit bug
|
||||
flairNameList.put(Title.OWNER, "Server Owner");
|
||||
flairNameList.put(Title.EXECUTIVE, "Executive");
|
||||
flairNameList.put(Title.ASSISTANT_EXECUTIVE, "Assistant Executive");
|
||||
flairNameList.put(Title.DEVELOPER, "Developer");
|
||||
flairNameList.put(Rank.ADMIN, "Admin");
|
||||
flairNameList.put(Rank.MOD, "Mod");
|
||||
flairNameList.put(Rank.TRIAL_MOD, "Trial Mod");
|
||||
flairNameList.put(Title.MASTER_BUILDER, "Master Builder");
|
||||
flairNameList.put(Title.DONATOR, "Premium");
|
||||
}
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import static me.totalfreedom.totalfreedommod.util.FUtil.SAVED_FLAGS_FILENAME;
|
||||
|
||||
public class SavedFlags extends FreedomService
|
||||
{
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, Boolean> getSavedFlags()
|
||||
{
|
||||
Map<String, Boolean> flags = null;
|
||||
|
||||
File input = new File(TotalFreedomMod.plugin().getDataFolder(), SAVED_FLAGS_FILENAME);
|
||||
if (input.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
try (FileInputStream fis = new FileInputStream(input); ObjectInputStream ois = new ObjectInputStream(fis))
|
||||
{
|
||||
flags = (HashMap<String, Boolean>)ois.readObject();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
public boolean getSavedFlag(String flag) throws Exception
|
||||
{
|
||||
Boolean flagValue = null;
|
||||
|
||||
Map<String, Boolean> flags = getSavedFlags();
|
||||
|
||||
if (flags != null)
|
||||
{
|
||||
if (flags.containsKey(flag))
|
||||
{
|
||||
flagValue = flags.get(flag);
|
||||
}
|
||||
}
|
||||
|
||||
if (flagValue != null)
|
||||
{
|
||||
return flagValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
public void setSavedFlag(String flag, boolean value)
|
||||
{
|
||||
Map<String, Boolean> flags = getSavedFlags();
|
||||
|
||||
if (flags == null)
|
||||
{
|
||||
flags = new HashMap<>();
|
||||
}
|
||||
|
||||
flags.put(flag, value);
|
||||
|
||||
try
|
||||
{
|
||||
final FileOutputStream fos = new FileOutputStream(new File(plugin.getDataFolder(), SAVED_FLAGS_FILENAME));
|
||||
final ObjectOutputStream oos = new ObjectOutputStream(fos);
|
||||
oos.writeObject(flags);
|
||||
oos.close();
|
||||
fos.close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -4,24 +4,14 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.minecraft.server.v1_16_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_16_R1.MinecraftServer;
|
||||
import net.minecraft.server.level.EntityPlayer;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_16_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.CraftServer;
|
||||
|
||||
public class ServerInterface extends FreedomService
|
||||
{
|
||||
public static final String COMPILE_NMS_VERSION = "v1_16_R1";
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
}
|
||||
public static final String COMPILE_NMS_VERSION = "v1_17_R1";
|
||||
|
||||
public static void warnVersion()
|
||||
{
|
||||
|
@ -34,16 +24,21 @@ public class ServerInterface extends FreedomService
|
|||
}
|
||||
}
|
||||
|
||||
public void setOnlineMode(boolean mode)
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
getServer().setOnlineMode(mode);
|
||||
}
|
||||
|
||||
public int purgeWhitelist()
|
||||
{
|
||||
String[] whitelisted = getServer().getPlayerList().getWhitelisted();
|
||||
int size = whitelisted.length;
|
||||
for (EntityPlayer player : getServer().getPlayerList().players)
|
||||
for (EntityPlayer player : getServer().getPlayerList().getPlayers())
|
||||
{
|
||||
getServer().getPlayerList().getWhitelist().remove(player.getProfile());
|
||||
}
|
||||
|
|
|
@ -30,9 +30,9 @@ public class ServerPing extends FreedomService
|
|||
return;
|
||||
}
|
||||
|
||||
if (ConfigEntry.STAFF_ONLY_MODE.getBoolean())
|
||||
if (ConfigEntry.ADMIN_ONLY_MODE.getBoolean())
|
||||
{
|
||||
event.setMotd(FUtil.colorize(ConfigEntry.SERVER_STAFFMODE_MOTD.getString()));
|
||||
event.setMotd(FUtil.colorize(ConfigEntry.SERVER_ADMINMODE_MOTD.getString()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -73,5 +73,4 @@ public class ServerPing extends FreedomService
|
|||
|
||||
event.setMotd(motd.toString().trim());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.command.Command_sit;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.spigotmc.event.entity.EntityDismountEvent;
|
||||
|
||||
public class Sitter extends FreedomService
|
||||
{
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDismount(EntityDismountEvent e)
|
||||
{
|
||||
Entity dm = e.getDismounted();
|
||||
if (dm instanceof ArmorStand)
|
||||
{
|
||||
if (Command_sit.STANDS.contains(dm))
|
||||
{
|
||||
Command_sit.STANDS.remove(dm);
|
||||
dm.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,6 +3,8 @@ package me.totalfreedom.totalfreedommod;
|
|||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
import me.totalfreedom.totalfreedommod.admin.ActivityLog;
|
||||
import me.totalfreedom.totalfreedommod.admin.AdminList;
|
||||
import me.totalfreedom.totalfreedommod.banning.BanManager;
|
||||
import me.totalfreedom.totalfreedommod.banning.IndefiniteBanList;
|
||||
import me.totalfreedom.totalfreedommod.blocking.BlockBlocker;
|
||||
|
@ -17,7 +19,6 @@ import me.totalfreedom.totalfreedommod.blocking.command.CommandBlocker;
|
|||
import me.totalfreedom.totalfreedommod.bridge.BukkitTelnetBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.CoreProtectBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.EssentialsBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.FAWEBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.LibsDisguisesBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.TFGuildsBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.WorldEditBridge;
|
||||
|
@ -27,7 +28,6 @@ import me.totalfreedom.totalfreedommod.command.CommandLoader;
|
|||
import me.totalfreedom.totalfreedommod.config.MainConfig;
|
||||
import me.totalfreedom.totalfreedommod.discord.Discord;
|
||||
import me.totalfreedom.totalfreedommod.freeze.Freezer;
|
||||
import me.totalfreedom.totalfreedommod.fun.CurseListener;
|
||||
import me.totalfreedom.totalfreedommod.fun.ItemFun;
|
||||
import me.totalfreedom.totalfreedommod.fun.Jumppads;
|
||||
import me.totalfreedom.totalfreedommod.fun.Landminer;
|
||||
|
@ -42,36 +42,30 @@ import me.totalfreedom.totalfreedommod.rank.RankManager;
|
|||
import me.totalfreedom.totalfreedommod.shop.Shop;
|
||||
import me.totalfreedom.totalfreedommod.shop.Votifier;
|
||||
import me.totalfreedom.totalfreedommod.sql.SQLite;
|
||||
import me.totalfreedom.totalfreedommod.staff.ActivityLog;
|
||||
import me.totalfreedom.totalfreedommod.staff.StaffList;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import me.totalfreedom.totalfreedommod.util.MethodTimer;
|
||||
import me.totalfreedom.totalfreedommod.world.CleanroomChunkGenerator;
|
||||
import me.totalfreedom.totalfreedommod.world.WorldManager;
|
||||
import me.totalfreedom.totalfreedommod.world.WorldRestrictions;
|
||||
import org.bstats.Metrics;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spigotmc.SpigotCommand;
|
||||
import org.spigotmc.SpigotConfig;
|
||||
|
||||
public class TotalFreedomMod extends JavaPlugin
|
||||
{
|
||||
private static TotalFreedomMod plugin;
|
||||
|
||||
public static TotalFreedomMod getPlugin()
|
||||
{
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public static final String CONFIG_FILENAME = "config.yml";
|
||||
//
|
||||
public static final BuildProperties build = new BuildProperties();
|
||||
//
|
||||
public static String pluginName;
|
||||
public static String pluginVersion;
|
||||
private static TotalFreedomMod plugin;
|
||||
//
|
||||
public MainConfig config;
|
||||
public PermissionConfig permissions;
|
||||
|
@ -82,10 +76,9 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
public CommandLoader cl;
|
||||
// Services
|
||||
public ServerInterface si;
|
||||
public SavedFlags sf;
|
||||
public WorldManager wm;
|
||||
public LogViewer lv;
|
||||
public StaffList sl;
|
||||
public AdminList al;
|
||||
public ActivityLog acl;
|
||||
public RankManager rm;
|
||||
public CommandBlocker cb;
|
||||
|
@ -108,7 +101,6 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
public BanManager bm;
|
||||
public IndefiniteBanList im;
|
||||
public PermissionManager pem;
|
||||
public Reddit rd;
|
||||
public GameRuleHandler gr;
|
||||
public CommandSpy cs;
|
||||
public Cager ca;
|
||||
|
@ -123,7 +115,6 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
public Monitors mo;
|
||||
public MovementValidator mv;
|
||||
public ServerPing sp;
|
||||
public CurseListener cul;
|
||||
public ItemFun it;
|
||||
public Landminer lm;
|
||||
public MP44 mp;
|
||||
|
@ -133,11 +124,8 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
public WorldRestrictions wr;
|
||||
public SignBlocker snp;
|
||||
public EntityWiper ew;
|
||||
public Sitter st;
|
||||
public VanishHandler vh;
|
||||
public AMP amp;
|
||||
|
||||
//public HubWorldRestrictions hwr;
|
||||
public Pterodactyl ptero;
|
||||
//
|
||||
// Bridges
|
||||
public BukkitTelnetBridge btb;
|
||||
|
@ -146,9 +134,25 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
public CoreProtectBridge cpb;
|
||||
public TFGuildsBridge tfg;
|
||||
public WorldEditBridge web;
|
||||
public FAWEBridge fab;
|
||||
public WorldGuardBridge wgb;
|
||||
|
||||
public static TotalFreedomMod getPlugin()
|
||||
{
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public static TotalFreedomMod plugin()
|
||||
{
|
||||
for (Plugin plugin : Bukkit.getPluginManager().getPlugins())
|
||||
{
|
||||
if (plugin.getName().equalsIgnoreCase(pluginName))
|
||||
{
|
||||
return (TotalFreedomMod)plugin;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad()
|
||||
{
|
||||
|
@ -182,7 +186,6 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
fsh = new FreedomServiceHandler();
|
||||
|
||||
config = new MainConfig();
|
||||
config.load();
|
||||
|
||||
if (FUtil.inDeveloperMode())
|
||||
{
|
||||
|
@ -195,81 +198,13 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
BackupManager backups = new BackupManager();
|
||||
backups.createAllBackups();
|
||||
|
||||
permissions = new PermissionConfig(this);
|
||||
permissions = new PermissionConfig();
|
||||
permissions.load();
|
||||
|
||||
// Start services
|
||||
si = new ServerInterface();
|
||||
sf = new SavedFlags();
|
||||
wm = new WorldManager();
|
||||
lv = new LogViewer();
|
||||
sql = new SQLite();
|
||||
sl = new StaffList();
|
||||
acl = new ActivityLog();
|
||||
rm = new RankManager();
|
||||
cb = new CommandBlocker();
|
||||
eb = new EventBlocker();
|
||||
bb = new BlockBlocker();
|
||||
mb = new MobBlocker();
|
||||
ib = new InteractBlocker();
|
||||
pb = new PotionBlocker();
|
||||
lp = new LoginProcess();
|
||||
nu = new AntiNuke();
|
||||
as = new AntiSpam();
|
||||
wr = new WorldRestrictions();
|
||||
pl = new PlayerList();
|
||||
sh = new Shop();
|
||||
vo = new Votifier();
|
||||
an = new Announcer();
|
||||
cm = new ChatManager();
|
||||
dc = new Discord();
|
||||
pul = new PunishmentList();
|
||||
bm = new BanManager();
|
||||
im = new IndefiniteBanList();
|
||||
pem = new PermissionManager();
|
||||
rd = new Reddit();
|
||||
gr = new GameRuleHandler();
|
||||
snp = new SignBlocker();
|
||||
ew = new EntityWiper();
|
||||
st = new Sitter();
|
||||
vh = new VanishHandler();
|
||||
amp = new AMP();
|
||||
|
||||
// Single admin utils
|
||||
cs = new CommandSpy();
|
||||
ca = new Cager();
|
||||
fm = new Freezer();
|
||||
or = new Orbiter();
|
||||
mu = new Muter();
|
||||
ebl = new EditBlocker();
|
||||
pbl = new PVPBlocker();
|
||||
fo = new Fuckoff();
|
||||
ak = new AutoKick();
|
||||
ae = new AutoEject();
|
||||
mo = new Monitors();
|
||||
|
||||
mv = new MovementValidator();
|
||||
sp = new ServerPing();
|
||||
|
||||
// Fun
|
||||
cul = new CurseListener();
|
||||
it = new ItemFun();
|
||||
lm = new Landminer();
|
||||
mp = new MP44();
|
||||
jp = new Jumppads();
|
||||
tr = new Trailer();
|
||||
// HTTPD
|
||||
hd = new HTTPDaemon();
|
||||
|
||||
// Start bridges
|
||||
btb = new BukkitTelnetBridge();
|
||||
cpb = new CoreProtectBridge();
|
||||
esb = new EssentialsBridge();
|
||||
ldb = new LibsDisguisesBridge();
|
||||
tfg = new TFGuildsBridge();
|
||||
web = new WorldEditBridge();
|
||||
fab = new FAWEBridge();
|
||||
wgb = new WorldGuardBridge();
|
||||
new Initializer();
|
||||
|
||||
fsh.startServices();
|
||||
|
||||
|
@ -281,8 +216,8 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
// Metrics @ https://bstats.org/plugin/bukkit/TotalFreedomMod/2966
|
||||
new Metrics(this, 2966);
|
||||
|
||||
// little workaround to stop spigot from autorestarting - causing AMP to detach from process.
|
||||
SpigotConfig.config.set("settings.restart-on-crash", false);
|
||||
// Revert AMP changes
|
||||
SpigotConfig.config.set("settings.restart-on-crash", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -296,6 +231,12 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
FLog.info("Plugin disabled");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkGenerator getDefaultWorldGenerator(@NotNull String worldName, String id)
|
||||
{
|
||||
return new CleanroomChunkGenerator(id);
|
||||
}
|
||||
|
||||
public static class BuildProperties
|
||||
{
|
||||
public String author;
|
||||
|
@ -323,7 +264,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
number = props.getProperty("buildNumber", "1");
|
||||
date = props.getProperty("buildDate", "unknown");
|
||||
// Need to do this or it will display ${git.commit.id.abbrev}
|
||||
head = props.getProperty("buildHead", "unknown").replace("${git.commit.id.abbrev}", "unknown");
|
||||
head = props.getProperty("buildHead", "unknown");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -338,21 +279,99 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
}
|
||||
}
|
||||
|
||||
public static TotalFreedomMod plugin()
|
||||
/**
|
||||
* This class is provided to please Codacy.
|
||||
*/
|
||||
private final class Initializer
|
||||
{
|
||||
for (Plugin plugin : Bukkit.getPluginManager().getPlugins())
|
||||
public Initializer()
|
||||
{
|
||||
if (plugin.getName().equalsIgnoreCase(pluginName))
|
||||
{
|
||||
return (TotalFreedomMod)plugin;
|
||||
}
|
||||
initServices();
|
||||
initAdminUtils();
|
||||
initBridges();
|
||||
initFun();
|
||||
initHTTPD();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id)
|
||||
{
|
||||
return new CleanroomChunkGenerator(id);
|
||||
private void initServices()
|
||||
{
|
||||
// Start services
|
||||
si = new ServerInterface();
|
||||
wm = new WorldManager();
|
||||
lv = new LogViewer();
|
||||
sql = new SQLite();
|
||||
al = new AdminList();
|
||||
acl = new ActivityLog();
|
||||
rm = new RankManager();
|
||||
cb = new CommandBlocker();
|
||||
eb = new EventBlocker();
|
||||
bb = new BlockBlocker();
|
||||
mb = new MobBlocker();
|
||||
ib = new InteractBlocker();
|
||||
pb = new PotionBlocker();
|
||||
lp = new LoginProcess();
|
||||
nu = new AntiNuke();
|
||||
as = new AntiSpam();
|
||||
wr = new WorldRestrictions();
|
||||
pl = new PlayerList();
|
||||
sh = new Shop();
|
||||
vo = new Votifier();
|
||||
an = new Announcer();
|
||||
cm = new ChatManager();
|
||||
dc = new Discord();
|
||||
pul = new PunishmentList();
|
||||
bm = new BanManager();
|
||||
im = new IndefiniteBanList();
|
||||
pem = new PermissionManager();
|
||||
gr = new GameRuleHandler();
|
||||
snp = new SignBlocker();
|
||||
ew = new EntityWiper();
|
||||
vh = new VanishHandler();
|
||||
//ptero = new Pterodactyl();
|
||||
}
|
||||
|
||||
private void initAdminUtils()
|
||||
{
|
||||
// Single admin utils
|
||||
cs = new CommandSpy();
|
||||
ca = new Cager();
|
||||
fm = new Freezer();
|
||||
or = new Orbiter();
|
||||
mu = new Muter();
|
||||
ebl = new EditBlocker();
|
||||
pbl = new PVPBlocker();
|
||||
fo = new Fuckoff();
|
||||
ak = new AutoKick();
|
||||
ae = new AutoEject();
|
||||
mo = new Monitors();
|
||||
}
|
||||
|
||||
private void initBridges()
|
||||
{
|
||||
// Start bridges
|
||||
btb = new BukkitTelnetBridge();
|
||||
cpb = new CoreProtectBridge();
|
||||
esb = new EssentialsBridge();
|
||||
ldb = new LibsDisguisesBridge();
|
||||
tfg = new TFGuildsBridge();
|
||||
web = new WorldEditBridge();
|
||||
wgb = new WorldGuardBridge();
|
||||
}
|
||||
|
||||
private void initFun()
|
||||
{
|
||||
// Fun
|
||||
it = new ItemFun();
|
||||
lm = new Landminer();
|
||||
mp = new MP44();
|
||||
jp = new Jumppads();
|
||||
tr = new Trailer();
|
||||
}
|
||||
|
||||
private void initHTTPD()
|
||||
{
|
||||
// HTTPD
|
||||
hd = new HTTPDaemon();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,7 +31,7 @@ public class VanishHandler extends FreedomService
|
|||
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (!plugin.sl.isStaff(player) && plugin.sl.isVanished(p.getName()))
|
||||
if (!plugin.al.isAdmin(player) && plugin.al.isVanished(p.getName()))
|
||||
{
|
||||
player.hidePlayer(plugin, p);
|
||||
}
|
||||
|
@ -39,17 +39,17 @@ public class VanishHandler extends FreedomService
|
|||
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (!plugin.sl.isStaff(p) && plugin.sl.isVanished(player.getName()))
|
||||
if (!plugin.al.isAdmin(p) && plugin.al.isVanished(player.getName()))
|
||||
{
|
||||
p.hidePlayer(plugin, player);
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.sl.isVanished(player.getName()))
|
||||
if (plugin.al.isVanished(player.getName()))
|
||||
{
|
||||
plugin.esb.setVanished(player.getName(), true);
|
||||
FLog.info(player.getName() + " joined while still vanished.");
|
||||
plugin.sl.messageAllStaff(ChatColor.YELLOW + player.getName() + " has joined silently.");
|
||||
plugin.al.messageAllAdmins(ChatColor.YELLOW + player.getName() + " has joined silently.");
|
||||
event.setJoinMessage(null);
|
||||
|
||||
new BukkitRunnable()
|
||||
|
@ -57,7 +57,7 @@ public class VanishHandler extends FreedomService
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (!plugin.sl.isVanished(player.getName()))
|
||||
if (!plugin.al.isVanished(player.getName()))
|
||||
{
|
||||
this.cancel();
|
||||
}
|
||||
|
@ -73,11 +73,11 @@ public class VanishHandler extends FreedomService
|
|||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (plugin.sl.isVanished(player.getName()))
|
||||
if (plugin.al.isVanished(player.getName()))
|
||||
{
|
||||
event.setQuitMessage(null);
|
||||
FLog.info(player.getName() + " left while still vanished.");
|
||||
plugin.sl.messageAllStaff(ChatColor.YELLOW + player.getName() + " has left silently.");
|
||||
plugin.al.messageAllAdmins(ChatColor.YELLOW + player.getName() + " has left silently.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +1,7 @@
|
|||
package me.totalfreedom.totalfreedommod.staff;
|
||||
package me.totalfreedom.totalfreedommod.admin;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import java.util.Map;
|
||||
import lombok.Getter;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.config.YamlConfig;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
|
@ -20,7 +19,6 @@ public class ActivityLog extends FreedomService
|
|||
|
||||
public static final String FILENAME = "activitylog.yml";
|
||||
|
||||
@Getter
|
||||
private final Map<String, ActivityLogEntry> allActivityLogs = Maps.newHashMap();
|
||||
private final Map<String, ActivityLogEntry> nameTable = Maps.newHashMap();
|
||||
private final Map<String, ActivityLogEntry> ipTable = Maps.newHashMap();
|
||||
|
@ -32,6 +30,11 @@ public class ActivityLog extends FreedomService
|
|||
this.config = new YamlConfig(plugin, FILENAME, true);
|
||||
}
|
||||
|
||||
public static String getFILENAME()
|
||||
{
|
||||
return FILENAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
|
@ -56,7 +59,7 @@ public class ActivityLog extends FreedomService
|
|||
ConfigurationSection section = config.getConfigurationSection(key);
|
||||
if (section == null)
|
||||
{
|
||||
logger.warning("Invalid activity log format: " + key);
|
||||
FLog.warning("Invalid activity log format: " + key);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -111,10 +114,10 @@ public class ActivityLog extends FreedomService
|
|||
activityLog = getEntryByIp(ip);
|
||||
if (activityLog != null)
|
||||
{
|
||||
// Set the new username
|
||||
activityLog.setName(player.getName());
|
||||
save();
|
||||
updateTables();
|
||||
// Set the new username
|
||||
activityLog.setName(player.getName());
|
||||
save();
|
||||
updateTables();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -167,7 +170,7 @@ public class ActivityLog extends FreedomService
|
|||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
if (plugin.sl.isStaff(player))
|
||||
if (plugin.al.isAdmin(player))
|
||||
{
|
||||
getActivityLog(event.getPlayer()).addLogin();
|
||||
plugin.acl.save();
|
||||
|
@ -179,11 +182,31 @@ public class ActivityLog extends FreedomService
|
|||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
if (plugin.sl.isStaff(player))
|
||||
if (plugin.al.isAdmin(player))
|
||||
{
|
||||
getActivityLog(event.getPlayer()).addLogout();
|
||||
plugin.acl.save();
|
||||
plugin.acl.updateTables();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, ActivityLogEntry> getAllActivityLogs()
|
||||
{
|
||||
return allActivityLogs;
|
||||
}
|
||||
|
||||
public Map<String, ActivityLogEntry> getNameTable()
|
||||
{
|
||||
return nameTable;
|
||||
}
|
||||
|
||||
public Map<String, ActivityLogEntry> getIpTable()
|
||||
{
|
||||
return ipTable;
|
||||
}
|
||||
|
||||
public YamlConfig getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
}
|
|
@ -1,11 +1,9 @@
|
|||
package me.totalfreedom.totalfreedommod.staff;
|
||||
package me.totalfreedom.totalfreedommod.admin;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import java.time.Instant;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.totalfreedom.totalfreedommod.config.IConfig;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
@ -15,21 +13,12 @@ import org.bukkit.entity.Player;
|
|||
public class ActivityLogEntry implements IConfig
|
||||
{
|
||||
|
||||
@Getter
|
||||
private String configKey;
|
||||
@Getter
|
||||
@Setter
|
||||
private String name;
|
||||
@Getter
|
||||
private final List<String> ips = Lists.newArrayList();
|
||||
@Getter
|
||||
@Setter
|
||||
private List<String> timestamps = Lists.newArrayList();
|
||||
@Getter
|
||||
@Setter
|
||||
private List<String> durations = Lists.newArrayList();
|
||||
|
||||
public static final String FILENAME = "activitylog.yml";
|
||||
private final List<String> ips = Lists.newArrayList();
|
||||
private final List<String> timestamps = Lists.newArrayList();
|
||||
private final List<String> durations = Lists.newArrayList();
|
||||
private String configKey;
|
||||
private String name;
|
||||
|
||||
public ActivityLogEntry(Player player)
|
||||
{
|
||||
|
@ -42,6 +31,11 @@ public class ActivityLogEntry implements IConfig
|
|||
this.configKey = configKey;
|
||||
}
|
||||
|
||||
public static String getFILENAME()
|
||||
{
|
||||
return FILENAME;
|
||||
}
|
||||
|
||||
public void loadFrom(Player player)
|
||||
{
|
||||
configKey = player.getName().toLowerCase();
|
||||
|
@ -75,9 +69,19 @@ public class ActivityLogEntry implements IConfig
|
|||
Date currentTime = Date.from(Instant.now());
|
||||
timestamps.add("Login: " + FUtil.dateToString(currentTime));
|
||||
}
|
||||
|
||||
public void addLogout()
|
||||
{
|
||||
String lastLoginString = timestamps.get(timestamps.size() - 1);
|
||||
// Fix of Array index out of bonds issue: FS-131
|
||||
String lastLoginString;
|
||||
if (timestamps.size() > 1)
|
||||
{
|
||||
lastLoginString = timestamps.get(timestamps.size() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
lastLoginString = timestamps.get(0);
|
||||
}
|
||||
Date currentTime = Date.from(Instant.now());
|
||||
timestamps.add("Logout: " + FUtil.dateToString(currentTime));
|
||||
lastLoginString = lastLoginString.replace("Login: ", "");
|
||||
|
@ -108,10 +112,7 @@ public class ActivityLogEntry implements IConfig
|
|||
|
||||
public void removeIp(String ip)
|
||||
{
|
||||
if (ips.contains(ip))
|
||||
{
|
||||
ips.remove(ip);
|
||||
}
|
||||
ips.remove(ip);
|
||||
}
|
||||
|
||||
public void clearIPs()
|
||||
|
@ -138,4 +139,39 @@ public class ActivityLogEntry implements IConfig
|
|||
return configKey != null
|
||||
&& name != null;
|
||||
}
|
||||
|
||||
public String getConfigKey()
|
||||
{
|
||||
return configKey;
|
||||
}
|
||||
|
||||
public void setConfigKey(String configKey)
|
||||
{
|
||||
this.configKey = configKey;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<String> getIps()
|
||||
{
|
||||
return ips;
|
||||
}
|
||||
|
||||
public List<String> getTimestamps()
|
||||
{
|
||||
return timestamps;
|
||||
}
|
||||
|
||||
public List<String> getDurations()
|
||||
{
|
||||
return durations;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package me.totalfreedom.totalfreedommod.staff;
|
||||
package me.totalfreedom.totalfreedommod.admin;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
@ -7,55 +7,36 @@ import java.util.Date;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.totalfreedom.totalfreedommod.LogViewer.LogsRegistrationMode;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class StaffMember
|
||||
public class Admin
|
||||
{
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private String name;
|
||||
@Getter
|
||||
private boolean active = true;
|
||||
@Getter
|
||||
@Setter
|
||||
private Rank rank = Rank.TRIAL_MOD;
|
||||
@Getter
|
||||
private final List<String> ips = new ArrayList<>();
|
||||
@Getter
|
||||
@Setter
|
||||
private Date lastLogin = new Date();
|
||||
@Getter
|
||||
@Setter
|
||||
private String loginMessage = null;
|
||||
@Getter
|
||||
@Setter
|
||||
private Boolean commandSpy = false;
|
||||
@Getter
|
||||
@Setter
|
||||
private Boolean potionSpy = false;
|
||||
@Getter
|
||||
@Setter
|
||||
private String acFormat = null;
|
||||
@Getter
|
||||
@Setter
|
||||
private String ampUsername = null;
|
||||
|
||||
public StaffMember(Player player)
|
||||
private final List<String> ips = new ArrayList<>();
|
||||
private String name;
|
||||
private boolean active = true;
|
||||
private Rank rank = Rank.ADMIN;
|
||||
private Date lastLogin = new Date();
|
||||
private Boolean commandSpy = false;
|
||||
private Boolean potionSpy = false;
|
||||
private String acFormat = null;
|
||||
private String pteroID = null;
|
||||
|
||||
public Admin(Player player)
|
||||
{
|
||||
this.name = player.getName();
|
||||
this.ips.add(FUtil.getIp(player));
|
||||
}
|
||||
|
||||
public StaffMember(ResultSet resultSet)
|
||||
public Admin(ResultSet resultSet)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -65,15 +46,14 @@ public class StaffMember
|
|||
this.ips.clear();
|
||||
this.ips.addAll(FUtil.stringToList(resultSet.getString("ips")));
|
||||
this.lastLogin = new Date(resultSet.getLong("last_login"));
|
||||
this.loginMessage = resultSet.getString("login_message");
|
||||
this.commandSpy = resultSet.getBoolean("command_spy");
|
||||
this.potionSpy = resultSet.getBoolean("potion_spy");
|
||||
this.acFormat = resultSet.getString("ac_format");
|
||||
this.ampUsername = resultSet.getString("amp_username");
|
||||
this.pteroID = resultSet.getString("ptero_id");
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
FLog.severe("Failed to load staff: " + e.getMessage());
|
||||
FLog.severe("Failed to load admin: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,15 +62,14 @@ public class StaffMember
|
|||
{
|
||||
final StringBuilder output = new StringBuilder();
|
||||
|
||||
output.append("Staff: ").append(name).append("\n")
|
||||
output.append("Admin: ").append(name).append("\n")
|
||||
.append("- IPs: ").append(StringUtils.join(ips, ", ")).append("\n")
|
||||
.append("- Last Login: ").append(FUtil.dateToString(lastLogin)).append("\n")
|
||||
.append("- Custom Login Message: ").append(loginMessage).append("\n")
|
||||
.append("- Rank: ").append(rank.getName()).append("\n")
|
||||
.append("- Is Active: ").append(active).append("\n")
|
||||
.append("- Potion Spy: ").append(potionSpy).append("\n")
|
||||
.append("- Admin Chat Format: ").append(acFormat).append("\n")
|
||||
.append("- AMP Username: ").append(ampUsername).append("\n");
|
||||
.append("- Pterodactyl ID: ").append(pteroID).append("\n");
|
||||
|
||||
return output.toString();
|
||||
}
|
||||
|
@ -104,20 +83,14 @@ public class StaffMember
|
|||
put("rank", rank.toString());
|
||||
put("ips", FUtil.listToString(ips));
|
||||
put("last_login", lastLogin.getTime());
|
||||
put("login_message", loginMessage);
|
||||
put("command_spy", commandSpy);
|
||||
put("potion_spy", potionSpy);
|
||||
put("ac_format", acFormat);
|
||||
put("amp_username", ampUsername);
|
||||
put("ptero_id", pteroID);
|
||||
}};
|
||||
return map;
|
||||
}
|
||||
|
||||
public boolean hasLoginMessage()
|
||||
{
|
||||
return loginMessage != null && !loginMessage.isEmpty();
|
||||
}
|
||||
|
||||
// Util IP methods
|
||||
public void addIp(String ip)
|
||||
{
|
||||
|
@ -137,10 +110,7 @@ public class StaffMember
|
|||
|
||||
public void removeIp(String ip)
|
||||
{
|
||||
if (ips.contains(ip))
|
||||
{
|
||||
ips.remove(ip);
|
||||
}
|
||||
ips.remove(ip);
|
||||
}
|
||||
|
||||
public void clearIPs()
|
||||
|
@ -148,15 +118,45 @@ public class StaffMember
|
|||
ips.clear();
|
||||
}
|
||||
|
||||
public boolean isValid()
|
||||
{
|
||||
return name != null
|
||||
&& rank != null
|
||||
&& !ips.isEmpty()
|
||||
&& lastLogin != null;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean isActive()
|
||||
{
|
||||
return active;
|
||||
}
|
||||
|
||||
public void setActive(boolean active)
|
||||
{
|
||||
this.active = active;
|
||||
|
||||
final TotalFreedomMod plugin = TotalFreedomMod.plugin();
|
||||
final TotalFreedomMod plugin = TotalFreedomMod.getPlugin();
|
||||
|
||||
// Avoiding stupid NPE compiler warnings
|
||||
if (plugin == null)
|
||||
{
|
||||
Bukkit.getLogger().severe("The plugin is null!! This is a major issue and WILL break the plugin!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!active)
|
||||
{
|
||||
if (getRank().isAtLeast(Rank.MOD))
|
||||
if (getRank().isAtLeast(Rank.ADMIN))
|
||||
{
|
||||
if (plugin.btb != null)
|
||||
{
|
||||
|
@ -168,11 +168,68 @@ public class StaffMember
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isValid()
|
||||
public Rank getRank()
|
||||
{
|
||||
return name != null
|
||||
&& rank != null
|
||||
&& !ips.isEmpty()
|
||||
&& lastLogin != null;
|
||||
return rank;
|
||||
}
|
||||
|
||||
public void setRank(Rank rank)
|
||||
{
|
||||
this.rank = rank;
|
||||
}
|
||||
|
||||
public List<String> getIps()
|
||||
{
|
||||
return ips;
|
||||
}
|
||||
|
||||
public Date getLastLogin()
|
||||
{
|
||||
return lastLogin;
|
||||
}
|
||||
|
||||
public void setLastLogin(Date lastLogin)
|
||||
{
|
||||
this.lastLogin = lastLogin;
|
||||
}
|
||||
|
||||
public Boolean getCommandSpy()
|
||||
{
|
||||
return commandSpy;
|
||||
}
|
||||
|
||||
public void setCommandSpy(Boolean commandSpy)
|
||||
{
|
||||
this.commandSpy = commandSpy;
|
||||
}
|
||||
|
||||
public Boolean getPotionSpy()
|
||||
{
|
||||
return potionSpy;
|
||||
}
|
||||
|
||||
public void setPotionSpy(Boolean potionSpy)
|
||||
{
|
||||
this.potionSpy = potionSpy;
|
||||
}
|
||||
|
||||
public String getAcFormat()
|
||||
{
|
||||
return acFormat;
|
||||
}
|
||||
|
||||
public void setAcFormat(String acFormat)
|
||||
{
|
||||
this.acFormat = acFormat;
|
||||
}
|
||||
|
||||
public String getPteroID()
|
||||
{
|
||||
return pteroID;
|
||||
}
|
||||
|
||||
public void setPteroID(String pteroID)
|
||||
{
|
||||
this.pteroID = pteroID;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,409 @@
|
|||
package me.totalfreedom.totalfreedommod.admin;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class AdminList extends FreedomService
|
||||
{
|
||||
public static final List<String> vanished = new ArrayList<>();
|
||||
public final Map<String, List<String>> verifiedNoAdmin = Maps.newHashMap();
|
||||
private final Set<Admin> allAdmins = Sets.newHashSet(); // Includes disabled admins
|
||||
// Only active admins below
|
||||
private final Set<Admin> activeAdmins = Sets.newHashSet();
|
||||
private final Map<String, Admin> nameTable = Maps.newHashMap();
|
||||
private final Map<String, Admin> ipTable = Maps.newHashMap();
|
||||
|
||||
public static List<String> getVanished()
|
||||
{
|
||||
return vanished;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
load();
|
||||
deactivateOldEntries(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
}
|
||||
|
||||
public void load()
|
||||
{
|
||||
allAdmins.clear();
|
||||
try
|
||||
{
|
||||
ResultSet adminSet = plugin.sql.getAdminList();
|
||||
{
|
||||
while (adminSet.next())
|
||||
{
|
||||
Admin admin = new Admin(adminSet);
|
||||
allAdmins.add(admin);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
FLog.severe("Failed to load admin list: " + e.getMessage());
|
||||
}
|
||||
|
||||
updateTables();
|
||||
FLog.info("Loaded " + allAdmins.size() + " admins (" + nameTable.size() + " active, " + ipTable.size() + " IPs)");
|
||||
}
|
||||
|
||||
public void messageAllAdmins(String message)
|
||||
{
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (isAdmin(player))
|
||||
{
|
||||
player.sendMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void potionSpyMessage(String message)
|
||||
{
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
Admin admin = getAdmin(player.getPlayer());
|
||||
if (isAdmin(player) && admin.getPotionSpy())
|
||||
{
|
||||
player.sendMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized boolean isAdminSync(CommandSender sender)
|
||||
{
|
||||
return isAdmin(sender);
|
||||
}
|
||||
|
||||
public List<String> getActiveAdminNames()
|
||||
{
|
||||
List<String> names = new ArrayList();
|
||||
for (Admin admin : activeAdmins)
|
||||
{
|
||||
names.add(admin.getName());
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
public boolean isAdmin(CommandSender sender)
|
||||
{
|
||||
if (!(sender instanceof Player))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Admin admin = getAdmin((Player)sender);
|
||||
|
||||
return admin != null && admin.isActive();
|
||||
}
|
||||
|
||||
public boolean isAdmin(Player player)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Admin admin = getAdmin(player);
|
||||
|
||||
return admin != null && admin.isActive();
|
||||
}
|
||||
|
||||
public boolean isSeniorAdmin(CommandSender sender)
|
||||
{
|
||||
Admin admin = getAdmin(sender);
|
||||
if (admin == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return admin.getRank().ordinal() >= Rank.SENIOR_ADMIN.ordinal();
|
||||
}
|
||||
|
||||
public Admin getAdmin(CommandSender sender)
|
||||
{
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
return getAdmin((Player)sender);
|
||||
}
|
||||
|
||||
return getEntryByName(sender.getName());
|
||||
}
|
||||
|
||||
public Admin getAdmin(Player player)
|
||||
{
|
||||
// Find admin
|
||||
String ip = FUtil.getIp(player);
|
||||
Admin admin = getEntryByName(player.getName());
|
||||
|
||||
// Admin by name
|
||||
if (admin != null)
|
||||
{
|
||||
// Check if we're in online mode,
|
||||
// Or the players IP is in the admin entry
|
||||
if (Bukkit.getOnlineMode() || admin.getIps().contains(ip))
|
||||
{
|
||||
if (!admin.getIps().contains(ip))
|
||||
{
|
||||
// Add the new IP if we have to
|
||||
admin.addIp(ip);
|
||||
save(admin);
|
||||
updateTables();
|
||||
}
|
||||
return admin;
|
||||
}
|
||||
}
|
||||
|
||||
// Admin by ip
|
||||
admin = getEntryByIp(ip);
|
||||
if (admin != null)
|
||||
{
|
||||
// Set the new username
|
||||
String oldName = admin.getName();
|
||||
admin.setName(player.getName());
|
||||
plugin.sql.updateAdminName(oldName, admin.getName());
|
||||
updateTables();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Admin getEntryByName(String name)
|
||||
{
|
||||
return nameTable.get(name.toLowerCase());
|
||||
}
|
||||
|
||||
public Admin getEntryByIp(String ip)
|
||||
{
|
||||
return ipTable.get(ip);
|
||||
}
|
||||
|
||||
public Admin getEntryByIpFuzzy(String needleIp)
|
||||
{
|
||||
final Admin directAdmin = getEntryByIp(needleIp);
|
||||
if (directAdmin != null)
|
||||
{
|
||||
return directAdmin;
|
||||
}
|
||||
|
||||
for (String ip : ipTable.keySet())
|
||||
{
|
||||
if (FUtil.fuzzyIpMatch(needleIp, ip, 3))
|
||||
{
|
||||
return ipTable.get(ip);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void updateLastLogin(Player player)
|
||||
{
|
||||
final Admin admin = getAdmin(player);
|
||||
if (admin == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
admin.setLastLogin(new Date());
|
||||
admin.setName(player.getName());
|
||||
save(admin);
|
||||
}
|
||||
|
||||
public boolean isAdminImpostor(Player player)
|
||||
{
|
||||
return getEntryByName(player.getName()) != null && !isAdmin(player) && !isVerifiedAdmin(player);
|
||||
}
|
||||
|
||||
public boolean isVerifiedAdmin(Player player)
|
||||
{
|
||||
return verifiedNoAdmin.containsKey(player.getName()) && verifiedNoAdmin.get(player.getName()).contains(FUtil.getIp(player));
|
||||
}
|
||||
|
||||
public boolean isIdentityMatched(Player player)
|
||||
{
|
||||
if (Bukkit.getOnlineMode())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Admin admin = getAdmin(player);
|
||||
return admin != null && admin.getName().equalsIgnoreCase(player.getName());
|
||||
}
|
||||
|
||||
public boolean addAdmin(Admin admin)
|
||||
{
|
||||
if (!admin.isValid())
|
||||
{
|
||||
FLog.warning("Could not add admin: " + admin.getName() + ". Admin is missing details!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Store admin, update views
|
||||
allAdmins.add(admin);
|
||||
updateTables();
|
||||
|
||||
// Save admin
|
||||
plugin.sql.addAdmin(admin);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean removeAdmin(Admin admin)
|
||||
{
|
||||
if (admin.getRank().isAtLeast(Rank.ADMIN))
|
||||
{
|
||||
if (plugin.btb != null)
|
||||
{
|
||||
plugin.btb.killTelnetSessions(admin.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// Remove admin, update views
|
||||
if (!allAdmins.remove(admin))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
updateTables();
|
||||
|
||||
// Unsave admin
|
||||
plugin.sql.removeAdmin(admin);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateTables()
|
||||
{
|
||||
activeAdmins.clear();
|
||||
nameTable.clear();
|
||||
ipTable.clear();
|
||||
|
||||
for (Admin admin : allAdmins)
|
||||
{
|
||||
if (!admin.isActive())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeAdmins.add(admin);
|
||||
nameTable.put(admin.getName().toLowerCase(), admin);
|
||||
|
||||
for (String ip : admin.getIps())
|
||||
{
|
||||
ipTable.put(ip, admin);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Set<String> getAdminNames()
|
||||
{
|
||||
return nameTable.keySet();
|
||||
}
|
||||
|
||||
public Set<String> getAdminIps()
|
||||
{
|
||||
return ipTable.keySet();
|
||||
}
|
||||
|
||||
public void save(Admin admin)
|
||||
{
|
||||
try
|
||||
{
|
||||
ResultSet currentSave = plugin.sql.getAdminByName(admin.getName());
|
||||
for (Map.Entry<String, Object> entry : admin.toSQLStorable().entrySet())
|
||||
{
|
||||
Object storedValue = plugin.sql.getValue(currentSave, entry.getKey(), entry.getValue());
|
||||
if (storedValue != null && !storedValue.equals(entry.getValue()) || storedValue == null && entry.getValue() != null || entry.getValue() == null)
|
||||
{
|
||||
plugin.sql.setAdminValue(admin, entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
FLog.severe("Failed to save admin: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void deactivateOldEntries(boolean verbose)
|
||||
{
|
||||
for (Admin admin : allAdmins)
|
||||
{
|
||||
if (!admin.isActive() || admin.getRank().isAtLeast(Rank.SENIOR_ADMIN))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Date lastLogin = admin.getLastLogin();
|
||||
final long lastLoginHours = TimeUnit.HOURS.convert(new Date().getTime() - lastLogin.getTime(), TimeUnit.MILLISECONDS);
|
||||
|
||||
if (lastLoginHours < ConfigEntry.ADMINLIST_CLEAN_THESHOLD_HOURS.getInteger())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
FUtil.adminAction("TotalFreedomMod", "Deactivating admin " + admin.getName() + ", inactive for " + lastLoginHours + " hours", true);
|
||||
}
|
||||
|
||||
admin.setActive(false);
|
||||
save(admin);
|
||||
}
|
||||
|
||||
updateTables();
|
||||
}
|
||||
|
||||
public boolean isVanished(String player)
|
||||
{
|
||||
return vanished.contains(player);
|
||||
}
|
||||
|
||||
public Set<Admin> getAllAdmins()
|
||||
{
|
||||
return allAdmins;
|
||||
}
|
||||
|
||||
public Set<Admin> getActiveAdmins()
|
||||
{
|
||||
return activeAdmins;
|
||||
}
|
||||
|
||||
public Map<String, Admin> getNameTable()
|
||||
{
|
||||
return nameTable;
|
||||
}
|
||||
|
||||
public Map<String, Admin> getIpTable()
|
||||
{
|
||||
return ipTable;
|
||||
}
|
||||
|
||||
public Map<String, List<String>> getVerifiedNoAdmin()
|
||||
{
|
||||
return verifiedNoAdmin;
|
||||
}
|
||||
}
|
|
@ -4,15 +4,12 @@ import com.google.common.collect.Lists;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -22,27 +19,19 @@ import org.bukkit.entity.Player;
|
|||
public class Ban
|
||||
{
|
||||
|
||||
public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private String username = null;
|
||||
@Getter
|
||||
@Setter
|
||||
private UUID uuid = null;
|
||||
@Getter
|
||||
public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
|
||||
private final List<String> ips = Lists.newArrayList();
|
||||
@Getter
|
||||
@Setter
|
||||
private String username = null;
|
||||
private UUID uuid = null;
|
||||
private String by = null;
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
|
||||
private Date at = null;
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
|
||||
private String reason = null; // Unformatted, &[0-9,a-f] instead of ChatColor
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
|
||||
private long expiryUnix = -1;
|
||||
|
||||
public Ban()
|
||||
|
@ -53,7 +42,7 @@ public class Ban
|
|||
{
|
||||
this(username,
|
||||
uuid,
|
||||
Arrays.asList(ip),
|
||||
Collections.singletonList(ip),
|
||||
by,
|
||||
at,
|
||||
expire,
|
||||
|
@ -71,6 +60,10 @@ public class Ban
|
|||
dedupeIps();
|
||||
this.by = by;
|
||||
this.at = at;
|
||||
if (expire == null)
|
||||
{
|
||||
expire = FUtil.parseDateOffset("24h");
|
||||
}
|
||||
this.expiryUnix = FUtil.getUnixTime(expire);
|
||||
this.reason = reason;
|
||||
}
|
||||
|
@ -84,7 +77,7 @@ public class Ban
|
|||
|
||||
public static Ban forPlayerIp(Player player, CommandSender by, Date expiry, String reason)
|
||||
{
|
||||
return new Ban(null, null, Arrays.asList(FUtil.getIp(player)), by.getName(), Date.from(Instant.now()), expiry, reason);
|
||||
return new Ban(null, null, Collections.singletonList(FUtil.getIp(player)), by.getName(), Date.from(Instant.now()), expiry, reason);
|
||||
}
|
||||
|
||||
public static Ban forPlayerIp(String ip, CommandSender by, Date expiry, String reason)
|
||||
|
@ -139,6 +132,11 @@ public class Ban
|
|||
reason);
|
||||
}
|
||||
|
||||
public static SimpleDateFormat getDateFormat()
|
||||
{
|
||||
return DATE_FORMAT;
|
||||
}
|
||||
|
||||
public boolean hasUsername()
|
||||
{
|
||||
return username != null && !username.isEmpty();
|
||||
|
@ -171,7 +169,7 @@ public class Ban
|
|||
|
||||
public boolean isExpired()
|
||||
{
|
||||
return hasExpiry() && expiryUnix < FUtil.getUnixTime();
|
||||
return hasExpiry() && FUtil.getUnixDate(expiryUnix).before(new Date(FUtil.getUnixTime()));
|
||||
}
|
||||
|
||||
public String bakeKickMessage()
|
||||
|
@ -252,17 +250,74 @@ public class Ban
|
|||
|
||||
private void dedupeIps()
|
||||
{
|
||||
|
||||
Set<String> uniqueIps = new HashSet<>();
|
||||
|
||||
Iterator<String> it = ips.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
if (!uniqueIps.add(it.next()))
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
//Fancy Collections.removeIf lets you do all that while loop work in one lambda.
|
||||
ips.removeIf(s -> !uniqueIps.add(s));
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getIps()
|
||||
{
|
||||
return ips;
|
||||
}
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username)
|
||||
{
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public UUID getUuid()
|
||||
{
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(UUID uuid)
|
||||
{
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getBy()
|
||||
{
|
||||
return by;
|
||||
}
|
||||
|
||||
public void setBy(String by)
|
||||
{
|
||||
this.by = by;
|
||||
}
|
||||
|
||||
public Date getAt()
|
||||
{
|
||||
return at;
|
||||
}
|
||||
|
||||
public void setAt(Date at)
|
||||
{
|
||||
this.at = at;
|
||||
}
|
||||
|
||||
public String getReason()
|
||||
{
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason)
|
||||
{
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public long getExpiryUnix()
|
||||
{
|
||||
return expiryUnix;
|
||||
}
|
||||
|
||||
public void setExpiryUnix(long expiryUnix)
|
||||
{
|
||||
this.expiryUnix = expiryUnix;
|
||||
}
|
||||
}
|
|
@ -15,7 +15,6 @@ import java.util.Set;
|
|||
import java.util.UUID;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -74,7 +73,7 @@ public class BanManager extends FreedomService
|
|||
|
||||
// Load unbannable usernames
|
||||
unbannableUsernames.clear();
|
||||
unbannableUsernames.addAll((Collection<? extends String>)ConfigEntry.FAMOUS_PLAYERS.getList());
|
||||
unbannableUsernames.addAll(ConfigEntry.FAMOUS_PLAYERS.getStringList());
|
||||
FLog.info("Loaded " + unbannableUsernames.size() + " unbannable usernames.");
|
||||
}
|
||||
|
||||
|
@ -190,7 +189,7 @@ public class BanManager extends FreedomService
|
|||
return getByUsername(username) != null;
|
||||
}
|
||||
|
||||
public boolean addBan(Ban ban)
|
||||
public void addBan(Ban ban)
|
||||
{
|
||||
if (ban.getUsername() != null && getByUsername(ban.getUsername()) != null)
|
||||
{
|
||||
|
@ -213,22 +212,18 @@ public class BanManager extends FreedomService
|
|||
{
|
||||
plugin.sql.addBan(ban);
|
||||
updateViews();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean removeBan(Ban ban)
|
||||
public void removeBan(Ban ban)
|
||||
{
|
||||
if (bans.remove(ban))
|
||||
{
|
||||
plugin.sql.removeBan(ban);
|
||||
updateViews();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public int purge()
|
||||
|
@ -269,9 +264,8 @@ public class BanManager extends FreedomService
|
|||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
final PlayerData data = plugin.pl.getData(player);
|
||||
|
||||
if (!plugin.sl.isStaff(player))
|
||||
if (!plugin.al.isAdmin(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -328,5 +322,4 @@ public class BanManager extends FreedomService
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -3,25 +3,15 @@ package me.totalfreedom.totalfreedommod.banning;
|
|||
import com.google.common.collect.Lists;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.totalfreedom.totalfreedommod.config.IConfig;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
public class IndefiniteBan implements IConfig
|
||||
{
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private String username = null;
|
||||
@Getter
|
||||
@Setter
|
||||
private UUID uuid = null;
|
||||
@Getter
|
||||
private final List<String> ips = Lists.newArrayList();
|
||||
@Getter
|
||||
@Setter
|
||||
private String username = null;
|
||||
private UUID uuid = null;
|
||||
private String reason = null;
|
||||
|
||||
public IndefiniteBan()
|
||||
|
@ -53,6 +43,7 @@ public class IndefiniteBan implements IConfig
|
|||
@Override
|
||||
public void saveTo(ConfigurationSection cs)
|
||||
{
|
||||
// The indefinite ban list is only intended to be modified manually. It is not intended to save.
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,4 +51,39 @@ public class IndefiniteBan implements IConfig
|
|||
{
|
||||
return username != null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username)
|
||||
{
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public UUID getUuid()
|
||||
{
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(UUID uuid)
|
||||
{
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public List<String> getIps()
|
||||
{
|
||||
return ips;
|
||||
}
|
||||
|
||||
public String getReason()
|
||||
{
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason)
|
||||
{
|
||||
this.reason = reason;
|
||||
}
|
||||
}
|
|
@ -4,7 +4,6 @@ import com.google.common.base.Strings;
|
|||
import com.google.common.collect.Sets;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.config.YamlConfig;
|
||||
|
@ -21,18 +20,23 @@ public class IndefiniteBanList extends FreedomService
|
|||
|
||||
public static final String CONFIG_FILENAME = "indefinitebans.yml";
|
||||
|
||||
@Getter
|
||||
|
||||
private final Set<IndefiniteBan> indefBans = Sets.newHashSet();
|
||||
|
||||
@Getter
|
||||
|
||||
private int nameBanCount = 0;
|
||||
|
||||
@Getter
|
||||
|
||||
private int uuidBanCount = 0;
|
||||
|
||||
@Getter
|
||||
|
||||
private int ipBanCount = 0;
|
||||
|
||||
public static String getConfigFilename()
|
||||
{
|
||||
return CONFIG_FILENAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
|
@ -51,6 +55,7 @@ public class IndefiniteBanList extends FreedomService
|
|||
|
||||
IndefiniteBan indefBan = new IndefiniteBan();
|
||||
ConfigurationSection cs = config.getConfigurationSection(name);
|
||||
assert cs != null;
|
||||
indefBan.loadFrom(cs);
|
||||
|
||||
if (!indefBan.isValid())
|
||||
|
@ -84,7 +89,7 @@ public class IndefiniteBanList extends FreedomService
|
|||
|
||||
for (IndefiniteBan indefBan : indefBans)
|
||||
{
|
||||
if (username.toLowerCase().equals(indefBan.getUsername().toLowerCase()))
|
||||
if (username.equalsIgnoreCase(indefBan.getUsername()))
|
||||
{
|
||||
bannedBy = "username";
|
||||
ban = indefBan;
|
||||
|
@ -137,4 +142,24 @@ public class IndefiniteBanList extends FreedomService
|
|||
ipBanCount += indefBan.getIps().size();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Set<IndefiniteBan> getIndefBans()
|
||||
{
|
||||
return indefBans;
|
||||
}
|
||||
|
||||
public int getNameBanCount()
|
||||
{
|
||||
return nameBanCount;
|
||||
}
|
||||
|
||||
public int getUuidBanCount()
|
||||
{
|
||||
return uuidBanCount;
|
||||
}
|
||||
|
||||
public int getIpBanCount()
|
||||
{
|
||||
return ipBanCount;
|
||||
}
|
||||
}
|
|
@ -29,6 +29,7 @@ public class BlockBlocker extends FreedomService
|
|||
{
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onBlockPlace(BlockPlaceEvent event)
|
||||
{
|
||||
|
@ -132,17 +133,18 @@ public class BlockBlocker extends FreedomService
|
|||
case PLAYER_HEAD:
|
||||
case PLAYER_WALL_HEAD:
|
||||
{
|
||||
Skull skull = (Skull) event.getBlockPlaced().getState();
|
||||
Skull skull = (Skull)event.getBlockPlaced().getState();
|
||||
if (skull.getOwner() != null)
|
||||
{
|
||||
if (skull.getOwner().contains("\u00A7"))
|
||||
{
|
||||
skull.setOwner(skull.getOwner().replace("\u00A7", ""));
|
||||
SkullMeta meta = (SkullMeta) event.getItemInHand().getItemMeta();
|
||||
SkullMeta meta = (SkullMeta)event.getItemInHand().getItemMeta();
|
||||
if (meta != null)
|
||||
{
|
||||
ItemStack newHead = new ItemStack(Material.PLAYER_HEAD, 1);
|
||||
ItemMeta headMeta = newHead.getItemMeta();
|
||||
assert headMeta != null;
|
||||
headMeta.setDisplayName(ChatColor.YELLOW + "C-sectioned Head");
|
||||
newHead.setItemMeta(headMeta);
|
||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), newHead);
|
||||
|
@ -169,18 +171,23 @@ public class BlockBlocker extends FreedomService
|
|||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// Do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Groups.BANNERS.contains(event.getBlockPlaced().getType()))
|
||||
{
|
||||
Banner banner = (Banner) event.getBlockPlaced().getState();
|
||||
List<Pattern> patterns = banner.getPatterns();;
|
||||
Banner banner = (Banner)event.getBlockPlaced().getState();
|
||||
List<Pattern> patterns = banner.getPatterns();
|
||||
|
||||
if (patterns.size() >= 2)
|
||||
{
|
||||
banner.setPatterns(patterns.subList(0, 2));
|
||||
player.sendMessage(ChatColor.GRAY + "Your banner had too many patterns on it, so some were removed.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,62 +1,62 @@
|
|||
package me.totalfreedom.totalfreedommod.blocking;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.util.FSync;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
|
||||
public class EditBlocker extends FreedomService
|
||||
{
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onBlockPlace(BlockPlaceEvent event)
|
||||
{
|
||||
FPlayer fPlayer = plugin.pl.getPlayerSync(event.getPlayer());
|
||||
if (!fPlayer.isEditBlocked())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.sl.isStaffSync(event.getPlayer()))
|
||||
{
|
||||
fPlayer.setEditBlocked(false);
|
||||
return;
|
||||
}
|
||||
|
||||
FSync.playerMsg(event.getPlayer(), ChatColor.RED + "Your ability to place blocks has been disabled!");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onBlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
FPlayer fPlayer = plugin.pl.getPlayerSync(event.getPlayer());
|
||||
if (!fPlayer.isEditBlocked())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.sl.isStaffSync(event.getPlayer()))
|
||||
{
|
||||
fPlayer.setEditBlocked(false);
|
||||
return;
|
||||
}
|
||||
|
||||
FSync.playerMsg(event.getPlayer(), ChatColor.RED + "Your ability to destroy blocks has been disabled!");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package me.totalfreedom.totalfreedommod.blocking;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.util.FSync;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
|
||||
public class EditBlocker extends FreedomService
|
||||
{
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onBlockPlace(BlockPlaceEvent event)
|
||||
{
|
||||
FPlayer fPlayer = plugin.pl.getPlayerSync(event.getPlayer());
|
||||
if (!fPlayer.isEditBlocked())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.al.isAdminSync(event.getPlayer()))
|
||||
{
|
||||
fPlayer.setEditBlocked(false);
|
||||
return;
|
||||
}
|
||||
|
||||
FSync.playerMsg(event.getPlayer(), ChatColor.RED + "Your ability to place blocks has been disabled!");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onBlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
FPlayer fPlayer = plugin.pl.getPlayerSync(event.getPlayer());
|
||||
if (!fPlayer.isEditBlocked())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.al.isAdminSync(event.getPlayer()))
|
||||
{
|
||||
fPlayer.setEditBlocked(false);
|
||||
return;
|
||||
}
|
||||
|
||||
FSync.playerMsg(event.getPlayer(), ChatColor.RED + "Your ability to destroy blocks has been disabled!");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package me.totalfreedom.totalfreedommod.blocking;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
|
@ -13,6 +14,7 @@ import org.bukkit.attribute.AttributeModifier;
|
|||
import org.bukkit.block.data.AnaloguePowerable;
|
||||
import org.bukkit.block.data.Powerable;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
@ -24,12 +26,12 @@ import org.bukkit.event.block.BlockIgniteEvent;
|
|||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
import org.bukkit.event.block.LeavesDecayEvent;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
import org.bukkit.event.entity.FireworkExplodeEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
|
@ -38,6 +40,20 @@ import org.bukkit.event.player.PlayerRespawnEvent;
|
|||
|
||||
public class EventBlocker extends FreedomService
|
||||
{
|
||||
/**
|
||||
* /@EventHandler(priority = EventPriority.HIGH)
|
||||
* /public void onBlockRedstone(BlockRedstoneEvent event)
|
||||
* /{
|
||||
* / if (!ConfigEntry.ALLOW_REDSTONE.getBoolean())
|
||||
* / {
|
||||
* / event.setNewCurrent(0);
|
||||
* / }
|
||||
* /}
|
||||
**/
|
||||
|
||||
// TODO: Revert back to old redstone block system when (or if) it is fixed in Bukkit, Spigot or Paper.
|
||||
private final ArrayList<Material> redstoneBlocks = new ArrayList<>(Arrays.asList(Material.REDSTONE, Material.DISPENSER, Material.DROPPER, Material.REDSTONE_LAMP));
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
|
@ -120,16 +136,11 @@ public class EventBlocker extends FreedomService
|
|||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onEntityDamage(EntityDamageEvent event)
|
||||
{
|
||||
switch (event.getCause())
|
||||
if ((event.getCause() == EntityDamageEvent.DamageCause.LAVA)
|
||||
&& !ConfigEntry.ALLOW_LAVA_DAMAGE.getBoolean())
|
||||
{
|
||||
case LAVA:
|
||||
{
|
||||
if (!ConfigEntry.ALLOW_LAVA_DAMAGE.getBoolean())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ConfigEntry.ENABLE_PET_PROTECT.getBoolean())
|
||||
|
@ -148,7 +159,7 @@ public class EventBlocker extends FreedomService
|
|||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event)
|
||||
{
|
||||
if (!plugin.sl.isStaff(event.getPlayer()))
|
||||
if (!plugin.al.isAdmin(event.getPlayer()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
@ -203,24 +214,22 @@ public class EventBlocker extends FreedomService
|
|||
}
|
||||
}
|
||||
|
||||
//@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onBlockRedstone(BlockRedstoneEvent event)
|
||||
@EventHandler
|
||||
public void onEntitySpawn(EntitySpawnEvent event)
|
||||
{
|
||||
if (!ConfigEntry.ALLOW_REDSTONE.getBoolean())
|
||||
if (!ConfigEntry.ALLOW_GRAVITY.getBoolean() && event.getEntity() instanceof FallingBlock)
|
||||
{
|
||||
event.setNewCurrent(0);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Revert back to old redstone block system when (or if) it is fixed in Bukkit, Spigot or Paper.
|
||||
private ArrayList<Material> redstoneBlocks = new ArrayList<>(Arrays.asList(Material.REDSTONE, Material.DISPENSER, Material.DROPPER, Material.REDSTONE_LAMP));
|
||||
@EventHandler
|
||||
public void onBlockPhysics(BlockPhysicsEvent event)
|
||||
{
|
||||
if (!ConfigEntry.ALLOW_REDSTONE.getBoolean())
|
||||
{
|
||||
// Check if the block is involved with redstone.
|
||||
if(event.getBlock().getBlockData() instanceof AnaloguePowerable || event.getBlock().getBlockData() instanceof Powerable || redstoneBlocks.contains(event.getBlock().getType()))
|
||||
if (event.getBlock().getBlockData() instanceof AnaloguePowerable || event.getBlock().getBlockData() instanceof Powerable || redstoneBlocks.contains(event.getBlock().getType()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
@ -230,15 +239,16 @@ public class EventBlocker extends FreedomService
|
|||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event)
|
||||
{
|
||||
double maxHealth = event.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
|
||||
double maxHealth = Objects.requireNonNull(event.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH)).getValue();
|
||||
if (maxHealth < 1)
|
||||
{
|
||||
for (AttributeModifier attributeModifier : event.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getModifiers())
|
||||
for (AttributeModifier attributeModifier : Objects.requireNonNull(event.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH)).getModifiers())
|
||||
{
|
||||
event.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).removeModifier(attributeModifier);
|
||||
Objects.requireNonNull(event.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH)).removeModifier(attributeModifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onBlockDispense(BlockDispenseEvent event)
|
||||
{
|
||||
|
|
|
@ -36,10 +36,9 @@ public class InteractBlocker extends FreedomService
|
|||
break;
|
||||
}
|
||||
|
||||
case LEFT_CLICK_AIR:
|
||||
case LEFT_CLICK_BLOCK:
|
||||
default:
|
||||
{
|
||||
//
|
||||
// Do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +89,7 @@ public class InteractBlocker extends FreedomService
|
|||
{
|
||||
case WATER_BUCKET:
|
||||
{
|
||||
if (plugin.sl.isStaff(player) || ConfigEntry.ALLOW_WATER_PLACE.getBoolean())
|
||||
if (plugin.al.isAdmin(player) || ConfigEntry.ALLOW_WATER_PLACE.getBoolean())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -103,7 +102,7 @@ public class InteractBlocker extends FreedomService
|
|||
|
||||
case LAVA_BUCKET:
|
||||
{
|
||||
if (plugin.sl.isStaff(player) || ConfigEntry.ALLOW_LAVA_PLACE.getBoolean())
|
||||
if (plugin.al.isAdmin(player) || ConfigEntry.ALLOW_LAVA_PLACE.getBoolean())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -126,7 +125,7 @@ public class InteractBlocker extends FreedomService
|
|||
event.setCancelled(true);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case ARMOR_STAND:
|
||||
{
|
||||
if (ConfigEntry.ALLOW_ARMOR_STANDS.getBoolean())
|
||||
|
@ -158,6 +157,11 @@ public class InteractBlocker extends FreedomService
|
|||
event.setCancelled(true);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// Do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package me.totalfreedom.totalfreedommod.blocking;
|
||||
|
||||
import java.util.Objects;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import org.bukkit.attribute.Attributable;
|
||||
|
@ -42,13 +43,13 @@ public class MobBlocker extends FreedomService
|
|||
Entity entity = e.getEntity();
|
||||
if (entity instanceof Attributable)
|
||||
{
|
||||
if (((Attributable)entity).getAttribute(Attribute.GENERIC_FOLLOW_RANGE).getBaseValue() > 255.0)
|
||||
if (Objects.requireNonNull(((Attributable)entity).getAttribute(Attribute.GENERIC_FOLLOW_RANGE)).getBaseValue() > 255.0)
|
||||
{
|
||||
((Attributable)entity).getAttribute(Attribute.GENERIC_FOLLOW_RANGE).setBaseValue(255.0);
|
||||
Objects.requireNonNull(((Attributable)entity).getAttribute(Attribute.GENERIC_FOLLOW_RANGE)).setBaseValue(255.0);
|
||||
}
|
||||
if (((Attributable)entity).getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue() > 10.0)
|
||||
if (Objects.requireNonNull(((Attributable)entity).getAttribute(Attribute.GENERIC_MOVEMENT_SPEED)).getBaseValue() > 10.0)
|
||||
{
|
||||
((Attributable)entity).getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(10.0);
|
||||
Objects.requireNonNull(((Attributable)entity).getAttribute(Attribute.GENERIC_MOVEMENT_SPEED)).setBaseValue(10.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +118,7 @@ public class MobBlocker extends FreedomService
|
|||
}
|
||||
|
||||
int mobcount = 0;
|
||||
for (Entity entity : event.getLocation().getWorld().getLivingEntities())
|
||||
for (Entity entity : Objects.requireNonNull(event.getLocation().getWorld()).getLivingEntities())
|
||||
{
|
||||
if (!(entity instanceof HumanEntity) && entity instanceof LivingEntity)
|
||||
{
|
||||
|
@ -130,4 +131,4 @@ public class MobBlocker extends FreedomService
|
|||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ import org.bukkit.GameMode;
|
|||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.FishHook;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.SpectralArrow;
|
||||
import org.bukkit.entity.Trident;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
@ -43,6 +44,14 @@ public class PVPBlocker extends FreedomService
|
|||
player = (Player)arrow.getShooter();
|
||||
}
|
||||
}
|
||||
else if (event.getDamager() instanceof SpectralArrow)
|
||||
{
|
||||
SpectralArrow spectralArrow = (SpectralArrow)event.getDamager();
|
||||
if (spectralArrow.getShooter() instanceof Player)
|
||||
{
|
||||
player = (Player)spectralArrow.getShooter();
|
||||
}
|
||||
}
|
||||
else if (event.getDamager() instanceof Trident)
|
||||
{
|
||||
Trident trident = (Trident)event.getDamager();
|
||||
|
@ -61,7 +70,7 @@ public class PVPBlocker extends FreedomService
|
|||
}
|
||||
}
|
||||
|
||||
if (player != null & !plugin.sl.isStaff(player))
|
||||
if (player != null & !plugin.al.isAdmin(player))
|
||||
{
|
||||
if (player.getGameMode() == GameMode.CREATIVE)
|
||||
{
|
||||
|
@ -84,7 +93,5 @@ public class PVPBlocker extends FreedomService
|
|||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -82,5 +82,4 @@ public class PotionBlocker extends FreedomService
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
package me.totalfreedom.totalfreedommod.blocking;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import net.minecraft.server.v1_16_R1.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
@ -35,8 +35,9 @@ public class SignBlocker extends FreedomService
|
|||
if (Tag.SIGNS.getValues().contains(event.getBlock().getType()))
|
||||
{
|
||||
ItemStack sign = event.getItemInHand();
|
||||
net.minecraft.server.v1_16_R1.ItemStack nmsSign = CraftItemStack.asNMSCopy(sign);
|
||||
net.minecraft.world.item.ItemStack nmsSign = CraftItemStack.asNMSCopy(sign);
|
||||
NBTTagCompound compound = (nmsSign.hasTag()) ? nmsSign.getTag() : new NBTTagCompound();
|
||||
assert compound != null;
|
||||
NBTTagCompound bet = compound.getCompound("BlockEntityTag");
|
||||
String line1 = bet.getString("Text1");
|
||||
String line2 = bet.getString("Text2");
|
||||
|
@ -63,4 +64,4 @@ public class SignBlocker extends FreedomService
|
|||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,6 +30,24 @@ public class CommandBlocker extends FreedomService
|
|||
private final Map<String, CommandBlockerEntry> entryList = Maps.newHashMap();
|
||||
private final List<String> unknownCommands = Lists.newArrayList();
|
||||
|
||||
public static CommandMap getCommandMap()
|
||||
{
|
||||
try
|
||||
{
|
||||
SimplePluginManager simplePluginManager = (SimplePluginManager)Bukkit.getServer().getPluginManager();
|
||||
|
||||
Field commandMapField = SimplePluginManager.class.getDeclaredField("commandMap");
|
||||
commandMapField.setAccessible(true);
|
||||
|
||||
return (SimpleCommandMap)commandMapField.get(simplePluginManager);
|
||||
}
|
||||
catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e)
|
||||
{
|
||||
FLog.severe("Failed to get command map field (" + e.getMessage() + ")");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
|
@ -42,25 +60,6 @@ public class CommandBlocker extends FreedomService
|
|||
entryList.clear();
|
||||
}
|
||||
|
||||
public static CommandMap getCommandMap()
|
||||
{
|
||||
try
|
||||
{
|
||||
SimplePluginManager simplePluginManager = (SimplePluginManager) Bukkit.getServer().getPluginManager();
|
||||
|
||||
Field commandMapField = SimplePluginManager.class.getDeclaredField("commandMap");
|
||||
commandMapField.setAccessible(true);
|
||||
|
||||
SimpleCommandMap simpleCommandMap = (SimpleCommandMap) commandMapField.get(simplePluginManager);
|
||||
return simpleCommandMap;
|
||||
}
|
||||
catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e)
|
||||
{
|
||||
FLog.severe("Failed to get command map field (" + e.getMessage() + ")");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void load()
|
||||
{
|
||||
entryList.clear();
|
||||
|
@ -84,7 +83,7 @@ public class CommandBlocker extends FreedomService
|
|||
String commandName = parts[2].toLowerCase().substring(1);
|
||||
final String message = (parts.length > 3 ? parts[3] : null);
|
||||
|
||||
if (rank == null || action == null || commandName == null || commandName.isEmpty())
|
||||
if (rank == null || action == null || commandName.isEmpty())
|
||||
{
|
||||
FLog.warning("Invalid command blocker entry: " + rawEntry);
|
||||
continue;
|
||||
|
@ -98,6 +97,7 @@ public class CommandBlocker extends FreedomService
|
|||
subCommand = StringUtils.join(commandParts, " ", 1, commandParts.length).trim().toLowerCase();
|
||||
}
|
||||
|
||||
assert commandMap != null;
|
||||
final Command command = commandMap.getCommand(commandName);
|
||||
|
||||
// Obtain command from alias
|
||||
|
@ -171,7 +171,7 @@ public class CommandBlocker extends FreedomService
|
|||
|
||||
for (String part : commandParts)
|
||||
{
|
||||
if (command.startsWith("/") && !plugin.sl.isStaff(sender) && (part.contains("#copy") || part.contains("#clipboard")))
|
||||
if (command.startsWith("/") && !plugin.al.isAdmin(sender) && (part.contains("#copy") || part.contains("#clipboard")))
|
||||
{
|
||||
FUtil.playerMsg(sender, "WorldEdit copy variables are disabled.");
|
||||
return true;
|
||||
|
|
|
@ -8,16 +8,11 @@ public enum CommandBlockerAction
|
|||
BLOCK_UNKNOWN("u");
|
||||
private final String token;
|
||||
|
||||
private CommandBlockerAction(String token)
|
||||
CommandBlockerAction(String token)
|
||||
{
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public String getToken()
|
||||
{
|
||||
return this.token;
|
||||
}
|
||||
|
||||
public static CommandBlockerAction fromToken(String token)
|
||||
{
|
||||
for (CommandBlockerAction action : CommandBlockerAction.values())
|
||||
|
@ -29,4 +24,9 @@ public enum CommandBlockerAction
|
|||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getToken()
|
||||
{
|
||||
return this.token;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package me.totalfreedom.totalfreedommod.blocking.command;
|
||||
|
||||
import lombok.Getter;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -11,15 +10,15 @@ import org.spigotmc.SpigotConfig;
|
|||
public class CommandBlockerEntry
|
||||
{
|
||||
|
||||
@Getter
|
||||
|
||||
private final CommandBlockerRank rank;
|
||||
@Getter
|
||||
|
||||
private final CommandBlockerAction action;
|
||||
@Getter
|
||||
|
||||
private final String command;
|
||||
@Getter
|
||||
|
||||
private final String subCommand;
|
||||
@Getter
|
||||
|
||||
private final String message;
|
||||
|
||||
public CommandBlockerEntry(CommandBlockerRank rank, CommandBlockerAction action, String command, String message)
|
||||
|
@ -40,7 +39,7 @@ public class CommandBlockerEntry
|
|||
{
|
||||
if (action == CommandBlockerAction.BLOCK_AND_EJECT && sender instanceof Player)
|
||||
{
|
||||
TotalFreedomMod.plugin().ae.autoEject((Player)sender, "You used a prohibited command: " + command);
|
||||
TotalFreedomMod.getPlugin().ae.autoEject((Player)sender, "You used a prohibited command: " + command);
|
||||
FUtil.bcastMsg(sender.getName() + " was automatically kicked for using harmful commands.", ChatColor.RED);
|
||||
return;
|
||||
}
|
||||
|
@ -51,4 +50,29 @@ public class CommandBlockerEntry
|
|||
}
|
||||
FUtil.playerMsg(sender, FUtil.colorize(message));
|
||||
}
|
||||
|
||||
public CommandBlockerRank getRank()
|
||||
{
|
||||
return rank;
|
||||
}
|
||||
|
||||
public CommandBlockerAction getAction()
|
||||
{
|
||||
return action;
|
||||
}
|
||||
|
||||
public String getCommand()
|
||||
{
|
||||
return command;
|
||||
}
|
||||
|
||||
public String getSubCommand()
|
||||
{
|
||||
return subCommand;
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
{
|
||||
return message;
|
||||
}
|
||||
}
|
|
@ -1,53 +1,35 @@
|
|||
package me.totalfreedom.totalfreedommod.blocking.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.staff.StaffMember;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public enum CommandBlockerRank
|
||||
{
|
||||
|
||||
ANYONE("a"),
|
||||
EVERYONE("e"),
|
||||
OP("o"),
|
||||
SUPER("s"),
|
||||
TELNET("t"),
|
||||
SENIOR("c"),
|
||||
ADMIN("a"),
|
||||
SENIOR_ADMIN("s"),
|
||||
NOBODY("n");
|
||||
//
|
||||
private final String token;
|
||||
|
||||
private CommandBlockerRank(String token)
|
||||
CommandBlockerRank(String token)
|
||||
{
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public String getToken()
|
||||
{
|
||||
return this.token;
|
||||
}
|
||||
|
||||
public boolean hasPermission(CommandSender sender)
|
||||
{
|
||||
return fromSender(sender).ordinal() >= ordinal();
|
||||
}
|
||||
|
||||
public static CommandBlockerRank fromSender(CommandSender sender)
|
||||
{
|
||||
if (!(sender instanceof Player))
|
||||
Admin admin = TotalFreedomMod.getPlugin().al.getAdmin(sender);
|
||||
if (admin != null)
|
||||
{
|
||||
return TELNET;
|
||||
}
|
||||
|
||||
StaffMember staffMember = TotalFreedomMod.plugin().sl.getAdmin(sender);
|
||||
if (staffMember != null)
|
||||
{
|
||||
if (staffMember.getRank() == Rank.ADMIN)
|
||||
if (admin.getRank() == Rank.SENIOR_ADMIN)
|
||||
{
|
||||
return SENIOR;
|
||||
return SENIOR_ADMIN;
|
||||
}
|
||||
return SUPER;
|
||||
return ADMIN;
|
||||
}
|
||||
|
||||
if (sender.isOp())
|
||||
|
@ -55,8 +37,7 @@ public enum CommandBlockerRank
|
|||
return OP;
|
||||
}
|
||||
|
||||
return ANYONE;
|
||||
|
||||
return EVERYONE;
|
||||
}
|
||||
|
||||
public static CommandBlockerRank fromToken(String token)
|
||||
|
@ -68,6 +49,16 @@ public enum CommandBlockerRank
|
|||
return rank;
|
||||
}
|
||||
}
|
||||
return ANYONE;
|
||||
return EVERYONE;
|
||||
}
|
||||
}
|
||||
|
||||
public String getToken()
|
||||
{
|
||||
return this.token;
|
||||
}
|
||||
|
||||
public boolean hasPermission(CommandSender sender)
|
||||
{
|
||||
return fromSender(sender).ordinal() >= ordinal();
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package me.totalfreedom.totalfreedommod.bridge;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.totalfreedom.bukkittelnet.BukkitTelnet;
|
||||
|
@ -10,8 +9,8 @@ import me.totalfreedom.bukkittelnet.api.TelnetPreLoginEvent;
|
|||
import me.totalfreedom.bukkittelnet.api.TelnetRequestDataTagsEvent;
|
||||
import me.totalfreedom.bukkittelnet.session.ClientSession;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.staff.StaffMember;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -43,15 +42,15 @@ public class BukkitTelnetBridge extends FreedomService
|
|||
return;
|
||||
}
|
||||
|
||||
final StaffMember staffMember = plugin.sl.getEntryByIpFuzzy(ip);
|
||||
final Admin admin = plugin.al.getEntryByIpFuzzy(ip);
|
||||
|
||||
if (staffMember == null || !staffMember.isActive() || !staffMember.getRank().hasConsoleVariant())
|
||||
if (admin == null || !admin.isActive() || !admin.getRank().hasConsoleVariant())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setBypassPassword(true);
|
||||
event.setName(staffMember.getName());
|
||||
event.setName(admin.getName());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
|
@ -66,10 +65,8 @@ public class BukkitTelnetBridge extends FreedomService
|
|||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onTelnetRequestDataTags(TelnetRequestDataTagsEvent event)
|
||||
{
|
||||
final Iterator<Map.Entry<Player, Map<String, Object>>> it = event.getDataTags().entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
for (Map.Entry<Player, Map<String, Object>> entry : event.getDataTags().entrySet())
|
||||
{
|
||||
final Map.Entry<Player, Map<String, Object>> entry = it.next();
|
||||
final Player player = entry.getKey();
|
||||
final Map<String, Object> playerTags = entry.getValue();
|
||||
|
||||
|
@ -77,14 +74,14 @@ public class BukkitTelnetBridge extends FreedomService
|
|||
boolean isTelnetAdmin = false;
|
||||
boolean isSeniorAdmin = false;
|
||||
|
||||
final StaffMember staffMember = plugin.sl.getAdmin(player);
|
||||
if (staffMember != null)
|
||||
final Admin admin = plugin.al.getAdmin(player);
|
||||
if (admin != null)
|
||||
{
|
||||
boolean active = staffMember.isActive();
|
||||
boolean active = admin.isActive();
|
||||
|
||||
isAdmin = active;
|
||||
isSeniorAdmin = active && staffMember.getRank() == Rank.ADMIN;
|
||||
isTelnetAdmin = active && (isSeniorAdmin || staffMember.getRank() == Rank.MOD);
|
||||
isSeniorAdmin = active && admin.getRank() == Rank.SENIOR_ADMIN;
|
||||
isTelnetAdmin = active && (isSeniorAdmin || admin.getRank() == Rank.ADMIN);
|
||||
}
|
||||
|
||||
playerTags.put("tfm.admin.isAdmin", isAdmin);
|
||||
|
@ -121,22 +118,22 @@ public class BukkitTelnetBridge extends FreedomService
|
|||
return bukkitTelnetPlugin;
|
||||
}
|
||||
|
||||
public List<StaffMember> getConnectedAdmins()
|
||||
public List<Admin> getConnectedAdmins()
|
||||
{
|
||||
List<StaffMember> staffMembers = new ArrayList<>();
|
||||
List<Admin> admins = new ArrayList<>();
|
||||
final BukkitTelnet telnet = getBukkitTelnetPlugin();
|
||||
if (telnet != null)
|
||||
{
|
||||
for (ClientSession session : telnet.appender.getSessions())
|
||||
{
|
||||
StaffMember staffMember = plugin.sl.getEntryByName(session.getUserName().toLowerCase());
|
||||
if (staffMember != null && !staffMembers.contains(staffMember))
|
||||
Admin admin = plugin.al.getEntryByName(session.getUserName().toLowerCase());
|
||||
if (admin != null && !admins.contains(admin))
|
||||
{
|
||||
staffMembers.add(staffMember);
|
||||
admins.add(admin);
|
||||
}
|
||||
}
|
||||
}
|
||||
return staffMembers;
|
||||
return admins;
|
||||
}
|
||||
|
||||
public void killTelnetSessions(final String name)
|
||||
|
@ -148,10 +145,8 @@ public class BukkitTelnetBridge extends FreedomService
|
|||
final BukkitTelnet telnet = getBukkitTelnetPlugin();
|
||||
if (telnet != null)
|
||||
{
|
||||
final Iterator<ClientSession> it = telnet.appender.getSessions().iterator();
|
||||
while (it.hasNext())
|
||||
for (ClientSession session : telnet.appender.getSessions())
|
||||
{
|
||||
final ClientSession session = it.next();
|
||||
if (name != null && name.equalsIgnoreCase(session.getUserName()))
|
||||
{
|
||||
sessionsToRemove.add(session);
|
||||
|
@ -179,4 +174,4 @@ public class BukkitTelnetBridge extends FreedomService
|
|||
FLog.severe("Error removing telnet sessions: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,32 +1,78 @@
|
|||
package me.totalfreedom.totalfreedommod.bridge;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.sql.*;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.CoreProtectAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class CoreProtectBridge extends FreedomService
|
||||
{
|
||||
private CoreProtectAPI coreProtectAPI = null;
|
||||
|
||||
public static Map<Player, FUtil.PaginationList<String>> HISTORY_MAP = new HashMap<>();
|
||||
private final List<String> tables = Arrays.asList("co_sign", "co_session", "co_container", "co_block");
|
||||
|
||||
private final HashMap<String, Long> cooldown = new HashMap<>();
|
||||
private CoreProtectAPI coreProtectAPI = null;
|
||||
private BukkitTask wiper;
|
||||
|
||||
public static Long getSecondsLeft(long prevTime, int timeAdd)
|
||||
{
|
||||
return prevTime / 1000L + timeAdd - System.currentTimeMillis() / 1000L;
|
||||
}
|
||||
|
||||
// Unix timestamp converter taken from Functions class in CoreProtect, not my code
|
||||
public static String getTimeAgo(int logTime, int currentTime)
|
||||
{
|
||||
StringBuilder message = new StringBuilder();
|
||||
double timeSince = (double)currentTime - ((double)logTime + 0.0D);
|
||||
timeSince /= 60.0D;
|
||||
if (timeSince < 60.0D)
|
||||
{
|
||||
message.append((new DecimalFormat("0.00")).format(timeSince)).append("/m ago");
|
||||
}
|
||||
|
||||
if (message.length() == 0)
|
||||
{
|
||||
timeSince /= 60.0D;
|
||||
if (timeSince < 24.0D)
|
||||
{
|
||||
message.append((new DecimalFormat("0.00")).format(timeSince)).append("/h ago");
|
||||
}
|
||||
}
|
||||
|
||||
if (message.length() == 0)
|
||||
{
|
||||
timeSince /= 24.0D;
|
||||
message.append((new DecimalFormat("0.00")).format(timeSince)).append("/d ago");
|
||||
}
|
||||
|
||||
return message.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
|
@ -43,8 +89,8 @@ public class CoreProtectBridge extends FreedomService
|
|||
try
|
||||
{
|
||||
final Plugin coreProtectPlugin = Bukkit.getServer().getPluginManager().getPlugin("CoreProtect");
|
||||
|
||||
if (coreProtectPlugin != null && coreProtectPlugin instanceof CoreProtect)
|
||||
assert coreProtectPlugin != null;
|
||||
if (coreProtectPlugin instanceof CoreProtect)
|
||||
{
|
||||
coreProtect = (CoreProtect)coreProtectPlugin;
|
||||
}
|
||||
|
@ -103,7 +149,7 @@ public class CoreProtectBridge extends FreedomService
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
coreProtect.performRollback(86400, Arrays.asList(name), null, null, null, null, 0, null);
|
||||
coreProtect.performRollback(86400, Collections.singletonList(name), null, null, null, null, 0, null);
|
||||
}
|
||||
}.runTaskAsynchronously(plugin);
|
||||
}
|
||||
|
@ -123,7 +169,7 @@ public class CoreProtectBridge extends FreedomService
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
coreProtect.performRestore(86400, Arrays.asList(name), null, null, null, null, 0, null);
|
||||
coreProtect.performRestore(86400, Collections.singletonList(name), null, null, null, null, 0, null);
|
||||
}
|
||||
}.runTaskAsynchronously(plugin);
|
||||
}
|
||||
|
@ -146,7 +192,6 @@ public class CoreProtectBridge extends FreedomService
|
|||
return (megabytes / 1024);
|
||||
}
|
||||
|
||||
// Wipes DB for the specified world
|
||||
public void clearDatabase(World world)
|
||||
{
|
||||
clearDatabase(world, false);
|
||||
|
@ -168,7 +213,7 @@ public class CoreProtectBridge extends FreedomService
|
|||
|
||||
/* As CoreProtect doesn't have an API method for deleting all of the data for a specific world
|
||||
we have to do this manually via SQL */
|
||||
Connection connection = null;
|
||||
Connection connection;
|
||||
try
|
||||
{
|
||||
String host = ConfigEntry.COREPROTECT_MYSQL_HOST.getString();
|
||||
|
@ -178,11 +223,12 @@ public class CoreProtectBridge extends FreedomService
|
|||
String database = ConfigEntry.COREPROTECT_MYSQL_DATABASE.getString();
|
||||
String url = host + ":" + port + "/" + database + "?user=" + username + "&password=" + password + "&useSSL=false";
|
||||
connection = DriverManager.getConnection("jdbc:sql://" + url);
|
||||
final Statement statement = connection.createStatement();
|
||||
final PreparedStatement statement = connection.prepareStatement("SELECT id FROM co_world WHERE world = ?");
|
||||
statement.setQueryTimeout(30);
|
||||
|
||||
// Obtain world ID from CoreProtect database
|
||||
ResultSet resultSet = statement.executeQuery("SELECT id FROM co_world WHERE world = '" + world.getName() + "'");
|
||||
statement.setString(1, world.getName());
|
||||
ResultSet resultSet = statement.executeQuery();
|
||||
String worldID = null;
|
||||
while (resultSet.next())
|
||||
{
|
||||
|
@ -200,7 +246,10 @@ public class CoreProtectBridge extends FreedomService
|
|||
// Iterate through each table and delete their data if the world ID matches
|
||||
for (String table : tables)
|
||||
{
|
||||
statement.executeQuery("DELETE FROM " + table + " WHERE wid = " + worldID);
|
||||
final PreparedStatement statement1 = connection.prepareStatement("DELETE FROM ? WHERE wid = ?");
|
||||
statement1.setString(1, table);
|
||||
statement1.setString(2, worldID);
|
||||
statement1.executeQuery();
|
||||
}
|
||||
|
||||
connection.close();
|
||||
|
@ -210,11 +259,180 @@ public class CoreProtectBridge extends FreedomService
|
|||
{
|
||||
FLog.warning("Failed to delete the CoreProtect data for the " + world.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// This exits for flatlands wipes
|
||||
if (shutdown)
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
PlayerData data = plugin.pl.getData(player);
|
||||
Block block = event.getClickedBlock();
|
||||
final CoreProtectAPI coreProtect = getCoreProtectAPI();
|
||||
|
||||
// TODO: Rewrite this
|
||||
if (data.hasInspection())
|
||||
{
|
||||
server.shutdown();
|
||||
int cooldownTime = 3;
|
||||
|
||||
// Cooldown check
|
||||
if ((event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK)
|
||||
&& cooldown.containsKey(player.getName()))
|
||||
{
|
||||
long secondsLeft = getSecondsLeft(cooldown.get(player.getName()), cooldownTime);
|
||||
if (secondsLeft > 0L)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(ChatColor.RED + String.valueOf(secondsLeft) + " seconds left before next query.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Actual lookup time
|
||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK)
|
||||
{
|
||||
if (block != null)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
List<String[]> lookup = coreProtect.blockLookup(block, -1);
|
||||
|
||||
if (!plugin.al.isAdmin(player))
|
||||
{
|
||||
cooldown.put(player.getName(), System.currentTimeMillis());
|
||||
}
|
||||
|
||||
if (lookup != null)
|
||||
{
|
||||
if (lookup.isEmpty())
|
||||
{
|
||||
player.sendMessage(net.md_5.bungee.api.ChatColor.of("#30ade4") + "Block Inspector " + ChatColor.WHITE + "- " + "No block data found for this location");
|
||||
return;
|
||||
}
|
||||
|
||||
HISTORY_MAP.remove(event.getPlayer());
|
||||
HISTORY_MAP.put(event.getPlayer(), new FUtil.PaginationList<>(10));
|
||||
FUtil.PaginationList<String> paged = HISTORY_MAP.get(event.getPlayer());
|
||||
|
||||
player.sendMessage("---- " + net.md_5.bungee.api.ChatColor.of("#30ade4") + "Block Inspector" + ChatColor.WHITE + " ---- " +
|
||||
ChatColor.GRAY + "(x" + block.getX() + "/" + "y" + block.getY() + "/" + "z" + block.getZ() + ")");
|
||||
|
||||
for (String[] value : lookup)
|
||||
{
|
||||
CoreProtectAPI.ParseResult result = coreProtect.parseResult(value);
|
||||
BlockData bl = result.getBlockData();
|
||||
|
||||
String s;
|
||||
String st = "";
|
||||
|
||||
if (result.getActionString().equals("Placement"))
|
||||
{
|
||||
s = " placed ";
|
||||
}
|
||||
else if (result.getActionString().equals("Removal"))
|
||||
{
|
||||
s = " broke ";
|
||||
}
|
||||
else
|
||||
{
|
||||
s = " interacted with ";
|
||||
}
|
||||
|
||||
if (result.isRolledBack())
|
||||
{
|
||||
st += "§m";
|
||||
}
|
||||
|
||||
int time = (int)(System.currentTimeMillis() / 1000L);
|
||||
|
||||
paged.add(ChatColor.GRAY + getTimeAgo(result.getTime(), time) + ChatColor.WHITE + " - " + net.md_5.bungee.api.ChatColor.of("#30ade4") +
|
||||
st + result.getPlayer() + ChatColor.WHITE + st + s + net.md_5.bungee.api.ChatColor.of("#30ade4") + st + bl.getMaterial().toString().toLowerCase());
|
||||
}
|
||||
|
||||
List<String> page = paged.getPage(1);
|
||||
for (String entries : page)
|
||||
{
|
||||
player.sendMessage(entries);
|
||||
}
|
||||
|
||||
player.sendMessage("Page 1/" + paged.getPageCount() + " | To index through the pages, type " + net.md_5.bungee.api.ChatColor.of("#30ade4") + "/ins history <page>");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (event.getAction() == Action.RIGHT_CLICK_BLOCK)
|
||||
{
|
||||
if (block != null)
|
||||
{
|
||||
BlockState blockState = block.getRelative(event.getBlockFace()).getState();
|
||||
Block placedBlock = blockState.getBlock();
|
||||
event.setCancelled(true);
|
||||
List<String[]> lookup = coreProtect.blockLookup(placedBlock, -1);
|
||||
|
||||
if (lookup.isEmpty())
|
||||
{
|
||||
lookup = coreProtect.blockLookup(block, -1);
|
||||
}
|
||||
|
||||
if (!plugin.al.isAdmin(player))
|
||||
{
|
||||
cooldown.put(player.getName(), System.currentTimeMillis());
|
||||
}
|
||||
|
||||
if (lookup != null)
|
||||
{
|
||||
if (lookup.isEmpty())
|
||||
{
|
||||
player.sendMessage(net.md_5.bungee.api.ChatColor.of("#30ade4") + "Block Inspector " + ChatColor.WHITE + "- " + "No block data found for this location");
|
||||
return;
|
||||
}
|
||||
|
||||
HISTORY_MAP.remove(event.getPlayer());
|
||||
HISTORY_MAP.put(event.getPlayer(), new FUtil.PaginationList<>(10));
|
||||
FUtil.PaginationList<String> paged = HISTORY_MAP.get(event.getPlayer());
|
||||
|
||||
player.sendMessage("---- " + net.md_5.bungee.api.ChatColor.of("#30ade4") + "Block Inspector" + ChatColor.WHITE + " ---- " +
|
||||
ChatColor.GRAY + "(x" + block.getX() + "/" + "y" + block.getY() + "/" + "z" + block.getZ() + ")");
|
||||
|
||||
for (String[] value : lookup)
|
||||
{
|
||||
CoreProtectAPI.ParseResult result = coreProtect.parseResult(value);
|
||||
BlockData bl = result.getBlockData();
|
||||
|
||||
String s;
|
||||
String st = "";
|
||||
|
||||
if (result.getActionString().equals("Placement"))
|
||||
{
|
||||
s = " placed ";
|
||||
}
|
||||
else if (result.getActionString().equals("Removal"))
|
||||
{
|
||||
s = " broke ";
|
||||
}
|
||||
else
|
||||
{
|
||||
s = " interacted with ";
|
||||
}
|
||||
|
||||
if (result.isRolledBack())
|
||||
{
|
||||
st += "§m";
|
||||
}
|
||||
|
||||
int time = (int)(System.currentTimeMillis() / 1000L);
|
||||
|
||||
paged.add(ChatColor.GRAY + getTimeAgo(result.getTime(), time) + ChatColor.WHITE + " - " + net.md_5.bungee.api.ChatColor.of("#30ade4") +
|
||||
st + result.getPlayer() + ChatColor.WHITE + st + s + net.md_5.bungee.api.ChatColor.of("#30ade4") + st + bl.getMaterial().toString().toLowerCase());
|
||||
}
|
||||
|
||||
List<String> page = paged.getPage(1);
|
||||
for (String entries : page)
|
||||
{
|
||||
player.sendMessage(entries);
|
||||
}
|
||||
|
||||
player.sendMessage("Page 1/" + paged.getPageCount() + " | To index through the pages, type " + net.md_5.bungee.api.ChatColor.of("#30ade4") + "/ins history <page>");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -42,7 +42,8 @@ public class EssentialsBridge extends FreedomService
|
|||
try
|
||||
{
|
||||
final Plugin essentials = server.getPluginManager().getPlugin("Essentials");
|
||||
if (essentials != null && essentials instanceof Essentials)
|
||||
assert essentials != null;
|
||||
if (essentials instanceof Essentials)
|
||||
{
|
||||
essentialsPlugin = (Essentials)essentials;
|
||||
}
|
||||
|
@ -113,7 +114,8 @@ public class EssentialsBridge extends FreedomService
|
|||
User user = getEssentialsUser(username);
|
||||
if (user != null)
|
||||
{
|
||||
return FUtil.getField(user, "lastActivity");
|
||||
Long l = FUtil.getField(user, "lastActivity");
|
||||
return (l != null) ? l : 0L;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -150,7 +152,7 @@ public class EssentialsBridge extends FreedomService
|
|||
if (inventoryType == InventoryType.PLAYER && fPlayer.isInvSee())
|
||||
{
|
||||
final InventoryHolder inventoryHolder = inventory.getHolder();
|
||||
if (inventoryHolder != null && inventoryHolder instanceof HumanEntity)
|
||||
if (inventoryHolder instanceof HumanEntity)
|
||||
{
|
||||
Player invOwner = (Player)inventoryHolder;
|
||||
Rank recieverRank = plugin.rm.getRank(player);
|
||||
|
@ -203,6 +205,7 @@ public class EssentialsBridge extends FreedomService
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Actually use this for something or remove it.
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
|
@ -215,4 +218,4 @@ public class EssentialsBridge extends FreedomService
|
|||
|
||||
return ess != null && ess.isEnabled();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,177 +0,0 @@
|
|||
package me.totalfreedom.totalfreedommod.bridge;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import net.coreprotect.CoreProtectAPI;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
public class FAWEBridge extends FreedomService
|
||||
{
|
||||
private CoreProtectAPI api;
|
||||
private World world = null;
|
||||
private final Map<Map.Entry<String, EditSession>, Map<BlockVector3, String>> blocksBroken = new HashMap<>();
|
||||
private final Map<Map.Entry<String, EditSession>, Map.Entry<Pattern, List<BlockVector3>>> blocksPlaced = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
api = plugin.cpb.getCoreProtectAPI();
|
||||
|
||||
/*
|
||||
* Iterates over blocks placed by GenerationCommands (in the EditSession) and adds them to the CoreProtect logs.
|
||||
*/
|
||||
server.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (!(blocksBroken.isEmpty() && blocksPlaced.isEmpty()))
|
||||
{
|
||||
// Send all broken blocks from the last ticks to the CoreProtect API.
|
||||
Map.Entry<String, EditSession> playerAndSessionEntry = null;
|
||||
for (Map.Entry<Map.Entry<String, EditSession>, Map<BlockVector3, String>> entry : blocksBroken.entrySet())
|
||||
{
|
||||
playerAndSessionEntry = entry.getKey();
|
||||
Map<BlockVector3, String> dataAndVectorEntry = entry.getValue();
|
||||
List<BlockVector3> blockVector3List = new ArrayList<>();
|
||||
blockVector3List.addAll(dataAndVectorEntry.keySet()); // Deep clone the block vector to avoid a change later in the code.
|
||||
|
||||
for (BlockVector3 blockVector3 : blockVector3List)
|
||||
{
|
||||
if (blockVector3 != null)
|
||||
{
|
||||
EditSession editSession = playerAndSessionEntry.getValue();
|
||||
World world = server.getWorld(editSession.getWorld().getName());
|
||||
Location location = new Location(world, blockVector3.getX(), blockVector3.getY(), blockVector3.getZ());
|
||||
BlockData blockData = server.createBlockData(dataAndVectorEntry.get(blockVector3));
|
||||
api.logRemoval(playerAndSessionEntry.getKey(), location, blockData.getMaterial(), blockData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clear after broken blocks have been updated.
|
||||
blocksBroken.values().clear();
|
||||
blocksBroken.putIfAbsent(playerAndSessionEntry, new HashMap<>());
|
||||
|
||||
// Send all blocks placed to the CoreProtect API (except from the air as it's only a broken block).
|
||||
for (Map.Entry<Map.Entry<String, EditSession>, Map.Entry<Pattern, List<BlockVector3>>> entry : blocksPlaced.entrySet())
|
||||
{
|
||||
playerAndSessionEntry = entry.getKey();
|
||||
Map.Entry<Pattern, List<BlockVector3>> patternAndListEntry = entry.getValue();
|
||||
Pattern pattern = patternAndListEntry.getKey();
|
||||
List<BlockVector3> blockVector3List = new ArrayList<>();
|
||||
blockVector3List.addAll(patternAndListEntry.getValue()); // Deep clone the block vector to avoid a change later in the code.
|
||||
|
||||
for (BlockVector3 blockVector3 : blockVector3List)
|
||||
{
|
||||
if (blockVector3 != null && !pattern.apply(blockVector3).getBlockType().getMaterial().isAir())
|
||||
{
|
||||
World world = server.getWorld(playerAndSessionEntry.getValue().getWorld().getName());
|
||||
Location location = new Location(world, blockVector3.getX(), blockVector3.getY(), blockVector3.getZ());
|
||||
BaseBlock block = pattern.apply(blockVector3);
|
||||
Material material = Material.getMaterial(block.getBlockType().getId().replaceFirst("minecraft:", "").toUpperCase());
|
||||
api.logPlacement(playerAndSessionEntry.getKey(), location, material, material.createBlockData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
blocksPlaced.values().forEach(collection -> collection.getValue().clear());
|
||||
}
|
||||
}
|
||||
}, 0L, 40L);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void logBlockEdit(String playerName, EditSession editSession, Pattern pattern, BlockVector3 blockVector3)
|
||||
{
|
||||
// Cache the world used for the next iterations to come.
|
||||
if (world == null || !world.getName().equals(editSession.getWorld().getName()))
|
||||
{
|
||||
world = server.getWorld(editSession.getWorld().getName());
|
||||
}
|
||||
|
||||
Map.Entry<String, EditSession> playerAndSessionEntry = new AbstractMap.SimpleEntry(playerName, editSession);
|
||||
Block block = world.getBlockAt(blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ());
|
||||
|
||||
// Add the broken block to CoreProtect if it's not air.
|
||||
if (!block.getType().isAir())
|
||||
{
|
||||
String blockData = block.getBlockData().getAsString();
|
||||
blockData = new Gson().fromJson(new Gson().toJson(blockData), blockData.getClass()); // Overwrite original with deep clones.
|
||||
blockVector3 = new Gson().fromJson(new Gson().toJson(blockVector3), blockVector3.getClass()); // Overwrite original with deep clones.
|
||||
blocksBroken.putIfAbsent(playerAndSessionEntry, new HashMap<>());
|
||||
blocksBroken.get(playerAndSessionEntry).put(blockVector3, blockData);
|
||||
}
|
||||
|
||||
// Add the placed block to CoreProtect if it's not air.
|
||||
if (!pattern.apply(blockVector3).getBlockType().getMaterial().isAir())
|
||||
{
|
||||
blocksPlaced.putIfAbsent(playerAndSessionEntry, new AbstractMap.SimpleEntry<>(pattern, new ArrayList<>()));
|
||||
blocksPlaced.get(playerAndSessionEntry).getValue().add(new Gson().fromJson(new Gson().toJson(blockVector3), blockVector3.getClass()));
|
||||
}
|
||||
}
|
||||
|
||||
public void logBlockEdits(String playerName, EditSession editSession, Region region, Pattern pattern)
|
||||
{
|
||||
// Add the broken blocks to CoreProtect.
|
||||
if (world == null || !world.getName().equals(editSession.getWorld().getName()))
|
||||
{
|
||||
world = server.getWorld(editSession.getWorld().getName());
|
||||
}
|
||||
List<Block> blocks = new ArrayList<>();
|
||||
|
||||
for (BlockVector3 blockVector3 : region)
|
||||
{
|
||||
blocks.add(world.getBlockAt(blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ()));
|
||||
}
|
||||
|
||||
logBlockEdit(playerName, editSession, pattern, blocks);
|
||||
}
|
||||
|
||||
public void logBlockEdit(String playerName, EditSession editSession, Pattern pattern, List<Block> blocks)
|
||||
{
|
||||
Map.Entry<String, EditSession> playerAndSessionEntry = new AbstractMap.SimpleEntry(playerName, editSession);
|
||||
|
||||
server.getScheduler().scheduleSyncDelayedTask(plugin, () ->
|
||||
{
|
||||
for (Block block : blocks)
|
||||
{
|
||||
BlockVector3 blockVector3 = BlockVector3.at(block.getX(), block.getY(), block.getZ());
|
||||
|
||||
// Add the broken block to CoreProtect if it's not air.
|
||||
if (!block.getType().isAir())
|
||||
{
|
||||
api.logRemoval(playerAndSessionEntry.getKey(), block.getLocation(), block.getType(), block.getBlockData());
|
||||
}
|
||||
|
||||
// Add the placed block to CoreProtect if it's not air.
|
||||
BaseBlock baseBlock = pattern.apply(blockVector3);
|
||||
if (!baseBlock.getBlockType().getMaterial().isAir())
|
||||
{
|
||||
Material material = Material.getMaterial(baseBlock.getBlockType().getId().replaceFirst("minecraft:", "").toUpperCase());
|
||||
api.logPlacement(playerAndSessionEntry.getKey(), block.getLocation(), material, material.createBlockData());
|
||||
}
|
||||
}
|
||||
}, 0L);
|
||||
}
|
||||
}
|
|
@ -46,24 +46,7 @@ public class LibsDisguisesBridge extends FreedomService
|
|||
return libsDisguisesPlugin;
|
||||
}
|
||||
|
||||
public Boolean isDisguised(Player player)
|
||||
{
|
||||
try
|
||||
{
|
||||
final LibsDisguises libsDisguises = getLibsDisguisesPlugin();
|
||||
if (libsDisguises != null)
|
||||
{
|
||||
return DisguiseAPI.isDisguised(player);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void undisguiseAll(boolean staff)
|
||||
public void undisguiseAll(boolean admin)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -78,7 +61,7 @@ public class LibsDisguisesBridge extends FreedomService
|
|||
{
|
||||
if (DisguiseAPI.isDisguised(player))
|
||||
{
|
||||
if (!staff && plugin.sl.isStaff(player))
|
||||
if (!admin && plugin.al.isAdmin(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -92,6 +75,11 @@ public class LibsDisguisesBridge extends FreedomService
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isDisguisesEnabled()
|
||||
{
|
||||
return !BlockedDisguises.disabled;
|
||||
}
|
||||
|
||||
public void setDisguisesEnabled(boolean state)
|
||||
{
|
||||
final LibsDisguises libsDisguises = getLibsDisguisesPlugin();
|
||||
|
@ -104,11 +92,6 @@ public class LibsDisguisesBridge extends FreedomService
|
|||
BlockedDisguises.disabled = !state;
|
||||
}
|
||||
|
||||
public boolean isDisguisesEnabled()
|
||||
{
|
||||
return !BlockedDisguises.disabled;
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
final LibsDisguises libsDisguises = getLibsDisguisesPlugin();
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.bukkit.plugin.Plugin;
|
|||
|
||||
public class TFGuildsBridge extends FreedomService
|
||||
{
|
||||
|
||||
public boolean enabled = false;
|
||||
|
||||
@Override
|
||||
|
@ -54,6 +53,6 @@ public class TFGuildsBridge extends FreedomService
|
|||
{
|
||||
return false;
|
||||
}
|
||||
return Common.IN_GUILD_CHAT.contains(player);
|
||||
return Common.GUILD_CHAT.contains(player);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -60,8 +60,7 @@ public class WorldEditBridge extends FreedomService
|
|||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
com.sk89q.worldedit.entity.Player fuckyou = (com.sk89q.worldedit.entity.Player)bukkitPlayer;
|
||||
session.undo(session.getBlockBag(fuckyou), fuckyou);
|
||||
session.undo(session.getBlockBag(bukkitPlayer), bukkitPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,8 +83,7 @@ public class WorldEditBridge extends FreedomService
|
|||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
com.sk89q.worldedit.entity.Player fuckyou = (com.sk89q.worldedit.entity.Player)bukkitPlayer;
|
||||
session.redo(session.getBlockBag(fuckyou), fuckyou);
|
||||
session.redo(session.getBlockBag(bukkitPlayer), bukkitPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
package me.totalfreedom.totalfreedommod.bridge;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.protection.flags.Flags;
|
||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
import com.sk89q.worldguard.protection.regions.RegionContainer;
|
||||
import java.util.Map;
|
||||
|
||||
import com.sk89q.worldguard.protection.regions.RegionQuery;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class WorldGuardBridge extends FreedomService
|
||||
|
@ -15,7 +22,6 @@ public class WorldGuardBridge extends FreedomService
|
|||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
plugin.wr.protectWorld(plugin.wm.hubworld.getWorld());
|
||||
plugin.wr.protectWorld(plugin.wm.masterBuilderWorld.getWorld());
|
||||
}
|
||||
|
||||
|
@ -24,6 +30,16 @@ public class WorldGuardBridge extends FreedomService
|
|||
{
|
||||
}
|
||||
|
||||
public boolean canEditCurrentWorld(Player player)
|
||||
{
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
|
||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||
RegionQuery query = container.createQuery();
|
||||
|
||||
return query.testBuild(localPlayer.getLocation(), localPlayer);
|
||||
}
|
||||
|
||||
public RegionManager getRegionManager(World world)
|
||||
{
|
||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||
|
|
|
@ -2,8 +2,8 @@ package me.totalfreedom.totalfreedommod.caging;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
|
@ -12,141 +12,21 @@ import org.bukkit.block.Skull;
|
|||
public class CageData
|
||||
{
|
||||
|
||||
private static String input = null;
|
||||
private final FPlayer fPlayer;
|
||||
//
|
||||
private final List<BlockData> cageHistory = new ArrayList<>();
|
||||
//
|
||||
@Getter
|
||||
private final List<BlockData> cageHistory = new ArrayList<>();
|
||||
private boolean caged = false;
|
||||
@Getter
|
||||
private Location location;
|
||||
@Getter
|
||||
private Material outerMaterial = Material.GLASS;
|
||||
@Getter
|
||||
private Material innerMaterial = Material.AIR;
|
||||
@Getter
|
||||
private static String input = null;
|
||||
|
||||
public CageData(FPlayer player)
|
||||
{
|
||||
this.fPlayer = player;
|
||||
}
|
||||
|
||||
public void setCaged(boolean cage)
|
||||
{
|
||||
if (cage)
|
||||
{
|
||||
cage(fPlayer.getPlayer().getLocation(), Material.GLASS, Material.GLASS);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.caged = false;
|
||||
regenerateHistory();
|
||||
clearHistory();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void cage(Location location, Material outer, Material inner)
|
||||
{
|
||||
if (isCaged())
|
||||
{
|
||||
setCaged(false);
|
||||
}
|
||||
|
||||
this.caged = true;
|
||||
this.location = location;
|
||||
this.outerMaterial = outer;
|
||||
this.innerMaterial = inner;
|
||||
this.input = null;
|
||||
|
||||
buildHistory(location, 2, fPlayer);
|
||||
regenerate();
|
||||
}
|
||||
|
||||
public void cage(Location location, Material outer, Material inner, String input)
|
||||
{
|
||||
if (isCaged())
|
||||
{
|
||||
setCaged(false);
|
||||
}
|
||||
|
||||
this.caged = true;
|
||||
this.location = location;
|
||||
this.outerMaterial = outer;
|
||||
this.innerMaterial = inner;
|
||||
this.input = input;
|
||||
|
||||
buildHistory(location, 2, fPlayer);
|
||||
regenerate();
|
||||
}
|
||||
|
||||
public void regenerate()
|
||||
{
|
||||
|
||||
if (!caged
|
||||
|| location == null
|
||||
|| outerMaterial == null
|
||||
|| innerMaterial == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
generateHollowCube(location, 2, outerMaterial);
|
||||
generateCube(location, 1, innerMaterial);
|
||||
}
|
||||
|
||||
// TODO: EventHandlerize this?
|
||||
public void playerJoin()
|
||||
{
|
||||
if (!isCaged())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cage(fPlayer.getPlayer().getLocation(), outerMaterial, innerMaterial, input);
|
||||
}
|
||||
|
||||
public void playerQuit()
|
||||
{
|
||||
regenerateHistory();
|
||||
clearHistory();
|
||||
}
|
||||
|
||||
public void clearHistory()
|
||||
{
|
||||
cageHistory.clear();
|
||||
}
|
||||
|
||||
private void insertHistoryBlock(Location location, Material material)
|
||||
{
|
||||
cageHistory.add(new BlockData(location, material));
|
||||
}
|
||||
|
||||
private void regenerateHistory()
|
||||
{
|
||||
for (BlockData blockdata : this.cageHistory)
|
||||
{
|
||||
blockdata.location.getBlock().setType(blockdata.material);
|
||||
}
|
||||
}
|
||||
|
||||
private void buildHistory(Location location, int length, FPlayer playerdata)
|
||||
{
|
||||
final Block center = location.getBlock();
|
||||
for (int xOffset = -length; xOffset <= length; xOffset++)
|
||||
{
|
||||
for (int yOffset = -length; yOffset <= length; yOffset++)
|
||||
{
|
||||
for (int zOffset = -length; zOffset <= length; zOffset++)
|
||||
{
|
||||
final Block block = center.getRelative(xOffset, yOffset, zOffset);
|
||||
insertHistoryBlock(block.getLocation(), block.getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Util methods
|
||||
public static void generateCube(Location location, int length, Material material)
|
||||
{
|
||||
|
@ -167,6 +47,7 @@ public class CageData
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void generateHollowCube(Location location, int length, Material material)
|
||||
{
|
||||
final Block center = location.getBlock();
|
||||
|
@ -209,11 +90,10 @@ public class CageData
|
|||
try
|
||||
{
|
||||
Skull skull = (Skull)block.getState();
|
||||
// This may or may not work in future versions of spigot
|
||||
skull.setOwner(input);
|
||||
skull.setOwningPlayer(Bukkit.getOfflinePlayer(input));
|
||||
skull.update();
|
||||
}
|
||||
catch (ClassCastException e)
|
||||
catch (ClassCastException ignored)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -223,6 +103,176 @@ public class CageData
|
|||
}
|
||||
}
|
||||
|
||||
public static String getInput()
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
public static void setInput(String input)
|
||||
{
|
||||
CageData.input = input;
|
||||
}
|
||||
|
||||
public void cage(Location location, Material outer, Material inner)
|
||||
{
|
||||
if (isCaged())
|
||||
{
|
||||
setCaged(false);
|
||||
}
|
||||
|
||||
this.caged = true;
|
||||
this.location = location;
|
||||
this.outerMaterial = outer;
|
||||
this.innerMaterial = inner;
|
||||
input = null;
|
||||
|
||||
buildHistory(location);
|
||||
regenerate();
|
||||
}
|
||||
|
||||
public void cage(Location location, Material outer, Material inner, String input)
|
||||
{
|
||||
if (isCaged())
|
||||
{
|
||||
setCaged(false);
|
||||
}
|
||||
|
||||
this.caged = true;
|
||||
this.location = location;
|
||||
this.outerMaterial = outer;
|
||||
this.innerMaterial = inner;
|
||||
CageData.input = input;
|
||||
|
||||
buildHistory(location);
|
||||
regenerate();
|
||||
}
|
||||
|
||||
public void regenerate()
|
||||
{
|
||||
|
||||
if (!caged
|
||||
|| location == null
|
||||
|| outerMaterial == null
|
||||
|| innerMaterial == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
generateHollowCube(location, 2, outerMaterial);
|
||||
generateCube(location, 1, innerMaterial);
|
||||
}
|
||||
|
||||
// TODO: EventHandler this?
|
||||
public void playerJoin()
|
||||
{
|
||||
if (!isCaged())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cage(fPlayer.getPlayer().getLocation(), outerMaterial, innerMaterial, input);
|
||||
}
|
||||
|
||||
public void playerQuit()
|
||||
{
|
||||
regenerateHistory();
|
||||
clearHistory();
|
||||
}
|
||||
|
||||
public void clearHistory()
|
||||
{
|
||||
cageHistory.clear();
|
||||
}
|
||||
|
||||
private void insertHistoryBlock(Location location, Material material)
|
||||
{
|
||||
cageHistory.add(new BlockData(location, material));
|
||||
}
|
||||
|
||||
private void regenerateHistory()
|
||||
{
|
||||
for (BlockData blockdata : this.cageHistory)
|
||||
{
|
||||
blockdata.location.getBlock().setType(blockdata.material);
|
||||
}
|
||||
}
|
||||
|
||||
private void buildHistory(Location location)
|
||||
{
|
||||
final Block center = location.getBlock();
|
||||
for (int xOffset = -2; xOffset <= 2; xOffset++)
|
||||
{
|
||||
for (int yOffset = -2; yOffset <= 2; yOffset++)
|
||||
{
|
||||
for (int zOffset = -2; zOffset <= 2; zOffset++)
|
||||
{
|
||||
final Block block = center.getRelative(xOffset, yOffset, zOffset);
|
||||
insertHistoryBlock(block.getLocation(), block.getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FPlayer getfPlayer()
|
||||
{
|
||||
return fPlayer;
|
||||
}
|
||||
|
||||
public List<BlockData> getCageHistory()
|
||||
{
|
||||
return cageHistory;
|
||||
}
|
||||
|
||||
public boolean isCaged()
|
||||
{
|
||||
return caged;
|
||||
}
|
||||
|
||||
public void setCaged(boolean cage)
|
||||
{
|
||||
if (cage)
|
||||
{
|
||||
cage(fPlayer.getPlayer().getLocation(), Material.GLASS, Material.GLASS);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.caged = false;
|
||||
regenerateHistory();
|
||||
clearHistory();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Location getLocation()
|
||||
{
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(Location location)
|
||||
{
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public Material getOuterMaterial()
|
||||
{
|
||||
return outerMaterial;
|
||||
}
|
||||
|
||||
public void setOuterMaterial(Material outerMaterial)
|
||||
{
|
||||
this.outerMaterial = outerMaterial;
|
||||
}
|
||||
|
||||
public Material getInnerMaterial()
|
||||
{
|
||||
return innerMaterial;
|
||||
}
|
||||
|
||||
public void setInnerMaterial(Material innerMaterial)
|
||||
{
|
||||
this.innerMaterial = innerMaterial;
|
||||
}
|
||||
|
||||
private static class BlockData
|
||||
{
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package me.totalfreedom.totalfreedommod.caging;
|
||||
|
||||
import io.papermc.lib.PaperLib;
|
||||
import java.util.Objects;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
|
@ -30,8 +32,7 @@ public class Cager extends FreedomService
|
|||
public void onBreakBlock(BlockBreakEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
if (player == null
|
||||
|| plugin.sl.isStaff(player))
|
||||
if (plugin.al.isAdmin(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -60,7 +61,7 @@ public class Cager extends FreedomService
|
|||
Location cageLoc = cage.getLocation();
|
||||
|
||||
final boolean outOfCage;
|
||||
if (!playerLoc.getWorld().equals(cageLoc.getWorld()))
|
||||
if (!Objects.equals(playerLoc.getWorld(), cageLoc.getWorld()))
|
||||
{
|
||||
outOfCage = true;
|
||||
}
|
||||
|
@ -71,7 +72,7 @@ public class Cager extends FreedomService
|
|||
|
||||
if (outOfCage)
|
||||
{
|
||||
player.getPlayer().teleport(cageLoc.subtract(0, 0.1, 0));
|
||||
PaperLib.teleportAsync(player.getPlayer(), cageLoc.subtract(0, 0.1, 0));
|
||||
FUtil.playerMsg(player.getPlayer(), "You may not leave your cage.", ChatColor.RED);
|
||||
cage.regenerate();
|
||||
}
|
||||
|
@ -112,5 +113,4 @@ public class Cager extends FreedomService
|
|||
cage.playerJoin();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -4,14 +4,12 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import org.reflections.Reflections;
|
||||
|
||||
public class CommandLoader extends FreedomService
|
||||
{
|
||||
@Getter
|
||||
private final List<FreedomCommand> commands;
|
||||
|
||||
public CommandLoader()
|
||||
|
@ -40,7 +38,9 @@ public class CommandLoader extends FreedomService
|
|||
for (FreedomCommand command : commands)
|
||||
{
|
||||
if (name.equals(command.getName()))
|
||||
{
|
||||
return command;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -50,7 +50,9 @@ public class CommandLoader extends FreedomService
|
|||
for (FreedomCommand command : commands)
|
||||
{
|
||||
if (Arrays.asList(command.getAliases().split(",")).contains(alias))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -69,10 +71,15 @@ public class CommandLoader extends FreedomService
|
|||
}
|
||||
catch (InstantiationException | IllegalAccessException | ExceptionInInitializerError ex)
|
||||
{
|
||||
FLog.warning("Failed to register command: /" + commandClass.getSimpleName().replace("Command_" , ""));
|
||||
FLog.warning("Failed to register command: /" + commandClass.getSimpleName().replace("Command_", ""));
|
||||
}
|
||||
}
|
||||
|
||||
FLog.info("Loaded " + commands.size() + " commands");
|
||||
}
|
||||
|
||||
public List<FreedomCommand> getCommands()
|
||||
{
|
||||
return commands;
|
||||
}
|
||||
}
|
|
@ -7,9 +7,9 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Talk privately with other staff on the server.", usage = "/<command> [message]", aliases = "o,sc")
|
||||
public class Command_staffchat extends FreedomCommand
|
||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Talk privately with other admins on the server.", usage = "/<command> [message]", aliases = "o,sc,ac,staffchat")
|
||||
public class Command_adminchat extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
|
@ -19,18 +19,18 @@ public class Command_staffchat extends FreedomCommand
|
|||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
msg("You must be in-game to toggle staff chat, it cannot be toggled via CONSOLE or Telnet.");
|
||||
msg("You must be in-game to toggle admin chat, it cannot be toggled via CONSOLE or Telnet.");
|
||||
return true;
|
||||
}
|
||||
|
||||
FPlayer userinfo = plugin.pl.getPlayer(playerSender);
|
||||
userinfo.setStaffChat(!userinfo.inStaffChat());
|
||||
msg("Toggled your staff chat " + (userinfo.inStaffChat() ? "on" : "off") + ".");
|
||||
userinfo.setAdminChat(!userinfo.inAdminChat());
|
||||
msg("Admin chat turned " + (userinfo.inAdminChat() ? "on" : "off") + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.cm.staffChat(sender, StringUtils.join(args, " "));
|
||||
plugin.cm.adminChat(sender, StringUtils.join(args, " "));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,23 +11,23 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Information on how to apply for staff.", usage = "/<command>", aliases = "si")
|
||||
public class Command_staffinfo extends FreedomCommand
|
||||
@CommandParameters(description = "Information on how to apply for admin.", usage = "/<command>", aliases = "si,ai,staffinfo")
|
||||
public class Command_admininfo extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
List<String> staffInfo = ConfigEntry.STAFF_INFO.getStringList();
|
||||
List<String> adminInfo = ConfigEntry.ADMIN_INFO.getStringList();
|
||||
|
||||
if (staffInfo.isEmpty())
|
||||
if (adminInfo.isEmpty())
|
||||
{
|
||||
msg("The staff information section of the config.yml file has not been configured.", ChatColor.RED);
|
||||
msg("The admin information section of the config.yml file has not been configured.", ChatColor.RED);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg(FUtil.colorize(StringUtils.join(staffInfo, "\n")));
|
||||
msg(FUtil.colorize(StringUtils.join(adminInfo, "\n")));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,9 +10,9 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.MOD, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Denies joining of operators and only allows staff members to join.", usage = "/<command> [on | off]")
|
||||
public class Command_staffmode extends FreedomCommand
|
||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Denies joining of operators and only allows admins to join.", usage = "/<command> [on | off]", aliases = "staffmode")
|
||||
public class Command_adminmode extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
|
@ -25,19 +25,19 @@ public class Command_staffmode extends FreedomCommand
|
|||
|
||||
if (args[0].equalsIgnoreCase("off"))
|
||||
{
|
||||
ConfigEntry.STAFF_ONLY_MODE.setBoolean(false);
|
||||
FUtil.staffAction(sender.getName(), "Opening the server to all players.", true);
|
||||
ConfigEntry.ADMIN_ONLY_MODE.setBoolean(false);
|
||||
FUtil.adminAction(sender.getName(), "Opening the server to all players", true);
|
||||
return true;
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
ConfigEntry.STAFF_ONLY_MODE.setBoolean(true);
|
||||
FUtil.staffAction(sender.getName(), "Closing the server to non-staff.", true);
|
||||
ConfigEntry.ADMIN_ONLY_MODE.setBoolean(true);
|
||||
FUtil.adminAction(sender.getName(), "Closing the server to non-admins", true);
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (!isStaff(player))
|
||||
if (!isAdmin(player))
|
||||
{
|
||||
player.kickPlayer("Server is now closed to non-staff.");
|
||||
player.kickPlayer("Server is now closed to non-admins.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -49,11 +49,11 @@ public class Command_staffmode extends FreedomCommand
|
|||
@Override
|
||||
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
if (args.length == 1 && plugin.sl.isStaff(sender) && !(sender instanceof Player))
|
||||
if (args.length == 1 && plugin.al.isAdmin(sender) && !(sender instanceof Player))
|
||||
{
|
||||
return Arrays.asList("on", "off");
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import io.papermc.lib.PaperLib;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -12,17 +13,12 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Allows for staff to configure time, and weather of the StaffWorld, and allows for staff and ops to go to the StaffWorld.",
|
||||
@CommandParameters(description = "Allows for admins to configure time, and weather of the AdminWorld, and allows for admins and ops to go to the AdminWorld.",
|
||||
usage = "/<command> [time <morning | noon | evening | night> | weather <off | rain | storm>]",
|
||||
aliases = "sw")
|
||||
public class Command_staffworld extends FreedomCommand
|
||||
aliases = "sw,aw,staffworld")
|
||||
public class Command_adminworld extends FreedomCommand
|
||||
{
|
||||
|
||||
private enum CommandMode
|
||||
{
|
||||
TELEPORT, TIME, WEATHER
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
@ -60,24 +56,24 @@ public class Command_staffworld extends FreedomCommand
|
|||
return false;
|
||||
}
|
||||
|
||||
World staffWorld = null;
|
||||
World adminWorld = null;
|
||||
try
|
||||
{
|
||||
staffWorld = plugin.wm.staffworld.getWorld();
|
||||
adminWorld = plugin.wm.adminworld.getWorld();
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ignored)
|
||||
{
|
||||
}
|
||||
|
||||
if (staffWorld == null || playerSender.getWorld() == staffWorld)
|
||||
if (adminWorld == null || playerSender.getWorld() == adminWorld)
|
||||
{
|
||||
msg("Going to the main world.");
|
||||
playerSender.teleport(server.getWorlds().get(0).getSpawnLocation());
|
||||
PaperLib.teleportAsync(playerSender, server.getWorlds().get(0).getSpawnLocation());
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("Going to the StaffWorld.");
|
||||
plugin.wm.staffworld.sendToWorld(playerSender);
|
||||
msg("Going to the AdminWorld.");
|
||||
plugin.wm.adminworld.sendToWorld(playerSender);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -90,8 +86,8 @@ public class Command_staffworld extends FreedomCommand
|
|||
WorldTime timeOfDay = WorldTime.getByAlias(args[1]);
|
||||
if (timeOfDay != null)
|
||||
{
|
||||
plugin.wm.staffworld.setTimeOfDay(timeOfDay);
|
||||
msg("StaffWorld time set to: " + timeOfDay.name());
|
||||
plugin.wm.adminworld.setTimeOfDay(timeOfDay);
|
||||
msg("AdminWorld time set to: " + timeOfDay.name());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -114,8 +110,8 @@ public class Command_staffworld extends FreedomCommand
|
|||
WorldWeather weatherMode = WorldWeather.getByAlias(args[1]);
|
||||
if (weatherMode != null)
|
||||
{
|
||||
plugin.wm.staffworld.setWeatherMode(weatherMode);
|
||||
msg("StaffWorld weather set to: " + weatherMode.name());
|
||||
plugin.wm.adminworld.setWeatherMode(weatherMode);
|
||||
msg("AdminWorld weather set to: " + weatherMode.name());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -141,7 +137,7 @@ public class Command_staffworld extends FreedomCommand
|
|||
{
|
||||
return noPerms();
|
||||
}
|
||||
sender.sendMessage(ex.getMessage());
|
||||
msg(ex.getMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -151,32 +147,16 @@ public class Command_staffworld extends FreedomCommand
|
|||
// TODO: Redo this properly
|
||||
private void assertCommandPerms(CommandSender sender, Player playerSender) throws PermissionDeniedException
|
||||
{
|
||||
if (!(sender instanceof Player) || playerSender == null || !isStaff(sender))
|
||||
if (!(sender instanceof Player) || playerSender == null || !isAdmin(sender))
|
||||
{
|
||||
throw new PermissionDeniedException();
|
||||
}
|
||||
}
|
||||
|
||||
private class PermissionDeniedException extends Exception
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private PermissionDeniedException()
|
||||
{
|
||||
super("");
|
||||
}
|
||||
|
||||
private PermissionDeniedException(String string)
|
||||
{
|
||||
super(string);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
if (!plugin.sl.isStaff(sender))
|
||||
if (!plugin.al.isAdmin(sender))
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
@ -197,4 +177,25 @@ public class Command_staffworld extends FreedomCommand
|
|||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private enum CommandMode
|
||||
{
|
||||
TELEPORT, TIME, WEATHER
|
||||
}
|
||||
|
||||
private static class PermissionDeniedException extends Exception
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private PermissionDeniedException()
|
||||
{
|
||||
super("");
|
||||
}
|
||||
|
||||
private PermissionDeniedException(String string)
|
||||
{
|
||||
super(string);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ public class Command_adventure extends FreedomCommand
|
|||
{
|
||||
if (isConsole())
|
||||
{
|
||||
sender.sendMessage("When used from the console, you must define a target player.");
|
||||
msg("When used from the console, you must define a target player.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ public class Command_adventure extends FreedomCommand
|
|||
return true;
|
||||
}
|
||||
|
||||
checkRank(Rank.TRIAL_MOD);
|
||||
checkRank(Rank.ADMIN);
|
||||
|
||||
if (args[0].equals("-a"))
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ public class Command_adventure extends FreedomCommand
|
|||
targetPlayer.setGameMode(GameMode.ADVENTURE);
|
||||
}
|
||||
|
||||
FUtil.staffAction(sender.getName(), "Changing everyone's gamemode to adventure", false);
|
||||
FUtil.adminAction(sender.getName(), "Changing everyone's gamemode to adventure", false);
|
||||
msg("Your gamemode has been set to adventure.");
|
||||
return true;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public class Command_adventure extends FreedomCommand
|
|||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
msg(PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -55,4 +55,4 @@ public class Command_adventure extends FreedomCommand
|
|||
player.setGameMode(GameMode.ADVENTURE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ import org.bukkit.entity.AreaEffectCloud;
|
|||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Clears lingering potion area effect clouds.", usage = "/<command>", aliases = "aec")
|
||||
public class Command_aeclear extends FreedomCommand
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ public class Command_aeclear extends FreedomCommand
|
|||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.staffAction(sender.getName(), "Removing all area effect clouds.", true);
|
||||
FUtil.adminAction(sender.getName(), "Removing all area effect clouds", true);
|
||||
int removed = 0;
|
||||
for (World world : server.getWorlds())
|
||||
{
|
||||
|
@ -33,4 +33,4 @@ public class Command_aeclear extends FreedomCommand
|
|||
msg(removed + " area effect clouds removed.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.staff.StaffMember;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Manage your AMP account", usage = "/<command> <create | resetpassword>")
|
||||
public class Command_amp extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
||||
if (!plugin.amp.isEnabled())
|
||||
{
|
||||
msg("AMP integration is currently disabled.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
PlayerData playerData = getData(playerSender);
|
||||
|
||||
if (playerData.getDiscordID() == null)
|
||||
{
|
||||
msg("You must have a linked discord account.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equals("create"))
|
||||
{
|
||||
msg("Creating your AMP account...", ChatColor.GREEN);
|
||||
StaffMember staffMember = getAdmin(playerSender);
|
||||
|
||||
if (staffMember.getAmpUsername() != null)
|
||||
{
|
||||
msg("You already have an AMP account.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
String username = sender.getName();
|
||||
String password = FUtil.randomString(30);
|
||||
|
||||
staffMember.setAmpUsername(username);
|
||||
plugin.sl.save(staffMember);
|
||||
plugin.sl.updateTables();
|
||||
|
||||
plugin.amp.createAccount(username, password);
|
||||
plugin.dc.sendAMPInfo(playerData, username, password);
|
||||
msg("Successfully created your AMP account. Check your DMs from " + plugin.dc.formatBotTag() + " on discord to get your credentials.", ChatColor.GREEN);
|
||||
return true;
|
||||
}
|
||||
else if (args[0].equals("resetpassword"))
|
||||
{
|
||||
StaffMember staffMember = getAdmin(playerSender);
|
||||
|
||||
if (staffMember.getAmpUsername() == null)
|
||||
{
|
||||
msg("You do not have an AMP account.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
msg("Resetting your password...", ChatColor.GREEN);
|
||||
|
||||
String username = staffMember.getAmpUsername();
|
||||
String password = FUtil.randomString(30);
|
||||
plugin.amp.setPassword(username,password);
|
||||
plugin.dc.sendAMPInfo(playerData, username, password);
|
||||
|
||||
msg("Successfully reset your AMP account password. Check your DMs from " + plugin.dc.formatBotTag() + " on discord to get your credentials.", ChatColor.GREEN);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
if (args.length == 1 && plugin.sl.isAdmin(sender))
|
||||
{
|
||||
return Arrays.asList("create", "resetpassword");
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
}
|
|
@ -6,7 +6,7 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.MOD, source = SourceType.BOTH)
|
||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Make an announcement anonymously to operators.", usage = "/<command> <message>")
|
||||
public class Command_announce extends FreedomCommand
|
||||
{
|
||||
|
@ -22,5 +22,4 @@ public class Command_announce extends FreedomCommand
|
|||
plugin.an.announce(StringUtils.join(args, " "));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -14,17 +14,17 @@ public class Command_attributelist extends FreedomCommand
|
|||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
String list = "All possible attributes: ";
|
||||
StringBuilder list = new StringBuilder("All possible attributes: ");
|
||||
|
||||
for (Attribute attribute : Attribute.values())
|
||||
{
|
||||
list += attribute.name() + ", ";
|
||||
list.append(attribute.name()).append(", ");
|
||||
}
|
||||
|
||||
// Remove extra comma at the end of the list
|
||||
list = list.substring(0, list.length() - 2);
|
||||
list = new StringBuilder(list.substring(0, list.length() - 2));
|
||||
|
||||
msg(list);
|
||||
msg(list.toString());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue