Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79a3b70d8d | ||
|
|
cf69425153 | ||
|
|
e2fe770e6f | ||
|
|
7e06088c1a | ||
|
|
f9d1c2d4e0 | ||
|
|
f883899cfe | ||
|
|
de386fb4d8 | ||
|
|
660f9ffa0d | ||
|
|
e05d42371f | ||
|
|
dca0515104 | ||
|
|
4abf971cf6 | ||
|
|
875a6fc827 | ||
|
|
3cb4abdbf7 | ||
|
|
4caf0afb38 | ||
|
|
054a73416b | ||
|
|
b59da5992f | ||
|
|
46251f5ffa | ||
|
|
98bef4e0ab | ||
|
|
f1c8649f9a | ||
|
|
aad698af84 | ||
|
|
ad7ecbaefe | ||
|
|
81750e191d | ||
|
|
703146bc18 | ||
|
|
2541483ebc | ||
|
|
0a601dbc28 | ||
|
|
f55802c176 | ||
|
|
a0922cb467 | ||
|
|
fb9705e4f0 | ||
|
|
9b665136d0 | ||
|
|
efac79fd38 | ||
|
|
1cff55f355 | ||
|
|
f4fb78c7f5 | ||
|
|
56086b0878 | ||
|
|
51fa25dd03 | ||
|
|
5b0fdb6801 | ||
|
|
cb69ab73a7 | ||
|
|
5a6b6eb81b | ||
|
|
75774dbbb0 | ||
|
|
fe0fd17d37 | ||
|
|
5e702f80a6 | ||
|
|
0165175a2e | ||
|
|
821c3e689e | ||
|
|
4644268214 | ||
|
|
c81f5892eb | ||
|
|
88854592ce | ||
|
|
8efc2e6539 | ||
|
|
b1cd1303d1 | ||
|
|
c98f9eda7e | ||
|
|
682942b965 | ||
|
|
7e817c3330 | ||
|
|
5302bcb132 | ||
|
|
bcac63dcaa | ||
|
|
37906c0fc4 | ||
|
|
6879f10de6 | ||
|
|
7155ef5833 | ||
|
|
e2f775c952 | ||
|
|
c5dad7476d | ||
|
|
4dfb9bea38 | ||
|
|
7436d5064e | ||
|
|
621c1289b3 | ||
|
|
093e282e13 | ||
|
|
2958c2526c | ||
|
|
d21ee98624 | ||
|
|
dd90fa21c7 | ||
|
|
34ed6175e5 | ||
|
|
0818b3c262 | ||
|
|
04541ed5a6 | ||
|
|
f17f1fc8c8 | ||
|
|
9defab65d1 | ||
|
|
a225d1b2d3 | ||
|
|
bcab33c12c | ||
|
|
3cb83465d1 | ||
|
|
32d16a7eaa | ||
|
|
3827266eb3 | ||
|
|
c3dbfdd699 | ||
|
|
f19ebab0e1 | ||
|
|
f8f95a44f0 | ||
|
|
0a74d02fc9 | ||
|
|
46a662e1a7 | ||
|
|
149d1f84e8 | ||
|
|
c4e76af5f4 | ||
|
|
c1c26360e3 | ||
|
|
65c894cfe9 | ||
|
|
7dcec2b3b4 | ||
|
|
09ce3b6373 | ||
|
|
de22a5cd25 | ||
|
|
d2c2bfbab2 | ||
|
|
528ba32a93 | ||
|
|
f37fbb1ae8 | ||
|
|
f1f8b625a8 | ||
|
|
e933050436 | ||
|
|
59d4c7b96d | ||
|
|
0c7f4bb8f7 | ||
|
|
3c9b21d01f | ||
|
|
aeea455560 | ||
|
|
129d27351a | ||
|
|
310ce9a662 | ||
|
|
e04c654cde | ||
|
|
b1674e5cb7 | ||
|
|
89c6a33b90 | ||
|
|
88c91ce3fc | ||
|
|
b70f5a73ce | ||
|
|
b6fc9ddd93 | ||
|
|
cbb3212082 | ||
|
|
04d5a3b437 | ||
|
|
282425f3cf | ||
|
|
15a08097ae | ||
|
|
035a645de0 | ||
|
|
59c146f59a | ||
|
|
d313f2caad | ||
|
|
8350267b10 | ||
|
|
e98196af40 | ||
|
|
3879772103 | ||
|
|
48233c3327 | ||
|
|
664ab18f00 | ||
|
|
07bf1871ab | ||
|
|
5921be432c | ||
|
|
60b16fc4c7 | ||
|
|
746b630d01 | ||
|
|
0b362088f4 | ||
|
|
014277fb2f | ||
|
|
f7ff984c34 | ||
|
|
d4b2060766 | ||
|
|
0e73b50d6f | ||
|
|
136ec31f38 | ||
|
|
ad000ab051 | ||
|
|
af67f1dd6a | ||
|
|
8dee2ad3b8 | ||
|
|
c860fce299 | ||
|
|
0cb84927a3 | ||
|
|
2ed60eba02 | ||
|
|
91a1494634 | ||
|
|
5b8c3e7f70 | ||
|
|
c1ff4fc3d3 | ||
|
|
691325c8f0 | ||
|
|
3da19a7ff0 | ||
|
|
f677af566f | ||
|
|
58eaf31879 | ||
|
|
6708b21016 | ||
|
|
ed4287ace7 | ||
|
|
03f05d3a4e | ||
|
|
c8bde17994 | ||
|
|
449145ba1f | ||
|
|
85c5f53d29 | ||
|
|
5162ce3dbd | ||
|
|
efe1e48bd4 | ||
|
|
1710c07623 | ||
|
|
6f9ed5d10f | ||
|
|
f0ec54af49 | ||
|
|
e9e1885f2e | ||
|
|
f8e2d8d6b7 | ||
|
|
2c0b592b19 | ||
|
|
46e230e625 | ||
|
|
fe24668c6a | ||
|
|
23efd5fec2 | ||
|
|
e54235a65e | ||
|
|
5ec3ed6092 | ||
|
|
1652c9bfc0 | ||
|
|
a97db0ede9 | ||
|
|
36e42eefd0 | ||
|
|
5b8eef92b8 | ||
|
|
d73dc6d719 | ||
|
|
74d8a4f0e7 | ||
|
|
613406aab4 | ||
|
|
66fd84ba2f | ||
|
|
53abb6c4ad | ||
|
|
923369e28c | ||
|
|
bc551da903 | ||
|
|
bffe5e76f2 | ||
|
|
8722322cd8 | ||
|
|
0fa92d4836 | ||
|
|
e52875bd0b | ||
|
|
dbad328d0d | ||
|
|
5407315799 | ||
|
|
b769469f5b | ||
|
|
3a9b1b1525 | ||
|
|
ff5f933879 | ||
|
|
0492fafe30 | ||
|
|
36d95ad090 | ||
|
|
c1ec708050 | ||
|
|
f4a3e8a936 | ||
|
|
6c5380ba0b | ||
|
|
868089b44f | ||
|
|
9905d22ddf | ||
|
|
4eaa376e2c | ||
|
|
37ae70f35d | ||
|
|
1a69250d9b | ||
|
|
b2d2d0815b | ||
|
|
47cd96a3af | ||
|
|
0a735e0146 | ||
|
|
60590acfe3 | ||
|
|
6030bea13e | ||
|
|
20f89ea2ae | ||
|
|
4c351fb0e3 | ||
|
|
5e7829c3fe | ||
|
|
37e66dae7d | ||
|
|
662ae2bc84 | ||
|
|
fa60582afe | ||
|
|
17c1647163 | ||
|
|
1fcda13469 | ||
|
|
570b7f7b77 | ||
|
|
aca0d843f6 | ||
|
|
1172ebd419 | ||
|
|
a09ccc5b45 | ||
|
|
e6bdf8abb5 | ||
|
|
df2ae6a666 | ||
|
|
e4481f9337 | ||
|
|
2169aa218e | ||
|
|
523e45188d | ||
|
|
d95c6af1be | ||
|
|
0d860bfca7 | ||
|
|
6f6125fe00 | ||
|
|
0332929531 | ||
|
|
637665f52d | ||
|
|
db3838ccfe | ||
|
|
789405d116 | ||
|
|
d37f015f0c | ||
|
|
239eda3f96 | ||
|
|
0715cbe216 | ||
|
|
738b24bfc1 | ||
|
|
b835ee39d5 | ||
|
|
4a7552e6be | ||
|
|
c6c0fc9d74 | ||
|
|
f43a4eaad8 | ||
|
|
abfa5cb6a5 | ||
|
|
05f7d68705 | ||
|
|
9adac4f239 | ||
|
|
c5355adb4b | ||
|
|
fb37342b3c | ||
|
|
1fd94a3655 | ||
|
|
c413cf4123 | ||
|
|
87162acf11 | ||
|
|
2c14acc28c | ||
|
|
26477406f1 | ||
|
|
121b34ecb9 | ||
|
|
3ebaaf9c8b | ||
|
|
4c9812db04 | ||
|
|
e792dd6f98 | ||
|
|
d410e1f84e | ||
|
|
d07f95952d | ||
|
|
cb9ab3a7b2 | ||
|
|
1c3cf02ebd | ||
|
|
fc0f7acab5 | ||
|
|
20db92541b | ||
|
|
5fca3b3c3d | ||
|
|
c633a2d070 | ||
|
|
effbd62e68 | ||
|
|
056eaa6587 | ||
|
|
cb2c0870ec | ||
|
|
179c324c80 | ||
|
|
96d15d6dbf | ||
|
|
120d2e223d | ||
|
|
70ea6bad6e | ||
|
|
e59d61e1cf | ||
|
|
bbed280f62 | ||
|
|
f165ae3d95 | ||
|
|
124898ec91 | ||
|
|
ba32d24363 | ||
|
|
0bba822295 | ||
|
|
7538af2686 | ||
|
|
48922118b1 | ||
|
|
14fe2d0e79 | ||
|
|
11a1ac6742 | ||
|
|
c5bfdcb0e6 | ||
|
|
93dae282b2 | ||
|
|
3468e3d47e | ||
|
|
b7ad0257b7 | ||
|
|
070f6e005f | ||
|
|
cc3f4d4d44 | ||
|
|
21e65be110 | ||
|
|
61494fd76e | ||
|
|
556b638d04 | ||
|
|
825b3a3f36 | ||
|
|
afe042ef4d | ||
|
|
4044e2b122 | ||
|
|
aa4137822f | ||
|
|
f37acd3de6 | ||
|
|
b0e4cf148b | ||
|
|
248ffd0ba8 | ||
|
|
3272759f25 | ||
|
|
456a16591b | ||
|
|
79f6635b8a | ||
|
|
1f362bef59 | ||
|
|
63209d1174 | ||
|
|
f546700189 | ||
|
|
35e0db36d3 | ||
|
|
ab7751e046 | ||
|
|
a9cd23c6ef | ||
|
|
8ca01b37a4 | ||
|
|
aa8997aeca | ||
|
|
b757fcc88b | ||
|
|
7593e1a01c | ||
|
|
af3eb85962 | ||
|
|
aabb0b2345 | ||
|
|
6d25513739 | ||
|
|
96b61743b9 | ||
|
|
ff7209a58b | ||
|
|
fe4f0cfc49 | ||
|
|
9cf1e02506 | ||
|
|
b0f8852198 | ||
|
|
cce9c39e01 | ||
|
|
11c95861f9 | ||
|
|
75bb0adbe6 | ||
|
|
32ec74aed7 | ||
|
|
b152cdc4ec | ||
|
|
d019e43a81 | ||
|
|
8c778ed861 | ||
|
|
1b842204e9 | ||
|
|
8aa4c25186 | ||
|
|
026361ae0b | ||
|
|
426a709e43 | ||
|
|
903a831248 | ||
|
|
1792bcb18a | ||
|
|
23ab79c999 | ||
|
|
a29afe8cc1 | ||
|
|
029f867a41 | ||
|
|
ce35798f67 | ||
|
|
0f989fc1b4 | ||
|
|
4871752f49 | ||
|
|
c4b31cf085 | ||
|
|
6e30f98322 | ||
|
|
4b320ab733 | ||
|
|
f516999087 | ||
|
|
2b854f0d72 | ||
|
|
36d25c08c6 | ||
|
|
3e899a70c4 | ||
|
|
d6c2504bbf | ||
|
|
f2d2f47394 | ||
|
|
aefebf32c2 | ||
|
|
7102f6204c | ||
|
|
d542ba78ff | ||
|
|
e7ef6af012 | ||
|
|
1ffa4b48b8 | ||
|
|
d4c49a7539 | ||
|
|
2e2be7092d | ||
|
|
ec4c53da77 | ||
|
|
024a51549d | ||
|
|
8c345cb64b | ||
|
|
461f3e1faf | ||
|
|
6fd7190ff2 | ||
|
|
5180673878 | ||
|
|
c57dd20f24 | ||
|
|
71df9c0011 | ||
|
|
b27f18788c | ||
|
|
18365bbe42 | ||
|
|
82451595cb | ||
|
|
c516eb2174 | ||
|
|
7199b8e70f | ||
|
|
fc4c67ff29 | ||
|
|
d9bb321f83 | ||
|
|
7692e30721 | ||
|
|
5f88bef5ac | ||
|
|
5b0bfd50d3 | ||
|
|
5c0be800ae | ||
|
|
ac505f0064 | ||
|
|
2aee42cbf2 | ||
|
|
5c8b6d3f95 | ||
|
|
eab7b5c47f | ||
|
|
36eba9c9dd | ||
|
|
3b8b67da84 | ||
|
|
d9b09ab7f1 | ||
|
|
50e62bd0e7 | ||
|
|
abfe3a2eb9 | ||
|
|
e94af1d77e | ||
|
|
1dbd25d15e | ||
|
|
c3675a10a2 | ||
|
|
ef2783f30a | ||
|
|
2c2b475513 | ||
|
|
0ebb4e0ffa | ||
|
|
47fb9bd30d | ||
|
|
5ffade9787 | ||
|
|
ca92464cca | ||
|
|
453740b56a | ||
|
|
397a71a602 | ||
|
|
44c4e5816f | ||
|
|
41268ca443 | ||
|
|
c7ed49388c | ||
|
|
874e429779 | ||
|
|
9c5eee90da | ||
|
|
4f088e5bf0 | ||
|
|
c2f96c9587 | ||
|
|
c181a86fd1 | ||
|
|
e2ffab5ee8 | ||
|
|
8a3f066023 | ||
|
|
c53ed56b3a | ||
|
|
6144ca82ac | ||
|
|
d091cb578f | ||
|
|
b2fe4c9c71 | ||
|
|
ea47e93323 | ||
|
|
10100bd194 | ||
|
|
91687dc204 | ||
|
|
e091a59063 | ||
|
|
ee7dc27283 | ||
|
|
54c3cdad77 | ||
|
|
ff37cc7935 | ||
|
|
b6e2bca5bc | ||
|
|
1f85a53117 | ||
|
|
bd4726f887 | ||
|
|
9ea2312751 | ||
|
|
cc988c0b5a | ||
|
|
af93530dbe | ||
|
|
43d8cf8cba | ||
|
|
090a00d6d8 | ||
|
|
a233be1df8 | ||
|
|
f9339e144e | ||
|
|
1f1e6eedf6 | ||
|
|
96e7c43f56 | ||
|
|
f8e129f33e | ||
|
|
144c31645c | ||
|
|
d24157e693 | ||
|
|
d5dddba8bc | ||
|
|
72a392aca2 | ||
|
|
c6442e6669 | ||
|
|
0102dbb9bc | ||
|
|
3f7a9f9bc8 | ||
|
|
ae51d74afb | ||
|
|
e51a22032e | ||
|
|
84017bffc4 | ||
|
|
60731f9836 | ||
|
|
3ea7c9fc08 | ||
|
|
9804c69044 | ||
|
|
cd39387e7f | ||
|
|
b48e145508 | ||
|
|
405b210fb5 | ||
|
|
d4d7601125 | ||
|
|
fdd9064170 | ||
|
|
803c2055c3 | ||
|
|
344c6cf814 | ||
|
|
863f6cc13b | ||
|
|
3dd35dabec | ||
|
|
80aec378d8 | ||
|
|
6dbd731c92 | ||
|
|
aea129889c | ||
|
|
2757a001c0 | ||
|
|
693314c7f7 | ||
|
|
db35c908ba | ||
|
|
14ce7d1be2 | ||
|
|
015f192193 | ||
|
|
83b375b6e1 | ||
|
|
91696533cf | ||
|
|
0dc5781326 | ||
|
|
5ad21521be | ||
|
|
e0b91e9529 | ||
|
|
7e0ff24c57 | ||
|
|
be426e92df | ||
|
|
a6261b9071 | ||
|
|
f235e870a7 | ||
|
|
a26eb87603 | ||
|
|
7fb7d59856 | ||
|
|
01dfebe531 | ||
|
|
87e5770405 | ||
|
|
d3c4681c49 | ||
|
|
e43daa726a | ||
|
|
8e819f7a82 | ||
|
|
ee4259b88d | ||
|
|
8771173146 | ||
|
|
d28a31f255 | ||
|
|
b4bda6bfaf | ||
|
|
44e3f720de | ||
|
|
7f47e31686 | ||
|
|
b2e64498a8 | ||
|
|
e31fa306ab | ||
|
|
1123270a07 | ||
|
|
b850b5caf8 | ||
|
|
ba61919168 | ||
|
|
34efb6e40e | ||
|
|
3203a81710 | ||
|
|
d8dba47c0f | ||
|
|
a6cfe7d0c9 | ||
|
|
f19d2ee73d | ||
|
|
bd89bd9d2f | ||
|
|
66eb8fa553 | ||
|
|
dcdd0497d8 | ||
|
|
8ac5f8f6f2 | ||
|
|
45a4e59965 | ||
|
|
43ed630034 | ||
|
|
3189b1ac13 | ||
|
|
e94083045f | ||
|
|
acce59edd4 | ||
|
|
bb29883fe0 | ||
|
|
e7ff99ae96 | ||
|
|
b10cf6adbc | ||
|
|
2e8d14c995 | ||
|
|
89db0d9fee | ||
|
|
6c5319f355 | ||
|
|
8eeab682db | ||
|
|
2ae6f39a09 | ||
|
|
d2c52f7c1b | ||
|
|
3a332fd87d | ||
|
|
0f72811bfc | ||
|
|
95b88ea64b | ||
|
|
f76259df82 | ||
|
|
3a8e3e84b8 | ||
|
|
84bc322de7 | ||
|
|
129bbd8ea1 | ||
|
|
4dc6e27660 | ||
|
|
4cb29796c1 | ||
|
|
85693b91b3 | ||
|
|
1c29e85f19 | ||
|
|
e019890f1d | ||
|
|
fb90b1446f | ||
|
|
22ef224a81 | ||
|
|
c0f3171a33 | ||
|
|
67ece5c5d7 | ||
|
|
46cca2b950 | ||
|
|
6e56763a7f | ||
|
|
f147402d30 | ||
|
|
8e35db0f35 | ||
|
|
9b2eff0a71 | ||
|
|
104cdc023d | ||
|
|
deb283c44b | ||
|
|
324e90c68a | ||
|
|
c60502ffd8 | ||
|
|
26e59955ed | ||
|
|
4746e95249 | ||
|
|
9cafb07e4d | ||
|
|
b2b0fe65c6 | ||
|
|
06e6ce589b | ||
|
|
12fc1438c2 | ||
|
|
e5e1f71a2a | ||
|
|
2aaa14261b | ||
|
|
f006a9584c | ||
|
|
03cf9a668b | ||
|
|
db70e6f346 | ||
|
|
e0df194ff2 | ||
|
|
ab55137f59 | ||
|
|
bbb79526b2 | ||
|
|
cde9a403f7 | ||
|
|
43a9228304 | ||
|
|
c1b8d12d05 | ||
|
|
a25674e9a5 | ||
|
|
778ec404ff | ||
|
|
4ab38e5b89 | ||
|
|
8b842e3a0d | ||
|
|
e38d98da00 | ||
|
|
5c9ba2e22e | ||
|
|
e9ecb6d2a8 | ||
|
|
f5a554f4a4 | ||
|
|
53aadca45b | ||
|
|
6c3dd4234d | ||
|
|
5bd2125963 | ||
|
|
8765bbb192 | ||
|
|
53e8b780bc | ||
|
|
0e252e41b2 | ||
|
|
15a9c50ea4 | ||
|
|
d3acbdf382 | ||
|
|
4239bdc96d | ||
|
|
43a5bf1638 | ||
|
|
a8591e536a | ||
|
|
38dcdff0b6 | ||
|
|
65e48d17d4 | ||
|
|
c9b8e9f6a2 | ||
|
|
93d454c675 | ||
|
|
ca4bb7a53d | ||
|
|
c2054615db | ||
|
|
6db2df4e29 | ||
|
|
536132a250 | ||
|
|
7c3b1ad20f | ||
|
|
729f66afdf | ||
|
|
a7c2026414 | ||
|
|
9222b3d364 | ||
|
|
adcc41413d | ||
|
|
ec08d7d73a | ||
|
|
3d5ee7b571 | ||
|
|
32341393fe | ||
|
|
0fcd42fdd5 | ||
|
|
e28b236a52 | ||
|
|
96e0ffd293 | ||
|
|
0ddc011a3c | ||
|
|
d320356045 | ||
|
|
95bf6bc9b2 | ||
|
|
1c4c213ed7 | ||
|
|
c9eaec0ae8 | ||
|
|
fc0be7db09 | ||
|
|
dbbc31a4f4 | ||
|
|
0f3e893aaf | ||
|
|
aa668916e4 | ||
|
|
a426d2a42c | ||
|
|
5ff8b37ae8 | ||
|
|
2d28e8db6d | ||
|
|
463a356020 | ||
|
|
21d13cc72c | ||
|
|
9cf85caf3c | ||
|
|
2f1343f408 | ||
|
|
3cb6c4e46f | ||
|
|
7f9b850288 | ||
|
|
e8d4f2fd84 | ||
|
|
f3891aaaf9 | ||
|
|
ea75549a29 | ||
|
|
fbd8206038 | ||
|
|
522ac459db | ||
|
|
255dd2d41a | ||
|
|
cf1716ff37 | ||
|
|
a277e69e9c | ||
|
|
ec5bb32510 | ||
|
|
8ddb7d4b99 | ||
|
|
3258bff2d1 | ||
|
|
8d7d32a2d2 | ||
|
|
a907eb2348 | ||
|
|
32132b5b0a | ||
|
|
c0c7c3215e | ||
|
|
ddf0f41061 | ||
|
|
d3ecbcb18a | ||
|
|
b7f4262978 | ||
|
|
60e6f92c64 | ||
|
|
98af7966cd | ||
|
|
99d042d260 | ||
|
|
c9d6166fcb | ||
|
|
752ccec150 | ||
|
|
91ccb95672 | ||
|
|
4caff457d3 | ||
|
|
a1a6ee7107 | ||
|
|
af157b88bd | ||
|
|
ea4f4c088b | ||
|
|
6559ed5c1a | ||
|
|
deddcf8dd2 | ||
|
|
dfe536a2d2 | ||
|
|
5bfb348354 | ||
|
|
afcf93b7b1 | ||
|
|
e1843624bb | ||
|
|
0f4e7b5061 | ||
|
|
869ead63bc | ||
|
|
6a6de7802b | ||
|
|
b50302d9d0 | ||
|
|
c841d74aaf | ||
|
|
09cce39aff | ||
|
|
e5b76a571b | ||
|
|
7c58fa4be6 | ||
|
|
f150a41d72 | ||
|
|
bca1c2bdb3 | ||
|
|
47a8bcc442 | ||
|
|
83cad75916 | ||
|
|
6b5a12105e | ||
|
|
451b679323 | ||
|
|
66a8bfd5b1 | ||
|
|
2a2b2f6f64 | ||
|
|
73dea11de2 | ||
|
|
9998a6c930 | ||
|
|
5111d40aaf | ||
|
|
972ccaed7e | ||
|
|
f7d36bc1f3 | ||
|
|
8073945af0 | ||
|
|
91353d6b01 | ||
|
|
bfbcc8dcf8 | ||
|
|
8f65798141 | ||
|
|
fdddb17d2f | ||
|
|
520f9e3fcf | ||
|
|
a3d2a1b127 | ||
|
|
7ecf73165b | ||
|
|
e90a7ed075 | ||
|
|
aae521b727 | ||
|
|
643345b459 | ||
|
|
a62d9f5617 | ||
|
|
2f3f76c8cf | ||
|
|
a03aaa45b1 | ||
|
|
372155b5c3 | ||
|
|
159de771bf | ||
|
|
41d922cb27 | ||
|
|
6a4fac63e8 | ||
|
|
3daf8db113 | ||
|
|
9c62a35e07 | ||
|
|
931f438b14 | ||
|
|
3109612c1b | ||
|
|
e4d63ffbcc | ||
|
|
866a554d30 | ||
|
|
ab2811ed2d | ||
|
|
8cc7bcc849 | ||
|
|
547e89b85d | ||
|
|
477f1188df | ||
|
|
d9e4b27cd2 | ||
|
|
37f39eaf66 | ||
|
|
223d22e79f | ||
|
|
04214a96eb | ||
|
|
f40cb69f38 | ||
|
|
6c1489d434 | ||
|
|
6fe63838f5 | ||
|
|
d883c22d64 | ||
|
|
3bd1c869f1 | ||
|
|
e7273aaf6f | ||
|
|
6e02f80f6c | ||
|
|
01276dfc62 | ||
|
|
f516fd5e54 | ||
|
|
79612915a7 | ||
|
|
f04f9093bc | ||
|
|
9dac950faf | ||
|
|
f2a8ff3f64 | ||
|
|
b78317dd42 | ||
|
|
048dd25099 | ||
|
|
0900289437 | ||
|
|
d8dd86dfe8 | ||
|
|
9a569d7ed8 | ||
|
|
53132ce83a | ||
|
|
c3bdc33215 | ||
|
|
c6bf8ceb5c | ||
|
|
792d041078 | ||
|
|
cb965c9bf9 | ||
|
|
f33889b88f | ||
|
|
e747e3a3fa | ||
|
|
fd460337f4 | ||
|
|
38c9479385 | ||
|
|
da032cb04e | ||
|
|
37a80338f5 | ||
|
|
8a5f233e84 | ||
|
|
e3a9131929 | ||
|
|
bab98d5463 | ||
|
|
4333b39377 | ||
|
|
8bd427a6ab | ||
|
|
d3493a3361 | ||
|
|
51982cda28 | ||
|
|
a2e14bc76a | ||
|
|
c050d274f5 | ||
|
|
bdff22cbac | ||
|
|
7da10198e3 | ||
|
|
b11e2b3d11 | ||
|
|
c95b619974 | ||
|
|
e61b2e18c1 | ||
|
|
e9d64dbf03 | ||
|
|
3c8121d088 | ||
|
|
93ced5ca7a | ||
|
|
7580583fbf | ||
|
|
41c68664d7 | ||
|
|
c8393cdcec | ||
|
|
42d12e4fa8 | ||
|
|
bed9bd77a6 | ||
|
|
f3c2390fbb | ||
|
|
83a7ed58a5 | ||
|
|
ddc1f77825 | ||
|
|
88169236cb | ||
|
|
0cb36b3b8b | ||
|
|
ce169461a3 | ||
|
|
18ec3db1bb | ||
|
|
53fdff1d9b | ||
|
|
9a91336958 | ||
|
|
7bd69bebf4 | ||
|
|
57b6f04b79 | ||
|
|
c7442c2a9e | ||
|
|
df985013eb | ||
|
|
41f520845a | ||
|
|
dac09c64c8 | ||
|
|
a2defe5971 | ||
|
|
ba4e5d6ea9 | ||
|
|
25f12e9733 | ||
|
|
ca37dc0fc6 | ||
|
|
7d41835794 | ||
|
|
b37014463f | ||
|
|
2b94883e70 | ||
|
|
5c7468ffb5 | ||
|
|
343632cbf2 | ||
|
|
2a3ccec429 | ||
|
|
d6f12804ea | ||
|
|
f858c175f9 | ||
|
|
cdab004505 | ||
|
|
59bd11e742 | ||
|
|
2e6faff8c1 | ||
|
|
722cc2e38c | ||
|
|
669c0e9651 | ||
|
|
d2252c6142 | ||
|
|
eab4101d1c | ||
|
|
db31c35d8e | ||
|
|
125595e6b9 | ||
|
|
6d5d9934cc | ||
|
|
bd2a8daad3 | ||
|
|
c4b3c1d033 | ||
|
|
eb051bc194 | ||
|
|
1a12faf5ab | ||
|
|
73fe9cd62f | ||
|
|
7ab4a283fe | ||
|
|
46138c9abe | ||
|
|
841cc8e033 | ||
|
|
cb0844c64d | ||
|
|
6e8e59aee5 | ||
|
|
358eebf96b | ||
|
|
01892b609f | ||
|
|
096981bd27 | ||
|
|
0852fc0d65 | ||
|
|
40ceb3d0b8 | ||
|
|
b52a6bd6d6 | ||
|
|
992e53856d | ||
|
|
f776d15e03 | ||
|
|
438bc59fbc | ||
|
|
453f253e77 | ||
|
|
550df20f18 | ||
|
|
e8ee0a8c5b | ||
|
|
5fcd7ddf7a | ||
|
|
b11d416035 | ||
|
|
f7e216ba84 | ||
|
|
f6406b668c | ||
|
|
7cd4a1d411 | ||
|
|
bd558bb527 | ||
|
|
8d29f6971a | ||
|
|
300f69597f | ||
|
|
8e320b6dbe | ||
|
|
fa422bef32 | ||
|
|
e8cd1cc253 | ||
|
|
5e9ffe9e29 | ||
|
|
edebb0efc9 | ||
|
|
913d5d64ae | ||
|
|
6da8fabb1f | ||
|
|
ee022d7cd7 | ||
|
|
c126a0ac38 | ||
|
|
4a3dac0aa4 | ||
|
|
f4700ded12 | ||
|
|
8570921049 | ||
|
|
612b953b63 | ||
|
|
02777c370d | ||
|
|
7a8ab1df99 | ||
|
|
182c5f6a17 | ||
|
|
7c7673af20 | ||
|
|
9282fc25de | ||
|
|
f66e47c01f | ||
|
|
f00d73d60e | ||
|
|
c5b08781f7 | ||
|
|
4b80c4e4e6 | ||
|
|
7da3cc224b | ||
|
|
0659a5263a | ||
|
|
0f8614519f | ||
|
|
541f828db4 | ||
|
|
70aedb4a84 | ||
|
|
4f24f2631e | ||
|
|
ddb910e2ea | ||
|
|
b5c4eb3587 | ||
|
|
a0553bfa34 | ||
|
|
241f053b8a | ||
|
|
6174c9e486 | ||
|
|
d7629acb61 | ||
|
|
8169b6f650 | ||
|
|
7b174683ba | ||
|
|
88e7327af6 | ||
|
|
b7d8562ece | ||
|
|
439826ddc6 | ||
|
|
b94641f1b5 | ||
|
|
0ddf56f7f6 | ||
|
|
74e64d0641 | ||
|
|
858b0b2c1c | ||
|
|
54237c0038 | ||
|
|
0edb948a40 | ||
|
|
f85aeecde7 | ||
|
|
69a0f26a52 | ||
|
|
8bb28b5ef1 | ||
|
|
a6118c3aa4 | ||
|
|
59494233e3 | ||
|
|
d0ff1815aa | ||
|
|
9b7970475a | ||
|
|
88c0bdfffb | ||
|
|
b43bc4a57a | ||
|
|
bd8e1a35f6 | ||
|
|
722dabcf1a | ||
|
|
09207367c0 | ||
|
|
3336b73536 | ||
|
|
0d7e3ad2de | ||
|
|
95d1bd8ee0 | ||
|
|
6c97e04c7c | ||
|
|
24f72cb07f | ||
|
|
ef56a32f00 | ||
|
|
d8da89703b | ||
|
|
e47c563ced | ||
|
|
bd0917d34b | ||
|
|
8098211d01 | ||
|
|
83c95bbb8c | ||
|
|
4d4e1c6c26 | ||
|
|
3045dc0293 | ||
|
|
e649973318 | ||
|
|
2d147bb7e1 | ||
|
|
f57afb2944 | ||
|
|
95052546a5 | ||
|
|
768532cb8b | ||
|
|
6b7e1286f2 | ||
|
|
577cfd0954 | ||
|
|
06df4585c2 | ||
|
|
416006dbde | ||
|
|
5ff9f5c175 | ||
|
|
fa14184eb4 | ||
|
|
d29f66563b | ||
|
|
53957e7b26 | ||
|
|
2c81cb2f84 | ||
|
|
711fe7ad2f | ||
|
|
f6f94571ea | ||
|
|
985629c196 | ||
|
|
bb64079d17 | ||
|
|
c3363f0d70 | ||
|
|
937a5758f7 | ||
|
|
bb1826bdb1 | ||
|
|
1a781fc5b0 | ||
|
|
039d174477 | ||
|
|
929f9e99cd | ||
|
|
ae8bf63c86 | ||
|
|
3eb5c65a3d | ||
|
|
095f2aa67e | ||
|
|
0f10e89f7c | ||
|
|
3a2b453e3f | ||
|
|
c43a24d78f | ||
|
|
d43eb3bc34 | ||
|
|
3ca147e405 | ||
|
|
41fb8a0722 | ||
|
|
ff3fa759d1 | ||
|
|
cab42af53b | ||
|
|
d9d665ab14 | ||
|
|
fac6ebef40 | ||
|
|
a4fd29c30c | ||
|
|
59c7197229 | ||
|
|
e7c9703ced | ||
|
|
5a63115fb2 | ||
|
|
4597849466 | ||
|
|
a35aaf9659 | ||
|
|
bfb3f9e840 | ||
|
|
91e34601ec | ||
|
|
7481acba8c | ||
|
|
4d43ef5305 | ||
|
|
b1fb143fd4 | ||
|
|
d07e81288a | ||
|
|
c0d4ba5c6c | ||
|
|
8a11752253 | ||
|
|
1d24be8c34 | ||
|
|
d3f3489c7e | ||
|
|
3f16fef57e | ||
|
|
608d782321 | ||
|
|
5d6dad4c6d | ||
|
|
28c538e981 | ||
|
|
a35cb9277e | ||
|
|
e43ce420a3 | ||
|
|
501a7aa77a | ||
|
|
76f7ac8d8e | ||
|
|
518d5958c9 | ||
|
|
7e25de38da | ||
|
|
bf8ef39871 | ||
|
|
cd62af698b | ||
|
|
709ce9eb08 | ||
|
|
e24d7ccb10 | ||
|
|
98bbd900cb | ||
|
|
19b87b628a | ||
|
|
dc2652f87b | ||
|
|
99660920d7 | ||
|
|
ad1c10a3e9 | ||
|
|
5b685e71d3 | ||
|
|
5ddc4b9251 | ||
|
|
38587a1c61 | ||
|
|
eb23e28c16 | ||
|
|
4379c7e989 | ||
|
|
989ce82c5d | ||
|
|
f92e55e061 | ||
|
|
0fc3d21b90 | ||
|
|
26d3645f86 | ||
|
|
110aa2e56b | ||
|
|
05369b69b6 | ||
|
|
4a501a49db | ||
|
|
2a69d1c7c9 | ||
|
|
573204caad | ||
|
|
7a01168781 | ||
|
|
b5dfed9e01 | ||
|
|
29f804b9f0 | ||
|
|
504fceceeb | ||
|
|
9a852f4cbe | ||
|
|
fafd3aba6a | ||
|
|
d87a335e85 | ||
|
|
471b4496c9 | ||
|
|
32e39f5c7c | ||
|
|
bf48361b10 | ||
|
|
387431c9c7 | ||
|
|
9b69c07663 | ||
|
|
a1d59373ac | ||
|
|
81a727fe7f | ||
|
|
189fd15498 | ||
|
|
1a602f2f8a | ||
|
|
7986238936 | ||
|
|
a2fc9c94fd | ||
|
|
51f98c9eb7 | ||
|
|
418b8ff6a7 | ||
|
|
9cab51dac8 | ||
|
|
26ac987024 | ||
|
|
e44875532d | ||
|
|
956d1b4248 | ||
|
|
3aa8bbe947 | ||
|
|
f46b1cb138 | ||
|
|
5b5022b0b8 | ||
|
|
d93c7fa09d | ||
|
|
2c1d1ef0a3 | ||
|
|
bf97e41697 | ||
|
|
c0852d63fe | ||
|
|
acc39e11b1 | ||
|
|
b4880ae982 | ||
|
|
1a1acae588 | ||
|
|
1581390092 | ||
|
|
cd221ea19c | ||
|
|
abeab91be4 | ||
|
|
227f54d315 | ||
|
|
ac88367f6c | ||
|
|
f788f0e0d9 | ||
|
|
9a4bc70cdd | ||
|
|
ab46fd6244 | ||
|
|
6deafa660d | ||
|
|
0d2adc5707 | ||
|
|
b0ed119585 | ||
|
|
ff2462b084 | ||
|
|
894a42ea13 | ||
|
|
d827e01760 | ||
|
|
5e6de8b76d | ||
|
|
b298bedea0 | ||
|
|
fb5ae838d9 | ||
|
|
3bfcd69fd9 | ||
|
|
c66adf0119 | ||
|
|
2119b274fd | ||
|
|
22f45c45ee | ||
|
|
0dd9729b35 | ||
|
|
ff46c2cf54 | ||
|
|
1537fc879e | ||
|
|
f00352cde0 | ||
|
|
fdc74b1c0d | ||
|
|
83a3c61b66 | ||
|
|
4422d536b7 | ||
|
|
1f40908c04 | ||
|
|
b707289284 | ||
|
|
43486bda63 | ||
|
|
7086a1d0d2 | ||
|
|
4dd13bd925 | ||
|
|
4ce97bca0e | ||
|
|
ec9712f30e | ||
|
|
0162910964 | ||
|
|
c252a79c1a | ||
|
|
89739d4efe | ||
|
|
9c7fb6a1d3 | ||
|
|
2df3290d38 | ||
|
|
4805df2f03 | ||
|
|
5bc670db8b | ||
|
|
ffda88f193 | ||
|
|
96a69aa2ef | ||
|
|
2d90fddbee | ||
|
|
bbd1a0ef10 | ||
|
|
6b16ed79b3 | ||
|
|
73b9a7fb0d | ||
|
|
4a0ae833f0 | ||
|
|
5f32ebe2de | ||
|
|
723928d239 | ||
|
|
d024ed7b81 | ||
|
|
ec4143d3dc | ||
|
|
071fdaabd3 | ||
|
|
23766f20dd | ||
|
|
31739c647b | ||
|
|
faa016180a | ||
|
|
e26238e814 | ||
|
|
f8ed1a3e3e | ||
|
|
d47c255168 | ||
|
|
d1e7796f81 | ||
|
|
1095064c5e | ||
|
|
a15c9d289b | ||
|
|
c0f95bebf0 | ||
|
|
0a54779fc4 | ||
|
|
ac525958c5 | ||
|
|
458cf64501 | ||
|
|
4acef77623 | ||
|
|
d38d7fc492 | ||
|
|
2510c3eeb5 | ||
|
|
326d53fd09 | ||
|
|
75b3082b12 | ||
|
|
1f214aadee | ||
|
|
174b3fad15 | ||
|
|
07531f67d4 | ||
|
|
291c45064a | ||
|
|
6f56cb29a5 | ||
|
|
977c7d2f29 | ||
|
|
ecb87efe8d | ||
|
|
a57c162cd8 | ||
|
|
60c3ed4f6b | ||
|
|
714e75eb95 | ||
|
|
636819c801 | ||
|
|
9a6c2e0685 | ||
|
|
736eecc13b | ||
|
|
4718c5dab0 | ||
|
|
7e9bd49da2 | ||
|
|
a0d0ff0b92 | ||
|
|
b41be0c319 | ||
|
|
17a466059e | ||
|
|
2d9e95a63e | ||
|
|
532a45f9e7 | ||
|
|
d61e32ebb5 | ||
|
|
b7d38e94c8 | ||
|
|
ae158742f6 | ||
|
|
c35686f8d1 | ||
|
|
a5b6651582 | ||
|
|
54973fdf82 | ||
|
|
0bee631385 | ||
|
|
6283382837 | ||
|
|
39bb522051 | ||
|
|
bf80d57abe | ||
|
|
865b94006a | ||
|
|
874248f8b5 | ||
|
|
cef7d5bb12 | ||
|
|
2a8131780f | ||
|
|
7094f70f4a | ||
|
|
df5af6129c | ||
|
|
a6888c3767 | ||
|
|
1bd367ddde | ||
|
|
0cf87ae561 | ||
|
|
fa80f5f67f | ||
|
|
7f080f920d | ||
|
|
13658323b4 | ||
|
|
2d440ab5ba | ||
|
|
dc55673691 | ||
|
|
92bb3948a6 | ||
|
|
f67ad6478c | ||
|
|
1d984198ce | ||
|
|
f2ca980771 | ||
|
|
b826697aea | ||
|
|
89430c13ec | ||
|
|
f07acea3e1 | ||
|
|
e9402c55e6 | ||
|
|
2eb6c76da8 | ||
|
|
a34e48a145 | ||
|
|
2d50659b48 | ||
|
|
327ae2b807 | ||
|
|
e831b7facc | ||
|
|
dfb6114584 | ||
|
|
5085841d9d | ||
|
|
7a98944469 | ||
|
|
3d2b455cda | ||
|
|
460d5d0691 | ||
|
|
b5f80351ec | ||
|
|
72a9472a57 | ||
|
|
7eb820c688 | ||
|
|
886b279da6 | ||
|
|
f2d7135fc5 | ||
|
|
d214a859c3 | ||
|
|
d1e221c2b7 | ||
|
|
e0e4207a4d | ||
|
|
4398c781c5 | ||
|
|
3e06000fd9 | ||
|
|
833795ebe1 | ||
|
|
6e270d5ec3 | ||
|
|
09a9bea3a7 | ||
|
|
035ccee2a6 | ||
|
|
17aa2a4153 | ||
|
|
f5bc5c0b47 | ||
|
|
e7a4afde7d | ||
|
|
8758c9b940 | ||
|
|
a569d20779 | ||
|
|
88e01fa083 | ||
|
|
7b435f9283 | ||
|
|
a240e5d128 | ||
|
|
0d0ba31d3a | ||
|
|
e79bb3533d | ||
|
|
f94c4ec831 | ||
|
|
d5afb76105 | ||
|
|
dd7e9ba05e | ||
|
|
ee54698fdb | ||
|
|
955b0e991c | ||
|
|
c1b98b9e40 | ||
|
|
d6939b7916 | ||
|
|
5f0ca37879 | ||
|
|
548bdb7eb5 | ||
|
|
5c85f39228 | ||
|
|
85b2cbc03a | ||
|
|
cc78011da6 | ||
|
|
d016da1895 | ||
|
|
8593f1c80a | ||
|
|
0b3c40dc3e | ||
|
|
2e7ecc59c0 | ||
|
|
942ce95dbf | ||
|
|
03f77d5ab7 | ||
|
|
8dec32fa6a | ||
|
|
8f409d47d9 | ||
|
|
93f062d4e3 | ||
|
|
b8f9ceafbb | ||
|
|
75d07b6dad | ||
|
|
6060a0a430 | ||
|
|
647ba1572c | ||
|
|
051e0cb811 | ||
|
|
b8c9e78910 | ||
|
|
2d7d9c6093 | ||
|
|
0f32f56208 | ||
|
|
5addfd8975 | ||
|
|
7f108ce8f0 | ||
|
|
8c883e1ca8 | ||
|
|
d18fe6ffa0 | ||
|
|
80a8ac9e98 | ||
|
|
671fd58568 | ||
|
|
c4ea3b59f0 | ||
|
|
5d5def206d | ||
|
|
b2ebbb9b55 | ||
|
|
3734c071bf | ||
|
|
b1a419f2a2 | ||
|
|
bf5e292160 | ||
|
|
df57d91270 | ||
|
|
4da1741578 | ||
|
|
7a3774e730 | ||
|
|
e6e21caeea | ||
|
|
200d47ab09 | ||
|
|
ab274151d4 | ||
|
|
aec1e3a529 | ||
|
|
916caa1eb2 | ||
|
|
50b29f8ad6 | ||
|
|
88d662cf27 | ||
|
|
5316130ae8 | ||
|
|
4f36dbc636 | ||
|
|
230a8697bf | ||
|
|
121449b230 | ||
|
|
fede549b51 | ||
|
|
1bdd7f9a6b | ||
|
|
b3f9da67b7 | ||
|
|
1ba7d623b4 | ||
|
|
47902e1177 | ||
|
|
a035bcc671 | ||
|
|
9bcc6b9605 | ||
|
|
282c3a864e | ||
|
|
eb083a8934 | ||
|
|
0fc71ff79e | ||
|
|
68a7455496 | ||
|
|
fcfc3acbb8 | ||
|
|
aa53c0aa6a | ||
|
|
f098905a92 | ||
|
|
eec78092b5 | ||
|
|
34fa5eceb8 | ||
|
|
c32d2dd6f8 | ||
|
|
da80d3536a | ||
|
|
e9361022d2 | ||
|
|
dd0c1a5ab5 | ||
|
|
bb9dff7b8c | ||
|
|
7e419c116e | ||
|
|
2cbc2f5226 | ||
|
|
68b5e3e0a8 | ||
|
|
1502ec12a9 | ||
|
|
6d09b18479 | ||
|
|
08ce207636 | ||
|
|
f199b977eb | ||
|
|
5715e2c835 | ||
|
|
b8642b7ca3 | ||
|
|
2c4d4708d8 | ||
|
|
0edb6e6157 | ||
|
|
4f394b5668 | ||
|
|
9834c30e3a | ||
|
|
f3f1b0870f | ||
|
|
915d314c18 | ||
|
|
02b3ae6aa5 | ||
|
|
f725e73653 | ||
|
|
c5858ef202 | ||
|
|
ba2fd2ca2e | ||
|
|
1075d36748 | ||
|
|
3ee3799e55 | ||
|
|
6654b0a67a | ||
|
|
9577c93edb | ||
|
|
7cd67281bc | ||
|
|
d21c226183 | ||
|
|
4322236b9e | ||
|
|
05e408ee65 | ||
|
|
3d1012ba94 | ||
|
|
94937e41ef | ||
|
|
3957aa83fc | ||
|
|
8aa79d1c4c | ||
|
|
578eeff0e1 | ||
|
|
5f2f1c67f5 | ||
|
|
c92b9c3d97 | ||
|
|
0951d00da3 | ||
|
|
6df9c3660b | ||
|
|
19be2bf96e | ||
|
|
e10ed6ac7a | ||
|
|
479ebf4d89 | ||
|
|
1f1e36e9f7 | ||
|
|
27e634ae03 | ||
|
|
e60b20b37b | ||
|
|
684214ff6a | ||
|
|
ba5be6071f | ||
|
|
6c8d13690e | ||
|
|
3e0b2ef3e4 | ||
|
|
c5304d2775 | ||
|
|
ca95ae04a5 | ||
|
|
1ab9f85ca6 | ||
|
|
01ff1b2f8f | ||
|
|
9b17fe68e7 | ||
|
|
0fed35a80f | ||
|
|
25280c9fa9 | ||
|
|
a98ebfdb21 | ||
|
|
acb1d18654 | ||
|
|
18b5a4e106 | ||
|
|
bab420a359 | ||
|
|
4f14f1f736 | ||
|
|
166831447c | ||
|
|
f2bd5961d0 | ||
|
|
2cc990a530 | ||
|
|
f0e6008563 | ||
|
|
93f19cca0a | ||
|
|
1cbe508f82 | ||
|
|
0c178c3155 | ||
|
|
e67304389d | ||
|
|
ad5b1cdcba | ||
|
|
fe1e09289f | ||
|
|
583ea76e4b | ||
|
|
a7d198893e | ||
|
|
fe62c8d0c5 | ||
|
|
16ce56c1ad | ||
|
|
15f0bfb9db | ||
|
|
22db589742 | ||
|
|
69119e6db7 | ||
|
|
690da2332b | ||
|
|
f2fead1444 | ||
|
|
c4f6267921 | ||
|
|
0dc65d083f | ||
|
|
40c1d93f02 | ||
|
|
2024a93126 | ||
|
|
88d79a42e6 | ||
|
|
b01b2cce9b | ||
|
|
c5b1089c96 | ||
|
|
679e43758b | ||
|
|
90e6e5a96c | ||
|
|
4fb003c4df | ||
|
|
9d5f349a04 | ||
|
|
f4f4a47a7f | ||
|
|
6a3e987668 | ||
|
|
83f943965f | ||
|
|
c9fdff169f | ||
|
|
5454832918 | ||
|
|
3d6d774b17 | ||
|
|
1463547af4 | ||
|
|
0bcf4b3597 | ||
|
|
824e8dcb4b | ||
|
|
4b2f0c8020 | ||
|
|
7fd424cf65 | ||
|
|
5ff2855eb0 | ||
|
|
8c8c162a54 | ||
|
|
37d52f3688 | ||
|
|
f361cbfa71 | ||
|
|
ddefbfe2cf | ||
|
|
10296cb736 | ||
|
|
49dc0599c9 | ||
|
|
14348e170b | ||
|
|
59d1f0d817 | ||
|
|
e024f134a4 | ||
|
|
cf5a5b5b47 | ||
|
|
e957f92496 | ||
|
|
9484bb9941 | ||
|
|
d781f9822f | ||
|
|
7845ef2de4 | ||
|
|
a9d4ecf33d | ||
|
|
6f4a62c7a3 | ||
|
|
6b4f872742 | ||
|
|
ef4f00f8f5 | ||
|
|
a27deb3936 | ||
|
|
18814c7373 | ||
|
|
1d9908e1f6 | ||
|
|
29529e4a06 | ||
|
|
74b1003c4c | ||
|
|
27ffdec323 | ||
|
|
d9e5fc2b60 | ||
|
|
646b3e3064 | ||
|
|
d3475208ef | ||
|
|
7246da472d | ||
|
|
e1f917894a | ||
|
|
c14d25f860 | ||
|
|
57ed91cd28 | ||
|
|
47c84beb43 | ||
|
|
1e3032bdce | ||
|
|
ed69684843 | ||
|
|
2eea5c7bf7 | ||
|
|
16da53ae4e | ||
|
|
f45464b0d9 | ||
|
|
2351ade6fe | ||
|
|
c19ccf9278 | ||
|
|
5c92762ba9 | ||
|
|
e665f966e6 | ||
|
|
7dcca7e505 | ||
|
|
e25049b1d6 | ||
|
|
da9bc4a138 | ||
|
|
1224d3b443 | ||
|
|
d33be37694 | ||
|
|
551ff26a65 | ||
|
|
74082f9c68 | ||
|
|
b93331e184 | ||
|
|
d5d26168b3 | ||
|
|
9d848e222b | ||
|
|
46a2510e85 | ||
|
|
0789a453a2 | ||
|
|
b30f7fe9c7 | ||
|
|
525bd199b2 | ||
|
|
dffd8b59f5 | ||
|
|
df206724bd | ||
|
|
41f31250a9 | ||
|
|
b29007275f | ||
|
|
35f268319e | ||
|
|
6e8a185b63 | ||
|
|
120fff1fc4 | ||
|
|
f879bd5e3a | ||
|
|
01f9fd561d | ||
|
|
6802a7d747 | ||
|
|
b918b29014 | ||
|
|
4895a3313b | ||
|
|
59673c9e66 | ||
|
|
b126255be7 | ||
|
|
606c9f3fd8 | ||
|
|
aa306a8df7 | ||
|
|
b1256eedcf | ||
|
|
4454df341f | ||
|
|
5bcac17f1c | ||
|
|
875b9f326c | ||
|
|
a0d27c6f86 | ||
|
|
1d47d12189 | ||
|
|
67f78ae8b5 | ||
|
|
5948855da7 | ||
|
|
f6ec46cdf6 | ||
|
|
ebd2755eb2 | ||
|
|
78f5827d3d | ||
|
|
0829070c67 | ||
|
|
8b4332e842 | ||
|
|
f904c91443 | ||
|
|
944539453e | ||
|
|
5856b002df | ||
|
|
12f68bc227 | ||
|
|
de6e20d60a | ||
|
|
35e6ef5cd8 | ||
|
|
27251dda2e | ||
|
|
4bb967ab4a | ||
|
|
7c1f878610 | ||
|
|
e8c4c9b218 | ||
|
|
bc37d365ab | ||
|
|
d9ae1bbd9f | ||
|
|
e492b30178 | ||
|
|
920860c298 | ||
|
|
5f8a6e3423 | ||
|
|
3e7a5056d5 | ||
|
|
2ec6f04763 | ||
|
|
ecef9c9792 | ||
|
|
810501a508 | ||
|
|
6285a66d76 | ||
|
|
72e4922e8e | ||
|
|
c1f1885633 | ||
|
|
56e514a500 | ||
|
|
5ede100d56 | ||
|
|
f1456b8101 | ||
|
|
ef8eb76b16 | ||
|
|
b4f2188f72 | ||
|
|
38c30f5ecd | ||
|
|
94c794de6f | ||
|
|
fb535e620c | ||
|
|
5a42980d78 | ||
|
|
299d2a1f01 | ||
|
|
164ff5ea9a | ||
|
|
6c89ef908a | ||
|
|
3441ae11f2 | ||
|
|
c028331ef9 | ||
|
|
9343c300cd | ||
|
|
63693cc529 | ||
|
|
e6de06aae8 | ||
|
|
89ce7312d1 | ||
|
|
b884787377 | ||
|
|
a1427e7743 | ||
|
|
0c02190e19 | ||
|
|
1f7cce9535 | ||
|
|
9fea677b60 | ||
|
|
6b9a3aff58 | ||
|
|
b938271b4d | ||
|
|
297e06ba71 | ||
|
|
a521ab76a5 | ||
|
|
b1c8fc82c4 | ||
|
|
d4ba90c21d | ||
|
|
14dc868d45 | ||
|
|
61a60ecdd6 | ||
|
|
2b56247e21 | ||
|
|
e0066e6173 | ||
|
|
b5b92f91dc | ||
|
|
7b12510182 | ||
|
|
e2fc6a3ff0 | ||
|
|
5acd3a7f6c | ||
|
|
ce49ca0998 | ||
|
|
eacce487ed | ||
|
|
602b1d8a27 | ||
|
|
dec469caef | ||
|
|
4194b2ca86 | ||
|
|
17741822c1 | ||
|
|
3757056e46 | ||
|
|
0eb68ef864 | ||
|
|
3f77a9b721 | ||
|
|
321b3acf0a | ||
|
|
dfbbeeb473 | ||
|
|
31d3f2e7c6 | ||
|
|
40a66b9be4 | ||
|
|
049a1fb2ed | ||
|
|
3fc68af05f | ||
|
|
c3f0c8a7a1 | ||
|
|
cba1a95838 | ||
|
|
345f4a2e0e | ||
|
|
162d53b66e | ||
|
|
bed6782a00 | ||
|
|
d90b960597 | ||
|
|
3325feb1cb | ||
|
|
62d181eb81 | ||
|
|
1e24e9c128 | ||
|
|
cfffba25cf | ||
|
|
671b4fe2db | ||
|
|
5b300bc5d1 | ||
|
|
a5332c2166 | ||
|
|
141d5ccd25 | ||
|
|
c75b9c2328 | ||
|
|
0863db8cf0 | ||
|
|
53d6a272e6 | ||
|
|
71467a7ae7 | ||
|
|
56fa3458ab | ||
|
|
82e04ac4e5 | ||
|
|
564d4442fc | ||
|
|
df8fdd086b | ||
|
|
a31476251e | ||
|
|
360a655627 | ||
|
|
3b871b9c00 | ||
|
|
65834a2087 | ||
|
|
e9d85da691 | ||
|
|
cfa78af654 | ||
|
|
45d9119150 | ||
|
|
ea487eb6a4 | ||
|
|
4e295ea1eb | ||
|
|
32265414bd | ||
|
|
80e706e962 | ||
|
|
110838715b | ||
|
|
b90334c8a8 | ||
|
|
3ce0530d5f | ||
|
|
7eaa84d5b1 | ||
|
|
ad325dfedb | ||
|
|
5bb7eb6f01 | ||
|
|
342cfc0801 | ||
|
|
f5c6a9f507 | ||
|
|
e843ff372e | ||
|
|
ed27ffed65 | ||
|
|
7995ecd867 | ||
|
|
fcef6679c4 | ||
|
|
742b6a2e27 | ||
|
|
258fbc8870 | ||
|
|
0fa43ee287 | ||
|
|
fb39261dc7 | ||
|
|
7fce4bf53e | ||
|
|
13840cf61b | ||
|
|
e26f6b5e8d | ||
|
|
767c49f9fa | ||
|
|
c9178da608 | ||
|
|
855bc59a53 | ||
|
|
798c22e94b | ||
|
|
ea3be11294 | ||
|
|
335073b3b0 | ||
|
|
2b6ee344b7 | ||
|
|
8f55b82e2f | ||
|
|
ba9cd1f3e2 | ||
|
|
e0e7ae98e7 | ||
|
|
b05e439da9 | ||
|
|
fb5dbbdf58 | ||
|
|
9cb9dd0a58 | ||
|
|
276d42561e | ||
|
|
44b98165ba | ||
|
|
b5088340fd | ||
|
|
b7dd63ebd9 | ||
|
|
ba376a6326 | ||
|
|
87a43e8e8f | ||
|
|
b62ada53c3 | ||
|
|
4f3198b1bd | ||
|
|
c9f99e0903 | ||
|
|
3b4c58b721 | ||
|
|
6496bbd87f | ||
|
|
4ad8d362f7 | ||
|
|
d9aeb6afaa | ||
|
|
d971389746 | ||
|
|
233a2bdbe7 | ||
|
|
2277183330 | ||
|
|
b2cd3d31fd | ||
|
|
02f6b3be42 | ||
|
|
22e84321fc | ||
|
|
c472dc89ad | ||
|
|
b89d9d44b0 | ||
|
|
a2c21f8ceb | ||
|
|
e35596b0fa | ||
|
|
b95a7f063b | ||
|
|
e4bbd36d47 | ||
|
|
9790ab29a2 | ||
|
|
24cc2d3b36 | ||
|
|
12779699e3 | ||
|
|
2188690d20 | ||
|
|
7059fdfd9e | ||
|
|
9e1bde4b00 | ||
|
|
45790b60b0 | ||
|
|
c5f3a27d6b | ||
|
|
d9136aa407 | ||
|
|
183f48a998 | ||
|
|
3c5bc507a5 | ||
|
|
548dd0365c | ||
|
|
4591fc603f | ||
|
|
26946feecc | ||
|
|
dd14f3c469 | ||
|
|
69af41f1e5 | ||
|
|
474562455d | ||
|
|
c75d612541 | ||
|
|
8de6ce9868 | ||
|
|
97bde50708 | ||
|
|
b23e35cf26 | ||
|
|
b58e04707d | ||
|
|
846cf63268 | ||
|
|
4850bdefdf | ||
|
|
424b580eb9 | ||
|
|
7f8ad468ca | ||
|
|
e07e2bd7d1 | ||
|
|
7074963fb1 | ||
|
|
88acbe655d | ||
|
|
903ebc68a4 | ||
|
|
49bdccf020 | ||
|
|
ba3818884d | ||
|
|
64ce904ec1 | ||
|
|
8c5f7ef020 | ||
|
|
98426f6dcc | ||
|
|
f3ec873ac2 | ||
|
|
30961483e1 | ||
|
|
33e0750959 | ||
|
|
e59a07e232 | ||
|
|
3b05b9be11 | ||
|
|
943bbd9889 | ||
|
|
763cf8dbda | ||
|
|
5117518d8f | ||
|
|
936996da17 | ||
|
|
019a7e59b7 | ||
|
|
428a47f889 | ||
|
|
2be2cb19b2 | ||
|
|
66ee09d050 | ||
|
|
906dab28c1 | ||
|
|
6db8e1d842 | ||
|
|
a665e86096 | ||
|
|
b7481dbd2e | ||
|
|
b1e509c6f8 | ||
|
|
1f69622a34 | ||
|
|
215b2b5f75 | ||
|
|
1e8c91e92f | ||
|
|
19d447d67d | ||
|
|
925fa2ee1b | ||
|
|
1cedf0e9a0 | ||
|
|
ca8bb7f5f0 | ||
|
|
9e15a4a557 | ||
|
|
af5d0c4b0e | ||
|
|
08ab359534 | ||
|
|
28c44e0b2f | ||
|
|
7038f49a1a | ||
|
|
af25c15286 | ||
|
|
ffc5281d59 | ||
|
|
ad659cd32e | ||
|
|
afd3cbd311 | ||
|
|
a5a5f7e24a | ||
|
|
1e203b58c3 | ||
|
|
104b7c2cf2 | ||
|
|
355c89ecab | ||
|
|
1241e18f9c | ||
|
|
6566acf7eb | ||
|
|
4332ed92f2 | ||
|
|
2e7f96aab0 | ||
|
|
3cb9b90ef0 | ||
|
|
21a04cc8c8 | ||
|
|
dcc1b59627 | ||
|
|
e8fb3e6d24 | ||
|
|
93d084d5ba | ||
|
|
e45ecf9c86 | ||
|
|
beb10e22f2 | ||
|
|
64b12f8497 | ||
|
|
0821a08df2 | ||
|
|
50870a9b32 | ||
|
|
b823446e28 | ||
|
|
48b00874e5 | ||
|
|
deba6c79f3 | ||
|
|
c0be10ad94 | ||
|
|
5010d35ff3 | ||
|
|
42d26a1f4f | ||
|
|
92c25d2df4 | ||
|
|
5b5349fc34 | ||
|
|
cc6ac93b7a | ||
|
|
1b843b3586 | ||
|
|
3b9a426547 | ||
|
|
989ba0103d | ||
|
|
b584b996a3 | ||
|
|
896c7fc467 | ||
|
|
bd2393342f | ||
|
|
762b10cb17 | ||
|
|
9322eedb4e | ||
|
|
4e2a902b75 | ||
|
|
d3b8bd6f39 | ||
|
|
0fa64dad7f | ||
|
|
792e8663e6 | ||
|
|
4dc999b0d9 | ||
|
|
7c15c2de41 | ||
|
|
43137c3e53 | ||
|
|
521ecd438e | ||
|
|
949c6599b3 | ||
|
|
ea79efe693 | ||
|
|
b4a89462f8 | ||
|
|
70bd3d0e9a | ||
|
|
c33474e0f9 | ||
|
|
3d0ebe5c91 | ||
|
|
a9ab0702e0 | ||
|
|
9272741a3c | ||
|
|
2b72a99608 | ||
|
|
4c38e10fe1 | ||
|
|
7806b48d34 | ||
|
|
9803d6b731 | ||
|
|
649db3aca2 | ||
|
|
b75ab68e7a | ||
|
|
8ffc42d349 | ||
|
|
145c9750cd | ||
|
|
12647c3a6c | ||
|
|
056f8a57c7 | ||
|
|
94f0acf9f3 | ||
|
|
40bf65d56a | ||
|
|
726e3a5c20 | ||
|
|
d1cab0da7f | ||
|
|
ede4873c6a | ||
|
|
fd8c827bf1 | ||
|
|
20afbdf264 | ||
|
|
0dd92e5189 | ||
|
|
4b1ba5acb0 | ||
|
|
edc94594eb | ||
|
|
837efb75d1 | ||
|
|
252208a479 | ||
|
|
2641cb7d4f | ||
|
|
9c91f06c5d | ||
|
|
7fab4144ae | ||
|
|
81eb2cad1a | ||
|
|
eda7db7aca | ||
|
|
45a7653dcd | ||
|
|
36fef995e4 | ||
|
|
af2e862ca2 | ||
|
|
7f48ce06be | ||
|
|
1c5ae9ef67 | ||
|
|
3bf18c41bb | ||
|
|
7ab49f1909 | ||
|
|
44b5e5548d | ||
|
|
50ca9d129b | ||
|
|
7b725d655c | ||
|
|
3e9c7aa74b | ||
|
|
916ed2652e | ||
|
|
59a1726e8c | ||
|
|
20f91b5258 | ||
|
|
353ce7e825 | ||
|
|
94be4ab18e | ||
|
|
df7409607f | ||
|
|
79b937e8d2 | ||
|
|
83c6c9c743 | ||
|
|
6a2affc0f9 | ||
|
|
8ad713c183 | ||
|
|
f8fb746f64 | ||
|
|
c6b3507bf4 | ||
|
|
2dc95da6e0 | ||
|
|
8f9bfcf474 | ||
|
|
a8b54757e9 | ||
|
|
19cfd9edc6 | ||
|
|
03d0f962e5 | ||
|
|
0ff24627ca | ||
|
|
4d8cd430b7 | ||
|
|
30b0e5d0b1 | ||
|
|
cdf067bba8 | ||
|
|
e4d05e14ac | ||
|
|
82dc78523f | ||
|
|
676e744c02 | ||
|
|
0d80265ff2 | ||
|
|
442521a73c | ||
|
|
dcef083e30 | ||
|
|
162cd20f80 | ||
|
|
c74433422a | ||
|
|
f338650b24 | ||
|
|
65c0d77d3e | ||
|
|
09a150b6e9 | ||
|
|
06173a446a | ||
|
|
d6adea447e | ||
|
|
d042b785ed | ||
|
|
881846d301 | ||
|
|
2092cc43b3 | ||
|
|
dc637d0f2b | ||
|
|
987a20b33c | ||
|
|
dbf65f798f | ||
|
|
97aa259b2d | ||
|
|
770a108bad | ||
|
|
71aaa574b2 | ||
|
|
a02fe633e2 | ||
|
|
0669bab563 | ||
|
|
a258400443 | ||
|
|
d02c5057c6 | ||
|
|
a473f47235 | ||
|
|
7bedf6bb15 | ||
|
|
9d813290c6 | ||
|
|
05239bccb0 | ||
|
|
1d5c28f37f | ||
|
|
16fb6b4f9d | ||
|
|
97b09aab34 | ||
|
|
55210caceb | ||
|
|
8127e56603 | ||
|
|
e61b496ca4 | ||
|
|
3ed8eb76c2 | ||
|
|
a5c3b8a245 | ||
|
|
3f5d52f901 | ||
|
|
46e0607a26 | ||
|
|
23fa7a89ad | ||
|
|
dcd379bce7 | ||
|
|
40238a9d25 | ||
|
|
44db374e09 | ||
|
|
d960d543ff | ||
|
|
0a45292587 | ||
|
|
9b4a7c705b | ||
|
|
71a6d8ab44 | ||
|
|
91f9acb633 | ||
|
|
0e45dc5a3f | ||
|
|
3341574e02 | ||
|
|
881dc38a18 | ||
|
|
e54b201aa5 | ||
|
|
2d06a40127 | ||
|
|
f7e68798fa | ||
|
|
b9fe5d2afc | ||
|
|
5f12d99e73 | ||
|
|
933987ac0a | ||
|
|
3a10a0969a | ||
|
|
ba4907e67b | ||
|
|
99b37147d3 | ||
|
|
92a03ab7d6 | ||
|
|
68a0c67769 | ||
|
|
17e9105b9c | ||
|
|
5411a294e7 | ||
|
|
f821e277de | ||
|
|
18c2164049 | ||
|
|
c9688a9c58 | ||
|
|
cd599849b2 | ||
|
|
423f0199d0 | ||
|
|
40299eeea4 | ||
|
|
38077275bc | ||
|
|
23aa6dc743 | ||
|
|
b90fb6a2b0 | ||
|
|
17c8ed9ebc | ||
|
|
a091a32c26 | ||
|
|
23970a4e36 | ||
|
|
f61a9ab5cc | ||
|
|
4505bb6f4e | ||
|
|
bb836aea57 | ||
|
|
d584fba31c | ||
|
|
feacf3af7b | ||
|
|
8c428bb399 | ||
|
|
8edb6976fb | ||
|
|
edd2f460a0 | ||
|
|
8810647bb8 | ||
|
|
2204bd67a7 | ||
|
|
c9c747693d | ||
|
|
135d92303d | ||
|
|
c707434155 | ||
|
|
4b72805a69 | ||
|
|
d5a9b0c65f | ||
|
|
2015604fe2 | ||
|
|
96a290b153 | ||
|
|
912fcfe88a | ||
|
|
4dcf7489fa | ||
|
|
7f1552dff8 | ||
|
|
d2ca8bffc4 | ||
|
|
e15b01bac5 | ||
|
|
dcd3cb80b8 | ||
|
|
d0ddc7c271 | ||
|
|
2b55f3407c | ||
|
|
e84afb4808 | ||
|
|
10c47eff7e | ||
|
|
aee81f918e | ||
|
|
95b2d9419f | ||
|
|
feb9ce6633 | ||
|
|
43489ca087 | ||
|
|
ce1a15e6ea | ||
|
|
cc72d370ea | ||
|
|
d042185660 | ||
|
|
e78b639018 | ||
|
|
e8ea562b09 | ||
|
|
3b5a729ef3 | ||
|
|
ef7d487ec5 | ||
|
|
b379b8f022 | ||
|
|
a31378c2c8 | ||
|
|
0d2c2121bb | ||
|
|
21040b306a | ||
|
|
541b1dbc44 | ||
|
|
005ac41820 | ||
|
|
dd93772233 | ||
|
|
428fc7e5f6 | ||
|
|
5cf38cc885 | ||
|
|
2f6b51e811 | ||
|
|
2f12da6bc6 | ||
|
|
3985e157d9 | ||
|
|
3034eb5c12 | ||
|
|
f666f1baa9 |
No files matched your search
@@ -0,0 +1,2 @@
|
||||
*.java diff=java
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
github: enginehub
|
||||
@@ -0,0 +1,93 @@
|
||||
name: Bug report
|
||||
description: Report a way in which WorldGuard is not working as intended
|
||||
labels: ['type:bug', 'status:pending']
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Please note that this is only for bugs, help with installation or other types of support should
|
||||
be taken to the Discord Guild instead.
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: WorldEdit Version
|
||||
description: The full version of WorldEdit, can be found by using `/we version`.
|
||||
placeholder: e.g. 7.2.3 or 7.3.0-SNAPSHOT
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: WorldGuard Version
|
||||
description: The full version of WorldGuard, can be found by using `/wg version`.
|
||||
placeholder: e.g. 7.0.5 or 7.0.6-SNAPSHOT
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Platform Version
|
||||
description: |
|
||||
The version of the platform you are on, i.e. Spigot or Paper.
|
||||
Please ensure you are running up-to-date software before making a bug report.
|
||||
Old versions, paper forks or hybrids will receive little to no support.
|
||||
placeholder: e.g. git-Spigot-21fe707-e1ebe52, git-Paper-463
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: checkboxes
|
||||
id: confirmations
|
||||
attributes:
|
||||
label: Confirmations
|
||||
description: Please confirm the following before submitting the bug. Your report will be closed if you are running hybrids or old software.
|
||||
options:
|
||||
- label: I am using the most recent Minecraft release.
|
||||
required: true
|
||||
- label: I am using a version of WorldEdit compatible with my Minecraft version.
|
||||
required: true
|
||||
- label: I am using a version of WorldGuard compatible with my Minecraft version.
|
||||
required: true
|
||||
- label: I am using the latest or recommended version of my platform software.
|
||||
required: true
|
||||
- label: I am NOT using a hybrid server, e.g. a server that combines Bukkit and Forge. Examples include Arclight, Mohist, and Cardboard.
|
||||
required: true
|
||||
- label: I am NOT using a fork of WorldEdit, such as FastAsyncWorldEdit (FAWE) or AsyncWorldEdit (AWE)
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Bug Description
|
||||
description: A clear and concise description of what the bug is.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Expected Behavior
|
||||
description: The behavior that you expected, instead of the bugged behavior that occurs.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Reproduction Steps
|
||||
description: Steps to reproduce the behavior.
|
||||
value: |
|
||||
1. ...
|
||||
2. ...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Optional WorldGuard-Report
|
||||
description: Link to WorldGuard Region report for bugs with regions, received with `/wg report -p`
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Anything Else?
|
||||
description: Add any additional context you can provide below.
|
||||
@@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: EngineHub Discord
|
||||
url: https://discord.gg/EngineHub
|
||||
about: Please ask and answer questions here.
|
||||
@@ -0,0 +1,35 @@
|
||||
name: Feature request
|
||||
description: Suggest an idea for WorldGuard
|
||||
labels: ['type:feature-request', 'status:pending']
|
||||
|
||||
body:
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: The Problem
|
||||
description: >
|
||||
What is making your WorldGuard experience sub-optimal? This should be something that
|
||||
cannot be easily solved by existing WorldGuard features.
|
||||
placeholder: It's hard to ... ; I'm unable to ...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: A Solution
|
||||
description: What is your proposed solution to the above problem?
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Alternatives
|
||||
description: |
|
||||
Alternative solutions or workarounds to the problem.
|
||||
You should also describe why these are not preferable to the given solution.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Anything Else?
|
||||
description: Add any additional context you can provide below.
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
.classpath
|
||||
.project
|
||||
.settings/
|
||||
target/
|
||||
|
||||
.DS_Store
|
||||
|
||||
**/*.iml
|
||||
**/.idea
|
||||
|
||||
bin/
|
||||
dependency-reduced-pom.xml
|
||||
*-private.sh
|
||||
|
||||
.gradle/
|
||||
**/build/
|
||||
out/
|
||||
|
||||
scripts/
|
||||
@@ -0,0 +1,8 @@
|
||||
language: java
|
||||
dist: trusty
|
||||
jdk:
|
||||
- oraclejdk11
|
||||
notifications:
|
||||
email: false
|
||||
before_install: chmod +x gradlew
|
||||
script: ./gradlew build -S
|
||||
+1016
File diff suppressed because it is too large.
Load diff
-202
@@ -1,202 +0,0 @@
|
||||
3.1:
|
||||
- Added ability to disable chest protection. New configuration setting
|
||||
(regions.build.chest-access) and new chest flag.
|
||||
- Possibly fixed projectile blocking in no-PvP zones.
|
||||
- Added /regionmembership permission that lets people only change
|
||||
the owners and members of regions they own.
|
||||
|
||||
3.0b2:
|
||||
- Fixed issue where built-in permissions were not (re)loaded.
|
||||
- Fixed /god not working for others.
|
||||
|
||||
3.0b1:
|
||||
- Added parent-child relationships to regions.
|
||||
- Added global build flag.
|
||||
- Improved flag support.
|
||||
- Fixed no-PvP zone messages being sent to the wrong person.
|
||||
- Fixed commands so that they work in a recent version of Bukkit.
|
||||
- Fixed NullPointerException in explode hook.
|
||||
|
||||
2.3.1:
|
||||
- Fixed various cast exceptions with the blacklist loggers.
|
||||
- Added checks for unchecked exceptions when resolving permissions.
|
||||
- Fixed the item durability disable setting changing the damage value on
|
||||
an empty hand.
|
||||
|
||||
2.3:
|
||||
- /god now works very well.
|
||||
- Item (TNT, flint and steel, etc.) blocking should now work.
|
||||
- The TNT blocking configuration variable should now work.
|
||||
- Re-added /heal (not sure where that went), added /slay.
|
||||
- Implemented contact damage disable toggle.
|
||||
- Made all player damage disabling configuration parameters work.
|
||||
- Fixed teleport-on-suffocation setting.
|
||||
- Added /locate <name>, /locate <x> <y> <z>, and /locate that lets you
|
||||
program/change your compass bearing to point to a player's position
|
||||
(not yet live), a position, or back to spawn.
|
||||
- Fixed CSVDatabase spitting an error if the owners list was empty.
|
||||
|
||||
2.2:
|
||||
- Now supports GroupUsers.
|
||||
- Added support for blocking creeper explosions.
|
||||
- Fixed a bug where a player's groups were not being loaded correctly,
|
||||
causing the blacklist group ignore option to not work.
|
||||
|
||||
2.1.1:
|
||||
- Fixed fire spread disable preventing flint and steel too.
|
||||
- Fixed NullPointerException related to the player item event.
|
||||
- Made setup simpler.
|
||||
|
||||
2.1:
|
||||
- Improved Bukkit support.
|
||||
|
||||
2.0beta3:
|
||||
- Fixed NullPointerException inside the ignite hook.
|
||||
|
||||
2.0beta2:
|
||||
- Fixed a NullPointerException in the damage hook.
|
||||
|
||||
2.0beta1:
|
||||
- Added area protection. Use /region or /rg to define regions.
|
||||
|
||||
1.8.1
|
||||
- Fixed NullPointerException.
|
||||
|
||||
1.8
|
||||
- Updated for Minecraft beta.
|
||||
- Blacklist hooks have CHANGED. The new hooks are work better. on-create has
|
||||
been replaced with on-place (for block placement) and on-use
|
||||
(for item usage, light buckets and lighters). The old on-use is now
|
||||
on-right-click although it currently does nothing.
|
||||
- Added coordinates to blacklist file logger.
|
||||
- Added suffocation damage prevention.
|
||||
|
||||
1.7.1
|
||||
- Updated for v0.2.8.
|
||||
|
||||
1.7
|
||||
- Updated for v0.2.6_02 and hMod b129.
|
||||
- Added option to prevent water from damaging particular blocks
|
||||
(Redstone wire, Minecart tracks, etc.). See disable-water-damage-blocks.
|
||||
- /reload WorldGuard should now reload WorldGuard's configuration.
|
||||
- Added wg-invincible and wg-amphibious groups that let you give certain
|
||||
players invincibility or underwater breathing.
|
||||
- Added the ability to disable fall, water, lava, and/or fire damage.
|
||||
- Water/lava bucket blocking should now be more reliable.
|
||||
- Added /stack (alias /;) commands to stack items in your inventory into
|
||||
piles up to 64 items in size. Even unstackable items like signs can be
|
||||
stacked.
|
||||
- /god mode should now let you gain health.
|
||||
- /god mode should now work more reliably.
|
||||
- Caught an error message for when the configuration file does not exist.
|
||||
|
||||
1.6
|
||||
- Added spawn protection that prevents damage when a player spawns.
|
||||
- Added login protection that prevents damage when a player joins.
|
||||
- Added /god. /god can be used on others, provided that the /godother
|
||||
permission is set for the command's user.
|
||||
|
||||
1.5.1
|
||||
- Removed the 'java.lang.NoSuchMethodError: Item.setDamage(I)V' error
|
||||
generated.
|
||||
|
||||
1.5
|
||||
- Removed the block lag fix.
|
||||
- WorldGuard now conditionally loads features so you can use any up-to-date
|
||||
build of hMod and the unsupported features won't break the entire
|
||||
plugin. When WG loads, check the server console for a report of
|
||||
features that are not supported by your version of hMod.
|
||||
- Changed some configuration defaults:
|
||||
disable-lava-fire=true
|
||||
simulate-sponge=true
|
||||
item-durability=false
|
||||
|
||||
1.4.1
|
||||
- Fixed issue with the block lag fix dropping item stacks of 0 quantity.
|
||||
|
||||
1.4
|
||||
- New on-acquire hook. This does both a total inventory check on inventory
|
||||
change and item pick up denial. The item pick up denial is largely
|
||||
thanks to Dinnerbone for fulfilling my request to add a particular hook.
|
||||
- Item durability can now be toggled with item-durability. Thanks to
|
||||
Dinnerbone for figuring this out while filfilling my request. The
|
||||
default setting is to fix item durability.
|
||||
- New no-physics-gravel and no-physics-sand options allow you to
|
||||
prevent gravel and sand from falling.
|
||||
- New allow-portal-anywhere option allows you to create portal blocks
|
||||
anywhere.
|
||||
|
||||
1.3
|
||||
- UPGRADE WARNING: If you are using database logging, you must add a
|
||||
NULL 'comment' VARCHAR field to the table. The line of SQL that you
|
||||
can run for MySQL can be found in blacklist_table.sql.
|
||||
- Improved plugin compatibility with the block lag fix. For maximum
|
||||
compatibility, you must now list WorldGuard as the first plugin in
|
||||
server.properties and you cannot reload or enable the plugin
|
||||
while the server is up. This is for bad plugins that unnecessarily
|
||||
use the "critical" priority for its hooks like the LWC. Most plugins
|
||||
don't do that though, so this won't apply for most people.
|
||||
- Fixed signs being blank if they were denied via the blacklist.
|
||||
- Added on-break event to the blacklist.
|
||||
- Added comments and messages. Comments are only for your own use and they
|
||||
are printed with the log and notify actions of the blacklist. The
|
||||
message replaces the message that is shown the user and it is optional.
|
||||
- The blacklist notification messages are now more compact and are
|
||||
light grey instead of light purple.
|
||||
- The notify, log, and tell actions will now trigger every time for the
|
||||
on-break, on-create, on-drop events rather than wait 3 seconds between
|
||||
events for the same item or block for a player.
|
||||
|
||||
1.2
|
||||
- /stopfire and /allowfire disable and enable fire spreading globally.
|
||||
- Block lag fix slightly improved in accuracy for item drops.
|
||||
- Sponge updated to remove water when the sponge block is set. Sponge radius
|
||||
can now be controlled using the 'sponge-radius' parameter and the
|
||||
default is now set to simulate Classic.
|
||||
- Updated for a newer build of "b126," meaning that lava spread control
|
||||
now works well!
|
||||
- A new summary of the status of some core protections is now printed
|
||||
on start. Disable this with 'summary-on-start'.
|
||||
- Blacklist system has been overhauled. Check README.txt for changed
|
||||
configuration settings!
|
||||
- The blacklist's method of preventing notification repeats is now better,
|
||||
instead waiting 3 seconds before notifying again (before it didn't
|
||||
notify again at all unless the user started using another blocked
|
||||
action).
|
||||
- To give users the ability to receive notifications, the command to give
|
||||
permission to has been changed to /worldguardnotify, although the
|
||||
old one (that was never mentioned anywhere) still works.
|
||||
- Water and lava buckets are now psuedo-blocked using an unreliable
|
||||
method that risks the stability of your server (no other plugin
|
||||
does it better though). Use it as your own risk.
|
||||
- Added on item drop and on item use (i.e. chest) events.
|
||||
- Chests, signs, and furnaces can now be blocked better with the
|
||||
blacklist system.
|
||||
- The event names in the blacklist configuration have changed but the old
|
||||
event names should still work. The new names should make "more sense."
|
||||
- A new "ban" action has been added to the blacklist.
|
||||
- Action messages have been improved, now longer saying "destroyed"
|
||||
for everything.
|
||||
- Logging to file has been completely changed, allowing you to use
|
||||
the date and time and the player's username in the log filename. It
|
||||
no longer rotates log files based on size, however.
|
||||
- Logging to database is now supported.
|
||||
- Tools can now be destroyed on drop to alleviate the durability cheat.
|
||||
You can do this with either with the blacklist or with the
|
||||
'item-drop-blacklist' configuration option. The configuration option
|
||||
prints more friendly messages than the 'tell' action of blacklists.
|
||||
|
||||
1.1.2
|
||||
- Block lag fix: Snow and glass should no longer drop items.
|
||||
- Block lag fix: Block object now reset after hook call.
|
||||
|
||||
1.1.1
|
||||
- Fixed redstone wire dropping wood blocks with the block lag fix.
|
||||
- The block lag fix now consults other plugins so that ALL protection
|
||||
mechanisms and plugins should work.
|
||||
|
||||
1.1
|
||||
- Added block lag fix.
|
||||
|
||||
1.0
|
||||
- Initial release.
|
||||
@@ -0,0 +1,42 @@
|
||||
Compiling
|
||||
=========
|
||||
|
||||
You can compile WorldGuard as long as you have some version of Java greater than or equal to 16 installed. Gradle will download JDK 16 specifically if needed,
|
||||
but it needs some version of Java to bootstrap from.
|
||||
|
||||
Note that if you have JRE 16 installed, Gradle will currently attempt to use that to compile, which will not work. It is easiest to uninstall JRE 16 and
|
||||
replace it with JDK 16.
|
||||
|
||||
The build process uses Gradle, which you do *not* need to download. WorldGuard is a multi-module project with three modules:
|
||||
|
||||
* `worldguard-core` contains the WorldGuard API
|
||||
* `worldguard-bukkit` is the Bukkit plugin
|
||||
* `worldguard-libs` contains library relocations
|
||||
|
||||
## To compile...
|
||||
|
||||
### On Windows
|
||||
|
||||
1. **Shift** + **right click** the folder with WorldGuard's files and click "Open PowerShell window here".
|
||||
2. `gradlew build`
|
||||
|
||||
### On Linux, BSD, or Mac OS X
|
||||
|
||||
1. In your terminal, navigate to the folder with WorldGuard's files (`cd /folder/of/worldguard/files`)
|
||||
2. `./gradlew build`
|
||||
|
||||
## Then you will find...
|
||||
|
||||
You will find:
|
||||
|
||||
* The core WorldGuard API in **worldguard-core/build/libs**
|
||||
* WorldGuard for Bukkit in **worldguard-bukkit/build/libs**
|
||||
|
||||
If you want to use WorldGuard, use the `-dist` version.
|
||||
|
||||
(The -dist version includes WorldGuard + necessary libraries.)
|
||||
|
||||
## Other commands
|
||||
|
||||
* `gradlew idea` will generate an [IntelliJ IDEA](http://www.jetbrains.com/idea/) module for each folder.
|
||||
* `gradlew eclipse` will generate an [Eclipse](https://www.eclipse.org/downloads/) project for each folder.
|
||||
@@ -0,0 +1,66 @@
|
||||
# Contributing
|
||||
|
||||
Thank you for your interest in contributing to WorldGuard! We appreciate your
|
||||
effort, but to make sure that the inclusion of your patch is a smooth process, we
|
||||
ask that you make note of the following guidelines.
|
||||
|
||||
* **Follow the [Oracle coding conventions](https://www.oracle.com/technetwork/java/javase/documentation/codeconvtoc-136057.html).**
|
||||
We can't stress this enough; if your code has notable issues, it may delay
|
||||
the process significantly.
|
||||
* **Target Java 16 for source and compilation.**
|
||||
* **Use only spaces for indentation.** Our indents are 4-spaces long, and tabs
|
||||
are unacceptable.
|
||||
* **Wrap code to a 89 column limit.** We do this to make side by side diffs
|
||||
and other such tasks easier. Ignore this guideline if it makes the code
|
||||
too unreadable.
|
||||
* **Write complete Javadocs.** Do so only for public methods, and make sure
|
||||
that your `@param` and `@return` fields are not just blank.
|
||||
* **Don't tag classes with @author.** Some legacy classes may have this tag,
|
||||
but we are phasing it out.
|
||||
* **Make sure the code is efficient.** One way you can achieve this is to spend
|
||||
around ten minutes to think about what the code is doing and whether it
|
||||
seems awfully roundabout. If you had to copy the same large piece of
|
||||
code in several places, that's bad.
|
||||
* **Keep commit summaries under 70 characters.** For more details, place two
|
||||
new lines after the summary line and write away!
|
||||
* **Test your code.** We're not interested in broken code, for the obvious reasons.
|
||||
* **Write unit tests.** While this is strictly optional, we recommend it for
|
||||
complicated algorithms.
|
||||
|
||||
|
||||
Checklist
|
||||
---------
|
||||
|
||||
Ready to submit? Perform the checklist below:
|
||||
|
||||
1. Have all tabs been replaced into four spaces? Are indentations 4-space wide?
|
||||
2. Have I written proper Javadocs for my public methods? Are the @param and
|
||||
@return fields actually filled out?
|
||||
3. Have I `git rebase`d my pull request to the latest commit of the target
|
||||
branch?
|
||||
4. Have I combined my commits into a reasonably small number (if not one)
|
||||
commit using `git rebase`?
|
||||
5. Have I made my pull request too large? Pull requests should introduce
|
||||
small sets of changes at a time. Major changes should be discussed with
|
||||
the team prior to starting work.
|
||||
6. Are my commit messages descriptive?
|
||||
|
||||
You should be aware of [`git rebase`](http://learn.github.com/p/rebasing.html).
|
||||
It allows you to modify existing commit messages, and combine, break apart, or
|
||||
adjust past changes.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
This is **GOOD:**
|
||||
|
||||
if (var.func(param1, param2)) {
|
||||
// do things
|
||||
}
|
||||
|
||||
This is **EXTREMELY BAD:**
|
||||
|
||||
if(var.func( param1, param2 ))
|
||||
{
|
||||
// do things
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
WorldGuard, a suite of tools for Minecraft
|
||||
Copyright (C) sk89q <http://www.sk89q.com>
|
||||
Copyright (C) WorldGuard team and contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser 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 Lesser General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+201
-165
@@ -1,165 +1,201 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser 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
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser 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
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
This work includes Robert Olofsson's Priority R-Tree implementation, for which
|
||||
its license is reproduced below.
|
||||
|
||||
Copyright (c) 2008-2010 Robert Olofsson.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the authors nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
@@ -0,0 +1,47 @@
|
||||
<h1>
|
||||
<img src="worldguard-logo.svg" alt="WorldGuard" width="400" />
|
||||
</h1>
|
||||
|
||||
WorldGuard lets you and players guard areas of land against griefers and undesirables, as well as tweak and disable various gameplay features of Minecraft.
|
||||
|
||||
* Block creeper and wither block damage, falling damage, etc.
|
||||
* Disable fire spread, lava fire spread, ice formation, Endermen picking up blocks, etc.
|
||||
* Blacklist certain items and blocks so they can't be used
|
||||
* Warn moderators when certain items and blocks are used
|
||||
* Protect areas of your world so only certain people can build in them
|
||||
* Set areas where PVP, TNT, mob damage, and other features are disabled
|
||||
* Protect your server from various 'exploits' like magical obsidian creation machines
|
||||
* Disable, or enable, various Minecraft features, like sponges from classic
|
||||
* Add useful commands like an immediate "STOP ALL FIRE SPREAD" command
|
||||
* Enable only features you want! Everything is off by default
|
||||
|
||||
WorldGuard is open source and is available under the GNU Lesser
|
||||
General Public License v3.
|
||||
|
||||
A Bukkit server implementation (such as [Paper](https://papermc.io)) and the [WorldEdit plugin](https://dev.bukkit.org/projects/worldedit) are required to use WorldGuard. You can get a release copy of WorldGuard from the [BukkitDev site](https://dev.bukkit.org/projects/worldguard).
|
||||
|
||||
Compiling
|
||||
---------
|
||||
|
||||
The project is written for Java 16 and our build process makes use of
|
||||
[Gradle](http://gradle.org).
|
||||
|
||||
Dependencies are automatically handled by Gradle.
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
We happily accept contributions, especially through pull requests on GitHub.
|
||||
|
||||
Please read CONTRIBUTING.md for important guidelines to follow.
|
||||
|
||||
Submissions must be licensed under the GNU Lesser General Public License v3.
|
||||
|
||||
Links
|
||||
-----
|
||||
|
||||
* [Homepage](http://enginehub.org/worldguard)
|
||||
* [Discord](https://discord.gg/enginehub)
|
||||
* [Issue tracker](https://github.com/EngineHub/WorldGuard/issues)
|
||||
* [Continuous integration](http://builds.enginehub.org) [](http://ci.enginehub.org/viewType.html?buildTypeId=bt11&guest=1)
|
||||
* [End-user documentation](https://worldguard.enginehub.org/en/latest/)
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
WorldGuard
|
||||
Copyright (c) 2010, 2011 sk89q <http://www.sk89q.com>
|
||||
Licensed under the GNU Lesser General Public License v3
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
WorldGuard protects your server!
|
||||
|
||||
Documentation can be found at:
|
||||
http://wiki.sk89q.com/wiki/WorldGuard
|
||||
|
||||
Thanks
|
||||
------
|
||||
|
||||
While I would like to thank everyone for their support, I would like to
|
||||
say thanks to the following individuals for their direct
|
||||
contributions to WorldGuard:
|
||||
|
||||
- Sturmeh, for contributing the original durability workaround
|
||||
- Meaglin, for changing the on flow hook at my request
|
||||
- Dinnerbone, for implementing the on item pick up hook at my request,
|
||||
and also for figuring out the durability bug in the process
|
||||
@@ -1,84 +0,0 @@
|
||||
#
|
||||
# This is the blacklist for WorldGuard. The blacklist allows you to perform
|
||||
# actions depending on an item or block ID. Comments start with # and they
|
||||
# are ignored so you can put your own notes.
|
||||
#
|
||||
# --------------------------------------------------------------------------
|
||||
#
|
||||
# WARNING:
|
||||
# Remember to check the compatibility spreadsheet for WorldGuard to see
|
||||
# if any events or actions are currently broken in your version of Bukkit.
|
||||
#
|
||||
# --------------------------------------------------------------------------
|
||||
#
|
||||
# Format:
|
||||
# [item1,item2]
|
||||
# option1=options
|
||||
# event1=whatToDo1,whatToDo2,whatToDo3
|
||||
# event2=whatToDo1,whatToDo2
|
||||
#
|
||||
# Example to block some ore mining and placement:
|
||||
# [coalore,goldore,ironore]
|
||||
# on-break=deny,log,kick
|
||||
# on-place=deny,tell
|
||||
#
|
||||
# Options:
|
||||
# - ignore-groups (comma-separated list of groups to not affect)
|
||||
# - comment (message for yourself that is printed with 'log' and 'notify')
|
||||
# - message (optional message to show the user instead; %s is the item name)
|
||||
#
|
||||
# Events:
|
||||
# - on-break (when a block of this type is about to be broken)
|
||||
# - on-destroy-with (the item/block held by the user while destroying)
|
||||
# - on-place (a block is being placed)
|
||||
# - on-use (an item like flint and steel or a bucket is being used)
|
||||
# - on-interact (when a block in used (doors, chests, etc.))
|
||||
# - on-drop (an item is being dropped from the player's inventory)
|
||||
# - on-acquire (an item enters a player's inventory via some method)
|
||||
#
|
||||
# Actions (for events):
|
||||
# - deny (deny completely)
|
||||
# - notify (notify admins)
|
||||
# - log (log to console/file/database)
|
||||
# - tell (tell a player that that's not allowed)
|
||||
# - kick (kick player)
|
||||
# - ban (ban player)
|
||||
#
|
||||
# Users with the /worldguardnotify permission will receive notifications.
|
||||
#
|
||||
# -------------
|
||||
#
|
||||
# You can have the same block or item used in two different sections and
|
||||
# they will both apply:
|
||||
#
|
||||
# [goldblock]
|
||||
# ignore-groups=vip
|
||||
# on-break=deny
|
||||
# [goldblock]
|
||||
# ignore-groups=admins
|
||||
# on-break=tell
|
||||
#
|
||||
# However, some events override others. For example, if you disable both
|
||||
# usage of the diamond pickaxe (with the on-destroy-with event) and
|
||||
# destruction of gold blocks (with the on-break event) and a player tries
|
||||
# to destroy a gold block with a diamond pickaxe, because the
|
||||
# on-destroy-with event comes first, the rules for the gold block
|
||||
# will not be applied (but the player will be denied nevertheless).
|
||||
#
|
||||
# --------------------------------------------------------------------------
|
||||
#
|
||||
# Some examples follow.
|
||||
#
|
||||
# REMEMBER: If a line has # in front, it will be ignored.
|
||||
#
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
# Deny lava buckets
|
||||
#[lavabucket]
|
||||
#ignore-groups=admins,mods
|
||||
#on-use=deny,tell
|
||||
|
||||
# Deny some ore
|
||||
#[coalore,goldore,ironore]
|
||||
#ignore-groups=admins,mods
|
||||
#on-break=notify,deny,log
|
||||
@@ -0,0 +1,26 @@
|
||||
import org.ajoberstar.grgit.Grgit
|
||||
|
||||
logger.lifecycle("""
|
||||
*******************************************
|
||||
You are building WorldGuard!
|
||||
If you encounter trouble:
|
||||
1) Try running 'build' in a separate Gradle run
|
||||
2) Use gradlew and not gradle
|
||||
3) If you still need help, ask on Discord! https://discord.gg/enginehub
|
||||
|
||||
Output files will be in [subproject]/build/libs
|
||||
*******************************************
|
||||
""")
|
||||
|
||||
applyRootArtifactoryConfig()
|
||||
|
||||
if (!project.hasProperty("gitCommitHash")) {
|
||||
apply(plugin = "org.ajoberstar.grgit")
|
||||
ext["gitCommitHash"] = try {
|
||||
Grgit.open(mapOf("currentDir" to project.rootDir))?.head()?.abbreviatedId
|
||||
} catch (e: Exception) {
|
||||
logger.warn("Error getting commit hash", e)
|
||||
|
||||
"no.git.id"
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
<project name="WorldGuard" default="dist" basedir=".">
|
||||
<description>WorldGuard fixes bugs with Minecraft SMP and provides for
|
||||
protection.</description>
|
||||
|
||||
<property name="src.dir" location="src"/>
|
||||
<property name="build.dir" location="build"/>
|
||||
<property name="dist.dir" location="dist"/>
|
||||
<property name="release.dir" location="release"/>
|
||||
<property name="lib.dir" location="lib"/>
|
||||
<property name="docs.dir" location="docs"/>
|
||||
|
||||
<fileset id="libs" dir="${lib.dir}">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
|
||||
<target name="init">
|
||||
<mkdir dir="${build.dir}"/>
|
||||
</target>
|
||||
|
||||
<!-- Compile the source files -->
|
||||
<target name="compile" depends="init">
|
||||
<javac srcdir="${src.dir}" deprecation="true" includeantruntime="true" destdir="${build.dir}" debug="true">
|
||||
<classpath>
|
||||
<fileset refid="libs"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<!-- Build the .jar -->
|
||||
<target name="jar" depends="compile">
|
||||
<mkdir dir="${dist.dir}"/>
|
||||
<manifest file="manifest.mf" mode="replace">
|
||||
<attribute name="Implementation-Title" value="WorldGuard"/>
|
||||
<attribute name="Implementation-Version" value="${version}"/>
|
||||
<attribute name="WorldGuard-Version" value="${version}"/>
|
||||
<attribute name="Class-Path" value="WorldEdit.jar WorldGuard/WorldEdit.jar"/>
|
||||
</manifest>
|
||||
<delete file="${build.dir}/plugin.yml"/>
|
||||
<copy tofile="${build.dir}/plugin.yml" file="plugin.yml"/>
|
||||
<replace file="${build.dir}/plugin.yml" token="WGVERSIONMACRO" value="${version}"/>
|
||||
<mkdir dir="${build.dir}/defaults"/>
|
||||
<copy tofile="${build.dir}/defaults/config.yml" file="config.yml"/>
|
||||
<copy tofile="${build.dir}/defaults/blacklist.txt" file="blacklist.txt"/>
|
||||
<jar jarfile="${dist.dir}/WorldGuard.jar" basedir="${build.dir}" manifest="manifest.mf"/>
|
||||
</target>
|
||||
|
||||
<!-- Create the .jar -->
|
||||
<target name="dist">
|
||||
<property name="version" value="nightly"/>
|
||||
<antcall target="jar"/>
|
||||
</target>
|
||||
|
||||
<!-- Build a release -->
|
||||
<target name="release">
|
||||
<input message="Enter version:" addproperty="version"/>
|
||||
<antcall target="jar"/>
|
||||
<delete dir="${release.dir}"/>
|
||||
<mkdir dir="${release.dir}"/>
|
||||
<copy tofile="${release.dir}/README.txt" file="README.txt"/>
|
||||
<copy tofile="${release.dir}/LICENSE.txt" file="LICENSE.txt"/>
|
||||
<copy tofile="${release.dir}/CHANGELOG.txt" file="CHANGELOG.txt"/>
|
||||
<copy tofile="${release.dir}/blacklist_table.sql" file="blacklist_table.sql"/>
|
||||
<copy tofile="${release.dir}/WorldGuard.jar" file="${dist.dir}/WorldGuard.jar"/>
|
||||
<zip destfile="${release.dir}/worldguard-${version}.zip" basedir="${release.dir}" excludes="*.zip plugin.yml"/>
|
||||
<mkdir dir="${release.dir}/src"/>
|
||||
<copy todir="${release.dir}/src">
|
||||
<fileset dir="${src.dir}"/>
|
||||
</copy>
|
||||
<zip destfile="${release.dir}/worldguard-${version}-src.zip" basedir="${release.dir}" excludes="*.zip plugin.yml"/>
|
||||
</target>
|
||||
|
||||
<!-- Javadoc -->
|
||||
<target name="javadoc">
|
||||
<javadoc access="public" author="true" destdir="${docs.dir}" doctitle="WorldGuard API" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" source="1.6" sourcepath="src" splitindex="true" use="true" version="true">
|
||||
<classpath>
|
||||
<fileset refid="libs"/>
|
||||
</classpath>
|
||||
</javadoc>
|
||||
</target>
|
||||
|
||||
<!-- Clean the output -->
|
||||
<target name="clean">
|
||||
<delete dir="${build.dir}"/>
|
||||
<delete dir="${dist.dir}"/>
|
||||
<delete dir="${release.dir}"/>
|
||||
<delete dir="${docs.dir}"/>
|
||||
</target>
|
||||
|
||||
<!--<target name="-get-version-git" if="git-revision">
|
||||
<sequential>
|
||||
<exec executable="git" failifexecutionfails="false" outputproperty="git-revision">
|
||||
<arg value="rev-parse"/>
|
||||
<arg value="HEAD"/>
|
||||
</exec>
|
||||
<exec executable="git" outputproperty="git-revision-dirty">
|
||||
<arg value="diff"/>
|
||||
<arg value="- -shortstat"/>
|
||||
</exec>
|
||||
<condition else="dev-${git-revision}-modified" property="version" value="dev-${git-revision}">
|
||||
<equals arg1="" arg2="${git-revision-dirty}"/>
|
||||
</condition>
|
||||
</sequential>
|
||||
</target>-->
|
||||
</project>
|
||||
@@ -0,0 +1,17 @@
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
kotlin("jvm") version embeddedKotlinVersion
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(gradleApi())
|
||||
implementation("gradle.plugin.org.cadixdev.gradle:licenser:0.6.1")
|
||||
implementation("org.ajoberstar.grgit:grgit-gradle:4.1.0")
|
||||
implementation("com.github.jengelman.gradle.plugins:shadow:6.1.0")
|
||||
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.21.0")
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.named
|
||||
import org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention
|
||||
import org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask
|
||||
|
||||
private const val ARTIFACTORY_CONTEXT_URL = "artifactory_contextUrl"
|
||||
private const val ARTIFACTORY_USER = "artifactory_user"
|
||||
private const val ARTIFACTORY_PASSWORD = "artifactory_password"
|
||||
|
||||
fun Project.applyRootArtifactoryConfig() {
|
||||
if (!project.hasProperty(ARTIFACTORY_CONTEXT_URL)) ext[ARTIFACTORY_CONTEXT_URL] = "http://localhost"
|
||||
if (!project.hasProperty(ARTIFACTORY_USER)) ext[ARTIFACTORY_USER] = "guest"
|
||||
if (!project.hasProperty(ARTIFACTORY_PASSWORD)) ext[ARTIFACTORY_PASSWORD] = ""
|
||||
|
||||
apply(plugin = "com.jfrog.artifactory")
|
||||
configure<ArtifactoryPluginConvention> {
|
||||
setContextUrl("${project.property(ARTIFACTORY_CONTEXT_URL)}")
|
||||
clientConfig.publisher.run {
|
||||
repoKey = when {
|
||||
"${project.version}".contains("SNAPSHOT") -> "libs-snapshot-local"
|
||||
else -> "libs-release-local"
|
||||
}
|
||||
username = "${project.property(ARTIFACTORY_USER)}"
|
||||
password = "${project.property(ARTIFACTORY_PASSWORD)}"
|
||||
isMaven = true
|
||||
isIvy = false
|
||||
}
|
||||
}
|
||||
tasks.named<ArtifactoryTask>("artifactoryPublish") {
|
||||
isSkip = true
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.applyCommonArtifactoryConfig() {
|
||||
tasks.named<ArtifactoryTask>("artifactoryPublish") {
|
||||
publications("maven")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import org.cadixdev.gradle.licenser.LicenseExtension
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.JavaPluginExtension
|
||||
import org.gradle.jvm.toolchain.JavaLanguageVersion
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.repositories
|
||||
import org.gradle.kotlin.dsl.the
|
||||
|
||||
fun Project.applyCommonConfiguration() {
|
||||
group = rootProject.group
|
||||
version = rootProject.version
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = uri("https://maven.enginehub.org/repo/") }
|
||||
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
cacheChangingModulesFor(5, "MINUTES")
|
||||
}
|
||||
}
|
||||
|
||||
plugins.withId("java") {
|
||||
the<JavaPluginExtension>().toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(16))
|
||||
}
|
||||
}
|
||||
|
||||
apply(plugin = "org.cadixdev.licenser")
|
||||
configure<LicenseExtension> {
|
||||
header(rootProject.file("HEADER.txt"))
|
||||
include("**/*.java")
|
||||
include("**/*.kt")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.ExtraPropertiesExtension
|
||||
import org.gradle.api.plugins.JavaPluginConvention
|
||||
import org.gradle.api.tasks.SourceSetContainer
|
||||
import org.gradle.kotlin.dsl.getByType
|
||||
import org.gradle.kotlin.dsl.the
|
||||
|
||||
val Project.ext: ExtraPropertiesExtension
|
||||
get() = extensions.getByType()
|
||||
|
||||
val Project.sourceSets: SourceSetContainer
|
||||
get() = the<JavaPluginConvention>().sourceSets
|
||||
@@ -0,0 +1,171 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.ModuleDependency
|
||||
import org.gradle.api.attributes.Bundling
|
||||
import org.gradle.api.attributes.Category
|
||||
import org.gradle.api.attributes.DocsType
|
||||
import org.gradle.api.attributes.LibraryElements
|
||||
import org.gradle.api.attributes.Usage
|
||||
import org.gradle.api.attributes.java.TargetJvmVersion
|
||||
import org.gradle.api.component.AdhocComponentWithVariants
|
||||
import org.gradle.api.component.SoftwareComponentFactory
|
||||
import org.gradle.api.publish.PublishingExtension
|
||||
import org.gradle.api.publish.maven.MavenPublication
|
||||
import org.gradle.api.tasks.bundling.Jar
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.get
|
||||
import org.gradle.kotlin.dsl.invoke
|
||||
import org.gradle.kotlin.dsl.named
|
||||
import org.gradle.kotlin.dsl.register
|
||||
import javax.inject.Inject
|
||||
|
||||
fun Project.applyLibrariesConfiguration() {
|
||||
applyCommonConfiguration()
|
||||
apply(plugin = "java-base")
|
||||
apply(plugin = "maven-publish")
|
||||
apply(plugin = "com.github.johnrengelman.shadow")
|
||||
apply(plugin = "com.jfrog.artifactory")
|
||||
|
||||
configurations {
|
||||
create("shade")
|
||||
}
|
||||
|
||||
group = "${rootProject.group}.worldguard-libs"
|
||||
|
||||
val relocations = mapOf(
|
||||
"org.enginehub.squirrelid" to "com.sk89q.worldguard.util.profile"
|
||||
)
|
||||
|
||||
tasks.register<ShadowJar>("jar") {
|
||||
configurations = listOf(project.configurations["shade"])
|
||||
archiveClassifier.set("")
|
||||
|
||||
dependencies {
|
||||
exclude(dependency("com.google.code.findbugs:jsr305"))
|
||||
}
|
||||
|
||||
relocations.forEach { (from, to) ->
|
||||
relocate(from, to)
|
||||
}
|
||||
}
|
||||
val altConfigFiles = { artifactType: String ->
|
||||
val deps = configurations["shade"].incoming.dependencies
|
||||
.filterIsInstance<ModuleDependency>()
|
||||
.map { it.copy() }
|
||||
.map { dependency ->
|
||||
dependency.artifact {
|
||||
name = dependency.name
|
||||
type = artifactType
|
||||
extension = "jar"
|
||||
classifier = artifactType
|
||||
}
|
||||
dependency
|
||||
}
|
||||
|
||||
files(configurations.detachedConfiguration(*deps.toTypedArray())
|
||||
.resolvedConfiguration.lenientConfiguration.artifacts
|
||||
.filter { it.classifier == artifactType }
|
||||
.map { zipTree(it.file) })
|
||||
}
|
||||
tasks.register<Jar>("sourcesJar") {
|
||||
from({
|
||||
altConfigFiles("sources")
|
||||
})
|
||||
relocations.forEach { (from, to) ->
|
||||
val filePattern = Regex("(.*)${from.replace('.', '/')}((?:/|$).*)")
|
||||
val textPattern = Regex.fromLiteral(from)
|
||||
eachFile {
|
||||
filter {
|
||||
it.replaceFirst(textPattern, to)
|
||||
}
|
||||
path = path.replaceFirst(filePattern, "$1${to.replace('.', '/')}$2")
|
||||
}
|
||||
}
|
||||
archiveClassifier.set("sources")
|
||||
}
|
||||
|
||||
tasks.named("assemble").configure {
|
||||
dependsOn("jar", "sourcesJar")
|
||||
}
|
||||
|
||||
project.apply<LibsConfigPluginHack>()
|
||||
|
||||
val libsComponent = project.components["libs"] as AdhocComponentWithVariants
|
||||
|
||||
val apiElements = project.configurations.register("apiElements") {
|
||||
isVisible = false
|
||||
description = "API elements for libs"
|
||||
isCanBeResolved = false
|
||||
isCanBeConsumed = true
|
||||
attributes {
|
||||
attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage.JAVA_API))
|
||||
attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category.LIBRARY))
|
||||
attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling.SHADOWED))
|
||||
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements.JAR))
|
||||
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 8)
|
||||
}
|
||||
outgoing.artifact(tasks.named("jar"))
|
||||
}
|
||||
|
||||
val runtimeElements = project.configurations.register("runtimeElements") {
|
||||
isVisible = false
|
||||
description = "Runtime elements for libs"
|
||||
isCanBeResolved = false
|
||||
isCanBeConsumed = true
|
||||
attributes {
|
||||
attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage.JAVA_RUNTIME))
|
||||
attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category.LIBRARY))
|
||||
attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling.SHADOWED))
|
||||
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements.JAR))
|
||||
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 8)
|
||||
}
|
||||
outgoing.artifact(tasks.named("jar"))
|
||||
}
|
||||
|
||||
val sourcesElements = project.configurations.register("sourcesElements") {
|
||||
isVisible = false
|
||||
description = "Source elements for libs"
|
||||
isCanBeResolved = false
|
||||
isCanBeConsumed = true
|
||||
attributes {
|
||||
attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage.JAVA_RUNTIME))
|
||||
attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category.DOCUMENTATION))
|
||||
attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling.SHADOWED))
|
||||
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, project.objects.named(DocsType.SOURCES))
|
||||
}
|
||||
outgoing.artifact(tasks.named("sourcesJar"))
|
||||
}
|
||||
|
||||
libsComponent.addVariantsFromConfiguration(apiElements.get()) {
|
||||
mapToMavenScope("compile")
|
||||
}
|
||||
|
||||
libsComponent.addVariantsFromConfiguration(runtimeElements.get()) {
|
||||
mapToMavenScope("runtime")
|
||||
}
|
||||
|
||||
libsComponent.addVariantsFromConfiguration(sourcesElements.get()) {
|
||||
mapToMavenScope("runtime")
|
||||
}
|
||||
|
||||
configure<PublishingExtension> {
|
||||
publications {
|
||||
register<MavenPublication>("maven") {
|
||||
from(libsComponent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
applyCommonArtifactoryConfig()
|
||||
}
|
||||
|
||||
internal open class LibsConfigPluginHack @Inject constructor(
|
||||
private val softwareComponentFactory: SoftwareComponentFactory
|
||||
) : Plugin<Project> {
|
||||
override fun apply(project: Project) {
|
||||
val libsComponents = softwareComponentFactory.adhoc("libs")
|
||||
project.components.add(libsComponents)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.component.AdhocComponentWithVariants
|
||||
import org.gradle.api.plugins.JavaPluginExtension
|
||||
import org.gradle.api.plugins.quality.CheckstyleExtension
|
||||
import org.gradle.api.publish.PublishingExtension
|
||||
import org.gradle.api.publish.maven.MavenPublication
|
||||
import org.gradle.api.tasks.javadoc.Javadoc
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
import org.gradle.external.javadoc.StandardJavadocDocletOptions
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.dependencies
|
||||
import org.gradle.kotlin.dsl.get
|
||||
import org.gradle.kotlin.dsl.named
|
||||
import org.gradle.kotlin.dsl.register
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
import org.gradle.kotlin.dsl.the
|
||||
|
||||
fun Project.applyPlatformAndCoreConfiguration() {
|
||||
applyCommonConfiguration()
|
||||
apply(plugin = "java")
|
||||
apply(plugin = "eclipse")
|
||||
apply(plugin = "idea")
|
||||
apply(plugin = "maven-publish")
|
||||
apply(plugin = "checkstyle")
|
||||
apply(plugin = "com.jfrog.artifactory")
|
||||
|
||||
ext["internalVersion"] = "$version+${rootProject.ext["gitCommitHash"]}"
|
||||
|
||||
configure<CheckstyleExtension> {
|
||||
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
|
||||
toolVersion = "8.34"
|
||||
}
|
||||
|
||||
tasks.withType<Test>().configureEach {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
"compileOnly"("com.google.code.findbugs:jsr305:3.0.2")
|
||||
"testCompileOnly"("com.google.code.findbugs:jsr305:3.0.2")
|
||||
"testImplementation"("org.junit.jupiter:junit-jupiter-api:${Versions.JUNIT}")
|
||||
"testImplementation"("org.junit.jupiter:junit-jupiter-params:${Versions.JUNIT}")
|
||||
"testImplementation"("org.mockito:mockito-core:${Versions.MOCKITO}")
|
||||
"testImplementation"("org.mockito:mockito-junit-jupiter:${Versions.MOCKITO}")
|
||||
"testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT}")
|
||||
}
|
||||
|
||||
// Java 8 turns on doclint which we fail
|
||||
tasks.withType<Javadoc>().configureEach {
|
||||
(options as StandardJavadocDocletOptions).apply {
|
||||
addStringOption("Xdoclint:none", "-quiet")
|
||||
tags(
|
||||
"apiNote:a:API Note:",
|
||||
"implSpec:a:Implementation Requirements:",
|
||||
"implNote:a:Implementation Note:"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
the<JavaPluginExtension>().withJavadocJar()
|
||||
|
||||
if (name == "worldguard-core" || name == "worldguard-bukkit") {
|
||||
the<JavaPluginExtension>().withSourcesJar()
|
||||
}
|
||||
|
||||
tasks.named("check").configure {
|
||||
dependsOn("checkstyleMain", "checkstyleTest")
|
||||
}
|
||||
|
||||
configure<PublishingExtension> {
|
||||
publications {
|
||||
register<MavenPublication>("maven") {
|
||||
from(components["java"])
|
||||
versionMapping {
|
||||
usage("java-api") {
|
||||
fromResolutionOf("runtimeClasspath")
|
||||
}
|
||||
usage("java-runtime") {
|
||||
fromResolutionResult()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
applyCommonArtifactoryConfig()
|
||||
}
|
||||
|
||||
fun Project.applyShadowConfiguration() {
|
||||
apply(plugin = "com.github.johnrengelman.shadow")
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
archiveClassifier.set("dist")
|
||||
dependencies {
|
||||
include(project(":worldguard-libs:core"))
|
||||
//include(project(":worldguard-libs:${project.name.replace("worldguard-", "")}"))
|
||||
include(project(":worldguard-core"))
|
||||
|
||||
relocate("org.flywaydb", "com.sk89q.worldguard.internal.flywaydb") {
|
||||
include(dependency("org.flywaydb:flyway-core:3.0"))
|
||||
}
|
||||
exclude("com.google.code.findbugs:jsr305")
|
||||
}
|
||||
exclude("GradleStart**")
|
||||
exclude(".cache")
|
||||
exclude("LICENSE*")
|
||||
}
|
||||
val javaComponent = components["java"] as AdhocComponentWithVariants
|
||||
javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
|
||||
skip()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
object Versions {
|
||||
// const val PISTON = "0.4.3"
|
||||
// const val AUTO_VALUE = "1.6.5"
|
||||
const val WORLDEDIT = "7.2.7"
|
||||
const val JUNIT = "5.7.0"
|
||||
const val SQUIRRELID = "0.3.0"
|
||||
const val GUAVA = "31.0.1-jre"
|
||||
const val MOCKITO = "3.7.7"
|
||||
}
|
||||
-98
@@ -1,98 +0,0 @@
|
||||
#
|
||||
# WorldGuard's configuration file
|
||||
#
|
||||
# About editing this file:
|
||||
# - DO NOT USE TABS. You MUST use spaces or Bukkit will complain. If
|
||||
# you use an editor like Notepad++ (recommended for Windows users), you
|
||||
# must configure it to "replace tabs with spaces." In Notepad++, this can
|
||||
# be changed in Settings > Preferences > Language Menu.
|
||||
# - Don't get rid of the indents. They are indented so some entries are
|
||||
# in categories (like "enforce-single-session" is in the "protection"
|
||||
# category.
|
||||
# - If you want to check the format of this file before putting it
|
||||
# into WorldGuard, paste it into http://yaml-online-parser.appspot.com/
|
||||
# and see if it gives "ERROR:".
|
||||
# - Lines starting with # are commentsand so they are ignored.
|
||||
#
|
||||
# WARNING:
|
||||
# Remember to check the compatibility spreadsheet for WorldGuard to see
|
||||
# if any features are currently broken in your version of Bukkit.
|
||||
#
|
||||
|
||||
summary-on-start: on
|
||||
|
||||
protection:
|
||||
enforce-single-session: on
|
||||
item-durability: on
|
||||
|
||||
simulation:
|
||||
classic-water: off
|
||||
sponge:
|
||||
enable: on
|
||||
radius: 3
|
||||
|
||||
physics:
|
||||
no-physics-gravel: off
|
||||
no-physics-sand: off
|
||||
allow-portal-anywhere: off
|
||||
disable-water-damage-blocks: []
|
||||
|
||||
ignition:
|
||||
block-tnt: off
|
||||
block-lighter: off
|
||||
|
||||
fire:
|
||||
disable-all-fire-spread: off
|
||||
disable-fire-spread-blocks: []
|
||||
disable-lava-fire-spread: on
|
||||
lava-spread-blocks: []
|
||||
|
||||
mobs:
|
||||
block-creeper-explosions: off
|
||||
block-creeper-block-damage: off
|
||||
|
||||
spawn:
|
||||
login-protection: 3
|
||||
spawn-protection: 0
|
||||
kick-on-death: off
|
||||
exact-respawn: off
|
||||
teleport-to-home-on-death: off
|
||||
|
||||
player-damage:
|
||||
disable-fall-damage: off
|
||||
disable-lava-damage: off
|
||||
disable-fire-damage: off
|
||||
disable-drowning-damage: off
|
||||
disable-suffocation-damage: off
|
||||
disable-contact-damage: off
|
||||
teleport-on-suffocation: off
|
||||
|
||||
regions:
|
||||
enable: on
|
||||
wand: 287
|
||||
default:
|
||||
build: true
|
||||
chest-access: false
|
||||
|
||||
blacklist:
|
||||
logging:
|
||||
console:
|
||||
enable: on
|
||||
database:
|
||||
enable: off
|
||||
dsn: jdbc:mysql://localhost:3306/minecraft
|
||||
user: root
|
||||
password: pass
|
||||
table: blacklist_events
|
||||
file:
|
||||
enable: on
|
||||
path: worldguard/logs/%Y-%m-%d.log
|
||||
open-files: 10
|
||||
|
||||
# See http://wiki.sk89q.com/wiki/WorldGuard/Permissions/Bukkit
|
||||
permissions:
|
||||
users:
|
||||
sk89q:
|
||||
permissions:
|
||||
- /region
|
||||
- /reloadwg
|
||||
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
||||
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
|
||||
<module name="Checker">
|
||||
<!-- Tabs are strictly banned -->
|
||||
<module name="FileTabCharacter"/>
|
||||
|
||||
<module name="SuppressionFilter">
|
||||
<property name="file" value="${config_loc}/suppressions.xml"/>
|
||||
</module>
|
||||
|
||||
|
||||
|
||||
<module name="TreeWalker">
|
||||
<!-- Important basics -->
|
||||
<!-- <module name="PackageDeclaration"/> Unlikely that we would miss this in a PR -->
|
||||
<module name="OuterTypeFilename"/> <!-- TypeName -> TypeName.java -->
|
||||
|
||||
<!--
|
||||
Control package usage, so people don't insert Bukkit into WG where it shouldn't belong, etc.
|
||||
It is a bit draconian, so update as necessary!
|
||||
-->
|
||||
<module name="ImportControl">
|
||||
<property name="file" value="${config_loc}/import-control.xml"/>
|
||||
</module>
|
||||
|
||||
<!-- Code -->
|
||||
<module name="HideUtilityClassConstructor"/> <!-- Utility classes should not have a constructor -->
|
||||
<module name="CovariantEquals"/>
|
||||
<module name="EqualsHashCode"/> <!-- equals() and hashCode() go together -->
|
||||
<module name="NestedTryDepth"> <!-- SHOULD not need to adjust this -->
|
||||
<property name="max" value="2"/>
|
||||
</module>
|
||||
<module name="SuperFinalize"/> <!-- We don't actually use this -->
|
||||
|
||||
<!-- Style -->
|
||||
<module name="LeftCurly"> <!-- Left brace never goes on another line -->
|
||||
<property name="option" value="eol"/>
|
||||
</module> <!-- We don't check right brace -->
|
||||
<module name="DefaultComesLast"/> <!-- default case in switch should be last -->
|
||||
<module name="GenericWhitespace"/>
|
||||
|
||||
<!-- Naming -->
|
||||
<module name="ClassTypeParameterName">
|
||||
<property name="format" value="^[A-Z][a-zA-Z0-9]*$"/>
|
||||
</module>
|
||||
<module name="LocalFinalVariableName"/>
|
||||
<module name="LocalVariableName">
|
||||
<property name="format" value="^[a-z_][a-zA-Z0-9]*$"/>
|
||||
</module>
|
||||
<module name="MemberName">
|
||||
<property name="format" value="^[a-z_][a-zA-Z0-9]*$"/>
|
||||
</module>
|
||||
<module name="MethodName">
|
||||
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
|
||||
</module>
|
||||
<!-- <module name="PackageName"/> Unlikely that we would miss this in a PR -->
|
||||
<module name="ParameterName"/>
|
||||
<!-- <module name="TypeName"/> Unlikely that we would miss this in a PR -->
|
||||
</module>
|
||||
|
||||
</module>
|
||||
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE import-control PUBLIC
|
||||
"-//Puppy Crawl//DTD Import Control 1.1//EN"
|
||||
"http://www.puppycrawl.com/dtds/import_control_1_1.dtd">
|
||||
|
||||
<import-control pkg="com.sk89q">
|
||||
<allow pkg="java"/>
|
||||
<allow pkg="javax"/>
|
||||
<allow pkg="org.junit"/>
|
||||
<allow pkg="org.hamcrest"/>
|
||||
<allow pkg="org.mockito"/>
|
||||
<allow pkg="junit.framework"/>
|
||||
<allow pkg="com.sk89q"/>
|
||||
<allow pkg="com.google.common"/>
|
||||
|
||||
<subpackage name="worldguard">
|
||||
<allow pkg="org.khelekore"/>
|
||||
<allow pkg="org.flywaydb"/>
|
||||
<allow pkg="org.yaml"/>
|
||||
<allow pkg="org.enginehub.piston"/>
|
||||
|
||||
<subpackage name="util.profile.resolver">
|
||||
<allow pkg="org.bukkit"/>
|
||||
<allow pkg="io.papermc.lib"/>
|
||||
<allow pkg="com.destroystokyo.paper"/>
|
||||
</subpackage>
|
||||
|
||||
<subpackage name="bukkit">
|
||||
<allow pkg="org.bukkit"/>
|
||||
<allow pkg="org.bstats.bukkit"/>
|
||||
<allow pkg="org.bstats.charts"/>
|
||||
<allow pkg="io.papermc.lib"/>
|
||||
<allow pkg="com.destroystokyo.paper"/>
|
||||
<allow pkg="co.aikar.timings.lib" />
|
||||
<allow pkg="org.spigotmc" />
|
||||
</subpackage>
|
||||
|
||||
</subpackage>
|
||||
|
||||
</import-control>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE suppressions PUBLIC
|
||||
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
|
||||
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
|
||||
<suppressions>
|
||||
<suppress files="ProtectedRegion.java" checks="EqualsHashCode"/>
|
||||
</suppressions>
|
||||
@@ -0,0 +1,2 @@
|
||||
group=com.sk89q.worldguard
|
||||
version=7.0.7
|
||||
Vendored
BIN
Binary file not shown.
+5
@@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -0,0 +1,234 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# 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
|
||||
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
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
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
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$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
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# 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
+89
@@ -0,0 +1,89 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project default="javadoc">
|
||||
<target name="javadoc">
|
||||
<javadoc access="public" author="true" classpath="P:\Projects\Minecraft\Libraries\GroupUsers.jar;P:\Projects\Minecraft\Libraries\jnbt.jar;P:\Projects\Minecraft\hMod\build\classes;P:\Projects\Minecraft\WorldEdit\build\classes;P:\Projects\Minecraft\Libraries\snakeyaml.jar;P:\Projects\Minecraft\Libraries\jopt-simple-3.2.jar;P:\Projects\Minecraft\Libraries\Permissions.jar;C:\Program Files\eclipse\plugins\org.hamcrest.core_1.1.0.v20090501071000.jar;P:\Projects\Minecraft\Libraries\json_simple-1.1.jar;P:\Projects\Minecraft\CraftBukkit\bin;P:\Projects\Minecraft\Libraries\truezip.jar;C:\Program Files\eclipse\plugins\org.junit_4.8.1.v4_8_1_v20100427-1100\junit.jar;P:\Projects\Minecraft\Bukkit\bin;P:\Projects\Minecraft\mc-dev" destdir="doc" doctitle="Worldguard API" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" packagenames="com.sk89q.worldguard.blacklist,com.sk89q.worldguard.domains,com.sk89q.worldguard.bukkit,com.sk89q.worldguard.protection,com.sk89q.worldguard.util,au.com.bytecode.opencsv,com.sk89q.worldguard,com.sk89q.worldguard.blacklist.loggers,com.sk89q.worldguard.blacklist.events" source="1.6" sourcepath="tests;src" splitindex="true" use="true" version="true"/>
|
||||
</target>
|
||||
</project>
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
name: WorldGuard
|
||||
main: com.sk89q.worldguard.bukkit.WorldGuardPlugin
|
||||
version: WGVERSIONMACRO
|
||||
commands:
|
||||
stopfire:
|
||||
description: Halts all fire spread until it is disabled or the server is restarted
|
||||
usage: /<command>
|
||||
allowfire:
|
||||
description: Re-enables fire spread if he has been disabled with /stopfire
|
||||
usage: /<command>
|
||||
god:
|
||||
description: Toggles god mode
|
||||
usage: /<command> [other player]
|
||||
heal:
|
||||
description: Heal yourself or another
|
||||
usage: /<command> [other player]
|
||||
slay:
|
||||
description: Slay yourself or another
|
||||
usage: /<command> [other player]
|
||||
stack:
|
||||
description: Stacks items in the player's inventory
|
||||
usage: /<command>
|
||||
aliases: ;
|
||||
region:
|
||||
description: Adjust protected regions
|
||||
usage: /<command> <define|claim|setparent|flag|delete|info|addowner|removeowner|addmember|removemember|list|save|load> ...
|
||||
aliases: rg, regions
|
||||
locate:
|
||||
description: Set your compass towards a person
|
||||
usage: /<command> <target>
|
||||
reloadwg:
|
||||
description: Reload WorldGuard's configuration
|
||||
usage: /<command>
|
||||
@@ -0,0 +1,7 @@
|
||||
rootProject.name = "worldguard"
|
||||
|
||||
include("worldguard-libs")
|
||||
include("worldguard-libs:core")
|
||||
include("worldguard-core")
|
||||
//include("worldguard-libs:bukkit")
|
||||
include("worldguard-bukkit")
|
||||
@@ -1,307 +0,0 @@
|
||||
/**
|
||||
Copyright 2005 Bytecode Pty Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package au.com.bytecode.opencsv;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A very simple CSV parser released under a commercial-friendly license.
|
||||
* This just implements splitting a single line into fields.
|
||||
*
|
||||
* @author Glen Smith
|
||||
* @author Rainer Pruy
|
||||
*
|
||||
*/
|
||||
public class CSVParser {
|
||||
|
||||
private final char separator;
|
||||
|
||||
private final char quotechar;
|
||||
|
||||
private final char escape;
|
||||
|
||||
private final boolean strictQuotes;
|
||||
|
||||
private String pending;
|
||||
private boolean inField = false;
|
||||
|
||||
private final boolean ignoreLeadingWhiteSpace;
|
||||
|
||||
/** The default separator to use if none is supplied to the constructor. */
|
||||
public static final char DEFAULT_SEPARATOR = ',';
|
||||
|
||||
public static final int INITIAL_READ_SIZE = 128;
|
||||
|
||||
/**
|
||||
* The default quote character to use if none is supplied to the
|
||||
* constructor.
|
||||
*/
|
||||
public static final char DEFAULT_QUOTE_CHARACTER = '"';
|
||||
|
||||
|
||||
/**
|
||||
* The default escape character to use if none is supplied to the
|
||||
* constructor.
|
||||
*/
|
||||
public static final char DEFAULT_ESCAPE_CHARACTER = '\\';
|
||||
|
||||
/**
|
||||
* The default strict quote behavior to use if none is supplied to the
|
||||
* constructor
|
||||
*/
|
||||
public static final boolean DEFAULT_STRICT_QUOTES = false;
|
||||
|
||||
/**
|
||||
* The default leading whitespace behavior to use if none is supplied to the
|
||||
* constructor
|
||||
*/
|
||||
public static final boolean DEFAULT_IGNORE_LEADING_WHITESPACE = true;
|
||||
|
||||
/**
|
||||
* Constructs CSVParser using a comma for the separator.
|
||||
*/
|
||||
public CSVParser() {
|
||||
this(DEFAULT_SEPARATOR, DEFAULT_QUOTE_CHARACTER, DEFAULT_ESCAPE_CHARACTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs CSVParser with supplied separator.
|
||||
* @param separator
|
||||
* the delimiter to use for separating entries.
|
||||
*/
|
||||
public CSVParser(char separator) {
|
||||
this(separator, DEFAULT_QUOTE_CHARACTER, DEFAULT_ESCAPE_CHARACTER);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructs CSVParser with supplied separator and quote char.
|
||||
* @param separator
|
||||
* the delimiter to use for separating entries
|
||||
* @param quotechar
|
||||
* the character to use for quoted elements
|
||||
*/
|
||||
public CSVParser(char separator, char quotechar) {
|
||||
this(separator, quotechar, DEFAULT_ESCAPE_CHARACTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs CSVReader with supplied separator and quote char.
|
||||
* @param separator
|
||||
* the delimiter to use for separating entries
|
||||
* @param quotechar
|
||||
* the character to use for quoted elements
|
||||
* @param escape
|
||||
* the character to use for escaping a separator or quote
|
||||
*/
|
||||
public CSVParser(char separator, char quotechar, char escape) {
|
||||
this(separator, quotechar, escape, DEFAULT_STRICT_QUOTES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs CSVReader with supplied separator and quote char.
|
||||
* Allows setting the "strict quotes" flag
|
||||
* @param separator
|
||||
* the delimiter to use for separating entries
|
||||
* @param quotechar
|
||||
* the character to use for quoted elements
|
||||
* @param escape
|
||||
* the character to use for escaping a separator or quote
|
||||
* @param strictQuotes
|
||||
* if true, characters outside the quotes are ignored
|
||||
*/
|
||||
public CSVParser(char separator, char quotechar, char escape, boolean strictQuotes) {
|
||||
this(separator, quotechar, escape, strictQuotes, DEFAULT_IGNORE_LEADING_WHITESPACE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs CSVReader with supplied separator and quote char.
|
||||
* Allows setting the "strict quotes" and "ignore leading whitespace" flags
|
||||
* @param separator
|
||||
* the delimiter to use for separating entries
|
||||
* @param quotechar
|
||||
* the character to use for quoted elements
|
||||
* @param escape
|
||||
* the character to use for escaping a separator or quote
|
||||
* @param strictQuotes
|
||||
* if true, characters outside the quotes are ignored
|
||||
* @param ignoreLeadingWhiteSpace
|
||||
* if true, white space in front of a quote in a field is ignored
|
||||
*/
|
||||
public CSVParser(char separator, char quotechar, char escape, boolean strictQuotes, boolean ignoreLeadingWhiteSpace) {
|
||||
this.separator = separator;
|
||||
this.quotechar = quotechar;
|
||||
this.escape = escape;
|
||||
this.strictQuotes = strictQuotes;
|
||||
this.ignoreLeadingWhiteSpace = ignoreLeadingWhiteSpace;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @return true if something was left over from last call(s)
|
||||
*/
|
||||
public boolean isPending() {
|
||||
return pending != null;
|
||||
}
|
||||
|
||||
public String[] parseLineMulti(String nextLine) throws IOException {
|
||||
return parseLine(nextLine, true);
|
||||
}
|
||||
|
||||
public String[] parseLine(String nextLine) throws IOException {
|
||||
return parseLine(nextLine, false);
|
||||
}
|
||||
/**
|
||||
* Parses an incoming String and returns an array of elements.
|
||||
*
|
||||
* @param nextLine
|
||||
* the string to parse
|
||||
* @param multi
|
||||
* @return the comma-tokenized list of elements, or null if nextLine is null
|
||||
* @throws IOException if bad things happen during the read
|
||||
*/
|
||||
private String[] parseLine(String nextLine, boolean multi) throws IOException {
|
||||
|
||||
if (!multi && pending != null) {
|
||||
pending = null;
|
||||
}
|
||||
|
||||
if (nextLine == null) {
|
||||
if (pending != null) {
|
||||
String s = pending;
|
||||
pending = null;
|
||||
return new String[] {s};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
List<String>tokensOnThisLine = new ArrayList<String>();
|
||||
StringBuilder sb = new StringBuilder(INITIAL_READ_SIZE);
|
||||
boolean inQuotes = false;
|
||||
if (pending != null) {
|
||||
sb.append(pending);
|
||||
pending = null;
|
||||
inQuotes = true;
|
||||
}
|
||||
for (int i = 0; i < nextLine.length(); i++) {
|
||||
|
||||
char c = nextLine.charAt(i);
|
||||
if (c == this.escape) {
|
||||
if( isNextCharacterEscapable(nextLine, inQuotes || inField, i) ){
|
||||
sb.append(nextLine.charAt(i+1));
|
||||
i++;
|
||||
}
|
||||
} else if (c == quotechar) {
|
||||
if( isNextCharacterEscapedQuote(nextLine, inQuotes || inField, i) ){
|
||||
sb.append(nextLine.charAt(i+1));
|
||||
i++;
|
||||
}else{
|
||||
inQuotes = !inQuotes;
|
||||
|
||||
// the tricky case of an embedded quote in the middle: a,bc"d"ef,g
|
||||
if (!strictQuotes) {
|
||||
if(i>2 //not on the beginning of the line
|
||||
&& nextLine.charAt(i-1) != this.separator //not at the beginning of an escape sequence
|
||||
&& nextLine.length()>(i+1) &&
|
||||
nextLine.charAt(i+1) != this.separator //not at the end of an escape sequence
|
||||
){
|
||||
|
||||
if (ignoreLeadingWhiteSpace && sb.length() > 0 && isAllWhiteSpace(sb)) {
|
||||
sb = new StringBuilder(INITIAL_READ_SIZE); //discard white space leading up to quote
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
inField = !inField;
|
||||
} else if (c == separator && !inQuotes) {
|
||||
tokensOnThisLine.add(sb.toString());
|
||||
sb = new StringBuilder(INITIAL_READ_SIZE); // start work on next token
|
||||
inField = false;
|
||||
} else {
|
||||
if (!strictQuotes || inQuotes){
|
||||
sb.append(c);
|
||||
inField = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// line is done - check status
|
||||
if (inQuotes) {
|
||||
if (multi) {
|
||||
// continuing a quoted section, re-append newline
|
||||
sb.append("\n");
|
||||
pending = sb.toString();
|
||||
sb = null; // this partial content is not to be added to field list yet
|
||||
} else {
|
||||
throw new IOException("Un-terminated quoted field at end of CSV line");
|
||||
}
|
||||
}
|
||||
if (sb != null) {
|
||||
tokensOnThisLine.add(sb.toString());
|
||||
}
|
||||
return tokensOnThisLine.toArray(new String[tokensOnThisLine.size()]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* precondition: the current character is a quote or an escape
|
||||
* @param nextLine the current line
|
||||
* @param inQuotes true if the current context is quoted
|
||||
* @param i current index in line
|
||||
* @return true if the following character is a quote
|
||||
*/
|
||||
private boolean isNextCharacterEscapedQuote(String nextLine, boolean inQuotes, int i) {
|
||||
return inQuotes // we are in quotes, therefore there can be escaped quotes in here.
|
||||
&& nextLine.length() > (i+1) // there is indeed another character to check.
|
||||
&& nextLine.charAt(i+1) == quotechar;
|
||||
}
|
||||
|
||||
/**
|
||||
* precondition: the current character is an escape
|
||||
* @param nextLine the current line
|
||||
* @param inQuotes true if the current context is quoted
|
||||
* @param i current index in line
|
||||
* @return true if the following character is a quote
|
||||
*/
|
||||
protected boolean isNextCharacterEscapable(String nextLine, boolean inQuotes, int i) {
|
||||
return inQuotes // we are in quotes, therefore there can be escaped quotes in here.
|
||||
&& nextLine.length() > (i+1) // there is indeed another character to check.
|
||||
&& ( nextLine.charAt(i+1) == quotechar || nextLine.charAt(i+1) == this.escape);
|
||||
}
|
||||
|
||||
/**
|
||||
* precondition: sb.length() > 0
|
||||
* @param sb A sequence of characters to examine
|
||||
* @return true if every character in the sequence is whitespace
|
||||
*/
|
||||
protected boolean isAllWhiteSpace(CharSequence sb) {
|
||||
boolean result = true;
|
||||
for (int i = 0; i < sb.length(); i++) {
|
||||
char c = sb.charAt(i);
|
||||
|
||||
if ( !Character.isWhitespace(c) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,282 +0,0 @@
|
||||
/**
|
||||
Copyright 2005 Bytecode Pty Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package au.com.bytecode.opencsv;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A very simple CSV reader released under a commercial-friendly license.
|
||||
*
|
||||
* @author Glen Smith
|
||||
*
|
||||
*/
|
||||
public class CSVReader implements Closeable {
|
||||
|
||||
private BufferedReader br;
|
||||
|
||||
private boolean hasNext = true;
|
||||
|
||||
private CSVParser parser;
|
||||
|
||||
private int skipLines;
|
||||
|
||||
private boolean linesSkiped;
|
||||
|
||||
/**
|
||||
* The default line to start reading.
|
||||
*/
|
||||
public static final int DEFAULT_SKIP_LINES = 0;
|
||||
|
||||
/**
|
||||
* Constructs CSVReader using a comma for the separator.
|
||||
*
|
||||
* @param reader
|
||||
* the reader to an underlying CSV source.
|
||||
*/
|
||||
public CSVReader(Reader reader) {
|
||||
this(reader, CSVParser.DEFAULT_SEPARATOR, CSVParser.DEFAULT_QUOTE_CHARACTER, CSVParser.DEFAULT_ESCAPE_CHARACTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs CSVReader with supplied separator.
|
||||
*
|
||||
* @param reader
|
||||
* the reader to an underlying CSV source.
|
||||
* @param separator
|
||||
* the delimiter to use for separating entries.
|
||||
*/
|
||||
public CSVReader(Reader reader, char separator) {
|
||||
this(reader, separator, CSVParser.DEFAULT_QUOTE_CHARACTER, CSVParser.DEFAULT_ESCAPE_CHARACTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs CSVReader with supplied separator and quote char.
|
||||
*
|
||||
* @param reader
|
||||
* the reader to an underlying CSV source.
|
||||
* @param separator
|
||||
* the delimiter to use for separating entries
|
||||
* @param quotechar
|
||||
* the character to use for quoted elements
|
||||
*/
|
||||
public CSVReader(Reader reader, char separator, char quotechar) {
|
||||
this(reader, separator, quotechar, CSVParser.DEFAULT_ESCAPE_CHARACTER, DEFAULT_SKIP_LINES, CSVParser.DEFAULT_STRICT_QUOTES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs CSVReader with supplied separator, quote char and quote handling
|
||||
* behavior.
|
||||
*
|
||||
* @param reader
|
||||
* the reader to an underlying CSV source.
|
||||
* @param separator
|
||||
* the delimiter to use for separating entries
|
||||
* @param quotechar
|
||||
* the character to use for quoted elements
|
||||
* @param strictQuotes
|
||||
* sets if characters outside the quotes are ignored
|
||||
*/
|
||||
public CSVReader(Reader reader, char separator, char quotechar, boolean strictQuotes) {
|
||||
this(reader, separator, quotechar, CSVParser.DEFAULT_ESCAPE_CHARACTER, DEFAULT_SKIP_LINES, strictQuotes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs CSVReader with supplied separator and quote char.
|
||||
*
|
||||
* @param reader
|
||||
* the reader to an underlying CSV source.
|
||||
* @param separator
|
||||
* the delimiter to use for separating entries
|
||||
* @param quotechar
|
||||
* the character to use for quoted elements
|
||||
* @param escape
|
||||
* the character to use for escaping a separator or quote
|
||||
*/
|
||||
|
||||
public CSVReader(Reader reader, char separator,
|
||||
char quotechar, char escape) {
|
||||
this(reader, separator, quotechar, escape, DEFAULT_SKIP_LINES, CSVParser.DEFAULT_STRICT_QUOTES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs CSVReader with supplied separator and quote char.
|
||||
*
|
||||
* @param reader
|
||||
* the reader to an underlying CSV source.
|
||||
* @param separator
|
||||
* the delimiter to use for separating entries
|
||||
* @param quotechar
|
||||
* the character to use for quoted elements
|
||||
* @param line
|
||||
* the line number to skip for start reading
|
||||
*/
|
||||
public CSVReader(Reader reader, char separator, char quotechar, int line) {
|
||||
this(reader, separator, quotechar, CSVParser.DEFAULT_ESCAPE_CHARACTER, line, CSVParser.DEFAULT_STRICT_QUOTES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs CSVReader with supplied separator and quote char.
|
||||
*
|
||||
* @param reader
|
||||
* the reader to an underlying CSV source.
|
||||
* @param separator
|
||||
* the delimiter to use for separating entries
|
||||
* @param quotechar
|
||||
* the character to use for quoted elements
|
||||
* @param escape
|
||||
* the character to use for escaping a separator or quote
|
||||
* @param line
|
||||
* the line number to skip for start reading
|
||||
*/
|
||||
public CSVReader(Reader reader, char separator, char quotechar, char escape, int line) {
|
||||
this(reader, separator, quotechar, escape, line, CSVParser.DEFAULT_STRICT_QUOTES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs CSVReader with supplied separator and quote char.
|
||||
*
|
||||
* @param reader
|
||||
* the reader to an underlying CSV source.
|
||||
* @param separator
|
||||
* the delimiter to use for separating entries
|
||||
* @param quotechar
|
||||
* the character to use for quoted elements
|
||||
* @param escape
|
||||
* the character to use for escaping a separator or quote
|
||||
* @param line
|
||||
* the line number to skip for start reading
|
||||
* @param strictQuotes
|
||||
* sets if characters outside the quotes are ignored
|
||||
*/
|
||||
public CSVReader(Reader reader, char separator, char quotechar, char escape, int line, boolean strictQuotes) {
|
||||
this(reader, separator, quotechar, escape, line, strictQuotes, CSVParser.DEFAULT_IGNORE_LEADING_WHITESPACE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs CSVReader with supplied separator and quote char.
|
||||
*
|
||||
* @param reader
|
||||
* the reader to an underlying CSV source.
|
||||
* @param separator
|
||||
* the delimiter to use for separating entries
|
||||
* @param quotechar
|
||||
* the character to use for quoted elements
|
||||
* @param escape
|
||||
* the character to use for escaping a separator or quote
|
||||
* @param line
|
||||
* the line number to skip for start reading
|
||||
* @param strictQuotes
|
||||
* sets if characters outside the quotes are ignored
|
||||
* @param ignoreLeadingWhiteSpace
|
||||
* it true, parser should ignore white space before a quote in a field
|
||||
*/
|
||||
public CSVReader(Reader reader, char separator, char quotechar, char escape, int line, boolean strictQuotes, boolean ignoreLeadingWhiteSpace) {
|
||||
this.br = new BufferedReader(reader);
|
||||
this.parser = new CSVParser(separator, quotechar, escape, strictQuotes, ignoreLeadingWhiteSpace);
|
||||
this.skipLines = line;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the entire file into a List with each element being a String[] of
|
||||
* tokens.
|
||||
*
|
||||
* @return a List of String[], with each String[] representing a line of the
|
||||
* file.
|
||||
*
|
||||
* @throws IOException
|
||||
* if bad things happen during the read
|
||||
*/
|
||||
public List<String[]> readAll() throws IOException {
|
||||
|
||||
List<String[]> allElements = new ArrayList<String[]>();
|
||||
while (hasNext) {
|
||||
String[] nextLineAsTokens = readNext();
|
||||
if (nextLineAsTokens != null)
|
||||
allElements.add(nextLineAsTokens);
|
||||
}
|
||||
return allElements;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the next line from the buffer and converts to a string array.
|
||||
*
|
||||
* @return a string array with each comma-separated element as a separate
|
||||
* entry.
|
||||
*
|
||||
* @throws IOException
|
||||
* if bad things happen during the read
|
||||
*/
|
||||
public String[] readNext() throws IOException {
|
||||
|
||||
String[] result = null;
|
||||
do {
|
||||
String nextLine = getNextLine();
|
||||
if (!hasNext) {
|
||||
return result; // should throw if still pending?
|
||||
}
|
||||
String[] r = parser.parseLineMulti(nextLine);
|
||||
if (r.length > 0) {
|
||||
if (result == null) {
|
||||
result = r;
|
||||
} else {
|
||||
String[] t = new String[result.length+r.length];
|
||||
System.arraycopy(result, 0, t, 0, result.length);
|
||||
System.arraycopy(r, 0, t, result.length, r.length);
|
||||
result = t;
|
||||
}
|
||||
}
|
||||
} while (parser.isPending());
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the next line from the file.
|
||||
*
|
||||
* @return the next line from the file without trailing newline
|
||||
* @throws IOException
|
||||
* if bad things happen during the read
|
||||
*/
|
||||
private String getNextLine() throws IOException {
|
||||
if (!this.linesSkiped) {
|
||||
for (int i = 0; i < skipLines; i++) {
|
||||
br.readLine();
|
||||
}
|
||||
this.linesSkiped = true;
|
||||
}
|
||||
String nextLine = br.readLine();
|
||||
if (nextLine == null) {
|
||||
hasNext = false;
|
||||
}
|
||||
return hasNext ? nextLine : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the underlying reader.
|
||||
*
|
||||
* @throws IOException if the close fails
|
||||
*/
|
||||
public void close() throws IOException{
|
||||
br.close();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,302 +0,0 @@
|
||||
/**
|
||||
Copyright 2005 Bytecode Pty Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package au.com.bytecode.opencsv;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Writer;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A very simple CSV writer released under a commercial-friendly license.
|
||||
*
|
||||
* @author Glen Smith
|
||||
*
|
||||
*/
|
||||
public class CSVWriter implements Closeable {
|
||||
|
||||
public static final int INITIAL_STRING_SIZE = 128;
|
||||
|
||||
private Writer rawWriter;
|
||||
|
||||
private PrintWriter pw;
|
||||
|
||||
private char separator;
|
||||
|
||||
private char quotechar;
|
||||
|
||||
private char escapechar;
|
||||
|
||||
private String lineEnd;
|
||||
|
||||
/** The character used for escaping quotes. */
|
||||
public static final char DEFAULT_ESCAPE_CHARACTER = '"';
|
||||
|
||||
/** The default separator to use if none is supplied to the constructor. */
|
||||
public static final char DEFAULT_SEPARATOR = ',';
|
||||
|
||||
/**
|
||||
* The default quote character to use if none is supplied to the
|
||||
* constructor.
|
||||
*/
|
||||
public static final char DEFAULT_QUOTE_CHARACTER = '"';
|
||||
|
||||
/** The quote constant to use when you wish to suppress all quoting. */
|
||||
public static final char NO_QUOTE_CHARACTER = '\u0000';
|
||||
|
||||
/** The escape constant to use when you wish to suppress all escaping. */
|
||||
public static final char NO_ESCAPE_CHARACTER = '\u0000';
|
||||
|
||||
/** Default line terminator uses platform encoding. */
|
||||
public static final String DEFAULT_LINE_END = "\n";
|
||||
|
||||
private ResultSetHelper resultService = new ResultSetHelperService();
|
||||
|
||||
/**
|
||||
* Constructs CSVWriter using a comma for the separator.
|
||||
*
|
||||
* @param writer
|
||||
* the writer to an underlying CSV source.
|
||||
*/
|
||||
public CSVWriter(Writer writer) {
|
||||
this(writer, DEFAULT_SEPARATOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs CSVWriter with supplied separator.
|
||||
*
|
||||
* @param writer
|
||||
* the writer to an underlying CSV source.
|
||||
* @param separator
|
||||
* the delimiter to use for separating entries.
|
||||
*/
|
||||
public CSVWriter(Writer writer, char separator) {
|
||||
this(writer, separator, DEFAULT_QUOTE_CHARACTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs CSVWriter with supplied separator and quote char.
|
||||
*
|
||||
* @param writer
|
||||
* the writer to an underlying CSV source.
|
||||
* @param separator
|
||||
* the delimiter to use for separating entries
|
||||
* @param quotechar
|
||||
* the character to use for quoted elements
|
||||
*/
|
||||
public CSVWriter(Writer writer, char separator, char quotechar) {
|
||||
this(writer, separator, quotechar, DEFAULT_ESCAPE_CHARACTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs CSVWriter with supplied separator and quote char.
|
||||
*
|
||||
* @param writer
|
||||
* the writer to an underlying CSV source.
|
||||
* @param separator
|
||||
* the delimiter to use for separating entries
|
||||
* @param quotechar
|
||||
* the character to use for quoted elements
|
||||
* @param escapechar
|
||||
* the character to use for escaping quotechars or escapechars
|
||||
*/
|
||||
public CSVWriter(Writer writer, char separator, char quotechar, char escapechar) {
|
||||
this(writer, separator, quotechar, escapechar, DEFAULT_LINE_END);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs CSVWriter with supplied separator and quote char.
|
||||
*
|
||||
* @param writer
|
||||
* the writer to an underlying CSV source.
|
||||
* @param separator
|
||||
* the delimiter to use for separating entries
|
||||
* @param quotechar
|
||||
* the character to use for quoted elements
|
||||
* @param lineEnd
|
||||
* the line feed terminator to use
|
||||
*/
|
||||
public CSVWriter(Writer writer, char separator, char quotechar, String lineEnd) {
|
||||
this(writer, separator, quotechar, DEFAULT_ESCAPE_CHARACTER, lineEnd);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructs CSVWriter with supplied separator, quote char, escape char and line ending.
|
||||
*
|
||||
* @param writer
|
||||
* the writer to an underlying CSV source.
|
||||
* @param separator
|
||||
* the delimiter to use for separating entries
|
||||
* @param quotechar
|
||||
* the character to use for quoted elements
|
||||
* @param escapechar
|
||||
* the character to use for escaping quotechars or escapechars
|
||||
* @param lineEnd
|
||||
* the line feed terminator to use
|
||||
*/
|
||||
public CSVWriter(Writer writer, char separator, char quotechar, char escapechar, String lineEnd) {
|
||||
this.rawWriter = writer;
|
||||
this.pw = new PrintWriter(writer);
|
||||
this.separator = separator;
|
||||
this.quotechar = quotechar;
|
||||
this.escapechar = escapechar;
|
||||
this.lineEnd = lineEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the entire list to a CSV file. The list is assumed to be a
|
||||
* String[]
|
||||
*
|
||||
* @param allLines
|
||||
* a List of String[], with each String[] representing a line of
|
||||
* the file.
|
||||
*/
|
||||
public void writeAll(List<String[]> allLines) {
|
||||
for (String[] line : allLines) {
|
||||
writeNext(line);
|
||||
}
|
||||
}
|
||||
|
||||
protected void writeColumnNames(ResultSet rs)
|
||||
throws SQLException {
|
||||
|
||||
writeNext(resultService.getColumnNames(rs));
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the entire ResultSet to a CSV file.
|
||||
*
|
||||
* The caller is responsible for closing the ResultSet.
|
||||
*
|
||||
* @param rs the recordset to write
|
||||
* @param includeColumnNames true if you want column names in the output, false otherwise
|
||||
*
|
||||
* @throws java.io.IOException thrown by getColumnValue
|
||||
* @throws java.sql.SQLException thrown by getColumnValue
|
||||
*/
|
||||
public void writeAll(java.sql.ResultSet rs, boolean includeColumnNames) throws SQLException, IOException {
|
||||
|
||||
|
||||
if (includeColumnNames) {
|
||||
writeColumnNames(rs);
|
||||
}
|
||||
|
||||
while (rs.next())
|
||||
{
|
||||
writeNext(resultService.getColumnValues(rs));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Writes the next line to the file.
|
||||
*
|
||||
* @param nextLine
|
||||
* a string array with each comma-separated element as a separate
|
||||
* entry.
|
||||
*/
|
||||
public void writeNext(String[] nextLine) {
|
||||
|
||||
if (nextLine == null)
|
||||
return;
|
||||
|
||||
StringBuilder sb = new StringBuilder(INITIAL_STRING_SIZE);
|
||||
for (int i = 0; i < nextLine.length; i++) {
|
||||
|
||||
if (i != 0) {
|
||||
sb.append(separator);
|
||||
}
|
||||
|
||||
String nextElement = nextLine[i];
|
||||
if (nextElement == null)
|
||||
continue;
|
||||
if (quotechar != NO_QUOTE_CHARACTER)
|
||||
sb.append(quotechar);
|
||||
|
||||
sb.append(stringContainsSpecialCharacters(nextElement) ? processLine(nextElement) : nextElement);
|
||||
|
||||
if (quotechar != NO_QUOTE_CHARACTER)
|
||||
sb.append(quotechar);
|
||||
}
|
||||
|
||||
sb.append(lineEnd);
|
||||
pw.write(sb.toString());
|
||||
|
||||
}
|
||||
|
||||
private boolean stringContainsSpecialCharacters(String line) {
|
||||
return line.indexOf(quotechar) != -1 || line.indexOf(escapechar) != -1;
|
||||
}
|
||||
|
||||
protected StringBuilder processLine(String nextElement)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(INITIAL_STRING_SIZE);
|
||||
for (int j = 0; j < nextElement.length(); j++) {
|
||||
char nextChar = nextElement.charAt(j);
|
||||
if (escapechar != NO_ESCAPE_CHARACTER && nextChar == quotechar) {
|
||||
sb.append(escapechar).append(nextChar);
|
||||
} else if (escapechar != NO_ESCAPE_CHARACTER && nextChar == escapechar) {
|
||||
sb.append(escapechar).append(nextChar);
|
||||
} else {
|
||||
sb.append(nextChar);
|
||||
}
|
||||
}
|
||||
|
||||
return sb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush underlying stream to writer.
|
||||
*
|
||||
* @throws IOException if bad things happen
|
||||
*/
|
||||
public void flush() throws IOException {
|
||||
|
||||
pw.flush();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the underlying stream writer flushing any buffered content.
|
||||
*
|
||||
* @throws IOException if bad things happen
|
||||
*
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
flush();
|
||||
pw.close();
|
||||
rawWriter.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the there has been an error in the printstream.
|
||||
*/
|
||||
public boolean checkError() {
|
||||
return pw.checkError();
|
||||
}
|
||||
|
||||
public void setResultService(ResultSetHelper resultService) {
|
||||
this.resultService = resultService;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
Copyright 2005 Bytecode Pty Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package au.com.bytecode.opencsv;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public interface ResultSetHelper {
|
||||
public String[] getColumnNames(ResultSet rs) throws SQLException;
|
||||
|
||||
public String[] getColumnValues(ResultSet rs) throws SQLException, IOException;
|
||||
}
|
||||
@@ -1,185 +0,0 @@
|
||||
/**
|
||||
Copyright 2005 Bytecode Pty Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package au.com.bytecode.opencsv;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* helper class for processing JDBC ResultSet objects
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ResultSetHelperService implements ResultSetHelper {
|
||||
public static final int CLOBBUFFERSIZE = 2048;
|
||||
|
||||
// note: we want to maintain compatibility with Java 5 VM's
|
||||
// These types don't exist in Java 5
|
||||
private static final int NVARCHAR = -9;
|
||||
private static final int NCHAR = -15;
|
||||
private static final int LONGNVARCHAR = -16;
|
||||
private static final int NCLOB = 2011;
|
||||
|
||||
public String[] getColumnNames(ResultSet rs) throws SQLException {
|
||||
List<String> names = new ArrayList<String>();
|
||||
ResultSetMetaData metadata = rs.getMetaData();
|
||||
|
||||
for (int i = 0; i < metadata.getColumnCount(); i++) {
|
||||
names.add(metadata.getColumnName(i+1));
|
||||
}
|
||||
|
||||
String[] nameArray = new String[names.size()];
|
||||
return names.toArray(nameArray);
|
||||
}
|
||||
|
||||
public String[] getColumnValues(ResultSet rs) throws SQLException, IOException {
|
||||
|
||||
List<String> values = new ArrayList<String>();
|
||||
ResultSetMetaData metadata = rs.getMetaData();
|
||||
|
||||
for (int i = 0; i < metadata.getColumnCount(); i++) {
|
||||
values.add(getColumnValue(rs, metadata.getColumnType(i + 1), i + 1));
|
||||
}
|
||||
|
||||
String[] valueArray = new String[values.size()];
|
||||
return values.toArray(valueArray);
|
||||
}
|
||||
|
||||
private String handleObject(Object obj){
|
||||
return obj == null ? "" : String.valueOf(obj);
|
||||
}
|
||||
|
||||
private String handleBigDecimal(BigDecimal decimal) {
|
||||
return decimal == null ? "" : decimal.toString();
|
||||
}
|
||||
|
||||
private String handleLong(ResultSet rs, int columnIndex) throws SQLException {
|
||||
long lv = rs.getLong(columnIndex);
|
||||
return rs.wasNull() ? "" : Long.toString(lv);
|
||||
}
|
||||
|
||||
private String handleInteger(ResultSet rs, int columnIndex) throws SQLException {
|
||||
int i = rs.getInt(columnIndex);
|
||||
return rs.wasNull() ? "" : Integer.toString(i);
|
||||
}
|
||||
|
||||
private String handleDate(ResultSet rs, int columnIndex) throws SQLException {
|
||||
java.sql.Date date = rs.getDate(columnIndex);
|
||||
String value = null;
|
||||
if (date != null) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
|
||||
value = dateFormat.format(date);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private String handleTime(Time time) {
|
||||
return time == null ? null : time.toString();
|
||||
}
|
||||
|
||||
private String handleTimestamp(Timestamp timestamp) {
|
||||
SimpleDateFormat timeFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
|
||||
return timestamp == null ? null : timeFormat.format(timestamp);
|
||||
}
|
||||
|
||||
private String getColumnValue(ResultSet rs, int colType, int colIndex)
|
||||
throws SQLException, IOException {
|
||||
|
||||
String value = "";
|
||||
|
||||
switch (colType)
|
||||
{
|
||||
case Types.BIT:
|
||||
case Types.JAVA_OBJECT:
|
||||
value = handleObject(rs.getObject(colIndex));
|
||||
break;
|
||||
case Types.BOOLEAN:
|
||||
boolean b = rs.getBoolean(colIndex);
|
||||
value = Boolean.valueOf(b).toString();
|
||||
break;
|
||||
case NCLOB: // todo : use rs.getNClob
|
||||
case Types.CLOB:
|
||||
Clob c = rs.getClob(colIndex);
|
||||
if (c != null) {
|
||||
value = read(c);
|
||||
}
|
||||
break;
|
||||
case Types.BIGINT:
|
||||
value = handleLong(rs, colIndex);
|
||||
break;
|
||||
case Types.DECIMAL:
|
||||
case Types.DOUBLE:
|
||||
case Types.FLOAT:
|
||||
case Types.REAL:
|
||||
case Types.NUMERIC:
|
||||
value = handleBigDecimal(rs.getBigDecimal(colIndex));
|
||||
break;
|
||||
case Types.INTEGER:
|
||||
case Types.TINYINT:
|
||||
case Types.SMALLINT:
|
||||
value = handleInteger(rs, colIndex);
|
||||
break;
|
||||
case Types.DATE:
|
||||
value = handleDate(rs, colIndex);
|
||||
break;
|
||||
case Types.TIME:
|
||||
value = handleTime(rs.getTime(colIndex));
|
||||
break;
|
||||
case Types.TIMESTAMP:
|
||||
value = handleTimestamp(rs.getTimestamp(colIndex));
|
||||
break;
|
||||
case NVARCHAR: // todo : use rs.getNString
|
||||
case NCHAR: // todo : use rs.getNString
|
||||
case LONGNVARCHAR: // todo : use rs.getNString
|
||||
case Types.LONGVARCHAR:
|
||||
case Types.VARCHAR:
|
||||
case Types.CHAR:
|
||||
value = rs.getString(colIndex);
|
||||
break;
|
||||
default:
|
||||
value = "";
|
||||
}
|
||||
|
||||
|
||||
if (value == null)
|
||||
{
|
||||
value = "";
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
}
|
||||
|
||||
private static String read(Clob c) throws SQLException, IOException
|
||||
{
|
||||
StringBuilder sb = new StringBuilder( (int) c.length());
|
||||
Reader r = c.getCharacterStream();
|
||||
char[] cbuf = new char[CLOBBUFFERSIZE];
|
||||
int n;
|
||||
while ((n = r.read(cbuf, 0, cbuf.length)) != -1) {
|
||||
sb.append(cbuf, 0, n);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
|
||||
public abstract class LocalPlayer {
|
||||
/**
|
||||
* Get a player's name.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract String getName();
|
||||
|
||||
/**
|
||||
* Returns true if the player is inside a group.
|
||||
*
|
||||
* @param group
|
||||
* @return
|
||||
*/
|
||||
public abstract boolean hasGroup(String group);
|
||||
|
||||
/**
|
||||
* Get the player's position.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract Vector getPosition();
|
||||
|
||||
/**
|
||||
* Kick the player.
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
public abstract void kick(String msg);
|
||||
|
||||
/**
|
||||
* Ban the player.
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
public abstract void ban(String msg);
|
||||
|
||||
/**
|
||||
* Send the player a message;
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
public abstract void printRaw(String msg);
|
||||
|
||||
/**
|
||||
* Get the player's list of groups.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract String[] getGroups();
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof LocalPlayer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((LocalPlayer)obj).getName().equals(getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getName().hashCode();
|
||||
}
|
||||
}
|
||||
@@ -1,301 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.Level;
|
||||
import java.io.*;
|
||||
import org.bukkit.ChatColor;
|
||||
import com.sk89q.worldedit.blocks.ItemType;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.blacklist.events.BlacklistEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public abstract class Blacklist {
|
||||
/**
|
||||
* Logger.
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger("Minecraft.WorldGuard");
|
||||
|
||||
/**
|
||||
* List of entries by block ID.
|
||||
*/
|
||||
private Map<Integer,List<BlacklistEntry>> blacklist
|
||||
= new HashMap<Integer,List<BlacklistEntry>>();
|
||||
/**
|
||||
* Logger.
|
||||
*/
|
||||
private BlacklistLogger blacklistLogger = new BlacklistLogger();
|
||||
/**
|
||||
* Last event.
|
||||
*/
|
||||
private BlacklistEvent lastEvent;
|
||||
/**
|
||||
* Used to prevent flooding.
|
||||
*/
|
||||
Map<String,BlacklistTrackedEvent> lastAffected =
|
||||
new HashMap<String,BlacklistTrackedEvent>();
|
||||
|
||||
/**
|
||||
* Returns whether the list is empty.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return blacklist.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the entries for an item or list.
|
||||
*/
|
||||
public List<BlacklistEntry> getEntries(int id) {
|
||||
return blacklist.get(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the logger.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public BlacklistLogger getLogger() {
|
||||
return blacklistLogger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to handle the event.
|
||||
*
|
||||
* @param event
|
||||
* @param forceRepeat
|
||||
* @param silent
|
||||
* @return
|
||||
*/
|
||||
public boolean check(BlacklistEvent event, boolean forceRepeat, boolean silent) {
|
||||
List<BlacklistEntry> entries = getEntries(event.getType());
|
||||
if (entries == null) {
|
||||
return true;
|
||||
}
|
||||
boolean ret = true;
|
||||
for (BlacklistEntry entry : entries) {
|
||||
if (!entry.check(event, forceRepeat, silent)) {
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the blacklist.
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public void load(File file) throws IOException {
|
||||
FileReader input = null;
|
||||
Map<Integer,List<BlacklistEntry>> blacklist =
|
||||
new HashMap<Integer,List<BlacklistEntry>>();
|
||||
|
||||
try {
|
||||
input = new FileReader(file);
|
||||
BufferedReader buff = new BufferedReader(input);
|
||||
|
||||
String line;
|
||||
List<BlacklistEntry> currentEntries = null;
|
||||
while ((line = buff.readLine()) != null) {
|
||||
line = line.trim();
|
||||
|
||||
// Blank line
|
||||
if (line.length() == 0) {
|
||||
continue;
|
||||
} else if (line.charAt(0) == ';' || line.charAt(0) == '#') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line.matches("^\\[.*\\]$")) {
|
||||
String[] items = line.substring(1, line.length() - 1).split(",");
|
||||
currentEntries = new ArrayList<BlacklistEntry>();
|
||||
|
||||
for (String item : items) {
|
||||
int id = 0;
|
||||
|
||||
try {
|
||||
id = Integer.parseInt(item.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
id = getItemID(item.trim());
|
||||
if (id == 0) {
|
||||
logger.log(Level.WARNING, "WorldGuard: Unknown block name: "
|
||||
+ item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
BlacklistEntry entry = new BlacklistEntry(this);
|
||||
if (blacklist.containsKey(id)) {
|
||||
blacklist.get(id).add(entry);
|
||||
} else {
|
||||
List<BlacklistEntry> entries = new ArrayList<BlacklistEntry>();
|
||||
entries.add(entry);
|
||||
blacklist.put(id, entries);
|
||||
}
|
||||
currentEntries.add(entry);
|
||||
}
|
||||
} else if (currentEntries != null) {
|
||||
String[] parts = line.split("=");
|
||||
|
||||
if (parts.length == 1) {
|
||||
logger.log(Level.WARNING, "Found option with no value "
|
||||
+ file.getName() + " for '" + line + "'");
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean unknownOption = false;
|
||||
|
||||
for (BlacklistEntry entry : currentEntries) {
|
||||
if (parts[0].equalsIgnoreCase("ignore-groups")) {
|
||||
entry.setIgnoreGroups(parts[1].split(","));
|
||||
} else if (parts[0].equalsIgnoreCase("on-break")) {
|
||||
entry.setBreakActions(parts[1].split(","));
|
||||
} else if (parts[0].equalsIgnoreCase("on-destroy-with")) {
|
||||
entry.setDestroyWithActions(parts[1].split(","));
|
||||
} else if (parts[0].equalsIgnoreCase("on-place")) {
|
||||
entry.setPlaceActions(parts[1].split(","));
|
||||
} else if (parts[0].equalsIgnoreCase("on-interact")) {
|
||||
entry.setInteractActions(parts[1].split(","));
|
||||
} else if (parts[0].equalsIgnoreCase("on-use")) {
|
||||
entry.setUseActions(parts[1].split(","));
|
||||
} else if (parts[0].equalsIgnoreCase("on-drop")) {
|
||||
entry.setDropActions(parts[1].split(","));
|
||||
} else if (parts[0].equalsIgnoreCase("on-acquire")) {
|
||||
entry.setAcquireActions(parts[1].split(","));
|
||||
} else if (parts[0].equalsIgnoreCase("message")) {
|
||||
entry.setMessage(parts[1].trim());
|
||||
} else if (parts[0].equalsIgnoreCase("comment")) {
|
||||
entry.setComment(parts[1].trim());
|
||||
} else {
|
||||
unknownOption = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (unknownOption) {
|
||||
logger.log(Level.WARNING, "Unknown option '" + parts[0]
|
||||
+ "' in " + file.getName() + " for '" + line + "'");
|
||||
}
|
||||
} else {
|
||||
logger.log(Level.WARNING, "Found option with no heading "
|
||||
+ file.getName() + " for '" + line + "'");
|
||||
}
|
||||
}
|
||||
|
||||
this.blacklist = blacklist;
|
||||
} finally {
|
||||
try {
|
||||
if (input != null) {
|
||||
input.close();
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last event.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public BlacklistEvent getLastEvent() {
|
||||
return lastEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify administrators.
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
public void notify(BlacklistEvent event, String comment) {
|
||||
lastEvent = event;
|
||||
|
||||
broadcastNotification(ChatColor.GRAY + "WG: "
|
||||
+ ChatColor.LIGHT_PURPLE + event.getPlayer().getName()
|
||||
+ ChatColor.GOLD + " (" + event.getDescription() + ") "
|
||||
+ ChatColor.WHITE
|
||||
+ getFriendlyItemName(event.getType())
|
||||
+ (comment != null ? " (" + comment + ")" : "") + ".");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a notification to all subscribing users.
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
public abstract void broadcastNotification(String msg);
|
||||
|
||||
/**
|
||||
* Forget a player.
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public void forgetPlayer(LocalPlayer player) {
|
||||
lastAffected.remove(player.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Forget all players.
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public void forgetAllPlayers() {
|
||||
lastAffected.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an item's ID from its name.
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
private static int getItemID(String name) {
|
||||
ItemType type = ItemType.lookup(name);
|
||||
if (type != null) {
|
||||
return type.getID();
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an item's friendly name with its ID.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
private static String getFriendlyItemName(int id) {
|
||||
ItemType type = ItemType.fromID(id);
|
||||
if (type != null) {
|
||||
return type.getName() + " (#" + id + ")";
|
||||
} else {
|
||||
return "#" + id + "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,381 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import org.bukkit.ChatColor;
|
||||
import com.sk89q.worldedit.blocks.ItemType;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.blacklist.events.BlacklistEvent;
|
||||
import com.sk89q.worldguard.blacklist.events.BlockBreakBlacklistEvent;
|
||||
import com.sk89q.worldguard.blacklist.events.BlockInteractBlacklistEvent;
|
||||
import com.sk89q.worldguard.blacklist.events.BlockPlaceBlacklistEvent;
|
||||
import com.sk89q.worldguard.blacklist.events.DestroyWithBlacklistEvent;
|
||||
import com.sk89q.worldguard.blacklist.events.ItemAcquireBlacklistEvent;
|
||||
import com.sk89q.worldguard.blacklist.events.ItemDropBlacklistEvent;
|
||||
import com.sk89q.worldguard.blacklist.events.ItemUseBlacklistEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class BlacklistEntry {
|
||||
/**
|
||||
* Parent blacklist entry.
|
||||
*/
|
||||
private Blacklist blacklist;
|
||||
/**
|
||||
* List of groups to not affect.
|
||||
*/
|
||||
private Set<String> ignoreGroups;
|
||||
|
||||
private String[] breakActions;
|
||||
private String[] destroyWithActions;
|
||||
private String[] placeActions;
|
||||
private String[] interactActions;
|
||||
private String[] useActions;
|
||||
private String[] dropActions;
|
||||
private String[] acquireActions;
|
||||
|
||||
private String message;
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
*
|
||||
* @param blacklist
|
||||
*/
|
||||
public BlacklistEntry(Blacklist blacklist) {
|
||||
this.blacklist = blacklist;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ignoreGroups
|
||||
*/
|
||||
public String[] getIgnoreGroups() {
|
||||
return ignoreGroups.toArray(new String[ignoreGroups.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ignoreGroups the ignoreGroups to set
|
||||
*/
|
||||
public void setIgnoreGroups(String[] ignoreGroups) {
|
||||
Set<String> ignoreGroupsSet = new HashSet<String>();
|
||||
for (String group : ignoreGroups) {
|
||||
ignoreGroupsSet.add(group.toLowerCase());
|
||||
}
|
||||
this.ignoreGroups = ignoreGroupsSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String[] getBreakActions() {
|
||||
return breakActions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param actions
|
||||
*/
|
||||
public void setBreakActions(String[] actions) {
|
||||
this.breakActions = actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String[] getDestroyWithActions() {
|
||||
return destroyWithActions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param action
|
||||
*/
|
||||
public void setDestroyWithActions(String[] actions) {
|
||||
this.destroyWithActions = actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String[] getPlaceActions() {
|
||||
return placeActions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param actions
|
||||
*/
|
||||
public void setPlaceActions(String[] actions) {
|
||||
this.placeActions = actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String[] getInteractActions() {
|
||||
return interactActions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param actions
|
||||
*/
|
||||
public void setInteractActions(String[] actions) {
|
||||
this.interactActions = actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String[] getUseActions() {
|
||||
return useActions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param actions
|
||||
*/
|
||||
public void setUseActions(String[] actions) {
|
||||
this.useActions = actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String[] getDropActions() {
|
||||
return dropActions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param actions
|
||||
*/
|
||||
public void setDropActions(String[] actions) {
|
||||
this.dropActions = actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String[] getAcquireActions() {
|
||||
return acquireActions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param actions
|
||||
*/
|
||||
public void setAcquireActions(String[] actions) {
|
||||
this.acquireActions = actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the message
|
||||
*/
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message the message to set
|
||||
*/
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the comment
|
||||
*/
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param comment the comment to set
|
||||
*/
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this player should be ignored.
|
||||
*
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldIgnore(LocalPlayer player) {
|
||||
if (ignoreGroups == null) {
|
||||
return false;
|
||||
}
|
||||
for (String group : player.getGroups()) {
|
||||
if (ignoreGroups.contains(group.toLowerCase())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the associated actions with an event.
|
||||
*
|
||||
* @param event
|
||||
* @return
|
||||
*/
|
||||
private String[] getActions(BlacklistEvent event) {
|
||||
if (event instanceof BlockBreakBlacklistEvent) {
|
||||
return breakActions;
|
||||
|
||||
} else if (event instanceof BlockPlaceBlacklistEvent) {
|
||||
return placeActions;
|
||||
|
||||
} else if (event instanceof BlockInteractBlacklistEvent) {
|
||||
return interactActions;
|
||||
|
||||
} else if (event instanceof DestroyWithBlacklistEvent) {
|
||||
return destroyWithActions;
|
||||
|
||||
} else if (event instanceof ItemAcquireBlacklistEvent) {
|
||||
return acquireActions;
|
||||
|
||||
} else if (event instanceof ItemDropBlacklistEvent) {
|
||||
return dropActions;
|
||||
|
||||
} else if (event instanceof ItemUseBlacklistEvent) {
|
||||
return useActions;
|
||||
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to handle the event.
|
||||
*
|
||||
* @param event
|
||||
* @param forceRepeat
|
||||
* @param silent
|
||||
* @return
|
||||
*/
|
||||
public boolean check(BlacklistEvent event, boolean forceRepeat, boolean silent) {
|
||||
LocalPlayer player = event.getPlayer();
|
||||
|
||||
if (shouldIgnore(player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String name = player.getName();
|
||||
long now = System.currentTimeMillis();
|
||||
boolean repeating = false;
|
||||
|
||||
// Check to see whether this event is being repeated
|
||||
BlacklistTrackedEvent tracked = blacklist.lastAffected.get(name);
|
||||
if (tracked != null) {
|
||||
if (tracked.matches(event, now)) {
|
||||
repeating = true;
|
||||
}
|
||||
} else {
|
||||
blacklist.lastAffected.put(name, new BlacklistTrackedEvent(event, now));
|
||||
}
|
||||
|
||||
String actions[] = getActions(event);
|
||||
boolean ret = true;
|
||||
|
||||
// Nothing to do
|
||||
if (actions == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (String action : actions) {
|
||||
// Deny
|
||||
if (action.equalsIgnoreCase("deny")) {
|
||||
if (silent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ret = false;
|
||||
|
||||
// Kick
|
||||
} else if (action.equalsIgnoreCase("kick")) {
|
||||
if (silent) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.message != null) {
|
||||
player.kick(String.format(this.message,
|
||||
getFriendlyItemName(event.getType())));
|
||||
} else {
|
||||
player.kick("You can't " + event.getDescription() + " "
|
||||
+ getFriendlyItemName(event.getType()));
|
||||
}
|
||||
|
||||
// Ban
|
||||
} else if (action.equalsIgnoreCase("ban")) {
|
||||
if (silent) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.message != null) {
|
||||
player.ban("Banned: " + String.format(this.message,
|
||||
getFriendlyItemName(event.getType())));
|
||||
} else {
|
||||
player.ban("Banned: You can't "
|
||||
+ event.getDescription() + " "
|
||||
+ getFriendlyItemName(event.getType()));
|
||||
}
|
||||
|
||||
} else if (!silent && (!repeating || forceRepeat)) {
|
||||
// Notify
|
||||
if (action.equalsIgnoreCase("notify")) {
|
||||
blacklist.notify(event, comment);
|
||||
|
||||
// Log
|
||||
} else if (action.equalsIgnoreCase("log")) {
|
||||
blacklist.getLogger().logEvent(event, comment);
|
||||
|
||||
// Tell
|
||||
} else if (action.equalsIgnoreCase("tell")) {
|
||||
if (this.message != null) {
|
||||
player.printRaw(ChatColor.YELLOW +
|
||||
String.format(message, getFriendlyItemName(event.getType()))
|
||||
+ ".");
|
||||
} else {
|
||||
player.printRaw(ChatColor.YELLOW + "You're not allowed to "
|
||||
+ event.getDescription() + " "
|
||||
+ getFriendlyItemName(event.getType()) + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an item's friendly name with its ID.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
private static String getFriendlyItemName(int id) {
|
||||
ItemType type = ItemType.fromID(id);
|
||||
if (type != null) {
|
||||
return type.getName() + " (#" + id + ")";
|
||||
} else {
|
||||
return "#" + id + "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import com.sk89q.worldguard.blacklist.events.BlacklistEvent;
|
||||
import com.sk89q.worldguard.blacklist.loggers.BlacklistLoggerHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class BlacklistLogger implements BlacklistLoggerHandler {
|
||||
/**
|
||||
* List of logger handlers.
|
||||
*/
|
||||
private Set<BlacklistLoggerHandler> handlers
|
||||
= new HashSet<BlacklistLoggerHandler>();
|
||||
|
||||
/**
|
||||
* Add a handler.
|
||||
*
|
||||
* @param handler
|
||||
*/
|
||||
public void addHandler(BlacklistLoggerHandler handler) {
|
||||
handlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a handler.
|
||||
*
|
||||
* @param handler
|
||||
*/
|
||||
public void removeHandler(BlacklistLoggerHandler handler) {
|
||||
handlers.remove(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a handler.
|
||||
*
|
||||
* @param handler
|
||||
*/
|
||||
public void clearHandlers() {
|
||||
handlers.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an event.
|
||||
*
|
||||
* @param player
|
||||
* @param event
|
||||
*/
|
||||
public void logEvent(BlacklistEvent event, String comment) {
|
||||
for (BlacklistLoggerHandler handler : handlers) {
|
||||
handler.logEvent(event, comment);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the connection.
|
||||
*/
|
||||
public void close() {
|
||||
for (BlacklistLoggerHandler handler : handlers) {
|
||||
handler.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist;
|
||||
|
||||
import com.sk89q.worldguard.blacklist.events.BlacklistEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class BlacklistTrackedEvent {
|
||||
private BlacklistEvent event;
|
||||
private long time;
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
*
|
||||
* @param id
|
||||
* @param time
|
||||
*/
|
||||
public BlacklistTrackedEvent(BlacklistEvent event, long time) {
|
||||
this.event = event;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public boolean matches(BlacklistEvent other, long now) {
|
||||
return other.getType() == event.getType()
|
||||
&& time > now - 3000
|
||||
&& other.getClass() == event.getClass();
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist.events;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
/**
|
||||
* Represents a blacklist event.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public abstract class BlacklistEvent {
|
||||
private Vector pos;
|
||||
private int type;
|
||||
|
||||
/**
|
||||
* Holds the player that triggered the event.
|
||||
*/
|
||||
private LocalPlayer player;
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
*
|
||||
* @param player
|
||||
* @param pos
|
||||
* @param type
|
||||
*/
|
||||
public BlacklistEvent(LocalPlayer player, Vector pos, int type) {
|
||||
this.player = player;
|
||||
this.pos = pos;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the player.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public LocalPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the position.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Vector getPosition() {
|
||||
return pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a short description such as "break" or "destroy with."
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract String getDescription();
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist.events;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
public abstract class BlockBlacklistEvent extends BlacklistEvent {
|
||||
public BlockBlacklistEvent(LocalPlayer player, Vector pos, int type) {
|
||||
super(player, pos, type);
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist.events;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
public class BlockBreakBlacklistEvent extends BlockBlacklistEvent {
|
||||
public BlockBreakBlacklistEvent(LocalPlayer player, Vector pos, int type) {
|
||||
super(player, pos, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a short description such as "break" or "destroy with."
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDescription() {
|
||||
return "break";
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist.events;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
public class BlockInteractBlacklistEvent extends BlockBlacklistEvent {
|
||||
public BlockInteractBlacklistEvent(LocalPlayer player, Vector pos, int type) {
|
||||
super(player, pos, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a short description such as "break" or "destroy with."
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDescription() {
|
||||
return "interact with";
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist.events;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
public class BlockPlaceBlacklistEvent extends BlockBlacklistEvent {
|
||||
public BlockPlaceBlacklistEvent(LocalPlayer player, Vector pos, int type) {
|
||||
super(player, pos, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a short description such as "break" or "destroy with."
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDescription() {
|
||||
return "place";
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist.events;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
public class DestroyWithBlacklistEvent extends BlacklistEvent {
|
||||
public DestroyWithBlacklistEvent(LocalPlayer player, Vector pos, int type) {
|
||||
super(player, pos, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a short description such as "break" or "destroy with."
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDescription() {
|
||||
return "destroy with";
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist.events;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
public class ItemAcquireBlacklistEvent extends ItemBlacklistEvent {
|
||||
public ItemAcquireBlacklistEvent(LocalPlayer player, Vector pos, int type) {
|
||||
super(player, pos, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a short description such as "break" or "destroy with."
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDescription() {
|
||||
return "acquire";
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist.events;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
public abstract class ItemBlacklistEvent extends BlacklistEvent {
|
||||
public ItemBlacklistEvent(LocalPlayer player, Vector pos, int type) {
|
||||
super(player, pos, type);
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist.events;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
public class ItemDropBlacklistEvent extends ItemBlacklistEvent {
|
||||
public ItemDropBlacklistEvent(LocalPlayer player, Vector pos, int type) {
|
||||
super(player, pos, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a short description such as "break" or "destroy with."
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDescription() {
|
||||
return "drop";
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist.events;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
public class ItemUseBlacklistEvent extends ItemBlacklistEvent {
|
||||
public ItemUseBlacklistEvent(LocalPlayer player, Vector pos, int type) {
|
||||
super(player, pos, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a short description such as "break" or "destroy with."
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDescription() {
|
||||
return "use";
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist.loggers;
|
||||
|
||||
import com.sk89q.worldguard.blacklist.events.BlacklistEvent;
|
||||
|
||||
/**
|
||||
* Interface for loggers for the blacklist.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public interface BlacklistLoggerHandler {
|
||||
/**
|
||||
* Log an event.
|
||||
*
|
||||
* @param event
|
||||
* @param comment
|
||||
*/
|
||||
public void logEvent(BlacklistEvent event, String comment);
|
||||
|
||||
/**
|
||||
* Close the logger.
|
||||
*/
|
||||
public void close();
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist.loggers;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.Level;
|
||||
import com.sk89q.worldedit.blocks.ItemType;
|
||||
import com.sk89q.worldguard.blacklist.events.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class ConsoleLoggerHandler implements BlacklistLoggerHandler {
|
||||
/**
|
||||
* Logger.
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger("Minecraft.WorldGuard");
|
||||
|
||||
/**
|
||||
* Log an event.
|
||||
*
|
||||
* @param player
|
||||
* @param event
|
||||
*/
|
||||
public void logEvent(BlacklistEvent event, String comment) {
|
||||
// Block break
|
||||
if (event instanceof BlockBreakBlacklistEvent) {
|
||||
BlockBreakBlacklistEvent evt = (BlockBreakBlacklistEvent)event;
|
||||
logger.log(Level.INFO, "WorldGuard: " + event.getPlayer().getName()
|
||||
+ " tried to break " + getFriendlyItemName(evt.getType())
|
||||
+ (comment != null ? " (" + comment + ")" : ""));
|
||||
|
||||
// Block place
|
||||
} else if (event instanceof BlockPlaceBlacklistEvent) {
|
||||
BlockPlaceBlacklistEvent evt = (BlockPlaceBlacklistEvent)event;
|
||||
logger.log(Level.INFO, "WorldGuard: " + event.getPlayer().getName()
|
||||
+ " tried to place " + getFriendlyItemName(evt.getType())
|
||||
+ (comment != null ? " (" + comment + ")" : ""));
|
||||
|
||||
// Block interact
|
||||
} else if (event instanceof BlockInteractBlacklistEvent) {
|
||||
BlockInteractBlacklistEvent evt = (BlockInteractBlacklistEvent)event;
|
||||
logger.log(Level.INFO, "WorldGuard: " + event.getPlayer().getName()
|
||||
+ " tried to interact with " + getFriendlyItemName(evt.getType())
|
||||
+ (comment != null ? " (" + comment + ")" : ""));
|
||||
|
||||
// Destroy with
|
||||
} else if (event instanceof DestroyWithBlacklistEvent) {
|
||||
DestroyWithBlacklistEvent evt = (DestroyWithBlacklistEvent)event;
|
||||
logger.log(Level.INFO, "WorldGuard: " + event.getPlayer().getName()
|
||||
+ " tried to destroy with " + getFriendlyItemName(evt.getType())
|
||||
+ (comment != null ? " (" + comment + ")" : ""));
|
||||
|
||||
// Acquire
|
||||
} else if (event instanceof ItemAcquireBlacklistEvent) {
|
||||
ItemAcquireBlacklistEvent evt = (ItemAcquireBlacklistEvent)event;
|
||||
logger.log(Level.INFO, "WorldGuard: " + event.getPlayer().getName()
|
||||
+ " tried to acquire " + getFriendlyItemName(evt.getType())
|
||||
+ (comment != null ? " (" + comment + ")" : ""));
|
||||
|
||||
// Drop
|
||||
} else if (event instanceof ItemDropBlacklistEvent) {
|
||||
ItemDropBlacklistEvent evt = (ItemDropBlacklistEvent)event;
|
||||
logger.log(Level.INFO, "WorldGuard: " + event.getPlayer().getName()
|
||||
+ " tried to drop " + getFriendlyItemName(evt.getType())
|
||||
+ (comment != null ? " (" + comment + ")" : ""));
|
||||
|
||||
// Use
|
||||
} else if (event instanceof ItemUseBlacklistEvent) {
|
||||
ItemUseBlacklistEvent evt = (ItemUseBlacklistEvent)event;
|
||||
logger.log(Level.INFO, "WorldGuard: " + event.getPlayer().getName()
|
||||
+ " tried to use " + getFriendlyItemName(evt.getType())
|
||||
+ (comment != null ? " (" + comment + ")" : ""));
|
||||
|
||||
// Unknown
|
||||
} else {
|
||||
logger.log(Level.INFO, "WorldGuard: " + event.getPlayer().getName()
|
||||
+ " caught unknown event: " + event.getClass().getCanonicalName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an item's friendly name with its ID.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
private static String getFriendlyItemName(int id) {
|
||||
ItemType type = ItemType.fromID(id);
|
||||
if (type != null) {
|
||||
return type.getName() + " (#" + id + ")";
|
||||
} else {
|
||||
return "#" + id + "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the connection.
|
||||
*/
|
||||
public void close() {
|
||||
}
|
||||
}
|
||||
@@ -1,198 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist.loggers;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.Level;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.PreparedStatement;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.blacklist.events.BlacklistEvent;
|
||||
import com.sk89q.worldguard.blacklist.events.BlockBreakBlacklistEvent;
|
||||
import com.sk89q.worldguard.blacklist.events.BlockPlaceBlacklistEvent;
|
||||
import com.sk89q.worldguard.blacklist.events.DestroyWithBlacklistEvent;
|
||||
import com.sk89q.worldguard.blacklist.events.ItemAcquireBlacklistEvent;
|
||||
import com.sk89q.worldguard.blacklist.events.ItemDropBlacklistEvent;
|
||||
import com.sk89q.worldguard.blacklist.events.ItemUseBlacklistEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class DatabaseLoggerHandler implements BlacklistLoggerHandler {
|
||||
/**
|
||||
* Logger.
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger("Minecraft.WorldGuard");
|
||||
|
||||
/**
|
||||
* DSN.
|
||||
*/
|
||||
private String dsn;
|
||||
/**
|
||||
* Username.
|
||||
*/
|
||||
private String user;
|
||||
/**
|
||||
* Password.
|
||||
*/
|
||||
private String pass;
|
||||
/**
|
||||
* Table.
|
||||
*/
|
||||
private String table;
|
||||
/**
|
||||
* Database connection.
|
||||
*/
|
||||
private Connection conn;
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
*
|
||||
* @param dsn
|
||||
* @param user
|
||||
* @param pass
|
||||
*/
|
||||
public DatabaseLoggerHandler(String dsn, String user, String pass, String table) {
|
||||
this.dsn = dsn;
|
||||
this.user = user;
|
||||
this.pass = pass;
|
||||
this.table = table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the database connection.
|
||||
*
|
||||
* @return
|
||||
* @throws SQLException
|
||||
*/
|
||||
private Connection getConnection() throws SQLException {
|
||||
if (conn == null || conn.isClosed()) {
|
||||
conn = DriverManager.getConnection(dsn, user, pass);
|
||||
}
|
||||
return conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an event to the database.
|
||||
*
|
||||
* @param event
|
||||
* @param name
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param item
|
||||
* @param comment
|
||||
*/
|
||||
private void logEvent(String event, LocalPlayer player, Vector pos, int item,
|
||||
String comment) {
|
||||
try {
|
||||
Connection conn = getConnection();
|
||||
PreparedStatement stmt = conn.prepareStatement(
|
||||
"INSERT INTO " + table
|
||||
+ "(event, player, x, y, z, item, time, comment) VALUES "
|
||||
+ "(?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
stmt.setString(1, event);
|
||||
stmt.setString(2, player.getName());
|
||||
stmt.setInt(3, pos.getBlockX());
|
||||
stmt.setInt(4, pos.getBlockY());
|
||||
stmt.setInt(5, pos.getBlockZ());
|
||||
stmt.setInt(6, item);
|
||||
stmt.setInt(7, (int)(System.currentTimeMillis() / 1000));
|
||||
stmt.setString(8, comment);
|
||||
stmt.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
logger.log(Level.SEVERE, "Failed to log blacklist event to database: "
|
||||
+ e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an event.
|
||||
*
|
||||
* @param player
|
||||
* @param event
|
||||
*/
|
||||
public void logEvent(BlacklistEvent event, String comment) {
|
||||
// Block break
|
||||
if (event instanceof BlockBreakBlacklistEvent) {
|
||||
BlockBreakBlacklistEvent evt = (BlockBreakBlacklistEvent)event;
|
||||
logEvent("BREAK", evt.getPlayer(), evt.getPosition(),
|
||||
evt.getType(), comment);
|
||||
|
||||
// Block place
|
||||
} else if (event instanceof BlockPlaceBlacklistEvent) {
|
||||
BlockPlaceBlacklistEvent evt = (BlockPlaceBlacklistEvent)event;
|
||||
logEvent("PLACE", evt.getPlayer(), evt.getPosition(),
|
||||
evt.getType(), comment);
|
||||
|
||||
// Block interact
|
||||
} else if (event instanceof BlockPlaceBlacklistEvent) {
|
||||
BlockPlaceBlacklistEvent evt = (BlockPlaceBlacklistEvent)event;
|
||||
logEvent("INTERACT", evt.getPlayer(), evt.getPosition(),
|
||||
evt.getType(), comment);
|
||||
|
||||
// Destroy with
|
||||
} else if (event instanceof DestroyWithBlacklistEvent) {
|
||||
DestroyWithBlacklistEvent evt = (DestroyWithBlacklistEvent)event;
|
||||
logEvent("DESTROY_WITH", evt.getPlayer(), evt.getPosition(),
|
||||
evt.getType(), comment);
|
||||
|
||||
// Acquire
|
||||
} else if (event instanceof ItemAcquireBlacklistEvent) {
|
||||
ItemAcquireBlacklistEvent evt = (ItemAcquireBlacklistEvent)event;
|
||||
logEvent("ACQUIRE", evt.getPlayer(), evt.getPlayer().getPosition(),
|
||||
evt.getType(), comment);
|
||||
|
||||
// Drop
|
||||
} else if (event instanceof ItemDropBlacklistEvent) {
|
||||
ItemDropBlacklistEvent evt = (ItemDropBlacklistEvent)event;
|
||||
logEvent("DROP", evt.getPlayer(), evt.getPlayer().getPosition(),
|
||||
evt.getType(), comment);
|
||||
|
||||
// Use
|
||||
} else if (event instanceof ItemUseBlacklistEvent) {
|
||||
ItemUseBlacklistEvent evt = (ItemUseBlacklistEvent)event;
|
||||
logEvent("USE", evt.getPlayer(), evt.getPlayer().getPosition(),
|
||||
evt.getType(), comment);
|
||||
|
||||
// Unknown
|
||||
} else {
|
||||
logEvent("UNKNOWN", event.getPlayer(), event.getPlayer().getPosition(),
|
||||
-1, comment);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the connection.
|
||||
*/
|
||||
public void close() {
|
||||
try {
|
||||
if (conn != null && !conn.isClosed()) {
|
||||
conn.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,300 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist.loggers;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.Level;
|
||||
import java.io.*;
|
||||
import java.util.regex.*;
|
||||
import java.util.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.ItemType;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.blacklist.events.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class FileLoggerHandler implements BlacklistLoggerHandler {
|
||||
/**
|
||||
* Logger.
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger("Minecraft.WorldGuard");
|
||||
/**
|
||||
* Regex for patterns in the path.
|
||||
*/
|
||||
private static Pattern pattern = Pattern.compile("%.");
|
||||
/**
|
||||
* Date format.
|
||||
*/
|
||||
private static SimpleDateFormat dateFormat =
|
||||
new SimpleDateFormat("yyyyy-MM-dd HH:mm:ss");
|
||||
|
||||
/**
|
||||
* Number of files to keep open at a time.
|
||||
*/
|
||||
private int cacheSize = 10;
|
||||
/**
|
||||
* Path pattern.
|
||||
*/
|
||||
private String pathPattern;
|
||||
/**
|
||||
* Cache of writers.
|
||||
*/
|
||||
private TreeMap<String,FileLoggerWriter> writers =
|
||||
new TreeMap<String,FileLoggerWriter>();
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
*
|
||||
* @param pathPattern
|
||||
*/
|
||||
public FileLoggerHandler(String pathPattern) {
|
||||
this.pathPattern = pathPattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
*
|
||||
* @param pathPattern
|
||||
* @param cacheSize
|
||||
*/
|
||||
public FileLoggerHandler(String pathPattern, int cacheSize) {
|
||||
if (cacheSize < 1) {
|
||||
throw new IllegalArgumentException("Cache size cannot be less than 1");
|
||||
}
|
||||
this.pathPattern = pathPattern;
|
||||
this.cacheSize = cacheSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the path.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String buildPath(String playerName) {
|
||||
GregorianCalendar calendar = new GregorianCalendar();
|
||||
|
||||
Matcher m = pattern.matcher(pathPattern);
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
|
||||
// Pattern replacements
|
||||
while (m.find()) {
|
||||
String group = m.group();
|
||||
String rep = "?";
|
||||
|
||||
if (group.matches("%%")) {
|
||||
rep = "%";
|
||||
} else if (group.matches("%u")) {
|
||||
rep = playerName.toLowerCase().replaceAll("[^A-Za-z0-9_]", "_");
|
||||
if (rep.length() > 32) { // Actual max length is 16
|
||||
rep = rep.substring(0, 32);
|
||||
}
|
||||
|
||||
// Date and time
|
||||
} else if (group.matches("%Y")) {
|
||||
rep = String.valueOf(calendar.get(Calendar.YEAR));
|
||||
} else if (group.matches("%m")) {
|
||||
rep = String.format("%02d", calendar.get(Calendar.MONTH));
|
||||
} else if (group.matches("%d")) {
|
||||
rep = String.format("%02d", calendar.get(Calendar.DAY_OF_MONTH));
|
||||
} else if (group.matches("%W")) {
|
||||
rep = String.format("%02d", calendar.get(Calendar.WEEK_OF_YEAR));
|
||||
} else if (group.matches("%H")) {
|
||||
rep = String.format("%02d", calendar.get(Calendar.HOUR_OF_DAY));
|
||||
} else if (group.matches("%h")) {
|
||||
rep = String.format("%02d", calendar.get(Calendar.HOUR));
|
||||
} else if (group.matches("%i")) {
|
||||
rep = String.format("%02d", calendar.get(Calendar.MINUTE));
|
||||
} else if (group.matches("%s")) {
|
||||
rep = String.format("%02d", calendar.get(Calendar.SECOND));
|
||||
}
|
||||
|
||||
m.appendReplacement(buffer, rep);
|
||||
}
|
||||
|
||||
m.appendTail(buffer);
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message.
|
||||
*
|
||||
* @param player
|
||||
* @param message
|
||||
*/
|
||||
private void log(LocalPlayer player, String message, String comment) {
|
||||
String path = buildPath(player.getName());
|
||||
try {
|
||||
String date = dateFormat.format(new Date());
|
||||
String line = "[" + date + "] " + player.getName() + ": " + message
|
||||
+ (comment != null ? " (" + comment + ")" : "") + "\r\n";
|
||||
|
||||
FileLoggerWriter writer = writers.get(path);
|
||||
|
||||
// Writer already exists!
|
||||
if (writer != null) {
|
||||
try {
|
||||
BufferedWriter out = writer.getWriter();
|
||||
out.write(line);
|
||||
out.flush();
|
||||
writer.updateLastUse();
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
// Failed initial rewrite... let's re-open
|
||||
}
|
||||
}
|
||||
|
||||
// Make parent directory
|
||||
File file = new File(path);
|
||||
File parent = file.getParentFile();
|
||||
if (parent != null && !parent.exists()) {
|
||||
parent.mkdirs();
|
||||
}
|
||||
|
||||
FileWriter stream = new FileWriter(path, true);
|
||||
BufferedWriter out = new BufferedWriter(stream);
|
||||
out.write(line);
|
||||
out.flush();
|
||||
writer = new FileLoggerWriter(path, out);
|
||||
writers.put(path, writer);
|
||||
|
||||
// Check to make sure our cache doesn't get too big!
|
||||
if (writers.size() > cacheSize) {
|
||||
Iterator<Map.Entry<String,FileLoggerWriter>> it =
|
||||
writers.entrySet().iterator();
|
||||
|
||||
// Remove some entries
|
||||
for (; it.hasNext(); ) {
|
||||
Map.Entry<String,FileLoggerWriter> entry = it.next();
|
||||
try {
|
||||
entry.getValue().getWriter().close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
it.remove();
|
||||
|
||||
// Trimmed enough
|
||||
if (writers.size() <= cacheSize) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
logger.log(Level.WARNING, "Failed to log blacklist event to '"
|
||||
+ path + "': " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the coordinates in text form for the log.
|
||||
*
|
||||
* @param pos
|
||||
* @return
|
||||
*/
|
||||
private String getCoordinates(Vector pos) {
|
||||
return "@" + pos.getBlockX() + "," + pos.getBlockY() + "," + pos.getBlockZ();
|
||||
}
|
||||
|
||||
private void logEvent(BlacklistEvent event, String text, int id, Vector pos, String comment) {
|
||||
log(event.getPlayer(), "Tried to " + text + " " + getFriendlyItemName(id)
|
||||
+ " " + getCoordinates(pos), comment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an event.
|
||||
*
|
||||
* @param player
|
||||
* @param event
|
||||
*/
|
||||
public void logEvent(BlacklistEvent event, String comment) {
|
||||
// Block break
|
||||
if (event instanceof BlockBreakBlacklistEvent) {
|
||||
BlockBreakBlacklistEvent evt = (BlockBreakBlacklistEvent)event;
|
||||
logEvent(event, "break", evt.getType(), evt.getPosition(), comment);
|
||||
|
||||
// Block place
|
||||
} else if (event instanceof BlockPlaceBlacklistEvent) {
|
||||
BlockPlaceBlacklistEvent evt = (BlockPlaceBlacklistEvent)event;
|
||||
logEvent(event, "place", evt.getType(), evt.getPosition(), comment);
|
||||
|
||||
// Block interact
|
||||
} else if (event instanceof BlockInteractBlacklistEvent) {
|
||||
BlockInteractBlacklistEvent evt = (BlockInteractBlacklistEvent)event;
|
||||
logEvent(event, "interact with", evt.getType(), evt.getPosition(), comment);
|
||||
|
||||
// Destroy with
|
||||
} else if (event instanceof DestroyWithBlacklistEvent) {
|
||||
DestroyWithBlacklistEvent evt = (DestroyWithBlacklistEvent)event;
|
||||
logEvent(event, "destroy with", evt.getType(), evt.getPosition(), comment);
|
||||
|
||||
// Acquire
|
||||
} else if (event instanceof ItemAcquireBlacklistEvent) {
|
||||
ItemAcquireBlacklistEvent evt = (ItemAcquireBlacklistEvent)event;
|
||||
logEvent(event, "acquire", evt.getType(), evt.getPosition(), comment);
|
||||
|
||||
// Drop
|
||||
} else if (event instanceof ItemDropBlacklistEvent) {
|
||||
ItemDropBlacklistEvent evt = (ItemDropBlacklistEvent)event;
|
||||
logEvent(event, "drop", evt.getType(), evt.getPosition(), comment);
|
||||
|
||||
// Use
|
||||
} else if (event instanceof ItemUseBlacklistEvent) {
|
||||
ItemUseBlacklistEvent evt = (ItemUseBlacklistEvent)event;
|
||||
logEvent(event, "use", evt.getType(), evt.getPosition(), comment);
|
||||
|
||||
// Unknown
|
||||
} else {
|
||||
log(event.getPlayer(), "Unknown event: "
|
||||
+ event.getClass().getCanonicalName(), comment);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an item's friendly name with its ID.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
private static String getFriendlyItemName(int id) {
|
||||
ItemType type = ItemType.fromID(id);
|
||||
if (type != null) {
|
||||
return type.getName() + " (#" + id + ")";
|
||||
} else {
|
||||
return "#" + id + "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Close handles.
|
||||
*/
|
||||
public void close() {
|
||||
for (Map.Entry<String,FileLoggerWriter> entry : writers.entrySet()) {
|
||||
try {
|
||||
entry.getValue().getWriter().close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
writers.clear();
|
||||
}
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist.loggers;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class FileLoggerWriter implements Comparable<FileLoggerWriter> {
|
||||
/**
|
||||
* Path.
|
||||
*/
|
||||
public String path;
|
||||
/**
|
||||
* Writer.
|
||||
*/
|
||||
private BufferedWriter writer;
|
||||
/**
|
||||
* Last use.
|
||||
*/
|
||||
private long lastUse;
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
*
|
||||
* @param writer
|
||||
*/
|
||||
public FileLoggerWriter(String path, BufferedWriter writer) {
|
||||
this.path = path;
|
||||
this.writer = writer;
|
||||
lastUse = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* File path.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the writer
|
||||
*/
|
||||
public BufferedWriter getWriter() {
|
||||
return writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the lastUse
|
||||
*/
|
||||
public long getLastUse() {
|
||||
return lastUse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update last use time.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public void updateLastUse() {
|
||||
lastUse = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Comparison function.
|
||||
*
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
public int compareTo(FileLoggerWriter other) {
|
||||
if (lastUse > other.lastUse) {
|
||||
return 1;
|
||||
} else if (lastUse < other.lastUse) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import com.sk89q.worldguard.blacklist.Blacklist;
|
||||
|
||||
public class BukkitBlacklist extends Blacklist {
|
||||
private WorldGuardPlugin plugin;
|
||||
|
||||
public BukkitBlacklist(WorldGuardPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public void broadcastNotification(String msg) {
|
||||
for (Player player : plugin.getServer().getOnlinePlayers()) {
|
||||
if (plugin.hasPermission(player, "/worldguardnotify")) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
public class BukkitPlayer extends LocalPlayer {
|
||||
private Player player;
|
||||
private WorldGuardPlugin plugin;
|
||||
|
||||
public BukkitPlayer(WorldGuardPlugin plugin, Player player) {
|
||||
this.plugin = plugin;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return player.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGroup(String group) {
|
||||
return plugin.inGroup(player, group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getPosition() {
|
||||
Location loc = player.getLocation();
|
||||
return new Vector(loc.getX(), loc.getY(), loc.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void kick(String msg) {
|
||||
player.kickPlayer(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ban(String msg) {
|
||||
player.kickPlayer(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getGroups() {
|
||||
return plugin.getGroups(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printRaw(String msg) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import java.util.List;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
|
||||
public class BukkitUtil {
|
||||
private BukkitUtil() {
|
||||
}
|
||||
|
||||
public static BlockVector toVector(Block block) {
|
||||
return new BlockVector(block.getX(), block.getY(), block.getZ());
|
||||
}
|
||||
|
||||
public static Vector toVector(Location loc) {
|
||||
return new Vector(loc.getX(), loc.getY(), loc.getZ());
|
||||
}
|
||||
|
||||
public static Vector toVector(org.bukkit.util.Vector vector) {
|
||||
return new Vector(vector.getX(), vector.getY(), vector.getZ());
|
||||
}
|
||||
|
||||
public static Player matchSinglePlayer(Server server, String name) {
|
||||
List<Player> players = server.matchPlayer(name);
|
||||
if (players.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
return players.get(0);
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import java.util.logging.Handler;
|
||||
import java.util.logging.LogRecord;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Sends all logger messages to a player.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class LoggerToChatHandler extends Handler {
|
||||
/**
|
||||
* Player.
|
||||
*/
|
||||
private Player player;
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public LoggerToChatHandler(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the handler.
|
||||
*/
|
||||
public void close() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush the output.
|
||||
*/
|
||||
public void flush() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a log record.
|
||||
*/
|
||||
public void publish(LogRecord record) {
|
||||
player.sendMessage(ChatColor.GRAY + record.getLevel().getName() + ": "
|
||||
+ ChatColor.WHITE + record.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -1,396 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockDamageLevel;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.blacklist.events.*;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import com.sk89q.worldguard.protection.AreaFlags;
|
||||
import static com.sk89q.worldguard.bukkit.BukkitUtil.*;
|
||||
|
||||
public class WorldGuardBlockListener extends BlockListener {
|
||||
/**
|
||||
* Plugin.
|
||||
*/
|
||||
private WorldGuardPlugin plugin;
|
||||
|
||||
/**
|
||||
* Construct the object;
|
||||
*
|
||||
* @param plugin
|
||||
*/
|
||||
public WorldGuardBlockListener(WorldGuardPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a block is damaged (or broken)
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onBlockDamage(BlockDamageEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!plugin.itemDurability && event.getDamageLevel() == BlockDamageLevel.BROKEN) {
|
||||
ItemStack held = player.getItemInHand();
|
||||
if (held.getTypeId() > 0) {
|
||||
held.setDamage((byte)-1);
|
||||
player.setItemInHand(held);
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.useRegions && event.getDamageLevel() == BlockDamageLevel.BROKEN) {
|
||||
Vector pt = BukkitUtil.toVector(event.getBlock());
|
||||
LocalPlayer localPlayer = plugin.wrapPlayer(player);
|
||||
|
||||
if (!plugin.hasPermission(player, "/regionbypass")
|
||||
&& !plugin.regionManager.getApplicableRegions(pt).canBuild(localPlayer)) {
|
||||
player.sendMessage(ChatColor.DARK_RED + "You don't have permission for this area.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.blacklist != null && event.getDamageLevel() == BlockDamageLevel.BROKEN) {
|
||||
if (!plugin.blacklist.check(
|
||||
new BlockBreakBlacklistEvent(plugin.wrapPlayer(player),
|
||||
toVector(event.getBlock()),
|
||||
event.getBlock().getTypeId()), false, false)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!plugin.blacklist.check(
|
||||
new DestroyWithBlacklistEvent(plugin.wrapPlayer(player),
|
||||
toVector(event.getBlock()),
|
||||
player.getItemInHand().getTypeId()), false, false)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a block flows (water/lava)
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onBlockFlow(BlockFromToEvent event) {
|
||||
World world = event.getBlock().getWorld();
|
||||
Block blockFrom = event.getBlock();
|
||||
Block blockTo = event.getToBlock();
|
||||
|
||||
boolean isWater = blockFrom.getTypeId() == 8 || blockFrom.getTypeId() == 9;
|
||||
boolean isLava = blockFrom.getTypeId() == 10 || blockFrom.getTypeId() == 11;
|
||||
|
||||
if (plugin.simulateSponge && isWater) {
|
||||
int ox = blockTo.getX();
|
||||
int oy = blockTo.getY();
|
||||
int oz = blockTo.getZ();
|
||||
|
||||
for (int cx = -plugin.spongeRadius; cx <= plugin.spongeRadius; cx++) {
|
||||
for (int cy = -plugin.spongeRadius; cy <= plugin.spongeRadius; cy++) {
|
||||
for (int cz = -plugin.spongeRadius; cz <= plugin.spongeRadius; cz++) {
|
||||
if (world.getBlockTypeIdAt(ox + cx, oy + cy, oz + cz) == 19) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.classicWater && isWater) {
|
||||
int blockBelow = world.getBlockTypeIdAt(blockFrom.getX(), blockFrom.getY() - 1, blockFrom.getZ());
|
||||
if (blockBelow != 0 && blockBelow != 8 && blockBelow != 9) {
|
||||
world.getBlockAt(blockFrom.getX(), blockFrom.getY(), blockFrom.getZ()).setTypeId(9);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.preventWaterDamage.size() > 0 && isWater) {
|
||||
int targetId = world.getBlockTypeIdAt(
|
||||
blockTo.getX(), blockTo.getY(), blockTo.getZ());
|
||||
if (plugin.preventWaterDamage.contains(targetId)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.allowedLavaSpreadOver.size() > 0 && isLava) {
|
||||
int targetId = world.getBlockTypeIdAt(
|
||||
blockTo.getX(), blockTo.getY() - 1, blockTo.getZ());
|
||||
if (!plugin.allowedLavaSpreadOver.contains(targetId)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a block gets ignited
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onBlockIgnite(BlockIgniteEvent event) {
|
||||
IgniteCause cause = event.getCause();
|
||||
Block block = event.getBlock();
|
||||
//Player player = event.getPlayer();
|
||||
World world = block.getWorld();
|
||||
boolean isFireSpread = cause == IgniteCause.SLOW_SPREAD
|
||||
|| cause == IgniteCause.SPREAD;
|
||||
|
||||
if (plugin.preventLavaFire && cause == IgniteCause.LAVA) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.disableFireSpread && isFireSpread) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.blockLighter && cause == IgniteCause.FLINT_AND_STEEL) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.fireSpreadDisableToggle && isFireSpread) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.disableFireSpreadBlocks.size() > 0 && isFireSpread) {
|
||||
int x = block.getX();
|
||||
int y = block.getY();
|
||||
int z = block.getZ();
|
||||
|
||||
if (plugin.disableFireSpreadBlocks.contains(world.getBlockTypeIdAt(x, y - 1, z))
|
||||
|| plugin.disableFireSpreadBlocks.contains(world.getBlockTypeIdAt(x + 1, y, z))
|
||||
|| plugin.disableFireSpreadBlocks.contains(world.getBlockTypeIdAt(x - 1, y, z))
|
||||
|| plugin.disableFireSpreadBlocks.contains(world.getBlockTypeIdAt(x, y, z - 1))
|
||||
|| plugin.disableFireSpreadBlocks.contains(world.getBlockTypeIdAt(x, y, z + 1))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*if (plugin.useRegions) {
|
||||
Vector pt = toVector(block);
|
||||
|
||||
if (player != null && !plugin.hasPermission(player, "/regionbypass")) {
|
||||
LocalPlayer localPlayer = plugin.wrapPlayer(player);
|
||||
|
||||
if (cause == IgniteCause.FLINT_AND_STEEL
|
||||
&& !plugin.regionManager.getApplicableRegions(pt).canBuild(localPlayer)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cause == IgniteCause.FLINT_AND_STEEL
|
||||
&& !plugin.regionManager.getApplicableRegions(pt)
|
||||
.allowsFlag(AreaFlags.FLAG_LIGHTER)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
f (isFireSpread && !plugin.regionManager.getApplicableRegions(pt)
|
||||
.allowsFlag(AreaFlags.FLAG_FIRE_SPREAD)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cause == IgniteCause.LAVA && !plugin.regionManager.getApplicableRegions(pt)
|
||||
.allowsFlag(AreaFlags.FLAG_LAVA_FIRE)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when block physics occurs
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||
int id = event.getChangedTypeId();
|
||||
|
||||
if (id == 13 && plugin.noPhysicsGravel) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (id == 12 && plugin.noPhysicsSand) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (id == 90 && plugin.allowPortalAnywhere) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a block is interacted with
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockInteract(BlockInteractEvent event) {
|
||||
Block block = event.getBlock();
|
||||
LivingEntity entity = event.getEntity();
|
||||
|
||||
if (entity instanceof Player
|
||||
&& (block.getType() == Material.CHEST
|
||||
|| block.getType() == Material.DISPENSER
|
||||
|| block.getType() == Material.FURNACE
|
||||
|| block.getType() == Material.BURNING_FURNACE
|
||||
|| block.getType() == Material.NOTE_BLOCK)) {
|
||||
Player player = (Player)entity;
|
||||
if (plugin.useRegions) {
|
||||
Vector pt = toVector(block);
|
||||
LocalPlayer localPlayer = plugin.wrapPlayer(player);
|
||||
|
||||
if (!plugin.hasPermission(player, "/regionbypass")
|
||||
&& !plugin.regionManager.getApplicableRegions(pt).allowsFlag(AreaFlags.FLAG_CHEST_ACCESS)
|
||||
&& !plugin.regionManager.getApplicableRegions(pt).canBuild(localPlayer)) {
|
||||
player.sendMessage(ChatColor.DARK_RED + "You don't have permission for this area.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.blacklist != null && entity instanceof Player) {
|
||||
Player player = (Player)entity;
|
||||
|
||||
if (!plugin.blacklist.check(
|
||||
new BlockInteractBlacklistEvent(plugin.wrapPlayer(player), toVector(block),
|
||||
block.getTypeId()), false, false)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player places a block
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
Block blockPlaced = event.getBlock();
|
||||
Player player = event.getPlayer();
|
||||
World world = blockPlaced.getWorld();
|
||||
|
||||
if (plugin.useRegions) {
|
||||
Vector pt = toVector(blockPlaced);
|
||||
LocalPlayer localPlayer = plugin.wrapPlayer(player);
|
||||
|
||||
if (!plugin.hasPermission(player, "/regionbypass")
|
||||
&& !plugin.regionManager.getApplicableRegions(pt).canBuild(localPlayer)) {
|
||||
player.sendMessage(ChatColor.DARK_RED + "You don't have permission for this area.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.blacklist != null) {
|
||||
if (!plugin.blacklist.check(
|
||||
new BlockPlaceBlacklistEvent(plugin.wrapPlayer(player), toVector(blockPlaced),
|
||||
blockPlaced.getTypeId()), false, false)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.simulateSponge && blockPlaced.getTypeId() == 19) {
|
||||
int ox = blockPlaced.getX();
|
||||
int oy = blockPlaced.getY();
|
||||
int oz = blockPlaced.getZ();
|
||||
|
||||
for (int cx = -plugin.spongeRadius; cx <= plugin.spongeRadius; cx++) {
|
||||
for (int cy = -plugin.spongeRadius; cy <= plugin.spongeRadius; cy++) {
|
||||
for (int cz = -plugin.spongeRadius; cz <= plugin.spongeRadius; cz++) {
|
||||
int id = world.getBlockTypeIdAt(ox + cx, oy + cy, oz + cz);
|
||||
if (id == 8 || id == 9) {
|
||||
world.getBlockAt(ox + cx, oy + cy, oz + cz)
|
||||
.setTypeId(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player right clicks a block
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onBlockRightClick(BlockRightClickEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (plugin.useRegions && event.getItemInHand().getTypeId() == plugin.regionWand) {
|
||||
Vector pt = toVector(event.getBlock());
|
||||
ApplicableRegionSet app = plugin.regionManager.getApplicableRegions(pt);
|
||||
List<String> regions = plugin.regionManager.getApplicableRegionsIDs(pt);
|
||||
|
||||
if (regions.size() > 0) {
|
||||
player.sendMessage(ChatColor.YELLOW + "Can you build? "
|
||||
+ (app.canBuild(plugin.wrapPlayer(player)) ? "Yes" : "No"));
|
||||
|
||||
StringBuilder str = new StringBuilder();
|
||||
for (Iterator<String> it = regions.iterator(); it.hasNext(); ) {
|
||||
str.append(it.next());
|
||||
if (it.hasNext()) {
|
||||
str.append(", ");
|
||||
}
|
||||
}
|
||||
|
||||
player.sendMessage(ChatColor.YELLOW + "Applicable regions: " + str.toString());
|
||||
} else {
|
||||
player.sendMessage(ChatColor.YELLOW + "WorldGuard: No defined regions here!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,291 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Creeper;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.*;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BlockType;
|
||||
import com.sk89q.worldguard.protection.AreaFlags;
|
||||
import static com.sk89q.worldguard.bukkit.BukkitUtil.*;
|
||||
|
||||
public class WorldGuardEntityListener extends EntityListener {
|
||||
/**
|
||||
* Plugin.
|
||||
*/
|
||||
private WorldGuardPlugin plugin;
|
||||
|
||||
/**
|
||||
* Construct the object;
|
||||
*
|
||||
* @param plugin
|
||||
*/
|
||||
public WorldGuardEntityListener(WorldGuardPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
|
||||
Entity defender = event.getEntity();
|
||||
DamageCause type = event.getCause();
|
||||
|
||||
if (defender instanceof Player) {
|
||||
Player player = (Player)defender;
|
||||
|
||||
if (plugin.invinciblePlayers.contains(player.getName())) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.disableLavaDamage && type == DamageCause.LAVA) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
Entity attacker = event.getDamager();
|
||||
Entity defender = event.getEntity();
|
||||
|
||||
if (defender instanceof Player) {
|
||||
Player player = (Player)defender;
|
||||
|
||||
if (plugin.invinciblePlayers.contains(player.getName())) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (attacker != null && attacker instanceof Player) {
|
||||
if (plugin.useRegions) {
|
||||
Vector pt = toVector(defender.getLocation());
|
||||
|
||||
if (!plugin.regionManager.getApplicableRegions(pt)
|
||||
.allowsFlag(AreaFlags.FLAG_PVP)) {
|
||||
((Player)attacker).sendMessage(ChatColor.DARK_RED + "You are in a no-PvP area.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (attacker != null && attacker instanceof Monster) {
|
||||
if (attacker instanceof Creeper && plugin.blockCreeperExplosions) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.useRegions) {
|
||||
Vector pt = toVector(defender.getLocation());
|
||||
|
||||
if (!plugin.regionManager.getApplicableRegions(pt)
|
||||
.allowsFlag(AreaFlags.FLAG_MOB_DAMAGE)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (attacker instanceof Creeper) {
|
||||
if (!plugin.regionManager.getApplicableRegions(pt)
|
||||
.allowsFlag(AreaFlags.FLAG_CREEPER_EXPLOSION)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onEntityDamageByProjectile(EntityDamageByProjectileEvent event) {
|
||||
Entity defender = event.getEntity();
|
||||
Entity attacker = event.getDamager();
|
||||
|
||||
if (defender instanceof Player) {
|
||||
Player player = (Player)defender;
|
||||
|
||||
if (plugin.invinciblePlayers.contains(player.getName())) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (attacker != null && attacker instanceof Player) {
|
||||
if (plugin.useRegions) {
|
||||
Vector pt = toVector(defender.getLocation());
|
||||
|
||||
if (!plugin.regionManager.getApplicableRegions(pt)
|
||||
.allowsFlag(AreaFlags.FLAG_PVP)) {
|
||||
((Player)attacker).sendMessage(ChatColor.DARK_RED + "You are in a no-PvP area.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
Entity defender = event.getEntity();
|
||||
DamageCause type = event.getCause();
|
||||
|
||||
if (defender instanceof Player) {
|
||||
Player player = (Player)defender;
|
||||
|
||||
if (plugin.invinciblePlayers.contains(player.getName())) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.disableFallDamage && type == DamageCause.FALL) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.disableFireDamage && (type == DamageCause.FIRE
|
||||
|| type == DamageCause.FIRE_TICK)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.disableDrowningDamage && type == DamageCause.DROWNING) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.teleportOnSuffocation && type == DamageCause.SUFFOCATION) {
|
||||
findFreePosition(player);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.disableSuffocationDamage && type == DamageCause.SUFFOCATION) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.disableContactDamage && type == DamageCause.CONTACT) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == DamageCause.DROWNING
|
||||
&& plugin.amphibiousPlayers.contains(player.getName())) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityExplode(EntityExplodeEvent event) {
|
||||
if (event.getEntity() instanceof LivingEntity) {
|
||||
if (plugin.blockCreeperBlockDamage) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.blockCreeperExplosions) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!plugin.regionManager.getApplicableRegions(BukkitUtil.toVector(event.getEntity().getLocation()))
|
||||
.allowsFlag(AreaFlags.FLAG_CREEPER_EXPLOSION)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.useRegions) {
|
||||
Vector pt = toVector(event.getEntity().getLocation());
|
||||
|
||||
if (!plugin.regionManager.getApplicableRegions(pt)
|
||||
.allowsFlag(AreaFlags.FLAG_CREEPER_EXPLOSION)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else { // Shall assume that this is TNT
|
||||
if (plugin.blockTNT) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.useRegions && event.getEntity() != null) {
|
||||
Vector pt = toVector(event.getEntity().getLocation());
|
||||
|
||||
if (!plugin.regionManager.getApplicableRegions(pt)
|
||||
.allowsFlag(AreaFlags.FLAG_TNT)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a position for the player to stand that is not inside a block.
|
||||
* Blocks above the player will be iteratively tested until there is
|
||||
* a series of two free blocks. The player will be teleported to
|
||||
* that free position.
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public void findFreePosition(Player player) {
|
||||
Location loc = player.getLocation();
|
||||
int x = loc.getBlockX();
|
||||
int y = Math.max(0, loc.getBlockY());
|
||||
int origY = y;
|
||||
int z = loc.getBlockZ();
|
||||
World world = player.getWorld();
|
||||
|
||||
byte free = 0;
|
||||
|
||||
while (y <= 129) {
|
||||
if (BlockType.canPassThrough(world.getBlockTypeIdAt(x, y, z))) {
|
||||
free++;
|
||||
} else {
|
||||
free = 0;
|
||||
}
|
||||
|
||||
if (free == 2) {
|
||||
if (y - 1 != origY) {
|
||||
loc.setX(x + 0.5);
|
||||
loc.setY(y);
|
||||
loc.setZ(z + 0.5);
|
||||
player.teleportTo(loc);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
y++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.*;
|
||||
import com.sk89q.worldguard.blacklist.events.ItemUseBlacklistEvent;
|
||||
import com.sk89q.worldguard.protection.AreaFlags;
|
||||
import static com.sk89q.worldguard.bukkit.BukkitUtil.*;
|
||||
|
||||
/**
|
||||
* Handles all events thrown in relation to a Player
|
||||
*/
|
||||
public class WorldGuardPlayerListener extends PlayerListener {
|
||||
/**
|
||||
* Plugin.
|
||||
*/
|
||||
private WorldGuardPlugin plugin;
|
||||
|
||||
/**
|
||||
* Construct the object;
|
||||
*
|
||||
* @param plugin
|
||||
*/
|
||||
public WorldGuardPlayerListener(WorldGuardPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player joins a server
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onPlayerJoin(PlayerEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (plugin.fireSpreadDisableToggle) {
|
||||
player.sendMessage(ChatColor.YELLOW
|
||||
+ "Fire spread is currently globally disabled.");
|
||||
}
|
||||
|
||||
if (plugin.inGroup(player, "wg-invincible")) {
|
||||
plugin.invinciblePlayers.add(player.getName());
|
||||
}
|
||||
|
||||
if (plugin.inGroup(player, "wg-amphibious")) {
|
||||
plugin.amphibiousPlayers.add(player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player leaves a server
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onPlayerQuit(PlayerEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
plugin.invinciblePlayers.remove(player.getName());
|
||||
plugin.amphibiousPlayers.remove(player.getName());
|
||||
if (plugin.blacklist != null) {
|
||||
plugin.blacklist.forgetPlayer(plugin.wrapPlayer(player));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player uses an item
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onPlayerItem(PlayerItemEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Block block = event.getBlockClicked();
|
||||
ItemStack item = event.getItem();
|
||||
|
||||
if (plugin.useRegions && !event.isBlock() && block != null) {
|
||||
Vector pt = toVector(block.getRelative(event.getBlockFace()));
|
||||
LocalPlayer localPlayer = plugin.wrapPlayer(player);
|
||||
|
||||
if (!plugin.hasPermission(player, "/regionbypass")
|
||||
&& !plugin.regionManager.getApplicableRegions(pt).canBuild(localPlayer)) {
|
||||
player.sendMessage(ChatColor.DARK_RED
|
||||
+ "You don't have permission for this area.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.blacklist != null && item != null && block != null) {
|
||||
if (!plugin.blacklist.check(
|
||||
new ItemUseBlacklistEvent(plugin.wrapPlayer(player),
|
||||
toVector(block.getRelative(event.getBlockFace())),
|
||||
item.getTypeId()), false, false)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.useRegions && item != null && block != null && item.getTypeId() == 259) {
|
||||
Vector pt = toVector(block.getRelative(event.getBlockFace()));
|
||||
|
||||
if (!plugin.regionManager.getApplicableRegions(pt)
|
||||
.allowsFlag(AreaFlags.FLAG_LIGHTER)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player attempts to log in to the server
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (plugin.enforceOneSession) {
|
||||
String name = player.getName();
|
||||
|
||||
for (Player pl : plugin.getServer().getOnlinePlayers()) {
|
||||
if (pl.getName().equalsIgnoreCase(name)) {
|
||||
pl.kickPlayer("Logged in from another location.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,126 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.domains;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
public class DefaultDomain implements Domain {
|
||||
private Set<String> groups;
|
||||
private Set<String> players;
|
||||
|
||||
public DefaultDomain() {
|
||||
this.groups = new LinkedHashSet<String>();
|
||||
this.players = new HashSet<String>();
|
||||
}
|
||||
|
||||
public void addPlayer(String name) {
|
||||
players.add(name.toLowerCase());
|
||||
}
|
||||
|
||||
public void addPlayer(LocalPlayer player) {
|
||||
players.add(player.getName().toLowerCase());
|
||||
}
|
||||
|
||||
public void removePlayer(String name) {
|
||||
players.remove(name.toLowerCase());
|
||||
}
|
||||
|
||||
public void removePlayer(LocalPlayer player) {
|
||||
players.remove(player.getName().toLowerCase());
|
||||
}
|
||||
|
||||
public void addGroup(String name) {
|
||||
groups.add(name.toLowerCase());
|
||||
}
|
||||
|
||||
public void removeGroup(String name) {
|
||||
groups.remove(name.toLowerCase());
|
||||
}
|
||||
|
||||
public Set<String> getGroups() {
|
||||
return groups;
|
||||
}
|
||||
|
||||
public Set<String> getPlayers() {
|
||||
return players;
|
||||
}
|
||||
|
||||
public boolean contains(LocalPlayer player) {
|
||||
if (players.contains(player.getName().toLowerCase())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (String group : groups) {
|
||||
if (player.hasGroup(group)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return groups.size();
|
||||
}
|
||||
|
||||
public String toPlayersString() {
|
||||
StringBuilder str = new StringBuilder();
|
||||
for (Iterator<String> it = players.iterator(); it.hasNext(); ) {
|
||||
str.append(it.next());
|
||||
if (it.hasNext()) {
|
||||
str.append(", ");
|
||||
}
|
||||
}
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
public String toGroupsString() {
|
||||
StringBuilder str = new StringBuilder();
|
||||
for (Iterator<String> it = groups.iterator(); it.hasNext(); ) {
|
||||
str.append("*");
|
||||
str.append(it.next());
|
||||
if (it.hasNext()) {
|
||||
str.append(", ");
|
||||
}
|
||||
}
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
public String toUserFriendlyString() {
|
||||
StringBuilder str = new StringBuilder();
|
||||
if (players.size() > 0) {
|
||||
str.append(toPlayersString());
|
||||
}
|
||||
|
||||
if (groups.size() > 0) {
|
||||
if (str.length() > 0) {
|
||||
str.append("; ");
|
||||
}
|
||||
|
||||
str.append(toGroupsString());
|
||||
}
|
||||
|
||||
return str.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.sk89q.worldguard.domains;
|
||||
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
public interface Domain {
|
||||
/**
|
||||
* Returns true if a domain contains a player.
|
||||
*
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
public boolean contains(LocalPlayer player);
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.domains;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.LinkedHashSet;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
public class DomainCollection implements Domain {
|
||||
private Set<Domain> domains;
|
||||
|
||||
public DomainCollection() {
|
||||
domains = new LinkedHashSet<Domain>();
|
||||
}
|
||||
|
||||
public void add(Domain domain) {
|
||||
domains.add(domain);
|
||||
}
|
||||
|
||||
public void remove(Domain domain) {
|
||||
domains.remove(domain);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return domains.size();
|
||||
}
|
||||
|
||||
public boolean contains(LocalPlayer player) {
|
||||
for (Domain domain : domains) {
|
||||
if (domain.contains(player)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.domains;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
import java.util.LinkedHashSet;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
public class GroupDomain implements Domain {
|
||||
private Set<String> groups;
|
||||
|
||||
public GroupDomain() {
|
||||
this.groups = new LinkedHashSet<String>();
|
||||
}
|
||||
|
||||
public GroupDomain(String[] groups) {
|
||||
this.groups = new LinkedHashSet<String>(Arrays.asList(groups));
|
||||
}
|
||||
|
||||
public void addGroup(String name) {
|
||||
groups.add(name);
|
||||
}
|
||||
|
||||
public boolean contains(LocalPlayer player) {
|
||||
for (String group : groups) {
|
||||
if (player.hasGroup(group)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return groups.size();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.domains;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
public class PlayerDomain implements Domain {
|
||||
private Set<String> players;
|
||||
|
||||
public PlayerDomain() {
|
||||
this.players = new HashSet<String>();
|
||||
}
|
||||
|
||||
public PlayerDomain(String[] players) {
|
||||
this.players = new HashSet<String>();
|
||||
|
||||
for (String name : players) {
|
||||
this.players.add(name.toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
public void addPlayer(String name) {
|
||||
players.add(name.toLowerCase());
|
||||
}
|
||||
|
||||
public boolean contains(LocalPlayer player) {
|
||||
return players.contains(player.getName().toLowerCase());
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return players.size();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.protection;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.SortedMap;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.protection.AreaFlags.State;
|
||||
|
||||
/**
|
||||
* Represents a set of regions and their rules as applied to one point.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class ApplicableRegionSet {
|
||||
private GlobalFlags global;
|
||||
private Vector pt;
|
||||
private SortedMap<String,ProtectedRegion> regions;
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
*
|
||||
* @param pt
|
||||
* @param regions
|
||||
* @param global
|
||||
*/
|
||||
public ApplicableRegionSet(Vector pt, SortedMap<String,ProtectedRegion> regions,
|
||||
GlobalFlags global) {
|
||||
this.pt = pt;
|
||||
this.regions = regions;
|
||||
this.global = global;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a player can build in an area.
|
||||
*
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
public boolean canBuild(LocalPlayer player) {
|
||||
return isFlagAllowed(AreaFlags.FLAG_BUILD, global.canBuild, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks a flag.
|
||||
*
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
public boolean allowsFlag(String flag) {
|
||||
boolean def = true;
|
||||
|
||||
if (flag.equals(AreaFlags.FLAG_CHEST_ACCESS)) {
|
||||
def = global.canAccessChests;
|
||||
}
|
||||
|
||||
return isFlagAllowed(flag, def, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if a flag is permitted.
|
||||
*
|
||||
* @param def default state if there are no regions defined
|
||||
* @param player null to not check owners and members
|
||||
* @return
|
||||
*/
|
||||
private boolean isFlagAllowed(String flag, boolean def, LocalPlayer player) {
|
||||
boolean found = false;
|
||||
boolean allowed = false; // Used for ALLOW override
|
||||
if (player == null) {
|
||||
allowed = def;
|
||||
}
|
||||
int lastPriority = 0;
|
||||
|
||||
// The algorithm is as follows:
|
||||
// While iterating through the list of regions, if an entry disallows
|
||||
// the flag, then put it into the needsClear set. If an entry allows
|
||||
// the flag and it has a parent, then its parent is put into hasCleared.
|
||||
// In the situation that the child is reached before the parent, upon
|
||||
// the parent being reached, even if the parent disallows, because the
|
||||
// parent will be in hasCleared, permission will be allowed. In the
|
||||
// other case, where the parent is reached first, if it does not allow
|
||||
// permissions, it will be placed into needsClear. If a child of
|
||||
// the parent is reached later, the parent will be removed from
|
||||
// needsClear. At the end, if needsClear is not empty, that means that
|
||||
// permission should not be given. If a parent has multiple children
|
||||
// and one child does not allow permissions, then it will be placed into
|
||||
// needsClear just like as if was a parent.
|
||||
|
||||
Set<ProtectedRegion> needsClear = new HashSet<ProtectedRegion>();
|
||||
Set<ProtectedRegion> hasCleared = new HashSet<ProtectedRegion>();
|
||||
|
||||
for (ProtectedRegion region : regions.values()) {
|
||||
// Ignore non-build regions
|
||||
if (player != null && region.getFlags().get(AreaFlags.FLAG_PASSTHROUGH) == State.ALLOW) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Forget about regions that are not covered
|
||||
if (!region.contains(pt)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Allow DENY to override everything
|
||||
if (region.getFlags().get(flag) == State.DENY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Forget about regions that allow it, although make sure the
|
||||
// default state is now to allow
|
||||
if (region.getFlags().get(flag) == State.ALLOW) {
|
||||
allowed = true;
|
||||
found = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore lower priority regions
|
||||
if (found && region.getPriority() < lastPriority) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
if (hasCleared.contains(region)) {
|
||||
// Already cleared, so do nothing
|
||||
} else {
|
||||
if (!region.isMember(player)) {
|
||||
needsClear.add(region);
|
||||
} else {
|
||||
// Need to clear all parents
|
||||
clearParents(needsClear, hasCleared, region);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
found = true;
|
||||
lastPriority = region.getPriority();
|
||||
}
|
||||
|
||||
return (found == false ? def : allowed)
|
||||
|| (player != null && needsClear.size() == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear a region's parents for isFlagAllowed().
|
||||
*
|
||||
* @param needsClear
|
||||
* @param hasCleared
|
||||
* @param region
|
||||
*/
|
||||
private void clearParents(Set<ProtectedRegion> needsClear,
|
||||
Set<ProtectedRegion> hasCleared, ProtectedRegion region) {
|
||||
ProtectedRegion parent = region.getParent();
|
||||
|
||||
while (parent != null) {
|
||||
if (!needsClear.remove(parent)) {
|
||||
hasCleared.add(parent);
|
||||
}
|
||||
|
||||
parent = parent.getParent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.protection;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Holds the flags for a region.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class AreaFlags {
|
||||
public enum State {
|
||||
NONE,
|
||||
ALLOW,
|
||||
DENY,
|
||||
};
|
||||
|
||||
public static final String FLAG_PASSTHROUGH = "z";
|
||||
public static final String FLAG_BUILD = "b";
|
||||
public static final String FLAG_PVP = "p";
|
||||
public static final String FLAG_MOB_DAMAGE = "m";
|
||||
public static final String FLAG_CREEPER_EXPLOSION = "c";
|
||||
public static final String FLAG_TNT = "t";
|
||||
public static final String FLAG_LIGHTER = "l";
|
||||
public static final String FLAG_FIRE_SPREAD = "f";
|
||||
public static final String FLAG_LAVA_FIRE = "F";
|
||||
public static final String FLAG_CHEST_ACCESS = "c";
|
||||
|
||||
/**
|
||||
* Get the user-friendly name of a flag. If a name isn't known, then
|
||||
* the flag is returned unchanged.
|
||||
*
|
||||
* @param flag
|
||||
* @return
|
||||
*/
|
||||
public static String getFlagName(String flag) {
|
||||
if (flag.equals(FLAG_PASSTHROUGH)) {
|
||||
return "passthrough";
|
||||
} else if (flag.equals(FLAG_BUILD)) {
|
||||
return "build";
|
||||
} else if (flag.equals(FLAG_PVP)) {
|
||||
return "PvP";
|
||||
} else if (flag.equals(FLAG_MOB_DAMAGE)) {
|
||||
return "mob damage";
|
||||
} else if (flag.equals(FLAG_CREEPER_EXPLOSION)) {
|
||||
return "creeper explosion";
|
||||
} else if (flag.equals(FLAG_TNT)) {
|
||||
return "TNT";
|
||||
} else if (flag.equals(FLAG_LIGHTER)) {
|
||||
return "lighter";
|
||||
} else if (flag.equals(FLAG_FIRE_SPREAD)) {
|
||||
return "fire spread";
|
||||
} else if (flag.equals(FLAG_LAVA_FIRE)) {
|
||||
return "lava fire spread";
|
||||
} else if (flag.equals(FLAG_CHEST_ACCESS)) {
|
||||
return "chest access";
|
||||
} else {
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a flag from an alias. May return null.
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static String fromAlias(String name) {
|
||||
if (name.equalsIgnoreCase("passthrough")) {
|
||||
return FLAG_PASSTHROUGH;
|
||||
} else if (name.equalsIgnoreCase("build")) {
|
||||
return FLAG_BUILD;
|
||||
} else if (name.equalsIgnoreCase("pvp")) {
|
||||
return FLAG_PVP;
|
||||
} else if (name.equalsIgnoreCase("mobdamage")) {
|
||||
return FLAG_MOB_DAMAGE;
|
||||
} else if (name.equalsIgnoreCase("creeper")) {
|
||||
return FLAG_CREEPER_EXPLOSION;
|
||||
} else if (name.equalsIgnoreCase("tnt")) {
|
||||
return FLAG_TNT;
|
||||
} else if (name.equalsIgnoreCase("lighter")) {
|
||||
return FLAG_LIGHTER;
|
||||
} else if (name.equalsIgnoreCase("firespread")) {
|
||||
return FLAG_FIRE_SPREAD;
|
||||
} else if (name.equalsIgnoreCase("lavafirespread")) {
|
||||
return FLAG_LAVA_FIRE;
|
||||
} else if (name.equalsIgnoreCase("chest")) {
|
||||
return FLAG_CHEST_ACCESS;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, State> states = new HashMap<String, State>();
|
||||
|
||||
public State get(String flag) {
|
||||
State state = states.get(flag);
|
||||
if (state == null) {
|
||||
return State.NONE;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
public void set(String flag, State state) {
|
||||
if (state == State.NONE) {
|
||||
states.remove(flag);
|
||||
} else {
|
||||
states.put(flag, state);
|
||||
}
|
||||
}
|
||||
|
||||
public Set<Map.Entry<String, State>> entrySet() {
|
||||
return states.entrySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof AreaFlags)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
AreaFlags other = (AreaFlags)obj;
|
||||
return other.states.equals(this);
|
||||
}
|
||||
}
|
||||
@@ -1,414 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.protection;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.io.*;
|
||||
import au.com.bytecode.opencsv.CSVReader;
|
||||
import au.com.bytecode.opencsv.CSVWriter;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.domains.DefaultDomain;
|
||||
import com.sk89q.worldguard.protection.AreaFlags.State;
|
||||
import com.sk89q.worldguard.protection.ProtectedRegion.CircularInheritanceException;
|
||||
import com.sk89q.worldguard.util.ArrayReader;
|
||||
|
||||
/**
|
||||
* Represents a protected area database that uses CSV files.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class CSVDatabase implements ProtectionDatabase {
|
||||
private static Logger logger = Logger.getLogger("Minecraft.WorldGuard");
|
||||
|
||||
/**
|
||||
* References the CSV file.
|
||||
*/
|
||||
private File file;
|
||||
/**
|
||||
* Holds the list of regions.
|
||||
*/
|
||||
private Map<String,ProtectedRegion> regions;
|
||||
|
||||
/**
|
||||
* Construct the database with a path to a file. No file is read or
|
||||
* written at this time.
|
||||
*
|
||||
* @param file
|
||||
*/
|
||||
public CSVDatabase(File file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the database.
|
||||
*/
|
||||
@Override
|
||||
public void save() throws IOException {
|
||||
CSVWriter writer = new CSVWriter(new FileWriter(file));
|
||||
|
||||
try {
|
||||
for (Map.Entry<String,ProtectedRegion> entry : regions.entrySet()) {
|
||||
String id = entry.getKey();
|
||||
ProtectedRegion region = entry.getValue();
|
||||
|
||||
if (!(region instanceof ProtectedCuboidRegion)) {
|
||||
logger.warning("The CSV database only supports cuboid regions.");
|
||||
continue;
|
||||
}
|
||||
|
||||
ProtectedCuboidRegion cuboid = (ProtectedCuboidRegion)region;
|
||||
BlockVector min = cuboid.getMinimumPoint();
|
||||
BlockVector max = cuboid.getMaximumPoint();
|
||||
|
||||
writer.writeNext(new String[] {
|
||||
id,
|
||||
"cuboid.2",
|
||||
String.valueOf(min.getBlockX()),
|
||||
String.valueOf(min.getBlockY()),
|
||||
String.valueOf(min.getBlockZ()),
|
||||
String.valueOf(max.getBlockX()),
|
||||
String.valueOf(max.getBlockY()),
|
||||
String.valueOf(max.getBlockZ()),
|
||||
String.valueOf(cuboid.getPriority()),
|
||||
cuboid.getParent() != null ? cuboid.getParent().getId() : "",
|
||||
writeDomains(cuboid.getOwners()),
|
||||
writeDomains(cuboid.getMembers()),
|
||||
writeFlags(cuboid.getFlags()),
|
||||
cuboid.getEnterMessage() != null ? cuboid.getEnterMessage() : "",
|
||||
cuboid.getLeaveMessage() != null ? cuboid.getLeaveMessage() : "",
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the database from file.
|
||||
*/
|
||||
@Override
|
||||
public void load() throws IOException {
|
||||
Map<String,ProtectedRegion> regions =
|
||||
new HashMap<String,ProtectedRegion>();
|
||||
Map<ProtectedRegion,String> parentSets =
|
||||
new LinkedHashMap<ProtectedRegion, String>();
|
||||
|
||||
CSVReader reader = new CSVReader(new FileReader(file));
|
||||
|
||||
try {
|
||||
String[] line;
|
||||
|
||||
while ((line = reader.readNext()) != null) {
|
||||
if (line.length < 2) {
|
||||
logger.warning("Invalid region definition: " + line);
|
||||
continue;
|
||||
}
|
||||
|
||||
String id = line[0].toLowerCase();
|
||||
String type = line[1];
|
||||
ArrayReader<String> entries = new ArrayReader<String>(line);
|
||||
|
||||
if (type.equalsIgnoreCase("cuboid")) {
|
||||
if (line.length < 8) {
|
||||
logger.warning("Invalid region definition: " + line);
|
||||
continue;
|
||||
}
|
||||
|
||||
Vector pt1 = new Vector(
|
||||
Integer.parseInt(line[2]),
|
||||
Integer.parseInt(line[3]),
|
||||
Integer.parseInt(line[4]));
|
||||
Vector pt2 = new Vector(
|
||||
Integer.parseInt(line[5]),
|
||||
Integer.parseInt(line[6]),
|
||||
Integer.parseInt(line[7]));
|
||||
|
||||
BlockVector min = Vector.getMinimum(pt1, pt2).toBlockVector();
|
||||
BlockVector max = Vector.getMaximum(pt1, pt2).toBlockVector();
|
||||
|
||||
int priority = entries.get(8) == null ? 0 : Integer.parseInt(entries.get(8));
|
||||
String ownersData = entries.get(9);
|
||||
String flagsData = entries.get(10);
|
||||
String enterMessage = nullEmptyString(entries.get(11));
|
||||
|
||||
ProtectedRegion region = new ProtectedCuboidRegion(id, min, max);
|
||||
region.setPriority(priority);
|
||||
region.setFlags(parseFlags(flagsData));
|
||||
region.setOwners(this.parseDomains(ownersData));
|
||||
region.setEnterMessage(enterMessage);
|
||||
regions.put(id, region);
|
||||
} else if (type.equalsIgnoreCase("cuboid.2")) {
|
||||
Vector pt1 = new Vector(
|
||||
Integer.parseInt(line[2]),
|
||||
Integer.parseInt(line[3]),
|
||||
Integer.parseInt(line[4]));
|
||||
Vector pt2 = new Vector(
|
||||
Integer.parseInt(line[5]),
|
||||
Integer.parseInt(line[6]),
|
||||
Integer.parseInt(line[7]));
|
||||
|
||||
BlockVector min = Vector.getMinimum(pt1, pt2).toBlockVector();
|
||||
BlockVector max = Vector.getMaximum(pt1, pt2).toBlockVector();
|
||||
|
||||
int priority = entries.get(8) == null ? 0 : Integer.parseInt(entries.get(8));
|
||||
String parentId = entries.get(9);
|
||||
String ownersData = entries.get(10);
|
||||
String membersData = entries.get(11);
|
||||
String flagsData = entries.get(12);
|
||||
String enterMessage = nullEmptyString(entries.get(13));
|
||||
String leaveMessage = nullEmptyString(entries.get(14));
|
||||
|
||||
ProtectedRegion region = new ProtectedCuboidRegion(id, min, max);
|
||||
region.setPriority(priority);
|
||||
region.setFlags(parseFlags(flagsData));
|
||||
region.setOwners(this.parseDomains(ownersData));
|
||||
region.setMembers(this.parseDomains(membersData));
|
||||
region.setEnterMessage(enterMessage);
|
||||
region.setLeaveMessage(leaveMessage);
|
||||
regions.put(id, region);
|
||||
|
||||
// Link children to parents later
|
||||
if (parentId.length() > 0) {
|
||||
parentSets.put(region, parentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<ProtectedRegion, String> entry : parentSets.entrySet()) {
|
||||
ProtectedRegion parent = regions.get(entry.getValue());
|
||||
if (parent != null) {
|
||||
try {
|
||||
entry.getKey().setParent(parent);
|
||||
} catch (CircularInheritanceException e) {
|
||||
logger.warning("Circular inheritance detect with '"
|
||||
+ entry.getValue() + "' detected as a parent");
|
||||
}
|
||||
} else {
|
||||
logger.warning("Unknown region parent: " + entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
this.regions = regions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the list of regions into a region manager.
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public void load(RegionManager manager) throws IOException {
|
||||
load();
|
||||
manager.setRegions(regions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the list of regions from a region manager.
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public void save(RegionManager manager) throws IOException {
|
||||
regions = manager.getRegions();
|
||||
save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to parse the specified domain in the CSV file.
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
private DefaultDomain parseDomains(String data) {
|
||||
if (data == null) {
|
||||
return new DefaultDomain();
|
||||
}
|
||||
|
||||
DefaultDomain domain = new DefaultDomain();
|
||||
Pattern pattern = Pattern.compile("^([A-Za-z]):(.*)$");
|
||||
|
||||
String[] parts = data.split(",");
|
||||
|
||||
for (String part : parts) {
|
||||
if (part.trim().length() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Matcher matcher = pattern.matcher(part);
|
||||
|
||||
if (!matcher.matches()) {
|
||||
logger.warning("Invalid owner specification: " + part);
|
||||
continue;
|
||||
}
|
||||
|
||||
String type = matcher.group(1);
|
||||
String id = matcher.group(2);
|
||||
|
||||
if (type.equals("u")) {
|
||||
domain.addPlayer(id);
|
||||
} else if (type.equals("g")) {
|
||||
domain.addGroup(id);
|
||||
} else {
|
||||
logger.warning("Unknown owner specification: " + type);
|
||||
}
|
||||
}
|
||||
|
||||
return domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to parse the list of flags.
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
private AreaFlags parseFlags(String data) {
|
||||
if (data == null) {
|
||||
return new AreaFlags();
|
||||
}
|
||||
|
||||
AreaFlags flags = new AreaFlags();
|
||||
State curState = State.ALLOW;
|
||||
|
||||
for (int i = 0; i < data.length(); i++) {
|
||||
char k = data.charAt(i);
|
||||
if (k == '+') {
|
||||
curState = State.ALLOW;
|
||||
} else if (k == '-') {
|
||||
curState = State.DENY;
|
||||
} else {
|
||||
String flag;
|
||||
if (k == '_') {
|
||||
if (i == data.length() - 1) {
|
||||
logger.warning("_ read ahead fail");
|
||||
break;
|
||||
}
|
||||
flag = "_" + data.charAt(i + 1);
|
||||
i++;
|
||||
} else {
|
||||
flag = String.valueOf(k);
|
||||
}
|
||||
flags.set(flag, curState);
|
||||
}
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to write the list of domains.
|
||||
*
|
||||
* @param domain
|
||||
* @return
|
||||
*/
|
||||
private String writeDomains(DefaultDomain domain) {
|
||||
StringBuilder str = new StringBuilder();
|
||||
|
||||
for (String player : domain.getPlayers()) {
|
||||
str.append("u:" + player + ",");
|
||||
}
|
||||
|
||||
for (String group : domain.getGroups()) {
|
||||
str.append("g:" + group + ",");
|
||||
}
|
||||
|
||||
return str.length() > 0 ?
|
||||
str.toString().substring(0, str.length() - 1) : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to prepend '+' or '-' in front of a flag according
|
||||
* to the flag's state.
|
||||
*
|
||||
* @param state
|
||||
* @param flag
|
||||
* @return
|
||||
*/
|
||||
private String writeFlag(State state, String flag) {
|
||||
if (state == State.ALLOW) {
|
||||
return "+" + flag;
|
||||
} else if (state == State.DENY) {
|
||||
return "-" + flag;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a null if a string is null or empty.
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
private String nullEmptyString(String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
} else if (str.length() == 0) {
|
||||
return null;
|
||||
} else {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to write the list of flags.
|
||||
*
|
||||
* @param flags
|
||||
* @return
|
||||
*/
|
||||
private String writeFlags(AreaFlags flags) {
|
||||
StringBuilder str = new StringBuilder();
|
||||
for (Map.Entry<String, State> entry : flags.entrySet()) {
|
||||
str.append(writeFlag(entry.getValue(), entry.getKey()));
|
||||
}
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of protected regions.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String,ProtectedRegion> getRegions() {
|
||||
return regions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of protected regions.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public void setRegions(Map<String,ProtectedRegion> regions) {
|
||||
this.regions = regions;
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.protection;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
class DescendingPriorityComparator implements Comparator<ProtectedRegion> {
|
||||
/**
|
||||
* Compares two regions.
|
||||
*
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
public int compare(ProtectedRegion r1, ProtectedRegion r2) {
|
||||
if (r1.getPriority() == r2.getPriority()) {
|
||||
return 0;
|
||||
} else if (r1.getPriority() > r2.getPriority()) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,183 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.protection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
/**
|
||||
* A very simple implementation of the region manager that uses a flat list
|
||||
* and iterates through the list to identify applicable regions. This method
|
||||
* is not very efficient.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class FlatRegionManager implements RegionManager {
|
||||
/**
|
||||
* List of protected regions.
|
||||
*/
|
||||
private SortedMap<String,ProtectedRegion> regions;
|
||||
/**
|
||||
* Global flags.
|
||||
*/
|
||||
private GlobalFlags global;
|
||||
|
||||
/**
|
||||
* Construct the manager.
|
||||
*/
|
||||
public FlatRegionManager(GlobalFlags global) {
|
||||
regions = new TreeMap<String,ProtectedRegion>();
|
||||
this.global = global;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of protected regions.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String,ProtectedRegion> getRegions() {
|
||||
return regions;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a list of protected regions.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public void setRegions(Map<String,ProtectedRegion> regions) {
|
||||
this.regions = new TreeMap<String,ProtectedRegion>(regions);
|
||||
}
|
||||
/**
|
||||
* Adds a region.
|
||||
*
|
||||
* @param id
|
||||
* @param region
|
||||
*/
|
||||
public void addRegion(ProtectedRegion region) {
|
||||
regions.put(region.getId(), region);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a region and its children.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void removeRegion(String id) {
|
||||
ProtectedRegion region = regions.get(id);
|
||||
|
||||
regions.remove(id);
|
||||
|
||||
if (region != null) {
|
||||
for (Map.Entry<String, ProtectedRegion> entry : regions.entrySet()) {
|
||||
if (entry.getValue().getParent() == region) {
|
||||
removeRegion(entry.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether a region exists by an ID.
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public boolean hasRegion(String id) {
|
||||
return regions.containsKey(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a region by its ID.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public ProtectedRegion getRegion(String id) {
|
||||
return regions.get(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an object for a point for rules to be applied with.
|
||||
*
|
||||
* @param pt
|
||||
* @return
|
||||
*/
|
||||
public ApplicableRegionSet getApplicableRegions(Vector pt) {
|
||||
return new ApplicableRegionSet(pt, regions, global);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of region IDs that contain a point.
|
||||
*
|
||||
* @param pt
|
||||
* @return
|
||||
*/
|
||||
public List<String> getApplicableRegionsIDs(Vector pt) {
|
||||
List<String> applicable = new ArrayList<String>();
|
||||
|
||||
for (Map.Entry<String,ProtectedRegion> entry : regions.entrySet()) {
|
||||
if (entry.getValue().contains(pt)) {
|
||||
applicable.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
return applicable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the provided region overlaps with any other region that
|
||||
* is not owned by the player.
|
||||
*
|
||||
* @param region
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
public boolean overlapsUnownedRegion(ProtectedRegion region, LocalPlayer player) {
|
||||
for (ProtectedRegion other : regions.values()) {
|
||||
if (other.getOwners().contains(player)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
if (ProtectedRegion.intersects(region, other)) {
|
||||
return true;
|
||||
}
|
||||
} catch (UnsupportedIntersectionException e) {
|
||||
// TODO: Maybe do something here
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of regions.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int size() {
|
||||
return regions.size();
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.protection;
|
||||
|
||||
/**
|
||||
* Used for default flags.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class GlobalFlags {
|
||||
public boolean canBuild = true;
|
||||
public boolean canAccessChests = false;
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.protection;
|
||||
|
||||
import com.sk89q.worldedit.*;
|
||||
|
||||
/**
|
||||
* Represents a cuboid region that can be protected.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class ProtectedCuboidRegion extends ProtectedRegion {
|
||||
/**
|
||||
* Store the first point.
|
||||
*/
|
||||
private BlockVector min;
|
||||
/**
|
||||
* Store the second point.
|
||||
*/
|
||||
private BlockVector max;
|
||||
|
||||
/**
|
||||
* Construct a new instance of this cuboid region.
|
||||
*
|
||||
* @param id
|
||||
* @param pos1
|
||||
* @param pos2
|
||||
* @param priority
|
||||
*/
|
||||
public ProtectedCuboidRegion(String id, BlockVector min, BlockVector max) {
|
||||
super(id);
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the lower point of the cuboid.
|
||||
*
|
||||
* @return min point
|
||||
*/
|
||||
public BlockVector getMinimumPoint() {
|
||||
return min;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the lower point of the cuboid.
|
||||
*
|
||||
* @param pt
|
||||
*/
|
||||
public void setMinimumPoint(BlockVector pt) {
|
||||
min = pt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the upper point of the cuboid.
|
||||
*
|
||||
* @return max point
|
||||
*/
|
||||
public BlockVector getMaximumPoint() {
|
||||
return max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the upper point of the cuboid.
|
||||
*
|
||||
* @param pt
|
||||
*/
|
||||
public void setMaximumPoint(BlockVector pt) {
|
||||
max = pt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if a point is inside this region.
|
||||
*/
|
||||
@Override
|
||||
public boolean contains(Vector pt) {
|
||||
int x = pt.getBlockX();
|
||||
int y = pt.getBlockY();
|
||||
int z = pt.getBlockZ();
|
||||
return x >= min.getBlockX() && x <= max.getBlockX()
|
||||
&& y >= min.getBlockY() && y <= max.getBlockY()
|
||||
&& z >= min.getBlockZ() && z <= max.getBlockZ();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the type of region as a user-friendly name.
|
||||
*
|
||||
* @return type of region
|
||||
*/
|
||||
public String getTypeName() {
|
||||
return "cuboid";
|
||||
}
|
||||
}
|
||||
@@ -1,320 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.protection;
|
||||
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.domains.DefaultDomain;
|
||||
|
||||
/**
|
||||
* Represents a region of any shape and size that can be protected.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public abstract class ProtectedRegion implements Comparable<ProtectedRegion> {
|
||||
/**
|
||||
* Holds the region's ID.
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* Priority.
|
||||
*/
|
||||
private int priority = 0;
|
||||
/**
|
||||
* Parent region.
|
||||
*/
|
||||
private ProtectedRegion parent;
|
||||
/**
|
||||
* List of owners.
|
||||
*/
|
||||
private DefaultDomain owners = new DefaultDomain();
|
||||
/**
|
||||
* List of members.
|
||||
*/
|
||||
private DefaultDomain members = new DefaultDomain();
|
||||
/**
|
||||
* Area flags.
|
||||
*/
|
||||
private AreaFlags flags = new AreaFlags();
|
||||
/**
|
||||
* Area message.
|
||||
*/
|
||||
private String enterMessage;
|
||||
/**
|
||||
* Area message.
|
||||
*/
|
||||
private String leaveMessage;
|
||||
|
||||
/**
|
||||
* Construct a new instance of this region.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public ProtectedRegion(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the priority
|
||||
*/
|
||||
public int getPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param priority the priority to set
|
||||
*/
|
||||
public void setPriority(int priority) {
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the parent
|
||||
*/
|
||||
public ProtectedRegion getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the parent. This checks to make sure that it will not result
|
||||
* in circular inheritance.
|
||||
*
|
||||
* @param parent the parent to set
|
||||
* @throws CircularInheritanceException
|
||||
*/
|
||||
public void setParent(ProtectedRegion parent) throws CircularInheritanceException {
|
||||
if (parent == null) {
|
||||
this.parent = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (parent == this) {
|
||||
throw new CircularInheritanceException();
|
||||
}
|
||||
|
||||
ProtectedRegion p = parent.getParent();
|
||||
while (p != null) {
|
||||
if (p == this) {
|
||||
throw new CircularInheritanceException();
|
||||
}
|
||||
p = p.getParent();
|
||||
}
|
||||
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Se flags.
|
||||
* @param flags
|
||||
*/
|
||||
public void setFlags(AreaFlags flags) {
|
||||
this.flags = flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the enterMessage
|
||||
*/
|
||||
public String getEnterMessage() {
|
||||
return enterMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param enterMessage the enterMessage to set
|
||||
*/
|
||||
public void setEnterMessage(String enterMessage) {
|
||||
this.enterMessage = enterMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the leaveMessage
|
||||
*/
|
||||
public String getLeaveMessage() {
|
||||
return leaveMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param leaveMessage the leaveMessage to set
|
||||
*/
|
||||
public void setLeaveMessage(String leaveMessage) {
|
||||
this.leaveMessage = leaveMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the owners
|
||||
*/
|
||||
public DefaultDomain getOwners() {
|
||||
return owners;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param owners the owners to set
|
||||
*/
|
||||
public void setOwners(DefaultDomain owners) {
|
||||
this.owners = owners;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the members
|
||||
*/
|
||||
public DefaultDomain getMembers() {
|
||||
return members;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param owners the owners to set
|
||||
*/
|
||||
public void setMembers(DefaultDomain members) {
|
||||
this.members = members;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a player is an owner of region or any of its parents.
|
||||
*
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
public boolean isOwner(LocalPlayer player) {
|
||||
if (owners.contains(player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
ProtectedRegion parent = getParent();
|
||||
while (parent != null) {
|
||||
if (parent.getOwners().contains(player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
parent = parent.getParent();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a player is a member of the region or any of its parents.
|
||||
*
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
public boolean isMember(LocalPlayer player) {
|
||||
if (owners.contains(player) || members.contains(player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
ProtectedRegion parent = getParent();
|
||||
while (parent != null) {
|
||||
if (parent.getOwners().contains(player)
|
||||
|| parent.getMembers().contains(player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
parent = parent.getParent();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get flags.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public AreaFlags getFlags() {
|
||||
return flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if a point is inside this region.
|
||||
*
|
||||
* @param pt
|
||||
* @return
|
||||
*/
|
||||
public abstract boolean contains(Vector pt);
|
||||
|
||||
/**
|
||||
* Compares to another region.
|
||||
*
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
public int compareTo(ProtectedRegion other) {
|
||||
if (priority == other.priority) {
|
||||
return 0;
|
||||
} else if (priority > other.priority) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the type of region as a user-friendly, lowercase name.
|
||||
*
|
||||
* @return type of region
|
||||
*/
|
||||
public abstract String getTypeName();
|
||||
|
||||
/**
|
||||
* Checks if two region intersects.
|
||||
*
|
||||
* @param region1
|
||||
* @param region2
|
||||
* @throws UnsupportedIntersectionException
|
||||
* @return
|
||||
*/
|
||||
public static boolean intersects(ProtectedRegion region1, ProtectedRegion region2)
|
||||
throws UnsupportedIntersectionException {
|
||||
if (region1 instanceof ProtectedCuboidRegion
|
||||
&& region2 instanceof ProtectedCuboidRegion) {
|
||||
ProtectedCuboidRegion r1 = (ProtectedCuboidRegion)region1;
|
||||
ProtectedCuboidRegion r2 = (ProtectedCuboidRegion)region2;
|
||||
BlockVector min1 = r1.getMinimumPoint();
|
||||
BlockVector max1 = r1.getMaximumPoint();
|
||||
BlockVector min2 = r2.getMinimumPoint();
|
||||
BlockVector max2 = r2.getMaximumPoint();
|
||||
|
||||
return !(min1.getBlockX() > max2.getBlockX()
|
||||
|| min1.getBlockY() > max2.getBlockY()
|
||||
|| min1.getBlockZ() > max2.getBlockZ()
|
||||
|| max1.getBlockX() < min2.getBlockX()
|
||||
|| max1.getBlockY() < min2.getBlockY()
|
||||
|| max1.getBlockZ() < min2.getBlockZ());
|
||||
} else {
|
||||
throw new UnsupportedIntersectionException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Thrown when setting a parent would create a circular inheritance
|
||||
* situation.
|
||||
*
|
||||
*/
|
||||
public static class CircularInheritanceException extends Exception {
|
||||
private static final long serialVersionUID = 7479613488496776022L;
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.protection;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Represents a database to read and write lists of regions from and to.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public interface ProtectionDatabase {
|
||||
/**
|
||||
* Load the list of regions. The method should not modify the list returned
|
||||
* by getRegions() unless the load finishes successfully.
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public void load() throws IOException;
|
||||
/**
|
||||
* Save the list of regions.
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public void save() throws IOException;
|
||||
/**
|
||||
* Load the list of regions into a region manager.
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public void load(RegionManager manager) throws IOException;
|
||||
/**
|
||||
* Save the list of regions from a region manager.
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public void save(RegionManager manager) throws IOException;
|
||||
/**
|
||||
* Get a list of regions.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String,ProtectedRegion> getRegions();
|
||||
/**
|
||||
* Set the list of regions.
|
||||
*
|
||||
* @param regions
|
||||
*/
|
||||
public void setRegions(Map<String,ProtectedRegion> regions);
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.protection;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
/**
|
||||
* An interface for getting, setting, and looking up regions. The most
|
||||
* simple implementation uses a flat list and iterates through the entire
|
||||
* list to look for applicable regions, but a more complicated (and more
|
||||
* efficient) implementation may use space partitioning techniques.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public interface RegionManager {
|
||||
/**
|
||||
* Get a list of protected regions.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String, ProtectedRegion> getRegions();
|
||||
|
||||
/**
|
||||
* Set a list of protected regions.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public void setRegions(Map<String,ProtectedRegion> regions);
|
||||
|
||||
/**
|
||||
* Adds a region.
|
||||
*
|
||||
* @param id
|
||||
* @param region
|
||||
*/
|
||||
public void addRegion(ProtectedRegion region);
|
||||
|
||||
/**
|
||||
* Return whether a region exists by an ID.
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public boolean hasRegion(String id);
|
||||
|
||||
/**
|
||||
* Get a region by its ID.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public ProtectedRegion getRegion(String id);
|
||||
|
||||
/**
|
||||
* Removes a region, including inheriting children.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void removeRegion(String id);
|
||||
|
||||
/**
|
||||
* Get an object for a point for rules to be applied with.
|
||||
*
|
||||
* @param pt
|
||||
* @return
|
||||
*/
|
||||
public ApplicableRegionSet getApplicableRegions(Vector pt);
|
||||
|
||||
/**
|
||||
* Get a list of region IDs that contain a point.
|
||||
*
|
||||
* @param pt
|
||||
* @return
|
||||
*/
|
||||
public List<String> getApplicableRegionsIDs(Vector pt);
|
||||
|
||||
/**
|
||||
* Returns true if the provided region overlaps with any other region that
|
||||
* is not owned by the player.
|
||||
*
|
||||
* @param region
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
public boolean overlapsUnownedRegion(ProtectedRegion region, LocalPlayer player);
|
||||
|
||||
/**
|
||||
* Get the number of regions.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int size();
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.protection;
|
||||
|
||||
public class UnsupportedIntersectionException extends Exception {
|
||||
private static final long serialVersionUID = 6423189392345575148L;
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.util;
|
||||
|
||||
public class ArrayReader<T> {
|
||||
private T[] arr;
|
||||
|
||||
public ArrayReader(T[] arr) {
|
||||
this.arr = arr;
|
||||
}
|
||||
|
||||
public T get(int index) {
|
||||
if (arr.length > index) {
|
||||
return arr[index];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public T get(int index, T def) {
|
||||
if (arr.length > index) {
|
||||
return arr[index];
|
||||
} else {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
public class TestPlayer extends LocalPlayer {
|
||||
private String name;
|
||||
private Set<String> groups = new HashSet<String>();
|
||||
|
||||
public TestPlayer(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void addGroup(String group) {
|
||||
groups.add(group.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGroup(String group) {
|
||||
return groups.contains(group.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getPosition() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void kick(String msg) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ban(String msg) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printRaw(String msg) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getGroups() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.protection;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.TestPlayer;
|
||||
import com.sk89q.worldguard.domains.DefaultDomain;
|
||||
import com.sk89q.worldguard.protection.AreaFlags.State;
|
||||
|
||||
public class ApplicableRegionSetTest {
|
||||
static String COURTYARD_ID = "courtyard";
|
||||
static String FOUNTAIN_ID = "fountain";
|
||||
static String NO_FIRE_ID = "nofire";
|
||||
static String MEMBER_GROUP = "member";
|
||||
static String COURTYARD_GROUP = "courtyard";
|
||||
|
||||
Vector inFountain = new Vector(2, 2, 2);
|
||||
Vector inCourtyard = new Vector(7, 7, 7);
|
||||
Vector outside = new Vector(15, 15, 15);
|
||||
Vector inNoFire = new Vector(150, 150, 150);
|
||||
RegionManager manager;
|
||||
ProtectedRegion courtyard;
|
||||
ProtectedRegion fountain;
|
||||
TestPlayer player1;
|
||||
TestPlayer player2;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
manager = new FlatRegionManager();
|
||||
|
||||
setUpPlayers();
|
||||
setUpCourtyardRegion();
|
||||
setUpFountainRegion();
|
||||
setUpNoFireRegion();
|
||||
}
|
||||
|
||||
void setUpPlayers() {
|
||||
player1 = new TestPlayer("tetsu");
|
||||
player1.addGroup(MEMBER_GROUP);
|
||||
player1.addGroup(COURTYARD_GROUP);
|
||||
|
||||
player2 = new TestPlayer("alex");
|
||||
player2.addGroup(MEMBER_GROUP);
|
||||
}
|
||||
|
||||
void setUpCourtyardRegion() {
|
||||
DefaultDomain domain = new DefaultDomain();
|
||||
domain.addGroup(COURTYARD_GROUP);
|
||||
|
||||
ProtectedRegion region = new ProtectedCuboidRegion(COURTYARD_ID,
|
||||
new BlockVector(0, 0, 0), new BlockVector(10, 10, 10));
|
||||
AreaFlags flags = new AreaFlags();
|
||||
flags.set(AreaFlags.FLAG_BUILD, State.NONE);
|
||||
flags.set(AreaFlags.FLAG_FIRE_SPREAD, State.ALLOW);
|
||||
region.setFlags(flags);
|
||||
region.setOwners(domain);
|
||||
manager.addRegion(region);
|
||||
|
||||
courtyard = region;
|
||||
}
|
||||
|
||||
void setUpFountainRegion() throws Exception {
|
||||
DefaultDomain domain = new DefaultDomain();
|
||||
domain.addGroup(MEMBER_GROUP);
|
||||
|
||||
ProtectedRegion region = new ProtectedCuboidRegion(FOUNTAIN_ID,
|
||||
new BlockVector(0, 0, 0), new BlockVector(5, 5, 5));
|
||||
AreaFlags flags = new AreaFlags();
|
||||
flags.set(AreaFlags.FLAG_FIRE_SPREAD, State.DENY);
|
||||
region.setFlags(flags);
|
||||
region.setMembers(domain);
|
||||
manager.addRegion(region);
|
||||
|
||||
fountain = region;
|
||||
fountain.setParent(courtyard);
|
||||
}
|
||||
|
||||
void setUpNoFireRegion() throws Exception {
|
||||
ProtectedRegion region = new ProtectedCuboidRegion(NO_FIRE_ID,
|
||||
new BlockVector(100, 100, 100), new BlockVector(200, 200, 200));
|
||||
AreaFlags flags = new AreaFlags();
|
||||
flags.set(AreaFlags.FLAG_FIRE_SPREAD, State.DENY);
|
||||
region.setFlags(flags);
|
||||
manager.addRegion(region);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonBuildFlag() {
|
||||
ApplicableRegionSet appl;
|
||||
|
||||
// Outside
|
||||
appl = manager.getApplicableRegions(outside);
|
||||
assertTrue(appl.allowsFlag(AreaFlags.FLAG_FIRE_SPREAD));
|
||||
// Inside courtyard
|
||||
appl = manager.getApplicableRegions(inCourtyard);
|
||||
assertTrue(appl.allowsFlag(AreaFlags.FLAG_FIRE_SPREAD));
|
||||
// Inside fountain
|
||||
appl = manager.getApplicableRegions(inFountain);
|
||||
assertFalse(appl.allowsFlag(AreaFlags.FLAG_FIRE_SPREAD));
|
||||
|
||||
// Inside no fire zone
|
||||
appl = manager.getApplicableRegions(inNoFire);
|
||||
assertFalse(appl.allowsFlag(AreaFlags.FLAG_FIRE_SPREAD));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPlayer1BuildAccess() {
|
||||
ApplicableRegionSet appl;
|
||||
|
||||
// Outside
|
||||
appl = manager.getApplicableRegions(outside);
|
||||
assertTrue(appl.canBuild(player1));
|
||||
// Inside courtyard
|
||||
appl = manager.getApplicableRegions(inCourtyard);
|
||||
assertTrue(appl.canBuild(player1));
|
||||
// Inside fountain
|
||||
appl = manager.getApplicableRegions(inFountain);
|
||||
assertTrue(appl.canBuild(player1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPlayer2BuildAccess() {
|
||||
ApplicableRegionSet appl;
|
||||
|
||||
// Outside
|
||||
appl = manager.getApplicableRegions(outside);
|
||||
assertTrue(appl.canBuild(player2));
|
||||
// Inside courtyard
|
||||
appl = manager.getApplicableRegions(inCourtyard);
|
||||
assertFalse(appl.canBuild(player2));
|
||||
// Inside fountain
|
||||
appl = manager.getApplicableRegions(inFountain);
|
||||
assertTrue(appl.canBuild(player2));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.protection;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldguard.domains.DefaultDomain;
|
||||
import com.sk89q.worldguard.protection.AreaFlags.State;
|
||||
|
||||
public class CSVDatabaseTest {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadSave() throws Exception {
|
||||
File temp = File.createTempFile("worldguard_csv_test", ".tmp");
|
||||
temp.deleteOnExit();
|
||||
|
||||
Map<String,ProtectedRegion> regions =
|
||||
new HashMap<String,ProtectedRegion>();
|
||||
regions.put("test1", getTestRegion1());
|
||||
regions.put("test2", getTestRegion2());
|
||||
|
||||
CSVDatabase writeDB = new CSVDatabase(temp);
|
||||
writeDB.setRegions(regions);
|
||||
writeDB.save();
|
||||
|
||||
CSVDatabase readDB = new CSVDatabase(temp);
|
||||
readDB.load();
|
||||
|
||||
Map<String,ProtectedRegion> loaded = readDB.getRegions();
|
||||
|
||||
ProtectedRegion region1 = loaded.get("test1");
|
||||
checkTestRegion1(region1);
|
||||
}
|
||||
|
||||
private void checkTestRegion1(ProtectedRegion region) {
|
||||
AreaFlags flags = new AreaFlags();
|
||||
flags.set(AreaFlags.FLAG_FIRE_SPREAD, State.ALLOW);
|
||||
flags.set(AreaFlags.FLAG_PVP, State.DENY);
|
||||
flags.set(AreaFlags.FLAG_LIGHTER, State.DENY);
|
||||
region.setFlags(flags);
|
||||
|
||||
assertEquals(region.getFlags(), flags);
|
||||
}
|
||||
|
||||
private ProtectedRegion getTestRegion1() {
|
||||
BlockVector min = new BlockVector(1, 2, 3);
|
||||
BlockVector max = new BlockVector(4, 5, 6);
|
||||
|
||||
ProtectedRegion region = new ProtectedCuboidRegion("test2", min, max);
|
||||
|
||||
AreaFlags flags = new AreaFlags();
|
||||
flags.set(AreaFlags.FLAG_FIRE_SPREAD, State.ALLOW);
|
||||
flags.set(AreaFlags.FLAG_PVP, State.DENY);
|
||||
flags.set(AreaFlags.FLAG_LIGHTER, State.DENY);
|
||||
region.setFlags(flags);
|
||||
|
||||
DefaultDomain domain = new DefaultDomain();
|
||||
domain.addGroup("members");
|
||||
domain.addGroup("sturmehs");
|
||||
domain.addPlayer("hollie");
|
||||
domain.addPlayer("chad");
|
||||
domain.addPlayer("tetsu");
|
||||
region.setOwners(domain);
|
||||
|
||||
region.setEnterMessage("hello there!");
|
||||
region.setPriority(444);
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
private ProtectedRegion getTestRegion2() {
|
||||
BlockVector min = new BlockVector(7, 8, 9);
|
||||
BlockVector max = new BlockVector(10, 11, 12);
|
||||
|
||||
ProtectedRegion region = new ProtectedCuboidRegion("test2", min, max);
|
||||
|
||||
AreaFlags flags = new AreaFlags();
|
||||
flags.set(AreaFlags.FLAG_FIRE_SPREAD, State.ALLOW);
|
||||
flags.set(AreaFlags.FLAG_PVP, State.ALLOW);
|
||||
flags.set(AreaFlags.FLAG_LIGHTER, State.DENY);
|
||||
region.setFlags(flags);
|
||||
|
||||
DefaultDomain domain = new DefaultDomain();
|
||||
domain.addGroup("admins");
|
||||
domain.addPlayer("jon");
|
||||
domain.addPlayer("ester");
|
||||
domain.addPlayer("amy");
|
||||
region.setOwners(domain);
|
||||
|
||||
region.setEnterMessage("Testing");
|
||||
region.setPriority(555);
|
||||
|
||||
return region;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
}
|
||||
|
||||
applyPlatformAndCoreConfiguration()
|
||||
applyShadowConfiguration()
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "paper"
|
||||
url = uri("https://papermc.io/repo/repository/maven-public/")
|
||||
}
|
||||
maven {
|
||||
name = "bstats"
|
||||
url = uri("https://repo.codemc.org/repository/maven-public")
|
||||
}
|
||||
maven {
|
||||
name = "aikar-timings"
|
||||
url = uri("https://repo.aikar.co/nexus/content/groups/aikar/")
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
compileClasspath.get().extendsFrom(create("shadeOnly"))
|
||||
}
|
||||
|
||||
dependencies {
|
||||
"api"(project(":worldguard-core"))
|
||||
"compileOnly"("io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT")
|
||||
"runtimeOnly"("org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT") {
|
||||
exclude("junit", "junit")
|
||||
}
|
||||
"api"("com.sk89q.worldedit:worldedit-bukkit:${Versions.WORLDEDIT}") { isTransitive = false }
|
||||
"implementation"("com.google.guava:guava:${Versions.GUAVA}")
|
||||
"compileOnly"("com.sk89q:commandbook:2.3") { isTransitive = false }
|
||||
"shadeOnly"("io.papermc:paperlib:1.0.7")
|
||||
"shadeOnly"("org.bstats:bstats-bukkit:2.1.0")
|
||||
"shadeOnly"("co.aikar:minecraft-timings:1.0.4")
|
||||
}
|
||||
|
||||
tasks.named<Copy>("processResources") {
|
||||
val internalVersion = project.ext["internalVersion"]
|
||||
inputs.property("internalVersion", internalVersion)
|
||||
filesMatching("plugin.yml") {
|
||||
expand("internalVersion" to internalVersion)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<Jar>("jar") {
|
||||
val projectVersion = project.version
|
||||
inputs.property("projectVersion", projectVersion)
|
||||
manifest {
|
||||
attributes("Implementation-Version" to projectVersion)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
configurations = listOf(project.configurations["shadeOnly"], project.configurations["runtimeClasspath"])
|
||||
|
||||
dependencies {
|
||||
include(dependency(":worldguard-core"))
|
||||
relocate("org.bstats", "com.sk89q.worldguard.bukkit.bstats") {
|
||||
include(dependency("org.bstats:"))
|
||||
}
|
||||
relocate ("io.papermc.lib", "com.sk89q.worldguard.bukkit.paperlib") {
|
||||
include(dependency("io.papermc:paperlib"))
|
||||
}
|
||||
relocate ("co.aikar.timings.lib", "com.sk89q.worldguard.bukkit.timingslib") {
|
||||
include(dependency("co.aikar:minecraft-timings"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("assemble").configure {
|
||||
dependsOn("shadowJar")
|
||||
}
|
||||
@@ -1,21 +1,24 @@
|
||||
-- Blacklist table for MySQL.
|
||||
-- You must still configure WorldGuard to use your database.
|
||||
-- If you do not plan on using a database for logging blacklist events,
|
||||
-- you do not need to do anything with this file.
|
||||
|
||||
CREATE TABLE `blacklist_events` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`event` varchar(25) NOT NULL,
|
||||
`player` varchar(16) NOT NULL,
|
||||
`x` int(11) NOT NULL,
|
||||
`y` int(11) NOT NULL,
|
||||
`z` int(11) NOT NULL,
|
||||
`item` int(11) NOT NULL,
|
||||
`time` int(11) NOT NULL,
|
||||
`comment` varchar(255) NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
-- Required update if you have an older version of the table:
|
||||
|
||||
ALTER TABLE `blacklist_events` ADD `comment` VARCHAR( 255 ) NULL
|
||||
-- Blacklist table for MySQL.
|
||||
-- You must still configure WorldGuard to use your database.
|
||||
-- If you do not plan on using a database for logging blacklist events,
|
||||
-- you do not need to do anything with this file.
|
||||
|
||||
CREATE TABLE `blacklist_events` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`event` varchar(25) NOT NULL,
|
||||
`world` varchar(32) NOT NULL,
|
||||
`player` varchar(16) NOT NULL,
|
||||
`x` int(11) NOT NULL,
|
||||
`y` int(11) NOT NULL,
|
||||
`z` int(11) NOT NULL,
|
||||
`item` int(11) NOT NULL,
|
||||
`time` int(11) NOT NULL,
|
||||
`comment` varchar(255) NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
-- Required update if you have an older version of the table:
|
||||
|
||||
ALTER TABLE `blacklist_events` ADD `comment` VARCHAR( 255 ) NULL
|
||||
|
||||
ALTER TABLE `blacklist_events` ADD `world` VARCHAR( 32 ) NOT NULL
|
||||
@@ -0,0 +1,114 @@
|
||||
--
|
||||
-- This file only needs to be run if you are using a very old version
|
||||
-- of the region database (before 2011/03/25).
|
||||
--
|
||||
-- Otherwise, WG knows how to update your tables automatically, as well
|
||||
-- as set them up initially.
|
||||
--
|
||||
|
||||
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
|
||||
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
|
||||
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
|
||||
|
||||
ALTER TABLE `region_cuboid` DROP FOREIGN KEY `fk_region_cuboid_region` ;
|
||||
|
||||
ALTER TABLE `region_flag` DROP FOREIGN KEY `fk_flags_region1` ;
|
||||
|
||||
ALTER TABLE `region_groups` DROP FOREIGN KEY `fk_region_groups_region` ;
|
||||
|
||||
ALTER TABLE `region_players` DROP FOREIGN KEY `fk_region_players_user` , DROP FOREIGN KEY `fk_region_players_region` ;
|
||||
|
||||
ALTER TABLE `region_poly2d` DROP FOREIGN KEY `fk_region_poly2d_region` ;
|
||||
|
||||
ALTER TABLE `region_poly2d_point` DROP FOREIGN KEY `fk_region_poly2d_point_region_poly2d` ;
|
||||
|
||||
ALTER TABLE `group` COLLATE = utf8_bin ;
|
||||
|
||||
ALTER TABLE `region_cuboid` COLLATE = utf8_bin , ADD COLUMN `world_id` INT(10) UNSIGNED NOT NULL AFTER `region_id` , CHANGE COLUMN `min_x` `min_x` BIGINT(20) NOT NULL AFTER `world_id` , CHANGE COLUMN `min_y` `min_y` BIGINT(20) NOT NULL AFTER `min_x` , CHANGE COLUMN `max_x` `max_x` BIGINT(20) NOT NULL AFTER `min_z` , CHANGE COLUMN `max_y` `max_y` BIGINT(20) NOT NULL AFTER `max_x` ,
|
||||
ADD CONSTRAINT `fk_region_cuboid_region`
|
||||
FOREIGN KEY (`region_id` , `world_id` )
|
||||
REFERENCES `region` (`id` , `world_id` )
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
, DROP PRIMARY KEY
|
||||
, ADD PRIMARY KEY (`region_id`, `world_id`) ;
|
||||
|
||||
ALTER TABLE `region_flag` COLLATE = utf8_bin , ADD COLUMN `world_id` INT(10) UNSIGNED NOT NULL AFTER `region_id` , CHANGE COLUMN `flag` `flag` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
|
||||
ADD CONSTRAINT `fk_flags_region`
|
||||
FOREIGN KEY (`region_id` , `world_id` )
|
||||
REFERENCES `region` (`id` , `world_id` )
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
, DROP INDEX `fk_flags_region`
|
||||
, ADD INDEX `fk_flags_region` (`region_id` ASC, `world_id` ASC) ;
|
||||
|
||||
ALTER TABLE `region_groups` COLLATE = utf8_bin , ADD COLUMN `world_id` INT(10) UNSIGNED NOT NULL AFTER `region_id` , DROP FOREIGN KEY `fk_region_groups_group` ;
|
||||
|
||||
ALTER TABLE `region_groups`
|
||||
ADD CONSTRAINT `fk_region_groups_group`
|
||||
FOREIGN KEY (`group_id` )
|
||||
REFERENCES `group` (`id` )
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `fk_region_groups_region`
|
||||
FOREIGN KEY (`region_id` , `world_id` )
|
||||
REFERENCES `region` (`id` , `world_id` )
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
, DROP PRIMARY KEY
|
||||
, ADD PRIMARY KEY (`region_id`, `world_id`, `group_id`) ;
|
||||
|
||||
ALTER TABLE `region_players` COLLATE = utf8_bin , ADD COLUMN `world_id` INT(10) UNSIGNED NOT NULL AFTER `region_id` ,
|
||||
ADD CONSTRAINT `fk_region_users_region`
|
||||
FOREIGN KEY (`region_id` , `world_id` )
|
||||
REFERENCES `region` (`id` , `world_id` )
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `fk_region_users_user`
|
||||
FOREIGN KEY (`user_id` )
|
||||
REFERENCES `user` (`id` )
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
, DROP PRIMARY KEY
|
||||
, ADD PRIMARY KEY (`region_id`, `world_id`, `user_id`)
|
||||
, ADD INDEX `fk_region_users_user` (`user_id` ASC)
|
||||
, DROP INDEX `fk_region_players_user` ;
|
||||
|
||||
ALTER TABLE `region_poly2d` COLLATE = utf8_bin , ADD COLUMN `world_id` INT(10) UNSIGNED NOT NULL AFTER `region_id` , CHANGE COLUMN `min_y` `min_y` INT(11) NOT NULL AFTER `world_id` ,
|
||||
ADD CONSTRAINT `fk_region_poly2d_region`
|
||||
FOREIGN KEY (`region_id` , `world_id` )
|
||||
REFERENCES `region` (`id` , `world_id` )
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
, DROP PRIMARY KEY
|
||||
, ADD PRIMARY KEY (`region_id`, `world_id`) ;
|
||||
|
||||
ALTER TABLE `region_poly2d_point` COLLATE = utf8_bin , ADD COLUMN `world_id` INT(10) UNSIGNED NOT NULL AFTER `region_id` , CHANGE COLUMN `x` `x` BIGINT(20) NOT NULL AFTER `world_id` ,
|
||||
ADD CONSTRAINT `fk_region_poly2d_point_region_poly2d`
|
||||
FOREIGN KEY (`region_id` , `world_id` )
|
||||
REFERENCES `region_poly2d` (`region_id` , `world_id` )
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
, DROP INDEX `fk_region_poly2d_point_region_poly2d`
|
||||
, ADD INDEX `fk_region_poly2d_point_region_poly2d` (`region_id` ASC, `world_id` ASC) ;
|
||||
|
||||
ALTER TABLE `user` COLLATE = utf8_bin ;
|
||||
|
||||
ALTER TABLE `world` COLLATE = utf8_bin ;
|
||||
|
||||
|
||||
UPDATE `region_cuboid` AS c SET c.`world_id` = (SELECT p.`world_id` FROM `region` AS p WHERE p.`id` = c.`region_id`);
|
||||
|
||||
UPDATE `region_flag` AS c SET c.`world_id` = (SELECT p.`world_id` FROM `region` AS p WHERE p.`id` = c.`region_id`);
|
||||
|
||||
UPDATE `region_groups` AS c SET c.`world_id` = (SELECT p.`world_id` FROM `region` AS p WHERE p.`id` = c.`region_id`);
|
||||
|
||||
UPDATE `region_players` AS c SET c.`world_id` = (SELECT p.`world_id` FROM `region` AS p WHERE p.`id` = c.`region_id`);
|
||||
|
||||
UPDATE `region_poly2d` AS c SET c.`world_id` = (SELECT p.`world_id` FROM `region` AS p WHERE p.`id` = c.`region_id`);
|
||||
|
||||
UPDATE `region_poly2d_point` AS c SET c.`world_id` = (SELECT p.`world_id` FROM `region` AS p WHERE p.`id` = c.`region_id`);
|
||||
|
||||
SET SQL_MODE=@OLD_SQL_MODE;
|
||||
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
||||
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* WorldGuard, a suite of tools for Minecraft
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldGuard team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser 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 Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldguard.config.YamlConfigurationManager;
|
||||
import com.sk89q.worldedit.util.report.Unreported;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
public class BukkitConfigurationManager extends YamlConfigurationManager {
|
||||
|
||||
@Unreported private WorldGuardPlugin plugin;
|
||||
@Unreported private ConcurrentMap<String, BukkitWorldConfiguration> worlds = new ConcurrentHashMap<>();
|
||||
|
||||
private boolean hasCommandBookGodMode;
|
||||
boolean extraStats;
|
||||
boolean timedSessionHandlers;
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
*
|
||||
* @param plugin The plugin instance
|
||||
*/
|
||||
public BukkitConfigurationManager(WorldGuardPlugin plugin) {
|
||||
super();
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public Collection<BukkitWorldConfiguration> getWorldConfigs() {
|
||||
return worlds.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
super.load();
|
||||
this.extraStats = getConfig().getBoolean("custom-metrics-charts", true);
|
||||
this.timedSessionHandlers = getConfig().getBoolean("extra-timings.session-handlers", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getDataFolder() {
|
||||
return plugin.getDataFolder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyDefaults() {
|
||||
// Create the default configuration file
|
||||
plugin.createDefaultConfiguration(new File(plugin.getDataFolder(), "config.yml"), "config.yml");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
worlds.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postLoad() {
|
||||
// Load configurations for each world
|
||||
for (World world : WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getWorlds()) {
|
||||
get(world);
|
||||
}
|
||||
getConfig().save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration for a world.
|
||||
*
|
||||
* @param world The world to get the configuration for
|
||||
* @return {@code world}'s configuration
|
||||
*/
|
||||
@Override
|
||||
public BukkitWorldConfiguration get(World world) {
|
||||
String worldName = world.getName();
|
||||
return get(worldName);
|
||||
}
|
||||
|
||||
public BukkitWorldConfiguration get(String worldName) {
|
||||
BukkitWorldConfiguration config = worlds.get(worldName);
|
||||
BukkitWorldConfiguration newConfig = null;
|
||||
|
||||
while (config == null) {
|
||||
if (newConfig == null) {
|
||||
newConfig = new BukkitWorldConfiguration(plugin, worldName, this.getConfig());
|
||||
}
|
||||
worlds.putIfAbsent(worldName, newConfig);
|
||||
config = worlds.get(worldName);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
public void updateCommandBookGodMode() {
|
||||
try {
|
||||
if (plugin.getServer().getPluginManager().isPluginEnabled("CommandBook")) {
|
||||
Class.forName("com.sk89q.commandbook.GodComponent");
|
||||
hasCommandBookGodMode = true;
|
||||
return;
|
||||
}
|
||||
} catch (ClassNotFoundException ignore) {}
|
||||
hasCommandBookGodMode = false;
|
||||
}
|
||||
|
||||
public boolean hasCommandBookGodMode() {
|
||||
return hasCommandBookGodMode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
/*
|
||||
* WorldGuard, a suite of tools for Minecraft
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldGuard team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser 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 Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissionsException;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.util.paste.ActorCallbackPaste;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.event.debug.CancelLogging;
|
||||
import com.sk89q.worldguard.bukkit.event.debug.LoggingBlockBreakEvent;
|
||||
import com.sk89q.worldguard.bukkit.event.debug.LoggingBlockPlaceEvent;
|
||||
import com.sk89q.worldguard.bukkit.event.debug.LoggingEntityDamageByEntityEvent;
|
||||
import com.sk89q.worldguard.bukkit.event.debug.LoggingPlayerInteractEvent;
|
||||
import com.sk89q.worldguard.bukkit.util.report.CancelReport;
|
||||
import com.sk89q.worldguard.internal.platform.DebugHandler;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.util.BlockIterator;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class BukkitDebugHandler implements DebugHandler {
|
||||
|
||||
private static final Logger log = Logger.getLogger(BukkitDebugHandler.class.getCanonicalName());
|
||||
private static final int MAX_TRACE_DISTANCE = 20;
|
||||
|
||||
private final WorldGuardPlugin plugin;
|
||||
|
||||
BukkitDebugHandler(WorldGuardPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulate an event and print its report.
|
||||
*
|
||||
* @param receiver The receiver of the messages
|
||||
* @param target The target
|
||||
* @param event The event
|
||||
* @param stacktraceMode Whether stack traces should be generated and posted
|
||||
* @param <T> The type of event
|
||||
*/
|
||||
private <T extends Event & CancelLogging> void testEvent(CommandSender receiver, Player target, T event, boolean stacktraceMode) throws
|
||||
CommandPermissionsException {
|
||||
boolean isConsole = receiver instanceof ConsoleCommandSender;
|
||||
|
||||
if (!receiver.equals(target)) {
|
||||
if (!isConsole) {
|
||||
log.info(receiver.getName() + " is simulating an event on " + target.getName());
|
||||
}
|
||||
|
||||
target.sendMessage(
|
||||
ChatColor.RED + "(Please ignore any messages that may immediately follow.)");
|
||||
}
|
||||
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
int start = new Exception().getStackTrace().length;
|
||||
CancelReport report = new CancelReport(event, event.getCancels(), start);
|
||||
report.setDetectingPlugin(!stacktraceMode);
|
||||
String result = report.toString();
|
||||
|
||||
if (stacktraceMode) {
|
||||
receiver.sendMessage(ChatColor.GRAY + "The report was printed to console.");
|
||||
log.info("Event report for " + receiver.getName() + ":\n\n" + result);
|
||||
|
||||
plugin.checkPermission(receiver, "worldguard.debug.pastebin");
|
||||
ActorCallbackPaste.pastebin(WorldGuard.getInstance().getSupervisor(), plugin.wrapCommandSender(receiver),
|
||||
result, "Event debugging report: %s.txt");
|
||||
} else {
|
||||
receiver.sendMessage(result.replaceAll("(?m)^", ChatColor.AQUA.toString()));
|
||||
|
||||
if (result.length() >= 500 && !isConsole) {
|
||||
receiver.sendMessage(ChatColor.GRAY + "The report was also printed to console.");
|
||||
log.info("Event report for " + receiver.getName() + ":\n\n" + result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the source of the test.
|
||||
*
|
||||
* @param sender The message sender
|
||||
* @param target The provided target
|
||||
* @param fromTarget Whether the source should be the target
|
||||
* @return The source
|
||||
* @throws CommandException Thrown if a condition is not met
|
||||
*/
|
||||
private Player getSource(CommandSender sender, Player target, boolean fromTarget) throws CommandException {
|
||||
if (fromTarget) {
|
||||
return target;
|
||||
} else {
|
||||
if (sender instanceof Player) {
|
||||
return (Player) sender;
|
||||
} else {
|
||||
throw new CommandException(
|
||||
"If this command is not to be used in-game, use -t to run the test from the viewpoint of the given player rather than yourself.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the first non-air block in a ray trace.
|
||||
*
|
||||
* @param sender The sender
|
||||
* @param target The target
|
||||
* @param fromTarget Whether the trace should originate from the target
|
||||
* @return The block found
|
||||
* @throws CommandException Throw on an incorrect parameter
|
||||
*/
|
||||
private Block traceBlock(CommandSender sender, Player target, boolean fromTarget) throws CommandException {
|
||||
Player source = getSource(sender, target, fromTarget);
|
||||
|
||||
BlockIterator it = new BlockIterator(source);
|
||||
int i = 0;
|
||||
while (it.hasNext() && i < MAX_TRACE_DISTANCE) {
|
||||
Block block = it.next();
|
||||
if (block.getType() != Material.AIR) {
|
||||
return block;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
throw new CommandException("Not currently looking at a block that is close enough.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the first nearby entity in a ray trace.
|
||||
*
|
||||
* @param sender The sender
|
||||
* @param target The target
|
||||
* @param fromTarget Whether the trace should originate from the target
|
||||
* @return The entity found
|
||||
* @throws CommandException Throw on an incorrect parameter
|
||||
*/
|
||||
private Entity traceEntity(CommandSender sender, Player target, boolean fromTarget) throws CommandException {
|
||||
Player source = getSource(sender, target, fromTarget);
|
||||
|
||||
BlockIterator it = new BlockIterator(source);
|
||||
int i = 0;
|
||||
while (it.hasNext() && i < MAX_TRACE_DISTANCE) {
|
||||
Block block = it.next();
|
||||
|
||||
// A very in-accurate and slow search
|
||||
Entity[] entities = block.getChunk().getEntities();
|
||||
for (Entity entity : entities) {
|
||||
if (!entity.equals(target) && entity.getLocation().distanceSquared(block.getLocation()) < 10) {
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
throw new CommandException("Not currently looking at an entity that is close enough.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testBreak(Actor sender, LocalPlayer target, boolean fromTarget, boolean stackTraceMode) throws CommandException {
|
||||
CommandSender bukkitSender = plugin.unwrapActor(sender);
|
||||
Player bukkitTarget = BukkitAdapter.adapt(target);
|
||||
|
||||
Block block = traceBlock(bukkitSender, bukkitTarget, fromTarget);
|
||||
sender.print(TextComponent.of("Testing BLOCK BREAK at ", TextColor.AQUA).append(TextComponent.of(block.toString(), TextColor.DARK_AQUA)));
|
||||
LoggingBlockBreakEvent event = new LoggingBlockBreakEvent(block, bukkitTarget);
|
||||
testEvent(bukkitSender, bukkitTarget, event, stackTraceMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testPlace(Actor sender, LocalPlayer target, boolean fromTarget, boolean stackTraceMode) throws CommandException {
|
||||
CommandSender bukkitSender = plugin.unwrapActor(sender);
|
||||
Player bukkitTarget = BukkitAdapter.adapt(target);
|
||||
|
||||
Block block = traceBlock(bukkitSender, bukkitTarget, fromTarget);
|
||||
sender.print(TextComponent.of("Testing BLOCK PLACE at ", TextColor.AQUA).append(TextComponent.of(block.toString(), TextColor.DARK_AQUA)));
|
||||
LoggingBlockPlaceEvent event = new LoggingBlockPlaceEvent(block, block.getState(), block.getRelative(BlockFace.DOWN), bukkitTarget.getItemInHand(), bukkitTarget, true);
|
||||
testEvent(bukkitSender, bukkitTarget, event, stackTraceMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testInteract(Actor sender, LocalPlayer target, boolean fromTarget, boolean stackTraceMode) throws CommandException {
|
||||
CommandSender bukkitSender = plugin.unwrapActor(sender);
|
||||
Player bukkitTarget = BukkitAdapter.adapt(target);
|
||||
|
||||
Block block = traceBlock(bukkitSender, bukkitTarget, fromTarget);
|
||||
sender.print(TextComponent.of("Testing BLOCK INTERACT at ", TextColor.AQUA).append(TextComponent.of(block.toString(), TextColor.DARK_AQUA)));
|
||||
LoggingPlayerInteractEvent event = new LoggingPlayerInteractEvent(bukkitTarget, Action.RIGHT_CLICK_BLOCK, bukkitTarget.getItemInHand(), block, BlockFace.SOUTH);
|
||||
testEvent(bukkitSender, bukkitTarget, event, stackTraceMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testDamage(Actor sender, LocalPlayer target, boolean fromTarget, boolean stackTraceMode) throws CommandException {
|
||||
CommandSender bukkitSender = plugin.unwrapActor(sender);
|
||||
Player bukkitTarget = BukkitAdapter.adapt(target);
|
||||
Entity entity = traceEntity(bukkitSender, bukkitTarget, fromTarget);
|
||||
sender.print(TextComponent.of("Testing ENTITY DAMAGE at ", TextColor.AQUA).append(TextComponent.of(entity.toString(), TextColor.DARK_AQUA)));
|
||||
LoggingEntityDamageByEntityEvent event = new LoggingEntityDamageByEntityEvent(bukkitTarget, entity, EntityDamageEvent.DamageCause.ENTITY_ATTACK, 1);
|
||||
testEvent(bukkitSender, bukkitTarget, event, stackTraceMode);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
/*
|
||||
* WorldGuard, a suite of tools for Minecraft
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldGuard team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser 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 Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.session.SessionKey;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.weather.WeatherType;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
class BukkitOfflinePlayer extends BukkitPlayer {
|
||||
|
||||
private final OfflinePlayer player;
|
||||
|
||||
BukkitOfflinePlayer(WorldGuardPlugin plugin, OfflinePlayer offlinePlayer) {
|
||||
super(plugin, offlinePlayer.getPlayer()); // null if they are offline
|
||||
this.player = offlinePlayer;
|
||||
}
|
||||
|
||||
/// ========================================
|
||||
/// These are checked for RegionAssociable
|
||||
/// (to see if a player belongs to a region)
|
||||
/// ========================================
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return player.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUniqueId() {
|
||||
return player.getUniqueId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGroup(String group) {
|
||||
return plugin.inGroup(player, group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getGroups() {
|
||||
return plugin.getGroups(player);
|
||||
}
|
||||
|
||||
/// ==========================================
|
||||
/// None of the following should ever be used.
|
||||
/// ==========================================
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(String perm) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void kick(String msg) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ban(String msg) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHealth() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHealth(double health) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxHealth() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getFoodLevel() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFoodLevel(double foodLevel) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSaturation() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSaturation(double saturation) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExhaustion() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExhaustion(float exhaustion) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeatherType getPlayerWeather() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerWeather(WeatherType weather) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetPlayerWeather() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlayerTimeRelative() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPlayerTimeOffset() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerTime(long time, boolean relative) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetPlayerTime() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printRaw(String msg) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printDebug(String msg) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(String msg) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printError(String msg) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseItemStack getItemInHand(HandSide handSide) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giveItem(BaseItemStack itemStack) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockBag getInventoryBlockBag() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(Vector3 pos, float pitch, float yaw) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BaseEntity getState() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompassTarget(Location location) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SessionKey getSessionKey() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public <T> T getFacet(Class<? extends T> cls) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
* WorldGuard, a suite of tools for Minecraft
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldGuard team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser 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 Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.weather.WeatherType;
|
||||
import com.sk89q.worldedit.world.weather.WeatherTypes;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.util.MessagingUtil;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import org.bukkit.BanList.Type;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class BukkitPlayer extends com.sk89q.worldedit.bukkit.BukkitPlayer implements LocalPlayer {
|
||||
|
||||
protected final WorldGuardPlugin plugin;
|
||||
private final boolean silenced;
|
||||
private String name;
|
||||
|
||||
public BukkitPlayer(WorldGuardPlugin plugin, Player player) {
|
||||
this(plugin, player, false);
|
||||
}
|
||||
|
||||
BukkitPlayer(WorldGuardPlugin plugin, Player player, boolean silenced) {
|
||||
super(player);
|
||||
this.plugin = plugin;
|
||||
this.silenced = silenced;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if (this.name == null) {
|
||||
// getName() takes longer than before in newer versions of Minecraft
|
||||
this.name = getPlayer().getName();
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGroup(String group) {
|
||||
return plugin.inGroup(getPlayer(), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void kick(String msg) {
|
||||
if (!silenced) {
|
||||
getPlayer().kickPlayer(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ban(String msg) {
|
||||
if (!silenced) {
|
||||
Bukkit.getBanList(Type.NAME).addBan(getName(), null, null, null);
|
||||
getPlayer().kickPlayer(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHealth() {
|
||||
return getPlayer().getHealth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHealth(double health) {
|
||||
getPlayer().setHealth(health);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxHealth() {
|
||||
return getPlayer().getMaxHealth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getFoodLevel() {
|
||||
return getPlayer().getFoodLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFoodLevel(double foodLevel) {
|
||||
getPlayer().setFoodLevel((int) foodLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSaturation() {
|
||||
return getPlayer().getSaturation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSaturation(double saturation) {
|
||||
getPlayer().setSaturation((float) saturation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExhaustion() {
|
||||
return getPlayer().getExhaustion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExhaustion(float exhaustion) {
|
||||
getPlayer().setExhaustion(exhaustion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeatherType getPlayerWeather() {
|
||||
org.bukkit.WeatherType playerWeather = getPlayer().getPlayerWeather();
|
||||
return playerWeather == null ? null : playerWeather == org.bukkit.WeatherType.CLEAR ? WeatherTypes.CLEAR : WeatherTypes.RAIN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerWeather(WeatherType weather) {
|
||||
getPlayer().setPlayerWeather(weather == WeatherTypes.CLEAR ? org.bukkit.WeatherType.CLEAR : org.bukkit.WeatherType.DOWNFALL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetPlayerWeather() {
|
||||
getPlayer().resetPlayerWeather();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlayerTimeRelative() {
|
||||
return getPlayer().isPlayerTimeRelative();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPlayerTimeOffset() {
|
||||
return getPlayer().getPlayerTimeOffset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerTime(long time, boolean relative) {
|
||||
getPlayer().setPlayerTime(time, relative);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetPlayerTime() {
|
||||
getPlayer().resetPlayerTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireTicks() {
|
||||
return getPlayer().getFireTicks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFireTicks(int fireTicks) {
|
||||
getPlayer().setFireTicks(fireTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompassTarget(Location location) {
|
||||
getPlayer().setCompassTarget(BukkitAdapter.adapt(location));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendTitle(String title, String subtitle) {
|
||||
if (WorldGuard.getInstance().getPlatform().getGlobalStateManager().get(getWorld()).forceDefaultTitleTimes) {
|
||||
getPlayer().sendTitle(title, subtitle, 10, 70, 20);
|
||||
} else {
|
||||
getPlayer().sendTitle(title, subtitle, -1, -1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetFallDistance() {
|
||||
getPlayer().setFallDistance(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void teleport(Location location, String successMessage, String failMessage) {
|
||||
PaperLib.teleportAsync(getPlayer(), BukkitAdapter.adapt(location))
|
||||
.thenApply(success -> {
|
||||
if (success) {
|
||||
// The success message can be cleared via flag
|
||||
if (!successMessage.isEmpty()) {
|
||||
MessagingUtil.sendStringToChat(this, successMessage);
|
||||
}
|
||||
} else {
|
||||
printError(failMessage);
|
||||
}
|
||||
return success;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getGroups() {
|
||||
return plugin.getGroups(getPlayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printRaw(String msg) {
|
||||
if (!silenced) {
|
||||
super.printRaw(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(String perm) {
|
||||
return plugin.hasPermission(getPlayer(), perm);
|
||||
}
|
||||
}
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* WorldGuard, a suite of tools for Minecraft
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldGuard team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser 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 Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.config.WorldConfiguration;
|
||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import com.sk89q.worldguard.protection.regions.RegionContainer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
import org.bukkit.event.world.WorldUnloadEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BukkitRegionContainer extends RegionContainer {
|
||||
|
||||
/**
|
||||
* Invalidation frequency in ticks.
|
||||
*/
|
||||
private static final int CACHE_INVALIDATION_INTERVAL = 2;
|
||||
|
||||
private final WorldGuardPlugin plugin;
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
* @param plugin the plugin
|
||||
*/
|
||||
public BukkitRegionContainer(WorldGuardPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
super.initialize();
|
||||
Bukkit.getPluginManager().registerEvents(new Listener() {
|
||||
@EventHandler
|
||||
public void onWorldLoad(WorldLoadEvent event) {
|
||||
load(BukkitAdapter.adapt(event.getWorld()));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onWorldUnload(WorldUnloadEvent event) {
|
||||
unload(BukkitAdapter.adapt(event.getWorld()));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onChunkLoad(ChunkLoadEvent event) {
|
||||
RegionManager manager = get(BukkitAdapter.adapt(event.getWorld()));
|
||||
if (manager != null) {
|
||||
Chunk chunk = event.getChunk();
|
||||
manager.loadChunk(BlockVector2.at(chunk.getX(), chunk.getZ()));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onChunkUnload(ChunkUnloadEvent event) {
|
||||
RegionManager manager = get(BukkitAdapter.adapt(event.getWorld()));
|
||||
if (manager != null) {
|
||||
Chunk chunk = event.getChunk();
|
||||
manager.unloadChunk(BlockVector2.at(chunk.getX(), chunk.getZ()));
|
||||
}
|
||||
}
|
||||
}, plugin);
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, cache::invalidateAll, CACHE_INVALIDATION_INTERVAL, CACHE_INVALIDATION_INTERVAL);
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
container.shutdown();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected RegionManager load(World world) {
|
||||
checkNotNull(world);
|
||||
|
||||
WorldConfiguration config = WorldGuard.getInstance().getPlatform().getGlobalStateManager().get(world);
|
||||
if (!config.useRegions) {
|
||||
return null;
|
||||
}
|
||||
|
||||
RegionManager manager;
|
||||
|
||||
synchronized (lock) {
|
||||
manager = container.load(world.getName());
|
||||
|
||||
if (manager != null) {
|
||||
// Bias the region data for loaded chunks
|
||||
List<BlockVector2> positions = new ArrayList<>();
|
||||
for (Chunk chunk : ((BukkitWorld) world).getWorld().getLoadedChunks()) {
|
||||
positions.add(BlockVector2.at(chunk.getX(), chunk.getZ()));
|
||||
}
|
||||
manager.loadChunks(positions);
|
||||
}
|
||||
}
|
||||
|
||||
return manager;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
/*
|
||||
* WorldGuard, a suite of tools for Minecraft
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldGuard team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser 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 Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.internal.platform.StringMatcher;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class BukkitStringMatcher implements StringMatcher {
|
||||
|
||||
@Override
|
||||
public World matchWorld(Actor sender, String filter) throws CommandException {
|
||||
List<? extends World> worlds = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getWorlds();
|
||||
|
||||
// Handle special hash tag groups
|
||||
if (filter.charAt(0) == '#') {
|
||||
// #main for the main world
|
||||
if (filter.equalsIgnoreCase("#main")) {
|
||||
return worlds.get(0);
|
||||
|
||||
// #normal for the first normal world
|
||||
} else if (filter.equalsIgnoreCase("#normal")) {
|
||||
for (World world : worlds) {
|
||||
if (BukkitAdapter.adapt(world).getEnvironment() == org.bukkit.World.Environment.NORMAL) {
|
||||
return world;
|
||||
}
|
||||
}
|
||||
|
||||
throw new CommandException("No normal world found.");
|
||||
|
||||
// #nether for the first nether world
|
||||
} else if (filter.equalsIgnoreCase("#nether")) {
|
||||
for (World world : worlds) {
|
||||
if (BukkitAdapter.adapt(world).getEnvironment() == org.bukkit.World.Environment.NETHER) {
|
||||
return world;
|
||||
}
|
||||
}
|
||||
|
||||
throw new CommandException("No nether world found.");
|
||||
|
||||
// #end for the first nether world
|
||||
} else if (filter.equalsIgnoreCase("#end")) {
|
||||
for (World world : worlds) {
|
||||
if (BukkitAdapter.adapt(world).getEnvironment() == org.bukkit.World.Environment.THE_END) {
|
||||
return world;
|
||||
}
|
||||
}
|
||||
|
||||
throw new CommandException("No end world found.");
|
||||
|
||||
// Handle getting a world from a player
|
||||
} else if (filter.matches("^#player$")) {
|
||||
String[] parts = filter.split(":", 2);
|
||||
|
||||
// They didn't specify an argument for the player!
|
||||
if (parts.length == 1) {
|
||||
throw new CommandException("Argument expected for #player.");
|
||||
}
|
||||
|
||||
return matchPlayers(sender, parts[1]).iterator().next().getWorld();
|
||||
} else {
|
||||
throw new CommandException("Invalid identifier '" + filter + "'.");
|
||||
}
|
||||
}
|
||||
|
||||
for (World world : worlds) {
|
||||
if (world.getName().equals(filter)) {
|
||||
return world;
|
||||
}
|
||||
}
|
||||
|
||||
throw new CommandException("No world by that exact name found.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LocalPlayer> matchPlayerNames(String filter) {
|
||||
List<LocalPlayer> wgPlayers = Bukkit.getServer().getOnlinePlayers().stream().map(player -> WorldGuardPlugin.inst().wrapPlayer(player)).collect(Collectors.toList());
|
||||
|
||||
filter = filter.toLowerCase();
|
||||
|
||||
// Allow exact name matching
|
||||
if (filter.charAt(0) == '@' && filter.length() >= 2) {
|
||||
filter = filter.substring(1);
|
||||
|
||||
for (LocalPlayer player : wgPlayers) {
|
||||
if (player.getName().equalsIgnoreCase(filter)) {
|
||||
List<LocalPlayer> list = new ArrayList<>();
|
||||
list.add(player);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
return new ArrayList<>();
|
||||
// Allow partial name matching
|
||||
} else if (filter.charAt(0) == '*' && filter.length() >= 2) {
|
||||
filter = filter.substring(1);
|
||||
|
||||
List<LocalPlayer> list = new ArrayList<>();
|
||||
|
||||
for (LocalPlayer player : wgPlayers) {
|
||||
if (player.getName().toLowerCase().contains(filter)) {
|
||||
list.add(player);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
// Start with name matching
|
||||
} else {
|
||||
List<LocalPlayer> list = new ArrayList<>();
|
||||
|
||||
for (LocalPlayer player : wgPlayers) {
|
||||
if (player.getName().toLowerCase().startsWith(filter)) {
|
||||
list.add(player);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<? extends LocalPlayer> matchPlayers(Actor source, String filter) throws CommandException {
|
||||
if (Bukkit.getServer().getOnlinePlayers().isEmpty()) {
|
||||
throw new CommandException("No players matched query.");
|
||||
}
|
||||
|
||||
List<LocalPlayer> wgPlayers = Bukkit.getServer().getOnlinePlayers().stream().map(player -> WorldGuardPlugin.inst().wrapPlayer(player)).collect(Collectors.toList());
|
||||
|
||||
if (filter.equals("*")) {
|
||||
return checkPlayerMatch(wgPlayers);
|
||||
}
|
||||
|
||||
// Handle special hash tag groups
|
||||
if (filter.charAt(0) == '#') {
|
||||
// Handle #world, which matches player of the same world as the
|
||||
// calling source
|
||||
if (filter.equalsIgnoreCase("#world")) {
|
||||
List<LocalPlayer> players = new ArrayList<>();
|
||||
LocalPlayer sourcePlayer = WorldGuard.getInstance().checkPlayer(source);
|
||||
World sourceWorld = sourcePlayer.getWorld();
|
||||
|
||||
for (LocalPlayer player : wgPlayers) {
|
||||
if (player.getWorld().equals(sourceWorld)) {
|
||||
players.add(player);
|
||||
}
|
||||
}
|
||||
|
||||
return checkPlayerMatch(players);
|
||||
|
||||
// Handle #near, which is for nearby players.
|
||||
} else if (filter.equalsIgnoreCase("#near")) {
|
||||
List<LocalPlayer> players = new ArrayList<>();
|
||||
LocalPlayer sourcePlayer = WorldGuard.getInstance().checkPlayer(source);
|
||||
World sourceWorld = sourcePlayer.getWorld();
|
||||
Vector3 sourceVector = sourcePlayer.getLocation().toVector();
|
||||
|
||||
for (LocalPlayer player : wgPlayers) {
|
||||
if (player.getWorld().equals(sourceWorld) && player.getLocation().toVector().distanceSq(sourceVector) < 900) {
|
||||
players.add(player);
|
||||
}
|
||||
}
|
||||
|
||||
return checkPlayerMatch(players);
|
||||
|
||||
} else {
|
||||
throw new CommandException("Invalid group '" + filter + "'.");
|
||||
}
|
||||
}
|
||||
|
||||
List<LocalPlayer> players = matchPlayerNames(filter);
|
||||
|
||||
return checkPlayerMatch(players);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Actor matchPlayerOrConsole(Actor sender, String filter) throws CommandException {
|
||||
// Let's see if console is wanted
|
||||
if (filter.equalsIgnoreCase("#console")
|
||||
|| filter.equalsIgnoreCase("*console*")
|
||||
|| filter.equalsIgnoreCase("!")) {
|
||||
return WorldGuardPlugin.inst().wrapCommandSender(Bukkit.getServer().getConsoleSender());
|
||||
}
|
||||
|
||||
return matchSinglePlayer(sender, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorldByName(String worldName) {
|
||||
final org.bukkit.World bukkitW = Bukkit.getServer().getWorld(worldName);
|
||||
if (bukkitW == null) {
|
||||
return null;
|
||||
}
|
||||
return BukkitAdapter.adapt(bukkitW);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String replaceMacros(Actor sender, String message) {
|
||||
Collection<? extends Player> online = Bukkit.getServer().getOnlinePlayers();
|
||||
|
||||
message = message.replace("%name%", sender.getName());
|
||||
message = message.replace("%id%", sender.getUniqueId().toString());
|
||||
message = message.replace("%online%", String.valueOf(online.size()));
|
||||
|
||||
if (sender instanceof LocalPlayer) {
|
||||
LocalPlayer player = (LocalPlayer) sender;
|
||||
World world = (World) player.getExtent();
|
||||
|
||||
message = message.replace("%world%", world.getName());
|
||||
message = message.replace("%health%", String.valueOf(player.getHealth()));
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* WorldGuard, a suite of tools for Minecraft
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldGuard team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser 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 Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.blacklist.target.BlockTarget;
|
||||
import com.sk89q.worldguard.blacklist.target.ItemTarget;
|
||||
import com.sk89q.worldguard.blacklist.target.Target;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class BukkitUtil {
|
||||
|
||||
private BukkitUtil() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given potion is a vial of water.
|
||||
*
|
||||
* @param item the item to check
|
||||
* @return true if it's a water vial
|
||||
*/
|
||||
public static boolean isWaterPotion(ItemStack item) {
|
||||
return (item.getDurability() & 0x3F) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get just the potion effect bits. This is to work around bugs with potion
|
||||
* parsing.
|
||||
*
|
||||
* @param item item
|
||||
* @return new bits
|
||||
*/
|
||||
public static int getPotionEffectBits(ItemStack item) {
|
||||
return item.getDurability() & 0x3F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a blacklist target for the given block.
|
||||
*
|
||||
* @param block the block
|
||||
* @param effectiveMaterial The effective material, if different
|
||||
* @return a target
|
||||
*/
|
||||
public static Target createTarget(Block block, Material effectiveMaterial) {
|
||||
checkNotNull(block);
|
||||
checkNotNull(block.getType());
|
||||
if (block.getType() == effectiveMaterial) {
|
||||
return createTarget(block.getType());
|
||||
} else {
|
||||
return createTarget(effectiveMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a blacklist target for the given block.
|
||||
*
|
||||
* @param block the block
|
||||
* @return a target
|
||||
*/
|
||||
public static Target createTarget(Block block) {
|
||||
checkNotNull(block);
|
||||
checkNotNull(block.getType());
|
||||
return createTarget(block.getType());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a blacklist target for the given item.
|
||||
*
|
||||
* @param item the item
|
||||
* @return a target
|
||||
*/
|
||||
public static Target createTarget(ItemStack item) {
|
||||
checkNotNull(item);
|
||||
checkNotNull(item.getType());
|
||||
return createTarget(item.getType()); // Delegate it, ItemStacks can contain both Blocks and Items in Spigot
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a blacklist target for the given material.
|
||||
*
|
||||
* @param material the material
|
||||
* @return a target
|
||||
*/
|
||||
public static Target createTarget(Material material) {
|
||||
checkNotNull(material);
|
||||
if (material.isBlock()) {
|
||||
return new BlockTarget(BukkitAdapter.asBlockType(material));
|
||||
} else {
|
||||
return new ItemTarget(BukkitAdapter.asItemType(material));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loaded 100 of 434 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user