mirror of
https://github.com/essentials/Essentials.git
synced 2025-09-16 09:22:28 +02:00
Compare commits
395 Commits
stable-2.9
...
stable-2.9
Author | SHA1 | Date | |
---|---|---|---|
|
8d64c7c81b | ||
|
f0e29552bc | ||
|
48d04216a7 | ||
|
ff6221f1a8 | ||
|
0bc33554f3 | ||
|
7c480e88d6 | ||
|
c357d19c56 | ||
|
86124b2705 | ||
|
99cefb2d74 | ||
|
600f99eb6b | ||
|
8ba7a24fd2 | ||
|
ef608c7595 | ||
|
e61fa58d2b | ||
|
ec5edf7bd2 | ||
|
8dbcebda53 | ||
|
28d2a9ed2e | ||
|
d47e9145f3 | ||
|
ae7c64619c | ||
|
bdef1780ac | ||
|
ced192e8fd | ||
|
0a9e9ca41d | ||
|
4982cc950e | ||
|
140a9100b7 | ||
|
0097f961b4 | ||
|
98d657ec4b | ||
|
63149d0b50 | ||
|
7a410919a0 | ||
|
aa7a39d0b0 | ||
|
9b88107897 | ||
|
147a2fc227 | ||
|
732dc3bf34 | ||
|
227cde75a7 | ||
|
e670d0af45 | ||
|
8cf2ce7b73 | ||
|
1ecf592893 | ||
|
0dd0dba338 | ||
|
678ae78767 | ||
|
d8b6742543 | ||
|
2671f39951 | ||
|
d7ddf3c828 | ||
|
2b7cba936d | ||
|
2757c707bb | ||
|
f50c5276e4 | ||
|
a7e692fe37 | ||
|
02d273f15e | ||
|
d7829bef28 | ||
|
d436d10b00 | ||
|
2d9254eb28 | ||
|
23393aea5f | ||
|
e1562e38bf | ||
|
4dcce2544e | ||
|
29fa2f0f19 | ||
|
b850ae93e9 | ||
|
21cb8efb90 | ||
|
cd7be1bb86 | ||
|
69cd17a1b1 | ||
|
872bc4df4c | ||
|
3083ba2627 | ||
|
35259892b8 | ||
|
fbc0f13b2b | ||
|
aa7f49cb85 | ||
|
720676542e | ||
|
1d7eb77f27 | ||
|
895f6269fc | ||
|
4bf0d3ab24 | ||
|
afccda6350 | ||
|
c0a176825c | ||
|
db6512b702 | ||
|
46d3f0827a | ||
|
838d7dd8f9 | ||
|
b9e5c8827f | ||
|
b8e000c7f9 | ||
|
5e7af93c77 | ||
|
077ad8cd0f | ||
|
0bf954e467 | ||
|
8a55afc4e1 | ||
|
2bc9f2e386 | ||
|
920e1a3b1f | ||
|
353253b9c5 | ||
|
1438230b70 | ||
|
240aebde98 | ||
|
d4e2ed782e | ||
|
f025cd9d2f | ||
|
1ff7082892 | ||
|
15fa10dd29 | ||
|
00b4bdadd4 | ||
|
3055dd93a5 | ||
|
94dc29cc4d | ||
|
22d1db5463 | ||
|
f2b4bb00b6 | ||
|
d2546ebd36 | ||
|
f1930e76d6 | ||
|
d722e6a9f0 | ||
|
8e6d4b1595 | ||
|
72065c81f3 | ||
|
2864d0186c | ||
|
9c9b2be011 | ||
|
2f40264c46 | ||
|
5cc24827fc | ||
|
da01bdc2b0 | ||
|
dfb81dd50f | ||
|
567d52459b | ||
|
80a96e2a73 | ||
|
c2f8467ca9 | ||
|
155ca46fef | ||
|
0952150235 | ||
|
30faa39070 | ||
|
3e367912ec | ||
|
f8cff25bda | ||
|
3e80bf479e | ||
|
84afc80873 | ||
|
27a943217e | ||
|
16834d85c5 | ||
|
44d8c85450 | ||
|
2a8e44dda8 | ||
|
00e3957190 | ||
|
a79b76e8d2 | ||
|
0a092ff5b3 | ||
|
e6aeefb12d | ||
|
924b6bd2ba | ||
|
f701090c89 | ||
|
b9195a561f | ||
|
d94e4095da | ||
|
fd61cd1750 | ||
|
e7ae8bcc47 | ||
|
edc4d62004 | ||
|
cdff690bb5 | ||
|
aa14cc39d9 | ||
|
cdf2c8beed | ||
|
3e06c06827 | ||
|
a2886d76d2 | ||
|
cc0a65bace | ||
|
d988546ef3 | ||
|
b7f2add7b4 | ||
|
b07f65c58b | ||
|
18e315a048 | ||
|
d3967297bb | ||
|
ea3631ddc2 | ||
|
992e473b72 | ||
|
0296f4fcf1 | ||
|
2fc16250a3 | ||
|
75f7b06a23 | ||
|
a7e834e5f9 | ||
|
59086932bd | ||
|
5611acf12c | ||
|
60142d872f | ||
|
1cf0ebbd7f | ||
|
736a6d273a | ||
|
71179e3dfd | ||
|
24cdc37987 | ||
|
b606f153f4 | ||
|
96ab1b4533 | ||
|
8718d59286 | ||
|
5d372b8149 | ||
|
1d62de7e5e | ||
|
3691417848 | ||
|
029162bba7 | ||
|
161a61e0c6 | ||
|
587addb73f | ||
|
d71bd7fb71 | ||
|
699ec273dd | ||
|
c1eed8ebcd | ||
|
b8d0cf4cc4 | ||
|
ff0dd00d79 | ||
|
e18d12f109 | ||
|
0a09b355b2 | ||
|
f9659dae68 | ||
|
78a580bc40 | ||
|
8c4d6ad4df | ||
|
9c9d4e1da5 | ||
|
ce50e1448b | ||
|
8e885a3a6e | ||
|
ecd96a81dd | ||
|
427108574e | ||
|
62381a7f52 | ||
|
b1b09ea542 | ||
|
e502a7e6fd | ||
|
acf4d0bcf5 | ||
|
6c3b13a7a4 | ||
|
cababcbfcf | ||
|
a032d0f19f | ||
|
f808e6fa8e | ||
|
842d9f73a4 | ||
|
c2893788e7 | ||
|
0b8a6c45c6 | ||
|
2049e630fb | ||
|
6fd82480a3 | ||
|
e919897f1b | ||
|
0fb5fc6bcc | ||
|
a7d61b1b8d | ||
|
be9a58457a | ||
|
b1cfc8a8ed | ||
|
6b9b6ba420 | ||
|
79c70b1f65 | ||
|
cfe634e8f7 | ||
|
8c8c6fe73a | ||
|
a4353bc8f2 | ||
|
4015351c85 | ||
|
e89f1d8a03 | ||
|
ff461be45d | ||
|
93f5a05f17 | ||
|
3eba7fb90f | ||
|
25d51cd79e | ||
|
a39824abb6 | ||
|
2ac4c8e665 | ||
|
a84afbaa6e | ||
|
41f7b4ec2d | ||
|
ce90e9710e | ||
|
930eb7ae86 | ||
|
cf79a8fdca | ||
|
1773a6060d | ||
|
5755d647a3 | ||
|
5032142a49 | ||
|
15e996f485 | ||
|
b37c08fd31 | ||
|
eaca7f9c09 | ||
|
00072501c9 | ||
|
b50bb03814 | ||
|
f55316281c | ||
|
413a7beaa4 | ||
|
88140f0610 | ||
|
4996171b6e | ||
|
d201286fc5 | ||
|
12b527be99 | ||
|
e666c27d96 | ||
|
56cfc47ef6 | ||
|
c4e4235f30 | ||
|
e045f9d983 | ||
|
ba8d060927 | ||
|
5f73bf12d7 | ||
|
616f92c214 | ||
|
298f3dc3b2 | ||
|
65741403e0 | ||
|
2b6d41ac5f | ||
|
a4936355b5 | ||
|
02d6eade28 | ||
|
089fa8c19b | ||
|
7c687831bc | ||
|
d43cb95d72 | ||
|
d588c3f271 | ||
|
eaa93d545d | ||
|
e324a21b60 | ||
|
b9cfd44588 | ||
|
44e9c6ebfc | ||
|
a836576211 | ||
|
1ad8c95e3e | ||
|
2dff343c10 | ||
|
fa2a041102 | ||
|
86f8f9c83f | ||
|
e359e8ab6e | ||
|
2f8f3aaa8d | ||
|
f5bf5ed251 | ||
|
979da6e713 | ||
|
6c86fe6117 | ||
|
9018fc8324 | ||
|
2f57961ce4 | ||
|
4478d438d6 | ||
|
9261b259a9 | ||
|
3f3d8c58bc | ||
|
e42f7e4ffa | ||
|
8a9353fd09 | ||
|
7d5e0352d2 | ||
|
05eef76134 | ||
|
e6ef67f7bf | ||
|
bbd93f333d | ||
|
84f7859ca9 | ||
|
1c0dffa67c | ||
|
5f3fb9b595 | ||
|
4ce1e2d9bf | ||
|
e40f364c1e | ||
|
6bd2d2c4b9 | ||
|
47f06e5c1b | ||
|
4c4df13c2f | ||
|
6ca037ae3e | ||
|
47c708fd33 | ||
|
c40b23d80e | ||
|
f17a790d78 | ||
|
bdf67db6ed | ||
|
3e203d193c | ||
|
a92eb4dee6 | ||
|
ed411ee217 | ||
|
368d3a4046 | ||
|
8aab57e86b | ||
|
e198b61eae | ||
|
9824cd75b6 | ||
|
562274706b | ||
|
03a93bfeff | ||
|
86749c433c | ||
|
17adafecf9 | ||
|
dd12e5db66 | ||
|
94947ecc21 | ||
|
8e50158af8 | ||
|
610fae63d2 | ||
|
ee072e844b | ||
|
0319415f1b | ||
|
8fdd32a210 | ||
|
32240cd00d | ||
|
94f9aedf4b | ||
|
fca3ad4df9 | ||
|
ba6cc5a9ee | ||
|
101ae201d6 | ||
|
5c1eea0953 | ||
|
733fcc9d87 | ||
|
738b895cba | ||
|
72aeec58ed | ||
|
4d8116cc39 | ||
|
54133cd75e | ||
|
322fe386f6 | ||
|
d2b30bad99 | ||
|
264eb318b8 | ||
|
cebe291a6f | ||
|
30d5468be0 | ||
|
fbfd62b73e | ||
|
0b9725bf77 | ||
|
3c268312a2 | ||
|
4c2d220176 | ||
|
a855eaf8d0 | ||
|
e5c70713b8 | ||
|
92267fa7f8 | ||
|
3c5f9e1616 | ||
|
c2db96edc8 | ||
|
4ca09cea2d | ||
|
9b39a227c9 | ||
|
a7a06963ac | ||
|
38655811b7 | ||
|
2f562f79aa | ||
|
ee608d944a | ||
|
9e975568be | ||
|
3dbabfa11d | ||
|
7a96fd1dce | ||
|
5174b6fe93 | ||
|
c6617324af | ||
|
c7b90f61f7 | ||
|
7beab59c1a | ||
|
55c9cacaa3 | ||
|
58fc3f4338 | ||
|
5379b3955f | ||
|
bf93bb2026 | ||
|
af73c11638 | ||
|
1a07815f4b | ||
|
52702894af | ||
|
73fb2d3735 | ||
|
7b482b612e | ||
|
bd6614328b | ||
|
45cd9597c9 | ||
|
b40d663c7e | ||
|
6513842d28 | ||
|
c8a07ecdb5 | ||
|
80f001fdb7 | ||
|
ab82f550cf | ||
|
6064b9760b | ||
|
7802192faa | ||
|
cd437f95f1 | ||
|
da735b496f | ||
|
fc288718b7 | ||
|
766f9b4dbd | ||
|
a1ac58d17c | ||
|
2fbdf7e4d6 | ||
|
d5ed474be7 | ||
|
1d92cb0e0a | ||
|
ab7a19b6e6 | ||
|
7b94adfac8 | ||
|
33d7776a8e | ||
|
d299309c67 | ||
|
fcf39ed85b | ||
|
0badd09ad3 | ||
|
cfc8faa43a | ||
|
b0586abc67 | ||
|
41235b6ee1 | ||
|
141a2bb190 | ||
|
fb71ebdfdf | ||
|
66ae1d5b94 | ||
|
ada077fead | ||
|
45367b17a5 | ||
|
76717350d6 | ||
|
b71a6ac5e1 | ||
|
58544c9eea | ||
|
f15cb410ce | ||
|
b0cec9782d | ||
|
1eac05799f | ||
|
8fac5f6beb | ||
|
a46497255e | ||
|
89670bdfd1 | ||
|
71e552c0d1 | ||
|
efec7c8f95 | ||
|
ed668fcac4 | ||
|
72015d42fc | ||
|
24ec84730e | ||
|
dab13931ca | ||
|
b1c7004d7e | ||
|
69ff8b28d8 | ||
|
0395b5d222 | ||
|
3b25235755 | ||
|
51d61e7a91 | ||
|
656f25dc97 |
85
.gitignore
vendored
85
.gitignore
vendored
@@ -1,42 +1,47 @@
|
||||
.DS_Store
|
||||
/BuildAll/nbproject/private/
|
||||
/EssentialsProtect/nbproject/private/
|
||||
/EssentialsChat/nbproject/private/
|
||||
/EssentialsGroupBridge/nbproject/private/
|
||||
/EssentialsGeoIP/nbproject/private/
|
||||
/EssentialsSpawn/nbproject/private/
|
||||
/EssentialsXMPP/nbproject/private/
|
||||
/EssentialsGroupManager/nbproject/private/
|
||||
/BuildAll/build/
|
||||
/EssentialsGroupBridge/dist/
|
||||
/EssentialsGroupBridge/build/
|
||||
/EssentialsGeoIP/dist/
|
||||
/EssentialsGeoIP/build/
|
||||
/EssentialsGroupManager/build/
|
||||
/EssentialsGroupManager/dist/
|
||||
/BuildAll/dist/
|
||||
/EssentialsChat/build/
|
||||
/EssentialsChat/dist/
|
||||
/EssentialsSpawn/build/
|
||||
/EssentialsSpawn/dist/
|
||||
/EssentialsXMPP/dist/
|
||||
/EssentialsXMPP/build/
|
||||
/EssentialsProtect/dist/
|
||||
/EssentialsProtect/build/
|
||||
/EssentialsPermissionsCommands/nbproject/private/
|
||||
/EssentialsPermissionsCommands/build/
|
||||
/EssentialsPermissionsCommands/dist/
|
||||
/Essentials/nbproject/private/
|
||||
/Essentials/dist/
|
||||
/Essentials/build/
|
||||
/YamlAnnotations/
|
||||
/EssentialsUpdate/nbproject/private/
|
||||
/EssentialsRelease/
|
||||
/EssentialsUpdate/dist/
|
||||
/EssentialsUpdate/build/
|
||||
/WebPush/apikey.php
|
||||
/WebPush/nbproject/private
|
||||
/.idea
|
||||
.DS_Store
|
||||
/BuildAll/nbproject/private/
|
||||
/EssentialsProtect/nbproject/private/
|
||||
/EssentialsChat/nbproject/private/
|
||||
/EssentialsGroupBridge/nbproject/private/
|
||||
/EssentialsGeoIP/nbproject/private/
|
||||
/EssentialsSpawn/nbproject/private/
|
||||
/EssentialsXMPP/nbproject/private/
|
||||
/EssentialsGroupManager/nbproject/private/
|
||||
/BuildAll/build/
|
||||
/EssentialsGroupBridge/dist/
|
||||
/EssentialsGroupBridge/build/
|
||||
/EssentialsGeoIP/dist/
|
||||
/EssentialsGeoIP/build/
|
||||
/EssentialsGroupManager/build/
|
||||
/EssentialsGroupManager/dist/
|
||||
/BuildAll/dist/
|
||||
/EssentialsChat/build/
|
||||
/EssentialsChat/dist/
|
||||
/EssentialsSpawn/build/
|
||||
/EssentialsSpawn/dist/
|
||||
/EssentialsXMPP/dist/
|
||||
/EssentialsXMPP/build/
|
||||
/EssentialsProtect/dist/
|
||||
/EssentialsProtect/build/
|
||||
/EssentialsPermissionsCommands/nbproject/private/
|
||||
/EssentialsPermissionsCommands/build/
|
||||
/EssentialsPermissionsCommands/dist/
|
||||
/Essentials/nbproject/private/
|
||||
/Essentials/dist/
|
||||
/Essentials/build/
|
||||
/YamlAnnotations/
|
||||
/EssentialsUpdate/nbproject/private/
|
||||
/EssentialsRelease/
|
||||
/EssentialsUpdate/dist/
|
||||
/EssentialsUpdate/build/
|
||||
/WebPush/apikey.php
|
||||
/WebPush/nbproject/private
|
||||
/.idea
|
||||
*.iml
|
||||
/EssentialsGroupManager/bin
|
||||
/EssentialsGroupManager/.externalToolBuilders
|
||||
/EssentialsGroupManager/.externalToolBuilders
|
||||
/EssentialsAntiBuild/nbproject/private/
|
||||
/EssentialsAntiBuild/dist/
|
||||
/EssentialsAntiBuild/build/
|
||||
/jars
|
||||
/out
|
@@ -638,6 +638,13 @@ is divided into following sections:
|
||||
<param name="call.target" value="jar"/>
|
||||
<param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
|
||||
</antcall>
|
||||
<antcall target="-maybe-call-dep">
|
||||
<param name="call.built.properties" value="${built-jar.properties}"/>
|
||||
<param location="${project.EssentialsAntiBuild}" name="call.subproject"/>
|
||||
<param location="${project.EssentialsAntiBuild}/build.xml" name="call.script"/>
|
||||
<param name="call.target" value="jar"/>
|
||||
<param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
|
||||
</antcall>
|
||||
<antcall target="-maybe-call-dep">
|
||||
<param name="call.built.properties" value="${built-jar.properties}"/>
|
||||
<param location="${project.EssentialsProtect}" name="call.subproject"/>
|
||||
@@ -1140,6 +1147,13 @@ is divided into following sections:
|
||||
<param name="call.target" value="clean"/>
|
||||
<param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
|
||||
</antcall>
|
||||
<antcall target="-maybe-call-dep">
|
||||
<param name="call.built.properties" value="${built-clean.properties}"/>
|
||||
<param location="${project.EssentialsAntiBuild}" name="call.subproject"/>
|
||||
<param location="${project.EssentialsAntiBuild}/build.xml" name="call.script"/>
|
||||
<param name="call.target" value="clean"/>
|
||||
<param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
|
||||
</antcall>
|
||||
<antcall target="-maybe-call-dep">
|
||||
<param name="call.built.properties" value="${built-clean.properties}"/>
|
||||
<param location="${project.EssentialsProtect}" name="call.subproject"/>
|
||||
|
@@ -1,8 +1,8 @@
|
||||
build.xml.data.CRC32=51b33957
|
||||
build.xml.data.CRC32=b4df970c
|
||||
build.xml.script.CRC32=7a797370
|
||||
build.xml.stylesheet.CRC32=28e38971@1.44.1.45
|
||||
build.xml.stylesheet.CRC32=28e38971@1.50.3.46
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=51b33957
|
||||
nbproject/build-impl.xml.script.CRC32=c5170bed
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.1.46
|
||||
nbproject/build-impl.xml.data.CRC32=b4df970c
|
||||
nbproject/build-impl.xml.script.CRC32=1fd6d3cc
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.3.46
|
||||
|
@@ -66,6 +66,7 @@ jar.compress=true
|
||||
javac.classpath=\
|
||||
${reference.Essentials.jar}:\
|
||||
${reference.EssentialsChat.jar}:\
|
||||
${reference.EssentialsAntiBuild.jar}:\
|
||||
${reference.EssentialsProtect.jar}:\
|
||||
${reference.EssentialsSpawn.jar}:\
|
||||
${reference.EssentialsGeoIP.jar}:\
|
||||
@@ -103,6 +104,7 @@ project.EssentialsChat=../EssentialsChat
|
||||
project.EssentialsGeoIP=../EssentialsGeoIP
|
||||
project.EssentialsGroupBridge=../EssentialsGroupBridge
|
||||
project.EssentialsGroupManager=../EssentialsGroupManager
|
||||
project.EssentialsAntiBuild=../EssentialsAntiBuild
|
||||
project.EssentialsProtect=../EssentialsProtect
|
||||
project.EssentialsSpawn=../EssentialsSpawn
|
||||
project.EssentialsXMPP=../EssentialsXMPP
|
||||
@@ -111,6 +113,7 @@ reference.EssentialsChat.jar=${project.EssentialsChat}/dist/EssentialsChat.jar
|
||||
reference.EssentialsGeoIP.jar=${project.EssentialsGeoIP}/dist/EssentialsGeoIP.jar
|
||||
reference.EssentialsGroupBridge.jar=${project.EssentialsGroupBridge}/dist/EssentialsGroupBridge.jar
|
||||
reference.EssentialsGroupManager.jar=${project.EssentialsGroupManager}/dist/EssentialsGroupManager.jar
|
||||
reference.EssentialsAntiBuild.jar=${project.EssentialsAntiBuild}/dist/EssentialsAntiBuild.jar
|
||||
reference.EssentialsProtect.jar=${project.EssentialsProtect}/dist/EssentialsProtect.jar
|
||||
reference.EssentialsSpawn.jar=${project.EssentialsSpawn}/dist/EssentialsSpawn.jar
|
||||
reference.EssentialsXMPP.jar=${project.EssentialsXMPP}/dist/EssentialsXMPP.jar
|
||||
|
@@ -55,6 +55,14 @@
|
||||
<clean-target>clean</clean-target>
|
||||
<id>jar</id>
|
||||
</reference>
|
||||
<reference>
|
||||
<foreign-project>EssentialsAntiBuild</foreign-project>
|
||||
<artifact-type>jar</artifact-type>
|
||||
<script>build.xml</script>
|
||||
<target>jar</target>
|
||||
<clean-target>clean</clean-target>
|
||||
<id>jar</id>
|
||||
</reference>
|
||||
<reference>
|
||||
<foreign-project>EssentialsProtect</foreign-project>
|
||||
<artifact-type>jar</artifact-type>
|
||||
|
@@ -12,9 +12,9 @@ is divided into following sections:
|
||||
- execution
|
||||
- debugging
|
||||
- javadoc
|
||||
- junit compilation
|
||||
- junit execution
|
||||
- junit debugging
|
||||
- test compilation
|
||||
- test execution
|
||||
- test debugging
|
||||
- applet
|
||||
- cleanup
|
||||
|
||||
@@ -181,6 +181,7 @@ is divided into following sections:
|
||||
</and>
|
||||
</condition>
|
||||
<property name="run.jvmargs" value=""/>
|
||||
<property name="run.jvmargs.ide" value=""/>
|
||||
<property name="javac.compilerargs" value=""/>
|
||||
<property name="work.dir" value="${basedir}"/>
|
||||
<condition property="no.deps">
|
||||
@@ -225,6 +226,27 @@ is divided into following sections:
|
||||
<property name="jar.index.metainf" value="${jar.index}"/>
|
||||
<property name="copylibs.rebase" value="true"/>
|
||||
<available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
|
||||
<condition property="junit.available">
|
||||
<or>
|
||||
<available classname="org.junit.Test" classpath="${run.test.classpath}"/>
|
||||
<available classname="junit.framework.Test" classpath="${run.test.classpath}"/>
|
||||
</or>
|
||||
</condition>
|
||||
<condition property="testng.available">
|
||||
<available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/>
|
||||
</condition>
|
||||
<condition property="junit+testng.available">
|
||||
<and>
|
||||
<istrue value="${junit.available}"/>
|
||||
<istrue value="${testng.available}"/>
|
||||
</and>
|
||||
</condition>
|
||||
<condition else="testng" property="testng.mode" value="mixed">
|
||||
<istrue value="${junit+testng.available}"/>
|
||||
</condition>
|
||||
<condition else="" property="testng.debug.mode" value="-mixed">
|
||||
<istrue value="${junit+testng.available}"/>
|
||||
</condition>
|
||||
</target>
|
||||
<target name="-post-init">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
@@ -357,11 +379,52 @@ is divided into following sections:
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target name="-init-macrodef-junit">
|
||||
<target if="${junit.available}" name="-init-macrodef-junit-init">
|
||||
<condition else="false" property="nb.junit.batch" value="true">
|
||||
<and>
|
||||
<istrue value="${junit.available}"/>
|
||||
<not>
|
||||
<isset property="test.method"/>
|
||||
</not>
|
||||
</and>
|
||||
</condition>
|
||||
<condition else="false" property="nb.junit.single" value="true">
|
||||
<and>
|
||||
<istrue value="${junit.available}"/>
|
||||
<isset property="test.method"/>
|
||||
</and>
|
||||
</condition>
|
||||
</target>
|
||||
<target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
|
||||
<macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="**" name="testincludes"/>
|
||||
<attribute default="" name="testmethods"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<property name="junit.forkmode" value="perTest"/>
|
||||
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
|
||||
<test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="test-sys-prop."/>
|
||||
<mapper from="test-sys-prop.*" to="*" type="glob"/>
|
||||
</syspropertyset>
|
||||
<formatter type="brief" usefile="false"/>
|
||||
<formatter type="xml"/>
|
||||
<jvmarg value="-ea"/>
|
||||
<customize/>
|
||||
</junit>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
|
||||
<macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="**" name="testincludes"/>
|
||||
<attribute default="" name="testmethods"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<property name="junit.forkmode" value="perTest"/>
|
||||
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
|
||||
@@ -370,32 +433,270 @@ is divided into following sections:
|
||||
<filename name="@{testincludes}"/>
|
||||
</fileset>
|
||||
</batchtest>
|
||||
<classpath>
|
||||
<path path="${run.test.classpath}"/>
|
||||
</classpath>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="test-sys-prop."/>
|
||||
<mapper from="test-sys-prop.*" to="*" type="glob"/>
|
||||
</syspropertyset>
|
||||
<formatter type="brief" usefile="false"/>
|
||||
<formatter type="xml"/>
|
||||
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
|
||||
<jvmarg value="-ea"/>
|
||||
<jvmarg line="${run.jvmargs}"/>
|
||||
<customize/>
|
||||
</junit>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/>
|
||||
<target name="-profile-pre-init">
|
||||
<target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/>
|
||||
<target if="${testng.available}" name="-init-macrodef-testng">
|
||||
<macrodef name="testng" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="**" name="testincludes"/>
|
||||
<attribute default="" name="testmethods"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}">
|
||||
<isset property="test.method"/>
|
||||
</condition>
|
||||
<union id="test.set">
|
||||
<fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
|
||||
<filename name="@{testincludes}"/>
|
||||
</fileset>
|
||||
</union>
|
||||
<taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
|
||||
<testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="Essentials" testname="TestNG tests" workingDir="${work.dir}">
|
||||
<xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
|
||||
<propertyset>
|
||||
<propertyref prefix="test-sys-prop."/>
|
||||
<mapper from="test-sys-prop.*" to="*" type="glob"/>
|
||||
</propertyset>
|
||||
<customize/>
|
||||
</testng>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target name="-init-macrodef-test-impl">
|
||||
<macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="**" name="testincludes"/>
|
||||
<attribute default="" name="testmethods"/>
|
||||
<element implicit="true" name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<echo>No tests executed.</echo>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl">
|
||||
<macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="**" name="testincludes"/>
|
||||
<attribute default="" name="testmethods"/>
|
||||
<element implicit="true" name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
|
||||
<customize/>
|
||||
</j2seproject3:junit>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl">
|
||||
<macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="**" name="testincludes"/>
|
||||
<attribute default="" name="testmethods"/>
|
||||
<element implicit="true" name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<j2seproject3:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
|
||||
<customize/>
|
||||
</j2seproject3:testng>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test">
|
||||
<macrodef name="test" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="**" name="testincludes"/>
|
||||
<attribute default="" name="testmethods"/>
|
||||
<sequential>
|
||||
<j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
|
||||
<customize>
|
||||
<classpath>
|
||||
<path path="${run.test.classpath}"/>
|
||||
</classpath>
|
||||
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
|
||||
<jvmarg line="${run.jvmargs}"/>
|
||||
<jvmarg line="${run.jvmargs.ide}"/>
|
||||
</customize>
|
||||
</j2seproject3:test-impl>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}">
|
||||
<macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="**" name="testincludes"/>
|
||||
<attribute default="" name="testmethods"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<property name="junit.forkmode" value="perTest"/>
|
||||
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
|
||||
<test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="test-sys-prop."/>
|
||||
<mapper from="test-sys-prop.*" to="*" type="glob"/>
|
||||
</syspropertyset>
|
||||
<formatter type="brief" usefile="false"/>
|
||||
<formatter type="xml"/>
|
||||
<jvmarg value="-ea"/>
|
||||
<jvmarg line="${debug-args-line}"/>
|
||||
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
|
||||
<customize/>
|
||||
</junit>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
|
||||
<macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="**" name="testincludes"/>
|
||||
<attribute default="" name="testmethods"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<property name="junit.forkmode" value="perTest"/>
|
||||
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
|
||||
<batchtest todir="${build.test.results.dir}">
|
||||
<fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
|
||||
<filename name="@{testincludes}"/>
|
||||
</fileset>
|
||||
</batchtest>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="test-sys-prop."/>
|
||||
<mapper from="test-sys-prop.*" to="*" type="glob"/>
|
||||
</syspropertyset>
|
||||
<formatter type="brief" usefile="false"/>
|
||||
<formatter type="xml"/>
|
||||
<jvmarg value="-ea"/>
|
||||
<jvmarg line="${debug-args-line}"/>
|
||||
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
|
||||
<customize/>
|
||||
</junit>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
|
||||
<macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="**" name="testincludes"/>
|
||||
<attribute default="" name="testmethods"/>
|
||||
<element implicit="true" name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
|
||||
<customize/>
|
||||
</j2seproject3:junit-debug>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target if="${testng.available}" name="-init-macrodef-testng-debug">
|
||||
<macrodef name="testng-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${main.class}" name="testClass"/>
|
||||
<attribute default="" name="testMethod"/>
|
||||
<element name="customize2" optional="true"/>
|
||||
<sequential>
|
||||
<condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}">
|
||||
<isset property="test.method"/>
|
||||
</condition>
|
||||
<condition else="-suitename Essentials -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
|
||||
<matches pattern=".*\.xml" string="@{testClass}"/>
|
||||
</condition>
|
||||
<delete dir="${build.test.results.dir}" quiet="true"/>
|
||||
<mkdir dir="${build.test.results.dir}"/>
|
||||
<j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}">
|
||||
<customize>
|
||||
<customize2/>
|
||||
<jvmarg value="-ea"/>
|
||||
<arg line="${testng.debug.mode}"/>
|
||||
<arg line="-d ${build.test.results.dir}"/>
|
||||
<arg line="-listener org.testng.reporters.VerboseReporter"/>
|
||||
<arg line="${testng.cmd.args}"/>
|
||||
</customize>
|
||||
</j2seproject3:debug>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl">
|
||||
<macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${main.class}" name="testClass"/>
|
||||
<attribute default="" name="testMethod"/>
|
||||
<element implicit="true" name="customize2" optional="true"/>
|
||||
<sequential>
|
||||
<j2seproject3:testng-debug testClass="@{testClass}" testMethod="@{testMethod}">
|
||||
<customize2/>
|
||||
</j2seproject3:testng-debug>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit">
|
||||
<macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="**" name="testincludes"/>
|
||||
<attribute default="" name="testmethods"/>
|
||||
<attribute default="${main.class}" name="testClass"/>
|
||||
<attribute default="" name="testMethod"/>
|
||||
<sequential>
|
||||
<j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
|
||||
<customize>
|
||||
<classpath>
|
||||
<path path="${run.test.classpath}"/>
|
||||
</classpath>
|
||||
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
|
||||
<jvmarg line="${run.jvmargs}"/>
|
||||
<jvmarg line="${run.jvmargs.ide}"/>
|
||||
</customize>
|
||||
</j2seproject3:test-debug-impl>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng">
|
||||
<macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="**" name="testincludes"/>
|
||||
<attribute default="" name="testmethods"/>
|
||||
<attribute default="${main.class}" name="testClass"/>
|
||||
<attribute default="" name="testMethod"/>
|
||||
<sequential>
|
||||
<j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
|
||||
<customize2>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="test-sys-prop."/>
|
||||
<mapper from="test-sys-prop.*" to="*" type="glob"/>
|
||||
</syspropertyset>
|
||||
</customize2>
|
||||
</j2seproject3:testng-debug-impl>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/>
|
||||
<!--
|
||||
pre NB7.2 profiling section; consider it deprecated
|
||||
-->
|
||||
<target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
|
||||
<target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="-profile-post-init">
|
||||
<target if="profiler.info.jvmargs.agent" name="-profile-post-init">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="-profile-init-macrodef-profile">
|
||||
<target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile">
|
||||
<macrodef name="resolve">
|
||||
<attribute name="name"/>
|
||||
<attribute name="value"/>
|
||||
@@ -427,10 +728,13 @@ is divided into following sections:
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check">
|
||||
<target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check">
|
||||
<fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
|
||||
<fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
|
||||
</target>
|
||||
<!--
|
||||
end of pre NB7.2 profiling section
|
||||
-->
|
||||
<target depends="-init-debug-args" name="-init-macrodef-nbjpda">
|
||||
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
|
||||
<attribute default="${main.class}" name="name"/>
|
||||
@@ -488,6 +792,7 @@ is divided into following sections:
|
||||
<jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
|
||||
<redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
|
||||
<jvmarg line="${run.jvmargs}"/>
|
||||
<jvmarg line="${run.jvmargs.ide}"/>
|
||||
<classpath>
|
||||
<path path="@{classpath}"/>
|
||||
</classpath>
|
||||
@@ -504,6 +809,7 @@ is divided into following sections:
|
||||
<macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
|
||||
<attribute default="${main.class}" name="classname"/>
|
||||
<attribute default="${run.classpath}" name="classpath"/>
|
||||
<attribute default="jvm" name="jvm"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<java classname="@{classname}" dir="${work.dir}" fork="true">
|
||||
@@ -511,6 +817,7 @@ is divided into following sections:
|
||||
<jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
|
||||
<redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
|
||||
<jvmarg line="${run.jvmargs}"/>
|
||||
<jvmarg line="${run.jvmargs.ide}"/>
|
||||
<classpath>
|
||||
<path path="@{classpath}"/>
|
||||
</classpath>
|
||||
@@ -537,6 +844,9 @@ is divided into following sections:
|
||||
<path path="${run.classpath.without.build.classes.dir}"/>
|
||||
<chainedmapper>
|
||||
<flattenmapper/>
|
||||
<filtermapper>
|
||||
<replacestring from=" " to="%20"/>
|
||||
</filtermapper>
|
||||
<globmapper from="*" to="lib/*"/>
|
||||
</chainedmapper>
|
||||
</pathconvert>
|
||||
@@ -582,7 +892,7 @@ is divided into following sections:
|
||||
<target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
|
||||
<property name="ap.cmd.line.internal" value=""/>
|
||||
</target>
|
||||
<target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
|
||||
<target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
|
||||
<!--
|
||||
===================
|
||||
COMPILATION SECTION
|
||||
@@ -805,7 +1115,11 @@ is divided into following sections:
|
||||
PROFILING SECTION
|
||||
=================
|
||||
-->
|
||||
<target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile">
|
||||
<!--
|
||||
pre NB7.2 profiler integration
|
||||
-->
|
||||
<target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
|
||||
<fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
|
||||
<nbprofiledirect>
|
||||
<classpath>
|
||||
<path path="${run.classpath}"/>
|
||||
@@ -813,8 +1127,9 @@ is divided into following sections:
|
||||
</nbprofiledirect>
|
||||
<profile/>
|
||||
</target>
|
||||
<target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single">
|
||||
<target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72">
|
||||
<fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
|
||||
<fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
|
||||
<nbprofiledirect>
|
||||
<classpath>
|
||||
<path path="${run.classpath}"/>
|
||||
@@ -822,12 +1137,8 @@ is divided into following sections:
|
||||
</nbprofiledirect>
|
||||
<profile classname="${profile.class}"/>
|
||||
</target>
|
||||
<!--
|
||||
=========================
|
||||
APPLET PROFILING SECTION
|
||||
=========================
|
||||
-->
|
||||
<target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet">
|
||||
<target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72">
|
||||
<fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
|
||||
<nbprofiledirect>
|
||||
<classpath>
|
||||
<path path="${run.classpath}"/>
|
||||
@@ -839,12 +1150,8 @@ is divided into following sections:
|
||||
</customize>
|
||||
</profile>
|
||||
</target>
|
||||
<!--
|
||||
=========================
|
||||
TESTS PROFILING SECTION
|
||||
=========================
|
||||
-->
|
||||
<target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single">
|
||||
<target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
|
||||
<fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
|
||||
<nbprofiledirect>
|
||||
<classpath>
|
||||
<path path="${run.test.classpath}"/>
|
||||
@@ -866,6 +1173,42 @@ is divided into following sections:
|
||||
<formatter type="xml"/>
|
||||
</junit>
|
||||
</target>
|
||||
<!--
|
||||
end of pre NB72 profiling section
|
||||
-->
|
||||
<target if="netbeans.home" name="-profile-check">
|
||||
<condition property="profiler.configured">
|
||||
<or>
|
||||
<contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
|
||||
<contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
|
||||
</or>
|
||||
</condition>
|
||||
</target>
|
||||
<target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent">
|
||||
<startprofiler/>
|
||||
<antcall target="run"/>
|
||||
</target>
|
||||
<target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent">
|
||||
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
|
||||
<startprofiler/>
|
||||
<antcall target="run-single"/>
|
||||
</target>
|
||||
<target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/>
|
||||
<target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs">
|
||||
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
|
||||
<startprofiler/>
|
||||
<antcall target="test-single"/>
|
||||
</target>
|
||||
<target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main">
|
||||
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
|
||||
<startprofiler/>
|
||||
<antcal target="run-test-with-main"/>
|
||||
</target>
|
||||
<target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent">
|
||||
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
|
||||
<startprofiler/>
|
||||
<antcall target="run-applet"/>
|
||||
</target>
|
||||
<!--
|
||||
===============
|
||||
JAVADOC SECTION
|
||||
@@ -909,7 +1252,7 @@ is divided into following sections:
|
||||
<target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
|
||||
<!--
|
||||
=========================
|
||||
JUNIT COMPILATION SECTION
|
||||
TEST COMPILATION SECTION
|
||||
=========================
|
||||
-->
|
||||
<target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
|
||||
@@ -952,14 +1295,14 @@ is divided into following sections:
|
||||
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
|
||||
<!--
|
||||
=======================
|
||||
JUNIT EXECUTION SECTION
|
||||
TEST EXECUTION SECTION
|
||||
=======================
|
||||
-->
|
||||
<target depends="init" if="have.tests" name="-pre-test-run">
|
||||
<mkdir dir="${build.test.results.dir}"/>
|
||||
</target>
|
||||
<target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
|
||||
<j2seproject3:junit testincludes="**/*Test.java"/>
|
||||
<j2seproject3:test testincludes="**/*Test.java"/>
|
||||
</target>
|
||||
<target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
|
||||
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
|
||||
@@ -972,39 +1315,40 @@ is divided into following sections:
|
||||
</target>
|
||||
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
|
||||
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
|
||||
<j2seproject3:junit excludes="" includes="${test.includes}"/>
|
||||
<j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/>
|
||||
</target>
|
||||
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
|
||||
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
|
||||
</target>
|
||||
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
|
||||
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method">
|
||||
<fail unless="test.class">Must select some files in the IDE or set test.class</fail>
|
||||
<fail unless="test.method">Must select some method in the IDE or set test.method</fail>
|
||||
<j2seproject3:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/>
|
||||
</target>
|
||||
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method">
|
||||
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
|
||||
</target>
|
||||
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/>
|
||||
<!--
|
||||
=======================
|
||||
JUNIT DEBUGGING SECTION
|
||||
TEST DEBUGGING SECTION
|
||||
=======================
|
||||
-->
|
||||
<target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
|
||||
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test">
|
||||
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
|
||||
<property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
|
||||
<delete file="${test.report.file}"/>
|
||||
<mkdir dir="${build.test.results.dir}"/>
|
||||
<j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
|
||||
<customize>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="test-sys-prop."/>
|
||||
<mapper from="test-sys-prop.*" to="*" type="glob"/>
|
||||
</syspropertyset>
|
||||
<arg value="${test.class}"/>
|
||||
<arg value="showoutput=true"/>
|
||||
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
|
||||
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
|
||||
</customize>
|
||||
</j2seproject3:debug>
|
||||
<j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
|
||||
</target>
|
||||
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method">
|
||||
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
|
||||
<fail unless="test.method">Must select some method in the IDE or set test.method</fail>
|
||||
<j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/>
|
||||
</target>
|
||||
<target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
|
||||
<j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
|
||||
</target>
|
||||
<target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
|
||||
<target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/>
|
||||
<target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
|
||||
<j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
|
||||
</target>
|
||||
@@ -1076,9 +1420,12 @@ is divided into following sections:
|
||||
<target name="-check-call-dep">
|
||||
<property file="${call.built.properties}" prefix="already.built."/>
|
||||
<condition property="should.call.dep">
|
||||
<not>
|
||||
<isset property="already.built.${call.subproject}"/>
|
||||
</not>
|
||||
<and>
|
||||
<not>
|
||||
<isset property="already.built.${call.subproject}"/>
|
||||
</not>
|
||||
<available file="${call.script}"/>
|
||||
</and>
|
||||
</condition>
|
||||
</target>
|
||||
<target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
|
||||
|
@@ -4,8 +4,8 @@ build.xml.stylesheet.CRC32=28e38971@1.38.2.45
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=a830bc14
|
||||
nbproject/build-impl.xml.script.CRC32=a9f8842a
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.1.46
|
||||
nbproject/build-impl.xml.script.CRC32=7c507372
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46
|
||||
nbproject/profiler-build-impl.xml.data.CRC32=ab78ce15
|
||||
nbproject/profiler-build-impl.xml.script.CRC32=abda56ed
|
||||
nbproject/profiler-build-impl.xml.stylesheet.CRC32=f10cf54c@1.11.1
|
||||
|
@@ -1,5 +1,5 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.enabled.in.editor=true
|
||||
annotation.processing.processors.list=lombok.core.AnnotationProcessor
|
||||
annotation.processing.run.all.processors=false
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
|
@@ -269,11 +269,11 @@ public final class DescParseTickFormat
|
||||
|
||||
// How many ingame days have passed since the server start?
|
||||
final long days = ticks / ticksPerDay;
|
||||
ticks = ticks - days * ticksPerDay;
|
||||
ticks -= days * ticksPerDay;
|
||||
|
||||
// How many hours on the last day?
|
||||
final long hours = ticks / ticksPerHour;
|
||||
ticks = ticks - hours * ticksPerHour;
|
||||
ticks -= hours * ticksPerHour;
|
||||
|
||||
// How many minutes on the last day?
|
||||
final long minutes = (long)Math.floor(ticks / ticksPerMinute);
|
||||
|
@@ -13,99 +13,123 @@ public class Enchantments
|
||||
{
|
||||
private static final transient Pattern NUMPATTERN = Pattern.compile("\\d+");
|
||||
private static final Map<String, Enchantment> ENCHANTMENTS = new HashMap<String, Enchantment>();
|
||||
private static final Map<String, Enchantment> ALIASENCHANTMENTS = new HashMap<String, Enchantment>();
|
||||
|
||||
static
|
||||
{
|
||||
ENCHANTMENTS.put("alldamage", Enchantment.DAMAGE_ALL);
|
||||
ENCHANTMENTS.put("alldmg", Enchantment.DAMAGE_ALL);
|
||||
ALIASENCHANTMENTS.put("alldmg", Enchantment.DAMAGE_ALL);
|
||||
ENCHANTMENTS.put("sharpness", Enchantment.DAMAGE_ALL);
|
||||
ENCHANTMENTS.put("sharp", Enchantment.DAMAGE_ALL);
|
||||
|
||||
ENCHANTMENTS.put("arthropodsdamage", Enchantment.DAMAGE_ARTHROPODS);
|
||||
ALIASENCHANTMENTS.put("dal", Enchantment.DAMAGE_ALL);
|
||||
|
||||
ENCHANTMENTS.put("ardmg", Enchantment.DAMAGE_ARTHROPODS);
|
||||
ENCHANTMENTS.put("baneofarthropods", Enchantment.DAMAGE_ARTHROPODS);
|
||||
ENCHANTMENTS.put("baneofarthropod", Enchantment.DAMAGE_ARTHROPODS);
|
||||
ENCHANTMENTS.put("arthropod", Enchantment.DAMAGE_ARTHROPODS);
|
||||
ALIASENCHANTMENTS.put("baneofarthropod", Enchantment.DAMAGE_ARTHROPODS);
|
||||
ALIASENCHANTMENTS.put("arthropod", Enchantment.DAMAGE_ARTHROPODS);
|
||||
ALIASENCHANTMENTS.put("dar", Enchantment.DAMAGE_ARTHROPODS);
|
||||
|
||||
ENCHANTMENTS.put("undeaddamage", Enchantment.DAMAGE_UNDEAD);
|
||||
ENCHANTMENTS.put("smite", Enchantment.DAMAGE_UNDEAD);
|
||||
ALIASENCHANTMENTS.put("du", Enchantment.DAMAGE_UNDEAD);
|
||||
|
||||
ENCHANTMENTS.put("digspeed", Enchantment.DIG_SPEED);
|
||||
ENCHANTMENTS.put("efficiency", Enchantment.DIG_SPEED);
|
||||
ENCHANTMENTS.put("minespeed", Enchantment.DIG_SPEED);
|
||||
ENCHANTMENTS.put("cutspeed", Enchantment.DIG_SPEED);
|
||||
ALIASENCHANTMENTS.put("minespeed", Enchantment.DIG_SPEED);
|
||||
ALIASENCHANTMENTS.put("cutspeed", Enchantment.DIG_SPEED);
|
||||
ALIASENCHANTMENTS.put("ds", Enchantment.DIG_SPEED);
|
||||
|
||||
ENCHANTMENTS.put("durability", Enchantment.DURABILITY);
|
||||
ENCHANTMENTS.put("dura", Enchantment.DURABILITY);
|
||||
ENCHANTMENTS.put("unbreaking", Enchantment.DURABILITY);
|
||||
ALIASENCHANTMENTS.put("d", Enchantment.DURABILITY);
|
||||
|
||||
ENCHANTMENTS.put("fireaspect", Enchantment.FIRE_ASPECT);
|
||||
ENCHANTMENTS.put("fire", Enchantment.FIRE_ASPECT);
|
||||
ENCHANTMENTS.put("meleefire", Enchantment.FIRE_ASPECT);
|
||||
ENCHANTMENTS.put("meleeflame", Enchantment.FIRE_ASPECT);
|
||||
ALIASENCHANTMENTS.put("meleefire", Enchantment.FIRE_ASPECT);
|
||||
ALIASENCHANTMENTS.put("meleeflame", Enchantment.FIRE_ASPECT);
|
||||
ALIASENCHANTMENTS.put("fa", Enchantment.FIRE_ASPECT);
|
||||
|
||||
ENCHANTMENTS.put("knockback", Enchantment.KNOCKBACK);
|
||||
ALIASENCHANTMENTS.put("k", Enchantment.KNOCKBACK);
|
||||
|
||||
ENCHANTMENTS.put("blockslootbonus", Enchantment.LOOT_BONUS_BLOCKS);
|
||||
ALIASENCHANTMENTS.put("blockslootbonus", Enchantment.LOOT_BONUS_BLOCKS);
|
||||
ENCHANTMENTS.put("fortune", Enchantment.LOOT_BONUS_BLOCKS);
|
||||
ALIASENCHANTMENTS.put("lbb", Enchantment.LOOT_BONUS_BLOCKS);
|
||||
|
||||
ENCHANTMENTS.put("mobslootbonus", Enchantment.LOOT_BONUS_MOBS);
|
||||
ALIASENCHANTMENTS.put("mobslootbonus", Enchantment.LOOT_BONUS_MOBS);
|
||||
ENCHANTMENTS.put("mobloot", Enchantment.LOOT_BONUS_MOBS);
|
||||
ENCHANTMENTS.put("looting", Enchantment.LOOT_BONUS_MOBS);
|
||||
ALIASENCHANTMENTS.put("lbm", Enchantment.LOOT_BONUS_MOBS);
|
||||
|
||||
ENCHANTMENTS.put("oxygen", Enchantment.OXYGEN);
|
||||
ALIASENCHANTMENTS.put("oxygen", Enchantment.OXYGEN);
|
||||
ENCHANTMENTS.put("respiration", Enchantment.OXYGEN);
|
||||
ENCHANTMENTS.put("breathing", Enchantment.OXYGEN);
|
||||
ALIASENCHANTMENTS.put("breathing", Enchantment.OXYGEN);
|
||||
ENCHANTMENTS.put("breath", Enchantment.OXYGEN);
|
||||
ALIASENCHANTMENTS.put("o", Enchantment.OXYGEN);
|
||||
|
||||
ENCHANTMENTS.put("protection", Enchantment.PROTECTION_ENVIRONMENTAL);
|
||||
ENCHANTMENTS.put("prot", Enchantment.PROTECTION_ENVIRONMENTAL);
|
||||
ALIASENCHANTMENTS.put("prot", Enchantment.PROTECTION_ENVIRONMENTAL);
|
||||
ENCHANTMENTS.put("protect", Enchantment.PROTECTION_ENVIRONMENTAL);
|
||||
ALIASENCHANTMENTS.put("p", Enchantment.PROTECTION_ENVIRONMENTAL);
|
||||
|
||||
ENCHANTMENTS.put("explosionsprotection", Enchantment.PROTECTION_EXPLOSIONS);
|
||||
ENCHANTMENTS.put("explosionprotection", Enchantment.PROTECTION_EXPLOSIONS);
|
||||
ENCHANTMENTS.put("expprot", Enchantment.PROTECTION_EXPLOSIONS);
|
||||
ENCHANTMENTS.put("blastprotection", Enchantment.PROTECTION_EXPLOSIONS);
|
||||
ALIASENCHANTMENTS.put("explosionsprotection", Enchantment.PROTECTION_EXPLOSIONS);
|
||||
ALIASENCHANTMENTS.put("explosionprotection", Enchantment.PROTECTION_EXPLOSIONS);
|
||||
ALIASENCHANTMENTS.put("expprot", Enchantment.PROTECTION_EXPLOSIONS);
|
||||
ALIASENCHANTMENTS.put("blastprotection", Enchantment.PROTECTION_EXPLOSIONS);
|
||||
ENCHANTMENTS.put("blastprotect", Enchantment.PROTECTION_EXPLOSIONS);
|
||||
ALIASENCHANTMENTS.put("pe", Enchantment.PROTECTION_EXPLOSIONS);
|
||||
|
||||
ENCHANTMENTS.put("fallprotection", Enchantment.PROTECTION_FALL);
|
||||
ALIASENCHANTMENTS.put("fallprotection", Enchantment.PROTECTION_FALL);
|
||||
ENCHANTMENTS.put("fallprot", Enchantment.PROTECTION_FALL);
|
||||
ENCHANTMENTS.put("featherfall", Enchantment.PROTECTION_FALL);
|
||||
ENCHANTMENTS.put("featherfalling", Enchantment.PROTECTION_FALL);
|
||||
ALIASENCHANTMENTS.put("pfa", Enchantment.PROTECTION_FALL);
|
||||
|
||||
ENCHANTMENTS.put("fireprotection", Enchantment.PROTECTION_FIRE);
|
||||
ENCHANTMENTS.put("flameprotection", Enchantment.PROTECTION_FIRE);
|
||||
ALIASENCHANTMENTS.put("fireprotection", Enchantment.PROTECTION_FIRE);
|
||||
ALIASENCHANTMENTS.put("flameprotection", Enchantment.PROTECTION_FIRE);
|
||||
ENCHANTMENTS.put("fireprotect", Enchantment.PROTECTION_FIRE);
|
||||
ENCHANTMENTS.put("flameprotect", Enchantment.PROTECTION_FIRE);
|
||||
ALIASENCHANTMENTS.put("flameprotect", Enchantment.PROTECTION_FIRE);
|
||||
ENCHANTMENTS.put("fireprot", Enchantment.PROTECTION_FIRE);
|
||||
ALIASENCHANTMENTS.put("flameprot", Enchantment.PROTECTION_FIRE);
|
||||
ALIASENCHANTMENTS.put("pf", Enchantment.PROTECTION_FIRE);
|
||||
|
||||
ENCHANTMENTS.put("projectileprotection", Enchantment.PROTECTION_PROJECTILE);
|
||||
ENCHANTMENTS.put("projprot", Enchantment.PROTECTION_PROJECTILE);
|
||||
ALIASENCHANTMENTS.put("pp", Enchantment.PROTECTION_PROJECTILE);
|
||||
|
||||
ENCHANTMENTS.put("silktouch", Enchantment.SILK_TOUCH);
|
||||
ENCHANTMENTS.put("softtouch", Enchantment.SILK_TOUCH);
|
||||
ALIASENCHANTMENTS.put("softtouch", Enchantment.SILK_TOUCH);
|
||||
ALIASENCHANTMENTS.put("st", Enchantment.SILK_TOUCH);
|
||||
|
||||
ENCHANTMENTS.put("waterworker", Enchantment.WATER_WORKER);
|
||||
ENCHANTMENTS.put("aquaaffinity", Enchantment.WATER_WORKER);
|
||||
ALIASENCHANTMENTS.put("watermine", Enchantment.WATER_WORKER);
|
||||
ALIASENCHANTMENTS.put("ww", Enchantment.WATER_WORKER);
|
||||
|
||||
ENCHANTMENTS.put("firearrow", Enchantment.ARROW_FIRE);
|
||||
ALIASENCHANTMENTS.put("firearrow", Enchantment.ARROW_FIRE);
|
||||
ENCHANTMENTS.put("flame", Enchantment.ARROW_FIRE);
|
||||
ENCHANTMENTS.put("flamearrow", Enchantment.ARROW_FIRE);
|
||||
ALIASENCHANTMENTS.put("af", Enchantment.ARROW_FIRE);
|
||||
|
||||
ENCHANTMENTS.put("arrowdamage", Enchantment.ARROW_DAMAGE);
|
||||
ENCHANTMENTS.put("power", Enchantment.ARROW_DAMAGE);
|
||||
ENCHANTMENTS.put("arrowpower", Enchantment.ARROW_DAMAGE);
|
||||
ALIASENCHANTMENTS.put("arrowpower", Enchantment.ARROW_DAMAGE);
|
||||
ALIASENCHANTMENTS.put("ad", Enchantment.ARROW_DAMAGE);
|
||||
|
||||
ENCHANTMENTS.put("arrowknockback", Enchantment.ARROW_KNOCKBACK);
|
||||
ENCHANTMENTS.put("arrowkb", Enchantment.ARROW_KNOCKBACK);
|
||||
ALIASENCHANTMENTS.put("arrowkb", Enchantment.ARROW_KNOCKBACK);
|
||||
ENCHANTMENTS.put("punch", Enchantment.ARROW_KNOCKBACK);
|
||||
ENCHANTMENTS.put("arrowpunch", Enchantment.ARROW_KNOCKBACK);
|
||||
ALIASENCHANTMENTS.put("arrowpunch", Enchantment.ARROW_KNOCKBACK);
|
||||
ALIASENCHANTMENTS.put("ak", Enchantment.ARROW_KNOCKBACK);
|
||||
|
||||
ENCHANTMENTS.put("infinitearrows", Enchantment.ARROW_INFINITE);
|
||||
ALIASENCHANTMENTS.put("infinitearrows", Enchantment.ARROW_INFINITE);
|
||||
ENCHANTMENTS.put("infarrows", Enchantment.ARROW_INFINITE);
|
||||
ENCHANTMENTS.put("infinity", Enchantment.ARROW_INFINITE);
|
||||
ENCHANTMENTS.put("infinite", Enchantment.ARROW_INFINITE);
|
||||
ENCHANTMENTS.put("unlimited", Enchantment.ARROW_INFINITE);
|
||||
ENCHANTMENTS.put("unlimitedarrows", Enchantment.ARROW_INFINITE);
|
||||
ALIASENCHANTMENTS.put("infinite", Enchantment.ARROW_INFINITE);
|
||||
ALIASENCHANTMENTS.put("unlimited", Enchantment.ARROW_INFINITE);
|
||||
ALIASENCHANTMENTS.put("unlimitedarrows", Enchantment.ARROW_INFINITE);
|
||||
ALIASENCHANTMENTS.put("ai", Enchantment.ARROW_INFINITE);
|
||||
}
|
||||
|
||||
public static Enchantment getByName(String name) {
|
||||
@@ -119,6 +143,10 @@ public class Enchantments
|
||||
{
|
||||
enchantment = ENCHANTMENTS.get(name.toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
if (enchantment == null)
|
||||
{
|
||||
enchantment = ALIASENCHANTMENTS.get(name.toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
return enchantment;
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,6 @@ package com.earth2me.essentials;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.Economy;
|
||||
import com.earth2me.essentials.api.IJails;
|
||||
import com.earth2me.essentials.commands.EssentialsCommand;
|
||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||
import com.earth2me.essentials.commands.NoChargeException;
|
||||
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
||||
@@ -36,7 +35,6 @@ import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -67,7 +65,7 @@ import org.yaml.snakeyaml.error.YAMLException;
|
||||
|
||||
public class Essentials extends JavaPlugin implements IEssentials
|
||||
{
|
||||
public static final int BUKKIT_VERSION = 2149;
|
||||
public static final int BUKKIT_VERSION = 2396;
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
private transient ISettings settings;
|
||||
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);
|
||||
@@ -330,7 +328,6 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
user = getUser(sender);
|
||||
LOGGER.log(Level.INFO, String.format("[PLAYER_COMMAND] %s: /%s %s ", ((Player)sender).getName(), commandLabel, EssentialsCommand.getFinalArg(args, 0)));
|
||||
}
|
||||
|
||||
// New mail notification
|
||||
@@ -470,15 +467,21 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
}
|
||||
if (base instanceof String)
|
||||
{
|
||||
final User user = userMap.getUser((String)base);
|
||||
if (user != null && user.getBase() instanceof OfflinePlayer)
|
||||
{
|
||||
((OfflinePlayer)user.getBase()).setName((String)base);
|
||||
}
|
||||
return user;
|
||||
return getOfflineUser((String)base);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getOfflineUser(final String name)
|
||||
{
|
||||
final User user = userMap.getUser(name);
|
||||
if (user != null && user.getBase() instanceof OfflinePlayer)
|
||||
{
|
||||
((OfflinePlayer)user.getBase()).setName(name);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
private <T extends Player> User getUser(final T base)
|
||||
{
|
||||
@@ -491,6 +494,13 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
{
|
||||
return (User)base;
|
||||
}
|
||||
|
||||
if (userMap == null)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "Essentials userMap not initialized");
|
||||
return null;
|
||||
}
|
||||
|
||||
User user = userMap.getUser(base.getName());
|
||||
|
||||
if (user == null)
|
||||
@@ -504,17 +514,6 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getOfflineUser(final String name)
|
||||
{
|
||||
final User user = userMap.getUser(name);
|
||||
if (user != null && user.getBase() instanceof OfflinePlayer)
|
||||
{
|
||||
((OfflinePlayer)user.getBase()).setName(name);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld(final String name)
|
||||
{
|
||||
@@ -638,6 +637,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
return vanishedPlayers;
|
||||
}
|
||||
|
||||
|
||||
private static class EssentialsWorldListener implements Listener, Runnable
|
||||
{
|
||||
private transient final IEssentials ess;
|
||||
|
@@ -5,24 +5,20 @@ import com.google.common.io.Files;
|
||||
import java.io.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
|
||||
public class EssentialsConf extends YamlConfiguration
|
||||
@@ -38,6 +34,7 @@ public class EssentialsConf extends YamlConfiguration
|
||||
super();
|
||||
this.configFile = configFile;
|
||||
}
|
||||
private final byte[] bytebuffer = new byte[1024];
|
||||
|
||||
public synchronized void load()
|
||||
{
|
||||
@@ -94,18 +91,7 @@ public class EssentialsConf extends YamlConfiguration
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("creatingEmptyConfig", configFile.toString()));
|
||||
if (!configFile.createNewFile())
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()));
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()), ex);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,9 +101,12 @@ public class EssentialsConf extends YamlConfiguration
|
||||
final FileInputStream inputStream = new FileInputStream(configFile);
|
||||
try
|
||||
{
|
||||
final FileChannel channel = inputStream.getChannel();
|
||||
final ByteBuffer buffer = ByteBuffer.allocate((int)configFile.length());
|
||||
channel.read(buffer);
|
||||
int length;
|
||||
while ((length = inputStream.read(bytebuffer)) != -1)
|
||||
{
|
||||
buffer.put(bytebuffer, 0, length);
|
||||
}
|
||||
buffer.rewind();
|
||||
final CharBuffer data = CharBuffer.allocate((int)configFile.length());
|
||||
CharsetDecoder decoder = UTF8.newDecoder();
|
||||
@@ -355,6 +344,11 @@ public class EssentialsConf extends YamlConfiguration
|
||||
}
|
||||
}
|
||||
|
||||
public void saveWithError() throws IOException
|
||||
{
|
||||
save(configFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void save(final File file) throws IOException
|
||||
{
|
||||
@@ -367,6 +361,28 @@ public class EssentialsConf extends YamlConfiguration
|
||||
|
||||
final String data = saveToString();
|
||||
|
||||
if (data.length() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!configFile.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("creatingEmptyConfig", configFile.toString()));
|
||||
if (!configFile.createNewFile())
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()));
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
final OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file), UTF8);
|
||||
|
||||
try
|
||||
@@ -393,4 +409,261 @@ public class EssentialsConf extends YamlConfiguration
|
||||
{
|
||||
set(path, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Object get(String path)
|
||||
{
|
||||
return super.get(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Object get(String path, Object def)
|
||||
{
|
||||
return super.get(path, def);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean getBoolean(String path)
|
||||
{
|
||||
return super.getBoolean(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean getBoolean(String path, boolean def)
|
||||
{
|
||||
return super.getBoolean(path, def);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized List<Boolean> getBooleanList(String path)
|
||||
{
|
||||
return super.getBooleanList(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized List<Byte> getByteList(String path)
|
||||
{
|
||||
return super.getByteList(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized List<Character> getCharacterList(String path)
|
||||
{
|
||||
return super.getCharacterList(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized ConfigurationSection getConfigurationSection(String path)
|
||||
{
|
||||
return super.getConfigurationSection(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized double getDouble(String path)
|
||||
{
|
||||
return super.getDouble(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized List<Double> getDoubleList(String path)
|
||||
{
|
||||
return super.getDoubleList(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized List<Float> getFloatList(String path)
|
||||
{
|
||||
return super.getFloatList(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized int getInt(String path)
|
||||
{
|
||||
return super.getInt(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized int getInt(String path, int def)
|
||||
{
|
||||
return super.getInt(path, def);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized List<Integer> getIntegerList(String path)
|
||||
{
|
||||
return super.getIntegerList(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized ItemStack getItemStack(String path, ItemStack def)
|
||||
{
|
||||
return super.getItemStack(path, def);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Set<String> getKeys(boolean deep)
|
||||
{
|
||||
return super.getKeys(deep);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized List<?> getList(String path)
|
||||
{
|
||||
return super.getList(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized List<?> getList(String path, List<?> def)
|
||||
{
|
||||
return super.getList(path, def);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized long getLong(String path)
|
||||
{
|
||||
return super.getLong(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized List<Long> getLongList(String path)
|
||||
{
|
||||
return super.getLongList(path);
|
||||
}
|
||||
|
||||
public synchronized Map<String, Object> getMap()
|
||||
{
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized List<Map<?, ?>> getMapList(String path)
|
||||
{
|
||||
return super.getMapList(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized OfflinePlayer getOfflinePlayer(String path)
|
||||
{
|
||||
return super.getOfflinePlayer(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized OfflinePlayer getOfflinePlayer(String path, OfflinePlayer def)
|
||||
{
|
||||
return super.getOfflinePlayer(path, def);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized List<Short> getShortList(String path)
|
||||
{
|
||||
return super.getShortList(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized String getString(String path)
|
||||
{
|
||||
return super.getString(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized String getString(String path, String def)
|
||||
{
|
||||
return super.getString(path, def);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized List<String> getStringList(String path)
|
||||
{
|
||||
return super.getStringList(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Map<String, Object> getValues(boolean deep)
|
||||
{
|
||||
return super.getValues(deep);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Vector getVector(String path)
|
||||
{
|
||||
return super.getVector(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Vector getVector(String path, Vector def)
|
||||
{
|
||||
return super.getVector(path, def);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isBoolean(String path)
|
||||
{
|
||||
return super.isBoolean(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isConfigurationSection(String path)
|
||||
{
|
||||
return super.isConfigurationSection(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isDouble(String path)
|
||||
{
|
||||
return super.isDouble(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isInt(String path)
|
||||
{
|
||||
return super.isInt(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isItemStack(String path)
|
||||
{
|
||||
return super.isItemStack(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isList(String path)
|
||||
{
|
||||
return super.isList(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isLong(String path)
|
||||
{
|
||||
return super.isLong(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isOfflinePlayer(String path)
|
||||
{
|
||||
return super.isOfflinePlayer(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isSet(String path)
|
||||
{
|
||||
return super.isSet(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isString(String path)
|
||||
{
|
||||
return super.isString(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isVector(String path)
|
||||
{
|
||||
return super.isVector(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void set(String path, Object value)
|
||||
{
|
||||
super.set(path, value);
|
||||
}
|
||||
}
|
||||
|
@@ -2,20 +2,24 @@ package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Ageable;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.*;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
import org.bukkit.event.entity.*;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
public class EssentialsEntityListener implements Listener
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
private final IEssentials ess;
|
||||
|
||||
public EssentialsEntityListener(IEssentials ess)
|
||||
@@ -23,6 +27,7 @@ public class EssentialsEntityListener implements Listener
|
||||
this.ess = ess;
|
||||
}
|
||||
|
||||
// This method does something undocumented reguarding certain bucket types #EasterEgg
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onEntityDamage(final EntityDamageByEntityEvent event)
|
||||
{
|
||||
@@ -44,6 +49,16 @@ public class EssentialsEntityListener implements Listener
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
if (attacker.isGodModeEnabled() && !attacker.isAuthorized("essentials.god.pvp"))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
if (attacker.isHidden() && !attacker.isAuthorized("essentials.vanish.pvp"))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
attacker.updateActivity(true);
|
||||
final List<String> commandList = attacker.getPowertool(attacker.getItemInHand());
|
||||
if (commandList != null && !commandList.isEmpty())
|
||||
@@ -59,6 +74,7 @@ public class EssentialsEntityListener implements Listener
|
||||
public void run()
|
||||
{
|
||||
attacker.getServer().dispatchCommand(attacker.getBase(), command.replaceAll("\\{player\\}", defender.getName()));
|
||||
LOGGER.log(Level.INFO, String.format("[PT] %s issued server command: /%s", attacker.getName(), command));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -68,17 +84,21 @@ public class EssentialsEntityListener implements Listener
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (eDefend instanceof Ageable && eAttack instanceof Player)
|
||||
else if (eAttack instanceof Player)
|
||||
{
|
||||
final Player player = (Player)eAttack;
|
||||
final ItemStack hand = player.getItemInHand();
|
||||
if (hand != null && hand.getType() == Material.MILK_BUCKET)
|
||||
final User player = ess.getUser(eAttack);
|
||||
player.updateActivity(true);
|
||||
if (eDefend instanceof Ageable)
|
||||
{
|
||||
((Ageable)eDefend).setBaby();
|
||||
hand.setType(Material.BUCKET);
|
||||
player.setItemInHand(hand);
|
||||
player.updateInventory();
|
||||
event.setCancelled(true);
|
||||
final ItemStack hand = player.getItemInHand();
|
||||
if (hand != null && hand.getType() == Material.MILK_BUCKET)
|
||||
{
|
||||
((Ageable)eDefend).setBaby();
|
||||
hand.setType(Material.BUCKET);
|
||||
player.setItemInHand(hand);
|
||||
player.updateInventory();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,6 +139,17 @@ public class EssentialsEntityListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerDeathExpEvent(final PlayerDeathEvent event)
|
||||
{
|
||||
final User user = ess.getUser(event.getEntity());
|
||||
if (user.isAuthorized("essentials.keepxp"))
|
||||
{
|
||||
event.setKeepLevel(true);
|
||||
event.setDroppedExp(0);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onFoodLevelChange(final FoodLevelChangeEvent event)
|
||||
{
|
||||
@@ -137,4 +168,16 @@ public class EssentialsEntityListener implements Listener
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPotionSplashEvent(final PotionSplashEvent event)
|
||||
{
|
||||
for (LivingEntity entity : event.getAffectedEntities())
|
||||
{
|
||||
if (entity instanceof Player && ess.getUser(entity).isGodModeEnabled())
|
||||
{
|
||||
event.setIntensity(entity, 0d);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
@@ -50,7 +51,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerChat(final PlayerChatEvent event)
|
||||
public void onPlayerChat(final AsyncPlayerChatEvent event)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
if (user.isMuted())
|
||||
@@ -87,7 +88,13 @@ public class EssentialsPlayerListener implements Listener
|
||||
if (user.isAfk() && ess.getSettings().getFreezeAfkPlayers())
|
||||
{
|
||||
final Location from = event.getFrom();
|
||||
final Location to = event.getTo().clone();
|
||||
final Location origTo = event.getTo();
|
||||
final Location to = origTo.clone();
|
||||
if (ess.getSettings().cancelAfkOnMove() && origTo.getY() >= from.getBlockY() + 1)
|
||||
{
|
||||
user.updateActivity(true);
|
||||
return;
|
||||
}
|
||||
to.setX(from.getX());
|
||||
to.setY(from.getY());
|
||||
to.setZ(from.getZ());
|
||||
@@ -120,7 +127,10 @@ public class EssentialsPlayerListener implements Listener
|
||||
{
|
||||
user.toggleVanished();
|
||||
}
|
||||
user.setLastLocation();
|
||||
if (!user.isJailed())
|
||||
{
|
||||
user.setLastLocation();
|
||||
}
|
||||
user.updateActivity(false);
|
||||
user.dispose();
|
||||
}
|
||||
@@ -151,11 +161,14 @@ public class EssentialsPlayerListener implements Listener
|
||||
user.setLastLogin(System.currentTimeMillis());
|
||||
user.updateActivity(false);
|
||||
|
||||
for (String p : ess.getVanishedPlayers())
|
||||
if (!ess.getVanishedPlayers().isEmpty() && !user.isAuthorized("essentials.vanish.see"))
|
||||
{
|
||||
if (!user.isAuthorized("essentials.vanish.see"))
|
||||
for (String p : ess.getVanishedPlayers())
|
||||
{
|
||||
user.hidePlayer(ess.getUser(p).getBase());
|
||||
Player toVanish = ess.getUser(p).getBase();
|
||||
if (toVanish.isOnline()) {
|
||||
user.hidePlayer(toVanish);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,6 +213,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
// Makes the compass item ingame always point to the first essentials home. #EasterEgg
|
||||
private void updateCompass(final User user)
|
||||
{
|
||||
Location loc = user.getHome(user.getLocation());
|
||||
@@ -309,7 +323,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
});
|
||||
}
|
||||
}
|
||||
private final static List<String> COMMANDS = Arrays.asList("msg", "r", "mail", "m", "t", "whisper", "emsg", "tell", "er", "reply", "ereply", "email");
|
||||
private final static List<String> COMMANDS = Arrays.asList("msg", "r", "mail", "m", "t", "whisper", "emsg", "tell", "er", "reply", "ereply", "email", "action", "describe", "eme", "eaction", "edescribe", "etell", "ewhisper", "pm");
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event)
|
||||
@@ -334,6 +348,17 @@ public class EssentialsPlayerListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerChangedWorldHack(final PlayerChangedWorldEvent event)
|
||||
{
|
||||
final Player user = event.getPlayer();
|
||||
if (user.getGameMode() != GameMode.CREATIVE) {
|
||||
user.setAllowFlight(false);
|
||||
}
|
||||
user.setFlySpeed(0.1f);
|
||||
user.setWalkSpeed(0.2f);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerChangedWorld(final PlayerChangedWorldEvent event)
|
||||
{
|
||||
@@ -366,6 +391,15 @@ public class EssentialsPlayerListener implements Listener
|
||||
}
|
||||
break;
|
||||
case LEFT_CLICK_AIR:
|
||||
if (event.getPlayer().isFlying())
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
if (user.isFlyClickJump())
|
||||
{
|
||||
useFlyClickJump(user);
|
||||
return;
|
||||
}
|
||||
}
|
||||
case LEFT_CLICK_BLOCK:
|
||||
if (event.getItem() != null && event.getItem().getTypeId() != AIR)
|
||||
{
|
||||
@@ -381,6 +415,39 @@ public class EssentialsPlayerListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
// This method allows the /jump lock feature to work, allows teleporting while flying #EasterEgg
|
||||
private void useFlyClickJump(final User user)
|
||||
{
|
||||
try
|
||||
{
|
||||
final Location otarget = Util.getTarget(user);
|
||||
|
||||
ess.scheduleSyncDelayedTask(
|
||||
new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Location loc = user.getLocation();
|
||||
loc.setX(otarget.getX());
|
||||
loc.setZ(otarget.getZ());
|
||||
while (Util.isBlockDamaging(loc.getWorld(), loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ()))
|
||||
{
|
||||
loc.setY(loc.getY() + 1d);
|
||||
}
|
||||
user.getBase().teleport(loc, TeleportCause.PLUGIN);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ess.getSettings().isDebug())
|
||||
{
|
||||
LOGGER.log(Level.WARNING, ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean usePowertools(final User user, final int id)
|
||||
{
|
||||
final List<String> commandList = user.getPowertool(id);
|
||||
@@ -411,6 +478,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
public void run()
|
||||
{
|
||||
user.getServer().dispatchCommand(user.getBase(), command);
|
||||
LOGGER.log(Level.INFO, String.format("[PT] %s issued server command: /%s", user.getName(), command));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -430,7 +498,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onInventoryClickEvent(final InventoryClickEvent event)
|
||||
{
|
||||
if (event.getView().getTopInventory().getType() == InventoryType.PLAYER)
|
||||
@@ -448,6 +516,14 @@ public class EssentialsPlayerListener implements Listener
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (event.getView().getTopInventory().getType() == InventoryType.ENDER_CHEST)
|
||||
{
|
||||
final User user = ess.getUser(event.getWhoClicked());
|
||||
if (user.isEnderSee() && (!user.isAuthorized("essentials.enderchest.modify")))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@@ -458,5 +534,10 @@ public class EssentialsPlayerListener implements Listener
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
user.setInvSee(false);
|
||||
}
|
||||
else if (event.getView().getTopInventory().getType() == InventoryType.ENDER_CHEST)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
user.setEnderSee(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -20,6 +20,9 @@ public class EssentialsPluginListener implements Listener, IConf
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPluginEnable(final PluginEnableEvent event)
|
||||
{
|
||||
if (event.getPlugin().getName().equals("EssentialsChat")) {
|
||||
ess.getSettings().setEssentialsChatActive(true);
|
||||
}
|
||||
ess.getPermissionsHandler().checkPermissions();
|
||||
ess.getAlternativeCommandsHandler().addPlugin(event.getPlugin());
|
||||
if (!ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().setMethod(ess.getServer().getPluginManager()))
|
||||
@@ -31,6 +34,9 @@ public class EssentialsPluginListener implements Listener, IConf
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPluginDisable(final PluginDisableEvent event)
|
||||
{
|
||||
if (event.getPlugin().getName().equals("EssentialsChat")) {
|
||||
ess.getSettings().setEssentialsChatActive(false);
|
||||
}
|
||||
ess.getPermissionsHandler().checkPermissions();
|
||||
ess.getAlternativeCommandsHandler().removePlugin(event.getPlugin());
|
||||
// Check to see if the plugin thats being disabled is the one we are using
|
||||
|
@@ -1,9 +1,9 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.craftbukkit.FakeWorld;
|
||||
import com.earth2me.essentials.settings.Spawns;
|
||||
import com.earth2me.essentials.storage.YamlStorageWriter;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import java.io.*;
|
||||
import java.math.BigInteger;
|
||||
import java.security.DigestInputStream;
|
||||
|
@@ -70,7 +70,8 @@ public class I18n implements II18n
|
||||
|
||||
public static String _(final String string, final Object... objects)
|
||||
{
|
||||
if (instance == null) {
|
||||
if (instance == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
if (objects.length == 0)
|
||||
@@ -85,11 +86,20 @@ public class I18n implements II18n
|
||||
|
||||
public String format(final String string, final Object... objects)
|
||||
{
|
||||
final String format = translate(string);
|
||||
String format = translate(string);
|
||||
MessageFormat messageFormat = messageFormatCache.get(format);
|
||||
if (messageFormat == null)
|
||||
{
|
||||
messageFormat = new MessageFormat(format);
|
||||
try
|
||||
{
|
||||
messageFormat = new MessageFormat(format);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
ess.getLogger().log(Level.SEVERE, "Invalid Translation key for '" + string + "': " + e.getMessage());
|
||||
format = format.replaceAll("\\{(\\D*?)\\}", "\\[$1\\]");
|
||||
messageFormat = new MessageFormat(format);
|
||||
}
|
||||
messageFormatCache.put(format, messageFormat);
|
||||
}
|
||||
return messageFormat.format(objects);
|
||||
@@ -133,7 +143,7 @@ public class I18n implements II18n
|
||||
{
|
||||
private final transient File dataFolder;
|
||||
|
||||
public FileResClassLoader(final ClassLoader classLoader, final IEssentials ess)
|
||||
FileResClassLoader(final ClassLoader classLoader, final IEssentials ess)
|
||||
{
|
||||
super(classLoader);
|
||||
this.dataFolder = ess.getDataFolder();
|
||||
|
@@ -1,9 +1,5 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
/**
|
||||
* @deprecated New interface will be IReload in api package
|
||||
*/
|
||||
@Deprecated
|
||||
public interface IConf {
|
||||
public void reloadConfig();
|
||||
}
|
||||
|
@@ -12,10 +12,6 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated This will be moved to the api package soon
|
||||
*/
|
||||
@Deprecated
|
||||
public interface IEssentials extends Plugin
|
||||
{
|
||||
void addReloadListener(IConf listener);
|
||||
|
@@ -92,10 +92,6 @@ public interface ISettings extends IConf
|
||||
|
||||
boolean isCommandOverridden(String name);
|
||||
|
||||
boolean isCommandRestricted(IEssentialsCommand cmd);
|
||||
|
||||
boolean isCommandRestricted(String label);
|
||||
|
||||
boolean isDebug();
|
||||
|
||||
boolean isEcoDisabled();
|
||||
@@ -110,8 +106,6 @@ public interface ISettings extends IConf
|
||||
|
||||
boolean showNonEssCommandsInHelp();
|
||||
|
||||
boolean spawnIfNoHome();
|
||||
|
||||
boolean warnOnBuildDisallow();
|
||||
|
||||
boolean warnOnSmite();
|
||||
@@ -159,7 +153,7 @@ public interface ISettings extends IConf
|
||||
boolean getRepairEnchanted();
|
||||
|
||||
boolean isWorldTeleportPermissions();
|
||||
|
||||
|
||||
boolean isWorldHomePermissions();
|
||||
|
||||
boolean registerBackInListener();
|
||||
@@ -177,8 +171,16 @@ public interface ISettings extends IConf
|
||||
long getTeleportInvulnerability();
|
||||
|
||||
boolean isTeleportInvulnerability();
|
||||
|
||||
|
||||
long getLoginAttackDelay();
|
||||
|
||||
|
||||
int getSignUsePerSecond();
|
||||
|
||||
double getMaxFlySpeed();
|
||||
|
||||
double getMaxWalkSpeed();
|
||||
|
||||
public int getMailsPerMinute();
|
||||
|
||||
public void setEssentialsChatActive(boolean b);
|
||||
}
|
||||
|
@@ -5,10 +5,6 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated This will be moved to the api package soon
|
||||
*/
|
||||
@Deprecated
|
||||
public interface IUser extends Player
|
||||
{
|
||||
long getLastTeleportTimestamp();
|
||||
|
@@ -1,11 +1,8 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import com.earth2me.essentials.api.IItemDb;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import com.earth2me.essentials.api.IItemDb;
|
||||
import java.util.*;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@@ -20,6 +17,7 @@ public class ItemDb implements IConf, IItemDb
|
||||
file = new ManagedFile("items.csv", ess);
|
||||
}
|
||||
private final transient Map<String, Integer> items = new HashMap<String, Integer>();
|
||||
private final transient Map<ItemData, List<String>> names = new HashMap<ItemData, List<String>>();
|
||||
private final transient Map<String, Short> durabilities = new HashMap<String, Short>();
|
||||
private final transient ManagedFile file;
|
||||
|
||||
@@ -35,6 +33,7 @@ public class ItemDb implements IConf, IItemDb
|
||||
|
||||
durabilities.clear();
|
||||
items.clear();
|
||||
names.clear();
|
||||
|
||||
for (String line : lines)
|
||||
{
|
||||
@@ -51,9 +50,25 @@ public class ItemDb implements IConf, IItemDb
|
||||
}
|
||||
|
||||
final int numeric = Integer.parseInt(parts[1]);
|
||||
final short data = parts.length > 2 && !parts[2].equals("0") ? Short.parseShort(parts[2]) : 0;
|
||||
String itemName = parts[0].toLowerCase(Locale.ENGLISH);
|
||||
|
||||
durabilities.put(parts[0].toLowerCase(Locale.ENGLISH), parts.length > 2 && !parts[2].equals("0") ? Short.parseShort(parts[2]) : 0);
|
||||
items.put(parts[0].toLowerCase(Locale.ENGLISH), numeric);
|
||||
durabilities.put(itemName, data);
|
||||
items.put(itemName, numeric);
|
||||
|
||||
ItemData itemData = new ItemData(numeric, data);
|
||||
if (names.containsKey(itemData))
|
||||
{
|
||||
List<String> nameList = names.get(itemData);
|
||||
nameList.add(itemName);
|
||||
Collections.sort(nameList, new LengthCompare());
|
||||
}
|
||||
else
|
||||
{
|
||||
List<String> nameList = new ArrayList<String>();
|
||||
nameList.add(itemName);
|
||||
names.put(itemData, nameList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,4 +134,81 @@ public class ItemDb implements IConf, IItemDb
|
||||
retval.setDurability(metaData);
|
||||
return retval;
|
||||
}
|
||||
|
||||
public String names(ItemStack item)
|
||||
{
|
||||
ItemData itemData = new ItemData(item.getTypeId(), item.getDurability());
|
||||
List<String> nameList = names.get(itemData);
|
||||
if (nameList == null) {
|
||||
itemData = new ItemData(item.getTypeId(), (short) 0);
|
||||
nameList = names.get(itemData);
|
||||
if (nameList == null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (nameList.size() > 15)
|
||||
{
|
||||
nameList = nameList.subList(0, 14);
|
||||
}
|
||||
return Util.joinList(", ", nameList);
|
||||
}
|
||||
|
||||
class ItemData
|
||||
{
|
||||
final private int itemNo;
|
||||
final private short itemData;
|
||||
|
||||
ItemData(final int itemNo, final short itemData)
|
||||
{
|
||||
this.itemNo = itemNo;
|
||||
this.itemData = itemData;
|
||||
}
|
||||
|
||||
public int getItemNo()
|
||||
{
|
||||
return itemNo;
|
||||
}
|
||||
|
||||
public short getItemData()
|
||||
{
|
||||
return itemData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return (31 * itemNo) ^ itemData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (o == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(o instanceof ItemData))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
ItemData pairo = (ItemData)o;
|
||||
return this.itemNo == pairo.getItemNo()
|
||||
&& this.itemData == pairo.getItemData();
|
||||
}
|
||||
}
|
||||
|
||||
class LengthCompare implements java.util.Comparator<String>
|
||||
{
|
||||
public LengthCompare()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(String s1, String s2)
|
||||
{
|
||||
return s1.length() - s2.length();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ public class Kit
|
||||
final StringBuilder list = new StringBuilder();
|
||||
for (String kiteItem : kits.getKeys(false))
|
||||
{
|
||||
if (user == null || user.isAuthorized("essentials.kit." + kiteItem.toLowerCase(Locale.ENGLISH)))
|
||||
if (user == null || user.isAuthorized("essentials.kits." + kiteItem.toLowerCase(Locale.ENGLISH)))
|
||||
{
|
||||
list.append(" ").append(capitalCase(kiteItem));
|
||||
}
|
||||
@@ -39,6 +39,10 @@ public class Kit
|
||||
|
||||
public static void checkTime(final User user, final String kitName, final Map<String, Object> els) throws NoChargeException
|
||||
{
|
||||
if (user.isAuthorized("essentials.kit.exemptdelay")) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Calendar time = new GregorianCalendar();
|
||||
|
||||
// Take the current time, and remove the delay from it.
|
||||
@@ -50,9 +54,9 @@ public class Kit
|
||||
final long earliestLong = earliestTime.getTimeInMillis();
|
||||
|
||||
// When was the last kit used?
|
||||
final Long lastTime = user.getKitTimestamp(kitName);
|
||||
final long lastTime = user.getKitTimestamp(kitName);
|
||||
|
||||
if (lastTime == null || lastTime < earliestLong)
|
||||
if (lastTime < earliestLong)
|
||||
{
|
||||
user.setKitTimestamp(kitName, time.getTimeInMillis());
|
||||
}
|
||||
@@ -78,6 +82,7 @@ public class Kit
|
||||
{
|
||||
throw new Exception(_("kitError2"));
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
|
@@ -1,11 +1,7 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Location;
|
||||
|
@@ -1051,4 +1051,58 @@ public class OfflinePlayer implements Player
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getExpToLevel()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLineOfSight(Entity entity)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlySpeed(float value) throws IllegalArgumentException
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWalkSpeed(float value) throws IllegalArgumentException
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFlySpeed()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWalkSpeed()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getEnderChest()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(Location arg0, Sound arg1, float arg2, float arg3)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
|
@@ -54,19 +54,21 @@ public class Settings implements ISettings
|
||||
@Override
|
||||
public int getHomeLimit(final User user)
|
||||
{
|
||||
final Set<String> homeList = getMultipleHomes();
|
||||
if (homeList == null)
|
||||
int limit = 1;
|
||||
if (user.isAuthorized("essentials.sethome.multiple"))
|
||||
{
|
||||
//TODO: Replace this code to remove backwards compat, after settings are automatically updated
|
||||
// return getHomeLimit("default");
|
||||
return config.getInt("multiple-homes", 5);
|
||||
limit = getHomeLimit("default");
|
||||
}
|
||||
int limit = getHomeLimit("default");
|
||||
for (String set : homeList)
|
||||
|
||||
final Set<String> homeList = getMultipleHomes();
|
||||
if (homeList != null)
|
||||
{
|
||||
if (user.isAuthorized("essentials.sethome.multiple." + set) && (limit < getHomeLimit(set)))
|
||||
for (String set : homeList)
|
||||
{
|
||||
limit = getHomeLimit(set);
|
||||
if (user.isAuthorized("essentials.sethome.multiple." + set) && (limit < getHomeLimit(set)))
|
||||
{
|
||||
limit = getHomeLimit(set);
|
||||
}
|
||||
}
|
||||
}
|
||||
return limit;
|
||||
@@ -77,11 +79,17 @@ public class Settings implements ISettings
|
||||
{
|
||||
return config.getInt("sethome-multiple." + set, config.getInt("sethome-multiple.default", 3));
|
||||
}
|
||||
private int chatRadius = 0;
|
||||
|
||||
private int _getChatRadius()
|
||||
{
|
||||
return config.getInt("chat.radius", config.getInt("chat-radius", 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChatRadius()
|
||||
{
|
||||
return config.getInt("chat.radius", config.getInt("chat-radius", 0));
|
||||
return chatRadius;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,39 +121,29 @@ public class Settings implements ISettings
|
||||
{
|
||||
return isCommandDisabled(cmd.getName());
|
||||
}
|
||||
private Set<String> disabledCommands = new HashSet<String>();
|
||||
|
||||
@Override
|
||||
public boolean isCommandDisabled(String label)
|
||||
{
|
||||
return disabledCommands.contains(label);
|
||||
}
|
||||
|
||||
private Set<String> getDisabledCommands()
|
||||
{
|
||||
Set<String> disCommands = new HashSet<String>();
|
||||
for (String c : config.getStringList("disabled-commands"))
|
||||
{
|
||||
if (!c.equalsIgnoreCase(label))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
disCommands.add(c.toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
return config.getBoolean("disable-" + label.toLowerCase(Locale.ENGLISH), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCommandRestricted(IEssentialsCommand cmd)
|
||||
{
|
||||
return isCommandRestricted(cmd.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCommandRestricted(String label)
|
||||
{
|
||||
for (String c : config.getStringList("restricted-commands"))
|
||||
for (String c : config.getKeys(false))
|
||||
{
|
||||
if (!c.equalsIgnoreCase(label))
|
||||
if (c.startsWith("disable-"))
|
||||
{
|
||||
continue;
|
||||
disCommands.add(c.substring(8).toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return config.getBoolean("restrict-" + label.toLowerCase(Locale.ENGLISH), false);
|
||||
return disCommands;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -175,6 +173,7 @@ public class Settings implements ISettings
|
||||
}
|
||||
return config.getBoolean("override-" + name.toLowerCase(Locale.ENGLISH), false);
|
||||
}
|
||||
private ConfigurationSection commandCosts;
|
||||
|
||||
@Override
|
||||
public double getCommandCost(IEssentialsCommand cmd)
|
||||
@@ -182,21 +181,49 @@ public class Settings implements ISettings
|
||||
return getCommandCost(cmd.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCommandCost(String label)
|
||||
public ConfigurationSection _getCommandCosts()
|
||||
{
|
||||
double cost = config.getDouble("command-costs." + label, 0.0);
|
||||
if (cost == 0.0)
|
||||
if (config.isConfigurationSection("command-costs"))
|
||||
{
|
||||
cost = config.getDouble("cost-" + label, 0.0);
|
||||
final ConfigurationSection section = config.getConfigurationSection("command-costs");
|
||||
final ConfigurationSection newSection = new MemoryConfiguration();
|
||||
for (String command : section.getKeys(false))
|
||||
{
|
||||
if (section.isDouble(command))
|
||||
{
|
||||
newSection.set(command.toLowerCase(Locale.ENGLISH), section.getDouble(command));
|
||||
}
|
||||
else if (section.isInt(command))
|
||||
{
|
||||
newSection.set(command.toLowerCase(Locale.ENGLISH), (double)section.getInt(command));
|
||||
}
|
||||
}
|
||||
return newSection;
|
||||
}
|
||||
return cost;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCommandCost(String name)
|
||||
{
|
||||
name = name.replace('.', '_').replace('/', '_');
|
||||
if (commandCosts != null)
|
||||
{
|
||||
return commandCosts.getDouble(name, 0.0);
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
private String nicknamePrefix = "~";
|
||||
|
||||
private String _getNicknamePrefix()
|
||||
{
|
||||
return config.getString("nickname-prefix", "~");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNicknamePrefix()
|
||||
{
|
||||
return config.getString("nickname-prefix", "~");
|
||||
return nicknamePrefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -240,7 +267,7 @@ public class Settings implements ISettings
|
||||
public Map<String, Object> getKit(String name)
|
||||
{
|
||||
name = name.replace('.', '_').replace('/', '_');
|
||||
if (config.isConfigurationSection("kits"))
|
||||
if (getKits() != null)
|
||||
{
|
||||
final ConfigurationSection kits = getKits();
|
||||
if (kits.isConfigurationSection(name))
|
||||
@@ -250,19 +277,25 @@ public class Settings implements ISettings
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private ChatColor operatorColor = null;
|
||||
|
||||
@Override
|
||||
public ChatColor getOperatorColor() throws Exception
|
||||
public ChatColor getOperatorColor()
|
||||
{
|
||||
return operatorColor;
|
||||
}
|
||||
|
||||
private ChatColor _getOperatorColor()
|
||||
{
|
||||
String colorName = config.getString("ops-name-color", null);
|
||||
|
||||
if (colorName == null)
|
||||
{
|
||||
return ChatColor.RED;
|
||||
return ChatColor.DARK_RED;
|
||||
}
|
||||
if ("none".equalsIgnoreCase(colorName) || colorName.isEmpty())
|
||||
{
|
||||
throw new Exception();
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
@@ -317,7 +350,7 @@ public class Settings implements ISettings
|
||||
{
|
||||
return config.getString("backup.command", null);
|
||||
}
|
||||
private Map<String, MessageFormat> chatFormats = new HashMap<String, MessageFormat>();
|
||||
private Map<String, MessageFormat> chatFormats = Collections.synchronizedMap(new HashMap<String, MessageFormat>());
|
||||
|
||||
@Override
|
||||
public MessageFormat getChatFormat(String group)
|
||||
@@ -334,6 +367,7 @@ public class Settings implements ISettings
|
||||
format = format.replace("{WORLDNAME}", "{1}");
|
||||
format = format.replace("{SHORTWORLDNAME}", "{2}");
|
||||
format = format.replaceAll("\\{(\\D*?)\\}", "\\[$1\\]");
|
||||
format = "§r".concat(format);
|
||||
mFormat = new MessageFormat(format);
|
||||
chatFormats.put(group, mFormat);
|
||||
}
|
||||
@@ -392,6 +426,20 @@ public class Settings implements ISettings
|
||||
signUsePerSecond = _getSignUsePerSecond();
|
||||
kits = _getKits();
|
||||
chatFormats.clear();
|
||||
changeDisplayName = _changeDisplayName();
|
||||
disabledCommands = getDisabledCommands();
|
||||
nicknamePrefix = _getNicknamePrefix();
|
||||
operatorColor = _getOperatorColor();
|
||||
changePlayerListName = _changePlayerListName();
|
||||
configDebug = _isDebug();
|
||||
prefixsuffixconfigured = _isPrefixSuffixConfigured();
|
||||
addprefixsuffix = _addPrefixSuffix();
|
||||
disablePrefix = _disablePrefix();
|
||||
disableSuffix = _disableSuffix();
|
||||
chatRadius = _getChatRadius();
|
||||
commandCosts = _getCommandCosts();
|
||||
warnOnBuildDisallow = _warnOnBuildDisallow();
|
||||
mailsPerMinute = _getMailsPerMinute();
|
||||
}
|
||||
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
||||
|
||||
@@ -466,24 +514,30 @@ public class Settings implements ISettings
|
||||
}
|
||||
return newSigns;
|
||||
}
|
||||
private boolean warnOnBuildDisallow;
|
||||
|
||||
@Override
|
||||
public boolean spawnIfNoHome()
|
||||
private boolean _warnOnBuildDisallow()
|
||||
{
|
||||
return config.getBoolean("spawn-if-no-home", false);
|
||||
return config.getBoolean("protect.disable.warn-on-build-disallow", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean warnOnBuildDisallow()
|
||||
{
|
||||
return config.getBoolean("protect.disable.warn-on-build-disallow", false);
|
||||
return warnOnBuildDisallow;
|
||||
}
|
||||
private boolean debug = false;
|
||||
private boolean configDebug = false;
|
||||
|
||||
private boolean _isDebug()
|
||||
{
|
||||
return config.getBoolean("debug", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDebug()
|
||||
{
|
||||
return debug || config.getBoolean("debug", false);
|
||||
return debug || configDebug;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -507,7 +561,7 @@ public class Settings implements ISettings
|
||||
@Override
|
||||
public String getCurrencySymbol()
|
||||
{
|
||||
return config.getString("currency-symbol", "$").substring(0, 1).replaceAll("[0-9]", "$");
|
||||
return config.getString("currency-symbol", "$").concat("$").substring(0, 1).replaceAll("[0-9]", "$");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -610,43 +664,86 @@ public class Settings implements ISettings
|
||||
{
|
||||
return config.getBoolean("remove-god-on-disconnect", false);
|
||||
}
|
||||
private boolean changeDisplayName = true;
|
||||
|
||||
@Override
|
||||
public boolean changeDisplayName()
|
||||
private boolean _changeDisplayName()
|
||||
{
|
||||
return config.getBoolean("change-displayname", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean changePlayerListName()
|
||||
public boolean changeDisplayName()
|
||||
{
|
||||
return changeDisplayName;
|
||||
}
|
||||
private boolean changePlayerListName = false;
|
||||
|
||||
private boolean _changePlayerListName()
|
||||
{
|
||||
return config.getBoolean("change-playerlist", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean changePlayerListName()
|
||||
{
|
||||
return changePlayerListName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useBukkitPermissions()
|
||||
{
|
||||
return config.getBoolean("use-bukkit-permissions", false);
|
||||
}
|
||||
private boolean prefixsuffixconfigured = false;
|
||||
private boolean addprefixsuffix = false;
|
||||
private boolean essentialsChatActive = false;
|
||||
|
||||
private boolean _addPrefixSuffix()
|
||||
{
|
||||
return config.getBoolean("add-prefix-suffix", false);
|
||||
}
|
||||
|
||||
private boolean _isPrefixSuffixConfigured()
|
||||
{
|
||||
return config.hasProperty("add-prefix-suffix");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEssentialsChatActive(boolean essentialsChatActive)
|
||||
{
|
||||
this.essentialsChatActive = essentialsChatActive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addPrefixSuffix()
|
||||
{
|
||||
return config.getBoolean("add-prefix-suffix", ess.getServer().getPluginManager().isPluginEnabled("EssentialsChat"));
|
||||
return prefixsuffixconfigured ? addprefixsuffix : essentialsChatActive;
|
||||
}
|
||||
private boolean disablePrefix = false;
|
||||
|
||||
@Override
|
||||
public boolean disablePrefix()
|
||||
private boolean _disablePrefix()
|
||||
{
|
||||
return config.getBoolean("disablePrefix", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean disableSuffix()
|
||||
public boolean disablePrefix()
|
||||
{
|
||||
return disablePrefix;
|
||||
}
|
||||
private boolean disableSuffix = false;
|
||||
|
||||
private boolean _disableSuffix()
|
||||
{
|
||||
return config.getBoolean("disableSuffix", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean disableSuffix()
|
||||
{
|
||||
return disableSuffix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAutoAfk()
|
||||
{
|
||||
@@ -713,7 +810,7 @@ public class Settings implements ISettings
|
||||
{
|
||||
return config.getBoolean("world-teleport-permissions", false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isWorldHomePermissions()
|
||||
{
|
||||
@@ -800,38 +897,62 @@ public class Settings implements ISettings
|
||||
{
|
||||
return (config.getLong("teleport-invulnerability", 0) > 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isTeleportInvulnerability()
|
||||
{
|
||||
return teleportInvulnerability;
|
||||
}
|
||||
|
||||
private long loginAttackDelay;
|
||||
|
||||
|
||||
private long _getLoginAttackDelay()
|
||||
{
|
||||
return config.getLong("login-attack-delay", 0) * 1000;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getLoginAttackDelay()
|
||||
{
|
||||
return loginAttackDelay;
|
||||
}
|
||||
|
||||
private int signUsePerSecond;
|
||||
|
||||
|
||||
private int _getSignUsePerSecond()
|
||||
{
|
||||
final int perSec = config.getInt("sign-use-per-second", 4);
|
||||
return perSec > 0 ? perSec : 1;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getSignUsePerSecond()
|
||||
{
|
||||
return signUsePerSecond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxFlySpeed()
|
||||
{
|
||||
double maxSpeed = config.getDouble("max-fly-speed", 1.0);
|
||||
return maxSpeed > 1.0 ? 1.0 : Math.abs(maxSpeed);
|
||||
}
|
||||
|
||||
//This option does not exist in the config.yml because it wasn't yet implemented in bukkit
|
||||
//The code was commented out in the /speed command
|
||||
@Override
|
||||
public double getMaxWalkSpeed()
|
||||
{
|
||||
double maxSpeed = config.getDouble("max-walk-speed", 0.8);
|
||||
return maxSpeed > 1.0 ? 1.0 : Math.abs(maxSpeed);
|
||||
}
|
||||
|
||||
private int mailsPerMinute;
|
||||
|
||||
private int _getMailsPerMinute() {
|
||||
return config.getInt("mails-per-minute", 1000);
|
||||
}
|
||||
@Override
|
||||
public int getMailsPerMinute()
|
||||
{
|
||||
return mailsPerMinute;
|
||||
}
|
||||
}
|
||||
|
@@ -1,12 +1,11 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import com.earth2me.essentials.api.ITeleport;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.ITeleport;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
@@ -17,36 +16,38 @@ public class Teleport implements Runnable, ITeleport
|
||||
private static final double MOVE_CONSTANT = 0.3;
|
||||
|
||||
|
||||
private static class Target
|
||||
private class Target
|
||||
{
|
||||
private final Location location;
|
||||
private final Entity entity;
|
||||
private final String name;
|
||||
|
||||
public Target(Location location)
|
||||
Target(Location location)
|
||||
{
|
||||
this.location = location;
|
||||
this.entity = null;
|
||||
this.name = null;
|
||||
}
|
||||
|
||||
public Target(Entity entity)
|
||||
Target(Player entity)
|
||||
{
|
||||
this.entity = entity;
|
||||
this.name = entity.getName();
|
||||
this.location = null;
|
||||
}
|
||||
|
||||
public Location getLocation()
|
||||
{
|
||||
if (this.entity != null)
|
||||
if (this.name != null)
|
||||
{
|
||||
return this.entity.getLocation();
|
||||
|
||||
return ess.getServer().getPlayerExact(name).getLocation();
|
||||
}
|
||||
return location;
|
||||
}
|
||||
}
|
||||
private IUser user;
|
||||
private IUser teleportUser;
|
||||
private int teleTimer = -1;
|
||||
private long started; // time this task was initiated
|
||||
private long delay; // how long to delay the teleport
|
||||
private long tpdelay; // how long to delay the teleport
|
||||
private int health;
|
||||
// note that I initially stored a clone of the location for reference, but...
|
||||
// when comparing locations, I got incorrect mismatches (rounding errors, looked like)
|
||||
@@ -61,13 +62,19 @@ public class Teleport implements Runnable, ITeleport
|
||||
private TeleportCause cause;
|
||||
|
||||
private void initTimer(long delay, Target target, Trade chargeFor, TeleportCause cause)
|
||||
{
|
||||
initTimer(delay, user, target, chargeFor, cause);
|
||||
}
|
||||
|
||||
private void initTimer(long delay, IUser teleportUser, Target target, Trade chargeFor, TeleportCause cause)
|
||||
{
|
||||
this.started = System.currentTimeMillis();
|
||||
this.delay = delay;
|
||||
this.health = user.getHealth();
|
||||
this.initX = Math.round(user.getLocation().getX() * MOVE_CONSTANT);
|
||||
this.initY = Math.round(user.getLocation().getY() * MOVE_CONSTANT);
|
||||
this.initZ = Math.round(user.getLocation().getZ() * MOVE_CONSTANT);
|
||||
this.tpdelay = delay;
|
||||
this.health = teleportUser.getHealth();
|
||||
this.initX = Math.round(teleportUser.getLocation().getX() * MOVE_CONSTANT);
|
||||
this.initY = Math.round(teleportUser.getLocation().getY() * MOVE_CONSTANT);
|
||||
this.initZ = Math.round(teleportUser.getLocation().getZ() * MOVE_CONSTANT);
|
||||
this.teleportUser = teleportUser;
|
||||
this.teleportTarget = target;
|
||||
this.chargeFor = chargeFor;
|
||||
this.cause = cause;
|
||||
@@ -79,31 +86,38 @@ public class Teleport implements Runnable, ITeleport
|
||||
|
||||
if (user == null || !user.isOnline() || user.getLocation() == null)
|
||||
{
|
||||
cancel();
|
||||
cancel(false);
|
||||
return;
|
||||
}
|
||||
if (Math.round(user.getLocation().getX() * MOVE_CONSTANT) != initX
|
||||
|| Math.round(user.getLocation().getY() * MOVE_CONSTANT) != initY
|
||||
|| Math.round(user.getLocation().getZ() * MOVE_CONSTANT) != initZ
|
||||
|| user.getHealth() < health)
|
||||
{ // user moved, cancel teleport
|
||||
if (teleportUser == null || !teleportUser.isOnline() || teleportUser.getLocation() == null)
|
||||
{
|
||||
cancel(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!user.isAuthorized("essentials.teleport.timer.move")
|
||||
&& (Math.round(teleportUser.getLocation().getX() * MOVE_CONSTANT) != initX
|
||||
|| Math.round(teleportUser.getLocation().getY() * MOVE_CONSTANT) != initY
|
||||
|| Math.round(teleportUser.getLocation().getZ() * MOVE_CONSTANT) != initZ
|
||||
|| teleportUser.getHealth() < health))
|
||||
{
|
||||
// user moved, cancel teleport
|
||||
cancel(true);
|
||||
return;
|
||||
}
|
||||
|
||||
health = user.getHealth(); // in case user healed, then later gets injured
|
||||
|
||||
health = teleportUser.getHealth(); // in case user healed, then later gets injured
|
||||
long now = System.currentTimeMillis();
|
||||
if (now > started + delay)
|
||||
if (now > started + tpdelay)
|
||||
{
|
||||
try
|
||||
{
|
||||
cooldown(false);
|
||||
user.sendMessage(_("teleportationCommencing"));
|
||||
teleportUser.sendMessage(_("teleportationCommencing"));
|
||||
try
|
||||
{
|
||||
|
||||
now(teleportTarget, cause);
|
||||
teleportUser.getTeleport().now(teleportTarget, cause);
|
||||
cancel(false);
|
||||
if (chargeFor != null)
|
||||
{
|
||||
chargeFor.charge(user);
|
||||
@@ -117,6 +131,10 @@ public class Teleport implements Runnable, ITeleport
|
||||
catch (Exception ex)
|
||||
{
|
||||
user.sendMessage(_("cooldownWithMessage", ex.getMessage()));
|
||||
if (user != teleportUser)
|
||||
{
|
||||
teleportUser.sendMessage(_("cooldownWithMessage", ex.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,22 +145,6 @@ public class Teleport implements Runnable, ITeleport
|
||||
this.ess = ess;
|
||||
}
|
||||
|
||||
public void respawn(final Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
final Player player = user.getBase();
|
||||
final Location bed = player.getBedSpawnLocation();
|
||||
final PlayerRespawnEvent pre = new PlayerRespawnEvent(player, bed == null ? player.getWorld().getSpawnLocation() : bed, bed != null);
|
||||
ess.getServer().getPluginManager().callEvent(pre);
|
||||
teleport(new Target(pre.getRespawnLocation()), chargeFor, cause);
|
||||
}
|
||||
|
||||
public void warp(String warp, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
Location loc = ess.getWarps().getWarp(warp);
|
||||
teleport(new Target(loc), chargeFor, cause);
|
||||
user.sendMessage(_("warpingTo", warp));
|
||||
}
|
||||
|
||||
public void cooldown(boolean check) throws Exception
|
||||
{
|
||||
final Calendar time = new GregorianCalendar();
|
||||
@@ -181,6 +183,7 @@ public class Teleport implements Runnable, ITeleport
|
||||
}
|
||||
}
|
||||
|
||||
//If we need to cancel a pending teleport call this method
|
||||
public void cancel(boolean notifyUser)
|
||||
{
|
||||
if (teleTimer == -1)
|
||||
@@ -193,6 +196,10 @@ public class Teleport implements Runnable, ITeleport
|
||||
if (notifyUser)
|
||||
{
|
||||
user.sendMessage(_("pendingTeleportCancelled"));
|
||||
if (teleportUser != user)
|
||||
{
|
||||
teleportUser.sendMessage(_("pendingTeleportCancelled"));
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -201,22 +208,46 @@ public class Teleport implements Runnable, ITeleport
|
||||
}
|
||||
}
|
||||
|
||||
public void cancel()
|
||||
//The now function is used when you want to skip tp delay when teleporting someone to a location or player.
|
||||
public void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception
|
||||
{
|
||||
if (cooldown)
|
||||
{
|
||||
cooldown(false);
|
||||
}
|
||||
now(new Target(loc), cause);
|
||||
}
|
||||
|
||||
public void now(Player entity, boolean cooldown, TeleportCause cause) throws Exception
|
||||
{
|
||||
if (cooldown)
|
||||
{
|
||||
cooldown(false);
|
||||
}
|
||||
now(new Target(entity), cause);
|
||||
}
|
||||
|
||||
private void now(Target target, TeleportCause cause) throws Exception
|
||||
{
|
||||
cancel(false);
|
||||
user.setLastLocation();
|
||||
user.getBase().teleport(Util.getSafeDestination(target.getLocation()), cause);
|
||||
}
|
||||
|
||||
//The teleport function is used when you want to normally teleport someone to a location or player.
|
||||
//This method is nolonger used internally and will be removed.
|
||||
@Deprecated
|
||||
public void teleport(Location loc, Trade chargeFor) throws Exception
|
||||
{
|
||||
teleport(new Target(loc), chargeFor, TeleportCause.PLUGIN);
|
||||
teleport(loc, chargeFor, TeleportCause.PLUGIN);
|
||||
}
|
||||
|
||||
|
||||
public void teleport(Location loc, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
teleport(new Target(loc), chargeFor, cause);
|
||||
}
|
||||
|
||||
public void teleport(Entity entity, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
public void teleport(Player entity, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
teleport(new Target(entity), chargeFor, cause);
|
||||
}
|
||||
@@ -241,58 +272,82 @@ public class Teleport implements Runnable, ITeleport
|
||||
return;
|
||||
}
|
||||
|
||||
cancel();
|
||||
Calendar c = new GregorianCalendar();
|
||||
c.add(Calendar.SECOND, (int)delay);
|
||||
c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0));
|
||||
user.sendMessage(_("dontMoveMessage", Util.formatDateDiff(c.getTimeInMillis())));
|
||||
cancel(false);
|
||||
warnUser(user, delay);
|
||||
initTimer((long)(delay * 1000.0), target, chargeFor, cause);
|
||||
|
||||
teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10);
|
||||
}
|
||||
|
||||
private void now(Target target, TeleportCause cause) throws Exception
|
||||
//The teleportToMe function is a wrapper used to handle teleporting players to them, like /tphere
|
||||
public void teleportToMe(User otherUser, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
cancel();
|
||||
user.setLastLocation();
|
||||
user.getBase().teleport(Util.getSafeDestination(target.getLocation()), cause);
|
||||
}
|
||||
Target target = new Target(user);
|
||||
|
||||
public void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception
|
||||
{
|
||||
if (cooldown)
|
||||
double delay = ess.getSettings().getTeleportDelay();
|
||||
|
||||
if (chargeFor != null)
|
||||
{
|
||||
chargeFor.isAffordableFor(user);
|
||||
}
|
||||
cooldown(true);
|
||||
if (delay <= 0 || user.isAuthorized("essentials.teleport.timer.bypass"))
|
||||
{
|
||||
cooldown(false);
|
||||
otherUser.getTeleport().now(target, cause);
|
||||
if (chargeFor != null)
|
||||
{
|
||||
chargeFor.charge(user);
|
||||
}
|
||||
return;
|
||||
}
|
||||
now(new Target(loc), cause);
|
||||
|
||||
cancel(false);
|
||||
warnUser(otherUser, delay);
|
||||
initTimer((long)(delay * 1000.0), otherUser, target, chargeFor, cause);
|
||||
|
||||
teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10);
|
||||
}
|
||||
|
||||
public void now(Location loc, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
private void warnUser(final IUser user, final double delay)
|
||||
{
|
||||
cooldown(false);
|
||||
chargeFor.charge(user);
|
||||
now(new Target(loc), cause);
|
||||
Calendar c = new GregorianCalendar();
|
||||
c.add(Calendar.SECOND, (int)delay);
|
||||
c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0));
|
||||
user.sendMessage(_("dontMoveMessage", Util.formatDateDiff(c.getTimeInMillis())));
|
||||
}
|
||||
|
||||
public void now(Entity entity, boolean cooldown, TeleportCause cause) throws Exception
|
||||
//The respawn function is a wrapper used to handle tp fallback, on /jail and /home
|
||||
public void respawn(final Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
if (cooldown)
|
||||
{
|
||||
cooldown(false);
|
||||
}
|
||||
now(new Target(entity), cause);
|
||||
final Player player = user.getBase();
|
||||
final Location bed = player.getBedSpawnLocation();
|
||||
final PlayerRespawnEvent pre = new PlayerRespawnEvent(player, bed == null ? player.getWorld().getSpawnLocation() : bed, bed != null);
|
||||
ess.getServer().getPluginManager().callEvent(pre);
|
||||
teleport(new Target(pre.getRespawnLocation()), chargeFor, cause);
|
||||
}
|
||||
|
||||
//The warp function is a wrapper used to teleport a player to a /warp
|
||||
public void warp(String warp, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
Location loc = ess.getWarps().getWarp(warp);
|
||||
user.sendMessage(_("warpingTo", warp));
|
||||
teleport(new Target(loc), chargeFor, cause);
|
||||
}
|
||||
|
||||
//The back function is a wrapper used to teleport a player /back to their previous location.
|
||||
public void back(Trade chargeFor) throws Exception
|
||||
{
|
||||
teleport(new Target(user.getLastLocation()), chargeFor, TeleportCause.COMMAND);
|
||||
}
|
||||
|
||||
//This function is used to throw a user back after a jail sentence
|
||||
public void back() throws Exception
|
||||
{
|
||||
now(new Target(user.getLastLocation()), TeleportCause.COMMAND);
|
||||
}
|
||||
|
||||
//This function handles teleporting to /home
|
||||
public void home(Location loc, Trade chargeFor) throws Exception
|
||||
{
|
||||
teleport(new Target(loc), chargeFor, TeleportCause.COMMAND);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import com.earth2me.essentials.craftbukkit.SetExpFix;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
@@ -20,7 +20,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
public class Trade
|
||||
{
|
||||
private final transient String command;
|
||||
private final transient String fallbackCommand;
|
||||
private final transient Trade fallbackTrade;
|
||||
private final transient Double money;
|
||||
private final transient ItemStack itemStack;
|
||||
private final transient Integer exp;
|
||||
@@ -31,7 +31,7 @@ public class Trade
|
||||
this(command, null, null, null, null, ess);
|
||||
}
|
||||
|
||||
public Trade(final String command, final String fallback, final IEssentials ess)
|
||||
public Trade(final String command, final Trade fallback, final IEssentials ess)
|
||||
{
|
||||
this(command, fallback, null, null, null, ess);
|
||||
}
|
||||
@@ -51,10 +51,10 @@ public class Trade
|
||||
this(null, null, null, null, exp, ess);
|
||||
}
|
||||
|
||||
private Trade(final String command, final String fallback, final Double money, final ItemStack item, final Integer exp, final IEssentials ess)
|
||||
private Trade(final String command, final Trade fallback, final Double money, final ItemStack item, final Integer exp, final IEssentials ess)
|
||||
{
|
||||
this.command = command;
|
||||
this.fallbackCommand = fallback;
|
||||
this.fallbackTrade = fallback;
|
||||
this.money = money;
|
||||
this.itemStack = item;
|
||||
this.exp = exp;
|
||||
@@ -63,6 +63,12 @@ public class Trade
|
||||
|
||||
public void isAffordableFor(final IUser user) throws ChargeException
|
||||
{
|
||||
|
||||
if (ess.getSettings().isDebug())
|
||||
{
|
||||
ess.getLogger().log(Level.INFO, "checking if " + user.getName() + " can afford charge.");
|
||||
}
|
||||
|
||||
if (getMoney() != null
|
||||
&& getMoney() > 0
|
||||
&& !user.canAfford(getMoney()))
|
||||
@@ -144,9 +150,14 @@ public class Trade
|
||||
|
||||
public void charge(final IUser user) throws ChargeException
|
||||
{
|
||||
if (ess.getSettings().isDebug())
|
||||
{
|
||||
ess.getLogger().log(Level.INFO, "charging user " + user.getName());
|
||||
}
|
||||
|
||||
if (getMoney() != null)
|
||||
{
|
||||
if (!user.canAfford(getMoney()) && getMoney() > 0)
|
||||
if (!user.canAfford(getMoney()) && getMoney() > 0.0d)
|
||||
{
|
||||
throw new ChargeException(_("notEnoughMoney"));
|
||||
}
|
||||
@@ -164,7 +175,7 @@ public class Trade
|
||||
if (command != null)
|
||||
{
|
||||
final double cost = getCommandCost(user);
|
||||
if (!user.canAfford(cost) && cost > 0)
|
||||
if (!user.canAfford(cost) && cost > 0.0d)
|
||||
{
|
||||
throw new ChargeException(_("notEnoughMoney"));
|
||||
}
|
||||
@@ -198,16 +209,24 @@ public class Trade
|
||||
|
||||
public Double getCommandCost(final IUser user)
|
||||
{
|
||||
double cost = 0d;
|
||||
if (command != null && !command.isEmpty()
|
||||
&& !user.isAuthorized("essentials.nocommandcost.all")
|
||||
&& !user.isAuthorized("essentials.nocommandcost." + command))
|
||||
double cost = 0.0d;
|
||||
if (command != null && !command.isEmpty())
|
||||
{
|
||||
cost = ess.getSettings().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command);
|
||||
if (cost == 0.0 && fallbackCommand != null && !fallbackCommand.isEmpty())
|
||||
if (cost == 0.0d && fallbackTrade != null)
|
||||
{
|
||||
cost = ess.getSettings().getCommandCost(fallbackCommand.charAt(0) == '/' ? fallbackCommand.substring(1) : fallbackCommand);
|
||||
cost = fallbackTrade.getCommandCost(user);
|
||||
}
|
||||
|
||||
if (ess.getSettings().isDebug())
|
||||
{
|
||||
ess.getLogger().log(Level.INFO, "calculated command (" + command + ") cost for " + user.getName() + " as " + cost);
|
||||
}
|
||||
}
|
||||
if (cost != 0.0d && (user.isAuthorized("essentials.nocommandcost.all")
|
||||
|| user.isAuthorized("essentials.nocommandcost." + command)))
|
||||
{
|
||||
return 0.0d;
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
@@ -215,6 +234,9 @@ public class Trade
|
||||
|
||||
public static void log(String type, String subtype, String event, String sender, Trade charge, String receiver, Trade pay, Location loc, IEssentials ess)
|
||||
{
|
||||
//isEcoLogUpdateEnabled() - This refers to log entries with no location, ie API updates #EasterEgg
|
||||
//isEcoLogEnabled() - This refers to log entries with with location, ie /pay /sell and eco signs.
|
||||
|
||||
if ((loc == null && !ess.getSettings().isEcoLogUpdateEnabled())
|
||||
|| (loc != null && !ess.getSettings().isEcoLogEnabled()))
|
||||
{
|
||||
|
@@ -7,9 +7,11 @@ import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
|
||||
public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
@@ -24,8 +26,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
private transient long lastThrottledAction;
|
||||
private transient long lastActivity = System.currentTimeMillis();
|
||||
private boolean hidden = false;
|
||||
private boolean rightClickJump = false;
|
||||
private transient Location afkPosition = null;
|
||||
private boolean invSee = false;
|
||||
private boolean enderSee = false;
|
||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||
|
||||
User(final Player base, final IEssentials ess)
|
||||
@@ -59,20 +63,22 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
@Override
|
||||
public boolean isAuthorized(final String node)
|
||||
{
|
||||
final boolean result = isAuthorizedCheck(node);
|
||||
if (ess.getSettings().isDebug())
|
||||
{
|
||||
ess.getLogger().log(Level.INFO, "checking if " + base.getName() + " has " + node);
|
||||
ess.getLogger().log(Level.INFO, "checking if " + base.getName() + " has " + node + " - " + result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean isAuthorizedCheck(final String node)
|
||||
{
|
||||
|
||||
if (base instanceof OfflinePlayer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isOp())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isJailed())
|
||||
{
|
||||
return false;
|
||||
@@ -84,7 +90,15 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ess.getLogger().log(Level.SEVERE, "Permission System Error: " + ess.getPermissionsHandler().getName() + " returned: " + ex.getMessage());
|
||||
if (ess.getSettings().isDebug())
|
||||
{
|
||||
ess.getLogger().log(Level.SEVERE, "Permission System Error: " + ess.getPermissionsHandler().getName() + " returned: " + ex.getMessage(), ex);
|
||||
}
|
||||
else
|
||||
{
|
||||
ess.getLogger().log(Level.SEVERE, "Permission System Error: " + ess.getPermissionsHandler().getName() + " returned: " + ex.getMessage());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -115,7 +129,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
|
||||
public void giveMoney(final double value, final CommandSender initiator)
|
||||
{
|
||||
if (value == 0)
|
||||
if (value == 0.0d)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -129,7 +143,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
|
||||
public void payUser(final User reciever, final double value) throws Exception
|
||||
{
|
||||
if (value == 0)
|
||||
if (value == 0.0d)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -154,7 +168,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
|
||||
public void takeMoney(final double value, final CommandSender initiator)
|
||||
{
|
||||
if (value == 0)
|
||||
if (value == 0.0d)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -174,6 +188,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
|
||||
public boolean canAfford(final double cost, final boolean permcheck)
|
||||
{
|
||||
if (cost <= 0.0d)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
final double mon = getMoney();
|
||||
if (!permcheck || isAuthorized("essentials.eco.loan"))
|
||||
{
|
||||
@@ -232,16 +250,6 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
return getHome(getHomes().get(0));
|
||||
}
|
||||
|
||||
public void setHome()
|
||||
{
|
||||
setHome("home", getLocation());
|
||||
}
|
||||
|
||||
public void setHome(final String name)
|
||||
{
|
||||
setHome(name, getLocation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLastLocation()
|
||||
{
|
||||
@@ -284,11 +292,11 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
{
|
||||
try
|
||||
{
|
||||
final String opPrefix = ess.getSettings().getOperatorColor().toString();
|
||||
if (opPrefix.length() > 0)
|
||||
final ChatColor opPrefix = ess.getSettings().getOperatorColor();
|
||||
if (opPrefix != null && opPrefix.toString().length() > 0)
|
||||
{
|
||||
prefix.insert(0, opPrefix);
|
||||
suffix = "§f";
|
||||
prefix.insert(0, opPrefix.toString());
|
||||
suffix = "§r";
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -298,17 +306,18 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
|
||||
if (ess.getSettings().addPrefixSuffix())
|
||||
{
|
||||
//These two extra toggles are not documented, because they are mostly redundant #EasterEgg
|
||||
if (!ess.getSettings().disablePrefix())
|
||||
{
|
||||
final String ptext = ess.getPermissionsHandler().getPrefix(base).replace('&', '§');
|
||||
prefix.insert(0, ptext);
|
||||
suffix = "§f";
|
||||
suffix = "§r";
|
||||
}
|
||||
if (!ess.getSettings().disableSuffix())
|
||||
{
|
||||
final String stext = ess.getPermissionsHandler().getSuffix(base).replace('&', '§');
|
||||
suffix = stext + "§f";
|
||||
suffix = suffix.replace("§f§f", "§f");
|
||||
suffix = stext + "§r";
|
||||
suffix = suffix.replace("§f§f", "§f").replace("§f§r", "§r").replace("§r§r", "§r");
|
||||
}
|
||||
}
|
||||
final String strPrefix = prefix.toString();
|
||||
@@ -325,7 +334,8 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
{
|
||||
output = Util.lastCode(strPrefix) + nickname.substring(0, 14);
|
||||
}
|
||||
if (output.charAt(output.length() - 1) == '§') {
|
||||
if (output.charAt(output.length() - 1) == '§')
|
||||
{
|
||||
output = output.substring(0, output.length() - 1);
|
||||
}
|
||||
return output;
|
||||
@@ -482,6 +492,13 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
try
|
||||
{
|
||||
getTeleport().respawn(null, TeleportCause.PLUGIN);
|
||||
}
|
||||
catch (Exception ex1)
|
||||
{
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -548,7 +565,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
}
|
||||
}
|
||||
final long autoafk = ess.getSettings().getAutoAfk();
|
||||
if (!isAfk() && autoafk > 0 && lastActivity + autoafk * 1000 < System.currentTimeMillis() && isAuthorized("essentials.afk"))
|
||||
if (!isAfk() && autoafk > 0 && lastActivity + autoafk * 1000 < System.currentTimeMillis() && isAuthorized("essentials.afk.auto"))
|
||||
{
|
||||
setAfk(true);
|
||||
if (!isHidden())
|
||||
@@ -610,6 +627,16 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
{
|
||||
invSee = set;
|
||||
}
|
||||
|
||||
public boolean isEnderSee()
|
||||
{
|
||||
return enderSee;
|
||||
}
|
||||
|
||||
public void setEnderSee(final boolean set)
|
||||
{
|
||||
enderSee = set;
|
||||
}
|
||||
private transient long teleportInvulnerabilityTimestamp = 0;
|
||||
|
||||
public void enableInvulnerabilityAfterTeleport()
|
||||
@@ -639,7 +666,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
{
|
||||
return vanished;
|
||||
}
|
||||
|
||||
|
||||
public void setVanished(final boolean set)
|
||||
{
|
||||
vanished = set;
|
||||
@@ -671,23 +698,35 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
final boolean set = !vanished;
|
||||
this.setVanished(set);
|
||||
}
|
||||
|
||||
public boolean checkSignThrottle() {
|
||||
if (isSignThrottled()) {
|
||||
|
||||
public boolean checkSignThrottle()
|
||||
{
|
||||
if (isSignThrottled())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
updateThrottle();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public boolean isSignThrottled()
|
||||
{
|
||||
final long minTime = lastThrottledAction + (1000 / ess.getSettings().getSignUsePerSecond());
|
||||
return (System.currentTimeMillis() < minTime);
|
||||
}
|
||||
|
||||
|
||||
public void updateThrottle()
|
||||
{
|
||||
lastThrottledAction = System.currentTimeMillis();;
|
||||
}
|
||||
|
||||
public boolean isFlyClickJump()
|
||||
{
|
||||
return rightClickJump;
|
||||
}
|
||||
|
||||
public void setRightClickJump(boolean rightClickJump)
|
||||
{
|
||||
this.rightClickJump = rightClickJump;
|
||||
}
|
||||
}
|
||||
|
@@ -4,6 +4,8 @@ import static com.earth2me.essentials.I18n._;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.MemoryConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@@ -11,13 +13,14 @@ import org.bukkit.inventory.ItemStack;
|
||||
public abstract class UserData extends PlayerExtension implements IConf
|
||||
{
|
||||
protected final transient IEssentials ess;
|
||||
private final EssentialsConf config;
|
||||
private EssentialsConf config;
|
||||
private final File folder;
|
||||
|
||||
protected UserData(Player base, IEssentials ess)
|
||||
{
|
||||
super(base);
|
||||
this.ess = ess;
|
||||
File folder = new File(ess.getDataFolder(), "userdata");
|
||||
folder = new File(ess.getDataFolder(), "userdata");
|
||||
if (!folder.exists())
|
||||
{
|
||||
folder.mkdirs();
|
||||
@@ -26,6 +29,13 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
reloadConfig();
|
||||
}
|
||||
|
||||
public final void reset()
|
||||
{
|
||||
config.getFile().delete();
|
||||
config = new EssentialsConf(new File(folder, Util.sanitizeFileName(base.getName()) + ".yml"));
|
||||
reloadConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void reloadConfig()
|
||||
{
|
||||
@@ -99,26 +109,25 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
return new HashMap<String, Object>();
|
||||
}
|
||||
|
||||
public Location getHome(String name) throws Exception
|
||||
private String getHomeName(String search)
|
||||
{
|
||||
Location loc = config.getLocation("homes." + name, getServer());
|
||||
if (loc == null)
|
||||
if (Util.isInt(search))
|
||||
{
|
||||
try
|
||||
{
|
||||
loc = config.getLocation("homes." + getHomes().get(Integer.parseInt(name) - 1), getServer());
|
||||
search = getHomes().get(Integer.parseInt(search) - 1);
|
||||
}
|
||||
catch (IndexOutOfBoundsException e)
|
||||
catch (Exception e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return loc;
|
||||
return search;
|
||||
}
|
||||
|
||||
public Location getHome(String name) throws Exception
|
||||
{
|
||||
String search = getHomeName(name);
|
||||
return config.getLocation("homes." + search, getServer());
|
||||
}
|
||||
|
||||
public Location getHome(final Location world)
|
||||
@@ -152,7 +161,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
public void setHome(String name, Location loc)
|
||||
{
|
||||
//Invalid names will corrupt the yaml
|
||||
name = Util.sanitizeFileName(name);
|
||||
name = Util.safeString(name);
|
||||
homes.put(name, loc);
|
||||
config.setProperty("homes." + name, loc);
|
||||
config.save();
|
||||
@@ -160,20 +169,20 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
|
||||
public void delHome(String name) throws Exception
|
||||
{
|
||||
String search = name;
|
||||
String search = getHomeName(name);
|
||||
if (!homes.containsKey(search))
|
||||
{
|
||||
search = Util.sanitizeFileName(name);
|
||||
search = Util.safeString(search);
|
||||
}
|
||||
if (homes.containsKey(search))
|
||||
{
|
||||
homes.remove(name);
|
||||
config.removeProperty("homes." + name);
|
||||
homes.remove(search);
|
||||
config.removeProperty("homes." + search);
|
||||
config.save();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("invalidHome", name));
|
||||
throw new Exception(_("invalidHome", search));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,14 +449,14 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
|
||||
public List<String> getIgnoredPlayers()
|
||||
{
|
||||
return config.getStringList("ignore");
|
||||
return Collections.synchronizedList(config.getStringList("ignore"));
|
||||
}
|
||||
|
||||
public void setIgnoredPlayers(List<String> players)
|
||||
{
|
||||
if (players == null || players.isEmpty())
|
||||
{
|
||||
ignoredPlayers = new ArrayList<String>();
|
||||
ignoredPlayers = Collections.synchronizedList(new ArrayList<String>());
|
||||
config.removeProperty("ignore");
|
||||
}
|
||||
else
|
||||
@@ -466,7 +475,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return isIgnoredPlayer(user);
|
||||
return isIgnoredPlayer(user);
|
||||
}
|
||||
|
||||
public boolean isIgnoredPlayer(IUser user)
|
||||
@@ -626,7 +635,10 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
public void setLastLogin(long time)
|
||||
{
|
||||
_setLastLogin(time);
|
||||
_setLastLoginAddress(base.getAddress().getAddress().getHostAddress());
|
||||
if (base.getAddress() != null && base.getAddress().getAddress() != null)
|
||||
{
|
||||
_setLastLoginAddress(base.getAddress().getAddress().getHostAddress());
|
||||
}
|
||||
config.save();
|
||||
}
|
||||
private long lastLogout;
|
||||
@@ -777,27 +789,44 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
{
|
||||
return config.getBoolean("powertoolsenabled", true);
|
||||
}
|
||||
private Map<String, Object> kitTimestamps;
|
||||
private ConfigurationSection kitTimestamps;
|
||||
|
||||
private Map<String, Object> _getKitTimestamps()
|
||||
private ConfigurationSection _getKitTimestamps()
|
||||
{
|
||||
|
||||
if (config.isConfigurationSection("timestamps.kits"))
|
||||
{
|
||||
return config.getConfigurationSection("timestamps.kits").getValues(false);
|
||||
final ConfigurationSection section = config.getConfigurationSection("timestamps.kits");
|
||||
final ConfigurationSection newSection = new MemoryConfiguration();
|
||||
for (String command : section.getKeys(false))
|
||||
{
|
||||
if (section.isLong(command))
|
||||
{
|
||||
newSection.set(command.toLowerCase(Locale.ENGLISH), section.getLong(command));
|
||||
}
|
||||
else if (section.isInt(command))
|
||||
{
|
||||
newSection.set(command.toLowerCase(Locale.ENGLISH), (long)section.getInt(command));
|
||||
}
|
||||
}
|
||||
return newSection;
|
||||
}
|
||||
return new HashMap<String, Object>();
|
||||
return new MemoryConfiguration();
|
||||
}
|
||||
|
||||
public Long getKitTimestamp(final String name)
|
||||
public long getKitTimestamp(String name)
|
||||
{
|
||||
final Number num = (Number)kitTimestamps.get(name.toLowerCase(Locale.ENGLISH));
|
||||
return num == null ? null : num.longValue();
|
||||
name = name.replace('.', '_').replace('/', '_');
|
||||
if (kitTimestamps != null)
|
||||
{
|
||||
return kitTimestamps.getLong(name, 0l);
|
||||
}
|
||||
return 0l;
|
||||
}
|
||||
|
||||
public void setKitTimestamp(final String name, final long time)
|
||||
{
|
||||
kitTimestamps.put(name.toLowerCase(Locale.ENGLISH), time);
|
||||
kitTimestamps.set(name.toLowerCase(Locale.ENGLISH), time);
|
||||
config.setProperty("timestamps.kits", kitTimestamps);
|
||||
config.save();
|
||||
}
|
||||
|
@@ -24,12 +24,19 @@ public class Util
|
||||
private final static Pattern INVALIDFILECHARS = Pattern.compile("[^a-z0-9]");
|
||||
private final static Pattern INVALIDCHARS = Pattern.compile("[^\t\n\r\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFC]");
|
||||
|
||||
//Used to clean file names before saving to disk
|
||||
public static String sanitizeFileName(final String name)
|
||||
{
|
||||
final String newName = INVALIDFILECHARS.matcher(name.toLowerCase(Locale.ENGLISH)).replaceAll("_");
|
||||
return newName;
|
||||
return safeString(name);
|
||||
}
|
||||
|
||||
//Used to clean strings/names before saving as filenames/permissions
|
||||
public static String safeString(final String string)
|
||||
{
|
||||
return INVALIDFILECHARS.matcher(string.toLowerCase(Locale.ENGLISH)).replaceAll("_");
|
||||
}
|
||||
|
||||
//Less restrictive string sanitizing, when not used as perm or filename
|
||||
public static String sanitizeString(final String string)
|
||||
{
|
||||
return INVALIDCHARS.matcher(string).replaceAll("");
|
||||
@@ -215,10 +222,11 @@ public class Util
|
||||
{
|
||||
c.add(Calendar.SECOND, seconds * (future ? 1 : -1));
|
||||
}
|
||||
|
||||
|
||||
Calendar max = new GregorianCalendar();
|
||||
max.add(Calendar.YEAR, 10);
|
||||
if (c.after(max)) {
|
||||
if (c.after(max))
|
||||
{
|
||||
return max.getTimeInMillis();
|
||||
}
|
||||
return c.getTimeInMillis();
|
||||
@@ -284,6 +292,46 @@ public class Util
|
||||
}
|
||||
return block.getLocation();
|
||||
}
|
||||
public final static int RADIUS = 3;
|
||||
public final static Vector3D[] VOLUME;
|
||||
|
||||
|
||||
public static class Vector3D
|
||||
{
|
||||
public Vector3D(int x, int y, int z)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
List<Vector3D> pos = new ArrayList<Vector3D>();
|
||||
for (int x = -RADIUS; x <= RADIUS; x++)
|
||||
{
|
||||
for (int y = -RADIUS; y <= RADIUS; y++)
|
||||
{
|
||||
for (int z = -RADIUS; z <= RADIUS; z++)
|
||||
{
|
||||
pos.add(new Vector3D(x, y, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
Collections.sort(pos, new Comparator<Vector3D>()
|
||||
{
|
||||
@Override
|
||||
public int compare(Vector3D a, Vector3D b)
|
||||
{
|
||||
return (a.x * a.x + a.y * a.y + a.z * a.z) - (b.x * b.x + b.y * b.y + b.z * b.z);
|
||||
}
|
||||
});
|
||||
VOLUME = pos.toArray(new Vector3D[0]);
|
||||
}
|
||||
|
||||
public static Location getSafeDestination(final Location loc) throws Exception
|
||||
{
|
||||
@@ -295,25 +343,46 @@ public class Util
|
||||
int x = loc.getBlockX();
|
||||
int y = (int)Math.round(loc.getY());
|
||||
int z = loc.getBlockZ();
|
||||
final int origX = x;
|
||||
final int origY = y;
|
||||
final int origZ = z;
|
||||
|
||||
while (isBlockAboveAir(world, x, y, z))
|
||||
{
|
||||
y -= 1;
|
||||
if (y < 0)
|
||||
{
|
||||
y = origY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
while (isBlockUnsafe(world, x, y, z))
|
||||
{
|
||||
i++;
|
||||
if (i >= VOLUME.length)
|
||||
{
|
||||
x = origX;
|
||||
y = origY + RADIUS;
|
||||
z = origZ;
|
||||
break;
|
||||
}
|
||||
x = origX + VOLUME[i].x;
|
||||
y = origY + VOLUME[i].y;
|
||||
z = origZ + VOLUME[i].z;
|
||||
}
|
||||
|
||||
while (isBlockUnsafe(world, x, y, z))
|
||||
{
|
||||
y += 1;
|
||||
if (y >= world.getHighestBlockYAt(x, z))
|
||||
if (y >= world.getMaxHeight())
|
||||
{
|
||||
x += 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while (isBlockUnsafe(world, x, y, z))
|
||||
{
|
||||
y -= 1;
|
||||
@@ -321,7 +390,7 @@ public class Util
|
||||
{
|
||||
x += 1;
|
||||
y = world.getHighestBlockYAt(x, z);
|
||||
if (x - 32 > loc.getBlockX())
|
||||
if (x - 48 > loc.getBlockX())
|
||||
{
|
||||
throw new Exception(_("holeInFloor"));
|
||||
}
|
||||
@@ -336,6 +405,15 @@ public class Util
|
||||
}
|
||||
|
||||
public static boolean isBlockUnsafe(final World world, final int x, final int y, final int z)
|
||||
{
|
||||
if (isBlockDamaging(world, x, y, z))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return isBlockAboveAir(world, x, y, z);
|
||||
}
|
||||
|
||||
public static boolean isBlockDamaging(final World world, final int x, final int y, final int z)
|
||||
{
|
||||
final Block below = world.getBlockAt(x, y - 1, z);
|
||||
if (below.getType() == Material.LAVA || below.getType() == Material.STATIONARY_LAVA)
|
||||
@@ -348,12 +426,17 @@ public class Util
|
||||
return true;
|
||||
}
|
||||
|
||||
if (below.getType() == Material.BED_BLOCK)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((!AIR_MATERIALS.contains(world.getBlockAt(x, y, z).getType().getId()))
|
||||
|| (!AIR_MATERIALS.contains(world.getBlockAt(x, y + 1, z).getType().getId())))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return isBlockAboveAir(world, x, y, z);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ItemStack convertBlockToItem(final Block block)
|
||||
@@ -510,15 +593,16 @@ public class Util
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public static String lastCode(final String input) {
|
||||
|
||||
public static String lastCode(final String input)
|
||||
{
|
||||
int pos = input.lastIndexOf("§");
|
||||
if (pos == -1 || (pos + 1) == input.length()) {
|
||||
if (pos == -1 || (pos + 1) == input.length())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return input.substring(pos, pos + 2);
|
||||
return input.substring(pos, pos + 2);
|
||||
}
|
||||
|
||||
private static transient final Pattern URL_PATTERN = Pattern.compile("((?:(?:https?)://)?[\\w-_\\.]{2,})\\.([a-z]{2,3}(?:/\\S+)?)");
|
||||
private static transient final Pattern VANILLA_PATTERN = Pattern.compile("\u00A7+[0-9A-FK-ORa-fk-or]");
|
||||
private static transient final Pattern REPLACE_PATTERN = Pattern.compile("&([0-9a-fk-or])");
|
||||
|
@@ -3,6 +3,7 @@ package com.earth2me.essentials;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.commands.WarpNotFoundException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -70,7 +71,14 @@ public class Warps implements IConf
|
||||
}
|
||||
conf.setProperty(null, loc);
|
||||
conf.setProperty("name", name);
|
||||
conf.save();
|
||||
try
|
||||
{
|
||||
conf.saveWithError();
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
throw new IOException(_("invalidWarpName"));
|
||||
}
|
||||
}
|
||||
|
||||
public void delWarp(String name) throws Exception
|
||||
|
@@ -8,7 +8,6 @@ import com.earth2me.essentials.Util;
|
||||
import java.io.File;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
/**
|
||||
@@ -72,17 +71,7 @@ public final class Economy
|
||||
{
|
||||
throw new RuntimeException(noCallBeforeLoad);
|
||||
}
|
||||
User user;
|
||||
Player player = ess.getServer().getPlayer(name);
|
||||
if (player != null)
|
||||
{
|
||||
user = ess.getUser(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
user = ess.getOfflineUser(name);
|
||||
}
|
||||
return user;
|
||||
return ess.getUser(name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,10 +0,0 @@
|
||||
package com.earth2me.essentials.api;
|
||||
|
||||
import java.util.Map;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
|
||||
|
||||
public interface IAlternativeCommandsHandler
|
||||
{
|
||||
Map<String, String> disabledCommands();
|
||||
}
|
@@ -1,51 +0,0 @@
|
||||
package com.earth2me.essentials.api;
|
||||
|
||||
import com.earth2me.essentials.perm.IPermissionsHandler;
|
||||
import com.earth2me.essentials.register.payment.Methods;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
|
||||
public interface IEssentials extends Plugin, IReload
|
||||
{
|
||||
void addReloadListener(IReload listener);
|
||||
|
||||
IUser getUser(Object base);
|
||||
|
||||
int broadcastMessage(IUser sender, String message);
|
||||
|
||||
II18n getI18n();
|
||||
|
||||
ISettings getSettings();
|
||||
|
||||
IJails getJail();
|
||||
|
||||
IWarps getWarps();
|
||||
|
||||
IWorth getWorth();
|
||||
|
||||
IItemDb getItemDb();
|
||||
|
||||
IUserMap getUserMap();
|
||||
|
||||
IEssentialsEconomy getEconomy();
|
||||
|
||||
World getWorld(String name);
|
||||
|
||||
Methods getPaymentMethod();
|
||||
|
||||
int scheduleAsyncDelayedTask(Runnable run);
|
||||
|
||||
int scheduleSyncDelayedTask(Runnable run);
|
||||
|
||||
int scheduleSyncDelayedTask(Runnable run, long delay);
|
||||
|
||||
int scheduleSyncRepeatingTask(Runnable run, long delay, long period);
|
||||
|
||||
IPermissionsHandler getPermissionsHandler();
|
||||
|
||||
IAlternativeCommandsHandler getAlternativeCommandsHandler();
|
||||
|
||||
void showCommandError(CommandSender sender, String commandLabel, Throwable exception);
|
||||
}
|
@@ -1,37 +0,0 @@
|
||||
package com.earth2me.essentials.api;
|
||||
|
||||
|
||||
public interface IEssentialsEconomy
|
||||
{
|
||||
double getMoney(String name) throws UserDoesNotExistException;
|
||||
|
||||
void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException;
|
||||
|
||||
void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException;
|
||||
|
||||
void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException;
|
||||
|
||||
void divide(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException;
|
||||
|
||||
void multiply(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException;
|
||||
|
||||
void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException;
|
||||
|
||||
boolean hasEnough(String name, double amount) throws UserDoesNotExistException;
|
||||
|
||||
boolean hasMore(String name, double amount) throws UserDoesNotExistException;
|
||||
|
||||
boolean hasLess(String name, double amount) throws UserDoesNotExistException;
|
||||
|
||||
boolean isNegative(String name) throws UserDoesNotExistException;
|
||||
|
||||
String format(double amount);
|
||||
|
||||
boolean playerExists(String name);
|
||||
|
||||
boolean isNPC(String name) throws UserDoesNotExistException;
|
||||
|
||||
boolean createNPC(String name);
|
||||
|
||||
void removeNPC(String name) throws UserDoesNotExistException;
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
package com.earth2me.essentials.api;
|
||||
|
||||
import com.earth2me.essentials.settings.Settings;
|
||||
import com.earth2me.essentials.storage.IStorageObjectHolder;
|
||||
|
||||
|
||||
public interface ISettings extends IStorageObjectHolder<Settings>
|
||||
{
|
||||
|
||||
}
|
@@ -1,43 +0,0 @@
|
||||
package com.earth2me.essentials.api;
|
||||
|
||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public interface IUser extends Player, IReload
|
||||
{
|
||||
long getLastTeleportTimestamp();
|
||||
|
||||
boolean isAuthorized(String node);
|
||||
|
||||
boolean isAuthorized(IEssentialsCommand cmd);
|
||||
|
||||
boolean isAuthorized(IEssentialsCommand cmd, String permissionPrefix);
|
||||
|
||||
void setLastTeleportTimestamp(long time);
|
||||
|
||||
Location getLastLocation();
|
||||
|
||||
Player getBase();
|
||||
|
||||
double getMoney();
|
||||
|
||||
void takeMoney(double value);
|
||||
|
||||
void giveMoney(double value);
|
||||
|
||||
String getGroup();
|
||||
|
||||
void setLastLocation();
|
||||
|
||||
Location getHome(String name) throws Exception;
|
||||
|
||||
Location getHome(Location loc) throws Exception;
|
||||
|
||||
boolean isHidden();
|
||||
|
||||
ITeleport getTeleport();
|
||||
|
||||
void setJail(String jail);
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
package com.earth2me.essentials.api;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
public interface IUserMap
|
||||
{
|
||||
boolean userExists(final String name);
|
||||
|
||||
IUser getUser(final String name);
|
||||
|
||||
void removeUser(final String name);
|
||||
|
||||
Set<String> getAllUniqueUsers();
|
||||
|
||||
int getUniqueUsers();
|
||||
|
||||
File getUserFile(final String name);
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
package com.earth2me.essentials.api;
|
||||
|
||||
import java.util.Collection;
|
||||
import org.bukkit.Location;
|
||||
|
||||
|
||||
public interface IWarps extends IReload
|
||||
{
|
||||
Location getWarp(String warp) throws Exception;
|
||||
|
||||
Collection<String> getWarps();
|
||||
|
||||
void removeWarp(String name) throws Exception;
|
||||
|
||||
void setWarp(String name, Location loc) throws Exception;
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
package com.earth2me.essentials.api;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
public interface IWorth extends IReload
|
||||
{
|
||||
double getPrice(ItemStack itemStack);
|
||||
|
||||
void setPrice(ItemStack itemStack, double price);
|
||||
}
|
@@ -6,7 +6,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
|
||||
|
||||
// This command has a in theme message that only shows if you supply a parameter #EasterEgg
|
||||
public class Commandantioch extends EssentialsCommand
|
||||
{
|
||||
public Commandantioch()
|
||||
|
@@ -17,9 +17,9 @@ public class Commandback extends EssentialsCommand
|
||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
if (user.getWorld() != user.getLastLocation().getWorld() && ess.getSettings().isWorldTeleportPermissions()
|
||||
&& !user.isAuthorized("essentials.world." + user.getLastLocation().getWorld().getName()))
|
||||
&& !user.isAuthorized("essentials.worlds." + user.getLastLocation().getWorld().getName()))
|
||||
{
|
||||
throw new Exception(_("noPerm", "essentials.world." + user.getLastLocation().getWorld().getName()));
|
||||
throw new Exception(_("noPerm", "essentials.worlds." + user.getLastLocation().getWorld().getName()));
|
||||
}
|
||||
final Trade charge = new Trade(this.getName(), ess);
|
||||
charge.isAffordableFor(user);
|
||||
|
@@ -27,6 +27,7 @@ public class Commandbalance extends EssentialsCommand
|
||||
@Override
|
||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
//TODO: Remove 'other' perm
|
||||
final double bal = (args.length < 1
|
||||
|| !(user.isAuthorized("essentials.balance.others")
|
||||
|| user.isAuthorized("essentials.balance.other"))
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.User;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.textreader.ArrayListInput;
|
||||
import com.earth2me.essentials.textreader.TextPager;
|
||||
|
@@ -2,7 +2,9 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.Console;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.OfflinePlayer;
|
||||
import com.earth2me.essentials.User;
|
||||
import java.util.logging.Level;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -18,11 +20,21 @@ public class Commandban extends EssentialsCommand
|
||||
@Override
|
||||
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
boolean nomatch = false;
|
||||
if (args.length < 1)
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
final User user = getPlayer(server, args, 0, true);
|
||||
User user;
|
||||
try
|
||||
{
|
||||
user = getPlayer(server, args, 0, true);
|
||||
}
|
||||
catch (NoSuchFieldException e)
|
||||
{
|
||||
nomatch = true;
|
||||
user = ess.getUser(new OfflinePlayer(args[0], ess));
|
||||
}
|
||||
if (!user.isOnline())
|
||||
{
|
||||
if (sender instanceof Player
|
||||
@@ -34,13 +46,13 @@ public class Commandban extends EssentialsCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
if (user.isAuthorized("essentials.ban.exempt"))
|
||||
if (user.isAuthorized("essentials.ban.exempt") && sender instanceof Player)
|
||||
{
|
||||
sender.sendMessage(_("banExempt"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
|
||||
String banReason;
|
||||
if (args.length > 1)
|
||||
@@ -51,15 +63,21 @@ public class Commandban extends EssentialsCommand
|
||||
{
|
||||
banReason = _("banFormat", _("defaultBanReason"), senderName);
|
||||
}
|
||||
|
||||
|
||||
user.setBanReason(banReason);
|
||||
user.setBanned(true);
|
||||
user.kickPlayer(banReason);
|
||||
|
||||
server.getLogger().log(Level.INFO, _("playerBanned", senderName, user.getName(), banReason));
|
||||
|
||||
if (nomatch) {
|
||||
sender.sendMessage(_("userUnknown", user.getName()));
|
||||
}
|
||||
|
||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||
{
|
||||
final User player = ess.getUser(onlinePlayer);
|
||||
if (player.isAuthorized("essentials.ban.notify"))
|
||||
if (onlinePlayer == sender || player.isAuthorized("essentials.ban.notify"))
|
||||
{
|
||||
onlinePlayer.sendMessage(_("playerBanned", senderName, user.getName(), banReason));
|
||||
}
|
||||
|
@@ -2,13 +2,10 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.User;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
public class Commandbreak extends EssentialsCommand
|
||||
|
@@ -20,6 +20,12 @@ public class Commandburn extends EssentialsCommand
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
//TODO: TL this
|
||||
if (args[0].trim().length() < 2)
|
||||
{
|
||||
throw new NotEnoughArgumentsException("You need to specify a player to burn.");
|
||||
}
|
||||
|
||||
for (Player p : server.matchPlayer(args[0]))
|
||||
{
|
||||
|
@@ -4,7 +4,10 @@ import com.earth2me.essentials.Enchantments;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import java.util.*;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
@@ -0,0 +1,30 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.Server;
|
||||
|
||||
|
||||
public class Commandenderchest extends EssentialsCommand
|
||||
{
|
||||
public Commandenderchest()
|
||||
{
|
||||
super("enderchest");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
if (args.length > 0 && user.isAuthorized("essentials.enderchest.others"))
|
||||
{
|
||||
final User invUser = getPlayer(server, args, 0);
|
||||
user.openInventory(invUser.getEnderChest());
|
||||
user.setEnderSee(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
user.openInventory(user.getEnderChest());
|
||||
user.setEnderSee(false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -1,13 +1,11 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.metrics.Metrics;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
@@ -16,7 +14,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
// This command has 4 undocumented behaviours #EasterEgg
|
||||
public class Commandessentials extends EssentialsCommand
|
||||
{
|
||||
public Commandessentials()
|
||||
@@ -44,6 +42,10 @@ public class Commandessentials extends EssentialsCommand
|
||||
{
|
||||
run_moo(server, sender, commandLabel, args);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("reset"))
|
||||
{
|
||||
run_reset(server, sender, commandLabel, args);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("opt-out"))
|
||||
{
|
||||
run_optout(server, sender, commandLabel, args);
|
||||
@@ -53,6 +55,7 @@ public class Commandessentials extends EssentialsCommand
|
||||
}
|
||||
}
|
||||
|
||||
//If you do not supply an argument this command will list 'overridden' commands.
|
||||
private void run_disabled(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
sender.sendMessage("Essentials " + ess.getDescription().getVersion());
|
||||
@@ -72,6 +75,17 @@ public class Commandessentials extends EssentialsCommand
|
||||
}
|
||||
}
|
||||
|
||||
private void run_reset(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
throw new NotEnoughArgumentsException("/<command> reset <player>");
|
||||
}
|
||||
final User user = getPlayer(server, args, 1, true);
|
||||
user.reset();
|
||||
sender.sendMessage("Reset Essentials userdata for player: " + user.getDisplayName());
|
||||
}
|
||||
|
||||
private void run_debug(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
ess.getSettings().setDebug(!ess.getSettings().isDebug());
|
||||
|
@@ -2,8 +2,8 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.craftbukkit.SetExpFix;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -104,7 +104,7 @@ public class Commandexp extends EssentialsCommand
|
||||
}
|
||||
}
|
||||
|
||||
private void expMatch(final Server server, final CommandSender sender, final String match, final String amount, final boolean toggle) throws NotEnoughArgumentsException
|
||||
private void expMatch(final Server server, final CommandSender sender, final String match, String amount, final boolean toggle) throws NotEnoughArgumentsException
|
||||
{
|
||||
boolean foundUser = false;
|
||||
for (Player matchPlayer : server.matchPlayer(match))
|
||||
@@ -122,13 +122,28 @@ public class Commandexp extends EssentialsCommand
|
||||
private void showExp(final CommandSender sender, final User target)
|
||||
{
|
||||
final int totalExp = SetExpFix.getTotalExperience(target);
|
||||
final int expLeft = (int)Util.roundDouble(((((3.5 * target.getLevel()) + 6.7) - (totalExp - ((1.75 * (target.getLevel() * target.getLevel())) + (5.00 * target.getLevel())))) + 1));
|
||||
sender.sendMessage(_("exp", target.getDisplayName(), SetExpFix.getTotalExperience(target), target.getLevel(), expLeft));
|
||||
sender.sendMessage(_("exp", target.getDisplayName(), SetExpFix.getTotalExperience(target), target.getLevel(), SetExpFix.getExpUntilNextLevel(target)));
|
||||
}
|
||||
|
||||
private void setExp(final CommandSender sender, final User target, final String strAmount, final boolean give)
|
||||
private void setExp(final CommandSender sender, final User target, String strAmount, final boolean give)
|
||||
{
|
||||
Long amount = Long.parseLong(strAmount);
|
||||
Long amount;
|
||||
strAmount = strAmount.toLowerCase(Locale.ENGLISH);
|
||||
if (strAmount.startsWith("l"))
|
||||
{
|
||||
strAmount = strAmount.substring(1);
|
||||
int neededLevel = Integer.parseInt(strAmount);
|
||||
if (give)
|
||||
{
|
||||
neededLevel += target.getLevel();
|
||||
}
|
||||
amount = (long)SetExpFix.getExpToLevel(neededLevel);
|
||||
SetExpFix.setTotalExperience(target, 0);
|
||||
}
|
||||
else {
|
||||
amount = Long.parseLong(strAmount);
|
||||
}
|
||||
|
||||
if (give)
|
||||
{
|
||||
amount += SetExpFix.getTotalExperience(target);
|
||||
|
@@ -19,53 +19,106 @@ public class Commandgamemode extends EssentialsCommand
|
||||
@Override
|
||||
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 1)
|
||||
if (args.length < 2)
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
gamemodeOtherPlayers(server, sender, args);
|
||||
GameMode gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH));
|
||||
gamemodeOtherPlayers(server, sender, gameMode, args[1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
if (args.length > 0 && args[0].trim().length() > 2 && user.isAuthorized("essentials.gamemode.others"))
|
||||
GameMode gameMode;
|
||||
if (args.length == 0)
|
||||
{
|
||||
gamemodeOtherPlayers(server, user, args);
|
||||
gameMode = matchGameMode(commandLabel);
|
||||
}
|
||||
else if (args.length > 1 && args[1].trim().length() > 2 && user.isAuthorized("essentials.gamemode.others"))
|
||||
{
|
||||
gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH));
|
||||
gamemodeOtherPlayers(server, user, gameMode, args[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
user.setGameMode(user.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL);
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
catch (NotEnoughArgumentsException e)
|
||||
{
|
||||
if (user.isAuthorized("essentials.gamemode.others"))
|
||||
{
|
||||
gameMode = matchGameMode(commandLabel);
|
||||
gamemodeOtherPlayers(server, user, gameMode, args[0]);
|
||||
return;
|
||||
}
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
}
|
||||
if (gameMode == null)
|
||||
{
|
||||
gameMode = user.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : user.getGameMode() == GameMode.CREATIVE ? GameMode.ADVENTURE : GameMode.SURVIVAL;
|
||||
}
|
||||
user.setGameMode(gameMode);
|
||||
user.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName()));
|
||||
}
|
||||
|
||||
private void gamemodeOtherPlayers(final Server server, final CommandSender sender, final String[] args)
|
||||
private void gamemodeOtherPlayers(final Server server, final CommandSender sender, final GameMode gameMode, final String player) throws NotEnoughArgumentsException
|
||||
{
|
||||
for (Player matchPlayer : server.matchPlayer(args[0]))
|
||||
//TODO: TL this
|
||||
if (player.trim().length() < 2 || gameMode == null)
|
||||
{
|
||||
final User player = ess.getUser(matchPlayer);
|
||||
if (player.isHidden())
|
||||
throw new NotEnoughArgumentsException("You need to specify a valid player/mode.");
|
||||
}
|
||||
|
||||
boolean foundUser = false;
|
||||
for (Player matchPlayer : server.matchPlayer(player))
|
||||
{
|
||||
final User user = ess.getUser(matchPlayer);
|
||||
if (user.isHidden())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (args.length > 1)
|
||||
{
|
||||
if (args[1].contains("creat") || args[1].equalsIgnoreCase("1"))
|
||||
{
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setGameMode(player.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL);
|
||||
}
|
||||
sender.sendMessage(_("gameMode", _(player.getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName()));
|
||||
user.setGameMode(gameMode);
|
||||
sender.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName()));
|
||||
foundUser = true;
|
||||
}
|
||||
if (!foundUser)
|
||||
{
|
||||
throw new NotEnoughArgumentsException(_("playerNotFound"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private GameMode matchGameMode(String modeString) throws NotEnoughArgumentsException
|
||||
{
|
||||
GameMode mode = null;
|
||||
if (modeString.equalsIgnoreCase("gmc") || modeString.equalsIgnoreCase("egmc")
|
||||
|| modeString.contains("creat") || modeString.equalsIgnoreCase("1") || modeString.equalsIgnoreCase("c"))
|
||||
{
|
||||
mode = GameMode.CREATIVE;
|
||||
}
|
||||
else if (modeString.equalsIgnoreCase("gms") || modeString.equalsIgnoreCase("egms")
|
||||
|| modeString.contains("survi") || modeString.equalsIgnoreCase("0") || modeString.equalsIgnoreCase("s"))
|
||||
{
|
||||
mode = GameMode.SURVIVAL;
|
||||
}
|
||||
else if (modeString.equalsIgnoreCase("gma") || modeString.equalsIgnoreCase("egma")
|
||||
|| modeString.contains("advent") || modeString.equalsIgnoreCase("2") || modeString.equalsIgnoreCase("a"))
|
||||
{
|
||||
mode = GameMode.ADVENTURE;
|
||||
}
|
||||
else if (modeString.equalsIgnoreCase("gmt") || modeString.equalsIgnoreCase("egmt")
|
||||
|| modeString.contains("toggle") || modeString.contains("cycle") || modeString.equalsIgnoreCase("t"))
|
||||
{
|
||||
mode = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
}
|
@@ -1,6 +1,8 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Util;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
@@ -31,17 +33,28 @@ public class Commandgc extends EssentialsCommand
|
||||
{
|
||||
color = ChatColor.RED;
|
||||
}
|
||||
|
||||
sender.sendMessage(_("uptime", Util.formatDateDiff(ManagementFactory.getRuntimeMXBean().getStartTime())));
|
||||
sender.sendMessage(_("tps", "" + color + tps));
|
||||
sender.sendMessage(_("gcmax", (Runtime.getRuntime().maxMemory() / 1024 / 1024)));
|
||||
sender.sendMessage(_("gctotal", (Runtime.getRuntime().totalMemory() / 1024 / 1024)));
|
||||
sender.sendMessage(_("gcfree", (Runtime.getRuntime().freeMemory() / 1024 / 1024)));
|
||||
sender.sendMessage(_("gcfree", (Runtime.getRuntime().freeMemory() / 1024 / 1024)));
|
||||
|
||||
for (World w : server.getWorlds())
|
||||
{
|
||||
sender.sendMessage(
|
||||
(w.getEnvironment() == World.Environment.NETHER ? "Nether" : "World") + " \"" + w.getName() + "\": "
|
||||
+ w.getLoadedChunks().length + _("gcchunks")
|
||||
+ w.getEntities().size() + _("gcentities"));
|
||||
String worldType = "World";
|
||||
switch (w.getEnvironment())
|
||||
{
|
||||
case NETHER:
|
||||
worldType = "Nether";
|
||||
break;
|
||||
case THE_END:
|
||||
worldType = "The End";
|
||||
break;
|
||||
}
|
||||
|
||||
sender.sendMessage(_("gcWorld", worldType, w.getName(), w.getLoadedChunks().length, w.getEntities().size()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
@@ -40,18 +41,17 @@ public class Commandgetpos extends EssentialsCommand
|
||||
outputPosition(sender, user.getLocation(), null);
|
||||
}
|
||||
|
||||
//TODO: Translate
|
||||
private void outputPosition(final CommandSender sender, final Location coords, final Location distance)
|
||||
{
|
||||
sender.sendMessage("§7World: " + coords.getWorld().getName());
|
||||
sender.sendMessage("§7X: " + coords.getBlockX() + " (+East <-> -West)");
|
||||
sender.sendMessage("§7Y: " + coords.getBlockY() + " (+Up <-> -Down)");
|
||||
sender.sendMessage("§7Z: " + coords.getBlockZ() + " (+South <-> -North)");
|
||||
sender.sendMessage("§7Yaw: " + (coords.getYaw() + 180 + 360) % 360 + " (Rotation)");
|
||||
sender.sendMessage("§7Pitch: " + coords.getPitch() + " (Head angle)");
|
||||
sender.sendMessage(_("currentWorld", coords.getWorld().getName()));
|
||||
sender.sendMessage(_("posX", coords.getBlockX()));
|
||||
sender.sendMessage(_("posY", coords.getBlockY()));
|
||||
sender.sendMessage(_("posZ", coords.getBlockZ()));
|
||||
sender.sendMessage(_("posYaw", (coords.getYaw() + 180 + 360) % 360));
|
||||
sender.sendMessage(_("posPitch", coords.getPitch()));
|
||||
if (distance != null && coords.getWorld().equals(distance.getWorld()))
|
||||
{
|
||||
sender.sendMessage("§7Distance: " + coords.distance(distance));
|
||||
sender.sendMessage(_("distance", coords.distance(distance)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,10 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -46,7 +45,7 @@ public class Commandgive extends EssentialsCommand
|
||||
final User giveTo = getPlayer(server, args, 0);
|
||||
|
||||
if (args.length > 3 && Util.isInt(args[2]) && Util.isInt(args[3]))
|
||||
{
|
||||
{
|
||||
stack.setAmount(Integer.parseInt(args[2]));
|
||||
stack.setDurability(Short.parseShort(args[3]));
|
||||
}
|
||||
@@ -91,9 +90,8 @@ public class Commandgive extends EssentialsCommand
|
||||
throw new Exception(_("cantSpawnItem", "Air"));
|
||||
}
|
||||
|
||||
//TODO: TL this.
|
||||
final String itemName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' ');
|
||||
sender.sendMessage(ChatColor.BLUE + "Giving " + stack.getAmount() + " of " + itemName + " to " + giveTo.getDisplayName() + ".");
|
||||
sender.sendMessage(_("giveSpawn", stack.getAmount(), itemName, giveTo.getDisplayName()));
|
||||
if (giveTo.isAuthorized("essentials.oversizedstacks"))
|
||||
{
|
||||
InventoryWorkaround.addItem(giveTo.getInventory(), true, ess.getSettings().getOversizedStackSize(), stack);
|
||||
|
@@ -6,6 +6,8 @@ import java.util.List;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
|
||||
public class Commandheal extends EssentialsCommand
|
||||
@@ -33,9 +35,7 @@ public class Commandheal extends EssentialsCommand
|
||||
{
|
||||
user.healCooldown();
|
||||
}
|
||||
user.setHealth(20);
|
||||
user.setFoodLevel(20);
|
||||
user.sendMessage(_("heal"));
|
||||
healPlayer(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,10 +63,19 @@ public class Commandheal extends EssentialsCommand
|
||||
{
|
||||
continue;
|
||||
}
|
||||
p.setHealth(20);
|
||||
p.setFoodLevel(20);
|
||||
p.sendMessage(_("heal"));
|
||||
healPlayer(p);
|
||||
sender.sendMessage(_("healOther", p.getDisplayName()));
|
||||
}
|
||||
}
|
||||
|
||||
private void healPlayer(final Player p)
|
||||
{
|
||||
p.setHealth(20);
|
||||
p.setFoodLevel(20);
|
||||
p.sendMessage(_("heal"));
|
||||
for (PotionEffect effect : p.getActivePotionEffects())
|
||||
{
|
||||
p.removePotionEffect(effect.getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,6 @@ public class Commandhome extends EssentialsCommand
|
||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
final Trade charge = new Trade(this.getName(), ess);
|
||||
charge.isAffordableFor(user);
|
||||
User player = user;
|
||||
String homeName = "";
|
||||
String[] nameParts;
|
||||
@@ -45,7 +44,7 @@ public class Commandhome extends EssentialsCommand
|
||||
}
|
||||
try
|
||||
{
|
||||
if ("bed".equalsIgnoreCase(homeName))
|
||||
if ("bed".equalsIgnoreCase(homeName) && user.isAuthorized("essentials.home.bed"))
|
||||
{
|
||||
final Location bed = player.getBedSpawnLocation();
|
||||
if (bed != null && bed.getBlock().getType() == Material.BED_BLOCK)
|
||||
@@ -102,9 +101,9 @@ public class Commandhome extends EssentialsCommand
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
if (user.getWorld() != loc.getWorld() && ess.getSettings().isWorldHomePermissions()
|
||||
&& !user.isAuthorized("essentials.world." + loc.getWorld().getName()))
|
||||
&& !user.isAuthorized("essentials.worlds." + loc.getWorld().getName()))
|
||||
{
|
||||
throw new Exception(_("noPerm", "essentials.world." + loc.getWorld().getName()));
|
||||
throw new Exception(_("noPerm", "essentials.worlds." + loc.getWorld().getName()));
|
||||
}
|
||||
user.getTeleport().home(loc, charge);
|
||||
}
|
||||
|
@@ -1,10 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.User;
|
||||
import java.util.Arrays;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
public class Commandinvsee extends EssentialsCommand
|
||||
@@ -21,8 +18,8 @@ public class Commandinvsee extends EssentialsCommand
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
final User invUser = getPlayer(server, args, 0);
|
||||
final User invUser = getPlayer(server, args, 0);
|
||||
user.setInvSee(true);
|
||||
user.openInventory(invUser.getInventory());
|
||||
user.openInventory(invUser.getInventory());
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
|
@@ -19,10 +19,12 @@ public class Commanditemdb extends EssentialsCommand
|
||||
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
ItemStack itemStack = null;
|
||||
boolean itemHeld = false;
|
||||
if (args.length < 1)
|
||||
{
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
itemHeld = true;
|
||||
itemStack = ((Player)sender).getItemInHand();
|
||||
}
|
||||
if (itemStack == null)
|
||||
@@ -34,9 +36,9 @@ public class Commanditemdb extends EssentialsCommand
|
||||
{
|
||||
itemStack = ess.getItemDb().get(args[0]);
|
||||
}
|
||||
sender.sendMessage(itemStack.getType().toString() + "- " + itemStack.getTypeId() + ":" + Integer.toString(itemStack.getData().getData()));
|
||||
|
||||
if (itemStack.getType() != Material.AIR)
|
||||
sender.sendMessage(_("itemType", itemStack.getType().toString(), itemStack.getTypeId() + ":" + Integer.toString(itemStack.getDurability())));
|
||||
|
||||
if (itemHeld && itemStack.getType() != Material.AIR)
|
||||
{
|
||||
int maxuses = itemStack.getType().getMaxDurability();
|
||||
int durability = ((maxuses + 1) - itemStack.getDurability());
|
||||
@@ -44,6 +46,11 @@ public class Commanditemdb extends EssentialsCommand
|
||||
{
|
||||
sender.sendMessage(_("durability", Integer.toString(durability)));
|
||||
}
|
||||
}
|
||||
}
|
||||
final String itemNameList = ess.getItemDb().names(itemStack);
|
||||
if (itemNameList != null)
|
||||
{
|
||||
sender.sendMessage(_("itemNames", ess.getItemDb().names(itemStack)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
|
||||
// This method contains an undocumented sub command #EasterEgg
|
||||
public class Commandjump extends EssentialsCommand
|
||||
{
|
||||
public Commandjump()
|
||||
@@ -19,6 +19,21 @@ public class Commandjump extends EssentialsCommand
|
||||
@Override
|
||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
if (args.length > 0 && args[0].contains("lock") && user.isAuthorized("essentials.jump.lock"))
|
||||
{
|
||||
if (user.isFlyClickJump())
|
||||
{
|
||||
user.setRightClickJump(false);
|
||||
user.sendMessage("Flying wizard mode disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
user.setRightClickJump(true);
|
||||
user.sendMessage("Enabling flying wizard mode");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Location loc;
|
||||
final Location cloc = user.getLocation();
|
||||
|
||||
|
@@ -3,6 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import com.earth2me.essentials.Console;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.User;
|
||||
import java.util.logging.Level;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -23,21 +24,29 @@ public class Commandkick extends EssentialsCommand
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
final User user = getPlayer(server, args, 0);
|
||||
if (sender instanceof Player && user.isAuthorized("essentials.kick.exempt"))
|
||||
{
|
||||
throw new Exception(_("kickExempt"));
|
||||
final User target = getPlayer(server, args, 0, true);
|
||||
if (sender instanceof Player) {
|
||||
User user = ess.getUser(sender);
|
||||
if (target.isHidden() && !user.isAuthorized("essentials.list.hidden")) {
|
||||
throw new PlayerNotFoundException();
|
||||
}
|
||||
if (target.isAuthorized("essentials.kick.exempt"))
|
||||
{
|
||||
throw new Exception(_("kickExempt"));
|
||||
}
|
||||
}
|
||||
final String kickReason = args.length > 1 ? getFinalArg(args, 1) : _("kickDefault");
|
||||
user.kickPlayer(kickReason);
|
||||
target.kickPlayer(kickReason);
|
||||
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
|
||||
|
||||
server.getLogger().log(Level.INFO, _("playerKicked", senderName, target.getName(), kickReason));
|
||||
|
||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||
{
|
||||
User player = ess.getUser(onlinePlayer);
|
||||
if (player.isAuthorized("essentials.kick.notify"))
|
||||
{
|
||||
onlinePlayer.sendMessage(_("playerKicked", senderName, user.getName(), kickReason));
|
||||
onlinePlayer.sendMessage(_("playerKicked", senderName, target.getName(), kickReason));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -22,16 +22,28 @@ public class Commandkill extends EssentialsCommand
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
//TODO: TL this
|
||||
if (args[0].trim().length() < 2)
|
||||
{
|
||||
throw new NotEnoughArgumentsException("You need to specify a player to kill.");
|
||||
}
|
||||
|
||||
for (Player matchPlayer : server.matchPlayer(args[0]))
|
||||
{
|
||||
final EntityDamageEvent ede = new EntityDamageEvent(matchPlayer, sender instanceof Player && ((Player)sender).getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, Short.MAX_VALUE);
|
||||
server.getPluginManager().callEvent(ede);
|
||||
if (ede.isCancelled() && !sender.hasPermission("essentials.kill.force"))
|
||||
if (ede.isCancelled() && sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.kill.force"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
matchPlayer.damage(Short.MAX_VALUE);
|
||||
|
||||
if (matchPlayer.getHealth() > 0)
|
||||
{
|
||||
matchPlayer.setHealth(0);
|
||||
}
|
||||
|
||||
sender.sendMessage(_("kill", matchPlayer.getDisplayName()));
|
||||
}
|
||||
}
|
||||
|
@@ -1,27 +1,14 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.Mob;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Mob;
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Animals;
|
||||
import org.bukkit.entity.ComplexLivingEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Flying;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.NPC;
|
||||
import org.bukkit.entity.Ocelot;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.entity.Snowman;
|
||||
import org.bukkit.entity.WaterMob;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
|
||||
|
||||
|
@@ -1,8 +1,13 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.*;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import java.util.*;
|
||||
import com.earth2me.essentials.Kit;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@@ -26,12 +31,12 @@ public class Commandkit extends EssentialsCommand
|
||||
else if (args.length > 1 && user.isAuthorized("essentials.kit.others"))
|
||||
{
|
||||
final User userTo = getPlayer(server, args, 1, true);
|
||||
final String kitName = Util.sanitizeString(args[0].toLowerCase(Locale.ENGLISH));
|
||||
final String kitName = Util.sanitizeString(args[0].toLowerCase(Locale.ENGLISH)).trim();
|
||||
giveKit(userTo, user, kitName);
|
||||
}
|
||||
else
|
||||
{
|
||||
final String kitName = Util.sanitizeString(args[0].toLowerCase(Locale.ENGLISH));
|
||||
final String kitName = Util.sanitizeString(args[0].toLowerCase(Locale.ENGLISH)).trim();
|
||||
giveKit(user, user, kitName);
|
||||
}
|
||||
}
|
||||
@@ -59,12 +64,17 @@ public class Commandkit extends EssentialsCommand
|
||||
}
|
||||
|
||||
private void giveKit(User userTo, User userFrom, String kitName) throws Exception
|
||||
{
|
||||
{
|
||||
if (kitName.isEmpty())
|
||||
{
|
||||
throw new Exception(_("kitError2"));
|
||||
}
|
||||
|
||||
final Map<String, Object> kit = ess.getSettings().getKit(kitName);
|
||||
|
||||
if (!userFrom.isAuthorized("essentials.kit." + kitName))
|
||||
if (!userFrom.isAuthorized("essentials.kits." + kitName))
|
||||
{
|
||||
throw new Exception(_("noKitPermission", "essentials.kit." + kitName));
|
||||
throw new Exception(_("noKitPermission", "essentials.kits." + kitName));
|
||||
}
|
||||
|
||||
final List<String> items = Kit.getItems(userTo, kit);
|
||||
|
@@ -7,7 +7,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Ocelot;
|
||||
|
||||
|
||||
// This command is not documented on the wiki #EasterEgg
|
||||
public class Commandkittycannon extends EssentialsCommand
|
||||
{
|
||||
private static Random random = new Random();
|
||||
|
@@ -6,11 +6,13 @@ import com.earth2me.essentials.Util;
|
||||
import java.util.List;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class Commandmail extends EssentialsCommand
|
||||
{
|
||||
private static int mailsPerMinute = 0;
|
||||
private static long timestamp = 0;
|
||||
|
||||
public Commandmail()
|
||||
{
|
||||
super("mail");
|
||||
@@ -42,24 +44,29 @@ public class Commandmail extends EssentialsCommand
|
||||
throw new Exception(_("noPerm", "essentials.mail.send"));
|
||||
}
|
||||
|
||||
Player player = server.getPlayer(args[1]);
|
||||
User u;
|
||||
if (player != null)
|
||||
{
|
||||
u = ess.getUser(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
u = ess.getOfflineUser(args[1]);
|
||||
}
|
||||
User u = ess.getUser(args[1]);
|
||||
if (u == null)
|
||||
{
|
||||
throw new Exception(_("playerNeverOnServer", args[1]));
|
||||
}
|
||||
if (!u.isIgnoredPlayer(user))
|
||||
{
|
||||
final String mail = Util.sanitizeString(Util.stripFormat(getFinalArg(args, 2)));
|
||||
u.addMail(user.getName() + ": " + mail);
|
||||
final String mail = user.getName() + ": " + Util.sanitizeString(Util.stripFormat(getFinalArg(args, 2)));
|
||||
if (mail.length() > 1000)
|
||||
{
|
||||
throw new Exception("Mail message too long. Try to keep it below 1000");
|
||||
}
|
||||
if (Math.abs(System.currentTimeMillis() - timestamp) > 60000)
|
||||
{
|
||||
timestamp = System.currentTimeMillis();
|
||||
mailsPerMinute = 0;
|
||||
}
|
||||
mailsPerMinute++;
|
||||
if (mailsPerMinute > ess.getSettings().getMailsPerMinute())
|
||||
{
|
||||
throw new Exception("Too many mails have been send within the last minute. Maximum: " + ess.getSettings().getMailsPerMinute());
|
||||
}
|
||||
u.addMail(mail);
|
||||
}
|
||||
user.sendMessage(_("mailSent"));
|
||||
return;
|
||||
@@ -96,16 +103,7 @@ public class Commandmail extends EssentialsCommand
|
||||
}
|
||||
else if (args.length >= 3 && "send".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
Player player = server.getPlayer(args[1]);
|
||||
User u;
|
||||
if (player != null)
|
||||
{
|
||||
u = ess.getUser(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
u = ess.getOfflineUser(args[1]);
|
||||
}
|
||||
User u = ess.getUser(args[1]);
|
||||
if (u == null)
|
||||
{
|
||||
throw new Exception(_("playerNeverOnServer", args[1]));
|
||||
@@ -121,16 +119,7 @@ public class Commandmail extends EssentialsCommand
|
||||
else if (args.length >= 2)
|
||||
{
|
||||
//allow sending from console without "send" argument, since it's the only thing the console can do
|
||||
Player player = server.getPlayer(args[0]);
|
||||
User u;
|
||||
if (player != null)
|
||||
{
|
||||
u = ess.getUser(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
u = ess.getOfflineUser(args[0]);
|
||||
}
|
||||
User u = ess.getUser(args[0]);
|
||||
if (u == null)
|
||||
{
|
||||
throw new Exception(_("playerNeverOnServer", args[0]));
|
||||
|
@@ -21,7 +21,7 @@ public class Commandmsg extends EssentialsCommand
|
||||
@Override
|
||||
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 2 || args[0].trim().length() < 3 || args[1].trim().isEmpty())
|
||||
if (args.length < 2 || args[0].trim().length() < 2 || args[1].trim().isEmpty())
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
@@ -22,7 +22,8 @@ public class Commandpay extends EssentialsCommand
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
if (args[0].trim().length() < 3)
|
||||
//TODO: TL this
|
||||
if (args[0].trim().length() < 2)
|
||||
{
|
||||
throw new NotEnoughArgumentsException("You need to specify a player to pay.");
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ import com.earth2me.essentials.Util;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
// This command can be used to echo messages to the users screen, mostly useless but also an #EasterEgg
|
||||
public class Commandping extends EssentialsCommand
|
||||
{
|
||||
public Commandping()
|
||||
|
@@ -24,6 +24,7 @@ public class Commandrealname extends EssentialsCommand
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
final String whois = args[0].toLowerCase(Locale.ENGLISH);
|
||||
boolean foundUser = false;
|
||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||
{
|
||||
final User u = ess.getUser(onlinePlayer);
|
||||
@@ -33,13 +34,15 @@ public class Commandrealname extends EssentialsCommand
|
||||
}
|
||||
u.setDisplayNick();
|
||||
final String displayName = Util.stripFormat(u.getDisplayName()).toLowerCase(Locale.ENGLISH);
|
||||
if (!whois.equals(displayName)
|
||||
&& !displayName.equals(Util.stripFormat(ess.getSettings().getNicknamePrefix()) + whois)
|
||||
&& !whois.equalsIgnoreCase(u.getName()))
|
||||
if (displayName.contains(whois))
|
||||
{
|
||||
continue;
|
||||
foundUser = true;
|
||||
sender.sendMessage(u.getDisplayName() + " " + _("is") + " " + u.getName());
|
||||
}
|
||||
sender.sendMessage(u.getDisplayName() + " " + _("is") + " " + u.getName());
|
||||
}
|
||||
if (!foundUser)
|
||||
{
|
||||
throw new NoSuchFieldException(_("playerNotFound"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ public class Commandrepair extends EssentialsCommand
|
||||
if (args[0].equalsIgnoreCase("hand"))
|
||||
{
|
||||
final ItemStack item = user.getItemInHand();
|
||||
if (item == null)
|
||||
if (item == null || item.getType().isBlock() || item.getDurability() == 0)
|
||||
{
|
||||
throw new Exception(_("repairInvalidType"));
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public class Commandrepair extends EssentialsCommand
|
||||
}
|
||||
|
||||
final String itemName = item.getType().toString().toLowerCase(Locale.ENGLISH);
|
||||
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess);
|
||||
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), new Trade("repair-" + item.getTypeId(), new Trade("repair-item", ess), ess), ess);
|
||||
|
||||
charge.isAffordableFor(user);
|
||||
|
||||
@@ -100,12 +100,12 @@ public class Commandrepair extends EssentialsCommand
|
||||
{
|
||||
for (ItemStack item : items)
|
||||
{
|
||||
if (item == null)
|
||||
if (item == null || item.getType().isBlock() || item.getDurability() == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
final String itemName = item.getType().toString().toLowerCase(Locale.ENGLISH);
|
||||
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), "repair-item", ess);
|
||||
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), new Trade("repair-" + item.getTypeId(), new Trade("repair-item", ess), ess), ess);
|
||||
try
|
||||
{
|
||||
charge.isAffordableFor(user);
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
import org.bukkit.Material;
|
||||
|
@@ -2,7 +2,9 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
|
||||
|
||||
@@ -16,6 +18,10 @@ public class Commandsethome extends EssentialsCommand
|
||||
@Override
|
||||
public void run(final Server server, final User user, final String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
User usersHome = user;
|
||||
String name = "home";
|
||||
final Location location = user.getLocation();
|
||||
|
||||
if (args.length > 0)
|
||||
{
|
||||
//Allowing both formats /sethome khobbits house | /sethome khobbits:house
|
||||
@@ -27,59 +33,52 @@ public class Commandsethome extends EssentialsCommand
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
if (user.isAuthorized("essentials.sethome.multiple"))
|
||||
{
|
||||
if ("bed".equals(args[0].toLowerCase(Locale.ENGLISH)))
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
if ((user.isAuthorized("essentials.sethome.multiple.unlimited")) || (user.getHomes().size() < ess.getSettings().getHomeLimit(user))
|
||||
|| (user.getHomes().contains(args[0].toLowerCase(Locale.ENGLISH))))
|
||||
{
|
||||
user.setHome(args[0].toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("maxHomes", ess.getSettings().getHomeLimit(user)));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("maxHomes", 1));
|
||||
}
|
||||
name = args[0].toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (user.isAuthorized("essentials.sethome.others"))
|
||||
{
|
||||
User usersHome = ess.getUser(ess.getServer().getPlayer(args[0]));
|
||||
usersHome = ess.getUser(args[0]);
|
||||
if (usersHome == null)
|
||||
{
|
||||
usersHome = ess.getOfflineUser(args[0]);
|
||||
throw new NoSuchFieldException(_("playerNotFound"));
|
||||
}
|
||||
if (usersHome == null)
|
||||
{
|
||||
throw new Exception(_("playerNotFound"));
|
||||
}
|
||||
String name = args[1].toLowerCase(Locale.ENGLISH);
|
||||
if (!user.isAuthorized("essentials.sethome.multiple"))
|
||||
{
|
||||
name = "home";
|
||||
}
|
||||
if ("bed".equals(name.toLowerCase(Locale.ENGLISH)))
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
usersHome.setHome(name, user.getLocation());
|
||||
name = args[1].toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (checkHomeLimit(user, usersHome, name))
|
||||
{
|
||||
user.setHome();
|
||||
name = "home";
|
||||
}
|
||||
if ("bed".equals(name) || Util.isInt(name))
|
||||
{
|
||||
throw new NoSuchFieldException(_("invalidHomeName"));
|
||||
}
|
||||
usersHome.setHome(name, location);
|
||||
user.sendMessage(_("homeSet", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ()));
|
||||
|
||||
}
|
||||
|
||||
private boolean checkHomeLimit(final User user, final User usersHome, String name) throws Exception
|
||||
{
|
||||
if (!user.isAuthorized("essentials.sethome.multiple.unlimited"))
|
||||
{
|
||||
int limit = ess.getSettings().getHomeLimit(user);
|
||||
if (usersHome.getHomes().size() == limit && usersHome.getHomes().contains(name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (usersHome.getHomes().size() >= limit)
|
||||
{
|
||||
throw new Exception(_("maxHomes", ess.getSettings().getHomeLimit(user)));
|
||||
}
|
||||
if (limit == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -22,9 +22,10 @@ public class Commandsetwarp extends EssentialsCommand
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
if (args[0].matches("[0-9]+")) {
|
||||
throw new NotEnoughArgumentsException();
|
||||
|
||||
if (Util.isInt(args[0]))
|
||||
{
|
||||
throw new NoSuchFieldException(_("invalidWarpName"));
|
||||
}
|
||||
|
||||
final Location loc = user.getLocation();
|
||||
@@ -39,7 +40,7 @@ public class Commandsetwarp extends EssentialsCommand
|
||||
{
|
||||
}
|
||||
|
||||
if (warpLoc == null || user.isAuthorized("essentials.warp.overwrite." + Util.sanitizeFileName(args[0])))
|
||||
if (warpLoc == null || user.isAuthorized("essentials.warp.overwrite." + Util.safeString(args[0])))
|
||||
{
|
||||
warps.setWarp(args[0], loc);
|
||||
}
|
||||
|
@@ -1,13 +1,15 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.*;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Mob;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.block.CreatureSpawner;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
|
||||
public class Commandspawner extends EssentialsCommand
|
||||
|
@@ -5,13 +5,16 @@ import com.earth2me.essentials.Mob;
|
||||
import com.earth2me.essentials.Mob.MobException;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import java.util.*;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.entity.Villager.Profession;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.material.Colorable;
|
||||
|
||||
|
||||
|
@@ -0,0 +1,153 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class Commandspeed extends EssentialsCommand
|
||||
{
|
||||
public Commandspeed()
|
||||
{
|
||||
super("speed");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
final boolean isFly = isFlyMode(args[0]);
|
||||
final float speed = getMoveSpeed(args[1]);
|
||||
speedOtherPlayers(server, sender, isFly, true, speed, args[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
boolean isFly;
|
||||
float speed;
|
||||
boolean isBypass = user.isAuthorized("essentials.speed.bypass");
|
||||
if (args.length == 1)
|
||||
{
|
||||
//isFly = user.isFlying();
|
||||
isFly = true;
|
||||
speed = getMoveSpeed(args[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
//isFly = isFlyMode(args[0]);
|
||||
//speed = getMoveSpeed(args[1]);
|
||||
//if (args.length > 2 && user.isAuthorized("essentials.speed.others"))
|
||||
//{
|
||||
// speedOtherPlayers(server, user, isFly, isBypass, speed, args[2]);
|
||||
// return;
|
||||
//}
|
||||
isFly = true;
|
||||
speed = getMoveSpeed(args[0]);
|
||||
if (user.isAuthorized("essentials.speed.others"))
|
||||
{
|
||||
speedOtherPlayers(server, user, isFly, isBypass, speed, args[1]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//if (isFly)
|
||||
//{
|
||||
user.setFlySpeed(getRealMoveSpeed(speed, isFly, isBypass));
|
||||
user.sendMessage(_("moveSpeed", _("flying"), speed, user.getDisplayName()));
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// user.setWalkSpeed(getRealMoveSpeed(speed, isFly, isBypass));
|
||||
// user.sendMessage(_("moveSpeed", _("walking"), speed, user.getDisplayName()));
|
||||
//}
|
||||
}
|
||||
|
||||
private void speedOtherPlayers(final Server server, final CommandSender sender, final boolean isFly, final boolean isBypass, final float speed, final String target)
|
||||
{
|
||||
for (Player matchPlayer : server.matchPlayer(target))
|
||||
{
|
||||
if (isFly)
|
||||
{
|
||||
matchPlayer.setFlySpeed(getRealMoveSpeed(speed, isFly, isBypass));
|
||||
sender.sendMessage(_("moveSpeed", _("flying"), speed, matchPlayer.getDisplayName()));
|
||||
}
|
||||
else
|
||||
{
|
||||
matchPlayer.setWalkSpeed(getRealMoveSpeed(speed, isFly, isBypass));
|
||||
sender.sendMessage(_("moveSpeed", _("walking"), speed, matchPlayer.getDisplayName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isFlyMode(final String modeString) throws NotEnoughArgumentsException
|
||||
{
|
||||
boolean isFlyMode;
|
||||
if (modeString.contains("fly") || modeString.equalsIgnoreCase("f"))
|
||||
{
|
||||
isFlyMode = true;
|
||||
}
|
||||
else if (modeString.contains("walk") || modeString.contains("run")
|
||||
|| modeString.equalsIgnoreCase("w") || modeString.equalsIgnoreCase("r"))
|
||||
{
|
||||
isFlyMode = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
return isFlyMode;
|
||||
}
|
||||
|
||||
private float getMoveSpeed(final String moveSpeed) throws NotEnoughArgumentsException
|
||||
{
|
||||
float userSpeed;
|
||||
try
|
||||
{
|
||||
userSpeed = Float.parseFloat(moveSpeed);
|
||||
if (userSpeed > 10f)
|
||||
{
|
||||
userSpeed = 10f;
|
||||
}
|
||||
else if (userSpeed < 0f)
|
||||
{
|
||||
userSpeed = 0f;
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
return userSpeed;
|
||||
}
|
||||
|
||||
private float getRealMoveSpeed(final float userSpeed, final boolean isFly, final boolean isBypass)
|
||||
{
|
||||
final float defaultSpeed = isFly ? 0.1f : 0.2f;
|
||||
float maxSpeed = 1f;
|
||||
if (!isBypass)
|
||||
{
|
||||
maxSpeed = (float)(isFly ? ess.getSettings().getMaxFlySpeed() : ess.getSettings().getMaxWalkSpeed());
|
||||
}
|
||||
|
||||
if (userSpeed < 1f)
|
||||
{
|
||||
return defaultSpeed * userSpeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
float ratio = ((userSpeed - 1) / 9) * (maxSpeed - defaultSpeed);
|
||||
return ratio + defaultSpeed;
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,10 +2,12 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class Commandsudo extends EssentialsCommand
|
||||
@@ -14,6 +16,7 @@ public class Commandsudo extends EssentialsCommand
|
||||
{
|
||||
super("sudo");
|
||||
}
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
|
||||
@Override
|
||||
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
@@ -24,6 +27,15 @@ public class Commandsudo extends EssentialsCommand
|
||||
}
|
||||
|
||||
final User user = getPlayer(server, args, 0, false);
|
||||
if(args[1].toLowerCase().startsWith("c:"))
|
||||
{
|
||||
if (user.isAuthorized("essentials.sudo.exempt") && sender instanceof Player)
|
||||
{
|
||||
throw new Exception(_("sudoExempt"));
|
||||
}
|
||||
user.chat(getFinalArg(args, 1).substring(2));
|
||||
return;
|
||||
}
|
||||
final String command = args[1];
|
||||
final String[] arguments = new String[args.length - 2];
|
||||
if (arguments.length > 0)
|
||||
@@ -31,7 +43,7 @@ public class Commandsudo extends EssentialsCommand
|
||||
System.arraycopy(args, 2, arguments, 0, args.length - 2);
|
||||
}
|
||||
|
||||
if (user.isAuthorized("essentials.sudo.exempt"))
|
||||
if (user.isAuthorized("essentials.sudo.exempt") && sender instanceof Player)
|
||||
{
|
||||
throw new Exception(_("sudoExempt"));
|
||||
}
|
||||
@@ -41,8 +53,19 @@ public class Commandsudo extends EssentialsCommand
|
||||
final PluginCommand execCommand = ess.getServer().getPluginCommand(command);
|
||||
if (execCommand != null)
|
||||
{
|
||||
execCommand.execute(user.getBase(), command, arguments);
|
||||
ess.scheduleSyncDelayedTask(
|
||||
new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
LOGGER.log(Level.INFO, String.format("[Sudo] %s issued server command: /%s %s", user.getName(), command, getFinalArg(arguments, 0)));
|
||||
execCommand.execute(user.getBase(), command, arguments);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(_("errorCallingCommand", command));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -20,10 +20,16 @@ public class Commandtime extends EssentialsCommand
|
||||
@Override
|
||||
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
boolean add = false;
|
||||
final List<String> argList = new ArrayList<String>(Arrays.asList(args));
|
||||
if ((argList.remove("set") || argList.remove("add")) && Util.isInt(argList.get(0)))
|
||||
if (argList.remove("set") && !argList.isEmpty() && Util.isInt(argList.get(0)))
|
||||
{
|
||||
ess.getLogger().info("debug edited 0" + argList.get(0).toString());
|
||||
argList.set(0, argList.get(0) + "t");
|
||||
}
|
||||
if (argList.remove("add") && !argList.isEmpty() && Util.isInt(argList.get(0)))
|
||||
{
|
||||
add = true;
|
||||
argList.set(0, argList.get(0) + "t");
|
||||
}
|
||||
final String[] validArgs = argList.toArray(new String[0]);
|
||||
|
||||
@@ -34,12 +40,27 @@ public class Commandtime extends EssentialsCommand
|
||||
worldSelector = validArgs[1];
|
||||
}
|
||||
final Set<World> worlds = getWorlds(server, sender, worldSelector);
|
||||
final String setTime;
|
||||
|
||||
// If no arguments we are reading the time
|
||||
if (validArgs.length == 0)
|
||||
{
|
||||
getWorldsTime(sender, worlds);
|
||||
return;
|
||||
if (commandLabel.equalsIgnoreCase("day") || commandLabel.equalsIgnoreCase("eday"))
|
||||
{
|
||||
setTime = "day";
|
||||
}
|
||||
else if (commandLabel.equalsIgnoreCase("night") || commandLabel.equalsIgnoreCase("enight"))
|
||||
{
|
||||
setTime = "night";
|
||||
}
|
||||
else
|
||||
{
|
||||
getWorldsTime(sender, worlds);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
setTime = validArgs[0];
|
||||
}
|
||||
|
||||
final User user = ess.getUser(sender);
|
||||
@@ -53,14 +74,14 @@ public class Commandtime extends EssentialsCommand
|
||||
long ticks;
|
||||
try
|
||||
{
|
||||
ticks = DescParseTickFormat.parse(validArgs[0]);
|
||||
ticks = DescParseTickFormat.parse(setTime);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
throw new NotEnoughArgumentsException(e);
|
||||
}
|
||||
|
||||
setWorldsTime(sender, worlds, ticks);
|
||||
setWorldsTime(sender, worlds, ticks, add);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,14 +105,17 @@ public class Commandtime extends EssentialsCommand
|
||||
/**
|
||||
* Used to set the time and inform of the change
|
||||
*/
|
||||
private void setWorldsTime(final CommandSender sender, final Collection<World> worlds, final long ticks)
|
||||
private void setWorldsTime(final CommandSender sender, final Collection<World> worlds, final long ticks, final boolean add)
|
||||
{
|
||||
// Update the time
|
||||
for (World world : worlds)
|
||||
{
|
||||
long time = world.getTime();
|
||||
time -= time % 24000;
|
||||
world.setTime(time + 24000 + ticks);
|
||||
if (!add)
|
||||
{
|
||||
time -= time % 24000;
|
||||
}
|
||||
world.setTime(time + (add ? 0 : 24000) + ticks);
|
||||
}
|
||||
|
||||
final StringBuilder output = new StringBuilder();
|
||||
@@ -159,4 +183,4 @@ class WorldNameComparator implements Comparator<World>
|
||||
{
|
||||
return a.getName().compareTo(b.getName());
|
||||
}
|
||||
}
|
||||
}
|
@@ -20,8 +20,8 @@ public class Commandtop extends EssentialsCommand
|
||||
{
|
||||
final int topX = user.getLocation().getBlockX();
|
||||
final int topZ = user.getLocation().getBlockZ();
|
||||
final int topY = user.getWorld().getHighestBlockYAt(topX, topZ);
|
||||
user.getTeleport().teleport(new Location(user.getWorld(), user.getLocation().getX(), topY + 1, user.getLocation().getZ()), new Trade(this.getName(), ess), TeleportCause.COMMAND);
|
||||
final Location location = new Location(user.getWorld(), topX, user.getWorld().getMaxHeight(), topZ);
|
||||
user.getTeleport().teleport(location, new Trade(this.getName(), ess), TeleportCause.COMMAND);
|
||||
user.sendMessage(_("teleportTop"));
|
||||
}
|
||||
}
|
||||
|
@@ -31,9 +31,9 @@ public class Commandtp extends EssentialsCommand
|
||||
throw new Exception(_("teleportDisabled", player.getDisplayName()));
|
||||
}
|
||||
if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
|
||||
&& !user.isAuthorized("essentials.world." + player.getWorld().getName()))
|
||||
&& !user.isAuthorized("essentials.worlds." + player.getWorld().getName()))
|
||||
{
|
||||
throw new Exception(_("noPerm", "essentials.world." + player.getWorld().getName()));
|
||||
throw new Exception(_("noPerm", "essentials.worlds." + player.getWorld().getName()));
|
||||
}
|
||||
user.sendMessage(_("teleporting"));
|
||||
final Trade charge = new Trade(this.getName(), ess);
|
||||
@@ -58,9 +58,9 @@ public class Commandtp extends EssentialsCommand
|
||||
throw new Exception(_("teleportDisabled", toPlayer.getDisplayName()));
|
||||
}
|
||||
if (target.getWorld() != toPlayer.getWorld() && ess.getSettings().isWorldTeleportPermissions()
|
||||
&& !user.isAuthorized("essentials.world." + toPlayer.getWorld().getName()))
|
||||
&& !user.isAuthorized("essentials.worlds." + toPlayer.getWorld().getName()))
|
||||
{
|
||||
throw new Exception(_("noPerm", "essentials.world." + toPlayer.getWorld().getName()));
|
||||
throw new Exception(_("noPerm", "essentials.worlds." + toPlayer.getWorld().getName()));
|
||||
}
|
||||
target.getTeleport().now(toPlayer, false, TeleportCause.COMMAND);
|
||||
target.sendMessage(_("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName()));
|
||||
|
@@ -26,9 +26,9 @@ public class Commandtpa extends EssentialsCommand
|
||||
throw new Exception(_("teleportDisabled", player.getDisplayName()));
|
||||
}
|
||||
if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
|
||||
&& !user.isAuthorized("essentials.world." + player.getWorld().getName()))
|
||||
&& !user.isAuthorized("essentials.worlds." + player.getWorld().getName()))
|
||||
{
|
||||
throw new Exception(_("noPerm", "essentials.world." + player.getWorld().getName()));
|
||||
throw new Exception(_("noPerm", "essentials.worlds." + player.getWorld().getName()));
|
||||
}
|
||||
if (!player.isIgnoredPlayer(user))
|
||||
{
|
||||
|
@@ -46,7 +46,7 @@ public class Commandtpaall extends EssentialsCommand
|
||||
continue;
|
||||
}
|
||||
if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
|
||||
&& !user.isAuthorized("essentials.world." + user.getWorld().getName()))
|
||||
&& !user.isAuthorized("essentials.worlds." + user.getWorld().getName()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@@ -27,14 +27,14 @@ public class Commandtpaccept extends EssentialsCommand
|
||||
|
||||
if (user.isTpRequestHere() && ((!target.isAuthorized("essentials.tpahere") && !target.isAuthorized("essentials.tpaall"))
|
||||
|| (user.getWorld() != target.getWorld() && ess.getSettings().isWorldTeleportPermissions()
|
||||
&& !user.isAuthorized("essentials.world." + user.getWorld().getName()))))
|
||||
&& !user.isAuthorized("essentials.worlds." + user.getWorld().getName()))))
|
||||
{
|
||||
throw new Exception(_("noPendingRequest"));
|
||||
}
|
||||
|
||||
if (!user.isTpRequestHere() && (!target.isAuthorized("essentials.tpa")
|
||||
|| (user.getWorld() != target.getWorld() && ess.getSettings().isWorldTeleportPermissions()
|
||||
&& !user.isAuthorized("essentials.world." + target.getWorld().getName()))))
|
||||
&& !user.isAuthorized("essentials.worlds." + target.getWorld().getName()))))
|
||||
{
|
||||
throw new Exception(_("noPendingRequest"));
|
||||
}
|
||||
@@ -65,12 +65,13 @@ public class Commandtpaccept extends EssentialsCommand
|
||||
|
||||
if (user.isTpRequestHere())
|
||||
{
|
||||
user.getTeleport().teleport(target, charge, TeleportCause.COMMAND);
|
||||
target.getTeleport().teleportToMe(user, charge, TeleportCause.COMMAND);
|
||||
}
|
||||
else
|
||||
{
|
||||
target.getTeleport().teleport(user, charge, TeleportCause.COMMAND);
|
||||
}
|
||||
user.requestTeleport(null, false);
|
||||
throw new NoChargeException();
|
||||
}
|
||||
}
|
||||
|
@@ -26,9 +26,9 @@ public class Commandtpahere extends EssentialsCommand
|
||||
throw new Exception(_("teleportDisabled", player.getDisplayName()));
|
||||
}
|
||||
if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
|
||||
&& !user.isAuthorized("essentials.world." + user.getWorld().getName()))
|
||||
&& !user.isAuthorized("essentials.worlds." + user.getWorld().getName()))
|
||||
{
|
||||
throw new Exception(_("noPerm", "essentials.world." + user.getWorld().getName()));
|
||||
throw new Exception(_("noPerm", "essentials.worlds." + user.getWorld().getName()));
|
||||
}
|
||||
player.requestTeleport(user, true);
|
||||
player.sendMessage(_("teleportHereRequest", user.getDisplayName()));
|
||||
|
@@ -43,7 +43,7 @@ public class Commandtpall extends EssentialsCommand
|
||||
continue;
|
||||
}
|
||||
if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
|
||||
&& !user.isAuthorized("essentials.world." + user.getWorld().getName()))
|
||||
&& !user.isAuthorized("essentials.worlds." + user.getWorld().getName()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@@ -23,11 +23,11 @@ public class Commandtphere extends EssentialsCommand
|
||||
throw new Exception(_("teleportDisabled", player.getDisplayName()));
|
||||
}
|
||||
if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
|
||||
&& !user.isAuthorized("essentials.world." + user.getWorld().getName()))
|
||||
&& !user.isAuthorized("essentials.worlds." + user.getWorld().getName()))
|
||||
{
|
||||
throw new Exception(_("noPerm", "essentials.world." + user.getWorld().getName()));
|
||||
throw new Exception(_("noPerm", "essentials.worlds." + user.getWorld().getName()));
|
||||
}
|
||||
player.getTeleport().teleport(user, new Trade(this.getName(), ess), TeleportCause.COMMAND);
|
||||
user.getTeleport().teleportToMe(player, new Trade(this.getName(), ess), TeleportCause.COMMAND);
|
||||
user.sendMessage(_("teleporting"));
|
||||
player.sendMessage(_("teleporting"));
|
||||
throw new NoChargeException();
|
||||
|
@@ -28,9 +28,9 @@ public class Commandtpo extends EssentialsCommand
|
||||
throw new NoSuchFieldException(_("playerNotFound"));
|
||||
}
|
||||
if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
|
||||
&& !user.isAuthorized("essentials.world." + player.getWorld().getName()))
|
||||
&& !user.isAuthorized("essentials.worlds." + player.getWorld().getName()))
|
||||
{
|
||||
throw new Exception(_("noPerm", "essentials.world." + player.getWorld().getName()));
|
||||
throw new Exception(_("noPerm", "essentials.worlds." + player.getWorld().getName()));
|
||||
}
|
||||
user.sendMessage(_("teleporting"));
|
||||
user.getTeleport().now(player, false, TeleportCause.COMMAND);
|
||||
@@ -52,9 +52,9 @@ public class Commandtpo extends EssentialsCommand
|
||||
}
|
||||
|
||||
if (target.getWorld() != toPlayer.getWorld() && ess.getSettings().isWorldTeleportPermissions()
|
||||
&& !user.isAuthorized("essentials.world." + toPlayer.getWorld().getName()))
|
||||
&& !user.isAuthorized("essentials.worlds." + toPlayer.getWorld().getName()))
|
||||
{
|
||||
throw new Exception(_("noPerm", "essentials.world." + toPlayer.getWorld().getName()));
|
||||
throw new Exception(_("noPerm", "essentials.worlds." + toPlayer.getWorld().getName()));
|
||||
}
|
||||
|
||||
target.getTeleport().now(toPlayer, false, TeleportCause.COMMAND);
|
||||
|
@@ -31,9 +31,9 @@ public class Commandtpohere extends EssentialsCommand
|
||||
}
|
||||
|
||||
if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
|
||||
&& !user.isAuthorized("essentials.world." + user.getWorld().getName()))
|
||||
&& !user.isAuthorized("essentials.worlds." + user.getWorld().getName()))
|
||||
{
|
||||
throw new Exception(_("noPerm", "essentials.world." + user.getWorld().getName()));
|
||||
throw new Exception(_("noPerm", "essentials.worlds." + user.getWorld().getName()));
|
||||
}
|
||||
|
||||
// Verify permission
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Material;
|
||||
|
@@ -37,8 +37,9 @@ public class Commandwarp extends EssentialsCommand
|
||||
}
|
||||
if (args.length > 0)
|
||||
{
|
||||
//TODO: Remove 'otherplayers' permission.
|
||||
User otherUser = null;
|
||||
if (args.length == 2 && user.isAuthorized("essentials.warp.otherplayers"))
|
||||
if (args.length == 2 && (user.isAuthorized("essentials.warp.otherplayers") || user.isAuthorized("essentials.warp.others")))
|
||||
{
|
||||
otherUser = ess.getUser(server.getPlayer(args[1]));
|
||||
if (otherUser == null)
|
||||
@@ -56,7 +57,7 @@ public class Commandwarp extends EssentialsCommand
|
||||
@Override
|
||||
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 2 || args[0].matches("[0-9]+"))
|
||||
if (args.length < 2 || Util.isInt(args[0]))
|
||||
{
|
||||
warpList(sender, args);
|
||||
throw new NoChargeException();
|
||||
@@ -87,14 +88,14 @@ public class Commandwarp extends EssentialsCommand
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
final String warpName = iterator.next();
|
||||
if (ess.getSettings().getPerWarpPermission() && !((User)sender).isAuthorized("essentials.warp." + warpName))
|
||||
if (ess.getSettings().getPerWarpPermission() && !((User)sender).isAuthorized("essentials.warps." + warpName))
|
||||
{
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
int page = 1;
|
||||
if (args.length > 0)
|
||||
if (args.length > 0 && Util.isInt(args[0]))
|
||||
{
|
||||
page = Integer.parseInt(args[0]);
|
||||
}
|
||||
@@ -105,7 +106,7 @@ public class Commandwarp extends EssentialsCommand
|
||||
if (warpNameList.size() > WARPS_PER_PAGE)
|
||||
{
|
||||
sender.sendMessage(_("warpsCount", warpNameList.size(), page, (int)Math.ceil(warpNameList.size() / (double)WARPS_PER_PAGE)));
|
||||
sender.sendMessage(warpList);
|
||||
sender.sendMessage(_("warpList", warpList));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -120,7 +121,7 @@ public class Commandwarp extends EssentialsCommand
|
||||
final double fullCharge = chargeWarp.getCommandCost(user) + chargeCmd.getCommandCost(user);
|
||||
final Trade charge = new Trade(fullCharge, ess);
|
||||
charge.isAffordableFor(owner);
|
||||
if (ess.getSettings().getPerWarpPermission() && !owner.isAuthorized("essentials.warp." + name))
|
||||
if (ess.getSettings().getPerWarpPermission() && !owner.isAuthorized("essentials.warps." + name))
|
||||
{
|
||||
throw new Exception(_("warpUsePermission"));
|
||||
}
|
||||
|
@@ -18,12 +18,27 @@ public class Commandweather extends EssentialsCommand
|
||||
@Override
|
||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
final boolean isStorm;
|
||||
if (args.length < 1)
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
if (commandLabel.equalsIgnoreCase("sun") || commandLabel.equalsIgnoreCase("esun"))
|
||||
{
|
||||
isStorm = false;
|
||||
}
|
||||
else if (commandLabel.equalsIgnoreCase("storm") || commandLabel.equalsIgnoreCase("estorm")
|
||||
|| commandLabel.equalsIgnoreCase("rain") || commandLabel.equalsIgnoreCase("erain"))
|
||||
{
|
||||
isStorm = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
isStorm = args[0].equalsIgnoreCase("storm");
|
||||
}
|
||||
|
||||
final boolean isStorm = args[0].equalsIgnoreCase("storm");
|
||||
final World world = user.getWorld();
|
||||
if (args.length > 1)
|
||||
{
|
||||
|
@@ -0,0 +1,20 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.Server;
|
||||
|
||||
|
||||
public class Commandworkbench extends EssentialsCommand
|
||||
{
|
||||
public Commandworkbench()
|
||||
{
|
||||
super("workbench");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
user.openWorkbench(null, true);
|
||||
}
|
||||
}
|
@@ -54,9 +54,9 @@ public class Commandworld extends EssentialsCommand
|
||||
}
|
||||
}
|
||||
|
||||
if (ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.world." + world.getName()))
|
||||
if (ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.worlds." + world.getName()))
|
||||
{
|
||||
throw new Exception(_("noPerm", "essentials.world." + world.getName()));
|
||||
throw new Exception(_("noPerm", "essentials.worlds." + world.getName()));
|
||||
}
|
||||
|
||||
double factor;
|
||||
|
@@ -56,14 +56,14 @@ public abstract class EssentialsCommand implements IEssentialsCommand
|
||||
}
|
||||
if (args[pos].isEmpty())
|
||||
{
|
||||
throw new NoSuchFieldException(_("playerNotFound"));
|
||||
throw new PlayerNotFoundException();
|
||||
}
|
||||
final User user = ess.getUser(args[pos]);
|
||||
if (user != null)
|
||||
{
|
||||
if (!getOffline && (!user.isOnline() || user.isHidden()))
|
||||
{
|
||||
throw new NoSuchFieldException(_("playerNotFound"));
|
||||
throw new PlayerNotFoundException();
|
||||
}
|
||||
return user;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public abstract class EssentialsCommand implements IEssentialsCommand
|
||||
return userMatch;
|
||||
}
|
||||
}
|
||||
throw new NoSuchFieldException(_("playerNotFound"));
|
||||
throw new PlayerNotFoundException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -0,0 +1,11 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
|
||||
public class PlayerNotFoundException extends NoSuchFieldException
|
||||
{
|
||||
public PlayerNotFoundException()
|
||||
{
|
||||
super(_("playerNotFound"));
|
||||
}
|
||||
}
|
@@ -669,4 +669,34 @@ public class FakeWorld implements World
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity spawnEntity(Location lctn, EntityType et)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChunkInUse(int x, int z)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public FallingBlock spawnFallingBlock(Location location, Material material, byte data) throws IllegalArgumentException
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public FallingBlock spawnFallingBlock(Location location, int blockId, byte blockData) throws IllegalArgumentException
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(Location arg0, Sound arg1, float arg2, float arg3)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
|
@@ -16,13 +16,13 @@ public class SetExpFix
|
||||
player.setExp(0);
|
||||
player.setLevel(0);
|
||||
player.setTotalExperience(0);
|
||||
|
||||
|
||||
//This following code is technically redundant now, as bukkit now calulcates levels more or less correctly
|
||||
//At larger numbers however... player.getExp(3000), only seems to give 2999, putting the below calculations off.
|
||||
int amount = exp;
|
||||
while (amount > 0)
|
||||
{
|
||||
final int expToLevel = getExpToLevel(player);
|
||||
final int expToLevel = getExpAtLevel(player);
|
||||
amount -= expToLevel;
|
||||
if (amount >= 0)
|
||||
{
|
||||
@@ -39,27 +39,56 @@ public class SetExpFix
|
||||
}
|
||||
}
|
||||
|
||||
private static int getExpToLevel(final Player player)
|
||||
{
|
||||
return getExpToLevel(player.getLevel());
|
||||
private static int getExpAtLevel(final Player player)
|
||||
{
|
||||
return getExpAtLevel(player.getLevel());
|
||||
}
|
||||
|
||||
public static int getExpAtLevel(final int level)
|
||||
{
|
||||
if (level > 29)
|
||||
{
|
||||
return 62 + (level - 30) * 7;
|
||||
}
|
||||
if (level > 15)
|
||||
{
|
||||
return 17 + (level - 15) * 3;
|
||||
}
|
||||
return 17;
|
||||
}
|
||||
|
||||
private static int getExpToLevel(final int level)
|
||||
{
|
||||
return 7 + (level * 7 >> 1);
|
||||
public static int getExpToLevel(final int level)
|
||||
{
|
||||
int currentLevel = 0;
|
||||
int exp = 0;
|
||||
|
||||
while (currentLevel < level)
|
||||
{
|
||||
exp += getExpAtLevel(currentLevel);
|
||||
currentLevel++;
|
||||
}
|
||||
return exp;
|
||||
}
|
||||
|
||||
|
||||
//This method is required because the bukkit player.getTotalExperience() method, shows exp that has been 'spent'.
|
||||
//Without this people would be able to use exp and then still sell it.
|
||||
public static int getTotalExperience(final Player player)
|
||||
{
|
||||
int exp = (int)Math.round(getExpToLevel(player) * player.getExp());
|
||||
int exp = (int)Math.round(getExpAtLevel(player) * player.getExp());
|
||||
int currentLevel = player.getLevel();
|
||||
|
||||
while (currentLevel > 0) {
|
||||
|
||||
while (currentLevel > 0)
|
||||
{
|
||||
currentLevel--;
|
||||
exp += getExpToLevel(currentLevel);
|
||||
exp += getExpAtLevel(currentLevel);
|
||||
}
|
||||
return exp;
|
||||
}
|
||||
|
||||
public static int getExpUntilNextLevel(final Player player)
|
||||
{
|
||||
int exp = (int)Math.round(getExpAtLevel(player) * player.getExp());
|
||||
int nextLevel = player.getLevel();
|
||||
return getExpAtLevel(nextLevel) - exp;
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user