Compare commits
426
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90344d36df | ||
|
|
f36a56e854 | ||
|
|
5d4bacc80e | ||
|
|
d88bf6e137 | ||
|
|
63f5d769d8 | ||
|
|
9a9bfc03b9 | ||
|
|
28112ef4d8 | ||
|
|
7e5a3238b8 | ||
|
|
3279a6a38d | ||
|
|
b64e48769d | ||
|
|
ff8002fc13 | ||
|
|
2af835f0c3 | ||
|
|
bf25b65f09 | ||
|
|
52eb3d820f | ||
|
|
908fcb1e44 | ||
|
|
73cd26aea3 | ||
|
|
758d25812b | ||
|
|
fa0ef421c7 | ||
|
|
e936a6271f | ||
|
|
7362e543da | ||
|
|
8a46d70301 | ||
|
|
a168e5cb48 | ||
|
|
ae578f9491 | ||
|
|
e72122378d | ||
|
|
fd2ea3df09 | ||
|
|
e94e071c6e | ||
|
|
0e19236cdc | ||
|
|
1c12756acf | ||
|
|
bcfde80c07 | ||
|
|
8dc9e864eb | ||
|
|
fec820f4ba | ||
|
|
ff9ffad302 | ||
|
|
fc2cb6aeae | ||
|
|
d2776ef448 | ||
|
|
36ef41b710 | ||
|
|
9258ebd8c7 | ||
|
|
d528cbcafd | ||
|
|
760c193b0e | ||
|
|
7c6edcb081 | ||
|
|
009a94f74d | ||
|
|
bd6fb4e51c | ||
|
|
2fdef44744 | ||
|
|
5b991f44e2 | ||
|
|
871ba16b67 | ||
|
|
e90c50d170 | ||
|
|
d1be3bd0be | ||
|
|
4d40b3f7e4 | ||
|
|
1877479094 | ||
|
|
20ce469aec | ||
|
|
70c91f777f | ||
|
|
cc24f38d83 | ||
|
|
5ec27db284 | ||
|
|
5d6bc806f0 | ||
|
|
5868ad64b4 | ||
|
|
ac6fcf5ed6 | ||
|
|
231824fd34 | ||
|
|
a3e7efcc58 | ||
|
|
a649307a29 | ||
|
|
b0235757cc | ||
|
|
06ee82a745 | ||
|
|
d2cad7ca8d | ||
|
|
2390aa8f92 | ||
|
|
674c4a4a06 | ||
|
|
768402088a | ||
|
|
084033cc90 | ||
|
|
51801b1b36 | ||
|
|
71054197f2 | ||
|
|
610f96415f | ||
|
|
34fa336f00 | ||
|
|
d92d62bce9 | ||
|
|
cf14d41d19 | ||
|
|
719ade19f7 | ||
|
|
1a8a97daf1 | ||
|
|
d9dffa8e6d | ||
|
|
973588defb | ||
|
|
c704c1ca3a | ||
|
|
c33a268b91 | ||
|
|
9821f1d9c8 | ||
|
|
be6e0b67be | ||
|
|
b9b1fa6164 | ||
|
|
28585dd6f9 | ||
|
|
47ca7b821b | ||
|
|
9ce2dfd100 | ||
|
|
473ccd09d7 | ||
|
|
cc2e1d44b2 | ||
|
|
2e8f159d38 | ||
|
|
6581d16125 | ||
|
|
562bc56e83 | ||
|
|
4493cd7916 | ||
|
|
1cd9e45915 | ||
|
|
acb6bc6dd6 | ||
|
|
b7b17c5d21 | ||
|
|
bbd9211845 | ||
|
|
fc6796e20f | ||
|
|
6040a27126 | ||
|
|
1c483148dc | ||
|
|
128442c062 | ||
|
|
141854f076 | ||
|
|
f72cc6764b | ||
|
|
d95ecfaa8e | ||
|
|
6c96f4e974 | ||
|
|
28cee291c6 | ||
|
|
155f32c00f | ||
|
|
071ba05d81 | ||
|
|
2ee5aea06b | ||
|
|
3bb8de6d33 | ||
|
|
79ac01da34 | ||
|
|
6e4fbb0ece | ||
|
|
167ed5e0d3 | ||
|
|
91f3304f78 | ||
|
|
7928e73a32 | ||
|
|
d61d186544 | ||
|
|
dc356e88d0 | ||
|
|
d0d5574580 | ||
|
|
29617059b3 | ||
|
|
bf05fc81dd | ||
|
|
a2c5bf70f0 | ||
|
|
ea19006465 | ||
|
|
89f685ff9a | ||
|
|
ecc76033dc | ||
|
|
e843b0711d | ||
|
|
eddfaf7df0 | ||
|
|
d1150ab5f8 | ||
|
|
cc3996ca76 | ||
|
|
1965aecfba | ||
|
|
ce34ae44d8 | ||
|
|
f5a2d7bc47 | ||
|
|
24295025ef | ||
|
|
e3f56f6498 | ||
|
|
bd0c3cff3f | ||
|
|
7c4ab035a0 | ||
|
|
2593080f77 | ||
|
|
0d4595d511 | ||
|
|
bf820c2c27 | ||
|
|
a12718d354 | ||
|
|
b23c1ae606 | ||
|
|
7c59dcbcb9 | ||
|
|
15cacba7c9 | ||
|
|
adbe88daa6 | ||
|
|
5350c012f7 | ||
|
|
a91f377cf5 | ||
|
|
c3ae5ac210 | ||
|
|
f4ce740c06 | ||
|
|
3ff8d34053 | ||
|
|
f362f09380 | ||
|
|
62b789dff5 | ||
|
|
84a9db597a | ||
|
|
89fd700e32 | ||
|
|
9741b1794c | ||
|
|
001a6000f8 | ||
|
|
bf61069fed | ||
|
|
d93def8b5b | ||
|
|
540394e266 | ||
|
|
425b1c80cc | ||
|
|
47ae6f5378 | ||
|
|
48601e4215 | ||
|
|
ed80083fe8 | ||
|
|
d041e0a8d1 | ||
|
|
de85be5832 | ||
|
|
81d59d8bf5 | ||
|
|
5d3d732c25 | ||
|
|
0c2d2f4e0a | ||
|
|
3d9108fb48 | ||
|
|
25c616bc32 | ||
|
|
148187025a | ||
|
|
115b0dc078 | ||
|
|
78bf6ba3bf | ||
|
|
e31c391af4 | ||
|
|
6ed4be9a64 | ||
|
|
d626e7e4b1 | ||
|
|
e7dd4fee51 | ||
|
|
146075de69 | ||
|
|
9fce6c54f6 | ||
|
|
f189eb3b7e | ||
|
|
ed77cacb1a | ||
|
|
2d4fe301cf | ||
|
|
e5fe1fe565 | ||
|
|
83010f1a28 | ||
|
|
864e50e38c | ||
|
|
0a99258f3e | ||
|
|
cfae997de4 | ||
|
|
b345baf20e | ||
|
|
d532052c7b | ||
|
|
1c02fb4387 | ||
|
|
2a99649e1e | ||
|
|
994bf922af | ||
|
|
36094e2bea | ||
|
|
6243b41956 | ||
|
|
32170cc089 | ||
|
|
c1a3d48944 | ||
|
|
75855826e7 | ||
|
|
d35363b10c | ||
|
|
ad1b733498 | ||
|
|
9159dfbb7d | ||
|
|
b8acd339b3 | ||
|
|
51e035eb3e | ||
|
|
2fd8e3edc3 | ||
|
|
faf20ee36e | ||
|
|
e1494808f3 | ||
|
|
05cf052204 | ||
|
|
242f05fc77 | ||
|
|
dd29fcc1dd | ||
|
|
d5013546d1 | ||
|
|
058c0837f0 | ||
|
|
e01c646562 | ||
|
|
3afca50930 | ||
|
|
94ca18e95c | ||
|
|
707eae92a8 | ||
|
|
b4a4519876 | ||
|
|
4f41b7aa6e | ||
|
|
b9267a3dfc | ||
|
|
a53c4214f0 | ||
|
|
343695e23e | ||
|
|
e17e9c8ce9 | ||
|
|
676c3a2e3d | ||
|
|
e821611744 | ||
|
|
d69c492577 | ||
|
|
eb91eefc80 | ||
|
|
f570c81366 | ||
|
|
b3f23278b1 | ||
|
|
3fa2bfa7cf | ||
|
|
582d6bef1a | ||
|
|
04c65cc59e | ||
|
|
268c4982c3 | ||
|
|
8983a0c024 | ||
|
|
1cbe901e4d | ||
|
|
4894abd1f1 | ||
|
|
1fac13247f | ||
|
|
59cfacf007 | ||
|
|
5f916fbf27 | ||
|
|
c70e254dbf | ||
|
|
9d42a05759 | ||
|
|
59b6522d59 | ||
|
|
46f8453b5b | ||
|
|
b4b0940918 | ||
|
|
22ad7214b0 | ||
|
|
1ba693ffd5 | ||
|
|
6ee0d8a05e | ||
|
|
d3ff2922fd | ||
|
|
5e2824abeb | ||
|
|
926e23bf19 | ||
|
|
841598232c | ||
|
|
540b6abcab | ||
|
|
38d5917915 | ||
|
|
da6bd20b42 | ||
|
|
8859fa78fd | ||
|
|
4de6b9ce47 | ||
|
|
f595f4cdb9 | ||
|
|
1581e1e009 | ||
|
|
7cb9bd4bc2 | ||
|
|
32e72bb355 | ||
|
|
950402a144 | ||
|
|
f598551d9c | ||
|
|
c3f08318d4 | ||
|
|
f0343b08b5 | ||
|
|
20a1fcb9f5 | ||
|
|
253ede1c9a | ||
|
|
d4454703e4 | ||
|
|
9737b62813 | ||
|
|
06bd1a838f | ||
|
|
4343167240 | ||
|
|
7762aca019 | ||
|
|
6ebc1188e8 | ||
|
|
8b358b0955 | ||
|
|
b201b09719 | ||
|
|
4c9d108f08 | ||
|
|
564a7d3684 | ||
|
|
d832e9e6d9 | ||
|
|
aa574b6236 | ||
|
|
d7894eb847 | ||
|
|
5e067fa72d | ||
|
|
b1bf68a0ad | ||
|
|
89a8f24b14 | ||
|
|
43ecdc913a | ||
|
|
0f14ee557d | ||
|
|
9b88d1d491 | ||
|
|
606a3fa3ce | ||
|
|
a7cace0fdc | ||
|
|
ae314108a3 | ||
|
|
d0180f05d5 | ||
|
|
07df8d0d09 | ||
|
|
4552f70f7e | ||
|
|
a6912c3cb5 | ||
|
|
4bdeacfd05 | ||
|
|
01f549f408 | ||
|
|
f7bbb5029b | ||
|
|
658b5219c3 | ||
|
|
fb505ab161 | ||
|
|
284b3179ad | ||
|
|
532ffacf5a | ||
|
|
2b4d386eb2 | ||
|
|
bc20ecbe60 | ||
|
|
4878395460 | ||
|
|
467ec809b5 | ||
|
|
ceb6850670 | ||
|
|
63abf33414 | ||
|
|
bcd7fcaee7 | ||
|
|
d18581828d | ||
|
|
54209e1535 | ||
|
|
2ed59a866f | ||
|
|
41b3096600 | ||
|
|
42adfa8175 | ||
|
|
12bcf71028 | ||
|
|
a826d0b2ff | ||
|
|
59cab8a417 | ||
|
|
da6a62b984 | ||
|
|
806c5909c4 | ||
|
|
c00847f173 | ||
|
|
626e5d3e4b | ||
|
|
f5e8a9c2e8 | ||
|
|
3364709e53 | ||
|
|
67d172fd08 | ||
|
|
f3a420d85c | ||
|
|
aba1f05c5b | ||
|
|
8fdc0ad3da | ||
|
|
3db57ee1d9 | ||
|
|
b3841adcc1 | ||
|
|
0b0b3c0088 | ||
|
|
a64a8d9605 | ||
|
|
0a0d3ba527 | ||
|
|
a351fbb345 | ||
|
|
46359cfbfe | ||
|
|
f52004cb76 | ||
|
|
0e3848874a | ||
|
|
71ba31a0f4 | ||
|
|
7b1e77340b | ||
|
|
bebd4742b9 | ||
|
|
b933027523 | ||
|
|
bd1d852393 | ||
|
|
648365f336 | ||
|
|
12b6a69146 | ||
|
|
cd312c3ab9 | ||
|
|
d2d243caec | ||
|
|
865434d1b1 | ||
|
|
0858e324dd | ||
|
|
618986e216 | ||
|
|
cc3dfe9fd4 | ||
|
|
6ee8466ac0 | ||
|
|
3b7dd21440 | ||
|
|
528dc25fcb | ||
|
|
762d8e3ebb | ||
|
|
ef251c256d | ||
|
|
da3015c72c | ||
|
|
601f457e6f | ||
|
|
ec805f38d7 | ||
|
|
61710369f4 | ||
|
|
4824d53fab | ||
|
|
65cc817573 | ||
|
|
9bb7dd6e5d | ||
|
|
fadb3280e3 | ||
|
|
b64dfa34af | ||
|
|
584a81fac6 | ||
|
|
4233e4f8b4 | ||
|
|
28da4aac2f | ||
|
|
c37dd803c8 | ||
|
|
27abb55006 | ||
|
|
c607aa1c47 | ||
|
|
79f8f6bd55 | ||
|
|
1446dd936a | ||
|
|
8664f56eeb | ||
|
|
1c2514d5db | ||
|
|
34c8b7cf0b | ||
|
|
63af4370b5 | ||
|
|
832e0f6497 | ||
|
|
b198942742 | ||
|
|
b60250287e | ||
|
|
86ba242f33 | ||
|
|
0639d39d5a | ||
|
|
ee745f8a55 | ||
|
|
243fc8bc20 | ||
|
|
807730805c | ||
|
|
c8abdf00b5 | ||
|
|
21aaf4a03e | ||
|
|
8ea639eba8 | ||
|
|
a7e6fd1412 | ||
|
|
636b8289f6 | ||
|
|
79290eed0d | ||
|
|
9f927605da | ||
|
|
e69b5a6b17 | ||
|
|
cbe6c2c901 | ||
|
|
875685b705 | ||
|
|
ad6f0d1b62 | ||
|
|
4a66a2f5bb | ||
|
|
a8040abd52 | ||
|
|
72a14719ac | ||
|
|
2b827a1fae | ||
|
|
e45520c43b | ||
|
|
0fb33d12d6 | ||
|
|
ebe44ed99e | ||
|
|
23ba7fe73b | ||
|
|
4efa97ee0e | ||
|
|
ce80fc190d | ||
|
|
8bfe3a5473 | ||
|
|
07a38e3e58 | ||
|
|
360c63fad9 | ||
|
|
2a5edc4f91 | ||
|
|
dba21cadaf | ||
|
|
fa9191dd8f | ||
|
|
4043d5abcb | ||
|
|
eff56f74da | ||
|
|
d97a9bccde | ||
|
|
55741b524d | ||
|
|
186d3f15a4 | ||
|
|
841f6f05df | ||
|
|
ebc2a516bb | ||
|
|
9e029ad6ae | ||
|
|
b2135a8f42 | ||
|
|
8cbffd1cee | ||
|
|
ff22077adf | ||
|
|
60c0a1ab92 | ||
|
|
58eeecbcb8 | ||
|
|
876456b932 | ||
|
|
18db50ca56 | ||
|
|
cce1ccc967 | ||
|
|
e5537dd8f1 | ||
|
|
0c7ba2ae67 | ||
|
|
bbfc672582 | ||
|
|
a65dc4966b | ||
|
|
4780f87278 | ||
|
|
b11d911e4a | ||
|
|
155aad8bf2 | ||
|
|
6e1d4ef961 | ||
|
|
cfa5a04e3a | ||
|
|
7d1c47c2fc | ||
|
|
957c55955d | ||
|
|
0226ab9609 |
No files matched your search
@@ -0,0 +1,77 @@
|
||||
name: 🐛 Report a Bug
|
||||
description: Report a problem with Multiverse-Core.
|
||||
title: "[Bug]: "
|
||||
labels: ["Bug: Unconfirmed"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this bug report!
|
||||
|
||||
If you are having issues with other submodules of Multiverse, please go to their respective git repo:
|
||||
Multiverse-Portals: https://github.com/Multiverse/Multiverse-Portals/issues/new/choose
|
||||
Multiverse-NetherPortals: https://github.com/Multiverse/Multiverse-NetherPortals/issues/new/choose
|
||||
Multiverse-Inventories: https://github.com/Multiverse/Multiverse-Inventories/issues/new/choose
|
||||
Multiverse-SignPortals: https://github.com/Multiverse/Multiverse-SignPortals/issues/new/choose
|
||||
|
||||
Not sure if this is a bug with Multiverse-Core? Feel free to ask on our Discord server: https://discord.gg/NZtfKky
|
||||
|
||||
When completing the report, please ensure all fields are filled with the correct details requested. Failure to do so will result in your issue being closed.
|
||||
- type: input
|
||||
id: mutliverse-version-info
|
||||
attributes:
|
||||
label: '`/mv version -p` output'
|
||||
description: Run `/mv version -p` in the console, then copy and paste the link from the output of the command into this box.
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: server-logs
|
||||
attributes:
|
||||
label: Server logs
|
||||
description: >
|
||||
Include full startup log and console error (if any). upload all relevant logs to either https://paste.gg
|
||||
or https://gist.github.com, save and the paste the link in this box.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: server-version
|
||||
attributes:
|
||||
label: Server Version
|
||||
description: Output of `/version` command.
|
||||
placeholder: server version info
|
||||
render: shell
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: bug-description
|
||||
attributes:
|
||||
label: Bug Description
|
||||
description: Describe in detail what the bug is about. Include the expected behaviour and actual behaviour.
|
||||
placeholder: "Example: When running `/mv` it cause the server to crash..."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduce-steps
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: Provide detailed intructions to trigger the bug.
|
||||
placeholder: |
|
||||
Example:
|
||||
1. Start a server with only multiverse installed.
|
||||
2. Run `/mv` command.
|
||||
3. Players all get kicked with a "server closed" message.
|
||||
...
|
||||
validations:
|
||||
required: true
|
||||
- type: checkboxes
|
||||
id: agreements
|
||||
attributes:
|
||||
label: Agreements
|
||||
description: Ensure you have done the following being submitting this issue.
|
||||
options:
|
||||
- label: I have searched for and ensured there isn't already an open or resolved issue(s) regarding this.
|
||||
required: true
|
||||
- label: >
|
||||
I was able to reproduce my issue on a freshly setup and up-to-date server with the latest
|
||||
version of Multiverse plugins with no other plugins and with no kinds of other server or client mods.
|
||||
required: true
|
||||
@@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: 💬 Multiverse Discord Server
|
||||
url: https://discord.gg/NZtfKky
|
||||
about: Need help with using Multiverse-Core or just want to chat with the devs? Join the Multiverse Discord Server for help!
|
||||
@@ -0,0 +1,41 @@
|
||||
name: 💡 Request a Feature
|
||||
description: Suggest a feature you want to see in Multiverse-Core!
|
||||
title: "[Idea]: "
|
||||
labels: ["Type: Idea"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to share your ideas!
|
||||
|
||||
If you are look for other submodules of Multiverse, go to their respective git repo:
|
||||
Multiverse-Portals: https://github.com/Multiverse/Multiverse-Portals/issues/new/choose
|
||||
Multiverse-NetherPortals: https://github.com/Multiverse/Multiverse-NetherPortals/issues/new/choose
|
||||
Multiverse-Inventories: https://github.com/Multiverse/Multiverse-Inventories/issues/new/choose
|
||||
Multiverse-SignPortals: https://github.com/Multiverse/Multiverse-SignPortals/issues/new/choose
|
||||
|
||||
Not sure if your feature fits in Multiverse-Core? Feel free to ask on our Discord server: https://discord.gg/NZtfKky
|
||||
- type: textarea
|
||||
id: feature-description
|
||||
attributes:
|
||||
label: Describe the feature
|
||||
description: What feature are you suggesting?
|
||||
placeholder: "Example: I hope multiverse can implement random teleport feature..."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: feature-reasoning
|
||||
attributes:
|
||||
label: How is the feature useful to all Multiverse users?
|
||||
description: How is the feature useful to all players, server owners and/or developers?
|
||||
placeholder: "Example: Random teleporting can be integrated into many multiverse modules such as mv-portals..."
|
||||
validations:
|
||||
required: true
|
||||
- type: checkboxes
|
||||
id: agreements
|
||||
attributes:
|
||||
label: Agreements
|
||||
description: Ensure you have done the following being submitting this issue.
|
||||
options:
|
||||
- label: I have searched for and ensured there isn't already an open issue regarding this.
|
||||
required: true
|
||||
@@ -0,0 +1,64 @@
|
||||
name: Create Release Version & Publish Package
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
release_on_push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
cache: gradle
|
||||
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@v1
|
||||
|
||||
- name: Test & Build
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
arguments: clean build -x assemble -x shadowJar
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Create release
|
||||
id: release
|
||||
uses: Multiverse/release-on-push-action@support_prerelease
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
bump_version_scheme: norelease
|
||||
tag_prefix: ''
|
||||
release_name: "<RELEASE_VERSION>"
|
||||
use_github_release_notes: true
|
||||
|
||||
- name: Modify version scheme
|
||||
run: |
|
||||
if [[ "${{ steps.release.outputs.tag_name }}" == *"pre"* ]]; then
|
||||
echo "Replacing prerelease version scheme with SNAPSHOT"
|
||||
echo "VERSION=$(echo ${{ steps.release.outputs.tag_name }} | sed -E 's/-pre.*/-SNAPSHOT/')" >> $GITHUB_ENV
|
||||
else
|
||||
echo "Using release version scheme"
|
||||
echo "VERSION=${{ steps.release.outputs.tag_name }}" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Publish package
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
arguments: publish
|
||||
env:
|
||||
GITHUB_VERSION: ${{ env.VERSION }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Upload release artifact
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: build/libs/multiverse-core-${{ env.VERSION }}.jar
|
||||
asset_name: multiverse-core-${{ steps.release.outputs.tag_name }}.jar
|
||||
tag: ${{ steps.release.outputs.tag_name }}
|
||||
@@ -0,0 +1,18 @@
|
||||
name: Require PR Labels
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, labeled, unlabeled, synchronize]
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
require_label:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: mheap/github-action-required-labels@v2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
mode: exactly
|
||||
count: 1
|
||||
labels: "release:major, release:minor, release:patch, no version bump"
|
||||
@@ -0,0 +1,29 @@
|
||||
name: Run unit tests against all PRs
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
cache: gradle
|
||||
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@v1
|
||||
|
||||
- name: Run unit tests
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
arguments: build
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
# maven
|
||||
/target
|
||||
dependency-reduced-pom.xml
|
||||
|
||||
# vim
|
||||
.*.sw[a-p]
|
||||
@@ -42,3 +43,6 @@ debug.log
|
||||
# Doxygen
|
||||
/docs/html
|
||||
debug.txt
|
||||
|
||||
# Gradle
|
||||
.gradle
|
||||
@@ -0,0 +1,6 @@
|
||||
Copyright (c) 2011, The Multiverse Team All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 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. Neither the name of the The Multiverse Team 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@@ -1,15 +1,44 @@
|
||||

|
||||
|
||||
[](https://github.com/Multiverse/Multiverse-Core/actions/workflows/build.yml)
|
||||
[](https://dev.bukkit.org/projects/multiverse-core)
|
||||
[](https://ci.onarandombox.com/job/Multiverse-Core/)
|
||||
[](https://discord.gg/NZtfKky)
|
||||
[](https://patreon.com/dumptruckman)
|
||||
[](LICENSE.md)
|
||||
|
||||
About
|
||||
========
|
||||
[Multiverse](https://dev.bukkit.org/projects/multiverse-core) was created at the dawn of Bukkit multiworld support. It has since then grown into a **complete world management solution!** Multiverse provides the easiest to use world management solution for your Minecraft server, big or small, and with great addons like [Portals](https://dev.bukkit.org/projects/multiverse-portals) and [NetherPortals](https://dev.bukkit.org/projects/multiverse-netherportals/), what's not to love!
|
||||
<br><br>
|
||||
Now it's time to create your very own Multiverse server, do check out our [Wiki](https://github.com/Multiverse/Multiverse-Core/wiki) and [Usage Guide](https://github.com/Multiverse/Multiverse-Core/wiki/Basics) to get started. Feel free to hop onto our [Discord](https://discord.gg/NZtfKky) if you have any question or just want to have a chat with us!
|
||||
|
||||
### Amazing sub-modules available:
|
||||
* [Multiverse-NetherPortals](https://github.com/Multiverse/Multiverse-NetherPortals) -> Have separate nether and end worlds for each of your overworlds!
|
||||
* [Multiverse-Portals](https://github.com/Multiverse/Multiverse-Portals) -> Make custom portals to go to any destination!
|
||||
* [Multiverse-Inventories](https://github.com/Multiverse/Multiverse-Inventories) -> Have separated players stats and inventories per world or per group of worlds.
|
||||
* [Multiverse-SignPortals](https://github.com/Multiverse/Multiverse-SignPortals) -> Signs as teleprompters!
|
||||
|
||||
Building
|
||||
========
|
||||
Simply build the source with maven:
|
||||
|
||||
$ mvn install
|
||||
|
||||
Simply build the source with Gradle:
|
||||
```
|
||||
./gradlew build
|
||||
```
|
||||
More details are available on the [build instructions wiki page](https://github.com/Multiverse/Multiverse-Core/wiki/Building).
|
||||
|
||||
|
||||
Contributing
|
||||
=======
|
||||
**Want to help improve Multiverse?** There are several ways you can support and contribute to the project.
|
||||
* Take a look at our "Bug: Unconfirmed" issues, where you can find issues that need extra testing and investigation.
|
||||
* Want others to love Multiverse too? You can join the [Multiverse Discord community](https://discord.gg/NZtfKky) and help others with issues and setup!
|
||||
* A Multiverse guru? You can update our [Wiki](https://github.com/Multiverse/Multiverse-Core/wiki) with your latest tip, tricks and guides! The wiki open for all to edit and improve.
|
||||
* Love coding? You could look at ["State: Open to PR"](https://github.com/Multiverse/Multiverse-Core/labels/State%3A%20Open%20to%20PR) and ["Resolution: Accepted"](https://github.com/Multiverse/Multiverse-Core/labels/Resolution%3A%20Accepted) issues. We're always happy to receive bug fixes and feature additions as [pull requests](https://www.freecodecamp.org/news/how-to-make-your-first-pull-request-on-github-3/).
|
||||
* If you'd like to make a financial contribution to the project, do consider joining our [patreon](https://www.patreon.com/dumptruckman) or make a one-time donation [here](https://paypal.me/dumptruckman)!
|
||||
|
||||
Additionally, we would like to give a big thanks to everyone that has supported Multiverse over the years, as well as those in the years to come. Thank you!
|
||||
|
||||
License
|
||||
=======
|
||||
Copyright (c) 2011, The Multiverse Team All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 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. Neither the name of the The Multiverse Team 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
Multiverse-Core is licensed under BSD-3-Clause License. Please see [LICENSE.md](LICENSE.md) for more info.
|
||||
@@ -1,44 +0,0 @@
|
||||
# Eclipse stuff
|
||||
/.classpath
|
||||
/.project
|
||||
/.settings
|
||||
/.checkstyle
|
||||
|
||||
# netbeans
|
||||
/nbproject
|
||||
|
||||
# we use maven!
|
||||
/build.xml
|
||||
|
||||
# maven
|
||||
/target
|
||||
|
||||
# vim
|
||||
.*.sw[a-p]
|
||||
|
||||
# various other potential build files
|
||||
/build
|
||||
/bin
|
||||
/dist
|
||||
/manifest.mf
|
||||
|
||||
/world
|
||||
|
||||
# Mac filesystem dust
|
||||
*.DS_Store
|
||||
|
||||
# intellij
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# Fern's utils
|
||||
uploadtoserver.sh
|
||||
|
||||
# Testing files:
|
||||
debug.log
|
||||
|
||||
# Doxygen
|
||||
/docs/html
|
||||
debug.txt
|
||||
@@ -1,140 +0,0 @@
|
||||
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ Multiverse 2 Copyright (c) the Multiverse Team 2012. ~
|
||||
~ Multiverse 2 is licensed under the BSD License. ~
|
||||
~ For more information please check the README.md file included ~
|
||||
~ with this project. ~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
|
||||
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
||||
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
|
||||
<!-- Future reference: valid severity values are 'ignore', 'info', 'warning', 'error' -->
|
||||
<module name="Checker">
|
||||
<module name="JavadocPackage">
|
||||
<property name="allowLegacy" value="true"/>
|
||||
</module>
|
||||
<module name="NewlineAtEndOfFile">
|
||||
<property name="severity" value="info"/>
|
||||
</module>
|
||||
<module name="Translation"/>
|
||||
<module name="FileLength"/>
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
</module>
|
||||
<module name="RegexpSingleline">
|
||||
<property name="message" value="Line has trailing spaces."/>
|
||||
<property name="format" value="\s+$"/>
|
||||
</module>
|
||||
<module name="SuppressWithNearbyCommentFilter">
|
||||
<property name="commentFormat" value="SUPPRESS CHECKSTYLE: (\w+)"/>
|
||||
<property name="checkFormat" value="$1"/>
|
||||
</module>
|
||||
<module name="SuppressionCommentFilter">
|
||||
<property name="offCommentFormat" value="BEGIN CHECKSTYLE-SUPPRESSION\: (\w+)"/>
|
||||
<property name="onCommentFormat" value="END CHECKSTYLE-SUPPRESSION\: (\w+)"/>
|
||||
<property name="checkFormat" value="$1"/>
|
||||
</module>
|
||||
<module name="SuppressionCommentFilter">
|
||||
<property name="offCommentFormat" value="BEGIN CHECKSTYLE-SUPPRESSION\: ALL"/>
|
||||
<property name="onCommentFormat" value="END CHECKSTYLE-SUPPRESSION\: ALL"/>
|
||||
</module>
|
||||
<module name="TreeWalker">
|
||||
<!-- Make suppression possible -->
|
||||
<module name="FileContentsHolder"/>
|
||||
<!-- Actual checks -->
|
||||
<module name="LineLength">
|
||||
<property name="max" value="120"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
<module name="JavadocMethod">
|
||||
<property name="scope" value="package"/><!-- We don't need javadoc for private methods -->
|
||||
<property name="tokens" value="METHOD_DEF"/><!-- We don't need javadoc for constructors -->
|
||||
</module>
|
||||
<module name="JavadocType"/>
|
||||
<module name="JavadocVariable">
|
||||
<property name="scope" value="package"/><!-- We don't need javadoc for private variables -->
|
||||
</module>
|
||||
<module name="JavadocStyle"/>
|
||||
<module name="WriteTag">
|
||||
<property name="tag" value="@author"/>
|
||||
<property name="tagFormat" value="\S"/>
|
||||
<property name="severity" value="ignore"/>
|
||||
<property name="tagSeverity" value="warning"/>
|
||||
</module>
|
||||
<module name="ConstantName"/>
|
||||
<module name="LocalVariableName"/>
|
||||
<module name="MemberName"/>
|
||||
<module name="MethodName"/>
|
||||
<module name="PackageName"/>
|
||||
<module name="ParameterName"/>
|
||||
<module name="StaticVariableName"/>
|
||||
<module name="TypeName"/>
|
||||
<module name="AvoidStarImport">
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
<module name="IllegalImport"/>
|
||||
<module name="RedundantImport"/>
|
||||
<module name="UnusedImports">
|
||||
<property name="processJavadoc" value="true"/>
|
||||
</module>
|
||||
<module name="MethodLength"/>
|
||||
<module name="ParameterNumber"/>
|
||||
<module name="EmptyForIteratorPad"/>
|
||||
<module name="MethodParamPad"/>
|
||||
<module name="NoWhitespaceAfter">
|
||||
<property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
|
||||
</module>
|
||||
<module name="NoWhitespaceBefore"/>
|
||||
<module name="OperatorWrap"/>
|
||||
<module name="ParenPad"/>
|
||||
<module name="TypecastParenPad"/>
|
||||
<module name="WhitespaceAfter">
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
<module name="WhitespaceAround">
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
<module name="ModifierOrder"/>
|
||||
<module name="RedundantModifier"/>
|
||||
<module name="AvoidNestedBlocks"/>
|
||||
<module name="EmptyBlock">
|
||||
<property name="tokens" value="LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_IF,LITERAL_FOR,LITERAL_TRY,LITERAL_WHILE,INSTANCE_INIT,STATIC_INIT"/>
|
||||
</module>
|
||||
<module name="LeftCurly"/>
|
||||
<module name="RightCurly"/>
|
||||
<module name="DoubleCheckedLocking"/>
|
||||
<module name="EmptyStatement"/>
|
||||
<module name="EqualsHashCode"/>
|
||||
<module name="HiddenField">
|
||||
<property name="tokens" value="VARIABLE_DEF"/><!-- We don't care if parameters hide fields. -->
|
||||
</module>
|
||||
<module name="IllegalInstantiation"/>
|
||||
<module name="InnerAssignment"/>
|
||||
<module name="MagicNumber">
|
||||
<property name="ignoreNumbers" value="-1, 0, 0.5, 1, 2, 3"/>
|
||||
</module>
|
||||
<module name="MissingSwitchDefault"/>
|
||||
<module name="RedundantThrows"/>
|
||||
<module name="SimplifyBooleanExpression"/>
|
||||
<module name="SimplifyBooleanReturn"/>
|
||||
<module name="DesignForExtension"/>
|
||||
<module name="FinalClass"/>
|
||||
<module name="HideUtilityClassConstructor"/>
|
||||
<module name="InterfaceIsType"/>
|
||||
<module name="VisibilityModifier">
|
||||
<property name="packageAllowed" value="true"/>
|
||||
<property name="protectedAllowed" value="true"/>
|
||||
</module>
|
||||
<module name="ArrayTypeStyle"/>
|
||||
<module name="FinalParameters"/>
|
||||
<module name="TodoComment">
|
||||
<property name="severity" value="info"/>
|
||||
</module>
|
||||
<module name="UpperEll"/>
|
||||
<module name="Indentation"/>
|
||||
<module name="MissingDeprecated"/>
|
||||
<module name="MissingOverride"/>
|
||||
|
||||
</module>
|
||||
</module>
|
||||
|
||||
-186
@@ -1,186 +0,0 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.mvplugin</groupId>
|
||||
<artifactId>MultiverseCore</artifactId>
|
||||
<version>3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>MultiverseCore-Base</artifactId>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>onarandombox</id>
|
||||
<url>http://repo.onarandombox.com/content/groups/public</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>doodleproject-repo</id>
|
||||
<name>DoodleProject Maven 2 Repository</name>
|
||||
<url>http://doodleproject.sourceforge.net/maven2/release</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<!-- Profiles are used to detect whether this is a local or Jenkins build
|
||||
and adjust the build number accordingly -->
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>jenkins</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>env.BUILD_NUMBER</name>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<project.build.number>${env.BUILD_NUMBER}</project.build.number>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean package</defaultGoal>
|
||||
<plugins>
|
||||
<!-- Compiler -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Jar Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.11</version>
|
||||
<configuration>
|
||||
<parallel>methods</parallel>
|
||||
<threadCount>10</threadCount>
|
||||
<excludes>
|
||||
<exclude>**/TestCommandSender.java</exclude>
|
||||
<exclude>**/TestInstanceCreator.java</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.surefire</groupId>
|
||||
<artifactId>surefire-junit47</artifactId>
|
||||
<version>2.11</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<configuration>
|
||||
<enableRulesSummary>true</enableRulesSummary>
|
||||
<configLocation>${project.basedir}/config/mv_checks.xml</configLocation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.1.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.8.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>javadoc-jar</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<!-- Start of PluginBase Dependency -->
|
||||
<dependency>
|
||||
<groupId>com.dumptruckman.minecraft</groupId>
|
||||
<artifactId>Plugin</artifactId>
|
||||
<version>1.5-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- End of PluginBase Dependency -->
|
||||
|
||||
<!-- Start of Test Dependencies -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-module-junit4</artifactId>
|
||||
<version>1.4.9</version>
|
||||
<type>jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-api-easymock</artifactId>
|
||||
<version>1.4.9</version>
|
||||
<type>jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-api-mockito</artifactId>
|
||||
<version>1.4.9</version>
|
||||
<type>jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
<version>3.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- End of Test Dependencies -->
|
||||
</dependencies>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>OnARandomBox</id>
|
||||
<url>http://repo.onarandombox.com/content/repositories/multiverse/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>OnARandomBox</id>
|
||||
<url>http://repo.onarandombox.com/content/repositories/multiverse-snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
@@ -1,329 +0,0 @@
|
||||
package com.mvplugin.core;
|
||||
|
||||
import com.mvplugin.core.api.MultiverseWorld;
|
||||
import com.mvplugin.core.api.WorldProperties;
|
||||
import com.mvplugin.core.api.WorldProperties.Spawning;
|
||||
import com.mvplugin.core.minecraft.Difficulty;
|
||||
import com.mvplugin.core.minecraft.GameMode;
|
||||
import com.mvplugin.core.minecraft.PlayerPosition;
|
||||
import com.mvplugin.core.minecraft.PortalType;
|
||||
import com.mvplugin.core.minecraft.WorldEnvironment;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
|
||||
abstract class AbstractMultiverseWorld implements MultiverseWorld, Observer {
|
||||
|
||||
private final WorldProperties worldProperties;
|
||||
|
||||
protected AbstractMultiverseWorld(final WorldProperties worldProperties) {
|
||||
this.worldProperties = worldProperties;
|
||||
worldProperties.addObserver(this);
|
||||
worldProperties.get(WorldProperties.SPAWNING).get(Spawning.ANIMALS).addObserver(this);
|
||||
worldProperties.get(WorldProperties.SPAWNING).get(Spawning.MONSTERS).addObserver(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void update(Observable o, Object arg) {
|
||||
update(arg);
|
||||
}
|
||||
|
||||
protected abstract void update(Object property);
|
||||
|
||||
@Override
|
||||
public WorldEnvironment getEnvironment() {
|
||||
return getProperties().get(WorldProperties.ENVIRONMENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnvironment(final WorldEnvironment environment) {
|
||||
getProperties().set(WorldProperties.ENVIRONMENT, environment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Difficulty getDifficulty() {
|
||||
return getProperties().get(WorldProperties.DIFFICULTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setDifficulty(final Difficulty difficulty) {
|
||||
// TODO Validate?
|
||||
return getProperties().set(WorldProperties.DIFFICULTY, difficulty);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSeed() {
|
||||
return getProperties().get(WorldProperties.SEED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSeed(long seed) {
|
||||
getProperties().set(WorldProperties.SEED, seed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGenerator() {
|
||||
return getProperties().get(WorldProperties.GENERATOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGenerator(final String generator) {
|
||||
getProperties().set(WorldProperties.GENERATOR, generator != null ? generator : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldProperties getProperties() {
|
||||
return worldProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAllPropertyNames() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlias() {
|
||||
return getProperties().get(WorldProperties.ALIAS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlias(final String alias) {
|
||||
getProperties().set(WorldProperties.ALIAS, alias != null ? alias : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAnimalsSpawn() {
|
||||
return getProperties().get(WorldProperties.SPAWNING)
|
||||
.get(WorldProperties.Spawning.ANIMALS)
|
||||
.get(WorldProperties.Spawning.Animals.SPAWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllowAnimalSpawn(final boolean allowAnimalSpawn) {
|
||||
getProperties().get(WorldProperties.SPAWNING)
|
||||
.get(WorldProperties.Spawning.ANIMALS)
|
||||
.set(WorldProperties.Spawning.Animals.SPAWN, allowAnimalSpawn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAnimalList() {
|
||||
return getProperties().get(WorldProperties.SPAWNING)
|
||||
.get(WorldProperties.Spawning.ANIMALS)
|
||||
.get(WorldProperties.Spawning.Animals.EXCEPTIONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMonstersSpawn() {
|
||||
return getProperties().get(WorldProperties.SPAWNING)
|
||||
.get(WorldProperties.Spawning.MONSTERS)
|
||||
.get(WorldProperties.Spawning.Monsters.SPAWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllowMonsterSpawn(final boolean allowMonsterSpawn) {
|
||||
getProperties().get(WorldProperties.SPAWNING)
|
||||
.get(WorldProperties.Spawning.MONSTERS)
|
||||
.set(WorldProperties.Spawning.Monsters.SPAWN, allowMonsterSpawn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getMonsterList() {
|
||||
return getProperties().get(WorldProperties.SPAWNING)
|
||||
.get(WorldProperties.Spawning.ANIMALS)
|
||||
.get(WorldProperties.Spawning.Monsters.EXCEPTIONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPVPEnabled() {
|
||||
return getProperties().get(WorldProperties.PVP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPVPMode(final boolean pvpMode) {
|
||||
getProperties().set(WorldProperties.PVP, pvpMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHidden() {
|
||||
return getProperties().get(WorldProperties.HIDDEN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHidden(final boolean hidden) {
|
||||
getProperties().set(WorldProperties.HIDDEN, hidden);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPrefixChat() {
|
||||
return getProperties().get(WorldProperties.PREFIX_CHAT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPrefixChat(final boolean prefixChat) {
|
||||
getProperties().set(WorldProperties.PREFIX_CHAT, prefixChat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWeatherEnabled() {
|
||||
return getProperties().get(WorldProperties.ALLOW_WEATHER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnableWeather(final boolean enableWeather) {
|
||||
getProperties().set(WorldProperties.ALLOW_WEATHER, enableWeather);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isKeepingSpawnInMemory() {
|
||||
return getProperties().get(WorldProperties.KEEP_SPAWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setKeepSpawnInMemory(final boolean keepSpawnInMemory) {
|
||||
getProperties().set(WorldProperties.KEEP_SPAWN, keepSpawnInMemory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayerPosition getSpawnLocation() {
|
||||
return getProperties().get(WorldProperties.SPAWN_LOCATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpawnLocation(final PlayerPosition spawnLocation) {
|
||||
getProperties().set(WorldProperties.SPAWN_LOCATION, spawnLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHunger() {
|
||||
return getProperties().get(WorldProperties.HUNGER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHunger(final boolean hungerEnabled) {
|
||||
getProperties().set(WorldProperties.HUNGER, hungerEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameMode getGameMode() {
|
||||
return getProperties().get(WorldProperties.GAME_MODE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setGameMode(final GameMode gameMode) {
|
||||
// Todo validate?
|
||||
return getProperties().set(WorldProperties.GAME_MODE, gameMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPrice() {
|
||||
return getProperties().get(WorldProperties.ENTRY_FEE).get(WorldProperties.EntryFee.AMOUNT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPrice(final double price) {
|
||||
getProperties().get(WorldProperties.ENTRY_FEE).set(WorldProperties.EntryFee.AMOUNT, price);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrency() {
|
||||
return getProperties().get(WorldProperties.ENTRY_FEE).get(WorldProperties.EntryFee.CURRENCY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrency(final int item) {
|
||||
getProperties().get(WorldProperties.ENTRY_FEE).set(WorldProperties.EntryFee.CURRENCY, item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRespawnToWorld() {
|
||||
return getProperties().get(WorldProperties.RESPAWN_WORLD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setRespawnToWorld(final String respawnWorld) {
|
||||
// TODO validation?
|
||||
return getProperties().set(WorldProperties.RESPAWN_WORLD, respawnWorld);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScaling() {
|
||||
return getProperties().get(WorldProperties.SCALE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setScaling(final double scaling) {
|
||||
// TODO validation?
|
||||
return getProperties().set(WorldProperties.SCALE, scaling);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getAutoHeal() {
|
||||
return getProperties().get(WorldProperties.AUTO_HEAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAutoHeal(final boolean heal) {
|
||||
getProperties().set(WorldProperties.AUTO_HEAL, heal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getAdjustSpawn() {
|
||||
return getProperties().get(WorldProperties.ADJUST_SPAWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAdjustSpawn(final boolean adjust) {
|
||||
getProperties().set(WorldProperties.ADJUST_SPAWN, adjust);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getAutoLoad() {
|
||||
return getProperties().get(WorldProperties.AUTO_LOAD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAutoLoad(final boolean autoLoad) {
|
||||
getProperties().set(WorldProperties.AUTO_LOAD, autoLoad);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBedRespawn() {
|
||||
return getProperties().get(WorldProperties.BED_RESPAWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBedRespawn(final boolean bedRespawn) {
|
||||
getProperties().set(WorldProperties.BED_RESPAWN, bedRespawn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerLimit(final int limit) {
|
||||
getProperties().set(WorldProperties.PLAYER_LIMIT, limit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerLimit() {
|
||||
return getProperties().get(WorldProperties.PLAYER_LIMIT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowPortalMaking(final PortalType type) {
|
||||
getProperties().set(WorldProperties.PORTAL_FORM, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortalType getAllowedPortals() {
|
||||
return getProperties().get(WorldProperties.PORTAL_FORM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWorldBlacklist() {
|
||||
return getProperties().get(WorldProperties.BLACK_LIST);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
getProperties().flush();
|
||||
}
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
package com.mvplugin.core;
|
||||
|
||||
import com.dumptruckman.minecraft.pluginbase.messaging.BundledMessage;
|
||||
import com.mvplugin.core.api.MultiverseCore;
|
||||
import com.mvplugin.core.api.MultiverseWorld;
|
||||
import com.mvplugin.core.api.WorldManager;
|
||||
import com.mvplugin.core.minecraft.WorldEnvironment;
|
||||
import com.mvplugin.core.minecraft.WorldType;
|
||||
import com.mvplugin.core.util.Language;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
abstract class AbstractWorldManager implements WorldManager {
|
||||
|
||||
protected final MultiverseCore core;
|
||||
protected final Map<String, MultiverseWorld> worldsMap;
|
||||
|
||||
protected AbstractWorldManager(final MultiverseCore core) {
|
||||
this.core = core;
|
||||
this.worldsMap = new HashMap<String, MultiverseWorld>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiverseWorld addWorld(String name, WorldEnvironment env, String seedString, WorldType type, Boolean generateStructures, String generator) throws WorldCreationException {
|
||||
return this.addWorld(name, env, seedString, type, generateStructures, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiverseWorld addWorld(String name,
|
||||
WorldEnvironment env,
|
||||
String seedString,
|
||||
WorldType type,
|
||||
Boolean generateStructures,
|
||||
String generator,
|
||||
boolean useSpawnAdjust) throws WorldCreationException {
|
||||
final WorldCreationSettings settings = new WorldCreationSettings(name);
|
||||
if (seedString != null && !seedString.isEmpty()) {
|
||||
try {
|
||||
settings.seed(Long.parseLong(seedString));
|
||||
} catch (NumberFormatException numberformatexception) {
|
||||
settings.seed((long) seedString.hashCode());
|
||||
}
|
||||
}
|
||||
|
||||
settings.type(type);
|
||||
settings.generateStructures(generateStructures);
|
||||
|
||||
// TODO: Use the fancy kind with the commandSender | dumptruckman has no idea what this means..
|
||||
if (generator != null && !generator.isEmpty()) {
|
||||
settings.generator(generator);
|
||||
}
|
||||
|
||||
settings.adjustSpawn(useSpawnAdjust);
|
||||
|
||||
return addWorld(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiverseWorld addWorld(WorldCreationSettings settings) throws WorldCreationException {
|
||||
if (this.worldsMap.containsKey(settings.name())) {
|
||||
throw new WorldCreationException(new BundledMessage(Language.WORLD_ALREADY_EXISTS, settings.name()));
|
||||
}
|
||||
MultiverseWorld mvWorld = createWorld(settings);
|
||||
mvWorld.setAdjustSpawn(settings.adjustSpawn());
|
||||
this.worldsMap.put(settings.name(), mvWorld);
|
||||
return mvWorld;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a world with the given properties.
|
||||
*
|
||||
* If a Minecraft world is already loaded with this name, null will be returned. If a Minecraft world already
|
||||
* exists but it not loaded, it will be loaded instead.
|
||||
*
|
||||
* @param name The name for the world. May not be null.
|
||||
* @param env The environment for the world. May not be null.
|
||||
* @param seed The seed for the world. Null means a random seed will be used if creating a new Minecraft world.
|
||||
* @param type The world type for the world. Null means the Minecraft default will be used if creating a new
|
||||
* Minecraft world or, if loading a world, the loaded world's type will be used.
|
||||
* @param generateStructures Whether or not to generate structures for the world. Null means the Minecraft default
|
||||
* will be used if creating a new world or, if loading a world, the loaded world's
|
||||
* setting will be used.
|
||||
* @param generator The name of the generator for the world. Null may be used to specify no generator.
|
||||
* @return A new {@link W} or null if a Minecraft world by this name is already loaded.
|
||||
* @throws WorldCreationException If any problems occured while trying to create the world.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a world with the given properties.
|
||||
*
|
||||
* If a Minecraft world is already loaded with this name, null will be returned. If a Minecraft world already
|
||||
* exists but it not loaded, it will be loaded instead.
|
||||
*
|
||||
* @param settings
|
||||
* @return
|
||||
* @throws WorldCreationException
|
||||
*/
|
||||
protected abstract MultiverseWorld createWorld(WorldCreationSettings settings) throws WorldCreationException;
|
||||
|
||||
@Override
|
||||
public boolean isMVWorld(final String name) {
|
||||
return this.worldsMap.containsKey(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<MultiverseWorld> getMVWorlds() {
|
||||
return Collections.unmodifiableCollection(this.worldsMap.values());
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.mvplugin.core;
|
||||
|
||||
import com.dumptruckman.minecraft.pluginbase.messaging.BundledMessage;
|
||||
import com.dumptruckman.minecraft.pluginbase.messaging.ChatColor;
|
||||
|
||||
public class MultiverseException extends Exception {
|
||||
|
||||
private final BundledMessage languageMessage;
|
||||
|
||||
|
||||
public MultiverseException(BundledMessage b) {
|
||||
super(String.format(ChatColor.translateAlternateColorCodes('&', b.getMessage().getDefault().get(0)), b.getArgs()));
|
||||
this.languageMessage = b;
|
||||
}
|
||||
|
||||
public MultiverseException(BundledMessage b, Throwable throwable) {
|
||||
super(String.format(ChatColor.translateAlternateColorCodes('&', b.getMessage().getDefault().get(0)), b.getArgs()), throwable);
|
||||
this.languageMessage = b;
|
||||
}
|
||||
|
||||
public BundledMessage getBundledMessage() {
|
||||
return this.languageMessage;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.mvplugin.core;
|
||||
|
||||
/**
|
||||
* Thrown when a world-property doesn't exist.
|
||||
*/
|
||||
public class UnknownPropertyException extends Exception {
|
||||
public UnknownPropertyException(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public UnknownPropertyException(String name, Throwable cause) {
|
||||
super(name, cause);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mvplugin.core;
|
||||
|
||||
import com.dumptruckman.minecraft.pluginbase.messaging.BundledMessage;
|
||||
|
||||
public class WorldCreationException extends MultiverseException {
|
||||
|
||||
public WorldCreationException(BundledMessage languageMessage) {
|
||||
super(languageMessage);
|
||||
}
|
||||
|
||||
public WorldCreationException(BundledMessage languageMessage, Throwable throwable) {
|
||||
super(languageMessage, throwable);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.mvplugin.core.api;
|
||||
|
||||
import com.dumptruckman.minecraft.pluginbase.config.BaseConfig;
|
||||
import com.dumptruckman.minecraft.pluginbase.properties.Properties;
|
||||
|
||||
/**
|
||||
* This is where you will find all of the configuration options for the Multiverse-Core plugin and potentially some
|
||||
* options used here and in other Multiverse plugins.
|
||||
*/
|
||||
public interface CoreConfig extends BaseConfig, Properties {
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.mvplugin.core.api;
|
||||
|
||||
import com.dumptruckman.minecraft.pluginbase.plugin.PluginBase;
|
||||
|
||||
/**
|
||||
* Multiverse 3 Core API
|
||||
* <p>
|
||||
* This API contains a bunch of useful things you can get out of Multiverse in general!
|
||||
* This is the class you should cast your plugin to unless you need more Implementation specific API.
|
||||
*/
|
||||
public interface MultiverseCore extends MultiversePlugin, PluginBase {
|
||||
|
||||
/**
|
||||
* Gets the Multiverse world manager.
|
||||
*
|
||||
* The world manager allows you to perform various tasks related to Minecraft worlds.
|
||||
*
|
||||
* @return {@link WorldManager}.
|
||||
*/
|
||||
WorldManager getWorldManager();
|
||||
|
||||
/**
|
||||
* Gets the Multiverse-Core configuration.
|
||||
*
|
||||
* @return The Multiverse-Core configuration.
|
||||
*/
|
||||
CoreConfig getMVConfig();
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.mvplugin.core.api;
|
||||
|
||||
/**
|
||||
* Implement this if you would
|
||||
*/
|
||||
public interface MultiversePlugin {
|
||||
|
||||
/**
|
||||
* Gets the reference to MultiverseCore.
|
||||
*
|
||||
* @return A valid {@link MultiverseCore}.
|
||||
*/
|
||||
MultiverseCore getCore();
|
||||
|
||||
/**
|
||||
* Sets the reference to MultiverseCore.
|
||||
*
|
||||
* @param core A valid {@link MultiverseCore}.
|
||||
*/
|
||||
void setCore(MultiverseCore core);
|
||||
|
||||
/**
|
||||
* Allows Multiverse or a plugin to query another Multiverse plugin to see what version its protocol is.
|
||||
*
|
||||
* This number should change when something will break the code. Generally your plugin should be checking the
|
||||
* Multiverse-Core's protocol version to ensure compatibility.
|
||||
*
|
||||
* @return The protocol version.
|
||||
*/
|
||||
int getProtocolVersion();
|
||||
}
|
||||
@@ -1,508 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.mvplugin.core.api;
|
||||
|
||||
import com.mvplugin.core.minecraft.Difficulty;
|
||||
import com.mvplugin.core.minecraft.GameMode;
|
||||
import com.mvplugin.core.minecraft.PlayerPosition;
|
||||
import com.mvplugin.core.minecraft.PortalType;
|
||||
import com.mvplugin.core.minecraft.WorldEnvironment;
|
||||
import com.mvplugin.core.minecraft.WorldType;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* The API for a Multiverse Handled World.
|
||||
*/
|
||||
public interface MultiverseWorld {
|
||||
|
||||
/**
|
||||
* Gets the name of this world. The name cannot be changed.
|
||||
* <p>
|
||||
* Note for plugin developers: Usually {@link #getAlias()}
|
||||
* is what you want to use instead of this method.
|
||||
*
|
||||
* @return The name of the world as a String.
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Gets the UUID for this world.
|
||||
*
|
||||
* This is what Minecraft uses to keep tracks of worlds.
|
||||
*
|
||||
* @return The UUID for this world.
|
||||
*/
|
||||
UUID getWorldUID();
|
||||
|
||||
/**
|
||||
* Returns the WorldProperties object that contains the backing for all the values of a Multiverse World.
|
||||
*
|
||||
* All of these properties are generally gettable and settable via the MultiverseWorld class. Specific uses for
|
||||
* the returned object may be to set properties in a different way and to perform more complex actions related
|
||||
* to properties.
|
||||
*
|
||||
* @return The properties for this world.
|
||||
*/
|
||||
WorldProperties getProperties();
|
||||
|
||||
/**
|
||||
* Gets the type of this world. As of 1.2 this will be:
|
||||
* FLAT, NORMAL or VERSION_1_1
|
||||
* <p>
|
||||
* This is <b>not</b> the generator.
|
||||
*
|
||||
* @return The Type of this world.
|
||||
*/
|
||||
WorldType getWorldType();
|
||||
|
||||
/**
|
||||
* Gets the environment of this world.
|
||||
*
|
||||
* This environment matches that of the actual game world.
|
||||
*
|
||||
* @return The environment of this world.
|
||||
*/
|
||||
WorldEnvironment getEnvironment();
|
||||
|
||||
/**
|
||||
* Sets the environment of a world.
|
||||
* <p>
|
||||
* Note: This will ONLY take effect once the world is unloaded/reloaded.
|
||||
*
|
||||
* @param environment The new environment for the world.
|
||||
*/
|
||||
void setEnvironment(WorldEnvironment environment);
|
||||
|
||||
/**
|
||||
* Gets the difficulty of this world.
|
||||
*
|
||||
* @return The difficulty of this world.
|
||||
*/
|
||||
Difficulty getDifficulty();
|
||||
|
||||
/**
|
||||
* Sets the difficulty of this world and returns {@code true} on success.
|
||||
* Valid string values are either an integer of difficulty(0-3) or
|
||||
* the name that resides in the Bukkit enum, ex. PEACEFUL
|
||||
*
|
||||
* @param difficulty The new difficulty.
|
||||
* @return True if success, false if the operation failed... for whatever reason.
|
||||
*/
|
||||
boolean setDifficulty(Difficulty difficulty);
|
||||
|
||||
/**
|
||||
* Gets the world seed of this world.
|
||||
*
|
||||
* @return The Long version of the seed.
|
||||
*/
|
||||
long getSeed();
|
||||
|
||||
/**
|
||||
* Sets the seed of this world.
|
||||
*
|
||||
* @param seed A Long that is the seed.
|
||||
*/
|
||||
void setSeed(long seed);
|
||||
|
||||
/**
|
||||
* Gets the generator of this world.
|
||||
*
|
||||
* @return The name of the generator.
|
||||
*/
|
||||
String getGenerator();
|
||||
|
||||
/**
|
||||
* Sets the generator of this world.
|
||||
*
|
||||
* @param generator The new generator's name.
|
||||
*/
|
||||
void setGenerator(String generator);
|
||||
|
||||
/**
|
||||
* Gets all the names of all properties that can be SET.
|
||||
*
|
||||
* @return All property names, with alternating colors.
|
||||
*/
|
||||
String getAllPropertyNames();
|
||||
|
||||
/**
|
||||
* Gets the alias of this world.
|
||||
* <p>
|
||||
* This alias allows users to have a world named "world" but show up in the list as "FernIsland"
|
||||
*
|
||||
* @return The alias of the world as a String.
|
||||
*/
|
||||
String getAlias();
|
||||
|
||||
/**
|
||||
* Sets the alias of the world.
|
||||
*
|
||||
* @param alias A string that is the new alias.
|
||||
*/
|
||||
void setAlias(String alias);
|
||||
|
||||
// animals&monster stuff
|
||||
/**
|
||||
* Gets whether or not animals are allowed to spawn in this world.
|
||||
*
|
||||
* @return True if ANY animal can, false if no animals can spawn.
|
||||
*/
|
||||
boolean canAnimalsSpawn();
|
||||
|
||||
/**
|
||||
* Sets whether or not animals can spawn.
|
||||
* If there are values in {@link #getAnimalList()} and this is false,
|
||||
* those animals become the exceptions, and will spawn
|
||||
*
|
||||
* @param allowAnimalSpawn True to allow spawning of monsters, false to prevent.
|
||||
*/
|
||||
void setAllowAnimalSpawn(boolean allowAnimalSpawn);
|
||||
|
||||
/**
|
||||
* Returns a list of animals. This list always negates the {@link #canAnimalsSpawn()} result.
|
||||
*
|
||||
* @return A list of animals that will spawn if {@link #canAnimalsSpawn()} is false.
|
||||
*/
|
||||
List<String> getAnimalList();
|
||||
|
||||
/**
|
||||
* Gets whether or not monsters are allowed to spawn in this world.
|
||||
*
|
||||
* @return True if ANY monster can, false if no monsters can spawn.
|
||||
*/
|
||||
boolean canMonstersSpawn();
|
||||
|
||||
/**
|
||||
* Sets whether or not monsters can spawn.
|
||||
* If there are values in {@link #getMonsterList()} and this is false,
|
||||
* those monsters become the exceptions, and will spawn
|
||||
*
|
||||
* @param allowMonsterSpawn True to allow spawning of monsters, false to prevent.
|
||||
*/
|
||||
void setAllowMonsterSpawn(boolean allowMonsterSpawn);
|
||||
|
||||
/**
|
||||
* Returns a list of monsters. This list always negates the {@link #canMonstersSpawn()} result.
|
||||
*
|
||||
* @return A list of monsters that will spawn if {@link #canMonstersSpawn()} is false.
|
||||
*/
|
||||
List<String> getMonsterList();
|
||||
// end of animal&monster stuff
|
||||
|
||||
/**
|
||||
* Gets whether or not PVP is enabled in this world in some form (fake or not).
|
||||
*
|
||||
* @return True if players can take damage from other players.
|
||||
*/
|
||||
boolean isPVPEnabled();
|
||||
|
||||
/**
|
||||
* Turn pvp on or off. This setting is used to set the world's PVP mode.
|
||||
*
|
||||
* @param pvpMode True to enable PVP damage, false to disable it.
|
||||
*/
|
||||
void setPVPMode(boolean pvpMode);
|
||||
|
||||
/**
|
||||
* Gets whether or not this world will display in mv who and mv list regardless if a user has the
|
||||
* access permissions to go to this world.
|
||||
*
|
||||
* @return True if the world will be hidden, false if not.
|
||||
* @see {@link #getPrefixChat()}
|
||||
*/
|
||||
boolean isHidden();
|
||||
|
||||
/**
|
||||
* Sets whether or not this world will display in mv who and mv list regardless if a user has the
|
||||
* access permissions to go to this world.
|
||||
*
|
||||
* @param hidden Set
|
||||
*/
|
||||
void setHidden(boolean hidden);
|
||||
|
||||
/**
|
||||
* Gets whether or not this world will display it's name/alias as a prefix in chat.
|
||||
*
|
||||
* If the global configuration setting for prefixChat is false, this setting has no effect.
|
||||
*
|
||||
* @return True if the world name/alias will be used as a prefix in chat, false if not.
|
||||
*/
|
||||
boolean getPrefixChat();
|
||||
|
||||
/**
|
||||
* Sets whether or not this world will display it's name/alias as a prefix in chat.
|
||||
*
|
||||
* If the global configuration setting for prefixChat is false, this setting has no effect.
|
||||
*
|
||||
* @param prefixChat True if the world name/alias will be used as a prefix in chat, false if not.
|
||||
*/
|
||||
void setPrefixChat(boolean prefixChat);
|
||||
|
||||
/**
|
||||
* Gets whether weather is enabled in this world.
|
||||
*
|
||||
* @return True if weather events will occur, false if not.
|
||||
*/
|
||||
boolean isWeatherEnabled();
|
||||
|
||||
/**
|
||||
* Sets whether or not there will be weather events in a given world.
|
||||
* If set to false, Multiverse will disable the weather in the world immediately.
|
||||
*
|
||||
* @param enableWeather True if weather events should occur in a world, false if not.
|
||||
*/
|
||||
void setEnableWeather(boolean enableWeather);
|
||||
|
||||
/**
|
||||
* Gets whether or not CraftBukkit is keeping the chunks for this world in memory.
|
||||
*
|
||||
* @return True if CraftBukkit is keeping spawn chunks in memory.
|
||||
*/
|
||||
boolean isKeepingSpawnInMemory();
|
||||
|
||||
/**
|
||||
* If true, tells Craftbukkit to keep a worlds spawn chunks loaded in memory (default: true)
|
||||
* If not, CraftBukkit will attempt to free memory when players have not used that world.
|
||||
* This will not happen immediately.
|
||||
*
|
||||
* @param keepSpawnInMemory If true, CraftBukkit will keep the spawn chunks loaded in memory.
|
||||
*/
|
||||
void setKeepSpawnInMemory(boolean keepSpawnInMemory);
|
||||
|
||||
/**
|
||||
* Gets the spawn location of this world.
|
||||
*
|
||||
* @return The spawn location of this world.
|
||||
*/
|
||||
PlayerPosition getSpawnLocation();
|
||||
|
||||
/**
|
||||
* Sets the spawn location for a world.
|
||||
*
|
||||
* @param spawnLocation The spawn location for a world.
|
||||
*/
|
||||
void setSpawnLocation(PlayerPosition spawnLocation);
|
||||
|
||||
/**
|
||||
* Gets whether or not the hunger level of players will go down in a world.
|
||||
*
|
||||
* @return True if it will go down, false if it will remain steady.
|
||||
*/
|
||||
boolean getHunger();
|
||||
|
||||
/**
|
||||
* Sets whether or not the hunger level of players will go down in a world.
|
||||
*
|
||||
* @param hungerEnabled True if hunger will go down, false to keep it at
|
||||
* the level they entered a world with.
|
||||
*/
|
||||
void setHunger(boolean hungerEnabled);
|
||||
|
||||
/**
|
||||
* Gets the GameMode of this world.
|
||||
*
|
||||
* @return The GameMode of this world.
|
||||
*/
|
||||
GameMode getGameMode();
|
||||
|
||||
/**
|
||||
* Sets the game mode of this world.
|
||||
*
|
||||
* @param gameMode The new {@link GameMode}.
|
||||
* @return True if the game mode was successfully changed, false if not.
|
||||
*/
|
||||
boolean setGameMode(GameMode gameMode);
|
||||
|
||||
/**
|
||||
* Gets the amount of currency it requires to enter this world.
|
||||
*
|
||||
* @return The amount it costs to enter this world.
|
||||
*/
|
||||
double getPrice();
|
||||
|
||||
/**
|
||||
* Sets the price for entry to this world.
|
||||
* You can think of this like an amount.
|
||||
* The type can be set with {@link #setCurrency(int)}
|
||||
*
|
||||
* @param price The Amount of money/item to enter the world.
|
||||
*/
|
||||
void setPrice(double price);
|
||||
|
||||
/**
|
||||
* Gets the Type of currency that will be used when users enter this world.
|
||||
*
|
||||
* @return The Type of currency that will be used when users enter this world.
|
||||
*/
|
||||
int getCurrency();
|
||||
|
||||
/**
|
||||
* Sets the type of item that will be required given the price is not 0.
|
||||
* Use -1 to use an AllPay economy, or any valid itemid
|
||||
*
|
||||
* @param item The Type of currency that will be used when users enter this world.
|
||||
*/
|
||||
void setCurrency(int item);
|
||||
|
||||
/**
|
||||
* Gets the world players will respawn in if they die in this one.
|
||||
*
|
||||
* @return A world that exists on the server.
|
||||
*/
|
||||
String getRespawnToWorld();
|
||||
|
||||
/**
|
||||
* Sets the world players will respawn in if they die in this one.
|
||||
* Returns true upon success, false upon failure.
|
||||
*
|
||||
* @param respawnWorld The name of a world that exists on the server.
|
||||
* @return True if respawnWorld existed, false if not.
|
||||
*/
|
||||
boolean setRespawnToWorld(String respawnWorld);
|
||||
|
||||
/**
|
||||
* Gets the scaling value of this world.Really only has an effect if you use
|
||||
* Multiverse-NetherPortals.
|
||||
*
|
||||
* @return This world's non-negative, non-zero scale.
|
||||
*/
|
||||
double getScaling();
|
||||
|
||||
/**
|
||||
* Sets the scale of this world. Really only has an effect if you use
|
||||
* Multiverse-NetherPortals.
|
||||
*
|
||||
* @param scaling A scaling value, cannot be negative or 0.
|
||||
* @return Whether the scale was set successfully.
|
||||
*/
|
||||
boolean setScaling(double scaling);
|
||||
|
||||
/**
|
||||
* Gets whether or not a world will auto-heal players if the difficulty is on peaceful.
|
||||
*
|
||||
* @return True if the world should heal (default), false if not.
|
||||
*/
|
||||
boolean getAutoHeal();
|
||||
|
||||
/**
|
||||
* Sets whether or not a world will auto-heal players if the difficulty is on peaceful.
|
||||
*
|
||||
* @param heal True if the world will heal.
|
||||
*/
|
||||
void setAutoHeal(boolean heal);
|
||||
|
||||
/**
|
||||
* Gets whether or not Multiverse should auto-adjust the spawn for this world.
|
||||
*
|
||||
* @return True if Multiverse should adjust the spawn, false if not.
|
||||
*/
|
||||
boolean getAdjustSpawn();
|
||||
|
||||
/**
|
||||
* Sets whether or not Multiverse should auto-adjust the spawn for this world.
|
||||
*
|
||||
* @param adjust True if multiverse should adjust the spawn, false if not.
|
||||
*/
|
||||
void setAdjustSpawn(boolean adjust);
|
||||
|
||||
/**
|
||||
* Gets whether or not Multiverse should auto-load this world.
|
||||
*
|
||||
* @return True if Multiverse should auto-load this world.
|
||||
*/
|
||||
boolean getAutoLoad();
|
||||
|
||||
/**
|
||||
* Sets whether or not Multiverse should auto-load this world.
|
||||
* <p>
|
||||
* True is default.
|
||||
*
|
||||
* @param autoLoad True if multiverse should autoload this world the spawn, false if not.
|
||||
*/
|
||||
void setAutoLoad(boolean autoLoad);
|
||||
|
||||
/**
|
||||
* Gets whether or not a player who dies in this world will respawn in their
|
||||
* bed or follow the normal respawn pattern.
|
||||
*
|
||||
* @return True if players dying in this world should respawn at their bed.
|
||||
*/
|
||||
boolean getBedRespawn();
|
||||
|
||||
/**
|
||||
* Sets whether or not a player who dies in this world will respawn in their
|
||||
* bed or follow the normal respawn pattern.
|
||||
* <p>
|
||||
* True is default.
|
||||
*
|
||||
* @param bedRespawn True if players dying in this world respawn at their bed.
|
||||
*/
|
||||
void setBedRespawn(boolean bedRespawn);
|
||||
|
||||
/**
|
||||
* Sets the player limit for this world after which players without an override
|
||||
* permission node will not be allowed in. A value of -1 or less signifies no limit
|
||||
*
|
||||
* @param limit The new limit
|
||||
*/
|
||||
void setPlayerLimit(int limit);
|
||||
|
||||
/**
|
||||
* Gets the player limit for this world after which players without an override
|
||||
* permission node will not be allowed in. A value of -1 or less signifies no limit
|
||||
*
|
||||
* @return The player limit
|
||||
*/
|
||||
int getPlayerLimit();
|
||||
|
||||
/**
|
||||
* Same as {@link #getTime()}, but returns a string.
|
||||
* @return The time as a short string: 12:34pm
|
||||
*/
|
||||
String getTime();
|
||||
|
||||
/**
|
||||
* Sets the current time in a world.
|
||||
* <p>
|
||||
* This method will take the following formats:
|
||||
* 11:37am
|
||||
* 4:30p
|
||||
* day(morning), night, noon, midnight
|
||||
*
|
||||
* @param timeAsString The formatted time to set the world to.
|
||||
* @return True if the time was set, false if not.
|
||||
*/
|
||||
boolean setTime(String timeAsString);
|
||||
|
||||
/**
|
||||
* Sets The types of portals that are allowed in this world.
|
||||
*
|
||||
* @param type The type of portals allowed in this world.
|
||||
*/
|
||||
void allowPortalMaking(PortalType type);
|
||||
|
||||
/**
|
||||
* Gets which type(s) of portals are allowed to be constructed in this world.
|
||||
*
|
||||
* @return The type of portals that are allowed.
|
||||
*/
|
||||
PortalType getAllowedPortals();
|
||||
|
||||
// properties that are not "getter+setter" style
|
||||
/**
|
||||
* Gets a list of all the worlds that players CANNOT travel to from this world,
|
||||
* regardless of their access permissions.
|
||||
*
|
||||
* @return A List of world names.
|
||||
*/
|
||||
List<String> getWorldBlacklist();
|
||||
|
||||
void save();
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.mvplugin.core.api;
|
||||
|
||||
import com.dumptruckman.minecraft.pluginbase.permission.Perm;
|
||||
import com.dumptruckman.minecraft.pluginbase.permission.PermFactory;
|
||||
|
||||
public interface Perms {
|
||||
|
||||
Perm ALL_MULTIVERSE = PermFactory.newPerm("multiverse.*").child(Perm.ALL).build();
|
||||
|
||||
Perm CMD_IMPORT = PermFactory.newPerm("cmd.import").commandPermission().build();
|
||||
}
|
||||
@@ -1,353 +0,0 @@
|
||||
package com.mvplugin.core.api;
|
||||
|
||||
import com.dumptruckman.minecraft.pluginbase.messaging.Message;
|
||||
import com.dumptruckman.minecraft.pluginbase.properties.PropertyValidator;
|
||||
import com.mvplugin.core.WorldCreationException;
|
||||
import com.mvplugin.core.minecraft.Generator;
|
||||
import com.mvplugin.core.minecraft.WorldEnvironment;
|
||||
import com.mvplugin.core.minecraft.WorldType;
|
||||
import com.mvplugin.core.util.PropertyDescriptions;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Multiverse 2 World Manager API
|
||||
* <p>
|
||||
* This API contains all of the world managing
|
||||
* functions that your heart desires!
|
||||
*/
|
||||
public interface WorldManager {
|
||||
|
||||
public class WorldCreationSettings {
|
||||
|
||||
private final String name;
|
||||
private WorldEnvironment env;
|
||||
private Long seed;
|
||||
private WorldType type;
|
||||
private Boolean generateStructures;
|
||||
private String generator;
|
||||
private boolean adjustSpawn = true;
|
||||
|
||||
public WorldCreationSettings(final String name) {
|
||||
if (name == null) {
|
||||
throw new IllegalArgumentException("name cannot be null!");
|
||||
}
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public WorldEnvironment env() {
|
||||
return env;
|
||||
}
|
||||
|
||||
public Long seed() {
|
||||
return seed;
|
||||
}
|
||||
|
||||
public WorldType type() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public Boolean generateStructures() {
|
||||
return generateStructures;
|
||||
}
|
||||
|
||||
public String generator() {
|
||||
return generator;
|
||||
}
|
||||
|
||||
public boolean adjustSpawn() {
|
||||
return adjustSpawn;
|
||||
}
|
||||
|
||||
public WorldCreationSettings env(WorldEnvironment e) {
|
||||
this.env = e;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WorldCreationSettings seed(Long l) {
|
||||
this.seed = l;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WorldCreationSettings type(WorldType t) {
|
||||
this.type = t;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WorldCreationSettings generateStructures(Boolean b) {
|
||||
this.generateStructures = b;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WorldCreationSettings generator(String g) {
|
||||
this.generator = g;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WorldCreationSettings adjustSpawn(boolean a) {
|
||||
this.adjustSpawn = a;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an existing WorldProperties object or creates a new one based on the name.
|
||||
*
|
||||
* TODO explain that they should use getWorld() in general.
|
||||
*
|
||||
* @param worldName The name of the world to get properties for.
|
||||
* @return The world properties for the given world name.
|
||||
* @throws IOException In case there are any issues accessing the persistence for the world properties.
|
||||
*/
|
||||
WorldProperties getWorldProperties(final String worldName) throws IOException;
|
||||
|
||||
/**
|
||||
* Add a new World to the Multiverse Setup.
|
||||
*
|
||||
* @param name World Name
|
||||
* @param env Environment Type
|
||||
* @param seedString The seed in the form of a string.
|
||||
* If the seed is a Long,
|
||||
* it will be interpreted as such.
|
||||
* @param type The Type of the world to be made.
|
||||
* @param generateStructures If true, this world will get NPC villages.
|
||||
* @param generator The Custom generator plugin to use.
|
||||
* @return The new world.
|
||||
* @throws WorldCreationException If world creation fails.
|
||||
*/
|
||||
MultiverseWorld addWorld(String name,
|
||||
WorldEnvironment env,
|
||||
String seedString,
|
||||
WorldType type,
|
||||
Boolean generateStructures,
|
||||
String generator) throws WorldCreationException;
|
||||
|
||||
/**
|
||||
* Add a new World to the Multiverse Setup.
|
||||
*
|
||||
* @param name World Name
|
||||
* @param env Environment Type
|
||||
* @param seedString The seed in the form of a string.
|
||||
* If the seed is a Long,
|
||||
* it will be interpreted as such.
|
||||
* @param type The Type of the world to be made.
|
||||
* @param generateStructures If true, this world will get NPC villages.
|
||||
* @param generator The Custom generator plugin to use.
|
||||
* @param useSpawnAdjust If true, multiverse will search for a safe spawn. If not, It will not modify the level.dat.
|
||||
* @return The new world.
|
||||
* @throws WorldCreationException If world creation fails.
|
||||
*/
|
||||
MultiverseWorld addWorld(String name,
|
||||
WorldEnvironment env,
|
||||
String seedString,
|
||||
WorldType type,
|
||||
Boolean generateStructures,
|
||||
String generator,
|
||||
boolean useSpawnAdjust) throws WorldCreationException;
|
||||
|
||||
/**
|
||||
* Adds a new World to the Multiverse Setup.
|
||||
* @param settings Settings for the world creation.
|
||||
* @return The new world.
|
||||
* @throws WorldCreationException If world creation fails.
|
||||
*/
|
||||
MultiverseWorld addWorld(WorldCreationSettings settings) throws WorldCreationException;
|
||||
|
||||
/**
|
||||
* Make a copy of a world.
|
||||
*
|
||||
* @param oldName Name of world to be copied
|
||||
* @param newName Name of world to be created
|
||||
* @param generator The Custom generator plugin to use.
|
||||
* @return True if the world is copied successfully, false if not.
|
||||
*/
|
||||
//TODO boolean cloneWorld(String oldName, String newName, String generator);
|
||||
|
||||
/**
|
||||
* Remove the world from the Multiverse list, from the
|
||||
* config and deletes the folder.
|
||||
*
|
||||
* @param name The name of the world to remove
|
||||
* @return True if success, false if failure.
|
||||
*/
|
||||
//TODO boolean deleteWorld(String name);
|
||||
|
||||
/**
|
||||
* Remove the world from the Multiverse list, from the
|
||||
* config if wanted, and deletes the folder.
|
||||
*
|
||||
* @param name The name of the world to remove
|
||||
* @param removeConfig If true(default), we'll remove the entries from the
|
||||
* config. If false, they'll stay and the world may come back.
|
||||
* @return True if success, false if failure.
|
||||
*/
|
||||
//TODO boolean deleteWorld(String name, boolean removeConfig);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name The name of the world to remove
|
||||
* @param removeFromConfig If true(default), we'll remove the entries from the
|
||||
* config. If false, they'll stay and the world may come back.
|
||||
* @param deleteWorldFolder If true the world folder will be completely deleted. If false
|
||||
* only the contents of the world folder will be deleted
|
||||
* @return True if success, false if failure.
|
||||
*/
|
||||
//TODO boolean deleteWorld(String name, boolean removeFromConfig, boolean deleteWorldFolder);
|
||||
|
||||
/**
|
||||
* Unload a world from Multiverse.
|
||||
*
|
||||
* @param name Name of the world to unload
|
||||
* @return True if the world was unloaded, false if not.
|
||||
*/
|
||||
//TODO boolean unloadWorld(String name);
|
||||
|
||||
/**
|
||||
* Loads the world. Only use this if the world has been
|
||||
* unloaded with {@link #unloadWorld(String)}.
|
||||
*
|
||||
* @param name The name of the world to load
|
||||
* @return True if success, false if failure.
|
||||
*/
|
||||
//TODO boolean loadWorld(String name);
|
||||
|
||||
/**
|
||||
* Removes all players from the specified world.
|
||||
*
|
||||
* @param name World to remove players from.
|
||||
*/
|
||||
//TODO void removePlayersFromWorld(String name);
|
||||
|
||||
/**
|
||||
* Test if a given chunk generator is valid.
|
||||
*
|
||||
* @param generator The generator name.
|
||||
* @param generatorID The generator id.
|
||||
* @param worldName The worldName to use as the default.
|
||||
* @return A {@link Generator} or null
|
||||
*/
|
||||
//TODO Generator getChunkGenerator(String generator, String generatorID, String worldName);
|
||||
|
||||
/**
|
||||
* Returns a list of all the worlds Multiverse knows about.
|
||||
*
|
||||
* @return A list of {@link MultiverseWorld}.
|
||||
*/
|
||||
Collection<MultiverseWorld> getMVWorlds();
|
||||
|
||||
|
||||
/**
|
||||
* Returns a {@link MultiverseWorld} if it exists, and null if it does not.
|
||||
* This will search name AND alias.
|
||||
*
|
||||
* @param name The name or alias of the world to get.
|
||||
* @return A {@link MultiverseWorld} or null.
|
||||
*/
|
||||
//TODO W getMVWorld(String name);
|
||||
|
||||
/**
|
||||
* Checks to see if the given name is a valid {@link MultiverseWorld}.
|
||||
*
|
||||
* @param name The name or alias of the world to check.
|
||||
* @return True if the world exists, false if not.
|
||||
*/
|
||||
boolean isMVWorld(String name);
|
||||
|
||||
/**
|
||||
* Load the Worlds & Settings from the configuration file.
|
||||
*
|
||||
* @param forceLoad If set to true, this will perform a total
|
||||
* reset and not just load new worlds.
|
||||
*/
|
||||
//TODO void loadWorlds(boolean forceLoad);
|
||||
|
||||
/**
|
||||
* Loads the Worlds & Settings for any worlds that bukkit loaded before us.
|
||||
* <p>
|
||||
* This way people will _always_ have some worlds in the list.
|
||||
*/
|
||||
//TODO void loadDefaultWorlds();
|
||||
|
||||
//TODO WorldPurger getWorldPurger();
|
||||
|
||||
/**
|
||||
* Gets the world players will spawn in on first join.
|
||||
* Currently this always returns worlds.get(0) from Bukkit.
|
||||
*
|
||||
* @return A Multiverse world that players will spawn in or null if no MV world has been set.
|
||||
*/
|
||||
//TODO MultiverseWorld getSpawnWorld();
|
||||
|
||||
/**
|
||||
* Gets the list of worlds in the config, but unloaded.
|
||||
*
|
||||
* @return A List of worlds as strings.
|
||||
*/
|
||||
List<String> getUnloadedWorlds();
|
||||
|
||||
/**
|
||||
* Saves the world config to disk.
|
||||
*
|
||||
* @return True if success, false if fail.
|
||||
*/
|
||||
//TODO boolean saveWorldsConfig();
|
||||
|
||||
/**
|
||||
* Remove the world from the Multiverse list and from the config.
|
||||
*
|
||||
* @param name The name of the world to remove
|
||||
* @return True if success, false if failure.
|
||||
*/
|
||||
//TODO boolean removeWorldFromConfig(String name);
|
||||
|
||||
/**
|
||||
* Sets the initial spawn world for new players.
|
||||
*
|
||||
* @param world The World new players should spawn in.
|
||||
*/
|
||||
//TODO void setFirstSpawnWorld(String world);
|
||||
|
||||
/**
|
||||
* Gets the world players should spawn in first.
|
||||
*
|
||||
* @return The {@link MultiverseWorld} new players should spawn in.
|
||||
*/
|
||||
//TODO MultiverseWorld getFirstSpawnWorld();
|
||||
|
||||
/**
|
||||
* Regenerates a world.
|
||||
*
|
||||
* @param name Name of the world to regenerate
|
||||
* @param useNewSeed If a new seed should be used
|
||||
* @param randomSeed IF the new seed should be random
|
||||
* @param seed The seed of the world.
|
||||
*
|
||||
* @return True if success, false if fail.
|
||||
*/
|
||||
//TODO boolean regenWorld(String name, boolean useNewSeed, boolean randomSeed, String seed);
|
||||
|
||||
class RespawnWorldValidator implements PropertyValidator<String> {
|
||||
|
||||
private final WorldManager worldManager;
|
||||
|
||||
public RespawnWorldValidator(WorldManager worldManager) {
|
||||
this.worldManager = worldManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(String s) {
|
||||
return worldManager.isMVWorld(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message getInvalidMessage() {
|
||||
return PropertyDescriptions.INVALID_RESPAWN_WORLD;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,226 +0,0 @@
|
||||
package com.mvplugin.core.api;
|
||||
|
||||
import com.dumptruckman.minecraft.pluginbase.messaging.Message;
|
||||
import com.dumptruckman.minecraft.pluginbase.properties.ListProperty;
|
||||
import com.dumptruckman.minecraft.pluginbase.properties.NestedProperties;
|
||||
import com.dumptruckman.minecraft.pluginbase.properties.NestedProperty;
|
||||
import com.dumptruckman.minecraft.pluginbase.properties.Properties;
|
||||
import com.dumptruckman.minecraft.pluginbase.properties.PropertyFactory;
|
||||
import com.dumptruckman.minecraft.pluginbase.properties.PropertyValidator;
|
||||
import com.dumptruckman.minecraft.pluginbase.properties.SimpleProperty;
|
||||
import com.mvplugin.core.minecraft.Difficulty;
|
||||
import com.mvplugin.core.minecraft.GameMode;
|
||||
import com.mvplugin.core.minecraft.PlayerPosition;
|
||||
import com.mvplugin.core.minecraft.PortalType;
|
||||
import com.mvplugin.core.minecraft.WorldEnvironment;
|
||||
import com.mvplugin.core.util.PropertyDescriptions;
|
||||
|
||||
/**
|
||||
* Houses all of the properties for a Multiverse world.
|
||||
*/
|
||||
public interface WorldProperties extends Properties {
|
||||
|
||||
SimpleProperty<String> ALIAS = PropertyFactory.newProperty(String.class, "alias", "")
|
||||
.comment("World aliases allow you to name a world differently than what the folder name is.")
|
||||
.comment("This lets you choose fancy names for your worlds while keeping the folders nice and neat.")
|
||||
.comment("You may add minecraft color and formatting codes here prepended with a &")
|
||||
.description(PropertyDescriptions.ALIAS)
|
||||
.build();
|
||||
|
||||
SimpleProperty<Boolean> HIDDEN = PropertyFactory.newProperty(Boolean.class, "hidden", false)
|
||||
.comment("The hidden property allows you to have a world that exists but does not show up in lists.")
|
||||
.description(PropertyDescriptions.HIDDEN)
|
||||
.build();
|
||||
|
||||
SimpleProperty<Boolean> PREFIX_CHAT = PropertyFactory.newProperty(Boolean.class, "prefixChat", true)
|
||||
.comment("The prefixChat property adds the world's name (or alias) as a prefix to chat messages.")
|
||||
.comment("Please note, this property can be disabled globally in the configuration.")
|
||||
.description(PropertyDescriptions.PREFIX_CHAT)
|
||||
.build();
|
||||
|
||||
SimpleProperty<Long> SEED = PropertyFactory.newProperty(Long.class, "seed", 0L)
|
||||
.comment("The seed property allows you to change the world's seed.")
|
||||
.description(PropertyDescriptions.SEED)
|
||||
.build();
|
||||
|
||||
SimpleProperty<String> GENERATOR = PropertyFactory.newProperty(String.class, "generator", "")
|
||||
.comment("The generator property allows you to specify the generator used to generate this world.")
|
||||
.description(PropertyDescriptions.GENERATOR)
|
||||
.build();
|
||||
|
||||
SimpleProperty<WorldEnvironment> ENVIRONMENT = PropertyFactory.newProperty(WorldEnvironment.class, "environment", WorldEnvironment.NORMAL)
|
||||
.comment("The environment property the Minecraft world environment such as NORMAL, NETHER, THE_END")
|
||||
.description(PropertyDescriptions.ENVIRONMENT)
|
||||
.build();
|
||||
|
||||
SimpleProperty<Integer> PLAYER_LIMIT = PropertyFactory.newProperty(Integer.class, "playerLimit", -1)
|
||||
.comment("The player limit property limits the number of players in a world at a time.")
|
||||
.comment("A value of -1 or lower signifies no player limit.")
|
||||
.description(PropertyDescriptions.PLAYER_LIMIT)
|
||||
.build();
|
||||
|
||||
SimpleProperty<Boolean> ADJUST_SPAWN = PropertyFactory.newProperty(Boolean.class, "adjustSpawn", true)
|
||||
.comment("The adjust spawn property determines whether or not Multiverse will make adjustments to the world's spawn location if it is unsafe.")
|
||||
.description(PropertyDescriptions.ADJUST_SPAWN)
|
||||
.build();
|
||||
|
||||
|
||||
SimpleProperty<Boolean> AUTO_LOAD = PropertyFactory.newProperty(Boolean.class, "autoLoad", true)
|
||||
.comment("The autoLoad dictates whether this world is loaded automatically on startup or not.")
|
||||
.description(PropertyDescriptions.AUTO_LOAD)
|
||||
.build();
|
||||
|
||||
SimpleProperty<Boolean> BED_RESPAWN = PropertyFactory.newProperty(Boolean.class, "bedRespawn", true)
|
||||
.comment("The bedRespawn property specifies if a player dying in this world should respawn in their bed or not.")
|
||||
.description(PropertyDescriptions.BED_RESPAWN)
|
||||
.build();
|
||||
|
||||
SimpleProperty<Boolean> HUNGER = PropertyFactory.newProperty(Boolean.class, "hunger", true)
|
||||
.comment("The hunger property specifies if hunger is depleted in this world")
|
||||
.description(PropertyDescriptions.HUNGER)
|
||||
.build();
|
||||
|
||||
ListProperty<String> BLACK_LIST = PropertyFactory.newListProperty(String.class, "worldBlacklist")
|
||||
.comment("The worldBlackList property allows you to specify worlds that people cannot go to from this specified world.")
|
||||
.description(PropertyDescriptions.BLACK_LIST)
|
||||
.build();
|
||||
|
||||
SimpleProperty<Boolean> PVP = PropertyFactory.newProperty(Boolean.class, "pvp", true)
|
||||
.comment("The pvp property states whether or not players may harm each other in this world. If set to true, they may.")
|
||||
.comment("Bear in mind, many other plugins may have conflicts with this setting.")
|
||||
.description(PropertyDescriptions.PVP)
|
||||
.build();
|
||||
|
||||
SimpleProperty<Double> SCALE = PropertyFactory.newProperty(Double.class, "scale", 1D)
|
||||
.comment("The scale property represents the scaling of worlds when using Multiverse-NetherPortals.")
|
||||
.comment("Setting this value will have no effect on anything but Multiverse-NetherPortals.")
|
||||
.description(PropertyDescriptions.SCALE)
|
||||
.validator(new ScaleValidator())
|
||||
.build();
|
||||
|
||||
class ScaleValidator implements PropertyValidator<Double> {
|
||||
@Override
|
||||
public boolean isValid(Double scale) {
|
||||
return scale > 0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message getInvalidMessage() {
|
||||
return PropertyDescriptions.INVALID_SCALE;
|
||||
}
|
||||
}
|
||||
|
||||
SimpleProperty<String> RESPAWN_WORLD = PropertyFactory.newProperty(String.class, "respawnWorld", "")
|
||||
.comment("The respawnWorld property is the world you will respawn to if you die in this world.")
|
||||
.comment("This value can be the same as this world.")
|
||||
.description(PropertyDescriptions.RESPAWN_WORLD)
|
||||
.build();
|
||||
|
||||
SimpleProperty<Boolean> ALLOW_WEATHER = PropertyFactory.newProperty(Boolean.class, "allowWeather", true)
|
||||
.comment("The allowWeather property specifies whether or not to allow weather events in this world.")
|
||||
.description(PropertyDescriptions.ALLOW_WEATHER)
|
||||
.build();
|
||||
|
||||
SimpleProperty<Difficulty> DIFFICULTY = PropertyFactory.newProperty(Difficulty.class, "difficulty", Difficulty.EASY)
|
||||
.comment("The difficulty property allows you to set the difficulty for the world.")
|
||||
.comment("World difficulty affects spawn rates, hunger rates, and other things that make the game more or less difficult.")
|
||||
.description(PropertyDescriptions.DIFFICULTY)
|
||||
.build();
|
||||
|
||||
SimpleProperty<Boolean> AUTO_HEAL = PropertyFactory.newProperty(Boolean.class, "autoHeal", true)
|
||||
.comment("The autoHeal property will specify whether ot not players will regain health in PEACEFUL difficulty only.")
|
||||
.comment("This setting has no effect on worlds with a difficulty greater than peaceful or 0.")
|
||||
.description(PropertyDescriptions.AUTO_HEAL)
|
||||
.build();
|
||||
|
||||
SimpleProperty<PortalType> PORTAL_FORM = PropertyFactory.newProperty(PortalType.class, "portalForm", PortalType.ALL)
|
||||
.comment("The portalFrom property allows you to specify which type of portals are allowed to be created in this world.")
|
||||
.description(PropertyDescriptions.PORTAL_FORM)
|
||||
.build();
|
||||
|
||||
SimpleProperty<GameMode> GAME_MODE = PropertyFactory.newProperty(GameMode.class, "gameMode", GameMode.SURVIVAL)
|
||||
.comment("The gameMode property allows you to specify the GameMode for this world.")
|
||||
.comment("Players entering this world will automatically be switched to this GameMode unless they are exempted.")
|
||||
.description(PropertyDescriptions.GAME_MODE)
|
||||
.build();
|
||||
|
||||
SimpleProperty<Boolean> KEEP_SPAWN = PropertyFactory.newProperty(Boolean.class, "keepSpawnInMemory", true)
|
||||
.comment("The keepSpawnInMemory property specifies whether or not to keep the spawn chunks loaded in memory when players aren't in the spawn area.")
|
||||
.comment("Setting this to false will potentially save you some memory.")
|
||||
.description(PropertyDescriptions.KEEP_SPAWN)
|
||||
.build();
|
||||
|
||||
SimpleProperty<PlayerPosition> SPAWN_LOCATION = PropertyFactory.newProperty(PlayerPosition.class, "spawnLocation", PlayerPosition.NULL_LOCATION)
|
||||
.comment("The spawnLocation property specifies where in the world players will spawn.")
|
||||
.comment("The world specified here has no effect.")
|
||||
.description(PropertyDescriptions.SPAWN_LOCATION)
|
||||
.build();
|
||||
|
||||
NestedProperty<EntryFee> ENTRY_FEE = PropertyFactory.newNestedProperty(EntryFee.class, "entryFee")
|
||||
.build();
|
||||
|
||||
public static interface EntryFee extends NestedProperties {
|
||||
|
||||
SimpleProperty<Double> AMOUNT = PropertyFactory.newProperty(Double.class, "amount", 0D)
|
||||
.comment("The amount property specifies how much a player has to pay to enter this world.")
|
||||
.comment("What the player has to pay is specified by the 'currency' property")
|
||||
.description(PropertyDescriptions.AMOUNT)
|
||||
.build();
|
||||
|
||||
SimpleProperty<Integer> CURRENCY = PropertyFactory.newProperty(Integer.class, "currency", -1)
|
||||
.comment("The currency property specifies what type of currency the player must pay (if any) to enter this world.")
|
||||
.comment("Currency can be an economy money by specifying -1 or a block type by specifying the block id.")
|
||||
.description(PropertyDescriptions.CURRENCY)
|
||||
.build();
|
||||
}
|
||||
|
||||
NestedProperty<Spawning> SPAWNING = PropertyFactory.newNestedProperty(Spawning.class, "spawning")
|
||||
.build();
|
||||
|
||||
public static interface Spawning extends NestedProperties {
|
||||
|
||||
NestedProperty<Animals> ANIMALS = PropertyFactory.newNestedProperty(Animals.class, "animals")
|
||||
.build();
|
||||
|
||||
NestedProperty<Monsters> MONSTERS = PropertyFactory.newNestedProperty(Monsters.class, "monsters")
|
||||
.build();
|
||||
|
||||
public static interface Animals extends NestedProperties {
|
||||
|
||||
SimpleProperty<Boolean> SPAWN = PropertyFactory.newProperty(Boolean.class, "spawn", true)
|
||||
.comment("The animals spawn property specifies whether or not to spawn animals in this world.")
|
||||
.description(PropertyDescriptions.ANIMALS_SPAWN)
|
||||
.build();
|
||||
|
||||
SimpleProperty<Integer> SPAWN_RATE = PropertyFactory.newProperty(Integer.class, "spawnRate", -1)
|
||||
.comment("The animals spawnRate property defines how many ticks in between attempting to spawn animals.")
|
||||
.comment("A value of -1 indicates the default should be used and is recommended unless you know what you are doing.")
|
||||
.description(PropertyDescriptions.ANIMALS_SPAWN_RATE)
|
||||
.build();
|
||||
|
||||
ListProperty<String> EXCEPTIONS = PropertyFactory.newListProperty(String.class, "exceptions")
|
||||
.comment("The animals exceptions property defines what animals are exempt from the animals spawn property.")
|
||||
.description(PropertyDescriptions.ANIMALS_SPAWN_EXCEPTIONS)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static interface Monsters extends NestedProperties {
|
||||
|
||||
SimpleProperty<Boolean> SPAWN = PropertyFactory.newProperty(Boolean.class, "spawn", true)
|
||||
.comment("The monsters spawn property specifies whether or not to spawn monsters in this world.")
|
||||
.description(PropertyDescriptions.MONSTERS_SPAWN)
|
||||
.build();
|
||||
|
||||
SimpleProperty<Integer> SPAWN_RATE = PropertyFactory.newProperty(Integer.class, "spawnRate", -1)
|
||||
.comment("The monsters spawnRate property defines how many ticks in between attempting to spawn monsters.")
|
||||
.comment("A value of -1 indicates the default should be used and is recommended unless you know what you are doing.")
|
||||
.description(PropertyDescriptions.MONSTERS_SPAWN_RATE)
|
||||
.build();
|
||||
|
||||
ListProperty<String> EXCEPTIONS = PropertyFactory.newListProperty(String.class, "exceptions")
|
||||
.comment("The monsters exceptions property defines what monsters are exempt from the monsters spawn property.")
|
||||
.description(PropertyDescriptions.MONSTERS_SPAWN_EXCEPTIONS)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package com.mvplugin.core.api;
|
||||
|
||||
import com.dumptruckman.minecraft.pluginbase.entity.BasePlayer;
|
||||
import com.mvplugin.core.minecraft.Entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Used to remove animals from worlds that don't belong there.
|
||||
*/
|
||||
public interface WorldPurger {
|
||||
/**
|
||||
* Synchronizes the given worlds with their settings.
|
||||
*
|
||||
* @param worlds A list of {@link com.mvplugin.core.api.MultiverseWorld}
|
||||
*/
|
||||
void purgeWorlds(List<MultiverseWorld> worlds);
|
||||
|
||||
void purgeWorld(MultiverseWorld world);
|
||||
|
||||
/**
|
||||
* Clear all animals/monsters that do not belong to a world according to the config.
|
||||
*
|
||||
* @param mvworld The {@link MultiverseWorld}.
|
||||
* @param thingsToKill A {@link java.util.List} of animals/monsters to be killed.
|
||||
* @param negateAnimals Whether the monsters in the list should be negated.
|
||||
* @param negateMonsters Whether the animals in the list should be negated.
|
||||
*/
|
||||
void purgeWorld(MultiverseWorld mvworld, List<String> thingsToKill, boolean negateAnimals,
|
||||
boolean negateMonsters);
|
||||
|
||||
/**
|
||||
* Clear all animals/monsters that do not belong to a world according to the config.
|
||||
*
|
||||
* @param mvworld The {@link MultiverseWorld}.
|
||||
* @param thingsToKill A {@link java.util.List} of animals/monsters to be killed.
|
||||
* @param negateAnimals Whether the monsters in the list should be negated.
|
||||
* @param negateMonsters Whether the animals in the list should be negated.
|
||||
* @param sender The {@link BasePlayer} that initiated the action. He will/should be notified.
|
||||
*/
|
||||
void purgeWorld(MultiverseWorld mvworld, List<String> thingsToKill, boolean negateAnimals,
|
||||
boolean negateMonsters, BasePlayer sender);
|
||||
|
||||
/**
|
||||
* Determines whether the specified creature should be killed.
|
||||
*
|
||||
* @param e The creature.
|
||||
* @param thingsToKill A {@link java.util.List} of animals/monsters to be killed.
|
||||
* @param negateAnimals Whether the monsters in the list should be negated.
|
||||
* @param negateMonsters Whether the animals in the list should be negated.
|
||||
* @return {@code true} if the creature should be killed, otherwise {@code false}.
|
||||
*/
|
||||
boolean shouldWeKillThisCreature(Entity e, List<String> thingsToKill, boolean negateAnimals, boolean negateMonsters);
|
||||
|
||||
/**
|
||||
* Determines whether the specified creature should be killed and automatically reads the params from a world object.
|
||||
*
|
||||
* @param w The world.
|
||||
* @param e The creature.
|
||||
* @return {@code true} if the creature should be killed, otherwise {@code false}.
|
||||
*/
|
||||
boolean shouldWeKillThisCreature(MultiverseWorld w, Entity e);
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
/**
|
||||
* The Multiverse-API, containing lots of interfaces that can be quite useful for other
|
||||
* plugins when interacting with Multiverse.
|
||||
*/
|
||||
package com.mvplugin.core.api;
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.mvplugin.core.command;
|
||||
|
||||
class CommandHelp {
|
||||
|
||||
static void init() { }
|
||||
|
||||
|
||||
}
|
||||
@@ -1,188 +0,0 @@
|
||||
package com.mvplugin.core.command;
|
||||
|
||||
import com.dumptruckman.minecraft.pluginbase.entity.BasePlayer;
|
||||
import com.dumptruckman.minecraft.pluginbase.messaging.ChatColor;
|
||||
import com.dumptruckman.minecraft.pluginbase.messaging.Message;
|
||||
import com.dumptruckman.minecraft.pluginbase.permission.Perm;
|
||||
import com.dumptruckman.minecraft.pluginbase.plugin.command.CommandInfo;
|
||||
import com.mvplugin.core.WorldCreationException;
|
||||
import com.mvplugin.core.api.MultiverseCore;
|
||||
import com.mvplugin.core.api.MultiverseWorld;
|
||||
import com.mvplugin.core.api.Perms;
|
||||
import com.mvplugin.core.minecraft.WorldEnvironment;
|
||||
import com.mvplugin.core.util.Language;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@CommandInfo(
|
||||
primaryAlias = "import",
|
||||
desc = "Import a world.",
|
||||
usage = "{NAME} {ENVIRONMENT}",
|
||||
prefixedAliases = "im",
|
||||
directlyPrefixedAliases = "import",
|
||||
flags = "g:n",
|
||||
min = 1,
|
||||
max = 2
|
||||
)
|
||||
public class ImportCommand extends MultiverseCommand {
|
||||
|
||||
public static final Message IMPORT_HELP = new Message("command.import.help",
|
||||
"Imports a world into the server from a folder with the given name.",
|
||||
"The folder must exist in the location where worlds are normally located and must contain Minecraft world data.",
|
||||
"You must specify a world environment such as NORMAL or NETHER.",
|
||||
"You may also specify a generator to use along with an optional generator ID.",
|
||||
"The generator name is case sensitive!",
|
||||
"Flags:",
|
||||
" -g {GENERATOR[:ID]} Specify a generator.",
|
||||
" -n Do not adjust spawn",
|
||||
"Examples:",
|
||||
" /mv import &6gargamel&a normal",
|
||||
" /mv import &6hell_world&a nether",
|
||||
" /mv import &6Cleanroom&a normal -g &3CleanroomGenerator");
|
||||
|
||||
public static final Message POTENTIAL_WORLD_LIST = new Message("command.import.potential_world_list",
|
||||
"&b====[ These look like worlds ]====", "%s");
|
||||
|
||||
public static final Message NO_POTENTIAL_WORLDS = new Message("command.import.no_potential_worlds",
|
||||
"&cNo potential worlds found. Sorry!");
|
||||
|
||||
public static final Message INVALID_ENVIRONMENT = new Message("command.import.invalid_environment",
|
||||
"&cThat is not a valid environment.");
|
||||
|
||||
public static final Message STARTING_IMPORT = new Message("command.import.starting_import",
|
||||
"Starting import of world '%s'...");
|
||||
|
||||
public static final Message IMPORT_COMPLETE = new Message("command.import.import_complete",
|
||||
"&aImport complete!");
|
||||
|
||||
public static final Message IMPORT_FAILED = new Message("command.import.import_failed",
|
||||
"&cImport failed!");
|
||||
|
||||
@Override
|
||||
public Perm getPerm() {
|
||||
return Perms.CMD_IMPORT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message getHelp() {
|
||||
return IMPORT_HELP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean runCommand(MultiverseCore core, BasePlayer sender, CommandContext context) {
|
||||
final String worldName = context.getString(0);
|
||||
|
||||
if (worldName.toLowerCase().equals("--list") || worldName.toLowerCase().equals("-l")) {
|
||||
final String worldList = this.getPotentialWorlds(core);
|
||||
if (worldList.length() > 2) {
|
||||
core.getMessager().message(sender, POTENTIAL_WORLD_LIST, worldList);
|
||||
} else {
|
||||
core.getMessager().message(sender, NO_POTENTIAL_WORLDS);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// Since we made an exception for the list, we have to make sure they have at least 2 params:
|
||||
// Note the exception is --list, which is covered above.
|
||||
if (context.argsLength() == 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make sure we don't already know about this world.
|
||||
if (core.getWorldManager().isMVWorld(worldName)) {
|
||||
core.getMessager().message(sender, Language.WORLD_ALREADY_EXISTS, worldName);
|
||||
return true;
|
||||
}
|
||||
|
||||
File worldFile = new File(core.getServerInterface().getWorldContainer(), worldName);
|
||||
|
||||
String generator = context.getFlag('g');
|
||||
boolean useSpawnAdjust = !context.hasFlag('n');
|
||||
|
||||
String env = context.getString(1);
|
||||
WorldEnvironment environment = WorldEnvironment.getFromString(env);
|
||||
if (environment == null) {
|
||||
core.getMessager().message(sender, INVALID_ENVIRONMENT);
|
||||
// TODO EnvironmentCommand.showEnvironments(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (worldFile.exists() && env != null) {
|
||||
core.getMessager().messageAndLog(sender, STARTING_IMPORT, worldName);
|
||||
try {
|
||||
core.getWorldManager().addWorld(worldName, environment, null, null, null, generator, useSpawnAdjust);
|
||||
core.getMessager().messageAndLog(sender, IMPORT_COMPLETE);
|
||||
} catch (WorldCreationException e) {
|
||||
core.getMessager().messageAndLog(sender, IMPORT_FAILED);
|
||||
core.getMessager().messageAndLog(sender, e.getBundledMessage().getMessage(), e.getBundledMessage().getArgs());
|
||||
}
|
||||
} else if (env == null) {
|
||||
core.getMessager().message(sender, IMPORT_FAILED);
|
||||
// TODO locale
|
||||
sender.sendMessage("That world environment did not exist.");
|
||||
sender.sendMessage("For a list of available world types, type: " + ChatColor.AQUA + "/mvenv");
|
||||
} else {
|
||||
core.getMessager().message(sender, IMPORT_FAILED);
|
||||
String worldList = this.getPotentialWorlds(core);
|
||||
// TODO locale
|
||||
sender.sendMessage("That world folder does not exist. These look like worlds to me:");
|
||||
sender.sendMessage(worldList);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* A very basic check to see if a folder has a level.dat file.
|
||||
* If it does, we can safely assume it's a world folder.
|
||||
*
|
||||
* @param worldFolder The File that may be a world.
|
||||
* @return True if it looks like a world, false if not.
|
||||
*/
|
||||
private static boolean checkIfIsWorld(File worldFolder) {
|
||||
if (worldFolder.isDirectory()) {
|
||||
File[] files = worldFolder.listFiles(new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File file, String name) {
|
||||
return name.equalsIgnoreCase("level.dat");
|
||||
}
|
||||
});
|
||||
if (files != null && files.length > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private String getPotentialWorlds(final MultiverseCore core) {
|
||||
final File worldFolder = core.getServerInterface().getWorldContainer();
|
||||
if (worldFolder == null) {
|
||||
return "";
|
||||
}
|
||||
File[] files = worldFolder.listFiles();
|
||||
String worldList = "";
|
||||
Collection<MultiverseWorld> worlds = core.getWorldManager().getMVWorlds();
|
||||
List<String> worldStrings = new ArrayList<String>();
|
||||
for (MultiverseWorld world : worlds) {
|
||||
worldStrings.add(world.getName());
|
||||
}
|
||||
for (String world : core.getWorldManager().getUnloadedWorlds()) {
|
||||
worldStrings.add(world);
|
||||
}
|
||||
ChatColor currColor = ChatColor.WHITE;
|
||||
for (File file : files) {
|
||||
if (file.isDirectory() && checkIfIsWorld(file) && !worldStrings.contains(file.getName())) {
|
||||
worldList += currColor + file.getName() + " ";
|
||||
if (currColor == ChatColor.WHITE) {
|
||||
currColor = ChatColor.YELLOW;
|
||||
} else {
|
||||
currColor = ChatColor.WHITE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return worldList;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.mvplugin.core.command;
|
||||
|
||||
import com.dumptruckman.minecraft.pluginbase.plugin.command.Command;
|
||||
import com.mvplugin.core.api.MultiverseCore;
|
||||
|
||||
abstract class MultiverseCommand extends Command<MultiverseCore> {
|
||||
|
||||
static {
|
||||
// Statically initialize help language
|
||||
CommandHelp.init();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.mvplugin.core.minecraft;
|
||||
|
||||
public enum Difficulty {
|
||||
PEACEFUL,
|
||||
EASY,
|
||||
NORMAL,
|
||||
HARD
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package com.mvplugin.core.minecraft;
|
||||
|
||||
public class Entity {
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.mvplugin.core.minecraft;
|
||||
|
||||
public enum GameMode {
|
||||
|
||||
ADVENTURE,
|
||||
CREATIVE,
|
||||
SURVIVAL
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package com.mvplugin.core.minecraft;
|
||||
|
||||
public interface Generator {
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package com.mvplugin.core.minecraft;
|
||||
|
||||
public final class PlayerPosition {
|
||||
|
||||
public static final PlayerPosition NULL_LOCATION = new PlayerPosition("", 0, 0, 0, 0, 0);
|
||||
|
||||
private final double x, y, z;
|
||||
private final float pitch, yaw;
|
||||
private final String world;
|
||||
|
||||
public PlayerPosition(final String world, final double x,
|
||||
final double y, final double z,
|
||||
final float pitch, final float yaw) {
|
||||
this.world = world;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.pitch = pitch;
|
||||
this.yaw = yaw;
|
||||
}
|
||||
|
||||
public String getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
public float getPitch() {
|
||||
return pitch;
|
||||
}
|
||||
|
||||
public float getYaw() {
|
||||
return this.yaw;
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return this.x;
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public double getZ() {
|
||||
return this.z;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.mvplugin.core.minecraft;
|
||||
|
||||
public enum PortalType {
|
||||
|
||||
/**
|
||||
* No portals are allowed.
|
||||
*/
|
||||
NONE,
|
||||
/**
|
||||
* All portal types are allowed.
|
||||
*/
|
||||
ALL,
|
||||
/**
|
||||
* Only Nether style portals are allowed.
|
||||
*/
|
||||
NETHER,
|
||||
/**
|
||||
* Only Ender style portals are allowed.
|
||||
*/
|
||||
END;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mvplugin.core.minecraft;
|
||||
|
||||
public enum WorldEnvironment {
|
||||
NETHER,
|
||||
NORMAL,
|
||||
THE_END
|
||||
;
|
||||
|
||||
public static WorldEnvironment getFromString(final String name) {
|
||||
for (final WorldEnvironment env : WorldEnvironment.values()) {
|
||||
if (name.equalsIgnoreCase(env.toString())) {
|
||||
return env;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.mvplugin.core.minecraft;
|
||||
|
||||
public enum WorldType {
|
||||
FLAT,
|
||||
LARGE_BIOMES,
|
||||
NORMAL,
|
||||
VERSION_1_1
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.mvplugin.core.util;
|
||||
|
||||
import com.dumptruckman.minecraft.pluginbase.messaging.Message;
|
||||
|
||||
public class Language {
|
||||
|
||||
public static final Message WORLD_ALREADY_EXISTS = new Message("worlds.world_exists",
|
||||
"&aMultiverse&f already knows about '&b%s&f'!");
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
package com.mvplugin.core.util;
|
||||
|
||||
import com.dumptruckman.minecraft.pluginbase.messaging.Message;
|
||||
|
||||
/**
|
||||
* Houses localized (english) descriptions of the Multiverse world properties.
|
||||
*/
|
||||
public class PropertyDescriptions {
|
||||
|
||||
public static void init() { }
|
||||
|
||||
public static final Message ALIAS = new Message("world_properties.descriptions.alias",
|
||||
"World aliases allow you to name a world differently than what the folder name is.",
|
||||
"This lets you choose fancy names for your worlds while keeping the folders nice and neat.",
|
||||
"You may add minecraft color and formatting codes here prepended with a &");
|
||||
|
||||
public static final Message HIDDEN = new Message("world_properties.descriptions.hidden",
|
||||
"The hidden property allows you to have a world that exists but does not show up in lists.");
|
||||
|
||||
public static final Message PREFIX_CHAT = new Message("world_properties.descriptions.prefixChat",
|
||||
"The prefixChat property adds the world's name (or alias) as a prefix to chat messages.");
|
||||
|
||||
public static final Message SEED = new Message("world_properties.descriptions.seed",
|
||||
"The seed property allows you to change the world's seed.");
|
||||
|
||||
public static final Message GENERATOR = new Message("world_properties.descriptions.generator",
|
||||
"The generator property allows you to specify the generator used to generate this world.");
|
||||
|
||||
public static final Message ENVIRONMENT = new Message("world_properties.descriptions.environment",
|
||||
"The environment property the Minecraft world environment such as NORMAL, NETHER, THE_END");
|
||||
|
||||
public static final Message PLAYER_LIMIT = new Message("world_properties.descriptions.playerLimit",
|
||||
"The player limit property limits the number of players in a world at a time.",
|
||||
"A value of -1 or lower signifies no player limit.");
|
||||
|
||||
public static final Message ADJUST_SPAWN = new Message("world_properties.descriptions.adjustSpawn",
|
||||
"The adjust spawn property determines whether or not Multiverse will make adjustments to the world's spawn location if it is unsafe.");
|
||||
|
||||
public static final Message AUTO_LOAD = new Message("world_properties.descriptions.autoLoad",
|
||||
"The autoLoad property dictates whether this world is loaded automatically on startup or not.");
|
||||
|
||||
public static final Message BED_RESPAWN = new Message("world_properties.descriptions.bedRespawn",
|
||||
"The bedRespawn property specifies if a player dying in this world should respawn in their bed or not.");
|
||||
|
||||
public static final Message HUNGER = new Message("world_properties.descriptions.hunger",
|
||||
"The hunger property specifies if hunger is depleted in this world");
|
||||
|
||||
public static final Message BLACK_LIST = new Message("world_properties.descriptions.worldBlacklist",
|
||||
"The worldBlackList property allows you to specify worlds that people cannot go to from this specified world.");
|
||||
|
||||
public static final Message PVP = new Message("world_properties.descriptions.pvp",
|
||||
"The pvp property states whether or not players may harm each other in this world. If set to true, they may.");
|
||||
|
||||
public static final Message SCALE = new Message("world_properties.descriptions.scale",
|
||||
"The scale property represents the scaling of worlds when using Multiverse-NetherPortals.",
|
||||
"Setting this value will have no effect on anything but Multiverse-NetherPortals.");
|
||||
|
||||
public static final Message RESPAWN_WORLD = new Message("world_properties.descriptions.respawnWorld",
|
||||
"The respawnWorld property is the world you will respawn to if you die in this world.",
|
||||
"This value can be the same as this world.");
|
||||
|
||||
public static final Message ALLOW_WEATHER = new Message("world_properties.descriptions.allowWeather",
|
||||
"The allowWeather property specifies whether or not to allow weather events in this world.");
|
||||
|
||||
public static final Message DIFFICULTY = new Message("world_properties.descriptions.difficulty",
|
||||
"The difficulty property allows you to set the difficulty for the world.",
|
||||
"World difficulty affects spawn rates, hunger rates, and other things that make the game more or less difficult.");
|
||||
|
||||
public static final Message AUTO_HEAL = new Message("world_properties.descriptions.autoHeal",
|
||||
"The autoHeal property will specify whether ot not players will regain health in PEACEFUL difficulty only.",
|
||||
"This setting has no effect on worlds with a difficulty greater than peaceful or 0.");
|
||||
|
||||
public static final Message PORTAL_FORM = new Message("world_properties.descriptions.portalForm",
|
||||
"The portalFrom property allows you to specify which type of portals are allowed to be created in this world.");
|
||||
|
||||
public static final Message GAME_MODE = new Message("world_properties.descriptions.gameMode",
|
||||
"The gameMode property allows you to specify the GameMode for this world.",
|
||||
"Players entering this world will automatically be switched to this GameMode unless they are exempted.");
|
||||
|
||||
public static final Message KEEP_SPAWN = new Message("world_properties.descriptions.keepSpawnInMemory",
|
||||
"The keepSpawnInMemory property specifies whether or not to keep the spawn chunks loaded in memory when players aren't in the spawn area.",
|
||||
"Setting this to false will potentially save you some memory.");
|
||||
|
||||
public static final Message SPAWN_LOCATION = new Message("world_properties.descriptions.spawnLocation",
|
||||
"The spawnLocation property specifies where in the world players will spawn.");
|
||||
|
||||
public static final Message AMOUNT = new Message("world_properties.descriptions.amount",
|
||||
"The amount property specifies how much a player has to pay to enter this world.",
|
||||
"What the player has to pay is specified by the 'currency' property");
|
||||
|
||||
public static final Message CURRENCY = new Message("world_properties.descriptions.currency",
|
||||
"The currency property specifies what type of currency the player must pay (if any) to enter this world.",
|
||||
"Currency can be an economy money by specifying -1 or a block type by specifying the block id.");
|
||||
|
||||
public static final Message ANIMALS_SPAWN = new Message("world_properties.descriptions.animals.spawn",
|
||||
"The animals spawn property specifies whether or not to spawn animals in this world.");
|
||||
|
||||
public static final Message ANIMALS_SPAWN_RATE = new Message("world_properties.descriptions.animals.spawnRate",
|
||||
"The animals spawnRate property defines how many ticks in between attempting to spawn animals.",
|
||||
"A value of -1 indicates the default should be used and is recommended unless you know what you are doing.");
|
||||
|
||||
public static final Message ANIMALS_SPAWN_EXCEPTIONS = new Message("world_properties.descriptions.animals.exceptions",
|
||||
"The animals exceptions property defines what animals are exempt from the animals spawn property.");
|
||||
|
||||
public static final Message MONSTERS_SPAWN = new Message("world_properties.descriptions.monsters.spawn",
|
||||
"The monsters spawn property specifies whether or not to spawn monsters in this world.");
|
||||
|
||||
public static final Message MONSTERS_SPAWN_RATE = new Message("world_properties.descriptions.monsters.spawnRate",
|
||||
"The monsters spawnRate property defines how many ticks in between attempting to spawn monsters.",
|
||||
"A value of -1 indicates the default should be used and is recommended unless you know what you are doing.");
|
||||
|
||||
public static final Message MONSTERS_SPAWN_EXCEPTIONS = new Message("world_properties.descriptions.monsters.exceptions",
|
||||
"The monsters exceptions property defines what monsters are exempt from the monsters spawn property.");
|
||||
|
||||
|
||||
public static final Message INVALID_SCALE = new Message("world_properties.validation.scale",
|
||||
"Scale must be a number higher than 0!");
|
||||
|
||||
public static final Message INVALID_RESPAWN_WORLD = new Message("world_properties.validation.respawnWorld",
|
||||
"Respawn world must be a world known to Multiverse!");
|
||||
}
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'maven-publish'
|
||||
id 'checkstyle'
|
||||
id 'com.github.johnrengelman.shadow' version '7.1.2'
|
||||
}
|
||||
|
||||
version = System.getenv('GITHUB_VERSION') ?: 'local'
|
||||
group = 'com.onarandombox.multiversecore'
|
||||
description = 'Multiverse-Core'
|
||||
|
||||
java.sourceCompatibility = JavaVersion.VERSION_11
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven {
|
||||
url = uri('https://hub.spigotmc.org/nexus/content/repositories/snapshots/')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://repo.onarandombox.com/content/groups/public')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://hub.spigotmc.org/nexus/content/groups/public/')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://jitpack.io')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://repo.minebench.de/')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://repo.maven.apache.org/maven2/')
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation('org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT') {
|
||||
exclude group: 'junit', module: 'junit'
|
||||
}
|
||||
|
||||
implementation('com.github.MilkBowl:VaultAPI:1.7') {
|
||||
exclude group: 'org.bukkit', module: 'bukkit'
|
||||
}
|
||||
|
||||
api('me.main__.util:SerializationConfig:1.7') {
|
||||
exclude group: 'org.bukkit', module: 'bukkit'
|
||||
}
|
||||
api('com.pneumaticraft.commandhandler:CommandHandler:11') {
|
||||
exclude group: 'org.bukkit', module: 'bukkit'
|
||||
exclude group: 'junit', module: 'junit'
|
||||
}
|
||||
api 'com.dumptruckman.minecraft:buscript:2.0-SNAPSHOT'
|
||||
api 'org.bstats:bstats-bukkit:2.2.1'
|
||||
api('com.dumptruckman.minecraft:Logging:1.1.1') {
|
||||
exclude group: 'junit', module: 'junit'
|
||||
}
|
||||
api 'de.themoep.idconverter:mappings:1.2-SNAPSHOT'
|
||||
api 'org.jetbrains:annotations:16.0.2'
|
||||
|
||||
testImplementation 'junit:junit:4.12'
|
||||
testImplementation 'org.mockito:mockito-core:3.11.2'
|
||||
testImplementation 'commons-io:commons-io:2.4'
|
||||
}
|
||||
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
tasks.withType(Javadoc) {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
|
||||
configurations {
|
||||
[apiElements, runtimeElements].each {
|
||||
it.outgoing.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(jar) }
|
||||
it.outgoing.artifact(shadowJar)
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
name = "GitHubPackages"
|
||||
url = "https://maven.pkg.github.com/Multiverse/Multiverse-Core"
|
||||
credentials {
|
||||
username = System.getenv("GITHUB_ACTOR")
|
||||
password = System.getenv("GITHUB_TOKEN")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ext.bitlyAccessToken = System.getenv('BITLY_ACCESS_TOKEN') ?: 'bitly-access-token'
|
||||
|
||||
task prepareSource(type: Sync) {
|
||||
inputs.property 'bitlyAccessToken', bitlyAccessToken
|
||||
from sourceSets.main.java
|
||||
into "$buildDir/src"
|
||||
filter(ReplaceTokens, tokens: [
|
||||
'bitly-access-token': bitlyAccessToken,
|
||||
])
|
||||
}
|
||||
|
||||
compileJava {
|
||||
source = prepareSource.outputs
|
||||
}
|
||||
|
||||
processResources {
|
||||
def props = [version: "${project.version}"]
|
||||
inputs.properties props
|
||||
filteringCharset 'UTF-8'
|
||||
filesMatching('plugin.yml') {
|
||||
expand props
|
||||
}
|
||||
|
||||
// This task should never be skipped. The tests depend on this having been run but we want the new version number
|
||||
// that is created after tests are run and before we run again to publish.
|
||||
outputs.upToDateWhen { false }
|
||||
}
|
||||
|
||||
|
||||
checkstyle {
|
||||
toolVersion = '6.1.1'
|
||||
configFile file('config/mv_checks.xml')
|
||||
ignoreFailures = true
|
||||
}
|
||||
|
||||
|
||||
javadoc {
|
||||
source = sourceSets.main.allJava
|
||||
classpath = configurations.compileClasspath
|
||||
}
|
||||
|
||||
|
||||
project.configurations.api.canBeResolved = true
|
||||
|
||||
shadowJar {
|
||||
relocate 'me.main__.util', 'com.onarandombox.serializationconfig'
|
||||
relocate 'com.pneumaticraft.commandhandler', 'com.onarandombox.commandhandler'
|
||||
relocate 'buscript', 'com.onarandombox.buscript'
|
||||
relocate 'org.bstats', 'com.onarandombox.bstats'
|
||||
relocate 'com.dumptruckman.minecraft.util.Logging', 'com.onarandombox.MultiverseCore.utils.CoreLogging'
|
||||
relocate 'com.dumptruckman.minecraft.util.DebugLog', 'com.onarandombox.MultiverseCore.utils.DebugFileLogger'
|
||||
relocate 'org.codehaus.jettison', 'com.onarandombox.jettison'
|
||||
relocate 'de.themoep.idconverter', 'com.onarandombox.idconverter'
|
||||
|
||||
configurations = [project.configurations.api]
|
||||
|
||||
archiveFileName = "$baseName-$version.$extension"
|
||||
}
|
||||
|
||||
build.dependsOn shadowJar
|
||||
jar.enabled = false
|
||||
@@ -1,44 +0,0 @@
|
||||
# Eclipse stuff
|
||||
/.classpath
|
||||
/.project
|
||||
/.settings
|
||||
/.checkstyle
|
||||
|
||||
# netbeans
|
||||
/nbproject
|
||||
|
||||
# we use maven!
|
||||
/build.xml
|
||||
|
||||
# maven
|
||||
/target
|
||||
|
||||
# vim
|
||||
.*.sw[a-p]
|
||||
|
||||
# various other potential build files
|
||||
/build
|
||||
/bin
|
||||
/dist
|
||||
/manifest.mf
|
||||
|
||||
/world
|
||||
|
||||
# Mac filesystem dust
|
||||
*.DS_Store
|
||||
|
||||
# intellij
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# Fern's utils
|
||||
uploadtoserver.sh
|
||||
|
||||
# Testing files:
|
||||
debug.log
|
||||
|
||||
# Doxygen
|
||||
/docs/html
|
||||
debug.txt
|
||||
@@ -1,143 +0,0 @@
|
||||
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ Multiverse 2 Copyright (c) the Multiverse Team 2011. ~
|
||||
~ Multiverse 2 is licensed under the BSD License. ~
|
||||
~ For more information please check the README.md file included ~
|
||||
~ with this project. ~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
|
||||
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
||||
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
|
||||
<!-- Future reference: valid severity values are 'ignore', 'info', 'warning', 'error' -->
|
||||
<module name="Checker">
|
||||
<module name="JavadocPackage">
|
||||
<property name="allowLegacy" value="true"/>
|
||||
</module>
|
||||
<module name="NewlineAtEndOfFile" />
|
||||
<module name="Translation"/>
|
||||
<module name="FileLength"/>
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
</module>
|
||||
<module name="RegexpSingleline">
|
||||
<property name="message" value="Line has trailing spaces."/>
|
||||
<property name="format" value="\s+$"/>
|
||||
</module>
|
||||
<module name="SuppressWithNearbyCommentFilter">
|
||||
<property name="commentFormat" value="SUPPRESS CHECKSTYLE: (\w+)"/>
|
||||
<property name="checkFormat" value="$1"/>
|
||||
</module>
|
||||
<module name="SuppressionCommentFilter">
|
||||
<property name="offCommentFormat" value="BEGIN CHECKSTYLE-SUPPRESSION\: (\w+)"/>
|
||||
<property name="onCommentFormat" value="END CHECKSTYLE-SUPPRESSION\: (\w+)"/>
|
||||
<property name="checkFormat" value="$1"/>
|
||||
</module>
|
||||
<module name="SuppressionCommentFilter">
|
||||
<property name="offCommentFormat" value="BEGIN CHECKSTYLE-SUPPRESSION\: ALL"/>
|
||||
<property name="onCommentFormat" value="END CHECKSTYLE-SUPPRESSION\: ALL"/>
|
||||
</module>
|
||||
<module name="TreeWalker">
|
||||
<!-- Make suppression possible -->
|
||||
<module name="FileContentsHolder"/>
|
||||
<!-- Actual checks -->
|
||||
<module name="LineLength">
|
||||
<property name="max" value="160"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
<module name="JavadocMethod">
|
||||
<property name="scope" value="package"/><!-- We don't need javadoc for private methods -->
|
||||
<property name="tokens" value="METHOD_DEF"/><!-- We don't need javadoc for constructors -->
|
||||
</module>
|
||||
<module name="JavadocType"/>
|
||||
<module name="JavadocVariable">
|
||||
<property name="scope" value="package"/><!-- We don't need javadoc for private variables -->
|
||||
</module>
|
||||
<module name="JavadocStyle"/>
|
||||
<module name="WriteTag">
|
||||
<property name="tag" value="@author"/>
|
||||
<property name="tagFormat" value="\S"/>
|
||||
<property name="severity" value="ignore"/>
|
||||
<property name="tagSeverity" value="warning"/>
|
||||
</module>
|
||||
<module name="ConstantName"/>
|
||||
<module name="LocalVariableName"/>
|
||||
<module name="MemberName"/>
|
||||
<module name="MethodName"/>
|
||||
<module name="PackageName"/>
|
||||
<module name="ParameterName"/>
|
||||
<module name="StaticVariableName"/>
|
||||
<module name="TypeName"/>
|
||||
<module name="AvoidStarImport">
|
||||
<property name="severity" value="warning"/>
|
||||
<property name="excludes" value="com.onarandombox.MultiverseCore.utils,com.onarandombox.MultiverseCore.configuration,com.onarandombox.MultiverseCore.commands,com.onarandombox.MultiverseCore.destination"/>
|
||||
</module>
|
||||
<module name="IllegalImport"/>
|
||||
<module name="RedundantImport"/>
|
||||
<module name="UnusedImports">
|
||||
<property name="processJavadoc" value="true"/>
|
||||
</module>
|
||||
<module name="MethodLength">
|
||||
<property name="severity" value="warning"/>
|
||||
<property name="countEmpty" value="false"/>
|
||||
</module>
|
||||
<module name="ParameterNumber"/>
|
||||
<module name="EmptyForIteratorPad"/>
|
||||
<module name="MethodParamPad"/>
|
||||
<module name="NoWhitespaceAfter">
|
||||
<property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
|
||||
</module>
|
||||
<module name="NoWhitespaceBefore"/>
|
||||
<module name="OperatorWrap"/>
|
||||
<module name="ParenPad"/>
|
||||
<module name="TypecastParenPad"/>
|
||||
<module name="WhitespaceAfter">
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
<module name="WhitespaceAround">
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
<module name="ModifierOrder"/>
|
||||
<module name="RedundantModifier"/>
|
||||
<module name="AvoidNestedBlocks"/>
|
||||
<module name="EmptyBlock">
|
||||
<property name="tokens" value="LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_IF,LITERAL_FOR,LITERAL_TRY,LITERAL_WHILE,INSTANCE_INIT,STATIC_INIT"/>
|
||||
</module>
|
||||
<module name="LeftCurly"/>
|
||||
<module name="RightCurly"/>
|
||||
<module name="DoubleCheckedLocking"/>
|
||||
<module name="EmptyStatement"/>
|
||||
<module name="EqualsHashCode"/>
|
||||
<module name="HiddenField">
|
||||
<property name="tokens" value="VARIABLE_DEF"/><!-- We don't care if parameters hide fields. -->
|
||||
</module>
|
||||
<module name="IllegalInstantiation"/>
|
||||
<module name="InnerAssignment"/>
|
||||
<module name="MagicNumber">
|
||||
<property name="ignoreNumbers" value="-1, 0, 0.5, 1, 2, 3"/>
|
||||
</module>
|
||||
<module name="MissingSwitchDefault"/>
|
||||
<module name="RedundantThrows"/>
|
||||
<module name="SimplifyBooleanExpression"/>
|
||||
<module name="SimplifyBooleanReturn"/>
|
||||
<!-- Don't like errors for `final` missing
|
||||
<module name="DesignForExtension"/>
|
||||
<module name="FinalClass"/>
|
||||
-->
|
||||
<module name="HideUtilityClassConstructor"/>
|
||||
<module name="InterfaceIsType"/>
|
||||
<module name="VisibilityModifier">
|
||||
<property name="protectedAllowed" value="true"/>
|
||||
</module>
|
||||
<module name="ArrayTypeStyle"/>
|
||||
<!-- Don't like errors for `final` missing
|
||||
<module name="FinalParameters"/>
|
||||
-->
|
||||
<module name="TodoComment">
|
||||
<property name="severity" value="info"/>
|
||||
</module>
|
||||
<module name="UpperEll"/>
|
||||
<module name="Indentation"/>
|
||||
<module name="MissingDeprecated"/>
|
||||
<module name="MissingOverride"/>
|
||||
</module>
|
||||
</module>
|
||||
-322
@@ -1,322 +0,0 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.mvplugin</groupId>
|
||||
<artifactId>MultiverseCore</artifactId>
|
||||
<version>3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>MultiverseCore-Bukkit</artifactId>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>onarandombox</id>
|
||||
<url>http://repo.onarandombox.com/content/groups/public</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>Bukkit Official</id>
|
||||
<url>http://repo.bukkit.org/content/repositories/public</url>
|
||||
</repository>
|
||||
<!-- Required for Metrics -->
|
||||
<repository>
|
||||
<id>mcstats</id>
|
||||
<url>http://repo.mcstats.org/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
<!-- Required for Vault -->
|
||||
<repository>
|
||||
<id>herocraft</id>
|
||||
<url>http://ci.herocraftonline.com/plugin/repository/everything/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>doodleproject-repo</id>
|
||||
<name>DoodleProject Maven 2 Repository</name>
|
||||
<url>http://doodleproject.sourceforge.net/maven2/release</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<ciManagement>
|
||||
<system>jenkins</system>
|
||||
<url>http://ci.onarandombox.com</url>
|
||||
</ciManagement>
|
||||
|
||||
<!-- Profiles are used to detect whether this is a local or Jenkins build
|
||||
and adjust the build number accordingly -->
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>jenkins</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>env.BUILD_NUMBER</name>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<project.build.number>${env.BUILD_NUMBER}</project.build.number>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean package</defaultGoal>
|
||||
<plugins>
|
||||
<!-- Compiler -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.google.code.maven-replacer-plugin</groupId>
|
||||
<artifactId>maven-replacer-plugin</artifactId>
|
||||
<version>1.3.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>replace</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<file>target/classes/plugin.yml</file>
|
||||
<replacements>
|
||||
<replacement>
|
||||
<token>maven-version-number</token>
|
||||
<value>${project.version}-b${project.build.number}</value>
|
||||
</replacement>
|
||||
</replacements>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Jar Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.11</version>
|
||||
<configuration>
|
||||
<parallel>methods</parallel>
|
||||
<threadCount>10</threadCount>
|
||||
<excludes>
|
||||
<exclude>**/TestCommandSender.java</exclude>
|
||||
<exclude>**/TestInstanceCreator.java</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.surefire</groupId>
|
||||
<artifactId>surefire-junit47</artifactId>
|
||||
<version>2.11</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<configuration>
|
||||
<enableRulesSummary>true</enableRulesSummary>
|
||||
<configLocation>${project.basedir}/config/mv_checks.xml</configLocation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.1.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.8.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>javadoc-jar</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>com.mvplugin:MultiverseCore-Base</include>
|
||||
<include>com.dumptruckman.minecraft:BukkitPlugin</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com.dumptruckman.minecraft.pluginbase</pattern>
|
||||
<shadedPattern>com.mvplugin.pluginbase</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<!--
|
||||
<include>me.main__.util:SerializationConfig</include>
|
||||
<include>com.pneumaticraft.commandhandler:CommandHandler</include>
|
||||
<include>com.dumptruckman.minecraft:buscript</include>
|
||||
<include>com.dumptruckman.minecraft:BukkitPlugin</include>
|
||||
<include>org.mcstats:metrics</include>
|
||||
<include>com.fernferret.allpay:AllPay</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com.fernferret.allpay</pattern>
|
||||
<shadedPattern>com.fernferret.allpay.multiverse</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>me.main__.util</pattern>
|
||||
<shadedPattern>me.main__.util.multiverse</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.pneumaticraft.commandhandler</pattern>
|
||||
<shadedPattern>com.pneumaticraft.commandhandler.multiverse</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>buscript</pattern>
|
||||
<shadedPattern>buscript.multiverse</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.dumptruckman.minecraft.pluginbase.util.Logging</pattern>
|
||||
<shadedPattern>com.onarandombox.multiverse.core.util.CoreLogging</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.dumptruckman.minecraft.pluginbase.util.DebugLog</pattern>
|
||||
<shadedPattern>com.onarandombox.multiverse.util.DebugFileLogger</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.dumptruckman.minecraft.pluginbase</pattern>
|
||||
<shadedPattern>com.dumptruckman.minecraft.pluginbase.multiverse</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.mcstats</pattern>
|
||||
<shadedPattern>org.mcstats.multiverse</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
-->
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.mvplugin</groupId>
|
||||
<artifactId>MultiverseCore-Base</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- PluginBase Dependency -->
|
||||
<dependency>
|
||||
<groupId>com.dumptruckman.minecraft</groupId>
|
||||
<artifactId>BukkitPlugin</artifactId>
|
||||
<version>1.5-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- Bukkit Dependency -->
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.3.2-R2.1-SNAPSHOT</version>
|
||||
<!-- If you want the lates, use this -->
|
||||
<!-- <version>LATEST</version> -->
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- Start of Economy Dependency -->
|
||||
<dependency>
|
||||
<groupId>com.fernferret.allpay</groupId>
|
||||
<artifactId>AllPay</artifactId>
|
||||
<version>10</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>Vault</artifactId>
|
||||
<version>1.2.19-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- End of Economy Dependency -->
|
||||
<!-- Start of CommandHandler Dependency -->
|
||||
<dependency>
|
||||
<groupId>com.pneumaticraft.commandhandler</groupId>
|
||||
<artifactId>CommandHandler</artifactId>
|
||||
<version>7</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- End of CommandHandler Dependency -->
|
||||
<!-- Start of Buscript Dependency -->
|
||||
<dependency>
|
||||
<groupId>com.dumptruckman.minecraft</groupId>
|
||||
<artifactId>buscript</artifactId>
|
||||
<version>1.0</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- End of Buscript Dependency -->
|
||||
<!-- Start of Metrics Dependency -->
|
||||
<dependency>
|
||||
<groupId>org.mcstats</groupId>
|
||||
<artifactId>metrics</artifactId>
|
||||
<version>1.2-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- End of Metrics Dependency -->
|
||||
</dependencies>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>OnARandomBox</id>
|
||||
<url>http://repo.onarandombox.com/content/repositories/multiverse/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>OnARandomBox</id>
|
||||
<url>http://repo.onarandombox.com/content/repositories/multiverse-snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
@@ -1,82 +0,0 @@
|
||||
package com.mvplugin.core;
|
||||
|
||||
import com.mvplugin.core.api.BukkitMultiverseWorld;
|
||||
import com.mvplugin.core.api.WorldProperties;
|
||||
import com.mvplugin.core.api.WorldProperties.Spawning.Animals;
|
||||
import com.mvplugin.core.minecraft.PlayerPosition;
|
||||
import com.mvplugin.core.minecraft.WorldType;
|
||||
import com.mvplugin.core.util.Convert;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
class BukkitWorld extends AbstractMultiverseWorld implements BukkitMultiverseWorld {
|
||||
|
||||
private final String name;
|
||||
private final UUID worldUID;
|
||||
private final WorldType worldType;
|
||||
|
||||
BukkitWorld(final World world, final WorldProperties worldProperties) {
|
||||
super(worldProperties);
|
||||
this.name = world.getName();
|
||||
this.worldUID = world.getUID();
|
||||
this.worldType = Convert.fromBukkit(world.getWorldType());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update(Object obj) {
|
||||
if (obj == WorldProperties.DIFFICULTY) {
|
||||
getBukkitWorld().setDifficulty(Convert.toBukkit(getDifficulty()));
|
||||
} else if (obj == WorldProperties.ALLOW_WEATHER) {
|
||||
if (!isWeatherEnabled()) {
|
||||
final World world = getBukkitWorld();
|
||||
world.setWeatherDuration(0);
|
||||
world.setStorm(false);
|
||||
world.setThunderDuration(0);
|
||||
world.setThundering(false);
|
||||
}
|
||||
} else if (obj == WorldProperties.PVP) {
|
||||
getBukkitWorld().setPVP(isPVPEnabled());
|
||||
} else if (obj == WorldProperties.SPAWN_LOCATION) {
|
||||
final PlayerPosition pos = getSpawnLocation();
|
||||
getBukkitWorld().setSpawnLocation((int) pos.getX(), (int) pos.getY(), (int) pos.getZ());
|
||||
} else if (obj == Animals.SPAWN_RATE) {
|
||||
//getBukkitWorld().set
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getWorldUID() {
|
||||
return this.worldUID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldType getWorldType() {
|
||||
return worldType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getBukkitWorld() {
|
||||
final World world = Bukkit.getWorld(worldUID);
|
||||
if (world == null) {
|
||||
throw new IllegalStateException("Multiverse lost track of Bukkit world '" + this.name + "'");
|
||||
}
|
||||
return world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTime() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setTime(String timeAsString) {
|
||||
return false; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
@@ -1,198 +0,0 @@
|
||||
package com.mvplugin.core;
|
||||
|
||||
import com.dumptruckman.minecraft.pluginbase.logging.Logging;
|
||||
import com.dumptruckman.minecraft.pluginbase.messaging.BundledMessage;
|
||||
import com.mvplugin.core.api.BukkitMultiverseWorld;
|
||||
import com.mvplugin.core.api.WorldProperties;
|
||||
import com.mvplugin.core.util.BukkitLanguage;
|
||||
import com.mvplugin.core.util.Convert;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class BukkitWorldManager extends AbstractWorldManager {
|
||||
|
||||
private final MultiverseCorePlugin plugin;
|
||||
private final File worldsFolder;
|
||||
|
||||
private final Map<String, WorldProperties> worldPropertiesMap;
|
||||
private final Map<String, String> defaultGens;
|
||||
|
||||
public BukkitWorldManager(MultiverseCorePlugin plugin) {
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
this.worldsFolder = new File(plugin.getDataFolder(), "worlds");
|
||||
this.worldPropertiesMap = new HashMap<String, WorldProperties>();
|
||||
this.defaultGens = new HashMap<String, String>();
|
||||
initializeDefaultWorldGenerators();
|
||||
initializeWorlds();
|
||||
}
|
||||
|
||||
private void initializeDefaultWorldGenerators() {
|
||||
File[] files = this.plugin.getServerFolder().listFiles(new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File file, String s) {
|
||||
return s.equalsIgnoreCase("bukkit.yml");
|
||||
}
|
||||
});
|
||||
if (files != null && files.length == 1) {
|
||||
FileConfiguration bukkitConfig = YamlConfiguration.loadConfiguration(files[0]);
|
||||
if (bukkitConfig.isConfigurationSection("worlds")) {
|
||||
Set<String> keys = bukkitConfig.getConfigurationSection("worlds").getKeys(false);
|
||||
for (String key : keys) {
|
||||
defaultGens.put(key, bukkitConfig.getString("worlds." + key + ".generator", ""));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Logging.warning("Could not read 'bukkit.yml'. Any Default worldgenerators will not be loaded!");
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeWorlds() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (final World w : this.plugin.getServer().getWorlds()) {
|
||||
try {
|
||||
worldsMap.put(w.getName(), getBukkitWorld(w));
|
||||
if (builder.length() != 0) {
|
||||
builder.append(", ");
|
||||
}
|
||||
builder.append(w.getName());
|
||||
} catch (IOException e) {
|
||||
Logging.severe("Multiverse could not initialize loaded Bukkit world '%s'", w.getName());
|
||||
}
|
||||
}
|
||||
|
||||
for (File file : getPotentialWorldFiles()) {
|
||||
final String worldName = getWorldNameFromFile(file);
|
||||
if (worldsMap.containsKey(worldName)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
WorldProperties worldProperties = getWorldProperties(file);
|
||||
if (worldProperties.get(WorldProperties.AUTO_LOAD)) {
|
||||
addWorld(worldName, worldProperties.get(WorldProperties.ENVIRONMENT), null, null,
|
||||
null, worldProperties.get(WorldProperties.GENERATOR),
|
||||
worldProperties.get(WorldProperties.ADJUST_SPAWN));
|
||||
if (builder.length() != 0) {
|
||||
builder.append(", ");
|
||||
}
|
||||
builder.append(worldName);
|
||||
} else {
|
||||
Logging.fine("Not loading '%s' because it is set to autoLoad: false", worldName);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Logging.getLogger().log(Level.WARNING, String.format("Could not load world from file '%s'", file), e);
|
||||
} catch (WorldCreationException e) {
|
||||
Logging.getLogger().log(Level.WARNING, String.format("Error while attempting to load world '%s'", worldName), e);
|
||||
}
|
||||
}
|
||||
|
||||
// Simple Output to the Console to show how many Worlds were loaded.
|
||||
Logging.config("Multiverse is now managing: %s", builder.toString());
|
||||
}
|
||||
|
||||
private String getWorldNameFromFile(final File file) {
|
||||
final String simpleName = file.getName();
|
||||
if (simpleName.endsWith(".yml")) {
|
||||
return simpleName.substring(0, simpleName.indexOf(".yml"));
|
||||
}
|
||||
return simpleName;
|
||||
}
|
||||
|
||||
private File[] getPotentialWorldFiles() {
|
||||
return worldsFolder.listFiles(new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.endsWith(".yml");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private WorldProperties getWorldProperties(final File file) throws IOException {
|
||||
final YamlWorldProperties worldProperties = new YamlWorldProperties(file);
|
||||
worldProperties.setPropertyValidator(WorldProperties.RESPAWN_WORLD, new RespawnWorldValidator(this));
|
||||
return worldProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldProperties getWorldProperties(String worldName) throws IOException {
|
||||
final World world = Bukkit.getWorld(worldName);
|
||||
if (world != null) {
|
||||
worldName = world.getName();
|
||||
}
|
||||
if (worldPropertiesMap.containsKey(worldName)) {
|
||||
return worldPropertiesMap.get(worldName);
|
||||
} else {
|
||||
final WorldProperties worldProperties = getWorldProperties(new File(worldsFolder, worldName + ".yml"));
|
||||
worldPropertiesMap.put(worldName, worldProperties);
|
||||
return worldProperties;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public BukkitMultiverseWorld createWorld(final WorldCreationSettings settings) throws WorldCreationException {
|
||||
if (Bukkit.getWorld(settings.name()) != null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final WorldCreator c = WorldCreator.name(settings.name());
|
||||
if (settings.env() != null) {
|
||||
c.environment(Convert.toBukkit(settings.env()));
|
||||
}
|
||||
if (settings.type() != null) {
|
||||
c.type(Convert.toBukkit(settings.type()));
|
||||
}
|
||||
if (settings.seed() != null) {
|
||||
c.seed(settings.seed());
|
||||
}
|
||||
if (settings.generateStructures() != null) {
|
||||
c.generateStructures(settings.generateStructures());
|
||||
}
|
||||
if (settings.generator() != null) {
|
||||
final String[] split = settings.generator().split(":", 2);
|
||||
final String id = (split.length > 1) ? split[1] : null;
|
||||
final Plugin plugin = Bukkit.getPluginManager().getPlugin(split[0]);
|
||||
|
||||
if (plugin == null) {
|
||||
throw new WorldCreationException(new BundledMessage(BukkitLanguage.WGEN_UNKNOWN_GENERATOR, settings.generator()));
|
||||
} else if (!plugin.isEnabled()) {
|
||||
throw new WorldCreationException(new BundledMessage(BukkitLanguage.WGEN_DISABLED_GENERATOR, settings.generator()));
|
||||
} else {
|
||||
c.generator(plugin.getDefaultWorldGenerator(settings.name(), id));
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
final World w = c.createWorld();
|
||||
return getBukkitWorld(w);
|
||||
} catch (Exception e) {
|
||||
throw new WorldCreationException(new BundledMessage(BukkitLanguage.CREATE_WORLD_ERROR, settings.name()), e);
|
||||
}
|
||||
}
|
||||
|
||||
private BukkitWorld getBukkitWorld(final World world) throws IOException {
|
||||
return new BukkitWorld(world, getWorldProperties(world.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getUnloadedWorlds() {
|
||||
return Collections.unmodifiableList(new ArrayList<String>(worldPropertiesMap.keySet()));
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package com.mvplugin.core;
|
||||
|
||||
import com.dumptruckman.minecraft.pluginbase.plugin.AbstractBukkitPlugin;
|
||||
import com.dumptruckman.minecraft.pluginbase.properties.Properties;
|
||||
import com.mvplugin.core.api.CoreConfig;
|
||||
import com.mvplugin.core.api.MultiverseCore;
|
||||
import com.mvplugin.core.command.ImportCommand;
|
||||
import com.mvplugin.core.util.PropertyDescriptions;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* The primary Bukkit plugin implementation of Multiverse-Core.
|
||||
*
|
||||
* See {@link MultiverseCore} for a more detailed external api javadocs.
|
||||
*/
|
||||
public class MultiverseCorePlugin extends AbstractBukkitPlugin implements MultiverseCore {
|
||||
|
||||
private static final int PROTOCOL = 19;
|
||||
private static final String COMMAND_PREFIX = "mv";
|
||||
|
||||
private BukkitWorldManager worldManager;
|
||||
|
||||
public MultiverseCorePlugin() {
|
||||
this.setPermissionName("multiverse.core");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPluginLoad() {
|
||||
PropertyDescriptions.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPluginEnable() {
|
||||
worldManager = new BukkitWorldManager(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onReloadConfig() {
|
||||
worldManager = new BukkitWorldManager(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerCommands() {
|
||||
registerCommand(ImportCommand.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandPrefix() {
|
||||
return COMMAND_PREFIX;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Properties getNewConfig() throws IOException {
|
||||
return new YamlCoreConfig(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CoreConfig config() {
|
||||
return (CoreConfig) super.config();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CoreConfig getMVConfig() {
|
||||
return config();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean useDatabase() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BukkitWorldManager getWorldManager() {
|
||||
return this.worldManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiverseCore getCore() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCore(MultiverseCore core) { }
|
||||
|
||||
@Override
|
||||
public int getProtocolVersion() {
|
||||
return PROTOCOL;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mvplugin.core;
|
||||
|
||||
import com.dumptruckman.minecraft.pluginbase.properties.YamlProperties;
|
||||
import com.mvplugin.core.api.CoreConfig;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* A yaml implementation of Multiverse-Core's primary configuration file.
|
||||
*/
|
||||
class YamlCoreConfig extends YamlProperties implements CoreConfig {
|
||||
|
||||
public YamlCoreConfig(MultiverseCorePlugin plugin) throws IOException {
|
||||
super(true, true, new File(plugin.getDataFolder(), "config.yml"), CoreConfig.class);
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
package com.mvplugin.core;
|
||||
|
||||
import com.dumptruckman.minecraft.pluginbase.properties.PropertySerializer;
|
||||
import com.dumptruckman.minecraft.pluginbase.properties.YamlProperties;
|
||||
import com.mvplugin.core.api.WorldProperties;
|
||||
import com.mvplugin.core.minecraft.PlayerPosition;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* YAML implementation of {@link WorldProperties} which will store all the world properties in a
|
||||
* YAML file named after the world.
|
||||
*/
|
||||
class YamlWorldProperties extends YamlProperties implements WorldProperties {
|
||||
|
||||
YamlWorldProperties(File configFile) throws IOException {
|
||||
super(false, true, configFile, WorldProperties.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerSerializers() {
|
||||
super.registerSerializers();
|
||||
setPropertySerializer(PlayerPosition.class, new PlayerPositionSerializer());
|
||||
}
|
||||
|
||||
private static class PlayerPositionSerializer implements PropertySerializer<PlayerPosition> {
|
||||
@Override
|
||||
public PlayerPosition deserialize(Object o) {
|
||||
String world = "";
|
||||
double x = 0D;
|
||||
double y = 0D;
|
||||
double z = 0D;
|
||||
float pitch = 0F;
|
||||
float yaw = 0F;
|
||||
if (o instanceof ConfigurationSection) {
|
||||
o = ((ConfigurationSection) o).getValues(false);
|
||||
}
|
||||
if (o instanceof Map) {
|
||||
Map map = (Map) o;
|
||||
world = map.get("world").toString();
|
||||
try {
|
||||
x = Double.valueOf(map.get("x").toString());
|
||||
} catch (Exception ignore) { }
|
||||
try {
|
||||
y = Double.valueOf(map.get("y").toString());
|
||||
} catch (Exception ignore) { }
|
||||
try {
|
||||
z = Double.valueOf(map.get("z").toString());
|
||||
} catch (Exception ignore) { }
|
||||
try {
|
||||
pitch = Float.valueOf(map.get("pitch").toString());
|
||||
} catch (Exception ignore) { }
|
||||
try {
|
||||
yaw = Float.valueOf(map.get("yaw").toString());
|
||||
} catch (Exception ignore) { }
|
||||
}
|
||||
return new PlayerPosition(world, x, y, z, pitch, yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object serialize(PlayerPosition playerPosition) {
|
||||
Map<String, Object> result = new LinkedHashMap<String, Object>(6);
|
||||
result.put("world", playerPosition.getWorld() != null ? playerPosition.getWorld() : "");
|
||||
result.put("x", playerPosition.getX());
|
||||
result.put("y", playerPosition.getY());
|
||||
result.put("z", playerPosition.getZ());
|
||||
result.put("pitch", playerPosition.getPitch());
|
||||
result.put("yaw", playerPosition.getYaw());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mvplugin.core.api;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
/**
|
||||
* Additional API for a Multiverse handled world specifically for Bukkit.
|
||||
*/
|
||||
public interface BukkitMultiverseWorld extends MultiverseWorld {
|
||||
|
||||
/**
|
||||
* Gets the Bukkit {@link World} associated with this MultiverseWorld.
|
||||
*
|
||||
* @return The Bukkit world associated with this Multiverse world.
|
||||
*/
|
||||
World getBukkitWorld();
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.mvplugin.core.util;
|
||||
|
||||
import com.dumptruckman.minecraft.pluginbase.messaging.Message;
|
||||
|
||||
public class BukkitLanguage {
|
||||
public static final Message CREATE_WORLD_ERROR = new Message("worlds.create_world_error",
|
||||
"&aBukkit&f experienced a problem while attempting to create '&b%s&f'!");
|
||||
public static final Message WGEN_UNKNOWN_GENERATOR = new Message("worlds.create.unknown_generator",
|
||||
"I can't create a &bBukkit&f world that uses the generator &c%s&f because it doesn't exist!");
|
||||
public static final Message WGEN_DISABLED_GENERATOR = new Message("worlds.create.unknown_generator",
|
||||
"I can't create a &bBukkit&f world that uses the generator &c%s&f because it is not enabled!");
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.mvplugin.core.util;
|
||||
|
||||
import com.mvplugin.core.minecraft.PlayerPosition;
|
||||
import com.mvplugin.core.minecraft.WorldEnvironment;
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.WorldType;
|
||||
|
||||
public final class Convert {
|
||||
private Convert() {}
|
||||
|
||||
public static Difficulty toBukkit(com.mvplugin.core.minecraft.Difficulty d) {
|
||||
return Difficulty.valueOf(d.name());
|
||||
}
|
||||
|
||||
public static WorldType toBukkit(com.mvplugin.core.minecraft.WorldType t) {
|
||||
return WorldType.valueOf(t.name());
|
||||
}
|
||||
|
||||
public static com.mvplugin.core.minecraft.WorldType fromBukkit(WorldType t) {
|
||||
return com.mvplugin.core.minecraft.WorldType.valueOf(t.name());
|
||||
}
|
||||
|
||||
public static Environment toBukkit(WorldEnvironment e) {
|
||||
return Environment.valueOf(e.name());
|
||||
}
|
||||
|
||||
public static Location toBukkit(PlayerPosition position, World world) {
|
||||
return new Location(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
name: Multiverse-Core
|
||||
main: com.mvplugin.core.MultiverseCorePlugin
|
||||
authors: ['Rigby', 'fernferret', 'lithium3141', 'main--', 'dumptruckman']
|
||||
version: maven-version-number
|
||||
@@ -104,7 +104,6 @@
|
||||
</module>
|
||||
<module name="LeftCurly"/>
|
||||
<module name="RightCurly"/>
|
||||
<module name="DoubleCheckedLocking"/>
|
||||
<module name="EmptyStatement"/>
|
||||
<module name="EqualsHashCode"/>
|
||||
<module name="HiddenField">
|
||||
@@ -116,7 +115,6 @@
|
||||
<property name="ignoreNumbers" value="-1, 0, 0.5, 1, 2, 3"/>
|
||||
</module>
|
||||
<module name="MissingSwitchDefault"/>
|
||||
<module name="RedundantThrows"/>
|
||||
<module name="SimplifyBooleanExpression"/>
|
||||
<module name="SimplifyBooleanReturn"/>
|
||||
<!-- Don't like errors for `final` missing
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+6
@@ -0,0 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -0,0 +1,244 @@
|
||||
#!/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/HEAD/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
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# 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*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# 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 \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+92
@@ -0,0 +1,92 @@
|
||||
@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=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
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% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1,130 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Displays a listing of all worlds that a player can enter.
|
||||
*/
|
||||
public class ListCommand extends PaginatedCoreCommand<String> {
|
||||
|
||||
public ListCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("World Listing");
|
||||
this.setCommandUsage("/mv list");
|
||||
this.setArgRange(0, 2);
|
||||
this.addKey("mvlist");
|
||||
this.addKey("mvl");
|
||||
this.addKey("mv list");
|
||||
this.setPermission("multiverse.core.list.worlds", "Displays a listing of all worlds that you can enter.", PermissionDefault.OP);
|
||||
this.setItemsPerPage(8); // SUPPRESS CHECKSTYLE: MagicNumberCheck
|
||||
}
|
||||
|
||||
private List<String> getFancyWorldList(Player p) {
|
||||
List<String> worldList = new ArrayList<String>();
|
||||
for (MultiverseWorld world : this.plugin.getMVWorldManager().getMVWorlds()) {
|
||||
|
||||
if (p != null && (!this.plugin.getMVPerms().canEnterWorld(p, world))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ChatColor color = ChatColor.GOLD;
|
||||
Environment env = world.getEnvironment();
|
||||
if (env == Environment.NETHER) {
|
||||
color = ChatColor.RED;
|
||||
} else if (env == Environment.NORMAL) {
|
||||
color = ChatColor.GREEN;
|
||||
} else if (env == Environment.THE_END) {
|
||||
color = ChatColor.AQUA;
|
||||
}
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(world.getColoredWorldString()).append(ChatColor.WHITE);
|
||||
builder.append(" - ").append(color).append(world.getEnvironment());
|
||||
if (world.isHidden()) {
|
||||
if (p == null || this.plugin.getMVPerms().hasPermission(p, "multiverse.core.modify", true)) {
|
||||
// Prefix hidden worlds with an "[H]"
|
||||
worldList.add(ChatColor.GRAY + "[H]" + builder.toString());
|
||||
}
|
||||
} else {
|
||||
worldList.add(builder.toString());
|
||||
}
|
||||
}
|
||||
for (String name : this.plugin.getMVWorldManager().getUnloadedWorlds()) {
|
||||
if (p == null || this.plugin.getMVPerms().hasPermission(p, "multiverse.access." + name, true)) {
|
||||
worldList.add(ChatColor.GRAY + name + " - UNLOADED");
|
||||
}
|
||||
}
|
||||
return worldList;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getFilteredItems(List<String> availableItems, String filter) {
|
||||
List<String> filtered = new ArrayList<String>();
|
||||
|
||||
for (String s : availableItems) {
|
||||
if (s.matches("(?i).*" + filter + ".*")) {
|
||||
filtered.add(s);
|
||||
}
|
||||
}
|
||||
return filtered;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getItemText(String item) {
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
sender.sendMessage(ChatColor.LIGHT_PURPLE + "====[ Multiverse World List ]====");
|
||||
Player p = null;
|
||||
if (sender instanceof Player) {
|
||||
p = (Player) sender;
|
||||
}
|
||||
|
||||
|
||||
FilterObject filterObject = this.getPageAndFilter(args);
|
||||
|
||||
List<String> availableWorlds = new ArrayList<String>(this.getFancyWorldList(p));
|
||||
if (filterObject.getFilter().length() > 0) {
|
||||
availableWorlds = this.getFilteredItems(availableWorlds, filterObject.getFilter());
|
||||
if (availableWorlds.size() == 0) {
|
||||
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE
|
||||
+ "No worlds matched your filter: " + ChatColor.AQUA + filterObject.getFilter());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
for (String c : availableWorlds) {
|
||||
sender.sendMessage(c);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int totalPages = (int) Math.ceil(availableWorlds.size() / (this.itemsPerPage + 0.0));
|
||||
|
||||
if (filterObject.getPage() > totalPages) {
|
||||
filterObject.setPage(totalPages);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.AQUA + " Page " + filterObject.getPage() + " of " + totalPages);
|
||||
|
||||
this.showPage(filterObject.getPage(), sender, availableWorlds);
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.BlockSafety;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Sets the spawn for a world.
|
||||
*/
|
||||
public class SetSpawnCommand extends MultiverseCommand {
|
||||
public SetSpawnCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Set World Spawn");
|
||||
this.setCommandUsage("/mv setspawn");
|
||||
this.setArgRange(0, 0);
|
||||
this.addKey("mvsetspawn");
|
||||
this.addKey("mvss");
|
||||
this.addKey("mv set spawn");
|
||||
this.addKey("mv setspawn");
|
||||
this.addKey("mvset spawn");
|
||||
this.addCommandExample("/mv set spawn");
|
||||
this.setPermission("multiverse.core.spawn.set", "Sets the spawn for the current world.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
setWorldSpawn(sender);
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the actual spawn-setting-work.
|
||||
*
|
||||
* @param sender The {@link CommandSender} that's setting the spawn.
|
||||
*/
|
||||
protected void setWorldSpawn(CommandSender sender) {
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
Location l = p.getLocation();
|
||||
World w = p.getWorld();
|
||||
MultiverseWorld foundWorld = this.plugin.getMVWorldManager().getMVWorld(w.getName());
|
||||
if (foundWorld != null) {
|
||||
foundWorld.setSpawnLocation(p.getLocation());
|
||||
BlockSafety bs = this.plugin.getBlockSafety();
|
||||
if (!bs.playerCanSpawnHereSafely(p.getLocation()) && foundWorld.getAdjustSpawn()) {
|
||||
sender.sendMessage("It looks like that location would normally be unsafe. But I trust you.");
|
||||
sender.sendMessage("I'm turning off the Safe-T-Teleporter for spawns to this world.");
|
||||
sender.sendMessage("If you want this turned back on just do:");
|
||||
sender.sendMessage(ChatColor.AQUA + "/mvm set adjustspawn true " + foundWorld.getAlias());
|
||||
foundWorld.setAdjustSpawn(false);
|
||||
}
|
||||
sender.sendMessage("Spawn was set to: " + plugin.getLocationManipulation().strCoords(p.getLocation()));
|
||||
} else {
|
||||
w.setSpawnLocation(l.getBlockX(), l.getBlockY(), l.getBlockZ());
|
||||
sender.sendMessage("Multiverse does not know about this world, only X,Y and Z set. Please import it to set the spawn fully (Pitch/Yaws).");
|
||||
}
|
||||
|
||||
} else {
|
||||
sender.sendMessage("You cannot use this command from the console.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
/*
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.getspout.spoutapi.gui.GenericButton;
|
||||
import org.getspout.spoutapi.gui.GenericPopup;
|
||||
import org.getspout.spoutapi.gui.PopupScreen;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Edit a world with spout.
|
||||
* /
|
||||
public class SpoutCommand extends MultiverseCommand {
|
||||
|
||||
public SpoutCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Edit World with Spout");
|
||||
this.setCommandUsage("/mv spout");
|
||||
this.setArgRange(0, 0);
|
||||
this.addKey("mv spout");
|
||||
this.setPermission("multiverse.core.spout", "Edit a world with spout.", PermissionDefault.OP);
|
||||
this.addCommandExample("/mv spout");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(ChatColor.RED + "This command must be run as a player!");
|
||||
return;
|
||||
}
|
||||
if (plugin.getSpout() == null) {
|
||||
sender.sendMessage(ChatColor.RED + "You need spout installed on this server to use it with Multiverse!");
|
||||
return;
|
||||
}
|
||||
SpoutPlayer p = (SpoutPlayer) sender;
|
||||
if (!p.isSpoutCraftEnabled()) {
|
||||
sender.sendMessage(ChatColor.RED + p.getName() + "You need to be using the Spoutcraft client to run this command!");
|
||||
return;
|
||||
}
|
||||
PopupScreen pop = new GenericPopup();
|
||||
GenericButton button = new GenericButton("Fish");
|
||||
// TO-DO maybe use constants for these
|
||||
// BEGIN CHECKSTYLE-SUPPRESSION: MagicNumberCheck
|
||||
button.setX(50);
|
||||
button.setY(50);
|
||||
button.setWidth(100);
|
||||
button.setHeight(40);
|
||||
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
|
||||
pop.attachWidget(this.plugin, button);
|
||||
sender.sendMessage(ChatColor.GREEN + "YAY!");
|
||||
p.getMainScreen().attachPopupScreen(pop);
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,123 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.event.MVVersionEvent;
|
||||
import com.onarandombox.MultiverseCore.utils.webpaste.BitlyURLShortener;
|
||||
import com.onarandombox.MultiverseCore.utils.webpaste.PasteFailedException;
|
||||
import com.onarandombox.MultiverseCore.utils.webpaste.PasteService;
|
||||
import com.onarandombox.MultiverseCore.utils.webpaste.PasteServiceFactory;
|
||||
import com.onarandombox.MultiverseCore.utils.webpaste.PasteServiceType;
|
||||
import com.onarandombox.MultiverseCore.utils.webpaste.URLShortener;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Dumps version info to the console.
|
||||
*/
|
||||
public class VersionCommand extends MultiverseCommand {
|
||||
private static final URLShortener SHORTENER = new BitlyURLShortener();
|
||||
|
||||
public VersionCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Multiverse Version");
|
||||
this.setCommandUsage("/mv version " + ChatColor.GOLD + "-[pb]");
|
||||
this.setArgRange(0, 1);
|
||||
this.addKey("mv version");
|
||||
this.addKey("mvv");
|
||||
this.addKey("mvversion");
|
||||
this.setPermission("multiverse.core.version",
|
||||
"Dumps version info to the console, optionally to pastie.org with -p or pastebin.com with a -b.", PermissionDefault.TRUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(final CommandSender sender, final List<String> args) {
|
||||
// Check if the command was sent from a Player.
|
||||
if (sender instanceof Player) {
|
||||
sender.sendMessage("Version info dumped to console. Please check your server logs.");
|
||||
}
|
||||
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append("[Multiverse-Core] Multiverse-Core Version: ").append(this.plugin.getDescription().getVersion()).append('\n');
|
||||
buffer.append("[Multiverse-Core] Bukkit Version: ").append(this.plugin.getServer().getVersion()).append('\n');
|
||||
buffer.append("[Multiverse-Core] Loaded Worlds: ").append(this.plugin.getMVWorldManager().getMVWorlds()).append('\n');
|
||||
buffer.append("[Multiverse-Core] Multiverse Plugins Loaded: ").append(this.plugin.getPluginCount()).append('\n');
|
||||
final boolean usingVault = plugin.getVaultHandler().getEconomy() != null;
|
||||
buffer.append("[Multiverse-Core] Using Vault: ").append(usingVault).append('\n');
|
||||
if (usingVault) {
|
||||
buffer.append("[Multiverse-Core] Economy being used: ").append(plugin.getVaultHandler().getEconomy().getName()).append('\n');
|
||||
} else {
|
||||
buffer.append("[Multiverse-Core] Economy being used: ").append(this.plugin.getBank().getEconUsed()).append('\n');
|
||||
}
|
||||
buffer.append("[Multiverse-Core] Permissions Plugin: ").append(this.plugin.getMVPerms().getType()).append('\n');
|
||||
buffer.append("[Multiverse-Core] Dumping Config Values: (version ")
|
||||
.append(this.plugin.getMVConfig().getVersion()).append(")").append('\n');
|
||||
buffer.append("[Multiverse-Core] messagecooldown: ").append(plugin.getMessaging().getCooldown()).append('\n');
|
||||
buffer.append("[Multiverse-Core] teleportcooldown: ").append(plugin.getMVConfig().getTeleportCooldown()).append('\n');
|
||||
buffer.append("[Multiverse-Core] worldnameprefix: ").append(plugin.getMVConfig().getPrefixChat()).append('\n');
|
||||
buffer.append("[Multiverse-Core] enforceaccess: ").append(plugin.getMVConfig().getEnforceAccess()).append('\n');
|
||||
buffer.append("[Multiverse-Core] displaypermerrors: ").append(plugin.getMVConfig().getDisplayPermErrors()).append('\n');
|
||||
buffer.append("[Multiverse-Core] teleportintercept: ").append(plugin.getMVConfig().getTeleportIntercept()).append('\n');
|
||||
buffer.append("[Multiverse-Core] firstspawnoverride: ").append(plugin.getMVConfig().getFirstSpawnOverride()).append('\n');
|
||||
buffer.append("[Multiverse-Core] firstspawnworld: ").append(plugin.getMVConfig().getFirstSpawnWorld()).append('\n');
|
||||
buffer.append("[Multiverse-Core] debug: ").append(plugin.getMVConfig().getGlobalDebug()).append('\n');
|
||||
buffer.append("[Multiverse-Core] Special Code: FRN002").append('\n');
|
||||
|
||||
MVVersionEvent versionEvent = new MVVersionEvent(buffer.toString());
|
||||
this.plugin.getServer().getPluginManager().callEvent(versionEvent);
|
||||
|
||||
// log to console
|
||||
final String data = versionEvent.getVersionInfo();
|
||||
String[] lines = data.split("\n");
|
||||
for (String line : lines) {
|
||||
Logging.info(line);
|
||||
}
|
||||
|
||||
this.plugin.getServer().getScheduler().scheduleAsyncDelayedTask(this.plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (args.size() == 1) {
|
||||
String pasteUrl;
|
||||
if (args.get(0).equalsIgnoreCase("-p")) {
|
||||
pasteUrl = postToService(PasteServiceType.PASTIE, true, data); // private post to pastie
|
||||
} else if (args.get(0).equalsIgnoreCase("-b")) {
|
||||
pasteUrl = postToService(PasteServiceType.PASTEBIN, true, data); // private post to pastie
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
sender.sendMessage("Version info dumped here: " + ChatColor.GREEN + pasteUrl);
|
||||
Logging.info("Version info dumped here: %s", pasteUrl);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the current contents of this.pasteBinBuffer to a web service.
|
||||
*
|
||||
* @param type Service type to send to
|
||||
* @param isPrivate Should the paste be marked as private.
|
||||
* @return URL of visible paste
|
||||
*/
|
||||
private static String postToService(PasteServiceType type, boolean isPrivate, String pasteData) {
|
||||
PasteService ps = PasteServiceFactory.getService(type, isPrivate);
|
||||
try {
|
||||
return SHORTENER.shorten(ps.postData(ps.encodeData(pasteData), ps.getPostURL()));
|
||||
} catch (PasteFailedException e) {
|
||||
System.out.print(e);
|
||||
return "Error posting to service";
|
||||
}
|
||||
}
|
||||
}
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2012. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.configuration;
|
||||
|
||||
/**
|
||||
* An "active" {@link MVConfigProperty} that uses the specified method to be "actually" set.
|
||||
* @param <T> The type of the config-property.
|
||||
* @deprecated This is deprecated.
|
||||
* @see MVConfigProperty
|
||||
*/
|
||||
@Deprecated
|
||||
public interface MVActiveConfigProperty<T> extends MVConfigProperty<T> {
|
||||
/**
|
||||
* Gets the method that will be executed.
|
||||
*
|
||||
* @return The name of the method in MVWorld to be called.
|
||||
*/
|
||||
String getMethod();
|
||||
|
||||
/**
|
||||
* Sets the method that will be executed.
|
||||
*
|
||||
* @param methodName The name of the method in MVWorld to be called.
|
||||
*/
|
||||
void setMethod(String methodName);
|
||||
|
||||
/**
|
||||
* Returns the class of the object we're looking at.
|
||||
* @return the class of the object we're looking at.
|
||||
*/
|
||||
Class<?> getPropertyClass();
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.configuration;
|
||||
|
||||
/**
|
||||
* A generic config-property.
|
||||
*
|
||||
* @param <T> The type of the config-property.
|
||||
* @deprecated This is deprecated.
|
||||
*/
|
||||
@Deprecated
|
||||
public interface MVConfigProperty<T> {
|
||||
/**
|
||||
* Gets the name of this property.
|
||||
*
|
||||
* @return The name of this property.
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Gets the value of this property.
|
||||
*
|
||||
* @return The value of this property.
|
||||
*/
|
||||
T getValue();
|
||||
|
||||
/**
|
||||
* Gets the string representation of this value.
|
||||
*
|
||||
* @return The value of this property as a string.
|
||||
*/
|
||||
String toString();
|
||||
|
||||
/**
|
||||
* Gets the help string for this.
|
||||
*
|
||||
* @return The value of this property as a string.
|
||||
*/
|
||||
String getHelp();
|
||||
|
||||
/**
|
||||
* Sets the value of this property.
|
||||
*
|
||||
* @param value The T representation of this value.
|
||||
* @return True the value was successfully set.
|
||||
*/
|
||||
boolean setValue(T value);
|
||||
|
||||
/**
|
||||
* This parseValue should be used with strings.
|
||||
*
|
||||
* @param value The string representation of the value to set.
|
||||
*
|
||||
* @return True if the value was set, false if not.
|
||||
*/
|
||||
boolean parseValue(String value);
|
||||
|
||||
/**
|
||||
* Gets the name of the config-node that this {@link MVConfigProperty} is saved as.
|
||||
*
|
||||
* @return The name of the config-node that this {@link MVConfigProperty} is saved as.
|
||||
*/
|
||||
String getConfigNode();
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.event;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when somebody requests version information about Multiverse.
|
||||
*/
|
||||
public class MVVersionEvent extends Event {
|
||||
|
||||
private final StringBuilder versionInfoBuilder;
|
||||
|
||||
public MVVersionEvent(String versionInfo) {
|
||||
this.versionInfoBuilder = new StringBuilder(versionInfo);
|
||||
}
|
||||
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the handler list. This is required by the event system.
|
||||
* @return A list of HANDLERS.
|
||||
*/
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the version-info currently saved in this event.
|
||||
* @return The version-info.
|
||||
*/
|
||||
public String getVersionInfo() {
|
||||
return this.versionInfoBuilder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends more version-info to the version-info currently saved in this event.
|
||||
* @param moreVersionInfo The version-info to add. Should end with '\n'.
|
||||
*/
|
||||
public void appendVersionInfo(String moreVersionInfo) {
|
||||
this.versionInfoBuilder.append(moreVersionInfo);
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.listeners;
|
||||
|
||||
import com.fernferret.allpay.AllPay;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.server.PluginDisableEvent;
|
||||
import org.bukkit.event.server.PluginEnableEvent;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Multiverse's Plugin {@link Listener}.
|
||||
*/
|
||||
public class MVPluginListener implements Listener {
|
||||
|
||||
private MultiverseCore plugin;
|
||||
|
||||
public MVPluginListener(MultiverseCore plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep an eye out for Plugins which we can utilize.
|
||||
* @param event The event.
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void pluginEnable(PluginEnableEvent event) {
|
||||
if (plugin.getVaultHandler().getEconomy() != null) {
|
||||
// Don't hook 2 economy plugins.
|
||||
return;
|
||||
}
|
||||
// Let AllPay handle all econ plugin loadings, only go for econ plugins we support
|
||||
if (Arrays.asList(AllPay.getValidEconPlugins()).contains(event.getPlugin().getDescription().getName())) {
|
||||
this.plugin.setBank(this.plugin.getBanker().loadEconPlugin());
|
||||
}
|
||||
|
||||
/*
|
||||
if (event.getPlugin().getDescription().getName().equals("Spout")) {
|
||||
this.plugin.setSpout();
|
||||
this.plugin.log(Level.INFO, "Spout integration enabled.");
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* We'll check if any of the plugins we rely on decide to Disable themselves.
|
||||
* @param event The event.
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void pluginDisable(PluginDisableEvent event) {
|
||||
// TODO: Disable econ when it disables.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,281 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.utils;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
|
||||
/**
|
||||
* Used to determine block/location-related facts.
|
||||
*
|
||||
* @deprecated Use instead: {@link com.onarandombox.MultiverseCore.api.BlockSafety} and {@link SimpleBlockSafety}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class BlockSafety {
|
||||
|
||||
/**
|
||||
* This function checks whether the block at the given coordinates are above air or not.
|
||||
* @param l The {@link Location} of the block.
|
||||
* @return True if the block at that {@link Location} is above air.
|
||||
*/
|
||||
public boolean isBlockAboveAir(Location l) {
|
||||
Location downOne = l.clone();
|
||||
downOne.setY(downOne.getY() - 1);
|
||||
return (downOne.getBlock().getType() == Material.AIR);
|
||||
}
|
||||
|
||||
// TODO maybe remove this?
|
||||
private boolean blockIsNotSafe(World world, double x, double y, double z) {
|
||||
return !playerCanSpawnHereSafely(world, x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a player can spawn safely at the given coordinates.
|
||||
* @param world The {@link World}.
|
||||
* @param x The x-coordinate.
|
||||
* @param y The y-coordinate.
|
||||
* @param z The z-coordinate.
|
||||
* @return True if a player can spawn safely at the given coordinates.
|
||||
*/
|
||||
public boolean playerCanSpawnHereSafely(World world, double x, double y, double z) {
|
||||
Location l = new Location(world, x, y, z);
|
||||
return playerCanSpawnHereSafely(l);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks whether the block at the coordinates given is safe or not by checking for Lava/Fire/Air
|
||||
* etc. This also ensures there is enough space for a player to spawn!
|
||||
*
|
||||
* @param l The {@link Location}
|
||||
* @return Whether the player can spawn safely at the given {@link Location}
|
||||
*/
|
||||
public boolean playerCanSpawnHereSafely(Location l) {
|
||||
if (l == null) {
|
||||
// Can't safely spawn at a null location!
|
||||
return false;
|
||||
}
|
||||
|
||||
World world = l.getWorld();
|
||||
Location actual = l.clone();
|
||||
Location upOne = l.clone();
|
||||
Location downOne = l.clone();
|
||||
upOne.setY(upOne.getY() + 1);
|
||||
downOne.setY(downOne.getY() - 1);
|
||||
|
||||
if (this.isSolidBlock(world.getBlockAt(actual).getType())
|
||||
|| this.isSolidBlock(upOne.getBlock().getType())) {
|
||||
Logging.finer("Error Here (Actual)? (%s)[%s]", actual.getBlock().getType(),
|
||||
this.isSolidBlock(actual.getBlock().getType()));
|
||||
Logging.finer("Error Here (upOne)? (%s)[%s]", upOne.getBlock().getType(),
|
||||
this.isSolidBlock(upOne.getBlock().getType()));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (downOne.getBlock().getType() == Material.LAVA || downOne.getBlock().getType() == Material.STATIONARY_LAVA) {
|
||||
Logging.finer("Error Here (downOne)? (%s)[%s]", downOne.getBlock().getType(),
|
||||
this.isSolidBlock(downOne.getBlock().getType()));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (downOne.getBlock().getType() == Material.FIRE) {
|
||||
Logging.finer("There's fire below! (%s)[%s]", actual.getBlock().getType(),
|
||||
this.isSolidBlock(actual.getBlock().getType()));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlockAboveAir(actual)) {
|
||||
Logging.finer("Is block above air [%s]", isBlockAboveAir(actual));
|
||||
Logging.finer("Has 2 blocks of water below [%s]", this.hasTwoBlocksofWaterBelow(actual));
|
||||
return this.hasTwoBlocksofWaterBelow(actual);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the location of the top block at the specified {@link Location}.
|
||||
* @param l Any {@link Location}.
|
||||
* @return The {@link Location} of the top-block.
|
||||
*/
|
||||
public Location getTopBlock(Location l) {
|
||||
Location check = l.clone();
|
||||
check.setY(127); // SUPPRESS CHECKSTYLE: MagicNumberCheck
|
||||
while (check.getY() > 0) {
|
||||
if (this.playerCanSpawnHereSafely(check)) {
|
||||
return check;
|
||||
}
|
||||
check.setY(check.getY() - 1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the location of the top block at the specified {@link Location}.
|
||||
* @param l Any {@link Location}.
|
||||
* @return The {@link Location} of the top-block.
|
||||
*/
|
||||
public Location getBottomBlock(Location l) {
|
||||
Location check = l.clone();
|
||||
check.setY(0);
|
||||
while (check.getY() < 127) { // SUPPRESS CHECKSTYLE: MagicNumberCheck
|
||||
if (this.playerCanSpawnHereSafely(check)) {
|
||||
return check;
|
||||
}
|
||||
check.setY(check.getY() + 1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* If someone has a better way of this... Please either tell us, or submit a pull request!
|
||||
*/
|
||||
private boolean isSolidBlock(Material type) {
|
||||
switch (type) {
|
||||
case AIR:
|
||||
return false;
|
||||
case SNOW:
|
||||
return false;
|
||||
case TRAP_DOOR:
|
||||
return false;
|
||||
case TORCH:
|
||||
return false;
|
||||
case YELLOW_FLOWER:
|
||||
return false;
|
||||
case RED_ROSE:
|
||||
return false;
|
||||
case RED_MUSHROOM:
|
||||
return false;
|
||||
case BROWN_MUSHROOM:
|
||||
return false;
|
||||
case REDSTONE:
|
||||
return false;
|
||||
case REDSTONE_WIRE:
|
||||
return false;
|
||||
case RAILS:
|
||||
return false;
|
||||
case POWERED_RAIL:
|
||||
return false;
|
||||
case REDSTONE_TORCH_ON:
|
||||
return false;
|
||||
case REDSTONE_TORCH_OFF:
|
||||
return false;
|
||||
case DEAD_BUSH:
|
||||
return false;
|
||||
case SAPLING:
|
||||
return false;
|
||||
case STONE_BUTTON:
|
||||
return false;
|
||||
case LEVER:
|
||||
return false;
|
||||
case LONG_GRASS:
|
||||
return false;
|
||||
case PORTAL:
|
||||
return false;
|
||||
case STONE_PLATE:
|
||||
return false;
|
||||
case WOOD_PLATE:
|
||||
return false;
|
||||
case SEEDS:
|
||||
return false;
|
||||
case SUGAR_CANE_BLOCK:
|
||||
return false;
|
||||
case WALL_SIGN:
|
||||
return false;
|
||||
case SIGN_POST:
|
||||
return false;
|
||||
case WOODEN_DOOR:
|
||||
return false;
|
||||
case STATIONARY_WATER:
|
||||
return false;
|
||||
case WATER:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an entity would be on track at the specified {@link Location}.
|
||||
* @param l The {@link Location}.
|
||||
* @return True if an entity would be on tracks at the specified {@link Location}.
|
||||
*/
|
||||
public boolean isEntitiyOnTrack(Location l) {
|
||||
Material currentBlock = l.getBlock().getType();
|
||||
return (currentBlock == Material.POWERED_RAIL || currentBlock == Material.DETECTOR_RAIL || currentBlock == Material.RAILS);
|
||||
}
|
||||
|
||||
// TODO maybe remove this?
|
||||
private void showDangers(Location l) {
|
||||
Location actual = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
|
||||
Location upOne = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
|
||||
Location downOne = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
|
||||
upOne.setY(upOne.getY() + 1);
|
||||
downOne.setY(downOne.getY() - 1);
|
||||
|
||||
System.out.print("Location Up: " + upOne.getBlock().getType());
|
||||
System.out.print(" " + upOne);
|
||||
System.out.print("Location: " + actual.getBlock().getType());
|
||||
System.out.print(" " + actual);
|
||||
System.out.print("Location Down: " + downOne.getBlock().getType());
|
||||
System.out.print(" " + downOne);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks recursively below a {@link Location} for 2 blocks of water.
|
||||
*
|
||||
* @param l The {@link Location}
|
||||
* @return Whether there are 2 blocks of water
|
||||
*/
|
||||
private boolean hasTwoBlocksofWaterBelow(Location l) {
|
||||
if (l.getBlockY() < 0) {
|
||||
return false;
|
||||
}
|
||||
Location oneBelow = l.clone();
|
||||
oneBelow.subtract(0, 1, 0);
|
||||
if (oneBelow.getBlock().getType() == Material.WATER || oneBelow.getBlock().getType() == Material.STATIONARY_WATER) {
|
||||
Location twoBelow = oneBelow.clone();
|
||||
twoBelow.subtract(0, 1, 0);
|
||||
return (oneBelow.getBlock().getType() == Material.WATER || oneBelow.getBlock().getType() == Material.STATIONARY_WATER);
|
||||
}
|
||||
if (oneBelow.getBlock().getType() != Material.AIR) {
|
||||
return false;
|
||||
}
|
||||
return hasTwoBlocksofWaterBelow(oneBelow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified {@link Minecart} can spawn safely.
|
||||
* @param cart The {@link Minecart}.
|
||||
* @return True if the minecart can spawn safely.
|
||||
*/
|
||||
public boolean canSpawnCartSafely(Minecart cart) {
|
||||
if (this.isBlockAboveAir(cart.getLocation())) {
|
||||
return true;
|
||||
}
|
||||
if (this.isEntitiyOnTrack(LocationManipulation.getNextBlock(cart))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified {@link Vehicle} can spawn safely.
|
||||
* @param vehicle The {@link Vehicle}.
|
||||
* @return True if the vehicle can spawn safely.
|
||||
*/
|
||||
public boolean canSpawnVehicleSafely(Vehicle vehicle) {
|
||||
if (this.isBlockAboveAir(vehicle.getLocation())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* File-utilities.
|
||||
*/
|
||||
public class FileUtils {
|
||||
protected FileUtils() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to delete a folder.
|
||||
*
|
||||
* @param file The folder to delete.
|
||||
* @return true if the folder was successfully deleted.
|
||||
*/
|
||||
public static boolean deleteFolder(File file) {
|
||||
if (file.exists()) {
|
||||
boolean ret = true;
|
||||
// If the file exists, and it has more than one file in it.
|
||||
if (file.isDirectory()) {
|
||||
for (File f : file.listFiles()) {
|
||||
ret = ret && deleteFolder(f);
|
||||
}
|
||||
}
|
||||
return ret && file.delete();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to delete the contents of a folder, without deleting the folder itself.
|
||||
*
|
||||
* @param file The folder whose contents to delete.
|
||||
* @return true if the contents were successfully deleted
|
||||
*/
|
||||
public static boolean deleteFolderContents(File file) {
|
||||
if (file.exists()) {
|
||||
boolean ret = true;
|
||||
// If the file exists, and it has more than one file in it.
|
||||
if (file.isDirectory()) {
|
||||
for (File f : file.listFiles()) {
|
||||
ret = ret && deleteFolder(f);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static final int COPY_BLOCK_SIZE = 1024;
|
||||
|
||||
/**
|
||||
* Helper method to copy the world-folder.
|
||||
* @param source Source-File
|
||||
* @param target Target-File
|
||||
* @param log A logger that logs the operation
|
||||
*
|
||||
* @return if it had success
|
||||
*/
|
||||
public static boolean copyFolder(File source, File target, Logger log) {
|
||||
InputStream in = null;
|
||||
OutputStream out = null;
|
||||
try {
|
||||
if (source.isDirectory()) {
|
||||
|
||||
if (!target.exists())
|
||||
target.mkdir();
|
||||
|
||||
String[] children = source.list();
|
||||
// for (int i=0; i<children.length; i++) {
|
||||
for (String child : children) {
|
||||
copyFolder(new File(source, child), new File(target, child), log);
|
||||
}
|
||||
} else {
|
||||
in = new FileInputStream(source);
|
||||
out = new FileOutputStream(target);
|
||||
|
||||
byte[] buf = new byte[COPY_BLOCK_SIZE];
|
||||
int len;
|
||||
while ((len = in.read(buf)) > 0) {
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch (FileNotFoundException e) {
|
||||
log.warning("Exception while copying file: " + e.getMessage());
|
||||
} catch (IOException e) {
|
||||
log.warning("Exception while copying file: " + e.getMessage());
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException ignore) { }
|
||||
}
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException ignore) { }
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.utils;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVDestination;
|
||||
import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
|
||||
import com.onarandombox.MultiverseCore.destination.CannonDestination;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.TravelAgent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* The Multiverse-{@link TravelAgent}.
|
||||
*/
|
||||
public class MVTravelAgent implements TravelAgent {
|
||||
private MVDestination destination;
|
||||
private MultiverseCore core;
|
||||
private Player player;
|
||||
|
||||
public MVTravelAgent(MultiverseCore multiverseCore, MVDestination d, Player p) {
|
||||
this.destination = d;
|
||||
this.core = multiverseCore;
|
||||
this.player = p;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public TravelAgent setSearchRadius(int radius) {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getSearchRadius() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public TravelAgent setCreationRadius(int radius) {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getCreationRadius() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean getCanCreatePortal() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setCanCreatePortal(boolean create) {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Location findOrCreate(Location location) {
|
||||
return this.getSafeLocation();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Location findPortal(Location location) {
|
||||
return this.getSafeLocation();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean createPortal(Location location) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private Location getSafeLocation() {
|
||||
// At this time, these can never use the velocity.
|
||||
if (this.destination instanceof CannonDestination) {
|
||||
this.core.log(Level.FINE, "Using Stock TP method. This cannon will have 0 velocity");
|
||||
}
|
||||
SafeTTeleporter teleporter = this.core.getSafeTTeleporter();
|
||||
Location newLoc = this.destination.getLocation(this.player);
|
||||
if (this.destination.useSafeTeleporter()) {
|
||||
newLoc = teleporter.getSafeLocation(this.player, this.destination);
|
||||
}
|
||||
if (newLoc == null) {
|
||||
return this.player.getLocation();
|
||||
}
|
||||
return newLoc;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,358 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.utils;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.BlockSafety;
|
||||
import com.onarandombox.MultiverseCore.api.MVDestination;
|
||||
import com.onarandombox.MultiverseCore.destination.InvalidDestination;
|
||||
import com.onarandombox.MultiverseCore.enums.TeleportResult;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* The {@link SafeTTeleporter}.
|
||||
*
|
||||
* @deprecated Use instead: {@link com.onarandombox.MultiverseCore.api.SafeTTeleporter} and {@link SimpleSafeTTeleporter}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class SafeTTeleporter {
|
||||
|
||||
private MultiverseCore plugin;
|
||||
private BlockSafety bs;
|
||||
|
||||
public SafeTTeleporter(MultiverseCore plugin) {
|
||||
this.plugin = plugin;
|
||||
this.bs = plugin.getBlockSafety();
|
||||
}
|
||||
|
||||
private static final int DEFAULT_TOLERANCE = 6;
|
||||
private static final int DEFAULT_RADIUS = 9;
|
||||
|
||||
/**
|
||||
* Gets the next safe location around the given location.
|
||||
* @param l A {@link Location}.
|
||||
* @return A safe {@link Location}.
|
||||
*/
|
||||
public Location getSafeLocation(Location l) {
|
||||
return this.getSafeLocation(l, DEFAULT_TOLERANCE, DEFAULT_RADIUS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the next safe location around the given location.
|
||||
* @param l A {@link Location}.
|
||||
* @param tolerance The tolerance.
|
||||
* @param radius The radius.
|
||||
* @return A safe {@link Location}.
|
||||
*/
|
||||
public Location getSafeLocation(Location l, int tolerance, int radius) {
|
||||
// Check around the player first in a configurable radius:
|
||||
Location safe = checkAboveAndBelowLocation(l, tolerance, radius);
|
||||
if (safe != null) {
|
||||
safe.setX(safe.getBlockX() + .5); // SUPPRESS CHECKSTYLE: MagicNumberCheck
|
||||
safe.setZ(safe.getBlockZ() + .5); // SUPPRESS CHECKSTYLE: MagicNumberCheck
|
||||
this.plugin.log(Level.FINE, "Hey! I found one: " + plugin.getLocationManipulation().strCoordsRaw(safe));
|
||||
} else {
|
||||
this.plugin.log(Level.FINE, "Uh oh! No safe place found!");
|
||||
}
|
||||
return safe;
|
||||
}
|
||||
|
||||
private Location checkAboveAndBelowLocation(Location l, int tolerance, int radius) {
|
||||
// Tolerance must be an even number:
|
||||
if (tolerance % 2 != 0) {
|
||||
tolerance += 1;
|
||||
}
|
||||
// We want half of it, so we can go up and down
|
||||
tolerance /= 2;
|
||||
this.plugin.log(Level.FINER, "Given Location of: " + plugin.getLocationManipulation().strCoordsRaw(l));
|
||||
this.plugin.log(Level.FINER, "Checking +-" + tolerance + " with a radius of " + radius);
|
||||
|
||||
// For now this will just do a straight up block.
|
||||
Location locToCheck = l.clone();
|
||||
// Check the main level
|
||||
Location safe = this.checkAroundLocation(locToCheck, radius);
|
||||
if (safe != null) {
|
||||
return safe;
|
||||
}
|
||||
// We've already checked zero right above this.
|
||||
int currentLevel = 1;
|
||||
while (currentLevel <= tolerance) {
|
||||
// Check above
|
||||
locToCheck = l.clone();
|
||||
locToCheck.add(0, currentLevel, 0);
|
||||
safe = this.checkAroundLocation(locToCheck, radius);
|
||||
if (safe != null) {
|
||||
return safe;
|
||||
}
|
||||
|
||||
// Check below
|
||||
locToCheck = l.clone();
|
||||
locToCheck.subtract(0, currentLevel, 0);
|
||||
safe = this.checkAroundLocation(locToCheck, radius);
|
||||
if (safe != null) {
|
||||
return safe;
|
||||
}
|
||||
currentLevel++;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* For my crappy algorithm, radius MUST be odd.
|
||||
*/
|
||||
private Location checkAroundLocation(Location l, int diameter) {
|
||||
if (diameter % 2 == 0) {
|
||||
diameter += 1;
|
||||
}
|
||||
Location checkLoc = l.clone();
|
||||
|
||||
// Start at 3, the min diameter around a block
|
||||
int loopcounter = 3;
|
||||
while (loopcounter <= diameter) {
|
||||
boolean foundSafeArea = checkAroundSpecificDiameter(checkLoc, loopcounter);
|
||||
// If a safe area was found:
|
||||
if (foundSafeArea) {
|
||||
// Return the checkLoc, it is the safe location.
|
||||
return checkLoc;
|
||||
}
|
||||
// Otherwise, let's reset our location
|
||||
checkLoc = l.clone();
|
||||
// And increment the radius
|
||||
loopcounter += 2;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean checkAroundSpecificDiameter(Location checkLoc, int circle) {
|
||||
// Adjust the circle to get how many blocks to step out.
|
||||
// A radius of 3 makes the block step 1
|
||||
// A radius of 5 makes the block step 2
|
||||
// A radius of 7 makes the block step 3
|
||||
// ...
|
||||
int adjustedCircle = ((circle - 1) / 2);
|
||||
checkLoc.add(adjustedCircle, 0, 0);
|
||||
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
|
||||
return true;
|
||||
}
|
||||
// Now we go to the right that adjustedCircle many
|
||||
for (int i = 0; i < adjustedCircle; i++) {
|
||||
checkLoc.add(0, 0, 1);
|
||||
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Then down adjustedCircle *2
|
||||
for (int i = 0; i < adjustedCircle * 2; i++) {
|
||||
checkLoc.add(-1, 0, 0);
|
||||
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Then left adjustedCircle *2
|
||||
for (int i = 0; i < adjustedCircle * 2; i++) {
|
||||
checkLoc.add(0, 0, -1);
|
||||
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Then up Then left adjustedCircle *2
|
||||
for (int i = 0; i < adjustedCircle * 2; i++) {
|
||||
checkLoc.add(1, 0, 0);
|
||||
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Then finish up by doing adjustedCircle - 1
|
||||
for (int i = 0; i < adjustedCircle - 1; i++) {
|
||||
checkLoc.add(0, 0, 1);
|
||||
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Safely teleport the entity to the MVDestination. This will perform checks to see if the place is safe, and if
|
||||
* it's not, will adjust the final destination accordingly.
|
||||
*
|
||||
* @param teleporter Person who performed the teleport command.
|
||||
* @param teleportee Entity to teleport
|
||||
* @param d Destination to teleport them to
|
||||
* @return true for success, false for failure
|
||||
*/
|
||||
public TeleportResult safelyTeleport(CommandSender teleporter, Entity teleportee, MVDestination d) {
|
||||
if (d instanceof InvalidDestination) {
|
||||
this.plugin.log(Level.FINER, "Entity tried to teleport to an invalid destination");
|
||||
return TeleportResult.FAIL_INVALID;
|
||||
}
|
||||
Player teleporteePlayer = null;
|
||||
if (teleportee instanceof Player) {
|
||||
teleporteePlayer = ((Player) teleportee);
|
||||
} else if (teleportee.getPassenger() instanceof Player) {
|
||||
teleporteePlayer = ((Player) teleportee.getPassenger());
|
||||
}
|
||||
|
||||
if (teleporteePlayer == null) {
|
||||
return TeleportResult.FAIL_INVALID;
|
||||
}
|
||||
MultiverseCore.addPlayerToTeleportQueue(teleporter.getName(), teleporteePlayer.getName());
|
||||
|
||||
Location safeLoc = d.getLocation(teleportee);
|
||||
if (d.useSafeTeleporter()) {
|
||||
safeLoc = this.getSafeLocation(teleportee, d);
|
||||
}
|
||||
|
||||
if (safeLoc != null) {
|
||||
if (teleportee.teleport(safeLoc)) {
|
||||
if (!d.getVelocity().equals(new Vector(0, 0, 0))) {
|
||||
teleportee.setVelocity(d.getVelocity());
|
||||
}
|
||||
return TeleportResult.SUCCESS;
|
||||
}
|
||||
return TeleportResult.FAIL_OTHER;
|
||||
}
|
||||
return TeleportResult.FAIL_UNSAFE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Safely teleport the entity to the Location. This may perform checks to
|
||||
* see if the place is safe, and if
|
||||
* it's not, will adjust the final destination accordingly.
|
||||
*
|
||||
* @param teleporter Person who issued the teleport command.
|
||||
* @param teleportee Entity to teleport.
|
||||
* @param location Location to teleport them to.
|
||||
* @param safely Should the destination be checked for safety before teleport?
|
||||
* @return true for success, false for failure.
|
||||
*/
|
||||
public TeleportResult safelyTeleport(CommandSender teleporter, Entity teleportee, Location location, boolean safely) {
|
||||
if (safely) {
|
||||
location = this.getSafeLocation(location);
|
||||
}
|
||||
|
||||
if (location != null) {
|
||||
if (teleportee.teleport(location)) {
|
||||
return TeleportResult.SUCCESS;
|
||||
}
|
||||
return TeleportResult.FAIL_OTHER;
|
||||
}
|
||||
return TeleportResult.FAIL_UNSAFE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a safe location for the entity to spawn at.
|
||||
*
|
||||
* @param e The entity to spawn
|
||||
* @param d The MVDestination to take the entity to.
|
||||
* @return A new location to spawn the entity at.
|
||||
*/
|
||||
public Location getSafeLocation(Entity e, MVDestination d) {
|
||||
Location l = d.getLocation(e);
|
||||
if (this.bs.playerCanSpawnHereSafely(l)) {
|
||||
plugin.log(Level.FINE, "The first location you gave me was safe.");
|
||||
return l;
|
||||
}
|
||||
if (e instanceof Minecart) {
|
||||
Minecart m = (Minecart) e;
|
||||
if (!this.bs.canSpawnCartSafely(m)) {
|
||||
return null;
|
||||
}
|
||||
} else if (e instanceof Vehicle) {
|
||||
Vehicle v = (Vehicle) e;
|
||||
if (!this.bs.canSpawnVehicleSafely(v)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Location safeLocation = this.getSafeLocation(l);
|
||||
if (safeLocation != null) {
|
||||
// Add offset to account for a vehicle on dry land!
|
||||
if (e instanceof Minecart && !this.bs.isEntitiyOnTrack(safeLocation)) {
|
||||
safeLocation.setY(safeLocation.getBlockY() + .5);
|
||||
this.plugin.log(Level.FINER, "Player was inside a minecart. Offsetting Y location.");
|
||||
}
|
||||
this.plugin.log(Level.FINE, "Had to look for a bit, but I found a safe place for ya!");
|
||||
return safeLocation;
|
||||
}
|
||||
if (e instanceof Player) {
|
||||
Player p = (Player) e;
|
||||
this.plugin.getMessaging().sendMessage(p, "No safe locations found!", false);
|
||||
this.plugin.log(Level.FINER, "No safe location found for " + p.getName());
|
||||
} else if (e.getPassenger() instanceof Player) {
|
||||
Player p = (Player) e.getPassenger();
|
||||
this.plugin.getMessaging().sendMessage(p, "No safe locations found!", false);
|
||||
this.plugin.log(Level.FINER, "No safe location found for " + p.getName());
|
||||
}
|
||||
this.plugin.log(Level.FINE, "Sorry champ, you're basically trying to teleport into a minefield. I should just kill you now.");
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a portal-block next to the specified {@link Location}.
|
||||
* @param l The {@link Location}
|
||||
* @return The next portal-block's {@link Location}.
|
||||
*/
|
||||
public static Location findPortalBlockNextTo(Location l) {
|
||||
Block b = l.getWorld().getBlockAt(l);
|
||||
Location foundLocation = null;
|
||||
if (b.getType() == Material.PORTAL) {
|
||||
return l;
|
||||
}
|
||||
if (b.getRelative(BlockFace.NORTH).getType() == Material.PORTAL) {
|
||||
foundLocation = getCloserBlock(l, b.getRelative(BlockFace.NORTH).getLocation(), foundLocation);
|
||||
}
|
||||
if (b.getRelative(BlockFace.SOUTH).getType() == Material.PORTAL) {
|
||||
foundLocation = getCloserBlock(l, b.getRelative(BlockFace.SOUTH).getLocation(), foundLocation);
|
||||
}
|
||||
if (b.getRelative(BlockFace.EAST).getType() == Material.PORTAL) {
|
||||
foundLocation = getCloserBlock(l, b.getRelative(BlockFace.EAST).getLocation(), foundLocation);
|
||||
}
|
||||
if (b.getRelative(BlockFace.WEST).getType() == Material.PORTAL) {
|
||||
foundLocation = getCloserBlock(l, b.getRelative(BlockFace.WEST).getLocation(), foundLocation);
|
||||
}
|
||||
return foundLocation;
|
||||
}
|
||||
|
||||
private static Location getCloserBlock(Location source, Location blockA, Location blockB) {
|
||||
// If B wasn't given, return a.
|
||||
if (blockB == null) {
|
||||
return blockA;
|
||||
}
|
||||
// Center our calculations
|
||||
blockA.add(.5, 0, .5);
|
||||
blockB.add(.5, 0, .5);
|
||||
|
||||
// Retrieve the distance to the normalized blocks
|
||||
double testA = source.distance(blockA);
|
||||
double testB = source.distance(blockB);
|
||||
|
||||
// Compare and return
|
||||
if (testA <= testB) {
|
||||
return blockA;
|
||||
}
|
||||
return blockB;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.utils;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/*
|
||||
* Apparently this isn't used and I don't know if we'll ever use this,
|
||||
* so I'm just going to deprecate it for now and suppress the warnings.
|
||||
*
|
||||
* BEGIN CHECKSTYLE-SUPPRESSION: ALL
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated Currently unused.
|
||||
*/
|
||||
@Deprecated
|
||||
public class UpdateChecker {
|
||||
|
||||
public static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
private Timer timer = new Timer(); // Create a new Timer.
|
||||
|
||||
private String name; // Hold the Plugins Name.
|
||||
private String cversion; // Hold the Plugins Current Version.
|
||||
|
||||
public UpdateChecker(String name, String version) {
|
||||
this.name = name;
|
||||
this.cversion = version;
|
||||
|
||||
int delay = 0; // No Delay, fire the first check instantly.
|
||||
int period = 1800; // Delay 30 Minutes
|
||||
|
||||
this.timer.scheduleAtFixedRate(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
checkUpdate();
|
||||
}
|
||||
}, delay * 1000, period * 1000);
|
||||
}
|
||||
|
||||
public void checkUpdate() {
|
||||
BufferedReader rd = null;
|
||||
try {
|
||||
URL url = new URL("http://bukkit.onarandombox.com/multiverse/version.php?n=" + URLEncoder.encode(this.name, "UTF-8") + "&v=" + this.cversion);
|
||||
URLConnection conn = url.openConnection();
|
||||
conn.setReadTimeout(2000); // 2000 = 2 Seconds.
|
||||
|
||||
int code = ((HttpURLConnection) conn).getResponseCode();
|
||||
|
||||
if (code != 200) {
|
||||
return;
|
||||
}
|
||||
|
||||
rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
String line;
|
||||
String version = null;
|
||||
|
||||
while ((line = rd.readLine()) != null) {
|
||||
if (version == null) {
|
||||
version = line;
|
||||
}
|
||||
}
|
||||
|
||||
if (version == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String v1 = normalisedVersion(version);
|
||||
String v2 = normalisedVersion(this.cversion);
|
||||
|
||||
int compare = v1.compareTo(v2);
|
||||
|
||||
if (compare > 0) {
|
||||
Logging.info("[%s] - Update Available (%s)", this.name, version);
|
||||
}
|
||||
|
||||
rd.close();
|
||||
} catch (Exception e) {
|
||||
// No need to alert the user of any error here... it's not important.
|
||||
} finally {
|
||||
if (rd != null) {
|
||||
try {
|
||||
rd.close();
|
||||
} catch (IOException ignore) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given Version String to a Normalized Version String so we can compare it.
|
||||
*
|
||||
* @param version The version string
|
||||
* @return The normalized version string
|
||||
*/
|
||||
public static String normalisedVersion(String version) {
|
||||
return normalisedVersion(version, ".", 4);
|
||||
}
|
||||
|
||||
public static String normalisedVersion(String version, String sep, int maxWidth) {
|
||||
String[] split = Pattern.compile(sep, Pattern.LITERAL).split(version);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String s : split) {
|
||||
sb.append(String.format("%" + maxWidth + 's', s));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* END CHECKSTYLE-SUPPRESSION: ALL
|
||||
*/
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.utils.webpaste;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* An {@link URLShortener} using {@code bit.ly}.
|
||||
*/
|
||||
public class BitlyURLShortener extends HttpAPIClient implements URLShortener {
|
||||
private static final String GENERIC_BITLY_REQUEST_FORMAT = "https://api-ssl.bitly.com/v3/shorten?format=txt&apiKey=%s&login=%s&longUrl=%s";
|
||||
|
||||
// I think it's no problem that these are public
|
||||
private static final String USERNAME = "multiverse2";
|
||||
private static final String API_KEY = "R_9dbff4862a3bc0c4218a7d78cc10d0e0";
|
||||
|
||||
public BitlyURLShortener() {
|
||||
super(String.format(GENERIC_BITLY_REQUEST_FORMAT, API_KEY, USERNAME, "%s"));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String shorten(String longUrl) {
|
||||
try {
|
||||
String result = this.exec(longUrl);
|
||||
if (!result.startsWith("http://j.mp/")) // ... then it's failed :/
|
||||
throw new IOException(result);
|
||||
return result;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return longUrl; // sorry ...
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.utils.webpaste;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
/**
|
||||
* HTTP API-client.
|
||||
*/
|
||||
public abstract class HttpAPIClient {
|
||||
/**
|
||||
* The URL for this API-request.
|
||||
*/
|
||||
protected final String urlFormat;
|
||||
|
||||
public HttpAPIClient(String urlFormat) {
|
||||
this.urlFormat = urlFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes this API-Request.
|
||||
* @param args Format-args.
|
||||
* @return The result (as text).
|
||||
* @throws IOException When the I/O-operation failed.
|
||||
*/
|
||||
protected final String exec(Object... args) throws IOException {
|
||||
|
||||
URLConnection conn = new URL(String.format(this.urlFormat, args)).openConnection();
|
||||
conn.connect();
|
||||
StringBuilder ret = new StringBuilder();
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
while (!reader.ready()); // wait until reader is ready, may not be necessary, SUPPRESS CHECKSTYLE: EmptyStatement
|
||||
|
||||
while (reader.ready()) {
|
||||
ret.append(reader.readLine()).append('\n');
|
||||
}
|
||||
} finally {
|
||||
if (reader != null) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException ignore) { }
|
||||
}
|
||||
}
|
||||
return ret.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.utils.webpaste;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* An interface to a web-based text-pasting service. Classes implementing this
|
||||
* interface should implement its methods to send data to an online text-sharing
|
||||
* service, such as pastebin.com. Conventionally, a paste is accomplished by (given
|
||||
* some PasteService instance ps):
|
||||
*
|
||||
* {@code ps.postData(ps.encodeData(someString), ps.getPostURL());}
|
||||
*
|
||||
* Services that provide a distinction between "public" and "private" pastes
|
||||
* should implement a custom constructor that specifies which kind the PasteService
|
||||
* instance is submitting; an example of this is the PastiePasteService class.
|
||||
*/
|
||||
public interface PasteService {
|
||||
|
||||
/**
|
||||
* Encode the given String data into a format suitable for transmission in an HTTP request.
|
||||
*
|
||||
* @param data The raw data to encode.
|
||||
* @return A URL-encoded string.
|
||||
*/
|
||||
String encodeData(String data);
|
||||
|
||||
/**
|
||||
* Get the URL to which this paste service sends new pastes.
|
||||
*
|
||||
* @return The URL that will be accessed to complete the paste.
|
||||
*/
|
||||
URL getPostURL();
|
||||
|
||||
/**
|
||||
* Post encoded data to the Web.
|
||||
*
|
||||
* @param encodedData A URL-encoded String containing the full request to post to
|
||||
* the given URL. Can be the result of calling #encodeData().
|
||||
* @param url The URL to which to paste. Can be the result of calling #getPostURL().
|
||||
* @throws PasteFailedException When pasting/posting the data failed.
|
||||
* @return The URL at which the new paste is visible.
|
||||
*/
|
||||
String postData(String encodedData, URL url) throws PasteFailedException;
|
||||
|
||||
}
|
||||
-89
@@ -1,89 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.utils.webpaste;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
/**
|
||||
* Pastes to {@code pastebin.com}.
|
||||
*/
|
||||
public class PastebinPasteService implements PasteService {
|
||||
|
||||
private boolean isPrivate;
|
||||
|
||||
public PastebinPasteService(boolean isPrivate) {
|
||||
this.isPrivate = isPrivate;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public URL getPostURL() {
|
||||
try {
|
||||
return new URL("http://pastebin.com/api/api_post.php");
|
||||
} catch (MalformedURLException e) {
|
||||
return null; // should never hit here
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String encodeData(String data) {
|
||||
try {
|
||||
String encData = URLEncoder.encode("api_dev_key", "UTF-8") + "=" + URLEncoder.encode("d61d68d31e8e0392b59b50b277411c71", "UTF-8");
|
||||
encData += "&" + URLEncoder.encode("api_option", "UTF-8") + "=" + URLEncoder.encode("paste", "UTF-8");
|
||||
encData += "&" + URLEncoder.encode("api_paste_code", "UTF-8") + "=" + URLEncoder.encode(data, "UTF-8");
|
||||
encData += "&" + URLEncoder.encode("api_paste_private", "UTF-8") + "=" + URLEncoder.encode(this.isPrivate ? "1" : "0", "UTF-8");
|
||||
encData += "&" + URLEncoder.encode("api_paste_format", "UTF-8") + "=" + URLEncoder.encode("yaml", "UTF-8");
|
||||
return encData;
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
return ""; // should never hit here
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String postData(String encodedData, URL url) throws PasteFailedException {
|
||||
OutputStreamWriter wr = null;
|
||||
BufferedReader rd = null;
|
||||
try {
|
||||
URLConnection conn = url.openConnection();
|
||||
conn.setDoOutput(true);
|
||||
wr = new OutputStreamWriter(conn.getOutputStream());
|
||||
wr.write(encodedData);
|
||||
wr.flush();
|
||||
|
||||
rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
String line;
|
||||
String pastebinUrl = "";
|
||||
while ((line = rd.readLine()) != null) {
|
||||
pastebinUrl = line;
|
||||
}
|
||||
return pastebinUrl;
|
||||
} catch (Exception e) {
|
||||
throw new PasteFailedException(e);
|
||||
} finally {
|
||||
if (wr != null) {
|
||||
try {
|
||||
wr.close();
|
||||
} catch (IOException ignore) { }
|
||||
}
|
||||
if (rd != null) {
|
||||
try {
|
||||
rd.close();
|
||||
} catch (IOException ignore) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-107
@@ -1,107 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.utils.webpaste;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Pastes to {@code pastie.org}.
|
||||
*/
|
||||
public class PastiePasteService implements PasteService {
|
||||
|
||||
private boolean isPrivate;
|
||||
|
||||
public PastiePasteService(boolean isPrivate) {
|
||||
this.isPrivate = isPrivate;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public URL getPostURL() {
|
||||
try {
|
||||
return new URL("http://pastie.org/pastes");
|
||||
} catch (MalformedURLException e) {
|
||||
return null; // should never hit here
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String encodeData(String data) {
|
||||
try {
|
||||
String encData = URLEncoder.encode("paste[authorization]", "UTF-8") + "=" + URLEncoder.encode("burger", "UTF-8"); // burger is magic
|
||||
encData += "&" + URLEncoder.encode("paste[restricted]", "UTF-8") + "=" + URLEncoder.encode(this.isPrivate ? "1" : "0", "UTF-8");
|
||||
encData += "&" + URLEncoder.encode("paste[parser_id]", "UTF-8") + "=" + URLEncoder.encode("6", "UTF-8"); // 6 is plain text
|
||||
encData += "&" + URLEncoder.encode("paste[body]", "UTF-8") + "=" + URLEncoder.encode(data, "UTF-8");
|
||||
return encData;
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
return ""; // should never hit here
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String postData(String encodedData, URL url) throws PasteFailedException {
|
||||
OutputStreamWriter wr = null;
|
||||
BufferedReader rd = null;
|
||||
try {
|
||||
URLConnection conn = url.openConnection();
|
||||
conn.setDoOutput(true);
|
||||
wr = new OutputStreamWriter(conn.getOutputStream());
|
||||
wr.write(encodedData);
|
||||
wr.flush();
|
||||
|
||||
rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
String line;
|
||||
String pastieUrl = "";
|
||||
Pattern pastiePattern = this.getURLMatchingPattern();
|
||||
while ((line = rd.readLine()) != null) {
|
||||
Matcher m = pastiePattern.matcher(line);
|
||||
if (m.matches()) {
|
||||
String pastieID = m.group(1);
|
||||
pastieUrl = this.formatURL(pastieID);
|
||||
}
|
||||
}
|
||||
return pastieUrl;
|
||||
} catch (Exception e) {
|
||||
throw new PasteFailedException(e);
|
||||
} finally {
|
||||
if (wr != null) {
|
||||
try {
|
||||
wr.close();
|
||||
} catch (IOException ignore) { }
|
||||
}
|
||||
if (rd != null) {
|
||||
try {
|
||||
rd.close();
|
||||
} catch (IOException ignore) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Pattern getURLMatchingPattern() {
|
||||
if (this.isPrivate) {
|
||||
return Pattern.compile(".*http://pastie.org/.*key=([0-9a-z]+).*");
|
||||
} else {
|
||||
return Pattern.compile(".*http://pastie.org/([0-9]+).*");
|
||||
}
|
||||
}
|
||||
|
||||
private String formatURL(String pastieID) {
|
||||
return "http://pastie.org/" + (this.isPrivate ? "private/" : "") + pastieID;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.utils.webpaste;
|
||||
|
||||
/**
|
||||
* URL-Shortener.
|
||||
*/
|
||||
public interface URLShortener {
|
||||
/**
|
||||
* Shorten an URL.
|
||||
* @param longUrl The long form.
|
||||
* @return The shortened URL.
|
||||
*/
|
||||
String shorten(String longUrl);
|
||||
}
|
||||
@@ -1,217 +0,0 @@
|
||||
name: Multiverse-Core
|
||||
main: com.onarandombox.MultiverseCore.MultiverseCore
|
||||
authors: ['Rigby', 'fernferret', 'lithium3141', 'main--']
|
||||
version: maven-version-number
|
||||
commands:
|
||||
mv:
|
||||
description: Generic Multiverse Command
|
||||
usage: /<command>
|
||||
mvcreate:
|
||||
description: World create command
|
||||
usage: |
|
||||
/<command> <world> <environment>
|
||||
/<command> creative normal -- Creates a world called 'creative' with a NORMAL environment.
|
||||
/<command> hellworld nether -- Creates a world called 'hellworld' with a NETHER environment.
|
||||
mvc:
|
||||
description: World create command
|
||||
usage: |
|
||||
/<command> <world> <environment>
|
||||
/<command> creative normal -- Creates a world called 'creative' with a NORMAL environment.
|
||||
/<command> hellworld nether -- Creates a world called 'hellworld' with a NETHER environment.
|
||||
mvimport:
|
||||
description: World import command
|
||||
usage: |
|
||||
/<command> <world> <environment>
|
||||
/<command> creative normal -- Imports an existing world called 'creative' with a NORMAL environment.
|
||||
/<command> hellworld nether -- Imports an existing world called 'hellworld' with a NETHER environment.
|
||||
mvim:
|
||||
description: World import command
|
||||
usage: |
|
||||
/<command> <world> <environment>
|
||||
/<command> creative normal -- Imports an existing world called 'creative' with a NORMAL environment.
|
||||
/<command> hellworld nether -- Imports an existing world called 'hellworld' with a NETHER environment.
|
||||
mvremove:
|
||||
description: World remove command
|
||||
usage: |
|
||||
/<command> <world>
|
||||
mvdelete:
|
||||
description: World delete command
|
||||
usage: |
|
||||
/<command> <world>
|
||||
mvunload:
|
||||
description: World unload command
|
||||
usage: |
|
||||
/<command> <world>
|
||||
mvmodify:
|
||||
description: Modify the settings of an existing world
|
||||
usage: |
|
||||
/<command> <world> <option>:<value>
|
||||
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
|
||||
mvmset:
|
||||
description: Modify the settings of an existing world
|
||||
usage: |
|
||||
/<command> <world> <option>:<value>
|
||||
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
|
||||
mvmadd:
|
||||
description: Modify the settings of an existing world
|
||||
usage: |
|
||||
/<command> <world> <option>:<value>
|
||||
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
|
||||
mvmremove:
|
||||
description: Modify the settings of an existing world
|
||||
usage: |
|
||||
/<command> <world> <option>:<value>
|
||||
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
|
||||
mvmclear:
|
||||
description: Modify the settings of an existing world
|
||||
usage: |
|
||||
/<command> <world> <option>:<value>
|
||||
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
|
||||
mvm:
|
||||
description: Modify the settings of an existing world
|
||||
usage: |
|
||||
/<command> <world> <option>:<value>
|
||||
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
|
||||
mvtp:
|
||||
description: Command to teleport between Worlds
|
||||
usage: |
|
||||
/<command> <world>[:spawn]
|
||||
Example: /<command> creative - Teleports you to the relevant location in the 'creative' world.
|
||||
Example: /<command> creative:spawn - Teleports you to the spawn of the 'creative' world.
|
||||
mvlist:
|
||||
description: Print list of loaded Worlds
|
||||
usage: |
|
||||
/<command> [environment]
|
||||
Example: /<command> NETHER - Shows all NETHER Worlds.
|
||||
Example: /<command> NORMAL - Shows all NORMAL Worlds.
|
||||
mvl:
|
||||
description: Print list of loaded Worlds
|
||||
usage: |
|
||||
/<command> [environment]
|
||||
Example: /<command> NETHER - Shows all NETHER Worlds.
|
||||
Example: /<command> NORMAL - Shows all NORMAL Worlds.
|
||||
mvsetspawn:
|
||||
description: Set the spawn area for a particular world
|
||||
usage: /<command> -- Sets the spawn area of the current world to your location.
|
||||
mvset:
|
||||
description: Set the spawn area for a particular world
|
||||
usage: /<command> -- Sets the spawn area of the current world to your location.
|
||||
mvss:
|
||||
description: Set the spawn area for a particular world
|
||||
usage: /<command> -- Sets the spawn area of the current world to your location.
|
||||
mvspawn:
|
||||
description: Teleport to the spawn area
|
||||
usage: /<command> -- Teleports you to the spawn area of your current world.
|
||||
mvs:
|
||||
description: Teleport to the spawn area
|
||||
usage: /<command> -- Teleports you to the spawn area of your current world.
|
||||
mvcoord:
|
||||
description: Display World, Coordinates, Direction & Compression for a world.
|
||||
usage: |
|
||||
/<command> [world]
|
||||
/<command> -- Shows the relevant coordinates in your current world.
|
||||
/<command> creative -- Shows the relevant coordinates if you were in the 'creative' world.
|
||||
mvc:
|
||||
description: Display World, Coordinates, Direction & Compression for a world.
|
||||
usage: |
|
||||
/<command> [world]
|
||||
/<command> -- Shows the relevant coordinates in your current world.
|
||||
/<command> creative -- Shows the relevant coordinates if you were in the 'creative' world.
|
||||
mvwho:
|
||||
description: Display online users per world.
|
||||
usage: |
|
||||
/<command> [world]
|
||||
/<command> -- Shows who is online in each world.
|
||||
/<command> creative -- Shows who is online in the 'creative' world.
|
||||
mvw:
|
||||
description: Display online users per world.
|
||||
usage: |
|
||||
/<command> [world]
|
||||
/<command> -- Shows who is online in each world.
|
||||
/<command> creative -- Shows who is online in the 'creative' world.
|
||||
mvreload:
|
||||
description: Reload Configuration files.
|
||||
usage: /<command>
|
||||
mvr:
|
||||
description: Reload Configuration files.
|
||||
usage: /<command>
|
||||
mvpurge:
|
||||
description: Purge the targetted world of creatures.
|
||||
usage: |
|
||||
/<command> [world] [creatures]
|
||||
/<command> -- Purges the players world of all creatures.
|
||||
/<command> creative * -- Purges the creative world of all Creatures.
|
||||
/<command> creative creeper -- Purges the creative world of all CREEPERS.
|
||||
mvconfirm:
|
||||
description: Confirms sensitive decisions like deleting a world.
|
||||
usage: |
|
||||
/<command>
|
||||
mvinfo:
|
||||
description: Gets world info.
|
||||
usage: |
|
||||
/<command> [world]
|
||||
mvi:
|
||||
description: Gets world info.
|
||||
usage: |
|
||||
/<command> [world]
|
||||
mvenv:
|
||||
description: Tells the user all possible environment types.
|
||||
usage: |
|
||||
/<command>
|
||||
mvv:
|
||||
description: Prints out version info.
|
||||
usage: |
|
||||
/<command>
|
||||
mvversion:
|
||||
description: Prints out version info.
|
||||
usage: |
|
||||
/<command>
|
||||
mvco:
|
||||
description: Displays the player's coordinates.
|
||||
usage: |
|
||||
/<command>
|
||||
mvh:
|
||||
description: Displays the Multiverse Help.
|
||||
usage: |
|
||||
/<command>
|
||||
mvsearch:
|
||||
description: Displays the Multiverse Help.
|
||||
usage: |
|
||||
/<command>
|
||||
mvhelp:
|
||||
description: Displays the Multiverse Help.
|
||||
usage: |
|
||||
/<command>
|
||||
mvdebug:
|
||||
description: Turns on debugging.
|
||||
usage: |
|
||||
/<command>
|
||||
mvgenerators:
|
||||
description: Displays all found world generators.
|
||||
usage: |
|
||||
/<command>
|
||||
mvgens:
|
||||
description: Displays all found world generators.
|
||||
usage: |
|
||||
/<command>
|
||||
mvload:
|
||||
description: Loads a world into Multiverse.
|
||||
usage: |
|
||||
/<command> {WORLD}
|
||||
mvregen:
|
||||
description: Regenerates a world Multiverse already knows about.
|
||||
usage: |
|
||||
/<command> {WORLD}
|
||||
mvscript:
|
||||
description: Runs a script from the Multiverse scripts directory.
|
||||
usage: |
|
||||
/<command> {script} [target]
|
||||
mvclone:
|
||||
description: World clone command
|
||||
usage: |
|
||||
/<command> <world> <environment>
|
||||
/<command> creative grieftastic -- Creates a world called 'grieftastic' exactly identical to the world 'creative'.
|
||||
mvsilent:
|
||||
description: Reduces startup messages
|
||||
usage: |
|
||||
/<command> [true|false]
|
||||
@@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.mvplugin</groupId>
|
||||
<artifactId>MultiverseCore</artifactId>
|
||||
<version>3.0-SNAPSHOT</version>
|
||||
<name>Multiverse-Core</name>
|
||||
<url>http://ci.onarandombox.org</url>
|
||||
<description>World Management Plugin</description>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.build.number>LOCAL</project.build.number>
|
||||
</properties>
|
||||
|
||||
<!-- Modules -->
|
||||
<modules>
|
||||
<module>base</module>
|
||||
<module>bukkit</module>
|
||||
</modules>
|
||||
|
||||
<ciManagement>
|
||||
<system>jenkins</system>
|
||||
<url>http://ci.onarandombox.com</url>
|
||||
</ciManagement>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>OnARandomBox</id>
|
||||
<url>http://repo.onarandombox.com/content/repositories/multiverse/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>OnARandomBox</id>
|
||||
<url>http://repo.onarandombox.com/content/repositories/multiverse-snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:git://github.com/multiverse/Multiverse-Core.git</connection>
|
||||
<url>https://github.com/multiverse/Multiverse-Core</url>
|
||||
<developerConnection>scm:git:git@github.com:multiverse/Multiverse-Core.git</developerConnection>
|
||||
</scm>
|
||||
</project>
|
||||
@@ -0,0 +1,5 @@
|
||||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*/
|
||||
|
||||
rootProject.name = 'multiverse-core'
|
||||
+294
-551
File diff suppressed because it is too large.
Load diff
+180
-232
@@ -7,10 +7,24 @@
|
||||
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import buscript.Buscript;
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.fernferret.allpay.AllPay;
|
||||
import com.fernferret.allpay.GenericBank;
|
||||
import com.onarandombox.MultiverseCore.MVWorld.NullLocation;
|
||||
import com.onarandombox.MultiverseCore.api.BlockSafety;
|
||||
import com.onarandombox.MultiverseCore.api.Core;
|
||||
import com.onarandombox.MultiverseCore.api.LocationManipulation;
|
||||
@@ -18,7 +32,6 @@ import com.onarandombox.MultiverseCore.api.MVPlugin;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseCoreConfig;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseMessaging;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
|
||||
import com.onarandombox.MultiverseCore.commands.AnchorCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.CheckCommand;
|
||||
@@ -30,6 +43,8 @@ import com.onarandombox.MultiverseCore.commands.CreateCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.DebugCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.DeleteCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.EnvironmentCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.GameruleCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.GamerulesCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.GeneratorCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.HelpCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.ImportCommand;
|
||||
@@ -53,6 +68,7 @@ import com.onarandombox.MultiverseCore.commands.TeleportCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.UnloadCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.VersionCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.WhoCommand;
|
||||
import com.onarandombox.MultiverseCore.commandtools.queue.CommandQueueManager;
|
||||
import com.onarandombox.MultiverseCore.destination.AnchorDestination;
|
||||
import com.onarandombox.MultiverseCore.destination.BedDestination;
|
||||
import com.onarandombox.MultiverseCore.destination.CannonDestination;
|
||||
@@ -60,61 +76,58 @@ import com.onarandombox.MultiverseCore.destination.DestinationFactory;
|
||||
import com.onarandombox.MultiverseCore.destination.ExactDestination;
|
||||
import com.onarandombox.MultiverseCore.destination.PlayerDestination;
|
||||
import com.onarandombox.MultiverseCore.destination.WorldDestination;
|
||||
import com.onarandombox.MultiverseCore.event.MVDebugModeEvent;
|
||||
import com.onarandombox.MultiverseCore.event.MVVersionEvent;
|
||||
import com.onarandombox.MultiverseCore.exceptions.PropertyDoesNotExistException;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVAsyncPlayerChatListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVChatListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVEntityListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVMapListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVPlayerChatListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVPlayerListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVPluginListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVPortalListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVWeatherListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVWorldInitListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVWorldListener;
|
||||
import com.onarandombox.MultiverseCore.utils.AnchorManager;
|
||||
import com.onarandombox.MultiverseCore.utils.CompatibilityLayer;
|
||||
import com.onarandombox.MultiverseCore.utils.MVEconomist;
|
||||
import com.onarandombox.MultiverseCore.utils.MVMessaging;
|
||||
import com.onarandombox.MultiverseCore.utils.MVPermissions;
|
||||
import com.onarandombox.MultiverseCore.utils.MVPlayerSession;
|
||||
import com.onarandombox.MultiverseCore.utils.MaterialConverter;
|
||||
import com.onarandombox.MultiverseCore.utils.TestingMode;
|
||||
import com.onarandombox.MultiverseCore.utils.metrics.MetricsConfigurator;
|
||||
import com.onarandombox.MultiverseCore.utils.SimpleBlockSafety;
|
||||
import com.onarandombox.MultiverseCore.utils.SimpleLocationManipulation;
|
||||
import com.onarandombox.MultiverseCore.utils.SimpleSafeTTeleporter;
|
||||
import com.onarandombox.MultiverseCore.utils.UnsafeCallWrapper;
|
||||
import com.onarandombox.MultiverseCore.utils.VaultHandler;
|
||||
import com.onarandombox.MultiverseCore.utils.WorldManager;
|
||||
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||
import me.main__.util.SerializationConfig.NoSuchPropertyException;
|
||||
import me.main__.util.SerializationConfig.SerializationConfig;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.Configuration;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.mcstats.Metrics;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import org.bukkit.plugin.java.JavaPluginLoader;
|
||||
|
||||
/**
|
||||
* The implementation of the Multiverse-{@link Core}.
|
||||
*/
|
||||
public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
private static final int PROTOCOL = 18;
|
||||
private static final int PROTOCOL = 24;
|
||||
// TODO: Investigate if this one is really needed to be static.
|
||||
// Doubt it. -- FernFerret
|
||||
private static Map<String, String> teleportQueue = new HashMap<String, String>();
|
||||
@@ -123,6 +136,21 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
// TODO please let's make this non-static
|
||||
private volatile MultiverseCoreConfiguration config;
|
||||
|
||||
public MultiverseCore() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* This is for unit testing.
|
||||
* @param loader The PluginLoader to use.
|
||||
* @param description The Description file to use.
|
||||
* @param dataFolder The folder that other datafiles can be found in.
|
||||
* @param file The location of the plugin.
|
||||
*/
|
||||
public MultiverseCore(JavaPluginLoader loader, PluginDescriptionFile description, File dataFolder, File file) {
|
||||
super(loader, description, dataFolder, file);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to find out who is teleporting a player.
|
||||
* @param playerName The teleported player (the teleportee).
|
||||
@@ -148,11 +176,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
teleportQueue.put(teleportee, teleporter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "The Multiverse-Core Plugin";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated This is now deprecated, nobody needs it any longer.
|
||||
@@ -182,6 +205,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
|
||||
// Setup our Map for our Commands using the CommandHandler.
|
||||
private CommandHandler commandHandler;
|
||||
private CommandQueueManager commandQueueManager;
|
||||
|
||||
private static final String LOG_TAG = "[Multiverse-Core]";
|
||||
|
||||
@@ -196,24 +220,22 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
// Setup the block/player/entity listener.
|
||||
private final MVPlayerListener playerListener = new MVPlayerListener(this);
|
||||
private final MVEntityListener entityListener = new MVEntityListener(this);
|
||||
private final MVPluginListener pluginListener = new MVPluginListener(this);
|
||||
private final MVWeatherListener weatherListener = new MVWeatherListener(this);
|
||||
private final MVPortalListener portalListener = new MVPortalListener(this);
|
||||
private final MVWorldListener worldListener = new MVWorldListener(this);
|
||||
private MVChatListener chatListener;
|
||||
|
||||
// HashMap to contain information relating to the Players.
|
||||
private HashMap<String, MVPlayerSession> playerSessions;
|
||||
private VaultHandler vaultHandler;
|
||||
private GenericBank bank = null;
|
||||
private AllPay banker;
|
||||
private MVEconomist economist;
|
||||
private Buscript buscript;
|
||||
private int pluginCount;
|
||||
private DestinationFactory destFactory;
|
||||
//private SpoutInterface spoutInterface = null;
|
||||
private MultiverseMessaging messaging;
|
||||
private BlockSafety blockSafety;
|
||||
private LocationManipulation locationManipulation;
|
||||
private SafeTTeleporter safeTTeleporter;
|
||||
private UnsafeCallWrapper unsafeCallWrapper;
|
||||
|
||||
private File serverFolder = new File(System.getProperty("user.dir"));
|
||||
|
||||
@@ -222,7 +244,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
// Register our config
|
||||
SerializationConfig.registerAll(MultiverseCoreConfiguration.class);
|
||||
// Register our world
|
||||
SerializationConfig.registerAll(MVWorld.class);
|
||||
SerializationConfig.registerAll(WorldProperties.class);
|
||||
// Create our DataFolder
|
||||
getDataFolder().mkdirs();
|
||||
// Setup our Debug Log
|
||||
@@ -234,31 +256,20 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
this.locationManipulation = new SimpleLocationManipulation();
|
||||
// Setup our SafeTTeleporter
|
||||
this.safeTTeleporter = new SimpleSafeTTeleporter(this);
|
||||
this.unsafeCallWrapper = new UnsafeCallWrapper(this);
|
||||
// Setup our CompatibilityLayer
|
||||
CompatibilityLayer.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated This is deprecated.
|
||||
*/
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public FileConfiguration getMVConfiguration() {
|
||||
return this.multiverseConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated Now using Vault.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public GenericBank getBank() {
|
||||
return this.bank;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VaultHandler getVaultHandler() {
|
||||
return vaultHandler;
|
||||
return getEconomist().getVaultHandler();
|
||||
}
|
||||
|
||||
public MVEconomist getEconomist() {
|
||||
return economist;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -266,9 +277,10 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
*/
|
||||
@Override
|
||||
public void onEnable() {
|
||||
getServer().getPluginManager().registerEvents(new MVWorldInitListener(this), this);
|
||||
|
||||
this.messaging = new MVMessaging();
|
||||
this.banker = new AllPay(this, LOG_TAG + " ");
|
||||
this.vaultHandler = new VaultHandler(this);
|
||||
this.economist = new MVEconomist(this);
|
||||
// Load the defaultWorldGenerators
|
||||
this.worldManager.getDefaultWorldGenerators();
|
||||
|
||||
@@ -276,10 +288,9 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
// Setup Permissions, we'll do an initial check for the Permissions plugin then fall back on isOP().
|
||||
this.ph = new MVPermissions(this);
|
||||
|
||||
this.bank = this.banker.loadEconPlugin();
|
||||
|
||||
// Setup the command manager
|
||||
this.commandHandler = new CommandHandler(this, this.ph);
|
||||
this.commandQueueManager = new CommandQueueManager(this);
|
||||
// Call the Function to assign all the Commands to their Class.
|
||||
this.registerCommands();
|
||||
|
||||
@@ -297,12 +308,11 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
// Setup & Load our Configuration files.
|
||||
loadConfigs();
|
||||
if (this.multiverseConfig != null) {
|
||||
Logging.setDebugLevel(getMVConfig().getGlobalDebug());
|
||||
Logging.setShowingConfig(!getMVConfig().getSilentStart());
|
||||
this.worldManager.loadDefaultWorlds();
|
||||
this.worldManager.loadWorlds(true);
|
||||
} else {
|
||||
this.log(Level.SEVERE, "Your configs were not loaded. Very little will function in Multiverse.");
|
||||
Logging.severe("Your configs were not loaded. Very little will function in Multiverse.");
|
||||
}
|
||||
this.anchorManager.loadAnchors();
|
||||
|
||||
@@ -326,118 +336,41 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
this.chatListener = new MVPlayerChatListener(this, this.playerListener);
|
||||
}
|
||||
getServer().getPluginManager().registerEvents(this.chatListener, this);
|
||||
/*
|
||||
// Check to see if spout was already loaded (most likely):
|
||||
if (this.getServer().getPluginManager().getPlugin("Spout") != null) {
|
||||
this.setSpout();
|
||||
this.log(Level.INFO, "Spout integration enabled.");
|
||||
}
|
||||
*/
|
||||
|
||||
this.initializeBuscript();
|
||||
this.setupMetrics();
|
||||
|
||||
// Output a little snippet to show it's enabled.
|
||||
Logging.config("Version %s (API v%s) Enabled - By %s", this.getDescription().getVersion(), PROTOCOL, getAuthors());
|
||||
|
||||
if (getMVConfig().isShowingDonateMessage()) {
|
||||
getLogger().config("Help dumptruckman keep this project alive. Become a patron! https://www.patreon.com/dumptruckman");
|
||||
getLogger().config("One time donations are also appreciated: https://www.paypal.me/dumptruckman");
|
||||
}
|
||||
}
|
||||
|
||||
private void setupMetrics() {
|
||||
if (TestingMode.isDisabled()) {
|
||||
MetricsConfigurator.configureMetrics(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the buscript javascript library.
|
||||
*/
|
||||
private void initializeBuscript() {
|
||||
buscript = new Buscript(this);
|
||||
// Add global variable "multiverse" to javascript environment
|
||||
buscript.getGlobalScope().put("multiverse", buscript.getGlobalScope(), this);
|
||||
}
|
||||
buscript = null;
|
||||
|
||||
/**
|
||||
* Plotter for Environment-Values.
|
||||
*/
|
||||
private static final class EnvironmentPlotter extends Metrics.Plotter {
|
||||
private MultiverseCore core;
|
||||
private final Environment env;
|
||||
|
||||
public EnvironmentPlotter(MultiverseCore core, Environment env) {
|
||||
super(envToString(env));
|
||||
this.core = core;
|
||||
this.env = env;
|
||||
}
|
||||
|
||||
private static String envToString(Environment env) {
|
||||
return new StringBuilder().append(env.name().toUpperCase().charAt(0))
|
||||
.append(env.name().toLowerCase().substring(1)).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getValue() {
|
||||
int count = 0;
|
||||
for (MultiverseWorld w : core.getMVWorldManager().getMVWorlds())
|
||||
if (w.getEnvironment() == env)
|
||||
count++;
|
||||
core.log(Level.FINE, String.format("Tracking %d worlds of type %s", count, env));
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Plotter for Generator-Values.
|
||||
*/
|
||||
private static final class GeneratorPlotter extends Metrics.Plotter {
|
||||
private MultiverseCore core;
|
||||
private final String gen;
|
||||
|
||||
public GeneratorPlotter(MultiverseCore core, String gen) {
|
||||
super(gen);
|
||||
this.core = core;
|
||||
this.gen = gen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getValue() {
|
||||
int count = 0;
|
||||
for (MultiverseWorld w : core.getMVWorldManager().getMVWorlds())
|
||||
if (gen.equals(w.getGenerator()))
|
||||
count++;
|
||||
core.log(Level.FINE, String.format("Tracking %d worlds of type %s", count, gen));
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
private void setupMetrics() {
|
||||
try {
|
||||
Metrics m = new Metrics(this);
|
||||
|
||||
Metrics.Graph envGraph = m.createGraph("worlds_by_env");
|
||||
for (Environment env : Environment.values())
|
||||
envGraph.addPlotter(new EnvironmentPlotter(this, env));
|
||||
|
||||
m.addCustomData(new Metrics.Plotter("Loaded worlds") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return getMVWorldManager().getMVWorlds().size();
|
||||
}
|
||||
});
|
||||
m.addCustomData(new Metrics.Plotter("Total number of worlds") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return getMVWorldManager().getMVWorlds().size()
|
||||
+ getMVWorldManager().getUnloadedWorlds().size();
|
||||
}
|
||||
});
|
||||
|
||||
Set<String> gens = new HashSet<String>();
|
||||
for (MultiverseWorld w : this.getMVWorldManager().getMVWorlds())
|
||||
gens.add(w.getGenerator());
|
||||
gens.remove(null);
|
||||
gens.remove("null");
|
||||
Metrics.Graph genGraph = m.createGraph("custom_gens");
|
||||
for (String gen : gens)
|
||||
genGraph.addPlotter(new GeneratorPlotter(this, gen));
|
||||
|
||||
m.start();
|
||||
log(Level.FINE, "Metrics have run!");
|
||||
} catch (IOException e) {
|
||||
log(Level.WARNING, "There was an issue while enabling metrics: " + e.getMessage());
|
||||
if (this.getMVConfig().getEnableBuscript()) {
|
||||
try {
|
||||
buscript = new Buscript(this);
|
||||
// Add global variable "multiverse" to javascript environment
|
||||
buscript.setScriptVariable("multiverse", this);
|
||||
} catch (NullPointerException e) {
|
||||
Logging.warning("Buscript failed to load! The script command will be disabled! " +
|
||||
"If you would like not to see this message, " +
|
||||
"use `/mv conf enablebuscript false` to disable Buscript from loading.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -459,10 +392,11 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
pm.registerEvents(this.playerListener, this);
|
||||
pm.registerEvents(this.entityListener, this);
|
||||
pm.registerEvents(this.pluginListener, this);
|
||||
pm.registerEvents(this.weatherListener, this);
|
||||
pm.registerEvents(this.portalListener, this);
|
||||
|
||||
Logging.info(ChatColor.GREEN + "We are aware of the warning about the deprecated event. There is no alternative that allows us to do what we need to do and performance impact is negligible. It is safe to ignore.");
|
||||
pm.registerEvents(this.worldListener, this);
|
||||
pm.registerEvents(new MVMapListener(this), this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -472,8 +406,19 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
public void loadConfigs() {
|
||||
// Now grab the Configuration Files.
|
||||
this.multiverseConfig = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "config.yml"));
|
||||
Configuration coreDefaults = YamlConfiguration.loadConfiguration(this.getClass().getResourceAsStream("/defaults/config.yml"));
|
||||
this.multiverseConfig.setDefaults(coreDefaults);
|
||||
InputStream resourceURL = this.getClass().getResourceAsStream("/defaults/config.yml");
|
||||
|
||||
// Read in our default config with UTF-8 now
|
||||
Configuration coreDefaults;
|
||||
try {
|
||||
coreDefaults = YamlConfiguration.loadConfiguration(new BufferedReader(new InputStreamReader(resourceURL, "UTF-8")));
|
||||
this.multiverseConfig.setDefaults(coreDefaults);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Logging.severe("Couldn't load default config with UTF-8 encoding. Details follow:");
|
||||
e.printStackTrace();
|
||||
Logging.severe("Default configs NOT loaded.");
|
||||
}
|
||||
|
||||
this.multiverseConfig.options().copyDefaults(false);
|
||||
this.multiverseConfig.options().copyHeader(true);
|
||||
|
||||
@@ -497,6 +442,12 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
// Old Config Format
|
||||
this.migrate22Values();
|
||||
this.saveMVConfigs();
|
||||
|
||||
int level = Logging.getDebugLevel();
|
||||
Logging.setDebugLevel(getMVConfig().getGlobalDebug());
|
||||
if (level != Logging.getDebugLevel()) {
|
||||
getServer().getPluginManager().callEvent(new MVDebugModeEvent(level));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -550,15 +501,25 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
}
|
||||
}
|
||||
|
||||
private static final char PATH_SEPARATOR = '\uF8FF';
|
||||
|
||||
/**
|
||||
* Migrate the worlds.yml to SerializationConfig.
|
||||
*/
|
||||
private void migrateWorldConfig() { // SUPPRESS CHECKSTYLE: MethodLength
|
||||
FileConfiguration wconf = YamlConfiguration
|
||||
.loadConfiguration(new File(getDataFolder(), "worlds.yml"));
|
||||
FileConfiguration wconf = new YamlConfiguration();
|
||||
wconf.options().pathSeparator(PATH_SEPARATOR);
|
||||
File worldsFile = new File(getDataFolder(), "worlds.yml");
|
||||
try {
|
||||
wconf.load(worldsFile);
|
||||
} catch (IOException e) {
|
||||
Logging.warning("Cannot load worlds.yml");
|
||||
} catch (InvalidConfigurationException e) {
|
||||
Logging.warning("Your worlds.yml is invalid!");
|
||||
}
|
||||
|
||||
if (!wconf.isConfigurationSection("worlds")) { // empty config
|
||||
this.log(Level.FINE, "No worlds to migrate!");
|
||||
Logging.fine("No worlds to migrate!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -567,14 +528,13 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
boolean wasChanged = false;
|
||||
Map<String, Object> newValues = new LinkedHashMap<String, Object>(values.size());
|
||||
for (Map.Entry<String, Object> entry : values.entrySet()) {
|
||||
if (entry.getValue() instanceof MVWorld) {
|
||||
if (entry.getValue() instanceof WorldProperties) {
|
||||
// fine
|
||||
newValues.put(entry.getKey(), entry.getValue());
|
||||
} else if (entry.getValue() instanceof ConfigurationSection) {
|
||||
this.log(Level.FINE, "Migrating: " + entry.getKey());
|
||||
Logging.fine("Migrating: " + entry.getKey());
|
||||
// we have to migrate this
|
||||
MVWorld world = new MVWorld(Collections.EMPTY_MAP);
|
||||
world.setPluginAndWorld(this, entry.getKey());
|
||||
WorldProperties world = new WorldProperties(Collections.emptyMap());
|
||||
ConfigurationSection section = (ConfigurationSection) entry.getValue();
|
||||
|
||||
// migrate animals and monsters
|
||||
@@ -608,8 +568,9 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
// migrate entryfee
|
||||
if (section.isConfigurationSection("entryfee")) {
|
||||
ConfigurationSection feeSection = section.getConfigurationSection("entryfee");
|
||||
if (feeSection.isInt("currency"))
|
||||
world.setCurrency(feeSection.getInt("currency"));
|
||||
if (feeSection.isInt("currency")) {
|
||||
world.setCurrency(MaterialConverter.convertConfigType(feeSection, "currency"));
|
||||
}
|
||||
|
||||
if (feeSection.isDouble("amount"))
|
||||
world.setPrice(feeSection.getDouble("amount"));
|
||||
@@ -668,8 +629,8 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
// migrate portalform
|
||||
if (section.isString("portalform")) {
|
||||
try {
|
||||
world.setPropertyValue("portalform", section.getString("portalform"));
|
||||
} catch (PropertyDoesNotExistException e) {
|
||||
world.setProperty("portalform", section.getString("portalform"), true);
|
||||
} catch (NoSuchPropertyException e) {
|
||||
throw new RuntimeException("Who forgot to update the migrator?", e);
|
||||
}
|
||||
}
|
||||
@@ -677,8 +638,8 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
// migrate environment
|
||||
if (section.isString("environment")) {
|
||||
try {
|
||||
world.setPropertyValue("environment", section.getString("environment"));
|
||||
} catch (PropertyDoesNotExistException e) {
|
||||
world.setProperty("environment", section.getString("environment"), true);
|
||||
} catch (NoSuchPropertyException e) {
|
||||
throw new RuntimeException("Who forgot to update the migrator?", e);
|
||||
}
|
||||
}
|
||||
@@ -716,7 +677,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
// migrate spawn
|
||||
if (section.isConfigurationSection("spawn")) {
|
||||
ConfigurationSection spawnSect = section.getConfigurationSection("spawn");
|
||||
Location spawnLoc = world.getSpawnLocation();
|
||||
Location spawnLoc = new NullLocation();
|
||||
if (spawnSect.isDouble("yaw"))
|
||||
spawnLoc.setYaw((float) spawnSect.getDouble("yaw"));
|
||||
if (spawnSect.isDouble("pitch"))
|
||||
@@ -733,7 +694,14 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
|
||||
// migrate difficulty
|
||||
if (section.isString("difficulty")) {
|
||||
final Difficulty difficulty = Difficulty.valueOf(section.getString("difficulty").toUpperCase());
|
||||
Difficulty difficulty;
|
||||
try {
|
||||
difficulty = Difficulty.valueOf(section.getString("difficulty").toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
Logging.warning("Could not parse difficulty: " + section.getString("difficulty"));
|
||||
Logging.warning("Setting world " + entry.getKey() + " difficulty to NORMAL");
|
||||
difficulty = Difficulty.NORMAL;
|
||||
}
|
||||
if (difficulty != null) {
|
||||
world.setDifficulty(difficulty);
|
||||
}
|
||||
@@ -748,7 +716,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
wasChanged = true;
|
||||
} else {
|
||||
// huh?
|
||||
this.log(Level.WARNING, "Removing unknown entry in the config: " + entry);
|
||||
Logging.warning("Removing unknown entry in the config: " + entry);
|
||||
// just don't add to newValues
|
||||
wasChanged = true;
|
||||
}
|
||||
@@ -822,6 +790,8 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
this.commandHandler.registerCommand(new GeneratorCommand(this));
|
||||
this.commandHandler.registerCommand(new CheckCommand(this));
|
||||
this.commandHandler.registerCommand(new ScriptCommand(this));
|
||||
this.commandHandler.registerCommand(new GameruleCommand(this));
|
||||
this.commandHandler.registerCommand(new GamerulesCommand(this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -830,8 +800,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
@Override
|
||||
public void onDisable() {
|
||||
this.saveMVConfigs();
|
||||
this.banker = null;
|
||||
this.bank = null;
|
||||
Logging.shutdown();
|
||||
}
|
||||
|
||||
@@ -848,17 +816,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @deprecated This is deprecated.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public com.onarandombox.MultiverseCore.utils.SafeTTeleporter getTeleporter() {
|
||||
return new com.onarandombox.MultiverseCore.utils.SafeTTeleporter(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -893,8 +850,12 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @deprecated This is now deprecated, nobody needs it any longer.
|
||||
* All logging is now done with {@link Logging}.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public void log(Level level, String msg) {
|
||||
Logging.log(level, msg);
|
||||
}
|
||||
@@ -961,6 +922,15 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
return this.commandHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public CommandQueueManager getCommandQueueManager() {
|
||||
return commandQueueManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the log-tag.
|
||||
*
|
||||
@@ -1017,26 +987,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
this.pluginCount -= 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated Now using Vault.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public AllPay getBanker() {
|
||||
return this.banker;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated Now using Vault.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setBank(GenericBank bank) {
|
||||
this.bank = bank;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -1078,25 +1028,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
this.serverFolder = newServerFolder;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Initializes Spout.
|
||||
* /
|
||||
public void setSpout() {
|
||||
this.spoutInterface = new SpoutInterface();
|
||||
this.commandHandler.registerCommand(new SpoutCommand(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets our {@link SpoutInterface}.
|
||||
*
|
||||
* @return The {@link SpoutInterface} we're using.
|
||||
* /
|
||||
public SpoutInterface getSpout() {
|
||||
return this.spoutInterface;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -1152,7 +1083,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
this.multiverseConfig.save(new File(getDataFolder(), "config.yml"));
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
this.log(Level.SEVERE, "Could not save Multiverse config.yml config. Please check your file permissions.");
|
||||
Logging.severe("Could not save Multiverse config.yml config. Please check your file permissions.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1200,12 +1131,22 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated This is deprecated!
|
||||
* @deprecated This is deprecated! Do not use!
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public Boolean regenWorld(String name, Boolean useNewSeed, Boolean randomSeed, String seed) {
|
||||
return this.worldManager.regenWorld(name, useNewSeed, randomSeed, seed);
|
||||
return this.worldManager.regenWorld(name, useNewSeed, randomSeed, seed, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated This is deprecated! Do not use!
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public Boolean regenWorld(String name, Boolean useNewSeed, Boolean randomSeed, String seed, Boolean keepGameRules) {
|
||||
return this.worldManager.regenWorld(name, useNewSeed, randomSeed, seed, keepGameRules);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1229,6 +1170,9 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
*/
|
||||
@Override
|
||||
public void setBlockSafety(BlockSafety bs) {
|
||||
if (bs == null) {
|
||||
throw new NullPointerException("block safety may not be null.");
|
||||
}
|
||||
this.blockSafety = bs;
|
||||
}
|
||||
|
||||
@@ -1287,4 +1231,8 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
public Buscript getScriptAPI() {
|
||||
return buscript;
|
||||
}
|
||||
|
||||
public UnsafeCallWrapper getUnsafeCallWrapper() {
|
||||
return this.unsafeCallWrapper;
|
||||
}
|
||||
}
|
||||
+96
-3
@@ -1,12 +1,14 @@
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseCoreConfig;
|
||||
import com.onarandombox.MultiverseCore.event.MVDebugModeEvent;
|
||||
import me.main__.util.SerializationConfig.NoSuchPropertyException;
|
||||
import me.main__.util.SerializationConfig.Property;
|
||||
import me.main__.util.SerializationConfig.SerializationConfig;
|
||||
|
||||
import java.util.Map;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
/**
|
||||
* Our configuration.
|
||||
@@ -44,6 +46,8 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
@Property
|
||||
private volatile boolean prefixchat;
|
||||
@Property
|
||||
private volatile String prefixchatformat;
|
||||
@Property
|
||||
private volatile boolean useasyncchat;
|
||||
@Property
|
||||
private volatile boolean teleportintercept;
|
||||
@@ -52,6 +56,8 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
@Property
|
||||
private volatile boolean displaypermerrors;
|
||||
@Property
|
||||
private volatile boolean enablebuscript;
|
||||
@Property
|
||||
private volatile int globaldebug;
|
||||
@Property
|
||||
private volatile boolean silentstart;
|
||||
@@ -63,6 +69,14 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
private volatile String firstspawnworld;
|
||||
@Property
|
||||
private volatile int teleportcooldown;
|
||||
@Property
|
||||
private volatile boolean defaultportalsearch;
|
||||
@Property
|
||||
private volatile int portalsearchradius;
|
||||
@Property
|
||||
private volatile boolean autopurge;
|
||||
@Property
|
||||
private volatile boolean idonotwanttodonate;
|
||||
|
||||
public MultiverseCoreConfiguration() {
|
||||
super();
|
||||
@@ -82,15 +96,21 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
// BEGIN CHECKSTYLE-SUPPRESSION: MagicNumberCheck
|
||||
enforceaccess = false;
|
||||
useasyncchat = true;
|
||||
prefixchat = true;
|
||||
prefixchat = false;
|
||||
prefixchatformat = "[%world%]%chat%";
|
||||
teleportintercept = true;
|
||||
firstspawnoverride = true;
|
||||
displaypermerrors = true;
|
||||
enablebuscript = true;
|
||||
globaldebug = 0;
|
||||
messagecooldown = 5000;
|
||||
teleportcooldown = 1000;
|
||||
this.version = 2.9;
|
||||
silentstart = false;
|
||||
defaultportalsearch = true;
|
||||
portalsearchradius = 128;
|
||||
autopurge = true;
|
||||
idonotwanttodonate = false;
|
||||
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
|
||||
}
|
||||
|
||||
@@ -139,6 +159,22 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
public void setPrefixChat(boolean prefixChat) {
|
||||
this.prefixchat = prefixChat;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getPrefixChatFormat() {
|
||||
return this.prefixchatformat;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setPrefixChatFormat(String prefixChatFormat) {
|
||||
this.prefixchatformat = prefixChatFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
@@ -180,6 +216,22 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
return this.displaypermerrors;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean getEnableBuscript() {
|
||||
return this.enablebuscript;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setEnableBuscript(boolean enableBuscript) {
|
||||
this.enablebuscript = enableBuscript;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -203,6 +255,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
public void setGlobalDebug(int globalDebug) {
|
||||
this.globaldebug = globalDebug;
|
||||
Logging.setDebugLevel(globalDebug);
|
||||
Bukkit.getPluginManager().callEvent(new MVDebugModeEvent(globalDebug));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -289,4 +342,44 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
public boolean getSilentStart() {
|
||||
return silentstart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUseDefaultPortalSearch(boolean useDefaultPortalSearch) {
|
||||
defaultportalsearch = useDefaultPortalSearch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsingDefaultPortalSearch() {
|
||||
return defaultportalsearch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPortalSearchRadius(int searchRadius) {
|
||||
this.portalsearchradius = searchRadius;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPortalSearchRadius() {
|
||||
return portalsearchradius;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoPurgeEnabled() {
|
||||
return autopurge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAutoPurgeEnabled(boolean autopurge) {
|
||||
this.autopurge = autopurge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShowingDonateMessage() {
|
||||
return !idonotwanttodonate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShowDonateMessage(boolean showDonateMessage) {
|
||||
this.idonotwanttodonate = !showDonateMessage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,655 @@
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld.NullLocation;
|
||||
import com.onarandombox.MultiverseCore.configuration.EntryFee;
|
||||
import com.onarandombox.MultiverseCore.configuration.SpawnLocation;
|
||||
import com.onarandombox.MultiverseCore.configuration.SpawnSettings;
|
||||
import com.onarandombox.MultiverseCore.configuration.WorldPropertyValidator;
|
||||
import com.onarandombox.MultiverseCore.enums.AllowedPortalType;
|
||||
import com.onarandombox.MultiverseCore.enums.EnglishChatColor;
|
||||
import com.onarandombox.MultiverseCore.enums.EnglishChatStyle;
|
||||
import me.main__.util.SerializationConfig.IllegalPropertyValueException;
|
||||
import me.main__.util.SerializationConfig.Property;
|
||||
import me.main__.util.SerializationConfig.SerializationConfig;
|
||||
import me.main__.util.SerializationConfig.Serializor;
|
||||
import me.main__.util.SerializationConfig.Validator;
|
||||
import me.main__.util.SerializationConfig.VirtualProperty;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.configuration.serialization.SerializableAs;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/*
|
||||
* This is a property class, I think we don't need that much javadoc.
|
||||
* BEGIN CHECKSTYLE-SUPPRESSION: Javadoc
|
||||
*/
|
||||
|
||||
@SerializableAs("MVWorld")
|
||||
public class WorldProperties extends SerializationConfig {
|
||||
|
||||
private static final Map<String, String> PROPERTY_ALIASES;
|
||||
|
||||
static {
|
||||
PROPERTY_ALIASES = new HashMap<String, String>();
|
||||
PROPERTY_ALIASES.put("curr", "entryfee.currency");
|
||||
PROPERTY_ALIASES.put("currency", "entryfee.currency");
|
||||
PROPERTY_ALIASES.put("price", "entryfee.amount");
|
||||
PROPERTY_ALIASES.put("scaling", "scale");
|
||||
PROPERTY_ALIASES.put("aliascolor", "color");
|
||||
PROPERTY_ALIASES.put("heal", "autoHeal");
|
||||
PROPERTY_ALIASES.put("storm", "allowWeather");
|
||||
PROPERTY_ALIASES.put("weather", "allowWeather");
|
||||
PROPERTY_ALIASES.put("spawnmemory", "keepSpawnInMemory");
|
||||
PROPERTY_ALIASES.put("memory", "keepSpawnInMemory");
|
||||
PROPERTY_ALIASES.put("mode", "gameMode");
|
||||
PROPERTY_ALIASES.put("diff", "difficulty");
|
||||
PROPERTY_ALIASES.put("spawnlocation", "spawn");
|
||||
PROPERTY_ALIASES.put("limit", "playerLimit");
|
||||
PROPERTY_ALIASES.put("animals", "spawning.animals.spawn");
|
||||
PROPERTY_ALIASES.put("monsters", "spawning.monsters.spawn");
|
||||
PROPERTY_ALIASES.put("animalsrate", "spawning.animals.spawnrate");
|
||||
PROPERTY_ALIASES.put("monstersrate", "spawning.monsters.spawnrate");
|
||||
PROPERTY_ALIASES.put("flight", "allowFlight");
|
||||
PROPERTY_ALIASES.put("fly", "allowFlight");
|
||||
PROPERTY_ALIASES.put("allowfly", "allowFlight");
|
||||
}
|
||||
|
||||
private final boolean keepSpawnFallback;
|
||||
|
||||
public WorldProperties(Map<String, Object> values) {
|
||||
super(values);
|
||||
Object keepSpawnObject = values.get("keepSpawnInMemory");
|
||||
keepSpawnFallback = keepSpawnObject == null || Boolean.parseBoolean(keepSpawnObject.toString());
|
||||
}
|
||||
|
||||
public WorldProperties() {
|
||||
super();
|
||||
keepSpawnFallback = true;
|
||||
}
|
||||
|
||||
public WorldProperties(final boolean fixSpawn, final Environment environment) {
|
||||
super();
|
||||
if (!fixSpawn) {
|
||||
this.adjustSpawn = false;
|
||||
}
|
||||
setScaling(getDefaultScale(environment));
|
||||
keepSpawnFallback = true;
|
||||
}
|
||||
|
||||
void setMVWorld(MVWorld world) {
|
||||
registerObjectUsing(world);
|
||||
registerGlobalValidator(new WorldPropertyValidator());
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializor for the color-property.
|
||||
*/
|
||||
private static final class EnumPropertySerializor<T extends Enum<T>> implements Serializor<T, String> {
|
||||
@Override
|
||||
public String serialize(T from) {
|
||||
return from.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public T deserialize(String serialized, Class<T> wanted) throws IllegalPropertyValueException {
|
||||
try {
|
||||
return Enum.valueOf(wanted, serialized.toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new IllegalPropertyValueException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializor for the difficulty-property.
|
||||
*/
|
||||
private static final class DifficultyPropertySerializor implements Serializor<Difficulty, String> {
|
||||
@Override
|
||||
public String serialize(Difficulty from) {
|
||||
return from.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Difficulty deserialize(String serialized, Class<Difficulty> wanted) throws IllegalPropertyValueException {
|
||||
try {
|
||||
return Difficulty.getByValue(Integer.parseInt(serialized));
|
||||
} catch (Exception e) {
|
||||
}
|
||||
try {
|
||||
return Difficulty.valueOf(serialized.toUpperCase());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
throw new IllegalPropertyValueException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializor for the gameMode-property.
|
||||
*/
|
||||
private static final class GameModePropertySerializor implements Serializor<GameMode, String> {
|
||||
@Override
|
||||
public String serialize(GameMode from) {
|
||||
return from.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameMode deserialize(String serialized, Class<GameMode> wanted) throws IllegalPropertyValueException {
|
||||
try {
|
||||
return GameMode.getByValue(Integer.parseInt(serialized));
|
||||
} catch (NumberFormatException nfe) {
|
||||
}
|
||||
try {
|
||||
return GameMode.valueOf(serialized.toUpperCase());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
throw new IllegalPropertyValueException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializor for the time-property.
|
||||
*/
|
||||
private static final class TimePropertySerializor implements Serializor<Long, String> {
|
||||
// BEGIN CHECKSTYLE-SUPPRESSION: MagicNumberCheck
|
||||
private static final String TIME_REGEX = "(\\d\\d?):?(\\d\\d)(a|p)?m?";
|
||||
private static final Map<String, String> TIME_ALIASES;
|
||||
static {
|
||||
Map<String, String> staticTimes = new HashMap<String, String>();
|
||||
staticTimes.put("morning", "8:00");
|
||||
staticTimes.put("day", "12:00");
|
||||
staticTimes.put("noon", "12:00");
|
||||
staticTimes.put("midnight", "0:00");
|
||||
staticTimes.put("night", "20:00");
|
||||
|
||||
// now set TIME_ALIASES to a "frozen" map
|
||||
TIME_ALIASES = Collections.unmodifiableMap(staticTimes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serialize(Long from) {
|
||||
// I'm tired, so they get time in 24 hour for now.
|
||||
// Someone else can add 12 hr format if they want :P
|
||||
|
||||
int hours = (int) ((from / 1000 + 8) % 24);
|
||||
int minutes = (int) (60 * (from % 1000) / 1000);
|
||||
|
||||
return String.format("%d:%02d", hours, minutes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long deserialize(String serialized, Class<Long> wanted) throws IllegalPropertyValueException {
|
||||
if (TIME_ALIASES.containsKey(serialized.toLowerCase())) {
|
||||
serialized = TIME_ALIASES.get(serialized.toLowerCase());
|
||||
}
|
||||
// Regex that extracts a time in the following formats:
|
||||
// 11:11pm, 11:11, 23:11, 1111, 1111p, and the aliases at the top of this file.
|
||||
Pattern pattern = Pattern.compile(TIME_REGEX, Pattern.CASE_INSENSITIVE);
|
||||
Matcher matcher = pattern.matcher(serialized);
|
||||
matcher.find();
|
||||
int hour = 0;
|
||||
double minute = 0;
|
||||
int count = matcher.groupCount();
|
||||
if (count >= 2) {
|
||||
hour = Integer.parseInt(matcher.group(1));
|
||||
minute = Integer.parseInt(matcher.group(2));
|
||||
}
|
||||
// If there were 4 matches (all, hour, min, am/pm)
|
||||
if (count == 4) {
|
||||
// We want 24 hour time for calcs, but if they
|
||||
// added a p[m], turn it into a 24 hr one.
|
||||
if (matcher.group(3).equals("p")) {
|
||||
hour += 12;
|
||||
}
|
||||
}
|
||||
// Translate 24th hour to 0th hour.
|
||||
if (hour == 24) {
|
||||
hour = 0;
|
||||
}
|
||||
// Clamp the hour
|
||||
if (hour > 23 || hour < 0) {
|
||||
throw new IllegalPropertyValueException("Illegal hour!");
|
||||
}
|
||||
// Clamp the minute
|
||||
if (minute > 59 || minute < 0) {
|
||||
throw new IllegalPropertyValueException("Illegal minute!");
|
||||
}
|
||||
// 60 seconds in a minute, time needs to be in hrs * 1000, per
|
||||
// the bukkit docs.
|
||||
double totaltime = (hour + (minute / 60.0)) * 1000;
|
||||
// Somehow there's an 8 hour offset...
|
||||
totaltime -= 8000;
|
||||
if (totaltime < 0) {
|
||||
totaltime = 24000 + totaltime;
|
||||
}
|
||||
|
||||
return (long) totaltime;
|
||||
}
|
||||
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// Begin properties
|
||||
@Property(description = "Sorry, 'hidden' must either be: true or false.")
|
||||
private volatile boolean hidden;
|
||||
@Property(description = "Alias must be a valid string.")
|
||||
private volatile String alias;
|
||||
@Property(serializor = EnumPropertySerializor.class, description = "Sorry, 'color' must be a valid color-name.")
|
||||
private volatile EnglishChatColor color;
|
||||
@Property(serializor = EnumPropertySerializor.class, description = "Sorry, 'style' must be a valid style-name.")
|
||||
private volatile EnglishChatStyle style;
|
||||
@Property(description = "Sorry, 'pvp' must either be: true or false.", virtualType = Boolean.class, persistVirtual = true)
|
||||
volatile VirtualProperty<Boolean> pvp; // SUPPRESS CHECKSTYLE: VisibilityModifier
|
||||
@Property(description = "Scale must be a positive double value. ex: 2.3")
|
||||
private volatile double scale;
|
||||
@Property(description = "You must set this to the NAME not alias of a world.")
|
||||
private volatile String respawnWorld;
|
||||
@Property(description = "Sorry, this must either be: true or false.")
|
||||
private volatile boolean allowWeather;
|
||||
@Property(serializor = DifficultyPropertySerializor.class, virtualType = Difficulty.class, persistVirtual = true,
|
||||
description = "Difficulty must be set as one of the following: peaceful easy normal hard")
|
||||
volatile VirtualProperty<Difficulty> difficulty; // SUPPRESS CHECKSTYLE: VisibilityModifier
|
||||
@Property(description = "Sorry, 'animals' must either be: true or false.")
|
||||
private volatile SpawnSettings spawning;
|
||||
@Property
|
||||
volatile EntryFee entryfee;
|
||||
@Property(description = "Sorry, 'hunger' must either be: true or false.")
|
||||
private volatile boolean hunger;
|
||||
@Property(description = "Sorry, 'autoheal' must either be: true or false.")
|
||||
private volatile boolean autoHeal;
|
||||
@Property(description = "Sorry, 'adjustspawn' must either be: true or false.")
|
||||
private volatile boolean adjustSpawn;
|
||||
@Property(serializor = EnumPropertySerializor.class, description = "Allow portal forming must be NONE, ALL, NETHER or END.")
|
||||
private volatile AllowedPortalType portalForm;
|
||||
@Property(serializor = GameModePropertySerializor.class, description = "GameMode must be set as one of the following: survival creative")
|
||||
private volatile GameMode gameMode;
|
||||
@Property(description = "Sorry, this must either be: true or false.", virtualType = Boolean.class, persistVirtual = true)
|
||||
volatile VirtualProperty<Boolean> keepSpawnInMemory; // SUPPRESS CHECKSTYLE: VisibilityModifier
|
||||
@Property
|
||||
volatile SpawnLocation spawnLocation; // SUPPRESS CHECKSTYLE: VisibilityModifier
|
||||
@Property(virtualType = Location.class,
|
||||
description = "There is no help available for this variable. Go bug Rigby90 about it.")
|
||||
volatile VirtualProperty<Location> spawn; // SUPPRESS CHECKSTYLE: VisibilityModifier
|
||||
@Property(description = "Set this to false ONLY if you don't want this world to load itself on server restart.")
|
||||
private volatile boolean autoLoad;
|
||||
@Property(description = "If a player dies in this world, shoudld they go to their bed?")
|
||||
private volatile boolean bedRespawn;
|
||||
@Property
|
||||
private volatile List<String> worldBlacklist;
|
||||
@Property(serializor = TimePropertySerializor.class, virtualType = Long.class,
|
||||
description = "Set the time to whatever you want! (Will NOT freeze time)")
|
||||
volatile VirtualProperty<Long> time; // SUPPRESS CHECKSTYLE: VisibilityModifier
|
||||
@Property
|
||||
volatile Environment environment; // SUPPRESS CHECKSTYLE: VisibilityModifier
|
||||
@Property
|
||||
volatile long seed; // SUPPRESS CHECKSTYLE: VisibilityModifier
|
||||
@Property
|
||||
private volatile String generator;
|
||||
@Property
|
||||
private volatile int playerLimit;
|
||||
@Property
|
||||
private volatile boolean allowFlight;
|
||||
// End of properties
|
||||
// --------------------------------------------------------------
|
||||
|
||||
void setValidator(String fieldName, Validator validator) {
|
||||
registerValidator(fieldName, validator); //To change body of overridden methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void copyValues(SerializationConfig other) {
|
||||
super.copyValues(other);
|
||||
}
|
||||
|
||||
/**
|
||||
* This prepares the MVWorld for unloading.
|
||||
*/
|
||||
public void cacheVirtualProperties() {
|
||||
try {
|
||||
this.buildVPropChanges();
|
||||
} catch (IllegalStateException e) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void setDefaults() {
|
||||
this.hidden = false;
|
||||
this.alias = new String();
|
||||
this.color = EnglishChatColor.WHITE;
|
||||
this.style = EnglishChatStyle.NORMAL;
|
||||
this.scale = 1D;
|
||||
this.respawnWorld = new String();
|
||||
this.allowWeather = true;
|
||||
this.spawning = new SpawnSettings();
|
||||
this.entryfee = new EntryFee();
|
||||
this.hunger = true;
|
||||
this.autoHeal = true;
|
||||
this.adjustSpawn = true;
|
||||
this.portalForm = AllowedPortalType.ALL;
|
||||
this.gameMode = GameMode.SURVIVAL;
|
||||
this.spawnLocation = new NullLocation();
|
||||
this.autoLoad = true;
|
||||
this.bedRespawn = true;
|
||||
this.worldBlacklist = new ArrayList<String>();
|
||||
this.generator = null;
|
||||
this.playerLimit = -1;
|
||||
this.allowFlight = true;
|
||||
}
|
||||
|
||||
private static double getDefaultScale(Environment environment) {
|
||||
if (environment == Environment.NETHER) {
|
||||
return 8.0; // SUPPRESS CHECKSTYLE: MagicNumberCheck
|
||||
} else if (environment == Environment.THE_END) {
|
||||
return 16.0; // SUPPRESS CHECKSTYLE: MagicNumberCheck
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* getAliases().
|
||||
* @return The alias-map.
|
||||
* @see SerializationConfig
|
||||
*/
|
||||
protected static Map<String, String> getAliases() {
|
||||
return PROPERTY_ALIASES;
|
||||
}
|
||||
|
||||
void flushChanges() {
|
||||
this.flushPendingVPropChanges();
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return this.alias;
|
||||
}
|
||||
|
||||
public void setAlias(String alias) {
|
||||
this.setPropertyValueUnchecked("alias", alias);
|
||||
}
|
||||
|
||||
public Environment getEnvironment() {
|
||||
return this.environment;
|
||||
}
|
||||
|
||||
public void setEnvironment(Environment environment) {
|
||||
this.setPropertyValueUnchecked("environment", environment);
|
||||
}
|
||||
|
||||
public long getSeed() {
|
||||
return this.seed;
|
||||
}
|
||||
|
||||
public void setSeed(long seed) {
|
||||
this.setPropertyValueUnchecked("seed", seed);
|
||||
}
|
||||
|
||||
public String getGenerator() {
|
||||
return this.generator;
|
||||
}
|
||||
|
||||
public void setGenerator(String generator) {
|
||||
this.setPropertyValueUnchecked("generator", generator);
|
||||
}
|
||||
|
||||
public int getPlayerLimit() {
|
||||
return this.playerLimit;
|
||||
}
|
||||
|
||||
public void setPlayerLimit(int limit) {
|
||||
this.setPropertyValueUnchecked("playerLimit", limit);
|
||||
}
|
||||
|
||||
public boolean canAnimalsSpawn() {
|
||||
return this.spawning.getAnimalSettings().doSpawn();
|
||||
}
|
||||
|
||||
public void setAllowAnimalSpawn(boolean animals) {
|
||||
this.setPropertyValueUnchecked("spawning.animals.spawn", animals);
|
||||
}
|
||||
|
||||
public List<String> getAnimalList() {
|
||||
// These don't fire events at the moment. Should they?
|
||||
return this.spawning.getAnimalSettings().getExceptions();
|
||||
}
|
||||
|
||||
public boolean canMonstersSpawn() {
|
||||
return this.spawning.getMonsterSettings().doSpawn();
|
||||
}
|
||||
|
||||
public void setAllowMonsterSpawn(boolean monsters) {
|
||||
this.setPropertyValueUnchecked("spawning.monsters.spawn", monsters);
|
||||
}
|
||||
|
||||
public int getAnimalSpawnRate() {
|
||||
return this.spawning.getAnimalSettings().getSpawnRate();
|
||||
}
|
||||
|
||||
public int getMonsterSpawnRate() {
|
||||
return this.spawning.getMonsterSettings().getSpawnRate();
|
||||
}
|
||||
|
||||
public List<String> getMonsterList() {
|
||||
// These don't fire events at the moment. Should they?
|
||||
return this.spawning.getMonsterSettings().getExceptions();
|
||||
}
|
||||
|
||||
public boolean isPVPEnabled() {
|
||||
return this.pvp.get();
|
||||
}
|
||||
|
||||
public void setPVPMode(boolean pvp) {
|
||||
this.setPropertyValueUnchecked("pvp", pvp);
|
||||
}
|
||||
|
||||
public boolean isHidden() {
|
||||
return this.hidden;
|
||||
}
|
||||
|
||||
public void setHidden(boolean hidden) {
|
||||
this.setPropertyValueUnchecked("hidden", hidden);
|
||||
}
|
||||
|
||||
public List<String> getWorldBlacklist() {
|
||||
return this.worldBlacklist;
|
||||
}
|
||||
|
||||
public double getScaling() {
|
||||
return this.scale;
|
||||
}
|
||||
|
||||
public boolean setScaling(double scaling) {
|
||||
return this.setPropertyValueUnchecked("scale", scaling);
|
||||
}
|
||||
|
||||
public boolean setColor(String aliasColor) {
|
||||
return this.setPropertyUnchecked("color", aliasColor);
|
||||
}
|
||||
|
||||
public boolean setColor(EnglishChatColor color) {
|
||||
return this.setPropertyValueUnchecked("color", color);
|
||||
}
|
||||
|
||||
public EnglishChatColor getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public String getRespawnToWorld() {
|
||||
return this.respawnWorld;
|
||||
}
|
||||
|
||||
public boolean setRespawnToWorld(String respawnToWorld) {
|
||||
return this.setPropertyValueUnchecked("respawnWorld", respawnToWorld);
|
||||
}
|
||||
|
||||
public Material getCurrency() {
|
||||
return this.entryfee.getCurrency();
|
||||
}
|
||||
|
||||
public void setCurrency(@Nullable Material currency) {
|
||||
this.setPropertyValueUnchecked("entryfee.currency", currency);
|
||||
}
|
||||
|
||||
public double getPrice() {
|
||||
return this.entryfee.getAmount();
|
||||
}
|
||||
|
||||
public void setPrice(double price) {
|
||||
this.setPropertyValueUnchecked("entryfee.amount", price);
|
||||
}
|
||||
|
||||
public boolean setGameMode(String mode) {
|
||||
return this.setPropertyUnchecked("gameMode", mode);
|
||||
}
|
||||
|
||||
public boolean setGameMode(GameMode mode) {
|
||||
return this.setPropertyValueUnchecked("gameMode", mode);
|
||||
}
|
||||
|
||||
public GameMode getGameMode() {
|
||||
return this.gameMode;
|
||||
}
|
||||
|
||||
public void setEnableWeather(boolean weather) {
|
||||
this.setPropertyValueUnchecked("allowWeather", weather);
|
||||
}
|
||||
|
||||
public boolean isWeatherEnabled() {
|
||||
return this.allowWeather;
|
||||
}
|
||||
|
||||
public boolean isKeepingSpawnInMemory() {
|
||||
if (keepSpawnInMemory == null) {
|
||||
return keepSpawnFallback;
|
||||
}
|
||||
try {
|
||||
return this.keepSpawnInMemory.get();
|
||||
} catch (IllegalStateException e) {
|
||||
return keepSpawnFallback;
|
||||
}
|
||||
}
|
||||
|
||||
public void setKeepSpawnInMemory(boolean value) {
|
||||
this.setPropertyValueUnchecked("keepSpawnInMemory", value);
|
||||
}
|
||||
|
||||
public boolean getHunger() {
|
||||
return this.hunger;
|
||||
}
|
||||
|
||||
public void setHunger(boolean hunger) {
|
||||
this.setPropertyValueUnchecked("hunger", hunger);
|
||||
}
|
||||
|
||||
public Location getSpawnLocation() {
|
||||
return this.spawn.get();
|
||||
}
|
||||
|
||||
public void setSpawnLocation(Location l) {
|
||||
this.setPropertyValueUnchecked("spawn", l);
|
||||
}
|
||||
|
||||
public Difficulty getDifficulty() {
|
||||
return this.difficulty.get();
|
||||
}
|
||||
|
||||
@Deprecated // SUPPRESS CHECKSTYLE: Deprecated
|
||||
public boolean setDifficulty(String difficulty) {
|
||||
return this.setPropertyUnchecked("difficulty", difficulty);
|
||||
}
|
||||
|
||||
public boolean setDifficulty(Difficulty difficulty) {
|
||||
return this.setPropertyValueUnchecked("difficulty", difficulty);
|
||||
}
|
||||
|
||||
public boolean getAutoHeal() {
|
||||
return this.autoHeal;
|
||||
}
|
||||
|
||||
public void setAutoHeal(boolean heal) {
|
||||
this.setPropertyValueUnchecked("autoHeal", heal);
|
||||
}
|
||||
|
||||
public void setAdjustSpawn(boolean adjust) {
|
||||
this.setPropertyValueUnchecked("adjustSpawn", adjust);
|
||||
}
|
||||
|
||||
public boolean getAdjustSpawn() {
|
||||
return this.adjustSpawn;
|
||||
}
|
||||
|
||||
public void setAutoLoad(boolean load) {
|
||||
this.setPropertyValueUnchecked("autoLoad", load);
|
||||
}
|
||||
|
||||
public boolean getAutoLoad() {
|
||||
return this.autoLoad;
|
||||
}
|
||||
|
||||
public void setBedRespawn(boolean respawn) {
|
||||
this.setPropertyValueUnchecked("bedRespawn", respawn);
|
||||
}
|
||||
|
||||
public boolean getBedRespawn() {
|
||||
return this.bedRespawn;
|
||||
}
|
||||
|
||||
public String getAllPropertyNames() {
|
||||
ChatColor myColor = ChatColor.AQUA;
|
||||
StringBuilder result = new StringBuilder();
|
||||
Map<String, Object> serialized = this.serialize();
|
||||
for (String key : serialized.keySet()) {
|
||||
result.append(myColor).append(key).append(' ');
|
||||
myColor = (myColor == ChatColor.AQUA) ? ChatColor.GOLD : ChatColor.AQUA;
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return this.getPropertyUnchecked("time");
|
||||
}
|
||||
|
||||
public boolean setTime(String timeAsString) {
|
||||
return this.setPropertyUnchecked("time", timeAsString);
|
||||
}
|
||||
|
||||
public AllowedPortalType getAllowedPortals() {
|
||||
return portalForm;
|
||||
}
|
||||
|
||||
public void allowPortalMaking(AllowedPortalType portalType) {
|
||||
this.setPropertyValueUnchecked("portalForm", portalType);
|
||||
}
|
||||
|
||||
public EnglishChatStyle getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
public boolean setStyle(String style) {
|
||||
return this.setPropertyUnchecked("style", style);
|
||||
}
|
||||
|
||||
public boolean getAllowFlight() {
|
||||
return this.allowFlight;
|
||||
}
|
||||
|
||||
public void setAllowFlight(final boolean allowFlight) {
|
||||
this.setPropertyValueUnchecked("allowFlight", allowFlight);
|
||||
}
|
||||
}
|
||||
File renamed without changes.
+41
-52
@@ -8,10 +8,10 @@
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import buscript.Buscript;
|
||||
import com.fernferret.allpay.AllPay;
|
||||
import com.fernferret.allpay.GenericBank;
|
||||
import com.onarandombox.MultiverseCore.commandtools.queue.CommandQueueManager;
|
||||
import com.onarandombox.MultiverseCore.destination.DestinationFactory;
|
||||
import com.onarandombox.MultiverseCore.utils.AnchorManager;
|
||||
import com.onarandombox.MultiverseCore.utils.MVEconomist;
|
||||
import com.onarandombox.MultiverseCore.utils.MVPermissions;
|
||||
import com.onarandombox.MultiverseCore.utils.MVPlayerSession;
|
||||
import com.onarandombox.MultiverseCore.utils.SimpleBlockSafety;
|
||||
@@ -19,7 +19,6 @@ import com.onarandombox.MultiverseCore.utils.SimpleLocationManipulation;
|
||||
import com.onarandombox.MultiverseCore.utils.SimpleSafeTTeleporter;
|
||||
import com.onarandombox.MultiverseCore.utils.VaultHandler;
|
||||
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
@@ -29,32 +28,24 @@ import org.bukkit.entity.Player;
|
||||
*/
|
||||
public interface Core {
|
||||
|
||||
/**
|
||||
* Gets the Multiverse config file.
|
||||
*
|
||||
* @return The Multiverse config file.
|
||||
* @deprecated Don't modify the config-file manually!
|
||||
*/
|
||||
@Deprecated
|
||||
FileConfiguration getMVConfiguration();
|
||||
|
||||
/**
|
||||
* Gets the Banking system that Multiverse-Core has hooked into.
|
||||
*
|
||||
* @return A {@link GenericBank} that can be used for payments.
|
||||
* @deprecated Now using vault, see {@link VaultHandler#getEconomy}
|
||||
*/
|
||||
@Deprecated
|
||||
GenericBank getBank();
|
||||
|
||||
/**
|
||||
* Returns the Vault handler used by Multiverse. The returned object will have all methods necessary for
|
||||
* interfacing with Vault.
|
||||
*
|
||||
* @return the Vault handler for Multiverse.
|
||||
* @deprecated we are now using {@link #getEconomist()} for all economy needs.
|
||||
*/
|
||||
@Deprecated
|
||||
VaultHandler getVaultHandler();
|
||||
|
||||
/**
|
||||
* Retrieves Multiverse's friendly economist. The economist can be used for dealing with economies without
|
||||
* worrying about any of the messy details.
|
||||
*
|
||||
* @return the economy manager for Multiverse.
|
||||
*/
|
||||
MVEconomist getEconomist();
|
||||
|
||||
/**
|
||||
* Reloads the Multiverse Configuration files:
|
||||
* worlds.yml and config.yml.
|
||||
@@ -80,17 +71,6 @@ public interface Core {
|
||||
*/
|
||||
MVPlayerSession getPlayerSession(Player player);
|
||||
|
||||
/**
|
||||
* Gets the instantiated Safe-T-Teleporter for performing
|
||||
* safe teleports.
|
||||
*
|
||||
* @return A non-null {@link SafeTTeleporter}.
|
||||
*
|
||||
* @deprecated Use {@link #getSafeTTeleporter()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
com.onarandombox.MultiverseCore.utils.SafeTTeleporter getTeleporter();
|
||||
|
||||
/**
|
||||
* Multiverse uses an advanced permissions setup, this object
|
||||
* simplifies getting/setting permissions.
|
||||
@@ -107,6 +87,15 @@ public interface Core {
|
||||
*/
|
||||
CommandHandler getCommandHandler();
|
||||
|
||||
/**
|
||||
* Manager for command that requires /mv confirm before execution.
|
||||
*
|
||||
* @return A non-null {@link CommandQueueManager}.
|
||||
* @deprecated To be moved to new command manager in 5.0.0
|
||||
*/
|
||||
@Deprecated
|
||||
CommandQueueManager getCommandQueueManager();
|
||||
|
||||
/**
|
||||
* Gets the factory class responsible for loading many different destinations
|
||||
* on demand.
|
||||
@@ -118,7 +107,7 @@ public interface Core {
|
||||
/**
|
||||
* Gets the primary class responsible for managing Multiverse Worlds.
|
||||
*
|
||||
* @return {@link WorldManager}.
|
||||
* @return {@link MVWorldManager}.
|
||||
*/
|
||||
MVWorldManager getMVWorldManager();
|
||||
|
||||
@@ -137,37 +126,37 @@ public interface Core {
|
||||
AnchorManager getAnchorManager();
|
||||
|
||||
/**
|
||||
* Used by queued commands to regenerate a world on a delay.
|
||||
* Previously used by queued commands to regenerate a world on a delay.
|
||||
* Do not use api method for any other purpose.
|
||||
*
|
||||
* @param name Name of the world to regenerate
|
||||
* @param useNewSeed If a new seed should be used
|
||||
* @param randomSeed IF the new seed should be random
|
||||
* @param seed The seed of the world.
|
||||
* @param name Name of the world to regenerate
|
||||
* @param useNewSeed If a new seed should be used
|
||||
* @param randomSeed If the new seed should be random
|
||||
* @param seed The seed of the world.
|
||||
*
|
||||
* @return True if success, false if fail.
|
||||
*
|
||||
* @deprecated Use {@link MVWorldManager#regenWorld(String, boolean, boolean, String)} instead.
|
||||
* @deprecated Use {@link MVWorldManager#regenWorld(String, boolean, boolean, String, boolean)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
Boolean regenWorld(String name, Boolean useNewSeed, Boolean randomSeed, String seed);
|
||||
|
||||
/**
|
||||
* Sets the {@link GenericBank}-Bank AllPay is using.
|
||||
* Used by queued commands to regenerate a world on a delay.
|
||||
* Do not use api method for any other purpose.
|
||||
*
|
||||
* @param bank The new {@link GenericBank}
|
||||
* @deprecated Now using vault, see {@link VaultHandler#getEconomy}
|
||||
* @param name Name of the world to regenerate
|
||||
* @param useNewSeed If a new seed should be used
|
||||
* @param randomSeed If the new seed should be random
|
||||
* @param seed The seed of the world.
|
||||
* @param keepGameRules If GameRules should be kept on world regen.
|
||||
*
|
||||
* @return True if success, false if fail.
|
||||
*
|
||||
* @deprecated Use {@link MVWorldManager#regenWorld(String, boolean, boolean, String, boolean)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
void setBank(GenericBank bank);
|
||||
|
||||
/**
|
||||
* Gets this plugin's {@link AllPay}-Banker.
|
||||
*
|
||||
* @return An {@link AllPay}-Banker
|
||||
* @deprecated Now using vault, see {@link VaultHandler#getEconomy}
|
||||
*/
|
||||
@Deprecated
|
||||
AllPay getBanker();
|
||||
Boolean regenWorld(String name, Boolean useNewSeed, Boolean randomSeed, String seed, Boolean keepGameRules);
|
||||
|
||||
/**
|
||||
* Decrements the number of plugins that have specifically hooked into core.
|
||||
File renamed without changes.
File renamed without changes.
+7
-1
@@ -7,11 +7,17 @@
|
||||
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import org.bukkit.Server;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
/** A simple API to require plugins to have a log method. */
|
||||
/**
|
||||
* A simple API to require plugins to have a log method.
|
||||
*
|
||||
* @deprecated Replaced by {@link Logging}.
|
||||
* */
|
||||
@Deprecated
|
||||
public interface LoggablePlugin {
|
||||
/**
|
||||
* Logs a message at the specified level.
|
||||
File renamed without changes.
+2
-2
@@ -30,14 +30,14 @@ public interface MVPlugin extends LoggablePlugin {
|
||||
/**
|
||||
* Gets the reference to MultiverseCore.
|
||||
*
|
||||
* @return A valid {@link MultiverseCore}.
|
||||
* @return A valid {@link com.onarandombox.MultiverseCore}.
|
||||
*/
|
||||
MultiverseCore getCore();
|
||||
|
||||
/**
|
||||
* Sets the reference to MultiverseCore.
|
||||
*
|
||||
* @param core A valid {@link MultiverseCore}.
|
||||
* @param core A valid {@link com.onarandombox.MultiverseCore}.
|
||||
*/
|
||||
void setCore(MultiverseCore core);
|
||||
|
||||
+89
-12
@@ -9,7 +9,6 @@ package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import com.onarandombox.MultiverseCore.utils.PurgeWorlds;
|
||||
import com.onarandombox.MultiverseCore.utils.SimpleWorldPurger;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.WorldType;
|
||||
@@ -65,16 +64,30 @@ public interface MVWorldManager {
|
||||
*
|
||||
* @param oldName Name of world to be copied
|
||||
* @param newName Name of world to be created
|
||||
* @param generator The Custom generator plugin to use.
|
||||
* @param generator The Custom generator plugin to use. Ignored.
|
||||
* @return True if the world is copied successfully, false if not.
|
||||
* @deprecated Use {@link #cloneWorld(String, String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
boolean cloneWorld(String oldName, String newName, String generator);
|
||||
|
||||
/**
|
||||
* Remove the world from the Multiverse list, from the
|
||||
* config and deletes the folder.
|
||||
* Make a copy of a world.
|
||||
*
|
||||
* @param name The name of the world to remove
|
||||
* @param oldName
|
||||
* Name of world to be copied
|
||||
* @param newName
|
||||
* Name of world to be created
|
||||
* @return True if the world is copied successfully, false if not.
|
||||
*/
|
||||
boolean cloneWorld(String oldName, String newName);
|
||||
|
||||
/**
|
||||
* Remove the world from the Multiverse list, from the config and deletes
|
||||
* the folder.
|
||||
*
|
||||
* @param name
|
||||
* The name of the world to remove
|
||||
* @return True if success, false if failure.
|
||||
*/
|
||||
boolean deleteWorld(String name);
|
||||
@@ -109,6 +122,15 @@ public interface MVWorldManager {
|
||||
*/
|
||||
boolean unloadWorld(String name);
|
||||
|
||||
/**
|
||||
* Unload a world from Multiverse with option to prevent calling unloadWorld in Bukkit.
|
||||
*
|
||||
* @param name Name of the world to unload
|
||||
* @param unloadBukkit True if Bukkit world should be unloaded
|
||||
* @return True if the world was unloaded, false if not.
|
||||
*/
|
||||
boolean unloadWorld(String name, boolean unloadBukkit);
|
||||
|
||||
/**
|
||||
* Loads the world. Only use this if the world has been
|
||||
* unloaded with {@link #unloadWorld(String)}.
|
||||
@@ -152,6 +174,16 @@ public interface MVWorldManager {
|
||||
*/
|
||||
MultiverseWorld getMVWorld(String name);
|
||||
|
||||
/**
|
||||
* Returns a {@link MultiverseWorld} if the world with name given exists, and null if it does not.
|
||||
* This will search optionally for alias names.
|
||||
*
|
||||
* @param name The name or optionally the alias of the world to get.
|
||||
* @param checkAliases Indicates whether to check for world alias name.
|
||||
* @return A {@link MultiverseWorld} or null.
|
||||
*/
|
||||
MultiverseWorld getMVWorld(String name, boolean checkAliases);
|
||||
|
||||
/**
|
||||
* Returns a {@link MultiverseWorld} if it exists, and null if it does not.
|
||||
*
|
||||
@@ -161,13 +193,24 @@ public interface MVWorldManager {
|
||||
MultiverseWorld getMVWorld(World world);
|
||||
|
||||
/**
|
||||
* Checks to see if the given name is a valid {@link MultiverseWorld}.
|
||||
* Checks to see if the given name is a valid {@link MultiverseWorld}
|
||||
* Searches based on world name AND alias.
|
||||
*
|
||||
* @param name The name or alias of the world to check.
|
||||
* @return True if the world exists, false if not.
|
||||
*/
|
||||
boolean isMVWorld(String name);
|
||||
|
||||
/**
|
||||
* Checks to see if the given name is a valid {@link MultiverseWorld}.
|
||||
* Optionally searches by alias is specified.
|
||||
*
|
||||
* @param name The name or alias of the world to check.
|
||||
* @param checkAliases Indicates whether to check for world alias name.
|
||||
* @return True if the world exists, false if not.
|
||||
*/
|
||||
boolean isMVWorld(String name, boolean checkAliases);
|
||||
|
||||
/**
|
||||
* Checks to see if the given world is a valid {@link MultiverseWorld}.
|
||||
*
|
||||
@@ -177,7 +220,7 @@ public interface MVWorldManager {
|
||||
boolean isMVWorld(World world);
|
||||
|
||||
/**
|
||||
* Load the Worlds & Settings from the configuration file.
|
||||
* Load the Worlds & Settings from the configuration file.
|
||||
*
|
||||
* @param forceLoad If set to true, this will perform a total
|
||||
* reset and not just load new worlds.
|
||||
@@ -185,7 +228,7 @@ public interface MVWorldManager {
|
||||
void loadWorlds(boolean forceLoad);
|
||||
|
||||
/**
|
||||
* Loads the Worlds & Settings for any worlds that bukkit loaded before us.
|
||||
* Loads the Worlds & Settings for any worlds that bukkit loaded before us.
|
||||
* <p>
|
||||
* This way people will _always_ have some worlds in the list.
|
||||
*/
|
||||
@@ -270,12 +313,46 @@ public interface MVWorldManager {
|
||||
/**
|
||||
* Regenerates a world.
|
||||
*
|
||||
* @param name Name of the world to regenerate
|
||||
* @param useNewSeed If a new seed should be used
|
||||
* @param randomSeed IF the new seed should be random
|
||||
* @param seed The seed of the world.
|
||||
* @param name Name of the world to regenerate
|
||||
* @param useNewSeed If a new seed should be used
|
||||
* @param randomSeed If the new seed should be random
|
||||
* @param seed The seed of the world.
|
||||
*
|
||||
* @return True if success, false if fail.
|
||||
*/
|
||||
boolean regenWorld(String name, boolean useNewSeed, boolean randomSeed, String seed);
|
||||
|
||||
/**
|
||||
* Regenerates a world.
|
||||
*
|
||||
* @param name Name of the world to regenerate
|
||||
* @param useNewSeed If a new seed should be used
|
||||
* @param randomSeed If the new seed should be random
|
||||
* @param seed The seed of the world.
|
||||
* @param keepGameRules If GameRules should be kept on world regen.
|
||||
*
|
||||
* @return True if success, false if fail.
|
||||
*/
|
||||
boolean regenWorld(String name, boolean useNewSeed, boolean randomSeed, String seed, boolean keepGameRules);
|
||||
|
||||
boolean isKeepingSpawnInMemory(World world);
|
||||
|
||||
/**
|
||||
* Checks whether Multiverse knows about a provided unloaded world. This
|
||||
* method will check the parameter against the alias mappings.
|
||||
*
|
||||
* @param name The name of the unloaded world
|
||||
* @param includeLoaded The value to return if the world is loaded
|
||||
*
|
||||
* @return True if the world exists and is unloaded. False if the world
|
||||
* does not exist. {@code includeLoaded} if the world exists and is loaded.
|
||||
*/
|
||||
boolean hasUnloadedWorld(String name, boolean includeLoaded);
|
||||
|
||||
/**
|
||||
* Get all the possible worlds that Multiverse has detected to be importable.
|
||||
*
|
||||
* @return A collection of world names that are deemed importable.
|
||||
*/
|
||||
Collection<String> getPotentialWorlds();
|
||||
}
|
||||
+80
@@ -86,6 +86,18 @@ public interface MultiverseCoreConfig extends ConfigurationSerializable {
|
||||
*/
|
||||
boolean getDisplayPermErrors();
|
||||
|
||||
/**
|
||||
* Sets enableBuscript.
|
||||
* @param enableBuscript The new value.
|
||||
*/
|
||||
void setEnableBuscript(boolean enableBuscript);
|
||||
|
||||
/**
|
||||
* Gets enableBuscript.
|
||||
* @return enableBuscript.
|
||||
*/
|
||||
boolean getEnableBuscript();
|
||||
|
||||
/**
|
||||
* Sets firstSpawnOverride.
|
||||
* @param firstSpawnOverride The new value.
|
||||
@@ -121,6 +133,18 @@ public interface MultiverseCoreConfig extends ConfigurationSerializable {
|
||||
* @return prefixChat.
|
||||
*/
|
||||
boolean getPrefixChat();
|
||||
|
||||
/**
|
||||
* Sets prefixChatFormat.
|
||||
* @param prefixChatFormat The new value.
|
||||
*/
|
||||
void setPrefixChatFormat(String prefixChatFormat);
|
||||
|
||||
/**
|
||||
* Gets prefixChatFormat.
|
||||
* @return prefixChatFormat.
|
||||
*/
|
||||
String getPrefixChatFormat();
|
||||
|
||||
/**
|
||||
* Sets enforceAccess.
|
||||
@@ -159,4 +183,60 @@ public interface MultiverseCoreConfig extends ConfigurationSerializable {
|
||||
* @return true if we are suppressing startup messages.
|
||||
*/
|
||||
boolean getSilentStart();
|
||||
|
||||
/**
|
||||
* Sets whether or not to let Bukkit determine portal search radius on its own or if Multiverse should give input.
|
||||
*
|
||||
* @param useDefaultPortalSearch True to let Bukkit determine portal search radius on its own.
|
||||
*/
|
||||
void setUseDefaultPortalSearch(boolean useDefaultPortalSearch);
|
||||
|
||||
/**
|
||||
* Gets whether or not Bukkit will be determining portal search radius on its own or if Multiverse should help.
|
||||
*
|
||||
* @return True means Bukkit will use its own default values.
|
||||
*/
|
||||
boolean isUsingDefaultPortalSearch();
|
||||
|
||||
/**
|
||||
* Sets the radius at which vanilla style portals will be searched for to connect to worlds together.
|
||||
*
|
||||
* @param searchRadius The portal search radius.
|
||||
*/
|
||||
void setPortalSearchRadius(int searchRadius);
|
||||
|
||||
/**
|
||||
* Gets the radius at which vanilla style portals will be searched for to connect to worlds together.
|
||||
*
|
||||
* @return The portal search radius.
|
||||
*/
|
||||
int getPortalSearchRadius();
|
||||
|
||||
/**
|
||||
* Gets whether or not the automatic purge of entities is enabled.
|
||||
*
|
||||
* @return True if automatic purge is enabled.
|
||||
*/
|
||||
boolean isAutoPurgeEnabled();
|
||||
|
||||
/**
|
||||
* Sets whether or not the automatic purge of entities is enabled.
|
||||
*
|
||||
* @param autopurge True if automatic purge should be enabled.
|
||||
*/
|
||||
void setAutoPurgeEnabled(boolean autopurge);
|
||||
|
||||
/**
|
||||
* Gets whether or not the donation/patreon messages are shown.
|
||||
*
|
||||
* @return True if donation/patreon messages should be shown.
|
||||
*/
|
||||
boolean isShowingDonateMessage();
|
||||
|
||||
/**
|
||||
* Sets whether or not the donation/patreon messages are shown.
|
||||
*
|
||||
* @param idonotwanttodonate True if donation/patreon messages should be shown.
|
||||
*/
|
||||
void setShowDonateMessage(boolean idonotwanttodonate);
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
+24
-38
@@ -9,15 +9,16 @@ package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import com.onarandombox.MultiverseCore.enums.AllowedPortalType;
|
||||
import com.onarandombox.MultiverseCore.exceptions.PropertyDoesNotExistException;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldType;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -154,37 +155,6 @@ public interface MultiverseWorld {
|
||||
*/
|
||||
boolean setPropertyValue(String property, String value) throws PropertyDoesNotExistException;
|
||||
|
||||
/**
|
||||
* Gets the actual MVConfigProperty from this world.
|
||||
* It will throw a PropertyDoesNotExistException if the property is not found.
|
||||
*
|
||||
* @param property The name of a world property to get.
|
||||
* @param expected The type of the expected property. Use Object.class if this doesn't matter for you.
|
||||
* @param <T> The type of the expected property.
|
||||
*
|
||||
* @return A valid MVWorldProperty.
|
||||
*
|
||||
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
|
||||
* @deprecated We don't use {@link com.onarandombox.MultiverseCore.configuration.MVConfigProperty} any longer!
|
||||
*/
|
||||
@Deprecated
|
||||
<T> com.onarandombox.MultiverseCore.configuration.MVConfigProperty<T> getProperty(String property, Class<T> expected) throws PropertyDoesNotExistException;
|
||||
|
||||
// old config
|
||||
/**
|
||||
* Adds the property to the given value.
|
||||
* It will throw a PropertyDoesNotExistException if the property is not found.
|
||||
*
|
||||
* @param property The name of a world property to set.
|
||||
* @param value A value in string representation, it will be parsed to the correct type.
|
||||
* @param sender The sender who wants this value to be set.
|
||||
* @return True if the value was set, false if not.
|
||||
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
|
||||
* @deprecated Use {@link #setPropertyValue(String, String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
boolean setProperty(String property, String value, CommandSender sender) throws PropertyDoesNotExistException;
|
||||
|
||||
/**
|
||||
* Adds a value to the given property. The property must be a {@link com.onarandombox.MultiverseCore.enums.AddProperties}.
|
||||
*
|
||||
@@ -505,26 +475,28 @@ public interface MultiverseWorld {
|
||||
/**
|
||||
* Sets the price for entry to this world.
|
||||
* You can think of this like an amount.
|
||||
* The type can be set with {@link #setCurrency(int)}
|
||||
* The type can be set with {@link #setCurrency(Material)}
|
||||
*
|
||||
* @param price The Amount of money/item to enter the world.
|
||||
*/
|
||||
void setPrice(double price);
|
||||
|
||||
/**
|
||||
* Gets the Type of currency that will be used when users enter this world.
|
||||
* Gets the type of currency that will be used when users enter this world. A value of null indicates a non-item
|
||||
* based currency is used.
|
||||
*
|
||||
* @return The Type of currency that will be used when users enter this world.
|
||||
* @return The type of currency that will be used when users enter this world.
|
||||
*/
|
||||
int getCurrency();
|
||||
@Nullable
|
||||
Material getCurrency();
|
||||
|
||||
/**
|
||||
* Sets the type of item that will be required given the price is not 0.
|
||||
* Use -1 to use an AllPay economy, or any valid itemid
|
||||
* Use a value of null to specify a non-item based currency.
|
||||
*
|
||||
* @param item The Type of currency that will be used when users enter this world.
|
||||
*/
|
||||
void setCurrency(int item);
|
||||
void setCurrency(@Nullable Material item);
|
||||
|
||||
/**
|
||||
* Gets the world players will respawn in if they die in this one.
|
||||
@@ -685,4 +657,18 @@ public interface MultiverseWorld {
|
||||
* @return All property names, with alternating colors.
|
||||
*/
|
||||
String getAllPropertyNames();
|
||||
|
||||
/**
|
||||
* Whether or not players are allowed to fly in this world.
|
||||
*
|
||||
* @return True if players allowed to fly in this world.
|
||||
*/
|
||||
boolean getAllowFlight();
|
||||
|
||||
/**
|
||||
* Sets whether or not players are allowed to fly in this world.
|
||||
*
|
||||
* @param allowFlight True to allow flight in this world.
|
||||
*/
|
||||
void setAllowFlight(final boolean allowFlight);
|
||||
}
|
||||
+1
-1
@@ -9,7 +9,7 @@ import com.onarandombox.MultiverseCore.enums.TeleportResult;
|
||||
/**
|
||||
* Used to safely teleport people.
|
||||
*/
|
||||
public interface SafeTTeleporter {
|
||||
public interface SafeTTeleporter extends Teleporter {
|
||||
|
||||
/**
|
||||
* Gets the next safe location around the given location.
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import com.onarandombox.MultiverseCore.api.MVDestination;
|
||||
import com.onarandombox.MultiverseCore.enums.TeleportResult;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface Teleporter {
|
||||
TeleportResult teleport(CommandSender teleporter, Player teleportee, MVDestination destination);
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@ public interface WorldPurger {
|
||||
void purgeWorlds(List<MultiverseWorld> worlds);
|
||||
|
||||
/**
|
||||
* Convenience method for {@link #purgeWorld(CommandSender, MultiverseWorld, List, boolean, boolean)} that takes the settings from the world-config.
|
||||
* Convenience method for {@link #purgeWorld(MultiverseWorld, java.util.List, boolean, boolean)} that takes the settings from the world-config.
|
||||
*
|
||||
* @param world The {@link MultiverseWorld}.
|
||||
*/
|
||||
File renamed without changes.
File renamed without changes.
Loaded 100 of 270 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user