Compare commits
887 Commits
FightSyste
...
50f0a9d4db
| Author | SHA1 | Date | |
|---|---|---|---|
| 50f0a9d4db | |||
| 425a393ce3 | |||
| 833bf985f7 | |||
| f7b3f020ca | |||
| 79a347e08b | |||
| c7319969a4 | |||
| 2fef8c0be7 | |||
| cd1e1a0ec0 | |||
| d96da5cd85 | |||
| 1db866257e | |||
| 76e40b8277 | |||
| 64999b5a71 | |||
| d6004f409e | |||
| cbc0f06174 | |||
| a63c04d030 | |||
| 87c374bbea | |||
| 6e0467780c | |||
| 8720d1548d | |||
| c165b595e6 | |||
| 15302ea58a | |||
| fd71b4e647 | |||
| 50bd18bae7 | |||
| 89a55996fc | |||
| f494729b89 | |||
| bcabce8b23 | |||
| 376da2028b | |||
| b6cfaf8135 | |||
| 5daee0f589 | |||
| 43663ea099 | |||
| 9d1b0063b9 | |||
| e706044f44 | |||
| 332daec716 | |||
| 2daca017c2 | |||
| 7edd72ac27 | |||
| 1355b57a93 | |||
| e04f0d4ad1 | |||
| 79a6c93f8f | |||
| e36bbfd2a7 | |||
| 65cb544b64 | |||
| 8a22afab63 | |||
| caae9542f4 | |||
| 4104c60f6b | |||
| 69260a9b73 | |||
| 4fb6505aef | |||
| bb2f7cf0c1 | |||
| 8516c8e536 | |||
| 066f06a6e3 | |||
| 78e176b55e | |||
| 86a10b3e97 | |||
| d01efffb6a | |||
| fd57ba43e9 | |||
| eac0390dd3 | |||
| 03005adcd8 | |||
| 933e2119ef | |||
| 679d373a1e | |||
| 828084a3d6 | |||
| 2b782585b1 | |||
| b43965be91 | |||
| d82f306094 | |||
| 30cdbe072e | |||
| db7e1a5fc9 | |||
| 3e5055c246 | |||
| 44c06314c6 | |||
| e06742d6d2 | |||
| 62e674ed42 | |||
| 0464442b83 | |||
| c682333771 | |||
| 58ab619144 | |||
| 00de852575 | |||
| 948cf5e8db | |||
| 7aba8da5a0 | |||
| 5a77854752 | |||
| cf1422f532 | |||
| 6260e65b33 | |||
| 6db404c1e6 | |||
| b086fcaa32 | |||
| f33b3521b8 | |||
| dc72ec1b93 | |||
| 0e9c9bd4dc | |||
| 291b6b1804 | |||
| 104f0cf02d | |||
| f7662cdcba | |||
| 167b36b10c | |||
| b9b541957b | |||
| e9d107f0ed | |||
| 1e264a63a2 | |||
| 868ba4073b | |||
| 3410dd5a4b | |||
| b86a26a709 | |||
| 71238a0167 | |||
| 30ac947ebb | |||
| a7d64b5887 | |||
| d7908c8255 | |||
| 12f26b982e | |||
| 2be4118399 | |||
| 9d6981ee0c | |||
| 97a4d47aa7 | |||
| d657f9871d | |||
| a572b84016 | |||
| f1c6b4b453 | |||
| d0414c71f3 | |||
| 3530aec5e2 | |||
| cccd090357 | |||
| 3ae9a41b31 | |||
| b8b38cf777 | |||
| c1eca74dd0 | |||
| 8c23bf5bd4 | |||
| 556c8f7db1 | |||
| 7a03b327ef | |||
| 0091cba336 | |||
| 35d8bfb588 | |||
| 78584fea34 | |||
| 66511e514c | |||
| 6f64d03fee | |||
| c04e8d75eb | |||
| 5c7c982175 | |||
| d5ca1e14e1 | |||
| 60347bc481 | |||
| fbfdcf8fff | |||
| e56c41ca66 | |||
| 3b67048b9c | |||
| 6efbda669e | |||
| 4bd5d9eb0b | |||
| 60a70dfc40 | |||
| 95a97aed93 | |||
| 6fa54aba2f | |||
| d04939fb2c | |||
| 4c98ce4aff | |||
| 4ed6bc52d0 | |||
| bc00873314 | |||
| 8677d59cce | |||
| 6b16bbc785 | |||
| 617bae5a5c | |||
| 9988774fb4 | |||
| 4fc707431f | |||
| 8ff0319fe6 | |||
| 86537a00de | |||
| e9f8a89758 | |||
| f37fbfffdf | |||
| 9798c08cf3 | |||
| dbd979a5fe | |||
| 280202c43f | |||
| 23df187eb1 | |||
| 39af920631 | |||
| e4864e6eaf | |||
| d2bb8e8e59 | |||
| bd9451f2aa | |||
| 1bb15d9551 | |||
| d06faa5d18 | |||
| bc5e781810 | |||
| 14b756261e | |||
| 1f1f99f8f3 | |||
| d9aeb47a3a | |||
| afe30fd348 | |||
| 9f323c8b38 | |||
| b6279fd7fa | |||
| 3f7cd48f27 | |||
| c682678827 | |||
| 1fd8b3c4cb | |||
| c6ecab5aa8 | |||
| 4383e541d8 | |||
| cc4532ab90 | |||
| 3e448e7597 | |||
| d975110470 | |||
| f6852a5523 | |||
| 40437afb73 | |||
| 80a156754d | |||
| dfc7bbbe13 | |||
| dd5f46069f | |||
| b10897c204 | |||
| f6dc1e1059 | |||
| dccb435bce | |||
| 1c8d6580d5 | |||
| 187087f56b | |||
| 77cf101889 | |||
| 0f68f671f5 | |||
| 75c4966e37 | |||
| fcebb4ffd3 | |||
| 9abbcc908d | |||
| 4eb40581f2 | |||
| c3a4e7ed85 | |||
| 5201a3edc0 | |||
| c9821053ce | |||
| eb8562b3a9 | |||
| 37acbf0033 | |||
| 9e294afa8f | |||
| 3e9ffa52c3 | |||
| 3296d9ebb3 | |||
| 3d562cf743 | |||
| 24f4ab7f37 | |||
| 0ea92be2e1 | |||
| 88d8016987 | |||
| 909c1c52aa | |||
| 26b126fdba | |||
| ecb2e736aa | |||
| 38559e8a2b | |||
| 1aba92e707 | |||
| e4df6f55fb | |||
| ff5113e112 | |||
| c425ca1171 | |||
| c1293ffda0 | |||
| 02428868c2 | |||
| adaae7f943 | |||
| c12d2c2ddf | |||
| 428c63429c | |||
| edec84c60a | |||
| 4f885a7269 | |||
| dfd9febd8c | |||
| 1a570dca17 | |||
| 761977c90a | |||
| 5cc417c43c | |||
| 1014df5f31 | |||
| c920664920 | |||
| 3069ffc991 | |||
| c3db2b7f86 | |||
| c30f24ab8f | |||
| bcb0ad4bef | |||
| f2a46e54ea | |||
| daede98a0f | |||
| d37a14f280 | |||
| 083c5c07c2 | |||
| 7b059cde0e | |||
| 30fa3fd66e | |||
| 37f6723542 | |||
| 7a9740c4c4 | |||
| 54eec6d57c | |||
| 2f93f336c9 | |||
| 62f9d37230 | |||
| b479b6667b | |||
| 9bc01a4e3b | |||
| b14cf445df | |||
| 527bc39d38 | |||
| 8defbaa18b | |||
| a5bb62590c | |||
| c35d4741a0 | |||
| a2a101c4e3 | |||
| 277e1f9f9b | |||
| 380506542f | |||
| d410484e4c | |||
| 8768fd7d81 | |||
| 374e314faa | |||
| 45a8aab321 | |||
| 0d15bbc266 | |||
| 7fa97ce36c | |||
| 8cd088050d | |||
| b0bbc09113 | |||
| a5b61fb0d6 | |||
| 297e6c9b59 | |||
| 400c78447a | |||
| 778d0282d3 | |||
| 2a314e7035 | |||
| 6ed639fbb3 | |||
| 3a79f19f37 | |||
| f7e81f8204 | |||
| 7f215b921e | |||
| b0be06136d | |||
| 8132e4fca0 | |||
| bf5eef2ebd | |||
|
|
69251f42a6 | ||
| 6bbe94150d | |||
| 717cfa8baf | |||
| 260656ad35 | |||
| e893d7934a | |||
| d0665932f4 | |||
| d6fba9b0af | |||
| b229b0d0ae | |||
| ac00245b04 | |||
| 6eb01a61b1 | |||
| fa13872f22 | |||
| 79edc1c591 | |||
| 6e9db276ef | |||
| e3179c69aa | |||
| c633694222 | |||
| a4eea298d2 | |||
| f387805b40 | |||
| 2c644eef26 | |||
| 7f0fa09c56 | |||
| 6940c32b02 | |||
| 5015aca159 | |||
| 32c85b9bd5 | |||
| 15bb92fbba | |||
| d6a5caf95d | |||
| 1912ad52e4 | |||
| 66d18e316b | |||
| f30c3b2f34 | |||
| 7e863e8062 | |||
| 5cdad8c2f4 | |||
| 87a7120a6a | |||
| b5a9564808 | |||
| f93362a023 | |||
| b1bef4ced5 | |||
| e7e1e2d968 | |||
| 713275ba11 | |||
| e72ae3cf94 | |||
| d36753dec1 | |||
|
|
84cc292df4 | ||
| f89c4e88f9 | |||
| aeff16b7dd | |||
| bb97d80c18 | |||
| 7d45680fcb | |||
| a38f9222dd | |||
| 5ee9d3e167 | |||
| 98321de46c | |||
|
|
239ba3f213 | ||
|
|
3d7dedd3ad | ||
| ef66b8c1f1 | |||
| 1201b16ee4 | |||
| 4ddd88f540 | |||
| 147e34c0d6 | |||
| ca35ab9234 | |||
| 3df84a7dad | |||
| 313b22cb44 | |||
| 83c20729fa | |||
| 925901e40e | |||
| 059dd314d1 | |||
| 86ff619548 | |||
| 76e00b07db | |||
| 4edfd32ff5 | |||
| 5669725f9b | |||
| 335649fa87 | |||
| 9001e83321 | |||
| 32703c6659 | |||
| e393aad25f | |||
| 50543ddd4e | |||
| 230ac09b61 | |||
| 48ea88e1a7 | |||
| 05dc42355d | |||
| 17704487c9 | |||
| 76bbfd0381 | |||
| ae9166528d | |||
| 119fae4b51 | |||
| 43621b18b4 | |||
| e5bdbac3c7 | |||
| fd738f539a | |||
| b4c7576433 | |||
| 8204e2ad21 | |||
| 684a74b60d | |||
| 1f58b51af6 | |||
| c9cfb48c4e | |||
| ace567ba33 | |||
| 2094120150 | |||
| e143268caa | |||
| 7802fdd7d9 | |||
| 7fb3d3d137 | |||
| 61d84492dc | |||
| f74780d395 | |||
| 62dac000d4 | |||
| 424c80ec81 | |||
| ae7d394ae2 | |||
| 306444356c | |||
| 29dff8dce6 | |||
| cbaacd4e85 | |||
| e24dada435 | |||
| d04ffd5cf6 | |||
| 9da1de9b6c | |||
| 866c376ee5 | |||
| 0b14a216d9 | |||
| b2853b9dec | |||
| df5c363fb7 | |||
| 5b3c3f36b4 | |||
| e1bcdd59ba | |||
| 40eeb4993f | |||
| 4c23915987 | |||
| c9e4b57f12 | |||
| fdcd248ba6 | |||
| f573771355 | |||
| 80078cd8e2 | |||
| 76fc468d89 | |||
| 1304048509 | |||
|
|
cf4ac95c2f | ||
| 4a816696ec | |||
| 038f54c3b3 | |||
|
|
f2d8c9c02b | ||
|
|
2405c5e620 | ||
| d9493c7474 | |||
| 2ccb240ef5 | |||
| d1d1679c0a | |||
| 4c6ab2c1a0 | |||
| 62002e44d7 | |||
|
|
9c3f7526ff | ||
| eefe17e5f7 | |||
|
|
812e78d277 | ||
| fd220d7fd4 | |||
| 446cd5deae | |||
| a6c46d0270 | |||
| 2686ab285b | |||
| 57ea1470e2 | |||
| bfdc9c118a | |||
| dafe838a8a | |||
| 13bd154383 | |||
| 9248c9fa51 | |||
|
|
764dec99f4 | ||
| c9a1528dfe | |||
| 8c37466312 | |||
| 3b7e38aceb | |||
| e7c4c998a0 | |||
| 5907648462 | |||
| b32d6e9c69 | |||
| f533e85007 | |||
| 81c310c946 | |||
| 47c8cb1701 | |||
| f62af55d39 | |||
| 1dcd2f102c | |||
| 87f0765506 | |||
| b37ded3a8d | |||
|
|
c4e9f80315 | ||
| 19e14f787a | |||
| 0f629a6387 | |||
| 1a356da6e0 | |||
| f6a18dffcc | |||
| 98cc09a7d3 | |||
| 4c8a03ac9c | |||
|
|
16f2eaad52 | ||
| 90d2e70a6e | |||
|
|
d22b01f5e6 | ||
| 71522973a7 | |||
| 0da3ebfbcc | |||
| 923142d0cb | |||
|
|
eca9963653 | ||
|
|
9467291020 | ||
|
|
e14c7321c2 | ||
| 50b6947312 | |||
| 9eca9ab990 | |||
| 34e4cd7060 | |||
| 30cb09c127 | |||
|
|
c94d67660a | ||
| 522cd850a2 | |||
|
|
394591f302 | ||
| 3016ad31fa | |||
| 1d293b446c | |||
|
|
3b41cc4ac5 | ||
| a71f3f6c66 | |||
| 2225b811fa | |||
| 96c25687b6 | |||
| 82723e4c31 | |||
| 17eaefe3d0 | |||
| 911a08a156 | |||
| b60111e717 | |||
|
|
644cc9da84 | ||
|
|
29cb1cc5da | ||
| 9bc1f8b328 | |||
| f38b85f9cb | |||
| 600c24441c | |||
| f3b5a45f62 | |||
| caee70c07e | |||
| 5f73395b63 | |||
| b4eab65757 | |||
| 0a60654a28 | |||
| 85c0db873c | |||
| f0beb22856 | |||
| af55c946a6 | |||
| 8b49b8a736 | |||
| 6d4ae9593d | |||
| 2fad352f62 | |||
| 2d28cc6182 | |||
| b0bd719627 | |||
| 284c4acd4b | |||
| 96a4168f37 | |||
| c77b8f57ce | |||
|
|
e3c02cfb60 | ||
|
|
ade9a1b5eb | ||
| ce907389df | |||
| d9b58d7170 | |||
| 3db327eb84 | |||
| fd82707414 | |||
| a2b3661605 | |||
| b045f16160 | |||
| dea0d33185 | |||
| 11cf0b6c54 | |||
| 593ca9f0cf | |||
| 7f5b57516e | |||
| 8ec12603b6 | |||
|
|
ef029eb420 | ||
|
|
9f108a7cea | ||
|
|
b516d1d569 | ||
|
|
56e1abca7e | ||
| 5420c19b39 | |||
| dd9467fa36 | |||
| ccbac9f7fb | |||
| 6aeecd444e | |||
|
|
ec43e7eba8 | ||
| fbea45fb0f | |||
| abbbf7d3cb | |||
| 1dc0c0d8a8 | |||
| 25cf1ab314 | |||
| 1715fdccdf | |||
| e39db5978b | |||
|
|
b4baef321f | ||
| 93ab1a50f3 | |||
| c6a7107ec2 | |||
| 8ac5fe44ef | |||
| 414bd20eb9 | |||
| 482282f913 | |||
| 3d153d49b5 | |||
| 20c90d9af5 | |||
| c799046f43 | |||
| 90666e2d20 | |||
| 77c6f41f1a | |||
| b3ddc04830 | |||
| 02b63687bc | |||
| dbf59df173 | |||
| 71362bc079 | |||
| 315674ebd8 | |||
| d5fb48ff3f | |||
| 5eaff4c492 | |||
| 4db5c50b06 | |||
|
|
aa01fde5a0 | ||
| aa5fcd3811 | |||
| de591b7a5f | |||
|
|
e83878a49b | ||
| bbd42a769b | |||
| 6541c34cc8 | |||
|
|
364911e449 | ||
|
|
7f7f84a4c4 | ||
| 3fadeb7751 | |||
| 8da9a3cfbb | |||
| 0ce7429151 | |||
| 2848db02ab | |||
| 35e4f66c91 | |||
| b4accdf0a1 | |||
| b41eec56b9 | |||
| 35142f108f | |||
|
|
af79ef544b | ||
| ca076f9ffd | |||
| eacae09e4f | |||
| 90ebc93b14 | |||
| 747bb1055d | |||
| 18418cca2a | |||
| a9660bd325 | |||
|
|
569d5b033e | ||
|
|
052e549606 | ||
| 6519269d74 | |||
| ee705792bf | |||
| 65cf84f164 | |||
|
|
a13039bce4 | ||
| d721a7496e | |||
|
|
721723716e | ||
|
|
3d2cba6a28 | ||
|
|
3be748b92e | ||
|
|
898f3c785b | ||
|
|
2192eddb8b | ||
|
|
327da139ba | ||
| 658dcd024d | |||
| ab4aaf782f | |||
| 21b389a993 | |||
| 3d78a23af1 | |||
| 07185d0960 | |||
| d42da4c903 | |||
|
|
afd0541039 | ||
|
|
eaae2f4009 | ||
| 0c815ee1d5 | |||
|
|
429f938f1c | ||
|
|
fba7fe5008 | ||
|
|
4012426e26 | ||
|
|
fe4e486d41 | ||
| 79a0fcb3aa | |||
| 393f840507 | |||
| 349e36fb6b | |||
| 6096828394 | |||
| 2d84cc8ca7 | |||
| ceff8e9cd5 | |||
| 82e6aff4bb | |||
| 8e7a6a56ca | |||
| 12c2ae435d | |||
| 2564227ec7 | |||
|
|
91d4a2dac3 | ||
|
|
f7c9c6d796 | ||
| 0f1fbc4b88 | |||
| bfdf6471d2 | |||
| e418109ab7 | |||
|
|
06010ae27c | ||
| a39f172a34 | |||
| 82c73f9367 | |||
|
|
1350be9b80 | ||
| 1f65121c68 | |||
| 3c848389c9 | |||
| 33f41869b6 | |||
| 3c1d46398d | |||
|
|
8e51db3e5b | ||
|
|
fdd25b11a2 | ||
|
|
b6d5f8dcba | ||
|
|
604a1db218 | ||
|
|
01da293680 | ||
|
|
e26e590e18 | ||
|
|
26bc341c4d | ||
|
|
46fed25da4 | ||
|
|
d3fbbb9768 | ||
| 9a8cb543e9 | |||
| ed16de900e | |||
|
|
66f4efb27f | ||
|
|
053bd06342 | ||
|
|
9888700273 | ||
|
|
94a1ed3569 | ||
|
|
da148c0e9f | ||
|
|
ab34d86da4 | ||
|
|
088965df59 | ||
|
|
a3490b801e | ||
|
|
856c79661b | ||
|
|
9f0f11adeb | ||
|
|
6b7825ead9 | ||
| 025ec2a850 | |||
|
|
d7d6c2df7b | ||
|
|
55c3579e5c | ||
|
|
d64e32eaa5 | ||
|
|
abb8ab2204 | ||
| c1dbce4648 | |||
| 7dc5686389 | |||
| f52cec0448 | |||
| add43b2f54 | |||
| ca0f82897e | |||
| f111d55200 | |||
| 7eba9231d5 | |||
| e9ac198fcb | |||
| 3a47e348d0 | |||
| a16e1e8cee | |||
|
|
0f73939bf0 | ||
|
|
30ac38ef53 | ||
|
|
22a8ca4aea | ||
|
|
bd87221198 | ||
|
|
fb0a653b0e | ||
| 9154077104 | |||
| 55adb1a052 | |||
| 4448eab877 | |||
| 180fb685bd | |||
| df1ec88f6c | |||
| 655b6cd15f | |||
| 867091d210 | |||
| 2f34369756 | |||
| 89fe401b03 | |||
| aaa808f90f | |||
|
|
1ea6bd61f8 | ||
|
|
026b7bcc0e | ||
|
|
4da2307d50 | ||
|
|
7d9996529e | ||
| a2710628a5 | |||
| ec5382316a | |||
| 51fd5faa4d | |||
|
|
acbc5c5fd3 | ||
|
|
793fc31b5c | ||
| 1b47700c19 | |||
| 06b0af5a16 | |||
| d08ccc3a98 | |||
| 336915dd96 | |||
|
|
8fac9cd37e | ||
|
|
3b2ee668b2 | ||
|
|
c479d21cd2 | ||
|
|
10e016c850 | ||
| 0e43c2a615 | |||
| 9eab15bfd5 | |||
| 2436340765 | |||
| 7d9b3cd098 | |||
| 85c6dcdc1e | |||
|
|
997a800c85 | ||
|
|
a5ffddad66 | ||
| 61e8ba14ca | |||
| 56c66b33b7 | |||
| b90884ee1d | |||
| e1d3e47845 | |||
| b12846d011 | |||
| 7488a4d063 | |||
|
|
429e2f86aa | ||
|
|
c308a06e6b | ||
| 68c7cfed73 | |||
| c3c4b94e3b | |||
| f61c27804a | |||
| b36c974f86 | |||
| ae4d498694 | |||
|
|
e9f6b284eb | ||
|
|
454cfecc0e | ||
| bc217c16dd | |||
| d3f6075686 | |||
|
|
a1e77e571b | ||
|
|
b31bd58e1a | ||
|
|
f81b95e39f | ||
|
|
7ce5e319b5 | ||
|
|
c50bb64516 | ||
|
|
b1c0e36cee | ||
|
|
be653754a7 | ||
| 9c055ee929 | |||
| 80ab0eeda0 | |||
| 257f70cc6a | |||
|
|
970780b855 | ||
|
|
c0d9b9f89b | ||
| 6d0fa6527e | |||
| df4cd12d2a | |||
| 60dc00fd92 | |||
| 06eec10660 | |||
| e1010f79e9 | |||
| e93683842b | |||
|
|
cd17e625ca | ||
|
|
d21e50dadd | ||
|
|
19ea605784 | ||
|
|
4c12148552 | ||
|
|
da672a7506 | ||
|
|
2f50c7acae | ||
|
|
ed276bf4ce | ||
|
|
f5f8b3bd06 | ||
|
|
f01f869479 | ||
|
|
3ce958778a | ||
|
|
c4849657df | ||
|
|
9a6dec6679 | ||
| 0134ef1f61 | |||
| 19a4d0e93a | |||
| 677eb4137a | |||
|
|
7b55e99be0 | ||
|
|
3abba4ae35 | ||
|
|
d2650ad97f | ||
| 57d4727f35 | |||
| a040448b5e | |||
| 79a993c8ec | |||
| bd95e95bc3 | |||
| d93d7c95eb | |||
| f97cc2ca61 | |||
| 990a59ae72 | |||
| 0153910402 | |||
| e61466e390 | |||
| 2788670bbb | |||
| 2ea8c93961 | |||
| dfe7c389f6 | |||
| 7140fbb1a0 | |||
|
|
d57d73c488 | ||
| 66d417a210 | |||
| e16410fd65 | |||
|
|
4009f11871 | ||
| a009c841b1 | |||
|
|
bf21d7ee90 | ||
|
|
851904beac | ||
| a4d5850555 | |||
|
|
116005c0c9 | ||
|
|
4dcfeb77b2 | ||
|
|
e24f108d90 | ||
|
|
f4ef396d4e | ||
| b041a50abb | |||
| f01cb66874 | |||
| 47cca70d95 | |||
| 37072b1f49 | |||
| f1154f3ea5 | |||
| 7927a195d6 | |||
| fd791ea98d | |||
| 41233b7710 | |||
|
|
2032a0b642 | ||
|
|
996e4932d7 | ||
| bd08107701 | |||
|
|
4ee8456fd4 | ||
|
|
8e2cca854e | ||
|
|
28f96e313a | ||
|
|
f51de58921 | ||
|
|
46c2de43a4 | ||
| e088e9794b | |||
|
|
891f4b0e9c | ||
|
|
e71a704d25 | ||
|
|
c34575df29 | ||
| edd3524b41 | |||
| b3cd8d843f | |||
| 3e270643e8 | |||
| 313d63e99d | |||
|
|
8b007721fb | ||
| 510aec048b | |||
|
|
9911a52da9 | ||
| d5c06688f0 | |||
| d6202f9596 | |||
| df37fa1564 | |||
|
|
0ca3ede280 | ||
| 16a5de7a84 | |||
| 8bb2be52f2 | |||
| 06e0d3df74 | |||
|
|
128d2d3378 | ||
| d30fb5f949 | |||
|
|
afadf0b9dd | ||
| 5e74aaad2c | |||
|
|
daa17c3e8b | ||
| ec990cb52a | |||
|
|
7f640ebd34 | ||
|
|
c15d523f3b | ||
| 97e4ccb076 | |||
|
|
c2cf6125d1 | ||
| 7437f87d22 | |||
| 5a3d801714 | |||
| edbc43abf1 | |||
| 9415a3f217 | |||
| 4bb1bc0cbd | |||
| 78853c70f8 | |||
| 5ac327409b | |||
| 35ca8f3877 | |||
| 2e9dbfe8b8 | |||
| 27bd7be776 | |||
| 9dff1f5884 | |||
| 26f15304a2 | |||
| d115975403 | |||
| ac9197c554 | |||
| a78974b903 | |||
| 8c0a888b3d | |||
| 597716569b | |||
| 0485713e86 | |||
|
|
85c8e2e56b | ||
| 43618fc290 | |||
| 07049c4646 | |||
| 32afd1de8c | |||
|
|
af4a3eb2ed | ||
|
|
fdd6d84b54 | ||
|
|
8842d822d9 | ||
|
|
1c7c57e10c | ||
|
|
5e27f5c333 | ||
| 9d87ac6747 | |||
| 6fea09fb9d | |||
| 338f2e6ed1 | |||
| a9514996a9 | |||
| 31bcefce8a | |||
| 11a933fede | |||
| dbe6d40e36 | |||
| d4ba20ee37 | |||
| cb54591ad9 | |||
| 9dcd0cce43 | |||
| 35d812b280 | |||
| a1e1396bdb | |||
| a64f6292e9 | |||
| 2142ed2f97 | |||
| 6560562b05 | |||
| 6222f76417 | |||
| 1f908134a1 | |||
| 04d9f38f7d | |||
| 94502a1567 | |||
| 4edc59ba66 | |||
|
|
46ee20ad1b | ||
| 52302dd284 | |||
|
|
e1769a42f4 | ||
| 1b10063e30 | |||
| bd389a7a7e | |||
| ac25dea08a | |||
| e0d964bdd7 | |||
| c11eaaee45 | |||
| baf837946e | |||
| 5f92d4c68c | |||
| 6496f33a9e | |||
| 9e2f2748b6 | |||
| a25e55ffdf | |||
| c8381413a3 | |||
| c61c2d8087 | |||
| 18cb7157d7 | |||
| ea929e0615 | |||
|
|
42dd4160ea | ||
| cab12fca92 | |||
| a75a1e8e10 | |||
| d5398cbde2 | |||
| 12b16d6801 | |||
|
|
c5f40f0911 | ||
|
|
9b66df1e08 | ||
| 20acd7abbe | |||
| 49fa6c364f | |||
| 56cbb41930 | |||
| fde70029c5 | |||
| 42fd35077b | |||
| 76aa61934c | |||
| f375aa68b5 | |||
| b2ff042e4a | |||
| 6a2a3314c6 | |||
| 007f0796ae | |||
|
|
9203e84d46 | ||
| cca8bdaab7 | |||
| 5e1338a9f3 | |||
|
|
50175b2518 | ||
|
|
09a8dc0786 | ||
|
|
5afdc04e1e | ||
| 42254a5133 | |||
| 6d648b9a71 | |||
|
|
67d4f3432a | ||
|
|
3e6dd61428 | ||
|
|
fbb6d84dae | ||
|
|
44faab9950 | ||
| f69f7ae294 | |||
|
|
a780385599 | ||
| fd7fe8c305 | |||
|
|
817c522d9a | ||
|
|
4a2afee27d | ||
|
|
15654394b5 | ||
|
|
25f6b3c223 | ||
|
|
642e9ffd50 | ||
|
|
8bdb2bad14 | ||
| 8b776ff33e | |||
|
|
963f798e7c | ||
|
|
0d2e028fac | ||
|
|
ead144d974 | ||
|
|
be848ac67a | ||
|
|
a9393f878f | ||
|
|
3b378977b7 | ||
|
|
6c7b0f7bb5 | ||
|
|
f4fef76562 |
10
.gitignore
vendored
10
.gitignore
vendored
@@ -11,5 +11,13 @@ steamwar.properties
|
||||
.idea
|
||||
*.iml
|
||||
|
||||
# VSCode
|
||||
bin/
|
||||
.vscode
|
||||
|
||||
# Other
|
||||
lib
|
||||
lib
|
||||
/WebsiteBackend/data
|
||||
/WebsiteBackend/logs
|
||||
/WebsiteBackend/skins
|
||||
/WebsiteBackend/config.json
|
||||
@@ -27,8 +27,8 @@ java {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":BauSystem:BauSystem_Main"))
|
||||
compileOnly(project(":SpigotCore"))
|
||||
compileOnly(project(":BauSystem:BauSystem_Main", "default"))
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
|
||||
compileOnly(libs.nms15)
|
||||
compileOnly(libs.worldedit15)
|
||||
|
||||
@@ -109,7 +109,7 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
|
||||
|
||||
@Override
|
||||
public void setSelection(Player p, Point minPoint, Point maxPoint) {
|
||||
WORLDEDIT_PLUGIN.getSession(p).setRegionSelector(BUKKITWORLD, new CuboidRegionSelector(BUKKITWORLD, toBlockVector3(minPoint), toBlockVector3(maxPoint)));
|
||||
WORLDEDIT_PLUGIN.getSession(p).setRegionSelector(BUKKITWORLD, new CuboidRegionSelector(BUKKITWORLD, minPoint.toBlockVector3(), maxPoint.toBlockVector3()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -178,9 +178,9 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
|
||||
pastePoint.set(v);
|
||||
|
||||
if (pasteBuilder.isReset()) {
|
||||
e.setBlocks(new CuboidRegion(toBlockVector3(pasteBuilder.getMinPoint()), toBlockVector3(pasteBuilder.getMaxPoint())), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock());
|
||||
e.setBlocks(new CuboidRegion(pasteBuilder.getMinPoint().toBlockVector3(), pasteBuilder.getMaxPoint().toBlockVector3()), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock());
|
||||
if (pasteBuilder.getWaterLevel() != 0) {
|
||||
e.setBlocks(new CuboidRegion(toBlockVector3(pasteBuilder.getMinPoint()), toBlockVector3(pasteBuilder.getMaxPoint()).withY(pasteBuilder.getWaterLevel())), Objects.requireNonNull(BlockTypes.WATER).getDefaultState().toBaseBlock());
|
||||
e.setBlocks(new CuboidRegion(pasteBuilder.getMinPoint().toBlockVector3(), pasteBuilder.getMaxPoint().toBlockVector3().withY(pasteBuilder.getWaterLevel())), Objects.requireNonNull(BlockTypes.WATER).getDefaultState().toBaseBlock());
|
||||
}
|
||||
}
|
||||
Operations.completeBlindly(ch.createPaste(e).to(v).ignoreAirBlocks(pasteBuilder.isIgnoreAir()).build());
|
||||
@@ -193,7 +193,7 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
|
||||
@Override
|
||||
public Clipboard copy(Point minPoint, Point maxPoint, Point copyPoint) {
|
||||
BukkitWorld bukkitWorld = new BukkitWorld(Bukkit.getWorlds().get(0));
|
||||
CuboidRegion region = new CuboidRegion(bukkitWorld, toBlockVector3(minPoint), toBlockVector3(maxPoint));
|
||||
CuboidRegion region = new CuboidRegion(bukkitWorld, minPoint.toBlockVector3(), maxPoint.toBlockVector3());
|
||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region);
|
||||
try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(bukkitWorld, -1)) {
|
||||
ForwardExtentCopy copy = new ForwardExtentCopy(
|
||||
@@ -204,7 +204,7 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
|
||||
copy.setCopyingBiomes(false);
|
||||
|
||||
Operations.complete(copy);
|
||||
clipboard.setOrigin(toBlockVector3(copyPoint));
|
||||
clipboard.setOrigin(copyPoint.toBlockVector3());
|
||||
return clipboard;
|
||||
} catch (WorldEditException e) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e);
|
||||
@@ -224,10 +224,6 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
private BlockVector3 toBlockVector3(Point point) {
|
||||
return BlockVector3.at(point.getX(), point.getY(), point.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inWater(org.bukkit.World world, Vector tntPosition) {
|
||||
Block block = world.getBlockAt(tntPosition.getBlockX(), tntPosition.getBlockY(), tntPosition.getBlockZ());
|
||||
|
||||
@@ -19,27 +19,21 @@
|
||||
|
||||
package de.steamwar.bausystem.utils;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import de.steamwar.Reflection;
|
||||
import de.steamwar.bausystem.features.util.NoClipCommand;
|
||||
import net.minecraft.server.v1_15_R1.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.LongSupplier;
|
||||
|
||||
public class NMSWrapper15 implements NMSWrapper {
|
||||
|
||||
private static final Reflection.FieldAccessor<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
||||
private static final Reflection.Field<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
@@ -63,7 +57,7 @@ public class NMSWrapper15 implements NMSWrapper {
|
||||
player.updateInventory();
|
||||
}
|
||||
|
||||
private static final Reflection.FieldAccessor<Integer> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, int.class, 0);
|
||||
private static final Reflection.Field<Integer> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, int.class, 0);
|
||||
|
||||
@Override
|
||||
public void setGameStateChangeReason(Object packet) {
|
||||
@@ -120,12 +114,12 @@ public class NMSWrapper15 implements NMSWrapper {
|
||||
return invalid;
|
||||
}
|
||||
|
||||
private final Class<?> explosionPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion");
|
||||
private final Reflection.FieldAccessor<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
||||
private final Reflection.FieldAccessor<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
||||
private final Reflection.FieldAccessor<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
||||
private final Reflection.FieldAccessor<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
||||
private final Reflection.FieldAccessor<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
||||
private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
|
||||
private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
||||
private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
||||
private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
||||
private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
||||
private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
||||
|
||||
@Override
|
||||
public Object resetExplosionKnockback(Object packet) {
|
||||
|
||||
@@ -19,12 +19,9 @@
|
||||
|
||||
package de.steamwar.bausystem.utils;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import de.steamwar.bausystem.utils.PlayerMovementWrapper;
|
||||
import de.steamwar.Reflection;
|
||||
import net.minecraft.server.v1_15_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayInFlying;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayOutEntity;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayOutEntityTeleport;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -46,14 +43,9 @@ public class PlayerMovementWrapper15 implements PlayerMovementWrapper {
|
||||
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
||||
Object packet = Reflection.newInstance(teleportPacket);
|
||||
teleportEntity.set(packet, player.getEntityId());
|
||||
teleportPosition.set(packet, packetPlayInFlying.a(0.0), packetPlayInFlying.b(0.0), packetPlayInFlying.c(0.0));
|
||||
if (Float.isNaN(packetPlayInFlying.a(Float.NaN))) {
|
||||
teleportYaw.set(packet, rotToByte(player.getLocation().getYaw()));
|
||||
teleportPitch.set(packet, rotToByte(player.getLocation().getPitch()));
|
||||
} else {
|
||||
teleportYaw.set(packet, rotToByte(packetPlayInFlying.a(0.0F)));
|
||||
teleportPitch.set(packet, rotToByte(packetPlayInFlying.b(0.0F)));
|
||||
}
|
||||
teleportPosition.set(packet, packetPlayInFlying.a(0.0), packetPlayInFlying.b(0.0), packetPlayInFlying.c(0.0),
|
||||
Float.isNaN(packetPlayInFlying.a(Float.NaN)) ? player.getLocation().getYaw() : packetPlayInFlying.a(0.0F),
|
||||
Float.isNaN(packetPlayInFlying.b(Float.NaN)) ? player.getLocation().getPitch() : packetPlayInFlying.b(0.0F));
|
||||
return packet;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.utils;
|
||||
|
||||
import de.steamwar.bausystem.region.GlobalRegion;
|
||||
import de.steamwar.bausystem.utils.bossbar.BossBarService;
|
||||
import de.steamwar.bausystem.utils.tps.TPSFreezeUtils;
|
||||
import de.steamwar.bausystem.utils.tps.TPSLimitUtils;
|
||||
import de.steamwar.core.TPSWarpUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class TickManager15 implements TickManager, Listener {
|
||||
|
||||
private static float currentTPSLimit = 20;
|
||||
private boolean currentlyStepping = false;
|
||||
private float currentLimit;
|
||||
private int stepsTotal;
|
||||
private int stepsLeft;
|
||||
|
||||
@Override
|
||||
public boolean canFreeze() {
|
||||
return TPSFreezeUtils.isCanFreeze();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTickRate(float tickRate) {
|
||||
if (currentlyStepping) {
|
||||
currentlyStepping = false;
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
BossBarService.instance.remove(player, GlobalRegion.getInstance(), "TickStep");
|
||||
});
|
||||
}
|
||||
TPSWarpUtils.warp(tickRate);
|
||||
if (currentTPSLimit == 0 && tickRate != 0) {
|
||||
TPSFreezeUtils.unfreeze();
|
||||
}
|
||||
currentTPSLimit = tickRate;
|
||||
if (tickRate == 0) {
|
||||
TPSLimitUtils.unlimit();
|
||||
TPSFreezeUtils.freeze();
|
||||
} else if (tickRate < 20.0) {
|
||||
TPSLimitUtils.limit(tickRate);
|
||||
} else if (tickRate >= 20) {
|
||||
TPSLimitUtils.unlimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFrozen() {
|
||||
return TPSFreezeUtils.frozen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFreeze(boolean freeze) {
|
||||
if (freeze) {
|
||||
setTickRate(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stepTicks(int ticks) {
|
||||
currentLimit = 0;
|
||||
setTickRate(20);
|
||||
stepsLeft = ticks;
|
||||
stepsTotal = ticks;
|
||||
currentlyStepping = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sprintTicks(int ticks) {
|
||||
currentLimit = currentTPSLimit;
|
||||
setTickRate(4000);
|
||||
stepsLeft = ticks;
|
||||
stepsTotal = ticks;
|
||||
currentlyStepping = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSprinting() {
|
||||
return currentlyStepping && currentTPSLimit > 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStepping() {
|
||||
return currentlyStepping && currentTPSLimit <= 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTickRate() {
|
||||
return currentTPSLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockTpsPacket(boolean block) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTotalTicks() {
|
||||
return stepsTotal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDoneTicks() {
|
||||
return stepsTotal - stepsLeft;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRemainingTicks() {
|
||||
return stepsLeft;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTickEnd(TickEndEvent event) {
|
||||
if (!currentlyStepping) return;
|
||||
stepsLeft--;
|
||||
if (stepsLeft <= 0) {
|
||||
setTickRate(currentLimit);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,25 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2023 SteamWar.de-Serverteam
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.features.tpslimit;
|
||||
package de.steamwar.bausystem.utils.tps;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import de.steamwar.Reflection;
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.core.BountifulWrapper;
|
||||
import de.steamwar.core.ChatWrapper;
|
||||
@@ -45,18 +45,18 @@ class PacketCache {
|
||||
private static Set<Entity> entities = new HashSet<>();
|
||||
private static BukkitTask task = null;
|
||||
|
||||
private static Class<?> vec3dClass = Reflection.getClass("{nms.world.phys}.Vec3D");
|
||||
private static Reflection.FieldAccessor<Object> zeroVec3d = (Reflection.FieldAccessor<Object>) Reflection.getField(vec3dClass, vec3dClass, 0);
|
||||
private static Class<?> vec3dClass = Reflection.getClass("net.minecraft.world.phys.Vec3");
|
||||
private static Reflection.Field<Object> zeroVec3d = (Reflection.Field<Object>) Reflection.getField(vec3dClass, vec3dClass, 0);
|
||||
private static Object ZERO_VEC3D = zeroVec3d.get(null);
|
||||
private static Class<?> velocityPacketClass = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutEntityVelocity");
|
||||
private static Reflection.ConstructorInvoker velocityPacketConstructor = Reflection.getConstructor(velocityPacketClass, int.class, vec3dClass);
|
||||
private static Class<?> velocityPacketClass = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket");
|
||||
private static Reflection.Constructor velocityPacketConstructor = Reflection.getConstructor(velocityPacketClass, int.class, vec3dClass);
|
||||
|
||||
private static Class<?> teleportPacketClass = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutEntityTeleport");
|
||||
private static Class<?> entityClass = Reflection.getClass("{nms.world.entity}.Entity");
|
||||
private static Reflection.ConstructorInvoker teleportPacketConstructor = Reflection.getConstructor(teleportPacketClass, entityClass);
|
||||
private static Class<?> teleportPacketClass = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket");
|
||||
private static Class<?> entityClass = Reflection.getClass("net.minecraft.world.entity.Entity");
|
||||
private static Reflection.Constructor teleportPacketConstructor = Reflection.getConstructor(teleportPacketClass, entityClass);
|
||||
|
||||
private static Class<?> craftEntityClass = Reflection.getClass("{obc}.entity.CraftEntity");
|
||||
private static Reflection.MethodInvoker getHandle = Reflection.getMethod(craftEntityClass, "getHandle");
|
||||
private static Class<?> craftEntityClass = Reflection.getClass("org.bukkit.craftbukkit.entity.CraftEntity");
|
||||
private static Reflection.Method getHandle = Reflection.getMethod(craftEntityClass, "getHandle");
|
||||
|
||||
private static Object noGravityDataWatcher = BountifulWrapper.impl.getDataWatcherObject(5, Boolean.class);
|
||||
private static Object fuseDataWatcher = BountifulWrapper.impl.getDataWatcherObject(8, Integer.class);
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.utils.tps;
|
||||
|
||||
import de.steamwar.Reflection;
|
||||
import lombok.Getter;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
||||
@UtilityClass
|
||||
public class TPSFreezeUtils {
|
||||
|
||||
private static Reflection.Field<Boolean> fieldAccessor;
|
||||
@Getter
|
||||
private static final boolean canFreeze;
|
||||
|
||||
private static final Reflection.Method getWorldHandle = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.CraftWorld"), "getHandle", null);
|
||||
|
||||
@Getter
|
||||
private static boolean frozen = false;
|
||||
|
||||
private static final World world = Bukkit.getWorlds().get(0);
|
||||
|
||||
static {
|
||||
Reflection.Field<Boolean> fieldAccessor;
|
||||
try {
|
||||
fieldAccessor = Reflection.getField(Reflection.getClass("net.minecraft.server.level.ServerLevel"), "freezed", boolean.class);
|
||||
} catch (IllegalArgumentException e) {
|
||||
fieldAccessor = null;
|
||||
}
|
||||
canFreeze = fieldAccessor != null;
|
||||
TPSFreezeUtils.fieldAccessor = fieldAccessor;
|
||||
}
|
||||
|
||||
public void freeze() {
|
||||
setFreeze(world, true);
|
||||
}
|
||||
|
||||
public void unfreeze() {
|
||||
setFreeze(world, false);
|
||||
}
|
||||
|
||||
public boolean frozen() {
|
||||
return canFreeze && frozen;
|
||||
}
|
||||
|
||||
private void setFreeze(World world, boolean state) {
|
||||
if (canFreeze) {
|
||||
fieldAccessor.set(getWorldHandle.invoke(world), state);
|
||||
if (state) {
|
||||
PacketCache.continuousSendCache();
|
||||
} else {
|
||||
PacketCache.clearCache();
|
||||
}
|
||||
frozen = state;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,17 +17,14 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.features.tpslimit;
|
||||
package de.steamwar.bausystem.utils.tps;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import de.steamwar.Reflection;
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.utils.PlayerMovementWrapper;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.core.TPSWatcher;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
@@ -104,8 +101,8 @@ public class TPSLimitUtils {
|
||||
}
|
||||
*/
|
||||
|
||||
private static final Class<?> position = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPosition");
|
||||
private static final Class<?> positionLook = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPositionLook");
|
||||
private static final Class<?> position = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Pos");
|
||||
private static final Class<?> positionLook = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$PosRot");
|
||||
static {
|
||||
BiFunction<Player, Object, Object> positionSetter = (player, o) -> {
|
||||
if (tpsLimiter != null) {
|
||||
@@ -27,8 +27,8 @@ java {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":BauSystem:BauSystem_Main"))
|
||||
compileOnly(project(":SpigotCore"))
|
||||
compileOnly(project(":BauSystem:BauSystem_Main", "default"))
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
|
||||
compileOnly(libs.spigotapi)
|
||||
compileOnly(libs.nms18)
|
||||
|
||||
@@ -19,36 +19,26 @@
|
||||
|
||||
package de.steamwar.bausystem.utils;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.Reflection;
|
||||
import de.steamwar.bausystem.features.util.NoClipCommand;
|
||||
import net.minecraft.SystemUtils;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.*;
|
||||
import net.minecraft.server.level.PlayerInteractManager;
|
||||
import net.minecraft.world.level.EnumGamemode;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.LongSupplier;
|
||||
|
||||
public class NMSWrapper18 implements NMSWrapper {
|
||||
|
||||
private static final Reflection.FieldAccessor<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
||||
private static final Reflection.Field<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
@@ -73,7 +63,7 @@ public class NMSWrapper18 implements NMSWrapper {
|
||||
player.updateInventory();
|
||||
}
|
||||
|
||||
private static final Reflection.FieldAccessor<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
||||
private static final Reflection.Field<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
||||
|
||||
@Override
|
||||
public void setGameStateChangeReason(Object packet) {
|
||||
@@ -130,12 +120,12 @@ public class NMSWrapper18 implements NMSWrapper {
|
||||
return invalid;
|
||||
}
|
||||
|
||||
private final Class<?> explosionPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion");
|
||||
private final Reflection.FieldAccessor<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
||||
private final Reflection.FieldAccessor<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
||||
private final Reflection.FieldAccessor<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
||||
private final Reflection.FieldAccessor<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
||||
private final Reflection.FieldAccessor<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
||||
private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
|
||||
private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
||||
private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
||||
private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
||||
private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
||||
private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
||||
|
||||
@Override
|
||||
public Object resetExplosionKnockback(Object packet) {
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.utils;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import de.steamwar.bausystem.utils.PlayerMovementWrapper;
|
||||
import de.steamwar.Reflection;
|
||||
import net.minecraft.network.protocol.game.PacketPlayInFlying;
|
||||
import net.minecraft.server.level.EntityPlayer;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer;
|
||||
@@ -44,14 +43,9 @@ public class PlayerMovementWrapper18 implements PlayerMovementWrapper {
|
||||
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
||||
Object packet = Reflection.newInstance(teleportPacket);
|
||||
teleportEntity.set(packet, player.getEntityId());
|
||||
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c);
|
||||
if (packetPlayInFlying.h) {
|
||||
teleportYaw.set(packet, rotToByte(player.getLocation().getYaw()));
|
||||
teleportPitch.set(packet, rotToByte(player.getLocation().getPitch()));
|
||||
} else {
|
||||
teleportYaw.set(packet, rotToByte(packetPlayInFlying.d));
|
||||
teleportPitch.set(packet, rotToByte(packetPlayInFlying.e));
|
||||
}
|
||||
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c,
|
||||
packetPlayInFlying.h ? player.getLocation().getYaw() : packetPlayInFlying.d,
|
||||
packetPlayInFlying.h ? player.getLocation().getPitch() : packetPlayInFlying.e);
|
||||
return packet;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ java {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":BauSystem:BauSystem_Main"))
|
||||
compileOnly(project(":SpigotCore"))
|
||||
compileOnly(project(":BauSystem:BauSystem_Main", "default"))
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
|
||||
compileOnly(libs.spigotapi)
|
||||
compileOnly(libs.paperapi)
|
||||
|
||||
@@ -19,37 +19,26 @@
|
||||
|
||||
package de.steamwar.bausystem.utils;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.Reflection;
|
||||
import de.steamwar.bausystem.features.util.NoClipCommand;
|
||||
import net.minecraft.SystemUtils;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.*;
|
||||
import net.minecraft.network.syncher.DataWatcher;
|
||||
import net.minecraft.server.level.PlayerInteractManager;
|
||||
import net.minecraft.world.level.EnumGamemode;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.LongSupplier;
|
||||
|
||||
public class NMSWrapper19 implements NMSWrapper {
|
||||
|
||||
private static final Reflection.FieldAccessor<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
||||
private static final Reflection.Field<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
@@ -73,7 +62,7 @@ public class NMSWrapper19 implements NMSWrapper {
|
||||
player.updateInventory();
|
||||
}
|
||||
|
||||
private static final Reflection.FieldAccessor<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
||||
private static final Reflection.Field<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
||||
|
||||
@Override
|
||||
public void setGameStateChangeReason(Object packet) {
|
||||
@@ -130,12 +119,12 @@ public class NMSWrapper19 implements NMSWrapper {
|
||||
return invalid;
|
||||
}
|
||||
|
||||
private final Class<?> explosionPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion");
|
||||
private final Reflection.FieldAccessor<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
||||
private final Reflection.FieldAccessor<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
||||
private final Reflection.FieldAccessor<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
||||
private final Reflection.FieldAccessor<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
||||
private final Reflection.FieldAccessor<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
||||
private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
|
||||
private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
||||
private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
||||
private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
||||
private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
||||
private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
||||
|
||||
@Override
|
||||
public Object resetExplosionKnockback(Object packet) {
|
||||
|
||||
@@ -19,17 +19,12 @@
|
||||
|
||||
package de.steamwar.bausystem.utils;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import de.steamwar.Reflection;
|
||||
import net.minecraft.network.protocol.game.PacketPlayInFlying;
|
||||
import net.minecraft.server.level.EntityPlayer;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlayerMovementWrapper19 implements PlayerMovementWrapper {
|
||||
|
||||
@Override
|
||||
@@ -48,14 +43,9 @@ public class PlayerMovementWrapper19 implements PlayerMovementWrapper {
|
||||
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
||||
Object packet = Reflection.newInstance(teleportPacket);
|
||||
teleportEntity.set(packet, player.getEntityId());
|
||||
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c);
|
||||
if (packetPlayInFlying.h) {
|
||||
teleportYaw.set(packet, rotToByte(player.getLocation().getYaw()));
|
||||
teleportPitch.set(packet, rotToByte(player.getLocation().getPitch()));
|
||||
} else {
|
||||
teleportYaw.set(packet, rotToByte(packetPlayInFlying.d));
|
||||
teleportPitch.set(packet, rotToByte(packetPlayInFlying.e));
|
||||
}
|
||||
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c,
|
||||
packetPlayInFlying.h ? player.getLocation().getYaw() : packetPlayInFlying.d,
|
||||
packetPlayInFlying.h ? player.getLocation().getPitch() : packetPlayInFlying.e);
|
||||
return packet;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ package de.steamwar.bausystem.utils;
|
||||
import com.destroystokyo.paper.event.server.ServerTickEndEvent;
|
||||
import com.destroystokyo.paper.event.server.ServerTickStartEvent;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.features.tpslimit.TPSFreezeUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -37,7 +36,7 @@ public class TickListener19 implements TickListener, Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onServerTickStart(ServerTickStartEvent event) {
|
||||
if (TPSFreezeUtils.isFrozen()) return;
|
||||
if (TickManager.impl.isFrozen()) return;
|
||||
Bukkit.getPluginManager().callEvent(new TickStartEvent());
|
||||
tickStartRan = true;
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ java {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":BauSystem:BauSystem_Main"))
|
||||
compileOnly(project(":SpigotCore"))
|
||||
compileOnly(project(":BauSystem:BauSystem_Main", "default"))
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
|
||||
compileOnly(libs.spigotapi)
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.utils;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import de.steamwar.Reflection;
|
||||
import de.steamwar.bausystem.features.util.NoClipCommand;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -40,7 +40,7 @@ import java.util.List;
|
||||
|
||||
public class NMSWrapper20 implements NMSWrapper {
|
||||
|
||||
private static final Reflection.FieldAccessor<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
||||
private static final Reflection.Field<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
@@ -64,7 +64,7 @@ public class NMSWrapper20 implements NMSWrapper {
|
||||
player.updateInventory();
|
||||
}
|
||||
|
||||
private static final Reflection.FieldAccessor<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
||||
private static final Reflection.Field<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
||||
|
||||
@Override
|
||||
public void setGameStateChangeReason(Object packet) {
|
||||
@@ -121,12 +121,12 @@ public class NMSWrapper20 implements NMSWrapper {
|
||||
return invalid;
|
||||
}
|
||||
|
||||
private final Class<?> explosionPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion");
|
||||
private final Reflection.FieldAccessor<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
||||
private final Reflection.FieldAccessor<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
||||
private final Reflection.FieldAccessor<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
||||
private final Reflection.FieldAccessor<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
||||
private final Reflection.FieldAccessor<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
||||
private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
|
||||
private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
||||
private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
||||
private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
||||
private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
||||
private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
||||
|
||||
@Override
|
||||
public Object resetExplosionKnockback(Object packet) {
|
||||
|
||||
@@ -19,18 +19,12 @@
|
||||
|
||||
package de.steamwar.bausystem.utils;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import de.steamwar.Reflection;
|
||||
import net.minecraft.network.protocol.game.PacketPlayInFlying;
|
||||
import net.minecraft.network.protocol.game.PacketPlayOutEntityTeleport;
|
||||
import net.minecraft.server.level.EntityPlayer;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlayerMovementWrapper20 implements PlayerMovementWrapper {
|
||||
|
||||
@Override
|
||||
@@ -49,14 +43,9 @@ public class PlayerMovementWrapper20 implements PlayerMovementWrapper {
|
||||
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
||||
Object packet = Reflection.newInstance(teleportPacket);
|
||||
teleportEntity.set(packet, player.getEntityId());
|
||||
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c);
|
||||
if (packetPlayInFlying.h) {
|
||||
teleportYaw.set(packet, rotToByte(player.getLocation().getYaw()));
|
||||
teleportPitch.set(packet, rotToByte(player.getLocation().getPitch()));
|
||||
} else {
|
||||
teleportYaw.set(packet, rotToByte(packetPlayInFlying.d));
|
||||
teleportPitch.set(packet, rotToByte(packetPlayInFlying.e));
|
||||
}
|
||||
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c,
|
||||
packetPlayInFlying.h ? player.getLocation().getYaw() : packetPlayInFlying.d,
|
||||
packetPlayInFlying.h ? player.getLocation().getPitch() : packetPlayInFlying.e);
|
||||
return packet;
|
||||
}
|
||||
}
|
||||
|
||||
17
BauSystem/BauSystem_21/build.gradle.kts
Normal file
17
BauSystem/BauSystem_21/build.gradle.kts
Normal file
@@ -0,0 +1,17 @@
|
||||
plugins {
|
||||
steamwar.java
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":BauSystem:BauSystem_Main", "default"))
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
|
||||
compileOnly(libs.paperapi21)
|
||||
|
||||
compileOnly(libs.nms21)
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2024 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.utils;
|
||||
|
||||
import de.steamwar.Reflection;
|
||||
import de.steamwar.bausystem.features.util.NoClipCommand;
|
||||
import io.papermc.paper.datacomponent.DataComponentTypes;
|
||||
import io.papermc.paper.datacomponent.item.ItemContainerContents;
|
||||
import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundExplodePacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundGameEventPacket;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.level.ServerPlayerGameMode;
|
||||
import net.minecraft.world.entity.player.Abilities;
|
||||
import net.minecraft.world.level.GameType;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerGameModeChangeEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class NMSWrapper21 implements NMSWrapper {
|
||||
|
||||
private static final Reflection.Field<ServerPlayerGameMode> playerInteractManager = Reflection.getField(ServerPlayer.class, null, ServerPlayerGameMode.class);
|
||||
|
||||
@Override
|
||||
public void setInternalGameMode(Player player, GameMode gameMode) {
|
||||
playerInteractManager.get(((CraftPlayer) player).getHandle()).changeGameModeForPlayer(GameType.byId(gameMode.getValue()), PlayerGameModeChangeEvent.Cause.UNKNOWN, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSlotToItemStack(Player player, Object o) {
|
||||
ClientboundContainerSetSlotPacket packetPlayInSetCreativeSlot = (ClientboundContainerSetSlotPacket) o;
|
||||
int index = packetPlayInSetCreativeSlot.getSlot();
|
||||
if (index >= 36 && index <= 44) {
|
||||
index -= 36;
|
||||
} else if (index > 44) {
|
||||
index -= 5;
|
||||
} else if (index <= 8) {
|
||||
index = index - 8 + 36;
|
||||
}
|
||||
player.getInventory().setItem(index, CraftItemStack.asBukkitCopy(packetPlayInSetCreativeSlot.getItem()));
|
||||
if (index < 9) player.getInventory().setHeldItemSlot(index);
|
||||
player.updateInventory();
|
||||
}
|
||||
|
||||
private static final Reflection.Field<ClientboundGameEventPacket.Type> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, ClientboundGameEventPacket.Type.class, 12);
|
||||
|
||||
@Override
|
||||
public void setGameStateChangeReason(Object packet) {
|
||||
gameStateChangeReason.set(packet, ClientboundGameEventPacket.CHANGE_GAME_MODE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerBuildAbilities(Player player) {
|
||||
Abilities abilities = (((CraftPlayer) player).getHandle()).getAbilities();
|
||||
abilities.mayBuild = true;
|
||||
abilities.mayfly = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material pathMaterial() {
|
||||
return Material.DIRT_PATH;
|
||||
}
|
||||
|
||||
private static final int threshold = 2048;
|
||||
|
||||
@Override
|
||||
public boolean checkItemStack(ItemStack item) {
|
||||
ItemContainerContents data = item.getData(DataComponentTypes.CONTAINER);
|
||||
if (data == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return drillDown(data.contents(), 0, 0) > threshold;
|
||||
}
|
||||
|
||||
private int drillDown(List<ItemStack> items, int layer, int start) {
|
||||
if (layer > 2) return start + threshold;
|
||||
int invalid = start;
|
||||
for (int i = start; i < items.size(); i++) {
|
||||
ItemStack item = items.get(i);
|
||||
if (item.isEmpty()) continue;
|
||||
|
||||
invalid += item.getAmount();
|
||||
|
||||
ItemContainerContents data = item.getData(DataComponentTypes.CONTAINER);
|
||||
if (data == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
List<ItemStack> subItems = data.contents();
|
||||
if (subItems.size() > 1) {
|
||||
invalid = drillDown(subItems, layer + 1, invalid);
|
||||
}
|
||||
}
|
||||
return invalid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resetExplosionKnockback(Object packet) {
|
||||
ClientboundExplodePacket explosion = (ClientboundExplodePacket) packet;
|
||||
|
||||
return new ClientboundExplodePacket(
|
||||
explosion.center(),
|
||||
Optional.empty(),
|
||||
explosion.explosionParticle(),
|
||||
explosion.explosionSound()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.utils;
|
||||
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.Reflection;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import net.minecraft.network.protocol.game.ClientboundTickingStatePacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.ServerTickRateManager;
|
||||
import net.minecraft.world.TickRateManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TickManager21 implements TickManager {
|
||||
private static final ServerTickRateManager manager = MinecraftServer.getServer().tickRateManager();
|
||||
private static final Reflection.Field<Integer> frozenTicksToRun = Reflection.getField(TickRateManager.class, int.class, 0);
|
||||
private static final Reflection.Field<Long> remainingSprintTicks = Reflection.getField(ServerTickRateManager.class, long.class, 0);
|
||||
|
||||
private boolean blockTpsPacket = true;
|
||||
private int totalSteps;
|
||||
|
||||
public TickManager21() {
|
||||
TinyProtocol.instance.addFilter(ClientboundTickingStatePacket.class, this::blockPacket);
|
||||
}
|
||||
|
||||
private Object blockPacket(Player player, Object packet) {
|
||||
if (blockTpsPacket) {
|
||||
return new ClientboundTickingStatePacket(20, manager.isFrozen());
|
||||
} else {
|
||||
return packet;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFreeze() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockTpsPacket(boolean block) {
|
||||
blockTpsPacket = block;
|
||||
if (blockTpsPacket) {
|
||||
ClientboundTickingStatePacket packet = new ClientboundTickingStatePacket(20, manager.isFrozen());
|
||||
Bukkit.getOnlinePlayers().forEach(player -> TinyProtocol.instance.sendPacket(player, packet));
|
||||
} else {
|
||||
ClientboundTickingStatePacket packet = new ClientboundTickingStatePacket(manager.tickrate(), manager.isFrozen());
|
||||
Bukkit.getOnlinePlayers().forEach(player -> TinyProtocol.instance.sendPacket(player, packet));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTickRate(float tickRate) {
|
||||
if (isFrozen()) {
|
||||
setFreeze(false);
|
||||
}
|
||||
manager.setTickRate(tickRate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFrozen() {
|
||||
return manager.isFrozen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFreeze(boolean freeze) {
|
||||
manager.setFrozen(freeze);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stepTicks(int ticks) {
|
||||
if (manager.isSprinting()) {
|
||||
manager.stopSprinting();
|
||||
} else if (manager.isSteppingForward()) {
|
||||
manager.stopStepping();
|
||||
}
|
||||
this.totalSteps = ticks;
|
||||
manager.setFrozen(true);
|
||||
manager.stepGameIfPaused(ticks);
|
||||
manager.setFrozen(false);
|
||||
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), (bukkitTask) -> {
|
||||
if (manager.isSteppingForward()) return;
|
||||
manager.setFrozen(true);
|
||||
bukkitTask.cancel();
|
||||
}, 1, 1);
|
||||
manager.tick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sprintTicks(int ticks) {
|
||||
if (manager.isSteppingForward()) {
|
||||
manager.stopStepping();
|
||||
} else if (manager.isSprinting()) {
|
||||
manager.stopSprinting();
|
||||
}
|
||||
this.totalSteps = ticks;
|
||||
manager.requestGameToSprint(ticks, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSprinting() {
|
||||
return manager.isSprinting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStepping() {
|
||||
return manager.isSteppingForward();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTickRate() {
|
||||
return manager.tickrate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRemainingTicks() {
|
||||
if (isSprinting()) {
|
||||
return remainingSprintTicks.get(manager);
|
||||
} else {
|
||||
return frozenTicksToRun.get(manager);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDoneTicks() {
|
||||
return totalSteps - getRemainingTicks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTotalTicks() {
|
||||
return totalSteps;
|
||||
}
|
||||
}
|
||||
@@ -33,14 +33,12 @@ java {
|
||||
dependencies {
|
||||
compileOnly(libs.classindex)
|
||||
annotationProcessor(libs.classindex)
|
||||
compileOnly(project(":SpigotCore"))
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
|
||||
compileOnly(libs.spigotapi)
|
||||
compileOnly(libs.axiom)
|
||||
compileOnly(libs.authlib)
|
||||
compileOnly(libs.viaapi)
|
||||
|
||||
compileOnly(libs.nms20)
|
||||
compileOnly(libs.fawe18)
|
||||
|
||||
implementation(libs.luaj)
|
||||
|
||||
@@ -25,7 +25,7 @@ PAGE_LIST=§e Page ({0}/{1}) »»
|
||||
LIST_PREVIOUS_PAGE=§ePrevious page
|
||||
LIST_NEXT_PAGE=§eNext page
|
||||
# Permissions
|
||||
NO_PERMISSION=You are not allowed to use that here
|
||||
NO_PERMISSION=§7You are not allowed to use that here
|
||||
SPECTATOR=§fSpectator
|
||||
# Scoreboard
|
||||
SCOREBOARD_TIME=Time
|
||||
@@ -38,6 +38,7 @@ SCOREBOARD_TRACE_TICKS=Ticks
|
||||
SCOREBOARD_TECHHIDER=TechHider§8: §aOn
|
||||
SCOREBOARD_XRAY=XRay§8: §aOn
|
||||
SCOREBOARD_LOCK_TEAM=Bau Lock§8: §eTeam
|
||||
SCOREBOARD_LOCK_SUPERVISOR=Bau Lock§8: §eSupervisor
|
||||
SCOREBOARD_LOCK_TEAM_AND_SERVERTEAM=Bau Lock§8: §e(Server) Team
|
||||
SCOREBOARD_LOCK_SERVERTEAM=Bau Lock§8: §eServer Team
|
||||
SCOREBOARD_LOCK_NOBODY=Bau Lock§8: §cNobody
|
||||
@@ -271,6 +272,7 @@ SIMULATOR_CHANGE_HELP=§8/§esimulator change §8-§7 Change your simulator wand
|
||||
SIMULATOR_DELETE_HELP=§8/§esimulator delete §8[§7name§8] §8-§7 Deletes the simulator
|
||||
SIMULATOR_START_HELP=§8/§esimulator start §8[§7name§8] §8-§7 Starts the simulator
|
||||
SIMULATOR_COPY_HELP=§8/§esimulator copy §8[§7to-copy§8] §8[§7name§8] §8-§7 Copy the simulator
|
||||
SIMULATOR_RENAME_HELP=§8/§esimulator rename §8[§7to-rename§8] §8[§7name§8] §8-§7 Rename the simulator
|
||||
SIMULATOR_GUI_ITEM_NAME=§eTNT Simulator
|
||||
SIMULATOR_NO_SIM_IN_HAND=§cNo simulator item selected
|
||||
SIMULATOR_GUI_SELECT_SIM=Simulator selection
|
||||
@@ -307,6 +309,7 @@ SIMULATOR_POSITION_Z=§7z-Position
|
||||
SIMULATOR_BACK=§eBack
|
||||
SIMULATOR_GUI_TOTAL_TNT=§7Total TNT§8: §e{0}
|
||||
SIMULATOR_DELETED=§cSimulator deleted
|
||||
SIMULATOR_RENAMED=§cSimulator renamed from {0} to {1}
|
||||
## GUI
|
||||
SIMULATOR_POSITION_EDIT=§eEdit position
|
||||
SIMULATOR_POSITION_ADD=§eSet position
|
||||
@@ -387,6 +390,12 @@ INVENTORY_FILL_HELP=§8/§einventoryfill §8- §7Toggles InventoryFill
|
||||
INVENTORY_FILL_INFO=§7Helps you fill containers by looking at them while sneaking and dropping the item. Or just scroll on a container to change the amount of the item inside.
|
||||
INVENTORY_FILL_ENABLE=§aInventoryFiller activated
|
||||
INVENTORY_FILL_DISABLE=§cInventoryFiller deactivated
|
||||
INVENTORY_FILL_GUI_NAME=Inventory Filler
|
||||
INVENTORY_FILL_GUI_POWER=§ePower§8:§7 {0}
|
||||
INVENTORY_FILL_GUI_TNT=§eTNT
|
||||
# Ray Visualizer
|
||||
RAY_VISUALIZER_ENABLE=§aRayVisualizer activated
|
||||
RAY_VISUALIZER_DISABLE=§aRayVisualizer deactivated
|
||||
# Killchecker
|
||||
KILLCHECKER_HELP_ENABLE=§8/§ekillchecker enable §8- §7Enables Killchecker / Recalculates kills
|
||||
KILLCHECKER_HELP_DISABLE=§8/§ekillchecker disable §8- §7Disables Killchecker
|
||||
@@ -394,6 +403,7 @@ KILLCHECKER_INFO=§7Shows the overlaps of cannon kills in your build area.
|
||||
KILLCHECKER_INFO2=§7Only colorable blocks like Wool, Terractotta, Stained Glass and Concrete are counted.
|
||||
KILLCHECKER_ENABLE=§aKillchecker activated
|
||||
KILLCHECKER_DISABLE=§cKillchecker deactivated
|
||||
KILLCHECKER_NO_BUILD=§cThere is no Build Area in this Region
|
||||
KILLCHECKER_BOSSBAR=§e§l{0} §7(§e{1}%§7) §e§l{2}§7 cannons
|
||||
# BlockCounter
|
||||
BLOCK_COUNTER_HELP_TOGGLE=§8/§eblockcounter §8- §7Toggle on/off
|
||||
@@ -404,6 +414,8 @@ BLOCK_COUNTER_MESSAGE_SECOND=§7Damage §8> §e{0} §7Blocks §e{1} §7TNT §e
|
||||
BLOCK_COUNTER_ENABLE=§7BlockCounter activated
|
||||
BLOCK_COUNTER_DISABLE=§7BlockCounter deactivated
|
||||
# DepthCounter
|
||||
DEPTH_COUNTER_DISABLE=§7Depth Counter disabled
|
||||
DEPTH_COUNTER_ENABLE=§7Depth Counter enabled
|
||||
DEPTH_COUNTER_MESSAGE=§7Depth §8> §7
|
||||
DEPTH_COUNTER_COUNT={0}{1}§8×{2}{3}§8×{4}{5}
|
||||
DEPTH_COUNTER_HOVER=§7X§8×§7Y§8×§7Z
|
||||
@@ -510,7 +522,7 @@ LOADER_HELP_GUI=§8/§7loader gui §8- §7Shows Loader gui
|
||||
LOADER_HELP_STOP=§8/§eloader stop §8- §7Stops recording/playback
|
||||
LOADER_HELP_WAIT=§8/§7loader wait §8[§7Ticks§8] - §7Sets wait time between shots
|
||||
LOADER_HELP_SPEED=§8/§7loader speed §8[§7Ticks§8] - §7Sets wait time between actions
|
||||
LOADER_NO_LOADER=§cYou have no Laoder. Create one with /loader setup
|
||||
LOADER_NO_LOADER=§cYou have no Loader. Create one with /loader setup
|
||||
LOADER_NEW=§7Load your cannon and fire it once, to initialise the loader.
|
||||
LOADER_HOW_TO_START=§7Then, execute /§eloader start§7 to start the Loader
|
||||
LOADER_ACTIVE=§7The Loader is now active.
|
||||
@@ -842,7 +854,7 @@ LAUFBAU_SETTINGS_INACTIVE=§cInactive
|
||||
LAUFBAU_SETTINGS_MIXED=§e{0}§8/§e{1} §aActive
|
||||
LAUFBAU_SETTINGS_GUI_BACK=§eBack
|
||||
LAUFBAU_SETTINGS_TOGGLE=§eClick §8-§7 Toggle
|
||||
LAUFBAU_SETTINGS_ADVANCED=§eMiddle-Click §8-§7 Advanced settings
|
||||
LAUFBAU_SETTINGS_ADVANCED=§eLeft-Click §8-§7 Advanced settings
|
||||
LAUFBAU_BLOCK_COBWEB=§eCobweb
|
||||
LAUFBAU_BLOCK_GRASS_PATH=§eGrass Path
|
||||
LAUFBAU_BLOCK_SOUL_SAND=§eSoul Sand
|
||||
@@ -928,7 +940,6 @@ SELECT_HELP=§8/§eselect §8[§7RegionsTyp§8] §8- §7Select a region type
|
||||
SELECT_EXTENSION_HELP=§8/§eselect §8[§7RegionsTyp§8] §8[§7Extension§8] §8- §7Select a region type with or without extension
|
||||
SELECT_GLOBAL_REGION=§cThe global region cannot be selected
|
||||
SELECT_NO_TYPE=§cThis region has no {0}
|
||||
SELECT_NO_EXTENSION=§cThis region has no extension
|
||||
SELECT_MESSAGE=§7WorldEdit selection set to {0}, {1}, {2} and {3}, {4}, {5}
|
||||
SKULL_HELP=§8/§eskull §8[§eplayer§8] §8-§7 Receive a player head
|
||||
SKULL_INVALID=§cInvalid player name
|
||||
@@ -943,6 +954,9 @@ SPEED_TAB_NAME=Input speed
|
||||
WORLDEDIT_WAND=WorldEdit Wand
|
||||
WORLDEDIT_LEFTCLICK=Left click: select pos #1
|
||||
WORLDEDIT_RIGHTCLICK=Right click: select pos #2
|
||||
TNT_DETAILS_COMMAND=§8/§etntdetails §8-§7 Toggle information printed after clicking on a TNT
|
||||
TNT_DETAILS_ON = §eTNTDetails §aactivated
|
||||
TNT_DETAILS_OFF = §eTNTDetails §cdeactivated
|
||||
TNT_CLICK_HEADER=§8---=== §eTNT §8===---
|
||||
TNT_CLICK_ORDER=§eEntity Order§8: §e{0}
|
||||
TNT_CLICK_FUSE_TIME=§eFuseTime§8: §e{0}
|
||||
@@ -1011,6 +1025,4 @@ XRAY_OFF=§cXray deactivated
|
||||
COLORREPLACE_HELP=§8//§ecolorreplace §8[§7color§8] §8[§7color§8] §8- §7Replace all blocks of one color with another
|
||||
TYPEREPLACE_HELP=§8//§etypereplace §8[§7type§8] §8[§7type§8] §8- §7Replace all blocks of one type with another
|
||||
# Schematic
|
||||
SCHEMATIC_GUI_ITEM=§eSchematics
|
||||
#VersionAnnouncer
|
||||
SERVER_VERSION=§7This server runs on Minecraft version §e{0}
|
||||
SCHEMATIC_GUI_ITEM=§eSchematics
|
||||
@@ -25,7 +25,7 @@ PAGE_LIST=§e Seite ({0}/{1}) »»
|
||||
LIST_PREVIOUS_PAGE=§eVorherige Seite
|
||||
LIST_NEXT_PAGE=§eNächste Seite
|
||||
# Permission
|
||||
NO_PERMISSION=Du darfst dies hier nicht nutzen
|
||||
NO_PERMISSION=§7Du darfst dies hier nicht nutzen
|
||||
SPECTATOR=§fZuschauer
|
||||
# Scoreboard
|
||||
SCOREBOARD_TIME=Uhrzeit
|
||||
@@ -254,6 +254,7 @@ SIMULATOR_CHANGE_HELP=§8/§esimulator change §8-§7 Wechsel zu einem anderen S
|
||||
SIMULATOR_DELETE_HELP=§8/§esimulator delete §8[§7name§8] §8-§7 Löscht den Simulator
|
||||
SIMULATOR_START_HELP=§8/§esimulator start §8[§7name§8] §8-§7 Startet die Simulation
|
||||
SIMULATOR_COPY_HELP=§8/§esimulator copy §8[§7to-copy§8] §8[§7name§8] §8-§7 Kopiert einen Simulator
|
||||
SIMULATOR_RENAME_HELP=§8/§esimulator rename §8[§7to-rename§8] §8[§7name§8] §8-§7 Benennt einen Simulator um
|
||||
SIMULATOR_GUI_ITEM_NAME=§eTNT Simulator
|
||||
SIMULATOR_NO_SIM_IN_HAND=§cKein Simulator Item gewählt
|
||||
SIMULATOR_GUI_SELECT_SIM=Simulator wählen
|
||||
@@ -290,6 +291,7 @@ SIMULATOR_POSITION_Z=§7z-Position
|
||||
SIMULATOR_BACK=§eZurück
|
||||
SIMULATOR_GUI_TOTAL_TNT=§7Gesamt TNT§8: §e{0}
|
||||
SIMULATOR_DELETED=§cSimulator gelöscht
|
||||
SIMULATOR_RENAMED=§cSimulator von {0} zu {1} umbenannt
|
||||
## GUI
|
||||
SIMULATOR_POSITION_EDIT=§ePosition bearbeiten
|
||||
SIMULATOR_POSITION_ADD=§ePosition setzen
|
||||
@@ -348,8 +350,11 @@ SMART_PLACE_DISABLE=§cSmartPlace deaktiviert
|
||||
# InventoryFiller
|
||||
INVENTORY_FILL_HELP=§8/§einventoryfill §8- §7Toggled InventoryFill
|
||||
INVENTORY_FILL_INFO=§7Hilft dir, Behälter zu füllen, indem du sie beim sneaken ansiehst und den Gegenstand fallen lässt. Oder scrolle einfach auf einen Behälter, um die Menge des gehaltenen Gegenstandes darin zu ändern.
|
||||
INVENTORY_FILL_ENABLE=§aInventoryFiller activated
|
||||
INVENTORY_FILL_DISABLE=§cInventoryFiller deactivated
|
||||
INVENTORY_FILL_ENABLE=§aInventoryFiller aktiviert
|
||||
INVENTORY_FILL_DISABLE=§cInventoryFiller deaktiviert
|
||||
# Ray Visualizer
|
||||
RAY_VISUALIZER_ENABLE=§aRayVisualizer aktiviert
|
||||
RAY_VISUALIZER_DISABLE=§aRayVisualizer deaktiviert
|
||||
# Killchecker
|
||||
KILLCHECKER_HELP_ENABLE=§8/§ekillchecker enable §8- §7Aktiviert Killchecker / Berechnet kills neu
|
||||
KILLCHECKER_HELP_DISABLE=§8/§ekillchecker disable §8- §7Deaktiviert Killchecker
|
||||
@@ -357,6 +362,7 @@ KILLCHECKER_INFO=§7Zeigt Überlappungen der Kanonen Kills im Baubereich an.
|
||||
KILLCHECKER_INFO2=§7Nur farbige Blöcke wie Wolle, Terracotta, Stained Glass und Concrete wird gezählt.
|
||||
KILLCHECKER_ENABLE=§aKillchecker aktiviert
|
||||
KILLCHECKER_DISABLE=§cKillchecker deaktiviert
|
||||
KILLCHECKER_NO_BUILD=§cEs gibt keinen Baubereich in dieser Region
|
||||
KILLCHECKER_BOSSBAR=§e§l{0} §7(§e{1}%§7) §e§l{2}§7 Kanonnen
|
||||
# BlockCounter
|
||||
BLOCK_COUNTER_HELP_TOGGLE=§8/§eblockcounter §8- §7Wechsel zwischen an und aus
|
||||
@@ -367,6 +373,8 @@ BLOCK_COUNTER_MESSAGE_SECOND=§7Schaden §8> §e{0} §7Blöcke §e{1} §7TNT
|
||||
BLOCK_COUNTER_ENABLE=§7BlockCounter angemacht
|
||||
BLOCK_COUNTER_DISABLE=§7BlockCounter ausgemacht
|
||||
# DepthCounter
|
||||
DEPTH_COUNTER_DISABLE=§7Depth Counter deaktiviert
|
||||
DEPTH_COUNTER_ENABLE=§7Depth Counter aktiviert
|
||||
DEPTH_COUNTER_MESSAGE=§7Tiefe §8> §7
|
||||
# TPSLimit
|
||||
TPSLIMIT_FREEZE_HELP=§8/§etpslimit 0 §8-§7 Friere TPS ein
|
||||
@@ -788,7 +796,7 @@ LAUFBAU_SETTINGS_INACTIVE=§cInaktiv
|
||||
LAUFBAU_SETTINGS_MIXED=§e{0}§8/§e{1} §aAktiv
|
||||
LAUFBAU_SETTINGS_GUI_BACK=§eBack
|
||||
LAUFBAU_SETTINGS_TOGGLE=§eClick §8-§7 Toggle
|
||||
LAUFBAU_SETTINGS_ADVANCED=§eMiddle-Click §8-§7 Erweiterte Einstellung
|
||||
LAUFBAU_SETTINGS_ADVANCED=§eLinks-Click §8-§7 Erweiterte Einstellung
|
||||
LAUFBAU_BLOCK_COBWEB=§eCobweb
|
||||
LAUFBAU_BLOCK_GRASS_PATH=§eGrass Path
|
||||
LAUFBAU_BLOCK_SOUL_SAND=§eSoul Sand
|
||||
@@ -870,7 +878,6 @@ SELECT_HELP=§8/§eselect §8[§7RegionsTyp§8] §8- §7Wähle einen RegionsTyp
|
||||
SELECT_EXTENSION_HELP=§8/§eselect §8[§7RegionsTyp§8] §8[§7Extension§8] §8- §7Wähle einen RegionsTyp aus mit oder ohne Extension
|
||||
SELECT_GLOBAL_REGION=§cDie globale Region kannst du nicht auswählen
|
||||
SELECT_NO_TYPE=§cDiese Region hat keinen {0}
|
||||
SELECT_NO_EXTENSION=§cDiese Region hat keine Ausfahrmaße
|
||||
SELECT_MESSAGE=§7WorldEdit auswahl auf {0}, {1}, {2} und {3}, {4}, {5} gesetzt
|
||||
SKULL_HELP=§8/§eskull §8[§eSpieler§8] §8-§7 Gibt einen SpielerKopf
|
||||
SKULL_INVALID=§cUngültiger Spieler
|
||||
@@ -885,6 +892,9 @@ SPEED_TAB_NAME=Geschwindigkeit eingeben
|
||||
WORLDEDIT_WAND=WorldEdit Wand
|
||||
WORLDEDIT_LEFTCLICK=Left click: select pos #1
|
||||
WORLDEDIT_RIGHTCLICK=Right click: select pos #2
|
||||
TNT_DETAILS_COMMAND=§8/§etntdetails §8-§7 Aktiviert/Deaktiviert das senden von Details beim Klick auf TNT
|
||||
TNT_DETAILS_ON = §eTNTDetails §aaktiviert
|
||||
TNT_DETAILS_OFF = §eTNTDetails §cdeaktiviert
|
||||
TNT_CLICK_HEADER=§8---=== §eTNT §8===---
|
||||
TNT_CLICK_ORDER=§eEntity Order§8: §e{0}
|
||||
TNT_CLICK_FUSE_TIME=§eFuseTime§8: §e{0}
|
||||
@@ -952,6 +962,4 @@ XRAY_OFF=§cXray deaktiviert
|
||||
COLORREPLACE_HELP=§8//§ecolorreplace §8[§7color§8] §8[§7color§8] §8- §7Ersetzt eine Farbe mit einer anderen
|
||||
TYPEREPLACE_HELP=§8//§etyreplace §8[§7type§8] §8[§7type§8] §8- §7Ersetzt einen Blockgruppe mit einer anderen
|
||||
# Schematics
|
||||
SCHEMATIC_GUI_ITEM=§eSchematics
|
||||
#VersionAnnouncer
|
||||
SERVER_VERSION=§7Dieser Server läuft auf Minecraft-Version §e{0}
|
||||
SCHEMATIC_GUI_ITEM=§eSchematics
|
||||
@@ -25,21 +25,23 @@ import de.steamwar.bausystem.configplayer.ConfigConverter;
|
||||
import de.steamwar.bausystem.features.gui.BauGUI;
|
||||
import de.steamwar.bausystem.features.script.lua.SteamWarLuaPlugin;
|
||||
import de.steamwar.bausystem.features.script.lua.libs.LuaLib;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||
import de.steamwar.bausystem.features.slaves.panzern.Panzern;
|
||||
import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm;
|
||||
import de.steamwar.bausystem.features.tpslimit.TPSFreezeUtils;
|
||||
import de.steamwar.bausystem.features.tracer.TraceManager;
|
||||
import de.steamwar.bausystem.features.tracer.TraceRecorder;
|
||||
import de.steamwar.bausystem.features.world.BauScoreboard;
|
||||
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||
import de.steamwar.bausystem.region.loader.PrototypeLoader;
|
||||
import de.steamwar.bausystem.region.loader.RegionLoader;
|
||||
import de.steamwar.bausystem.region.loader.Updater;
|
||||
import de.steamwar.bausystem.region.RegionSystem;
|
||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||
import de.steamwar.bausystem.utils.TickListener;
|
||||
import de.steamwar.bausystem.utils.TickManager;
|
||||
import de.steamwar.bausystem.worlddata.WorldData;
|
||||
import de.steamwar.command.AbstractValidator;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.SWCommandUtils;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.core.WorldEditRendererCUIEditor;
|
||||
import de.steamwar.linkage.LinkedInstance;
|
||||
import de.steamwar.linkage.MaxVersion;
|
||||
import de.steamwar.linkage.MinVersion;
|
||||
@@ -70,7 +72,7 @@ import java.util.function.Consumer;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class BauSystem extends JavaPlugin implements Listener {
|
||||
public class BauSystem extends JavaPlugin {
|
||||
|
||||
// This should be treated as final!
|
||||
public static Message MESSAGE;
|
||||
@@ -91,6 +93,8 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
instance = this;
|
||||
SWUtils.setBausystem(instance);
|
||||
|
||||
RegionSystem.INSTANCE.load();
|
||||
/*
|
||||
try {
|
||||
PrototypeLoader.load();
|
||||
RegionLoader.load();
|
||||
@@ -103,6 +107,7 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
|
||||
new Updater(PrototypeLoader.file, PrototypeLoader::load);
|
||||
new Updater(RegionLoader.file, RegionLoader::load);
|
||||
*/
|
||||
|
||||
SWCommandUtils.addValidator(Player.class, validator(Permission.BUILD));
|
||||
SWCommandUtils.addValidator(CommandSender.class, validator(Permission.BUILD));
|
||||
@@ -182,6 +187,9 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
if (any instanceof ConfigConverter) {
|
||||
Config.addConfigConverter((ConfigConverter) any);
|
||||
}
|
||||
if (any instanceof BoundingBoxLoader) {
|
||||
((BoundingBoxLoader) any).load();
|
||||
}
|
||||
});
|
||||
|
||||
instances.forEach((clazz, o) -> {
|
||||
@@ -197,6 +205,11 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
});
|
||||
|
||||
TickListener.impl.init();
|
||||
|
||||
TraceManager.instance.init();
|
||||
TraceRecorder.instance.init();
|
||||
|
||||
new WorldEditRendererCUIEditor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -211,6 +224,7 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
});
|
||||
|
||||
WorldData.write();
|
||||
RegionSystem.INSTANCE.save();
|
||||
Config.getInstance().saveAll();
|
||||
}
|
||||
|
||||
@@ -254,7 +268,7 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (TPSFreezeUtils.isFrozen()) return;
|
||||
if (TickManager.impl.isFrozen()) return;
|
||||
if (counter >= delay) {
|
||||
runnable.run();
|
||||
cancel();
|
||||
@@ -272,7 +286,7 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (TPSFreezeUtils.isFrozen()) return;
|
||||
if (TickManager.impl.isFrozen()) return;
|
||||
if (counter >= (first ? delay : period)) {
|
||||
first = false;
|
||||
runnable.run();
|
||||
|
||||
@@ -21,11 +21,9 @@ package de.steamwar.bausystem;
|
||||
|
||||
import de.steamwar.bausystem.config.BauServer;
|
||||
import de.steamwar.bausystem.features.world.BauMemberUpdate;
|
||||
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
|
||||
import de.steamwar.sql.BauweltMember;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
@@ -24,7 +24,6 @@ import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.MinVersion;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@@ -24,8 +24,6 @@ import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.bausystem.utils.ItemUtils;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.linkage.Linked;
|
||||
@@ -44,8 +42,9 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Linked
|
||||
public class AutostartListener implements Listener {
|
||||
@@ -106,11 +105,11 @@ public class AutostartListener implements Listener {
|
||||
|
||||
public void activate(Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (region.isGlobal()) {
|
||||
if (region.getType().isGlobal()) {
|
||||
BauSystem.MESSAGE.send("AUTOSTART_MESSAGE_NO_REGION", player);
|
||||
return;
|
||||
}
|
||||
if (!region.hasType(RegionType.TESTBLOCK)) {
|
||||
if (region.getTestblockArea().isEmpty()) {
|
||||
BauSystem.MESSAGE.send("AUTOSTART_MESSAGE_NO_REGION", player);
|
||||
return;
|
||||
}
|
||||
@@ -131,8 +130,7 @@ public class AutostartListener implements Listener {
|
||||
event.blockList().forEach(block -> {
|
||||
Region region = Region.getRegion(block.getLocation());
|
||||
if (!regionStartTime.containsKey(region)) return;
|
||||
if (!region.hasType(RegionType.TESTBLOCK)) return;
|
||||
if (!region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) return;
|
||||
if (!region.getTestblockArea().inRegion(block.getLocation(), true)) return;
|
||||
long tickDiff = TPSUtils.currentRealTick.get() - regionStartTime.remove(region);
|
||||
long preFightDurationInSeconds = getPreFightDurationInSeconds(region);
|
||||
RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT1", tickDiff);
|
||||
@@ -142,7 +140,7 @@ public class AutostartListener implements Listener {
|
||||
}
|
||||
|
||||
private int getPreFightDurationInSeconds(Region region) {
|
||||
File file = region.gameModeConfig();
|
||||
File file = region.getGameModeConfig().orElse(null);
|
||||
if (file == null) return 30;
|
||||
FileConfiguration config = YamlConfiguration.loadConfiguration(file);
|
||||
return config.getInt("Times.PreFightDuration", 30);
|
||||
|
||||
@@ -19,31 +19,23 @@
|
||||
|
||||
package de.steamwar.bausystem.features.backup;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.region.Color;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionBackups;
|
||||
import de.steamwar.bausystem.region.flags.ChangedMode;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
|
||||
import de.steamwar.bausystem.region.tags.Tag;
|
||||
import de.steamwar.bausystem.utils.PasteBuilder;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.SWCommandUtils;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.inventory.SWListInv;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Linked
|
||||
@@ -54,7 +46,7 @@ public class BackupCommand extends SWCommand {
|
||||
}
|
||||
|
||||
static boolean checkGlobalRegion(Region region, Player p) {
|
||||
if (region.isGlobal()) {
|
||||
if (region.getType().isGlobal()) {
|
||||
BauSystem.MESSAGE.send("BACKUP_REGION_NO_REGION", p);
|
||||
return true;
|
||||
}
|
||||
@@ -67,11 +59,12 @@ public class BackupCommand extends SWCommand {
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return;
|
||||
}
|
||||
if (!region.get(Tag.CHANGED)) {
|
||||
if (region.getFlags().get(Flag.CHANGED).isWithDefault(ChangedMode.NO_CHANGE)) {
|
||||
BauSystem.MESSAGE.send("BACKUP_CREATE_NO_CHANGE", p);
|
||||
return;
|
||||
}
|
||||
if (region.backup()) {
|
||||
Optional<RegionBackups.Backup> backup = region.getBackups().create(RegionBackups.BackupType.MANUAL);
|
||||
if (backup.isPresent()) {
|
||||
BauSystem.MESSAGE.send("BACKUP_CREATE_SUCCESS", p);
|
||||
} else {
|
||||
BauSystem.MESSAGE.send("BACKUP_CREATE_FAILURE", p);
|
||||
@@ -79,25 +72,17 @@ public class BackupCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "load", description = "BACKUP_HELP_LOAD")
|
||||
public void backupLoad(@Validator("owner") Player p, @Mapper("backupName") String backupName) {
|
||||
public void backupLoad(@Validator("owner") Player p, @Mapper("backup") RegionBackups.Backup backup) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return;
|
||||
}
|
||||
|
||||
File backupFile = region.getBackupFile(backupName.replace('_', ' '));
|
||||
if (backupFile == null) {
|
||||
if (backup.load()) {
|
||||
BauSystem.MESSAGE.send("BACKUP_LOAD", p);
|
||||
} else {
|
||||
BauSystem.MESSAGE.send("BACKUP_LOAD_FAILURE", p);
|
||||
return;
|
||||
}
|
||||
EditSession editSession = new PasteBuilder(new PasteBuilder.FileProvider(backupFile))
|
||||
.pastePoint(region.getMinPoint().add(region.getPrototype().getSizeX() / 2, 0, region.getPrototype().getSizeZ() / 2))
|
||||
.minPoint(region.getMinPoint())
|
||||
.maxPoint(region.getMaxPoint())
|
||||
.waterLevel(region.getWaterLevel())
|
||||
.run();
|
||||
region.remember(editSession);
|
||||
BauSystem.MESSAGE.send("BACKUP_LOAD", p);
|
||||
}
|
||||
|
||||
@Register(value = "list", description = "BACKUP_HELP_LIST")
|
||||
@@ -106,10 +91,10 @@ public class BackupCommand extends SWCommand {
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return;
|
||||
}
|
||||
List<String> backups = listBackup(p);
|
||||
List<RegionBackups.Backup> backups = listBackup(p);
|
||||
BauSystem.MESSAGE.send("BACKUP_LIST_HEAD", p, backups.size());
|
||||
backups.forEach(s -> {
|
||||
BauSystem.MESSAGE.send("BACKUP_LIST_ENTRY", p, "/backup load " + s, new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/backup load " + s), s);
|
||||
backups.forEach(backup -> {
|
||||
BauSystem.MESSAGE.send("BACKUP_LIST_ENTRY", p, "/backup load " + backup.getName(), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/backup load " + backup.getName()), backup.getName());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -119,34 +104,44 @@ public class BackupCommand extends SWCommand {
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return;
|
||||
}
|
||||
List<String> backups = listBackup(p);
|
||||
List<SWListInv.SWListEntry<String>> swListEntries = new ArrayList<>();
|
||||
List<RegionBackups.Backup> backups = listBackup(p);
|
||||
List<SWListInv.SWListEntry<RegionBackups.Backup>> swListEntries = new ArrayList<>();
|
||||
List<String> lore = Arrays.asList(BauSystem.MESSAGE.parse("BACKUP_LORE", p));
|
||||
for (int i = 0; i < backups.size(); i++) {
|
||||
String s = backups.get(i);
|
||||
SWItem swItem = new SWItem(Material.BRICK, BauSystem.MESSAGE.parse("BACKUP_ITEM_NAME", p, s), lore, false, clickType -> {});
|
||||
RegionBackups.Backup backup = backups.get(i);
|
||||
SWItem swItem = new SWItem(Material.BRICK, BauSystem.MESSAGE.parse("BACKUP_ITEM_NAME", p, backup.getName()), lore, false, clickType -> {});
|
||||
swItem.getItemStack().setAmount(i + 1);
|
||||
swListEntries.add(new SWListInv.SWListEntry<>(swItem, s));
|
||||
swListEntries.add(new SWListInv.SWListEntry<>(swItem, backup));
|
||||
}
|
||||
SWListInv<String> swListInv = new SWListInv<>(p, BauSystem.MESSAGE.parse("BACKUP_INV_NAME", p), swListEntries, (clickType, s) -> {
|
||||
SWListInv<RegionBackups.Backup> swListInv = new SWListInv<>(p, BauSystem.MESSAGE.parse("BACKUP_INV_NAME", p), swListEntries, (clickType, s) -> {
|
||||
p.getOpenInventory().close();
|
||||
p.performCommand("backup load " + s);
|
||||
});
|
||||
swListInv.open();
|
||||
}
|
||||
|
||||
@Mapper(value = "backupName", local = true)
|
||||
public TypeMapper<String> backupMapper() {
|
||||
return SWCommandUtils.createMapper(s -> s, (commandSender, s) -> listBackup((Player) commandSender));
|
||||
@Mapper(value = "backup", local = true)
|
||||
public TypeMapper<RegionBackups.Backup> backupMapper() {
|
||||
return new TypeMapper<RegionBackups.Backup>() {
|
||||
@Override
|
||||
public RegionBackups.Backup map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
return Region.getRegion(((Player) commandSender).getLocation()).getBackups().get(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) {
|
||||
return listBackup((Player) sender).stream().map(RegionBackups.Backup::getName).collect(Collectors.toList());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private List<String> listBackup(Player p) {
|
||||
private List<RegionBackups.Backup> listBackup(Player p) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
try {
|
||||
return region.listBackup().stream().map(s -> s.substring(0, s.length() - 6).replace(' ', '_')).collect(Collectors.toList());
|
||||
return region.getBackups().list();
|
||||
} catch (NullPointerException e) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.BauServer;
|
||||
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||
import de.steamwar.bausystem.region.FlagOptional;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.core.Core;
|
||||
@@ -62,9 +63,9 @@ public class BauInfoBauGuiItem extends BauGuiItem {
|
||||
if (flag == Flag.ITEMS && Core.getVersion() < 19) {
|
||||
continue;
|
||||
}
|
||||
Flag.Value<?> value = region.get(flag);
|
||||
if (value != null) {
|
||||
stringList.add(BauSystem.MESSAGE.parse("BAU_INFO_ITEM_LORE_" + flag.name(), player, BauSystem.MESSAGE.parse(value.getChatValue(), player)));
|
||||
FlagOptional<?> value = region.getFlags().get(flag);
|
||||
if (value.isPresent()) {
|
||||
stringList.add(BauSystem.MESSAGE.parse("BAU_INFO_ITEM_LORE_" + flag.name(), player, BauSystem.MESSAGE.parse(value.getWithDefault().getChatValue(), player)));
|
||||
}
|
||||
}
|
||||
itemStack.setLore(stringList);
|
||||
|
||||
@@ -19,13 +19,11 @@
|
||||
|
||||
package de.steamwar.bausystem.features.bau;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.techhider.TechHider;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -3,6 +3,7 @@ package de.steamwar.bausystem.features.bau;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.BauServer;
|
||||
import de.steamwar.bausystem.region.FlagOptional;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.command.SWCommand;
|
||||
@@ -33,9 +34,9 @@ public class InfoCommand extends SWCommand {
|
||||
if (flag == Flag.PROTECT && region.getFloorLevel() == 0) {
|
||||
continue;
|
||||
}
|
||||
Flag.Value<?> value = region.get(flag);
|
||||
if (value != null) {
|
||||
BauSystem.MESSAGE.send("BAU_INFO_COMMAND_FLAG", p, BauSystem.MESSAGE.parse(flag.getChatValue(), p), BauSystem.MESSAGE.parse(value.getChatValue(), p));
|
||||
FlagOptional<?> value = region.getFlags().get(flag);
|
||||
if (value.isPresent()) {
|
||||
BauSystem.MESSAGE.send("BAU_INFO_COMMAND_FLAG", p, BauSystem.MESSAGE.parse(flag.getChatValue(), p), BauSystem.MESSAGE.parse(value.getWithDefault().getChatValue(), p));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.features.cannon.depth.Depth;
|
||||
import de.steamwar.bausystem.features.cannon.depth.DepthManager;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
@@ -85,8 +84,8 @@ public class CannonDetector implements Listener {
|
||||
grouped.forEach((cannonKey, tntPrimeds) -> {
|
||||
if (tntPrimeds.size() <= 5) return;
|
||||
Region region = Region.getRegion(tntPrimeds.get(0).getLocation());
|
||||
if (region.isGlobal()) return;
|
||||
if (!region.hasType(RegionType.TESTBLOCK)) return;
|
||||
if (region.getType().isGlobal()) return;
|
||||
if (region.getTestblockArea().isEmpty()) return;
|
||||
Depth depth = new Depth(region);
|
||||
DepthManager.init(tntPrimeds, depth);
|
||||
});
|
||||
|
||||
@@ -22,7 +22,6 @@ package de.steamwar.bausystem.features.cannon;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@@ -20,10 +20,9 @@
|
||||
package de.steamwar.bausystem.features.cannon.depth;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.configplayer.Config;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
@@ -49,7 +48,7 @@ public class Depth {
|
||||
|
||||
public void update(List<Block> blocks) {
|
||||
List<Block> blocksList = blocks.stream()
|
||||
.filter(block -> region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION))
|
||||
.filter(block -> region.getTestblockArea().inRegion(block.getLocation(), true))
|
||||
.collect(Collectors.toList());
|
||||
tntCount++;
|
||||
for (Block block : blocksList) {
|
||||
@@ -65,7 +64,9 @@ public class Depth {
|
||||
dimensions.setZ(Math.abs(dimensions.getZ()));
|
||||
|
||||
RegionUtils.message(region, player -> {
|
||||
player.spigot().sendMessage(getMessage(player, dimensions.getBlockX() + 1, dimensions.getBlockY() + 1, dimensions.getBlockZ() + 1, tntCount));
|
||||
if (Config.getInstance().get(player).getPlainValueOrDefault("depth_message", true)) {
|
||||
player.spigot().sendMessage(getMessage(player, dimensions.getBlockX() + 1, dimensions.getBlockY() + 1, dimensions.getBlockZ() + 1, tntCount));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.features.cannon.depth;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.configplayer.Config;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@Linked
|
||||
public class DepthCommand extends SWCommand {
|
||||
|
||||
public DepthCommand() {
|
||||
super("depth");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void toggle(Player player) {
|
||||
if (Config.getInstance().get(player).getPlainValueOrDefault("depth_message", true)) {
|
||||
Config.getInstance().get(player).put("depth_message", false);
|
||||
BauSystem.MESSAGE.send("DEPTH_COUNTER_DISABLE", player);
|
||||
} else {
|
||||
Config.getInstance().get(player).put("depth_message", true);
|
||||
BauSystem.MESSAGE.send("DEPTH_COUNTER_ENABLE", player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,12 +48,12 @@ public class DesignEndStone {
|
||||
private double maxBlastResistance;
|
||||
|
||||
public DesignEndStone(Region region) {
|
||||
this.minX = region.getMinPointBuild().getX();
|
||||
this.minY = region.getMinPointBuild().getY();
|
||||
this.minZ = region.getMinPointBuild().getZ();
|
||||
this.maxX = region.getMaxPointBuild().getX();
|
||||
this.maxY = region.getMaxPointBuild().getY();
|
||||
this.maxZ = region.getMaxPointBuild().getZ();
|
||||
this.minX = region.getBuildArea().getMinPoint(false).getX();
|
||||
this.minY = region.getBuildArea().getMinPoint(false).getY();
|
||||
this.minZ = region.getBuildArea().getMinPoint(false).getZ();
|
||||
this.maxX = region.getBuildArea().getMaxPoint(false).getX();
|
||||
this.maxY = region.getBuildArea().getMaxPoint(false).getY();
|
||||
this.maxZ = region.getBuildArea().getMaxPoint(false).getZ();
|
||||
wsOrAs = region.getName().startsWith("ws") || region.getName().startsWith("as");
|
||||
maxBlastResistance = wsOrAs ? 6.1 : 9.0;
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ package de.steamwar.bausystem.features.design.endstone;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
@@ -49,7 +48,7 @@ public class DesignEndStoneCommand extends SWCommand implements Listener {
|
||||
@Register(description = "DESIGN_ENDSTONE_COMMAND_HELP")
|
||||
public void genericCommand(@Validator Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (!region.hasType(RegionType.BUILD)) {
|
||||
if (region.getBuildArea().isEmpty()) {
|
||||
BauSystem.MESSAGE.send("DESIGN_ENDSTONE_REGION_ERROR", player);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ package de.steamwar.bausystem.features.gui.editor;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.features.gui.BauGUI;
|
||||
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.data.CMDs;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.inventory.SWListInv;
|
||||
import de.steamwar.linkage.Linked;
|
||||
@@ -72,8 +74,8 @@ public class BauGuiEditor implements Listener {
|
||||
|
||||
inv.setItem(mapping.getSize() + 5, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH", p), Arrays.asList(BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH_LORE", p)), false, clickType -> {
|
||||
}).getItemStack());
|
||||
inv.setItem(mapping.getSize() + 6, new SWItem(Material.SCUTE, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_MORE", p)).getItemStack());
|
||||
inv.setItem(mapping.getSize() + 8, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_CLOSE", p)).getItemStack());
|
||||
inv.setItem(mapping.getSize() + 6, new SWItem(TrickyTrialsWrapper.impl.getTurtleScute(), BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_MORE", p)).getItemStack());
|
||||
inv.setItem(mapping.getSize() + 8, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_CLOSE", p)).setCustomModelData(CMDs.BACK).getItemStack());
|
||||
|
||||
p.openInventory(inv);
|
||||
p.getOpenInventory().setCursor(cursor == null ? new SWItem().getItemStack() : cursor);
|
||||
|
||||
@@ -4,12 +4,45 @@ import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.configplayer.Config;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.inventory.SWInventory;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Barrel;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.ShulkerBox;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BlockStateMeta;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Linked
|
||||
public class InventoryFillerCommand extends SWCommand {
|
||||
|
||||
private static final Map<Integer, Integer> POWER_TO_FILLLEVEL = new HashMap<>();
|
||||
|
||||
static {
|
||||
POWER_TO_FILLLEVEL.put(0, 0);
|
||||
POWER_TO_FILLLEVEL.put(1, 1);
|
||||
POWER_TO_FILLLEVEL.put(2, 1 * 64 + 60);
|
||||
POWER_TO_FILLLEVEL.put(3, 3 * 64 + 55);
|
||||
POWER_TO_FILLLEVEL.put(4, 5 * 64 + 51);
|
||||
POWER_TO_FILLLEVEL.put(5, 7 * 64 + 46);
|
||||
POWER_TO_FILLLEVEL.put(6, 9 * 64 + 42);
|
||||
POWER_TO_FILLLEVEL.put(7, 11 * 64 + 37);
|
||||
POWER_TO_FILLLEVEL.put(8, 13 * 64 + 32);
|
||||
POWER_TO_FILLLEVEL.put(9, 15 * 64 + 28);
|
||||
POWER_TO_FILLLEVEL.put(10, 17 * 64 + 23);
|
||||
POWER_TO_FILLLEVEL.put(11, 19 * 64 + 19);
|
||||
POWER_TO_FILLLEVEL.put(12, 21 * 64 + 14);
|
||||
POWER_TO_FILLLEVEL.put(13, 23 * 64 + 10);
|
||||
POWER_TO_FILLLEVEL.put(14, 25 * 64 + 5);
|
||||
POWER_TO_FILLLEVEL.put(15, 27 * 64 + 0);
|
||||
}
|
||||
|
||||
public InventoryFillerCommand() {
|
||||
super("inventoryfill");
|
||||
}
|
||||
@@ -21,8 +54,116 @@ public class InventoryFillerCommand extends SWCommand {
|
||||
if (!inventoryFill) {
|
||||
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("INVENTORY_FILL_ENABLE", player));
|
||||
BauSystem.MESSAGE.send("INVENTORY_FILL_INFO", player);
|
||||
}else {
|
||||
} else {
|
||||
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("INVENTORY_FILL_DISABLE", player));
|
||||
}
|
||||
}
|
||||
|
||||
@Register("gui")
|
||||
public void gui(Player player) {
|
||||
SWInventory inventory = new SWInventory(player, 18, BauSystem.MESSAGE.parse("INVENTORY_FILL_GUI_NAME", player));
|
||||
inventory.setItem(0, new SWItem(Material.REDSTONE, BauSystem.MESSAGE.parse("INVENTORY_FILL_GUI_POWER", player, 0)).setAmount(1));
|
||||
inventory.setItem(1, new SWItem(Material.REDSTONE_TORCH, BauSystem.MESSAGE.parse("INVENTORY_FILL_GUI_POWER", player, 1)).setAmount(1));
|
||||
inventory.setItem(2, new SWItem(Material.REDSTONE_TORCH, BauSystem.MESSAGE.parse("INVENTORY_FILL_GUI_POWER", player, 2)).setAmount(2));
|
||||
inventory.setItem(3, new SWItem(Material.REDSTONE_TORCH, BauSystem.MESSAGE.parse("INVENTORY_FILL_GUI_POWER", player, 3)).setAmount(3));
|
||||
inventory.setItem(4, new SWItem(Material.REDSTONE_TORCH, BauSystem.MESSAGE.parse("INVENTORY_FILL_GUI_POWER", player, 4)).setAmount(4));
|
||||
inventory.setItem(5, new SWItem(Material.REDSTONE_TORCH, BauSystem.MESSAGE.parse("INVENTORY_FILL_GUI_POWER", player, 5)).setAmount(5));
|
||||
inventory.setItem(6, new SWItem(Material.REDSTONE_TORCH, BauSystem.MESSAGE.parse("INVENTORY_FILL_GUI_POWER", player, 6)).setAmount(6));
|
||||
inventory.setItem(7, new SWItem(Material.REDSTONE_TORCH, BauSystem.MESSAGE.parse("INVENTORY_FILL_GUI_POWER", player, 7)).setAmount(7));
|
||||
inventory.setItem(8, new SWItem(Material.REDSTONE_TORCH, BauSystem.MESSAGE.parse("INVENTORY_FILL_GUI_POWER", player, 8)).setAmount(8));
|
||||
inventory.setItem(9, new SWItem(Material.REDSTONE_TORCH, BauSystem.MESSAGE.parse("INVENTORY_FILL_GUI_POWER", player, 9)).setAmount(9));
|
||||
inventory.setItem(10, new SWItem(Material.REDSTONE_TORCH, BauSystem.MESSAGE.parse("INVENTORY_FILL_GUI_POWER", player, 10)).setAmount(10));
|
||||
inventory.setItem(11, new SWItem(Material.REDSTONE_TORCH, BauSystem.MESSAGE.parse("INVENTORY_FILL_GUI_POWER", player, 11)).setAmount(11));
|
||||
inventory.setItem(12, new SWItem(Material.REDSTONE_TORCH, BauSystem.MESSAGE.parse("INVENTORY_FILL_GUI_POWER", player, 12)).setAmount(12));
|
||||
inventory.setItem(13, new SWItem(Material.REDSTONE_TORCH, BauSystem.MESSAGE.parse("INVENTORY_FILL_GUI_POWER", player, 13)).setAmount(13));
|
||||
inventory.setItem(14, new SWItem(Material.REDSTONE_TORCH, BauSystem.MESSAGE.parse("INVENTORY_FILL_GUI_POWER", player, 14)).setAmount(14));
|
||||
inventory.setItem(15, new SWItem(Material.REDSTONE_TORCH, BauSystem.MESSAGE.parse("INVENTORY_FILL_GUI_POWER", player, 15)).setAmount(15));
|
||||
inventory.setItem(17, new SWItem(Material.TNT, BauSystem.MESSAGE.parse("INVENTORY_FILL_GUI_TNT", player)));
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
inventory.setEventCallback(i, inventoryClickEvent -> {
|
||||
selectInventoryType(player, inventoryClickEvent.getCurrentItem().getItemMeta().getDisplayName(), Material.DANDELION, POWER_TO_FILLLEVEL.get(inventoryClickEvent.getCurrentItem().getAmount()));
|
||||
});
|
||||
}
|
||||
inventory.setEventCallback(17, inventoryClickEvent -> {
|
||||
selectInventoryType(player, inventoryClickEvent.getCurrentItem().getItemMeta().getDisplayName(), Material.TNT, POWER_TO_FILLLEVEL.get(15));
|
||||
});
|
||||
|
||||
inventory.open();
|
||||
}
|
||||
|
||||
private final Material[] SHULKER_BOX_MATERIALS = new Material[]{
|
||||
Material.SHULKER_BOX,
|
||||
Material.WHITE_SHULKER_BOX,
|
||||
Material.LIGHT_GRAY_SHULKER_BOX,
|
||||
Material.GRAY_SHULKER_BOX,
|
||||
Material.BLACK_SHULKER_BOX,
|
||||
Material.BROWN_SHULKER_BOX,
|
||||
Material.RED_SHULKER_BOX,
|
||||
Material.ORANGE_SHULKER_BOX,
|
||||
Material.YELLOW_SHULKER_BOX,
|
||||
Material.LIME_SHULKER_BOX,
|
||||
Material.GREEN_SHULKER_BOX,
|
||||
Material.CYAN_SHULKER_BOX,
|
||||
Material.LIGHT_BLUE_SHULKER_BOX,
|
||||
Material.BLUE_SHULKER_BOX,
|
||||
Material.PURPLE_SHULKER_BOX,
|
||||
Material.MAGENTA_SHULKER_BOX,
|
||||
Material.PINK_SHULKER_BOX
|
||||
};
|
||||
|
||||
private void selectInventoryType(Player player, String name, Material material, int count) {
|
||||
ItemStack[] itemStacks = new ItemStack[27];
|
||||
int index = 0;
|
||||
int amount = count;
|
||||
while (amount > 0) {
|
||||
ItemStack stack;
|
||||
if (amount > 64) {
|
||||
stack = new ItemStack(material, 64);
|
||||
amount -= 64;
|
||||
} else {
|
||||
stack = new ItemStack(material, amount);
|
||||
amount = 0;
|
||||
}
|
||||
itemStacks[index++] = stack;
|
||||
}
|
||||
|
||||
SWInventory inventory = new SWInventory(player, 27, BauSystem.MESSAGE.parse("INVENTORY_FILL_GUI_NAME", player));
|
||||
int i = 0;
|
||||
for (Material type : SHULKER_BOX_MATERIALS) {
|
||||
inventory.setItemEvent(i++, generateFilledInventory(name, type, itemStacks), inventoryClickEvent -> {
|
||||
SWUtils.giveItemToPlayer(player, inventoryClickEvent.getCurrentItem());
|
||||
});
|
||||
}
|
||||
inventory.setItemEvent(27 - 6, generateFilledInventory(name, Material.CHEST, itemStacks), inventoryClickEvent -> {
|
||||
SWUtils.giveItemToPlayer(player, inventoryClickEvent.getCurrentItem());
|
||||
});
|
||||
inventory.setItemEvent(27 - 4, generateFilledInventory(name, Material.BARREL, itemStacks), inventoryClickEvent -> {
|
||||
SWUtils.giveItemToPlayer(player, inventoryClickEvent.getCurrentItem());
|
||||
});
|
||||
inventory.open();
|
||||
}
|
||||
|
||||
private ItemStack generateFilledInventory(String name, Material material, ItemStack[] itemStacks) {
|
||||
ItemStack itemStack = new ItemStack(material);
|
||||
BlockStateMeta meta = (BlockStateMeta) itemStack.getItemMeta();
|
||||
BlockState state = meta.getBlockState();
|
||||
|
||||
if (state instanceof ShulkerBox box) {
|
||||
box.getInventory().setContents(itemStacks);
|
||||
box.update();
|
||||
meta.setBlockState(box);
|
||||
} else if (state instanceof Chest chest) {
|
||||
chest.getInventory().setContents(itemStacks);
|
||||
chest.update();
|
||||
meta.setBlockState(chest);
|
||||
} else if (state instanceof Barrel barrel) {
|
||||
barrel.getInventory().setContents(itemStacks);
|
||||
barrel.update();
|
||||
meta.setBlockState(barrel);
|
||||
}
|
||||
meta.setDisplayName(name);
|
||||
itemStack.setItemMeta(meta);
|
||||
return itemStack;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Linked
|
||||
public class KillcheckerCommand extends SWCommand implements Listener {
|
||||
@@ -57,6 +56,10 @@ public class KillcheckerCommand extends SWCommand implements Listener {
|
||||
@Register(value = "enable", description = "KILLCHECKER_HELP_ENABLE")
|
||||
public void genericCommand(@Validator Player player, @OptionalValue("-outline") @StaticValue(value = {"-area", "-outline"}, allowISE = true) boolean onlyOutline) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (region.getBuildArea().isEmpty()) {
|
||||
BauSystem.MESSAGE.send("KILLCHECKER_NO_BUILD", player);
|
||||
return;
|
||||
}
|
||||
KillcheckerVisualizer killcheckerVisualizer = visualizers.computeIfAbsent(region, region1 -> new KillcheckerVisualizer(region1, bossBarService));
|
||||
killcheckerVisualizer.recalc();
|
||||
killcheckerVisualizer.show(player, onlyOutline);
|
||||
|
||||
@@ -22,8 +22,6 @@ package de.steamwar.bausystem.features.killchecker;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.region.Point;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
|
||||
import de.steamwar.bausystem.utils.bossbar.BossBarService;
|
||||
import de.steamwar.entity.REntity;
|
||||
@@ -75,8 +73,8 @@ public class KillcheckerVisualizer {
|
||||
|
||||
public KillcheckerVisualizer(Region region, BossBarService bossBarService) {
|
||||
this.region = region;
|
||||
this.minPoint = region.getMinPoint(RegionType.BUILD, RegionExtensionType.NORMAL);
|
||||
this.maxPoint = region.getMaxPoint(RegionType.BUILD, RegionExtensionType.NORMAL);
|
||||
this.minPoint = region.getBuildArea().getMinPoint(false);
|
||||
this.maxPoint = region.getBuildArea().getMaxPoint(false);
|
||||
|
||||
yArea = (maxPoint.getX() - minPoint.getX()) * (maxPoint.getZ() - minPoint.getZ());
|
||||
zArea = (maxPoint.getX() - minPoint.getX()) * (maxPoint.getY() - minPoint.getY());
|
||||
|
||||
@@ -73,7 +73,7 @@ public class Loader implements Listener {
|
||||
Bukkit.getPluginManager().registerEvents(this, BauSystem.getInstance());
|
||||
|
||||
BauSystem.runTaskTimer(BauSystem.getInstance(), () -> {
|
||||
if (stage != Stage.RUNNING) return;
|
||||
if (stage != Stage.RUNNING && stage != Stage.SINGLE) return;
|
||||
if(!Permission.BUILD.hasPermission(p)) return;
|
||||
if (waitTime > 0) {
|
||||
waitTime--;
|
||||
@@ -93,6 +93,7 @@ public class Loader implements Listener {
|
||||
element.execute(delay -> waitTime = delay);
|
||||
if (waitTime > 0) {
|
||||
if (element instanceof LoaderTNT) currentElement--;
|
||||
waitTime--;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -148,13 +149,16 @@ public class Loader implements Listener {
|
||||
}
|
||||
|
||||
public boolean setTicksBetweenShots(int delay) {
|
||||
if (elements.size() == 0) return false;
|
||||
if (elements.isEmpty()) return false;
|
||||
LoaderElement loaderElement = elements.get(elements.size() - 1);
|
||||
if (loaderElement instanceof LoaderWait) {
|
||||
((LoaderWait) loaderElement).setDelay(delay);
|
||||
return true;
|
||||
} else {
|
||||
LoaderWait loaderWait = new LoaderWait(delay);
|
||||
elements.add(loaderWait);
|
||||
pause();
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setTicksBetweenBlocks(int delay) {
|
||||
|
||||
@@ -44,7 +44,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class LoaderRecorder implements Listener {
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.loader.elements;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.data.CMDs;
|
||||
import de.steamwar.inventory.SWAnvilInv;
|
||||
import de.steamwar.inventory.SWInventory;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
@@ -113,7 +114,7 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
||||
});
|
||||
listInv.setItem(48, new SWItem(Material.ARROW, "§7Back", clickType -> {
|
||||
backAction.run();
|
||||
}));
|
||||
}).setCustomModelData(CMDs.BACK));
|
||||
listInv.setItem(50, new SWItem(Material.GHAST_SPAWN_EGG, "§7Insert another Setting", clickType -> {
|
||||
elements.add(defaultSetting);
|
||||
extraPower.add(0);
|
||||
@@ -150,7 +151,7 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
||||
|
||||
SWInventory swInventory = new SWInventory(player, guiSize, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
|
||||
for (int i = guiSize - 9; i < guiSize; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", clickType -> {}));
|
||||
swInventory.setItem(guiSize - 9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).getItemStack(), clickType -> back.run());
|
||||
swInventory.setItem(guiSize - 9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).setCustomModelData(CMDs.BACK).getItemStack(), clickType -> back.run());
|
||||
swInventory.setItem(guiSize - 5, new SWItem(Material.WOODEN_AXE, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_COPY", player)).getItemStack(), clickType -> {
|
||||
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_GUI_COPY_TITLE", player), "1");
|
||||
swAnvilInv.setCallback(s -> {
|
||||
|
||||
@@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.loader.elements.impl;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.features.loader.elements.LoaderElement;
|
||||
import de.steamwar.data.CMDs;
|
||||
import de.steamwar.inventory.SWAnvilInv;
|
||||
import de.steamwar.inventory.SWInventory;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
@@ -60,7 +61,7 @@ public class LoaderWait implements LoaderElement {
|
||||
public void click(Player player, Runnable backAction) {
|
||||
SWInventory swInventory = new SWInventory(player, 18, BauSystem.MESSAGE.parse("LOADER_GUI_WAIT_TITLE", player));
|
||||
for (int i = 9; i < 18; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
|
||||
swInventory.setItem(9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_WAIT_BACK", player)).getItemStack(), clickType -> backAction.run());
|
||||
swInventory.setItem(9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_WAIT_BACK", player)).setCustomModelData(CMDs.BACK).getItemStack(), clickType -> backAction.run());
|
||||
|
||||
swInventory.setItem(3, new SWItem(SWItem.getDye(1), BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
|
||||
delay -= clickType.isShiftClick() ? 5 : 1;
|
||||
|
||||
@@ -22,8 +22,6 @@ package de.steamwar.bausystem.features.loadtimer;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@@ -158,7 +156,7 @@ public class Loadtimer implements Listener {
|
||||
}
|
||||
|
||||
public void onTntExplode(EntityExplodeEvent event) {
|
||||
if (region.inRegion(event.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION) && stage == Stage.IGNITION) {
|
||||
if (region.getBuildArea().inRegion(event.getLocation(), true) && stage == Stage.IGNITION) {
|
||||
stage = Stage.END;
|
||||
explode = TPSUtils.currentRealTick.get();
|
||||
print();
|
||||
|
||||
@@ -39,7 +39,7 @@ public class LoadtimerCommand extends SWCommand {
|
||||
@Register(value = "start", description = {"LOADTIMER_HELP_START_2", "LOADTIMER_HELP_START_3"})
|
||||
public void start(@Validator Player p, TimerMode mode) {
|
||||
Region r = Region.getRegion(p.getLocation());
|
||||
if (r.isGlobal()) return;
|
||||
if (r.getType().isGlobal()) return;
|
||||
if (!Loadtimer.hasTimer(r))
|
||||
Loadtimer.createLoadtimer(r, mode == TimerMode.HALF);
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class LoadtimerCommand extends SWCommand {
|
||||
@Register(value = "stop", description = "LOADTIMER_HELP_STOP")
|
||||
public void stop(@Validator Player p) {
|
||||
Region r = Region.getRegion(p.getLocation());
|
||||
if (r.isGlobal()) return;
|
||||
if (r.getType().isGlobal()) return;
|
||||
if (Loadtimer.hasTimer(r))
|
||||
Loadtimer.getTimer(r).delete();
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class LoadtimerGuiItem extends BauGuiItem {
|
||||
@Override
|
||||
public ItemStack getItem(Player player) {
|
||||
Region r = Region.getRegion(player.getLocation());
|
||||
if (r.isGlobal())
|
||||
if (r.getType().isGlobal())
|
||||
return new SWItem(Material.BOWL, BauSystem.MESSAGE.parse("LOADTIMER_GUI_GLOBAL", player)).getItemStack();
|
||||
if (Loadtimer.hasTimer(r)) {
|
||||
return new SWItem(Material.BOW, BauSystem.MESSAGE.parse("LOADTIMER_GUI_STOP", player)).getItemStack();
|
||||
@@ -58,7 +58,7 @@ public class LoadtimerGuiItem extends BauGuiItem {
|
||||
@Override
|
||||
public boolean click(ClickType click, Player p) {
|
||||
Region r = Region.getRegion(p.getLocation());
|
||||
if (r.isGlobal()) return false;
|
||||
if (r.getType().isGlobal()) return false;
|
||||
if (Loadtimer.hasTimer(r)) {
|
||||
p.performCommand("lt stop");
|
||||
} else {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.loadtimer;
|
||||
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@@ -57,7 +58,7 @@ public class LoadtimerListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onEntitySpawn(EntitySpawnEvent event) {
|
||||
if (!getTimers().isEmpty() && event.getEntityType() == EntityType.PRIMED_TNT) {
|
||||
if (!getTimers().isEmpty() && event.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
|
||||
Region r = Region.getRegion(event.getLocation());
|
||||
if (hasTimer(r)) {
|
||||
getTimer(r).onTntSpawn();
|
||||
@@ -67,7 +68,7 @@ public class LoadtimerListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onEntityExplode(EntityExplodeEvent event) {
|
||||
if (!getTimers().isEmpty() && event.getEntityType() == EntityType.PRIMED_TNT) {
|
||||
if (!getTimers().isEmpty() && event.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
|
||||
Region r = Region.getRegion(event.getLocation());
|
||||
if (hasTimer(r)) {
|
||||
getTimer(r).onTntExplode(event);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.features.observer;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import de.steamwar.Reflection;
|
||||
import de.steamwar.bausystem.region.Point;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@@ -170,7 +170,7 @@ public class ObserverTracer {
|
||||
}
|
||||
}
|
||||
|
||||
private static final Class<?> craftPoweredRail = Reflection.getClass("{obc}.block.impl.CraftPoweredRail");
|
||||
private static final Class<?> craftPoweredRail = Reflection.getClass("org.bukkit.craftbukkit.block.impl.CraftPoweredRail");
|
||||
private boolean checkAllowed(Block block, BlockData blockData) {
|
||||
if (checkMaterial(block)) return true;
|
||||
if (block.getType() == Material.BELL) {
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
package de.steamwar.bausystem.features.observer;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.features.rayvisualizer;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.configplayer.Config;
|
||||
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.entity.CRay;
|
||||
import de.steamwar.entity.REntityServer;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.MinVersion;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.util.RayTraceResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Linked
|
||||
@MinVersion(20)
|
||||
public class RayVisualizerCommand extends SWCommand implements Listener {
|
||||
|
||||
private class CRayData {
|
||||
private CRay[] rays = new CRay[27 * 400];
|
||||
private boolean[] used = new boolean[27 * 400];
|
||||
|
||||
public void reset() {
|
||||
for (int i = 0; i < 27 * 400; i++) {
|
||||
if (!used[i] && rays[i] != null) {
|
||||
rays[i].die();
|
||||
rays[i] = null;
|
||||
}
|
||||
used[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean locEquals(Location loc1, Location loc2) {
|
||||
if ((long)(loc1.getX() * 1000) != (long)(loc2.getX() * 1000)) return false;
|
||||
if ((long)(loc1.getY() * 1000) != (long)(loc2.getY() * 1000)) return false;
|
||||
if ((long)(loc1.getZ() * 1000) != (long)(loc2.getZ() * 1000)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public CRay get(Location from, Location to) {
|
||||
for (int i = 0; i < rays.length; i++) {
|
||||
if (rays[i] != null && locEquals(from, rays[i].getFrom()) && locEquals(to, rays[i].getTo())) {
|
||||
used[i] = true;
|
||||
return rays[i];
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < rays.length; i++) {
|
||||
if (rays[i] != null && locEquals(from, rays[i].getFrom()) && !used[i]) {
|
||||
used[i] = true;
|
||||
return rays[i];
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < rays.length; i++) {
|
||||
if (used[i]) continue;
|
||||
CRay ray = rays[i];
|
||||
if (ray != null) {
|
||||
return ray;
|
||||
}
|
||||
ray = new CRay(server);
|
||||
ray.setBlock(Material.LIME_CONCRETE.createBlockData());
|
||||
ray.setWidth(1 / 32f);
|
||||
rays[i] = ray;
|
||||
used[i] = true;
|
||||
return ray;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private CRayData rayData = new CRayData();
|
||||
|
||||
private final REntityServer server = new REntityServer();
|
||||
private final World WORLD = Bukkit.getWorlds().get(0);
|
||||
|
||||
public RayVisualizerCommand() {
|
||||
super("rayvisualizer");
|
||||
|
||||
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> {
|
||||
if (server.getPlayers().isEmpty()) return;
|
||||
Map<Integer, List<TNTPrimed>> primedList = WORLD.getEntitiesByClass(TNTPrimed.class)
|
||||
.stream()
|
||||
.collect(Collectors.groupingBy(TNTPrimed::getFuseTicks));
|
||||
rayData.reset();
|
||||
if (primedList.isEmpty()) return;
|
||||
|
||||
List<Integer> fuseTicks = primedList.keySet().stream().sorted().collect(Collectors.toList());
|
||||
List<TNTPrimed> current = new ArrayList<>();
|
||||
for (int i = 0; i < fuseTicks.size(); i++) {
|
||||
List<TNTPrimed> tnts = primedList.get(fuseTicks.get(i));
|
||||
calculateRays(current, tnts);
|
||||
current.addAll(tnts);
|
||||
}
|
||||
}, 1, 1);
|
||||
}
|
||||
|
||||
private void calculateRays(List<TNTPrimed> fromTNTs, List<TNTPrimed> toTNTs) {
|
||||
for (TNTPrimed from : fromTNTs) {
|
||||
if (!from.isInWater()) continue;
|
||||
for (TNTPrimed to : toTNTs) {
|
||||
if (from == to) continue;
|
||||
if (to.getLocation().distanceSquared(from.getLocation()) > 25) continue;
|
||||
|
||||
Location fromLoc = from.getLocation();
|
||||
Location toLoc = to.getLocation().clone().add(-0.49, 0, -0.49);
|
||||
|
||||
final double minX = 0.5 * (1 - Math.floor(2 * 0.98 + 1) / (2 * 0.98 + 1));
|
||||
final double minZ = 0.5 * (1 - Math.floor(2 * 0.98 + 1) / (2 * 0.98 + 1));
|
||||
final double spacing = 0.98 / (2 * 0.98 + 1);
|
||||
|
||||
for (int dx = 0; dx < 3; dx++) {
|
||||
for (int dy = 0; dy < 3; dy++) {
|
||||
for (int dz = 0; dz < 3; dz++) {
|
||||
Location end = toLoc.clone().add(minX + dx * spacing, 0 + dy * spacing, minZ + dz * spacing);
|
||||
RayTraceResult result = fromLoc.getWorld().rayTraceBlocks(fromLoc, end.clone().subtract(fromLoc).toVector(), end.distance(fromLoc), FluidCollisionMode.NEVER, true);
|
||||
if (result != null && result.getHitBlock() != null) {
|
||||
continue;
|
||||
}
|
||||
CRay cRay = rayData.get(fromLoc, end);
|
||||
if (cRay == null) continue;
|
||||
cRay.setFrom(fromLoc);
|
||||
cRay.setTo(end);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
boolean rayvisualizer = Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("rayvisualizer", false);
|
||||
if (rayvisualizer) server.addPlayer(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
server.removePlayer(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (Permission.BUILD.hasPermission(player)) {
|
||||
boolean rayvisualizer = Config.getInstance().get(player).getPlainValueOrDefault("rayvisualizer", false);
|
||||
if (rayvisualizer) server.addPlayer(player);
|
||||
} else {
|
||||
server.removePlayer(player);
|
||||
}
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
|
||||
@Register
|
||||
public void toggle(@Validator Player player) {
|
||||
boolean rayvisualizer = Config.getInstance().get(player).getPlainValueOrDefault("rayvisualizer", false);
|
||||
Config.getInstance().get(player).put("rayvisualizer", !rayvisualizer);
|
||||
if (!rayvisualizer) {
|
||||
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("RAY_VISUALIZER_ENABLE", player));
|
||||
server.addPlayer(player);
|
||||
} else {
|
||||
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("RAY_VISUALIZER_DISABLE", player));
|
||||
server.removePlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,8 +23,8 @@ import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.config.BauServer;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.flags.ColorMode;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
|
||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.bausystem.utils.PasteBuilder;
|
||||
@@ -34,8 +34,6 @@ import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.LinkedInstance;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Linked
|
||||
public class ColorCommand extends SWCommand {
|
||||
|
||||
@@ -47,29 +45,31 @@ public class ColorCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(description = "REGION_COLOR_HELP_COLOR")
|
||||
public void genericColor(Player p, ColorMode color) {
|
||||
public void genericColor(@Validator Player p, ColorMode color) {
|
||||
genericColorSet(p, color, ColorizationType.LOCAL);
|
||||
}
|
||||
|
||||
@Register(description = "REGION_COLOR_HELP_COLOR_TYPE")
|
||||
public void genericColorSet(@Validator Player p, ColorMode color, ColorizationType colorizationType) {
|
||||
if (colorizationType == ColorizationType.GLOBAL) {
|
||||
Region.setGlobal(Flag.COLOR, color);
|
||||
Region.getRegions().forEach(region -> {
|
||||
region.getFlags().set(Flag.COLOR, color);
|
||||
});
|
||||
BauSystem.MESSAGE.send("REGION_COLOR_GLOBAL", p, BauSystem.MESSAGE.parse(color.getChatValue(), p));
|
||||
return;
|
||||
}
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (region.isGlobal()) {
|
||||
if (region.getType().isGlobal()) {
|
||||
BauSystem.MESSAGE.send("REGION_COLOR_NO_REGION", p);
|
||||
return;
|
||||
}
|
||||
region.set(Flag.COLOR, color);
|
||||
region.getFlags().set(Flag.COLOR, color);
|
||||
try {
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getResetFile(RegionType.NORMAL)))
|
||||
.ignoreAir(true)
|
||||
.onlyColors(true)
|
||||
.color(color.getColor());
|
||||
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
|
||||
.color(color);
|
||||
region.getArea().reset(pasteBuilder, false);
|
||||
RegionUtils.message(region, "REGION_REGION_COLORED");
|
||||
RegionUtils.message(region, "REGION_REGION_COLORED_FAILED");
|
||||
} catch (SecurityException e) {
|
||||
@@ -78,7 +78,7 @@ public class ColorCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register
|
||||
public void genericColorSet(Player p, ColorizationType colorizationType, ColorMode color) {
|
||||
public void genericColorSet(@Validator Player p, ColorizationType colorizationType, ColorMode color) {
|
||||
genericColorSet(p, color, colorizationType);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,13 +19,11 @@
|
||||
|
||||
package de.steamwar.bausystem.features.region;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.flags.FireMode;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.FireMode;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -55,14 +53,12 @@ public class FireCommand extends SWCommand {
|
||||
}
|
||||
|
||||
private boolean toggle(Region region) {
|
||||
switch (region.getPlain(Flag.FIRE, FireMode.class)) {
|
||||
case ALLOW:
|
||||
region.set(Flag.FIRE, FireMode.DENY);
|
||||
return true;
|
||||
default:
|
||||
case DENY:
|
||||
region.set(Flag.FIRE, FireMode.ALLOW);
|
||||
return false;
|
||||
if (region.getFlags().get(Flag.FIRE).isWithDefault(FireMode.ALLOW)) {
|
||||
region.getFlags().set(Flag.FIRE, FireMode.DENY);
|
||||
return true;
|
||||
} else {
|
||||
region.getFlags().set(Flag.FIRE, FireMode.ALLOW);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ package de.steamwar.bausystem.features.region;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.FireMode;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.FireMode;
|
||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -17,12 +17,12 @@ public class FireListener implements Listener, ScoreboardElement {
|
||||
|
||||
@EventHandler
|
||||
public void onFireDamage(BlockBurnEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getPlain(Flag.FIRE, FireMode.class) == FireMode.DENY) e.setCancelled(true);
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FIRE).isWithDefault(FireMode.DENY)) e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onFireSpread(BlockSpreadEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getPlain(Flag.FIRE, FireMode.class) == FireMode.DENY) e.setCancelled(true);
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FIRE).isWithDefault(FireMode.DENY)) e.setCancelled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -37,7 +37,7 @@ public class FireListener implements Listener, ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (region.get(Flag.FIRE) == Flag.FIRE.getDefaultValue()) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.FIRE.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(Flag.FIRE).getChatValue(), p);
|
||||
if (region.getFlags().get(Flag.FIRE).isWithDefault(FireMode.DENY)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.FIRE.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getFlags().get(Flag.FIRE).getWithDefault().getChatValue(), p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,13 +19,11 @@
|
||||
|
||||
package de.steamwar.bausystem.features.region;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode;
|
||||
import de.steamwar.bausystem.region.flags.FreezeMode;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -55,14 +53,12 @@ public class FreezeCommand extends SWCommand {
|
||||
}
|
||||
|
||||
private boolean toggle(Region region) {
|
||||
switch (region.getPlain(Flag.FREEZE, FreezeMode.class)) {
|
||||
case ACTIVE:
|
||||
region.set(Flag.FREEZE, FreezeMode.INACTIVE);
|
||||
return false;
|
||||
default:
|
||||
case INACTIVE:
|
||||
region.set(Flag.FREEZE, FreezeMode.ACTIVE);
|
||||
return true;
|
||||
if (region.getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
region.getFlags().set(Flag.FREEZE, FreezeMode.INACTIVE);
|
||||
return false;
|
||||
} else {
|
||||
region.getFlags().set(Flag.FREEZE, FreezeMode.ACTIVE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,17 @@ package de.steamwar.bausystem.features.region;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode;
|
||||
import de.steamwar.bausystem.region.flags.FreezeMode;
|
||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.type.NoteBlock;
|
||||
import org.bukkit.block.data.type.Switch;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@@ -27,11 +29,9 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
||||
|
||||
@EventHandler
|
||||
public void onEntitySpawn(EntitySpawnEvent e) {
|
||||
if (Region.getRegion(e.getLocation()).get(Flag.FREEZE) == FreezeMode.INACTIVE) {
|
||||
return;
|
||||
}
|
||||
if (Region.getRegion(e.getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
|
||||
e.setCancelled(true);
|
||||
if (e.getEntityType() == EntityType.PRIMED_TNT) {
|
||||
if (e.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
e.getLocation().getBlock().setType(Material.TNT, false);
|
||||
}, 1L);
|
||||
@@ -41,8 +41,7 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
||||
@EventHandler
|
||||
public void onBlockCanBuild(BlockCanBuildEvent e) {
|
||||
if (!e.isBuildable()) return;
|
||||
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.INACTIVE)
|
||||
return;
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
|
||||
if (e.getMaterial() == Material.TNT) {
|
||||
e.setBuildable(false);
|
||||
e.getBlock().setType(Material.TNT, false);
|
||||
@@ -51,69 +50,87 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
||||
|
||||
@EventHandler
|
||||
public void onEntityChangeBlock(EntityChangeBlockEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPhysicsEvent(BlockPhysicsEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
if (e.getSourceBlock().getType() == Material.NOTE_BLOCK) {
|
||||
BlockState state = e.getSourceBlock().getState();
|
||||
NoteBlock noteBlock = (NoteBlock) state.getBlockData();
|
||||
if (noteBlock.isPowered()) {
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
state.update(true, false);
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
if (e.getBlock().getType() == Material.NOTE_BLOCK) {
|
||||
BlockState state = e.getBlock().getState();
|
||||
NoteBlock noteBlock = (NoteBlock) state.getBlockData();
|
||||
if (noteBlock.isPowered()) {
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
state.update(true, false);
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPistonExtend(BlockPistonExtendEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPistonRetract(BlockPistonRetractEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockGrow(BlockGrowEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onRedstoneEvent(BlockRedstoneEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setNewCurrent(e.getOldCurrent());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockDispense(BlockDispenseEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryMoveEvent(InventoryMoveItemEvent e) {
|
||||
if (e.getDestination().getLocation() != null && Region.getRegion(e.getDestination().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
if (e.getDestination().getLocation() != null && Region.getRegion(e.getDestination().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
} else if (e.getSource().getLocation() != null && Region.getRegion(e.getSource().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
} else if (e.getSource().getLocation() != null && Region.getRegion(e.getSource().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockBreak(BlockBreakEvent e) {
|
||||
if (Core.getVersion() < 19) return;
|
||||
if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK) return;
|
||||
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
if (e.isCancelled()) return;
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
e.getBlock().setType(Material.BARRIER, false);
|
||||
e.getBlock().setType(Material.AIR, false);
|
||||
}
|
||||
}
|
||||
@@ -134,35 +151,35 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
||||
|
||||
@EventHandler
|
||||
public void onFluidLevelChange(FluidLevelChangeEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockSpread(BlockSpreadEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockFromTo(BlockFromToEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSpongeAbsorb(SpongeAbsorbEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockForm(BlockFormEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@@ -170,7 +187,7 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent e) {
|
||||
if (e.getAction() != Action.RIGHT_CLICK_BLOCK) return;
|
||||
if (Region.getRegion(e.getClickedBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
if (Region.getRegion(e.getClickedBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
Block block = e.getClickedBlock();
|
||||
if (block.getType() == Material.LEVER) {
|
||||
Switch data = ((Switch) block.getBlockData());
|
||||
@@ -181,9 +198,9 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockFade(BlockFadeEvent event) {
|
||||
if (Region.getRegion(event.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
event.setCancelled(true);
|
||||
public void onBlockFade(BlockFadeEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +216,7 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (region.get(Flag.FREEZE) == Flag.FREEZE.getDefaultValue()) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.FREEZE.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(Flag.FREEZE).getChatValue(), p);
|
||||
if (region.getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.FREEZE.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getFlags().get(Flag.FREEZE).getWithDefault().getChatValue(), p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,14 +19,11 @@
|
||||
|
||||
package de.steamwar.bausystem.features.region;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.region.GlobalRegion;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.ItemMode;
|
||||
import de.steamwar.bausystem.region.flags.ItemMode;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.MinVersion;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -58,14 +55,12 @@ public class ItemsCommand extends SWCommand {
|
||||
}
|
||||
|
||||
private boolean toggle(Region region) {
|
||||
switch (region.getPlain(Flag.ITEMS, ItemMode.class)) {
|
||||
case ACTIVE:
|
||||
region.set(Flag.ITEMS, ItemMode.INACTIVE);
|
||||
return false;
|
||||
default:
|
||||
case INACTIVE:
|
||||
region.set(Flag.ITEMS, ItemMode.ACTIVE);
|
||||
return true;
|
||||
if (region.getFlags().get(Flag.ITEMS).isWithDefault(ItemMode.ACTIVE)) {
|
||||
region.getFlags().set(Flag.ITEMS, ItemMode.INACTIVE);
|
||||
return false;
|
||||
} else {
|
||||
region.getFlags().set(Flag.ITEMS, ItemMode.ACTIVE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ package de.steamwar.bausystem.features.region;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.ItemMode;
|
||||
import de.steamwar.bausystem.region.flags.ItemMode;
|
||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.MinVersion;
|
||||
@@ -35,13 +35,9 @@ import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
@MinVersion(19)
|
||||
public class ItemsListener implements Listener, ScoreboardElement {
|
||||
|
||||
private static ItemMode getMode(Region region) {
|
||||
return region.getPlain(Flag.ITEMS, ItemMode.class);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onItemSpawn(ItemSpawnEvent event) {
|
||||
if (getMode(Region.getRegion(event.getLocation())) == ItemMode.INACTIVE) {
|
||||
if (Region.getRegion(event.getLocation()).getFlags().get(Flag.ITEMS).isWithDefault(ItemMode.INACTIVE)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@@ -58,7 +54,7 @@ public class ItemsListener implements Listener, ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (region.get(Flag.ITEMS) == Flag.ITEMS.getDefaultValue()) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.ITEMS.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(Flag.ITEMS).getChatValue(), p);
|
||||
if (region.getFlags().get(Flag.ITEMS).isWithDefault(ItemMode.INACTIVE)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.ITEMS.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getFlags().get(Flag.ITEMS).getWithDefault().getChatValue(), p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ package de.steamwar.bausystem.features.region;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.NoGravityMode;
|
||||
import de.steamwar.bausystem.region.flags.NoGravityMode;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -53,14 +53,12 @@ public class NoGravityCommand extends SWCommand {
|
||||
}
|
||||
|
||||
private boolean toggle(Region region) {
|
||||
switch (region.getPlain(Flag.NO_GRAVITY, NoGravityMode.class)) {
|
||||
case ACTIVE:
|
||||
region.set(Flag.NO_GRAVITY, NoGravityMode.INACTIVE);
|
||||
return false;
|
||||
default:
|
||||
case INACTIVE:
|
||||
region.set(Flag.NO_GRAVITY, NoGravityMode.ACTIVE);
|
||||
return true;
|
||||
if (region.getFlags().get(Flag.NO_GRAVITY).isWithDefault(NoGravityMode.ACTIVE)) {
|
||||
region.getFlags().set(Flag.NO_GRAVITY, NoGravityMode.INACTIVE);
|
||||
return false;
|
||||
} else {
|
||||
region.getFlags().set(Flag.NO_GRAVITY, NoGravityMode.ACTIVE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ package de.steamwar.bausystem.features.region;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.NoGravityMode;
|
||||
import de.steamwar.bausystem.region.flags.NoGravityMode;
|
||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@@ -34,14 +34,10 @@ import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
@Linked
|
||||
public class NoGravityListener implements Listener, ScoreboardElement {
|
||||
|
||||
private static NoGravityMode getMode(Region region) {
|
||||
return region.getPlain(Flag.NO_GRAVITY, NoGravityMode.class);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntitySpawn(EntitySpawnEvent event) {
|
||||
if (event.getEntityType() == EntityType.PLAYER) return;
|
||||
if (getMode(Region.getRegion(event.getLocation())) == NoGravityMode.ACTIVE) {
|
||||
if (Region.getRegion(event.getLocation()).getFlags().get(Flag.NO_GRAVITY).isWithDefault(NoGravityMode.ACTIVE)) {
|
||||
event.getEntity().setGravity(false);
|
||||
}
|
||||
}
|
||||
@@ -58,7 +54,7 @@ public class NoGravityListener implements Listener, ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (region.get(Flag.NO_GRAVITY) == Flag.NO_GRAVITY.getDefaultValue()) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.NO_GRAVITY.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(Flag.NO_GRAVITY).getChatValue(), p);
|
||||
if (region.getFlags().get(Flag.NO_GRAVITY).isWithDefault(NoGravityMode.INACTIVE)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.NO_GRAVITY.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getFlags().get(Flag.NO_GRAVITY).getWithDefault().getChatValue(), p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,13 +20,11 @@
|
||||
package de.steamwar.bausystem.features.region;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.ProtectMode;
|
||||
import de.steamwar.bausystem.region.flags.ProtectMode;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -41,22 +39,18 @@ public class ProtectCommand extends SWCommand {
|
||||
public void genericProtectCommand(@Validator Player p) {
|
||||
Region region = regionCheck(p);
|
||||
if (region == null) return;
|
||||
switch (region.getPlain(Flag.PROTECT, ProtectMode.class)) {
|
||||
case ACTIVE:
|
||||
region.set(Flag.PROTECT, ProtectMode.INACTIVE);
|
||||
RegionUtils.actionBar(region, "REGION_PROTECT_DISABLE");
|
||||
break;
|
||||
default:
|
||||
case INACTIVE:
|
||||
region.set(Flag.PROTECT, ProtectMode.ACTIVE);
|
||||
RegionUtils.actionBar(region, "REGION_PROTECT_ENABLE");
|
||||
break;
|
||||
if (region.getFlags().get(Flag.PROTECT).isWithDefault(ProtectMode.ACTIVE)) {
|
||||
region.getFlags().set(Flag.PROTECT, ProtectMode.INACTIVE);
|
||||
RegionUtils.actionBar(region, "REGION_PROTECT_DISABLE");
|
||||
} else {
|
||||
region.getFlags().set(Flag.PROTECT, ProtectMode.ACTIVE);
|
||||
RegionUtils.actionBar(region, "REGION_PROTECT_ENABLE");
|
||||
}
|
||||
}
|
||||
|
||||
private Region regionCheck(Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (region.getFloorLevel() == 0) {
|
||||
if (!region.getFlags().has(Flag.PROTECT).isApplicable()) {
|
||||
BauSystem.MESSAGE.send("REGION_PROTECT_FALSE_REGION", player);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package de.steamwar.bausystem.features.region;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.region.Point;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.ProtectMode;
|
||||
import de.steamwar.bausystem.region.flags.ProtectMode;
|
||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Location;
|
||||
@@ -21,13 +22,11 @@ public class ProtectListener implements Listener, ScoreboardElement {
|
||||
|
||||
private void explode(List<Block> blockList, Location location) {
|
||||
Region region = Region.getRegion(location);
|
||||
if (region.getFloorLevel() == 0) {
|
||||
return;
|
||||
}
|
||||
if (region.getPlain(Flag.PROTECT, ProtectMode.class) == ProtectMode.INACTIVE) {
|
||||
return;
|
||||
}
|
||||
blockList.removeIf(block -> block.getY() < region.getFloorLevel());
|
||||
if (region.getFlags().get(Flag.PROTECT).isWithDefault(ProtectMode.INACTIVE)) return;
|
||||
Point p1 = region.getBuildArea().getMinPoint(true);
|
||||
Point p2 = region.getTestblockArea().getMinPoint(true);
|
||||
int floorLevel = Math.min(p1.getY(), p2.getY());
|
||||
blockList.removeIf(block -> block.getY() < floorLevel);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -52,8 +51,7 @@ public class ProtectListener implements Listener, ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (region.getFloorLevel() == 0) return null;
|
||||
if (region.get(Flag.PROTECT) != Flag.PROTECT.getDefaultValue()) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.PROTECT.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(Flag.PROTECT).getChatValue(), p);
|
||||
if (region.getFlags().get(Flag.PROTECT).isWithDefault(ProtectMode.INACTIVE)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.PROTECT.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getFlags().get(Flag.PROTECT).getWithDefault().getChatValue(), p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,8 +32,6 @@ import de.steamwar.bausystem.region.Point;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
|
||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.bausystem.shared.Pair;
|
||||
import de.steamwar.bausystem.utils.FlatteningWrapper;
|
||||
@@ -71,7 +69,7 @@ public class RegionCommand extends SWCommand {
|
||||
}
|
||||
|
||||
static boolean checkGlobalRegion(Region region, Player p) {
|
||||
if (region.isGlobal()) {
|
||||
if (region.getType().isGlobal()) {
|
||||
BauSystem.MESSAGE.send("REGION_REGION_NO_REGION", p);
|
||||
return true;
|
||||
}
|
||||
@@ -83,7 +81,7 @@ public class RegionCommand extends SWCommand {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) return;
|
||||
|
||||
if (region.undo()) {
|
||||
if (region.getHistory().undo()) {
|
||||
RegionUtils.message(region, "REGION_REGION_UNDID");
|
||||
} else {
|
||||
BauSystem.MESSAGE.send("REGION_REGION_NOTHING_UNDO", p);
|
||||
@@ -97,7 +95,7 @@ public class RegionCommand extends SWCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (region.redo()) {
|
||||
if (region.getHistory().redo()) {
|
||||
RegionUtils.message(region, "REGION_REGION_REDID");
|
||||
} else {
|
||||
BauSystem.MESSAGE.send("REGION_REGION_NOTHING_REDO", p);
|
||||
@@ -112,8 +110,8 @@ public class RegionCommand extends SWCommand {
|
||||
try {
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getResetFile(RegionType.NORMAL)))
|
||||
.ignoreAir(true)
|
||||
.color(region.getPlain(Flag.COLOR, ColorMode.class).getColor());
|
||||
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
|
||||
.color(region.getFlags().get(Flag.COLOR).getWithDefault());
|
||||
region.getArea().reset(pasteBuilder, true);
|
||||
RegionUtils.message(region, "REGION_REGION_RESTORED");
|
||||
} catch (SecurityException e) {
|
||||
BauSystem.MESSAGE.send("REGION_REGION_FAILED_RESTORE", p);
|
||||
@@ -134,8 +132,8 @@ public class RegionCommand extends SWCommand {
|
||||
try {
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.SchematicProvider(node))
|
||||
.ignoreAir(true)
|
||||
.color(region.getPlain(Flag.COLOR, ColorMode.class).getColor());
|
||||
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
|
||||
.color(region.getFlags().get(Flag.COLOR).getWithDefault());
|
||||
region.getArea().reset(pasteBuilder, true);
|
||||
RegionUtils.message(region, "REGION_REGION_RESTORED");
|
||||
} catch (SecurityException e) {
|
||||
BauSystem.MESSAGE.send("REGION_REGION_FAILED_RESTORE", p);
|
||||
@@ -149,11 +147,11 @@ public class RegionCommand extends SWCommand {
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return;
|
||||
}
|
||||
if (region.getCopyPoint() == null) {
|
||||
if (region.getBuildArea().isEmpty()) {
|
||||
BauSystem.MESSAGE.send("REGION_REGION_TP_UNKNOWN", p);
|
||||
return;
|
||||
}
|
||||
p.teleport(region.getCopyPoint().toLocation(p, 0.5, 0, 0.5), PlayerTeleportEvent.TeleportCause.COMMAND);
|
||||
p.teleport(region.getBuildArea().getCopyPoint().toLocation(p, 0.5, 0, 0.5), PlayerTeleportEvent.TeleportCause.COMMAND);
|
||||
BauSystem.MESSAGE.send("REGION_REGION_TP_COPY", p);
|
||||
}
|
||||
|
||||
@@ -164,11 +162,11 @@ public class RegionCommand extends SWCommand {
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return;
|
||||
}
|
||||
if (region.getTestBlockPoint() == null) {
|
||||
if (region.getTestblockArea().isEmpty()) {
|
||||
BauSystem.MESSAGE.send("REGION_REGION_TP_UNKNOWN", p);
|
||||
return;
|
||||
}
|
||||
p.teleport(region.getTestBlockPoint().toLocation(p, 0.5, 0, 0.5), PlayerTeleportEvent.TeleportCause.COMMAND);
|
||||
p.teleport(region.getTestblockArea().getCopyPoint().toLocation(p, 0.5, 0, 0.5), PlayerTeleportEvent.TeleportCause.COMMAND);
|
||||
BauSystem.MESSAGE.send("REGION_REGION_TP_TEST_BLOCK", p);
|
||||
}
|
||||
|
||||
@@ -211,23 +209,19 @@ public class RegionCommand extends SWCommand {
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return;
|
||||
}
|
||||
if (!region.hasType(RegionType.BUILD)) {
|
||||
if (region.getBuildArea().isEmpty()) {
|
||||
BauSystem.MESSAGE.send("REGION_REGION_NO_BUILD", p);
|
||||
return;
|
||||
}
|
||||
if (region.getCopyPoint() == null) {
|
||||
BauSystem.MESSAGE.send("REGION_REGION_TP_UNKNOWN", p);
|
||||
return;
|
||||
}
|
||||
|
||||
Point minPoint = region.getMinPoint(RegionType.BUILD, RegionExtensionType.NORMAL);
|
||||
Point maxPoint = region.getMaxPoint(RegionType.BUILD, RegionExtensionType.NORMAL);
|
||||
Point minPoint = region.getBuildArea().getMinPoint(false);
|
||||
Point maxPoint = region.getBuildArea().getMaxPoint(false);
|
||||
switch (option) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
minPoint = region.getMinPoint(RegionType.BUILD, RegionExtensionType.EXTENSION);
|
||||
maxPoint = region.getMaxPoint(RegionType.BUILD, RegionExtensionType.EXTENSION);
|
||||
minPoint = region.getBuildArea().getMinPoint(true);
|
||||
maxPoint = region.getBuildArea().getMaxPoint(true);
|
||||
break;
|
||||
case 2:
|
||||
Pair<Location, Location> selection = WorldEditUtils.getSelection(p);
|
||||
@@ -238,7 +232,7 @@ public class RegionCommand extends SWCommand {
|
||||
break;
|
||||
}
|
||||
|
||||
Clipboard clipboard = FlatteningWrapper.impl.copy(minPoint, maxPoint, region.getCopyPoint());
|
||||
Clipboard clipboard = FlatteningWrapper.impl.copy(minPoint, maxPoint, region.getBuildArea().getCopyPoint());
|
||||
WorldEdit.getInstance()
|
||||
.getSessionManager()
|
||||
.get(BukkitAdapter.adapt(p))
|
||||
@@ -252,14 +246,10 @@ public class RegionCommand extends SWCommand {
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return;
|
||||
}
|
||||
if (!region.hasType(RegionType.BUILD)) {
|
||||
if (region.getBuildArea().isEmpty()) {
|
||||
BauSystem.MESSAGE.send("REGION_REGION_NO_BUILD", p);
|
||||
return;
|
||||
}
|
||||
if (region.getCopyPoint() == null) {
|
||||
BauSystem.MESSAGE.send("REGION_REGION_TP_UNKNOWN", p);
|
||||
return;
|
||||
}
|
||||
|
||||
ClipboardHolder clipboardHolder = WorldEdit.getInstance()
|
||||
.getSessionManager()
|
||||
@@ -287,13 +277,13 @@ public class RegionCommand extends SWCommand {
|
||||
}
|
||||
|
||||
try (EditSession e = WorldEditUtils.getEditSession(p)) {
|
||||
Operations.completeBlindly(clipboardHolder.createPaste(e).ignoreAirBlocks(ignoreAir).to(toBlockVector3(region.getCopyPoint())).build());
|
||||
Operations.completeBlindly(clipboardHolder.createPaste(e).ignoreAirBlocks(ignoreAir).to(toBlockVector3(region.getBuildArea().getCopyPoint())).build());
|
||||
WorldEditUtils.addToPlayer(p, e);
|
||||
|
||||
if (selectPasted) {
|
||||
Clipboard clipboard = clipboardHolder.getClipboards().get(0);
|
||||
BlockVector3 minPointSelection = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin()).add(toBlockVector3(region.getCopyPoint()));
|
||||
BlockVector3 maxPointSelection = clipboard.getRegion().getMaximumPoint().subtract(clipboard.getOrigin()).add(toBlockVector3(region.getCopyPoint()));
|
||||
BlockVector3 minPointSelection = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin()).add(toBlockVector3(region.getBuildArea().getCopyPoint()));
|
||||
BlockVector3 maxPointSelection = clipboard.getRegion().getMaximumPoint().subtract(clipboard.getOrigin()).add(toBlockVector3(region.getBuildArea().getCopyPoint()));
|
||||
FlatteningWrapper.impl.setSelection(p, Point.fromBlockVector3(minPointSelection), Point.fromBlockVector3(maxPointSelection));
|
||||
}
|
||||
BauSystem.MESSAGE.send("REGION_REGION_PASTE_DONE", p);
|
||||
@@ -312,7 +302,7 @@ public class RegionCommand extends SWCommand {
|
||||
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
Player p = (Player) commandSender;
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (region.isGlobal()) {
|
||||
if (region.getType().isGlobal()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return region.getPrototype().getSkinMap().keySet().stream().map(c -> c.replace(' ', '_')).collect(Collectors.toList());
|
||||
|
||||
@@ -21,7 +21,8 @@ package de.steamwar.bausystem.features.region;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.tags.Tag;
|
||||
import de.steamwar.bausystem.region.flags.ChangedMode;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@@ -185,7 +186,7 @@ public class RegionListener implements Listener {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Region.getRegion(location).set(Tag.CHANGED);
|
||||
Region.getRegion(location).getFlags().set(Flag.CHANGED, ChangedMode.HAS_CHANGE);
|
||||
}
|
||||
}.runTaskAsynchronously(BauSystem.getInstance());
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
package de.steamwar.bausystem.features.region;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.region.GlobalRegion;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||
import de.steamwar.linkage.Linked;
|
||||
@@ -41,7 +40,7 @@ public class RegionScoreboardElement implements ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (GlobalRegion.getInstance() == region) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_REGION", p) + "§8: §7" + region.getDisplayName();
|
||||
if (region.getType().isGlobal()) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_REGION", p) + "§8: §7" + region.getName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,18 +20,15 @@
|
||||
package de.steamwar.bausystem.features.region;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.BauServer;
|
||||
import de.steamwar.bausystem.region.GlobalRegion;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionSystem;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.flags.ColorMode;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
|
||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.bausystem.utils.PasteBuilder;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.LinkedInstance;
|
||||
import de.steamwar.sql.Punishment;
|
||||
@@ -40,7 +37,6 @@ import de.steamwar.sql.SteamwarUser;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@Linked
|
||||
@@ -59,10 +55,10 @@ public class ResetCommand extends SWCommand {
|
||||
if (region == null) return;
|
||||
try {
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getResetFile(RegionType.NORMAL)))
|
||||
.color(region.getPlain(Flag.COLOR, ColorMode.class).getColor());
|
||||
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
|
||||
for (Flag value : Flag.values()) {
|
||||
region.set(value, value.getDefaultValue());
|
||||
.color(region.getFlags().get(Flag.COLOR).getWithDefault());
|
||||
region.getArea().reset(pasteBuilder, false);
|
||||
for (Flag value : Flag.getFlags()) {
|
||||
region.getFlags().set(value, value.getDefaultValue());
|
||||
}
|
||||
RegionUtils.message(region, "REGION_RESET_RESETED");
|
||||
} catch (SecurityException e) {
|
||||
@@ -91,8 +87,8 @@ public class ResetCommand extends SWCommand {
|
||||
}
|
||||
try {
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.SchematicProvider(node))
|
||||
.color(region.getPlain(Flag.COLOR, ColorMode.class).getColor());
|
||||
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
|
||||
.color(region.getFlags().get(Flag.COLOR).getWithDefault());
|
||||
region.getArea().reset(pasteBuilder, true);
|
||||
RegionUtils.message(region, "REGION_RESET_RESETED");
|
||||
} catch (SecurityException e) {
|
||||
BauSystem.MESSAGE.send("REGION_RESET_ERROR", p);
|
||||
@@ -102,7 +98,7 @@ public class ResetCommand extends SWCommand {
|
||||
|
||||
private Region regionCheck(Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (region == GlobalRegion.getInstance()) {
|
||||
if (region == RegionSystem.INSTANCE.getGlobalRegion()) {
|
||||
BauSystem.MESSAGE.send("REGION_RESET_NO_REGION", player);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -20,16 +20,14 @@
|
||||
package de.steamwar.bausystem.features.region;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.TNTMode;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.bausystem.region.flags.TNTMode;
|
||||
import de.steamwar.bausystem.region.flags.TestblockMode;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -98,7 +96,7 @@ public class TNTCommand extends SWCommand {
|
||||
@Override
|
||||
public List<String> tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) {
|
||||
Region region = Region.getRegion(((Player) sender).getLocation());
|
||||
if (region.hasType(RegionType.TESTBLOCK) && region.hasType(RegionType.BUILD)) {
|
||||
if (region.getFlags().get(Flag.TESTBLOCK).isNotWithDefault(TestblockMode.NO_VALUE)) {
|
||||
return new ArrayList<>(tntModeMap.keySet());
|
||||
} else {
|
||||
return new ArrayList<>(tntModeMapReduced.keySet());
|
||||
@@ -108,7 +106,7 @@ public class TNTCommand extends SWCommand {
|
||||
@Override
|
||||
public TNTMode map(CommandSender sender, PreviousArguments previousArguments, String s) {
|
||||
Region region = Region.getRegion(((Player) sender).getLocation());
|
||||
if (region.hasType(RegionType.TESTBLOCK) && region.hasType(RegionType.BUILD)) {
|
||||
if (region.getFlags().get(Flag.TESTBLOCK).isNotWithDefault(TestblockMode.NO_VALUE)) {
|
||||
return tntModeMap.getOrDefault(s, null);
|
||||
} else {
|
||||
return tntModeMapReduced.getOrDefault(s, null);
|
||||
@@ -134,24 +132,24 @@ public class TNTCommand extends SWCommand {
|
||||
}
|
||||
|
||||
private void tntToggle(Region region, TNTMode requestedMode, String requestedMessage) {
|
||||
if (requestedMode != null && region.hasType(RegionType.TESTBLOCK) && region.hasType(RegionType.BUILD)) {
|
||||
region.set(Flag.TNT, requestedMode);
|
||||
if (requestedMode != null && region.getFlags().get(Flag.TESTBLOCK).isNotWithDefault(TestblockMode.NO_VALUE)) {
|
||||
region.getFlags().set(Flag.TNT, requestedMode);
|
||||
RegionUtils.actionBar(region, requestedMessage);
|
||||
return;
|
||||
}
|
||||
switch (region.getPlain(Flag.TNT, TNTMode.class)) {
|
||||
switch (region.getFlags().get(Flag.TNT).getWithDefault()) {
|
||||
case ALLOW:
|
||||
case ONLY_TB:
|
||||
case ONLY_BUILD:
|
||||
region.set(Flag.TNT, TNTMode.DENY);
|
||||
region.getFlags().set(Flag.TNT, TNTMode.DENY);
|
||||
RegionUtils.actionBar(region, getDisableMessage());
|
||||
break;
|
||||
case DENY:
|
||||
if (region.hasType(RegionType.TESTBLOCK) && region.hasType(RegionType.BUILD)) {
|
||||
region.set(Flag.TNT, TNTMode.ONLY_TB);
|
||||
if (region.getFlags().get(Flag.TESTBLOCK).isNotWithDefault(TestblockMode.NO_VALUE)) {
|
||||
region.getFlags().set(Flag.TNT, TNTMode.ONLY_TB);
|
||||
RegionUtils.actionBar(region, getTestblockEnableMessage());
|
||||
} else {
|
||||
region.set(Flag.TNT, TNTMode.ALLOW);
|
||||
region.getFlags().set(Flag.TNT, TNTMode.ALLOW);
|
||||
RegionUtils.actionBar(region, getEnableMessage());
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -23,9 +23,7 @@ import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.TNTMode;
|
||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.bausystem.region.flags.TNTMode;
|
||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -37,7 +35,6 @@ import org.bukkit.event.block.BlockExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@Linked
|
||||
public class TNTListener implements Listener, ScoreboardElement {
|
||||
@@ -45,24 +42,16 @@ public class TNTListener implements Listener, ScoreboardElement {
|
||||
private void explode(List<Block> blockList) {
|
||||
blockList.removeIf(block -> {
|
||||
Region region = Region.getRegion(block.getLocation());
|
||||
TNTMode value = region.getPlain(Flag.TNT);
|
||||
TNTMode value = region.getFlags().get(Flag.TNT).getWithDefault();
|
||||
if (value == TNTMode.ALLOW) {
|
||||
return false;
|
||||
} else if (value == TNTMode.ONLY_TB) {
|
||||
if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.NORMAL)) {
|
||||
RegionUtils.actionBar(region, "REGION_TNT_BUILD_DESTROY");
|
||||
return true;
|
||||
}
|
||||
if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)) {
|
||||
if (region.getBuildArea().inRegion(block.getLocation(), true)) {
|
||||
RegionUtils.actionBar(region, "REGION_TNT_BUILD_DESTROY");
|
||||
return true;
|
||||
}
|
||||
} else if (value == TNTMode.ONLY_BUILD) {
|
||||
if (region.hasType(RegionType.TESTBLOCK) && region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.NORMAL)) {
|
||||
RegionUtils.actionBar(region, "REGION_TNT_TB_DESTROY");
|
||||
return true;
|
||||
}
|
||||
if (region.hasType(RegionType.TESTBLOCK) && region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) {
|
||||
if (region.getTestblockArea().inRegion(block.getLocation(), true)) {
|
||||
RegionUtils.actionBar(region, "REGION_TNT_TB_DESTROY");
|
||||
return true;
|
||||
}
|
||||
@@ -93,6 +82,7 @@ public class TNTListener implements Listener, ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.TNT.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(Flag.TNT).getChatValue(), p);
|
||||
if (region.getFlags().get(Flag.TNT).isWithDefault(TNTMode.ALLOW)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.TNT.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getFlags().get(Flag.TNT).getWithDefault().getChatValue(), p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,19 +20,16 @@
|
||||
package de.steamwar.bausystem.features.region;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.BauServer;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
|
||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.bausystem.utils.PasteBuilder;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.LinkedInstance;
|
||||
import de.steamwar.sql.Punishment;
|
||||
@@ -43,10 +40,8 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -105,8 +100,8 @@ public class TestblockCommand extends SWCommand {
|
||||
.onlyColors(onlyColors)
|
||||
.removeTNT(removeTNT)
|
||||
.removeWater(removeWater)
|
||||
.color(region.getPlain(Flag.COLOR, ColorMode.class).getColor());
|
||||
region.reset(pasteBuilder, RegionType.TESTBLOCK, regionExtensionType);
|
||||
.color(region.getFlags().get(Flag.COLOR).getWithDefault());
|
||||
region.getTestblockArea().reset(pasteBuilder, regionExtensionType == RegionExtensionType.EXTENSION);
|
||||
RegionUtils.message(region, "REGION_TB_DONE");
|
||||
} catch (SecurityException e) {
|
||||
BauSystem.MESSAGE.send("REGION_TB_ERROR", p);
|
||||
@@ -159,7 +154,7 @@ public class TestblockCommand extends SWCommand {
|
||||
|
||||
private Region regionCheck(Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (!region.hasType(RegionType.TESTBLOCK)) {
|
||||
if (region.getTestblockArea().isEmpty()) {
|
||||
BauSystem.MESSAGE.send("REGION_TB_NO_REGION", player);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -22,10 +22,9 @@ package de.steamwar.bausystem.features.region.items;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||
import de.steamwar.bausystem.region.Color;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.ColorMode;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.inventory.SWListInv;
|
||||
import de.steamwar.linkage.Linked;
|
||||
@@ -45,7 +44,7 @@ public class ColorBauGuiItem extends BauGuiItem {
|
||||
super(2);
|
||||
}
|
||||
|
||||
private static Material mapColor(Color color) {
|
||||
private static Material mapColor(ColorMode color) {
|
||||
switch (color) {
|
||||
case RED:
|
||||
return Material.RED_CONCRETE;
|
||||
@@ -85,17 +84,17 @@ public class ColorBauGuiItem extends BauGuiItem {
|
||||
@Override
|
||||
public ItemStack getItem(Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
ColorMode mode = region.getPlain(Flag.COLOR, ColorMode.class);
|
||||
return new SWItem(mapColor(mode.getColor()), BauSystem.MESSAGE.parse("REGION_ITEM_COLOR", player, BauSystem.MESSAGE.parse(mode.getChatValue(), player))).getItemStack();
|
||||
ColorMode mode = region.getFlags().get(Flag.COLOR).orElse(ColorMode.PINK);
|
||||
return new SWItem(mapColor(mode), BauSystem.MESSAGE.parse("REGION_ITEM_COLOR", player, BauSystem.MESSAGE.parse(mode.getChatValue(), player))).getItemStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean click(ClickType click, Player p) {
|
||||
p.closeInventory();
|
||||
ColorMode current = Region.getRegion(p.getLocation()).getPlain(Flag.COLOR, ColorMode.class);
|
||||
ColorMode current = Region.getRegion(p.getLocation()).getFlags().get(Flag.COLOR).orElse(ColorMode.PINK);
|
||||
List<SWListInv.SWListEntry<ColorMode>> items = new ArrayList<>();
|
||||
for (ColorMode value : ColorMode.values()) {
|
||||
items.add(new SWListInv.SWListEntry<>(new SWItem(mapColor(value.getColor()), (byte) 0, "§f" + BauSystem.MESSAGE.parse(value.getChatValue(), p), Collections.emptyList(), value == current, clickType -> {
|
||||
items.add(new SWListInv.SWListEntry<>(new SWItem(mapColor(value), (byte) 0, "§f" + BauSystem.MESSAGE.parse(value.getChatValue(), p), Collections.emptyList(), value == current, clickType -> {
|
||||
}), value));
|
||||
}
|
||||
SWListInv<ColorMode> inv = new SWListInv<>(p, BauSystem.MESSAGE.parse("REGION_ITEM_COLOR_CHOOSE", p), items, (clickType, colorMode) -> {
|
||||
|
||||
@@ -23,8 +23,8 @@ import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.FireMode;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.FireMode;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
@@ -42,7 +42,10 @@ public class FireBauGuiItem extends BauGuiItem {
|
||||
@Override
|
||||
public ItemStack getItem(Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (region.getPlain(Flag.FIRE, FireMode.class) == FireMode.ALLOW) {
|
||||
if (!region.getFlags().has(Flag.FIRE).isApplicable()) {
|
||||
return new SWItem(Material.BARRIER, "").getItemStack();
|
||||
}
|
||||
if (region.getFlags().get(Flag.FIRE).isWithDefault(FireMode.ALLOW)) {
|
||||
return new SWItem(Material.FIRE_CHARGE, BauSystem.MESSAGE.parse("REGION_ITEM_FIRE_ALLOW", player)).getItemStack();
|
||||
} else {
|
||||
return new SWItem(Material.FIREWORK_STAR, BauSystem.MESSAGE.parse("REGION_ITEM_FIRE_DISALLOW", player)).getItemStack();
|
||||
|
||||
@@ -24,7 +24,7 @@ import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode;
|
||||
import de.steamwar.bausystem.region.flags.FreezeMode;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
@@ -42,7 +42,10 @@ public class FreezeBauGuiItem extends BauGuiItem {
|
||||
@Override
|
||||
public ItemStack getItem(Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (region.getPlain(Flag.FREEZE, FreezeMode.class) == FreezeMode.ACTIVE) {
|
||||
if (!region.getFlags().has(Flag.FREEZE).isApplicable()) {
|
||||
return new SWItem(Material.BARRIER, "").getItemStack();
|
||||
}
|
||||
if (region.getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
return new SWItem(Material.GUNPOWDER, BauSystem.MESSAGE.parse("REGION_ITEM_FREEZE_ALLOW", player)).getItemStack();
|
||||
} else {
|
||||
return new SWItem(Material.REDSTONE, BauSystem.MESSAGE.parse("REGION_ITEM_FREEZE_DISALLOW", player)).getItemStack();
|
||||
|
||||
@@ -25,7 +25,7 @@ import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.ProtectMode;
|
||||
import de.steamwar.bausystem.region.flags.ProtectMode;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
@@ -43,7 +43,10 @@ public class ProtectBauGuiItem extends BauGuiItem {
|
||||
@Override
|
||||
public ItemStack getItem(Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (region.getPlain(Flag.PROTECT, ProtectMode.class) == ProtectMode.ACTIVE) {
|
||||
if (!region.getFlags().has(Flag.PROTECT).isApplicable()) {
|
||||
return new SWItem(Material.BARRIER, "").getItemStack();
|
||||
}
|
||||
if (region.getFlags().get(Flag.PROTECT).isWithDefault(ProtectMode.ACTIVE)) {
|
||||
return SWUtils.setCustomModelData(new SWItem(Material.OBSIDIAN, BauSystem.MESSAGE.parse("REGION_ITEM_PROTECT_ALLOW", player)), 1).getItemStack();
|
||||
} else {
|
||||
return SWUtils.setCustomModelData(new SWItem(Material.STONE, BauSystem.MESSAGE.parse("REGION_ITEM_PROTECT_DISALLOW", player)), 1).getItemStack();
|
||||
|
||||
@@ -24,7 +24,7 @@ import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.TNTMode;
|
||||
import de.steamwar.bausystem.region.flags.TNTMode;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.inventory.SWInventory;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
@@ -43,7 +43,7 @@ public class TntBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(Player player) {
|
||||
switch (Region.getRegion(player.getLocation()).getPlain(Flag.TNT, TNTMode.class)) {
|
||||
switch (Region.getRegion(player.getLocation()).getFlags().get(Flag.TNT).getWithDefault()) {
|
||||
case DENY:
|
||||
return new SWItem(Material.MINECART, BauSystem.MESSAGE.parse("REGION_ITEM_TNT_OFF", player)).getItemStack();
|
||||
case ONLY_TB:
|
||||
@@ -58,12 +58,12 @@ public class TntBauGuiItem extends BauGuiItem {
|
||||
@Override
|
||||
public boolean click(ClickType click, Player p) {
|
||||
if (click == ClickType.LEFT) {
|
||||
switch (Region.getRegion(p.getLocation()).getPlain(Flag.TNT, TNTMode.class)) {
|
||||
switch (Region.getRegion(p.getLocation()).getFlags().get(Flag.TNT).getWithDefault()) {
|
||||
case DENY:
|
||||
updateTntMode(TNTMode.ALLOW, p);
|
||||
break;
|
||||
case ALLOW:
|
||||
if (Region.getRegion(p.getLocation()).hasType(RegionType.BUILD) && Region.getRegion(p.getLocation()).hasType(RegionType.TESTBLOCK)) {
|
||||
if (!Region.getRegion(p.getLocation()).getBuildArea().isEmpty() && !Region.getRegion(p.getLocation()).getTestblockArea().isEmpty()) {
|
||||
updateTntMode(TNTMode.ONLY_TB, p);
|
||||
break;
|
||||
}
|
||||
@@ -77,7 +77,7 @@ public class TntBauGuiItem extends BauGuiItem {
|
||||
updateTntMode(TNTMode.ALLOW, p);
|
||||
p.closeInventory();
|
||||
}));
|
||||
if (Region.getRegion(p.getLocation()).hasType(RegionType.BUILD) && Region.getRegion(p.getLocation()).hasType(RegionType.TESTBLOCK)) {
|
||||
if (!Region.getRegion(p.getLocation()).getBuildArea().isEmpty() && !Region.getRegion(p.getLocation()).getTestblockArea().isEmpty()) {
|
||||
selector.setItem(3, new SWItem(Material.TNT_MINECART, BauSystem.MESSAGE.parse("REGION_ITEM_SELECTOR_ONLY_TB", p), clickType -> {
|
||||
updateTntMode(TNTMode.ONLY_TB, p);
|
||||
p.closeInventory();
|
||||
|
||||
@@ -22,7 +22,6 @@ package de.steamwar.bausystem.features.script;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.features.script.lua.SteamWarPlatform;
|
||||
import de.steamwar.bausystem.utils.ItemUtils;
|
||||
import de.steamwar.inventory.SWAnvilInv;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.inventory.SWListInv;
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.luaj.vm2.LuaValue;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
@@ -24,14 +24,13 @@ import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.features.script.ScriptRunner;
|
||||
import de.steamwar.bausystem.features.script.lua.SteamWarGlobalLuaPlugin;
|
||||
import de.steamwar.bausystem.features.script.lua.libs.StorageLib;
|
||||
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@@ -71,9 +70,10 @@ public class EventListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
if(Permission.BUILD.hasPermission(event.getPlayer())) {
|
||||
ScriptRunner.callEvent(event.getPlayer(), SteamWarGlobalLuaPlugin.EventType.SelfLeave, LuaValue.NIL, event);
|
||||
}
|
||||
StorageLib.removePlayer(event.getPlayer());
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
ScriptRunner.callEvent(event.getPlayer(), SteamWarGlobalLuaPlugin.EventType.SelfLeave, LuaValue.NIL, event);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@@ -146,14 +146,14 @@ public class EventListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onEntitySpawn(EntitySpawnEvent event) {
|
||||
if (event.getEntityType() != EntityType.PRIMED_TNT) {
|
||||
if (event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) {
|
||||
return;
|
||||
}
|
||||
Region tntRegion = Region.getRegion(event.getLocation());
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if(!Permission.BUILD.hasPermission(player)) continue;
|
||||
if (tntRegion.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) {
|
||||
if (tntRegion.getArea().inRegion(player.getLocation(), false)) {
|
||||
ScriptRunner.callEvent(player, SteamWarGlobalLuaPlugin.EventType.TNTSpawn, LuaValue.NIL, event);
|
||||
}
|
||||
}
|
||||
@@ -161,7 +161,7 @@ public class EventListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onEntityExplode(EntityExplodeEvent event) {
|
||||
if (event.getEntityType() != EntityType.PRIMED_TNT) {
|
||||
if (event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) {
|
||||
return;
|
||||
}
|
||||
Region tntRegion = Region.getRegion(event.getLocation());
|
||||
@@ -171,11 +171,11 @@ public class EventListener implements Listener {
|
||||
table.set("y", event.getLocation().getY());
|
||||
table.set("z", event.getLocation().getZ());
|
||||
|
||||
boolean inBuild = event.blockList().stream().anyMatch(block -> tntRegion.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION));
|
||||
boolean inBuild = event.blockList().stream().anyMatch(block -> tntRegion.getBuildArea().inRegion(block.getLocation(), true));
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if(!Permission.BUILD.hasPermission(player)) continue;
|
||||
if (tntRegion.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) {
|
||||
if (tntRegion.getArea().inRegion(player.getLocation(), false)) {
|
||||
ScriptRunner.callEvent(player, SteamWarGlobalLuaPlugin.EventType.TNTExplode, table, event);
|
||||
if (inBuild) {
|
||||
ScriptRunner.callEvent(player, SteamWarGlobalLuaPlugin.EventType.TNTExplodeInBuild, table, event);
|
||||
|
||||
@@ -22,19 +22,14 @@ package de.steamwar.bausystem.features.script.lua;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.bukkit.BukkitPlayer;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldedit.event.platform.CommandEvent;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.configplayer.Config;
|
||||
import de.steamwar.bausystem.features.script.ScriptRunner;
|
||||
import de.steamwar.bausystem.features.script.lua.libs.LuaLib;
|
||||
import de.steamwar.bausystem.features.world.WorldEditListener;
|
||||
import de.steamwar.bausystem.utils.WorldEditUtils;
|
||||
import de.steamwar.inventory.SWAnvilInv;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@@ -47,8 +42,6 @@ import org.luaj.vm2.LuaValue;
|
||||
import org.luaj.vm2.Varargs;
|
||||
import org.luaj.vm2.lib.*;
|
||||
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@@ -166,6 +159,8 @@ public class SteamWarLuaPlugin extends TwoArgFunction {
|
||||
env.set("rawlen", NIL);
|
||||
env.set("rawset", NIL);
|
||||
env.set("xpcall", NIL);
|
||||
env.set("require", NIL);
|
||||
env.set("package", NIL);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,19 +20,16 @@
|
||||
package de.steamwar.bausystem.features.script.lua.libs;
|
||||
|
||||
import de.steamwar.bausystem.features.loader.Loader;
|
||||
import de.steamwar.bausystem.region.GlobalRegion;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.FireMode;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.ProtectMode;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.TNTMode;
|
||||
import de.steamwar.bausystem.region.RegionSystem;
|
||||
import de.steamwar.bausystem.region.flags.*;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.luaj.vm2.LuaTable;
|
||||
import org.luaj.vm2.LuaValue;
|
||||
import org.luaj.vm2.lib.OneArgFunction;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Linked
|
||||
@@ -46,27 +43,26 @@ public class RegionLib implements LuaLib {
|
||||
private LuaTable create(Supplier<Region> region, Player player) {
|
||||
LuaTable table = LuaValue.tableOf();
|
||||
|
||||
table.set("name", getter(() -> region.get().getName()));
|
||||
table.set("name", getter(() -> region.get().getID().toString()));
|
||||
table.set("id", getter(() -> region.get().getID().toString()));
|
||||
table.set("type", getter(() -> {
|
||||
Region region1 = region.get();
|
||||
if (region1 instanceof GlobalRegion) {
|
||||
if (region1.getType().isGlobal()) {
|
||||
return "global";
|
||||
} else {
|
||||
return region1.getPrototype().getName();
|
||||
}
|
||||
return region1.getType().name().toLowerCase();
|
||||
}));
|
||||
|
||||
LuaValue tntLib = LuaValue.tableOf();
|
||||
tntLib.set("mode", getter(() -> region.get().getPlain(Flag.TNT, TNTMode.class).name()));
|
||||
tntLib.set("enabled", getter(() -> region.get().getPlain(Flag.TNT, TNTMode.class) != TNTMode.DENY));
|
||||
tntLib.set("onlyTb", getter(() -> region.get().getPlain(Flag.TNT, TNTMode.class) == TNTMode.ONLY_TB));
|
||||
tntLib.set("onlyBuild", getter(() -> region.get().getPlain(Flag.TNT, TNTMode.class) == TNTMode.ONLY_BUILD));
|
||||
|
||||
tntLib.set("mode", getter(() -> region.get().getFlags().get(Flag.TNT).nameWithDefault()));
|
||||
tntLib.set("enabled", getter(() -> region.get().getFlags().get(Flag.TNT).orElse(null) != TNTMode.DENY));
|
||||
tntLib.set("onlyTb", getter(() -> region.get().getFlags().get(Flag.TNT).orElse(null) == TNTMode.ONLY_TB));
|
||||
tntLib.set("onlyBuild", getter(() -> region.get().getFlags().get(Flag.TNT).orElse(null) == TNTMode.ONLY_BUILD));
|
||||
table.set("tnt", tntLib);
|
||||
|
||||
table.set("fire", getter(() -> region.get().getPlain(Flag.FIRE, FireMode.class) == FireMode.ALLOW));
|
||||
table.set("freeze", getter(() -> region.get().getPlain(Flag.FREEZE, FreezeMode.class) == FreezeMode.ACTIVE));
|
||||
table.set("protect", getter(() -> region.get().getPlain(Flag.PROTECT, ProtectMode.class) == ProtectMode.ACTIVE));
|
||||
table.set("fire", getter(() -> region.get().getFlags().get(Flag.FIRE).orElse(null) == FireMode.ALLOW));
|
||||
table.set("freeze", getter(() -> region.get().getFlags().get(Flag.FREEZE).orElse(null) == FreezeMode.ACTIVE));
|
||||
table.set("protect", getter(() -> region.get().getFlags().get(Flag.PROTECT).orElse(null) == ProtectMode.ACTIVE));
|
||||
|
||||
//LuaValue traceLib = LuaValue.tableOf();
|
||||
//traceLib.set("active", getter(() -> !region.get().isGlobal() && Recorder.INSTANCE.get(region.get()) instanceof ActiveTracer));
|
||||
@@ -79,16 +75,16 @@ public class RegionLib implements LuaLib {
|
||||
Loader loader = Loader.getLoader(player);
|
||||
table.set("loader", getter(() -> loader == null ? "OFF" : loader.getStage().name()));
|
||||
|
||||
table.set("copyPoint", getter(() -> toPos(region.get().getCopyPoint())));
|
||||
table.set("minPointBuild", getter(() -> toPos(region.get().getMinPointBuild())));
|
||||
table.set("maxPointBuild", getter(() -> toPos(region.get().getMaxPointBuild())));
|
||||
table.set("minPointBuildExtension", getter(() -> toPos(region.get().getMinPointBuildExtension())));
|
||||
table.set("maxPointBuildExtension", getter(() -> toPos(region.get().getMaxPointBuildExtension())));
|
||||
table.set("testblockPoint", getter(() -> toPos(region.get().getTestBlockPoint())));
|
||||
table.set("minPointTestblock", getter(() -> toPos(region.get().getMinPointTestblock())));
|
||||
table.set("maxPointTestblock", getter(() -> toPos(region.get().getMaxPointTestblock())));
|
||||
table.set("minPointTestblockExtension", getter(() -> toPos(region.get().getMinPointTestblockExtension())));
|
||||
table.set("maxPointTestblockExtension", getter(() -> toPos(region.get().getMaxPointTestblockExtension())));
|
||||
table.set("copyPoint", getter(() -> toPos(region.get().getBuildArea().getCopyPoint())));
|
||||
table.set("minPointBuild", getter(() -> toPos(region.get().getBuildArea().getMinPoint(false))));
|
||||
table.set("maxPointBuild", getter(() -> toPos(region.get().getBuildArea().getMinPoint(false))));
|
||||
table.set("minPointBuildExtension", getter(() -> toPos(region.get().getBuildArea().getMinPoint(true))));
|
||||
table.set("maxPointBuildExtension", getter(() -> toPos(region.get().getBuildArea().getMinPoint(true))));
|
||||
table.set("testblockPoint", getter(() -> toPos(region.get().getTestblockArea().getCopyPoint())));
|
||||
table.set("minPointTestblock", getter(() -> toPos(region.get().getTestblockArea().getMinPoint(false))));
|
||||
table.set("maxPointTestblock", getter(() -> toPos(region.get().getTestblockArea().getMinPoint(false))));
|
||||
table.set("minPointTestblockExtension", getter(() -> toPos(region.get().getTestblockArea().getMinPoint(true))));
|
||||
table.set("maxPointTestblockExtension", getter(() -> toPos(region.get().getTestblockArea().getMinPoint(true))));
|
||||
|
||||
return table;
|
||||
}
|
||||
@@ -99,11 +95,11 @@ public class RegionLib implements LuaLib {
|
||||
table.set("get", new OneArgFunction() {
|
||||
@Override
|
||||
public LuaValue call(LuaValue arg) {
|
||||
return create(() -> Region.getREGION_MAP().get(arg.checkjstring()), player);
|
||||
return create(() -> RegionSystem.INSTANCE.getRegion(UUID.fromString(arg.checkjstring())).orElse(RegionSystem.INSTANCE.getGlobalRegion()), player);
|
||||
}
|
||||
});
|
||||
|
||||
table.set("list", getter(() -> LuaValue.listOf(Region.getREGION_MAP().values().stream().map(region -> create(() -> region, player)).toArray(LuaTable[]::new))));
|
||||
table.set("list", getter(() -> LuaValue.listOf(RegionSystem.INSTANCE.getRegions().map(region -> create(() -> region, player)).toArray(LuaTable[]::new))));
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
@@ -24,9 +24,7 @@ import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.luaj.vm2.LuaTable;
|
||||
import org.luaj.vm2.LuaValue;
|
||||
import org.luaj.vm2.Varargs;
|
||||
import org.luaj.vm2.lib.TwoArgFunction;
|
||||
import org.luaj.vm2.lib.VarArgFunction;
|
||||
|
||||
@Linked
|
||||
|
||||
@@ -21,7 +21,6 @@ package de.steamwar.bausystem.features.script.lua.libs;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.features.loader.Loader;
|
||||
import de.steamwar.bausystem.features.loader.LoaderRecorder;
|
||||
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
|
||||
@@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.script.lua.libs;
|
||||
|
||||
import com.google.gson.*;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionSystem;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.api.Disable;
|
||||
@@ -74,7 +75,7 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
||||
jsonObject.keySet().forEach(key -> {
|
||||
map.put(key, fromJson(jsonObject.get(key)));
|
||||
});
|
||||
Region region = Region.getREGION_MAP().get(regionStorage.getName().substring(0, regionStorage.getName().length() - ".json".length()));
|
||||
Region region = RegionSystem.INSTANCE.getRegion(UUID.fromString(regionStorage.getName().substring(0, regionStorage.getName().length() - ".json".length()))).orElse(null);
|
||||
REGION_STORAGE.put(region, map);
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
@@ -143,7 +144,7 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
||||
regionStorageDirectory.mkdirs();
|
||||
for (Map.Entry<Region, HashMap<String, LuaValue>> entry : REGION_STORAGE.entrySet()) {
|
||||
try {
|
||||
FileWriter fileWriter = new FileWriter(new File(regionStorageDirectory, entry.getKey().getName() + ".json"));
|
||||
FileWriter fileWriter = new FileWriter(new File(regionStorageDirectory, entry.getKey().getID().toString() + ".json"));
|
||||
gson.toJson(toJson(entry.getValue()), fileWriter);
|
||||
fileWriter.close();
|
||||
} catch (IOException e) {}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.script.lua.libs;
|
||||
|
||||
import de.steamwar.bausystem.features.tpslimit.TPSSystem;
|
||||
import de.steamwar.bausystem.utils.TickManager;
|
||||
import de.steamwar.core.TPSWatcher;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.LinkedInstance;
|
||||
@@ -51,7 +52,7 @@ public class TpsLib implements LuaLib {
|
||||
tpsLib.set("fiveMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.FIVE_MINUTES)));
|
||||
tpsLib.set("tenMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES)));
|
||||
tpsLib.set("current", getter(TPSWatcher::getTPS));
|
||||
tpsLib.set("limit", getter(tpsSystem::getCurrentTPSLimit));
|
||||
tpsLib.set("limit", getter(() -> (double) TickManager.impl.getTickRate()));
|
||||
return tpsLib;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2023 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.features.script.lua.libs;
|
||||
|
||||
import de.steamwar.bausystem.features.tracer.TNTPoint;
|
||||
import de.steamwar.bausystem.features.tracer.Trace;
|
||||
import de.steamwar.bausystem.features.tracer.TraceManager;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.luaj.vm2.LuaTable;
|
||||
import org.luaj.vm2.LuaValue;
|
||||
import org.luaj.vm2.lib.ZeroArgFunction;
|
||||
|
||||
@Linked
|
||||
public class TracerLib implements LuaLib {
|
||||
@Override
|
||||
public String name() {
|
||||
return "tracer";
|
||||
}
|
||||
|
||||
private static LuaTable convertTrace(Trace trace) {
|
||||
LuaTable luaTrace = new LuaTable();
|
||||
|
||||
luaTrace.set("getRecords", new ZeroArgFunction() {
|
||||
@Override
|
||||
public LuaValue call() {
|
||||
return LuaValue.listOf(
|
||||
trace.getHistories()
|
||||
.stream()
|
||||
.map((history) -> LuaValue.listOf(history
|
||||
.stream()
|
||||
.map(TracerLib::convertTntPoint)
|
||||
.toArray(LuaValue[]::new)))
|
||||
.toArray(LuaValue[]::new));
|
||||
}
|
||||
});
|
||||
|
||||
luaTrace.set("getId", new ZeroArgFunction() {
|
||||
@Override
|
||||
public LuaValue call() {
|
||||
return LuaValue.valueOf(trace.getUuid().toString());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return luaTrace;
|
||||
}
|
||||
|
||||
private static LuaTable convertTntPoint(TNTPoint tntPoint) {
|
||||
Location pointPos = tntPoint.getLocation();
|
||||
LuaTable luaPos = LuaValue.tableOf(new LuaValue[]{
|
||||
LuaValue.valueOf("x"), LuaValue.valueOf(pointPos.getX()),
|
||||
LuaValue.valueOf("y"), LuaValue.valueOf(pointPos.getY()),
|
||||
LuaValue.valueOf("z"), LuaValue.valueOf(pointPos.getZ()),
|
||||
});
|
||||
|
||||
Vector pointVel = tntPoint.getVelocity();
|
||||
LuaTable luaVel = LuaValue.tableOf(new LuaValue[]{
|
||||
LuaValue.valueOf("x"), LuaValue.valueOf(pointVel.getX()),
|
||||
LuaValue.valueOf("y"), LuaValue.valueOf(pointVel.getY()),
|
||||
LuaValue.valueOf("z"), LuaValue.valueOf(pointVel.getZ()),
|
||||
});
|
||||
|
||||
return LuaValue.tableOf(new LuaValue[]{
|
||||
LuaValue.valueOf("pos"), luaPos,
|
||||
LuaValue.valueOf("vel"), luaVel,
|
||||
LuaValue.valueOf("ticksSinceStart"), LuaValue.valueOf(tntPoint.getTicksSinceStart()),
|
||||
LuaValue.valueOf("fuse"), LuaValue.valueOf(tntPoint.getFuse()),
|
||||
LuaValue.valueOf("isExplosion"), LuaValue.valueOf(tntPoint.isExplosion()),
|
||||
LuaValue.valueOf("isInWater"), LuaValue.valueOf(tntPoint.isInWater()),
|
||||
LuaValue.valueOf("hasDestroyedBuild"), LuaValue.valueOf(tntPoint.isDestroyedBuildArea()),
|
||||
LuaValue.valueOf("hasDestroyedTestblock"), LuaValue.valueOf(tntPoint.isDestroyedTestBlock())
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public LuaTable get(Player player) {
|
||||
LuaTable rootTable = LuaValue.tableOf();
|
||||
|
||||
rootTable.set("getTraces", new ZeroArgFunction() {
|
||||
@Override
|
||||
public LuaValue call() {
|
||||
return LuaValue.listOf(TraceManager.instance.getAll()
|
||||
.stream()
|
||||
.map(TracerLib::convertTrace)
|
||||
.toArray(LuaValue[]::new));
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
return rootTable;
|
||||
}
|
||||
}
|
||||
@@ -160,6 +160,11 @@ public class ShieldPrinting implements Listener {
|
||||
|
||||
private void paste(Map<Material, BlockDataConfiguration<?>[]> stateConfiguration) {
|
||||
for (Map.Entry<Vector, BlockData> entry : shieldData.entrySet()) {
|
||||
BlockData copied = entry.getValue();
|
||||
if (copied.getMaterial().isAir()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Block block = entry.getKey().toLocation(WORLD).getBlock();
|
||||
if (entry.getValue().getMaterial() != block.getType()) {
|
||||
block.setBlockData(entry.getValue(), false);
|
||||
@@ -171,12 +176,11 @@ public class ShieldPrinting implements Listener {
|
||||
|
||||
BlockDataConfiguration[] stateConfigurations = stateConfiguration.get(entry.getValue().getMaterial());
|
||||
if (stateConfigurations == null) {
|
||||
block.setBlockData(entry.getValue(), false);
|
||||
continue;
|
||||
}
|
||||
|
||||
BlockData worldOriginal = block.getBlockData();
|
||||
BlockData copied = entry.getValue().clone();
|
||||
copied = copied.clone();
|
||||
for (BlockDataConfiguration blockDataConfiguration : stateConfigurations) {
|
||||
if (blockDataConfiguration == null) continue;
|
||||
blockDataConfiguration.apply(copied, worldOriginal);
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ShieldPrintingCommand extends SWCommand implements Listener {
|
||||
@Register
|
||||
public void genericCommand(@Validator Player player, ShieldPrintingState shieldPrintingState) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (region.isGlobal()) {
|
||||
if (region.getType().isGlobal()) {
|
||||
BauSystem.MESSAGE.send("SHIELD_PRINTING_NO_REGION", player);
|
||||
return;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class ShieldPrintingCommand extends SWCommand implements Listener {
|
||||
@Register("stop")
|
||||
public void stopCommand(@Validator Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (region.isGlobal()) {
|
||||
if (region.getType().isGlobal()) {
|
||||
BauSystem.MESSAGE.send("SHIELD_PRINTING_NO_REGION", player);
|
||||
return;
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public class ShieldPrintingCommand extends SWCommand implements Listener {
|
||||
return false;
|
||||
}
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (region.isGlobal()) {
|
||||
if (region.getType().isGlobal()) {
|
||||
messageSender.send("SHIELD_PRINTING_NO_REGION", player);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.features.shieldprinting.BlockDataConfiguration;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.Piston;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
package de.steamwar.bausystem.features.simulator;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
||||
import de.steamwar.bausystem.features.simulator.execute.SimulatorExecutor;
|
||||
@@ -63,15 +62,7 @@ public class SimulatorCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "copy", description = "SIMULATOR_COPY_HELP")
|
||||
public void copy(@Validator Player p, @ErrorMessage("SIMULATOR_NOT_EXISTS") Simulator simulator, String name) {
|
||||
if (SimulatorStorage.getSimulator(name) != null) {
|
||||
BauSystem.MESSAGE.send("SIMULATOR_NAME_ALREADY_EXISTS", p);
|
||||
return;
|
||||
}
|
||||
if (!name.matches("[a-zA-Z_0-9-]+")) {
|
||||
BauSystem.MESSAGE.send("SIMULATOR_NAME_INVALID", p);
|
||||
return;
|
||||
}
|
||||
public void copy(@Validator Player p, @ErrorMessage("SIMULATOR_NOT_EXISTS") Simulator simulator, @Validator("simulatorName") String name) {
|
||||
if (!SimulatorStorage.copy(simulator, name)) {
|
||||
BauSystem.MESSAGE.send("SIMULATOR_ERROR_COPY", p);
|
||||
}
|
||||
@@ -85,7 +76,18 @@ public class SimulatorCommand extends SWCommand {
|
||||
|
||||
@Register(value = "start", description = "SIMULATOR_START_HELP")
|
||||
public void start(@Validator Player p, @ErrorMessage("SIMULATOR_NOT_EXISTS") Simulator simulator) {
|
||||
SimulatorExecutor.run(simulator);
|
||||
SimulatorExecutor.run(p, simulator, null);
|
||||
}
|
||||
|
||||
@Register(value = "rename", description = "SIMULATOR_RENAME_HELP")
|
||||
public void rename(@Validator Player p, @ErrorMessage("SIMULATOR_NOT_EXISTS") Simulator simulator, @Validator("simulatorName") String name) {
|
||||
String oldName = simulator.getName();
|
||||
if (SimulatorStorage.copy(simulator, name)) {
|
||||
SimulatorStorage.delete(simulator);
|
||||
BauSystem.MESSAGE.send("SIMULATOR_RENAMED", p, oldName, name);
|
||||
} else {
|
||||
BauSystem.MESSAGE.send("SIMULATOR_ERROR_COPY", p);
|
||||
}
|
||||
}
|
||||
|
||||
@ClassMapper(value = Simulator.class, local = true)
|
||||
@@ -102,4 +104,19 @@ public class SimulatorCommand extends SWCommand {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Validator(value = "simulatorName", local = true)
|
||||
public TypeValidator<String> simulatorName() {
|
||||
return (commandSender, name, messageSender) -> {
|
||||
if (SimulatorStorage.getSimulator(name) != null) {
|
||||
messageSender.send("SIMULATOR_NAME_ALREADY_EXISTS");
|
||||
return false;
|
||||
}
|
||||
if (!name.matches("[a-zA-Z_0-9-]+")) {
|
||||
messageSender.send("SIMULATOR_NAME_INVALID");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.features.simulator;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import de.steamwar.Reflection;
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
@@ -72,9 +72,9 @@ import java.util.stream.Collectors;
|
||||
public class SimulatorCursor implements Listener {
|
||||
|
||||
private final World WORLD = Bukkit.getWorlds().get(0);
|
||||
private Class<?> position = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPosition");
|
||||
private Class<?> look = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInLook");
|
||||
private Class<?> positionLook = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPositionLook");
|
||||
private Class<?> position = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Pos");
|
||||
private Class<?> look = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Rot");
|
||||
private Class<?> positionLook = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$PosRot");
|
||||
|
||||
private Map<Player, CursorType> cursorType = Collections.synchronizedMap(new HashMap<>());
|
||||
private Map<Player, REntityServer> cursors = Collections.synchronizedMap(new HashMap<>());
|
||||
@@ -168,9 +168,19 @@ public class SimulatorCursor implements Listener {
|
||||
}
|
||||
return;
|
||||
}
|
||||
Simulator simulator = SimulatorStorage.getSimulator(player);
|
||||
SimulatorWatcher.show(simulator, player);
|
||||
|
||||
Simulator simulator = SimulatorStorage.getSimulator(player);
|
||||
if (simulator != null && simulator.getStabGenerator() != null) {
|
||||
removeCursor(player);
|
||||
SimulatorWatcher.show(null, player);
|
||||
SWUtils.sendToActionbar(player, "§cGenerating Stab");
|
||||
synchronized (calculating) {
|
||||
calculating.remove(player);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
SimulatorWatcher.show(simulator, player);
|
||||
List<REntity> entities = SimulatorWatcher.getEntitiesOfSimulator(simulator);
|
||||
RayTraceUtils.RRayTraceResult rayTraceResult = RayTraceUtils.traceREntity(player, player.getLocation(), entities);
|
||||
if (rayTraceResult == null) {
|
||||
@@ -357,7 +367,7 @@ public class SimulatorCursor implements Listener {
|
||||
if (simulator == null) {
|
||||
return;
|
||||
}
|
||||
SimulatorExecutor.run(simulator);
|
||||
SimulatorExecutor.run(event.getPlayer(), simulator, null);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Linked
|
||||
@MinVersion(19)
|
||||
@@ -130,7 +131,7 @@ public class SimulatorStorage implements Enable {
|
||||
}
|
||||
|
||||
public static void openSimulatorSelector(Player player) {
|
||||
SimulatorPageGui<Simulator> simulatorPageGui = new SimulatorPageGui<Simulator>(player, null, 6 * 9, new ArrayList<>(simulatorMap.values())) {
|
||||
SimulatorPageGui<Simulator> simulatorPageGui = new SimulatorPageGui<Simulator>(player, null, 6 * 9, simulatorMap.values().stream().sorted(Comparator.comparing(Simulator::getName)).collect(Collectors.toList())) {
|
||||
@Override
|
||||
public String baseTitle() {
|
||||
return "Simulators";
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.simulator.data;
|
||||
|
||||
import de.steamwar.bausystem.features.simulator.execute.SimulatorAction;
|
||||
import de.steamwar.bausystem.features.simulator.execute.SimulatorStabGenerator;
|
||||
import de.steamwar.inventory.InvCallback;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import lombok.Getter;
|
||||
@@ -30,18 +31,20 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@RequiredArgsConstructor
|
||||
public final class Simulator {
|
||||
private SimulatorStabGenerator stabGenerator = null;
|
||||
private Material material = Material.BARREL;
|
||||
private final String name;
|
||||
private boolean autoTrace = false;
|
||||
private final List<SimulatorGroup> groups = new ArrayList<>();
|
||||
|
||||
private boolean autoTrace = false;
|
||||
private boolean autoTestblock = false;
|
||||
|
||||
public void move(int x, int y, int z) {
|
||||
groups.forEach(simulatorGroup -> {
|
||||
simulatorGroup.move(x, y, z);
|
||||
|
||||
@@ -33,7 +33,6 @@ import yapion.hierarchy.types.YAPIONObject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
@Getter
|
||||
|
||||
@@ -25,8 +25,6 @@ import lombok.Setter;
|
||||
import org.bukkit.util.Vector;
|
||||
import yapion.hierarchy.types.YAPIONObject;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
@Getter
|
||||
|
||||
@@ -23,7 +23,6 @@ import de.steamwar.bausystem.features.simulator.data.SimulatorPhase;
|
||||
import de.steamwar.bausystem.features.simulator.execute.SimulatorAction;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
@@ -60,11 +59,12 @@ public final class TNTPhase extends SimulatorPhase {
|
||||
|
||||
@Override
|
||||
public void toSimulatorActions(Vector position, BiConsumer<Integer, SimulatorAction> tickStart, BiConsumer<Integer, SimulatorAction> tickEnd) {
|
||||
if (count <= 0) return;
|
||||
tickStart.accept(tickOffset, new SimulatorAction(order, count) {
|
||||
@Override
|
||||
public void accept(World world) {
|
||||
Location location = position.toLocation(world);
|
||||
if (Region.getRegion(location).get(Flag.FREEZE) == FreezeMode.ACTIVE) return;
|
||||
if (Region.getRegion(location).getFlags().get(Flag.FREEZE).isPresent()) return;
|
||||
TNTPrimed tnt = world.spawn(location, TNTPrimed.class);
|
||||
if (!xJump) tnt.setVelocity(tnt.getVelocity().setX(0));
|
||||
if (!yJump) tnt.setVelocity(tnt.getVelocity().setY(0));
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.features.simulator.execute;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
@AllArgsConstructor
|
||||
public enum Direction {
|
||||
X(Vector::getBlockX),
|
||||
Y(Vector::getBlockY),
|
||||
Z(Vector::getBlockZ);
|
||||
|
||||
public final Function<Vector, Integer> component;
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.MinVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
@@ -46,7 +47,7 @@ public class SimulatorExecutor implements Listener {
|
||||
private static Map<Long, Map<Integer, List<SimulatorAction>>> tickStartActions = new HashMap<>();
|
||||
private static Map<Long, List<SimulatorAction>> tickEndActions = new HashMap<>();
|
||||
|
||||
public static boolean run(Simulator simulator) {
|
||||
public static boolean run(Player player, Simulator simulator, Runnable onEnd) {
|
||||
if (currentlyRunning.contains(simulator)) return false;
|
||||
currentlyRunning.add(simulator);
|
||||
|
||||
@@ -69,7 +70,7 @@ public class SimulatorExecutor implements Listener {
|
||||
public void accept(World world) {
|
||||
currentlyRunning.remove(simulator);
|
||||
|
||||
if (simulator.isAutoTrace()) {
|
||||
if (simulator.isAutoTrace() && onEnd == null) {
|
||||
simulator.getGroups()
|
||||
.stream()
|
||||
.map(SimulatorGroup::getElements)
|
||||
@@ -82,10 +83,17 @@ public class SimulatorExecutor implements Listener {
|
||||
TraceRecorder.instance.stopRecording(region);
|
||||
});
|
||||
}
|
||||
|
||||
if (onEnd != null) {
|
||||
onEnd.run();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (simulator.isAutoTrace()) {
|
||||
if (player != null && simulator.isAutoTestblock()) {
|
||||
player.performCommand("tb");
|
||||
}
|
||||
if (simulator.isAutoTrace() && onEnd == null) {
|
||||
simulator.getGroups()
|
||||
.stream()
|
||||
.map(SimulatorGroup::getElements)
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.features.simulator.execute;
|
||||
|
||||
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
||||
import de.steamwar.bausystem.features.simulator.data.tnt.TNTElement;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.utils.bossbar.BossBarService;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SimulatorStabGenerator {
|
||||
|
||||
private final StabData stabData;
|
||||
|
||||
public SimulatorStabGenerator(Region region, Simulator simulator, TNTElement tntElement, int depthLimit) {
|
||||
stabData = new StabData(region, simulator, tntElement, tntElement.getPhases(), depthLimit);
|
||||
new StabSetup(stabData);
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
stabData.cancel = true;
|
||||
stabData.simulator.setStabGenerator(null);
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
BossBarService.instance.remove(player, stabData.region, "simulator_stab_generator");
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user