Compare commits
884
Commits
metis-api-old
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59e3fcb70c | ||
|
|
56fad0a9da | ||
|
|
e6719c619f | ||
|
|
35e76fc8b4 | ||
|
|
d99d8f4699 | ||
|
|
ba328585bf | ||
|
|
3a121afd81 | ||
|
|
30ac6076f2 | ||
|
|
96980fdcea | ||
|
|
7977015d80 | ||
|
|
809d37368d | ||
|
|
e5ce647eb7 | ||
|
|
2c1eabebf9 | ||
|
|
4ca6da0169 | ||
|
|
4ab3e836bd | ||
|
|
90b9c8dde7 | ||
|
|
a6e5133366 | ||
|
|
906f9b6a5d | ||
|
|
f8b61a877f | ||
|
|
23750fdcba | ||
|
|
42d70666ad | ||
|
|
157e53aefb | ||
|
|
0665fb8888 | ||
|
|
2e84d2d824 | ||
|
|
54b7b7d41a | ||
|
|
8073813763 | ||
|
|
21298372e5 | ||
|
|
4db4aa8c7d | ||
|
|
898d272cdf | ||
|
|
3b77ca4c6f | ||
|
|
ba1d4c1cfa | ||
|
|
19877b2ff0 | ||
|
|
408425ec3d | ||
|
|
777835edfa | ||
|
|
a07c2dd4bc | ||
|
|
c3e08a9b12 | ||
|
|
077205c9b3 | ||
|
|
dbf2044194 | ||
|
|
bde16e50ff | ||
|
|
ed30c8f5f3 | ||
|
|
12449cf2f0 | ||
|
|
5576441e62 | ||
|
|
96a07f7d08 | ||
|
|
467c07975f | ||
|
|
12339e7447 | ||
|
|
2e1959de6b | ||
|
|
8eeb17cd90 | ||
|
|
afcb80ec6b | ||
|
|
19390f3032 | ||
|
|
51ddbcb16c | ||
|
|
a16c042b76 | ||
|
|
0748d8fbc3 | ||
|
|
d2f75e067d | ||
|
|
d5838e9261 | ||
|
|
3bfc9697bb | ||
|
|
61e9e5ef22 | ||
|
|
c835b52f70 | ||
|
|
f01c06760d | ||
|
|
09b23c91b9 | ||
|
|
aa97b8a6ed | ||
|
|
e786465817 | ||
|
|
9c179d6db4 | ||
|
|
13ad388cdd | ||
|
|
374ada44fe | ||
|
|
6b3acf50d0 | ||
|
|
9183291491 | ||
|
|
4bbe860009 | ||
|
|
5daecbd1c8 | ||
|
|
0abdaf7de6 | ||
|
|
0f279428cb | ||
|
|
6418ced879 | ||
|
|
8d2eedfad2 | ||
|
|
42f7686f9b | ||
|
|
79f2802aff | ||
|
|
952118f1f1 | ||
|
|
d672356aba | ||
|
|
4c0c09040b | ||
|
|
0c9ac7c0bc | ||
|
|
eee97477c3 | ||
|
|
4134a0f485 | ||
|
|
2fbc8e4832 | ||
|
|
870e851b3a | ||
|
|
f1334d44fe | ||
|
|
3bc51b4e4f | ||
|
|
e35570ccc4 | ||
|
|
44e50087c7 | ||
|
|
d517a4ab67 | ||
|
|
eb1d4389be | ||
|
|
a67574d9f7 | ||
|
|
75f2902494 | ||
|
|
9b41293ad7 | ||
|
|
6b178d650d | ||
|
|
a950b52ac9 | ||
|
|
38eecf7d8f | ||
|
|
9aa99e3b6e | ||
|
|
ebcdd7a84a | ||
|
|
3b892202df | ||
|
|
765ec43c1b | ||
|
|
165a4bc5a8 | ||
|
|
d41c168ff6 | ||
|
|
ddb24b67ad | ||
|
|
0e7b5050eb | ||
|
|
15baca3772 | ||
|
|
1df2117d90 | ||
|
|
faf6941264 | ||
|
|
55f138bc28 | ||
|
|
1f8c5ab569 | ||
|
|
04b495fabb | ||
|
|
45f9e66e2a | ||
|
|
363b6b2ed0 | ||
|
|
513923181e | ||
|
|
efc67e323d | ||
|
|
79d25621a9 | ||
|
|
122b096200 | ||
|
|
e1d47031d4 | ||
|
|
00fd629344 | ||
|
|
636fa9c58f | ||
|
|
00c85873be | ||
|
|
f54e80bca9 | ||
|
|
470029fa53 | ||
|
|
2fe942cae2 | ||
|
|
f2ba562218 | ||
|
|
6f89ef8191 | ||
|
|
56412ef723 | ||
|
|
6fcee5f4e4 | ||
|
|
6afb981e50 | ||
|
|
626048f35a | ||
|
|
c11c38ca96 | ||
|
|
5971f58d4a | ||
|
|
305cf9bce7 | ||
|
|
b37c112c9b | ||
|
|
09d0c22894 | ||
|
|
5d93f5e828 | ||
|
|
02cd724d88 | ||
|
|
a194915ff8 | ||
|
|
566a3f62b0 | ||
|
|
7ec796a34e | ||
|
|
3fb0b66848 | ||
|
|
aebc23f8ad | ||
|
|
b81111c3ef | ||
|
|
ab3c1fda46 | ||
|
|
006d2a36c1 | ||
|
|
a69e6cf0ef | ||
|
|
13ee67031f | ||
|
|
5815cb144c | ||
|
|
06bbc113f8 | ||
|
|
1612e57576 | ||
|
|
7fb61194d1 | ||
|
|
e9da1c1293 | ||
|
|
931cd0d1df | ||
|
|
54024347c1 | ||
|
|
f8f6ae7fd6 | ||
|
|
865e2f86f0 | ||
|
|
eda218c318 | ||
|
|
1159809d8d | ||
|
|
8d5daa77fc | ||
|
|
8f817b8244 | ||
|
|
6afed694af | ||
|
|
ec345bc425 | ||
|
|
66d6e90ca2 | ||
|
|
37cf308b9f | ||
|
|
75e2ec1ea9 | ||
|
|
f0192d1695 | ||
|
|
aa72653b61 | ||
|
|
78b082a544 | ||
|
|
79ec20ac94 | ||
|
|
6bfcfb095a | ||
|
|
6c2da25b00 | ||
|
|
fcd0e1265e | ||
|
|
736952e5f2 | ||
|
|
40ddd432f6 | ||
|
|
d04b6b0317 | ||
|
|
27faf3de8b | ||
|
|
4d0c70d0ee | ||
|
|
2ff968535a | ||
|
|
4b1030cf24 | ||
|
|
a167a9f692 | ||
|
|
87c1e162de | ||
|
|
97a92653c9 | ||
|
|
8fe9db4a48 | ||
|
|
0024c147e3 | ||
|
|
6a4a4f096c | ||
|
|
7367990354 | ||
|
|
818f543c7d | ||
|
|
708e23dd68 | ||
|
|
c4f87d9686 | ||
|
|
de2a6a4bc1 | ||
|
|
c740834140 | ||
|
|
abd14e6940 | ||
|
|
9856518f92 | ||
|
|
2f2fa60101 | ||
|
|
b4facdd618 | ||
|
|
ae410788f5 | ||
|
|
fb9828c48c | ||
|
|
501371722c | ||
|
|
7138a2a06c | ||
|
|
a50d75d7fd | ||
|
|
1f9c0b2036 | ||
|
|
7abae75667 | ||
|
|
a3d34dfa49 | ||
|
|
9dc5c0889d | ||
|
|
9f642e0969 | ||
|
|
0453f62205 | ||
|
|
26f69dc5de | ||
|
|
1f58950fbc | ||
|
|
814848b1c0 | ||
|
|
45a860becf | ||
|
|
e2f469c9a9 | ||
|
|
fc487de6da | ||
|
|
4589af5e01 | ||
|
|
3737d47253 | ||
|
|
c778ce00aa | ||
|
|
5f740e2dcd | ||
|
|
6dc570b86f | ||
|
|
22ad3d1511 | ||
|
|
4129a0c81c | ||
|
|
7bce50f0f5 | ||
|
|
12d701ee87 | ||
|
|
05a8556980 | ||
|
|
3c8f1d5dc0 | ||
|
|
0838895885 | ||
|
|
f70252e467 | ||
|
|
010b2684ac | ||
|
|
03ed346436 | ||
|
|
7e7aab74e2 | ||
|
|
1c2ada628e | ||
|
|
a5120288c0 | ||
|
|
45b6f69b4e | ||
|
|
cc098b6857 | ||
|
|
fca5e5d52e | ||
|
|
0c4f7ae57f | ||
|
|
16ef47c7b2 | ||
|
|
fe2c84fc5e | ||
|
|
980200ab96 | ||
|
|
c5e79d395a | ||
|
|
f762f00161 | ||
|
|
4b6a4c21a0 | ||
|
|
abd51966e9 | ||
|
|
e8662ed39f | ||
|
|
ba525e8ef5 | ||
|
|
8c921ae845 | ||
|
|
248bf56cd4 | ||
|
|
5117070701 | ||
|
|
a85dc3d75f | ||
|
|
192d84d1b1 | ||
|
|
ec278a7270 | ||
|
|
e62f291d2c | ||
|
|
2281e5a099 | ||
|
|
417b28dce1 | ||
|
|
99ac96891f | ||
|
|
90bc4d48fd | ||
|
|
abf625fb0f | ||
|
|
44896ac204 | ||
|
|
337c87a4e4 | ||
|
|
f65549c8d2 | ||
|
|
9c31861d77 | ||
|
|
543f0c6193 | ||
|
|
e5ae905cee | ||
|
|
148e30c1e2 | ||
|
|
e55407fc4a | ||
|
|
da8b5adba8 | ||
|
|
966b027416 | ||
|
|
b08eba316f | ||
|
|
5c73156e94 | ||
|
|
efc7e439c5 | ||
|
|
92f6bb28d7 | ||
|
|
94f2ae9dc7 | ||
|
|
c4a85a3bc1 | ||
|
|
383056f5ed | ||
|
|
5c715dfbd3 | ||
|
|
2612b4b85d | ||
|
|
e94e07ae54 | ||
|
|
898879bdfd | ||
|
|
522f5d50a8 | ||
|
|
a233518e4c | ||
|
|
afea5e2c98 | ||
|
|
636ed4474e | ||
|
|
706ca304d2 | ||
|
|
f4d3b6e0eb | ||
|
|
67160e9e04 | ||
|
|
c1f68c40c8 | ||
|
|
53d10b0256 | ||
|
|
d093ee99ef | ||
|
|
9bd33003a2 | ||
|
|
25c03b80f7 | ||
|
|
e5f604cad4 | ||
|
|
ada386884c | ||
|
|
8ca8eda480 | ||
|
|
15d1b260bb | ||
|
|
1c9ed40f07 | ||
|
|
69257ea282 | ||
|
|
0fd61bf452 | ||
|
|
6ea698a101 | ||
|
|
1693b71e2e | ||
|
|
3e2945ec4f | ||
|
|
2a7f8d6b64 | ||
|
|
a4336bb2a9 | ||
|
|
845f847240 | ||
|
|
76690f1275 | ||
|
|
b8df37dddc | ||
|
|
356812745d | ||
|
|
d28ca0594c | ||
|
|
f83fc5a932 | ||
|
|
c3ab15a853 | ||
|
|
2681e6ae63 | ||
|
|
1e03eb833b | ||
|
|
0d776a6ce7 | ||
|
|
77404cb581 | ||
|
|
a13548f249 | ||
|
|
3cd3c656c0 | ||
|
|
9d1253d6d8 | ||
|
|
0c994df90a | ||
|
|
67f9b2666f | ||
|
|
d939832225 | ||
|
|
71286130ad | ||
|
|
9c21f848ff | ||
|
|
321f0ddaa2 | ||
|
|
eb5ef69fbd | ||
|
|
7f672c3ae3 | ||
|
|
73015ad263 | ||
|
|
25af9ac960 | ||
|
|
5c8e7b5b8a | ||
|
|
b68519e563 | ||
|
|
b3df7a1119 | ||
|
|
14e02313ab | ||
|
|
21043eb96b | ||
|
|
d1de6ab2e8 | ||
|
|
d7205debc9 | ||
|
|
3ff03632ff | ||
|
|
f7381e359f | ||
|
|
0ec5ef70dc | ||
|
|
9add587313 | ||
|
|
f01863c5bd | ||
|
|
15abe8bda7 | ||
|
|
ef1758f2e1 | ||
|
|
987bd54c25 | ||
|
|
cc2137766d | ||
|
|
045ed107ab | ||
|
|
161d71fdf7 | ||
|
|
e229a432e4 | ||
|
|
84845640c9 | ||
|
|
6bdb81e124 | ||
|
|
7754d9a326 | ||
|
|
67b5d1af47 | ||
|
|
8e64062cf3 | ||
|
|
ba4a7ff9c5 | ||
|
|
b024e4be52 | ||
|
|
547e4a17c8 | ||
|
|
77c3dca42e | ||
|
|
6dd22598ba | ||
|
|
504284a47a | ||
|
|
e2aa919c7a | ||
|
|
02e94954ed | ||
|
|
1450a9d6b8 | ||
|
|
a3c24a7f7e | ||
|
|
f8f93041c7 | ||
|
|
a593178ad3 | ||
|
|
f09559145b | ||
|
|
f441aa11bb | ||
|
|
1e1e98b91a | ||
|
|
aea96fc1a1 | ||
|
|
58c37704c9 | ||
|
|
56220efc6d | ||
|
|
4c2c0b9d3d | ||
|
|
5d65615685 | ||
|
|
c6067291a9 | ||
|
|
05ee2b6724 | ||
|
|
e8e3ad4e45 | ||
|
|
122c973762 | ||
|
|
44a16a5af7 | ||
|
|
77636f83fe | ||
|
|
ec3b244baa | ||
|
|
23c644c3db | ||
|
|
16db949c7d | ||
|
|
480553f088 | ||
|
|
8bd539dcce | ||
|
|
f6c57c3f3e | ||
|
|
2b6ed2675a | ||
|
|
94075c084f | ||
|
|
6e3324f57c | ||
|
|
28dbdbc90e | ||
|
|
83c9907e01 | ||
|
|
b40e8defa4 | ||
|
|
8365817799 | ||
|
|
92680cb79c | ||
|
|
11fe172fec | ||
|
|
ae515ae773 | ||
|
|
70b13d82f8 | ||
|
|
752e22e224 | ||
|
|
710f7ced46 | ||
|
|
4a7e00e410 | ||
|
|
db338bb99d | ||
|
|
d0ebddb12b | ||
|
|
f2b526e7b7 | ||
|
|
d831220cce | ||
|
|
4fe41dbc6c | ||
|
|
cc5f0a4c34 | ||
|
|
0794f418e0 | ||
|
|
9e8bdfcecd | ||
|
|
d2c10c8037 | ||
|
|
27f20c1a43 | ||
|
|
7d0ecae692 | ||
|
|
755c47a864 | ||
|
|
24ee9ec6b3 | ||
|
|
2802474172 | ||
|
|
01828d2045 | ||
|
|
d195ed08b0 | ||
|
|
4e5c9f2567 | ||
|
|
f1b1d5c739 | ||
|
|
4629b20ef2 | ||
|
|
457d138343 | ||
|
|
06104f542f | ||
|
|
afa363b885 | ||
|
|
02d8b3cf93 | ||
|
|
648a9f7062 | ||
|
|
94e7934a7c | ||
|
|
4b8709fad2 | ||
|
|
4d20fcdd36 | ||
|
|
c32e0193f9 | ||
|
|
d824efd6ae | ||
|
|
599e5dc9ac | ||
|
|
d0714e9e8f | ||
|
|
ff79aee63d | ||
|
|
c6c5cd3f79 | ||
|
|
597b5ceee3 | ||
|
|
d1481d0a57 | ||
|
|
9008efba05 | ||
|
|
347d8a0701 | ||
|
|
f5d2bd22a0 | ||
|
|
97ae66848b | ||
|
|
eb1c0a07fa | ||
|
|
1b66d78bf9 | ||
|
|
e5b28e09eb | ||
|
|
23d07c0619 | ||
|
|
55cb6c2d15 | ||
|
|
01237ef071 | ||
|
|
b46b62066d | ||
|
|
5ebaa1a972 | ||
|
|
53ebca0ada | ||
|
|
dd3d14fc92 | ||
|
|
e2f24f9110 | ||
|
|
d8d28a1aca | ||
|
|
91cf81ac76 | ||
|
|
72a846d5f7 | ||
|
|
8f095e7993 | ||
|
|
315d79987b | ||
|
|
9a94d93555 | ||
|
|
b52391b4f9 | ||
|
|
d2954bb859 | ||
|
|
6c1fa5f43b | ||
|
|
71d50afa3c | ||
|
|
58125e5bc8 | ||
|
|
d918a3f529 | ||
|
|
066f67ad60 | ||
|
|
5091e8fa46 | ||
|
|
007786e204 | ||
|
|
7c487e936f | ||
|
|
ef63487a2f | ||
|
|
b262b2ebac | ||
|
|
0fb8b82ab9 | ||
|
|
4e104b574d | ||
|
|
d06d9aa60b | ||
|
|
1bd6bc4df3 | ||
|
|
a2a294f680 | ||
|
|
4e3b757cf6 | ||
|
|
ccdbe6ec15 | ||
|
|
eb996ddbe4 | ||
|
|
5b8f51aceb | ||
|
|
c3f1fc519e | ||
|
|
69a5d3926e | ||
|
|
3c1cc667e4 | ||
|
|
8b4fad8c28 | ||
|
|
4ec0d0e6da | ||
|
|
517a54d08d | ||
|
|
e746682e6c | ||
|
|
b49abca008 | ||
|
|
3fa828cefb | ||
|
|
759367a9ae | ||
|
|
74c05f78b2 | ||
|
|
28d09a9824 | ||
|
|
db6ec44c66 | ||
|
|
482e53ac38 | ||
|
|
159fb9cf02 | ||
|
|
a77b070f1f | ||
|
|
33e4c4b5d8 | ||
|
|
d9ef604b58 | ||
|
|
b4641cd695 | ||
|
|
145f6a3e5e | ||
|
|
3496afc256 | ||
|
|
c22443ac84 | ||
|
|
5ba0beae32 | ||
|
|
83cd8e6456 | ||
|
|
60fffcd3d2 | ||
|
|
884be01a59 | ||
|
|
d44e93b6ab | ||
|
|
85a1a1443b | ||
|
|
c39a3bdb4d | ||
|
|
53c11c3f06 | ||
|
|
383d9614cc | ||
|
|
d9e529c9ab | ||
|
|
8b348fde82 | ||
|
|
d66866cb81 | ||
|
|
617f7c4b28 | ||
|
|
3680709ec3 | ||
|
|
f75ddf52f6 | ||
|
|
c27602f6b0 | ||
|
|
c6cf4e537f | ||
|
|
fcae5638b0 | ||
|
|
f99534c4cd | ||
|
|
82ade18f84 | ||
|
|
649e70f8c2 | ||
|
|
6a3d4ed0d2 | ||
|
|
b9c815d95d | ||
|
|
6552dbddfd | ||
|
|
db1490c900 | ||
|
|
b71fcd74e5 | ||
|
|
97bfe71585 | ||
|
|
4644899c97 | ||
|
|
2664f53471 | ||
|
|
5eb2914aa3 | ||
|
|
399cc4436a | ||
|
|
d152dca01c | ||
|
|
143a26f35e | ||
|
|
7fe21f61b3 | ||
|
|
8f90066ac6 | ||
|
|
9f5235b721 | ||
|
|
f465535bd3 | ||
|
|
dedfda63a8 | ||
|
|
cf9590ffe4 | ||
|
|
3dfb694772 | ||
|
|
89cade32b5 | ||
|
|
cf89ee2aad | ||
|
|
9c997d001e | ||
|
|
13fbe725d7 | ||
|
|
a3b048edde | ||
|
|
3674796831 | ||
|
|
87b5b2f3bc | ||
|
|
9e27a0600f | ||
|
|
48ff57d761 | ||
|
|
f815d89480 | ||
|
|
c263fc7407 | ||
|
|
7d79df6ba3 | ||
|
|
73888689d1 | ||
|
|
9e9289abf4 | ||
|
|
5cda837a36 | ||
|
|
017ed08d72 | ||
|
|
2cfaf3344c | ||
|
|
a223c92109 | ||
|
|
5fd4d7758d | ||
|
|
9e51efde64 | ||
|
|
09e9589765 | ||
|
|
9d1a1467ca | ||
|
|
db1d1687a8 | ||
|
|
156fdf2c12 | ||
|
|
8e76d96f26 | ||
|
|
35420b9f00 | ||
|
|
1e29e26abb | ||
|
|
3161bc6176 | ||
|
|
277160d815 | ||
|
|
8c5929cf8c | ||
|
|
9d733aa61a | ||
|
|
484321eab0 | ||
|
|
fa8c3daa43 | ||
|
|
d9994fcbfd | ||
|
|
e921c77f03 | ||
|
|
aeb6d68638 | ||
|
|
0440ea91a4 | ||
|
|
36e87664f9 | ||
|
|
613202560d | ||
|
|
e2869df849 | ||
|
|
bc67735d62 | ||
|
|
b716a19064 | ||
|
|
97b6c0aed3 | ||
|
|
a5336f4274 | ||
|
|
48918f7684 | ||
|
|
45b2d1d208 | ||
|
|
d910733427 | ||
|
|
92fcc36593 | ||
|
|
0a7fcf82ba | ||
|
|
7353f8a7ca | ||
|
|
e1e882256b | ||
|
|
3b8bbb59de | ||
|
|
771b79e558 | ||
|
|
66d0dc7d4c | ||
|
|
b09bc8e859 | ||
|
|
e458281dcd | ||
|
|
631c4b8e8d | ||
|
|
d013fe518a | ||
|
|
ff639e7b46 | ||
|
|
809312ec13 | ||
|
|
6b7c165224 | ||
|
|
b12e82b9f7 | ||
|
|
62d6a2e88b | ||
|
|
9ed3fb24f2 | ||
|
|
9ce676d3a0 | ||
|
|
45a6668f46 | ||
|
|
77a434b978 | ||
|
|
d858df346d | ||
|
|
0fddbd3595 | ||
|
|
38769bd87b | ||
|
|
bacc0ccad7 | ||
|
|
b54a6b3914 | ||
|
|
c9e8b15348 | ||
|
|
e2c209ac81 | ||
|
|
7848b77612 | ||
|
|
af8cf5df1d | ||
|
|
2e9d97f0d0 | ||
|
|
38971f7b3b | ||
|
|
47b5765d41 | ||
|
|
a98d9c3170 | ||
|
|
be52fa0231 | ||
|
|
ef08fb66c7 | ||
|
|
09c9a02ce0 | ||
|
|
9d6d9c725f | ||
|
|
40ab1c573f | ||
|
|
f372e51f71 | ||
|
|
b7c2f75266 | ||
|
|
08a028941f | ||
|
|
8cef708e72 | ||
|
|
7d8cbb3518 | ||
|
|
d55e234c4a | ||
|
|
40a539005a | ||
|
|
8fad9bcb34 | ||
|
|
6c19159c4a | ||
|
|
b13a6128ee | ||
|
|
37b3a2f4b3 | ||
|
|
ce0e5ba58e | ||
|
|
458eddff62 | ||
|
|
9235860d54 | ||
|
|
40fe500021 | ||
|
|
27eda90958 | ||
|
|
6569e5419a | ||
|
|
25878fa9b9 | ||
|
|
402a708f85 | ||
|
|
dc8bb52e7c | ||
|
|
590e5852a6 | ||
|
|
dfc96da0ea | ||
|
|
78d2ac8ab3 | ||
|
|
5d9a926a81 | ||
|
|
92cf945243 | ||
|
|
3f50f7b4bd | ||
|
|
7bf76ac810 | ||
|
|
75bc44beef | ||
|
|
9e5b182c34 | ||
|
|
52acea980f | ||
|
|
b079f127ec | ||
|
|
6b39463f0a | ||
|
|
5d97446a31 | ||
|
|
22eb1cedde | ||
|
|
82b7cbdbc5 | ||
|
|
5960ab7208 | ||
|
|
7442407bcf | ||
|
|
d00f289c0a | ||
|
|
36a3562d9a | ||
|
|
6699b5fd8c | ||
|
|
4de8d06544 | ||
|
|
72022af430 | ||
|
|
ae0335374d | ||
|
|
66cc7e4054 | ||
|
|
4a44a3d8bf | ||
|
|
cddbc7e506 | ||
|
|
0b17da6883 | ||
|
|
646129e775 | ||
|
|
a759d4de35 | ||
|
|
8a78d800a5 | ||
|
|
d12d98ce79 | ||
|
|
8e3766b5ee | ||
|
|
a61ac101b5 | ||
|
|
b63ddc1f43 | ||
|
|
bcf2d322a5 | ||
|
|
c6daa641f6 | ||
|
|
f146e13b39 | ||
|
|
935c429cd4 | ||
|
|
f7c86594bd | ||
|
|
adefdb6597 | ||
|
|
c3a2013d1d | ||
|
|
f04dca3a45 | ||
|
|
59ebd47f67 | ||
|
|
61d9c52955 | ||
|
|
80613fbc9d | ||
|
|
f17ce0b81f | ||
|
|
27b1fb3a5c | ||
|
|
eed8b5e8b2 | ||
|
|
01f4589e19 | ||
|
|
724c4f0b1c | ||
|
|
03121ea7ad | ||
|
|
83a095c59d | ||
|
|
8f2982a0fc | ||
|
|
76f359f77d | ||
|
|
2edf179e19 | ||
|
|
7d749f5f04 | ||
|
|
28cfd71c2e | ||
|
|
39aadcdce8 | ||
|
|
5ed6336d3a | ||
|
|
90f2c853d5 | ||
|
|
4b5c0ddb4f | ||
|
|
a57036f6d1 | ||
|
|
0b030f0132 | ||
|
|
ffd4338e16 | ||
|
|
55dff30415 | ||
|
|
241de4aa41 | ||
|
|
ddde0886f2 | ||
|
|
c1ac2653d4 | ||
|
|
d2ec0f94fb | ||
|
|
068d7f33a2 | ||
|
|
d83cb75da4 | ||
|
|
b16786312f | ||
|
|
073340dfb5 | ||
|
|
f98671bd95 | ||
|
|
b35ad8de71 | ||
|
|
e37a5ad975 | ||
|
|
588c364163 | ||
|
|
ead9a2cd86 | ||
|
|
b7471604ad | ||
|
|
b2b3575c62 | ||
|
|
26e92c51fb | ||
|
|
754af91d1e | ||
|
|
f4d85a5e42 | ||
|
|
8e827f2c3d | ||
|
|
1e94936205 | ||
|
|
fcf854f3fb | ||
|
|
00e0aea5b9 | ||
|
|
6d2809cff7 | ||
|
|
dc851bd391 | ||
|
|
8a19de674d | ||
|
|
8cd001c6d3 | ||
|
|
435f63ae2d | ||
|
|
0ea685f0ff | ||
|
|
332d41992c | ||
|
|
3439bdffe5 | ||
|
|
d0c1d62f22 | ||
|
|
93d612ca18 | ||
|
|
a700105e62 | ||
|
|
b7b09a9cda | ||
|
|
cb437197c7 | ||
|
|
7bcb4e7dee | ||
|
|
265f3c2b4e | ||
|
|
e0e9826a99 | ||
|
|
4c2cab81d4 | ||
|
|
a3cb4cf7f7 | ||
|
|
88c4593ef3 | ||
|
|
0d341f44bc | ||
|
|
e2a212f125 | ||
|
|
5369e4ec6b | ||
|
|
dd0e1e10de | ||
|
|
e2881f4bce | ||
|
|
a66f1c4948 | ||
|
|
3d3f1539df | ||
|
|
631ed0f32c | ||
|
|
b18dc2a33d | ||
|
|
daf1c5a569 | ||
|
|
c651b5f0d9 | ||
|
|
889e9b17f1 | ||
|
|
eefb35c30b | ||
|
|
e8f607a7c8 | ||
|
|
9e18ba9e29 | ||
|
|
2e4f7c5581 | ||
|
|
bf61ec442b | ||
|
|
f2577ed869 | ||
|
|
d80355bf3f | ||
|
|
c9035299fb | ||
|
|
2732c31c3c | ||
|
|
dea3b3b487 | ||
|
|
7dd80816fe | ||
|
|
ce5128a867 | ||
|
|
ecd61ce212 | ||
|
|
0667c25b9b | ||
|
|
dca56cb52f | ||
|
|
9aadec932f | ||
|
|
1be86d5dbb | ||
|
|
3683ad2678 | ||
|
|
d0201c5841 | ||
|
|
04c188d47b | ||
|
|
559ac3a465 | ||
|
|
1b5ebbef8c | ||
|
|
9ce532f61f | ||
|
|
1db974fb26 | ||
|
|
170a3dbcb0 | ||
|
|
a7a1a58255 | ||
|
|
264b6e6385 | ||
|
|
ca3b98a847 | ||
|
|
94ef29da3d | ||
|
|
6dea66dce7 | ||
|
|
c1a896e3ff | ||
|
|
565f0f5627 | ||
|
|
e89264c5f4 | ||
|
|
8c89149340 | ||
|
|
0e3f6ac81d | ||
|
|
b1254a666d | ||
|
|
6d275fd1c4 | ||
|
|
a96b5eda74 | ||
|
|
7ac850daec | ||
|
|
02f5a75578 | ||
|
|
b74f1af584 | ||
|
|
738244628c | ||
|
|
1738aa80e8 | ||
|
|
85cd3d3c0b | ||
|
|
41152a9c5f | ||
|
|
ad3345e890 | ||
|
|
1b7ffac81e | ||
|
|
16f5396859 | ||
|
|
b5e601490b | ||
|
|
ff48e00a16 | ||
|
|
c77f3912bb | ||
|
|
5a2a453de7 | ||
|
|
7be8a1b9d1 | ||
|
|
ca482e9c5a | ||
|
|
2461ee9929 | ||
|
|
c9e52d0732 | ||
|
|
3a3afedb60 | ||
|
|
5d840e45a0 | ||
|
|
d7cc410a5e | ||
|
|
89a5e82fbb | ||
|
|
164586919b | ||
|
|
041463fe11 | ||
|
|
08fdd920cc | ||
|
|
c006d1c416 | ||
|
|
4b82de00d7 | ||
|
|
83273f7f9c | ||
|
|
92c68a6146 | ||
|
|
053524d986 | ||
|
|
501c535149 | ||
|
|
8d8974e8e8 | ||
|
|
e5c38e97b7 | ||
|
|
92e00caae7 | ||
|
|
ce4044abcb | ||
|
|
ae8c14aab4 | ||
|
|
e57969db76 | ||
|
|
3f50b2bb9a | ||
|
|
065e4d5da4 | ||
|
|
f2b6c1776e | ||
|
|
5109d8f697 | ||
|
|
15ea81dc01 | ||
|
|
45f71a02e5 | ||
|
|
b34734cf63 | ||
|
|
74f26b623f | ||
|
|
d526d71e62 | ||
|
|
3a7f82eb9a | ||
|
|
7b8029c8e8 | ||
|
|
894778f73d | ||
|
|
f598b5c4d0 | ||
|
|
5f409af394 | ||
|
|
8126b9fdf7 | ||
|
|
2af13e22b3 | ||
|
|
0bed84aada | ||
|
|
fbf0c1e3c9 | ||
|
|
698a96f7b8 | ||
|
|
e1f1a06181 | ||
|
|
a4c76742a3 | ||
|
|
e06f5d4ff7 | ||
|
|
68477a75d9 | ||
|
|
7498b2ddf2 | ||
|
|
9b73a1ab47 | ||
|
|
d8dd266266 | ||
|
|
0ce98ce375 | ||
|
|
7e230d7abe | ||
|
|
55a3baae3c | ||
|
|
f246d12e2f | ||
|
|
6fe86bb52f | ||
|
|
4a0fc811ef | ||
|
|
844cbc7438 | ||
|
|
fbedbfc3c2 | ||
|
|
fc452184dd | ||
|
|
993cdf2925 | ||
|
|
cba6b87cbc | ||
|
|
1f404e237c | ||
|
|
75f9a949af | ||
|
|
66bf694b4a | ||
|
|
89d2ac953b | ||
|
|
c19d8acb74 | ||
|
|
f74ad28861 | ||
|
|
9650825431 | ||
|
|
751ae1eede | ||
|
|
1c7f174701 | ||
|
|
5a07b43946 | ||
|
|
32118589f8 | ||
|
|
73b5a49ca4 | ||
|
|
964b7455f3 | ||
|
|
703621199c | ||
|
|
bf5465067f | ||
|
|
1ecb766d6d | ||
|
|
19bc33c5a9 | ||
|
|
8c70c8de19 | ||
|
|
1c0e0ac6d5 |
No files matched your search
@@ -12,7 +12,7 @@ jobs:
|
||||
matrix:
|
||||
# Use these Java versions
|
||||
java: [
|
||||
17 # Minimum supported by Minecraft
|
||||
21
|
||||
]
|
||||
# and run on both Linux and Windows
|
||||
os: [ubuntu-20.04, windows-latest]
|
||||
@@ -32,8 +32,8 @@ jobs:
|
||||
- name: build
|
||||
run: ./gradlew build
|
||||
- name: capture build artifacts
|
||||
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS
|
||||
if: ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only upload artifacts built from latest java on one OS
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Artifacts
|
||||
path: build/dev/libs
|
||||
path: build/${{ github.ref_name }}/libs
|
||||
+61
@@ -1,3 +1,63 @@
|
||||
### Linux ###
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
### macOS ###
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
### Windows ###
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
# gradle
|
||||
|
||||
.gradle
|
||||
@@ -33,3 +93,4 @@ bin/
|
||||
# fabric
|
||||
|
||||
run/
|
||||
.nexuspath
|
||||
@@ -1,121 +1,674 @@
|
||||
Creative Commons Legal Code
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
CC0 1.0 Universal
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||
HEREUNDER.
|
||||
Preamble
|
||||
|
||||
Statement of Purpose
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer
|
||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||
authorship and/or a database (each, a "Work").
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for
|
||||
the purpose of contributing to a commons of creative, cultural and
|
||||
scientific works ("Commons") that the public can reliably and without fear
|
||||
of later claims of infringement build upon, modify, incorporate in other
|
||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||
and for any purposes, including without limitation commercial purposes.
|
||||
These owners may contribute to the Commons to promote the ideal of a free
|
||||
culture and the further production of creative, cultural and scientific
|
||||
works, or to gain reputation or greater distribution for their Work in
|
||||
part through the use and efforts of others.
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
For these and/or other purposes and motivations, and without any
|
||||
expectation of additional consideration or compensation, the person
|
||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||
protected by copyright and related or neighboring rights ("Copyright and
|
||||
Related Rights"). Copyright and Related Rights include, but are not
|
||||
limited to, the following:
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
i. the right to reproduce, adapt, distribute, perform, display,
|
||||
communicate, and translate a Work;
|
||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||
iii. publicity and privacy rights pertaining to a person's image or
|
||||
likeness depicted in a Work;
|
||||
iv. rights protecting against unfair competition in regards to a Work,
|
||||
subject to the limitations in paragraph 4(a), below;
|
||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||
in a Work;
|
||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||
European Parliament and of the Council of 11 March 1996 on the legal
|
||||
protection of databases, and under any national implementation
|
||||
thereof, including any amended or successor version of such
|
||||
directive); and
|
||||
vii. other similar, equivalent or corresponding rights throughout the
|
||||
world based on applicable law or treaty, and any national
|
||||
implementations thereof.
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||
of action, whether now known or unknown (including existing as well as
|
||||
future claims and causes of action), in the Work (i) in all territories
|
||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||
treaty (including future time extensions), (iii) in any current or future
|
||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||
including without limitation commercial, advertising or promotional
|
||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||
member of the public at large and to the detriment of Affirmer's heirs and
|
||||
successors, fully intending that such Waiver shall not be subject to
|
||||
revocation, rescission, cancellation, termination, or any other legal or
|
||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||
as contemplated by Affirmer's express Statement of Purpose.
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||
be judged legally invalid or ineffective under applicable law, then the
|
||||
Waiver shall be preserved to the maximum extent permitted taking into
|
||||
account Affirmer's express Statement of Purpose. In addition, to the
|
||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||
maximum duration provided by applicable law or treaty (including future
|
||||
time extensions), (iii) in any current or future medium and for any number
|
||||
of copies, and (iv) for any purpose whatsoever, including without
|
||||
limitation commercial, advertising or promotional purposes (the
|
||||
"License"). The License shall be deemed effective as of the date CC0 was
|
||||
applied by Affirmer to the Work. Should any part of the License for any
|
||||
reason be judged legally invalid or ineffective under applicable law, such
|
||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||
of the License, and in such case Affirmer hereby affirms that he or she
|
||||
will not (i) exercise any of his or her remaining Copyright and Related
|
||||
Rights in the Work or (ii) assert any associated claims and causes of
|
||||
action with respect to the Work, in either case contrary to Affirmer's
|
||||
express Statement of Purpose.
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
4. Limitations and Disclaimers.
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||
surrendered, licensed or otherwise affected by this document.
|
||||
b. Affirmer offers the Work as-is and makes no representations or
|
||||
warranties of any kind concerning the Work, express, implied,
|
||||
statutory or otherwise, including without limitation warranties of
|
||||
title, merchantability, fitness for a particular purpose, non
|
||||
infringement, or the absence of latent or other defects, accuracy, or
|
||||
the present or absence of errors, whether or not discoverable, all to
|
||||
the greatest extent permissible under applicable law.
|
||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||
that may apply to the Work or any use thereof, including without
|
||||
limitation any person's Copyright and Related Rights in the Work.
|
||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||
consents, permissions or other rights required for any use of the
|
||||
Work.
|
||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||
party to this document and has no duty or obligation with respect to
|
||||
this CC0 or use of the Work.
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -1,11 +1,22 @@
|
||||
# Nexia DEV
|
||||
<div align="center">
|
||||
|
||||
Last Sync with [Main](https://github.com/nexia-cts/Nexia-Mod/tree/main):
|
||||
<img src="https://notcoded.needs.rest/r/nexia.png" height=150 alt="Nexia Logo"/>
|
||||
<br>
|
||||
|
||||
[92e00caae78cb985bb7ae4297d7f7d04971b26a2](https://github.com/nexia-cts/Nexia-Mod/commit/92e00caae78cb985bb7ae4297d7f7d04971b26a2)
|
||||
# Nexia
|
||||
using **Nexus API**
|
||||
|
||||
*(may be 1 commit forward)*
|
||||
The mod for the Nexia CTS server.
|
||||
|
||||
</div>
|
||||
|
||||
### Requirements
|
||||
- Java 17
|
||||
- Gradle 7.3
|
||||
|
||||
- Java 21
|
||||
- Gradle 8.7
|
||||
|
||||
### Build
|
||||
- Clone the repository
|
||||
- `git clone https://github.com/nexia-cts/Nexia-Mod`
|
||||
- `git checkout 'main/dev'`
|
||||
- Run `./gradlew build`
|
||||
+55
-79
@@ -1,13 +1,9 @@
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
plugins {
|
||||
id 'fabric-loom' version '0.13-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
id 'fabric-loom' version '1.6-SNAPSHOT'
|
||||
}
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
|
||||
String getGitCommit() {
|
||||
ByteArrayOutputStream stdout = new ByteArrayOutputStream();
|
||||
exec {
|
||||
@@ -17,80 +13,90 @@ String getGitCommit() {
|
||||
return stdout.toString().trim()
|
||||
}
|
||||
|
||||
archivesBaseName = project.archives_base_name
|
||||
version = project.mod_version + "." + getGitCommit()
|
||||
String getGitBranch() {
|
||||
ByteArrayOutputStream stdout = new ByteArrayOutputStream();
|
||||
exec {
|
||||
commandLine("git", "rev-parse", "--abbrev-ref", "HEAD")
|
||||
standardOutput = stdout
|
||||
}
|
||||
return stdout.toString().trim()
|
||||
}
|
||||
|
||||
version = project.mod_version + "+" + getGitBranch() + "." + getGitCommit()
|
||||
group = project.maven_group
|
||||
|
||||
// Set Build Dir to dev to differentiate with main
|
||||
buildDir = new File(buildDir, "dev")
|
||||
// Set Build Dir to main to differentiate
|
||||
buildDir = new File(buildDir, getGitBranch())
|
||||
if(new File(buildDir, "libs").exists()) FileUtils.cleanDirectory(buildDir.toPath().resolve("libs").toFile())
|
||||
|
||||
base {
|
||||
archivesName = project.archives_base_name
|
||||
}
|
||||
|
||||
// Repo for CT intermediary mappings
|
||||
repositories {
|
||||
flatDir { dirs("libraries") }
|
||||
|
||||
maven { url 'https://github.com/not-coded/notcoded-maven/raw/fabric/' }
|
||||
maven { url 'https://maven.nucleoid.xyz' }
|
||||
maven { url "https://maven.rizecookey.net/" }
|
||||
//maven { url "https://maven.rizecookey.net/" }
|
||||
maven { url "https://maven.shedaniel.me/" }
|
||||
maven { url "https://maven.gegy.dev/" }
|
||||
maven { url "https://jitpack.io" }
|
||||
maven { url "https://maven.terraformersmc.com/releases/" }
|
||||
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
|
||||
maven { url 'https://github.com/ricksouth/serilum-forge-maven/raw/maven/' }
|
||||
maven { url 'https://repo.minebench.de/' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
//to change the versions see the gradle.properties file
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
mappings loom.officialMojangMappings()
|
||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
|
||||
modImplementation('com.combatreforged.factory:factory-api:0.1.13-full')
|
||||
modImplementation('com.combatreforged.factory:factory-builder:0.1.13-1.16_combat-6')
|
||||
|
||||
implementation("com.combatreforged.factory:factory-api:0.1.13:javadoc@jar") {
|
||||
exclude(group: "com.google.code.gson")
|
||||
exclude(group: "org.apache.logging.log4j")
|
||||
}
|
||||
|
||||
implementation("org.apache.logging.log4j:log4j-core:2.20.0")
|
||||
include(implementation("com.google.code.gson:gson:2.10.1"))
|
||||
|
||||
include(implementation(annotationProcessor("com.github.llamalad7.mixinextras:mixinextras-fabric:${project.mixin_extras_version}")))
|
||||
// Important!
|
||||
modImplementation("com.nexia.nexus:nexus-api:${project.nexus_version}-full")
|
||||
modImplementation("com.nexia.nexus:nexus-builder:${project.nexus_version}-${project.minecraft_version}-full")
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:${project.mixin_extras_version}")))
|
||||
|
||||
//include(modApi("eu.pb4:hologram-api:0.1.0") { exclude(group: "net.fabricmc.fabric-api") })
|
||||
//include(modApi("eu.pb4:sidebar-api:0.0.2") { exclude(group: "net.fabricmc.fabric-api") })
|
||||
// MongoDB
|
||||
include(implementation("org.mongodb:mongodb-driver-sync:${project.mongodb_version}"))
|
||||
include(implementation("org.mongodb:mongodb-driver-core:${project.mongodb_version}"))
|
||||
include(implementation("org.mongodb:bson:${project.mongodb_version}"))
|
||||
|
||||
modApi('com.natamus.collective:collective-fabric:1.16.5-5.50')
|
||||
modApi('xyz.nucleoid:fantasy:0.4.0') {exclude(group: "net.fabricmc.fabric-api") }
|
||||
// Will be replaced by Nexus
|
||||
include(modApi("eu.pb4:sgui:${project.sgui_version}") { exclude(group: "net.fabricmc.fabric-api") })
|
||||
modApi("xyz.nucleoid:fantasy:${project.fantasy_version}") {exclude(group: "net.fabricmc.fabric-api") }
|
||||
include(modApi("io.github.blumbo:inventory-merger:${project.inventory_merger_version}"))
|
||||
|
||||
include(modApi('eu.pb4:sgui:0.5.0') { exclude(group: "net.fabricmc.fabric-api") })
|
||||
include(modApi('me.sargunvohra.mcmods:autoconfig1u:3.3.1') { exclude(group: "net.fabricmc.fabric-api") })
|
||||
//include(modApi("xyz.nucleoid:plasmid:${project.plasmid_version}"))
|
||||
|
||||
|
||||
include(implementation("com.googlecode.json-simple:json-simple:1.1.1"))
|
||||
|
||||
modApi('me.lucko:fabric-permissions-api:0.2-SNAPSHOT')
|
||||
|
||||
include(modApi('net.blumbo:blfscheduler:1.0.0-1.16_combat-6'))
|
||||
//include(modApi('io.github.blumbo:inventory-merger:1.3.1-1.16_combat-6'))
|
||||
// Should probably be removed/replaced
|
||||
include(modApi("me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig1u_version}") { exclude(group: "net.fabricmc.fabric-api") })
|
||||
modApi("com.natamus.collective:collective-fabric:${project.collective_version}")
|
||||
|
||||
// somewhat useful stuff
|
||||
modApi("me.lucko:fabric-permissions-api:${project.fabric_permissions_api_version}")
|
||||
include(implementation("net.kyori:adventure-text-minimessage:${project.adventure_version}"))
|
||||
include(implementation("net.kyori:adventure-text-serializer-gson:${project.adventure_version}"))
|
||||
include(compileOnly("de.themoep:minedown-adventure:${project.minedown_adventure_version}"))
|
||||
compileOnly("net.luckperms:api:${project.luckperms_api_version}")
|
||||
|
||||
// discord shit
|
||||
include(api("net.dv8tion:JDA:${project.jda_version}"))
|
||||
include(api('club.minnced:discord-webhooks:0.8.2') { exclude(group: "org.json") })
|
||||
include(api('org.json:json:20230227'))
|
||||
include(api("club.minnced:discord-webhooks:${project.discord_webhooks_version}") { exclude(group: "org.json") })
|
||||
include(api("org.json:json:${project.json_version}"))
|
||||
|
||||
// useless libraries
|
||||
include(implementation("com.google.code.gson:gson:${project.gson_version}"))
|
||||
include(implementation("com.googlecode.json-simple:json-simple:${project.json_simple_version}"))
|
||||
|
||||
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
|
||||
// You may need to force-disable transitiveness on them.
|
||||
}
|
||||
|
||||
// Custom Manifest and Intermediary mappings declaration
|
||||
loom {
|
||||
accessWidenerPath = file("src/main/resources/nexia.accesswidener")
|
||||
customMinecraftManifest = "https://gist.githubusercontent.com/rizecookey/4c6142baaccc3875f9b227fe22f2ace5/raw/c8ed74b19f7a5315813c9d4b199798b692a8f359/1.16_combat-6.json"
|
||||
|
||||
intermediaryUrl = "https://maven.rizecookey.net/net/fabricmc/intermediary/%1\$s/intermediary-%1\$s-v2.jar"
|
||||
}
|
||||
|
||||
@@ -106,53 +112,23 @@ processResources {
|
||||
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
||||
// this fixes some edge cases with special characters not displaying correctly
|
||||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
||||
def targetJavaVersion = 17
|
||||
def targetJavaVersion = 21
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
it.options.encoding = "UTF-8"
|
||||
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
|
||||
it.options.release = targetJavaVersion
|
||||
}
|
||||
}
|
||||
|
||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||
// if it is present.
|
||||
// If you remove this task, sources will not be generated.
|
||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
classifier = "sources"
|
||||
from sourceSets.main.allSource
|
||||
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
|
||||
it.options.release = targetJavaVersion
|
||||
}
|
||||
|
||||
java {
|
||||
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
|
||||
if (JavaVersion.current() < javaVersion) {
|
||||
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
|
||||
}
|
||||
archivesBaseName = project.archives_base_name
|
||||
withSourcesJar()
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
|
||||
jar {
|
||||
from("LICENSE") {
|
||||
rename { "${it}_${project.archivesBaseName}" }
|
||||
}
|
||||
}
|
||||
|
||||
// configure the maven publication
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
// add all the jars that should be included when publishing to maven
|
||||
artifact(remapJar) {
|
||||
builtBy remapJar
|
||||
}
|
||||
artifact(sourcesJar) {
|
||||
builtBy remapSourcesJar
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// select the repositories you want to publish to
|
||||
repositories {
|
||||
// uncomment to publish to the local maven
|
||||
// mavenLocal()
|
||||
}
|
||||
}
|
||||
+31
-12
@@ -1,21 +1,40 @@
|
||||
# Done to increase the memory available to gradle.
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
org.gradle.parallel=true
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/use
|
||||
minecraft_version=1.16_combat-6
|
||||
yarn_mappings=1.16_combat-6+build.2
|
||||
loader_version=0.14.21
|
||||
# 0.9.3+build.207
|
||||
# check these on https://fabricmc.net/use
|
||||
minecraft_version=1.16_combat-6
|
||||
yarn_mappings=1.16_combat-6+build.2
|
||||
loader_version=0.14.21
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.0.0+dev
|
||||
maven_group = com.nexia
|
||||
archives_base_name = nexia
|
||||
mod_version = 2.0.0
|
||||
maven_group = com.nexia
|
||||
archives_base_name = nexia
|
||||
|
||||
# Dependencies
|
||||
fabric_version= 0.25.0+build.415-1.16
|
||||
plasmid_version=0.4.0
|
||||
jda_version=5.0.0-beta.12
|
||||
mixin_extras_version=0.2.0-beta.9
|
||||
fabric_version=0.42.0+1.16
|
||||
mongodb_version=5.1.2
|
||||
jda_version=5.0.0-beta.20
|
||||
mixin_extras_version=0.4.0
|
||||
nexus_version=0.1.15
|
||||
collective_version=1.16.5-5.50
|
||||
fantasy_version=0.4.3
|
||||
sgui_version=0.5.0
|
||||
autoconfig1u_version=3.3.1
|
||||
fabric_permissions_api_version=0.2-SNAPSHOT
|
||||
inventory_merger_version=1.3.1-1.16_combat-6
|
||||
luckperms_api_version=5.4
|
||||
adventure_version=4.1.0-SNAPSHOT
|
||||
minedown_adventure_version=1.7.3-SNAPSHOT
|
||||
|
||||
# Useless dependencies
|
||||
json_simple_version=1.1.1
|
||||
discord_webhooks_version=0.8.4
|
||||
json_version=20230227
|
||||
gson_version=2.10.1
|
||||
|
||||
|
||||
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -17,78 +17,113 @@
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
@@ -97,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
@@ -105,79 +140,95 @@ location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+4
-18
@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -54,7 +54,7 @@ goto fail
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
@@ -64,28 +64,14 @@ echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,259 @@
|
||||
package com.nexia.base.player;
|
||||
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.games.util.LobbyUtil;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.item.ItemStackUtil;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.pos.EntityPos;
|
||||
import com.nexia.core.utilities.ranks.NexiaRank;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import com.nexia.ffa.FfaUtil;
|
||||
import com.nexia.minigames.games.bedwars.players.BwPlayerEvents;
|
||||
import com.nexia.minigames.games.bedwars.util.BwScoreboard;
|
||||
import com.nexia.minigames.games.bedwars.util.BwUtil;
|
||||
import com.nexia.minigames.games.duels.DuelGameHandler;
|
||||
import com.nexia.minigames.games.football.FootballGame;
|
||||
import com.nexia.minigames.games.oitc.OitcGame;
|
||||
import com.nexia.minigames.games.skywars.SkywarsGame;
|
||||
import com.nexia.nexus.api.world.effect.StatusEffectInstance;
|
||||
import com.nexia.nexus.api.world.entity.player.Player;
|
||||
import com.nexia.nexus.api.world.item.ItemStack;
|
||||
import com.nexia.nexus.api.world.types.Minecraft;
|
||||
import com.nexia.nexus.builder.implementation.world.entity.player.WrappedPlayer;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundSoundPacket;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.item.Item;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class NexiaPlayer extends WrappedPlayer {
|
||||
|
||||
public NexiaPlayer(ServerPlayer wrappedPlayer) {
|
||||
super(wrappedPlayer);
|
||||
}
|
||||
|
||||
public NexiaPlayer(Player player) {
|
||||
super(PlayerUtil.getMinecraftPlayer(player.getUUID()));
|
||||
}
|
||||
|
||||
public void reset(boolean heal, Minecraft.GameMode gameMode) {
|
||||
this.setInvulnerabilityTime(0);
|
||||
this.clearEffects();
|
||||
this.unwrap().setAbsorptionAmount(0);
|
||||
this.getInventory().clear();
|
||||
this.setRemainingFireTicks(0);
|
||||
this.setExperienceLevel(0);
|
||||
this.setExperiencePoints(0);
|
||||
this.getInventory().setCursorStack(ItemStack.create(Minecraft.Item.AIR));
|
||||
|
||||
this.unwrap().getEnderChestInventory().clearContent();
|
||||
this.setGlowing(false);
|
||||
this.stopAllSounds();
|
||||
|
||||
this.setGameMode(gameMode);
|
||||
|
||||
if (heal) {
|
||||
this.setHealth(this.getMaxHealth());
|
||||
this.setFoodLevel(20);
|
||||
}
|
||||
|
||||
this.setAbleToFly(false);
|
||||
this.unwrap().onUpdateAbilities();
|
||||
|
||||
ServerTime.minecraftServer.getPlayerList().sendPlayerPermissionLevel(this.unwrap());
|
||||
}
|
||||
|
||||
public PlayerGameMode getCurrentGameMode() {
|
||||
return ((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(this)).gameMode;
|
||||
}
|
||||
|
||||
public NexiaPlayer refreshPlayer() {
|
||||
return new NexiaPlayer(PlayerUtil.getMinecraftPlayer(this.getUUID()));
|
||||
}
|
||||
|
||||
public boolean isInGameMode(PlayerGameMode gameMode) {
|
||||
return this.getCurrentGameMode().equals(gameMode);
|
||||
}
|
||||
|
||||
public void safeReset(boolean heal, Minecraft.GameMode gameMode) {
|
||||
this.setGameMode(gameMode);
|
||||
|
||||
this.setInvulnerabilityTime(0);
|
||||
this.clearEffects();
|
||||
this.unwrap().setAbsorptionAmount(0);
|
||||
this.setRemainingFireTicks(0);
|
||||
this.setGlowing(false);
|
||||
|
||||
if (heal) {
|
||||
this.setHealth(this.getMaxHealth());
|
||||
this.setFoodLevel(20);
|
||||
}
|
||||
|
||||
this.setAbleToFly(false);
|
||||
this.unwrap().onUpdateAbilities();
|
||||
|
||||
ServerTime.minecraftServer.getPlayerList().sendPlayerPermissionLevel(this.unwrap());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a parsed <a href="https://docs.advntr.dev/minimessage/index.html">MiniMessage</a> message to the player.
|
||||
* @param message The message that's going to get parsed
|
||||
* @apiNote Check out the <a href="https://docs.advntr.dev/minimessage/format.html">MiniMessage docs</a>.
|
||||
*/
|
||||
|
||||
public void sendMiniMessage(String message, Object... args) {
|
||||
this.sendMessage(MiniMessage.get().parse(String.format(message, args)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a message with the prefix <code>Nexia » </code> to the player.
|
||||
* @apiNote The message is going to get sent in white ({@link ChatFormat.Minecraft}).
|
||||
*/
|
||||
|
||||
public void sendNexiaMessage(String message, Object... args) {
|
||||
this.sendMessage(ChatFormat.nexiaMessage.append(Component.text(String.format(message, args), ChatFormat.Minecraft.white)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a Component with the prefix <code>Nexia » </code> to the player.
|
||||
*/
|
||||
|
||||
public void sendNexiaMessage(Component component) {
|
||||
this.sendMessage(ChatFormat.nexiaMessage.append(component));
|
||||
}
|
||||
|
||||
public boolean hasPermission(@NotNull String permission) {
|
||||
return Permissions.check(this.unwrap(), permission);
|
||||
}
|
||||
|
||||
|
||||
public boolean hasPermission(@NotNull String permission, int defaultRequiredLevel) {
|
||||
return Permissions.check(this.unwrap(), permission, defaultRequiredLevel);
|
||||
}
|
||||
|
||||
public boolean hasEffect(Minecraft.Effect effect) {
|
||||
for(StatusEffectInstance effectInstance : this.getActiveEffects()) {
|
||||
if(effectInstance.getStatusEffect().getType().equals(effect.getType())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void leaveAllGames() {
|
||||
if (BwUtil.isInBedWars(this)) {
|
||||
BwPlayerEvents.leaveInBedWars(this);
|
||||
} else if (FfaUtil.isFfaPlayer(this)) {
|
||||
FfaUtil.leaveOrDie(this, this.unwrap().getLastDamageSource(), true);
|
||||
} else if (this.isInGameMode(PlayerGameMode.LOBBY)) {
|
||||
DuelGameHandler.leave(this, false);
|
||||
} else if (this.isInGameMode(PlayerGameMode.OITC)) {
|
||||
OitcGame.leave(this);
|
||||
} else if (this.isInGameMode(PlayerGameMode.SKYWARS)) {
|
||||
SkywarsGame.leave(this);
|
||||
} else if (this.isInGameMode(PlayerGameMode.FOOTBALL)) {
|
||||
FootballGame.leave(this);
|
||||
}
|
||||
|
||||
// sometimes those do not get removed
|
||||
PlayerUtil.sendBossbar(SkywarsGame.BOSSBAR, this, true);
|
||||
BwScoreboard.removeScoreboardFor(this);
|
||||
|
||||
for (String tag : LobbyUtil.removedTags) {
|
||||
if (this.hasTag(tag)) this.removeTag(tag);
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshInventory() {
|
||||
NonNullList<net.minecraft.world.item.ItemStack> i = NonNullList.create();
|
||||
for (int j = 0; j < this.unwrap().containerMenu.slots.size(); ++j) {
|
||||
net.minecraft.world.item.ItemStack itemStack = this.unwrap().containerMenu.slots.get(j).getItem();
|
||||
i.add(itemStack.isEmpty() ? net.minecraft.world.item.ItemStack.EMPTY : itemStack);
|
||||
}
|
||||
this.unwrap().refreshContainer(this.unwrap().containerMenu, i);
|
||||
}
|
||||
|
||||
public void sendHandItemPacket(InteractionHand hand) {
|
||||
if (hand == InteractionHand.MAIN_HAND) {
|
||||
sendInvSlotPacket(this.unwrap().inventory.selected);
|
||||
} else if (hand == InteractionHand.OFF_HAND) {
|
||||
sendInvSlotPacket(40);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendHandItemPacket() {
|
||||
this.sendHandItemPacket(this.unwrap().getUsedItemHand());
|
||||
}
|
||||
|
||||
public void sendInvSlotPacket(int slot) {
|
||||
int packetSlot;
|
||||
|
||||
if (slot < 9) {
|
||||
packetSlot = 36 + slot;
|
||||
} else if (slot < 36) {
|
||||
packetSlot = slot;
|
||||
} else if (slot < 40) {
|
||||
packetSlot = 44 - slot;
|
||||
} else if (slot == 40) {
|
||||
packetSlot = 45;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
this.unwrap().connection.send(new ClientboundContainerSetSlotPacket(0, packetSlot, this.unwrap().inventory.getItem(slot)));
|
||||
}
|
||||
|
||||
public boolean hasRank(NexiaRank rank) {
|
||||
return this.hasPermission(rank.groupID);
|
||||
}
|
||||
|
||||
public boolean hasPrefix(NexiaRank rank) {
|
||||
return this.hasPermission("nexia.prefix." + rank.id);
|
||||
}
|
||||
|
||||
public void removeItem(Item item, int count) {
|
||||
for (net.minecraft.world.item.ItemStack itemStack : ItemStackUtil.getInvItems(this.unwrap())) {
|
||||
if (itemStack.getItem() != item) continue;
|
||||
|
||||
if (itemStack.getCount() >= count) {
|
||||
itemStack.shrink(count);
|
||||
break;
|
||||
} else {
|
||||
count -= itemStack.getCount();
|
||||
itemStack.shrink(itemStack.getCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void sendSound(SoundEvent soundEvent, SoundSource soundSource, float volume, float pitch) {
|
||||
sendSound(new EntityPos(this), soundEvent, soundSource, volume, pitch);
|
||||
}
|
||||
|
||||
public void sendSound(EntityPos position, SoundEvent soundEvent, SoundSource soundSource, float volume, float pitch) {
|
||||
this.unwrap().connection.send(new ClientboundSoundPacket(soundEvent, soundSource,
|
||||
position.x, position.y, position.z, 16f * volume, pitch));
|
||||
}
|
||||
|
||||
public boolean setBedrockBridging(boolean allowed) {
|
||||
if (ServerPlayNetworking.canSend(this.unwrap(), NexiaCore.CONVENTIONAL_BRIDGING_UPDATE_ID)) {
|
||||
FriendlyByteBuf buf = PacketByteBufs.create();
|
||||
buf.writeBoolean(allowed);
|
||||
ServerPlayNetworking.send(this.unwrap(), NexiaCore.CONVENTIONAL_BRIDGING_UPDATE_ID, buf);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
package com.nexia.discord.utilities.player;
|
||||
package com.nexia.base.player;
|
||||
|
||||
public class PlayerData {
|
||||
|
||||
// Stuff saved into files
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.nexia.base.player;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.mongodb.client.model.Filters;
|
||||
import com.mongodb.client.result.UpdateResult;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import com.nexia.core.utilities.player.CoreSavedPlayerData;
|
||||
import com.nexia.discord.utilities.player.DiscordSavedPlayerData;
|
||||
import com.nexia.ffa.base.player.FFASavedPlayerData;
|
||||
import com.nexia.ffa.kits.utilities.player.KitFFAPlayerData;
|
||||
import com.nexia.minigames.games.base.player.WLKSavedPlayerData;
|
||||
import com.nexia.minigames.games.bedwars.util.player.BedwarsPlayerData;
|
||||
import com.nexia.minigames.games.bedwars.util.player.BedwarsSavedPlayerData;
|
||||
import com.nexia.minigames.games.duels.util.player.DuelsPlayerData;
|
||||
import com.nexia.minigames.games.duels.util.player.DuelsSavedPlayerData;
|
||||
import com.nexia.minigames.games.football.util.player.FootballPlayerData;
|
||||
import com.nexia.minigames.games.football.util.player.FootballSavedPlayerData;
|
||||
import com.nexia.minigames.games.oitc.util.player.OITCPlayerData;
|
||||
import com.nexia.minigames.games.skywars.util.player.SkywarsPlayerData;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.bson.Document;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlayerDataManager {
|
||||
public static Map<ResourceLocation, PlayerDataManager> dataManagerMap = new HashMap<>();
|
||||
|
||||
private final String collectionName;
|
||||
|
||||
HashMap<UUID, PlayerData> allPlayerData = new HashMap<>();
|
||||
|
||||
public Class<? extends SavedPlayerData> savedPlayerDataClass;
|
||||
|
||||
public Class<? extends PlayerData> playerDataClass;
|
||||
|
||||
public PlayerDataManager(ResourceLocation id, String collectionName, Class<? extends SavedPlayerData> savedPlayerDataClass, Class<? extends PlayerData> playerDataClass) {
|
||||
this.collectionName = collectionName;
|
||||
this.savedPlayerDataClass = savedPlayerDataClass;
|
||||
this.playerDataClass = playerDataClass;
|
||||
dataManagerMap.put(id, this);
|
||||
}
|
||||
|
||||
public static PlayerDataManager getDataManager(ResourceLocation identifier) {
|
||||
return dataManagerMap.get(identifier);
|
||||
}
|
||||
public static void init() {
|
||||
// <----------- Core --------------->
|
||||
new PlayerDataManager(NexiaCore.CORE_DATA_MANAGER, "core", CoreSavedPlayerData.class, CorePlayerData.class);
|
||||
|
||||
// <----------- Discord --------------->
|
||||
new PlayerDataManager(NexiaCore.DISCORD_DATA_MANAGER, "discord", DiscordSavedPlayerData.class, PlayerData.class);
|
||||
|
||||
// <----------- FFAs --------------->
|
||||
new PlayerDataManager(NexiaCore.FFA_CLASSIC_DATA_MANAGER, "ffa_classic", FFASavedPlayerData.class, PlayerData.class);
|
||||
new PlayerDataManager(NexiaCore.FFA_KITS_DATA_MANAGER, "ffa_kits", FFASavedPlayerData.class, KitFFAPlayerData.class);
|
||||
new PlayerDataManager(NexiaCore.FFA_POT_DATA_MANAGER, "ffa_pot", FFASavedPlayerData.class, PlayerData.class);
|
||||
new PlayerDataManager(NexiaCore.FFA_SKY_DATA_MANAGER, "ffa_sky", FFASavedPlayerData.class, PlayerData.class);
|
||||
new PlayerDataManager(NexiaCore.FFA_UHC_DATA_MANAGER, "ffa_uhc", FFASavedPlayerData.class, PlayerData.class);
|
||||
|
||||
// <----------- BedWars --------------->
|
||||
new PlayerDataManager(NexiaCore.BEDWARS_DATA_MANAGER, "bedwars", BedwarsSavedPlayerData.class, BedwarsPlayerData.class);
|
||||
|
||||
// <----------- Duels --------------->
|
||||
new PlayerDataManager(NexiaCore.DUELS_DATA_MANAGER, "duels", DuelsSavedPlayerData.class, DuelsPlayerData.class);
|
||||
|
||||
// <----------- Football --------------->
|
||||
new PlayerDataManager(NexiaCore.FOOTBALL_DATA_MANAGER, "football", FootballSavedPlayerData.class, FootballPlayerData.class);
|
||||
|
||||
// <----------- OITC --------------->
|
||||
new PlayerDataManager(NexiaCore.OITC_DATA_MANAGER, "oitc", WLKSavedPlayerData.class, OITCPlayerData.class);
|
||||
|
||||
// <----------- SkyWars --------------->
|
||||
new PlayerDataManager(NexiaCore.SKYWARS_DATA_MANAGER, "skywars", WLKSavedPlayerData.class, SkywarsPlayerData.class);
|
||||
}
|
||||
|
||||
public PlayerData get(NexiaPlayer player) {
|
||||
return get(player.getUUID());
|
||||
}
|
||||
|
||||
public void addPlayerData(NexiaPlayer player) {
|
||||
addPlayerData(player.getUUID());
|
||||
}
|
||||
|
||||
public void removePlayerData(NexiaPlayer player) {
|
||||
removePlayerData(player.getUUID());
|
||||
}
|
||||
|
||||
public PlayerData get(UUID uuid) {
|
||||
if (!allPlayerData.containsKey(uuid)) {
|
||||
addPlayerData(uuid);
|
||||
}
|
||||
return allPlayerData.get(uuid);
|
||||
}
|
||||
|
||||
public void addPlayerData(UUID uuid) {
|
||||
PlayerData playerData;
|
||||
try {
|
||||
playerData = playerDataClass.getConstructor(SavedPlayerData.class).newInstance(loadPlayerData(uuid, savedPlayerDataClass));
|
||||
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
allPlayerData.put(uuid, playerData);
|
||||
}
|
||||
|
||||
public void removePlayerData(UUID uuid) {
|
||||
if (!allPlayerData.containsKey(uuid)) return;
|
||||
savePlayerData(uuid);
|
||||
allPlayerData.remove(uuid);
|
||||
}
|
||||
|
||||
private void savePlayerData(UUID uuid) {
|
||||
Document document = NexiaCore.mongoManager.toDocument(get(uuid).savedData);
|
||||
document.append("uuid", uuid.toString());
|
||||
document.remove("data");
|
||||
|
||||
UpdateResult isReplaced = NexiaCore.mongoManager.getCollection(collectionName).replaceOne(Filters.eq("uuid", uuid.toString()), document);
|
||||
|
||||
if (isReplaced.getMatchedCount() == 0) {
|
||||
NexiaCore.mongoManager.getCollection(collectionName).insertOne(document);
|
||||
}
|
||||
}
|
||||
|
||||
private <T extends SavedPlayerData> T loadPlayerData(UUID uuid, Class<T> toLoad) throws InstantiationException, IllegalAccessException {
|
||||
T savedPlayerData = NexiaCore.mongoManager.getObject(collectionName, Filters.eq("uuid", uuid.toString()), toLoad);
|
||||
if (savedPlayerData != null) {
|
||||
return savedPlayerData;
|
||||
}
|
||||
|
||||
try {
|
||||
return toLoad.getDeclaredConstructor().newInstance();
|
||||
} catch (InvocationTargetException | NoSuchMethodException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.nexia.base.player;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public abstract class SavedPlayerData {
|
||||
private final Data data;
|
||||
public SavedPlayerData() {
|
||||
this.data = new Data();
|
||||
}
|
||||
|
||||
public void incrementInteger(String name) {
|
||||
Integer val = get(Integer.class, name);
|
||||
set(Integer.class, name, val + 1);
|
||||
}
|
||||
|
||||
public void decrementInteger(String name) {
|
||||
Integer val = get(Integer.class, name);
|
||||
set(Integer.class, name, val - 1);
|
||||
}
|
||||
|
||||
public <T> void set(Class<T> type, String name, T value) {
|
||||
try {
|
||||
data.append(type, name, value, getClass().getField(name), this);
|
||||
} catch (NoSuchFieldException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public <T> T get(Class<T> type, String name) {
|
||||
try {
|
||||
return data.retrieve(type, name, getClass().getField(name), this);
|
||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
public static class Data {
|
||||
public Data() {
|
||||
|
||||
}
|
||||
public <T> void append(Class<T> type, String name, T value, Field field, SavedPlayerData data) {
|
||||
if (field != null) {
|
||||
try {
|
||||
field.set(data, value);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else throw new NullPointerException("The field " + name + " in " + data.getClass().getSimpleName() + " must not be null!");
|
||||
}
|
||||
public <T> T retrieve(Class<T> type, String name, Field field, SavedPlayerData data) throws IllegalAccessException, NoSuchFieldException {
|
||||
if (field != null) {
|
||||
return (T) field.get(data);
|
||||
} else throw new NullPointerException("The field " + name + " in " + data.getClass().getSimpleName() + " must not be null!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.nexia.core;
|
||||
|
||||
import com.combatreforged.factory.api.FactoryAPI;
|
||||
import com.combatreforged.factory.api.FactoryServer;
|
||||
import com.combatreforged.factory.api.entrypoint.FactoryPlugin;
|
||||
import com.nexia.core.config.ModConfig;
|
||||
import com.nexia.core.listeners.*;
|
||||
import com.nexia.core.loader.CommandLoader;
|
||||
import com.nexia.core.utilities.misc.NxFileUtil;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.serializer.GsonConfigSerializer;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class Main implements ModInitializer, FactoryPlugin {
|
||||
public static ModConfig config;
|
||||
|
||||
public static final String MOD_NAME = "Nexia";
|
||||
public static final String MOD_NAME_SHORT = "Nx";
|
||||
public static Logger logger = LogManager.getLogger(MOD_NAME);
|
||||
public static final String modConfigDir = NxFileUtil.makeDir(FabricLoader.getInstance().getConfigDir().toString() + "/nexia");
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
AutoConfig.register(ModConfig.class, GsonConfigSerializer::new);
|
||||
config = AutoConfig.getConfigHolder(ModConfig.class).getConfig();
|
||||
|
||||
logger.info("Loading mod...");
|
||||
logger.info("Registering commands....");
|
||||
CommandLoader.registerCommands();
|
||||
logger.info("Registered commands.");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("FutureReturnValueIgnored")
|
||||
public void onFactoryLoad(FactoryAPI api, FactoryServer server) {
|
||||
Main.logger.info("Loading factory version...");
|
||||
|
||||
ServerTime.factoryServer = server;
|
||||
ServerTime.factoryAPI = api;
|
||||
ServerTime.scheduler = api.getScheduler();
|
||||
|
||||
Main.logger.info("Registering listeners....");
|
||||
ListenerHelper.registerListeners();
|
||||
Main.logger.info("Registered listeners.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.nexia.core;
|
||||
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.utilities.database.MongoManager;
|
||||
import com.nexia.nexus.api.NexusAPI;
|
||||
import com.nexia.nexus.api.NexusServer;
|
||||
import com.nexia.nexus.api.entrypoint.NexusPlugin;
|
||||
import com.nexia.core.config.ModConfig;
|
||||
import com.nexia.core.listeners.ListenerHelper;
|
||||
import com.nexia.core.loader.CommandLoader;
|
||||
import com.nexia.core.networking.NetworkingHandler;
|
||||
import com.nexia.core.utilities.misc.NxFileUtil;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.serializer.GsonConfigSerializer;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class NexiaCore implements ModInitializer, NexusPlugin {
|
||||
public static ModConfig config;
|
||||
|
||||
public static final String MOD_NAME = "Nexia";
|
||||
public static Logger logger = LogManager.getLogger(MOD_NAME);
|
||||
public static final String modConfigDir = NxFileUtil.makeDir(FabricLoader.getInstance().getConfigDir().toString() + "/nexia");
|
||||
|
||||
public NetworkingHandler networkingHandler;
|
||||
public static MongoManager mongoManager;
|
||||
|
||||
public static final ResourceLocation CONVENTIONAL_BRIDGING_UPDATE_ID = new ResourceLocation("c", "update_status");
|
||||
|
||||
public static final ResourceLocation CORE_DATA_MANAGER = id("core");
|
||||
|
||||
public static final ResourceLocation DISCORD_DATA_MANAGER = id("discord");
|
||||
|
||||
public static final ResourceLocation FFA_CLASSIC_DATA_MANAGER = id("ffa_classic");
|
||||
public static final ResourceLocation FFA_KITS_DATA_MANAGER = id("ffa_kits");
|
||||
public static final ResourceLocation FFA_POT_DATA_MANAGER = id("ffa_pot");
|
||||
public static final ResourceLocation FFA_SKY_DATA_MANAGER = id("ffa_sky");
|
||||
public static final ResourceLocation FFA_UHC_DATA_MANAGER = id("ffa_uhc");
|
||||
|
||||
public static final ResourceLocation BEDWARS_DATA_MANAGER = id("bedwars");
|
||||
|
||||
public static final ResourceLocation DUELS_DATA_MANAGER = id("duels");
|
||||
|
||||
public static final ResourceLocation FOOTBALL_DATA_MANAGER = id("football");
|
||||
|
||||
public static final ResourceLocation OITC_DATA_MANAGER = id("oitc");
|
||||
|
||||
public static final ResourceLocation SKYWARS_DATA_MANAGER = id("skywars");
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
AutoConfig.register(ModConfig.class, GsonConfigSerializer::new);
|
||||
config = AutoConfig.getConfigHolder(ModConfig.class).getConfig();
|
||||
|
||||
logger.info("Loading mod...");
|
||||
PlayerDataManager.init();
|
||||
logger.info("Registering commands...");
|
||||
CommandLoader.registerCommands();
|
||||
logger.info("Registered commands.");
|
||||
|
||||
networkingHandler = new NetworkingHandler();
|
||||
mongoManager = new MongoManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("FutureReturnValueIgnored")
|
||||
public void onNexusLoad(NexusAPI api, NexusServer server) {
|
||||
logger.info("Loading Nexus API...");
|
||||
|
||||
ServerTime.nexusServer = server;
|
||||
ServerTime.nexusAPI = api;
|
||||
ServerTime.scheduler = api.getScheduler();
|
||||
|
||||
logger.info("Registering listeners...");
|
||||
ListenerHelper.registerListeners();
|
||||
logger.info("Registered listeners.");
|
||||
logger.info("Registering Nexus commands...");
|
||||
CommandLoader.registerNexusCommands();
|
||||
logger.info("Registered Nexus commands.");
|
||||
}
|
||||
public static ResourceLocation id(String path) {
|
||||
return new ResourceLocation("nexia", path);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +1,33 @@
|
||||
package com.nexia.core.commands.player;
|
||||
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.discord.Main;
|
||||
import com.nexia.discord.NexiaDiscord;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
import net.kyori.adventure.text.event.HoverEvent;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
|
||||
public class DiscordCommand {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("discord").executes(DiscordCommand::run));
|
||||
dispatcher.register(Commands.literal("dc").executes(DiscordCommand::run));
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("discord").executes(DiscordCommand::run));
|
||||
dispatcher.register(CommandUtils.literal("dc").executes(DiscordCommand::run));
|
||||
}
|
||||
|
||||
public static int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
PlayerUtil.getFactoryPlayer(context.getSource().getPlayerOrException()).sendMessage(
|
||||
public static int run(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
context.getSource().sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("Link to discord: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
|
||||
.append(Component.text(com.nexia.discord.Main.config.discordLink).color(ChatFormat.brandColor2)
|
||||
.hoverEvent(HoverEvent.showText(Component.text("Click me").color(ChatFormat.greenColor)))
|
||||
.clickEvent(ClickEvent.openUrl(Main.config.discordLink)))
|
||||
));
|
||||
.append(Component.text("Link to discord: ", ChatFormat.normalColor))
|
||||
.append(Component.text(NexiaDiscord.config.discordLink, ChatFormat.brandColor2)
|
||||
.hoverEvent(HoverEvent.showText(Component.text("Click me", ChatFormat.greenColor)))
|
||||
.clickEvent(ClickEvent.openUrl(NexiaDiscord.config.discordLink))
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
package com.nexia.core.commands.player;
|
||||
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
|
||||
public class HelpCommand {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("help").executes(HelpCommand::run));
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("help").executes(HelpCommand::run));
|
||||
}
|
||||
|
||||
static String commandSeparator = ": ";
|
||||
@@ -28,13 +27,17 @@ public class HelpCommand {
|
||||
"msg" + commandSeparator + "allows you to message other players",
|
||||
"stats" + commandSeparator + "shows you your stats",
|
||||
"duel" + commandSeparator + "duel a player that is in the hub (duels)",
|
||||
"customduel" + commandSeparator + "duel a player that is in the hub, in a custom kit that you made (custom duels)",
|
||||
"kitlayout" + commandSeparator + "edit your gamemode layout in duels",
|
||||
"kiteditor" + commandSeparator + "create kits for custom duels",
|
||||
"queue" + commandSeparator + "queue for a gamemode in duels",
|
||||
"spectate" + commandSeparator + "spectate a player which is in duels (or ffa if you have supporter rank)",
|
||||
"buy" + commandSeparator + "buy our ranks to support the server",
|
||||
"shout" + commandSeparator + "shout a message to the whole server (supporter++)"
|
||||
"shout" + commandSeparator + "shout a message to the whole server (supporter)",
|
||||
"sprintfix" + commandSeparator + "toggle the sprint fix"
|
||||
};
|
||||
|
||||
public static int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
public static int run(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
|
||||
Component message = ChatFormat.separatorLine("Commands");
|
||||
|
||||
@@ -44,17 +47,17 @@ public class HelpCommand {
|
||||
|
||||
message = message.append(Component.text("\n/" + commandInfo[0])
|
||||
.color(ChatFormat.brandColor1)
|
||||
.decoration(ChatFormat.bold, false)
|
||||
|
||||
.decoration(ChatFormat.strikeThrough, false)
|
||||
.append(Component.text(" | ").color(ChatFormat.lineColor).decoration(ChatFormat.bold, false).decoration(ChatFormat.strikeThrough, false))
|
||||
.append(Component.text(commandInfo[1]).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false).decoration(ChatFormat.strikeThrough, false)));
|
||||
.append(Component.text(" | ").color(ChatFormat.lineColor).decoration(ChatFormat.strikeThrough, false))
|
||||
.append(Component.text(commandInfo[1], ChatFormat.brandColor2).decoration(ChatFormat.strikeThrough, false)));
|
||||
|
||||
//message += "\n" + ChatFormat.brandColor1 + "/" + commandInfo[0] + ChatFormat.lineColor + " | " + ChatFormat.brandColor2 + commandInfo[1];
|
||||
}
|
||||
|
||||
message = message.append(Component.text("\n").append(ChatFormat.separatorLine(null)));
|
||||
|
||||
PlayerUtil.getFactoryPlayer(context.getSource().getPlayerOrException()).sendMessage(message);
|
||||
context.getSource().sendMessage(message);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,26 +1,29 @@
|
||||
package com.nexia.core.commands.player;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.games.util.LobbyUtil;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
|
||||
public class LeaveCommand {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
register(dispatcher, "leave");
|
||||
register(dispatcher, "lobby");
|
||||
register(dispatcher, "l");
|
||||
register(dispatcher, "hub");
|
||||
}
|
||||
|
||||
private static void register(CommandDispatcher<CommandSourceStack> dispatcher, String string) {
|
||||
dispatcher.register(Commands.literal(string).executes(LeaveCommand::run));
|
||||
private static void register(CommandDispatcher<CommandSourceInfo> dispatcher, String string) {
|
||||
dispatcher.register(CommandUtils.literal(string).executes(LeaveCommand::run));
|
||||
}
|
||||
|
||||
public static int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
LobbyUtil.leaveAllGames(context.getSource().getPlayerOrException(), true);
|
||||
public static int run(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
NexiaPlayer player = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
LobbyUtil.returnToLobby(player, true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,63 +1,59 @@
|
||||
package com.nexia.core.commands.player;
|
||||
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.chat.LegacyChatFormat;
|
||||
import com.nexia.core.utilities.chat.PlayerMutes;
|
||||
import com.nexia.core.utilities.player.PlayerData;
|
||||
import com.nexia.core.utilities.player.PlayerDataManager;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
|
||||
|
||||
public class MessageCommand {
|
||||
|
||||
public static void registerMsg(CommandDispatcher<CommandSourceStack> commandDispatcher, boolean bl) {
|
||||
commandDispatcher.register(Commands.literal("msg")
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.then(Commands.argument("message", StringArgumentType.greedyString())
|
||||
.executes(MessageCommand::msgCommand)
|
||||
)
|
||||
));
|
||||
commandDispatcher.register(Commands.literal("message")
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.then(Commands.argument("message", StringArgumentType.greedyString())
|
||||
.executes(MessageCommand::msgCommand)
|
||||
)
|
||||
)
|
||||
);
|
||||
commandDispatcher.register(Commands.literal("tell")
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.then(Commands.argument("message", StringArgumentType.greedyString())
|
||||
public static void registerMsg(CommandDispatcher<CommandSourceInfo> commandDispatcher) {
|
||||
registerMsg(commandDispatcher, "msg");
|
||||
registerMsg(commandDispatcher, "message");
|
||||
registerMsg(commandDispatcher, "tell");
|
||||
registerMsg(commandDispatcher, "whisper");
|
||||
}
|
||||
|
||||
public static void registerMsg(CommandDispatcher<CommandSourceInfo> commandDispatcher, String string) {
|
||||
commandDispatcher.register(CommandUtils.literal(string)
|
||||
.then(CommandUtils.argument("player", EntityArgument.player())
|
||||
.then(CommandUtils.argument("message", StringArgumentType.greedyString())
|
||||
.executes(MessageCommand::msgCommand)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static void registerReply(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("r")
|
||||
.then(Commands.argument("message", StringArgumentType.greedyString())
|
||||
|
||||
|
||||
public static void registerReply(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("r")
|
||||
.then(CommandUtils.argument("message", StringArgumentType.greedyString())
|
||||
.executes(MessageCommand::replyCommand)
|
||||
));
|
||||
dispatcher.register(Commands.literal("reply")
|
||||
.then(Commands.argument("message", StringArgumentType.greedyString())
|
||||
dispatcher.register(CommandUtils.literal("reply")
|
||||
.then(CommandUtils.argument("message", StringArgumentType.greedyString())
|
||||
.executes(MessageCommand::replyCommand)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private static int msgCommand(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer sender = context.getSource().getPlayerOrException();
|
||||
ServerPlayer receiver = EntityArgument.getPlayer(context, "player");
|
||||
private static int msgCommand(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
NexiaPlayer sender = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
NexiaPlayer receiver = new NexiaPlayer(context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), true)));
|
||||
String message = StringArgumentType.getString(context, "message");
|
||||
|
||||
sendMessage(sender, receiver, message);
|
||||
@@ -65,13 +61,13 @@ public class MessageCommand {
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int replyCommand(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer sender = context.getSource().getPlayerOrException();
|
||||
PlayerData senderData = PlayerDataManager.get(sender);
|
||||
ServerPlayer receiver = PlayerUtil.getFixedPlayer(senderData.lastMessageSender);
|
||||
private static int replyCommand(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
NexiaPlayer sender = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
CorePlayerData senderData = (CorePlayerData) PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(sender);
|
||||
NexiaPlayer receiver = senderData.lastMessageSender;
|
||||
|
||||
if (receiver == null) {
|
||||
sender.sendMessage(LegacyChatFormat.format("{s}Nobody to reply to"), Util.NIL_UUID);
|
||||
sender.sendMessage(Component.text("Nobody to reply to.", ChatFormat.systemColor));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -81,33 +77,24 @@ public class MessageCommand {
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static void sendMessage(ServerPlayer sender, ServerPlayer receiver, String message) {
|
||||
if (PlayerMutes.muted(sender) || sender == receiver) return;
|
||||
private static void sendMessage(NexiaPlayer sender, NexiaPlayer receiver, String message) {
|
||||
if (PlayerMutes.muted(sender) || sender.equals(receiver)) return;
|
||||
|
||||
PlayerUtil.getFactoryPlayer(sender).sendMessage(
|
||||
Component.text(String.format("To %s", receiver.getScoreboardName())).color(ChatFormat.brandColor2)
|
||||
sender.sendMessage(
|
||||
Component.text(String.format("To %s", receiver.getRawName()), ChatFormat.brandColor2)
|
||||
.append(Component.text(" » ").color(ChatFormat.arrowColor)
|
||||
.append(Component.text(message).color(ChatFormat.brandColor2))
|
||||
.append(Component.text(message, ChatFormat.brandColor2))
|
||||
|
||||
));
|
||||
|
||||
PlayerUtil.getFactoryPlayer(receiver).sendMessage(
|
||||
Component.text(String.format("From %s", sender.getScoreboardName())).color(ChatFormat.brandColor2)
|
||||
receiver.sendMessage(
|
||||
Component.text(String.format("From %s", sender.getRawName()), ChatFormat.brandColor2)
|
||||
.append(Component.text(" » ").color(ChatFormat.arrowColor)
|
||||
.append(Component.text(message).color(ChatFormat.brandColor2))
|
||||
.append(Component.text(message, ChatFormat.brandColor2))
|
||||
|
||||
));
|
||||
|
||||
/*
|
||||
sender.sendMessage(LegacyChatFormat.format("{b1}To {} {s}» {b1}{}", receiver.getScoreboardName(), message),
|
||||
Util.NIL_UUID);
|
||||
PlayerDataManager.get(sender).lastMessageSender = receiver;
|
||||
|
||||
receiver.sendMessage(LegacyChatFormat.format("{b1}From {} {s}» {b1}{}", sender.getScoreboardName(), message),
|
||||
Util.NIL_UUID);
|
||||
|
||||
*/
|
||||
PlayerDataManager.get(receiver).lastMessageSender = sender;
|
||||
((CorePlayerData) PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(receiver)).lastMessageSender = sender;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,65 +3,55 @@ package com.nexia.core.commands.player;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.chat.LegacyChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class PingCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("ping").executes(PingCommand::run)
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.executes(context -> PingCommand.ping(context, EntityArgument.getPlayer(context, "player")))
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("ping").executes(PingCommand::run)
|
||||
.then(CommandUtils.argument("player", EntityArgument.player())
|
||||
.executes(context -> PingCommand.ping(context, context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), true))))
|
||||
)
|
||||
);
|
||||
dispatcher.register(Commands.literal("latency").executes(PingCommand::run)
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.executes(context -> PingCommand.ping(context, EntityArgument.getPlayer(context, "player")))
|
||||
dispatcher.register(CommandUtils.literal("latency").executes(PingCommand::run)
|
||||
.then(CommandUtils.argument("player", EntityArgument.player())
|
||||
.executes(context -> PingCommand.ping(context, context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), true))))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer executer = context.getSource().getPlayerOrException();
|
||||
int ping = executer.latency;
|
||||
public static int run(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
int ping = new NexiaPlayer(context.getSource().getPlayerOrException()).getLatency();
|
||||
|
||||
PlayerUtil.getFactoryPlayer(executer).sendMessage(
|
||||
context.getSource().sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("Your ping is ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
|
||||
.append(Component.text(ping + "ms").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(".").color(ChatFormat.normalColor))
|
||||
.append(Component.text(" (ping may not be accurate)").color(NamedTextColor.GRAY).decorate(ChatFormat.italic))
|
||||
.append(Component.text("Your ping is ", ChatFormat.normalColor)
|
||||
.append(Component.text(ping + "ms", ChatFormat.brandColor2))
|
||||
.append(Component.text(".", ChatFormat.normalColor))
|
||||
.append(Component.text(" (ping may not be accurate)", ChatFormat.Minecraft.dark_gray).decorate(ChatFormat.italic))
|
||||
));
|
||||
|
||||
return ping;
|
||||
}
|
||||
|
||||
public static int ping(CommandContext<CommandSourceStack> context, ServerPlayer player) {
|
||||
CommandSourceStack cmdExecutor = context.getSource();
|
||||
ServerPlayer executor;
|
||||
public static int ping(CommandContext<CommandSourceInfo> context, ServerPlayer player) {
|
||||
int ping = player.latency;
|
||||
|
||||
try {
|
||||
executor = cmdExecutor.getPlayerOrException();
|
||||
} catch(Exception ignored){
|
||||
cmdExecutor.sendSuccess(LegacyChatFormat.format("{b1}The ping of {} is {b2}{}ms{b1}.", player.getScoreboardName(), ping), false);
|
||||
return ping;
|
||||
}
|
||||
|
||||
PlayerUtil.getFactoryPlayer(executor).sendMessage(
|
||||
context.getSource().sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("The ping of ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(player.getScoreboardName()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(" is ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(ping + "ms").color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(" (ping may not be accurate)").color(NamedTextColor.GRAY).decorate(ChatFormat.italic).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text("The ping of ", ChatFormat.normalColor))
|
||||
.append(Component.text(player.getScoreboardName(), ChatFormat.brandColor2))
|
||||
.append(Component.text(" is ", ChatFormat.normalColor))
|
||||
.append(Component.text(ping + "ms", ChatFormat.brandColor2))
|
||||
.append(Component.text(".", ChatFormat.normalColor))
|
||||
.append(Component.text(" (ping may not be accurate)", ChatFormat.Minecraft.dark_gray).decorate(ChatFormat.italic))
|
||||
);
|
||||
|
||||
return ping;
|
||||
|
||||
@@ -5,92 +5,61 @@ import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.games.util.LobbyUtil;
|
||||
import com.nexia.core.gui.PlayGUI;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
|
||||
public class PlayCommand {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("play").executes(PlayCommand::openGUI)
|
||||
.then(Commands.literal("ffa").executes(PlayCommand::openGUI)
|
||||
.then(Commands.literal("kits").executes(PlayCommand::playKitFFA))
|
||||
.then(Commands.literal("pot").executes(PlayCommand::playPotFFA))
|
||||
.then(Commands.literal("uhc").executes(PlayCommand::playUhcFFA))
|
||||
.then(Commands.literal("classic").executes(PlayCommand::playNormalFFA)))
|
||||
.then(Commands.literal("bedwars").executes(PlayCommand::playBedWars))
|
||||
.then(Commands.literal("duels").executes(PlayCommand::playDuels))
|
||||
.then(Commands.literal("skywars").executes(PlayCommand::playSkywars))
|
||||
.then(Commands.literal("sw").executes(PlayCommand::playSkywars))
|
||||
.then(Commands.literal("oitc").executes(PlayCommand::playOITC))
|
||||
.then(Commands.literal("bw").executes(PlayCommand::playBedWars)));
|
||||
dispatcher.register(Commands.literal("join").executes(PlayCommand::openGUI)
|
||||
.then(Commands.literal("ffa").executes(PlayCommand::openGUI)
|
||||
.then(Commands.literal("kits").executes(PlayCommand::playKitFFA))
|
||||
.then(Commands.literal("pot").executes(PlayCommand::playPotFFA))
|
||||
.then(Commands.literal("uhc").executes(PlayCommand::playUhcFFA))
|
||||
.then(Commands.literal("classic").executes(PlayCommand::playNormalFFA)))
|
||||
.then(Commands.literal("bedwars").executes(PlayCommand::playBedWars))
|
||||
.then(Commands.literal("duels").executes(PlayCommand::playDuels))
|
||||
.then(Commands.literal("skywars").executes(PlayCommand::playSkywars))
|
||||
.then(Commands.literal("sw").executes(PlayCommand::playSkywars))
|
||||
.then(Commands.literal("bw").executes(PlayCommand::playBedWars))
|
||||
.then(Commands.literal("oitc").executes(PlayCommand::playOITC))
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
|
||||
register(dispatcher, "play");
|
||||
register(dispatcher, "join");
|
||||
|
||||
dispatcher.register(CommandUtils.literal("ffa").executes(PlayCommand::openFFAGui)
|
||||
.then(CommandUtils.literal("kits").executes(context -> playGame(context, "kits ffa")))
|
||||
.then(CommandUtils.literal("pot").executes(context -> playGame(context, "pot ffa")))
|
||||
.then(CommandUtils.literal("sky").executes(context -> playGame(context, "sky ffa")))
|
||||
.then(CommandUtils.literal("uhc").executes(context -> playGame(context, "uhc ffa")))
|
||||
.then(CommandUtils.literal("classic").executes(context -> playGame(context, "classic ffa")))
|
||||
);
|
||||
dispatcher.register(Commands.literal("ffa").executes(PlayCommand::playNormalFFA));
|
||||
}
|
||||
|
||||
private static int openGUI(CommandContext<CommandSourceStack> context) throws CommandSyntaxException{
|
||||
PlayGUI.openMainGUI(context.getSource().getPlayerOrException());
|
||||
private static void register(CommandDispatcher<CommandSourceInfo> dispatcher, String string) {
|
||||
dispatcher.register(CommandUtils.literal(string).executes(PlayCommand::openGUI)
|
||||
.then(CommandUtils.literal("ffa").executes(PlayCommand::openFFAGui)
|
||||
.then(CommandUtils.literal("kits").executes(context -> playGame(context, "kits ffa")))
|
||||
.then(CommandUtils.literal("pot").executes(context -> playGame(context, "pot ffa")))
|
||||
.then(CommandUtils.literal("sky").executes(context -> playGame(context, "sky ffa")))
|
||||
.then(CommandUtils.literal("uhc").executes(context -> playGame(context, "uhc ffa")))
|
||||
.then(CommandUtils.literal("classic").executes(context -> playGame(context, "classic ffa")))
|
||||
)
|
||||
.then(CommandUtils.literal("bedwars").executes(context -> playGame(context, "bedwars")))
|
||||
.then(CommandUtils.literal("duels").executes(context -> playGame(context, "duels")))
|
||||
.then(CommandUtils.literal("skywars").executes(context -> playGame(context, "skywars")))
|
||||
.then(CommandUtils.literal("sw").executes(context -> playGame(context, "skywars")))
|
||||
.then(CommandUtils.literal("football").executes(context -> playGame(context, "football")))
|
||||
.then(CommandUtils.literal("oitc").executes(context -> playGame(context, "oitc")))
|
||||
.then(CommandUtils.literal("bw").executes(context -> playGame(context, "bedwars")))
|
||||
);
|
||||
}
|
||||
|
||||
private static int openGUI(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
PlayGUI.openMainGUI(new NexiaPlayer(context.getSource().getPlayerOrException()).unwrap());
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int playNormalFFA(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
LobbyUtil.sendGame(player, "classic ffa", true, true);
|
||||
private static int openFFAGui(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
PlayGUI.openMainGUI(new NexiaPlayer(context.getSource().getPlayerOrException()).unwrap()).setFFALayout();
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int playKitFFA(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
LobbyUtil.sendGame(player, "kits ffa", true, true);
|
||||
return 1;
|
||||
private static int playGame(CommandContext<CommandSourceInfo> context, String game) throws CommandSyntaxException {
|
||||
return playGame(new NexiaPlayer(context.getSource().getPlayerOrException()), game);
|
||||
}
|
||||
|
||||
private static int playUhcFFA(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
LobbyUtil.sendGame(player, "uhc ffa", true, true);
|
||||
private static int playGame(NexiaPlayer player, String game) {
|
||||
LobbyUtil.sendGame(player, game, true, true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int playPotFFA(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
LobbyUtil.sendGame(player, "pot ffa", true, true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int playBedWars(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
LobbyUtil.sendGame(player, "bedwars", true, true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int playDuels(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
LobbyUtil.sendGame(player, "duels", true, true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int playOITC(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
LobbyUtil.sendGame(player, "oitc", true, true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int playSkywars(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
LobbyUtil.sendGame(player, "skywars", true, true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,18 +4,17 @@ import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.gui.PrefixGUI;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
|
||||
public class PrefixCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("prefix").executes(PrefixCommand::run));
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("prefix").executes(PrefixCommand::run));
|
||||
}
|
||||
|
||||
public static int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer executer = context.getSource().getPlayerOrException();
|
||||
PrefixGUI.openRankGUI(executer);
|
||||
public static int run(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
PrefixGUI.openRankGUI(new NexiaPlayer(context.getSource().getPlayerOrException()).unwrap());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -4,20 +4,21 @@ import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.gui.RanksGUI;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
|
||||
public class RanksCommand {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("buy").executes(RanksCommand::run));
|
||||
dispatcher.register(Commands.literal("store").executes(RanksCommand::run));
|
||||
dispatcher.register(Commands.literal("ranks").executes(RanksCommand::run));
|
||||
dispatcher.register(Commands.literal("role").executes(RanksCommand::run));
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("buy").executes(RanksCommand::run));
|
||||
dispatcher.register(CommandUtils.literal("store").executes(RanksCommand::run));
|
||||
dispatcher.register(CommandUtils.literal("ranks").executes(RanksCommand::run));
|
||||
dispatcher.register(CommandUtils.literal("role").executes(RanksCommand::run));
|
||||
}
|
||||
|
||||
public static int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
RanksGUI.openMainGUI(context.getSource().getPlayerOrException());
|
||||
public static int run(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
RanksGUI.openMainGUI(new NexiaPlayer(context.getSource().getPlayerOrException()).unwrap());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,31 +1,34 @@
|
||||
package com.nexia.core.commands.player;
|
||||
|
||||
import com.combatreforged.factory.api.world.entity.player.Player;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.utilities.player.CoreSavedPlayerData;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.Main;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.http.DiscordWebhook;
|
||||
import com.nexia.core.utilities.player.PlayerDataManager;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import com.nexia.discord.NexiaDiscord;
|
||||
import com.nexia.nexus.api.world.entity.player.Player;
|
||||
import com.nexia.nexus.builder.implementation.world.entity.player.WrappedPlayer;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
import java.awt.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class ReportCommand {
|
||||
|
||||
private static void sendWebhook(String reporter, String victim, String reason){
|
||||
DiscordWebhook webhook = new DiscordWebhook("https://discord.com/api/webhooks/1076143579585593404/WAvzxt2x1hPOX2UHrklkiCumwVU7xBvUjZ91InBnHKCuuL0nnKPERaEiQxQvgkUxHnZ0");
|
||||
private static boolean sendWebhook(String reporter, String victim, String reason){
|
||||
DiscordWebhook webhook = new DiscordWebhook(NexiaDiscord.config.reportWebhook);
|
||||
webhook.addEmbed(new DiscordWebhook.EmbedObject()
|
||||
.setAuthor((reporter + " reported " + victim), null, null)
|
||||
.setColor(Color.RED)
|
||||
@@ -35,67 +38,58 @@ public class ReportCommand {
|
||||
.addField("Reported Player:", victim, true)
|
||||
.setThumbnail("https://mc-heads.net/avatar/" + victim + "/64")
|
||||
.addField("Reason:", reason, false)
|
||||
.setFooter("Nexia • " + DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss").format(LocalDateTime.now()), "https://notcoded.needs.rest/r/nexia.png"));
|
||||
);
|
||||
try {
|
||||
webhook.execute();
|
||||
} catch (Exception ignored) { }
|
||||
return true;
|
||||
} catch (Exception ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("report")
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.then(Commands.argument("reason", StringArgumentType.greedyString())
|
||||
.executes(context -> ReportCommand.report(context, EntityArgument.getPlayer(context, "player"), StringArgumentType.getString(context, "reason")))
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("report")
|
||||
.then(CommandUtils.argument("player", EntityArgument.player())
|
||||
.then(CommandUtils.argument("reason", StringArgumentType.greedyString())
|
||||
.executes(context -> ReportCommand.report(context, context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), true)), StringArgumentType.getString(context, "reason")))
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public static int report(CommandContext<CommandSourceStack> context, ServerPlayer player, String reason) throws CommandSyntaxException {
|
||||
ServerPlayer mcExecutor = context.getSource().getPlayerOrException();
|
||||
Player executor = PlayerUtil.getFactoryPlayer(mcExecutor);
|
||||
public static int report(CommandContext<CommandSourceInfo> context, ServerPlayer player, String reason) throws CommandSyntaxException {
|
||||
NexiaPlayer executor = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
if(PlayerDataManager.get(mcExecutor).isReportBanned) {
|
||||
executor.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You are report banned!").color(ChatFormat.failColor).decoration(ChatFormat.bold, false)
|
||||
)
|
||||
|
||||
);
|
||||
if(((CoreSavedPlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(executor).savedData).isReportBanned()) {
|
||||
executor.sendNexiaMessage("You are report banned!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(mcExecutor == player){
|
||||
executor.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You cannot report yourself!").color(ChatFormat.failColor).decoration(ChatFormat.bold, false))
|
||||
|
||||
);
|
||||
if(executor.getUUID().equals(player.getUUID())){
|
||||
executor.sendNexiaMessage("You cannot report yourself!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
executor.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have reported ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(player.getScoreboardName()).color(ChatFormat.brandColor2))
|
||||
.append(Component.text(" for ").color(ChatFormat.normalColor))
|
||||
.append(Component.text(reason).color(ChatFormat.brandColor2))
|
||||
executor.sendNexiaMessage(
|
||||
Component.text("You have reported ", ChatFormat.normalColor)
|
||||
.append(Component.text(player.getScoreboardName(), ChatFormat.brandColor2))
|
||||
.append(Component.text(" for ", ChatFormat.normalColor))
|
||||
.append(Component.text(reason, ChatFormat.brandColor2))
|
||||
);
|
||||
|
||||
ServerPlayer staffPlayer;
|
||||
sendWebhook(executor.getRawName(), player.getScoreboardName(), reason);
|
||||
for (int i = 0; i != ServerTime.minecraftServer.getPlayerCount(); i++){
|
||||
staffPlayer = PlayerUtil.getMinecraftPlayerFromName(ServerTime.minecraftServer.getPlayerNames()[i]);
|
||||
if(Permissions.check(staffPlayer, "nexia.staff.report", 1)) {
|
||||
PlayerUtil.getFactoryPlayer(staffPlayer).sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text(executor.getRawName()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(" has reported ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(player.getScoreboardName()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(" for ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(reason).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false))
|
||||
);
|
||||
}
|
||||
if(!sendWebhook(executor.getRawName(), player.getScoreboardName(), reason)) {
|
||||
executor.sendNexiaMessage("Failed to send webhook! Don't worry, staff who are currently online will see your report!");
|
||||
}
|
||||
|
||||
Component staffReportMessage = ChatFormat.nexiaMessage
|
||||
.append(Component.text(executor.getRawName(), ChatFormat.brandColor2))
|
||||
.append(Component.text(" has reported ", ChatFormat.normalColor))
|
||||
.append(Component.text(player.getScoreboardName(), ChatFormat.brandColor2))
|
||||
.append(Component.text(" for ", ChatFormat.normalColor))
|
||||
.append(Component.text(reason, ChatFormat.brandColor2));
|
||||
|
||||
for (Player staffPlayer : ServerTime.nexusServer.getPlayers()){
|
||||
if(Permissions.check(((WrappedPlayer) staffPlayer).unwrap(), "nexia.staff.report", 1)) staffPlayer.sendMessage(staffReportMessage);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -1,32 +1,20 @@
|
||||
package com.nexia.core.commands.player;
|
||||
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
|
||||
public class RulesCommand {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("rules").executes(RulesCommand::run));
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("rules").executes(RulesCommand::run));
|
||||
}
|
||||
|
||||
private static final String[] rules = {
|
||||
"No hacking, cheating, griefing or exploiting bugs.",
|
||||
"Be respectful. No toxicity and/or annoying behaviour.",
|
||||
"No advertising.",
|
||||
"No encouraging of illegal activity.",
|
||||
"No interrupting other player's fights.",
|
||||
"No spamming/filling up chat.",
|
||||
"No stalling/combat logging.",
|
||||
"No bedrock bridging."
|
||||
};
|
||||
|
||||
public static int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
public static int run(CommandContext<CommandSourceInfo> context) {
|
||||
|
||||
/*
|
||||
Apparently this just doesn't work.....
|
||||
@@ -38,11 +26,11 @@ public class RulesCommand {
|
||||
Component message = Component.text("")
|
||||
.append(Component.text(" ").color(ChatFormat.lineColor).decoration(ChatFormat.strikeThrough, true))
|
||||
.append(Component.text("[ ").color(ChatFormat.lineColor).decoration(ChatFormat.strikeThrough, false)
|
||||
.append(Component.text("Rules").color(ChatFormat.brandColor1).decoration(ChatFormat.strikeThrough, false))
|
||||
.append(Component.text("Rules", ChatFormat.brandColor1).decoration(ChatFormat.strikeThrough, false))
|
||||
.append(Component.text(" ]").color(ChatFormat.lineColor).decoration(ChatFormat.strikeThrough, false))
|
||||
.append(Component.text(" ").color(ChatFormat.lineColor).decoration(ChatFormat.strikeThrough, true)));
|
||||
|
||||
for (int i = 0; i < rules.length; i++) {
|
||||
for (int i = 0; i < NexiaCore.config.rules.length; i++) {
|
||||
|
||||
message = message.append(Component.text("\n" + (i+1) + ". ")
|
||||
.color(ChatFormat.brandColor1)
|
||||
@@ -50,10 +38,10 @@ public class RulesCommand {
|
||||
.decoration(ChatFormat.strikeThrough, false)
|
||||
.append(Component.text("» ")
|
||||
.color(ChatFormat.arrowColor)
|
||||
.decoration(ChatFormat.bold, false)
|
||||
|
||||
.decoration(ChatFormat.strikeThrough, false)
|
||||
.append(Component.text(rules[i])
|
||||
.decoration(ChatFormat.bold, false)
|
||||
.append(Component.text(NexiaCore.config.rules[i])
|
||||
|
||||
.decoration(ChatFormat.strikeThrough, false)
|
||||
.color(ChatFormat.normalColor)
|
||||
)
|
||||
@@ -62,7 +50,7 @@ public class RulesCommand {
|
||||
|
||||
message = message.append(Component.text("\n").append(ChatFormat.separatorLine(null)));
|
||||
|
||||
PlayerUtil.getFactoryPlayer(context.getSource().getPlayerOrException()).sendMessage(message);
|
||||
context.getSource().sendMessage(message);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,34 +1,30 @@
|
||||
package com.nexia.core.commands.player;
|
||||
|
||||
import com.combatreforged.factory.api.world.entity.player.Player;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.nexia.nexus.api.world.entity.player.Player;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.chat.PlayerMutes;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ShoutCommand {
|
||||
|
||||
private static HashMap<UUID, Long> cooldownTime = new HashMap<>();
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("shout")
|
||||
.requires(context -> {
|
||||
try {
|
||||
return Permissions.check(context.getPlayerOrException(), "nexia.prefix.supporter");
|
||||
} catch (Exception ignored) { }
|
||||
return false;
|
||||
})
|
||||
.then(Commands.argument("message", StringArgumentType.greedyString())
|
||||
private static final HashMap<UUID, Long> cooldownTime = new HashMap<>();
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("shout")
|
||||
.requires(commandSourceInfo -> CommandUtil.hasPermission(commandSourceInfo, "nexia.prefix.supporter"))
|
||||
.then(CommandUtils.argument("message", StringArgumentType.greedyString())
|
||||
.executes(context -> ShoutCommand.shout(context, StringArgumentType.getString(context, "message")))
|
||||
)
|
||||
);
|
||||
@@ -44,27 +40,28 @@ public class ShoutCommand {
|
||||
}
|
||||
|
||||
|
||||
public static int shout(CommandContext<CommandSourceStack> context, String message) throws CommandSyntaxException {
|
||||
ServerPlayer executor = context.getSource().getPlayerOrException();
|
||||
Player factoryExecutor = PlayerUtil.getFactoryPlayer(executor);
|
||||
public static int shout(CommandContext<CommandSourceInfo> context, String message) throws CommandSyntaxException {
|
||||
NexiaPlayer executor = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
if (PlayerMutes.muted(executor)) return 0;
|
||||
|
||||
if(ShoutCommand.cooldownTime.get(executor.getUUID()) == null) ShoutCommand.cooldownTime.put(executor.getUUID(), System.currentTimeMillis());
|
||||
long longTime = ShoutCommand.cooldownTime.get(executor.getUUID());
|
||||
|
||||
if(longTime - System.currentTimeMillis() > 0) {
|
||||
String time = ShoutCommand.timeToText(longTime - System.currentTimeMillis());
|
||||
factoryExecutor.sendMessage(ChatFormat.nexiaMessage.append(
|
||||
Component.text("You are still on cooldown, you have ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
|
||||
.append(Component.text(time).color(ChatFormat.brandColor1).decoration(ChatFormat.bold, true))
|
||||
.append(Component.text(" left!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
));
|
||||
executor.sendNexiaMessage(
|
||||
Component.text("You are still on cooldown, you have ", ChatFormat.normalColor)
|
||||
.append(Component.text(time, ChatFormat.brandColor1).decoration(ChatFormat.bold, true))
|
||||
.append(Component.text(" left!", ChatFormat.normalColor))
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Component cmessage = Component.text(factoryExecutor.getRawName()).color(ChatFormat.brandColor1).decoration(ChatFormat.bold, true)
|
||||
.append(Component.text( " shouts: " + message).color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
|
||||
);
|
||||
Component cmessage = Component.text(executor.getRawName(), ChatFormat.brandColor1).decoration(ChatFormat.bold, true)
|
||||
.append(Component.text( " shouts: " + message, ChatFormat.normalColor));
|
||||
|
||||
for(Player player : ServerTime.factoryServer.getPlayers()) {
|
||||
for(Player player : ServerTime.nexusServer.getPlayers()) {
|
||||
player.sendMessage(cmessage);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,144 +1,133 @@
|
||||
package com.nexia.core.commands.player;
|
||||
|
||||
import com.combatreforged.factory.api.world.entity.player.Player;
|
||||
import com.combatreforged.factory.api.world.types.Minecraft;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.games.util.LobbyUtil;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerData;
|
||||
import com.nexia.core.utilities.player.PlayerDataManager;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import com.nexia.ffa.FfaUtil;
|
||||
import com.nexia.ffa.classic.utilities.FfaAreas;
|
||||
import com.nexia.ffa.classic.utilities.FfaClassicUtil;
|
||||
import com.nexia.minigames.games.duels.DuelGameMode;
|
||||
import com.nexia.minigames.games.duels.gamemodes.GamemodeHandler;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
import com.nexia.minigames.games.duels.util.player.DuelsPlayerData;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.nexia.nexus.api.world.types.Minecraft;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
import net.kyori.adventure.text.event.HoverEvent;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class SpectateCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("spectate")
|
||||
.requires(commandSourceStack -> {
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("spectate")
|
||||
.requires(commandSourceInfo -> {
|
||||
try {
|
||||
com.nexia.minigames.games.duels.util.player.PlayerData playerData = com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
PlayerData playerData1 = PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
NexiaPlayer player = new NexiaPlayer(commandSourceInfo.getPlayerOrException());
|
||||
|
||||
DuelsPlayerData playerData = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player);
|
||||
CorePlayerData playerData1 = (CorePlayerData) PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player);
|
||||
return (playerData.gameMode == DuelGameMode.LOBBY && playerData1.gameMode == PlayerGameMode.LOBBY) || (playerData1.gameMode == PlayerGameMode.FFA);
|
||||
} catch (Exception ignored) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.executes(SpectateCommand::gameModeSpectate)
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.executes(context -> SpectateCommand.spectate(context, EntityArgument.getPlayer(context, "player")))
|
||||
.then(CommandUtils.argument("player", EntityArgument.player())
|
||||
.executes(context -> SpectateCommand.spectate(context, context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), true))))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static int gameModeSpectate(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer executor = context.getSource().getPlayerOrException();
|
||||
Player factoryExecutor = PlayerUtil.getFactoryPlayer(executor);
|
||||
public static int gameModeSpectate(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
NexiaPlayer executor = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
if(PlayerDataManager.get(executor).gameMode != PlayerGameMode.FFA) {
|
||||
factoryExecutor.sendMessage(ChatFormat.nexiaMessage.append(
|
||||
Component.text("This can only be used in FFA!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
|
||||
));
|
||||
factoryExecutor.sendMessage(ChatFormat.nexiaMessage.append(
|
||||
Component.text("If you are in duels then you do /spectate <player>.").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
|
||||
));
|
||||
if(!executor.isInGameMode(PlayerGameMode.FFA)) {
|
||||
executor.sendNexiaMessage("This can only be used in FFA!");
|
||||
executor.sendNexiaMessage("If you are in duels then you do /spectate <player>.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!Permissions.check(executor, "nexia.prefix.supporter")) {
|
||||
factoryExecutor.sendMessage(ChatFormat.nexiaMessage.append(
|
||||
Component.text("This feature is only available for").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
|
||||
if(!executor.hasPermission("nexia.prefix.supporter")) {
|
||||
executor.sendNexiaMessage(
|
||||
Component.text("This feature is only available for", ChatFormat.normalColor)
|
||||
.append(Component.text("Supporters")
|
||||
.color(ChatFormat.brandColor1)
|
||||
.decoration(ChatFormat.bold, true)
|
||||
.hoverEvent(HoverEvent.showText(Component.text("Click me").color(ChatFormat.brandColor1)))
|
||||
.clickEvent(ClickEvent.suggestCommand("/ranks")
|
||||
)
|
||||
.append(Component.text("!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.hoverEvent(HoverEvent.showText(Component.text("Click me", ChatFormat.brandColor1)))
|
||||
.clickEvent(ClickEvent.suggestCommand("/ranks"))
|
||||
.append(Component.text("!", ChatFormat.normalColor))
|
||||
)
|
||||
)
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
// Check if player is in combat (or full health), then put them in spectator.
|
||||
|
||||
if(factoryExecutor.getHealth() < 20) {
|
||||
factoryExecutor.sendMessage(ChatFormat.nexiaMessage.append(
|
||||
Component.text("You must be fully healed to go into spectator!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
);
|
||||
if(LobbyUtil.checkGameModeBan(executor, "ffa")) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
factoryExecutor.setGameMode(Minecraft.GameMode.SPECTATOR);
|
||||
if(Math.round(executor.getHealth()) < 20) {
|
||||
executor.sendNexiaMessage("You must be fully healed to go into spectator!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
executor.setGameMode(Minecraft.GameMode.SPECTATOR);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int spectate(CommandContext<CommandSourceStack> context, ServerPlayer player) throws CommandSyntaxException {
|
||||
ServerPlayer executor = context.getSource().getPlayerOrException();
|
||||
Player factoryExecutor = PlayerUtil.getFactoryPlayer(executor);
|
||||
public static int spectate(CommandContext<CommandSourceInfo> context, ServerPlayer player) throws CommandSyntaxException {
|
||||
NexiaPlayer nexiaExecutor = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
NexiaPlayer nexiaPlayer = new NexiaPlayer(player);
|
||||
|
||||
if(PlayerDataManager.get(player).gameMode == PlayerGameMode.LOBBY) {
|
||||
GamemodeHandler.spectatePlayer(executor, player);
|
||||
if(nexiaPlayer.isInGameMode(PlayerGameMode.LOBBY)) {
|
||||
GamemodeHandler.spectatePlayer(nexiaExecutor, nexiaPlayer);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(!Permissions.check(executor, "nexia.prefix.supporter")) {
|
||||
factoryExecutor.sendMessage(ChatFormat.nexiaMessage.append(
|
||||
Component.text("This feature is only available for").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
|
||||
if(!nexiaExecutor.hasPermission("nexia.prefix.supporter")) {
|
||||
nexiaExecutor.sendNexiaMessage(
|
||||
Component.text("This feature is only available for", ChatFormat.normalColor)
|
||||
.append(Component.text("Supporters")
|
||||
.color(ChatFormat.brandColor1)
|
||||
.decoration(ChatFormat.bold, true)
|
||||
.hoverEvent(HoverEvent.showText(Component.text("Click me").color(ChatFormat.brandColor1)))
|
||||
.hoverEvent(HoverEvent.showText(Component.text("Click me", ChatFormat.brandColor1)))
|
||||
.clickEvent(ClickEvent.suggestCommand("/ranks")
|
||||
)
|
||||
.append(Component.text("!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text("!", ChatFormat.normalColor))
|
||||
)
|
||||
)
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
if(PlayerDataManager.get(executor).gameMode != PlayerGameMode.FFA) {
|
||||
factoryExecutor.sendMessage(ChatFormat.nexiaMessage.append(
|
||||
Component.text("This can only be used in FFA!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
|
||||
));
|
||||
factoryExecutor.sendMessage(ChatFormat.nexiaMessage.append(
|
||||
Component.text("If you are in duels then you do /spectate <player>.").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
|
||||
));
|
||||
if(LobbyUtil.checkGameModeBan(nexiaExecutor, "ffa")) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!FfaUtil.isFfaPlayer(player)) {
|
||||
factoryExecutor.sendMessage(ChatFormat.nexiaMessage.append(
|
||||
Component.text("That player is not in FFA!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
|
||||
));
|
||||
if(((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(nexiaExecutor)).gameMode != PlayerGameMode.FFA) {
|
||||
nexiaExecutor.sendNexiaMessage("This can only be used in FFA!");
|
||||
nexiaExecutor.sendNexiaMessage("If you are in duels then you do /spectate <player>.");
|
||||
}
|
||||
|
||||
if(!FfaUtil.isFfaPlayer(nexiaPlayer)) {
|
||||
nexiaExecutor.sendNexiaMessage("That player is not in FFA!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Check if player is in combat (or full health), then put them in spectator.
|
||||
|
||||
if(factoryExecutor.getHealth() < 20) {
|
||||
factoryExecutor.sendMessage(ChatFormat.nexiaMessage.append(
|
||||
Component.text("You must be fully healed to go into spectator!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
);
|
||||
if(Math.round(nexiaExecutor.getHealth()) < 20) {
|
||||
nexiaExecutor.sendNexiaMessage("You must be fully healed to go into spectator!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
factoryExecutor.setGameMode(Minecraft.GameMode.SPECTATOR);
|
||||
executor.teleportTo(player.getLevel(), player.getX(), player.getY(), player.getZ(), 0, 0);
|
||||
nexiaExecutor.setGameMode(Minecraft.GameMode.SPECTATOR);
|
||||
nexiaExecutor.teleport(nexiaPlayer.getLocation());
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.nexia.core.commands.player;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.player.CoreSavedPlayerData;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
public class SprintFixCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("sprintfix").executes(SprintFixCommand::run));
|
||||
}
|
||||
|
||||
public static int run(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
NexiaPlayer player = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
CoreSavedPlayerData data = (CoreSavedPlayerData) PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player).savedData;
|
||||
|
||||
player.sendNexiaMessage(Component.text((data.setSprintFix(!data.isSprintFix()) ? "Enabled" : "Disabled") + " Sprint Fix!", ChatFormat.normalColor));
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -1,190 +1,194 @@
|
||||
package com.nexia.core.commands.player;
|
||||
|
||||
import com.combatreforged.factory.api.world.entity.player.Player;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.base.player.SavedPlayerData;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.games.util.LobbyUtil;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerData;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import com.nexia.ffa.FfaGameMode;
|
||||
import com.nexia.ffa.classic.utilities.player.PlayerDataManager;
|
||||
import com.nexia.ffa.classic.utilities.player.SavedPlayerData;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
public class StatsCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("stats").executes(StatsCommand::run)
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.then(Commands.argument("gamemode", StringArgumentType.greedyString())
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("stats").executes(StatsCommand::run)
|
||||
.then(CommandUtils.argument("player", EntityArgument.player())
|
||||
.then(CommandUtils.argument("gamemode", StringArgumentType.greedyString())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((LobbyUtil.statsGameModes), builder)))
|
||||
.executes(context -> StatsCommand.other(context, EntityArgument.getPlayer(context, "player"), StringArgumentType.getString(context, "gamemode")))))
|
||||
.executes(context -> StatsCommand.other(context, context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), true)), StringArgumentType.getString(context, "gamemode")))))
|
||||
);
|
||||
}
|
||||
|
||||
public static int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
|
||||
ServerPlayer mcPlayer = context.getSource().getPlayerOrException();
|
||||
PlayerData executerData = com.nexia.core.utilities.player.PlayerDataManager.get(mcPlayer);
|
||||
Player player = PlayerUtil.getFactoryPlayer(mcPlayer);
|
||||
public static int run(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
NexiaPlayer player = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
CorePlayerData playerData = (CorePlayerData) PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player);
|
||||
|
||||
|
||||
Component start = Component.text(" »").color(NamedTextColor.GRAY);
|
||||
Component start = Component.text(" »").color(ChatFormat.arrowColor);
|
||||
|
||||
Component user = start
|
||||
.append(Component.text(" User: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(player.getRawName()).color(ChatFormat.normalColor))
|
||||
;
|
||||
.append(Component.text(" User: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(player.getRawName(), ChatFormat.normalColor));
|
||||
|
||||
|
||||
|
||||
Component message;
|
||||
|
||||
if(executerData.gameMode == PlayerGameMode.FFA){
|
||||
|
||||
if (playerData.gameMode == PlayerGameMode.FFA) {
|
||||
message = ChatFormat.separatorLine("FFA Classic Stats");
|
||||
SavedPlayerData data = PlayerDataManager.get(mcPlayer).savedData;
|
||||
SavedPlayerData data = PlayerDataManager.getDataManager(NexiaCore.FFA_CLASSIC_DATA_MANAGER).get(player).savedData;
|
||||
|
||||
int kills = data.kills;
|
||||
int deaths = data.deaths;
|
||||
int killstreak = data.killstreak;
|
||||
int bestKillstreak = data.bestKillstreak;
|
||||
|
||||
if(executerData.ffaGameMode == FfaGameMode.KITS) {
|
||||
if (playerData.ffaGameMode == FfaGameMode.KITS) {
|
||||
message = ChatFormat.separatorLine("Kit FFA Stats");
|
||||
com.nexia.ffa.kits.utilities.player.SavedPlayerData kData = com.nexia.ffa.kits.utilities.player.PlayerDataManager.get(mcPlayer).savedData;
|
||||
kills = kData.kills;
|
||||
deaths = kData.deaths;
|
||||
killstreak = kData.killstreak;
|
||||
bestKillstreak = kData.bestKillstreak;
|
||||
data = PlayerDataManager.getDataManager(NexiaCore.FFA_KITS_DATA_MANAGER).get(player).savedData;
|
||||
}
|
||||
|
||||
if(executerData.ffaGameMode == FfaGameMode.UHC) {
|
||||
if (playerData.ffaGameMode == FfaGameMode.UHC) {
|
||||
message = ChatFormat.separatorLine("UHC FFA Stats");
|
||||
com.nexia.ffa.uhc.utilities.player.SavedPlayerData kData = com.nexia.ffa.uhc.utilities.player.PlayerDataManager.get(mcPlayer).savedData;
|
||||
kills = kData.kills;
|
||||
deaths = kData.deaths;
|
||||
killstreak = kData.killstreak;
|
||||
bestKillstreak = kData.bestKillstreak;
|
||||
data = PlayerDataManager.getDataManager(NexiaCore.FFA_UHC_DATA_MANAGER).get(player).savedData;
|
||||
}
|
||||
|
||||
if(executerData.ffaGameMode == FfaGameMode.POT) {
|
||||
message = ChatFormat.separatorLine("Pot FFA Stats");
|
||||
com.nexia.ffa.pot.utilities.player.SavedPlayerData kData = com.nexia.ffa.pot.utilities.player.PlayerDataManager.get(mcPlayer).savedData;
|
||||
kills = kData.kills;
|
||||
deaths = kData.deaths;
|
||||
killstreak = kData.killstreak;
|
||||
bestKillstreak = kData.bestKillstreak;
|
||||
if (playerData.ffaGameMode == FfaGameMode.SKY) {
|
||||
message = ChatFormat.separatorLine("Sky FFA Stats");
|
||||
data = PlayerDataManager.getDataManager(NexiaCore.FFA_SKY_DATA_MANAGER).get(player).savedData;
|
||||
}
|
||||
|
||||
int kills = data.get(Integer.class, "kills");
|
||||
int deaths = data.get(Integer.class, "deaths");
|
||||
int killstreak = data.get(Integer.class, "killstreak");
|
||||
int bestKillstreak = data.get(Integer.class, "bestKillstreak");
|
||||
|
||||
player.sendMessage(message);
|
||||
player.sendMessage(user);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Kills: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(kills).color(ChatFormat.greenColor))
|
||||
.append(Component.text(" Kills: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(kills).color(ChatFormat.greenColor))
|
||||
);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Deaths: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(deaths).color(ChatFormat.failColor))
|
||||
.append(Component.text(" Deaths: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(deaths, ChatFormat.failColor))
|
||||
);
|
||||
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" KDR: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(calculateKDR(kills, deaths)).color(ChatFormat.greenColor))
|
||||
.append(Component.text(" KDR: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(calculateKDR(kills, deaths)).color(ChatFormat.greenColor))
|
||||
);
|
||||
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Killstreak: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(killstreak).color(TextColor.fromHexString("#f5bc42")))
|
||||
.append(Component.text("/").color(ChatFormat.arrowColor))
|
||||
.append(Component.text(bestKillstreak).color(TextColor.fromHexString("#f5bc42")))
|
||||
.append(Component.text(" Killstreak: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(killstreak).color(ChatFormat.goldColor))
|
||||
.append(Component.text("/").color(ChatFormat.arrowColor))
|
||||
.append(Component.text(bestKillstreak).color(ChatFormat.goldColor))
|
||||
);
|
||||
}
|
||||
|
||||
if(executerData.gameMode == PlayerGameMode.LOBBY){
|
||||
if(playerData.gameMode == PlayerGameMode.LOBBY){
|
||||
message = ChatFormat.separatorLine("Duels Stats");
|
||||
com.nexia.minigames.games.duels.util.player.SavedPlayerData data = com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(mcPlayer).savedData;
|
||||
SavedPlayerData data = PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player).savedData;
|
||||
player.sendMessage(message);
|
||||
player.sendMessage(user);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Wins: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.wins).color(ChatFormat.greenColor))
|
||||
.append(Component.text(" Wins: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor))
|
||||
);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Losses: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.loss).color(ChatFormat.failColor))
|
||||
.append(Component.text(" Losses: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if(executerData.gameMode == PlayerGameMode.BEDWARS){
|
||||
if(playerData.gameMode == PlayerGameMode.BEDWARS){
|
||||
message = ChatFormat.separatorLine("Bedwars Stats");
|
||||
com.nexia.minigames.games.bedwars.util.player.SavedPlayerData data = com.nexia.minigames.games.bedwars.util.player.PlayerDataManager.get(mcPlayer).savedData;
|
||||
SavedPlayerData data = PlayerDataManager.getDataManager(NexiaCore.BEDWARS_DATA_MANAGER).get(player).savedData;
|
||||
player.sendMessage(message);
|
||||
player.sendMessage(user);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Wins: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.wins).color(ChatFormat.greenColor))
|
||||
.append(Component.text(" Wins: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor))
|
||||
);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Losses: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.loss).color(ChatFormat.failColor))
|
||||
.append(Component.text(" Losses: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor))
|
||||
);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Beds broken: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.bedsBroken).color(ChatFormat.failColor))
|
||||
.append(Component.text(" Beds broken: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "bedsBroken"), ChatFormat.failColor))
|
||||
);
|
||||
}
|
||||
|
||||
if(executerData.gameMode == PlayerGameMode.OITC){
|
||||
if(playerData.gameMode == PlayerGameMode.OITC){
|
||||
message = ChatFormat.separatorLine("OITC Stats");
|
||||
com.nexia.minigames.games.oitc.util.player.SavedPlayerData data = com.nexia.minigames.games.oitc.util.player.PlayerDataManager.get(mcPlayer).savedData;
|
||||
SavedPlayerData data = PlayerDataManager.getDataManager(NexiaCore.OITC_DATA_MANAGER).get(player).savedData;
|
||||
|
||||
player.sendMessage(message);
|
||||
player.sendMessage(user);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Wins: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.wins).color(ChatFormat.greenColor))
|
||||
.append(Component.text(" Wins: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor))
|
||||
);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Losses: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.loss).color(ChatFormat.failColor))
|
||||
.append(Component.text(" Losses: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor))
|
||||
);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Kills: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.kills).color(ChatFormat.failColor))
|
||||
.append(Component.text(" Kills: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "kills"), ChatFormat.failColor))
|
||||
);
|
||||
}
|
||||
|
||||
if(executerData.gameMode == PlayerGameMode.SKYWARS){
|
||||
message = ChatFormat.separatorLine("SkyWars Stats");
|
||||
com.nexia.minigames.games.skywars.util.player.SavedPlayerData data = com.nexia.minigames.games.skywars.util.player.PlayerDataManager.get(mcPlayer).savedData;
|
||||
if(playerData.gameMode == PlayerGameMode.FOOTBALL){
|
||||
message = ChatFormat.separatorLine("Football Stats");
|
||||
SavedPlayerData data = PlayerDataManager.getDataManager(NexiaCore.FOOTBALL_DATA_MANAGER).get(player).savedData;
|
||||
|
||||
player.sendMessage(message);
|
||||
player.sendMessage(user);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Wins: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.wins).color(ChatFormat.greenColor))
|
||||
.append(Component.text(" Wins: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor))
|
||||
);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Losses: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.losses).color(ChatFormat.failColor))
|
||||
.append(Component.text(" Losses: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor))
|
||||
);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Kills: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.kills).color(ChatFormat.failColor))
|
||||
.append(Component.text(" Goals: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "goals"), ChatFormat.failColor))
|
||||
);
|
||||
}
|
||||
|
||||
if(playerData.gameMode == PlayerGameMode.SKYWARS){
|
||||
message = ChatFormat.separatorLine("SkyWars Stats");
|
||||
SavedPlayerData data = PlayerDataManager.getDataManager(NexiaCore.SKYWARS_DATA_MANAGER).get(player).savedData;
|
||||
|
||||
player.sendMessage(message);
|
||||
player.sendMessage(user);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Wins: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor))
|
||||
);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Losses: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor))
|
||||
);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Kills: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "kills"), ChatFormat.failColor))
|
||||
);
|
||||
}
|
||||
player.sendMessage(ChatFormat.separatorLine(null));
|
||||
@@ -193,160 +197,167 @@ public class StatsCommand {
|
||||
|
||||
public static float calculateKDR(int kills, int deaths){
|
||||
|
||||
if(deaths == 0 || kills == 0) { return 0; }
|
||||
if(deaths <= 0 || kills <= 0) { return 0; }
|
||||
return Float.parseFloat(new DecimalFormat("#.##").format((float) kills / deaths));
|
||||
}
|
||||
|
||||
public static int other(CommandContext<CommandSourceStack> context, ServerPlayer otherPlayer, String gamemode) throws CommandSyntaxException {
|
||||
ServerPlayer mcPlayer = context.getSource().getPlayerOrException();
|
||||
Player player = PlayerUtil.getFactoryPlayer(mcPlayer);
|
||||
public static int other(CommandContext<CommandSourceInfo> context, ServerPlayer otherPlayer, String gamemode) {
|
||||
CommandSourceInfo source = context.getSource();
|
||||
|
||||
Component start = Component.text(" »").color(NamedTextColor.GRAY);
|
||||
Component start = Component.text(" »").color(ChatFormat.arrowColor);
|
||||
|
||||
Component user = start
|
||||
.append(Component.text(" User: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(otherPlayer.getScoreboardName()).color(ChatFormat.normalColor))
|
||||
.append(Component.text(" User: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(otherPlayer.getScoreboardName(), ChatFormat.normalColor))
|
||||
;
|
||||
|
||||
|
||||
|
||||
Component message;
|
||||
|
||||
if(gamemode.equalsIgnoreCase("ffa classic") || gamemode.equalsIgnoreCase("kit ffa")){
|
||||
if (gamemode.equalsIgnoreCase("ffa classic") || gamemode.equalsIgnoreCase("kit ffa") || gamemode.equalsIgnoreCase("sky ffa") || gamemode.equalsIgnoreCase("uhc ffa")){
|
||||
message = ChatFormat.separatorLine("FFA Classic Stats");
|
||||
SavedPlayerData data = PlayerDataManager.get(otherPlayer).savedData;
|
||||
SavedPlayerData data = PlayerDataManager.getDataManager(NexiaCore.FFA_CLASSIC_DATA_MANAGER).get(otherPlayer.getUUID()).savedData;
|
||||
|
||||
int kills = data.kills;
|
||||
int deaths = data.deaths;
|
||||
int killstreak = data.killstreak;
|
||||
int bestKillstreak = data.bestKillstreak;
|
||||
|
||||
if(gamemode.equalsIgnoreCase("kit ffa")) {
|
||||
if (gamemode.equalsIgnoreCase("kit ffa")) {
|
||||
message = ChatFormat.separatorLine("Kit FFA Stats");
|
||||
com.nexia.ffa.kits.utilities.player.SavedPlayerData kData = com.nexia.ffa.kits.utilities.player.PlayerDataManager.get(otherPlayer).savedData;
|
||||
kills = kData.kills;
|
||||
deaths = kData.deaths;
|
||||
killstreak = kData.killstreak;
|
||||
bestKillstreak = kData.bestKillstreak;
|
||||
data = PlayerDataManager.getDataManager(NexiaCore.FFA_KITS_DATA_MANAGER).get(otherPlayer.getUUID()).savedData;
|
||||
}
|
||||
|
||||
if(gamemode.equalsIgnoreCase("pot ffa")) {
|
||||
message = ChatFormat.separatorLine("Pot FFA Stats");
|
||||
com.nexia.ffa.pot.utilities.player.SavedPlayerData kData = com.nexia.ffa.pot.utilities.player.PlayerDataManager.get(otherPlayer).savedData;
|
||||
kills = kData.kills;
|
||||
deaths = kData.deaths;
|
||||
killstreak = kData.killstreak;
|
||||
bestKillstreak = kData.bestKillstreak;
|
||||
if (gamemode.equalsIgnoreCase("sky ffa")) {
|
||||
message = ChatFormat.separatorLine("Sky FFA Stats");
|
||||
data = PlayerDataManager.getDataManager(NexiaCore.FFA_SKY_DATA_MANAGER).get(otherPlayer.getUUID()).savedData;
|
||||
}
|
||||
|
||||
if(gamemode.equalsIgnoreCase("uhc ffa")) {
|
||||
if (gamemode.equalsIgnoreCase("uhc ffa")) {
|
||||
message = ChatFormat.separatorLine("UHC FFA Stats");
|
||||
com.nexia.ffa.uhc.utilities.player.SavedPlayerData kData = com.nexia.ffa.uhc.utilities.player.PlayerDataManager.get(otherPlayer).savedData;
|
||||
kills = kData.kills;
|
||||
deaths = kData.deaths;
|
||||
killstreak = kData.killstreak;
|
||||
bestKillstreak = kData.bestKillstreak;
|
||||
data = PlayerDataManager.getDataManager(NexiaCore.FFA_UHC_DATA_MANAGER).get(otherPlayer.getUUID()).savedData;
|
||||
}
|
||||
|
||||
player.sendMessage(message);
|
||||
player.sendMessage(user);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Kills: ").color(ChatFormat.brandColor2))
|
||||
int kills = data.get(Integer.class, "kills");
|
||||
int deaths = data.get(Integer.class, "deaths");
|
||||
int killstreak = data.get(Integer.class, "killstreak");
|
||||
int bestKillstreak = data.get(Integer.class, "bestKillstreak");
|
||||
|
||||
source.sendMessage(message);
|
||||
source.sendMessage(user);
|
||||
source.sendMessage(start
|
||||
.append(Component.text(" Kills: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(kills).color(ChatFormat.greenColor))
|
||||
);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Deaths: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(deaths).color(ChatFormat.failColor))
|
||||
source.sendMessage(start
|
||||
.append(Component.text(" Deaths: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(deaths, ChatFormat.failColor))
|
||||
);
|
||||
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" KDR: ").color(ChatFormat.brandColor2))
|
||||
source.sendMessage(start
|
||||
.append(Component.text(" KDR: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(calculateKDR(kills, deaths)).color(ChatFormat.greenColor))
|
||||
);
|
||||
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Killstreak: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(killstreak).color(TextColor.fromHexString("#f5bc42")))
|
||||
source.sendMessage(start
|
||||
.append(Component.text(" Killstreak: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(killstreak).color(ChatFormat.goldColor))
|
||||
.append(Component.text("/").color(ChatFormat.arrowColor))
|
||||
.append(Component.text(bestKillstreak).color(TextColor.fromHexString("#f5bc42")))
|
||||
.append(Component.text(bestKillstreak).color(ChatFormat.goldColor))
|
||||
);
|
||||
}
|
||||
|
||||
if(gamemode.equalsIgnoreCase("duels")){
|
||||
message = ChatFormat.separatorLine("Duels Stats");
|
||||
com.nexia.minigames.games.duels.util.player.SavedPlayerData data = com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(otherPlayer).savedData;
|
||||
player.sendMessage(message);
|
||||
player.sendMessage(user);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Wins: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.wins).color(ChatFormat.greenColor))
|
||||
SavedPlayerData data = PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(otherPlayer.getUUID()).savedData;
|
||||
source.sendMessage(message);
|
||||
source.sendMessage(user);
|
||||
source.sendMessage(start
|
||||
.append(Component.text(" Wins: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor))
|
||||
);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Losses: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.loss).color(ChatFormat.failColor))
|
||||
source.sendMessage(start
|
||||
.append(Component.text(" Losses: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if(gamemode.equalsIgnoreCase("bedwars")){
|
||||
message = ChatFormat.separatorLine("Bedwars Stats");
|
||||
com.nexia.minigames.games.bedwars.util.player.SavedPlayerData data = com.nexia.minigames.games.bedwars.util.player.PlayerDataManager.get(otherPlayer).savedData;
|
||||
player.sendMessage(message);
|
||||
player.sendMessage(user);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Wins: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.wins).color(ChatFormat.greenColor))
|
||||
SavedPlayerData data = PlayerDataManager.getDataManager(NexiaCore.BEDWARS_DATA_MANAGER).get(otherPlayer.getUUID()).savedData;
|
||||
source.sendMessage(message);
|
||||
source.sendMessage(user);
|
||||
source.sendMessage(start
|
||||
.append(Component.text(" Wins: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor))
|
||||
);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Losses: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.loss).color(ChatFormat.failColor))
|
||||
source.sendMessage(start
|
||||
.append(Component.text(" Losses: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor))
|
||||
);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Beds broken: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.bedsBroken).color(ChatFormat.failColor))
|
||||
source.sendMessage(start
|
||||
.append(Component.text(" Beds broken: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "bedsBroken"), ChatFormat.failColor))
|
||||
);
|
||||
}
|
||||
|
||||
if(gamemode.equalsIgnoreCase("oitc")){
|
||||
message = ChatFormat.separatorLine("OITC Stats");
|
||||
com.nexia.minigames.games.oitc.util.player.SavedPlayerData data = com.nexia.minigames.games.oitc.util.player.PlayerDataManager.get(otherPlayer).savedData;
|
||||
SavedPlayerData data = PlayerDataManager.getDataManager(NexiaCore.OITC_DATA_MANAGER).get(otherPlayer.getUUID()).savedData;
|
||||
|
||||
player.sendMessage(message);
|
||||
player.sendMessage(user);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Wins: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.wins).color(ChatFormat.greenColor))
|
||||
source.sendMessage(message);
|
||||
source.sendMessage(user);
|
||||
source.sendMessage(start
|
||||
.append(Component.text(" Wins: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor))
|
||||
);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Losses: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.loss).color(ChatFormat.failColor))
|
||||
source.sendMessage(start
|
||||
.append(Component.text(" Losses: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor))
|
||||
);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Kills: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.kills).color(ChatFormat.failColor))
|
||||
source.sendMessage(start
|
||||
.append(Component.text(" Kills: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "kills"), ChatFormat.failColor))
|
||||
);
|
||||
}
|
||||
|
||||
if(gamemode.equalsIgnoreCase("football")){
|
||||
message = ChatFormat.separatorLine("Football Stats");
|
||||
SavedPlayerData data = PlayerDataManager.getDataManager(NexiaCore.FOOTBALL_DATA_MANAGER).get(otherPlayer.getUUID()).savedData;
|
||||
|
||||
source.sendMessage(message);
|
||||
source.sendMessage(user);
|
||||
source.sendMessage(start
|
||||
.append(Component.text(" Wins: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor))
|
||||
);
|
||||
source.sendMessage(start
|
||||
.append(Component.text(" Losses: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor))
|
||||
);
|
||||
source.sendMessage(start
|
||||
.append(Component.text(" Goals: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "goals"), ChatFormat.failColor))
|
||||
);
|
||||
}
|
||||
|
||||
if(gamemode.equalsIgnoreCase("skywars")){
|
||||
message = ChatFormat.separatorLine("SkyWars Stats");
|
||||
com.nexia.minigames.games.skywars.util.player.SavedPlayerData data = com.nexia.minigames.games.skywars.util.player.PlayerDataManager.get(otherPlayer).savedData;
|
||||
SavedPlayerData data = PlayerDataManager.getDataManager(NexiaCore.SKYWARS_DATA_MANAGER).get(otherPlayer.getUUID()).savedData;
|
||||
|
||||
player.sendMessage(message);
|
||||
player.sendMessage(user);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Wins: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.wins).color(ChatFormat.greenColor))
|
||||
source.sendMessage(message);
|
||||
source.sendMessage(user);
|
||||
source.sendMessage(start
|
||||
.append(Component.text(" Wins: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor))
|
||||
);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Losses: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.losses).color(ChatFormat.failColor))
|
||||
source.sendMessage(start
|
||||
.append(Component.text(" Losses: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor))
|
||||
);
|
||||
player.sendMessage(start
|
||||
.append(Component.text(" Kills: ").color(ChatFormat.brandColor2))
|
||||
.append(Component.text(data.kills).color(ChatFormat.failColor))
|
||||
source.sendMessage(start
|
||||
.append(Component.text(" Kills: ", ChatFormat.brandColor2))
|
||||
.append(Component.text(data.get(Integer.class, "kills"), ChatFormat.failColor))
|
||||
);
|
||||
}
|
||||
player.sendMessage(ChatFormat.separatorLine(null));
|
||||
source.sendMessage(ChatFormat.separatorLine(null));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,58 +1,53 @@
|
||||
package com.nexia.core.commands.player.duels;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.gui.duels.DuelGUI;
|
||||
import com.nexia.core.utilities.player.PlayerData;
|
||||
import com.nexia.core.utilities.player.PlayerDataManager;
|
||||
import com.nexia.minigames.Main;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import com.nexia.minigames.games.duels.DuelGameMode;
|
||||
import com.nexia.minigames.games.duels.gamemodes.GamemodeHandler;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import com.nexia.minigames.games.duels.util.player.DuelsPlayerData;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class AcceptDuelCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("acceptduel")
|
||||
.requires(commandSourceStack -> {
|
||||
try {
|
||||
com.nexia.minigames.games.duels.util.player.PlayerData playerData = com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
PlayerData playerData1 = PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
return playerData.gameMode == DuelGameMode.LOBBY && playerData1.gameMode == PlayerGameMode.LOBBY;
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.executes(context -> AcceptDuelCommand.accept(context, EntityArgument.getPlayer(context, "player")))
|
||||
)
|
||||
);
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
register(dispatcher, "acceptduel");
|
||||
register(dispatcher, "acceptchallenge");
|
||||
}
|
||||
|
||||
dispatcher.register(Commands.literal("acceptchallenge")
|
||||
.requires(commandSourceStack -> {
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher, String string) {
|
||||
dispatcher.register(CommandUtils.literal(string)
|
||||
.requires(commandSourceInfo -> {
|
||||
try {
|
||||
com.nexia.minigames.games.duels.util.player.PlayerData playerData = com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
PlayerData playerData1 = PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
NexiaPlayer player = new NexiaPlayer(commandSourceInfo.getPlayerOrException());
|
||||
|
||||
DuelsPlayerData playerData = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player);
|
||||
CorePlayerData playerData1 = (CorePlayerData) PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player);
|
||||
return playerData.gameMode == DuelGameMode.LOBBY && playerData1.gameMode == PlayerGameMode.LOBBY;
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.executes(context -> AcceptDuelCommand.accept(context, EntityArgument.getPlayer(context, "player")))
|
||||
.then(CommandUtils.argument("player", EntityArgument.player())
|
||||
.executes(context -> AcceptDuelCommand.accept(context, context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), true))))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static int accept(CommandContext<CommandSourceStack> context, ServerPlayer player) throws CommandSyntaxException {
|
||||
GamemodeHandler.acceptDuel(context.getSource().getPlayerOrException(), player);
|
||||
|
||||
public static int accept(CommandContext<CommandSourceInfo> context, ServerPlayer player) throws CommandSyntaxException {
|
||||
NexiaPlayer executor = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
GamemodeHandler.acceptDuel(executor, new NexiaPlayer(player));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -3,51 +3,50 @@ package com.nexia.core.commands.player.duels;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.utilities.player.PlayerData;
|
||||
import com.nexia.core.utilities.player.PlayerDataManager;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import com.nexia.minigames.games.duels.DuelGameMode;
|
||||
import com.nexia.minigames.games.duels.gamemodes.GamemodeHandler;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import com.nexia.minigames.games.duels.util.player.DuelsPlayerData;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class DeclineDuelCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("declineduel")
|
||||
.requires(commandSourceStack -> {
|
||||
try {
|
||||
com.nexia.minigames.games.duels.util.player.PlayerData playerData = com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
PlayerData playerData1 = PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
return playerData.gameMode == DuelGameMode.LOBBY && playerData1.gameMode == PlayerGameMode.LOBBY;
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.executes(context -> DeclineDuelCommand.decline(context, EntityArgument.getPlayer(context, "player")))
|
||||
)
|
||||
);
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
register(dispatcher, "declineduel");
|
||||
register(dispatcher, "declinechallenge");
|
||||
}
|
||||
|
||||
dispatcher.register(Commands.literal("declinechallenge")
|
||||
.requires(commandSourceStack -> {
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher, String string) {
|
||||
dispatcher.register(CommandUtils.literal(string)
|
||||
.requires(commandSourceInfo -> {
|
||||
try {
|
||||
com.nexia.minigames.games.duels.util.player.PlayerData playerData = com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
PlayerData playerData1 = PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
NexiaPlayer player = new NexiaPlayer(commandSourceInfo.getPlayerOrException());
|
||||
|
||||
DuelsPlayerData playerData = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player);
|
||||
CorePlayerData playerData1 = (CorePlayerData) PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player);
|
||||
return playerData.gameMode == DuelGameMode.LOBBY && playerData1.gameMode == PlayerGameMode.LOBBY;
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.executes(context -> DeclineDuelCommand.decline(context, EntityArgument.getPlayer(context, "player")))
|
||||
.then(CommandUtils.argument("player", EntityArgument.player())
|
||||
.executes(context -> DeclineDuelCommand.decline(context, context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), true))))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static int decline(CommandContext<CommandSourceStack> context, ServerPlayer player) throws CommandSyntaxException {
|
||||
GamemodeHandler.declineDuel(context.getSource().getPlayerOrException(), player);
|
||||
public static int decline(CommandContext<CommandSourceInfo> context, ServerPlayer player) throws CommandSyntaxException {
|
||||
NexiaPlayer executor = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
GamemodeHandler.declineDuel(executor, new NexiaPlayer(player));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -4,65 +4,65 @@ import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.gui.duels.DuelGUI;
|
||||
import com.nexia.core.utilities.player.PlayerData;
|
||||
import com.nexia.core.utilities.player.PlayerDataManager;
|
||||
import com.nexia.minigames.games.duels.DuelGameHandler;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import com.nexia.minigames.games.duels.DuelGameMode;
|
||||
import com.nexia.minigames.games.duels.map.DuelsMap;
|
||||
import com.nexia.minigames.games.duels.gamemodes.GamemodeHandler;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import com.nexia.minigames.games.duels.map.DuelsMap;
|
||||
import com.nexia.minigames.games.duels.util.player.DuelsPlayerData;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class DuelCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("duel")
|
||||
.requires(commandSourceStack -> {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
register(dispatcher, "duel");
|
||||
register(dispatcher, "challenge");
|
||||
}
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher, String string) {
|
||||
dispatcher.register(CommandUtils.literal(string)
|
||||
.requires(commandSourceInfo -> {
|
||||
try {
|
||||
com.nexia.minigames.games.duels.util.player.PlayerData playerData = com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
PlayerData playerData1 = PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
NexiaPlayer player = new NexiaPlayer(commandSourceInfo.getPlayerOrException());
|
||||
|
||||
DuelsPlayerData playerData = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player);
|
||||
CorePlayerData playerData1 = (CorePlayerData) PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player);
|
||||
return playerData.gameMode == DuelGameMode.LOBBY && playerData1.gameMode == PlayerGameMode.LOBBY;
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.executes(context -> DuelGUI.openDuelGui(context.getSource().getPlayerOrException(), EntityArgument.getPlayer(context, "player")))
|
||||
.then(Commands.argument("gamemode", StringArgumentType.string())
|
||||
.then(CommandUtils.argument("player", EntityArgument.player())
|
||||
.executes(context -> {
|
||||
NexiaPlayer player = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
DuelGUI.openDuelGui(player.unwrap(), context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), true)));
|
||||
return 1;
|
||||
})
|
||||
.then(CommandUtils.argument("gamemode", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((DuelGameMode.stringDuelGameModes), builder)))
|
||||
.executes(context -> DuelCommand.challenge(context, EntityArgument.getPlayer(context, "player"), StringArgumentType.getString(context, "gamemode"), null))
|
||||
.then(Commands.argument("map", StringArgumentType.string())
|
||||
.executes(context -> DuelCommand.challenge(context, context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), true)), StringArgumentType.getString(context, "gamemode"), null))
|
||||
.then(CommandUtils.argument("map", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((DuelsMap.stringDuelsMaps), builder)))
|
||||
.executes(context -> DuelCommand.challenge(context, EntityArgument.getPlayer(context, "player"), StringArgumentType.getString(context, "gamemode"), StringArgumentType.getString(context, "map")))
|
||||
))));
|
||||
dispatcher.register(Commands.literal("challenge")
|
||||
.requires(commandSourceStack -> {
|
||||
try {
|
||||
com.nexia.minigames.games.duels.util.player.PlayerData playerData = com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
PlayerData playerData1 = PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
return playerData.gameMode == DuelGameMode.LOBBY && playerData1.gameMode == PlayerGameMode.LOBBY;
|
||||
} catch (Exception ignored) {}
|
||||
return false;
|
||||
})
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.executes(context -> DuelGUI.openDuelGui(context.getSource().getPlayerOrException(), EntityArgument.getPlayer(context, "player")))
|
||||
.then(Commands.argument("gamemode", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((DuelGameMode.stringDuelGameModes), builder)))
|
||||
.executes(context -> DuelCommand.challenge(context, EntityArgument.getPlayer(context, "player"), StringArgumentType.getString(context, "gamemode"), null))
|
||||
.then(Commands.argument("map", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((DuelsMap.stringDuelsMaps), builder)))
|
||||
.executes(context -> DuelCommand.challenge(context, EntityArgument.getPlayer(context, "player"), StringArgumentType.getString(context, "gamemode"), StringArgumentType.getString(context, "map")))
|
||||
.executes(context -> DuelCommand.challenge(context, context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), true)), StringArgumentType.getString(context, "gamemode"), StringArgumentType.getString(context, "map")))
|
||||
))));
|
||||
}
|
||||
|
||||
public static int challenge(CommandContext<CommandSourceStack> context, ServerPlayer player, String gameMode, @Nullable String map) throws CommandSyntaxException {
|
||||
ServerPlayer executer = context.getSource().getPlayerOrException();
|
||||
GamemodeHandler.challengePlayer(executer, player, gameMode, DuelsMap.identifyMap(map));
|
||||
public static int challenge(CommandContext<CommandSourceInfo> context, ServerPlayer player, String gameMode, @Nullable String map) throws CommandSyntaxException {
|
||||
NexiaPlayer executor = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
GamemodeHandler.challengePlayer(executor, new NexiaPlayer(player), gameMode, DuelsMap.identifyMap(map));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.nexia.core.commands.player.duels;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.item.InventoryUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import com.nexia.minigames.games.duels.DuelGameHandler;
|
||||
import com.nexia.minigames.games.duels.DuelGameMode;
|
||||
import com.nexia.minigames.games.duels.util.player.DuelsPlayerData;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import io.github.blumbo.inventorymerger.saving.SavableInventory;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class KitLayoutCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register((CommandUtils.literal("kitlayout")
|
||||
.requires(commandSourceInfo -> {
|
||||
try {
|
||||
NexiaPlayer player = new NexiaPlayer(commandSourceInfo.getPlayerOrException());
|
||||
|
||||
DuelsPlayerData playerData = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player);
|
||||
CorePlayerData playerData1 = (CorePlayerData) PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player);
|
||||
return playerData.gameMode == DuelGameMode.LOBBY && playerData1.gameMode == PlayerGameMode.LOBBY;
|
||||
} catch (Exception ignored) {}
|
||||
return false;
|
||||
})
|
||||
.then(CommandUtils.argument("argument", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((new String[]{"save", "edit", "reset"}), builder)))
|
||||
.executes(context -> run(context, StringArgumentType.getString(context, "argument"), ""))
|
||||
.then(CommandUtils.argument("inventory", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest(InventoryUtil.getListOfInventories("duels"), builder)))
|
||||
.executes(context -> run(context, StringArgumentType.getString(context, "argument"), StringArgumentType.getString(context, "inventory")))
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private static int run(CommandContext<CommandSourceInfo> context, @NotNull String argument, @NotNull String inventory) throws CommandSyntaxException {
|
||||
NexiaPlayer player = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
if((inventory.trim().isEmpty() || !InventoryUtil.getListOfInventories("duels").contains(inventory.toLowerCase())) && !argument.equalsIgnoreCase("save")) {
|
||||
player.sendMessage(Component.text("Invalid gamemode!", ChatFormat.failColor));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(argument.equalsIgnoreCase("save")) {
|
||||
|
||||
if(((DuelsPlayerData)PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player)).editingLayout.isEmpty()) {
|
||||
player.sendMessage(Component.text("You aren't editing a layout!", ChatFormat.failColor));
|
||||
return 0;
|
||||
}
|
||||
|
||||
inventory = ((DuelsPlayerData)PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player)).editingLayout;
|
||||
|
||||
String path = InventoryUtil.dirpath + File.separator + "duels" + File.separator + "custom" + File.separator + player.getUUID() + File.separator + "layout";
|
||||
Path playerPath = Path.of(path);
|
||||
|
||||
File playerDir = playerPath.toFile();
|
||||
try {
|
||||
if(!playerDir.exists()) Files.createDirectory(playerPath);
|
||||
} catch (IOException ignored) { }
|
||||
|
||||
SavableInventory savableInventory = new SavableInventory(player.unwrap().inventory);
|
||||
String stringInventory = savableInventory.toSave();
|
||||
|
||||
try {
|
||||
String file = path + File.separator + inventory + ".json";
|
||||
FileWriter fileWriter = new FileWriter(file);
|
||||
fileWriter.write(stringInventory);
|
||||
fileWriter.close();
|
||||
} catch (Exception var6) {
|
||||
player.runCommand("/hub", 0, false);
|
||||
player.sendMessage(Component.text(String.format("Failed to save your inventory as '%s'. Please try again or contact a developer.", inventory), ChatFormat.failColor));
|
||||
return 0;
|
||||
}
|
||||
|
||||
player.sendMessage(Component.text(String.format("Successfully saved your inventory as '%s'.", inventory), ChatFormat.brandColor1));
|
||||
player.runCommand("/hub", 0, false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (argument.equalsIgnoreCase("edit")) {
|
||||
|
||||
if(!((DuelsPlayerData)PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player)).editingLayout.isEmpty()) {
|
||||
player.sendMessage(Component.text("You are still editing a layuot! Save it run or run /hub!", ChatFormat.failColor));
|
||||
return 0;
|
||||
}
|
||||
|
||||
DuelGameHandler.loadInventory(player, inventory);
|
||||
|
||||
((DuelsPlayerData)PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player)).editingLayout = inventory;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(argument.equalsIgnoreCase("reset")) {
|
||||
|
||||
File playerFile = new File(InventoryUtil.dirpath + File.separator + "duels" + File.separator + "custom" + File.separator + player.getUUID() + File.separator + "layout" + File.separator + inventory + ".json");
|
||||
if(playerFile.exists() && playerFile.delete()) {
|
||||
player.sendMessage(Component.text(String.format("Successfully reset saved layout '%s'!", inventory), ChatFormat.brandColor1));
|
||||
} else {
|
||||
player.sendMessage(Component.text("Saved Layout does not exist!", ChatFormat.failColor));
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
player.sendMessage(Component.text("Invalid argument!", ChatFormat.failColor));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package com.nexia.core.commands.player.duels;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import com.nexia.minigames.games.duels.DuelGameMode;
|
||||
import com.nexia.minigames.games.duels.team.DuelsTeam;
|
||||
import com.nexia.minigames.games.duels.util.player.DuelsPlayerData;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class PartyCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
register(dispatcher, "party");
|
||||
register(dispatcher, "duelsteam");
|
||||
}
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher, String string) {
|
||||
dispatcher.register(CommandUtils.literal(string)
|
||||
.requires(commandSourceInfo -> {
|
||||
try {
|
||||
NexiaPlayer player = new NexiaPlayer(commandSourceInfo.getPlayerOrException());
|
||||
|
||||
DuelsPlayerData playerData = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player);
|
||||
CorePlayerData playerData1 = (CorePlayerData) PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player);
|
||||
return playerData.gameMode == DuelGameMode.LOBBY && playerData1.gameMode == PlayerGameMode.LOBBY;
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.then(CommandUtils.literal("invite")
|
||||
.then(CommandUtils.argument("player", EntityArgument.player()).executes(context -> PartyCommand.invitePlayer(context, context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), true)))))
|
||||
)
|
||||
.then(CommandUtils.literal("promote")
|
||||
.then(CommandUtils.argument("player", EntityArgument.player()).executes(context -> PartyCommand.promotePlayer(context, context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), true)))))
|
||||
)
|
||||
.then(CommandUtils.literal("join")
|
||||
.then(CommandUtils.argument("player", EntityArgument.player()).executes(context -> PartyCommand.joinTeam(context, context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), true)))))
|
||||
)
|
||||
.then(CommandUtils.literal("kick")
|
||||
.then(CommandUtils.argument("player", EntityArgument.player()).executes(context -> PartyCommand.kickPlayer(context, context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), true)))))
|
||||
)
|
||||
.then(CommandUtils.literal("decline")
|
||||
.then(CommandUtils.argument("player", EntityArgument.player()).executes(context -> PartyCommand.declinePlayer(context, context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), true)))))
|
||||
)
|
||||
.then(CommandUtils.literal("disband").executes(PartyCommand::disbandTeam))
|
||||
.then(CommandUtils.literal("create").executes(PartyCommand::createTeam))
|
||||
.then(CommandUtils.literal("list").executes(PartyCommand::listTeam))
|
||||
.then(CommandUtils.literal("leave").executes(PartyCommand::leaveTeam))
|
||||
);
|
||||
}
|
||||
|
||||
public static int invitePlayer(CommandContext<CommandSourceInfo> context, ServerPlayer player) throws CommandSyntaxException {
|
||||
NexiaPlayer invitor = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
DuelsPlayerData data = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(invitor);
|
||||
|
||||
if(data.duelOptions.duelsTeam == null) {
|
||||
DuelsTeam.createTeam(invitor, false);
|
||||
}
|
||||
data.duelOptions.duelsTeam.invitePlayer(invitor, new NexiaPlayer(player));
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int joinTeam(CommandContext<CommandSourceInfo> context, ServerPlayer player) throws CommandSyntaxException {
|
||||
NexiaPlayer executor = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
((DuelsPlayerData)PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player.getUUID())).duelOptions.duelsTeam.joinTeam(executor);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int listTeam(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
NexiaPlayer executor = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
DuelsPlayerData data = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(executor);
|
||||
|
||||
if(data.duelOptions.duelsTeam == null) {
|
||||
executor.sendMessage(Component.text("You aren't in a team!", ChatFormat.failColor));
|
||||
return 1;
|
||||
}
|
||||
|
||||
data.duelOptions.duelsTeam.listTeam(executor);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int declinePlayer(CommandContext<CommandSourceInfo> context, ServerPlayer player) throws CommandSyntaxException {
|
||||
NexiaPlayer executor = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
((DuelsPlayerData)PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player.getUUID())).duelOptions.duelsTeam.declineTeam(executor);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int createTeam(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
NexiaPlayer player = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
DuelsTeam.createTeam(player, true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int promotePlayer(CommandContext<CommandSourceInfo> context, ServerPlayer player) throws CommandSyntaxException {
|
||||
NexiaPlayer executor = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
DuelsPlayerData data = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(executor);
|
||||
|
||||
if(data.duelOptions.duelsTeam == null) {
|
||||
executor.sendMessage(Component.text("You aren't in a team!", ChatFormat.failColor));
|
||||
return 1;
|
||||
}
|
||||
|
||||
data.duelOptions.duelsTeam.replaceLeader(executor, new NexiaPlayer(player), true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int kickPlayer(CommandContext<CommandSourceInfo> context, ServerPlayer player) throws CommandSyntaxException {
|
||||
NexiaPlayer executor = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
DuelsPlayerData data = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(executor);
|
||||
|
||||
if(data.duelOptions.duelsTeam == null) {
|
||||
executor.sendMessage(Component.text("You aren't in a team!", ChatFormat.failColor));
|
||||
return 1;
|
||||
}
|
||||
|
||||
data.duelOptions.duelsTeam.kickPlayer(executor, new NexiaPlayer(player));
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int disbandTeam(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
NexiaPlayer player = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
DuelsPlayerData data = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player);
|
||||
|
||||
if(data.duelOptions.duelsTeam == null) {
|
||||
player.sendMessage(Component.text("You aren't in a team!", ChatFormat.failColor));
|
||||
return 1;
|
||||
}
|
||||
|
||||
((DuelsPlayerData)PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player)).duelOptions.duelsTeam.disbandTeam(player, true);
|
||||
return 1;
|
||||
}
|
||||
public static int leaveTeam(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
NexiaPlayer player = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
DuelsPlayerData data = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player);
|
||||
|
||||
if(data.duelOptions.duelsTeam == null) {
|
||||
player.sendMessage(Component.text("You aren't in a team!", ChatFormat.failColor));
|
||||
return 1;
|
||||
}
|
||||
|
||||
((DuelsPlayerData)PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player)).duelOptions.duelsTeam.leaveTeam(player, true);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -4,38 +4,49 @@ import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.gui.duels.QueueGUI;
|
||||
import com.nexia.core.utilities.player.PlayerData;
|
||||
import com.nexia.core.utilities.player.PlayerDataManager;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import com.nexia.minigames.games.duels.DuelGameMode;
|
||||
import com.nexia.minigames.games.duels.gamemodes.GamemodeHandler;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import com.nexia.minigames.games.duels.util.player.DuelsPlayerData;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class QueueCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("queue")
|
||||
.requires(commandSourceStack -> {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("queue")
|
||||
.requires(commandSourceInfo -> {
|
||||
try {
|
||||
com.nexia.minigames.games.duels.util.player.PlayerData playerData = com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
PlayerData playerData1 = PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
NexiaPlayer player = new NexiaPlayer(commandSourceInfo.getPlayerOrException());
|
||||
|
||||
DuelsPlayerData playerData = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player);
|
||||
CorePlayerData playerData1 = (CorePlayerData) PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player);
|
||||
return playerData.gameMode == DuelGameMode.LOBBY && playerData1.gameMode == PlayerGameMode.LOBBY;
|
||||
} catch (Exception ignored) {}
|
||||
return false;
|
||||
})
|
||||
.executes(context -> QueueGUI.openQueueGUI(context.getSource().getPlayerOrException()))
|
||||
.then(Commands.argument("gamemode", StringArgumentType.string())
|
||||
.executes(context -> {
|
||||
NexiaPlayer player = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
QueueGUI.openQueueGUI(player.unwrap());
|
||||
return 1;
|
||||
})
|
||||
.then(CommandUtils.argument("gamemode", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((DuelGameMode.stringDuelGameModes), builder)))
|
||||
.executes(context -> QueueCommand.queue(context, StringArgumentType.getString(context, "gamemode"))))
|
||||
);
|
||||
}
|
||||
|
||||
public static int queue(CommandContext<CommandSourceStack> context, String gameMode) throws CommandSyntaxException {
|
||||
ServerPlayer executer = context.getSource().getPlayerOrException();
|
||||
GamemodeHandler.joinQueue(executer, gameMode, false);
|
||||
public static int queue(CommandContext<CommandSourceInfo> context, String gameMode) throws CommandSyntaxException {
|
||||
NexiaPlayer player = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
GamemodeHandler.joinQueue(player, gameMode, false);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -1,178 +0,0 @@
|
||||
package com.nexia.core.commands.player.duels;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerData;
|
||||
import com.nexia.core.utilities.player.PlayerDataManager;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.minigames.games.duels.DuelGameMode;
|
||||
import com.nexia.minigames.games.duels.team.DuelsTeam;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class TeamCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("party")
|
||||
.requires(commandSourceStack -> {
|
||||
try {
|
||||
com.nexia.minigames.games.duels.util.player.PlayerData playerData = com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
PlayerData playerData1 = PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
return playerData.gameMode == DuelGameMode.LOBBY && playerData1.gameMode == PlayerGameMode.LOBBY;
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.then(Commands.literal("invite")
|
||||
.then(Commands.argument("player", EntityArgument.player()).executes(context -> TeamCommand.invitePlayer(context, EntityArgument.getPlayer(context, "player"))))
|
||||
)
|
||||
.then(Commands.literal("promote")
|
||||
.then(Commands.argument("player", EntityArgument.player()).executes(context -> TeamCommand.promotePlayer(context, EntityArgument.getPlayer(context, "player"))))
|
||||
)
|
||||
.then(Commands.literal("join")
|
||||
.then(Commands.argument("player", EntityArgument.player()).executes(context -> TeamCommand.joinTeam(context, EntityArgument.getPlayer(context, "player"))))
|
||||
)
|
||||
.then(Commands.literal("kick")
|
||||
.then(Commands.argument("player", EntityArgument.player()).executes(context -> TeamCommand.kickPlayer(context, EntityArgument.getPlayer(context, "player"))))
|
||||
)
|
||||
.then(Commands.literal("decline")
|
||||
.then(Commands.argument("player", EntityArgument.player()).executes(context -> TeamCommand.declinePlayer(context, EntityArgument.getPlayer(context, "player"))))
|
||||
)
|
||||
.then(Commands.literal("disband").executes(TeamCommand::disbandTeam))
|
||||
.then(Commands.literal("create").executes(TeamCommand::createTeam))
|
||||
.then(Commands.literal("list").executes(TeamCommand::listTeam))
|
||||
.then(Commands.literal("leave").executes(TeamCommand::leaveTeam))
|
||||
);
|
||||
dispatcher.register(Commands.literal("duelsteam")
|
||||
.requires(commandSourceStack -> {
|
||||
try {
|
||||
com.nexia.minigames.games.duels.util.player.PlayerData playerData = com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
PlayerData playerData1 = PlayerDataManager.get(commandSourceStack.getPlayerOrException());
|
||||
return playerData.gameMode == DuelGameMode.LOBBY && playerData1.gameMode == PlayerGameMode.LOBBY;
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.then(Commands.literal("invite")
|
||||
.then(Commands.argument("player", EntityArgument.player()).executes(context -> TeamCommand.invitePlayer(context, EntityArgument.getPlayer(context, "player"))))
|
||||
)
|
||||
.then(Commands.literal("promote")
|
||||
.then(Commands.argument("player", EntityArgument.player()).executes(context -> TeamCommand.promotePlayer(context, EntityArgument.getPlayer(context, "player"))))
|
||||
)
|
||||
.then(Commands.literal("join")
|
||||
.then(Commands.argument("player", EntityArgument.player()).executes(context -> TeamCommand.joinTeam(context, EntityArgument.getPlayer(context, "player"))))
|
||||
)
|
||||
.then(Commands.literal("kick")
|
||||
.then(Commands.argument("player", EntityArgument.player()).executes(context -> TeamCommand.kickPlayer(context, EntityArgument.getPlayer(context, "player"))))
|
||||
)
|
||||
.then(Commands.literal("decline")
|
||||
.then(Commands.argument("player", EntityArgument.player()).executes(context -> TeamCommand.declinePlayer(context, EntityArgument.getPlayer(context, "player"))))
|
||||
)
|
||||
.then(Commands.literal("disband").executes(TeamCommand::disbandTeam))
|
||||
.then(Commands.literal("create").executes(TeamCommand::createTeam))
|
||||
.then(Commands.literal("list").executes(TeamCommand::listTeam))
|
||||
.then(Commands.literal("leave").executes(TeamCommand::leaveTeam))
|
||||
);
|
||||
}
|
||||
|
||||
public static int invitePlayer(CommandContext<CommandSourceStack> context, ServerPlayer player) throws CommandSyntaxException {
|
||||
ServerPlayer invitor = context.getSource().getPlayerOrException();
|
||||
|
||||
com.nexia.minigames.games.duels.util.player.PlayerData data = com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(invitor);
|
||||
|
||||
if(data.duelsTeam == null) {
|
||||
DuelsTeam.createTeam(invitor, false);
|
||||
}
|
||||
data.duelsTeam.invitePlayer(invitor, player);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int joinTeam(CommandContext<CommandSourceStack> context, ServerPlayer player) throws CommandSyntaxException {
|
||||
com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(player).duelsTeam.joinTeam(context.getSource().getPlayerOrException());
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int listTeam(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer executor = context.getSource().getPlayerOrException();
|
||||
|
||||
com.nexia.minigames.games.duels.util.player.PlayerData data = com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(executor);
|
||||
|
||||
if(data.duelsTeam == null) {
|
||||
PlayerUtil.getFactoryPlayer(executor).sendMessage(Component.text("You aren't in a team!").color(ChatFormat.failColor));
|
||||
return 1;
|
||||
}
|
||||
|
||||
data.duelsTeam.listTeam(executor);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int declinePlayer(CommandContext<CommandSourceStack> context, ServerPlayer player) throws CommandSyntaxException {
|
||||
com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(player).duelsTeam.declineTeam(context.getSource().getPlayerOrException());
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int createTeam(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
DuelsTeam.createTeam(context.getSource().getPlayerOrException(), true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int promotePlayer(CommandContext<CommandSourceStack> context, ServerPlayer player) throws CommandSyntaxException {
|
||||
ServerPlayer executor = context.getSource().getPlayerOrException();
|
||||
|
||||
com.nexia.minigames.games.duels.util.player.PlayerData data = com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(executor);
|
||||
|
||||
if(data.duelsTeam == null) {
|
||||
PlayerUtil.getFactoryPlayer(executor).sendMessage(Component.text("You aren't in a team!").color(ChatFormat.failColor));
|
||||
return 1;
|
||||
}
|
||||
|
||||
data.duelsTeam.replaceLeader(executor, player, true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int kickPlayer(CommandContext<CommandSourceStack> context, ServerPlayer player) throws CommandSyntaxException {
|
||||
ServerPlayer executor = context.getSource().getPlayerOrException();
|
||||
|
||||
com.nexia.minigames.games.duels.util.player.PlayerData data = com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(executor);
|
||||
|
||||
if(data.duelsTeam == null) {
|
||||
PlayerUtil.getFactoryPlayer(executor).sendMessage(Component.text("You aren't in a team!").color(ChatFormat.failColor));
|
||||
return 1;
|
||||
}
|
||||
|
||||
data.duelsTeam.kickPlayer(executor, player);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int disbandTeam(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
|
||||
com.nexia.minigames.games.duels.util.player.PlayerData data = com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(player);
|
||||
|
||||
if(data.duelsTeam == null) {
|
||||
PlayerUtil.getFactoryPlayer(player).sendMessage(Component.text("You aren't in a team!").color(ChatFormat.failColor));
|
||||
return 1;
|
||||
}
|
||||
|
||||
com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(player).duelsTeam.disbandTeam(player, true);
|
||||
return 1;
|
||||
}
|
||||
public static int leaveTeam(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
|
||||
com.nexia.minigames.games.duels.util.player.PlayerData data = com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(player);
|
||||
|
||||
if(data.duelsTeam == null) {
|
||||
PlayerUtil.getFactoryPlayer(player).sendMessage(Component.text("You aren't in a team!").color(ChatFormat.failColor));
|
||||
return 1;
|
||||
}
|
||||
|
||||
com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(player).duelsTeam.leaveTeam(player, true);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.nexia.core.commands.player.duels.custom;
|
||||
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.minigames.games.duels.util.player.DuelsPlayerData;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.gui.duels.CustomDuelGUI;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.core.utilities.item.InventoryUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import com.nexia.minigames.games.duels.DuelGameMode;
|
||||
import com.nexia.minigames.games.duels.gamemodes.GamemodeHandler;
|
||||
import com.nexia.minigames.games.duels.map.DuelsMap;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class CustomDuelCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
register(dispatcher, "customduel");
|
||||
register(dispatcher, "customchallenge");
|
||||
}
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher, String string) {
|
||||
dispatcher.register(CommandUtils.literal(string)
|
||||
.requires(commandSourceInfo -> {
|
||||
try {
|
||||
NexiaPlayer player = new NexiaPlayer(commandSourceInfo.getPlayerOrException());
|
||||
|
||||
DuelsPlayerData playerData = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player);
|
||||
CorePlayerData playerData1 = (CorePlayerData) PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player);
|
||||
return playerData.gameMode == DuelGameMode.LOBBY && playerData1.gameMode == PlayerGameMode.LOBBY;
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.then(CommandUtils.argument("player", EntityArgument.player())
|
||||
.executes(context -> {
|
||||
NexiaPlayer player = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
CustomDuelGUI.openDuelGui(player.unwrap(), context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), true)));
|
||||
return 1;
|
||||
})
|
||||
.then(CommandUtils.argument("kit", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((InventoryUtil.getListOfInventories("duels/custom/" + context.getSource().getPlayerOrException().getUUID())), builder)))
|
||||
.executes(context -> CustomDuelCommand.challenge(context, context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), true)), StringArgumentType.getString(context, "kit"), null))
|
||||
.then(CommandUtils.argument("map", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((DuelsMap.stringDuelsMaps), builder)))
|
||||
.executes(context -> CustomDuelCommand.challenge(context, context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), true)), StringArgumentType.getString(context, "kit"), StringArgumentType.getString(context, "map")))
|
||||
))));
|
||||
}
|
||||
|
||||
public static int challenge(CommandContext<CommandSourceInfo> context, ServerPlayer player, String kit, @Nullable String map) throws CommandSyntaxException {
|
||||
NexiaPlayer executor = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
GamemodeHandler.customChallengePlayer(executor, new NexiaPlayer(player), kit, DuelsMap.identifyMap(map));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package com.nexia.core.commands.player.duels.custom;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.natamus.collective_fabric.functions.PlayerFunctions;
|
||||
import com.natamus.collective_fabric.functions.StringFunctions;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.item.InventoryUtil;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import com.nexia.minigames.games.duels.DuelGameMode;
|
||||
import com.nexia.minigames.games.duels.custom.kitroom.kitrooms.CustomKitRoom;
|
||||
import com.nexia.minigames.games.duels.custom.kitroom.kitrooms.KitRoom;
|
||||
import com.nexia.minigames.games.duels.custom.kitroom.kitrooms.SmpKitRoom;
|
||||
import com.nexia.minigames.games.duels.custom.kitroom.kitrooms.VanillaKitRoom;
|
||||
import com.nexia.minigames.games.duels.util.player.DuelsPlayerData;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class KitEditorCommand {
|
||||
|
||||
private static final List<String> slots = Arrays.asList("1", "2", "3", "smp", "vanilla");
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register((CommandUtils.literal("kiteditor")
|
||||
.requires(commandSourceInfo -> {
|
||||
try {
|
||||
NexiaPlayer player = new NexiaPlayer(commandSourceInfo.getPlayerOrException());
|
||||
|
||||
DuelsPlayerData playerData = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player);
|
||||
CorePlayerData playerData1 = (CorePlayerData) PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player);
|
||||
return playerData.gameMode == DuelGameMode.LOBBY && playerData1.gameMode == PlayerGameMode.LOBBY;
|
||||
} catch (Exception ignored) {}
|
||||
return false;
|
||||
})
|
||||
.then(CommandUtils.argument("argument", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((new String[]{"save", "edit", "delete"}), builder)))
|
||||
.executes(context -> run(context, StringArgumentType.getString(context, "argument"), ""))
|
||||
.then(CommandUtils.argument("slot", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest(slots, builder)))
|
||||
.executes(context -> run(context, StringArgumentType.getString(context, "argument"), StringArgumentType.getString(context, "slot")))
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private static int run(CommandContext<CommandSourceInfo> context, @NotNull String argument, String slot) throws CommandSyntaxException {
|
||||
NexiaPlayer player = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
|
||||
if (!slots.contains(slot) && !argument.equalsIgnoreCase("save")) {
|
||||
player.sendMessage(Component.text("Invalid slot!", ChatFormat.failColor));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
String inventory = StringUtils.isNumeric(slot) ? "custom_" + slot : slot;
|
||||
|
||||
if(argument.equalsIgnoreCase("save")) {
|
||||
|
||||
DuelsPlayerData playerData = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player);
|
||||
|
||||
if(playerData.editingKit.isEmpty() || playerData.kitRoom == null) {
|
||||
player.sendMessage(Component.text("You aren't editing a kit!", ChatFormat.failColor));
|
||||
return 0;
|
||||
}
|
||||
|
||||
inventory = ((DuelsPlayerData)PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player)).editingKit;
|
||||
|
||||
String gearstring = PlayerFunctions.getPlayerGearString(player.unwrap());
|
||||
|
||||
Path playerPath = Path.of(InventoryUtil.dirpath + File.separator + "duels" + File.separator + "custom" + File.separator + player.getUUID());
|
||||
File playerDir = playerPath.toFile();
|
||||
try {
|
||||
if(!playerDir.exists()) Files.createDirectory(playerPath);
|
||||
} catch (IOException ignored) { }
|
||||
|
||||
KitRoom kitRoom = playerData.kitRoom;
|
||||
|
||||
if (StringFunctions.sequenceCount(gearstring, "\n") < 40 || !playerDir.exists()) {
|
||||
player.sendMessage(Component.text("Something went wrong while generating the save file content for your inventory.", ChatFormat.failColor));
|
||||
kitRoom.leave();
|
||||
player.runCommand("/hub", 0, false);
|
||||
return 0;
|
||||
} else if (!InventoryUtil.writeGearStringToFile("duels/custom/" + player.getUUID(), inventory, gearstring)) {
|
||||
player.sendMessage(Component.text(String.format("Something went wrong while saving the content of your inventory as '%s'.", inventory), ChatFormat.failColor));
|
||||
|
||||
kitRoom.leave();
|
||||
player.runCommand("/hub", 0, false);
|
||||
return 0;
|
||||
} else {
|
||||
player.sendMessage(Component.text(String.format("Successfully saved your inventory as '%s'.", inventory), ChatFormat.failColor));
|
||||
|
||||
kitRoom.leave();
|
||||
player.runCommand("/hub", 0, false);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (argument.equalsIgnoreCase("edit")) {
|
||||
|
||||
if(!((DuelsPlayerData)PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player)).editingKit.isEmpty()) {
|
||||
player.sendMessage(Component.text("You are still editing a kit! Save it or run /hub!", ChatFormat.failColor));
|
||||
return 0;
|
||||
}
|
||||
|
||||
KitRoom kitRoom;
|
||||
DuelsPlayerData playerData = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player);
|
||||
|
||||
|
||||
switch (slot) {
|
||||
case "1", "2", "3" -> kitRoom = new CustomKitRoom(player);
|
||||
case "vanilla" -> kitRoom = new VanillaKitRoom(player);
|
||||
case "smp" -> kitRoom = new SmpKitRoom(player);
|
||||
default -> {
|
||||
player.sendMessage(Component.text("Something went wrong whilst creating your kit room.", ChatFormat.failColor));
|
||||
player.runCommand("/hub", 0, false);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
playerData.editingKit = inventory;
|
||||
playerData.kitRoom = kitRoom;
|
||||
|
||||
if(kitRoom.generate()) kitRoom.teleport();
|
||||
|
||||
File playerFile = new File(InventoryUtil.dirpath + File.separator + "duels" + File.separator + "custom" + File.separator + player.getUUID(), inventory + ".txt");
|
||||
if(playerFile.exists()) {
|
||||
InventoryUtil.loadInventory(player, "duels/custom/" + player.getUUID(), inventory.toLowerCase());
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(argument.equalsIgnoreCase("delete")) {
|
||||
|
||||
File playerFile = new File(InventoryUtil.dirpath + File.separator + "duels" + File.separator + "custom" + File.separator + player.getUUID(), inventory + ".txt");
|
||||
if(playerFile.exists() && playerFile.delete()) {
|
||||
player.sendMessage(Component.text(String.format("Successfully deleted slot '%s’!", slot), ChatFormat.brandColor1));
|
||||
} else {
|
||||
player.sendMessage(Component.text(String.format("The saved kit for that slot (%s) does not exist!", slot), ChatFormat.failColor));
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
player.sendMessage(Component.text("Invalid argument!", ChatFormat.failColor));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
package com.nexia.core.commands.player.ffa;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.games.util.LobbyUtil;
|
||||
import com.nexia.core.gui.ffa.SpawnGUI;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.ffa.classic.utilities.FfaClassicUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class BiomeCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("biome")
|
||||
.executes(context -> {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
if(!FfaClassicUtil.canGoToSpawn(player)) {
|
||||
PlayerUtil.getFactoryPlayer(player).sendMessage(Component.text("You must be fully healed to change biomes!").color(ChatFormat.failColor));
|
||||
return 1;
|
||||
}
|
||||
LobbyUtil.sendGame(player, "classic ffa", false, true);
|
||||
run(context);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("biome", StringArgumentType.greedyString())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest(SpawnGUI.mapLocations.keySet(), builder)))
|
||||
.executes(context -> {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
if(!FfaClassicUtil.canGoToSpawn(player)) {
|
||||
PlayerUtil.getFactoryPlayer(player).sendMessage(Component.text("You must be fully healed to change biomes!").color(ChatFormat.failColor));
|
||||
return 1;
|
||||
}
|
||||
LobbyUtil.sendGame(player, "classic ffa", false, true);
|
||||
selectedMap(context);
|
||||
return 1;
|
||||
})
|
||||
)
|
||||
);
|
||||
dispatcher.register(Commands.literal("spawn")
|
||||
.executes(context -> {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
if(!FfaClassicUtil.canGoToSpawn(player)) {
|
||||
PlayerUtil.getFactoryPlayer(player).sendMessage(Component.text("You must be fully healed to change biomes!").color(ChatFormat.failColor));
|
||||
return 1;
|
||||
}
|
||||
LobbyUtil.sendGame(player, "classic ffa", false, true);
|
||||
run(context);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("biome", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest(SpawnGUI.mapLocations.keySet(), builder)))
|
||||
.executes(context -> {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
if(!FfaClassicUtil.canGoToSpawn(player)) {
|
||||
PlayerUtil.getFactoryPlayer(player).sendMessage(Component.text("You must be fully healed to change biomes!").color(ChatFormat.failColor));
|
||||
return 1;
|
||||
}
|
||||
LobbyUtil.sendGame(player, "classic ffa", false, true);
|
||||
selectedMap(context);
|
||||
return 1;
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static void run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer executer = context.getSource().getPlayerOrException();
|
||||
SpawnGUI.openSpawnGUI(executer);
|
||||
}
|
||||
|
||||
public static void selectedMap(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
SpawnGUI.teleportPlayer(context.getSource().getPlayerOrException(), StringArgumentType.getString(context, "biome"));
|
||||
}
|
||||
}
|
||||
@@ -2,57 +2,54 @@ package com.nexia.core.commands.player.ffa;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.games.util.LobbyUtil;
|
||||
import com.nexia.core.gui.ffa.KitGUI;
|
||||
import com.nexia.core.gui.ffa.SpawnGUI;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.ffa.classic.utilities.FfaClassicUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.ffa.kits.FfaKit;
|
||||
import com.nexia.ffa.kits.utilities.FfaKitsUtil;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class KitCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("kit")
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("kit")
|
||||
.executes(context -> {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
if(!FfaKitsUtil.canGoToSpawn(player)) {
|
||||
PlayerUtil.getFactoryPlayer(player).sendMessage(Component.text("You must be fully healed to change kits!").color(ChatFormat.failColor));
|
||||
return 1;
|
||||
NexiaPlayer player = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
if(!FfaKitsUtil.INSTANCE.canGoToSpawn(player)) {
|
||||
player.sendMessage(Component.text("You must be fully healed to change kits!", ChatFormat.failColor));
|
||||
return 0;
|
||||
}
|
||||
LobbyUtil.sendGame(player, "kits ffa", false, true);
|
||||
run(context);
|
||||
run(player.unwrap());
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("inventory", StringArgumentType.greedyString())
|
||||
.then(CommandUtils.argument("inventory", StringArgumentType.greedyString())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest(FfaKit.stringFfaKits, builder)))
|
||||
.executes(context -> {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
if(!FfaKitsUtil.canGoToSpawn(player)) {
|
||||
PlayerUtil.getFactoryPlayer(player).sendMessage(Component.text("You must be fully healed to change kits!").color(ChatFormat.failColor));
|
||||
NexiaPlayer player = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
if(!FfaKitsUtil.INSTANCE.canGoToSpawn(player)) {
|
||||
player.sendMessage(Component.text("You must be fully healed to change kits!", ChatFormat.failColor));
|
||||
return 1;
|
||||
}
|
||||
|
||||
LobbyUtil.sendGame(player, "kits ffa", false, true);
|
||||
selectedMap(context);
|
||||
selectedMap(player.unwrap(), StringArgumentType.getString(context, "inventory"));
|
||||
return 1;
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static void run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
KitGUI.openKitGUI(context.getSource().getPlayerOrException());
|
||||
public static void run(ServerPlayer player) throws CommandSyntaxException {
|
||||
KitGUI.openKitGUI(player);
|
||||
}
|
||||
|
||||
public static void selectedMap(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
KitGUI.giveKit(context.getSource().getPlayerOrException(), StringArgumentType.getString(context, "inventory"));
|
||||
public static void selectedMap(ServerPlayer player, String inventory) {
|
||||
KitGUI.giveKit(player, inventory);
|
||||
}
|
||||
}
|
||||
@@ -3,82 +3,71 @@ package com.nexia.core.commands.staff;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.Main;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.chat.LegacyChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import com.nexia.discord.NexiaDiscord;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.GameProfileArgument;
|
||||
import net.minecraft.network.chat.ComponentUtils;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.players.UserBanList;
|
||||
import net.minecraft.server.players.UserBanListEntry;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
public class BanCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("ban")
|
||||
.requires(commandSourceStack -> PlayerUtil.hasPermission(commandSourceStack, "nexia.staff.ban", 3))
|
||||
.then(Commands.argument("player", GameProfileArgument.gameProfile())
|
||||
.executes(context -> BanCommand.ban(context.getSource(), GameProfileArgument.getGameProfiles(context, "player"), "No reason specified."))
|
||||
.then(Commands.argument("reason", StringArgumentType.greedyString())
|
||||
.executes(context -> BanCommand.ban(context.getSource(), GameProfileArgument.getGameProfiles(context, "player"), StringArgumentType.getString(context, "reason"))))
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("ban")
|
||||
.requires(commandSourceInfo -> CommandUtil.hasPermission(commandSourceInfo, "nexia.staff.ban", 3))
|
||||
.then(CommandUtils.argument("player", GameProfileArgument.gameProfile())
|
||||
.executes(context -> BanCommand.ban(context.getSource(), context.getArgument("player", GameProfileArgument.Result.class).getNames(CommandUtil.getCommandSourceStack(context.getSource(), false)), "No reason specified."))
|
||||
.then(CommandUtils.argument("reason", StringArgumentType.greedyString())
|
||||
.executes(context -> BanCommand.ban(context.getSource(), context.getArgument("player", GameProfileArgument.Result.class).getNames(CommandUtil.getCommandSourceStack(context.getSource(), false)), StringArgumentType.getString(context, "reason"))))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static int ban(CommandSourceStack context, Collection<GameProfile> collection, String reason) {
|
||||
public static int ban(CommandSourceInfo context, Collection<GameProfile> collection, String reason) {
|
||||
UserBanList userBanList = ServerTime.minecraftServer.getPlayerList().getBans();
|
||||
int i = 0;
|
||||
|
||||
ServerPlayer player = null;
|
||||
|
||||
try {
|
||||
player = context.getPlayerOrException();
|
||||
} catch (Exception ignored){ }
|
||||
|
||||
for (GameProfile gameProfile : collection) {
|
||||
if (!userBanList.isBanned(gameProfile)) {
|
||||
ServerPlayer serverPlayer = ServerTime.minecraftServer.getPlayerList().getPlayer(gameProfile.getId());
|
||||
NexiaPlayer nexiaPlayer = new NexiaPlayer(serverPlayer);
|
||||
|
||||
UserBanListEntry userBanListEntry = new UserBanListEntry(gameProfile, (Date) null, context.getTextName(), (Date) null, reason);
|
||||
UserBanListEntry userBanListEntry = new UserBanListEntry(gameProfile, null, null, null, reason);
|
||||
userBanList.add(userBanListEntry);
|
||||
++i;
|
||||
if(player != null){
|
||||
PlayerUtil.getFactoryPlayer(player).sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have banned ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(ComponentUtils.getDisplayName(gameProfile).getString()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(" for ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(reason).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false))
|
||||
);
|
||||
context.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have banned ", ChatFormat.normalColor))
|
||||
.append(Component.text(ComponentUtils.getDisplayName(gameProfile).getString(), ChatFormat.brandColor2))
|
||||
.append(Component.text(" for ", ChatFormat.normalColor))
|
||||
.append(Component.text(reason, ChatFormat.brandColor2))
|
||||
);
|
||||
|
||||
} else {
|
||||
context.sendSuccess(LegacyChatFormat.format("{b1}You have banned {b2}{} {b1}for {b2}{}", ComponentUtils.getDisplayName(gameProfile).getString(), reason), true);
|
||||
}
|
||||
|
||||
if (serverPlayer != null) {
|
||||
serverPlayer.connection.disconnect(new TextComponent("§c§lYou have been banned.\n§7Reason: §d" + reason + "\n§7You can appeal your ban at §d" + com.nexia.discord.Main.config.discordLink));
|
||||
nexiaPlayer.disconnect(Component.text("You have been banned.", ChatFormat.failColor)
|
||||
.append(Component.text("\nReason: ", ChatFormat.systemColor))
|
||||
.append(Component.text(reason, ChatFormat.brandColor2))
|
||||
.append(Component.text("\nYou can appeal your ban at ", ChatFormat.systemColor))
|
||||
.append(Component.text(NexiaDiscord.config.discordLink, ChatFormat.brandColor2))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
if(player != null){
|
||||
PlayerUtil.getFactoryPlayer(player).sendMessage(
|
||||
ChatFormat.nexiaMessage.append(Component.text("That player is already banned.").color(ChatFormat.failColor))
|
||||
);
|
||||
} else {
|
||||
context.sendFailure(LegacyChatFormat.formatFail("That player is already banned."));
|
||||
}
|
||||
|
||||
context.sendMessage(
|
||||
ChatFormat.nexiaMessage.append(Component.text("That player is already banned.", ChatFormat.failColor))
|
||||
);
|
||||
} else {
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.nexia.core.commands.staff;
|
||||
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class DetectCommand {
|
||||
|
||||
public static final boolean enabled = false;
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
if(!enabled) return;
|
||||
dispatcher.register(CommandUtils.literal("detect")
|
||||
.requires(commandSourceInfo -> CommandUtil.hasPermission(commandSourceInfo, "nexia.dev.detect", 4))
|
||||
.executes(DetectCommand::run)
|
||||
);
|
||||
}
|
||||
|
||||
public static int run(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
if(!enabled) return 0;
|
||||
|
||||
detect(new NexiaPlayer(context.getSource().getPlayerOrException()));
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static void detect(NexiaPlayer attacker) {
|
||||
|
||||
String botName = ".bot";
|
||||
|
||||
List<Player> playersNearby = attacker.unwrap().level.getEntitiesOfClass(ServerPlayer.class, attacker.unwrap().getBoundingBox().inflate(12, 0.25, 12));
|
||||
Vec3 eyePos = attacker.unwrap().getEyePosition(1);
|
||||
AtomicReference<Vec3> nearestPosition = new AtomicReference<>();
|
||||
playersNearby.forEach(player -> {
|
||||
Vec3 currentPos = player.getBoundingBox().getNearestPointTo(eyePos);
|
||||
if(nearestPosition.get() == null || nearestPosition.get().distanceToSqr(eyePos) > currentPos.distanceToSqr(eyePos))
|
||||
nearestPosition.set(currentPos);
|
||||
});
|
||||
if(nearestPosition.get() != null) {
|
||||
Vec3 nearestPos = nearestPosition.get();
|
||||
ServerTime.nexusServer.runCommand("/player " + botName + " look at " + nearestPos.x + " " + nearestPos.y + " " + nearestPos.z, 4, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.nexia.core.commands.staff;
|
||||
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.core.utilities.player.BanHandler;
|
||||
import com.nexia.core.utilities.player.GamemodeBanHandler;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class GamemodeBanCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("gamemodeban")
|
||||
.requires(commandSourceInfo -> CommandUtil.hasPermission(commandSourceInfo, "nexia.staff.ban", 3))
|
||||
.then(CommandUtils.argument("player", EntityArgument.player())
|
||||
.then(CommandUtils.argument("gamemode", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((PlayerGameMode.stringPlayerGameModes), builder)))
|
||||
.then(CommandUtils.argument("duration", StringArgumentType.word())
|
||||
.then(CommandUtils.argument("reason", StringArgumentType.greedyString())
|
||||
.executes(context -> GamemodeBanCommand.ban(context.getSource(), context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), false)), StringArgumentType.getString(context, "gamemode"), StringArgumentType.getString(context, "reason"), StringArgumentType.getString(context, "duration"))))
|
||||
)
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
public static int ban(CommandSourceInfo sender, ServerPlayer player, String stringGameMode, String reason, String durationArg) {
|
||||
|
||||
PlayerGameMode gameMode = PlayerGameMode.identifyGamemode(stringGameMode);
|
||||
if(gameMode == null) {
|
||||
|
||||
sender.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("Invalid gamemode!", ChatFormat.normalColor))
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int durationInSeconds;
|
||||
try {
|
||||
durationInSeconds = BanHandler.parseTimeArg(durationArg);
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("Invalid duration. Examples: ", ChatFormat.normalColor))
|
||||
.append(Component.text("1s / 2m / 3h / 4d / 5w", ChatFormat.failColor))
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
GamemodeBanHandler.tryGamemodeBan(sender, new NexiaPlayer(player), gameMode, durationInSeconds, reason);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -1,68 +1,53 @@
|
||||
package com.nexia.core.commands.staff;
|
||||
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.chat.LegacyChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class HealCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("heal").executes(HealCommand::run)
|
||||
.requires(commandSourceStack -> PlayerUtil.hasPermission(commandSourceStack, "nexia.staff.heal", 1))
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.executes(context -> HealCommand.heal(context, EntityArgument.getPlayer(context, "player")))
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("heal").executes(HealCommand::run)
|
||||
.requires(commandSourceInfo -> CommandUtil.hasPermission(commandSourceInfo, "nexia.staff.heal", 1))
|
||||
.then(CommandUtils.argument("player", EntityArgument.player())
|
||||
.executes(context -> HealCommand.heal(context, context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), false))))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer executer = context.getSource().getPlayerOrException();
|
||||
executer.heal(executer.getMaxHealth());
|
||||
public static int run(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
NexiaPlayer executor = new NexiaPlayer(context.getSource().getPlayerOrException());
|
||||
executor.setHealth(executor.getMaxHealth());
|
||||
|
||||
|
||||
PlayerUtil.getFactoryPlayer(executer).sendMessage(
|
||||
executor.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have been healed.").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text("You have been healed.", ChatFormat.normalColor))
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int heal(CommandContext<CommandSourceStack> context, ServerPlayer otherPlayer) {
|
||||
CommandSourceStack executer = context.getSource();
|
||||
public static int heal(CommandContext<CommandSourceInfo> context, ServerPlayer otherPlayer) {
|
||||
otherPlayer.heal(otherPlayer.getMaxHealth());
|
||||
|
||||
ServerPlayer player = null;
|
||||
try {
|
||||
player = executer.getPlayerOrException();
|
||||
|
||||
} catch(Exception ignored) { }
|
||||
context.getSource().sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have healed ", ChatFormat.normalColor))
|
||||
.append(Component.text(otherPlayer.getScoreboardName(), ChatFormat.brandColor2))
|
||||
.append(Component.text(".", ChatFormat.normalColor))
|
||||
);
|
||||
|
||||
|
||||
if(player != null){
|
||||
PlayerUtil.getFactoryPlayer(player).sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have healed ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(otherPlayer.getScoreboardName()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
);
|
||||
} else {
|
||||
executer.sendSuccess(LegacyChatFormat.format("{b1}You have healed {b2}{}{b1}.", otherPlayer.getScoreboardName()), false);
|
||||
}
|
||||
|
||||
|
||||
PlayerUtil.getFactoryPlayer(otherPlayer).sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have been healed.").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
);
|
||||
|
||||
new NexiaPlayer(otherPlayer).sendNexiaMessage("You have been healed.");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.nexia.core.commands.staff;
|
||||
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.item.InventoryUtil;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ListInventoriesCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register((CommandUtils.literal("listinventories")
|
||||
.requires(commandSourceInfo -> CommandUtil.hasPermission(commandSourceInfo, "nexia.inventory.list", 4))
|
||||
.then(CommandUtils.argument("type", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((Objects.requireNonNull(new File(InventoryUtil.dirpath).list())), builder)))
|
||||
.executes(ListInventoriesCommand::run)
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
private static int run(CommandContext<CommandSourceInfo> context){
|
||||
|
||||
String type = StringArgumentType.getString(context, "type");
|
||||
if(type.trim().isEmpty()) {
|
||||
context.getSource().sendMessage(Component.text("Empty type!", ChatFormat.failColor));
|
||||
return 0;
|
||||
}
|
||||
|
||||
context.getSource().sendMessage(Component.text("Saved Inventories: ", ChatFormat.normalColor)
|
||||
.append(Component.text(InventoryUtil.getListOfInventoriesString(type), ChatFormat.brandColor2))
|
||||
.append(Component.text(".", ChatFormat.normalColor))
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,98 +1,81 @@
|
||||
package com.nexia.core.commands.staff;
|
||||
|
||||
import com.combatreforged.factory.api.world.entity.player.Player;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import com.nexia.ffa.classic.utilities.FfaAreas;
|
||||
import com.nexia.core.utilities.world.WorldUtil;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.nexia.nexus.api.world.entity.player.Player;
|
||||
import com.nexia.nexus.api.world.util.Location;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.commands.arguments.ResourceLocationArgument;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.Difficulty;
|
||||
import net.minecraft.world.level.GameRules;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.biome.Biomes;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import xyz.nucleoid.fantasy.RuntimeWorldConfig;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import java.io.File;
|
||||
import static net.minecraft.server.commands.LocateBiomeCommand.ERROR_INVALID_BIOME;
|
||||
|
||||
public class MapCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register((Commands.literal("map")
|
||||
.requires(commandSourceStack -> {
|
||||
try {
|
||||
return PlayerUtil.hasPermission(commandSourceStack, "nexia.staff.map", 2);
|
||||
} catch (Exception ignored) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.then(Commands.argument("type", StringArgumentType.string())
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register((CommandUtils.literal("map")
|
||||
.requires(commandSourceInfo -> CommandUtil.hasPermission(commandSourceInfo, "nexia.staff.map", 2))
|
||||
.then(CommandUtils.argument("type", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((new String[]{"delete", "create", "tp"}), builder)))
|
||||
.then(Commands.argument("map", StringArgumentType.greedyString())
|
||||
.executes(MapCommand::run)
|
||||
.then(CommandUtils.argument("map", ResourceLocationArgument.id())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((WorldUtil.getAllWorldsId()), builder)))
|
||||
.executes((context -> run(context, StringArgumentType.getString(context, "type"), context.getArgument("map", ResourceLocation.class), Biomes.THE_VOID)))
|
||||
.then(CommandUtils.argument("biome", ResourceLocationArgument.id())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggestResource((ServerTime.minecraftServer.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY).keySet()), builder)))
|
||||
.executes((context -> run(context, StringArgumentType.getString(context, "type"), context.getArgument("map", ResourceLocation.class), context.getArgument("biome", ResourceLocation.class))))
|
||||
)
|
||||
)
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
private static int run(CommandContext<CommandSourceStack> context) {
|
||||
ServerPlayer mcPlayer = null;
|
||||
Player player = null;
|
||||
private static int run(CommandContext<CommandSourceInfo> context, String type, ResourceLocation map, ResourceLocation biomeLocation) throws CommandSyntaxException {
|
||||
// check if biome is valid
|
||||
ServerTime.minecraftServer.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY).getOptional(biomeLocation).orElseThrow(() -> ERROR_INVALID_BIOME.create(biomeLocation));
|
||||
|
||||
try {
|
||||
mcPlayer = context.getSource().getPlayerOrException();
|
||||
player = PlayerUtil.getFactoryPlayer(mcPlayer);
|
||||
} catch (Exception ignored) { }
|
||||
|
||||
|
||||
String type = StringArgumentType.getString(context, "type");
|
||||
String map = StringArgumentType.getString(context, "map");
|
||||
|
||||
if(ChatFormat.hasWhiteSpacesOrSpaces(map) || ChatFormat.hasWhiteSpacesOrSpaces(type)) {
|
||||
if(player != null) {
|
||||
player.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("Invalid name!").color(ChatFormat.failColor).decoration(ChatFormat.bold, false))
|
||||
);
|
||||
}
|
||||
return run(context, type, map, ResourceKey.create(Registry.BIOME_REGISTRY, biomeLocation));
|
||||
}
|
||||
|
||||
private static int run(CommandContext<CommandSourceInfo> context, String type, ResourceLocation map, @NotNull ResourceKey<Biome> biome) {
|
||||
NexiaPlayer player = null;
|
||||
if(context.getSource().getExecutingEntity() instanceof Player nexusPlayer) {
|
||||
player = new NexiaPlayer(nexusPlayer);
|
||||
}
|
||||
|
||||
if(map == null || map.toString().trim().isEmpty() || type.trim().isEmpty()) {
|
||||
context.getSource().sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("Invalid name!", ChatFormat.failColor))
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
String[] mapname = map.split(":");
|
||||
|
||||
if(type.equalsIgnoreCase("create")){
|
||||
|
||||
ServerLevel level = ServerTime.fantasy.getOrOpenPersistentWorld(ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(mapname[0], mapname[1])).location(), (
|
||||
new RuntimeWorldConfig()
|
||||
.setDimensionType(FfaAreas.ffaWorld.dimensionType())
|
||||
.setGenerator(FfaAreas.ffaWorld.getChunkSource().getGenerator())
|
||||
.setDifficulty(Difficulty.HARD)
|
||||
.setGameRule(GameRules.RULE_KEEPINVENTORY, false)
|
||||
.setGameRule(GameRules.RULE_MOBGRIEFING, false)
|
||||
.setGameRule(GameRules.RULE_WEATHER_CYCLE, false)
|
||||
.setGameRule(GameRules.RULE_DAYLIGHT, false)
|
||||
.setGameRule(GameRules.RULE_DO_IMMEDIATE_RESPAWN, false)
|
||||
.setGameRule(GameRules.RULE_DOMOBSPAWNING, false)
|
||||
.setGameRule(GameRules.RULE_SHOWDEATHMESSAGES, false)
|
||||
.setGameRule(GameRules.RULE_SPAWN_RADIUS, 0))).asWorld();
|
||||
ServerLevel level = ServerTime.fantasy.getOrOpenPersistentWorld(ResourceKey.create(Registry.DIMENSION_REGISTRY, map).location(), (WorldUtil.defaultWorldConfig.setGenerator(WorldUtil.getChunkGenerator(biome)))).asWorld();
|
||||
|
||||
if (mcPlayer != null && player != null) {
|
||||
mcPlayer.teleportTo(level, 0, 80, 0, 0, 0);
|
||||
if (player != null) {
|
||||
player.teleport(new Location(0, 80, 0, 0, 0, WorldUtil.getWorld(level)));
|
||||
|
||||
player.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("Created map called: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(map).color(ChatFormat.brandColor2))
|
||||
player.sendNexiaMessage(
|
||||
Component.text("Created map called: ", ChatFormat.normalColor)
|
||||
.append(Component.text(map.toString(), ChatFormat.brandColor2))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -101,31 +84,29 @@ public class MapCommand {
|
||||
}
|
||||
|
||||
if (type.equalsIgnoreCase("delete")) {
|
||||
ServerTime.fantasy.getOrOpenPersistentWorld(ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(mapname[0], mapname[1])).location(), null).delete();
|
||||
ServerTime.fantasy.getOrOpenPersistentWorld(ResourceKey.create(Registry.DIMENSION_REGISTRY, map).location(), null).delete();
|
||||
if(player != null) {
|
||||
player.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("Deleted map called: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(map).color(ChatFormat.brandColor2))
|
||||
player.sendNexiaMessage(
|
||||
Component.text("Deleted map called: ", ChatFormat.normalColor)
|
||||
.append(Component.text(map.toString(), ChatFormat.brandColor2))
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
FileUtils.forceDeleteOnExit(new File("/world/dimensions/" + mapname[0], mapname[1]));
|
||||
FileUtils.forceDeleteOnExit(new File("/world/dimensions/" + map.getNamespace(), map.getPath()));
|
||||
} catch (Exception ignored) { }
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(type.equalsIgnoreCase("tp")) {
|
||||
ServerLevel level = ServerTime.fantasy.getOrOpenPersistentWorld(ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(mapname[0], mapname[1])).location(), null).asWorld();
|
||||
ServerLevel level = ServerTime.fantasy.getOrOpenPersistentWorld(ResourceKey.create(Registry.DIMENSION_REGISTRY, map).location(), null).asWorld();
|
||||
|
||||
if(mcPlayer != null && player != null) {
|
||||
mcPlayer.teleportTo(level, 0, 80, 0, 0, 0);
|
||||
if(player != null) {
|
||||
player.teleport(new Location(0, 80, 0, 0, 0, WorldUtil.getWorld(level)));
|
||||
|
||||
player.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("Teleported to map called: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(map).color(ChatFormat.brandColor2))
|
||||
player.sendNexiaMessage(
|
||||
Component.text("Teleported to map called: ", ChatFormat.normalColor)
|
||||
.append(Component.text(map.toString(), ChatFormat.brandColor2))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
package com.nexia.core.commands.staff;
|
||||
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.chat.LegacyChatFormat;
|
||||
import com.nexia.core.utilities.chat.PlayerMutes;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class MuteCommand {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("mute")
|
||||
.requires(commandSourceStack -> PlayerUtil.hasPermission(commandSourceStack, "nexia.staff.mute", 1))
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.then(Commands.argument("duration", StringArgumentType.word())
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("mute")
|
||||
.requires(commandSourceInfo -> CommandUtil.hasPermission(commandSourceInfo, "nexia.staff.mute", 1))
|
||||
.then(CommandUtils.argument("player", EntityArgument.player())
|
||||
.then(CommandUtils.argument("duration", StringArgumentType.word())
|
||||
.executes(context -> MuteCommand.mute(context, StringArgumentType.getString(context, "duration"), "No reason specified."))
|
||||
.then(Commands.argument("reason", StringArgumentType.greedyString())
|
||||
.then(CommandUtils.argument("reason", StringArgumentType.greedyString())
|
||||
.executes(context -> MuteCommand.mute(context,
|
||||
StringArgumentType.getString(context, "duration"),
|
||||
StringArgumentType.getString(context, "reason"))
|
||||
@@ -36,32 +36,25 @@ public class MuteCommand {
|
||||
);
|
||||
}
|
||||
|
||||
public static int mute(CommandContext<CommandSourceStack> context, String durationArg, String reason) throws CommandSyntaxException {
|
||||
public static int mute(CommandContext<CommandSourceInfo> context, String durationArg, String reason) throws CommandSyntaxException {
|
||||
|
||||
CommandSourceStack sender = context.getSource();
|
||||
ServerPlayer muted = EntityArgument.getPlayer(context, "player");
|
||||
|
||||
ServerPlayer player;
|
||||
CommandSourceInfo sender = context.getSource();
|
||||
ServerPlayer muted = context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), false));
|
||||
|
||||
int durationInSeconds;
|
||||
try {
|
||||
durationInSeconds = parseTimeArg(durationArg);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
player = sender.getPlayerOrException();
|
||||
PlayerUtil.getFactoryPlayer(player).sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("Invalid duration. Examples: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text("1s / 2m / 3h").color(ChatFormat.failColor).decoration(ChatFormat.bold, false))
|
||||
);
|
||||
} catch(Exception ignored) {
|
||||
sender.sendFailure(LegacyChatFormat.format("{f}Invalid duration. Examples: 1s / 2m / 3h"));
|
||||
}
|
||||
|
||||
context.getSource().sendMessage(ChatFormat.nexiaMessage
|
||||
.append(Component.text("Invalid duration. Examples: ", ChatFormat.normalColor))
|
||||
.append(Component.text("1s / 2m / 3h / 4d / 5w", ChatFormat.failColor))
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
PlayerMutes.mute(sender, muted, durationInSeconds * 1000, reason);
|
||||
PlayerMutes.mute(sender, muted, durationInSeconds, reason);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -84,6 +77,8 @@ public class MuteCommand {
|
||||
units.put("s", 1);
|
||||
units.put("m", 60);
|
||||
units.put("h", 3600);
|
||||
units.put("d", 86400);
|
||||
units.put("w", 604800);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,84 +1,58 @@
|
||||
package com.nexia.core.commands.staff;
|
||||
|
||||
import com.combatreforged.factory.api.world.entity.player.Player;
|
||||
import com.mojang.brigadier.Command;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.nexia.core.Main;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.chat.LegacyChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.ranks.NexiaRank;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class RankCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("rank")
|
||||
.requires(commandSourceStack -> PlayerUtil.hasPermission(commandSourceStack, "nexia.staff.rank", 4))
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.then(Commands.argument("rank", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((Main.config.ranks), builder)))
|
||||
.executes(context -> RankCommand.give(context, EntityArgument.getPlayer(context, "player"), StringArgumentType.getString(context, "rank")))))
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
|
||||
ArrayList<String> ranks = new ArrayList<>();
|
||||
NexiaRank.ranks.forEach(rank -> ranks.add(rank.id));
|
||||
|
||||
dispatcher.register(CommandUtils.literal("rank")
|
||||
.requires(commandSourceInfo -> CommandUtil.hasPermission(commandSourceInfo, "nexia.staff.rank"))
|
||||
.then(CommandUtils.argument("player", EntityArgument.player())
|
||||
.then(CommandUtils.argument("rank", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((ranks), builder)))
|
||||
.executes(context -> RankCommand.give(context, context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), false)), StringArgumentType.getString(context, "rank")))))
|
||||
);
|
||||
}
|
||||
|
||||
public static int give(CommandContext<CommandSourceStack> context, ServerPlayer player, String rank) {
|
||||
CommandSourceStack executer = context.getSource();
|
||||
public static int give(CommandContext<CommandSourceInfo> context, ServerPlayer player, String rank) {
|
||||
NexiaPlayer nexiaPlayer = new NexiaPlayer(player);
|
||||
|
||||
Player factoryExecutor = null;
|
||||
|
||||
Player otherFactoryPlayer = PlayerUtil.getFactoryPlayer(player);
|
||||
|
||||
try {
|
||||
factoryExecutor = PlayerUtil.getFactoryPlayer(context.getSource().getPlayerOrException());
|
||||
} catch(Exception ignored) { }
|
||||
|
||||
for(int i = 0; i < 10; i++){
|
||||
if(rank.equalsIgnoreCase(Main.config.ranks[i])){
|
||||
|
||||
if(factoryExecutor != null){
|
||||
factoryExecutor.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have set the rank of ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(otherFactoryPlayer.getRawName()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(" to ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(Main.config.ranks[i]).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, true).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(".").color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false).decoration(ChatFormat.bold, false))
|
||||
);
|
||||
} else {
|
||||
executer.sendSuccess(LegacyChatFormat.format("{b1}You have set the rank of {b2}{} {b1}to: {b2}{b}{}{b1}.", otherFactoryPlayer.getRawName(), Main.config.ranks[i]), false);
|
||||
}
|
||||
|
||||
if(rank.equalsIgnoreCase("pro") || rank.equalsIgnoreCase("god")){
|
||||
ServerTime.factoryServer.runCommand("/staffprefix add " + otherFactoryPlayer.getRawName() + " " + rank, 3, true);
|
||||
ServerTime.factoryServer.runCommand("/staffprefix set " + otherFactoryPlayer.getRawName() + " " + rank, 3, true);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
otherFactoryPlayer.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("Your rank has been set to: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(Main.config.ranks[i]).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, true))
|
||||
.append(Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
);
|
||||
|
||||
for (int i2 = 0; i2 < 9; i2++) {
|
||||
otherFactoryPlayer.removeTag(Main.config.ranks[i2]);
|
||||
}
|
||||
|
||||
ServerTime.factoryServer.runCommand(String.format("/lp user %s parent set %s", otherFactoryPlayer.getRawName(), Main.config.ranks[i]));
|
||||
|
||||
otherFactoryPlayer.addTag(Main.config.ranks[i]);
|
||||
}
|
||||
NexiaRank nexiaRank = NexiaRank.identifyRank(rank);
|
||||
if (nexiaRank == null) {
|
||||
context.getSource().sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("Invalid rank!", ChatFormat.normalColor))
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
nexiaPlayer.sendNexiaMessage(
|
||||
Component.text("Your rank has been set to: ", ChatFormat.normalColor)
|
||||
.append(Component.text(nexiaRank.name, ChatFormat.brandColor2).decoration(ChatFormat.bold, true))
|
||||
.append(Component.text(".", ChatFormat.normalColor))
|
||||
);
|
||||
|
||||
NexiaRank.setRank(nexiaRank, nexiaPlayer);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -1,125 +1,92 @@
|
||||
package com.nexia.core.commands.staff;
|
||||
|
||||
import com.combatreforged.factory.api.world.entity.player.Player;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.mojang.brigadier.Command;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.nexia.core.Main;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.chat.LegacyChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.ranks.NexiaRank;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class StaffPrefixCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
import java.util.ArrayList;
|
||||
|
||||
dispatcher.register(Commands.literal("staffprefix")
|
||||
.requires(commandSourceStack -> PlayerUtil.hasPermission(commandSourceStack, "nexia.staff.prefix", 3))
|
||||
.then(Commands.argument("type", StringArgumentType.string())
|
||||
public class StaffPrefixCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
|
||||
ArrayList<String> ranks = new ArrayList<>();
|
||||
NexiaRank.ranks.forEach(rank -> ranks.add(rank.id));
|
||||
|
||||
dispatcher.register(CommandUtils.literal("staffprefix")
|
||||
.requires(commandSourceInfo -> CommandUtil.hasPermission(commandSourceInfo, "nexia.staff.prefix"))
|
||||
.then(CommandUtils.argument("type", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((new String[]{"set", "add", "remove"}), builder)))
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.then(Commands.argument("prefix", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((Main.config.ranks), builder)))
|
||||
.then(CommandUtils.argument("player", EntityArgument.player())
|
||||
.then(CommandUtils.argument("prefix", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((ranks), builder)))
|
||||
.executes(context -> {
|
||||
|
||||
CommandSourceStack executor = context.getSource();
|
||||
|
||||
String type = StringArgumentType.getString(context, "type");
|
||||
ServerPlayer mcOtherPlayer = EntityArgument.getPlayer(context, "player");
|
||||
Player otherPlayer = PlayerUtil.getFactoryPlayer(mcOtherPlayer);
|
||||
String prefix = StringArgumentType.getString(context, "prefix");
|
||||
|
||||
ServerPlayer mcExecutor;
|
||||
Player factoryExecutor = null;
|
||||
|
||||
try {
|
||||
mcExecutor = executor.getPlayerOrException();
|
||||
factoryExecutor = PlayerUtil.getFactoryPlayer(mcExecutor);
|
||||
} catch(Exception ignored){ }
|
||||
ServerPlayer mcOtherPlayer = context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), false));
|
||||
NexiaPlayer otherPlayer = new NexiaPlayer(mcOtherPlayer);
|
||||
NexiaRank rank = NexiaRank.identifyRank(StringArgumentType.getString(context, "prefix"));
|
||||
|
||||
if(rank == null) {
|
||||
context.getSource().sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("Invalid rank!", ChatFormat.normalColor))
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(type.equalsIgnoreCase("set")){
|
||||
for(int i = 0; i < 10; i++){
|
||||
if(prefix.equalsIgnoreCase(Main.config.ranks[i])){
|
||||
context.getSource().sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have set the prefix of ", ChatFormat.normalColor))
|
||||
.append(Component.text(otherPlayer.getRawName(), ChatFormat.brandColor2))
|
||||
.append(Component.text(" to: ", ChatFormat.normalColor))
|
||||
.append(Component.text(rank.name, ChatFormat.brandColor2).decoration(ChatFormat.bold, true))
|
||||
.append(Component.text(".", ChatFormat.normalColor).decoration(ChatFormat.bold,false))
|
||||
);
|
||||
|
||||
otherPlayer.sendNexiaMessage(
|
||||
Component.text("Your prefix has been set to: ", ChatFormat.normalColor)
|
||||
.append(Component.text(rank.name, ChatFormat.brandColor2).decoration(ChatFormat.bold, true))
|
||||
.append(Component.text(".", ChatFormat.normalColor))
|
||||
);
|
||||
|
||||
if(factoryExecutor != null){
|
||||
factoryExecutor.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have set the prefix of ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(otherPlayer.getRawName()).color(ChatFormat.brandColor2))
|
||||
.append(Component.text(" to: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(Main.config.ranks[i]).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, true))
|
||||
.append(Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold,false).decoration(ChatFormat.bold, false))
|
||||
);
|
||||
} else {
|
||||
executor.sendSuccess(LegacyChatFormat.format("{b1}You have set the prefix of {b2}{} {b1}to: {b2}{b}{}{b1}.", otherPlayer.getRawName(), Main.config.ranks[i]), false);
|
||||
}
|
||||
|
||||
otherPlayer.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("Your prefix has been set to: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(Main.config.ranks[i]).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, true))
|
||||
.append(Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
);
|
||||
|
||||
for (int i2 = 0; i2 < 10; i2++) {
|
||||
otherPlayer.removeTag(Main.config.ranks[i2]);
|
||||
}
|
||||
|
||||
otherPlayer.addTag(Main.config.ranks[i]);
|
||||
}
|
||||
}
|
||||
NexiaRank.setPrefix(rank, otherPlayer);
|
||||
}
|
||||
|
||||
if(type.equalsIgnoreCase("remove")){
|
||||
for(int i = 0; i < 10; i++){
|
||||
if(prefix.equalsIgnoreCase(Main.config.ranks[i])){
|
||||
context.getSource().sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have removed the prefix ", ChatFormat.normalColor))
|
||||
.append(Component.text(rank.name, ChatFormat.brandColor2).decoration(ChatFormat.bold, true))
|
||||
.append(Component.text(" from: ", ChatFormat.normalColor))
|
||||
.append(Component.text(otherPlayer.getRawName(), ChatFormat.brandColor2))
|
||||
.append(Component.text(".", ChatFormat.normalColor).decoration(ChatFormat.bold,false))
|
||||
);
|
||||
|
||||
if(factoryExecutor != null){
|
||||
factoryExecutor.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have removed the prefix ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(Main.config.ranks[i]).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, true).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(" from: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(otherPlayer.getRawName()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold,false))
|
||||
);
|
||||
} else {
|
||||
executor.sendSuccess(LegacyChatFormat.format("{b1}You have removed the prefix {b2}{b}{} {b1}from {b2}{}{b1}.", Main.config.ranks[i], otherPlayer.getRawName()), false);
|
||||
}
|
||||
|
||||
|
||||
ServerTime.factoryServer.runCommand(String.format("/lp user %s permission unset nexia.prefix.%s", otherPlayer.getRawName(), Main.config.ranks[i]));
|
||||
}
|
||||
}
|
||||
NexiaRank.removePrefix(rank, otherPlayer);
|
||||
}
|
||||
|
||||
if(type.equalsIgnoreCase("add")){
|
||||
for(int i = 0; i < 10; i++){
|
||||
if(prefix.equalsIgnoreCase(Main.config.ranks[i])){
|
||||
if(factoryExecutor != null){
|
||||
factoryExecutor.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have added the prefix ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(Main.config.ranks[i]).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, true))
|
||||
.append(Component.text(" to: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(otherPlayer.getRawName()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold,false))
|
||||
);
|
||||
} else {
|
||||
executor.sendSuccess(LegacyChatFormat.format("{b1}You have added the prefix {b2}{b}{} {b1}to {b2}{}{b1}.", Main.config.ranks[i], otherPlayer.getRawName()), false);
|
||||
}
|
||||
|
||||
ServerTime.factoryServer.runCommand(String.format("/lp user %s permission set nexia.prefix.%s true", otherPlayer.getRawName(), Main.config.ranks[i]));
|
||||
}
|
||||
}
|
||||
context.getSource().sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have added the prefix ", ChatFormat.normalColor))
|
||||
.append(Component.text(rank.name, ChatFormat.brandColor2).decoration(ChatFormat.bold, true))
|
||||
.append(Component.text(" to: ", ChatFormat.normalColor))
|
||||
.append(Component.text(otherPlayer.getRawName(), ChatFormat.brandColor2))
|
||||
.append(Component.text(".", ChatFormat.normalColor).decoration(ChatFormat.bold,false))
|
||||
);
|
||||
NexiaRank.addPrefix(rank, otherPlayer, false);
|
||||
}
|
||||
|
||||
return Command.SINGLE_SUCCESS;
|
||||
|
||||
@@ -1,104 +1,72 @@
|
||||
package com.nexia.core.commands.staff;
|
||||
|
||||
import com.combatreforged.factory.api.world.entity.player.Player;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.utilities.player.CoreSavedPlayerData;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.mojang.brigadier.Command;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.nexia.core.Main;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.chat.LegacyChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerData;
|
||||
import com.nexia.core.utilities.player.PlayerDataManager;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class StaffReportCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
|
||||
dispatcher.register(Commands.literal("staffreport")
|
||||
.requires(commandSourceStack -> PlayerUtil.hasPermission(commandSourceStack, "nexia.staff.report", 1))
|
||||
.then(Commands.argument("type", StringArgumentType.string())
|
||||
dispatcher.register(CommandUtils.literal("staffreport")
|
||||
.requires(commandSourceInfo -> CommandUtil.hasPermission(commandSourceInfo, "nexia.staff.report", 3))
|
||||
.then(CommandUtils.argument("type", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((new String[]{"ban", "unban"}), builder)))
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.then(CommandUtils.argument("player", EntityArgument.player())
|
||||
.executes(context -> {
|
||||
|
||||
CommandSourceStack executor = context.getSource();
|
||||
|
||||
String type = StringArgumentType.getString(context, "type");
|
||||
ServerPlayer mcOtherPlayer = EntityArgument.getPlayer(context, "player");
|
||||
Player otherPlayer = PlayerUtil.getFactoryPlayer(mcOtherPlayer);
|
||||
ServerPlayer mcOtherPlayer = context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), false));
|
||||
NexiaPlayer otherPlayer = new NexiaPlayer(mcOtherPlayer);
|
||||
|
||||
Player factoryExecutor = null;
|
||||
|
||||
try {
|
||||
factoryExecutor = PlayerUtil.getFactoryPlayer(executor.getPlayerOrException());
|
||||
} catch (Exception ignored) { }
|
||||
|
||||
|
||||
PlayerData data = PlayerDataManager.get(mcOtherPlayer);
|
||||
CorePlayerData data = (CorePlayerData) PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(mcOtherPlayer.getUUID());
|
||||
|
||||
if(type.equalsIgnoreCase("ban")) {
|
||||
if(data.isReportBanned) {
|
||||
if(factoryExecutor != null) {
|
||||
factoryExecutor.sendMessage(Component.text("That player is already report banned!").color(ChatFormat.failColor).decoration(ChatFormat.bold, false));
|
||||
} else {
|
||||
executor.sendFailure(new TextComponent("That player is already report banned!"));
|
||||
}
|
||||
if(((CoreSavedPlayerData)data.savedData).isReportBanned()) {
|
||||
context.getSource().sendMessage(Component.text("That player is already report banned!", ChatFormat.failColor));
|
||||
return 0;
|
||||
}
|
||||
data.isReportBanned = true;
|
||||
if(factoryExecutor != null) {
|
||||
factoryExecutor.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have report banned ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
|
||||
.append(Component.text(otherPlayer.getRawName()).color(ChatFormat.brandColor1).decoration(ChatFormat.bold, true))
|
||||
.append(Component.text(".")).color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
executor.sendSuccess(LegacyChatFormat.format("You have report banned {}.", otherPlayer.getRawName()), true);
|
||||
}
|
||||
((CoreSavedPlayerData)data.savedData).setReportBanned(true);
|
||||
context.getSource().sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have report banned ", ChatFormat.normalColor)
|
||||
.append(Component.text(otherPlayer.getRawName(), ChatFormat.brandColor1).decoration(ChatFormat.bold, true))
|
||||
.append(Component.text(".", ChatFormat.normalColor))
|
||||
)
|
||||
);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
if(type.equalsIgnoreCase("unban") || type.equalsIgnoreCase("pardon")) {
|
||||
if(!data.isReportBanned) {
|
||||
if(factoryExecutor != null) {
|
||||
factoryExecutor.sendMessage(Component.text("That player is not report banned!").color(ChatFormat.failColor).decoration(ChatFormat.bold, false));
|
||||
} else {
|
||||
executor.sendFailure(new TextComponent("That player is not report banned!"));
|
||||
}
|
||||
if(!((CoreSavedPlayerData)data.savedData).isReportBanned()) {
|
||||
context.getSource().sendMessage(Component.text("That player is not report banned!", ChatFormat.failColor));
|
||||
return 0;
|
||||
}
|
||||
data.isReportBanned = false;
|
||||
if(factoryExecutor != null) {
|
||||
factoryExecutor.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have report unbanned ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
|
||||
.append(Component.text(otherPlayer.getRawName()).color(ChatFormat.brandColor1).decoration(ChatFormat.bold, true))
|
||||
.append(Component.text(".")).color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
executor.sendSuccess(LegacyChatFormat.format("You have report unbanned {}.", otherPlayer.getRawName()), true);
|
||||
}
|
||||
((CoreSavedPlayerData)data.savedData).setReportBanned(false);
|
||||
context.getSource().sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have report unbanned ", ChatFormat.normalColor))
|
||||
.append(Component.text(otherPlayer.getRawName(), ChatFormat.brandColor1).decoration(ChatFormat.bold, true))
|
||||
.append(Component.text(".", ChatFormat.normalColor))
|
||||
);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
if(factoryExecutor != null) {
|
||||
factoryExecutor.sendMessage(Component.text("Invalid argument").color(ChatFormat.failColor).decoration(ChatFormat.bold, false));
|
||||
} else {
|
||||
executor.sendFailure(new TextComponent("Invalid argument!"));
|
||||
}
|
||||
context.getSource().sendMessage(Component.text("Invalid argument", ChatFormat.failColor));
|
||||
|
||||
return Command.SINGLE_SUCCESS;
|
||||
return 0;
|
||||
}))
|
||||
|
||||
)
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.nexia.core.commands.staff;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class SudoCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
|
||||
dispatcher.register(CommandUtils.literal("sudo")
|
||||
.requires(commandSourceInfo -> CommandUtil.hasPermission(commandSourceInfo, "nexia.staff.sudo"))
|
||||
.then(CommandUtils.argument("player", EntityArgument.player())
|
||||
.then(CommandUtils.argument("command", StringArgumentType.greedyString())
|
||||
.executes(context -> SudoCommand.execute(context, context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), false)), StringArgumentType.getString(context, "command")))))
|
||||
);
|
||||
}
|
||||
|
||||
private static int execute(CommandContext<CommandSourceInfo> context, ServerPlayer player, String command) {
|
||||
NexiaPlayer nexiaPlayer = new NexiaPlayer(player);
|
||||
nexiaPlayer.runCommand(command, 4, false);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,70 +1,44 @@
|
||||
package com.nexia.core.commands.staff;
|
||||
|
||||
import com.combatreforged.factory.api.world.entity.player.Player;
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.Main;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.chat.LegacyChatFormat;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.core.utilities.player.BanHandler;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.GameProfileArgument;
|
||||
import net.minecraft.network.chat.ComponentUtils;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.players.UserBanList;
|
||||
import net.minecraft.server.players.UserBanListEntry;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
public class TempBanCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("tempban")
|
||||
.requires(commandSourceStack -> PlayerUtil.hasPermission(commandSourceStack, "nexia.staff.ban", 3))
|
||||
.then(Commands.argument("player", GameProfileArgument.gameProfile())
|
||||
.then(Commands.argument("duration", StringArgumentType.word())
|
||||
.then(Commands.argument("reason", StringArgumentType.greedyString())
|
||||
.executes(context -> TempBanCommand.ban(context.getSource(), GameProfileArgument.getGameProfiles(context, "player"), StringArgumentType.getString(context, "reason"), StringArgumentType.getString(context, "duration"))))
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("tempban")
|
||||
.requires(commandSourceInfo -> CommandUtil.hasPermission(commandSourceInfo, "nexia.staff.ban", 3))
|
||||
.then(CommandUtils.argument("player", GameProfileArgument.gameProfile())
|
||||
.then(CommandUtils.argument("duration", StringArgumentType.word())
|
||||
.then(CommandUtils.argument("reason", StringArgumentType.greedyString())
|
||||
.executes(context -> TempBanCommand.ban(context.getSource(), context.getArgument("player", GameProfileArgument.Result.class).getNames(CommandUtil.getCommandSourceStack(context.getSource(), false)), StringArgumentType.getString(context, "reason"), StringArgumentType.getString(context, "duration"))))
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
public static int ban(CommandSourceStack sender, Collection<GameProfile> collection, String reason, String durationArg) {
|
||||
ServerPlayer mcPlayer = null;
|
||||
Player player = null;
|
||||
|
||||
try {
|
||||
mcPlayer = sender.getPlayerOrException();
|
||||
} catch (Exception ignored){ }
|
||||
|
||||
if(mcPlayer != null) {
|
||||
player = PlayerUtil.getFactoryPlayer(mcPlayer);
|
||||
}
|
||||
|
||||
public static int ban(CommandSourceInfo sender, Collection<GameProfile> collection, String reason, String durationArg) {
|
||||
int durationInSeconds;
|
||||
try {
|
||||
durationInSeconds = BanHandler.parseTimeArg(durationArg);
|
||||
} catch (Exception e) {
|
||||
if (player != null) {
|
||||
player.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("Invalid duration. Examples: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text("1s / 2m / 3h").color(ChatFormat.failColor).decoration(ChatFormat.bold, false))
|
||||
);
|
||||
} else {
|
||||
sender.sendFailure(LegacyChatFormat.format("{f}Invalid duration. Examples: 1s / 2m / 3h"));
|
||||
}
|
||||
sender.sendMessage(ChatFormat.nexiaMessage
|
||||
.append(Component.text("Invalid duration. Examples: ", ChatFormat.normalColor))
|
||||
.append(Component.text("1s / 2m / 3h / 4d / 5w", ChatFormat.failColor))
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
BanHandler.tryBan(sender, collection, durationInSeconds * 1000, reason);
|
||||
BanHandler.tryBan(sender, collection, durationInSeconds, reason);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,79 +1,61 @@
|
||||
package com.nexia.core.commands.staff;
|
||||
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.nexia.core.Main;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.chat.LegacyChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.commands.arguments.GameProfileArgument;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.players.UserBanList;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class UnBanCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("unban")
|
||||
.requires(commandSourceStack -> PlayerUtil.hasPermission(commandSourceStack, "nexia.staff.ban", 3))
|
||||
.then(Commands.argument("player", GameProfileArgument.gameProfile())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((context.getSource()).getServer().getPlayerList().getBans().getUserList(), builder)))
|
||||
.executes(context -> UnBanCommand.unban(context.getSource(), GameProfileArgument.getGameProfiles(context, "player")))
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("unban")
|
||||
.requires(commandSourceInfo -> CommandUtil.hasPermission(commandSourceInfo, "nexia.staff.ban", 3))
|
||||
.then(CommandUtils.argument("player", GameProfileArgument.gameProfile())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((ServerTime.minecraftServer.getPlayerList().getBans().getUserList()), builder)))
|
||||
.executes(context -> UnBanCommand.unban(context.getSource(), context.getArgument("player", GameProfileArgument.Result.class).getNames(CommandUtil.getCommandSourceStack(context.getSource(), false))))
|
||||
)
|
||||
);
|
||||
dispatcher.register(Commands.literal("pardon")
|
||||
.requires(commandSourceStack -> PlayerUtil.hasPermission(commandSourceStack, "nexia.staff.ban", 3))
|
||||
.then(Commands.argument("player", GameProfileArgument.gameProfile())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((context.getSource()).getServer().getPlayerList().getBans().getUserList(), builder)))
|
||||
.executes(context -> UnBanCommand.unban(context.getSource(), GameProfileArgument.getGameProfiles(context, "player")))
|
||||
dispatcher.register(CommandUtils.literal("pardon")
|
||||
.requires(commandSourceInfo -> CommandUtil.hasPermission(commandSourceInfo, "nexia.staff.ban", 3))
|
||||
.then(CommandUtils.argument("player", GameProfileArgument.gameProfile())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((ServerTime.minecraftServer.getPlayerList().getBans().getUserList()), builder)))
|
||||
.executes(context -> UnBanCommand.unban(context.getSource(), context.getArgument("player", GameProfileArgument.Result.class).getNames(CommandUtil.getCommandSourceStack(context.getSource(), false))))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static int unban(CommandSourceStack context, Collection<GameProfile> collection) {
|
||||
public static int unban(CommandSourceInfo context, Collection<GameProfile> collection) {
|
||||
UserBanList userBanList = ServerTime.minecraftServer.getPlayerList().getBans();
|
||||
int i = 0;
|
||||
|
||||
ServerPlayer player = null;
|
||||
|
||||
try {
|
||||
player = context.getPlayerOrException();
|
||||
} catch (Exception ignored){ }
|
||||
|
||||
for (GameProfile gameProfile : collection) {
|
||||
if (userBanList.isBanned(gameProfile)) {
|
||||
userBanList.remove(gameProfile);
|
||||
++i;
|
||||
if(player != null){
|
||||
PlayerUtil.getFactoryPlayer(player).sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have unbanned ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(gameProfile.getName()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
|
||||
|
||||
);
|
||||
} else {
|
||||
context.sendSuccess(LegacyChatFormat.format("{b1}You have unbanned {b2}{}{b1}.", gameProfile.getName()), true);
|
||||
}
|
||||
context.getSender().sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have unbanned ", ChatFormat.normalColor))
|
||||
.append(Component.text(gameProfile.getName(), ChatFormat.brandColor2))
|
||||
.append(Component.text(".", ChatFormat.normalColor))
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
if(player != null){
|
||||
PlayerUtil.getFactoryPlayer(player).sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("That player is not banned.").color(ChatFormat.failColor))
|
||||
);
|
||||
} else {
|
||||
context.sendSuccess(LegacyChatFormat.formatFail("That player is not banned."), false);
|
||||
}
|
||||
context.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("That player is not banned.", ChatFormat.failColor))
|
||||
);
|
||||
|
||||
} else {
|
||||
return i;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.nexia.core.commands.staff;
|
||||
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.core.utilities.player.GamemodeBanHandler;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
|
||||
public class UnGamemodeBanCommand {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("ungamemodeban")
|
||||
.requires(commandSourceInfo -> CommandUtil.hasPermission(commandSourceInfo, "nexia.staff.ban", 3))
|
||||
.then(CommandUtils.argument("player", EntityArgument.player())
|
||||
.then(CommandUtils.argument("gamemode", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((PlayerGameMode.stringPlayerGameModes), builder)))
|
||||
.executes(UnGamemodeBanCommand::unBan)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static int unBan(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
CommandSourceInfo sender = context.getSource();
|
||||
|
||||
PlayerGameMode gameMode = PlayerGameMode.identifyGamemode(StringArgumentType.getString(context, "gamemode"));
|
||||
if(gameMode == null) {
|
||||
sender.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("Invalid gamemode!", ChatFormat.normalColor))
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
GamemodeBanHandler.tryUnGamemodeBan(sender, new NexiaPlayer(context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), false))), gameMode);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +1,30 @@
|
||||
package com.nexia.core.commands.staff;
|
||||
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.utilities.chat.PlayerMutes;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class UnMuteCommand {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("unmute")
|
||||
.requires(commandSourceStack -> PlayerUtil.hasPermission(commandSourceStack, "nexia.staff.mute", 1))
|
||||
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("unmute")
|
||||
.requires(commandSourceInfo -> CommandUtil.hasPermission(commandSourceInfo, "nexia.staff.mute", 1))
|
||||
.then(CommandUtils.argument("player", EntityArgument.player())
|
||||
.executes(UnMuteCommand::unMute)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static int unMute(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
CommandSourceStack sender = context.getSource();
|
||||
ServerPlayer muted = EntityArgument.getPlayer(context, "player");
|
||||
public static int unMute(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
CommandSourceInfo sender = context.getSource();
|
||||
ServerPlayer muted = context.getArgument("player", EntitySelector.class).findSinglePlayer(CommandUtil.getCommandSourceStack(context.getSource(), false));
|
||||
|
||||
PlayerMutes.unMute(sender, muted);
|
||||
|
||||
|
||||
@@ -1,34 +1,29 @@
|
||||
package com.nexia.core.commands.staff;
|
||||
|
||||
import com.nexia.nexus.api.command.CommandSourceInfo;
|
||||
import com.nexia.nexus.api.command.CommandUtils;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.Main;
|
||||
import com.nexia.core.utilities.chat.PlayerMutes;
|
||||
import com.nexia.core.utilities.commands.CommandUtil;
|
||||
import com.nexia.core.utilities.player.BanHandler;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.commands.arguments.GameProfileArgument;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class UnTempBanCommand {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("untempban")
|
||||
.requires(commandSourceStack -> PlayerUtil.hasPermission(commandSourceStack, "nexia.staff.ban", 3))
|
||||
|
||||
.then(Commands.argument("player", GameProfileArgument.gameProfile())
|
||||
public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
|
||||
dispatcher.register(CommandUtils.literal("untempban")
|
||||
.requires(commandSourceInfo -> CommandUtil.hasPermission(commandSourceInfo, "nexia.staff.ban", 3))
|
||||
.then(CommandUtils.argument("player", GameProfileArgument.gameProfile())
|
||||
.executes(UnTempBanCommand::unBan)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static int unBan(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
CommandSourceStack sender = context.getSource();
|
||||
public static int unBan(CommandContext<CommandSourceInfo> context) throws CommandSyntaxException {
|
||||
CommandSourceInfo sender = context.getSource();
|
||||
|
||||
BanHandler.tryUnBan(sender, GameProfileArgument.getGameProfiles(context, "player"));
|
||||
BanHandler.tryUnBan(sender, context.getArgument("player", GameProfileArgument.Result.class).getNames(CommandUtil.getCommandSourceStack(context.getSource(), false)));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -3,10 +3,9 @@ package com.nexia.core.commands.staff.dev;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.chat.LegacyChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.minigames.games.bedwars.shop.BwLoadShop;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
@@ -15,13 +14,12 @@ public class BwReloadShopCommand {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("bwreloadshop").executes(BwReloadShopCommand::run)
|
||||
.requires(commandSourceStack -> PlayerUtil.hasPermission(commandSourceStack, "nexia.dev.bwreloadshop", 3)));
|
||||
.requires(commandSourceStack -> Permissions.check(commandSourceStack, "nexia.dev.bwreloadshop", 3)));
|
||||
}
|
||||
|
||||
public static int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
|
||||
boolean success = BwLoadShop.loadBedWarsShop(false) &&
|
||||
BwLoadShop.loadBedWarsShop(false);
|
||||
boolean success = BwLoadShop.loadBedWarsShop(false);
|
||||
|
||||
if (success) {
|
||||
String message = LegacyChatFormat.brandColor1 + "Reloaded Bedwars shop successfully!";
|
||||
|
||||
@@ -3,24 +3,22 @@ package com.nexia.core.commands.staff.dev;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.minigames.games.bedwars.players.BwTeam;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class BwReloadTeamColorsCommand {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("bwreloadteamcolors").executes(BwReloadTeamColorsCommand::run)
|
||||
.requires(commandSourceStack -> PlayerUtil.hasPermission(commandSourceStack, "nexia.dev.bwreloadteamcolors", 3)));
|
||||
dispatcher.register(Commands.literal("bwreloadteamcolors")
|
||||
.requires(commandSourceStack -> Permissions.check(commandSourceStack, "nexia.dev.bwreloadteamcolors", 3))
|
||||
.executes(BwReloadTeamColorsCommand::run)
|
||||
);
|
||||
}
|
||||
|
||||
public static int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
|
||||
BwTeam.reloadPlayerTeamColors(player);
|
||||
|
||||
BwTeam.reloadPlayerTeamColors();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.nexia.core.commands.staff.dev;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.minigames.games.bedwars.util.BwUtil;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class BwSkipQueueCommand {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register((Commands.literal("bwskipqueue")
|
||||
.requires(commandSourceStack -> PlayerUtil.hasPermission(commandSourceStack, "nexia.staff.bwskipqueue", 1)))
|
||||
.executes(BwSkipQueueCommand::run)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
private static int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
|
||||
if (BwUtil.skipQueue()) {
|
||||
player.sendMessage(new TextComponent("Skipped queue"), Util.NIL_UUID);
|
||||
} else {
|
||||
player.sendMessage(new TextComponent("Epic queue skip failure"), Util.NIL_UUID);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.nexia.core.commands.staff.dev;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.nexia.core.utilities.chat.LegacyChatFormat;
|
||||
import com.nexia.core.utilities.item.InventoryUtil;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
public class DeleteInventoryCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register((Commands.literal("deleteinventory")
|
||||
.requires(commandSourceStack -> {
|
||||
try {
|
||||
return Permissions.check(commandSourceStack, "nexia.inventory.delete", 4);
|
||||
} catch (Exception ignored) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.then(Commands.argument("type", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((Objects.requireNonNull(new File(InventoryUtil.dirpath).list())), builder)))
|
||||
.then(Commands.argument("inventory", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> {
|
||||
ArrayList<String> inventoryList = new ArrayList<>();
|
||||
try {
|
||||
inventoryList = InventoryUtil.getListOfInventories(StringArgumentType.getString(context, "type"));
|
||||
} catch (Exception ignored) {
|
||||
inventoryList.add("Unable to get inventories!");
|
||||
}
|
||||
return SharedSuggestionProvider.suggest(inventoryList, builder);
|
||||
}))
|
||||
.executes(context -> run(context, StringArgumentType.getString(context, "type"), StringArgumentType.getString(context, "inventory")))
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private static int run(CommandContext<CommandSourceStack> context, @NotNull String type, @NotNull String inventory) {
|
||||
if(inventory.trim().isEmpty()) {
|
||||
context.getSource().sendFailure(LegacyChatFormat.format("Empty inventory name!"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(type.trim().isEmpty()) {
|
||||
context.getSource().sendFailure(LegacyChatFormat.format("Empty type!"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
File file = new File(InventoryUtil.dirpath + File.separator + type, inventory + ".txt");
|
||||
|
||||
if(file.isDirectory() || !file.exists()) {
|
||||
context.getSource().sendFailure(LegacyChatFormat.format("The inventory with the name '{}' in '{}' does not exist!", inventory, type));
|
||||
return 0;
|
||||
}
|
||||
|
||||
file.delete();
|
||||
context.getSource().sendSuccess(LegacyChatFormat.format("{b1}Successfully deleted inventory '{}' in '{}'.", inventory, type), true);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.nexia.core.commands.staff.dev;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.utilities.chat.LegacyChatFormat;
|
||||
import com.nexia.core.utilities.misc.RandomUtil;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import com.nexia.ffa.FfaUtil;
|
||||
import com.nexia.ffa.uhc.utilities.UhcFfaAreas;
|
||||
import com.nexia.minigames.games.skywars.SkywarsGame;
|
||||
import com.nexia.minigames.games.skywars.SkywarsMap;
|
||||
import io.github.blumbo.inventorymerger.saving.SavableInventory;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
import java.io.FileWriter;
|
||||
|
||||
public class DevExperimentalCommandsCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register((Commands.literal("devexperimentalcmds")
|
||||
.requires(commandSourceStack -> {
|
||||
try {
|
||||
return Permissions.check(commandSourceStack, "nexia.dev.experimentalcmds");
|
||||
} catch (Exception ignored) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.then(Commands.argument("argument", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((new String[]{"cffa", "rluhc", "swmap", "saveinventory"}), builder)))
|
||||
.executes(DevExperimentalCommandsCommand::run))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private static int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
|
||||
String argument = StringArgumentType.getString(context, "argument");
|
||||
String name = argument;
|
||||
if(name.contains("-")) name = name.split("-")[1];
|
||||
|
||||
if(argument.contains("cffa")){
|
||||
ServerLevel level = ServerTime.fantasy.getOrOpenPersistentWorld(ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation("ffa", name)).location(), FfaUtil.ffaWorldConfig).asWorld();
|
||||
player.teleportTo(level, 0, 80, 0, 0, 0);
|
||||
} else if(argument.equalsIgnoreCase("rluhc")) {
|
||||
UhcFfaAreas.resetMap(true);
|
||||
player.sendMessage(LegacyChatFormat.format("Reloaded UHC Map."), Util.NIL_UUID);
|
||||
} else if(argument.contains("swmap")) {
|
||||
SkywarsMap map = SkywarsMap.identifyMap(name);
|
||||
if(map != null) {
|
||||
SkywarsGame.map = map;
|
||||
player.sendMessage(LegacyChatFormat.format("Map set to " + map.id), Util.NIL_UUID);
|
||||
} else {
|
||||
player.sendMessage(LegacyChatFormat.format("Invalid map!"), Util.NIL_UUID);
|
||||
}
|
||||
|
||||
} else if(argument.equalsIgnoreCase("saveinventory")) {
|
||||
|
||||
SavableInventory savableInventory = new SavableInventory(player.inventory);
|
||||
String stringInventory = savableInventory.toSave();
|
||||
|
||||
try {
|
||||
String fileName = player.getScoreboardName() + "_devinventory-" + RandomUtil.randomInt(0, 100);
|
||||
String directory = FabricLoader.getInstance().getConfigDir().toString() + "/nexia";
|
||||
FileWriter fileWriter = new FileWriter(directory + "/" + fileName + ".json");
|
||||
fileWriter.write(stringInventory);
|
||||
fileWriter.close();
|
||||
player.sendMessage(LegacyChatFormat.format("Saved Inventory in /config/nexia/{}.json", fileName), Util.NIL_UUID);
|
||||
} catch (Exception var6) {
|
||||
player.sendMessage(LegacyChatFormat.format("Failed to save inventory!"), Util.NIL_UUID);
|
||||
player.sendMessage(new TextComponent(var6.getMessage()), Util.NIL_UUID);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.nexia.core.commands.staff.dev;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.games.util.LobbyUtil;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import com.nexia.minigames.games.oitc.OitcGame;
|
||||
import com.nexia.minigames.games.skywars.SkywarsGame;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.Difficulty;
|
||||
import net.minecraft.world.level.GameRules;
|
||||
import xyz.nucleoid.fantasy.RuntimeWorldConfig;
|
||||
|
||||
public class DevExperimentalMapCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register((Commands.literal("devexperimentalmap")
|
||||
.requires(commandSourceStack -> {
|
||||
try {
|
||||
return Permissions.check(commandSourceStack, "nexia.dev.experimentalmap");
|
||||
} catch (Exception ignored) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.then(Commands.argument("argument", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((new String[]{"cffa"}), builder)))
|
||||
.executes(DevExperimentalMapCommand::run))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private static int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
|
||||
String argument = StringArgumentType.getString(context, "argument");
|
||||
String name = argument.split("-")[1];
|
||||
|
||||
if(argument.contains("cffa")){
|
||||
ServerLevel level = ServerTime.fantasy.getOrOpenPersistentWorld(ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation("ffa", name)).location(), (
|
||||
new RuntimeWorldConfig()
|
||||
.setDimensionType(SkywarsGame.world.dimensionType())
|
||||
.setGenerator(SkywarsGame.world.getChunkSource().getGenerator())
|
||||
.setDifficulty(Difficulty.HARD)
|
||||
.setGameRule(GameRules.RULE_KEEPINVENTORY, true)
|
||||
.setGameRule(GameRules.RULE_MOBGRIEFING, false)
|
||||
.setGameRule(GameRules.RULE_WEATHER_CYCLE, false)
|
||||
.setGameRule(GameRules.RULE_DAYLIGHT, true)
|
||||
.setGameRule(GameRules.RULE_DO_IMMEDIATE_RESPAWN, true)
|
||||
.setGameRule(GameRules.RULE_DOMOBSPAWNING, false)
|
||||
.setGameRule(GameRules.RULE_SHOWDEATHMESSAGES, false)
|
||||
.setGameRule(GameRules.RULE_ANNOUNCE_ADVANCEMENTS, false)
|
||||
.setGameRule(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK, true)
|
||||
.setGameRule(GameRules.RULE_DROWNING_DAMAGE, true)
|
||||
.setGameRule(GameRules.RULE_SPAWN_RADIUS, 0))).asWorld();
|
||||
|
||||
player.teleportTo(level, 0, 80, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.nexia.core.commands.staff.dev;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.nexia.minigames.games.bedwars.BwGame;
|
||||
import com.nexia.minigames.games.football.FootballGame;
|
||||
import com.nexia.minigames.games.oitc.OitcGame;
|
||||
import com.nexia.minigames.games.skywars.SkywarsGame;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
|
||||
public class ForceGameEndCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register((Commands.literal("forcegameend")
|
||||
.requires(commandSourceStack -> {
|
||||
try {
|
||||
return Permissions.check(commandSourceStack, "nexia.dev.forcegameend");
|
||||
} catch (Exception ignored) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.then(Commands.argument("game", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((new String[]{"football", "oitc", "skywars", "bedwars"}), builder)))
|
||||
.executes(ForceGameEndCommand::run))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private static int run(CommandContext<CommandSourceStack> context) {
|
||||
String argument = StringArgumentType.getString(context, "game");
|
||||
|
||||
|
||||
switch (argument) {
|
||||
case "football" -> FootballGame.endGame(null);
|
||||
case "oitc" -> OitcGame.endGame(null);
|
||||
case "skywars" -> SkywarsGame.winNearestCenter();
|
||||
case "bedwars" -> BwGame.endBedwars();
|
||||
default -> {
|
||||
context.getSource().sendFailure(new TextComponent("Invalid game!"));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
context.getSource().sendSuccess(new TextComponent("Game ended (if valid)."), false);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.nexia.core.commands.staff.dev;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.utilities.chat.LegacyChatFormat;
|
||||
import com.nexia.core.utilities.item.InventoryUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
public class LoadInventoryCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register((Commands.literal("loadinventory")
|
||||
.requires(commandSourceStack -> {
|
||||
try {
|
||||
return Permissions.check(commandSourceStack, "nexia.inventory.load", 4);
|
||||
} catch (Exception ignored) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.then(Commands.argument("type", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((Objects.requireNonNull(new File(InventoryUtil.dirpath).list())), builder)))
|
||||
.then(Commands.argument("inventory", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> {
|
||||
ArrayList<String> inventoryList = new ArrayList<>();
|
||||
try {
|
||||
inventoryList = InventoryUtil.getListOfInventories(StringArgumentType.getString(context, "type"));
|
||||
} catch (Exception ignored) {
|
||||
inventoryList.add("Unable to get inventories!");
|
||||
}
|
||||
return SharedSuggestionProvider.suggest(inventoryList, builder);
|
||||
}))
|
||||
.executes(context -> run(context, StringArgumentType.getString(context, "type"), StringArgumentType.getString(context, "inventory"), context.getSource().getPlayerOrException()))
|
||||
.then(Commands.argument("player", EntityArgument.player())
|
||||
.executes(context -> run(context, StringArgumentType.getString(context, "type"), StringArgumentType.getString(context, "inventory"), EntityArgument.getPlayer(context, "player")))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private static int run(CommandContext<CommandSourceStack> context, @NotNull String type, @NotNull String inventory, @NotNull ServerPlayer player) {
|
||||
if(inventory.trim().isEmpty()) {
|
||||
context.getSource().sendFailure(LegacyChatFormat.format("Empty inventory name!"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(type.trim().isEmpty()) {
|
||||
context.getSource().sendFailure(LegacyChatFormat.format("Empty type!"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean isContextPlayer;
|
||||
try {
|
||||
isContextPlayer = context.getSource().getPlayerOrException().equals(player);
|
||||
} catch (CommandSyntaxException ignored) {
|
||||
isContextPlayer = false;
|
||||
}
|
||||
|
||||
String gearString = InventoryUtil.getGearStringFromFile(type, inventory);
|
||||
if(gearString.isEmpty()) {
|
||||
context.getSource().sendFailure(LegacyChatFormat.format("Unable to load the content of the inventory with the name '{}' in '{}'.", inventory, type));
|
||||
return 0;
|
||||
} else {
|
||||
InventoryUtil.loadInventory(new NexiaPlayer(player), type, inventory);
|
||||
|
||||
context.getSource().sendSuccess(LegacyChatFormat.format("{b1}Successfully loaded '{}' in '{}' to " + ((isContextPlayer) ? "your inventory" : "the inventory of " + player.getScoreboardName()) + ".", inventory, type), false);
|
||||
|
||||
if(!isContextPlayer){
|
||||
player.sendMessage(LegacyChatFormat.format("{b1}Your inventory has been replaced with '{}'.", inventory), Util.NIL_UUID);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,9 @@ package com.nexia.core.commands.staff.dev;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.ffa.uhc.utilities.FfaAreas;
|
||||
import com.nexia.ffa.sky.utilities.SkyFfaAreas;
|
||||
import com.nexia.minigames.games.bedwars.areas.BwAreas;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
@@ -14,11 +14,11 @@ public class ProtectionMapCommand {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("protectionmap")
|
||||
.requires(commandSourceStack -> PlayerUtil.hasPermission(commandSourceStack, "nexia.dev.protectionmap", 4))
|
||||
.requires(commandSourceStack -> Permissions.check(commandSourceStack, "nexia.dev.protectionmap", 4))
|
||||
|
||||
.then(Commands.literal("bedwars").executes(ProtectionMapCommand::bedwars))
|
||||
.then(Commands.literal("ffa")
|
||||
.then(Commands.literal("uhc").executes(ProtectionMapCommand::ffa_uhc))
|
||||
.then(Commands.literal("sky").executes(ProtectionMapCommand::ffa_sky))
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -29,10 +29,9 @@ public class ProtectionMapCommand {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int ffa_uhc(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
public static int ffa_sky(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
FfaAreas.createProtectionMap(player);
|
||||
SkyFfaAreas.createProtectionMap(player);
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.nexia.core.utilities.misc.RandomUtil;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
@@ -12,7 +12,7 @@ import net.minecraft.network.chat.TextComponent;
|
||||
public class RandomCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register(Commands.literal("random")
|
||||
.requires(commandSourceStack -> PlayerUtil.hasPermission(commandSourceStack, "nexia.staff.random", 1))
|
||||
.requires(commandSourceStack -> Permissions.check(commandSourceStack, "nexia.staff.random", 1))
|
||||
.then(Commands.argument("minimum", IntegerArgumentType.integer())
|
||||
.then(Commands.argument("maximum", IntegerArgumentType.integer())
|
||||
.executes(context -> RandomCommand.calculate(context, IntegerArgumentType.getInteger(context, "minimum"), IntegerArgumentType.getInteger(context, "maximum")))))
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.nexia.core.commands.staff.dev;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.natamus.collective_fabric.functions.PlayerFunctions;
|
||||
import com.natamus.collective_fabric.functions.StringFunctions;
|
||||
import com.nexia.core.utilities.chat.LegacyChatFormat;
|
||||
import com.nexia.core.utilities.item.InventoryUtil;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
|
||||
public class SaveInventoryCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register((Commands.literal("saveinventory")
|
||||
.requires(commandSourceStack -> {
|
||||
try {
|
||||
return Permissions.check(commandSourceStack, "nexia.inventory.save", 4);
|
||||
} catch (Exception ignored) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.then(Commands.argument("type", StringArgumentType.string())
|
||||
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((Objects.requireNonNull(new File(InventoryUtil.dirpath).list())), builder)))
|
||||
.then(Commands.argument("name", StringArgumentType.string())
|
||||
.executes(context -> run(context, StringArgumentType.getString(context, "type"), StringArgumentType.getString(context, "name")))
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private static int run(CommandContext<CommandSourceStack> context, @NotNull String type, @NotNull String inventory) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
|
||||
if(inventory.trim().isEmpty()) {
|
||||
context.getSource().sendFailure(LegacyChatFormat.format("Empty inventory name!"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(type.trim().isEmpty()) {
|
||||
context.getSource().sendFailure(LegacyChatFormat.format("Empty type!"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
String gearstring = PlayerFunctions.getPlayerGearString(player);
|
||||
if (StringFunctions.sequenceCount(gearstring, "\n") < 40) {
|
||||
context.getSource().sendFailure(LegacyChatFormat.format("Something went wrong while generating the save file content for your inventory."));
|
||||
return 0;
|
||||
} else if (!InventoryUtil.writeGearStringToFile(type, inventory, gearstring)) {
|
||||
context.getSource().sendFailure(LegacyChatFormat.format("Something went wrong while saving the content of your inventory as '{}' in '{}'.", inventory, type));
|
||||
return 0;
|
||||
} else {
|
||||
context.getSource().sendFailure(LegacyChatFormat.format("Successfully saved your inventory as '{}' in '{}'.", inventory, type));
|
||||
context.getSource().sendFailure(LegacyChatFormat.format("{b1}You can load it with the command '/loadinventory {} {}'.", type, inventory));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.nexia.core.commands.staff.dev;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.utilities.chat.LegacyChatFormat;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import com.nexia.minigames.games.bedwars.util.BwUtil;
|
||||
import com.nexia.minigames.games.football.FootballGame;
|
||||
import com.nexia.minigames.games.oitc.OitcGame;
|
||||
import com.nexia.minigames.games.skywars.SkywarsGame;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class SkipQueueCommand {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register((Commands.literal("skipqueue")
|
||||
.requires(commandSourceStack -> Permissions.check(commandSourceStack, "nexia.staff.skipqueue", 1)))
|
||||
.executes(SkipQueueCommand::currentGamemode)
|
||||
.then(Commands.literal("oitc").executes(SkipQueueCommand::oitc))
|
||||
.then(Commands.literal("sw").executes(SkipQueueCommand::skywars))
|
||||
.then(Commands.literal("bw").executes(SkipQueueCommand::bedwars))
|
||||
.then(Commands.literal("football").executes(SkipQueueCommand::football))
|
||||
);
|
||||
}
|
||||
|
||||
private static int currentGamemode(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
PlayerGameMode gameMode = ((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player.getUUID())).gameMode;
|
||||
|
||||
if(gameMode.equals(PlayerGameMode.SKYWARS)) return skywars(context);
|
||||
if(gameMode.equals(PlayerGameMode.BEDWARS)) return bedwars(context);
|
||||
if(gameMode.equals(PlayerGameMode.OITC)) return oitc(context);
|
||||
if(gameMode.equals(PlayerGameMode.FOOTBALL)) return football(context);
|
||||
|
||||
player.sendMessage(LegacyChatFormat.formatFail("No gamemode found!"), Util.NIL_UUID);
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static int skywars(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
|
||||
if (SkywarsGame.isStarted || SkywarsGame.queueTime <= 1) {
|
||||
player.sendMessage(new TextComponent("Epic queue skip failure"), Util.NIL_UUID);
|
||||
} else {
|
||||
SkywarsGame.queueTime = 1;
|
||||
player.sendMessage(new TextComponent("Skipped queue"), Util.NIL_UUID);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int football(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
|
||||
if (FootballGame.isStarted || FootballGame.queueTime <= 1) {
|
||||
player.sendMessage(new TextComponent("Epic queue skip failure"), Util.NIL_UUID);
|
||||
} else {
|
||||
FootballGame.queueTime = 1;
|
||||
player.sendMessage(new TextComponent("Skipped queue"), Util.NIL_UUID);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
private static int oitc(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
|
||||
if (OitcGame.isStarted || OitcGame.queueTime <= 1) {
|
||||
player.sendMessage(new TextComponent("Epic queue skip failure"), Util.NIL_UUID);
|
||||
} else {
|
||||
OitcGame.queueTime = 1;
|
||||
player.sendMessage(new TextComponent("Skipped queue"), Util.NIL_UUID);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int bedwars(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
|
||||
if (BwUtil.skipQueue()) {
|
||||
player.sendMessage(new TextComponent("Skipped queue"), Util.NIL_UUID);
|
||||
} else {
|
||||
player.sendMessage(new TextComponent("Epic queue skip failure"), Util.NIL_UUID);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.nexia.core.commands.staff.dev;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.minigames.games.bedwars.util.BwUtil;
|
||||
import com.nexia.minigames.games.skywars.SkywarsGame;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class SwSkipQueueCommand {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean bl) {
|
||||
dispatcher.register((Commands.literal("swskipqueue")
|
||||
.requires(commandSourceStack -> PlayerUtil.hasPermission(commandSourceStack, "nexia.staff.swskipqueue", 1)))
|
||||
.executes(SwSkipQueueCommand::run)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
private static int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
|
||||
if (SkywarsGame.isStarted || SkywarsGame.queueTime <= 1) {
|
||||
player.sendMessage(new TextComponent("Epic queue skip failure"), Util.NIL_UUID);
|
||||
} else {
|
||||
SkywarsGame.queueTime = 1;
|
||||
player.sendMessage(new TextComponent("Skipped queue"), Util.NIL_UUID);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -2,29 +2,19 @@ package com.nexia.core.config;
|
||||
|
||||
import me.sargunvohra.mcmods.autoconfig1u.ConfigData;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.annotation.Config;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.shadowed.blue.endless.jankson.Comment;
|
||||
|
||||
@Config(name = "nexia-core")
|
||||
public class ModConfig implements ConfigData {
|
||||
|
||||
@Comment("List of ranks.")
|
||||
public String[] ranks = {""};
|
||||
public double[] lobbyPos = {
|
||||
0.5,
|
||||
65.0,
|
||||
0.5,
|
||||
};
|
||||
public String[] rules = {""};
|
||||
|
||||
public String serverType = "";
|
||||
|
||||
public Enhancements enhancements = new Enhancements();
|
||||
public static class Enhancements {
|
||||
@Comment("Toggles if the better shields are enabled.")
|
||||
public boolean betterShields = false;
|
||||
public boolean debugMode = false;
|
||||
|
||||
@Comment("Modifies the pearl cooldown in ticks (20 ticks = 1 second).")
|
||||
public int enderpearlCooldown = 20;
|
||||
|
||||
@Comment("Remove Projectiles going through players [EXPERIMENTAL]")
|
||||
public boolean projectilePatch = false;
|
||||
}
|
||||
public String host = "";
|
||||
public String database = "";
|
||||
public String username = "";
|
||||
public String password = "";
|
||||
public int port = 27017;
|
||||
}
|
||||
@@ -1,60 +1,74 @@
|
||||
package com.nexia.core.games.util;
|
||||
|
||||
import com.combatreforged.factory.api.world.entity.player.Player;
|
||||
import com.nexia.core.Main;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.item.ItemDisplayUtil;
|
||||
import com.nexia.core.utilities.item.ItemStackUtil;
|
||||
import com.nexia.core.utilities.player.PlayerDataManager;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.player.BanHandler;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import com.nexia.core.utilities.player.GamemodeBanHandler;
|
||||
import com.nexia.core.utilities.pos.EntityPos;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import com.nexia.ffa.FfaGameMode;
|
||||
import com.nexia.ffa.FfaUtil;
|
||||
import com.nexia.ffa.classic.utilities.FfaAreas;
|
||||
import com.nexia.core.utilities.ranks.NexiaRank;
|
||||
import com.nexia.core.utilities.world.WorldUtil;
|
||||
import com.nexia.ffa.base.BaseFfaUtil;
|
||||
import com.nexia.ffa.classic.utilities.FfaClassicUtil;
|
||||
import com.nexia.ffa.kits.FfaKit;
|
||||
import com.nexia.ffa.kits.utilities.FfaKitsUtil;
|
||||
import com.nexia.ffa.pot.utilities.FfaPotUtil;
|
||||
import com.nexia.ffa.uhc.utilities.FfaUhcUtil;
|
||||
import com.nexia.minigames.games.bedwars.players.BwPlayerEvents;
|
||||
import com.nexia.minigames.games.bedwars.util.BwScoreboard;
|
||||
import com.nexia.minigames.games.bedwars.util.BwUtil;
|
||||
import com.nexia.minigames.games.duels.DuelGameHandler;
|
||||
import com.nexia.minigames.games.football.FootballGame;
|
||||
import com.nexia.minigames.games.football.FootballGameMode;
|
||||
import com.nexia.minigames.games.football.util.player.FootballPlayerData;
|
||||
import com.nexia.minigames.games.oitc.OitcGame;
|
||||
import com.nexia.minigames.games.oitc.OitcGameMode;
|
||||
import com.nexia.minigames.games.oitc.util.player.OITCPlayerData;
|
||||
import com.nexia.minigames.games.skywars.SkywarsGame;
|
||||
import com.nexia.minigames.games.skywars.SkywarsGameMode;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
import com.nexia.minigames.games.skywars.util.player.SkywarsPlayerData;
|
||||
import com.nexia.nexus.api.world.World;
|
||||
import com.nexia.nexus.api.world.nbt.NBTObject;
|
||||
import com.nexia.nexus.api.world.nbt.NBTValue;
|
||||
import com.nexia.nexus.api.world.types.Minecraft;
|
||||
import com.nexia.nexus.api.world.util.Location;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.protocol.game.ClientboundStopSoundPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.GameType;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static com.nexia.core.utilities.player.BanHandler.getBanTime;
|
||||
|
||||
public class LobbyUtil {
|
||||
|
||||
public static String[] statsGameModes = {"FFA CLASSIC", "POT FFA", "UHC FFA", "KIT FFA", "BEDWARS", "OITC", "DUELS", "SKYWARS"};
|
||||
public static String[] statsGameModes = {"FFA CLASSIC", "SKY FFA", "UHC FFA", "KIT FFA", "BEDWARS", "OITC", "DUELS", "SKYWARS", "FOOTBALL"};
|
||||
|
||||
public static ServerLevel lobbyWorld = null;
|
||||
public static EntityPos lobbySpawn = new EntityPos(Main.config.lobbyPos[0], Main.config.lobbyPos[1], Main.config.lobbyPos[2], 0, 0);
|
||||
|
||||
public static World nexusLobbyWorld = null;
|
||||
public static Location nexusLobbyLocation = null;
|
||||
|
||||
public static EntityPos lobbySpawn = new EntityPos(0.5, 65, 0.5, 0, 0);
|
||||
|
||||
public static boolean isLobbyWorld(Level level) {
|
||||
return level.dimension() == Level.OVERWORLD;
|
||||
}
|
||||
|
||||
public static boolean isLobbyWorld(World world) {
|
||||
return world.getIdentifier().pure().equals("minecraft:overworld");
|
||||
}
|
||||
|
||||
public static void setLobbyWorld(MinecraftServer server) {
|
||||
for (ServerLevel level : server.getAllLevels()) {
|
||||
if (isLobbyWorld(level)) {
|
||||
lobbyWorld = level;
|
||||
nexusLobbyWorld = WorldUtil.getWorld(level);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
nexusLobbyLocation = new Location(lobbySpawn.x, lobbySpawn.y, lobbySpawn.z, lobbySpawn.yaw, lobbySpawn.pitch, nexusLobbyWorld);
|
||||
}
|
||||
|
||||
// Players with the tag will not be affected by server rank teams given by server datapack
|
||||
@@ -67,277 +81,241 @@ public class LobbyUtil {
|
||||
public static final String NO_SATURATION_TAG = "no_saturation";
|
||||
|
||||
public static String[] removedTags = {
|
||||
"in_bedwars",
|
||||
"ffa",
|
||||
"ffa_classic",
|
||||
"ffa_kits",
|
||||
"ffa_pot",
|
||||
"ffa_uhc",
|
||||
PlayerGameMode.BEDWARS.tag,
|
||||
"bedwars",
|
||||
PlayerGameMode.FOOTBALL.tag,
|
||||
"in_football_game",
|
||||
"duels",
|
||||
"skywars",
|
||||
"oitc",
|
||||
PlayerGameMode.SKYWARS.tag,
|
||||
PlayerGameMode.OITC.tag,
|
||||
"in_oitc_game",
|
||||
"in_kitroom",
|
||||
NO_RANK_DISPLAY_TAG,
|
||||
NO_SATURATION_TAG,
|
||||
NO_FALL_DAMAGE_TAG
|
||||
NO_FALL_DAMAGE_TAG,
|
||||
NO_DAMAGE_TAG
|
||||
};
|
||||
|
||||
public static void leaveAllGames(ServerPlayer minecraftPlayer, boolean tp) {
|
||||
Player player = PlayerUtil.getFactoryPlayer(minecraftPlayer);
|
||||
if (BwUtil.isInBedWars(minecraftPlayer)) {
|
||||
BwPlayerEvents.leaveInBedWars(minecraftPlayer);
|
||||
}
|
||||
else if (FfaUtil.isFfaPlayer(minecraftPlayer)) {
|
||||
FfaUtil.leaveOrDie(minecraftPlayer, minecraftPlayer.getLastDamageSource(), true);
|
||||
}
|
||||
else if (PlayerDataManager.get(minecraftPlayer).gameMode == PlayerGameMode.LOBBY) {
|
||||
DuelGameHandler.leave(minecraftPlayer, false);
|
||||
}
|
||||
else if (PlayerDataManager.get(minecraftPlayer).gameMode == PlayerGameMode.OITC) {
|
||||
OitcGame.leave(minecraftPlayer);
|
||||
}
|
||||
else if (PlayerDataManager.get(minecraftPlayer).gameMode == PlayerGameMode.SKYWARS) {
|
||||
SkywarsGame.leave(minecraftPlayer);
|
||||
}
|
||||
|
||||
PlayerUtil.sendBossbar(SkywarsGame.BOSSBAR, minecraftPlayer, true);
|
||||
BwScoreboard.removeScoreboardFor(minecraftPlayer);
|
||||
minecraftPlayer.setGlowing(false);
|
||||
minecraftPlayer.setGameMode(GameType.ADVENTURE);
|
||||
|
||||
for(int i = 0; i < LobbyUtil.removedTags.length; i++){
|
||||
if(player.hasTag(LobbyUtil.removedTags[i])){
|
||||
player.removeTag(LobbyUtil.removedTags[i]);
|
||||
}
|
||||
}
|
||||
|
||||
returnToLobby(minecraftPlayer, tp);
|
||||
}
|
||||
|
||||
public static void returnToLobby(ServerPlayer minecraftPlayer, boolean tp) {
|
||||
Player player = PlayerUtil.getFactoryPlayer(minecraftPlayer);
|
||||
for(int i = 0; i < LobbyUtil.removedTags.length; i++){
|
||||
if(player.hasTag(LobbyUtil.removedTags[i])){
|
||||
player.removeTag(LobbyUtil.removedTags[i]);
|
||||
}
|
||||
}
|
||||
|
||||
minecraftPlayer.setInvulnerable(false);
|
||||
|
||||
minecraftPlayer.abilities.mayfly = false;
|
||||
minecraftPlayer.abilities.flying = false;
|
||||
minecraftPlayer.onUpdateAbilities();
|
||||
minecraftPlayer.setGlowing(false);
|
||||
|
||||
PlayerUtil.resetHealthStatus(player);
|
||||
minecraftPlayer.setGameMode(GameType.ADVENTURE);
|
||||
|
||||
player.getInventory().clear();
|
||||
minecraftPlayer.inventory.setCarried(ItemStack.EMPTY);
|
||||
minecraftPlayer.getEnderChestInventory().clearContent();
|
||||
minecraftPlayer.setExperiencePoints(0);
|
||||
public static void returnToLobby(NexiaPlayer player, boolean tp) {
|
||||
player.leaveAllGames();
|
||||
player.reset(true, Minecraft.GameMode.ADVENTURE);
|
||||
|
||||
// Duels shit
|
||||
player.addTag("duels");
|
||||
DuelGameHandler.leave(minecraftPlayer, false);
|
||||
DuelGameHandler.leave(player, false);
|
||||
|
||||
if (tp) {
|
||||
minecraftPlayer.setRespawnPosition(lobbyWorld.dimension(), lobbySpawn.toBlockPos(), lobbySpawn.yaw, true, false);
|
||||
minecraftPlayer.teleportTo(lobbyWorld, lobbySpawn.x, lobbySpawn.y, lobbySpawn.z, lobbySpawn.pitch, lobbySpawn.yaw);
|
||||
player.setRespawnPosition(nexusLobbyLocation, lobbySpawn.yaw, true, false);
|
||||
player.teleport(nexusLobbyLocation);
|
||||
|
||||
if(Permissions.check(minecraftPlayer, "nexia.prefix.supporter")) {
|
||||
minecraftPlayer.abilities.mayfly = true;
|
||||
minecraftPlayer.onUpdateAbilities();
|
||||
if(player.hasPrefix(NexiaRank.SUPPORTER)) {
|
||||
player.setAbleToFly(true);
|
||||
}
|
||||
|
||||
LobbyUtil.giveItems(minecraftPlayer);
|
||||
LobbyUtil.giveItems(player);
|
||||
}
|
||||
|
||||
minecraftPlayer.connection.send(new ClientboundStopSoundPacket());
|
||||
((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player)).gameMode = PlayerGameMode.LOBBY;
|
||||
|
||||
PlayerDataManager.get(minecraftPlayer).gameMode = PlayerGameMode.LOBBY;
|
||||
player.removeTag(LobbyUtil.NO_RANK_DISPLAY_TAG);
|
||||
player.removeTag(LobbyUtil.NO_FALL_DAMAGE_TAG);
|
||||
player.removeTag(LobbyUtil.NO_DAMAGE_TAG);
|
||||
ServerTime.minecraftServer.getPlayerList().sendPlayerPermissionLevel(minecraftPlayer);
|
||||
player.setBedrockBridging(true);
|
||||
}
|
||||
|
||||
public static void giveItems(ServerPlayer minecraftPlayer) {
|
||||
ItemStack compass = new ItemStack(Items.COMPASS);
|
||||
compass.setHoverName(new TextComponent("§eGamemode Selector"));
|
||||
ItemDisplayUtil.addGlint(compass);
|
||||
ItemDisplayUtil.addLore(compass, "§eRight click §7to open the menu.", 0);
|
||||
public static void giveItems(NexiaPlayer player) {
|
||||
|
||||
ItemStack nameTag = new ItemStack(Items.NAME_TAG);
|
||||
nameTag.setHoverName(new TextComponent("§ePrefix Selector"));
|
||||
ItemDisplayUtil.addGlint(nameTag);
|
||||
ItemDisplayUtil.addLore(nameTag, "§eRight click §7to open the menu.", 0);
|
||||
NBTObject hideAttributesNBTObject = NBTObject.create();
|
||||
hideAttributesNBTObject.set("HideFlags", NBTValue.of(39));
|
||||
|
||||
ItemStack queueSword = new ItemStack(Items.IRON_SWORD);
|
||||
queueSword.setHoverName(new TextComponent("§eQueue Sword"));
|
||||
ItemDisplayUtil.addGlint(queueSword);
|
||||
ItemDisplayUtil.addLore(queueSword, "§eRight click §7to queue menu.", 0);
|
||||
ItemDisplayUtil.addLore(queueSword, "§eHit a player §7to duel them.", 1);
|
||||
NBTObject unbreakableNBTObject = hideAttributesNBTObject.copy();
|
||||
unbreakableNBTObject.set("Unbreakable", NBTValue.of(1));
|
||||
|
||||
ItemStack teamSword = new ItemStack(Items.IRON_AXE);
|
||||
teamSword.setHoverName(new TextComponent("§eTeam Axe"));
|
||||
ItemDisplayUtil.addGlint(teamSword);
|
||||
ItemDisplayUtil.addLore(teamSword, "§eRight click §7to list the team.", 0);
|
||||
ItemDisplayUtil.addLore(teamSword, "§eHit a player §7to invite them to your team.", 1);
|
||||
com.nexia.nexus.api.world.item.ItemStack compass = com.nexia.nexus.api.world.item.ItemStack.create(Minecraft.Item.COMPASS);
|
||||
compass.setItemNBT(hideAttributesNBTObject.copy());
|
||||
compass.setLore(Component.text("Right click to open the gamemode selector menu.", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false));
|
||||
compass.setDisplayName(Component.text("Gamemode Selector", ChatFormat.Minecraft.yellow).decoration(ChatFormat.italic, false));
|
||||
|
||||
if(Permissions.check(minecraftPlayer, "nexia.prefix.supporter")) {
|
||||
ItemStack elytra = new ItemStack(Items.ELYTRA);
|
||||
elytra.setHoverName(new TextComponent("§5§lSupporter Elytra"));
|
||||
ItemDisplayUtil.addGlint(elytra);
|
||||
elytra.getOrCreateTag().putBoolean("Unbreakable", true);
|
||||
ItemDisplayUtil.addLore(elytra, "§7Thanks for supporting the server!", 0);
|
||||
elytra.hideTooltipPart(ItemStack.TooltipPart.UNBREAKABLE);
|
||||
minecraftPlayer.setItemSlot(EquipmentSlot.CHEST, elytra);
|
||||
|
||||
com.nexia.nexus.api.world.item.ItemStack nameTag = com.nexia.nexus.api.world.item.ItemStack.create(Minecraft.Item.NAME_TAG);
|
||||
nameTag.setItemNBT(hideAttributesNBTObject.copy());
|
||||
nameTag.setLore(Component.text("Right click to open the prefix selector menu.", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false));
|
||||
nameTag.setDisplayName(Component.text("Prefix Selector", ChatFormat.Minecraft.yellow).decoration(ChatFormat.italic, false));
|
||||
|
||||
|
||||
com.nexia.nexus.api.world.item.ItemStack queueSword = com.nexia.nexus.api.world.item.ItemStack.create(Minecraft.Item.IRON_SWORD);
|
||||
queueSword.setItemNBT(unbreakableNBTObject.copy());
|
||||
queueSword.setLore(new ArrayList<>(Arrays.asList(
|
||||
Component.text("Right click to open the queue menu.", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false),
|
||||
Component.text("Hit a player to duel them.", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false)
|
||||
)));
|
||||
queueSword.setDisplayName(Component.text("Duel Sword", ChatFormat.Minecraft.yellow).decoration(ChatFormat.italic, false));
|
||||
|
||||
|
||||
com.nexia.nexus.api.world.item.ItemStack teamSword = com.nexia.nexus.api.world.item.ItemStack.create(Minecraft.Item.IRON_AXE);
|
||||
teamSword.setItemNBT(unbreakableNBTObject.copy());
|
||||
teamSword.setLore(new ArrayList<>(Arrays.asList(
|
||||
Component.text("Right click to list the team you're in.", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false),
|
||||
Component.text("Hit a player to invite them to your team.", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false)
|
||||
)));
|
||||
teamSword.setDisplayName(Component.text("Team Axe", ChatFormat.Minecraft.yellow).decoration(ChatFormat.italic, false));
|
||||
|
||||
|
||||
com.nexia.nexus.api.world.item.ItemStack customDuelSword = com.nexia.nexus.api.world.item.ItemStack.create(Minecraft.Item.DIAMOND_SWORD);
|
||||
customDuelSword.setItemNBT(unbreakableNBTObject.copy());
|
||||
customDuelSword.setLore(Component.text("Hit a player to duel them in your custom kit.", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false));
|
||||
customDuelSword.setDisplayName(Component.text("Custom Duel Sword", ChatFormat.Minecraft.yellow).decoration(ChatFormat.italic, false));
|
||||
|
||||
if(player.hasPrefix(NexiaRank.SUPPORTER)) {
|
||||
|
||||
com.nexia.nexus.api.world.item.ItemStack elytra = com.nexia.nexus.api.world.item.ItemStack.create(Minecraft.Item.ELYTRA);
|
||||
elytra.setItemNBT(unbreakableNBTObject.copy());
|
||||
elytra.setLore(Component.text("Thanks for supporting the server!", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false));
|
||||
elytra.setDisplayName(Component.text("Supporter Elytra", ChatFormat.brandColor2).decorate(ChatFormat.bold).decoration(ChatFormat.italic, false));
|
||||
|
||||
player.getInventory().setItemStack(38, elytra);
|
||||
}
|
||||
|
||||
|
||||
minecraftPlayer.setSlot(4, compass); //middle slot
|
||||
minecraftPlayer.setSlot(3, nameTag); //left
|
||||
minecraftPlayer.setSlot(5, queueSword); //right
|
||||
minecraftPlayer.setSlot(8, teamSword); // like right right not right
|
||||
ItemStackUtil.sendInventoryRefreshPacket(minecraftPlayer);
|
||||
player.getInventory().setItemStack(0, customDuelSword); // 1st slot
|
||||
player.getInventory().setItemStack(4, compass); // middle slot
|
||||
player.getInventory().setItemStack(3, nameTag); // left
|
||||
player.getInventory().setItemStack(5, queueSword); // right
|
||||
player.getInventory().setItemStack(8, teamSword); // like right right not right
|
||||
|
||||
player.refreshInventory();
|
||||
}
|
||||
|
||||
public static void sendGame(ServerPlayer minecraftPlayer, String game, boolean message, boolean tp){
|
||||
Player player = PlayerUtil.getFactoryPlayer(minecraftPlayer);
|
||||
minecraftPlayer.setInvulnerable(false);
|
||||
public static boolean checkGameModeBan(NexiaPlayer player, String game) {
|
||||
ArrayList<PlayerGameMode> bannedGameModes = GamemodeBanHandler.getBannedGameModes(player);
|
||||
if(bannedGameModes.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
minecraftPlayer.abilities.mayfly = false;
|
||||
minecraftPlayer.onUpdateAbilities();
|
||||
for(PlayerGameMode gameMode : bannedGameModes) {
|
||||
if(game.toLowerCase().contains(gameMode.id.toLowerCase())) {
|
||||
|
||||
if((game.equalsIgnoreCase("classic ffa") && !FfaClassicUtil.canGoToSpawn(minecraftPlayer)) ||
|
||||
(game.equalsIgnoreCase("kits ffa") && !FfaKitsUtil.canGoToSpawn(minecraftPlayer) ||
|
||||
(game.equalsIgnoreCase("pot ffa") && !FfaPotUtil.canGoToSpawn(minecraftPlayer) ||
|
||||
(game.equalsIgnoreCase("uhc ffa") && !FfaUhcUtil.canGoToSpawn(minecraftPlayer))))) {
|
||||
JSONObject banJSON = GamemodeBanHandler.getBanList(player.getUUID(), gameMode);
|
||||
|
||||
player.sendMessage(Component.text("You must be fully healed to go to spawn!").color(ChatFormat.failColor));
|
||||
if (banJSON != null) {
|
||||
LocalDateTime banTime = getBanTime((String) banJSON.get("duration"));
|
||||
if(LocalDateTime.now().isAfter(banTime)) {
|
||||
GamemodeBanHandler.removeBanFromList(player.getUUID(), gameMode);
|
||||
return false;
|
||||
} else {
|
||||
player.sendNexiaMessage(
|
||||
Component.text("You are gamemode (" + gameMode.name + ") banned for ", ChatFormat.Minecraft.white)
|
||||
.append(Component.text(BanHandler.banTimeToText(banTime), ChatFormat.brandColor2))
|
||||
.append(Component.text(".\nReason: ", ChatFormat.Minecraft.white))
|
||||
.append(Component.text((String) banJSON.get("reason"), ChatFormat.brandColor2))
|
||||
);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
player.sendNexiaMessage("You are gamemode (%s) banned!", gameMode.name);
|
||||
}
|
||||
|
||||
LobbyUtil.returnToLobby(player, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void sendGame(NexiaPlayer player, String game, boolean message, boolean tp) {
|
||||
|
||||
if (checkGameModeBan(player, game)) {
|
||||
return;
|
||||
}
|
||||
|
||||
DuelGameHandler.leave(minecraftPlayer, true);
|
||||
player.setBedrockBridging(true);
|
||||
|
||||
if (!LobbyUtil.isLobbyWorld(minecraftPlayer.getLevel())) {
|
||||
LobbyUtil.leaveAllGames(minecraftPlayer, false);
|
||||
} else{
|
||||
PlayerUtil.resetHealthStatus(player);
|
||||
minecraftPlayer.setGameMode(GameType.ADVENTURE);
|
||||
|
||||
player.getInventory().clear();
|
||||
minecraftPlayer.inventory.setCarried(ItemStack.EMPTY);
|
||||
minecraftPlayer.getEnderChestInventory().clearContent();
|
||||
|
||||
minecraftPlayer.connection.send(new ClientboundStopSoundPacket());
|
||||
|
||||
player.removeTag(LobbyUtil.NO_FALL_DAMAGE_TAG);
|
||||
player.removeTag(LobbyUtil.NO_DAMAGE_TAG);
|
||||
player.removeTag("duels");
|
||||
player.removeTag(LobbyUtil.NO_SATURATION_TAG);
|
||||
for (BaseFfaUtil util : BaseFfaUtil.ffaUtils) {
|
||||
if (game.equalsIgnoreCase(util.getNameLowercase() + " ffa") && !util.canGoToSpawn(player)) {
|
||||
player.sendNexiaMessage("You must be fully healed to go to spawn!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(game.equalsIgnoreCase("classic ffa") ||
|
||||
if (player.hasTag("duels")) {
|
||||
player.removeTag("duels");
|
||||
DuelGameHandler.leave(player, true);
|
||||
}
|
||||
|
||||
player.reset(true, Minecraft.GameMode.ADVENTURE);
|
||||
player.leaveAllGames();
|
||||
|
||||
if (game.equalsIgnoreCase("classic ffa") ||
|
||||
game.equalsIgnoreCase("kits ffa") ||
|
||||
game.equalsIgnoreCase("pot ffa") ||
|
||||
game.equalsIgnoreCase("sky ffa") ||
|
||||
game.equalsIgnoreCase("uhc ffa")) {
|
||||
player.addTag("ffa");
|
||||
PlayerDataManager.get(minecraftPlayer).gameMode = PlayerGameMode.FFA;
|
||||
if(message){ player.sendActionBarMessage(Component.text("You have joined §8🗡 §7§lFFA §b🔱")); }
|
||||
((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player)).gameMode = PlayerGameMode.FFA;
|
||||
if (message) { player.sendActionBarMessage(Component.text("You have joined §8🗡 §7§lFFA §b🔱")); }
|
||||
}
|
||||
|
||||
if(game.equalsIgnoreCase("classic ffa")){
|
||||
player.addTag("ffa_classic");
|
||||
FfaClassicUtil.wasInSpawn.add(player.getUUID());
|
||||
PlayerDataManager.get(minecraftPlayer).ffaGameMode = FfaGameMode.CLASSIC;
|
||||
if(tp){
|
||||
minecraftPlayer.teleportTo(FfaAreas.ffaWorld, FfaAreas.spawn.x, FfaAreas.spawn.y, FfaAreas.spawn.z, FfaAreas.spawn.yaw, FfaAreas.spawn.pitch);
|
||||
minecraftPlayer.setRespawnPosition(FfaAreas.ffaWorld.dimension(), FfaAreas.spawn.toBlockPos(), FfaAreas.spawn.yaw, true, false);
|
||||
for (BaseFfaUtil util : BaseFfaUtil.ffaUtils) {
|
||||
if (game.equalsIgnoreCase(util.getNameLowercase() + " ffa")) {
|
||||
player.addTag(NO_FALL_DAMAGE_TAG);
|
||||
((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player)).ffaGameMode = util.getGameMode();
|
||||
if (tp) {
|
||||
player.setRespawnPosition(util.getRespawnLocation(), util.getSpawn().yaw, true, false);
|
||||
}
|
||||
|
||||
util.join(player, tp);
|
||||
util.clearProjectiles(player);
|
||||
}
|
||||
|
||||
FfaClassicUtil.clearThrownTridents(minecraftPlayer);
|
||||
FfaClassicUtil.setInventory(minecraftPlayer);
|
||||
}
|
||||
|
||||
if(game.equalsIgnoreCase("pot ffa")){
|
||||
player.addTag("ffa_pot");
|
||||
FfaPotUtil.wasInSpawn.add(player.getUUID());
|
||||
PlayerDataManager.get(minecraftPlayer).ffaGameMode = FfaGameMode.POT;
|
||||
if(tp){
|
||||
FfaPotUtil.sendToSpawn(minecraftPlayer);
|
||||
minecraftPlayer.setRespawnPosition(com.nexia.ffa.pot.utilities.FfaAreas.ffaWorld.dimension(), com.nexia.ffa.pot.utilities.FfaAreas.spawn.toBlockPos(), com.nexia.ffa.pot.utilities.FfaAreas.spawn.yaw, true, false);
|
||||
}
|
||||
|
||||
FfaPotUtil.clearEnderpearls(minecraftPlayer);
|
||||
FfaPotUtil.clearExperience(minecraftPlayer, true);
|
||||
if (game.equalsIgnoreCase("classic ffa")) {
|
||||
FfaClassicUtil.INSTANCE.setInventory(player);
|
||||
}
|
||||
|
||||
if(game.equalsIgnoreCase("uhc ffa")){
|
||||
player.addTag("ffa_uhc");
|
||||
FfaUhcUtil.wasInSpawn.add(player.getUUID());
|
||||
PlayerDataManager.get(minecraftPlayer).ffaGameMode = FfaGameMode.UHC;
|
||||
if(tp){
|
||||
FfaUhcUtil.sendToSpawn(minecraftPlayer);
|
||||
minecraftPlayer.setRespawnPosition(com.nexia.ffa.uhc.utilities.FfaAreas.ffaWorld.dimension(), com.nexia.ffa.uhc.utilities.FfaAreas.spawn.toBlockPos(), com.nexia.ffa.uhc.utilities.FfaAreas.spawn.yaw, true, false);
|
||||
}
|
||||
|
||||
FfaUhcUtil.clearArrows(minecraftPlayer);
|
||||
FfaUhcUtil.clearTrident(minecraftPlayer);
|
||||
}
|
||||
|
||||
if(game.equalsIgnoreCase("kits ffa")){
|
||||
player.addTag("ffa_kits");
|
||||
FfaKitsUtil.wasInSpawn.add(player.getUUID());
|
||||
PlayerDataManager.get(minecraftPlayer).ffaGameMode = FfaGameMode.KITS;
|
||||
if(tp){
|
||||
FfaKitsUtil.sendToSpawn(minecraftPlayer);
|
||||
minecraftPlayer.setRespawnPosition(com.nexia.ffa.kits.utilities.FfaAreas.ffaWorld.dimension(), com.nexia.ffa.kits.utilities.FfaAreas.spawn.toBlockPos(), com.nexia.ffa.kits.utilities.FfaAreas.spawn.yaw, true, false);
|
||||
}
|
||||
|
||||
FfaKitsUtil.clearThrownTridents(minecraftPlayer);
|
||||
FfaKitsUtil.clearArrows(minecraftPlayer);
|
||||
FfaKitsUtil.clearSpectralArrows(minecraftPlayer);
|
||||
}
|
||||
|
||||
if(game.equalsIgnoreCase("bedwars")){
|
||||
if (game.equalsIgnoreCase("bedwars")) {
|
||||
if(message){ player.sendActionBarMessage(Component.text("You have joined §b\uD83E\uDE93 §c§lBedwars §e⚡"));}
|
||||
BwPlayerEvents.tryToJoin(minecraftPlayer, false);
|
||||
BwPlayerEvents.tryToJoin(player, false);
|
||||
}
|
||||
|
||||
if(game.equalsIgnoreCase("duels")){
|
||||
LobbyUtil.leaveAllGames(minecraftPlayer, tp);
|
||||
if (game.equalsIgnoreCase("duels")) {
|
||||
LobbyUtil.returnToLobby(player, tp);
|
||||
|
||||
if(message){
|
||||
player.sendActionBarMessage(Component.text("You have joined §f☯ §c§lDuels §7\uD83E\uDE93"));
|
||||
player.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("Duels has now moved here. (main hub)").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
);
|
||||
player.sendMessage(Component.text("Meaning you can now use /duel, /queue and /spectate inside of the normal hub WITHOUT going to duels!").decoration(ChatFormat.bold, false));
|
||||
player.sendNexiaMessage("Duels has now moved here. (main hub)");
|
||||
player.sendMessage(Component.text("Meaning you can now use /duel, /queue and /spectate inside of the normal hub WITHOUT going to duels!"));
|
||||
}
|
||||
}
|
||||
|
||||
if(game.equalsIgnoreCase("oitc")){
|
||||
player.addTag("oitc");
|
||||
PlayerDataManager.get(minecraftPlayer).gameMode = PlayerGameMode.OITC;
|
||||
OitcGame.death(minecraftPlayer, minecraftPlayer.getLastDamageSource());
|
||||
player.addTag(OitcGame.OITC_TAG);
|
||||
((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player)).gameMode = PlayerGameMode.OITC;
|
||||
OitcGame.death(player, null);
|
||||
|
||||
com.nexia.minigames.games.oitc.util.player.PlayerDataManager.get(minecraftPlayer).gameMode = OitcGameMode.LOBBY;
|
||||
((OITCPlayerData)PlayerDataManager.getDataManager(NexiaCore.OITC_DATA_MANAGER).get(player)).gameMode = OitcGameMode.LOBBY;
|
||||
|
||||
OitcGame.joinQueue(minecraftPlayer);
|
||||
OitcGame.joinQueue(player);
|
||||
|
||||
if(message){player.sendActionBarMessage(Component.text("You have joined §7\uD83D\uDDE1 §f§lOITC §7\uD83C\uDFF9"));}
|
||||
}
|
||||
|
||||
if(game.equalsIgnoreCase("football")){
|
||||
player.addTag(FootballGame.FOOTBALL_TAG);
|
||||
((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player)).gameMode = PlayerGameMode.FOOTBALL;
|
||||
((FootballPlayerData)PlayerDataManager.getDataManager(NexiaCore.FOOTBALL_DATA_MANAGER).get(player)).gameMode = FootballGameMode.LOBBY;
|
||||
|
||||
FootballGame.joinQueue(player);
|
||||
|
||||
if(message){player.sendActionBarMessage(Component.text("You have joined §7○ §7§lFootball §7\uD83D\uDDE1"));}
|
||||
}
|
||||
|
||||
|
||||
if(game.equalsIgnoreCase("skywars")){
|
||||
player.addTag("skywars");
|
||||
PlayerDataManager.get(minecraftPlayer).gameMode = PlayerGameMode.SKYWARS;
|
||||
SkywarsGame.death(minecraftPlayer, minecraftPlayer.getLastDamageSource());
|
||||
player.addTag(PlayerGameMode.SKYWARS.tag);
|
||||
((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player)).gameMode = PlayerGameMode.SKYWARS;
|
||||
SkywarsGame.death(player, null);
|
||||
|
||||
com.nexia.minigames.games.skywars.util.player.PlayerDataManager.get(minecraftPlayer).gameMode = SkywarsGameMode.LOBBY;
|
||||
((SkywarsPlayerData)PlayerDataManager.getDataManager(NexiaCore.SKYWARS_DATA_MANAGER).get(player)).gameMode = SkywarsGameMode.LOBBY;
|
||||
|
||||
SkywarsGame.joinQueue(minecraftPlayer);
|
||||
SkywarsGame.joinQueue(player);
|
||||
|
||||
if(message){player.sendActionBarMessage(Component.text("You have joined §7☐ §aSkywars §7\uD83D\uDDE1"));}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,55 @@
|
||||
package com.nexia.core.games.util;
|
||||
|
||||
import com.nexia.minigames.games.bedwars.players.BwPlayers;
|
||||
import com.nexia.minigames.games.football.FootballGame;
|
||||
import com.nexia.minigames.games.oitc.OitcGame;
|
||||
import com.nexia.minigames.games.skywars.SkywarsGame;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class PlayerGameMode {
|
||||
|
||||
String id;
|
||||
public static ArrayList<PlayerGameMode> playerGameModes = new ArrayList<>();
|
||||
|
||||
public static final PlayerGameMode LOBBY = new PlayerGameMode("lobby");
|
||||
public static final PlayerGameMode BEDWARS = new PlayerGameMode("bedwars");
|
||||
public static ArrayList<String> stringPlayerGameModes = new ArrayList<>();
|
||||
|
||||
public static final PlayerGameMode SKYWARS = new PlayerGameMode("skywars");
|
||||
public static final PlayerGameMode OITC = new PlayerGameMode("oitc");
|
||||
public static final PlayerGameMode FFA = new PlayerGameMode("ffa");
|
||||
public String id;
|
||||
|
||||
public String name;
|
||||
|
||||
public String tag;
|
||||
|
||||
public static final PlayerGameMode LOBBY = new PlayerGameMode("lobby", "Hub", LobbyUtil.NO_DAMAGE_TAG);
|
||||
public static final PlayerGameMode BEDWARS = new PlayerGameMode("bedwars", "Bedwars", BwPlayers.BED_WARS_IN_GAME_TAG);
|
||||
|
||||
public static final PlayerGameMode SKYWARS = new PlayerGameMode("skywars", "Skywars", SkywarsGame.SKYWARS_TAG);
|
||||
public static final PlayerGameMode OITC = new PlayerGameMode("oitc", "OITC", OitcGame.OITC_TAG);
|
||||
public static final PlayerGameMode FFA = new PlayerGameMode("ffa", "FFA", "ffa");
|
||||
public static final PlayerGameMode FOOTBALL = new PlayerGameMode("football", "Football", FootballGame.FOOTBALL_TAG);
|
||||
|
||||
//public static final PlayerGameMode DUELS = new PlayerGameMode("duels");
|
||||
|
||||
PlayerGameMode(String id) {
|
||||
PlayerGameMode(String id, String name, String tag) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.tag = tag;
|
||||
|
||||
if(id.equals("lobby")) return;
|
||||
PlayerGameMode.playerGameModes.add(this);
|
||||
PlayerGameMode.stringPlayerGameModes.add(id);
|
||||
}
|
||||
|
||||
public static PlayerGameMode identifyGamemode(@NotNull String gameMode) {
|
||||
|
||||
for(PlayerGameMode playerGameMode : PlayerGameMode.playerGameModes) {
|
||||
if(playerGameMode.id.equalsIgnoreCase(gameMode)) return playerGameMode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,22 @@
|
||||
package com.nexia.core.gui;
|
||||
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.ffa.kits.utilities.KitFfaAreas;
|
||||
import com.nexia.ffa.pot.utilities.PotFfaAreas;
|
||||
import com.nexia.ffa.sky.utilities.SkyFfaAreas;
|
||||
import com.nexia.ffa.uhc.utilities.UhcFfaAreas;
|
||||
import com.nexia.minigames.games.duels.util.player.DuelsPlayerData;
|
||||
import com.nexia.nexus.builder.implementation.util.ObjectMappings;
|
||||
import com.nexia.core.games.util.LobbyUtil;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.item.ItemDisplayUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import com.nexia.ffa.classic.utilities.FfaAreas;
|
||||
import com.nexia.ffa.classic.utilities.ClassicFfaAreas;
|
||||
import com.nexia.minigames.games.bedwars.areas.BwAreas;
|
||||
import com.nexia.minigames.games.duels.DuelGameMode;
|
||||
import com.nexia.minigames.games.duels.util.player.PlayerDataManager;
|
||||
import com.nexia.minigames.games.football.FootballGame;
|
||||
import com.nexia.minigames.games.oitc.OitcGame;
|
||||
import com.nexia.minigames.games.skywars.SkywarsGame;
|
||||
import eu.pb4.sgui.api.ClickType;
|
||||
@@ -18,6 +28,8 @@ import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.alchemy.PotionUtils;
|
||||
import net.minecraft.world.item.alchemy.Potions;
|
||||
|
||||
public class PlayGUI extends SimpleGui {
|
||||
|
||||
@@ -32,68 +44,70 @@ public class PlayGUI extends SimpleGui {
|
||||
}
|
||||
}
|
||||
private void setMainLayout(){
|
||||
|
||||
int players = FfaAreas.ffaWorld.players().size();
|
||||
players = players + com.nexia.ffa.kits.utilities.FfaAreas.ffaWorld.players().size();
|
||||
players = players + com.nexia.ffa.pot.utilities.FfaAreas.ffaWorld.players().size();
|
||||
players = players + com.nexia.ffa.uhc.utilities.FfaAreas.ffaWorld.players().size();
|
||||
int players = ClassicFfaAreas.ffaWorld.players().size();
|
||||
players = players + KitFfaAreas.ffaWorld.players().size();
|
||||
players = players + PotFfaAreas.ffaWorld.players().size();
|
||||
players = players + SkyFfaAreas.ffaWorld.players().size();
|
||||
players = players + UhcFfaAreas.ffaWorld.players().size();
|
||||
|
||||
ItemStack ffa = new ItemStack(Items.NETHERITE_SWORD, 1);
|
||||
ffa.setHoverName(new TextComponent("§3FFA"));
|
||||
ffa.setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text("FFA", ChatFormat.Minecraft.aqua).decoration(ChatFormat.italic, false)));
|
||||
ItemDisplayUtil.addGlint(ffa);
|
||||
ffa.hideTooltipPart(ItemStack.TooltipPart.MODIFIERS);
|
||||
|
||||
ItemDisplayUtil.addLore(ffa, "§5", 0);
|
||||
ItemDisplayUtil.addLore(ffa, "§7Fight players in a huge landscape", 1);
|
||||
ItemDisplayUtil.addLore(ffa, "§7be the best player.", 2);
|
||||
ItemDisplayUtil.addLore(ffa, net.kyori.adventure.text.Component.text("Fight players in a huge landscape", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 1);
|
||||
ItemDisplayUtil.addLore(ffa, net.kyori.adventure.text.Component.text("and be the best player.", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 2);
|
||||
ItemDisplayUtil.addLore(ffa, "§f", 3);
|
||||
ItemDisplayUtil.addLore(ffa, "§3◆ There are " + players + " people playing this gamemode.", 4);
|
||||
ItemDisplayUtil.addLore(ffa, net.kyori.adventure.text.Component.text(String.format("There are %s people playing this gamemode.", players), ChatFormat.Minecraft.aqua).decoration(ChatFormat.italic, false), 4);
|
||||
|
||||
|
||||
ItemStack other = new ItemStack(Items.DRAGON_BREATH, 1);
|
||||
other.setHoverName(new TextComponent("§5Other Games"));
|
||||
other.setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text("Other Games", ChatFormat.Minecraft.dark_purple).decoration(ChatFormat.italic, false)));
|
||||
other.hideTooltipPart(ItemStack.TooltipPart.MODIFIERS);
|
||||
ItemDisplayUtil.addLore(other, "§7Discover other games.", 0);
|
||||
ItemDisplayUtil.addLore(other, net.kyori.adventure.text.Component.text("Discover other games.", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 0);
|
||||
|
||||
ItemStack bedwars = new ItemStack(Items.RED_BED, 1);
|
||||
bedwars.setHoverName(new TextComponent("§cBedwars"));
|
||||
bedwars.setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text("Bedwars", ChatFormat.Minecraft.red).decoration(ChatFormat.italic, false)));
|
||||
ItemDisplayUtil.addGlint(bedwars);
|
||||
bedwars.hideTooltipPart(ItemStack.TooltipPart.MODIFIERS);
|
||||
|
||||
ItemDisplayUtil.addLore(bedwars, "§5", 0);
|
||||
ItemDisplayUtil.addLore(bedwars, "§7Protect your bed and", 1);
|
||||
ItemDisplayUtil.addLore(bedwars, "§7destroy other's beds, kill your", 2);
|
||||
ItemDisplayUtil.addLore(bedwars, "§7opponents to win!", 3);
|
||||
ItemDisplayUtil.addLore(bedwars, net.kyori.adventure.text.Component.text("Protect your bed and", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 1);
|
||||
ItemDisplayUtil.addLore(bedwars, net.kyori.adventure.text.Component.text("destroy other opponent's beds, and", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 2);
|
||||
ItemDisplayUtil.addLore(bedwars, net.kyori.adventure.text.Component.text("kill your opponents to win!", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 3);
|
||||
ItemDisplayUtil.addLore(bedwars, "§f", 4);
|
||||
ItemDisplayUtil.addLore(bedwars, "§c◆ There are " + BwAreas.bedWarsWorld.players().size() + " people playing this gamemode.", 5);
|
||||
ItemDisplayUtil.addLore(bedwars, net.kyori.adventure.text.Component.text(String.format("There are %s people playing this gamemode.", BwAreas.bedWarsWorld.players().size()), ChatFormat.Minecraft.red).decoration(ChatFormat.italic, false), 5);
|
||||
|
||||
|
||||
ItemStack skywars = new ItemStack(Items.GRASS_BLOCK, 1);
|
||||
skywars.setHoverName(new TextComponent("§aSkywars"));
|
||||
skywars.setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text("Skywars", ChatFormat.Minecraft.green).decoration(ChatFormat.italic, false)));
|
||||
skywars.hideTooltipPart(ItemStack.TooltipPart.MODIFIERS);
|
||||
|
||||
ItemDisplayUtil.addLore(skywars, "§5", 0);
|
||||
ItemDisplayUtil.addLore(skywars, "§7Battle against others on", 1);
|
||||
ItemDisplayUtil.addLore(skywars, "§7sky islands and be the", 2);
|
||||
ItemDisplayUtil.addLore(skywars, "§7last one standing to win!", 3);
|
||||
ItemDisplayUtil.addLore(skywars, net.kyori.adventure.text.Component.text("Battle against others on", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 1);
|
||||
ItemDisplayUtil.addLore(skywars, net.kyori.adventure.text.Component.text("sky islands and be the", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 2);
|
||||
ItemDisplayUtil.addLore(skywars, net.kyori.adventure.text.Component.text("last one standing to win!", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 3);
|
||||
ItemDisplayUtil.addLore(skywars, "§f", 4);
|
||||
ItemDisplayUtil.addLore(skywars, "§a◆ There are " + SkywarsGame.world.players().size() + " people playing this gamemode.", 5);
|
||||
ItemDisplayUtil.addLore(skywars, net.kyori.adventure.text.Component.text(String.format("There are %s people playing this gamemode.", SkywarsGame.world.players().size()), ChatFormat.Minecraft.green).decoration(ChatFormat.italic, false), 5);
|
||||
|
||||
ItemStack duels = new ItemStack(Items.NETHERITE_AXE, 1);
|
||||
duels.setHoverName(new TextComponent("§9Duels"));
|
||||
duels.setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text("Duels", ChatFormat.Minecraft.blue).decoration(ChatFormat.italic, false)));
|
||||
ItemDisplayUtil.addGlint(duels);
|
||||
duels.hideTooltipPart(ItemStack.TooltipPart.MODIFIERS);
|
||||
|
||||
int duelsPlayers = 0;
|
||||
for(ServerPlayer serverPlayer : ServerTime.minecraftServer.getPlayerList().getPlayers()) {
|
||||
DuelGameMode gameMode = PlayerDataManager.get(serverPlayer).gameMode;
|
||||
DuelGameMode gameMode = ((DuelsPlayerData)PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(serverPlayer.getUUID())).gameMode;
|
||||
if(gameMode != null && (gameMode != DuelGameMode.LOBBY && gameMode != DuelGameMode.SPECTATING)) duelsPlayers++;
|
||||
}
|
||||
|
||||
ItemDisplayUtil.addLore(duels, "§5", 0);
|
||||
ItemDisplayUtil.addLore(duels, "§7Duel against other people", 1);
|
||||
ItemDisplayUtil.addLore(duels, "§7or play against people in teams", 2);
|
||||
ItemDisplayUtil.addLore(duels, "§7with team duels!", 3);
|
||||
ItemDisplayUtil.addLore(duels, net.kyori.adventure.text.Component.text("Duel against other people", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 1);
|
||||
ItemDisplayUtil.addLore(duels, net.kyori.adventure.text.Component.text("or play against people in teams", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 2);
|
||||
ItemDisplayUtil.addLore(duels, net.kyori.adventure.text.Component.text("with team duels!", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 3);
|
||||
ItemDisplayUtil.addLore(duels, "§f", 4);
|
||||
ItemDisplayUtil.addLore(duels, "§9◆ There are " + (LobbyUtil.lobbyWorld.players().size() + duelsPlayers) + " people playing this gamemode.", 5);
|
||||
ItemDisplayUtil.addLore(duels, net.kyori.adventure.text.Component.text(String.format("There are %s people playing this gamemode.", (LobbyUtil.lobbyWorld.players().size() + duelsPlayers)), ChatFormat.Minecraft.blue).decoration(ChatFormat.italic, false), 5);
|
||||
|
||||
|
||||
ItemStack emptySlot = new ItemStack(Items.BLACK_STAINED_GLASS_PANE, 1);
|
||||
@@ -107,66 +121,73 @@ public class PlayGUI extends SimpleGui {
|
||||
this.setSlot(8, bedwars);
|
||||
}
|
||||
|
||||
private void setFFALayout(){
|
||||
ItemStack classic = new ItemStack(Items.NETHERITE_SWORD, 1);
|
||||
classic.setHoverName(new TextComponent("§cClassic FFA"));
|
||||
public void setFFALayout(){
|
||||
ItemStack classic = new ItemStack(Items.DIAMOND_SWORD, 1);
|
||||
classic.setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text("Classic FFA", ChatFormat.Minecraft.aqua).decoration(ChatFormat.italic, false)));
|
||||
ItemDisplayUtil.addGlint(classic);
|
||||
classic.hideTooltipPart(ItemStack.TooltipPart.MODIFIERS);
|
||||
|
||||
ItemDisplayUtil.addLore(classic, "§5", 0);
|
||||
ItemDisplayUtil.addLore(classic, "§7The classic snapshot", 1);
|
||||
ItemDisplayUtil.addLore(classic, "§7Free For All gamemode.", 2);
|
||||
ItemDisplayUtil.addLore(classic, "§b", 0);
|
||||
ItemDisplayUtil.addLore(classic, net.kyori.adventure.text.Component.text("The classic snapshot", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 1);
|
||||
ItemDisplayUtil.addLore(classic, net.kyori.adventure.text.Component.text("Free For All gamemode.", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 2);
|
||||
ItemDisplayUtil.addLore(classic, "§f", 3);
|
||||
ItemDisplayUtil.addLore(classic, "§c◆ There are " + FfaAreas.ffaWorld.players().size() + " people playing this gamemode.", 4);
|
||||
ItemDisplayUtil.addLore(classic, net.kyori.adventure.text.Component.text(String.format("There are %s people playing this gamemode.", ClassicFfaAreas.ffaWorld.players().size()), ChatFormat.Minecraft.aqua).decoration(ChatFormat.italic, false), 4);
|
||||
|
||||
ItemStack kit = new ItemStack(Items.DIAMOND_SWORD, 1);
|
||||
kit.setHoverName(new TextComponent("§bKit FFA"));
|
||||
ItemDisplayUtil.addGlint(classic);
|
||||
ItemStack kit = new ItemStack(Items.CROSSBOW, 1);
|
||||
kit.setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text("Kit FFA", ChatFormat.Minecraft.white).decoration(ChatFormat.italic, false)));
|
||||
ItemDisplayUtil.addGlint(kit);
|
||||
kit.hideTooltipPart(ItemStack.TooltipPart.MODIFIERS);
|
||||
|
||||
ItemDisplayUtil.addLore(kit, "§5", 0);
|
||||
ItemDisplayUtil.addLore(kit, "§7Fight against players", 1);
|
||||
ItemDisplayUtil.addLore(kit, "§7with various kits!", 2);
|
||||
ItemDisplayUtil.addLore(kit, net.kyori.adventure.text.Component.text("Fight against players", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 1);
|
||||
ItemDisplayUtil.addLore(kit, net.kyori.adventure.text.Component.text("with various kits!", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 2);
|
||||
ItemDisplayUtil.addLore(kit, "§f", 3);
|
||||
ItemDisplayUtil.addLore(kit, "§b◆ There are " + com.nexia.ffa.kits.utilities.FfaAreas.ffaWorld.players().size() + " people playing this gamemode.", 4);
|
||||
|
||||
|
||||
ItemDisplayUtil.addLore(kit, net.kyori.adventure.text.Component.text(String.format("There are %s people playing this gamemode.", KitFfaAreas.ffaWorld.players().size()), ChatFormat.Minecraft.white).decoration(ChatFormat.italic, false), 4);
|
||||
|
||||
ItemStack pot = new ItemStack(Items.POTION, 1);
|
||||
pot.setHoverName(new TextComponent("§dPot FFA"));
|
||||
PotionUtils.setPotion(pot, Potions.HEALING);
|
||||
pot.setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text("Pot FFA", ChatFormat.Minecraft.light_purple).decoration(ChatFormat.italic, false)));
|
||||
ItemDisplayUtil.addGlint(pot);
|
||||
pot.hideTooltipPart(ItemStack.TooltipPart.MODIFIERS);
|
||||
|
||||
ItemDisplayUtil.addLore(pot, "§5", 0);
|
||||
ItemDisplayUtil.addLore(pot, "§7The classic snapshot", 1);
|
||||
ItemDisplayUtil.addLore(pot, "§7Free For All gamemodes.", 2);
|
||||
ItemDisplayUtil.addLore(pot, "§5", 3);
|
||||
ItemDisplayUtil.addLore(pot, "§d◆ There are " + com.nexia.ffa.pot.utilities.FfaAreas.ffaWorld.players().size() + " people playing this gamemode.", 4);
|
||||
ItemDisplayUtil.addLore(pot, net.kyori.adventure.text.Component.text("Free for All: ", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 1);
|
||||
ItemDisplayUtil.addLore(pot, net.kyori.adventure.text.Component.text("Pot Edition™!", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 2);
|
||||
ItemDisplayUtil.addLore(pot, "§f", 3);
|
||||
ItemDisplayUtil.addLore(pot, net.kyori.adventure.text.Component.text(String.format("There are %s people playing this gamemode.", PotFfaAreas.ffaWorld.players().size()), ChatFormat.Minecraft.light_purple).decoration(ChatFormat.italic, false), 4);
|
||||
|
||||
ItemStack skyffa = new ItemStack(Items.POTION, 1);
|
||||
skyffa.setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text("Sky FFA", ChatFormat.Minecraft.yellow).decoration(ChatFormat.italic, false)));
|
||||
skyffa.getOrCreateTag().putInt("CustomPotionColor", 16771584);
|
||||
ItemDisplayUtil.addGlint(skyffa);
|
||||
skyffa.hideTooltipPart(ItemStack.TooltipPart.MODIFIERS);
|
||||
|
||||
ItemDisplayUtil.addLore(skyffa, "§5", 0);
|
||||
ItemDisplayUtil.addLore(skyffa, net.kyori.adventure.text.Component.text("Fight people on sky islands", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 1);
|
||||
ItemDisplayUtil.addLore(skyffa, net.kyori.adventure.text.Component.text("and drink Piss Juice™ to survive!", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 2);
|
||||
ItemDisplayUtil.addLore(skyffa, "§5", 3);
|
||||
ItemDisplayUtil.addLore(skyffa, net.kyori.adventure.text.Component.text(String.format("There are %s people playing this gamemode.", SkyFfaAreas.ffaWorld.players().size()), ChatFormat.Minecraft.yellow).decoration(ChatFormat.italic, false), 4);
|
||||
|
||||
ItemStack uhc = new ItemStack(Items.GOLDEN_APPLE, 1);
|
||||
uhc.setHoverName(new TextComponent("§6UHC FFA"));
|
||||
ItemDisplayUtil.addGlint(classic);
|
||||
uhc.setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text("UHC FFA", ChatFormat.goldColor).decoration(ChatFormat.italic, false)));
|
||||
ItemDisplayUtil.addGlint(uhc);
|
||||
uhc.hideTooltipPart(ItemStack.TooltipPart.MODIFIERS);
|
||||
|
||||
ItemDisplayUtil.addLore(uhc, "§5", 0);
|
||||
ItemDisplayUtil.addLore(uhc, "§7The classic snapshot", 1);
|
||||
ItemDisplayUtil.addLore(uhc, "§7Free For All gamemodes.", 2);
|
||||
ItemDisplayUtil.addLore(uhc, net.kyori.adventure.text.Component.text("A FFA to practice PvP", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 1);
|
||||
ItemDisplayUtil.addLore(uhc, net.kyori.adventure.text.Component.text("for the UHC gamemode.", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 2);
|
||||
ItemDisplayUtil.addLore(uhc, "§f", 3);
|
||||
ItemDisplayUtil.addLore(uhc, "§6◆ There are " + com.nexia.ffa.uhc.utilities.FfaAreas.ffaWorld.players().size() + " people playing this gamemode.", 4);
|
||||
|
||||
|
||||
|
||||
ItemDisplayUtil.addLore(uhc, net.kyori.adventure.text.Component.text(String.format("There are %s people playing this gamemode.", UhcFfaAreas.ffaWorld.players().size()), ChatFormat.goldColor).decoration(ChatFormat.italic, false), 4);
|
||||
|
||||
ItemStack emptySlot = new ItemStack(Items.BLACK_STAINED_GLASS_PANE, 1);
|
||||
emptySlot.setHoverName(new TextComponent(""));
|
||||
|
||||
fillEmptySlots(emptySlot);
|
||||
this.setSlot(1, classic);
|
||||
this.setSlot(3, uhc);
|
||||
this.setSlot(5, pot);
|
||||
this.setSlot(7, kit);
|
||||
this.setSlot(0, classic);
|
||||
this.setSlot(2, uhc);
|
||||
this.setSlot(4, pot);
|
||||
this.setSlot(6, skyffa);
|
||||
this.setSlot(8, kit);
|
||||
}
|
||||
|
||||
private void setOtherGamesLayout() {
|
||||
@@ -176,30 +197,43 @@ public class PlayGUI extends SimpleGui {
|
||||
unknown.hideTooltipPart(ItemStack.TooltipPart.MODIFIERS);
|
||||
|
||||
ItemStack back = new ItemStack(Items.DRAGON_BREATH, 1);
|
||||
back.setHoverName(new TextComponent("§5Back"));
|
||||
back.setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text("Back", ChatFormat.Minecraft.dark_purple).decoration(ChatFormat.italic, false)));
|
||||
back.hideTooltipPart(ItemStack.TooltipPart.MODIFIERS);
|
||||
ItemDisplayUtil.addLore(back, "§7Go back to the main menu.", 0);
|
||||
ItemDisplayUtil.addLore(back, net.kyori.adventure.text.Component.text("Go back to the main menu.", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 0);
|
||||
|
||||
ItemStack oitc = new ItemStack(Items.BOW, 1);
|
||||
oitc.setHoverName(new TextComponent("§eOITC"));
|
||||
oitc.setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text("OITC", ChatFormat.Minecraft.yellow).decoration(ChatFormat.italic, false)));
|
||||
ItemDisplayUtil.addGlint(oitc);
|
||||
oitc.hideTooltipPart(ItemStack.TooltipPart.MODIFIERS);
|
||||
|
||||
ItemDisplayUtil.addLore(oitc, "§5", 0);
|
||||
ItemDisplayUtil.addLore(oitc, "§7One in the chamber.", 1);
|
||||
ItemDisplayUtil.addLore(oitc, "§7Try to kill as many people as possible", 2);
|
||||
ItemDisplayUtil.addLore(oitc, "§7to achieve victory!", 3);
|
||||
ItemDisplayUtil.addLore(oitc, net.kyori.adventure.text.Component.text("One in the chamber.", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 1);
|
||||
ItemDisplayUtil.addLore(oitc, net.kyori.adventure.text.Component.text("Try to kill as many people as possible", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 2);
|
||||
ItemDisplayUtil.addLore(oitc, net.kyori.adventure.text.Component.text("to achieve victory!", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 3);
|
||||
ItemDisplayUtil.addLore(oitc, "§f", 4);
|
||||
ItemDisplayUtil.addLore(oitc, "§e◆ There are " + OitcGame.world.players().size() + " people playing this gamemode.", 5);
|
||||
ItemDisplayUtil.addLore(oitc, net.kyori.adventure.text.Component.text(String.format("There are %s people playing this gamemode.", OitcGame.world.players().size()), ChatFormat.Minecraft.yellow).decoration(ChatFormat.italic, false), 5);
|
||||
|
||||
|
||||
ItemStack emptySlot = new ItemStack(Items.BLACK_STAINED_GLASS_PANE, 1);
|
||||
emptySlot.setHoverName(new TextComponent(""));
|
||||
|
||||
ItemStack football = new ItemStack(Items.ARMOR_STAND, 1);
|
||||
football.setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text("Football", ChatFormat.Minecraft.white).decoration(ChatFormat.italic, false)));
|
||||
ItemDisplayUtil.addGlint(football);
|
||||
football.hideTooltipPart(ItemStack.TooltipPart.MODIFIERS);
|
||||
|
||||
ItemDisplayUtil.addLore(football, "§f", 0);
|
||||
ItemDisplayUtil.addLore(football, net.kyori.adventure.text.Component.text("Also known as soccer.", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 1);
|
||||
ItemDisplayUtil.addLore(football, net.kyori.adventure.text.Component.text("You kick a ball into a goal", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 2);
|
||||
ItemDisplayUtil.addLore(football, net.kyori.adventure.text.Component.text("to achieve victory!", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 3);
|
||||
ItemDisplayUtil.addLore(football, "§f", 4);
|
||||
ItemDisplayUtil.addLore(football, net.kyori.adventure.text.Component.text(String.format("There are %s people playing this gamemode.", FootballGame.world.players().size()), ChatFormat.Minecraft.white).decoration(ChatFormat.italic, false), 5);
|
||||
|
||||
fillEmptySlots(emptySlot);
|
||||
|
||||
this.setSlot(2, oitc);
|
||||
this.setSlot(4, back);
|
||||
this.setSlot(6, unknown);
|
||||
this.setSlot(6, football);
|
||||
this.setSlot(0, unknown);
|
||||
this.setSlot(8, unknown);
|
||||
}
|
||||
@@ -209,55 +243,67 @@ public class PlayGUI extends SimpleGui {
|
||||
if(element != null && clickType != ClickType.MOUSE_DOUBLE_CLICK) {
|
||||
ItemStack itemStack = element.getItemStack();
|
||||
Component name = itemStack.getHoverName();
|
||||
if(name.getString().equalsIgnoreCase("§cClassic FFA")){
|
||||
LobbyUtil.sendGame(this.player, "classic ffa", true, true);
|
||||
NexiaPlayer nexiaPlayer = new NexiaPlayer(this.player);
|
||||
|
||||
if(name.getString().contains("Classic FFA")){
|
||||
LobbyUtil.sendGame(nexiaPlayer, "classic ffa", true, true);
|
||||
this.close();
|
||||
}
|
||||
|
||||
if(name.getString().equalsIgnoreCase("§bKit FFA")){
|
||||
LobbyUtil.sendGame(this.player, "kits ffa", true, true);
|
||||
if(name.getString().contains("Kit FFA")){
|
||||
LobbyUtil.sendGame(nexiaPlayer, "kits ffa", true, true);
|
||||
this.close();
|
||||
}
|
||||
|
||||
if(name.getString().equalsIgnoreCase("§dPot FFA")){
|
||||
LobbyUtil.sendGame(this.player, "pot ffa", true, true);
|
||||
if(name.getString().contains("Pot FFA")){
|
||||
LobbyUtil.sendGame(nexiaPlayer, "pot ffa", true, true);
|
||||
this.close();
|
||||
}
|
||||
|
||||
if(name.getString().equalsIgnoreCase("§6UHC FFA")){
|
||||
LobbyUtil.sendGame(this.player, "uhc ffa", true, true);
|
||||
if(name.getString().contains("Sky FFA")){
|
||||
LobbyUtil.sendGame(nexiaPlayer, "sky ffa", true, true);
|
||||
this.close();
|
||||
}
|
||||
|
||||
if(name.getString().equalsIgnoreCase("§3FFA")){
|
||||
if(name.getString().contains("UHC FFA")){
|
||||
LobbyUtil.sendGame(nexiaPlayer, "uhc ffa", true, true);
|
||||
this.close();
|
||||
}
|
||||
|
||||
if(name.getString().contains("FFA")){
|
||||
this.setFFALayout();
|
||||
}
|
||||
|
||||
if(name.getString().equalsIgnoreCase("§cBedwars")){
|
||||
LobbyUtil.sendGame(this.player, "bedwars", true, true);
|
||||
if(name.getString().contains("Bedwars")){
|
||||
LobbyUtil.sendGame(nexiaPlayer, "bedwars", true, true);
|
||||
this.close();
|
||||
}
|
||||
|
||||
if(name.getString().equalsIgnoreCase("§aSkywars")){
|
||||
LobbyUtil.sendGame(this.player, "skywars", true, true);
|
||||
if(name.getString().contains("Skywars")){
|
||||
LobbyUtil.sendGame(nexiaPlayer, "skywars", true, true);
|
||||
this.close();
|
||||
}
|
||||
|
||||
if(name.getString().equalsIgnoreCase("§eOITC")){
|
||||
LobbyUtil.sendGame(this.player, "oitc", true, true);
|
||||
if(name.getString().contains("OITC")){
|
||||
LobbyUtil.sendGame(nexiaPlayer, "oitc", true, true);
|
||||
this.close();
|
||||
}
|
||||
|
||||
if(name.getString().equalsIgnoreCase("§9Duels")){
|
||||
LobbyUtil.sendGame(this.player, "duels", true, true);
|
||||
if(name.getString().contains("Football")){
|
||||
LobbyUtil.sendGame(nexiaPlayer, "football", true, true);
|
||||
this.close();
|
||||
}
|
||||
|
||||
if(name.getString().toLowerCase().equalsIgnoreCase("§5Other Games")){
|
||||
if(name.getString().contains("Duels")){
|
||||
LobbyUtil.sendGame(nexiaPlayer, "duels", true, true);
|
||||
this.close();
|
||||
}
|
||||
|
||||
if(name.getString().contains("Other Games")){
|
||||
this.setOtherGamesLayout();
|
||||
}
|
||||
|
||||
if(name.getString().toLowerCase().equalsIgnoreCase("§5Back")){
|
||||
if(name.getString().contains("Back")){
|
||||
this.setMainLayout();
|
||||
}
|
||||
|
||||
@@ -267,10 +313,12 @@ public class PlayGUI extends SimpleGui {
|
||||
}
|
||||
return super.click(index, clickType, action);
|
||||
}
|
||||
public static void openMainGUI(ServerPlayer player) {
|
||||
public static PlayGUI openMainGUI(ServerPlayer player) {
|
||||
PlayGUI shop = new PlayGUI(MenuType.GENERIC_9x1, player, false);
|
||||
shop.setTitle(title);
|
||||
shop.setMainLayout();
|
||||
shop.open();
|
||||
|
||||
return shop;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,20 @@
|
||||
package com.nexia.core.gui;
|
||||
|
||||
import com.combatreforged.factory.api.world.entity.player.Player;
|
||||
import com.nexia.core.Main;
|
||||
import com.nexia.nexus.builder.implementation.util.ObjectMappings;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.item.ItemDisplayUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.ranks.NexiaRank;
|
||||
import eu.pb4.sgui.api.ClickType;
|
||||
import eu.pb4.sgui.api.elements.GuiElementInterface;
|
||||
import eu.pb4.sgui.api.gui.SimpleGui;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.enchantment.Enchantments;
|
||||
|
||||
public class PrefixGUI extends SimpleGui {
|
||||
static final TextComponent title = new TextComponent("Prefix Menu");
|
||||
@@ -48,28 +47,30 @@ public class PrefixGUI extends SimpleGui {
|
||||
this.setSlot(airSlots, new ItemStack(Items.AIR));
|
||||
airSlots++;
|
||||
}
|
||||
for(int i = 0; i < 10; i++){
|
||||
|
||||
for(NexiaRank rank : NexiaRank.ranks){
|
||||
|
||||
if(slot == 17) {
|
||||
slot = 19;
|
||||
}
|
||||
|
||||
if(PlayerUtil.hasPermission(player.createCommandSourceStack(), "nexia.prefix." + Main.config.ranks[i], 4) && player.getTags().contains(Main.config.ranks[i])){
|
||||
boolean hasPermission = Permissions.check(player, rank.groupID);
|
||||
|
||||
if(hasPermission && player.getTags().contains(rank.id)){
|
||||
ItemStack enchantedItem = new ItemStack(Items.NAME_TAG, 1);
|
||||
enchantedItem.enchant(Enchantments.SHARPNESS, 1);
|
||||
enchantedItem.hideTooltipPart(ItemStack.TooltipPart.ENCHANTMENTS);
|
||||
enchantedItem.setHoverName(new TextComponent("§d§l" + Main.config.ranks[i]));
|
||||
ItemDisplayUtil.addGlint(enchantedItem);
|
||||
enchantedItem.setHoverName(ObjectMappings.convertComponent(Component.text(rank.name, ChatFormat.brandColor2).decoration(ChatFormat.italic, false).decoration(ChatFormat.bold, true)));
|
||||
this.setSlot(slot, enchantedItem);
|
||||
slot++;
|
||||
} else if(PlayerUtil.hasPermission(player.createCommandSourceStack(), "nexia.prefix." + Main.config.ranks[i], 4)){
|
||||
} else if(hasPermission){
|
||||
ItemStack changedItem = new ItemStack(Items.NAME_TAG, 1);
|
||||
changedItem.setHoverName(new TextComponent("§f" + Main.config.ranks[i]));
|
||||
changedItem.setHoverName(ObjectMappings.convertComponent(Component.text(rank.name, ChatFormat.Minecraft.white).decoration(ChatFormat.italic, false).decoration(ChatFormat.bold, true)));
|
||||
this.setSlot(slot, changedItem);
|
||||
slot++;
|
||||
} else if(player.getTags().contains(Main.config.ranks[i])) {
|
||||
} else if(player.getTags().contains(rank.id)) {
|
||||
ItemStack enchantedItem = new ItemStack(Items.NAME_TAG, 1);
|
||||
enchantedItem.enchant(Enchantments.SHARPNESS, 1);
|
||||
enchantedItem.hideTooltipPart(ItemStack.TooltipPart.ENCHANTMENTS);
|
||||
enchantedItem.setHoverName(new TextComponent(Main.config.ranks[i]).withStyle(ChatFormatting.BOLD, ChatFormatting.LIGHT_PURPLE));
|
||||
ItemDisplayUtil.addGlint(enchantedItem);
|
||||
enchantedItem.setHoverName(ObjectMappings.convertComponent(Component.text(rank.name, ChatFormat.brandColor2).decoration(ChatFormat.italic, false).decoration(ChatFormat.bold, true)));
|
||||
this.setSlot(slot, enchantedItem);
|
||||
slot++;
|
||||
}
|
||||
@@ -80,23 +81,25 @@ public class PrefixGUI extends SimpleGui {
|
||||
GuiElementInterface element = this.getSlot(index);
|
||||
if(element != null && clickType != ClickType.MOUSE_DOUBLE_CLICK) {
|
||||
ItemStack itemStack = element.getItemStack();
|
||||
String name = itemStack.getHoverName().getString().substring(2).replaceAll("§l", "");
|
||||
String name = itemStack.getHoverName().getString();
|
||||
|
||||
if(itemStack.getItem() != Items.BLACK_STAINED_GLASS_PANE && itemStack.getItem() != Items.AIR){
|
||||
|
||||
Player player = PlayerUtil.getFactoryPlayer(this.player);
|
||||
NexiaPlayer player = new NexiaPlayer(this.player);
|
||||
|
||||
player.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(net.kyori.adventure.text.Component.text("Your prefix has been set to: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(net.kyori.adventure.text.Component.text(name).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false))
|
||||
.append(net.kyori.adventure.text.Component.text(".").decoration(ChatFormat.bold, false))
|
||||
player.sendNexiaMessage(
|
||||
net.kyori.adventure.text.Component.text("Your prefix has been set to: ", ChatFormat.normalColor)
|
||||
.append(net.kyori.adventure.text.Component.text(name, ChatFormat.brandColor2))
|
||||
.append(net.kyori.adventure.text.Component.text(".", ChatFormat.normalColor))
|
||||
);
|
||||
|
||||
for(int i = 0; i < 10; i++){
|
||||
player.removeTag(Main.config.ranks[i]);
|
||||
for(NexiaRank rank : NexiaRank.ranks){
|
||||
player.removeTag(rank.id);
|
||||
}
|
||||
|
||||
if(name.equalsIgnoreCase("player")) name = "default";
|
||||
if(name.equalsIgnoreCase("nexia")) name = "supporter";
|
||||
|
||||
player.addTag(name.toLowerCase());
|
||||
this.setMainLayout(this.player);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.nexia.core.gui;
|
||||
|
||||
import com.combatreforged.factory.api.world.entity.player.Player;
|
||||
import com.nexia.nexus.builder.implementation.util.ObjectMappings;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.item.ItemDisplayUtil;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.discord.Main;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.discord.NexiaDiscord;
|
||||
import eu.pb4.sgui.api.ClickType;
|
||||
import eu.pb4.sgui.api.elements.GuiElementInterface;
|
||||
import eu.pb4.sgui.api.gui.SimpleGui;
|
||||
@@ -32,19 +32,20 @@ public class RanksGUI extends SimpleGui {
|
||||
}
|
||||
private void setMainLayout(){
|
||||
ItemStack supporter = new ItemStack(Items.DRAGON_BREATH, 1);
|
||||
supporter.setHoverName(new TextComponent("§5Supporter"));
|
||||
supporter.setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text("Supporter", ChatFormat.brandColor2).decoration(ChatFormat.italic, false).decoration(ChatFormat.bold, true)));
|
||||
ItemDisplayUtil.addGlint(supporter);
|
||||
supporter.hideTooltipPart(ItemStack.TooltipPart.MODIFIERS);
|
||||
|
||||
ItemDisplayUtil.addLore(supporter, "§7How to get it:", 0);
|
||||
ItemDisplayUtil.addLore(supporter, net.kyori.adventure.text.Component.text("How to get it:", ChatFormat.Minecraft.white).decoration(ChatFormat.italic, false), 0);
|
||||
ItemDisplayUtil.addLore(supporter, "§1", 1);
|
||||
ItemDisplayUtil.addLore(supporter, "§cPatreon - Buy it from our patreon.", 2);
|
||||
ItemDisplayUtil.addLore(supporter, "§chttps://www.patreon.com/Nexia", 3);
|
||||
ItemDisplayUtil.addLore(supporter, "§f§lOR", 4);
|
||||
ItemDisplayUtil.addLore(supporter, "§dBoosting - Boost the discord server.", 5);
|
||||
ItemDisplayUtil.addLore(supporter, "§d" + Main.config.discordLink, 6);
|
||||
ItemDisplayUtil.addLore(supporter, net.kyori.adventure.text.Component.text("Patreon - Buy it from our patreon.", TextColor.fromHexString("#f96b59")).decoration(ChatFormat.italic, false), 2);
|
||||
ItemDisplayUtil.addLore(supporter, net.kyori.adventure.text.Component.text("https://www.patreon.com/Nexia", TextColor.fromHexString("#f96b59")).decoration(ChatFormat.italic, false), 3);
|
||||
ItemDisplayUtil.addLore(supporter, net.kyori.adventure.text.Component.text("OR", ChatFormat.Minecraft.white).decoration(ChatFormat.bold, true).decoration(ChatFormat.italic, false), 4);
|
||||
ItemDisplayUtil.addLore(supporter, net.kyori.adventure.text.Component.text("Boosting - Boost the discord server.", TextColor.fromHexString("#8c00ff")).decoration(ChatFormat.italic, false), 5);
|
||||
ItemDisplayUtil.addLore(supporter, net.kyori.adventure.text.Component.text(NexiaDiscord.config.discordLink, TextColor.fromHexString("#8c00ff")).decoration(ChatFormat.italic, false), 6);
|
||||
ItemDisplayUtil.addLore(supporter, "§3", 7);
|
||||
ItemDisplayUtil.addLore(supporter, "§dPrice: §5§l5.00$", 8);
|
||||
ItemDisplayUtil.addLore(supporter, net.kyori.adventure.text.Component.text("Price: ", TextColor.fromHexString("#8c00ff")).decoration(ChatFormat.italic, false)
|
||||
.append(net.kyori.adventure.text.Component.text("5.00$", ChatFormat.brandColor1).decoration(ChatFormat.bold, true).decoration(ChatFormat.italic, false)), 8);
|
||||
|
||||
ItemStack purple = new ItemStack(Items.PURPLE_STAINED_GLASS_PANE, 1);
|
||||
purple.setHoverName(new TextComponent(""));
|
||||
@@ -84,27 +85,25 @@ public class RanksGUI extends SimpleGui {
|
||||
ItemStack itemStack = element.getItemStack();
|
||||
Component name = itemStack.getHoverName();
|
||||
|
||||
Player factoryPlayer = PlayerUtil.getFactoryPlayer(this.player);
|
||||
NexiaPlayer nexiaPlayer = new NexiaPlayer(this.player);
|
||||
|
||||
if(name.getString().equalsIgnoreCase("§5Supporter")){
|
||||
// Insert supporter thing here (link to discord and patreon)
|
||||
factoryPlayer.sendMessage(ChatFormat.nexiaMessage.append(
|
||||
net.kyori.adventure.text.Component.text("In order to get the ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
|
||||
.append(net.kyori.adventure.text.Component.text("Supporter").color(ChatFormat.brandColor2).decoration(ChatFormat.bold, true))
|
||||
.append(net.kyori.adventure.text.Component.text(" rank, you need to either ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
if(name.getString().contains("Supporter")){
|
||||
nexiaPlayer.sendNexiaMessage(
|
||||
net.kyori.adventure.text.Component.text("In order to get the ", ChatFormat.normalColor)
|
||||
.append(net.kyori.adventure.text.Component.text("Supporter", ChatFormat.brandColor2).decoration(ChatFormat.bold, true))
|
||||
.append(net.kyori.adventure.text.Component.text(" rank, you need to either ", ChatFormat.normalColor))
|
||||
.append(net.kyori.adventure.text.Component.text("buy from our patreon")
|
||||
.color(TextColor.fromHexString("#f96b59"))
|
||||
.decoration(ChatFormat.bold, true)
|
||||
.hoverEvent(HoverEvent.showText(net.kyori.adventure.text.Component.text("Click me").color(TextColor.fromHexString("#f96b59"))))
|
||||
.clickEvent(ClickEvent.openUrl("https://www.patreon.com/Nexia")))
|
||||
.append(net.kyori.adventure.text.Component.text(" or ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(net.kyori.adventure.text.Component.text(" or ", ChatFormat.normalColor))
|
||||
.append(net.kyori.adventure.text.Component.text("boost our discord server")
|
||||
.color(TextColor.fromHexString("#8c00ff"))
|
||||
.decoration(ChatFormat.bold, true)
|
||||
.hoverEvent(HoverEvent.showText(net.kyori.adventure.text.Component.text("Click me").color(TextColor.fromHexString("#8c00ff"))))
|
||||
.clickEvent(ClickEvent.openUrl(Main.config.discordLink)))
|
||||
.append(net.kyori.adventure.text.Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
)
|
||||
.clickEvent(ClickEvent.openUrl(NexiaDiscord.config.discordLink)))
|
||||
.append(net.kyori.adventure.text.Component.text(".", ChatFormat.normalColor))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
package com.nexia.core.gui.duels;
|
||||
|
||||
import com.nexia.nexus.builder.implementation.util.ObjectMappings;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.item.InventoryUtil;
|
||||
import com.nexia.core.utilities.item.ItemDisplayUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.minigames.games.duels.gamemodes.GamemodeHandler;
|
||||
import com.nexia.minigames.games.duels.map.DuelsMap;
|
||||
import eu.pb4.sgui.api.ClickType;
|
||||
import eu.pb4.sgui.api.elements.GuiElementInterface;
|
||||
import eu.pb4.sgui.api.gui.SimpleGui;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class CustomDuelGUI extends SimpleGui {
|
||||
static final TextComponent title = new TextComponent("Custom Duel Menu");
|
||||
|
||||
ServerPlayer other;
|
||||
|
||||
String kit;
|
||||
public CustomDuelGUI(MenuType<?> type, ServerPlayer player, boolean includePlayer) {
|
||||
super(type, player, includePlayer);
|
||||
this.other = null;
|
||||
this.kit = "";
|
||||
}
|
||||
|
||||
private void fillEmptySlots(ItemStack itemStack){
|
||||
for(int i = 0; i < 45; i++){
|
||||
this.setSlot(i, itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
private void setMapLayout(){
|
||||
ItemStack emptySlot = new ItemStack(Items.BLACK_STAINED_GLASS_PANE, 1);
|
||||
emptySlot.setHoverName(new TextComponent(""));
|
||||
|
||||
fillEmptySlots(emptySlot);
|
||||
int slot = 10;
|
||||
int airSlots = 10;
|
||||
for(int air = 0; air < 21; air++){
|
||||
if(airSlots == 17) {
|
||||
airSlots = 19;
|
||||
}
|
||||
if(airSlots == 26) {
|
||||
airSlots = 28;
|
||||
}
|
||||
this.setSlot(airSlots, new ItemStack(Items.AIR));
|
||||
airSlots++;
|
||||
}
|
||||
for(DuelsMap map : DuelsMap.duelsMaps){
|
||||
this.setSlot(slot, map.item);
|
||||
slot++;
|
||||
}
|
||||
}
|
||||
|
||||
private void setMainLayout(ServerPlayer otherp){
|
||||
ItemStack emptySlot = new ItemStack(Items.BLACK_STAINED_GLASS_PANE, 1);
|
||||
emptySlot.setHoverName(new TextComponent(""));
|
||||
|
||||
this.other = otherp;
|
||||
|
||||
fillEmptySlots(emptySlot);
|
||||
int slot = 10;
|
||||
int airSlots = 10;
|
||||
for(int air = 0; air < 21; air++){
|
||||
if(airSlots == 17) {
|
||||
airSlots = 19;
|
||||
}
|
||||
if(airSlots == 26) {
|
||||
airSlots = 28;
|
||||
}
|
||||
this.setSlot(airSlots, new ItemStack(Items.AIR));
|
||||
airSlots++;
|
||||
}
|
||||
|
||||
|
||||
ItemStack playerHead = PlayerUtil.getPlayerHead(otherp.getUUID());
|
||||
playerHead.setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text(otherp.getScoreboardName(), ChatFormat.Minecraft.yellow).decoration(ChatFormat.bold, true).decoration(ChatFormat.italic, false)));
|
||||
|
||||
this.setSlot(4, playerHead);
|
||||
|
||||
ArrayList<String> inventories = InventoryUtil.getListOfInventories("duels/custom/" + this.player.getStringUUID());
|
||||
|
||||
ItemStack item;
|
||||
|
||||
if(inventories.isEmpty()) {
|
||||
item = new ItemStack(Items.COMMAND_BLOCK);
|
||||
|
||||
ItemDisplayUtil.removeLore(item, 0);
|
||||
ItemDisplayUtil.removeLore(item, 1);
|
||||
|
||||
ItemDisplayUtil.addLore(item,
|
||||
net.kyori.adventure.text.Component.text("Use ", ChatFormat.Minecraft.yellow).decoration(ChatFormat.italic, false)
|
||||
.append(net.kyori.adventure.text.Component.text("/kiteditor edit <1, 2, 3, smp, vanilla>", ChatFormat.Minecraft.yellow).decoration(ChatFormat.italic, false).decoration(ChatFormat.bold, true))
|
||||
.append(net.kyori.adventure.text.Component.text(" to edit/create a custom kit!", ChatFormat.Minecraft.yellow).decoration(ChatFormat.italic, false))
|
||||
, 0);
|
||||
|
||||
ItemDisplayUtil.addGlint(item);
|
||||
|
||||
item.setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text("No kits!", ChatFormat.Minecraft.white).decoration(ChatFormat.italic, false)));
|
||||
|
||||
this.setSlot(slot, item);
|
||||
return;
|
||||
}
|
||||
|
||||
for(String inventory : inventories){
|
||||
if(slot == 17) {
|
||||
slot = 19;
|
||||
}
|
||||
if(slot == 26) {
|
||||
slot = 28;
|
||||
}
|
||||
|
||||
|
||||
item = new ItemStack(Items.BARRIER);
|
||||
|
||||
ItemDisplayUtil.removeLore(item, 0);
|
||||
ItemDisplayUtil.removeLore(item, 1);
|
||||
|
||||
net.kyori.adventure.text.Component infoMsg = net.kyori.adventure.text.Component.text("INFO: ", ChatFormat.Minecraft.yellow).decoration(ChatFormat.italic, false).decoration(ChatFormat.bold, true)
|
||||
.append(net.kyori.adventure.text.Component.text("This kit is a ", ChatFormat.Minecraft.yellow)).decoration(ChatFormat.italic, false)
|
||||
.append(net.kyori.adventure.text.Component.text("per-custom ", ChatFormat.Minecraft.yellow)).decoration(ChatFormat.italic, false).decoration(ChatFormat.bold, true)
|
||||
.append(net.kyori.adventure.text.Component.text("kit.", ChatFormat.Minecraft.yellow)).decoration(ChatFormat.italic, false);
|
||||
|
||||
if(inventory.equalsIgnoreCase("vanilla")) {
|
||||
item = new ItemStack(Items.RESPAWN_ANCHOR);
|
||||
|
||||
ItemDisplayUtil.addLore(item, infoMsg, 0);
|
||||
}
|
||||
else if(inventory.equalsIgnoreCase("smp")) {
|
||||
item = new ItemStack(Items.DIAMOND_CHESTPLATE);
|
||||
|
||||
ItemDisplayUtil.addLore(item, infoMsg, 0);
|
||||
}
|
||||
|
||||
ItemDisplayUtil.addGlint(item);
|
||||
|
||||
item.setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text(inventory.toUpperCase().replaceAll("_", " "), ChatFormat.Minecraft.white).decoration(ChatFormat.italic, false)));
|
||||
|
||||
this.setSlot(slot, item);
|
||||
slot++;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean click(int index, ClickType clickType, net.minecraft.world.inventory.ClickType action){
|
||||
GuiElementInterface element = this.getSlot(index);
|
||||
if(element != null && clickType != ClickType.MOUSE_DOUBLE_CLICK) {
|
||||
ItemStack itemStack = element.getItemStack();
|
||||
Component name = itemStack.getHoverName();
|
||||
|
||||
if(itemStack.getItem() != Items.BLACK_STAINED_GLASS_PANE && itemStack.getItem() != Items.AIR && itemStack.getItem() != Items.PLAYER_HEAD && itemStack.getItem() != Items.COMMAND_BLOCK){
|
||||
if(InventoryUtil.getListOfInventories("duels/custom/" + this.player.getStringUUID()).contains(name.getString().toLowerCase().replaceAll(" ", "_"))){
|
||||
this.kit = name.getString().toLowerCase().replaceAll(" ", "_");
|
||||
setMapLayout();
|
||||
} else {
|
||||
GamemodeHandler.customChallengePlayer(new NexiaPlayer(this.player), new NexiaPlayer(this.other), this.kit, DuelsMap.identifyMap(name.getString()));
|
||||
this.close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return super.click(index, clickType, action);
|
||||
}
|
||||
public static int openDuelGui(ServerPlayer player, ServerPlayer other) {
|
||||
CustomDuelGUI shop = new CustomDuelGUI(MenuType.GENERIC_9x5, player, false);
|
||||
shop.setTitle(title);
|
||||
shop.setMainLayout(other);
|
||||
shop.open();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,14 @@
|
||||
package com.nexia.core.gui.duels;
|
||||
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.item.ItemDisplayUtil;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.minigames.games.duels.DuelGameMode;
|
||||
import com.nexia.minigames.games.duels.map.DuelsMap;
|
||||
import com.nexia.minigames.games.duels.gamemodes.GamemodeHandler;
|
||||
import com.nexia.minigames.games.duels.map.DuelsMap;
|
||||
import com.nexia.nexus.api.world.types.Minecraft;
|
||||
import com.nexia.nexus.builder.implementation.util.ObjectMappings;
|
||||
import eu.pb4.sgui.api.ClickType;
|
||||
import eu.pb4.sgui.api.elements.GuiElementInterface;
|
||||
import eu.pb4.sgui.api.gui.SimpleGui;
|
||||
@@ -13,9 +18,6 @@ import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.GameType;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class DuelGUI extends SimpleGui {
|
||||
static final TextComponent title = new TextComponent("Duel Menu");
|
||||
@@ -53,8 +55,8 @@ public class DuelGUI extends SimpleGui {
|
||||
airSlots++;
|
||||
}
|
||||
for(DuelsMap map : DuelsMap.duelsMaps){
|
||||
if(gameMode.gameMode == GameType.ADVENTURE && !map.isAdventureSupported) return;
|
||||
this.setSlot(slot, map.item.setHoverName(new TextComponent("§f" + map.id)));
|
||||
if(gameMode.gameMode == Minecraft.GameMode.ADVENTURE && !map.isAdventureSupported) continue;
|
||||
this.setSlot(slot, map.item);
|
||||
slot++;
|
||||
}
|
||||
}
|
||||
@@ -78,7 +80,14 @@ public class DuelGUI extends SimpleGui {
|
||||
this.setSlot(airSlots, new ItemStack(Items.AIR));
|
||||
airSlots++;
|
||||
}
|
||||
|
||||
//this.setSlot(4, HeadFunctions.getPlayerHead(otherp.getScoreboardName(), 1));
|
||||
|
||||
ItemStack playerHead = PlayerUtil.getPlayerHead(otherp.getUUID());
|
||||
playerHead.setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text(otherp.getScoreboardName(), ChatFormat.Minecraft.yellow).decoration(ChatFormat.bold, true).decoration(ChatFormat.italic, false)));
|
||||
|
||||
this.setSlot(4, playerHead);
|
||||
|
||||
int i1 = 0;
|
||||
ItemStack item;
|
||||
for(String duel : DuelGameMode.stringDuelGameModes){
|
||||
@@ -88,9 +97,10 @@ public class DuelGUI extends SimpleGui {
|
||||
if(slot == 26) {
|
||||
slot = 28;
|
||||
}
|
||||
item = DuelGameMode.duelsItems.get(i1).setHoverName(new TextComponent("§f" + duel.toUpperCase().replaceAll("_", " ")));
|
||||
item = DuelGameMode.duelsItems.get(i1);
|
||||
ItemDisplayUtil.removeLore(item, 0);
|
||||
ItemDisplayUtil.removeLore(item, 1);
|
||||
|
||||
this.setSlot(slot, item);
|
||||
slot++;
|
||||
i1++;
|
||||
@@ -103,12 +113,12 @@ public class DuelGUI extends SimpleGui {
|
||||
ItemStack itemStack = element.getItemStack();
|
||||
Component name = itemStack.getHoverName();
|
||||
|
||||
if(itemStack.getItem() != Items.BLACK_STAINED_GLASS_PANE && itemStack.getItem() != Items.AIR){
|
||||
if(DuelGameMode.stringDuelGameModes.contains(name.getString().substring(2).replaceAll(" ", "_"))){
|
||||
this.kit = name.getString().substring(2).replaceAll(" ", "_");
|
||||
if(itemStack.getItem() != Items.BLACK_STAINED_GLASS_PANE && itemStack.getItem() != Items.AIR && itemStack.getItem() != Items.PLAYER_HEAD){
|
||||
if(DuelGameMode.stringDuelGameModes.contains(name.getString().replaceAll(" ", "_"))){
|
||||
this.kit = name.getString().replaceAll(" ", "_");
|
||||
setMapLayout(GamemodeHandler.identifyGamemode(this.kit));
|
||||
} else {
|
||||
GamemodeHandler.challengePlayer(this.player, this.other, this.kit, DuelsMap.identifyMap(name.getString().substring(2)));
|
||||
GamemodeHandler.challengePlayer(new NexiaPlayer(this.player), new NexiaPlayer(this.other), this.kit, DuelsMap.identifyMap(name.getString()));
|
||||
this.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.nexia.core.gui.duels;
|
||||
|
||||
import com.nexia.core.games.util.LobbyUtil;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.item.ItemDisplayUtil;
|
||||
import com.nexia.core.utilities.item.ItemStackUtil;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.minigames.games.duels.DuelGameMode;
|
||||
import com.nexia.minigames.games.duels.gamemodes.GamemodeHandler;
|
||||
import com.nexia.nexus.builder.implementation.util.ObjectMappings;
|
||||
import eu.pb4.sgui.api.ClickType;
|
||||
import eu.pb4.sgui.api.elements.GuiElementInterface;
|
||||
import eu.pb4.sgui.api.gui.SimpleGui;
|
||||
@@ -15,7 +15,6 @@ import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class QueueGUI extends SimpleGui {
|
||||
static final TextComponent title = new TextComponent("Queue Menu");
|
||||
@@ -55,25 +54,27 @@ public class QueueGUI extends SimpleGui {
|
||||
slot = 28;
|
||||
}
|
||||
|
||||
|
||||
item = DuelGameMode.duelsItems.get(i1).setHoverName(new TextComponent("§f" + duel.toUpperCase().replaceAll("_", " ")));
|
||||
item = DuelGameMode.duelsItems.get(i1);
|
||||
DuelGameMode gameMode = GamemodeHandler.identifyGamemode(duel);
|
||||
|
||||
ItemDisplayUtil.removeLore(item, 0);
|
||||
ItemDisplayUtil.addLore(item, "§7There are §7§l" + gameMode.queue.size() + " §7people queued up.", 0);
|
||||
assert gameMode != null;
|
||||
ItemDisplayUtil.addLore(item,
|
||||
net.kyori.adventure.text.Component.text("There are ", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false)
|
||||
.append(net.kyori.adventure.text.Component.text(gameMode.queue.size(), ChatFormat.brandColor1).decoration(ChatFormat.bold, true).decoration(ChatFormat.italic, false))
|
||||
.append(net.kyori.adventure.text.Component.text(" people queued up.", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false))
|
||||
, 0);
|
||||
|
||||
if(GamemodeHandler.isInQueue(player, gameMode)) {
|
||||
ItemDisplayUtil.removeLore(item, 1);
|
||||
ItemDisplayUtil.addLore(item, "§7Click to leave the queue.", 1);
|
||||
} else {
|
||||
ItemDisplayUtil.removeLore(item, 1);
|
||||
ItemDisplayUtil.removeLore(item, 1);
|
||||
if(GamemodeHandler.isInQueue(new NexiaPlayer(this.player), gameMode)) {
|
||||
ItemDisplayUtil.addLore(item, net.kyori.adventure.text.Component.text("Click to leave the queue.", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 1);
|
||||
}
|
||||
|
||||
this.setSlot(slot, item);
|
||||
slot++;
|
||||
i1++;
|
||||
}
|
||||
this.setSlot(40, new ItemStack(Items.BARRIER).setHoverName(new TextComponent("§c§lLeave ALL Queues")));
|
||||
this.setSlot(40, new ItemStack(Items.BARRIER).setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text("Leave ALL Queues", ChatFormat.Minecraft.red).decoration(ChatFormat.bold, true).decoration(ChatFormat.italic, false))));
|
||||
}
|
||||
|
||||
public boolean click(int index, ClickType clickType, net.minecraft.world.inventory.ClickType action){
|
||||
@@ -82,24 +83,23 @@ public class QueueGUI extends SimpleGui {
|
||||
ItemStack itemStack = element.getItemStack();
|
||||
Component name = itemStack.getHoverName();
|
||||
|
||||
NexiaPlayer nexiaPlayer = new NexiaPlayer(this.player);
|
||||
|
||||
if(itemStack.getItem() != Items.BLACK_STAINED_GLASS_PANE && itemStack.getItem() != Items.AIR){
|
||||
if(name.getString().substring(4).equalsIgnoreCase("Leave ALL Queues")) {
|
||||
//PlayerUtil.getFactoryPlayer(player).runCommand("/queue LEAVE", 0, false);
|
||||
LobbyUtil.leaveAllGames(this.player, true);
|
||||
this.close();
|
||||
return super.click(index, clickType, action);
|
||||
if(name.getString().contains("Leave ALL Queues")) {
|
||||
GamemodeHandler.removeQueue(nexiaPlayer, null, false);
|
||||
}
|
||||
|
||||
String modifiedName = name.getString().substring(2).replaceAll(" ", "_");
|
||||
String modifiedName = name.getString().replaceAll(" ", "_");
|
||||
DuelGameMode gameMode = GamemodeHandler.identifyGamemode(modifiedName);
|
||||
|
||||
if(gameMode != null && GamemodeHandler.isInQueue(player, gameMode)) {
|
||||
GamemodeHandler.removeQueue(this.player, modifiedName, false);
|
||||
this.close();
|
||||
if(gameMode != null && GamemodeHandler.isInQueue(nexiaPlayer, gameMode)) {
|
||||
GamemodeHandler.removeQueue(nexiaPlayer, modifiedName, false);
|
||||
} else {
|
||||
GamemodeHandler.joinQueue(this.player, modifiedName, false);
|
||||
this.close();
|
||||
GamemodeHandler.joinQueue(nexiaPlayer, modifiedName, false);
|
||||
}
|
||||
|
||||
this.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,31 +1,23 @@
|
||||
package com.nexia.core.gui.ffa;
|
||||
|
||||
import com.combatreforged.factory.api.world.entity.player.Player;
|
||||
import com.nexia.core.Main;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.item.ItemDisplayUtil;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.ffa.classic.utilities.FfaAreas;
|
||||
import com.nexia.ffa.kits.FfaKit;
|
||||
import com.nexia.ffa.kits.utilities.player.PlayerDataManager;
|
||||
import com.nexia.minigames.games.duels.DuelGameMode;
|
||||
import com.nexia.nexus.builder.implementation.util.ObjectMappings;
|
||||
import eu.pb4.sgui.api.ClickType;
|
||||
import eu.pb4.sgui.api.elements.GuiElementInterface;
|
||||
import eu.pb4.sgui.api.gui.SimpleGui;
|
||||
import net.fabricmc.loader.impl.util.StringUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.enchantment.Enchantments;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class KitGUI extends SimpleGui {
|
||||
static final TextComponent title = new TextComponent("Kits Menu");
|
||||
|
||||
public KitGUI(MenuType<?> type, ServerPlayer player, boolean includePlayer) {
|
||||
super(type, player, includePlayer);
|
||||
}
|
||||
@@ -57,7 +49,7 @@ public class KitGUI extends SimpleGui {
|
||||
|
||||
ItemStack item = ffaKits.item;
|
||||
|
||||
item.setHoverName(new TextComponent("§f" + StringUtil.capitalize(ffaKits.id.replaceAll("_", " "))));
|
||||
item.setHoverName(ObjectMappings.convertComponent(Component.text(StringUtil.capitalize(ffaKits.id.replaceAll("_", " ")), ChatFormat.Minecraft.white)));
|
||||
|
||||
this.setSlot(slot, item);
|
||||
|
||||
@@ -66,10 +58,10 @@ public class KitGUI extends SimpleGui {
|
||||
}
|
||||
|
||||
public static void giveKit(ServerPlayer minecraftPlayer, String name) {
|
||||
Player player = PlayerUtil.getFactoryPlayer(minecraftPlayer);
|
||||
NexiaPlayer player = new NexiaPlayer(minecraftPlayer);
|
||||
FfaKit kit = FfaKit.identifyKit(name);
|
||||
if(kit != null) kit.giveKit(minecraftPlayer, false);
|
||||
else player.sendMessage(Component.text("Invalid kit!").color(ChatFormat.failColor));
|
||||
if(kit != null) kit.giveKit(new NexiaPlayer(minecraftPlayer), false);
|
||||
else player.sendMessage(Component.text("Invalid kit!", ChatFormat.failColor));
|
||||
}
|
||||
|
||||
public boolean click(int index, ClickType clickType, net.minecraft.world.inventory.ClickType action){
|
||||
@@ -79,7 +71,7 @@ public class KitGUI extends SimpleGui {
|
||||
net.minecraft.network.chat.Component name = itemStack.getHoverName();
|
||||
|
||||
if(itemStack.getItem() != Items.BLACK_STAINED_GLASS_PANE && itemStack.getItem() != Items.AIR){
|
||||
String modifiedName = name.getString().substring(2).toLowerCase();
|
||||
String modifiedName = name.getString().toLowerCase();
|
||||
giveKit(this.player, modifiedName);
|
||||
this.close();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.nexia.core.gui.ffa;
|
||||
|
||||
import com.combatreforged.factory.api.world.entity.player.Player;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.item.ItemDisplayUtil;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.ffa.classic.utilities.FfaAreas;
|
||||
import com.nexia.ffa.kits.utilities.KitFfaAreas;
|
||||
import com.nexia.nexus.api.world.util.Location;
|
||||
import eu.pb4.sgui.api.ClickType;
|
||||
import eu.pb4.sgui.api.elements.GuiElementInterface;
|
||||
import eu.pb4.sgui.api.gui.SimpleGui;
|
||||
@@ -23,7 +23,7 @@ public class SpawnGUI extends SimpleGui {
|
||||
super(type, player, includePlayer);
|
||||
}
|
||||
|
||||
public static HashMap<String, int[]> mapLocations = new HashMap<>();
|
||||
public static HashMap<String, Location> mapLocations = new HashMap<>();
|
||||
|
||||
private void fillEmptySlots(ItemStack itemStack){
|
||||
for(int i = 0; i < 45; i++){
|
||||
@@ -109,18 +109,17 @@ public class SpawnGUI extends SimpleGui {
|
||||
}
|
||||
|
||||
public static void teleportPlayer(ServerPlayer minecraftPlayer, String name) {
|
||||
int[] pos = mapLocations.get(name);
|
||||
Player player = PlayerUtil.getFactoryPlayer(minecraftPlayer);
|
||||
Location pos = mapLocations.get(name);
|
||||
NexiaPlayer player = new NexiaPlayer(minecraftPlayer);
|
||||
if(pos != null){
|
||||
minecraftPlayer.teleportTo(FfaAreas.ffaWorld, pos[0], pos[1], pos[2], pos[3], pos[4]);
|
||||
player.sendMessage(
|
||||
ChatFormat.nexiaMessage
|
||||
.append(Component.text("You have been teleported to: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(name).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false))
|
||||
.append(Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
|
||||
player.teleport(pos);
|
||||
player.sendNexiaMessage(
|
||||
Component.text("You have been teleported to: ", ChatFormat.normalColor)
|
||||
.append(Component.text(name, ChatFormat.brandColor2))
|
||||
.append(Component.text(".", ChatFormat.normalColor))
|
||||
);
|
||||
} else {
|
||||
player.sendMessage(Component.text("Invalid biome!").color(ChatFormat.failColor));
|
||||
player.sendMessage(Component.text("Invalid biome!", ChatFormat.failColor));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,15 +157,15 @@ public class SpawnGUI extends SimpleGui {
|
||||
// 115 40 -151 | Mushrooms
|
||||
// 0 40 0 | Plains (Center)
|
||||
|
||||
mapLocations.put("nether forest", new int[]{186, 49, -71, -133, -5});
|
||||
mapLocations.put("blackstone", new int[]{161, 57, 82, -130, -11});
|
||||
mapLocations.put("mesa", new int[]{74, 48, 169, 130, -1});
|
||||
mapLocations.put("savanna", new int[]{-166, 43, 50, 156, -3});
|
||||
mapLocations.put("snow", new int[]{-35, 47, -206, 51, 1});
|
||||
mapLocations.put("forest", new int[]{-174, 42, -38, 132, -2});
|
||||
mapLocations.put("desert", new int[]{-73, 41, 181, 121, -2});
|
||||
mapLocations.put("mushrooms", new int[]{115, 41, -151, -136, -1});
|
||||
mapLocations.put("plains", new int[]{0, 41, 0, 0, 0});
|
||||
mapLocations.put("nether forest", new Location(186, 49, -71, -133, -5, KitFfaAreas.nexusFfaWorld));
|
||||
mapLocations.put("blackstone", new Location(161, 57, 82, -130, -11, KitFfaAreas.nexusFfaWorld));
|
||||
mapLocations.put("mesa", new Location(74, 48, 169, 130, -1, KitFfaAreas.nexusFfaWorld));
|
||||
mapLocations.put("savanna", new Location(-166, 43, 50, 156, -3, KitFfaAreas.nexusFfaWorld));
|
||||
mapLocations.put("snow", new Location(-35, 47, -206, 51, 1, KitFfaAreas.nexusFfaWorld));
|
||||
mapLocations.put("forest", new Location(-174, 42, -38, 132, -2, KitFfaAreas.nexusFfaWorld));
|
||||
mapLocations.put("desert", new Location(-73, 41, 181, 121, -2, KitFfaAreas.nexusFfaWorld));
|
||||
mapLocations.put("mushrooms", new Location(115, 41, -151, -136, -1, KitFfaAreas.nexusFfaWorld));
|
||||
mapLocations.put("plains", new Location(0, 41, 0, 0, 0, KitFfaAreas.nexusFfaWorld));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,18 @@
|
||||
package com.nexia.core.listeners;
|
||||
|
||||
import com.nexia.core.listeners.factory.*;
|
||||
import com.nexia.core.listeners.nexus.*;
|
||||
|
||||
public class ListenerHelper {
|
||||
public static void registerListeners() {
|
||||
// Factory Listeners
|
||||
PlayerJoinListener.registerListener();
|
||||
PlayerLeaveListener.registerListener();
|
||||
UseItemListener.registerListener();
|
||||
PlayerDropItemListener.registerListener();
|
||||
PlayerRespawnListener.registerListener();
|
||||
// Nexus Listeners
|
||||
new PlayerJoinListener().registerListener();
|
||||
new PlayerDamageListener().registerListener();
|
||||
new PlayerDeathListener().registerListener();
|
||||
new PlayerHungerListener().registerListener();
|
||||
new PlayerLeaveListener().registerListener();
|
||||
new PlayerSwapHandItemsListener().registerListener();
|
||||
new PlayerUseItemListener().registerListener();
|
||||
new PlayerDropItemListener().registerListener();
|
||||
new PlayerRespawnListener().registerListener();
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.nexia.core.listeners.factory;
|
||||
|
||||
import com.combatreforged.factory.api.event.player.PlayerHotbarDropItemEvent;
|
||||
import com.combatreforged.factory.api.world.entity.player.Player;
|
||||
import com.nexia.core.games.util.LobbyUtil;
|
||||
import com.nexia.core.utilities.item.ItemStackUtil;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.ffa.FfaUtil;
|
||||
import com.nexia.ffa.classic.utilities.FfaClassicUtil;
|
||||
import com.nexia.minigames.games.bedwars.util.BwUtil;
|
||||
import com.nexia.minigames.games.oitc.OitcGame;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class PlayerDropItemListener {
|
||||
public static void registerListener(){
|
||||
PlayerHotbarDropItemEvent.BACKEND.register(playerDropItemEvent -> {
|
||||
|
||||
Player player = playerDropItemEvent.getPlayer();
|
||||
ServerPlayer minecraftPlayer = PlayerUtil.getMinecraftPlayer(player);
|
||||
|
||||
if (FfaUtil.isFfaPlayer(minecraftPlayer)) {
|
||||
playerDropItemEvent.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if(LobbyUtil.isLobbyWorld(minecraftPlayer.getLevel())){
|
||||
playerDropItemEvent.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (BwUtil.isBedWarsPlayer(minecraftPlayer)) {
|
||||
if (!BwUtil.canDropItem(playerDropItemEvent.getItemStack())) {
|
||||
ItemStackUtil.sendInventoryRefreshPacket(minecraftPlayer);
|
||||
playerDropItemEvent.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(OitcGame.isOITCPlayer(minecraftPlayer)){
|
||||
playerDropItemEvent.setCancelled(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
package com.nexia.core.listeners.factory;
|
||||
|
||||
import com.combatreforged.factory.api.event.player.PlayerJoinEvent;
|
||||
|
||||
import com.combatreforged.factory.api.world.entity.player.Player;
|
||||
import com.nexia.core.Main;
|
||||
import com.nexia.core.games.util.LobbyUtil;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerDataManager;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import com.nexia.discord.utilities.player.PlayerData;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
import net.kyori.adventure.text.event.HoverEvent;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.stats.Stats;
|
||||
|
||||
import static com.nexia.discord.Main.jda;
|
||||
|
||||
public class PlayerJoinListener {
|
||||
public static void registerListener() {
|
||||
PlayerJoinEvent.BACKEND.register(playerJoinEvent -> {
|
||||
|
||||
Player player = playerJoinEvent.getPlayer();
|
||||
ServerPlayer minecraftPlayer = PlayerUtil.getMinecraftPlayer(player);
|
||||
|
||||
processJoin(player, minecraftPlayer);
|
||||
|
||||
/*
|
||||
if(minecraftPlayer.getStats().getValue(Stats.CUSTOM.get(Stats.LEAVE_GAME)) <= 1) {
|
||||
playerJoinEvent.setJoinMessage(
|
||||
Component.text("[").color(ChatFormat.lineColor)
|
||||
.append(Component.text("!").color(TextColor.fromHexString("#ff9940")))
|
||||
.append(Component.text("] ").color(ChatFormat.lineColor))
|
||||
.append(Component.text(player.getRawName()).color(TextColor.fromHexString("#ff9940")))
|
||||
|
||||
|
||||
);
|
||||
} else {
|
||||
playerJoinEvent.setJoinMessage(
|
||||
Component.text("[").color(ChatFormat.lineColor)
|
||||
.append(Component.text("+").color(ChatFormat.greenColor))
|
||||
.append(Component.text("] ").color(ChatFormat.lineColor))
|
||||
.append(Component.text(player.getRawName()).color(ChatFormat.greenColor))
|
||||
);
|
||||
}
|
||||
|
||||
*/
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private static void sendJoinMessage(Player player){
|
||||
player.sendMessage(ChatFormat.separatorLine("Welcome"));
|
||||
player.sendMessage(
|
||||
Component.text(" » ").color(ChatFormat.brandColor2)
|
||||
.append(Component.text("Welcome ").color(ChatFormat.normalColor))
|
||||
.append(Component.text(player.getRawName()).color(ChatFormat.brandColor2))
|
||||
.append(Component.text(" to ").color(ChatFormat.normalColor))
|
||||
.append(Component.text("Nexia").color(ChatFormat.brandColor2))
|
||||
.append(Component.text("!").color(ChatFormat.normalColor))
|
||||
);
|
||||
player.sendMessage(
|
||||
Component.text(" » ").color(ChatFormat.brandColor2)
|
||||
.append(Component.text("Players online: ").color(ChatFormat.normalColor))
|
||||
.append(Component.text(ServerTime.minecraftServer.getPlayerCount()).color(ChatFormat.brandColor2))
|
||||
.append(Component.text("/").color(ChatFormat.lineColor))
|
||||
.append(Component.text(ServerTime.factoryServer.getMaxPlayerCount()).color(ChatFormat.brandColor2))
|
||||
);
|
||||
player.sendMessage(
|
||||
Component.text(" » ").color(ChatFormat.brandColor2)
|
||||
.append(Component.text("Read the rules: ").color(ChatFormat.normalColor))
|
||||
.append(Component.text("/rules")).color(ChatFormat.brandColor2).hoverEvent(HoverEvent.showText(Component.text("Click me").color(TextColor.fromHexString("#73ff54"))))
|
||||
.clickEvent(ClickEvent.suggestCommand("/rules"))
|
||||
);
|
||||
player.sendMessage(
|
||||
Component.text(" » ").color(ChatFormat.brandColor2)
|
||||
.append(Component.text("Join our discord: ").color(ChatFormat.normalColor))
|
||||
.append(Component.text(com.nexia.discord.Main.config.discordLink)
|
||||
.color(ChatFormat.brandColor2)
|
||||
.hoverEvent(HoverEvent.showText(Component.text("Click me").color(TextColor.fromHexString("#73ff54"))))
|
||||
.clickEvent(ClickEvent.openUrl(com.nexia.discord.Main.config.discordLink))
|
||||
)
|
||||
);
|
||||
player.sendMessage(ChatFormat.separatorLine(null));
|
||||
}
|
||||
|
||||
private static void checkBooster(ServerPlayer player) {
|
||||
PlayerData playerData = com.nexia.discord.utilities.player.PlayerDataManager.get(player.getUUID());
|
||||
if(!playerData.savedData.isLinked) { return; }
|
||||
Member discordUser = null;
|
||||
|
||||
try {
|
||||
discordUser = jda.getGuildById(com.nexia.discord.Main.config.guildID).retrieveMemberById(playerData.savedData.discordID).complete(true);
|
||||
} catch (Exception ignored) { }
|
||||
|
||||
if(discordUser == null) {
|
||||
if(Permissions.check(player, "nexia.prefix.supporter")) {
|
||||
if(Permissions.check(player, "nexia.rank")) {
|
||||
ServerTime.factoryServer.runCommand("/staffprefix set " + player.getScoreboardName() + " default");
|
||||
ServerTime.factoryServer.runCommand("/staffprefix remove " + player.getScoreboardName() + " supporter");
|
||||
return;
|
||||
}
|
||||
ServerTime.factoryServer.runCommand("/rank " + player.getScoreboardName() + " default", 4, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Role supporterRole = jda.getRoleById("1107264322951979110");
|
||||
boolean hasRole = discordUser.getRoles().contains(supporterRole);
|
||||
boolean hasSupporterPrefix = Permissions.check(player, "nexia.prefix.supporter");
|
||||
|
||||
if(hasRole && !hasSupporterPrefix) {
|
||||
if(Permissions.check(player, "nexia.rank")) {
|
||||
ServerTime.factoryServer.runCommand("/staffprefix add " + player.getScoreboardName() + " supporter", 4, false);
|
||||
return;
|
||||
}
|
||||
ServerTime.factoryServer.runCommand("/rank " + player.getScoreboardName() + " supporter", 4, false);
|
||||
} else if(!hasRole && hasSupporterPrefix) {
|
||||
if(Permissions.check(player, "nexia.rank")) {
|
||||
ServerTime.factoryServer.runCommand("/staffprefix remove " + player.getScoreboardName() + " supporter", 4, false);
|
||||
ServerTime.factoryServer.runCommand("/staffprefix set " + player.getScoreboardName() + " default", 4, false);
|
||||
return;
|
||||
}
|
||||
ServerTime.factoryServer.runCommand("/rank " + player.getScoreboardName() + " default", 4, false);
|
||||
}
|
||||
}
|
||||
|
||||
private static void processJoin(Player player, ServerPlayer minecraftPlayer) {
|
||||
PlayerDataManager.addPlayerData(minecraftPlayer);
|
||||
|
||||
com.nexia.ffa.classic.utilities.player.PlayerDataManager.addPlayerData(minecraftPlayer);
|
||||
com.nexia.ffa.kits.utilities.player.PlayerDataManager.addPlayerData(minecraftPlayer);
|
||||
com.nexia.ffa.uhc.utilities.player.PlayerDataManager.addPlayerData(minecraftPlayer);
|
||||
com.nexia.ffa.pot.utilities.player.PlayerDataManager.addPlayerData(minecraftPlayer);
|
||||
|
||||
com.nexia.discord.utilities.player.PlayerDataManager.addPlayerData(minecraftPlayer.getUUID());
|
||||
com.nexia.minigames.games.duels.util.player.PlayerDataManager.addPlayerData(minecraftPlayer);
|
||||
com.nexia.minigames.games.bedwars.util.player.PlayerDataManager.addPlayerData(minecraftPlayer);
|
||||
com.nexia.minigames.games.oitc.util.player.PlayerDataManager.addPlayerData(minecraftPlayer);
|
||||
com.nexia.minigames.games.skywars.util.player.PlayerDataManager.addPlayerData(minecraftPlayer);
|
||||
LobbyUtil.leaveAllGames(minecraftPlayer, true);
|
||||
checkBooster(minecraftPlayer);
|
||||
sendJoinMessage(player);
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.nexia.core.listeners.factory;
|
||||
|
||||
import com.combatreforged.factory.api.event.player.PlayerDisconnectEvent;
|
||||
|
||||
import com.combatreforged.factory.api.world.entity.player.Player;
|
||||
import com.nexia.core.Main;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.player.PlayerDataManager;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import com.nexia.ffa.classic.utilities.FfaClassicUtil;
|
||||
import com.nexia.minigames.games.bedwars.players.BwPlayerEvents;
|
||||
import com.nexia.minigames.games.bedwars.util.BwUtil;
|
||||
import com.nexia.minigames.games.duels.DuelGameHandler;
|
||||
import com.nexia.minigames.games.oitc.OitcGame;
|
||||
import com.nexia.minigames.games.skywars.SkywarsGame;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class PlayerLeaveListener {
|
||||
public static void registerListener() {
|
||||
PlayerDisconnectEvent.BACKEND.register(playerDisconnectEvent -> {
|
||||
|
||||
Player player = playerDisconnectEvent.getPlayer();
|
||||
ServerPlayer minecraftPlayer = PlayerUtil.getMinecraftPlayer(player);
|
||||
|
||||
processDisconnect(player, minecraftPlayer);
|
||||
|
||||
/*
|
||||
if(Main.config.events.statusMessages){
|
||||
playerDisconnectEvent.setLeaveMessage(
|
||||
Component.text("[").color(ChatFormat.lineColor)
|
||||
.append(Component.text("-").color(ChatFormat.failColor)
|
||||
.append(Component.text("] ").color(ChatFormat.lineColor))
|
||||
.append(Component.text(player.getRawName()).color(ChatFormat.failColor)))
|
||||
);
|
||||
}
|
||||
|
||||
*/
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void processDisconnect(Player player, ServerPlayer minecraftPlayer){
|
||||
|
||||
if (BwUtil.isInBedWars(minecraftPlayer)) BwPlayerEvents.leaveInBedWars(minecraftPlayer);
|
||||
else if (FfaClassicUtil.isFfaPlayer(minecraftPlayer)) {
|
||||
FfaClassicUtil.leaveOrDie(minecraftPlayer, minecraftPlayer.getLastDamageSource(), true);
|
||||
}
|
||||
else if (PlayerDataManager.get(minecraftPlayer).gameMode == PlayerGameMode.LOBBY) DuelGameHandler.leave(minecraftPlayer, true);
|
||||
else if (PlayerDataManager.get(minecraftPlayer).gameMode == PlayerGameMode.SKYWARS) SkywarsGame.leave(minecraftPlayer);
|
||||
else if (PlayerDataManager.get(minecraftPlayer).gameMode == PlayerGameMode.OITC) OitcGame.leave(minecraftPlayer);
|
||||
|
||||
PlayerDataManager.removePlayerData(minecraftPlayer);
|
||||
|
||||
com.nexia.ffa.classic.utilities.player.PlayerDataManager.removePlayerData(minecraftPlayer);
|
||||
com.nexia.ffa.kits.utilities.player.PlayerDataManager.removePlayerData(minecraftPlayer);
|
||||
com.nexia.ffa.uhc.utilities.player.PlayerDataManager.removePlayerData(minecraftPlayer);
|
||||
com.nexia.ffa.pot.utilities.player.PlayerDataManager.removePlayerData(minecraftPlayer);
|
||||
|
||||
com.nexia.discord.utilities.player.PlayerDataManager.removePlayerData(minecraftPlayer.getUUID());
|
||||
com.nexia.minigames.games.duels.util.player.PlayerDataManager.removePlayerData(minecraftPlayer);
|
||||
com.nexia.minigames.games.oitc.util.player.PlayerDataManager.removePlayerData(minecraftPlayer);
|
||||
com.nexia.minigames.games.bedwars.util.player.PlayerDataManager.removePlayerData(minecraftPlayer);
|
||||
com.nexia.minigames.games.skywars.util.player.PlayerDataManager.removePlayerData(minecraftPlayer);
|
||||
|
||||
|
||||
//LobbyUtil.leaveAllGames(minecraftPlayer, true);
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
package com.nexia.core.listeners.factory;
|
||||
|
||||
import com.combatreforged.factory.api.event.player.PlayerRespawnEvent;
|
||||
import com.combatreforged.factory.api.util.Identifier;
|
||||
import com.combatreforged.factory.api.world.entity.player.Player;
|
||||
import com.combatreforged.factory.api.world.types.Minecraft;
|
||||
import com.combatreforged.factory.api.world.util.Location;
|
||||
import com.nexia.core.games.util.LobbyUtil;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import com.nexia.minigames.GameHandler;
|
||||
import com.nexia.minigames.games.duels.DuelsGame;
|
||||
import com.nexia.minigames.games.duels.team.TeamDuelsGame;
|
||||
import com.nexia.minigames.games.duels.util.player.PlayerData;
|
||||
import com.nexia.minigames.games.duels.util.player.PlayerDataManager;
|
||||
import com.nexia.minigames.games.oitc.OitcGame;
|
||||
import com.nexia.minigames.games.oitc.OitcGameMode;
|
||||
import com.nexia.minigames.games.skywars.SkywarsGame;
|
||||
import com.nexia.minigames.games.skywars.SkywarsGameMode;
|
||||
import com.nexia.world.WorldUtil;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class PlayerRespawnListener {
|
||||
public static void registerListener(){
|
||||
PlayerRespawnEvent.BACKEND.register((respawnEvent) -> {
|
||||
Player factoryPlayer = respawnEvent.getPlayer();
|
||||
if(factoryPlayer == null && respawnEvent.getEntity() instanceof Player) {
|
||||
factoryPlayer = (Player) respawnEvent.getEntity();
|
||||
}
|
||||
|
||||
if(factoryPlayer == null) return;
|
||||
|
||||
ServerPlayer player = ServerTime.minecraftServer.getPlayerList().getPlayer(factoryPlayer.getUUID());
|
||||
|
||||
if(player == null) return;
|
||||
PlayerData duelsData = PlayerDataManager.get(player);
|
||||
com.nexia.core.utilities.player.PlayerData data = com.nexia.core.utilities.player.PlayerDataManager.get(player);
|
||||
DuelsGame duelsGame = duelsData.duelsGame;
|
||||
TeamDuelsGame teamDuelsGame = duelsData.teamDuelsGame;
|
||||
|
||||
|
||||
if(data.gameMode == PlayerGameMode.OITC) {
|
||||
double[] respawn = {0, 100, 0};
|
||||
boolean isPlaying = com.nexia.minigames.games.oitc.util.player.PlayerDataManager.get(player).gameMode == OitcGameMode.PLAYING;
|
||||
if(player.getLastDamageSource() != null && PlayerUtil.getPlayerAttacker(player.getLastDamageSource().getEntity()) != null) {
|
||||
ServerPlayer serverPlayer = PlayerUtil.getPlayerAttacker(player.getLastDamageSource().getEntity());
|
||||
if(isPlaying) {
|
||||
respawn[0] = serverPlayer.getX();
|
||||
respawn[1] = serverPlayer.getY();
|
||||
respawn[2] = serverPlayer.getZ();
|
||||
}
|
||||
}
|
||||
|
||||
if(isPlaying) {
|
||||
GameHandler.showCountdown(player, 5);
|
||||
}
|
||||
respawnEvent.setRespawnMode(Minecraft.GameMode.SPECTATOR);
|
||||
respawnEvent.setSpawnpoint(new Location(respawn[0], respawn[1], respawn[2], ServerTime.factoryServer.getWorld(new Identifier("oitc", OitcGame.world.dimension().toString().replaceAll("]", "").split(":")[2]))));
|
||||
return;
|
||||
}
|
||||
|
||||
if(data.gameMode == PlayerGameMode.SKYWARS) {
|
||||
double[] respawn = {0, 100, 0};
|
||||
boolean isPlaying = com.nexia.minigames.games.skywars.util.player.PlayerDataManager.get(player).gameMode == SkywarsGameMode.PLAYING;
|
||||
if(player.getLastDamageSource() != null && PlayerUtil.getPlayerAttacker(player.getLastDamageSource().getEntity()) != null) {
|
||||
ServerPlayer serverPlayer = PlayerUtil.getPlayerAttacker(player.getLastDamageSource().getEntity());
|
||||
if(isPlaying) {
|
||||
respawn[0] = serverPlayer.getX();
|
||||
respawn[1] = serverPlayer.getY();
|
||||
respawn[2] = serverPlayer.getZ();
|
||||
}
|
||||
}
|
||||
|
||||
respawnEvent.setRespawnMode(Minecraft.GameMode.SPECTATOR);
|
||||
respawnEvent.setSpawnpoint(new Location(respawn[0], respawn[1], respawn[2], WorldUtil.getWorld(SkywarsGame.world)));
|
||||
}
|
||||
|
||||
if(duelsGame != null && duelsGame.isEnding && duelsGame.winner != null) {
|
||||
factoryPlayer.getInventory().clear();
|
||||
LobbyUtil.giveItems(player);
|
||||
|
||||
respawnEvent.setRespawnMode(Minecraft.GameMode.SPECTATOR);
|
||||
respawnEvent.setSpawnpoint(new Location(duelsGame.winner.getX(), duelsGame.winner.getY(), duelsGame.winner.getZ(), ServerTime.factoryServer.getWorld(new Identifier("duels", duelsGame.level.dimension().toString().replaceAll("]", "").split(":")[2]))));
|
||||
//player.teleportTo(duelsGame.level, duelsGame.winner.getX(), duelsGame.winner.getY(), duelsGame.winner.getZ(), 0, 0);
|
||||
} else if(teamDuelsGame != null && duelsData.duelsTeam != null) {
|
||||
factoryPlayer.getInventory().clear();
|
||||
LobbyUtil.giveItems(player);
|
||||
|
||||
respawnEvent.setRespawnMode(Minecraft.GameMode.SPECTATOR);
|
||||
// duelsTeam.alive.get(new Random().nextInt(teamDuelsGame.winner.alive.size()))
|
||||
|
||||
ServerPlayer player1;
|
||||
if(duelsData.duelsTeam.alive.isEmpty()) {
|
||||
if(teamDuelsGame.team1 == duelsData.duelsTeam) {
|
||||
player1 = teamDuelsGame.team2.alive.get(new Random().nextInt(teamDuelsGame.team2.alive.size()));
|
||||
} else {
|
||||
player1 = teamDuelsGame.team1.alive.get(new Random().nextInt(teamDuelsGame.team1.alive.size()));
|
||||
}
|
||||
} else {
|
||||
player1 = duelsData.duelsTeam.alive.get(new Random().nextInt(duelsData.duelsTeam.alive.size()));
|
||||
}
|
||||
|
||||
|
||||
respawnEvent.setSpawnpoint(new Location(player1.getX(), player1.getY(), player1.getZ(), ServerTime.factoryServer.getWorld(new Identifier("duels", teamDuelsGame.level.dimension().toString().replaceAll("]", "").split(":")[2]))));
|
||||
//player.teleportTo(duelsGame.level, duelsGame.winner.getX(), duelsGame.winner.getY(), duelsGame.winner.getZ(), 0, 0);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.nexia.core.listeners.factory;
|
||||
|
||||
import com.combatreforged.factory.api.event.player.PlayerUseItemEvent;
|
||||
import com.combatreforged.factory.api.world.entity.player.Player;
|
||||
import com.combatreforged.factory.api.world.item.ItemStack;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.gui.PlayGUI;
|
||||
import com.nexia.core.gui.PrefixGUI;
|
||||
import com.nexia.core.gui.duels.QueueGUI;
|
||||
import com.nexia.core.utilities.player.PlayerDataManager;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class UseItemListener {
|
||||
public static void registerListener() {
|
||||
PlayerUseItemEvent.BACKEND.register(playerUseItemEvent -> {
|
||||
|
||||
Player player = playerUseItemEvent.getPlayer();
|
||||
ServerPlayer minecraftPlayer = PlayerUtil.getMinecraftPlayer(player);
|
||||
|
||||
ItemStack itemStack = playerUseItemEvent.getItemStack();
|
||||
|
||||
Component name = itemStack.getDisplayName();
|
||||
|
||||
PlayerGameMode gameMode = PlayerDataManager.get(minecraftPlayer).gameMode;
|
||||
|
||||
String sName = name.toString().toLowerCase();
|
||||
|
||||
if(sName.contains("gamemode selector") && gameMode == PlayerGameMode.LOBBY){
|
||||
//PlayGUI.openMainGUI(minecraftPlayer);
|
||||
player.runCommand("/play", 0, false);
|
||||
}
|
||||
|
||||
if(sName.contains("prefix selector") && gameMode == PlayerGameMode.LOBBY){
|
||||
//PrefixGUI.openRankGUI(minecraftPlayer);
|
||||
player.runCommand("/prefix", 0, false);
|
||||
}
|
||||
|
||||
if(sName.contains("queue sword") && gameMode == PlayerGameMode.LOBBY) {
|
||||
//QueueGUI.openQueueGUI(minecraftPlayer);
|
||||
player.runCommand("/queue", 0, false);
|
||||
}
|
||||
|
||||
if(sName.contains("team axe") && gameMode == PlayerGameMode.LOBBY) {
|
||||
player.runCommand("/party list");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.nexia.core.listeners.nexus;
|
||||
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.core.games.util.LobbyUtil;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.ffa.base.BaseFfaUtil;
|
||||
import com.nexia.nexus.api.event.entity.LivingEntityDamageEvent;
|
||||
import com.nexia.nexus.api.world.damage.DamageData;
|
||||
import com.nexia.nexus.api.world.entity.player.Player;
|
||||
|
||||
public class PlayerDamageListener {
|
||||
public void registerListener() {
|
||||
LivingEntityDamageEvent.BACKEND.register(livingEntityDamageEvent -> {
|
||||
if(!(livingEntityDamageEvent.getLivingEntity() instanceof Player nexusPlayer)) return;
|
||||
NexiaPlayer player = new NexiaPlayer(nexusPlayer);
|
||||
DamageData damageData = livingEntityDamageEvent.getCause();
|
||||
|
||||
for (BaseFfaUtil util : BaseFfaUtil.ffaUtils) {
|
||||
if (util.isFfaPlayer(player) && !util.beforeDamage(player, damageData)) {
|
||||
livingEntityDamageEvent.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(LobbyUtil.isLobbyWorld(player.getWorld()) && damageData.getType().equals(DamageData.Type.VOID)) {
|
||||
player.teleport(LobbyUtil.nexusLobbyLocation);
|
||||
livingEntityDamageEvent.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.hasTag(LobbyUtil.NO_DAMAGE_TAG)) {
|
||||
livingEntityDamageEvent.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
Player attacker = PlayerUtil.getPlayerAttacker(damageData);
|
||||
|
||||
if(attacker != null) {
|
||||
if(attacker.hasTag(LobbyUtil.NO_DAMAGE_TAG)) {
|
||||
livingEntityDamageEvent.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(damageData.getType().equals(DamageData.Type.VOID) && (!player.isInGameMode(PlayerGameMode.LOBBY) || player.isInGameMode(PlayerGameMode.FFA))) {
|
||||
livingEntityDamageEvent.setDamage(1000);
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.nexia.core.listeners.nexus;
|
||||
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import com.nexia.minigames.games.bedwars.areas.BwAreas;
|
||||
import com.nexia.minigames.games.bedwars.players.BwPlayerEvents;
|
||||
import com.nexia.minigames.games.duels.util.player.DuelsPlayerData;
|
||||
import com.nexia.minigames.games.oitc.OitcGame;
|
||||
import com.nexia.minigames.games.skywars.SkywarsGame;
|
||||
import com.nexia.nexus.api.event.player.PlayerDeathEvent;
|
||||
import com.nexia.nexus.api.world.scoreboard.ScoreboardTeam;
|
||||
|
||||
public class PlayerDeathListener {
|
||||
public void registerListener() {
|
||||
PlayerDeathEvent.BACKEND.register(playerDeathEvent -> {
|
||||
NexiaPlayer nexiaPlayer = new NexiaPlayer(playerDeathEvent.getPlayer());
|
||||
|
||||
PlayerGameMode gameMode = ((CorePlayerData) PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(nexiaPlayer)).gameMode;
|
||||
DuelsPlayerData duelsData = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(nexiaPlayer);
|
||||
|
||||
/*
|
||||
if(FfaUtil.isFfaPlayer(nexiaPlayer)) {
|
||||
FfaUtil.leaveOrDie(nexiaPlayer, playerDeathEvent, false);
|
||||
}
|
||||
*/
|
||||
|
||||
if (BwAreas.isBedWarsWorld(nexiaPlayer.getWorld())) {
|
||||
BwPlayerEvents.death(nexiaPlayer);
|
||||
playerDeathEvent.setVisibleFor(ScoreboardTeam.VisibleFor.NO_ONE);
|
||||
return;
|
||||
}
|
||||
|
||||
if(gameMode == PlayerGameMode.OITC){
|
||||
OitcGame.death(nexiaPlayer, playerDeathEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
if(gameMode == PlayerGameMode.SKYWARS) {
|
||||
SkywarsGame.death(nexiaPlayer, playerDeathEvent);
|
||||
}
|
||||
|
||||
if(gameMode == PlayerGameMode.LOBBY && duelsData.gameOptions != null) {
|
||||
if(duelsData.gameOptions.duelsGame != null) {
|
||||
duelsData.gameOptions.duelsGame.death(nexiaPlayer);
|
||||
return;
|
||||
}
|
||||
if(duelsData.gameOptions.teamDuelsGame != null) {
|
||||
duelsData.gameOptions.teamDuelsGame.death(nexiaPlayer, playerDeathEvent);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.nexia.core.listeners.nexus;
|
||||
|
||||
import com.nexia.nexus.api.event.player.PlayerHotbarDropItemEvent;
|
||||
import com.nexia.core.utilities.misc.EventUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
|
||||
public class PlayerDropItemListener {
|
||||
public void registerListener(){
|
||||
PlayerHotbarDropItemEvent.BACKEND.register(playerDropItemEvent -> {
|
||||
NexiaPlayer player = new NexiaPlayer(playerDropItemEvent.getPlayer());
|
||||
|
||||
if (!EventUtil.dropItem(player, playerDropItemEvent.getItemStack())) {
|
||||
playerDropItemEvent.setCancelled(true);
|
||||
player.refreshInventory();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.nexia.core.listeners.nexus;
|
||||
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import com.nexia.minigames.games.duels.DuelGameMode;
|
||||
import com.nexia.minigames.games.duels.util.player.DuelsPlayerData;
|
||||
import com.nexia.minigames.games.skywars.SkywarsGame;
|
||||
import com.nexia.minigames.games.skywars.SkywarsGameMode;
|
||||
import com.nexia.minigames.games.skywars.util.player.SkywarsPlayerData;
|
||||
import com.nexia.nexus.api.event.player.PlayerFoodLevelsChangeEvent;
|
||||
|
||||
public class PlayerHungerListener {
|
||||
public void registerListener(){
|
||||
PlayerFoodLevelsChangeEvent.BACKEND.register(playerFoodLevelsChangeEvent -> {
|
||||
NexiaPlayer player = new NexiaPlayer(playerFoodLevelsChangeEvent.getPlayer());
|
||||
|
||||
// SkyWars
|
||||
SkywarsPlayerData playerData = (SkywarsPlayerData) PlayerDataManager.getDataManager(NexiaCore.SKYWARS_DATA_MANAGER).get(player);
|
||||
if(SkywarsGame.isSkywarsPlayer(player) && playerData.gameMode.equals(SkywarsGameMode.PLAYING)) return;
|
||||
|
||||
// Duels
|
||||
DuelGameMode duelGameMode = ((DuelsPlayerData)PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player)).gameMode;
|
||||
PlayerGameMode gameMode = ((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player)).gameMode;
|
||||
if(gameMode.equals(PlayerGameMode.LOBBY) && (duelGameMode != null && !duelGameMode.hasSaturation)) return;
|
||||
|
||||
playerFoodLevelsChangeEvent.setFoodLevel(20);
|
||||
playerFoodLevelsChangeEvent.setCancelled(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package com.nexia.core.listeners.nexus;
|
||||
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.base.player.PlayerData;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.games.util.LobbyUtil;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import com.nexia.core.utilities.ranks.NexiaRank;
|
||||
import com.nexia.core.utilities.time.ServerTime;
|
||||
import com.nexia.discord.NexiaDiscord;
|
||||
import com.nexia.nexus.api.event.player.PlayerJoinEvent;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
import net.kyori.adventure.text.event.HoverEvent;
|
||||
import net.minecraft.stats.Stats;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import static com.nexia.discord.NexiaDiscord.jda;
|
||||
|
||||
public class PlayerJoinListener {
|
||||
public void registerListener() {
|
||||
PlayerJoinEvent.BACKEND.register(playerJoinEvent -> {
|
||||
|
||||
NexiaPlayer player = new NexiaPlayer(playerJoinEvent.getPlayer());
|
||||
if(((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player)).clientType.equals(CorePlayerData.ClientType.VIAFABRICPLUS)) return;
|
||||
|
||||
//setJoinMessage(player, playerJoinEvent);
|
||||
|
||||
if (!player.getTags().contains("bot"))
|
||||
CompletableFuture.runAsync(() -> PlayerDataManager.dataManagerMap.forEach((resourceLocation, playerDataManager) -> playerDataManager.addPlayerData(player)));
|
||||
|
||||
LobbyUtil.returnToLobby(player, true);
|
||||
checkBooster(player);
|
||||
|
||||
ServerTime.scheduler.schedule(() -> {
|
||||
sendJoinMessage(player);
|
||||
}, 10);
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private static void setJoinMessage(NexiaPlayer player, PlayerJoinEvent playerJoinEvent) {
|
||||
if(player.unwrap().getStats().getValue(Stats.CUSTOM.get(Stats.LEAVE_GAME)) < 1) {
|
||||
playerJoinEvent.setJoinMessage(
|
||||
net.kyori.adventure.text.Component.text("[").color(ChatFormat.lineColor)
|
||||
.append(net.kyori.adventure.text.Component.text("!").color(ChatFormat.goldColor)
|
||||
.append(net.kyori.adventure.text.Component.text("] ").color(ChatFormat.lineColor))
|
||||
.append(net.kyori.adventure.text.Component.text(player.getRawName()).color(ChatFormat.goldColor)))
|
||||
);
|
||||
} else {
|
||||
playerJoinEvent.setJoinMessage(
|
||||
net.kyori.adventure.text.Component.text("[").color(ChatFormat.lineColor)
|
||||
.append(net.kyori.adventure.text.Component.text("+").color(ChatFormat.greenColor))
|
||||
.append(net.kyori.adventure.text.Component.text("] ").color(ChatFormat.lineColor))
|
||||
.append(net.kyori.adventure.text.Component.text(player.getRawName()).color(ChatFormat.greenColor))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static void sendJoinMessage(NexiaPlayer player){
|
||||
player.sendMessage(ChatFormat.separatorLine("Welcome"));
|
||||
player.sendMessage(
|
||||
Component.text(" » ", ChatFormat.brandColor2)
|
||||
.append(Component.text("Welcome ", ChatFormat.normalColor))
|
||||
.append(Component.text(player.getRawName(), ChatFormat.brandColor2))
|
||||
.append(Component.text(" to ", ChatFormat.normalColor))
|
||||
.append(Component.text("Nexia", ChatFormat.brandColor2))
|
||||
.append(Component.text("!", ChatFormat.normalColor))
|
||||
);
|
||||
player.sendMessage(
|
||||
Component.text(" » ", ChatFormat.brandColor2)
|
||||
.append(Component.text("Players online: ", ChatFormat.normalColor))
|
||||
.append(Component.text(ServerTime.minecraftServer.getPlayerCount(), ChatFormat.brandColor2))
|
||||
.append(Component.text("/").color(ChatFormat.lineColor))
|
||||
.append(Component.text(ServerTime.nexusServer.getMaxPlayerCount(), ChatFormat.brandColor2))
|
||||
);
|
||||
player.sendMessage(
|
||||
Component.text(" » ", ChatFormat.brandColor2)
|
||||
.append(Component.text("Read the rules: ", ChatFormat.normalColor))
|
||||
.append(Component.text("/rules", ChatFormat.brandColor2)
|
||||
.hoverEvent(HoverEvent.showText(Component.text("Click me", ChatFormat.Minecraft.green))))
|
||||
.clickEvent(ClickEvent.suggestCommand("/rules"))
|
||||
);
|
||||
player.sendMessage(
|
||||
Component.text(" » ", ChatFormat.brandColor2)
|
||||
.append(Component.text("Join our discord: ", ChatFormat.normalColor))
|
||||
.append(Component.text(NexiaDiscord.config.discordLink)
|
||||
.color(ChatFormat.brandColor2)
|
||||
.hoverEvent(HoverEvent.showText(Component.text("Click me", ChatFormat.Minecraft.green)))
|
||||
.clickEvent(ClickEvent.openUrl(NexiaDiscord.config.discordLink))
|
||||
)
|
||||
);
|
||||
player.sendMessage(ChatFormat.separatorLine(null));
|
||||
}
|
||||
|
||||
private static void checkBooster(NexiaPlayer player) {
|
||||
PlayerData playerData = PlayerDataManager.getDataManager(NexiaCore.DISCORD_DATA_MANAGER).get(player.getUUID());
|
||||
if(!playerData.savedData.get(Boolean.class, "isLinked")) { return; }
|
||||
Member discordUser = null;
|
||||
|
||||
try {
|
||||
discordUser = Objects.requireNonNull(jda.getGuildById(NexiaDiscord.config.guildID)).retrieveMemberById(playerData.savedData.get(Long.class, "discordID")).complete(true);
|
||||
} catch (Exception ignored) { }
|
||||
|
||||
if(discordUser == null) {
|
||||
if(player.hasPrefix(NexiaRank.SUPPORTER)) {
|
||||
if(player.hasPermission("nexia.rank")) {
|
||||
NexiaRank.removePrefix(NexiaRank.SUPPORTER, player);
|
||||
return;
|
||||
}
|
||||
NexiaRank.setRank(NexiaRank.DEFAULT, player);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Role supporterRole = jda.getRoleById("1107264322951979110");
|
||||
boolean hasRole = discordUser.getRoles().contains(supporterRole);
|
||||
boolean hasSupporterPrefix = player.hasPrefix(NexiaRank.SUPPORTER);
|
||||
|
||||
if(hasRole && !hasSupporterPrefix) {
|
||||
if(player.hasPermission("nexia.rank")) {
|
||||
NexiaRank.addPrefix(NexiaRank.SUPPORTER, player, false);
|
||||
return;
|
||||
}
|
||||
NexiaRank.setRank(NexiaRank.SUPPORTER, player);
|
||||
} else if(!hasRole && hasSupporterPrefix) {
|
||||
if(player.hasPermission("nexia.rank")) {
|
||||
NexiaRank.removePrefix(NexiaRank.SUPPORTER, player);
|
||||
return;
|
||||
}
|
||||
NexiaRank.setRank(NexiaRank.DEFAULT, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.nexia.core.listeners.nexus;
|
||||
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.utilities.chat.ChatFormat;
|
||||
import com.nexia.nexus.api.event.player.PlayerDisconnectEvent;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class PlayerLeaveListener {
|
||||
public void registerListener() {
|
||||
PlayerDisconnectEvent.BACKEND.register(playerDisconnectEvent -> {
|
||||
NexiaPlayer player = new NexiaPlayer(playerDisconnectEvent.getPlayer());
|
||||
player.leaveAllGames();
|
||||
|
||||
//setLeaveMessage(player, playerDisconnectEvent);
|
||||
|
||||
if (!player.getTags().contains("bot"))
|
||||
CompletableFuture.runAsync(() -> PlayerDataManager.dataManagerMap.forEach((resourceLocation, playerDataManager) -> playerDataManager.removePlayerData(player)));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void setLeaveMessage(NexiaPlayer player, PlayerDisconnectEvent playerDisconnectEvent){
|
||||
playerDisconnectEvent.setLeaveMessage(
|
||||
Component.text("[").color(ChatFormat.lineColor)
|
||||
.append(Component.text("-", ChatFormat.failColor))
|
||||
.append(Component.text("] ").color(ChatFormat.lineColor))
|
||||
.append(Component.text(player.getRawName(), ChatFormat.failColor))
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.nexia.core.listeners.nexus;
|
||||
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.games.util.LobbyUtil;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import com.nexia.core.utilities.player.PlayerUtil;
|
||||
import com.nexia.core.utilities.world.WorldUtil;
|
||||
import com.nexia.ffa.FfaUtil;
|
||||
import com.nexia.ffa.base.BaseFfaUtil;
|
||||
import com.nexia.minigames.games.bedwars.players.BwPlayerEvents;
|
||||
import com.nexia.minigames.games.duels.DuelsGame;
|
||||
import com.nexia.minigames.games.duels.team.TeamDuelsGame;
|
||||
import com.nexia.minigames.games.duels.util.player.DuelsPlayerData;
|
||||
import com.nexia.minigames.games.skywars.SkywarsGame;
|
||||
import com.nexia.minigames.games.skywars.SkywarsGameMode;
|
||||
import com.nexia.minigames.games.skywars.util.player.SkywarsPlayerData;
|
||||
import com.nexia.nexus.api.event.player.PlayerRespawnEvent;
|
||||
import com.nexia.nexus.api.world.types.Minecraft;
|
||||
import com.nexia.nexus.api.world.util.Location;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class PlayerRespawnListener {
|
||||
public void registerListener() {
|
||||
PlayerRespawnEvent.BACKEND.register((respawnEvent) -> {
|
||||
NexiaPlayer player = new NexiaPlayer(respawnEvent.getPlayer());
|
||||
|
||||
DuelsPlayerData duelsData = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player);
|
||||
CorePlayerData data = (CorePlayerData) PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player);
|
||||
|
||||
switch (data.gameMode.id) {
|
||||
case "lobby":
|
||||
if (duelsData.gameOptions != null) break;
|
||||
LobbyUtil.returnToLobby(player, true);
|
||||
return;
|
||||
case "ffa":
|
||||
BaseFfaUtil ffaUtil = FfaUtil.getFfaUtil(data.ffaGameMode);
|
||||
if (ffaUtil != null) {
|
||||
respawnEvent.setRespawnMode(ffaUtil.getMinecraftGameMode());
|
||||
respawnEvent.setSpawnpoint(ffaUtil.getRespawnLocation());
|
||||
respawnEvent.runAfterwards(() -> {
|
||||
ffaUtil.respawn(player.refreshPlayer());
|
||||
player.setInvulnerabilityTime(0);
|
||||
});
|
||||
}
|
||||
return;
|
||||
case "skywars":
|
||||
Location respawn = new Location(0,100, 0, WorldUtil.getWorld(SkywarsGame.world));
|
||||
boolean isPlaying = ((SkywarsPlayerData)PlayerDataManager.getDataManager(NexiaCore.SKYWARS_DATA_MANAGER).get(player)).gameMode == SkywarsGameMode.PLAYING;
|
||||
ServerPlayer serverPlayer = PlayerUtil.getPlayerAttacker(player.unwrap());
|
||||
respawnEvent.setRespawnMode(Minecraft.GameMode.SPECTATOR);
|
||||
|
||||
if(serverPlayer != null && !serverPlayer.equals(player.unwrap()) && isPlaying) {
|
||||
respawn.setX(serverPlayer.getX());
|
||||
respawn.setY(serverPlayer.getY());
|
||||
respawn.setZ(serverPlayer.getZ());
|
||||
}
|
||||
|
||||
respawnEvent.setSpawnpoint(respawn);
|
||||
return;
|
||||
case "bedwars":
|
||||
BwPlayerEvents.respawned(player);
|
||||
respawnEvent.setRespawnMode(Minecraft.GameMode.SPECTATOR);
|
||||
return;
|
||||
case "oitc":
|
||||
respawnEvent.setRespawnMode(Minecraft.GameMode.SPECTATOR);
|
||||
return;
|
||||
}
|
||||
|
||||
if(duelsData.gameOptions == null) return;
|
||||
|
||||
DuelsGame duelsGame = duelsData.gameOptions.duelsGame;
|
||||
TeamDuelsGame teamDuelsGame = duelsData.gameOptions.teamDuelsGame;
|
||||
|
||||
if(duelsGame != null && duelsGame.isEnding && duelsGame.winner != null) {
|
||||
player.getInventory().clear();
|
||||
LobbyUtil.giveItems(player);
|
||||
|
||||
Location respawn = new Location(0,80, 0, WorldUtil.getWorld(duelsGame.level));
|
||||
|
||||
if(duelsGame.winner != null) {
|
||||
respawn = duelsGame.winner.getLocation();
|
||||
}
|
||||
|
||||
respawnEvent.setRespawnMode(Minecraft.GameMode.SPECTATOR);
|
||||
respawnEvent.setSpawnpoint(respawn);
|
||||
} else if(teamDuelsGame != null && duelsData.duelOptions.duelsTeam != null) {
|
||||
player.getInventory().clear();
|
||||
LobbyUtil.giveItems(player);
|
||||
respawnEvent.setRespawnMode(Minecraft.GameMode.SPECTATOR);
|
||||
|
||||
Location respawn = new Location(0,80, 0, WorldUtil.getWorld(teamDuelsGame.level));
|
||||
|
||||
NexiaPlayer player1 = null;
|
||||
if(duelsData.duelOptions.duelsTeam.alive.isEmpty()) {
|
||||
if(teamDuelsGame.team1 == duelsData.duelOptions.duelsTeam && !teamDuelsGame.team2.alive.isEmpty()) {
|
||||
player1 = teamDuelsGame.team2.alive.get(new Random().nextInt(teamDuelsGame.team2.alive.size()));
|
||||
} else if(teamDuelsGame.team2 == duelsData.duelOptions.duelsTeam && !teamDuelsGame.team1.alive.isEmpty()){
|
||||
player1 = teamDuelsGame.team1.alive.get(new Random().nextInt(teamDuelsGame.team1.alive.size()));
|
||||
}
|
||||
} else {
|
||||
player1 = duelsData.duelOptions.duelsTeam.alive.get(new Random().nextInt(duelsData.duelOptions.duelsTeam.alive.size()));
|
||||
}
|
||||
|
||||
if(player1 != null) {
|
||||
respawn = player1.getLocation();
|
||||
}
|
||||
|
||||
respawnEvent.setSpawnpoint(respawn);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.nexia.core.listeners.nexus;
|
||||
|
||||
import com.nexia.nexus.api.event.player.PlayerSwapHandItemsEvent;
|
||||
import com.nexia.core.games.util.LobbyUtil;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
|
||||
public class PlayerSwapHandItemsListener {
|
||||
public void registerListener(){
|
||||
PlayerSwapHandItemsEvent.BACKEND.register(playerSwapHandItemsEvent -> {
|
||||
NexiaPlayer player = new NexiaPlayer(playerSwapHandItemsEvent.getPlayer());
|
||||
|
||||
if(LobbyUtil.isLobbyWorld(player.getWorld())) {
|
||||
playerSwapHandItemsEvent.setCancelled(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.nexia.core.listeners.nexus;
|
||||
|
||||
import com.nexia.base.player.PlayerDataManager;
|
||||
import com.nexia.core.NexiaCore;
|
||||
import com.nexia.core.utilities.player.CorePlayerData;
|
||||
import com.nexia.nexus.api.event.player.PlayerUseItemEvent;
|
||||
import com.nexia.nexus.api.world.item.ItemStack;
|
||||
import com.nexia.core.games.util.PlayerGameMode;
|
||||
import com.nexia.base.player.NexiaPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
public class PlayerUseItemListener {
|
||||
public void registerListener() {
|
||||
PlayerUseItemEvent.BACKEND.register(playerUseItemEvent -> {
|
||||
|
||||
NexiaPlayer player = new NexiaPlayer(playerUseItemEvent.getPlayer());
|
||||
|
||||
ItemStack itemStack = playerUseItemEvent.getItemStack();
|
||||
|
||||
Component name = itemStack.getDisplayName();
|
||||
|
||||
PlayerGameMode gameMode = ((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player)).gameMode;
|
||||
String sName = name.toString().toLowerCase();
|
||||
|
||||
if(gameMode == PlayerGameMode.LOBBY) {
|
||||
if(sName.contains("gamemode selector")){
|
||||
//PlayGUI.openMainGUI(minecraftPlayer);
|
||||
player.runCommand("/play", 0, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if(sName.contains("prefix selector")){
|
||||
//PrefixGUI.openRankGUI(minecraftPlayer);
|
||||
player.runCommand("/prefix", 0, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if(sName.contains("duel sword") && !sName.contains("custom duel sword")) {
|
||||
//QueueGUI.openQueueGUI(minecraftPlayer);
|
||||
player.runCommand("/queue", 0, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if(sName.contains("team axe")) {
|
||||
player.runCommand("/party list");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Loaded 100 of 311 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user