mirror of
https://github.com/essentials/Essentials.git
synced 2025-09-08 21:50:45 +02:00
Compare commits
269 Commits
stable-2.1
...
gm-final
Author | SHA1 | Date | |
---|---|---|---|
|
02c6780476 | ||
|
2526f559ff | ||
|
9818df3039 | ||
|
c843a329bd | ||
|
4fb96aa586 | ||
|
a11daafb0d | ||
|
c6dfa741c1 | ||
|
e36f26e185 | ||
|
4b20b6a93a | ||
|
cdd5df0c0a | ||
|
d3be04c81a | ||
|
e6049b0818 | ||
|
2e04dbf7be | ||
|
bd210309b2 | ||
|
d7c9a8742d | ||
|
7b63aab562 | ||
|
2c9feadf1d | ||
|
bd72eee559 | ||
|
d32c692b66 | ||
|
4097ef4939 | ||
|
3137c9ae10 | ||
|
194de920cf | ||
|
9a55d32b75 | ||
|
d86d72eeb7 | ||
|
f336e54b67 | ||
|
2e0a1dde85 | ||
|
e862e3c87b | ||
|
d9fdf3bdf6 | ||
|
34a323125f | ||
|
f03e41536b | ||
|
9c3d965371 | ||
|
578aec35eb | ||
|
a8ad83fb0b | ||
|
6779c9f0d3 | ||
|
86b57804c6 | ||
|
211dc220d8 | ||
|
aae586f79a | ||
|
32f49350cf | ||
|
9739784e75 | ||
|
a0e93af758 | ||
|
81c6291338 | ||
|
24509d60be | ||
|
f0947e9a7c | ||
|
92bb4e0e66 | ||
|
8f810ad447 | ||
|
3f35a6b59c | ||
|
427dd714c9 | ||
|
9d7a2043f7 | ||
|
ff3ec84b0d | ||
|
1f9e72c5e2 | ||
|
67be18566c | ||
|
862e71bc85 | ||
|
395655ba19 | ||
|
1bb569fff2 | ||
|
e66ad88451 | ||
|
3bf3093177 | ||
|
69faf87866 | ||
|
5eb82add06 | ||
|
8bd1a9f3bc | ||
|
e1631b2af8 | ||
|
145d24c34c | ||
|
229ff9f0e4 | ||
|
0557aa58b0 | ||
|
b40aa43872 | ||
|
a1cdfa19b0 | ||
|
d62b401db8 | ||
|
887957756e | ||
|
b6d6b24796 | ||
|
b6c0871daa | ||
|
b080187808 | ||
|
3c613fd59b | ||
|
547c6e4073 | ||
|
6098086a99 | ||
|
87f90e9bdd | ||
|
65b1821196 | ||
|
756321d280 | ||
|
3dbf69f163 | ||
|
e8ace54036 | ||
|
22e1c14e7e | ||
|
50d3486d35 | ||
|
4f2ed6fe11 | ||
|
6cc0edb89a | ||
|
cd38aeb544 | ||
|
9e9409da1e | ||
|
36e580474f | ||
|
e007331581 | ||
|
8d435ec86e | ||
|
214d64e4ad | ||
|
737fadc390 | ||
|
10de6ac929 | ||
|
fe9fbf585f | ||
|
af3f3fb4c7 | ||
|
0e6a5240db | ||
|
f272a7ecd6 | ||
|
e00ee62f75 | ||
|
22ff49a0b8 | ||
|
14c764e049 | ||
|
ec5496ad18 | ||
|
020f0b2ad6 | ||
|
8e59c47200 | ||
|
104caea3c9 | ||
|
44fbd05df7 | ||
|
6cfb5084e1 | ||
|
ae1804758a | ||
|
4b470b32c5 | ||
|
cfe89dde17 | ||
|
30dae51ddf | ||
|
0b11abf8f4 | ||
|
b673882b2f | ||
|
200dbda6d3 | ||
|
3538728733 | ||
|
5724c0c8df | ||
|
0b5718f7ff | ||
|
c6b0dfaa4c | ||
|
8fecd44786 | ||
|
2ee590d85c | ||
|
b469439f7b | ||
|
a7d6e5440b | ||
|
077074c855 | ||
|
c59a204827 | ||
|
1be30e4a0a | ||
|
28ec7c2d80 | ||
|
ee986768ce | ||
|
de485b8d48 | ||
|
e443776dc1 | ||
|
859ffeaa0b | ||
|
545d706a70 | ||
|
9ec0ca25a5 | ||
|
b0e165546e | ||
|
470f4c1b3e | ||
|
3b35763fef | ||
|
2d5c1fd51c | ||
|
088c54e386 | ||
|
e409363426 | ||
|
34599b7428 | ||
|
53c1c8a8b7 | ||
|
3f2c2aadbb | ||
|
a1a190bb02 | ||
|
6744b652e6 | ||
|
11b308cc8c | ||
|
c50f559512 | ||
|
98bee40bf7 | ||
|
970d342a60 | ||
|
2500c9af90 | ||
|
fa765d3077 | ||
|
9bc8f287a4 | ||
|
5e6ce8aecb | ||
|
6174e4a98b | ||
|
5c74af42a3 | ||
|
ce48f2f326 | ||
|
2affce875c | ||
|
52c8ebc61f | ||
|
a9249deea7 | ||
|
d99c35cc35 | ||
|
518650e842 | ||
|
20ff61909f | ||
|
f0e4e8c5ba | ||
|
63300866f9 | ||
|
c8212371ff | ||
|
0a6a79115a | ||
|
6798615507 | ||
|
016b39726c | ||
|
882ebae257 | ||
|
161862bc53 | ||
|
18b31a7e50 | ||
|
5b5be164b6 | ||
|
466b4ae7c5 | ||
|
e7c468b20d | ||
|
b9d09dd7b0 | ||
|
1c035457bb | ||
|
5070f15810 | ||
|
c8faf03f5b | ||
|
915cb51d1a | ||
|
52c3169a3c | ||
|
32b118d3c0 | ||
|
9ce1158aeb | ||
|
839bfe0c2e | ||
|
f39ef36115 | ||
|
eee18f40be | ||
|
4084445b5b | ||
|
8c882a5268 | ||
|
3440a22d6d | ||
|
3b0e86ae67 | ||
|
3fecd3138d | ||
|
d48c02021d | ||
|
0b71b6e93d | ||
|
99d25bfaea | ||
|
46691871ad | ||
|
58440dd594 | ||
|
12c96e21b9 | ||
|
1d791fb110 | ||
|
bca9bf5099 | ||
|
0384ac5d42 | ||
|
def1569fcc | ||
|
7d7e87e63a | ||
|
8b26c7fc84 | ||
|
3017d2a7f4 | ||
|
23d2ffb134 | ||
|
ad2f446602 | ||
|
bcd5350a4d | ||
|
b6b2ee61a4 | ||
|
6362dbd5b3 | ||
|
ee55584117 | ||
|
e5b522ed14 | ||
|
df219db1a4 | ||
|
f8e273767e | ||
|
1bfab68932 | ||
|
901b835ae0 | ||
|
7d8d9d8959 | ||
|
b70b58660f | ||
|
18a6d1761a | ||
|
9a197d65a3 | ||
|
b68e451c13 | ||
|
11949a4315 | ||
|
69e1583bac | ||
|
752cec8f13 | ||
|
f52858d058 | ||
|
90fc19cc7b | ||
|
ddb1f76a26 | ||
|
2584e0ab06 | ||
|
5dbf4f5a00 | ||
|
af02a28ce5 | ||
|
5e9f5904fd | ||
|
946051de71 | ||
|
427b97433e | ||
|
f3b005e331 | ||
|
5b64c31e86 | ||
|
723e458a81 | ||
|
309273dc6b | ||
|
d40e331c8a | ||
|
c57e902173 | ||
|
e864696b00 | ||
|
fed250fd74 | ||
|
5fe19dbd83 | ||
|
b836b3c041 | ||
|
9550ef2a0d | ||
|
bac26f966c | ||
|
278bb98649 | ||
|
3839b6f1f5 | ||
|
c0a58a5316 | ||
|
de7c2be960 | ||
|
c57c791e69 | ||
|
1ae2b094f3 | ||
|
dde8cd8f72 | ||
|
b3bad6a35a | ||
|
25e4096a12 | ||
|
e411f61296 | ||
|
caa3ac88aa | ||
|
f677d6a411 | ||
|
4232216f76 | ||
|
beef371ae6 | ||
|
872df26e9d | ||
|
8146858ee0 | ||
|
9b4e6e5dc6 | ||
|
a66b9a3ee4 | ||
|
ea824b26f4 | ||
|
7b0d3d49f1 | ||
|
00cc13ce1a | ||
|
132d56760b | ||
|
32b466bb3b | ||
|
0041492f42 | ||
|
27d88a6c56 | ||
|
981d620349 | ||
|
c902155d6e | ||
|
6ea835e96f | ||
|
5fdac7588e | ||
|
9e7320ad16 | ||
|
8dc79c2d37 | ||
|
4da70254ff |
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="lib/bukkit-0.0.1-SNAPSHOT.jar"/>
|
||||
<classpathentry kind="lib" path="lib/Permissions3.jar"/>
|
||||
</classpath>
|
6
.gitignore
vendored
6
.gitignore
vendored
@@ -46,4 +46,8 @@
|
||||
.idea/
|
||||
*.iml
|
||||
target/
|
||||
dependency-reduced-pom.xml
|
||||
dependency-reduced-pom.xml
|
||||
/Essentials/config.yml
|
||||
/Essentials/userdata/testplayer1.yml
|
||||
/Essentials/usermap.csv
|
||||
/Essentials/userdata
|
||||
|
17
.project
17
.project
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Essentials</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@@ -3,7 +3,7 @@ jdk:
|
||||
- oraclejdk7
|
||||
- openjdk7
|
||||
- openjdk6
|
||||
script: ant collect
|
||||
script: mvn compile test
|
||||
install: true
|
||||
notifications:
|
||||
irc:
|
||||
|
@@ -1,73 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="BuildAll" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project BuildAll.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar: JAR building
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="BuildAll-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
File diff suppressed because it is too large
Load Diff
@@ -1,8 +0,0 @@
|
||||
build.xml.data.CRC32=cab45985
|
||||
build.xml.script.CRC32=9113ff80
|
||||
build.xml.stylesheet.CRC32=8064a381@1.68.1.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=b4df970c
|
||||
nbproject/build-impl.xml.script.CRC32=8905537e
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46
|
@@ -1,129 +0,0 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
application.title=BuildAll
|
||||
application.vendor=
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=2
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=2
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=2
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=120
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineAnnotationArgs=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineArrayInit=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineAssignment=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineBinaryOp=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineCallArgs=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineDisjunctiveCatchTypes=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineFor=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineImplements=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineMethodParams=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineParenthesized=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineTernaryOp=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineThrows=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineTryResources=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesAfterClassHeader=0
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesBeforeClass=2
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement=NEW_LINE
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs=false
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width=4
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indentCasesFromSwitch=false
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement=NEW_LINE
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement=NEW_LINE
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeCatchOnNewLine=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeElseOnNewLine=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeFinallyOnNewLine=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeWhileOnNewLine=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceAfterTypeCast=false
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab=4
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size=4
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/BuildAll.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
endorsed.classpath=
|
||||
excludes=
|
||||
includes=**
|
||||
jar.compress=true
|
||||
javac.classpath=\
|
||||
${reference.Essentials.jar}:\
|
||||
${reference.EssentialsChat.jar}:\
|
||||
${reference.EssentialsAntiBuild.jar}:\
|
||||
${reference.EssentialsProtect.jar}:\
|
||||
${reference.EssentialsSpawn.jar}:\
|
||||
${reference.EssentialsGeoIP.jar}:\
|
||||
${reference.EssentialsXMPP.jar}:\
|
||||
${reference.EssentialsGroupManager.jar}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=1.6
|
||||
javac.target=1.6
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=default_platform
|
||||
project.Essentials=../Essentials
|
||||
project.EssentialsChat=../EssentialsChat
|
||||
project.EssentialsGeoIP=../EssentialsGeoIP
|
||||
project.EssentialsGroupManager=../EssentialsGroupManager
|
||||
project.EssentialsAntiBuild=../EssentialsAntiBuild
|
||||
project.EssentialsProtect=../EssentialsProtect
|
||||
project.EssentialsSpawn=../EssentialsSpawn
|
||||
project.EssentialsXMPP=../EssentialsXMPP
|
||||
reference.Essentials.jar=${project.Essentials}/dist/Essentials.jar
|
||||
reference.EssentialsChat.jar=${project.EssentialsChat}/dist/EssentialsChat.jar
|
||||
reference.EssentialsGeoIP.jar=${project.EssentialsGeoIP}/dist/EssentialsGeoIP.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
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project
|
||||
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
|
||||
# or test-sys-prop.name=value to set system properties for unit tests):
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
@@ -1,84 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>BuildAll</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
<libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
|
||||
<definitions>..\lib\nblibraries.properties</definitions>
|
||||
</libraries>
|
||||
<references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
|
||||
<reference>
|
||||
<foreign-project>Essentials</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>EssentialsChat</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>EssentialsGeoIP</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>EssentialsGroupManager</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>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>
|
||||
<script>build.xml</script>
|
||||
<target>jar</target>
|
||||
<clean-target>clean</clean-target>
|
||||
<id>jar</id>
|
||||
</reference>
|
||||
<reference>
|
||||
<foreign-project>EssentialsSpawn</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>EssentialsXMPP</foreign-project>
|
||||
<artifact-type>jar</artifact-type>
|
||||
<script>build.xml</script>
|
||||
<target>jar</target>
|
||||
<clean-target>clean</clean-target>
|
||||
<id>jar</id>
|
||||
</reference>
|
||||
</references>
|
||||
</configuration>
|
||||
</project>
|
@@ -1,84 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="Essentials" default="default" basedir=".">
|
||||
|
||||
<description>Builds, tests, and runs the project Essentials.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar-with-manifest: JAR building (if you are using a manifest)
|
||||
-do-jar-without-manifest: JAR building (if you are not using a manifest)
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="Essentials-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
<!--target name="-post-jar">
|
||||
<jar jarfile="${dist.dir}/Essentials.jar">
|
||||
<zipfileset src="${dist.jar}" excludes="META-INF/*" />
|
||||
<zipfileset src="${dist.dir}/lib/Register.jar" excludes="META-INF/*" />
|
||||
<manifest>
|
||||
<attribute name="Classpath" value="Essentials.jar"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
</target-->
|
||||
</project>
|
File diff suppressed because it is too large
Load Diff
@@ -1,11 +0,0 @@
|
||||
build.xml.data.CRC32=7d758acf
|
||||
build.xml.script.CRC32=3233ee78
|
||||
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=c52f1a28
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=5a01deb7@1.68.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,3 +0,0 @@
|
||||
DoNotUseThreads
|
||||
LongVariable
|
||||
SignatureDeclareThrowsException
|
@@ -1,150 +0,0 @@
|
||||
annotation.processing.enabled=true
|
||||
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
|
||||
application.title=Essentials
|
||||
application.vendor=
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=2
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=2
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=2
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=120
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineAnnotationArgs=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineArrayInit=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineAssignment=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineBinaryOp=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineCallArgs=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineDisjunctiveCatchTypes=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineFor=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineImplements=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineMethodParams=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineParenthesized=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineTernaryOp=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineThrows=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineTryResources=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesAfterClassHeader=0
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesBeforeClass=2
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement=NEW_LINE
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs=false
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.importGroupsOrder=*
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width=4
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indentCasesFromSwitch=false
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement=NEW_LINE
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement=NEW_LINE
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeCatchOnNewLine=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeElseOnNewLine=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeFinallyOnNewLine=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeWhileOnNewLine=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.separateImportGroups=false
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceAfterTypeCast=false
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab=4
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size=4
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/Essentials.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
endorsed.classpath=
|
||||
excludes=
|
||||
file.reference.BOSEconomy.jar=../lib/BOSEconomy.jar
|
||||
file.reference.bPermissions.jar=../lib/bPermissions.jar
|
||||
file.reference.bukkit.jar=../lib/bukkit.jar
|
||||
file.reference.iCo5.jar=../lib/iCo5.jar
|
||||
file.reference.iCo6.jar=../lib/iCo6.jar
|
||||
file.reference.lombok.jar=../lib/lombok-1.12.2.jar
|
||||
file.reference.MultiCurrency.jar=../lib/MultiCurrency.jar
|
||||
file.reference.PermissionsBukkit-1.2.jar=../lib/PermissionsBukkit.jar
|
||||
file.reference.PermissionsEx.jar=../lib/PermissionsEx.jar
|
||||
file.reference.Privileges.jar=..\\lib\\Privileges.jar
|
||||
file.reference.Vault.jar=../lib/Vault.jar
|
||||
file.reference.SimplyPerms.jar=../lib/SimplyPerms.jar
|
||||
file.reference.zPermissions.jar=../lib/zPermissions.jar
|
||||
includes=**
|
||||
jar.archive.disabled=${jnlp.enabled}
|
||||
jar.compress=true
|
||||
jar.index=${jnlp.enabled}
|
||||
javac.classpath=\
|
||||
${file.reference.iCo5.jar}:\
|
||||
${file.reference.iCo6.jar}:\
|
||||
${file.reference.MultiCurrency.jar}:\
|
||||
${file.reference.BOSEconomy.jar}:\
|
||||
${file.reference.PermissionsEx.jar}:\
|
||||
${file.reference.PermissionsBukkit-1.2.jar}:\
|
||||
${file.reference.lombok.jar}:\
|
||||
${reference.EssentialsGroupManager.jar}:\
|
||||
${file.reference.bukkit.jar}:\
|
||||
${file.reference.Vault.jar}:\
|
||||
${file.reference.Privileges.jar}:\
|
||||
${file.reference.bPermissions.jar}:\
|
||||
${file.reference.SimplyPerms.jar}:\
|
||||
${file.reference.zPermissions.jar}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=-Xlint:unchecked
|
||||
javac.deprecation=false
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=1.6
|
||||
javac.target=1.6
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}:\
|
||||
${libs.junit_4.10.classpath}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.reference.PermissionsEx.jar=../lib/PermissionsEx-javadoc.jar
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
jnlp.codebase.type=no.codebase
|
||||
jnlp.descriptor=application
|
||||
jnlp.enabled=false
|
||||
jnlp.mixed.code=default
|
||||
jnlp.offline-allowed=false
|
||||
jnlp.signed=false
|
||||
jnlp.signing=
|
||||
jnlp.signing.alias=
|
||||
jnlp.signing.keystore=
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=true
|
||||
platform.active=default_platform
|
||||
project.EssentialsGroupManager=../EssentialsGroupManager
|
||||
reference.EssentialsGroupManager.jar=../EssentialsGroupManager/dist/EssentialsGroupManager.jar
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project
|
||||
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
|
||||
# or test-sys-prop.name=value to set system properties for unit tests):
|
||||
run.jvmargs=-Djline.terminal=jline.UnsupportedTerminal
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>Essentials</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
<libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
|
||||
<definitions>../lib/nblibraries.properties</definitions>
|
||||
</libraries>
|
||||
<references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
|
||||
<reference>
|
||||
<foreign-project>EssentialsGroupManager</foreign-project>
|
||||
<artifact-type>jar</artifact-type>
|
||||
<script>build.xml</script>
|
||||
<target>jar</target>
|
||||
<clean-target>clean</clean-target>
|
||||
<id>jar</id>
|
||||
</reference>
|
||||
</references>
|
||||
</configuration>
|
||||
</project>
|
@@ -1,6 +1,6 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
@@ -40,19 +40,26 @@
|
||||
<system>TeamCity</system>
|
||||
<url>http://ci.ess3.net/</url>
|
||||
</ciManagement>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>vault-repo</id>
|
||||
<url>http://ci.herocraftonline.com/plugin/repository/everything</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>kitteh-repo</id>
|
||||
<url>http://repo.kitteh.org/content/groups/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.7.2-R0.3-SNAPSHOT</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/../lib/bukkit.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>BOSEconomy</groupId>
|
||||
<artifactId>BOSEconomy</artifactId>
|
||||
@@ -122,9 +129,9 @@
|
||||
<systemPath>${project.basedir}/../lib/SimplyPerms.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl</groupId>
|
||||
<artifactId>vault</artifactId>
|
||||
<version>1.2.27</version>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>Vault</artifactId>
|
||||
<version>1.2.32</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>zPermissions</groupId>
|
||||
@@ -134,4 +141,4 @@
|
||||
<systemPath>${project.basedir}/../lib/zPermissions.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
</project>
|
||||
|
@@ -12,7 +12,7 @@ import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class AlternativeCommandsHandler
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
private static final Logger LOGGER = Logger.getLogger("Essentials");
|
||||
private final transient Map<String, List<PluginCommand>> altcommands = new HashMap<String, List<PluginCommand>>();
|
||||
private final transient Map<String, String> disabledList = new HashMap<String, String>();
|
||||
private final transient IEssentials ess;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
@@ -13,7 +13,7 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
public class Backup implements Runnable
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
private static final Logger LOGGER = Logger.getLogger("Essentials");
|
||||
private transient final Server server;
|
||||
private transient final IEssentials ess;
|
||||
private transient boolean running = false;
|
||||
@@ -86,70 +86,82 @@ public class Backup implements Runnable
|
||||
active = false;
|
||||
return;
|
||||
}
|
||||
LOGGER.log(Level.INFO, _("backupStarted"));
|
||||
LOGGER.log(Level.INFO, tl("backupStarted"));
|
||||
final CommandSender cs = server.getConsoleSender();
|
||||
server.dispatchCommand(cs, "save-all");
|
||||
server.dispatchCommand(cs, "save-off");
|
||||
|
||||
ess.runTaskAsynchronously(
|
||||
new Runnable()
|
||||
ess.runTaskAsynchronously(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
final ProcessBuilder childBuilder = new ProcessBuilder(command);
|
||||
childBuilder.redirectErrorStream(true);
|
||||
childBuilder.directory(ess.getDataFolder().getParentFile().getParentFile());
|
||||
final Process child = childBuilder.start();
|
||||
ess.runTaskAsynchronously(new Runnable()
|
||||
{
|
||||
try
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
final ProcessBuilder childBuilder = new ProcessBuilder(command);
|
||||
childBuilder.redirectErrorStream(true);
|
||||
childBuilder.directory(ess.getDataFolder().getParentFile().getParentFile());
|
||||
final Process child = childBuilder.start();
|
||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(child.getInputStream()));
|
||||
try
|
||||
{
|
||||
child.waitFor();
|
||||
String line;
|
||||
do
|
||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(child.getInputStream()));
|
||||
try
|
||||
{
|
||||
line = reader.readLine();
|
||||
if (line != null)
|
||||
String line;
|
||||
do
|
||||
{
|
||||
LOGGER.log(Level.INFO, line);
|
||||
}
|
||||
}
|
||||
while (line != null);
|
||||
}
|
||||
finally
|
||||
{
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
catch (InterruptedException ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ess.scheduleSyncDelayedTask(
|
||||
new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
line = reader.readLine();
|
||||
if (line != null)
|
||||
{
|
||||
server.dispatchCommand(cs, "save-on");
|
||||
if (server.getOnlinePlayers().length == 0)
|
||||
{
|
||||
stopTask();
|
||||
}
|
||||
active = false;
|
||||
LOGGER.log(Level.INFO, _("backupFinished"));
|
||||
LOGGER.log(Level.INFO, line);
|
||||
}
|
||||
});
|
||||
}
|
||||
while (line != null);
|
||||
}
|
||||
finally
|
||||
{
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
child.waitFor();
|
||||
}
|
||||
catch (InterruptedException ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ess.scheduleSyncDelayedTask(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
server.dispatchCommand(cs, "save-on");
|
||||
if (server.getOnlinePlayers().length == 0)
|
||||
{
|
||||
stopTask();
|
||||
}
|
||||
active = false;
|
||||
LOGGER.log(Level.INFO, tl("backupFinished"));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -141,13 +141,32 @@ public class Enchantments
|
||||
ALIASENCHANTMENTS.put("unlimited", Enchantment.ARROW_INFINITE);
|
||||
ALIASENCHANTMENTS.put("unlimitedarrows", Enchantment.ARROW_INFINITE);
|
||||
ALIASENCHANTMENTS.put("ai", Enchantment.ARROW_INFINITE);
|
||||
|
||||
try // 1.7 update
|
||||
{
|
||||
ENCHANTMENTS.put("luck", Enchantment.LUCK);
|
||||
ALIASENCHANTMENTS.put("luckofsea", Enchantment.LUCK);
|
||||
ALIASENCHANTMENTS.put("luckofseas", Enchantment.LUCK);
|
||||
ALIASENCHANTMENTS.put("rodluck", Enchantment.LUCK);
|
||||
|
||||
ENCHANTMENTS.put("lure", Enchantment.LURE);
|
||||
ALIASENCHANTMENTS.put("rodlure", Enchantment.LURE);
|
||||
}
|
||||
catch (java.lang.NoSuchFieldError e)
|
||||
{
|
||||
Essentials.wrongVersion();
|
||||
}
|
||||
}
|
||||
|
||||
public static Enchantment getByName(String name) {
|
||||
public static Enchantment getByName(String name)
|
||||
{
|
||||
Enchantment enchantment;
|
||||
if (NumberUtil.isInt(name)) {
|
||||
if (NumberUtil.isInt(name))
|
||||
{
|
||||
enchantment = Enchantment.getById(Integer.parseInt(name));
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
enchantment = Enchantment.getByName(name.toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
if (enchantment == null)
|
||||
|
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.commands.EssentialsCommand;
|
||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||
import com.earth2me.essentials.commands.NoChargeException;
|
||||
@@ -40,6 +40,7 @@ import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -58,9 +59,7 @@ import org.bukkit.command.BlockCommandSender;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.command.SimpleCommandMap;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.command.defaults.VanillaCommand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@@ -74,6 +73,7 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.plugin.java.JavaPluginLoader;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.yaml.snakeyaml.error.YAMLException;
|
||||
@@ -81,8 +81,8 @@ import org.yaml.snakeyaml.error.YAMLException;
|
||||
|
||||
public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
||||
{
|
||||
public static final int BUKKIT_VERSION = 2882;
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
public static final int BUKKIT_VERSION = 3050;
|
||||
private static final Logger LOGGER = Logger.getLogger("Essentials");
|
||||
private transient ISettings settings;
|
||||
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);
|
||||
private transient Jails jails;
|
||||
@@ -99,8 +99,16 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
||||
private transient I18n i18n;
|
||||
private transient Metrics metrics;
|
||||
private transient EssentialsTimer timer;
|
||||
private transient List<String> vanishedPlayers = new ArrayList<String>();
|
||||
private transient SimpleCommandMap scm;
|
||||
private final transient List<String> vanishedPlayers = new ArrayList<String>();
|
||||
|
||||
public Essentials()
|
||||
{
|
||||
}
|
||||
|
||||
public Essentials(final Server server)
|
||||
{
|
||||
super(new JavaPluginLoader(server), new PluginDescriptionFile("Essentials", "", "com.earth2me.essentials.Essentials"), null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISettings getSettings()
|
||||
@@ -121,7 +129,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
||||
}
|
||||
i18n = new I18n(this);
|
||||
i18n.onEnable();
|
||||
LOGGER.log(Level.INFO, _("usingTempFolderForTesting"));
|
||||
LOGGER.log(Level.INFO, tl("usingTempFolderForTesting"));
|
||||
LOGGER.log(Level.INFO, dataFolder.toString());
|
||||
this.initialize(null, server, new PluginDescriptionFile(new FileReader(new File("src" + File.separator + "plugin.yml"))), dataFolder, null, null);
|
||||
settings = new Settings(this);
|
||||
@@ -136,12 +144,12 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
||||
{
|
||||
try
|
||||
{
|
||||
LOGGER.setParent(this.getLogger());
|
||||
execTimer = new ExecuteTimer();
|
||||
execTimer.start();
|
||||
i18n = new I18n(this);
|
||||
i18n.onEnable();
|
||||
execTimer.mark("I18n1");
|
||||
scm = new SimpleCommandMap(this.getServer());
|
||||
final PluginManager pm = getServer().getPluginManager();
|
||||
for (Plugin plugin : pm.getPlugins())
|
||||
{
|
||||
@@ -149,7 +157,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
||||
&& !plugin.getDescription().getVersion().equals(this.getDescription().getVersion())
|
||||
&& !plugin.getDescription().getName().equals("EssentialsAntiCheat"))
|
||||
{
|
||||
LOGGER.log(Level.WARNING, _("versionMismatch", plugin.getDescription().getName()));
|
||||
LOGGER.log(Level.WARNING, tl("versionMismatch", plugin.getDescription().getName()));
|
||||
}
|
||||
}
|
||||
final Matcher versionMatch = Pattern.compile("git-Bukkit-(?:(?:[0-9]+)\\.)+[0-9]+-R[\\.0-9]+-(?:[0-9]+-g[0-9a-f]+-)?b([0-9]+)jnks.*").matcher(getServer().getVersion());
|
||||
@@ -165,7 +173,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("bukkitFormatChanged"));
|
||||
LOGGER.log(Level.INFO, tl("bukkitFormatChanged"));
|
||||
LOGGER.log(Level.INFO, getServer().getVersion());
|
||||
LOGGER.log(Level.INFO, getServer().getBukkitVersion());
|
||||
}
|
||||
@@ -179,12 +187,12 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
||||
settings = new Settings(this);
|
||||
confList.add(settings);
|
||||
execTimer.mark("Settings");
|
||||
upgrade.afterSettings();
|
||||
execTimer.mark("Upgrade2");
|
||||
i18n.updateLocale(settings.getLocale());
|
||||
userMap = new UserMap(this);
|
||||
confList.add(userMap);
|
||||
execTimer.mark("Init(Usermap)");
|
||||
upgrade.afterSettings();
|
||||
execTimer.mark("Upgrade2");
|
||||
i18n.updateLocale(settings.getLocale());
|
||||
warps = new Warps(getServer(), this.getDataFolder());
|
||||
confList.add(warps);
|
||||
execTimer.mark("Init(Spawn/Warp)");
|
||||
@@ -201,11 +209,11 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
||||
{
|
||||
if (pm.getPlugin("EssentialsUpdate") != null)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("essentialsHelp2"));
|
||||
LOGGER.log(Level.SEVERE, tl("essentialsHelp2"));
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("essentialsHelp1"));
|
||||
LOGGER.log(Level.SEVERE, tl("essentialsHelp1"));
|
||||
}
|
||||
handleCrash(exception);
|
||||
return;
|
||||
@@ -234,7 +242,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
||||
final String timeroutput = execTimer.end();
|
||||
if (getSettings().isDebug())
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Essentials load " + timeroutput);
|
||||
LOGGER.log(Level.INFO, "Essentials load {0}", timeroutput);
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
@@ -302,7 +310,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
||||
if (user.isVanished())
|
||||
{
|
||||
user.setVanished(false);
|
||||
user.sendMessage(_("unvanishedReload"));
|
||||
user.sendMessage(tl("unvanishedReload"));
|
||||
}
|
||||
}
|
||||
cleanupOpenInventories();
|
||||
@@ -316,6 +324,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
||||
}
|
||||
Economy.setEss(null);
|
||||
Trade.closeLog();
|
||||
getUserMap().getUUIDMap().forceWriteUUIDMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -431,7 +440,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
||||
final List<String> mail = user.getMails();
|
||||
if (mail != null && !mail.isEmpty())
|
||||
{
|
||||
user.sendMessage(_("youHaveNewMail", mail.size()));
|
||||
user.sendMessage(tl("youHaveNewMail", mail.size()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,16 +454,6 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
||||
// Check for disabled commands
|
||||
if (getSettings().isCommandDisabled(commandLabel))
|
||||
{
|
||||
if (scm != null)
|
||||
{
|
||||
for (VanillaCommand cmd : scm.getFallbackCommands())
|
||||
{
|
||||
if (cmd.matches(commandLabel))
|
||||
{
|
||||
cmd.execute(cSender, commandLabel, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -467,16 +466,16 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
sender.sendMessage(_("commandNotLoaded", commandLabel));
|
||||
LOGGER.log(Level.SEVERE, _("commandNotLoaded", commandLabel), ex);
|
||||
sender.sendMessage(tl("commandNotLoaded", commandLabel));
|
||||
LOGGER.log(Level.SEVERE, tl("commandNotLoaded", commandLabel), ex);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check authorization
|
||||
if (user != null && !user.isAuthorized(cmd, permissionPrefix))
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("deniedAccessCommand", user.getName()));
|
||||
user.sendMessage(_("noAccessCommand"));
|
||||
LOGGER.log(Level.INFO, tl("deniedAccessCommand", user.getName()));
|
||||
user.sendMessage(tl("noAccessCommand"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -484,11 +483,11 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
||||
{
|
||||
if (user.getJailTimeout() > 0)
|
||||
{
|
||||
user.sendMessage(_("playerJailedFor", user.getName(), DateUtil.formatDateDiff(user.getJailTimeout())));
|
||||
user.sendMessage(tl("playerJailedFor", user.getName(), DateUtil.formatDateDiff(user.getJailTimeout())));
|
||||
}
|
||||
else
|
||||
{
|
||||
user.sendMessage(_("jailMessage"));
|
||||
user.sendMessage(tl("jailMessage"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -532,7 +531,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
||||
}
|
||||
catch (Throwable ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("commandFailed", commandLabel), ex);
|
||||
LOGGER.log(Level.SEVERE, tl("commandFailed", commandLabel), ex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -560,18 +559,18 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
||||
@Override
|
||||
public void showError(final CommandSource sender, final Throwable exception, final String commandLabel)
|
||||
{
|
||||
sender.sendMessage(_("errorWithMessage", exception.getMessage()));
|
||||
sender.sendMessage(tl("errorWithMessage", exception.getMessage()));
|
||||
if (getSettings().isDebug())
|
||||
{
|
||||
LOGGER.log(Level.WARNING, _("errorCallingCommand", commandLabel), exception);
|
||||
LOGGER.log(Level.INFO, tl("errorCallingCommand", commandLabel), exception);
|
||||
}
|
||||
}
|
||||
|
||||
static public void wrongVersion()
|
||||
public static void wrongVersion()
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, " * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! *");
|
||||
LOGGER.log(Level.SEVERE, _("notRecommendedBukkit"));
|
||||
LOGGER.log(Level.SEVERE, _("requiredBukkit", Integer.toString(BUKKIT_VERSION)));
|
||||
LOGGER.log(Level.SEVERE, tl("notRecommendedBukkit"));
|
||||
LOGGER.log(Level.SEVERE, tl("requiredBukkit", Integer.toString(BUKKIT_VERSION)));
|
||||
LOGGER.log(Level.SEVERE, " * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! *");
|
||||
}
|
||||
|
||||
@@ -632,23 +631,42 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
||||
return null;
|
||||
}
|
||||
|
||||
//This will return null if there is not a match.
|
||||
@Override
|
||||
public User getUser(final String base)
|
||||
{
|
||||
return getOfflineUser((String)base);
|
||||
return getOfflineUser(base);
|
||||
}
|
||||
|
||||
//This will return null if there is not a match.
|
||||
@Override
|
||||
public User getUser(final UUID base)
|
||||
{
|
||||
return userMap.getUser(base);
|
||||
}
|
||||
|
||||
//This will return null if there is not a match.
|
||||
@Override
|
||||
public User getOfflineUser(final String name)
|
||||
{
|
||||
final User user = userMap.getUser(name);
|
||||
final User user = userMap.getUser(name);
|
||||
if (user != null && user.getBase() instanceof OfflinePlayer)
|
||||
{
|
||||
((OfflinePlayer)user.getBase()).setName(name);
|
||||
//This code should attempt to use the last known name of a user, if Bukkit returns name as null.
|
||||
final String lastName = user.getLastAccountName();
|
||||
if (lastName != null)
|
||||
{
|
||||
((OfflinePlayer)user.getBase()).setName(lastName);
|
||||
}
|
||||
else
|
||||
{
|
||||
((OfflinePlayer)user.getBase()).setName(name);
|
||||
}
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
//This will create a new user if there is not a match.
|
||||
@Override
|
||||
public User getUser(final Player base)
|
||||
{
|
||||
@@ -663,11 +681,16 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
||||
return null;
|
||||
}
|
||||
|
||||
User user = userMap.getUser(base.getName());
|
||||
User user = userMap.getUser(base.getUniqueId());
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
if (getSettings().isDebug())
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Constructing new userfile from base player {0}", base.getName());
|
||||
}
|
||||
user = new User(base, this);
|
||||
user.setLastAccountName(base.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -54,7 +54,7 @@ public class EssentialsBlockListener implements Listener
|
||||
}
|
||||
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
if (user.hasUnlimited(is) && user.getGameMode() == GameMode.SURVIVAL)
|
||||
if (user.hasUnlimited(is) && user.getBase().getGameMode() == GameMode.SURVIVAL)
|
||||
{
|
||||
ess.scheduleSyncDelayedTask(
|
||||
new Runnable()
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.google.common.io.Files;
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
@@ -31,11 +31,11 @@ import org.bukkit.util.Vector;
|
||||
|
||||
public class EssentialsConf extends YamlConfiguration
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
private final File configFile;
|
||||
private String templateName = null;
|
||||
private Class<?> resourceClass = EssentialsConf.class;
|
||||
private static final Charset UTF8 = Charset.forName("UTF-8");
|
||||
protected static final Logger LOGGER = Logger.getLogger("Essentials");
|
||||
protected final File configFile;
|
||||
protected String templateName = null;
|
||||
protected static final Charset UTF8 = Charset.forName("UTF-8");
|
||||
private Class<?> resourceClass = EssentialsConf.class;
|
||||
private static final ExecutorService EXECUTOR_SERVICE = Executors.newSingleThreadExecutor();
|
||||
private final AtomicInteger pendingDiskWrites = new AtomicInteger(0);
|
||||
|
||||
@@ -50,14 +50,14 @@ public class EssentialsConf extends YamlConfiguration
|
||||
{
|
||||
if (pendingDiskWrites.get() != 0)
|
||||
{
|
||||
LOGGER.log(Level.INFO, "File " + configFile + " not read, because it's not yet written to disk.");
|
||||
LOGGER.log(Level.INFO, "File {0} not read, because it''s not yet written to disk.", configFile);
|
||||
return;
|
||||
}
|
||||
if (!configFile.getParentFile().exists())
|
||||
{
|
||||
if (!configFile.getParentFile().mkdirs())
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()));
|
||||
LOGGER.log(Level.SEVERE, tl("failedToCreateConfig", configFile.toString()));
|
||||
}
|
||||
}
|
||||
// This will delete files where the first character is 0. In most cases they are broken.
|
||||
@@ -95,12 +95,20 @@ public class EssentialsConf extends YamlConfiguration
|
||||
LOGGER.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!configFile.exists())
|
||||
{
|
||||
if (templateName != null)
|
||||
if (legacyFileExists())
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("creatingConfigFromTemplate", configFile.toString()));
|
||||
convertLegacyFile();
|
||||
}
|
||||
else if (altFileExists())
|
||||
{
|
||||
convertAltFile();
|
||||
}
|
||||
else if (templateName != null)
|
||||
{
|
||||
LOGGER.log(Level.INFO, tl("creatingConfigFromTemplate", configFile.toString()));
|
||||
createFromTemplate();
|
||||
}
|
||||
else
|
||||
@@ -179,6 +187,26 @@ public class EssentialsConf extends YamlConfiguration
|
||||
LOGGER.log(Level.SEVERE, "The file " + configFile.toString() + " is broken, it has been renamed to " + broken.toString(), ex.getCause());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean legacyFileExists()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void convertLegacyFile()
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, "Unable to import legacy config file.");
|
||||
}
|
||||
|
||||
public boolean altFileExists()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void convertAltFile()
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, "Unable to import alt config file.");
|
||||
}
|
||||
|
||||
private void createFromTemplate()
|
||||
{
|
||||
@@ -189,7 +217,7 @@ public class EssentialsConf extends YamlConfiguration
|
||||
istr = resourceClass.getResourceAsStream(templateName);
|
||||
if (istr == null)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("couldNotFindTemplate", templateName));
|
||||
LOGGER.log(Level.SEVERE, tl("couldNotFindTemplate", templateName));
|
||||
return;
|
||||
}
|
||||
ostr = new FileOutputStream(configFile);
|
||||
@@ -204,7 +232,7 @@ public class EssentialsConf extends YamlConfiguration
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("failedToWriteConfig", configFile.toString()), ex);
|
||||
LOGGER.log(Level.SEVERE, tl("failedToWriteConfig", configFile.toString()), ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -228,7 +256,7 @@ public class EssentialsConf extends YamlConfiguration
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("failedToCloseConfig", configFile.toString()), ex);
|
||||
LOGGER.log(Level.SEVERE, tl("failedToCloseConfig", configFile.toString()), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -352,16 +380,16 @@ public class EssentialsConf extends YamlConfiguration
|
||||
{
|
||||
try
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("creatingEmptyConfig", configFile.toString()));
|
||||
LOGGER.log(Level.INFO, tl("creatingEmptyConfig", configFile.toString()));
|
||||
if (!configFile.createNewFile())
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()));
|
||||
LOGGER.log(Level.SEVERE, tl("failedToCreateConfig", configFile.toString()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()), ex);
|
||||
LOGGER.log(Level.SEVERE, tl("failedToCreateConfig", configFile.toString()), ex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -405,7 +433,8 @@ public class EssentialsConf extends YamlConfiguration
|
||||
|
||||
public Location getLocation(final String path, final Server server) throws InvalidWorldException
|
||||
{
|
||||
final String worldName = getString((path == null ? "" : path + ".") + "world");
|
||||
final String worldString = (path == null ? "" : path + ".") + "world";
|
||||
final String worldName = getString(worldString);
|
||||
if (worldName == null || worldName.isEmpty())
|
||||
{
|
||||
return null;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -18,7 +18,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class EssentialsEntityListener implements Listener
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
private static final Logger LOGGER = Logger.getLogger("Essentials");
|
||||
private static final transient Pattern powertoolPlayer = Pattern.compile("\\{player\\}");
|
||||
private final IEssentials ess;
|
||||
|
||||
@@ -42,21 +42,23 @@ public class EssentialsEntityListener implements Listener
|
||||
}
|
||||
else if (eDefend instanceof Ageable)
|
||||
{
|
||||
final ItemStack hand = attacker.getItemInHand();
|
||||
final ItemStack hand = attacker.getBase().getItemInHand();
|
||||
if (hand != null && hand.getType() == Material.MILK_BUCKET)
|
||||
{
|
||||
((Ageable)eDefend).setBaby();
|
||||
hand.setType(Material.BUCKET);
|
||||
attacker.setItemInHand(hand);
|
||||
attacker.updateInventory();
|
||||
attacker.getBase().setItemInHand(hand);
|
||||
attacker.getBase().updateInventory();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
attacker.updateActivity(true);
|
||||
}
|
||||
else if (eAttack instanceof Projectile && eDefend instanceof Player)
|
||||
{
|
||||
Entity shooter = ((Projectile)event.getDamager()).getShooter();
|
||||
{
|
||||
final Projectile projectile = (Projectile)event.getDamager();
|
||||
//This should return a ProjectileSource on 1.7.3 beta +
|
||||
final Object shooter = projectile.getShooter();
|
||||
if (shooter instanceof Player)
|
||||
{
|
||||
final User attacker = ess.getUser((Player)shooter);
|
||||
@@ -95,7 +97,7 @@ public class EssentialsEntityListener implements Listener
|
||||
|
||||
private void onPlayerVsPlayerPowertool(final EntityDamageByEntityEvent event, final Player defender, final User attacker)
|
||||
{
|
||||
final List<String> commandList = attacker.getPowertool(attacker.getItemInHand());
|
||||
final List<String> commandList = attacker.getPowertool(attacker.getBase().getItemInHand());
|
||||
if (commandList != null && !commandList.isEmpty())
|
||||
{
|
||||
for (final String tempCommand : commandList)
|
||||
@@ -149,7 +151,7 @@ public class EssentialsEntityListener implements Listener
|
||||
if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back"))
|
||||
{
|
||||
user.setLastLocation();
|
||||
user.sendMessage(_("backAfterDeath"));
|
||||
user.sendMessage(tl("backAfterDeath"));
|
||||
}
|
||||
if (!ess.getSettings().areDeathMessagesEnabled())
|
||||
{
|
||||
@@ -178,8 +180,8 @@ public class EssentialsEntityListener implements Listener
|
||||
{
|
||||
if (user.isGodModeEnabledRaw())
|
||||
{
|
||||
user.setFoodLevel(20);
|
||||
user.setSaturation(10);
|
||||
user.getBase().setFoodLevel(20);
|
||||
user.getBase().setSaturation(10);
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.textreader.IText;
|
||||
import com.earth2me.essentials.textreader.KeywordReplacer;
|
||||
import com.earth2me.essentials.textreader.TextInput;
|
||||
@@ -35,27 +35,27 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class EssentialsPlayerListener implements Listener
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
private static final Logger LOGGER = Logger.getLogger("Essentials");
|
||||
private final transient IEssentials ess;
|
||||
|
||||
|
||||
public EssentialsPlayerListener(final IEssentials parent)
|
||||
{
|
||||
this.ess = parent;
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onPlayerRespawn(final PlayerRespawnEvent event)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
updateCompass(user);
|
||||
user.setDisplayNick();
|
||||
|
||||
|
||||
if (ess.getSettings().isTeleportInvulnerability())
|
||||
{
|
||||
user.enableInvulnerabilityAfterTeleport();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerChat(final AsyncPlayerChatEvent event)
|
||||
{
|
||||
@@ -63,8 +63,8 @@ public class EssentialsPlayerListener implements Listener
|
||||
if (user.isMuted())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
user.sendMessage(_("voiceSilenced"));
|
||||
LOGGER.info(_("mutedUserSpeaks", user.getName()));
|
||||
user.sendMessage(tl("voiceSilenced"));
|
||||
LOGGER.info(tl("mutedUserSpeaks", user.getName()));
|
||||
}
|
||||
try
|
||||
{
|
||||
@@ -89,11 +89,11 @@ public class EssentialsPlayerListener implements Listener
|
||||
ess.getLogger().info("Ignore could not block chat due to custom chat plugin event.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
user.updateActivity(true);
|
||||
user.setDisplayNick();
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onPlayerMove(final PlayerMoveEvent event)
|
||||
{
|
||||
@@ -103,19 +103,19 @@ public class EssentialsPlayerListener implements Listener
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!ess.getSettings().cancelAfkOnMove() && !ess.getSettings().getFreezeAfkPlayers())
|
||||
{
|
||||
event.getHandlers().unregister(this);
|
||||
|
||||
|
||||
if (ess.getSettings().isDebug())
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Unregistering move listener");
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
if (user.isAfk() && ess.getSettings().getFreezeAfkPlayers())
|
||||
{
|
||||
@@ -146,11 +146,25 @@ public class EssentialsPlayerListener implements Listener
|
||||
user.updateActivity(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerQuit(final PlayerQuitEvent event)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
|
||||
if (ess.getSettings().allowSilentJoinQuit() && user.isAuthorized("essentials.silentquit"))
|
||||
{
|
||||
event.setQuitMessage(null);
|
||||
}
|
||||
else if (ess.getSettings().isCustomQuitMessage() && event.getQuitMessage() != null)
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
event.setQuitMessage(
|
||||
ess.getSettings().getCustomQuitMessage()
|
||||
.replace("{PLAYER}", player.getDisplayName())
|
||||
.replace("{USERNAME}", player.getName()));
|
||||
}
|
||||
|
||||
if (ess.getSettings().removeGodOnDisconnect() && user.isGodModeEnabled())
|
||||
{
|
||||
user.setGodModeEnabled(false);
|
||||
@@ -164,64 +178,63 @@ public class EssentialsPlayerListener implements Listener
|
||||
{
|
||||
user.getBase().getOpenInventory().getTopInventory().clear();
|
||||
}
|
||||
if (user.hasPermission("essentials.silentquit"))
|
||||
{
|
||||
event.setQuitMessage(null);
|
||||
}
|
||||
user.updateActivity(false);
|
||||
user.dispose();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerJoin(final PlayerJoinEvent event)
|
||||
{
|
||||
if (event.getPlayer().hasPermission("essentials.silentjoin"))
|
||||
{
|
||||
event.setJoinMessage(null);
|
||||
}
|
||||
final String joinMessage = event.getJoinMessage();
|
||||
ess.runTaskAsynchronously(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
delayedJoin(event.getPlayer());
|
||||
delayedJoin(event.getPlayer(), joinMessage);
|
||||
}
|
||||
});
|
||||
if (ess.getSettings().allowSilentJoinQuit() || ess.getSettings().isCustomJoinMessage())
|
||||
{
|
||||
event.setJoinMessage(null);
|
||||
}
|
||||
}
|
||||
|
||||
public void delayedJoin(final Player player)
|
||||
|
||||
public void delayedJoin(final Player player, final String message)
|
||||
{
|
||||
if (!player.isOnline())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ess.getBackup().onPlayerJoin();
|
||||
final User user = ess.getUser(player);
|
||||
|
||||
|
||||
|
||||
if (user.isNPC())
|
||||
{
|
||||
user.setNPC(false);
|
||||
}
|
||||
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
user.checkMuteTimeout(currentTime);
|
||||
user.updateActivity(false);
|
||||
|
||||
|
||||
ess.scheduleSyncDelayedTask(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (!user.isOnline())
|
||||
if (!user.getBase().isOnline())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
user.setLastAccountName(user.getBase().getName());
|
||||
user.setLastLogin(currentTime);
|
||||
user.setDisplayNick();
|
||||
updateCompass(user);
|
||||
|
||||
|
||||
if (!ess.getVanishedPlayers().isEmpty() && !user.isAuthorized("essentials.vanish.see"))
|
||||
{
|
||||
for (String p : ess.getVanishedPlayers())
|
||||
@@ -229,16 +242,32 @@ public class EssentialsPlayerListener implements Listener
|
||||
Player toVanish = ess.getServer().getPlayerExact(p);
|
||||
if (toVanish != null && toVanish.isOnline())
|
||||
{
|
||||
user.hidePlayer(toVanish);
|
||||
user.getBase().hidePlayer(toVanish);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (user.isAuthorized("essentials.sleepingignored"))
|
||||
{
|
||||
user.setSleepingIgnored(true);
|
||||
user.getBase().setSleepingIgnored(true);
|
||||
}
|
||||
|
||||
|
||||
if ((ess.getSettings().allowSilentJoinQuit() && user.isAuthorized("essentials.silentjoin")) || message == null)
|
||||
{
|
||||
// Do nothing - silently join
|
||||
}
|
||||
else if (ess.getSettings().isCustomJoinMessage())
|
||||
{
|
||||
ess.getServer().broadcastMessage(
|
||||
ess.getSettings().getCustomJoinMessage()
|
||||
.replace("{PLAYER}", player.getDisplayName())
|
||||
.replace("{USERNAME}", player.getName()));
|
||||
}
|
||||
else if (ess.getSettings().allowSilentJoinQuit())
|
||||
{
|
||||
ess.getServer().broadcastMessage(message);
|
||||
}
|
||||
|
||||
if (!ess.getSettings().isCommandDisabled("motd") && user.isAuthorized("essentials.motd"))
|
||||
{
|
||||
try
|
||||
@@ -260,32 +289,33 @@ public class EssentialsPlayerListener implements Listener
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!ess.getSettings().isCommandDisabled("mail") && user.isAuthorized("essentials.mail"))
|
||||
{
|
||||
final List<String> mail = user.getMails();
|
||||
if (mail.isEmpty())
|
||||
{
|
||||
user.sendMessage(_("noNewMail"));
|
||||
user.sendMessage(tl("noNewMail"));
|
||||
}
|
||||
else
|
||||
{
|
||||
user.sendMessage(_("youHaveNewMail", mail.size()));
|
||||
user.sendMessage(tl("youHaveNewMail", mail.size()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (user.isAuthorized("essentials.fly.safelogin"))
|
||||
{
|
||||
user.getBase().setFallDistance(0);
|
||||
if (LocationUtil.shouldFly(user.getLocation()))
|
||||
{
|
||||
user.setAllowFlight(true);
|
||||
user.setFlying(true);
|
||||
user.sendMessage(_("flyMode", _("enabled"), user.getDisplayName()));
|
||||
}
|
||||
user.getBase().setAllowFlight(true);
|
||||
user.getBase().setFlying(true);
|
||||
user.getBase().sendMessage(tl("flyMode", tl("enabled"), user.getDisplayName()));
|
||||
}
|
||||
}
|
||||
user.setFlySpeed(0.1f);
|
||||
user.setWalkSpeed(0.2f);
|
||||
|
||||
user.getBase().setFlySpeed(0.1f);
|
||||
user.getBase().setWalkSpeed(0.2f);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -296,15 +326,15 @@ public class EssentialsPlayerListener implements Listener
|
||||
Location loc = user.getHome(user.getLocation());
|
||||
if (loc == null)
|
||||
{
|
||||
loc = user.getBedSpawnLocation();
|
||||
loc = user.getBase().getBedSpawnLocation();
|
||||
}
|
||||
if (loc != null)
|
||||
{
|
||||
final Location updateLoc = loc;
|
||||
user.setCompassTarget(updateLoc);
|
||||
user.getBase().setCompassTarget(updateLoc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerLogin2(final PlayerLoginEvent event)
|
||||
{
|
||||
@@ -315,11 +345,11 @@ public class EssentialsPlayerListener implements Listener
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
final String banReason = _("banFormat", _("defaultBanReason"), "Console");
|
||||
|
||||
final String banReason = tl("banFormat", tl("defaultBanReason"), "Console");
|
||||
event.disallow(Result.KICK_BANNED, banReason);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onPlayerLogin(final PlayerLoginEvent event)
|
||||
{
|
||||
@@ -331,10 +361,10 @@ public class EssentialsPlayerListener implements Listener
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
|
||||
if (event.getResult() == Result.KICK_BANNED || user.isBanned())
|
||||
|
||||
if (event.getResult() == Result.KICK_BANNED || user.getBase().isBanned())
|
||||
{
|
||||
final boolean banExpired = user.checkBanTimeout(System.currentTimeMillis());
|
||||
if (!banExpired)
|
||||
@@ -353,15 +383,15 @@ public class EssentialsPlayerListener implements Listener
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (event.getResult() == Result.KICK_FULL && !user.isAuthorized("essentials.joinfullserver"))
|
||||
{
|
||||
event.disallow(Result.KICK_FULL, _("serverFull"));
|
||||
event.disallow(Result.KICK_FULL, tl("serverFull"));
|
||||
return;
|
||||
}
|
||||
event.allow();
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onPlayerTeleport(final PlayerTeleportEvent event)
|
||||
{
|
||||
@@ -375,13 +405,13 @@ public class EssentialsPlayerListener implements Listener
|
||||
{
|
||||
user.setLastLocation();
|
||||
}
|
||||
if (teleportInvulnerability)
|
||||
if (teleportInvulnerability && (event.getCause() == TeleportCause.PLUGIN || event.getCause() == TeleportCause.COMMAND))
|
||||
{
|
||||
user.enableInvulnerabilityAfterTeleport();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onPlayerEggThrow(final PlayerEggThrowEvent event)
|
||||
{
|
||||
@@ -389,11 +419,11 @@ public class EssentialsPlayerListener implements Listener
|
||||
final ItemStack stack = new ItemStack(Material.EGG, 1);
|
||||
if (user.hasUnlimited(stack))
|
||||
{
|
||||
user.getInventory().addItem(stack);
|
||||
user.updateInventory();
|
||||
user.getBase().getInventory().addItem(stack);
|
||||
user.getBase().updateInventory();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onPlayerBucketEmpty(final PlayerBucketEmptyEvent event)
|
||||
{
|
||||
@@ -406,18 +436,18 @@ public class EssentialsPlayerListener implements Listener
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
user.updateInventory();
|
||||
user.getBase().updateInventory();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
final String cmd = event.getMessage().toLowerCase(Locale.ENGLISH).split(" ")[0].replace("/", "").toLowerCase(Locale.ENGLISH);
|
||||
if (ess.getSettings().getSocialSpyCommands().contains(cmd))
|
||||
if (ess.getSettings().getSocialSpyCommands().contains(cmd) || ess.getSettings().getSocialSpyCommands().contains("*"))
|
||||
{
|
||||
for (Player onlinePlayer : ess.getServer().getOnlinePlayers())
|
||||
{
|
||||
@@ -434,20 +464,43 @@ public class EssentialsPlayerListener implements Listener
|
||||
user.updateActivity(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onPlayerChangedWorldFlyReset(final PlayerChangedWorldEvent event)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
if (user.getGameMode() != GameMode.CREATIVE && !user.isAuthorized("essentials.fly"))
|
||||
if (user.getBase().getGameMode() != GameMode.CREATIVE && !user.isAuthorized("essentials.fly"))
|
||||
{
|
||||
user.setFallDistance(0f);
|
||||
user.setAllowFlight(false);
|
||||
user.getBase().setFallDistance(0f);
|
||||
user.getBase().setAllowFlight(false);
|
||||
}
|
||||
if (!user.isAuthorized("essentials.speed"))
|
||||
{
|
||||
user.getBase().setFlySpeed(0.1f);
|
||||
user.getBase().setWalkSpeed(0.2f);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (user.getBase().getFlySpeed() > ess.getSettings().getMaxFlySpeed() && !user.isAuthorized("essentials.speed.bypass"))
|
||||
{
|
||||
user.getBase().setFlySpeed((float)ess.getSettings().getMaxFlySpeed());
|
||||
}
|
||||
else
|
||||
{
|
||||
user.getBase().setFlySpeed(user.getBase().getFlySpeed() * 0.99999f);
|
||||
}
|
||||
|
||||
if (user.getBase().getWalkSpeed() > ess.getSettings().getMaxWalkSpeed() && !user.isAuthorized("essentials.speed.bypass"))
|
||||
{
|
||||
user.getBase().setWalkSpeed((float)ess.getSettings().getMaxWalkSpeed());
|
||||
}
|
||||
else
|
||||
{
|
||||
user.getBase().setWalkSpeed(user.getBase().getWalkSpeed() * 0.99999f);
|
||||
}
|
||||
}
|
||||
user.setFlySpeed(0.1f);
|
||||
user.setWalkSpeed(0.2f);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerChangedWorld(final PlayerChangedWorldEvent event)
|
||||
{
|
||||
@@ -457,19 +510,19 @@ public class EssentialsPlayerListener implements Listener
|
||||
updateCompass(user);
|
||||
if (ess.getSettings().getNoGodWorlds().contains(newWorld) && user.isGodModeEnabledRaw())
|
||||
{
|
||||
user.sendMessage(_("noGodWorldWarning"));
|
||||
user.sendMessage(tl("noGodWorldWarning"));
|
||||
}
|
||||
|
||||
|
||||
if (!user.getWorld().getName().equals(newWorld))
|
||||
{
|
||||
user.sendMessage(_("currentWorld", newWorld));
|
||||
user.sendMessage(tl("currentWorld", newWorld));
|
||||
}
|
||||
if (user.isVanished())
|
||||
{
|
||||
user.setVanished(user.isAuthorized("essentials.vanish"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onPlayerInteract(final PlayerInteractEvent event)
|
||||
{
|
||||
@@ -481,8 +534,8 @@ public class EssentialsPlayerListener implements Listener
|
||||
User player = ess.getUser(event.getPlayer());
|
||||
if (player.isAuthorized("essentials.sethome.bed"))
|
||||
{
|
||||
player.setBedSpawnLocation(event.getClickedBlock().getLocation());
|
||||
player.sendMessage(_("bedSet", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ()));
|
||||
player.getBase().setBedSpawnLocation(event.getClickedBlock().getLocation());
|
||||
player.sendMessage(tl("bedSet", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ()));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -518,7 +571,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
try
|
||||
{
|
||||
final Location otarget = LocationUtil.getTarget(user.getBase());
|
||||
|
||||
|
||||
ess.scheduleSyncDelayedTask(
|
||||
new Runnable()
|
||||
{
|
||||
@@ -544,7 +597,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean usePowertools(final User user, final int id)
|
||||
{
|
||||
final List<String> commandList = user.getPowertool(id);
|
||||
@@ -563,7 +616,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
else if (command.startsWith("c:"))
|
||||
{
|
||||
used = true;
|
||||
user.chat(command.substring(2));
|
||||
user.getBase().chat(command.substring(2));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -582,7 +635,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
}
|
||||
return used;
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerPickupItem(final PlayerPickupItemEvent event)
|
||||
{
|
||||
@@ -594,13 +647,14 @@ public class EssentialsPlayerListener implements Listener
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onInventoryClickEvent(final InventoryClickEvent event)
|
||||
{
|
||||
Player refreshPlayer = null;
|
||||
final Inventory top = event.getView().getTopInventory();
|
||||
final InventoryType type = top.getType();
|
||||
|
||||
|
||||
if (type == InventoryType.PLAYER)
|
||||
{
|
||||
final User user = ess.getUser((Player)event.getWhoClicked());
|
||||
@@ -610,10 +664,10 @@ public class EssentialsPlayerListener implements Listener
|
||||
final User invOwner = ess.getUser((Player)invHolder);
|
||||
if (user.isInvSee() && (!user.isAuthorized("essentials.invsee.modify")
|
||||
|| invOwner.isAuthorized("essentials.invsee.preventmodify")
|
||||
|| !invOwner.isOnline()))
|
||||
|| !invOwner.getBase().isOnline()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
user.updateInventory();
|
||||
refreshPlayer = user.getBase();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -623,6 +677,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
if (user.isEnderSee() && (!user.isAuthorized("essentials.enderchest.modify")))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
refreshPlayer = user.getBase();
|
||||
}
|
||||
}
|
||||
else if (type == InventoryType.WORKBENCH)
|
||||
@@ -631,6 +686,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
if (user.isRecipeSee())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
refreshPlayer = user.getBase();
|
||||
}
|
||||
}
|
||||
else if (type == InventoryType.CHEST && top.getSize() == 9)
|
||||
@@ -640,26 +696,41 @@ public class EssentialsPlayerListener implements Listener
|
||||
if (invHolder != null && invHolder instanceof HumanEntity && user.isInvSee())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
refreshPlayer = user.getBase();
|
||||
}
|
||||
}
|
||||
|
||||
if (refreshPlayer != null)
|
||||
{
|
||||
final Player player = refreshPlayer;
|
||||
ess.scheduleSyncDelayedTask(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
player.updateInventory();
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onInventoryCloseEvent(final InventoryCloseEvent event)
|
||||
{
|
||||
Player refreshPlayer = null;
|
||||
final Inventory top = event.getView().getTopInventory();
|
||||
final InventoryType type = top.getType();
|
||||
if (type == InventoryType.PLAYER)
|
||||
{
|
||||
final User user = ess.getUser((Player)event.getPlayer());
|
||||
user.setInvSee(false);
|
||||
user.updateInventory();
|
||||
refreshPlayer = user.getBase();
|
||||
}
|
||||
else if (type == InventoryType.ENDER_CHEST)
|
||||
{
|
||||
final User user = ess.getUser((Player)event.getPlayer());
|
||||
user.setEnderSee(false);
|
||||
user.updateInventory();
|
||||
refreshPlayer = user.getBase();
|
||||
}
|
||||
else if (type == InventoryType.WORKBENCH)
|
||||
{
|
||||
@@ -668,7 +739,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
{
|
||||
user.setRecipeSee(false);
|
||||
event.getView().getTopInventory().clear();
|
||||
user.updateInventory();
|
||||
refreshPlayer = user.getBase();
|
||||
}
|
||||
}
|
||||
else if (type == InventoryType.CHEST && top.getSize() == 9)
|
||||
@@ -678,11 +749,24 @@ public class EssentialsPlayerListener implements Listener
|
||||
{
|
||||
final User user = ess.getUser((Player)event.getPlayer());
|
||||
user.setInvSee(false);
|
||||
user.updateInventory();
|
||||
refreshPlayer = user.getBase();
|
||||
}
|
||||
}
|
||||
|
||||
if (refreshPlayer != null)
|
||||
{
|
||||
final Player player = refreshPlayer;
|
||||
ess.scheduleSyncDelayedTask(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
player.updateInventory();
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerFishEvent(final PlayerFishEvent event)
|
||||
{
|
||||
|
@@ -4,6 +4,7 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -12,7 +13,7 @@ import org.bukkit.entity.Player;
|
||||
public class EssentialsTimer implements Runnable
|
||||
{
|
||||
private final transient IEssentials ess;
|
||||
private final transient Set<String> onlineUsers = new HashSet<String>();
|
||||
private final transient Set<UUID> onlineUsers = new HashSet<UUID>();
|
||||
private transient long lastPoll = System.nanoTime();
|
||||
private final LinkedList<Double> history = new LinkedList<Double>();
|
||||
private int skip1 = 0;
|
||||
@@ -66,7 +67,7 @@ public class EssentialsTimer implements Runnable
|
||||
try
|
||||
{
|
||||
final User user = ess.getUser(player);
|
||||
onlineUsers.add(user.getName());
|
||||
onlineUsers.add(user.getBase().getUniqueId());
|
||||
user.setLastOnlineActivity(currentTime);
|
||||
user.checkActivity();
|
||||
}
|
||||
@@ -77,7 +78,7 @@ public class EssentialsTimer implements Runnable
|
||||
}
|
||||
|
||||
count = 0;
|
||||
final Iterator<String> iterator = onlineUsers.iterator();
|
||||
final Iterator<UUID> iterator = onlineUsers.iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
count++;
|
||||
|
@@ -1,10 +1,11 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.craftbukkit.FakeWorld;
|
||||
import com.earth2me.essentials.settings.Spawns;
|
||||
import com.earth2me.essentials.storage.YamlStorageWriter;
|
||||
import com.earth2me.essentials.utils.StringUtil;
|
||||
import com.google.common.base.Charsets;
|
||||
import java.io.*;
|
||||
import java.math.BigInteger;
|
||||
import java.security.DigestInputStream;
|
||||
@@ -15,14 +16,12 @@ import java.util.logging.Logger;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
public class EssentialsUpgrade
|
||||
{
|
||||
private final static Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
private final static Logger LOGGER = Logger.getLogger("Essentials");
|
||||
private final transient IEssentials ess;
|
||||
private final transient EssentialsConf doneFile;
|
||||
|
||||
@@ -37,46 +36,6 @@ public class EssentialsUpgrade
|
||||
doneFile.load();
|
||||
}
|
||||
|
||||
private void moveWorthValuesToWorthYml()
|
||||
{
|
||||
if (doneFile.getBoolean("moveWorthValuesToWorthYml", false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
final File configFile = new File(ess.getDataFolder(), "config.yml");
|
||||
if (!configFile.exists())
|
||||
{
|
||||
return;
|
||||
}
|
||||
final EssentialsConf conf = new EssentialsConf(configFile);
|
||||
conf.load();
|
||||
final Worth worth = new Worth(ess.getDataFolder());
|
||||
boolean found = false;
|
||||
for (Material mat : Material.values())
|
||||
{
|
||||
final int id = mat.getId();
|
||||
final double value = conf.getDouble("worth-" + id, Double.NaN);
|
||||
if (!Double.isNaN(value))
|
||||
{
|
||||
found = true;
|
||||
worth.setPrice(new ItemStack(mat, 1, (short)0, (byte)0), value);
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
removeLinesFromConfig(configFile, "\\s*#?\\s*worth-[0-9]+.*", "# Worth values have been moved to worth.yml");
|
||||
}
|
||||
doneFile.setProperty("moveWorthValuesToWorthYml", true);
|
||||
doneFile.save();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("upgradingFilesError"), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void moveMotdRulesToFile(String name)
|
||||
{
|
||||
if (doneFile.getBoolean("move" + name + "ToFile", false))
|
||||
@@ -117,7 +76,7 @@ public class EssentialsUpgrade
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("upgradingFilesError"), e);
|
||||
LOGGER.log(Level.SEVERE, tl("upgradingFilesError"), e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,11 +126,11 @@ public class EssentialsUpgrade
|
||||
{
|
||||
if (!file.renameTo(new File(file.getParentFile(), file.getName().concat("." + System.currentTimeMillis() + ".upgradebackup"))))
|
||||
{
|
||||
throw new Exception(_("configFileMoveError"));
|
||||
throw new Exception(tl("configFileMoveError"));
|
||||
}
|
||||
if (!tempFile.renameTo(file))
|
||||
{
|
||||
throw new Exception(_("configFileRenameError"));
|
||||
throw new Exception(tl("configFileRenameError"));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -180,73 +139,6 @@ public class EssentialsUpgrade
|
||||
}
|
||||
}
|
||||
|
||||
private void updateUsersToNewDefaultHome()
|
||||
{
|
||||
if (doneFile.getBoolean("updateUsersToNewDefaultHome", false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
final File userdataFolder = new File(ess.getDataFolder(), "userdata");
|
||||
if (!userdataFolder.exists() || !userdataFolder.isDirectory())
|
||||
{
|
||||
return;
|
||||
}
|
||||
final File[] userFiles = userdataFolder.listFiles();
|
||||
|
||||
for (File file : userFiles)
|
||||
{
|
||||
if (!file.isFile() || !file.getName().endsWith(".yml"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
final EssentialsConf config = new EssentialsConf(file);
|
||||
try
|
||||
{
|
||||
config.load();
|
||||
if (config.hasProperty("home") && !config.hasProperty("home.default"))
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<Object> vals = (List<Object>)config.getProperty("home");
|
||||
if (vals == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
World world = ess.getServer().getWorlds().get(0);
|
||||
if (vals.size() > 5)
|
||||
{
|
||||
world = ess.getServer().getWorld((String)vals.get(5));
|
||||
}
|
||||
if (world != null)
|
||||
{
|
||||
final Location loc = new Location(
|
||||
world,
|
||||
((Number)vals.get(0)).doubleValue(),
|
||||
((Number)vals.get(1)).doubleValue(),
|
||||
((Number)vals.get(2)).doubleValue(),
|
||||
((Number)vals.get(3)).floatValue(),
|
||||
((Number)vals.get(4)).floatValue());
|
||||
|
||||
final String worldName = world.getName().toLowerCase(Locale.ENGLISH);
|
||||
if (worldName != null && !worldName.isEmpty())
|
||||
{
|
||||
config.removeProperty("home");
|
||||
config.setProperty("home.default", worldName);
|
||||
config.setProperty("home.worlds." + worldName, loc);
|
||||
config.forceSave();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (RuntimeException ex)
|
||||
{
|
||||
LOGGER.log(Level.INFO, "File: " + file.toString());
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
doneFile.setProperty("updateUsersToNewDefaultHome", true);
|
||||
doneFile.save();
|
||||
}
|
||||
|
||||
private void updateUsersPowerToolsFormat()
|
||||
{
|
||||
if (doneFile.getBoolean("updateUsersPowerToolsFormat", false))
|
||||
@@ -374,195 +266,6 @@ public class EssentialsUpgrade
|
||||
doneFile.save();
|
||||
}
|
||||
|
||||
private void moveUsersDataToUserdataFolder()
|
||||
{
|
||||
final File usersFile = new File(ess.getDataFolder(), "users.yml");
|
||||
if (!usersFile.exists())
|
||||
{
|
||||
return;
|
||||
}
|
||||
final EssentialsConf usersConfig = new EssentialsConf(usersFile);
|
||||
usersConfig.load();
|
||||
for (String username : usersConfig.getKeys(false))
|
||||
{
|
||||
final User user = new User(new OfflinePlayer(username, ess), ess);
|
||||
final String nickname = usersConfig.getString(username + ".nickname");
|
||||
if (nickname != null && !nickname.isEmpty() && !nickname.equals(username))
|
||||
{
|
||||
user.setNickname(nickname);
|
||||
}
|
||||
final List<String> mails = usersConfig.getStringList(username + ".mail");
|
||||
if (mails != null && !mails.isEmpty())
|
||||
{
|
||||
user.setMails(mails);
|
||||
}
|
||||
if (!user.hasHome())
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<Object> vals = (List<Object>)usersConfig.getProperty(username + ".home");
|
||||
if (vals != null)
|
||||
{
|
||||
World world = ess.getServer().getWorlds().get(0);
|
||||
if (vals.size() > 5)
|
||||
{
|
||||
world = getFakeWorld((String)vals.get(5));
|
||||
}
|
||||
if (world != null)
|
||||
{
|
||||
user.setHome("home", new Location(world,
|
||||
((Number)vals.get(0)).doubleValue(),
|
||||
((Number)vals.get(1)).doubleValue(),
|
||||
((Number)vals.get(2)).doubleValue(),
|
||||
((Number)vals.get(3)).floatValue(),
|
||||
((Number)vals.get(4)).floatValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
usersFile.renameTo(new File(usersFile.getAbsolutePath() + ".old"));
|
||||
}
|
||||
|
||||
private void convertWarps()
|
||||
{
|
||||
final File warpsFolder = new File(ess.getDataFolder(), "warps");
|
||||
if (!warpsFolder.exists())
|
||||
{
|
||||
warpsFolder.mkdirs();
|
||||
}
|
||||
final File[] listOfFiles = warpsFolder.listFiles();
|
||||
if (listOfFiles.length >= 1)
|
||||
{
|
||||
for (int i = 0; i < listOfFiles.length; i++)
|
||||
{
|
||||
final String filename = listOfFiles[i].getName();
|
||||
if (listOfFiles[i].isFile() && filename.endsWith(".dat"))
|
||||
{
|
||||
try
|
||||
{
|
||||
final BufferedReader rx = new BufferedReader(new FileReader(listOfFiles[i]));
|
||||
double x, y, z;
|
||||
float yaw, pitch;
|
||||
String worldName;
|
||||
try
|
||||
{
|
||||
if (!rx.ready())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
x = Double.parseDouble(rx.readLine().trim());
|
||||
if (!rx.ready())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
y = Double.parseDouble(rx.readLine().trim());
|
||||
if (!rx.ready())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
z = Double.parseDouble(rx.readLine().trim());
|
||||
if (!rx.ready())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
yaw = Float.parseFloat(rx.readLine().trim());
|
||||
if (!rx.ready())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
pitch = Float.parseFloat(rx.readLine().trim());
|
||||
worldName = rx.readLine();
|
||||
}
|
||||
finally
|
||||
{
|
||||
rx.close();
|
||||
}
|
||||
World w = null;
|
||||
for (World world : ess.getServer().getWorlds())
|
||||
{
|
||||
if (world.getEnvironment() != World.Environment.NETHER)
|
||||
{
|
||||
w = world;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (worldName != null)
|
||||
{
|
||||
worldName = worldName.trim();
|
||||
World w1 = null;
|
||||
w1 = getFakeWorld(worldName);
|
||||
if (w1 != null)
|
||||
{
|
||||
w = w1;
|
||||
}
|
||||
}
|
||||
final Location loc = new Location(w, x, y, z, yaw, pitch);
|
||||
ess.getWarps().setWarp(filename.substring(0, filename.length() - 4), loc);
|
||||
if (!listOfFiles[i].renameTo(new File(warpsFolder, filename + ".old")))
|
||||
{
|
||||
throw new Exception(_("fileRenameError", filename));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
final File warpFile = new File(ess.getDataFolder(), "warps.txt");
|
||||
if (warpFile.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
final BufferedReader rx = new BufferedReader(new FileReader(warpFile));
|
||||
try
|
||||
{
|
||||
for (String[] parts = new String[0]; rx.ready(); parts = rx.readLine().split(":"))
|
||||
{
|
||||
if (parts.length < 6)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
final String name = parts[0];
|
||||
final double x = Double.parseDouble(parts[1].trim());
|
||||
final double y = Double.parseDouble(parts[2].trim());
|
||||
final double z = Double.parseDouble(parts[3].trim());
|
||||
final float yaw = Float.parseFloat(parts[4].trim());
|
||||
final float pitch = Float.parseFloat(parts[5].trim());
|
||||
if (name.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
World w = null;
|
||||
for (World world : ess.getServer().getWorlds())
|
||||
{
|
||||
if (world.getEnvironment() != World.Environment.NETHER)
|
||||
{
|
||||
w = world;
|
||||
break;
|
||||
}
|
||||
}
|
||||
final Location loc = new Location(w, x, y, z, yaw, pitch);
|
||||
ess.getWarps().setWarp(name, loc);
|
||||
if (!warpFile.renameTo(new File(ess.getDataFolder(), "warps.txt.old")))
|
||||
{
|
||||
throw new Exception(_("fileRenameError", "warps.txt"));
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
rx.close();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sanitizeAllUserFilenames()
|
||||
{
|
||||
if (doneFile.getBoolean("sanitizeAllUserFilenames", false))
|
||||
@@ -591,17 +294,17 @@ public class EssentialsUpgrade
|
||||
final File newFile = new File(listOfFile.getParentFile(), sanitizedFilename);
|
||||
if (!listOfFile.renameTo(tmpFile))
|
||||
{
|
||||
LOGGER.log(Level.WARNING, _("userdataMoveError", filename, sanitizedFilename));
|
||||
LOGGER.log(Level.WARNING, tl("userdataMoveError", filename, sanitizedFilename));
|
||||
continue;
|
||||
}
|
||||
if (newFile.exists())
|
||||
{
|
||||
LOGGER.log(Level.WARNING, _("duplicatedUserdata", filename, sanitizedFilename));
|
||||
LOGGER.log(Level.WARNING, tl("duplicatedUserdata", filename, sanitizedFilename));
|
||||
continue;
|
||||
}
|
||||
if (!tmpFile.renameTo(newFile))
|
||||
{
|
||||
LOGGER.log(Level.WARNING, _("userdataMoveBackError", sanitizedFilename, sanitizedFilename));
|
||||
LOGGER.log(Level.WARNING, tl("userdataMoveBackError", sanitizedFilename, sanitizedFilename));
|
||||
}
|
||||
}
|
||||
doneFile.setProperty("sanitizeAllUserFilenames", true);
|
||||
@@ -711,7 +414,7 @@ public class EssentialsUpgrade
|
||||
}
|
||||
if (!configFile.renameTo(new File(ess.getDataFolder(), "spawn.yml.old")))
|
||||
{
|
||||
throw new Exception(_("fileRenameError", "spawn.yml"));
|
||||
throw new Exception(tl("fileRenameError", "spawn.yml"));
|
||||
}
|
||||
PrintWriter writer = new PrintWriter(configFile);
|
||||
try
|
||||
@@ -758,7 +461,7 @@ public class EssentialsUpgrade
|
||||
}
|
||||
if (!configFile.renameTo(new File(ess.getDataFolder(), "jail.yml.old")))
|
||||
{
|
||||
throw new Exception(_("fileRenameError", "jail.yml"));
|
||||
throw new Exception(tl("fileRenameError", "jail.yml"));
|
||||
}
|
||||
PrintWriter writer = new PrintWriter(configFile);
|
||||
try
|
||||
@@ -791,13 +494,173 @@ public class EssentialsUpgrade
|
||||
doneFile.save();
|
||||
}
|
||||
|
||||
private void uuidFileChange()
|
||||
{
|
||||
if (doneFile.getBoolean("uuidFileChange", false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final File userdir = new File(ess.getDataFolder(), "userdata");
|
||||
if (!userdir.exists())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int countFiles = 0;
|
||||
int countReqFiles = 0;
|
||||
for (String string : userdir.list())
|
||||
{
|
||||
if (!string.endsWith(".yml") || string.length() < 5)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
countFiles++;
|
||||
|
||||
final String name = string.substring(0, string.length() - 4);
|
||||
UUID uuid = null;
|
||||
|
||||
try
|
||||
{
|
||||
uuid = UUID.fromString(name);
|
||||
}
|
||||
catch (IllegalArgumentException ex)
|
||||
{
|
||||
countReqFiles++;
|
||||
}
|
||||
|
||||
if (countFiles > 100)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (countReqFiles < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ess.getLogger().info("#### Starting Essentials UUID userdata conversion in a few seconds. ####");
|
||||
ess.getLogger().info("We recommend you take a backup of your server before upgrading from the old username system.");
|
||||
|
||||
try
|
||||
{
|
||||
Thread.sleep(10000);
|
||||
}
|
||||
catch (InterruptedException ex)
|
||||
{
|
||||
// NOOP
|
||||
}
|
||||
|
||||
uuidFileConvert(ess);
|
||||
|
||||
doneFile.setProperty("uuidFileChange", true);
|
||||
doneFile.save();
|
||||
}
|
||||
|
||||
public static void uuidFileConvert(IEssentials ess)
|
||||
{
|
||||
ess.getLogger().info("Starting Essentials UUID userdata conversion");
|
||||
|
||||
final File userdir = new File(ess.getDataFolder(), "userdata");
|
||||
if (!userdir.exists())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int countFiles = 0;
|
||||
int countFails = 0;
|
||||
int countEssCache = 0;
|
||||
int countBukkit = 0;
|
||||
|
||||
ess.getLogger().info("Found " + userdir.list().length + " files to convert...");
|
||||
|
||||
for (String string : userdir.list())
|
||||
{
|
||||
if (!string.endsWith(".yml") || string.length() < 5)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final int showProgress = countFiles % 250;
|
||||
|
||||
if (showProgress == 0)
|
||||
{
|
||||
ess.getUserMap().getUUIDMap().forceWriteUUIDMap();
|
||||
ess.getLogger().info("Converted " + countFiles + "/" + userdir.list().length);
|
||||
}
|
||||
|
||||
countFiles++;
|
||||
|
||||
final String name = string.substring(0, string.length() - 4);
|
||||
EssentialsUserConf config;
|
||||
UUID uuid = null;
|
||||
try
|
||||
{
|
||||
uuid = UUID.fromString(name);
|
||||
}
|
||||
catch (IllegalArgumentException ex)
|
||||
{
|
||||
File file = new File(userdir, string);
|
||||
EssentialsConf conf = new EssentialsConf(file);
|
||||
conf.load();
|
||||
conf.setProperty("lastAccountName", name);
|
||||
conf.save();
|
||||
|
||||
String uuidString = conf.getString("uuid", null);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
uuid = UUID.fromString(uuidString);
|
||||
countEssCache++;
|
||||
break;
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
if (conf.getBoolean("npc", false))
|
||||
{
|
||||
uuid = UUID.nameUUIDFromBytes(("NPC:" + name).getBytes(Charsets.UTF_8));
|
||||
break;
|
||||
}
|
||||
|
||||
org.bukkit.OfflinePlayer player = ess.getServer().getOfflinePlayer(name);
|
||||
uuid = player.getUniqueId();
|
||||
}
|
||||
|
||||
if (uuid != null)
|
||||
{
|
||||
countBukkit++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (uuid != null)
|
||||
{
|
||||
conf.forceSave();
|
||||
config = new EssentialsUserConf(name, uuid, new File(userdir, uuid + ".yml"));
|
||||
config.convertLegacyFile();
|
||||
ess.getUserMap().trackUUID(uuid, name);
|
||||
continue;
|
||||
}
|
||||
countFails++;
|
||||
}
|
||||
}
|
||||
ess.getUserMap().getUUIDMap().forceWriteUUIDMap();
|
||||
|
||||
ess.getLogger().info("Converted " + countFiles + "/" + countFiles + ". Conversion complete.");
|
||||
ess.getLogger().info("Converted via cache: " + countEssCache + " :: Converted via lookup: " + countBukkit + " :: Failed to convert: " + countFails);
|
||||
ess.getLogger().info("To rerun the conversion type /essentials uuidconvert");
|
||||
}
|
||||
|
||||
public void beforeSettings()
|
||||
{
|
||||
if (!ess.getDataFolder().exists())
|
||||
{
|
||||
ess.getDataFolder().mkdirs();
|
||||
}
|
||||
moveWorthValuesToWorthYml();
|
||||
moveMotdRulesToFile("motd");
|
||||
moveMotdRulesToFile("rules");
|
||||
}
|
||||
@@ -805,14 +668,12 @@ public class EssentialsUpgrade
|
||||
public void afterSettings()
|
||||
{
|
||||
sanitizeAllUserFilenames();
|
||||
updateUsersToNewDefaultHome();
|
||||
moveUsersDataToUserdataFolder();
|
||||
convertWarps();
|
||||
updateUsersPowerToolsFormat();
|
||||
updateUsersHomesFormat();
|
||||
deleteOldItemsCsv();
|
||||
updateSpawnsToNewSpawnsConfig();
|
||||
updateJailsToNewJailsConfig();
|
||||
uuidFileChange();
|
||||
warnMetrics();
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,76 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.io.Files;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
|
||||
public class EssentialsUserConf extends EssentialsConf
|
||||
{
|
||||
final String username;
|
||||
final UUID uuid;
|
||||
|
||||
public EssentialsUserConf(final String username, final UUID uuid, final File configFile)
|
||||
{
|
||||
super(configFile);
|
||||
this.username = username;
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean legacyFileExists()
|
||||
{
|
||||
final File file = new File(configFile.getParentFile(), username + ".yml");
|
||||
return file.exists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void convertLegacyFile()
|
||||
{
|
||||
final File file = new File(configFile.getParentFile(), username + ".yml");
|
||||
try
|
||||
{
|
||||
Files.move(file, new File(configFile.getParentFile(), uuid + ".yml"));
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Bukkit.getLogger().log(Level.WARNING, "Failed to migrate user: " + username, ex);
|
||||
}
|
||||
|
||||
setProperty("lastAccountName", username);
|
||||
}
|
||||
|
||||
private File getAltFile()
|
||||
{
|
||||
final UUID fn = UUID.nameUUIDFromBytes(("OfflinePlayer:" + username.toLowerCase(Locale.ENGLISH)).getBytes(Charsets.UTF_8));
|
||||
return new File(configFile.getParentFile(), fn.toString() + ".yml");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean altFileExists()
|
||||
{
|
||||
if (username.equals(username.toLowerCase()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return getAltFile().exists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void convertAltFile()
|
||||
{
|
||||
try
|
||||
{
|
||||
Files.move(getAltFile(), new File(configFile.getParentFile(), uuid + ".yml"));
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Bukkit.getLogger().log(Level.WARNING, "Failed to migrate user: " + username, ex);
|
||||
}
|
||||
}
|
||||
}
|
@@ -65,7 +65,7 @@ public class ExecuteTimer
|
||||
}
|
||||
|
||||
|
||||
static private class ExecuteRecord
|
||||
private static class ExecuteRecord
|
||||
{
|
||||
private final String mark;
|
||||
private final long time;
|
||||
|
@@ -25,7 +25,7 @@ public class I18n implements net.ess3.api.II18n
|
||||
private final transient ResourceBundle defaultBundle;
|
||||
private final transient Map<String, MessageFormat> messageFormatCache = new HashMap<String, MessageFormat>();
|
||||
private final transient IEssentials ess;
|
||||
private final static Pattern NODOUBLEMARK = Pattern.compile("''");
|
||||
private static final Pattern NODOUBLEMARK = Pattern.compile("''");
|
||||
|
||||
public I18n(final IEssentials ess)
|
||||
{
|
||||
@@ -66,12 +66,12 @@ public class I18n implements net.ess3.api.II18n
|
||||
}
|
||||
catch (MissingResourceException ex)
|
||||
{
|
||||
Logger.getLogger("Minecraft").log(Level.WARNING, String.format("Missing translation key \"%s\" in translation file %s", ex.getKey(), localeBundle.getLocale().toString()), ex);
|
||||
Logger.getLogger("Essentials").log(Level.WARNING, String.format("Missing translation key \"%s\" in translation file %s", ex.getKey(), localeBundle.getLocale().toString()), ex);
|
||||
return defaultBundle.getString(string);
|
||||
}
|
||||
}
|
||||
|
||||
public static String _(final String string, final Object... objects)
|
||||
public static String tl(final String string, final Object... objects)
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
@@ -128,7 +128,7 @@ public class I18n implements net.ess3.api.II18n
|
||||
currentLocale = new Locale(parts[0], parts[1], parts[2]);
|
||||
}
|
||||
ResourceBundle.clearCache();
|
||||
Logger.getLogger("Minecraft").log(Level.INFO, String.format("Using locale %s", currentLocale.toString()));
|
||||
Logger.getLogger("Essentials").log(Level.INFO, String.format("Using locale %s", currentLocale.toString()));
|
||||
customBundle = ResourceBundle.getBundle(MESSAGES, currentLocale, new FileResClassLoader(I18n.class.getClassLoader(), ess));
|
||||
localeBundle = ResourceBundle.getBundle(MESSAGES, currentLocale);
|
||||
}
|
||||
|
@@ -7,6 +7,7 @@ import com.earth2me.essentials.metrics.Metrics;
|
||||
import com.earth2me.essentials.perm.PermissionsHandler;
|
||||
import com.earth2me.essentials.register.payment.Methods;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -27,6 +28,8 @@ public interface IEssentials extends Plugin
|
||||
@Deprecated
|
||||
User getUser(Object base);
|
||||
|
||||
User getUser(UUID base);
|
||||
|
||||
User getUser(String base);
|
||||
|
||||
User getUser(Player base);
|
||||
|
@@ -29,6 +29,10 @@ public interface ISettings extends IConf
|
||||
String getChatFormat(String group);
|
||||
|
||||
int getChatRadius();
|
||||
|
||||
char getChatShout();
|
||||
|
||||
char getChatQuestion();
|
||||
|
||||
BigDecimal getCommandCost(IEssentialsCommand cmd);
|
||||
|
||||
@@ -80,6 +84,8 @@ public interface ISettings extends IConf
|
||||
|
||||
BigDecimal getStartingBalance();
|
||||
|
||||
boolean isTeleportSafetyEnabled();
|
||||
|
||||
double getTeleportCooldown();
|
||||
|
||||
double getTeleportDelay();
|
||||
@@ -195,6 +201,16 @@ public interface ISettings extends IConf
|
||||
Map<String, Object> getListGroupConfig();
|
||||
|
||||
int getMaxNickLength();
|
||||
|
||||
|
||||
int getMaxUserCacheCount();
|
||||
|
||||
boolean allowSilentJoinQuit();
|
||||
|
||||
boolean isCustomJoinMessage();
|
||||
|
||||
String getCustomJoinMessage();
|
||||
|
||||
boolean isCustomQuitMessage();
|
||||
|
||||
String getCustomQuitMessage();
|
||||
}
|
||||
|
@@ -6,8 +6,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import net.ess3.api.ITeleport;
|
||||
import net.ess3.api.MaxMoneyException;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
@@ -21,19 +21,15 @@ public interface IUser
|
||||
|
||||
void healCooldown() throws Exception;
|
||||
|
||||
void giveMoney(BigDecimal value);
|
||||
|
||||
void giveMoney(final BigDecimal value, final CommandSource initiator);
|
||||
@Deprecated
|
||||
void giveMoney(final BigDecimal value, final CommandSender initiator);
|
||||
void giveMoney(BigDecimal value) throws MaxMoneyException;
|
||||
|
||||
void giveMoney(final BigDecimal value, final CommandSource initiator) throws MaxMoneyException;
|
||||
|
||||
void payUser(final User reciever, final BigDecimal value) throws Exception;
|
||||
|
||||
void takeMoney(BigDecimal value);
|
||||
|
||||
void takeMoney(final BigDecimal value, final CommandSource initiator);
|
||||
@Deprecated
|
||||
void takeMoney(final BigDecimal value, final CommandSender initiator);
|
||||
|
||||
boolean canAfford(BigDecimal value);
|
||||
|
||||
@@ -49,7 +45,7 @@ public interface IUser
|
||||
|
||||
BigDecimal getMoney();
|
||||
|
||||
void setMoney(final BigDecimal value);
|
||||
void setMoney(final BigDecimal value) throws MaxMoneyException;
|
||||
|
||||
void setAfk(final boolean set);
|
||||
|
||||
|
@@ -1,11 +1,13 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import com.earth2me.essentials.utils.StringUtil;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@@ -18,13 +20,13 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb
|
||||
private final transient Map<ItemData, String> primaryName = new HashMap<ItemData, String>();
|
||||
private final transient Map<String, Short> durabilities = new HashMap<String, Short>();
|
||||
private final transient ManagedFile file;
|
||||
private final transient Pattern splitPattern = Pattern.compile("[:+',;.]");
|
||||
private final transient Pattern splitPattern = Pattern.compile("((.*)[:+',;.](\\d+))");
|
||||
|
||||
public ItemDb(final IEssentials ess)
|
||||
{
|
||||
this.ess = ess;
|
||||
file = new ManagedFile("items.csv", ess);
|
||||
}
|
||||
public ItemDb(final IEssentials ess)
|
||||
{
|
||||
this.ess = ess;
|
||||
file = new ManagedFile("items.csv", ess);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadConfig()
|
||||
@@ -93,27 +95,31 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb
|
||||
int itemid = 0;
|
||||
String itemname = null;
|
||||
short metaData = 0;
|
||||
String[] parts = splitPattern.split(id);
|
||||
if (id.matches("^\\d+[:+',;.]\\d+$"))
|
||||
Matcher parts = splitPattern.matcher(id);
|
||||
if (parts.matches())
|
||||
{
|
||||
itemid = Integer.parseInt(parts[0]);
|
||||
metaData = Short.parseShort(parts[1]);
|
||||
itemname = parts.group(2);
|
||||
metaData = Short.parseShort(parts.group(3));
|
||||
}
|
||||
else
|
||||
{
|
||||
itemname = id;
|
||||
}
|
||||
|
||||
if (NumberUtil.isInt(itemname))
|
||||
{
|
||||
itemid = Integer.parseInt(itemname);
|
||||
}
|
||||
else if (NumberUtil.isInt(id))
|
||||
{
|
||||
itemid = Integer.parseInt(id);
|
||||
}
|
||||
else if (id.matches("^[^:+',;.]+[:+',;.]\\d+$"))
|
||||
{
|
||||
itemname = parts[0].toLowerCase(Locale.ENGLISH);
|
||||
metaData = Short.parseShort(parts[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemname = id.toLowerCase(Locale.ENGLISH);
|
||||
itemname = itemname.toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
if (itemname != null)
|
||||
if (itemid < 1)
|
||||
{
|
||||
if (items.containsKey(itemname))
|
||||
{
|
||||
@@ -125,19 +131,32 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb
|
||||
}
|
||||
else if (Material.getMaterial(itemname.toUpperCase(Locale.ENGLISH)) != null)
|
||||
{
|
||||
itemid = Material.getMaterial(itemname.toUpperCase(Locale.ENGLISH)).getId();
|
||||
metaData = 0;
|
||||
Material bMaterial = Material.getMaterial(itemname.toUpperCase(Locale.ENGLISH));
|
||||
itemid = bMaterial.getId();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("unknownItemName", id));
|
||||
try
|
||||
{
|
||||
Material bMaterial = Bukkit.getUnsafe().getMaterialFromInternalName(itemname.toLowerCase(Locale.ENGLISH));
|
||||
itemid = bMaterial.getId();
|
||||
}
|
||||
catch (Throwable throwable)
|
||||
{
|
||||
throw new Exception(tl("unknownItemName", itemname), throwable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (itemid < 1)
|
||||
{
|
||||
throw new Exception(tl("unknownItemName", itemname));
|
||||
}
|
||||
|
||||
final Material mat = Material.getMaterial(itemid);
|
||||
if (mat == null)
|
||||
{
|
||||
throw new Exception(_("unknownItemId", itemid));
|
||||
throw new Exception(tl("unknownItemId", itemid));
|
||||
}
|
||||
final ItemStack retval = new ItemStack(mat);
|
||||
retval.setAmount(mat.getMaxStackSize());
|
||||
@@ -152,15 +171,15 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb
|
||||
|
||||
if (args.length < 1)
|
||||
{
|
||||
is.add(user.getItemInHand());
|
||||
is.add(user.getBase().getItemInHand());
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("hand"))
|
||||
{
|
||||
is.add(user.getItemInHand());
|
||||
is.add(user.getBase().getItemInHand());
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("inventory") || args[0].equalsIgnoreCase("invent") || args[0].equalsIgnoreCase("all"))
|
||||
{
|
||||
for (ItemStack stack : user.getInventory().getContents())
|
||||
for (ItemStack stack : user.getBase().getInventory().getContents())
|
||||
{
|
||||
if (stack == null || stack.getType() == Material.AIR)
|
||||
{
|
||||
@@ -171,7 +190,7 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("blocks"))
|
||||
{
|
||||
for (ItemStack stack : user.getInventory().getContents())
|
||||
for (ItemStack stack : user.getBase().getInventory().getContents())
|
||||
{
|
||||
if (stack == null || stack.getTypeId() > 255 || stack.getType() == Material.AIR)
|
||||
{
|
||||
@@ -187,13 +206,13 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb
|
||||
|
||||
if (is.isEmpty() || is.get(0).getType() == Material.AIR)
|
||||
{
|
||||
throw new Exception(_("itemSellAir"));
|
||||
throw new Exception(tl("itemSellAir"));
|
||||
}
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public String names(ItemStack item)
|
||||
{
|
||||
ItemData itemData = new ItemData(item.getTypeId(), item.getDurability());
|
||||
@@ -215,7 +234,7 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb
|
||||
return StringUtil.joinList(", ", nameList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public String name(ItemStack item)
|
||||
{
|
||||
ItemData itemData = new ItemData(item.getTypeId(), item.getDurability());
|
||||
@@ -232,6 +251,7 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
static class ItemData
|
||||
{
|
||||
final private int itemNo;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.storage.AsyncStorageObjectHolder;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
@@ -93,12 +93,12 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
||||
if (getData().getJails() == null || jailName == null
|
||||
|| !getData().getJails().containsKey(jailName.toLowerCase(Locale.ENGLISH)))
|
||||
{
|
||||
throw new Exception(_("jailNotExist"));
|
||||
throw new Exception(tl("jailNotExist"));
|
||||
}
|
||||
Location loc = getData().getJails().get(jailName.toLowerCase(Locale.ENGLISH));
|
||||
if (loc == null || loc.getWorld() == null)
|
||||
{
|
||||
throw new Exception(_("jailNotExist"));
|
||||
throw new Exception(tl("jailNotExist"));
|
||||
}
|
||||
return loc;
|
||||
}
|
||||
@@ -272,11 +272,11 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
||||
{
|
||||
if (ess.getSettings().isDebug())
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()), ex);
|
||||
LOGGER.log(Level.INFO, tl("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()), ex);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()));
|
||||
LOGGER.log(Level.INFO, tl("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -298,14 +298,14 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
||||
{
|
||||
if (ess.getSettings().isDebug())
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()), ex);
|
||||
LOGGER.log(Level.INFO, tl("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()), ex);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()));
|
||||
LOGGER.log(Level.INFO, tl("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()));
|
||||
}
|
||||
}
|
||||
user.sendMessage(_("jailMessage"));
|
||||
user.sendMessage(tl("jailMessage"));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@@ -327,14 +327,14 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
||||
{
|
||||
if (ess.getSettings().isDebug())
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()), ex);
|
||||
LOGGER.log(Level.INFO, tl("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()), ex);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()));
|
||||
LOGGER.log(Level.INFO, tl("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()));
|
||||
}
|
||||
}
|
||||
user.sendMessage(_("jailMessage"));
|
||||
user.sendMessage(tl("jailMessage"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import static com.earth2me.essentials.I18n.capitalCase;
|
||||
import com.earth2me.essentials.Trade.OverflowType;
|
||||
import com.earth2me.essentials.commands.NoChargeException;
|
||||
@@ -41,13 +41,13 @@ public class Kit
|
||||
BigDecimal costPrice = new Trade("kit-" + kitItem.toLowerCase(Locale.ENGLISH), ess).getCommandCost(user);
|
||||
if (costPrice.signum() > 0)
|
||||
{
|
||||
cost = _("kitCost", NumberUtil.displayCurrency(costPrice, ess));
|
||||
cost = tl("kitCost", NumberUtil.displayCurrency(costPrice, ess));
|
||||
}
|
||||
final Map<String, Object> kit = ess.getSettings().getKit(kitItem);
|
||||
|
||||
if (Kit.getNextUse(user, kitItem, kit) != 0)
|
||||
{
|
||||
name = _("kitDelay", name);
|
||||
name = tl("kitDelay", name);
|
||||
}
|
||||
|
||||
list.append(" ").append(name).append(cost);
|
||||
@@ -57,7 +57,7 @@ public class Kit
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(_("kitError"), ex);
|
||||
throw new Exception(tl("kitError"), ex);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -73,12 +73,12 @@ public class Kit
|
||||
}
|
||||
else if (nextUse < 0L)
|
||||
{
|
||||
user.sendMessage(_("kitOnce"));
|
||||
user.sendMessage(tl("kitOnce"));
|
||||
throw new NoChargeException();
|
||||
}
|
||||
else
|
||||
{
|
||||
user.sendMessage(_("kitTimed", DateUtil.formatDateDiff(nextUse)));
|
||||
user.sendMessage(tl("kitTimed", DateUtil.formatDateDiff(nextUse)));
|
||||
throw new NoChargeException();
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public class Kit
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new Exception(_("kitError2"));
|
||||
throw new Exception(tl("kitError2"));
|
||||
}
|
||||
|
||||
// When was the last kit used?
|
||||
@@ -138,7 +138,7 @@ public class Kit
|
||||
{
|
||||
if (kit == null)
|
||||
{
|
||||
throw new Exception(_("kitNotFound"));
|
||||
throw new Exception(tl("kitNotFound"));
|
||||
}
|
||||
try
|
||||
{
|
||||
@@ -162,7 +162,7 @@ public class Kit
|
||||
catch (Exception e)
|
||||
{
|
||||
ess.getLogger().log(Level.WARNING, "Error parsing kit " + kitName + ": " + e.getMessage());
|
||||
throw new Exception(_("kitError2"), e);
|
||||
throw new Exception(tl("kitError2"), e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,11 +204,11 @@ public class Kit
|
||||
final boolean allowOversizedStacks = user.isAuthorized("essentials.oversizedstacks");
|
||||
if (allowOversizedStacks)
|
||||
{
|
||||
overfilled = InventoryWorkaround.addOversizedItems(user.getInventory(), ess.getSettings().getOversizedStackSize(), metaStack.getItemStack());
|
||||
overfilled = InventoryWorkaround.addOversizedItems(user.getBase().getInventory(), ess.getSettings().getOversizedStackSize(), metaStack.getItemStack());
|
||||
}
|
||||
else
|
||||
{
|
||||
overfilled = InventoryWorkaround.addItems(user.getInventory(), metaStack.getItemStack());
|
||||
overfilled = InventoryWorkaround.addItems(user.getBase().getInventory(), metaStack.getItemStack());
|
||||
}
|
||||
for (ItemStack itemStack : overfilled.values())
|
||||
{
|
||||
@@ -223,17 +223,17 @@ public class Kit
|
||||
spew = true;
|
||||
}
|
||||
}
|
||||
user.updateInventory();
|
||||
user.getBase().updateInventory();
|
||||
if (spew)
|
||||
{
|
||||
user.sendMessage(_("kitInvFull"));
|
||||
user.sendMessage(tl("kitInvFull"));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
user.updateInventory();
|
||||
user.getBase().updateInventory();
|
||||
ess.getLogger().log(Level.WARNING, e.getMessage());
|
||||
throw new Exception(_("kitError2"), e);
|
||||
throw new Exception(tl("kitError2"), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import java.io.*;
|
||||
import java.math.BigInteger;
|
||||
import java.security.DigestInputStream;
|
||||
@@ -17,7 +17,7 @@ import org.bukkit.Bukkit;
|
||||
|
||||
public class ManagedFile
|
||||
{
|
||||
private final static int BUFFERSIZE = 1024 * 8;
|
||||
private static final int BUFFERSIZE = 1024 * 8;
|
||||
private final transient File file;
|
||||
|
||||
public ManagedFile(final String filename, final IEssentials ess)
|
||||
@@ -47,7 +47,7 @@ public class ManagedFile
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Bukkit.getLogger().log(Level.SEVERE, _("itemsCsvNotLoaded"), ex);
|
||||
Bukkit.getLogger().log(Level.SEVERE, tl("itemsCsvNotLoaded"), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.textreader.BookInput;
|
||||
import com.earth2me.essentials.textreader.BookPager;
|
||||
import com.earth2me.essentials.textreader.IText;
|
||||
@@ -8,6 +8,9 @@ import com.earth2me.essentials.utils.FormatUtil;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import java.util.logging.Level;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.DyeColor;
|
||||
@@ -22,8 +25,9 @@ import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class MetaItemStack
|
||||
{
|
||||
private final static Map<String, DyeColor> colorMap = new HashMap<String, DyeColor>();
|
||||
private final static Map<String, FireworkEffect.Type> fireworkShape = new HashMap<String, FireworkEffect.Type>();
|
||||
private static final Map<String, DyeColor> colorMap = new HashMap<String, DyeColor>();
|
||||
private static final Map<String, FireworkEffect.Type> fireworkShape = new HashMap<String, FireworkEffect.Type>();
|
||||
|
||||
static
|
||||
{
|
||||
for (DyeColor color : DyeColor.values())
|
||||
@@ -36,7 +40,7 @@ public class MetaItemStack
|
||||
}
|
||||
}
|
||||
private final transient Pattern splitPattern = Pattern.compile("[:+',;.]");
|
||||
private final ItemStack stack;
|
||||
private ItemStack stack;
|
||||
private FireworkEffect.Builder builder = FireworkEffect.builder();
|
||||
private PotionEffectType pEffectType;
|
||||
private PotionEffect pEffect;
|
||||
@@ -93,31 +97,84 @@ public class MetaItemStack
|
||||
completePotion = true;
|
||||
}
|
||||
|
||||
public void parseStringMeta(final CommandSource sender, final boolean allowUnsafe, String[] string, int fromArg, final IEssentials ess) throws Exception
|
||||
public boolean canSpawn(final IEssentials ess)
|
||||
{
|
||||
|
||||
for (int i = fromArg; i < string.length; i++)
|
||||
try
|
||||
{
|
||||
addStringMeta(sender, allowUnsafe, string[i], ess);
|
||||
ess.getServer().getUnsafe().modifyItemStack(stack, "{}");
|
||||
return true;
|
||||
}
|
||||
if (validFirework)
|
||||
catch (NullPointerException npe)
|
||||
{
|
||||
if (!hasMetaPermission(sender, "firework", true, true, ess))
|
||||
if (ess.getSettings().isDebug())
|
||||
{
|
||||
throw new Exception(_("noMetaFirework"));
|
||||
ess.getLogger().log(Level.INFO, "Itemstack is invalid", npe);
|
||||
}
|
||||
FireworkEffect effect = builder.build();
|
||||
FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta();
|
||||
fmeta.addEffect(effect);
|
||||
if (fmeta.getEffects().size() > 1 && !hasMetaPermission(sender, "firework-multiple", true, true, ess))
|
||||
return false;
|
||||
}
|
||||
catch (NoSuchMethodError nsme)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
catch (Throwable throwable)
|
||||
{
|
||||
if (ess.getSettings().isDebug())
|
||||
{
|
||||
throw new Exception(_("multipleCharges"));
|
||||
ess.getLogger().log(Level.INFO, "Itemstack is invalid", throwable);
|
||||
}
|
||||
stack.setItemMeta(fmeta);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void addStringMeta(final CommandSource sender, final boolean allowUnsafe, final String string, final IEssentials ess) throws Exception
|
||||
public void parseStringMeta(final CommandSource sender, final boolean allowUnsafe, String[] string, int fromArg, final IEssentials ess) throws Exception
|
||||
{
|
||||
if (string[fromArg].startsWith("{"))
|
||||
{
|
||||
try
|
||||
{
|
||||
stack = ess.getServer().getUnsafe().modifyItemStack(stack, Joiner.on(' ').join(Arrays.asList(string).subList(fromArg, string.length)));
|
||||
}
|
||||
catch (NullPointerException npe)
|
||||
{
|
||||
if (ess.getSettings().isDebug())
|
||||
{
|
||||
ess.getLogger().log(Level.INFO, "Itemstack is invalid", npe);
|
||||
}
|
||||
}
|
||||
catch (NoSuchMethodError nsme)
|
||||
{
|
||||
throw new Exception(tl("noMetaJson"), nsme);
|
||||
}
|
||||
catch (Throwable throwable)
|
||||
{
|
||||
throw new Exception(throwable.getMessage(), throwable);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = fromArg; i < string.length; i++)
|
||||
{
|
||||
addStringMeta(sender, allowUnsafe, string[i], ess);
|
||||
}
|
||||
if (validFirework)
|
||||
{
|
||||
if (!hasMetaPermission(sender, "firework", true, true, ess))
|
||||
{
|
||||
throw new Exception(tl("noMetaFirework"));
|
||||
}
|
||||
FireworkEffect effect = builder.build();
|
||||
FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta();
|
||||
fmeta.addEffect(effect);
|
||||
if (fmeta.getEffects().size() > 1 && !hasMetaPermission(sender, "firework-multiple", true, true, ess))
|
||||
{
|
||||
throw new Exception(tl("multipleCharges"));
|
||||
}
|
||||
stack.setItemMeta(fmeta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addStringMeta(final CommandSource sender, final boolean allowUnsafe, final String string, final IEssentials ess) throws Exception
|
||||
{
|
||||
final String[] split = splitPattern.split(string, 2);
|
||||
if (split.length < 1)
|
||||
@@ -154,7 +211,7 @@ public class MetaItemStack
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("onlyPlayerSkulls"));
|
||||
throw new Exception(tl("onlyPlayerSkulls"));
|
||||
}
|
||||
}
|
||||
else if (split.length > 1 && split[0].equalsIgnoreCase("book") && stack.getType() == Material.WRITTEN_BOOK
|
||||
@@ -215,7 +272,7 @@ public class MetaItemStack
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("leatherSyntax"));
|
||||
throw new Exception(tl("leatherSyntax"));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -241,14 +298,14 @@ public class MetaItemStack
|
||||
{
|
||||
if (!hasMetaPermission(sender, "firework", true, true, ess))
|
||||
{
|
||||
throw new Exception(_("noMetaFirework"));
|
||||
throw new Exception(tl("noMetaFirework"));
|
||||
}
|
||||
FireworkEffect effect = builder.build();
|
||||
FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta();
|
||||
fmeta.addEffect(effect);
|
||||
if (fmeta.getEffects().size() > 1 && !hasMetaPermission(sender, "firework-multiple", true, true, ess))
|
||||
{
|
||||
throw new Exception(_("multipleCharges"));
|
||||
throw new Exception(tl("multipleCharges"));
|
||||
}
|
||||
stack.setItemMeta(fmeta);
|
||||
builder = FireworkEffect.builder();
|
||||
@@ -265,7 +322,7 @@ public class MetaItemStack
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("invalidFireworkFormat", split[1], split[0]));
|
||||
throw new Exception(tl("invalidFireworkFormat", split[1], split[0]));
|
||||
}
|
||||
}
|
||||
builder.withColor(primaryColors);
|
||||
@@ -280,7 +337,7 @@ public class MetaItemStack
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("invalidFireworkFormat", split[1], split[0]));
|
||||
throw new Exception(tl("invalidFireworkFormat", split[1], split[0]));
|
||||
}
|
||||
if (finalEffect != null)
|
||||
{
|
||||
@@ -299,7 +356,7 @@ public class MetaItemStack
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("invalidFireworkFormat", split[1], split[0]));
|
||||
throw new Exception(tl("invalidFireworkFormat", split[1], split[0]));
|
||||
}
|
||||
}
|
||||
if (!fadeColors.isEmpty())
|
||||
@@ -322,7 +379,7 @@ public class MetaItemStack
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("invalidFireworkFormat", split[1], split[0]));
|
||||
throw new Exception(tl("invalidFireworkFormat", split[1], split[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -351,12 +408,12 @@ public class MetaItemStack
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("noPotionEffectPerm", pEffectType.getName().toLowerCase(Locale.ENGLISH)));
|
||||
throw new Exception(tl("noPotionEffectPerm", pEffectType.getName().toLowerCase(Locale.ENGLISH)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("invalidPotionMeta", split[1]));
|
||||
throw new Exception(tl("invalidPotionMeta", split[1]));
|
||||
}
|
||||
}
|
||||
else if (split[0].equalsIgnoreCase("power") || (allowShortName && split[0].equalsIgnoreCase("p")))
|
||||
@@ -372,7 +429,7 @@ public class MetaItemStack
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("invalidPotionMeta", split[1]));
|
||||
throw new Exception(tl("invalidPotionMeta", split[1]));
|
||||
}
|
||||
}
|
||||
else if (split[0].equalsIgnoreCase("duration") || (allowShortName && split[0].equalsIgnoreCase("d")))
|
||||
@@ -384,7 +441,7 @@ public class MetaItemStack
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("invalidPotionMeta", split[1]));
|
||||
throw new Exception(tl("invalidPotionMeta", split[1]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,7 +451,7 @@ public class MetaItemStack
|
||||
pEffect = pEffectType.createEffect(duration, power);
|
||||
if (pmeta.getCustomEffects().size() > 1 && !hasMetaPermission(sender, "potions.multiple", true, false, ess))
|
||||
{
|
||||
throw new Exception(_("multiplePotionEffects"));
|
||||
throw new Exception(tl("multiplePotionEffects"));
|
||||
}
|
||||
pmeta.addCustomEffect(pEffect, true);
|
||||
stack.setItemMeta(pmeta);
|
||||
@@ -435,7 +492,7 @@ public class MetaItemStack
|
||||
{
|
||||
if (enchantment == null)
|
||||
{
|
||||
throw new Exception(_("enchantmentNotFound"));
|
||||
throw new Exception(tl("enchantmentNotFound"));
|
||||
}
|
||||
try
|
||||
{
|
||||
@@ -489,7 +546,7 @@ public class MetaItemStack
|
||||
|
||||
if (!hasMetaPermission(user, "enchantments." + enchantmentName, true, false))
|
||||
{
|
||||
throw new Exception(_("enchantmentPerm", enchantmentName));
|
||||
throw new Exception(tl("enchantmentPerm", enchantmentName));
|
||||
}
|
||||
return enchantment;
|
||||
}
|
||||
@@ -514,7 +571,7 @@ public class MetaItemStack
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("noMetaPerm", metaPerm));
|
||||
throw new Exception(tl("noMetaPerm", metaPerm));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -53,7 +53,7 @@ public enum Mob
|
||||
MINECART_MOB_SPAWNER("SpawnerMinecart", Enemies.NEUTRAL, EntityType.MINECART_MOB_SPAWNER),
|
||||
ENDERCRYSTAL("EnderCrystal", Enemies.NEUTRAL, EntityType.ENDER_CRYSTAL),
|
||||
EXPERIENCEORB("ExperienceOrb", Enemies.NEUTRAL, EntityType.EXPERIENCE_ORB);
|
||||
public static final Logger logger = Logger.getLogger("Minecraft");
|
||||
public static final Logger logger = Logger.getLogger("Essentials");
|
||||
|
||||
private Mob(String n, Enemies en, String s, EntityType type)
|
||||
{
|
||||
@@ -95,7 +95,7 @@ public enum Mob
|
||||
final Entity entity = world.spawn(loc, (Class<? extends Entity>)this.bukkitType.getEntityClass());
|
||||
if (entity == null)
|
||||
{
|
||||
logger.log(Level.WARNING, _("unableToSpawnMob"));
|
||||
logger.log(Level.WARNING, tl("unableToSpawnMob"));
|
||||
throw new MobException();
|
||||
}
|
||||
return entity;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.utils.StringUtil;
|
||||
import java.util.*;
|
||||
import java.util.logging.Logger;
|
||||
@@ -93,6 +93,7 @@ public enum MobData
|
||||
IRON_SWORD_SKELETON("ironsword", EntityType.SKELETON, Material.IRON_SWORD, true),
|
||||
STONE_SWORD_SKELETON("stonesword", EntityType.SKELETON, Material.STONE_SWORD, false),
|
||||
SWORD_SKELETON("sword", EntityType.SKELETON, Material.STONE_SWORD, true),
|
||||
BOW_SKELETON("bow", EntityType.SKELETON, Material.BOW, true),
|
||||
WHITHER_SKELETON("wither", EntityType.SKELETON, Data.WITHER, true),
|
||||
POWERED_CREEPER("powered", EntityType.CREEPER, Data.ELECTRIFIED, true),
|
||||
ELECTRIC_CREEPER("electric", EntityType.CREEPER, Data.ELECTRIFIED, false),
|
||||
@@ -126,7 +127,7 @@ public enum MobData
|
||||
EXP,
|
||||
SIZE;
|
||||
}
|
||||
public static final Logger logger = Logger.getLogger("Minecraft");
|
||||
public static final Logger logger = Logger.getLogger("Essentials");
|
||||
|
||||
private MobData(String n, Object type, Object value, boolean isPublic)
|
||||
{
|
||||
@@ -232,8 +233,10 @@ public enum MobData
|
||||
}
|
||||
else if (this.value.equals(Data.HORSESADDLE))
|
||||
{
|
||||
((Horse)spawned).setTamed(true);
|
||||
((Horse)spawned).getInventory().setSaddle(new ItemStack(Material.SADDLE, 1));
|
||||
final Horse horse = ((Horse)spawned);
|
||||
horse.setTamed(true);
|
||||
horse.setOwner(target);
|
||||
horse.getInventory().setSaddle(new ItemStack(Material.SADDLE, 1));
|
||||
}
|
||||
else if (this.value.equals(Data.PIGSADDLE))
|
||||
{
|
||||
@@ -271,7 +274,7 @@ public enum MobData
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new Exception(_("sheepMalformedColor"), e);
|
||||
throw new Exception(tl("sheepMalformedColor"), e);
|
||||
}
|
||||
}
|
||||
else if (this.value.equals(Data.EXP))
|
||||
@@ -283,7 +286,7 @@ public enum MobData
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
throw new Exception(_("invalidNumber"), e);
|
||||
throw new Exception(tl("invalidNumber"), e);
|
||||
}
|
||||
}
|
||||
else if (this.value.equals(Data.SIZE))
|
||||
@@ -295,7 +298,7 @@ public enum MobData
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
throw new Exception(_("slimeMalformedSize"), e);
|
||||
throw new Exception(tl("slimeMalformedSize"), e);
|
||||
}
|
||||
}
|
||||
else if (this.value instanceof Horse.Color)
|
||||
|
@@ -1,10 +1,8 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.*;
|
||||
import lombok.Delegate;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.conversations.Conversation;
|
||||
@@ -25,22 +23,31 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
|
||||
public class OfflinePlayer implements Player
|
||||
{
|
||||
private final transient IEssentials ess;
|
||||
private final transient Server server;
|
||||
private transient Location location = new Location(null, 0, 0, 0, 0, 0);
|
||||
private transient World world;
|
||||
private final transient UUID uniqueId = UUID.randomUUID();
|
||||
@Delegate(types = org.bukkit.OfflinePlayer.class)
|
||||
private transient org.bukkit.OfflinePlayer base;
|
||||
private boolean allowFlight = false;
|
||||
private boolean isFlying = false;
|
||||
private String name = null;
|
||||
|
||||
public OfflinePlayer(final String name, final IEssentials ess)
|
||||
public OfflinePlayer(final UUID uuid, final Server server)
|
||||
{
|
||||
this.ess = ess;
|
||||
this.world = ess.getServer().getWorlds().get(0);
|
||||
this.base = ess.getServer().getOfflinePlayer(name);
|
||||
this.server = server;
|
||||
this.world = server.getWorlds().get(0);
|
||||
this.base = server.getOfflinePlayer(uuid);
|
||||
this.name = base.getName();
|
||||
}
|
||||
|
||||
public OfflinePlayer(final String name, final Server server)
|
||||
{
|
||||
this.server = server;
|
||||
this.world = server.getWorlds().get(0);
|
||||
this.base = server.getOfflinePlayer(name);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -180,25 +187,25 @@ public class OfflinePlayer implements Player
|
||||
@Override
|
||||
public int getRemainingAir()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRemainingAir(int i)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumAir()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaximumAir(int i)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -210,245 +217,245 @@ public class OfflinePlayer implements Player
|
||||
@Override
|
||||
public void setSneaking(boolean bln)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInventory()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chat(String string)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getEyeHeight()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getEyeHeight(boolean bln)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Block> getLineOfSight(HashSet<Byte> hs, int i)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getTargetBlock(HashSet<Byte> hs, int i)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Block> getLastTwoTargetBlocks(HashSet<Byte> hs, int i)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireTicks()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFireTicks()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFireTicks(int i)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Server getServer()
|
||||
{
|
||||
return ess == null ? null : ess.getServer();
|
||||
return server;
|
||||
}
|
||||
|
||||
public Vector getMomentum()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
public void setMomentum(Vector vector)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVelocity(Vector vector)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getVelocity()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damage(double d)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damage(double d, Entity entity)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getEyeLocation()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendRawMessage(String string)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getCompassTarget()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumNoDamageTicks()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaximumNoDamageTicks(int i)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLastDamage()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLastDamage(double d)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNoDamageTicks()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNoDamageTicks(int i)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean teleport(Location lctn)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean teleport(Entity entity)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity getPassenger()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setPassenger(Entity entity)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eject()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadData()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSleeping()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSleepTicks()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Entity> getNearbyEntities(double d, double d1, double d2)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDead()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFallDistance()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -459,79 +466,175 @@ public class OfflinePlayer implements Player
|
||||
@Override
|
||||
public void setSleepingIgnored(boolean bln)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSleepingIgnored()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void awardAchievement(Achievement a)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAchievement(Achievement achievement)
|
||||
{
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAchievement(Achievement achievement)
|
||||
{
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void incrementStatistic(Statistic ststc)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decrementStatistic(Statistic statistic) throws IllegalArgumentException
|
||||
{
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void incrementStatistic(Statistic ststc, int i)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decrementStatistic(Statistic statistic, int i) throws IllegalArgumentException
|
||||
{
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStatistic(Statistic statistic, int i) throws IllegalArgumentException
|
||||
{
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatistic(Statistic statistic) throws IllegalArgumentException
|
||||
{
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void incrementStatistic(Statistic ststc, Material mtrl)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decrementStatistic(Statistic statistic, Material material) throws IllegalArgumentException
|
||||
{
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatistic(Statistic statistic, Material material) throws IllegalArgumentException
|
||||
{
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void incrementStatistic(Statistic ststc, Material mtrl, int i)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decrementStatistic(Statistic statistic, Material material, int i) throws IllegalArgumentException
|
||||
{
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStatistic(Statistic statistic, Material material, int i) throws IllegalArgumentException
|
||||
{
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void incrementStatistic(Statistic statistic, EntityType entityType) throws IllegalArgumentException
|
||||
{
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decrementStatistic(Statistic statistic, EntityType entityType) throws IllegalArgumentException
|
||||
{
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatistic(Statistic statistic, EntityType entityType) throws IllegalArgumentException
|
||||
{
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void incrementStatistic(Statistic statistic, EntityType entityType, int i) throws IllegalArgumentException
|
||||
{
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decrementStatistic(Statistic statistic, EntityType entityType, int i)
|
||||
{
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStatistic(Statistic statistic, EntityType entityType, int i)
|
||||
{
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playNote(Location lctn, byte b, byte b1)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBlockChange(Location lctn, Material mtrl, byte b)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBlockChange(Location lctn, int i, byte b)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLastDamageCause(EntityDamageEvent ede)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityDamageEvent getLastDamageCause()
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playEffect(Location lctn, Effect effect, int i)
|
||||
{
|
||||
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||
throw new UnsupportedOperationException(tl("notSupportedYet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -540,12 +643,6 @@ public class OfflinePlayer implements Player
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUniqueId()
|
||||
{
|
||||
return uniqueId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playNote(Location lctn, Instrument i, Note note)
|
||||
{
|
||||
@@ -740,13 +837,12 @@ public class OfflinePlayer implements Player
|
||||
@Override
|
||||
public void setPlayerListName(String name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerListName()
|
||||
{
|
||||
return getName();
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -805,9 +901,10 @@ public class OfflinePlayer implements Player
|
||||
|
||||
void setName(final String name)
|
||||
{
|
||||
if (!this.base.getName().equalsIgnoreCase(name))
|
||||
this.name = base.getName();
|
||||
if (this.name == null)
|
||||
{
|
||||
this.base = ess.getServer().getOfflinePlayer(name);
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -846,7 +943,7 @@ public class OfflinePlayer implements Player
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void playEffect(EntityEffect ee)
|
||||
{
|
||||
@@ -1003,7 +1100,6 @@ public class OfflinePlayer implements Player
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isConversing()
|
||||
{
|
||||
@@ -1057,7 +1153,7 @@ public class OfflinePlayer implements Player
|
||||
{
|
||||
isFlying = arg0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getExpToLevel()
|
||||
{
|
||||
@@ -1160,6 +1256,12 @@ public class OfflinePlayer implements Player
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResourcePack(String s)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxHealth(double i)
|
||||
{
|
||||
@@ -1283,48 +1385,150 @@ public class OfflinePlayer implements Player
|
||||
@Override
|
||||
public void playSound(Location arg0, String arg1, float arg2, float arg3)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHealthScaled()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHealthScaled(boolean arg0)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHealthScale(double arg0) throws IllegalArgumentException
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHealthScale()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeashed()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity getLeashHolder() throws IllegalStateException
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setLeashHolder(Entity arg0)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Projectile> T launchProjectile(Class<? extends T> type, Vector vector)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendSignChange(Location arg0, String[] arg1) throws IllegalArgumentException
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getBedSpawnLocation()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUniqueId()
|
||||
{
|
||||
return base.getUniqueId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOp()
|
||||
{
|
||||
return base.isOp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOp(boolean value)
|
||||
{
|
||||
base.setOp(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline()
|
||||
{
|
||||
return base.isOnline();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBanned()
|
||||
{
|
||||
return base.isBanned();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBanned(boolean banned)
|
||||
{
|
||||
base.setBanned(banned);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWhitelisted()
|
||||
{
|
||||
return base.isWhitelisted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWhitelisted(boolean value)
|
||||
{
|
||||
base.setWhitelisted(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Player getPlayer()
|
||||
{
|
||||
return base.getPlayer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getFirstPlayed()
|
||||
{
|
||||
return base.getFirstPlayed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLastPlayed()
|
||||
{
|
||||
return base.getLastPlayed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPlayedBefore()
|
||||
{
|
||||
return base.hasPlayedBefore();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> serialize()
|
||||
{
|
||||
return base.serialize();
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,9 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import lombok.Delegate;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||
import org.bukkit.entity.Entity;
|
||||
@@ -13,12 +16,6 @@ import org.bukkit.permissions.ServerOperator;
|
||||
|
||||
public class PlayerExtension
|
||||
{
|
||||
@Delegate(types =
|
||||
{
|
||||
Player.class, Entity.class, CommandSender.class, ServerOperator.class,
|
||||
HumanEntity.class, ConfigurationSerializable.class, LivingEntity.class,
|
||||
Permissible.class
|
||||
})
|
||||
protected Player base;
|
||||
|
||||
public PlayerExtension(final Player base)
|
||||
@@ -35,4 +32,17 @@ public class PlayerExtension
|
||||
{
|
||||
return this.base = base;
|
||||
}
|
||||
|
||||
public Server getServer()
|
||||
{
|
||||
return base.getServer();
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
return base.getWorld();
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return base.getLocation();
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.utils.FormatUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -16,7 +16,7 @@ import org.bukkit.entity.Player;
|
||||
public class PlayerList
|
||||
{
|
||||
// Cosmetic list formatting
|
||||
static public String listUsers(final IEssentials ess, final List<User> users, final String seperator)
|
||||
public static String listUsers(final IEssentials ess, final List<User> users, final String seperator)
|
||||
{
|
||||
final StringBuilder groupString = new StringBuilder();
|
||||
Collections.sort(users);
|
||||
@@ -30,11 +30,11 @@ public class PlayerList
|
||||
needComma = true;
|
||||
if (user.isAfk())
|
||||
{
|
||||
groupString.append(_("listAfkTag"));
|
||||
groupString.append(tl("listAfkTag"));
|
||||
}
|
||||
if (user.isHidden())
|
||||
{
|
||||
groupString.append(_("listHiddenTag"));
|
||||
groupString.append(tl("listHiddenTag"));
|
||||
}
|
||||
user.setDisplayNick();
|
||||
groupString.append(user.getDisplayName());
|
||||
@@ -44,7 +44,7 @@ public class PlayerList
|
||||
}
|
||||
|
||||
// Produce a user summary: There are 5 out of maximum 10 players online.
|
||||
static public String listSummary(final IEssentials ess, final boolean showHidden)
|
||||
public static String listSummary(final IEssentials ess, final boolean showHidden)
|
||||
{
|
||||
Server server = ess.getServer();
|
||||
int playerHidden = 0;
|
||||
@@ -58,17 +58,17 @@ public class PlayerList
|
||||
String online;
|
||||
if (showHidden && playerHidden > 0)
|
||||
{
|
||||
online = _("listAmountHidden", server.getOnlinePlayers().length - playerHidden, playerHidden, server.getMaxPlayers());
|
||||
online = tl("listAmountHidden", server.getOnlinePlayers().length - playerHidden, playerHidden, server.getMaxPlayers());
|
||||
}
|
||||
else
|
||||
{
|
||||
online = _("listAmount", server.getOnlinePlayers().length - playerHidden, server.getMaxPlayers());
|
||||
online = tl("listAmount", server.getOnlinePlayers().length - playerHidden, server.getMaxPlayers());
|
||||
}
|
||||
return online;
|
||||
}
|
||||
|
||||
// Build the basic player list, divided by groups.
|
||||
static public Map<String, List<User>> getPlayerLists(final IEssentials ess, final boolean showHidden)
|
||||
public static Map<String, List<User>> getPlayerLists(final IEssentials ess, final boolean showHidden)
|
||||
{
|
||||
Server server = ess.getServer();
|
||||
final Map<String, List<User>> playerList = new HashMap<String, List<User>>();
|
||||
@@ -92,7 +92,7 @@ public class PlayerList
|
||||
}
|
||||
|
||||
// Handle the merging of groups
|
||||
static public List<User> getMergedList(final IEssentials ess, final Map<String, List<User>> playerList, final String groupName)
|
||||
public static List<User> getMergedList(final IEssentials ess, final Map<String, List<User>> playerList, final String groupName)
|
||||
{
|
||||
final Set<String> configGroups = ess.getSettings().getListGroupConfig().keySet();
|
||||
final List<User> users = new ArrayList<User>();
|
||||
@@ -122,7 +122,7 @@ public class PlayerList
|
||||
}
|
||||
|
||||
// Output a playerlist of just a single group, /list <groupname>
|
||||
static public String listGroupUsers(final IEssentials ess, final Map<String, List<User>> playerList, final String groupName) throws Exception
|
||||
public static String listGroupUsers(final IEssentials ess, final Map<String, List<User>> playerList, final String groupName) throws Exception
|
||||
{
|
||||
final List<User> users = getMergedList(ess, playerList, groupName);
|
||||
final List<User> groupUsers = playerList.get(groupName);
|
||||
@@ -132,7 +132,7 @@ public class PlayerList
|
||||
}
|
||||
if (users == null || users.isEmpty())
|
||||
{
|
||||
throw new Exception(_("groupDoesNotExist"));
|
||||
throw new Exception(tl("groupDoesNotExist"));
|
||||
}
|
||||
final StringBuilder displayGroupName = new StringBuilder();
|
||||
displayGroupName.append(Character.toTitleCase(groupName.charAt(0)));
|
||||
@@ -141,10 +141,10 @@ public class PlayerList
|
||||
}
|
||||
|
||||
// Build the output string
|
||||
static public String outputFormat(final String group, final String message)
|
||||
public static String outputFormat(final String group, final String message)
|
||||
{
|
||||
final StringBuilder outputString = new StringBuilder();
|
||||
outputString.append(_("listGroupTag", FormatUtil.replaceFormat(group)));
|
||||
outputString.append(tl("listGroupTag", FormatUtil.replaceFormat(group)));
|
||||
outputString.append(message);
|
||||
return outputString.toString();
|
||||
}
|
||||
|
@@ -116,6 +116,19 @@ public class Potions
|
||||
{
|
||||
Essentials.wrongVersion();
|
||||
}
|
||||
|
||||
try // 1.7 update
|
||||
{
|
||||
POTIONS.put("waterbreathing", PotionEffectType.WATER_BREATHING);
|
||||
ALIASPOTIONS.put("underwaterbreathing", PotionEffectType.WATER_BREATHING);
|
||||
ALIASPOTIONS.put("waterbreath", PotionEffectType.WATER_BREATHING);
|
||||
ALIASPOTIONS.put("underwaterbreath", PotionEffectType.WATER_BREATHING);
|
||||
ALIASPOTIONS.put("air", PotionEffectType.WATER_BREATHING);
|
||||
}
|
||||
catch (java.lang.NoSuchFieldError e)
|
||||
{
|
||||
Essentials.wrongVersion();
|
||||
}
|
||||
}
|
||||
|
||||
public static PotionEffectType getByName(String name)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||
import com.earth2me.essentials.signs.EssentialsSign;
|
||||
import com.earth2me.essentials.signs.Signs;
|
||||
@@ -24,7 +24,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
public class Settings implements net.ess3.api.ISettings
|
||||
{
|
||||
private final transient EssentialsConf config;
|
||||
private final static Logger logger = Logger.getLogger("Minecraft");
|
||||
private static final Logger logger = Logger.getLogger("Essentials");
|
||||
private final transient IEssentials ess;
|
||||
private boolean metricsEnabled = true;
|
||||
|
||||
@@ -94,6 +94,47 @@ public class Settings implements net.ess3.api.ISettings
|
||||
{
|
||||
return chatRadius;
|
||||
}
|
||||
|
||||
// #easteregg
|
||||
private char chatShout = '!';
|
||||
|
||||
private char _getChatShout()
|
||||
{
|
||||
return config.getString("chat.shout", "!").charAt(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char getChatShout()
|
||||
{
|
||||
return chatShout;
|
||||
}
|
||||
|
||||
// #easteregg
|
||||
private char chatQuestion = '?';
|
||||
|
||||
private char _getChatQuestion()
|
||||
{
|
||||
return config.getString("chat.question", "?").charAt(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char getChatQuestion()
|
||||
{
|
||||
return chatQuestion;
|
||||
}
|
||||
|
||||
private boolean teleportSafety;
|
||||
|
||||
public boolean _isTeleportSafetyEnabled()
|
||||
{
|
||||
return config.getBoolean("teleport-safety", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTeleportSafetyEnabled()
|
||||
{
|
||||
return teleportSafety;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTeleportDelay()
|
||||
@@ -192,7 +233,6 @@ public class Settings implements net.ess3.api.ISettings
|
||||
final ConfigurationSection newSection = new MemoryConfiguration();
|
||||
for (String command : section.getKeys(false))
|
||||
{
|
||||
PluginCommand cmd = ess.getServer().getPluginCommand(command);
|
||||
if (command.charAt(0) == '/')
|
||||
{
|
||||
ess.getLogger().warning("Invalid command cost. '" + command + "' should not start with '/'.");
|
||||
@@ -416,6 +456,7 @@ public class Settings implements net.ess3.api.ISettings
|
||||
mFormat = mFormat.replace("{DISPLAYNAME}", "%1$s");
|
||||
mFormat = mFormat.replace("{MESSAGE}", "%2$s");
|
||||
mFormat = mFormat.replace("{GROUP}", "{0}");
|
||||
mFormat = mFormat.replace("{WORLD}", "{1}");
|
||||
mFormat = mFormat.replace("{WORLDNAME}", "{1}");
|
||||
mFormat = mFormat.replace("{SHORTWORLDNAME}", "{2}");
|
||||
mFormat = mFormat.replace("{TEAMPREFIX}", "{3}");
|
||||
@@ -486,6 +527,7 @@ public class Settings implements net.ess3.api.ISettings
|
||||
config.load();
|
||||
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds"));
|
||||
enabledSigns = _getEnabledSigns();
|
||||
teleportSafety = _isTeleportSafetyEnabled();
|
||||
teleportInvulnerabilityTime = _getTeleportInvulnerability();
|
||||
teleportInvulnerability = _isTeleportInvulnerability();
|
||||
disableItemPickupWhileAfk = _getDisableItemPickupWhileAfk();
|
||||
@@ -509,6 +551,8 @@ public class Settings implements net.ess3.api.ISettings
|
||||
disablePrefix = _disablePrefix();
|
||||
disableSuffix = _disableSuffix();
|
||||
chatRadius = _getChatRadius();
|
||||
chatShout = _getChatShout();
|
||||
chatQuestion = _getChatQuestion();
|
||||
commandCosts = _getCommandCosts();
|
||||
socialSpyCommands = _getSocialSpyCommands();
|
||||
warnOnBuildDisallow = _warnOnBuildDisallow();
|
||||
@@ -519,6 +563,11 @@ public class Settings implements net.ess3.api.ISettings
|
||||
economyLog = _isEcoLogEnabled();
|
||||
economyLogUpdate = _isEcoLogUpdateEnabled();
|
||||
economyDisabled = _isEcoDisabled();
|
||||
allowSilentJoin = _isJoinQuitMessagesDisabled();
|
||||
customJoinMessage = _getCustomJoinMessage();
|
||||
isCustomJoinMessage = !customJoinMessage.equals("none");
|
||||
customQuitMessage = _getCustomQuitMessage();
|
||||
isCustomQuitMessage = !customQuitMessage.equals("none");
|
||||
}
|
||||
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
||||
|
||||
@@ -550,7 +599,7 @@ public class Settings implements net.ess3.api.ISettings
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.log(Level.SEVERE, _("unknownItemInList", itemName, "item-spawn-blacklist"));
|
||||
logger.log(Level.SEVERE, tl("unknownItemInList", itemName, "item-spawn-blacklist"));
|
||||
}
|
||||
}
|
||||
return epItemSpwn;
|
||||
@@ -586,7 +635,7 @@ public class Settings implements net.ess3.api.ISettings
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.log(Level.SEVERE, _("unknownItemInList", signName, "enabledSigns"));
|
||||
logger.log(Level.SEVERE, tl("unknownItemInList", signName, "enabledSigns"));
|
||||
continue;
|
||||
}
|
||||
signsEnabled = true;
|
||||
@@ -690,7 +739,7 @@ public class Settings implements net.ess3.api.ISettings
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.log(Level.SEVERE, _("unknownItemInList", itemName, configName));
|
||||
logger.log(Level.SEVERE, tl("unknownItemInList", itemName, configName));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
@@ -707,7 +756,7 @@ public class Settings implements net.ess3.api.ISettings
|
||||
{
|
||||
return config.getBoolean(configName, def);
|
||||
}
|
||||
private final static BigDecimal MAXMONEY = new BigDecimal("10000000000000");
|
||||
private static final BigDecimal MAXMONEY = new BigDecimal("10000000000000");
|
||||
private BigDecimal maxMoney = MAXMONEY;
|
||||
|
||||
private BigDecimal _getMaxMoney()
|
||||
@@ -720,7 +769,7 @@ public class Settings implements net.ess3.api.ISettings
|
||||
{
|
||||
return maxMoney;
|
||||
}
|
||||
private final static BigDecimal MINMONEY = new BigDecimal("-10000000000000");
|
||||
private static final BigDecimal MINMONEY = new BigDecimal("-10000000000000");
|
||||
private BigDecimal minMoney = MINMONEY;
|
||||
|
||||
private BigDecimal _getMinMoney()
|
||||
@@ -1112,6 +1161,56 @@ public class Settings implements net.ess3.api.ISettings
|
||||
{
|
||||
return config.getInt("max-nick-length", 30);
|
||||
}
|
||||
private boolean allowSilentJoin;
|
||||
|
||||
public boolean _isJoinQuitMessagesDisabled()
|
||||
{
|
||||
return config.getBoolean("allow-silent-join-quit");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowSilentJoinQuit()
|
||||
{
|
||||
return allowSilentJoin;
|
||||
}
|
||||
private String customJoinMessage;
|
||||
private boolean isCustomJoinMessage;
|
||||
|
||||
public String _getCustomJoinMessage()
|
||||
{
|
||||
return FormatUtil.replaceFormat(config.getString("custom-join-message", "none"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCustomJoinMessage()
|
||||
{
|
||||
return customJoinMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCustomJoinMessage()
|
||||
{
|
||||
return isCustomJoinMessage;
|
||||
}
|
||||
private String customQuitMessage;
|
||||
private boolean isCustomQuitMessage;
|
||||
|
||||
public String _getCustomQuitMessage()
|
||||
{
|
||||
return FormatUtil.replaceFormat(config.getString("custom-quit-message", "none"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCustomQuitMessage()
|
||||
{
|
||||
return customQuitMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCustomQuitMessage()
|
||||
{
|
||||
return isCustomQuitMessage;
|
||||
}
|
||||
|
||||
// #easteregg
|
||||
@Override
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.Mob.MobException;
|
||||
import com.earth2me.essentials.utils.LocationUtil;
|
||||
import com.earth2me.essentials.utils.StringUtil;
|
||||
@@ -34,7 +34,7 @@ public class SpawnMob
|
||||
}
|
||||
if (availableList.isEmpty())
|
||||
{
|
||||
availableList.add(_("none"));
|
||||
availableList.add(tl("none"));
|
||||
}
|
||||
return StringUtil.joinList(availableList);
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public class SpawnMob
|
||||
final Block block = LocationUtil.getTarget(user.getBase()).getBlock();
|
||||
if (block == null)
|
||||
{
|
||||
throw new Exception(_("unableToSpawnMob"));
|
||||
throw new Exception(tl("unableToSpawnMob"));
|
||||
}
|
||||
spawnmob(ess, server, user.getSource(), user, block.getLocation(), parts, data, mobCount);
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public class SpawnMob
|
||||
if (mobCount > effectiveLimit)
|
||||
{
|
||||
mobCount = effectiveLimit;
|
||||
sender.sendMessage(_("mobSpawnLimit"));
|
||||
sender.sendMessage(tl("mobSpawnLimit"));
|
||||
}
|
||||
|
||||
Mob mob = Mob.fromName(parts.get(0)); // Get the first mob
|
||||
@@ -135,19 +135,19 @@ public class SpawnMob
|
||||
{
|
||||
spawnMob(ess, server, sender, target, sloc, parts, data);
|
||||
}
|
||||
sender.sendMessage(mobCount * parts.size() + " " + mob.name.toLowerCase(Locale.ENGLISH) + mob.suffix + " " + _("spawned"));
|
||||
sender.sendMessage(mobCount * parts.size() + " " + mob.name.toLowerCase(Locale.ENGLISH) + mob.suffix + " " + tl("spawned"));
|
||||
}
|
||||
catch (MobException e1)
|
||||
{
|
||||
throw new Exception(_("unableToSpawnMob"), e1);
|
||||
throw new Exception(tl("unableToSpawnMob"), e1);
|
||||
}
|
||||
catch (NumberFormatException e2)
|
||||
{
|
||||
throw new Exception(_("numberRequired"), e2);
|
||||
throw new Exception(tl("numberRequired"), e2);
|
||||
}
|
||||
catch (NullPointerException np)
|
||||
{
|
||||
throw new Exception(_("soloMob"), np);
|
||||
throw new Exception(tl("soloMob"), np);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,17 +194,17 @@ public class SpawnMob
|
||||
{
|
||||
if (mob == null)
|
||||
{
|
||||
throw new Exception(_("invalidMob"));
|
||||
throw new Exception(tl("invalidMob"));
|
||||
}
|
||||
|
||||
if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase(Locale.ENGLISH)))
|
||||
{
|
||||
throw new Exception(_("disabledToSpawnMob"));
|
||||
throw new Exception(tl("disabledToSpawnMob"));
|
||||
}
|
||||
|
||||
if (sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.spawnmob." + mob.name.toLowerCase(Locale.ENGLISH)))
|
||||
{
|
||||
throw new Exception(_("noPermToSpawnMob"));
|
||||
throw new Exception(tl("noPermToSpawnMob"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,15 +214,7 @@ public class SpawnMob
|
||||
|
||||
if (data.isEmpty())
|
||||
{
|
||||
sender.sendMessage(_("mobDataList", StringUtil.joinList(MobData.getValidHelp(spawned))));
|
||||
}
|
||||
|
||||
MobData newData = MobData.fromData(spawned, data);
|
||||
while (newData != null)
|
||||
{
|
||||
newData.setData(spawned, target.getBase(), data);
|
||||
data = data.replace(newData.getMatched(), "");
|
||||
newData = MobData.fromData(spawned, data);
|
||||
sender.sendMessage(tl("mobDataList", StringUtil.joinList(MobData.getValidHelp(spawned))));
|
||||
}
|
||||
|
||||
if (spawned instanceof Zombie || type == EntityType.SKELETON)
|
||||
@@ -230,7 +222,11 @@ public class SpawnMob
|
||||
if (inputData.contains("armor") || inputData.contains("armour"))
|
||||
{
|
||||
final EntityEquipment invent = ((LivingEntity)spawned).getEquipment();
|
||||
if (inputData.contains("diamond"))
|
||||
if (inputData.contains("noarmor") || inputData.contains("noarmour"))
|
||||
{
|
||||
invent.clear();
|
||||
}
|
||||
else if (inputData.contains("diamond"))
|
||||
{
|
||||
invent.setBoots(new ItemStack(Material.DIAMOND_BOOTS, 1));
|
||||
invent.setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS, 1));
|
||||
@@ -251,10 +247,6 @@ public class SpawnMob
|
||||
invent.setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE, 1));
|
||||
invent.setHelmet(new ItemStack(Material.LEATHER_HELMET, 1));
|
||||
}
|
||||
else if (inputData.contains("no"))
|
||||
{
|
||||
invent.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
invent.setBoots(new ItemStack(Material.IRON_BOOTS, 1));
|
||||
@@ -269,6 +261,14 @@ public class SpawnMob
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MobData newData = MobData.fromData(spawned, data);
|
||||
while (newData != null)
|
||||
{
|
||||
newData.setData(spawned, target.getBase(), data);
|
||||
data = data.replace(newData.getMatched(), "");
|
||||
newData = MobData.fromData(spawned, data);
|
||||
}
|
||||
}
|
||||
|
||||
private static void defaultMobData(final EntityType type, final Entity spawned)
|
||||
|
@@ -1,8 +1,9 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.utils.DateUtil;
|
||||
import com.earth2me.essentials.utils.LocationUtil;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import net.ess3.api.IEssentials;
|
||||
@@ -53,7 +54,7 @@ public class Teleport implements net.ess3.api.ITeleport
|
||||
time.setTimeInMillis(lastTime);
|
||||
time.add(Calendar.SECOND, (int)cooldown);
|
||||
time.add(Calendar.MILLISECOND, (int)((cooldown * 1000.0) % 1000.0));
|
||||
throw new Exception(_("timeBeforeTeleport", DateUtil.formatDateDiff(time.getTimeInMillis())));
|
||||
throw new Exception(tl("timeBeforeTeleport", DateUtil.formatDateDiff(time.getTimeInMillis())));
|
||||
}
|
||||
}
|
||||
// if justCheck is set, don't update lastTeleport; we're just checking
|
||||
@@ -68,7 +69,7 @@ public class Teleport implements net.ess3.api.ITeleport
|
||||
Calendar c = new GregorianCalendar();
|
||||
c.add(Calendar.SECOND, (int)delay);
|
||||
c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0));
|
||||
user.sendMessage(_("dontMoveMessage", DateUtil.formatDateDiff(c.getTimeInMillis())));
|
||||
user.sendMessage(tl("dontMoveMessage", DateUtil.formatDateDiff(c.getTimeInMillis())));
|
||||
}
|
||||
|
||||
//The now function is used when you want to skip tp delay when teleporting someone to a location or player.
|
||||
@@ -79,7 +80,8 @@ public class Teleport implements net.ess3.api.ITeleport
|
||||
{
|
||||
cooldown(false);
|
||||
}
|
||||
now(teleportOwner, new LocationTarget(loc), cause);
|
||||
final ITarget target = new LocationTarget(loc);
|
||||
now(teleportOwner, target, cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,14 +91,40 @@ public class Teleport implements net.ess3.api.ITeleport
|
||||
{
|
||||
cooldown(false);
|
||||
}
|
||||
now(teleportOwner, new PlayerTarget(entity), cause);
|
||||
final ITarget target = new PlayerTarget(entity);
|
||||
now(teleportOwner, target, cause);
|
||||
teleportOwner.sendMessage(tl("teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ()));
|
||||
}
|
||||
|
||||
protected void now(IUser teleportee, ITarget target, TeleportCause cause) throws Exception
|
||||
{
|
||||
cancel(false);
|
||||
teleportee.setLastLocation();
|
||||
teleportee.getBase().teleport(LocationUtil.getSafeDestination(teleportee, target.getLocation()), cause);
|
||||
final Location loc = target.getLocation();
|
||||
|
||||
if (LocationUtil.isBlockUnsafe(loc.getWorld(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()))
|
||||
{
|
||||
if (ess.getSettings().isTeleportSafetyEnabled())
|
||||
{
|
||||
if (teleportee.getBase().isInsideVehicle())
|
||||
{
|
||||
teleportee.getBase().leaveVehicle();
|
||||
}
|
||||
teleportee.getBase().teleport(LocationUtil.getSafeDestination(teleportee, loc), cause);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(tl("unsafeTeleportDestination", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (teleportee.getBase().isInsideVehicle())
|
||||
{
|
||||
teleportee.getBase().leaveVehicle();
|
||||
}
|
||||
teleportee.getBase().teleport(LocationUtil.getRoundedDestination(loc), cause);
|
||||
}
|
||||
}
|
||||
|
||||
//The teleportPlayer function is used when you want to normally teleportPlayer someone to a location or player.
|
||||
@@ -114,48 +142,66 @@ public class Teleport implements net.ess3.api.ITeleport
|
||||
teleport(teleportOwner, new LocationTarget(loc), chargeFor, cause);
|
||||
}
|
||||
|
||||
//This is used when teleporting to a player
|
||||
@Override
|
||||
public void teleport(Player entity, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
teleport(teleportOwner, new PlayerTarget(entity), chargeFor, cause);
|
||||
ITarget target = new PlayerTarget(entity);
|
||||
teleport(teleportOwner, target, chargeFor, cause);
|
||||
teleportOwner.sendMessage(tl("teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ()));
|
||||
}
|
||||
|
||||
//This is used when teleporting to stored location
|
||||
@Override
|
||||
public void teleportPlayer(IUser teleportee, Location loc, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
teleport(teleportee, new LocationTarget(loc), chargeFor, cause);
|
||||
}
|
||||
|
||||
//This is used on /tphere
|
||||
@Override
|
||||
public void teleportPlayer(IUser teleportee, Player entity, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
teleport(teleportee, new PlayerTarget(entity), chargeFor, cause);
|
||||
ITarget target = new PlayerTarget(entity);
|
||||
teleport(teleportee, target, chargeFor, cause);
|
||||
teleportee.sendMessage(tl("teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ()));
|
||||
teleportOwner.sendMessage(tl("teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ()));
|
||||
}
|
||||
|
||||
private void teleport(IUser teleportee, ITarget target, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
double delay = ess.getSettings().getTeleportDelay();
|
||||
|
||||
Trade cashCharge = chargeFor;
|
||||
|
||||
if (chargeFor != null)
|
||||
{
|
||||
chargeFor.isAffordableFor(teleportOwner);
|
||||
|
||||
//This code is to make sure that commandcosts are checked in the initial world, and not in the resulting world.
|
||||
if (!chargeFor.getCommandCost(teleportOwner).equals(BigDecimal.ZERO))
|
||||
{
|
||||
//By converting a command cost to a regular cost, the command cost permission isn't checked when executing the charge after teleport.
|
||||
cashCharge = new Trade(chargeFor.getCommandCost(teleportOwner), ess);
|
||||
}
|
||||
}
|
||||
|
||||
cooldown(true);
|
||||
if (delay <= 0 || teleportOwner.isAuthorized("essentials.teleport.timer.bypass")
|
||||
|| teleportee.isAuthorized("essentials.teleport.timer.bypass"))
|
||||
{
|
||||
cooldown(false);
|
||||
now(teleportee, target, cause);
|
||||
if (chargeFor != null)
|
||||
if (cashCharge != null)
|
||||
{
|
||||
chargeFor.charge(teleportOwner);
|
||||
cashCharge.charge(teleportOwner);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
cancel(false);
|
||||
warnUser(teleportee, delay);
|
||||
initTimer((long)(delay * 1000.0), teleportee, target, chargeFor, cause, false);
|
||||
initTimer((long)(delay * 1000.0), teleportee, target, cashCharge, cause, false);
|
||||
}
|
||||
|
||||
//The respawn function is a wrapper used to handle tp fallback, on /jail and /home
|
||||
@@ -209,7 +255,7 @@ public class Teleport implements net.ess3.api.ITeleport
|
||||
public void warp(IUser teleportee, String warp, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
Location loc = ess.getWarps().getWarp(warp);
|
||||
teleportee.sendMessage(_("warpingTo", warp));
|
||||
teleportee.sendMessage(tl("warpingTo", warp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
||||
teleport(teleportee, new LocationTarget(loc), chargeFor, cause);
|
||||
}
|
||||
|
||||
@@ -217,7 +263,9 @@ public class Teleport implements net.ess3.api.ITeleport
|
||||
@Override
|
||||
public void back(Trade chargeFor) throws Exception
|
||||
{
|
||||
teleport(teleportOwner, new LocationTarget(teleportOwner.getLastLocation()), chargeFor, TeleportCause.COMMAND);
|
||||
final Location loc = teleportOwner.getLastLocation();
|
||||
teleportOwner.sendMessage(tl("backUsageMsg", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
||||
teleport(teleportOwner, new LocationTarget(loc), chargeFor, TeleportCause.COMMAND);
|
||||
}
|
||||
|
||||
//This function is used to throw a user back after a jail sentence
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.IUser;
|
||||
import org.bukkit.Location;
|
||||
@@ -95,36 +95,41 @@ public class TimedTeleport implements Runnable
|
||||
try
|
||||
{
|
||||
teleport.cooldown(false);
|
||||
teleportUser.sendMessage(_("teleportationCommencing"));
|
||||
try
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
teleportOwner.sendMessage(tl("cooldownWithMessage", ex.getMessage()));
|
||||
if (teleportOwner != teleportUser)
|
||||
{
|
||||
if (timer_respawn)
|
||||
{
|
||||
teleport.respawnNow(teleportUser, timer_cause);
|
||||
}
|
||||
else
|
||||
{
|
||||
teleport.now(teleportUser, timer_teleportTarget, timer_cause);
|
||||
}
|
||||
cancelTimer(false);
|
||||
if (timer_chargeFor != null)
|
||||
{
|
||||
timer_chargeFor.charge(teleportOwner);
|
||||
}
|
||||
teleportUser.sendMessage(tl("cooldownWithMessage", ex.getMessage()));
|
||||
}
|
||||
catch (Exception ex)
|
||||
}
|
||||
try
|
||||
{
|
||||
cancelTimer(false);
|
||||
teleportUser.sendMessage(tl("teleportationCommencing"));
|
||||
if (timer_chargeFor != null)
|
||||
{
|
||||
ess.showError(teleportOwner.getSource(), ex, "teleport");
|
||||
timer_chargeFor.isAffordableFor(teleportOwner);
|
||||
}
|
||||
if (timer_respawn)
|
||||
{
|
||||
teleport.respawnNow(teleportUser, timer_cause);
|
||||
}
|
||||
else
|
||||
{
|
||||
teleport.now(teleportUser, timer_teleportTarget, timer_cause);
|
||||
}
|
||||
if (timer_chargeFor != null)
|
||||
{
|
||||
timer_chargeFor.charge(teleportOwner);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
teleportOwner.sendMessage(_("cooldownWithMessage", ex.getMessage()));
|
||||
if (teleportOwner != teleportUser)
|
||||
{
|
||||
teleportUser.sendMessage(_("cooldownWithMessage", ex.getMessage()));
|
||||
}
|
||||
ess.showError(teleportOwner.getSource(), ex, "\\ teleport");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,10 +145,10 @@ public class TimedTeleport implements Runnable
|
||||
ess.getServer().getScheduler().cancelTask(timer_task);
|
||||
if (notifyUser)
|
||||
{
|
||||
teleportOwner.sendMessage(_("pendingTeleportCancelled"));
|
||||
teleportOwner.sendMessage(tl("pendingTeleportCancelled"));
|
||||
if (timer_teleportee != null && !timer_teleportee.equals(teleportOwner.getName()))
|
||||
{
|
||||
ess.getUser(timer_teleportee).sendMessage(_("pendingTeleportCancelled"));
|
||||
ess.getUser(timer_teleportee).sendMessage(tl("pendingTeleportCancelled"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import com.earth2me.essentials.craftbukkit.SetExpFix;
|
||||
import java.io.File;
|
||||
@@ -15,6 +15,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.api.MaxMoneyException;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -98,13 +99,13 @@ public class Trade
|
||||
&& getMoney().signum() > 0
|
||||
&& !user.canAfford(getMoney()))
|
||||
{
|
||||
throw new ChargeException(_("notEnoughMoney"));
|
||||
throw new ChargeException(tl("notEnoughMoney"));
|
||||
}
|
||||
|
||||
if (getItemStack() != null
|
||||
&& !user.getBase().getInventory().containsAtLeast(itemStack, itemStack.getAmount()))
|
||||
{
|
||||
throw new ChargeException(_("missingItems", getItemStack().getAmount(), ess.getItemDb().name(getItemStack())));
|
||||
throw new ChargeException(tl("missingItems", getItemStack().getAmount(), ess.getItemDb().name(getItemStack())));
|
||||
}
|
||||
|
||||
BigDecimal money;
|
||||
@@ -112,22 +113,22 @@ public class Trade
|
||||
&& (money = getCommandCost(user)).signum() > 0
|
||||
&& !user.canAfford(money))
|
||||
{
|
||||
throw new ChargeException(_("notEnoughMoney"));
|
||||
throw new ChargeException(tl("notEnoughMoney"));
|
||||
}
|
||||
|
||||
if (exp != null && exp > 0
|
||||
&& SetExpFix.getTotalExperience(user.getBase()) < exp)
|
||||
{
|
||||
throw new ChargeException(_("notEnoughExperience"));
|
||||
throw new ChargeException(tl("notEnoughExperience"));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean pay(final IUser user)
|
||||
public boolean pay(final IUser user) throws MaxMoneyException
|
||||
{
|
||||
return pay(user, OverflowType.ABORT) == null;
|
||||
}
|
||||
|
||||
public Map<Integer, ItemStack> pay(final IUser user, final OverflowType type)
|
||||
public Map<Integer, ItemStack> pay(final IUser user, final OverflowType type) throws MaxMoneyException
|
||||
{
|
||||
if (getMoney() != null && getMoney().signum() > 0)
|
||||
{
|
||||
@@ -222,7 +223,7 @@ public class Trade
|
||||
}
|
||||
if (!user.canAfford(getMoney()) && getMoney().signum() > 0)
|
||||
{
|
||||
throw new ChargeException(_("notEnoughMoney"));
|
||||
throw new ChargeException(tl("notEnoughMoney"));
|
||||
}
|
||||
user.takeMoney(getMoney());
|
||||
}
|
||||
@@ -234,7 +235,7 @@ public class Trade
|
||||
}
|
||||
if (!user.getBase().getInventory().containsAtLeast(getItemStack(), getItemStack().getAmount()))
|
||||
{
|
||||
throw new ChargeException(_("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " ")));
|
||||
throw new ChargeException(tl("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " ")));
|
||||
}
|
||||
user.getBase().getInventory().removeItem(getItemStack());
|
||||
user.getBase().updateInventory();
|
||||
@@ -244,7 +245,7 @@ public class Trade
|
||||
final BigDecimal cost = getCommandCost(user);
|
||||
if (!user.canAfford(cost) && cost.signum() > 0)
|
||||
{
|
||||
throw new ChargeException(_("notEnoughMoney"));
|
||||
throw new ChargeException(tl("notEnoughMoney"));
|
||||
}
|
||||
user.takeMoney(cost);
|
||||
}
|
||||
@@ -257,7 +258,7 @@ public class Trade
|
||||
final int experience = SetExpFix.getTotalExperience(user.getBase());
|
||||
if (experience < getExperience() && getExperience() > 0)
|
||||
{
|
||||
throw new ChargeException(_("notEnoughExperience"));
|
||||
throw new ChargeException(tl("notEnoughExperience"));
|
||||
}
|
||||
SetExpFix.setTotalExperience(user.getBase(), experience - getExperience());
|
||||
}
|
||||
@@ -340,7 +341,7 @@ public class Trade
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
|
||||
Logger.getLogger("Essentials").log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -428,7 +429,7 @@ public class Trade
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
|
||||
Logger.getLogger("Essentials").log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,7 +443,7 @@ public class Trade
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
|
||||
Logger.getLogger("Essentials").log(Level.SEVERE, null, ex);
|
||||
}
|
||||
fw = null;
|
||||
}
|
||||
|
197
Essentials/src/com/earth2me/essentials/UUIDMap.java
Normal file
197
Essentials/src/com/earth2me/essentials/UUIDMap.java
Normal file
@@ -0,0 +1,197 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.regex.Pattern;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
|
||||
public class UUIDMap
|
||||
{
|
||||
private final transient net.ess3.api.IEssentials ess;
|
||||
private File userList;
|
||||
private final transient Pattern splitPattern = Pattern.compile(",");
|
||||
private static final ExecutorService EXECUTOR_SERVICE = Executors.newSingleThreadExecutor();
|
||||
private final AtomicInteger pendingDiskWrites = new AtomicInteger(0);
|
||||
|
||||
public UUIDMap(final net.ess3.api.IEssentials ess)
|
||||
{
|
||||
this.ess = ess;
|
||||
userList = new File(ess.getDataFolder(), "usermap.csv");
|
||||
|
||||
}
|
||||
|
||||
public void loadAllUsers(final ConcurrentSkipListMap<String, UUID> names, final ConcurrentSkipListMap<UUID, ArrayList<String>> history)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!userList.exists())
|
||||
{
|
||||
userList.createNewFile();
|
||||
}
|
||||
|
||||
final BufferedReader reader = new BufferedReader(new FileReader(userList));
|
||||
try
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
final String line = reader.readLine();
|
||||
if (line == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
final String[] values = splitPattern.split(line);
|
||||
if (values.length == 2)
|
||||
{
|
||||
final String name = values[0];
|
||||
final UUID uuid = UUID.fromString(values[1]);
|
||||
names.put(name, uuid);
|
||||
if (!history.containsKey(uuid))
|
||||
{
|
||||
final ArrayList<String> list = new ArrayList<String>();
|
||||
list.add(name);
|
||||
history.put(uuid, list);
|
||||
}
|
||||
else
|
||||
{
|
||||
final ArrayList<String> list = history.get(uuid);
|
||||
if (!list.contains(name))
|
||||
{
|
||||
list.add(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeUUIDMap()
|
||||
{
|
||||
_writeUUIDMap();
|
||||
}
|
||||
|
||||
public void forceWriteUUIDMap()
|
||||
{
|
||||
try
|
||||
{
|
||||
Future<?> future = _writeUUIDMap();;
|
||||
if (future != null)
|
||||
{
|
||||
future.get();
|
||||
}
|
||||
}
|
||||
catch (InterruptedException ex)
|
||||
{
|
||||
ess.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
|
||||
}
|
||||
catch (ExecutionException ex)
|
||||
{
|
||||
ess.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
public Future<?> _writeUUIDMap()
|
||||
{
|
||||
final ConcurrentSkipListMap<String, UUID> names = ess.getUserMap().getNames().clone();
|
||||
if (names.size() < 1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
pendingDiskWrites.incrementAndGet();
|
||||
Future<?> future = EXECUTOR_SERVICE.submit(new WriteRunner(ess.getDataFolder(), userList, names, pendingDiskWrites));
|
||||
return future;
|
||||
}
|
||||
|
||||
|
||||
private static class WriteRunner implements Runnable
|
||||
{
|
||||
private final File location;
|
||||
private final File endFile;
|
||||
private final ConcurrentSkipListMap<String, UUID> names;
|
||||
private final AtomicInteger pendingDiskWrites;
|
||||
|
||||
private WriteRunner(final File location, final File endFile, final ConcurrentSkipListMap<String, UUID> names, final AtomicInteger pendingDiskWrites)
|
||||
{
|
||||
this.location = location;
|
||||
this.endFile = endFile;
|
||||
this.names = names;
|
||||
this.pendingDiskWrites = pendingDiskWrites;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
synchronized (pendingDiskWrites)
|
||||
{
|
||||
if (pendingDiskWrites.get() > 1)
|
||||
{
|
||||
pendingDiskWrites.decrementAndGet();
|
||||
return;
|
||||
}
|
||||
|
||||
File configFile = null;
|
||||
|
||||
try
|
||||
{
|
||||
configFile = File.createTempFile("usermap", ".tmp.csv", location);
|
||||
|
||||
final BufferedWriter bWriter = new BufferedWriter(new FileWriter(configFile));
|
||||
for (Map.Entry<String, UUID> entry : names.entrySet())
|
||||
{
|
||||
bWriter.write(entry.getKey() + "," + entry.getValue().toString());
|
||||
bWriter.newLine();
|
||||
}
|
||||
|
||||
bWriter.close();
|
||||
Files.move(configFile, endFile);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (configFile != null && configFile.exists())
|
||||
{
|
||||
Files.move(configFile, new File(endFile.getParentFile(), "usermap.bak.csv"));
|
||||
}
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
Bukkit.getLogger().log(Level.SEVERE, ex2.getMessage(), ex2);
|
||||
}
|
||||
Bukkit.getLogger().log(Level.WARNING, ex.getMessage(), ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
pendingDiskWrites.decrementAndGet();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||
import com.earth2me.essentials.register.payment.Method;
|
||||
import com.earth2me.essentials.register.payment.Methods;
|
||||
@@ -13,9 +13,11 @@ import java.util.GregorianCalendar;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.MaxMoneyException;
|
||||
import net.ess3.api.events.AfkStatusChangeEvent;
|
||||
import net.ess3.api.events.UserBalanceUpdateEvent;
|
||||
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;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
@@ -24,7 +26,7 @@ import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class User extends UserData implements Comparable<User>, IReplyTo, net.ess3.api.IUser
|
||||
{
|
||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||
private static final Logger logger = Logger.getLogger("Essentials");
|
||||
private CommandSource replyTo = null;
|
||||
private transient String teleportRequester;
|
||||
private transient boolean teleportRequestHere;
|
||||
@@ -43,15 +45,15 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
private boolean enderSee = false;
|
||||
private transient long teleportInvulnerabilityTimestamp = 0;
|
||||
|
||||
User(final Player base, final IEssentials ess)
|
||||
public User(final Player base, final IEssentials ess)
|
||||
{
|
||||
super(base, ess);
|
||||
teleport = new Teleport(this, ess);
|
||||
if (isAfk())
|
||||
{
|
||||
afkPosition = getLocation();
|
||||
afkPosition = this.getLocation();
|
||||
}
|
||||
if (isOnline())
|
||||
if (this.getBase().isOnline())
|
||||
{
|
||||
lastOnlineActivity = System.currentTimeMillis();
|
||||
}
|
||||
@@ -126,42 +128,35 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
cooldownTime.add(Calendar.MILLISECOND, (int)((cooldown * 1000.0) % 1000.0));
|
||||
if (cooldownTime.after(now) && !isAuthorized("essentials.heal.cooldown.bypass"))
|
||||
{
|
||||
throw new Exception(_("timeBeforeHeal", DateUtil.formatDateDiff(cooldownTime.getTimeInMillis())));
|
||||
throw new Exception(tl("timeBeforeHeal", DateUtil.formatDateDiff(cooldownTime.getTimeInMillis())));
|
||||
}
|
||||
}
|
||||
setLastHealTimestamp(now.getTimeInMillis());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giveMoney(final BigDecimal value)
|
||||
public void giveMoney(final BigDecimal value) throws MaxMoneyException
|
||||
{
|
||||
giveMoney(value, (CommandSource) null);
|
||||
giveMoney(value, (CommandSource)null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giveMoney(final BigDecimal value, final CommandSource initiator)
|
||||
public void giveMoney(final BigDecimal value, final CommandSource initiator) throws MaxMoneyException
|
||||
{
|
||||
if (value.signum() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
setMoney(getMoney().add(value));
|
||||
sendMessage(_("addedToAccount", NumberUtil.displayCurrency(value, ess)));
|
||||
sendMessage(tl("addedToAccount", NumberUtil.displayCurrency(value, ess)));
|
||||
if (initiator != null)
|
||||
{
|
||||
initiator.sendMessage(_("addedToOthersAccount", NumberUtil.displayCurrency(value, ess), this.getDisplayName(), NumberUtil.displayCurrency(getMoney(), ess)));
|
||||
initiator.sendMessage(tl("addedToOthersAccount", NumberUtil.displayCurrency(value, ess), this.getDisplayName(), NumberUtil.displayCurrency(getMoney(), ess)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void giveMoney(final BigDecimal value, final CommandSender initiator)
|
||||
{
|
||||
giveMoney(value, new CommandSource(initiator));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void payUser(final User reciever, final BigDecimal value) throws ChargeException
|
||||
public void payUser(final User reciever, final BigDecimal value) throws ChargeException, MaxMoneyException
|
||||
{
|
||||
if (value.signum() == 0)
|
||||
{
|
||||
@@ -171,19 +166,19 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
{
|
||||
setMoney(getMoney().subtract(value));
|
||||
reciever.setMoney(reciever.getMoney().add(value));
|
||||
sendMessage(_("moneySentTo", NumberUtil.displayCurrency(value, ess), reciever.getDisplayName()));
|
||||
reciever.sendMessage(_("moneyRecievedFrom", NumberUtil.displayCurrency(value, ess), getDisplayName()));
|
||||
sendMessage(tl("moneySentTo", NumberUtil.displayCurrency(value, ess), reciever.getDisplayName()));
|
||||
reciever.sendMessage(tl("moneyRecievedFrom", NumberUtil.displayCurrency(value, ess), getDisplayName()));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ChargeException(_("notEnoughMoney"));
|
||||
throw new ChargeException(tl("notEnoughMoney"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void takeMoney(final BigDecimal value)
|
||||
{
|
||||
takeMoney(value, (CommandSource) null);
|
||||
takeMoney(value, (CommandSource)null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -193,21 +188,21 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
{
|
||||
return;
|
||||
}
|
||||
setMoney(getMoney().subtract(value));
|
||||
sendMessage(_("takenFromAccount", NumberUtil.displayCurrency(value, ess)));
|
||||
try
|
||||
{
|
||||
setMoney(getMoney().subtract(value));
|
||||
}
|
||||
catch (MaxMoneyException ex)
|
||||
{
|
||||
//We shouldn't be able to throw an exception on subtract money
|
||||
}
|
||||
sendMessage(tl("takenFromAccount", NumberUtil.displayCurrency(value, ess)));
|
||||
if (initiator != null)
|
||||
{
|
||||
initiator.sendMessage(_("takenFromOthersAccount", NumberUtil.displayCurrency(value, ess), this.getDisplayName(), NumberUtil.displayCurrency(getMoney(), ess)));
|
||||
initiator.sendMessage(tl("takenFromOthersAccount", NumberUtil.displayCurrency(value, ess), this.getDisplayName(), NumberUtil.displayCurrency(getMoney(), ess)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void takeMoney(final BigDecimal value, final CommandSender initiator)
|
||||
{
|
||||
takeMoney(value, new CommandSource(initiator));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAfford(final BigDecimal cost)
|
||||
{
|
||||
@@ -230,7 +225,19 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
this.base = new OfflinePlayer(getName(), ess);
|
||||
ess.runTaskAsynchronously(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_dispose();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void _dispose()
|
||||
{
|
||||
this.base = new OfflinePlayer(base.getUniqueId(), ess.getServer());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -242,13 +249,13 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
@Override
|
||||
public void setLastLocation()
|
||||
{
|
||||
setLastLocation(getLocation());
|
||||
setLastLocation(this.getLocation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLogoutLocation()
|
||||
{
|
||||
setLogoutLocation(getLocation());
|
||||
setLogoutLocation(this.getLocation());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -298,7 +305,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
suffix = "§r";
|
||||
}
|
||||
|
||||
if (isOp())
|
||||
if (this.getBase().isOp())
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -355,13 +362,13 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
{
|
||||
if (base.isOnline() && ess.getSettings().changeDisplayName())
|
||||
{
|
||||
setDisplayName(getNick(true));
|
||||
this.getBase().setDisplayName(getNick(true));
|
||||
if (ess.getSettings().changePlayerListName())
|
||||
{
|
||||
String name = getNick(false);
|
||||
try
|
||||
{
|
||||
setPlayerListName(name);
|
||||
this.getBase().setPlayerListName(name);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
@@ -374,10 +381,9 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName()
|
||||
{
|
||||
return super.getDisplayName() == null ? super.getName() : super.getDisplayName();
|
||||
return super.getBase().getDisplayName() == null ? super.getBase().getName() : super.getBase().getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -439,7 +445,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMoney(final BigDecimal value)
|
||||
public void setMoney(final BigDecimal value) throws MaxMoneyException
|
||||
{
|
||||
if (ess.getSettings().isEcoDisabled())
|
||||
{
|
||||
@@ -449,6 +455,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
}
|
||||
return;
|
||||
}
|
||||
final BigDecimal oldBalance = _getMoney();
|
||||
if (Methods.hasMethod())
|
||||
{
|
||||
try
|
||||
@@ -465,7 +472,8 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
{
|
||||
}
|
||||
}
|
||||
super.setMoney(value);
|
||||
super.setMoney(value, true);
|
||||
ess.getServer().getPluginManager().callEvent(new UserBalanceUpdateEvent(this.getBase(), oldBalance, value));
|
||||
Trade.log("Update", "Set", "API", getName(), new Trade(value, ess), null, null, null, ess);
|
||||
}
|
||||
|
||||
@@ -477,31 +485,43 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
}
|
||||
if (Methods.hasMethod() && super.getMoney() != value)
|
||||
{
|
||||
super.setMoney(value);
|
||||
try
|
||||
{
|
||||
super.setMoney(value, false);
|
||||
}
|
||||
catch (MaxMoneyException ex)
|
||||
{
|
||||
// We don't want to throw any errors here, just updating a cache
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAfk(final boolean set)
|
||||
{
|
||||
this.setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") ? true : set);
|
||||
final AfkStatusChangeEvent afkEvent = new AfkStatusChangeEvent(this, set);
|
||||
ess.getServer().getPluginManager().callEvent(afkEvent);
|
||||
if (afkEvent.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.getBase().setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") ? true : set);
|
||||
if (set && !isAfk())
|
||||
{
|
||||
afkPosition = getLocation();
|
||||
afkPosition = this.getLocation();
|
||||
}
|
||||
else if (!set && isAfk())
|
||||
{
|
||||
afkPosition = null;
|
||||
}
|
||||
super.setAfk(set);
|
||||
_setAfk(set);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean toggleAfk()
|
||||
{
|
||||
final boolean now = super.toggleAfk();
|
||||
this.setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") ? true : now);
|
||||
return now;
|
||||
setAfk(!isAfk());
|
||||
return isAfk();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -527,7 +547,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
{
|
||||
setJailTimeout(0);
|
||||
setJailed(false);
|
||||
sendMessage(_("haveBeenReleased"));
|
||||
sendMessage(tl("haveBeenReleased"));
|
||||
setJail(null);
|
||||
try
|
||||
{
|
||||
@@ -554,7 +574,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
if (getMuteTimeout() > 0 && getMuteTimeout() < currentTime && isMuted())
|
||||
{
|
||||
setMuteTimeout(0);
|
||||
sendMessage(_("canTalkAgain"));
|
||||
sendMessage(tl("canTalkAgain"));
|
||||
setMuted(false);
|
||||
return true;
|
||||
}
|
||||
@@ -564,10 +584,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
//Returns true if status expired during this check
|
||||
public boolean checkBanTimeout(final long currentTime)
|
||||
{
|
||||
if (getBanTimeout() > 0 && getBanTimeout() < currentTime && isBanned())
|
||||
if (getBanTimeout() > 0 && getBanTimeout() < currentTime && this.getBase().isBanned())
|
||||
{
|
||||
setBanTimeout(0);
|
||||
setBanned(false);
|
||||
this.getBase().setBanned(false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -581,7 +601,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
if (broadcast && !isHidden())
|
||||
{
|
||||
setDisplayNick();
|
||||
final String msg = _("userIsNotAway", getDisplayName());
|
||||
final String msg = tl("userIsNotAway", getDisplayName());
|
||||
if (!msg.isEmpty())
|
||||
{
|
||||
ess.broadcastMessage(this, msg);
|
||||
@@ -597,9 +617,9 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
if (autoafkkick > 0 && lastActivity > 0 && (lastActivity + (autoafkkick * 1000)) < System.currentTimeMillis()
|
||||
&& !isHidden() && !isAuthorized("essentials.kick.exempt") && !isAuthorized("essentials.afk.kickexempt"))
|
||||
{
|
||||
final String kickReason = _("autoAfkKickReason", autoafkkick / 60.0);
|
||||
final String kickReason = tl("autoAfkKickReason", autoafkkick / 60.0);
|
||||
lastActivity = 0;
|
||||
kickPlayer(kickReason);
|
||||
this.getBase().kickPlayer(kickReason);
|
||||
|
||||
|
||||
for (Player player : ess.getServer().getOnlinePlayers())
|
||||
@@ -607,7 +627,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
final User user = ess.getUser(player);
|
||||
if (user.isAuthorized("essentials.kick.notify"))
|
||||
{
|
||||
user.sendMessage(_("playerKicked", Console.NAME, getName(), kickReason));
|
||||
user.sendMessage(tl("playerKicked", Console.NAME, getName(), kickReason));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -618,7 +638,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
if (!isHidden())
|
||||
{
|
||||
setDisplayNick();
|
||||
final String msg = _("userIsAway", getDisplayName());
|
||||
final String msg = tl("userIsAway", getDisplayName());
|
||||
if (!msg.isEmpty())
|
||||
{
|
||||
ess.broadcastMessage(this, msg);
|
||||
@@ -635,7 +655,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
@Override
|
||||
public boolean isGodModeEnabled()
|
||||
{
|
||||
return (super.isGodModeEnabled() && !ess.getSettings().getNoGodWorlds().contains(getLocation().getWorld().getName()))
|
||||
return (super.isGodModeEnabled() && !ess.getSettings().getNoGodWorlds().contains(this.getLocation().getWorld().getName()))
|
||||
|| (isAfk() && ess.getSettings().getFreezeAfkPlayers());
|
||||
}
|
||||
|
||||
@@ -669,7 +689,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
@Override
|
||||
public boolean canBuild()
|
||||
{
|
||||
if (isOp())
|
||||
if (this.getBase().isOp())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -750,7 +770,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
ess.getVanishedPlayers().add(getName());
|
||||
if (isAuthorized("essentials.vanish.effect"))
|
||||
{
|
||||
this.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false));
|
||||
this.getBase().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -763,7 +783,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
ess.getVanishedPlayers().remove(getName());
|
||||
if (isAuthorized("essentials.vanish.effect"))
|
||||
{
|
||||
this.removePotionEffect(PotionEffectType.INVISIBILITY);
|
||||
this.getBase().removePotionEffect(PotionEffectType.INVISIBILITY);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -786,7 +806,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
|
||||
public void updateThrottle()
|
||||
{
|
||||
lastThrottledAction = System.currentTimeMillis();;
|
||||
lastThrottledAction = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public boolean isFlyClickJump()
|
||||
@@ -839,7 +859,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
@Override
|
||||
public int compareTo(final User other)
|
||||
{
|
||||
return FormatUtil.stripFormat(this.getDisplayName()).compareToIgnoreCase(FormatUtil.stripFormat(other.getDisplayName()));
|
||||
return FormatUtil.stripFormat(getDisplayName()).compareToIgnoreCase(FormatUtil.stripFormat(other.getDisplayName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -864,4 +884,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
||||
{
|
||||
return new CommandSource(getBase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return this.getBase().getName();
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import com.earth2me.essentials.utils.StringUtil;
|
||||
import java.io.File;
|
||||
@@ -8,6 +8,7 @@ import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.InvalidWorldException;
|
||||
import net.ess3.api.MaxMoneyException;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -17,7 +18,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
public abstract class UserData extends PlayerExtension implements IConf
|
||||
{
|
||||
protected final transient IEssentials ess;
|
||||
private final EssentialsConf config;
|
||||
private final EssentialsUserConf config;
|
||||
private final File folder;
|
||||
|
||||
protected UserData(Player base, IEssentials ess)
|
||||
@@ -29,14 +30,27 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
{
|
||||
folder.mkdirs();
|
||||
}
|
||||
config = new EssentialsConf(new File(folder, StringUtil.sanitizeFileName(base.getName()) + ".yml"));
|
||||
|
||||
String filename;
|
||||
try
|
||||
{
|
||||
filename = base.getUniqueId().toString();
|
||||
}
|
||||
catch (Throwable ex)
|
||||
{
|
||||
ess.getLogger().warning("Falling back to old username system for " + base.getName());
|
||||
filename = base.getName();
|
||||
}
|
||||
|
||||
config = new EssentialsUserConf(base.getName(), base.getUniqueId(), new File(folder, filename + ".yml"));
|
||||
reloadConfig();
|
||||
}
|
||||
|
||||
public final void reset()
|
||||
{
|
||||
config.forceSave();
|
||||
config.getFile().delete();
|
||||
ess.getUserMap().removeUser(this.getName());
|
||||
ess.getUserMap().removeUser(this.getBase().getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,6 +84,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
nickname = _getNickname();
|
||||
ignoredPlayers = _getIgnoredPlayers();
|
||||
logoutLocation = _getLogoutLocation();
|
||||
lastAccountName = _getLastAccountName();
|
||||
}
|
||||
private BigDecimal money;
|
||||
|
||||
@@ -99,7 +114,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
return money;
|
||||
}
|
||||
|
||||
public void setMoney(BigDecimal value)
|
||||
public void setMoney(BigDecimal value, boolean throwError) throws MaxMoneyException
|
||||
{
|
||||
money = value;
|
||||
BigDecimal maxMoney = ess.getSettings().getMaxMoney();
|
||||
@@ -107,6 +122,10 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
if (money.compareTo(maxMoney) > 0)
|
||||
{
|
||||
money = maxMoney;
|
||||
if (throwError)
|
||||
{
|
||||
throw new MaxMoneyException();
|
||||
}
|
||||
}
|
||||
if (money.compareTo(minMoney) < 0)
|
||||
{
|
||||
@@ -137,6 +156,9 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
}
|
||||
catch (IndexOutOfBoundsException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
return search;
|
||||
}
|
||||
@@ -144,7 +166,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
public Location getHome(String name) throws Exception
|
||||
{
|
||||
String search = getHomeName(name);
|
||||
return config.getLocation("homes." + search, getServer());
|
||||
return config.getLocation("homes." + search, this.getBase().getServer());
|
||||
}
|
||||
|
||||
public Location getHome(final Location world)
|
||||
@@ -158,14 +180,14 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
Location loc;
|
||||
for (String home : getHomes())
|
||||
{
|
||||
loc = config.getLocation("homes." + home, getServer());
|
||||
loc = config.getLocation("homes." + home, this.getBase().getServer());
|
||||
if (world.getWorld() == loc.getWorld())
|
||||
{
|
||||
return loc;
|
||||
}
|
||||
|
||||
}
|
||||
loc = config.getLocation("homes." + getHomes().get(0), getServer());
|
||||
loc = config.getLocation("homes." + getHomes().get(0), this.getBase().getServer());
|
||||
return loc;
|
||||
}
|
||||
catch (InvalidWorldException ex)
|
||||
@@ -203,7 +225,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("invalidHome", search));
|
||||
throw new Exception(tl("invalidHome", search));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +339,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
{
|
||||
try
|
||||
{
|
||||
return config.getLocation("lastlocation", getServer());
|
||||
return config.getLocation("lastlocation", this.getBase().getServer());
|
||||
}
|
||||
catch (InvalidWorldException e)
|
||||
{
|
||||
@@ -346,7 +368,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
{
|
||||
try
|
||||
{
|
||||
return config.getLocation("logoutlocation", getServer());
|
||||
return config.getLocation("logoutlocation", this.getBase().getServer());
|
||||
}
|
||||
catch (InvalidWorldException e)
|
||||
{
|
||||
@@ -729,19 +751,12 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
return afk;
|
||||
}
|
||||
|
||||
public void setAfk(boolean set)
|
||||
public void _setAfk(boolean set)
|
||||
{
|
||||
afk = set;
|
||||
config.setProperty("afk", set);
|
||||
config.save();
|
||||
}
|
||||
|
||||
public boolean toggleAfk()
|
||||
{
|
||||
boolean ret = !isAfk();
|
||||
setAfk(ret);
|
||||
return ret;
|
||||
}
|
||||
private boolean newplayer;
|
||||
private String geolocation;
|
||||
|
||||
@@ -798,6 +813,25 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
{
|
||||
return isNPC;
|
||||
}
|
||||
private String lastAccountName = null;
|
||||
|
||||
public String getLastAccountName()
|
||||
{
|
||||
return lastAccountName;
|
||||
}
|
||||
|
||||
public String _getLastAccountName()
|
||||
{
|
||||
return config.getString("lastAccountName", null);
|
||||
}
|
||||
|
||||
public void setLastAccountName(String lastAccountName)
|
||||
{
|
||||
this.lastAccountName = lastAccountName;
|
||||
config.setProperty("lastAccountName", lastAccountName);
|
||||
config.save();
|
||||
ess.getUserMap().trackUUID(base.getUniqueId(), lastAccountName);
|
||||
}
|
||||
|
||||
public void setNPC(boolean set)
|
||||
{
|
||||
|
@@ -6,26 +6,34 @@ import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.util.concurrent.UncheckedExecutionException;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
import java.util.concurrent.ConcurrentSkipListSet;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class UserMap extends CacheLoader<String, User> implements IConf
|
||||
public class UserMap extends CacheLoader<UUID, User> implements IConf
|
||||
{
|
||||
private final transient IEssentials ess;
|
||||
private final transient Cache<String, User> users;
|
||||
private final transient ConcurrentSkipListSet<String> keys = new ConcurrentSkipListSet<String>();
|
||||
private final transient Cache<UUID, User> users;
|
||||
private final transient ConcurrentSkipListSet<UUID> keys = new ConcurrentSkipListSet<UUID>();
|
||||
private final transient ConcurrentSkipListMap<String, UUID> names = new ConcurrentSkipListMap<String, UUID>();
|
||||
private final transient ConcurrentSkipListMap<UUID, ArrayList<String>> history = new ConcurrentSkipListMap<UUID, ArrayList<String>>();
|
||||
private UUIDMap uuidMap;
|
||||
|
||||
public UserMap(final IEssentials ess)
|
||||
{
|
||||
super();
|
||||
this.ess = ess;
|
||||
users = CacheBuilder.newBuilder().maximumSize(ess.getSettings().getMaxUserCacheCount()).softValues().build(this);
|
||||
loadAllUsersAsync(ess);
|
||||
uuidMap = new UUIDMap(ess);
|
||||
users = CacheBuilder.newBuilder().maximumSize(ess.getSettings().getMaxUserCacheCount()).softValues().build(this);
|
||||
}
|
||||
|
||||
private void loadAllUsersAsync(final IEssentials ess)
|
||||
@@ -35,36 +43,73 @@ public class UserMap extends CacheLoader<String, User> implements IConf
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
final File userdir = new File(ess.getDataFolder(), "userdata");
|
||||
if (!userdir.exists())
|
||||
synchronized (users)
|
||||
{
|
||||
return;
|
||||
}
|
||||
keys.clear();
|
||||
users.invalidateAll();
|
||||
for (String string : userdir.list())
|
||||
{
|
||||
if (!string.endsWith(".yml"))
|
||||
final File userdir = new File(ess.getDataFolder(), "userdata");
|
||||
if (!userdir.exists())
|
||||
{
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
final String name = string.substring(0, string.length() - 4);
|
||||
keys.add(StringUtil.sanitizeFileName(name));
|
||||
keys.clear();
|
||||
names.clear();
|
||||
users.invalidateAll();
|
||||
for (String string : userdir.list())
|
||||
{
|
||||
if (!string.endsWith(".yml"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
final String name = string.substring(0, string.length() - 4);
|
||||
try
|
||||
{
|
||||
keys.add(UUID.fromString(name));
|
||||
}
|
||||
catch (IllegalArgumentException ex)
|
||||
{
|
||||
//Ignore these users till they rejoin.
|
||||
}
|
||||
}
|
||||
uuidMap.loadAllUsers(names, history);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean userExists(final String name)
|
||||
public boolean userExists(final UUID uuid)
|
||||
{
|
||||
return keys.contains(StringUtil.sanitizeFileName(name));
|
||||
return keys.contains(uuid);
|
||||
}
|
||||
|
||||
public User getUser(final String name)
|
||||
{
|
||||
try
|
||||
{
|
||||
return users.get(name);
|
||||
final String sanitizedName = StringUtil.sanitizeFileName(name);
|
||||
if (names.containsKey(sanitizedName))
|
||||
{
|
||||
final UUID uuid = names.get(sanitizedName);
|
||||
return users.get(uuid);
|
||||
}
|
||||
|
||||
for (Player player : ess.getServer().getOnlinePlayers())
|
||||
{
|
||||
String sanitizedPlayer = StringUtil.sanitizeFileName(player.getName());
|
||||
if (sanitizedPlayer.equalsIgnoreCase(sanitizedName))
|
||||
{
|
||||
User user = new User(player, ess);
|
||||
trackUUID(user.getBase().getUniqueId(), user.getName());
|
||||
return new User(player, ess);
|
||||
}
|
||||
}
|
||||
|
||||
final File userFile = getUserFileFromString(sanitizedName);
|
||||
if (userFile.exists())
|
||||
{
|
||||
User user = new User(new OfflinePlayer(sanitizedName, ess.getServer()), ess);
|
||||
trackUUID(user.getBase().getUniqueId(), user.getName());
|
||||
return user;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
catch (ExecutionException ex)
|
||||
{
|
||||
@@ -76,53 +121,84 @@ public class UserMap extends CacheLoader<String, User> implements IConf
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public User load(final String name) throws Exception
|
||||
public User getUser(final UUID uuid)
|
||||
{
|
||||
String sanitizedName = StringUtil.sanitizeFileName(name);
|
||||
if (!sanitizedName.equals(name))
|
||||
try
|
||||
{
|
||||
User user = getUser(sanitizedName);
|
||||
if (user == null)
|
||||
return users.get(uuid);
|
||||
}
|
||||
catch (ExecutionException ex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
catch (UncheckedExecutionException ex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void trackUUID(final UUID uuid, final String name)
|
||||
{
|
||||
if (uuid != null)
|
||||
{
|
||||
keys.add(uuid);
|
||||
if (name != null && name.length() > 0)
|
||||
{
|
||||
throw new Exception("User not found!");
|
||||
}
|
||||
else
|
||||
{
|
||||
return user;
|
||||
final String keyName = StringUtil.sanitizeFileName(name);
|
||||
if (!names.containsKey(keyName) || !names.get(keyName).equals(uuid))
|
||||
{
|
||||
names.put(keyName, uuid);
|
||||
uuidMap.writeUUIDMap();
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Player player : ess.getServer().getOnlinePlayers())
|
||||
}
|
||||
|
||||
@Override
|
||||
public User load(final UUID uuid) throws Exception
|
||||
{
|
||||
Player player = ess.getServer().getPlayer(uuid);
|
||||
if (player != null)
|
||||
{
|
||||
if (player.getName().equalsIgnoreCase(name))
|
||||
{
|
||||
keys.add(sanitizedName);
|
||||
return new User(player, ess);
|
||||
}
|
||||
final User user = new User(player, ess);
|
||||
trackUUID(uuid, user.getName());
|
||||
return user;
|
||||
}
|
||||
final File userFile = getUserFile2(sanitizedName);
|
||||
|
||||
final File userFile = getUserFileFromID(uuid);
|
||||
|
||||
if (userFile.exists())
|
||||
{
|
||||
keys.add(sanitizedName);
|
||||
return new User(new OfflinePlayer(name, ess), ess);
|
||||
player = new OfflinePlayer(uuid, ess.getServer());
|
||||
final User user = new User(player, ess);
|
||||
((OfflinePlayer)player).setName(user.getLastAccountName());
|
||||
trackUUID(uuid, user.getName());
|
||||
return user;
|
||||
}
|
||||
|
||||
throw new Exception("User not found!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadConfig()
|
||||
{
|
||||
getUUIDMap().forceWriteUUIDMap();
|
||||
loadAllUsersAsync(ess);
|
||||
}
|
||||
|
||||
public void removeUser(final String name)
|
||||
{
|
||||
keys.remove(StringUtil.sanitizeFileName(name));
|
||||
users.invalidate(StringUtil.sanitizeFileName(name));
|
||||
users.invalidate(name);
|
||||
UUID uuid = names.get(name);
|
||||
if (uuid != null)
|
||||
{
|
||||
keys.remove(uuid);
|
||||
users.invalidate(uuid);
|
||||
}
|
||||
names.remove(name);
|
||||
names.remove(StringUtil.sanitizeFileName(name));
|
||||
}
|
||||
|
||||
public Set<String> getAllUniqueUsers()
|
||||
public Set<UUID> getAllUniqueUsers()
|
||||
{
|
||||
return Collections.unmodifiableSet(keys);
|
||||
}
|
||||
@@ -132,14 +208,35 @@ public class UserMap extends CacheLoader<String, User> implements IConf
|
||||
return keys.size();
|
||||
}
|
||||
|
||||
public File getUserFile(final String name)
|
||||
public ConcurrentSkipListMap<String, UUID> getNames()
|
||||
{
|
||||
return getUserFile2(StringUtil.sanitizeFileName(name));
|
||||
return names;
|
||||
}
|
||||
|
||||
private File getUserFile2(final String name)
|
||||
public ConcurrentSkipListMap<UUID, ArrayList<String>> getHistory()
|
||||
{
|
||||
return history;
|
||||
}
|
||||
|
||||
public List<String> getUserHistory(final UUID uuid)
|
||||
{
|
||||
return history.get(uuid);
|
||||
}
|
||||
|
||||
public UUIDMap getUUIDMap()
|
||||
{
|
||||
return uuidMap;
|
||||
}
|
||||
|
||||
private File getUserFileFromID(final UUID uuid)
|
||||
{
|
||||
final File userFolder = new File(ess.getDataFolder(), "userdata");
|
||||
return new File(userFolder, name + ".yml");
|
||||
return new File(userFolder, uuid.toString() + ".yml");
|
||||
}
|
||||
|
||||
public File getUserFileFromString(final String name)
|
||||
{
|
||||
final File userFolder = new File(ess.getDataFolder(), "userdata");
|
||||
return new File(userFolder, StringUtil.sanitizeFileName(name) + ".yml");
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.commands.WarpNotFoundException;
|
||||
import com.earth2me.essentials.utils.StringUtil;
|
||||
import java.io.File;
|
||||
@@ -16,7 +16,7 @@ import org.bukkit.Server;
|
||||
|
||||
public class Warps implements IConf, net.ess3.api.IWarps
|
||||
{
|
||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||
private static final Logger logger = Logger.getLogger("Essentials");
|
||||
private final Map<StringIgnoreCase, EssentialsConf> warpPoints = new HashMap<StringIgnoreCase, EssentialsConf>();
|
||||
private final File warpsFolder;
|
||||
private final Server server;
|
||||
@@ -71,7 +71,7 @@ public class Warps implements IConf, net.ess3.api.IWarps
|
||||
File confFile = new File(warpsFolder, filename + ".yml");
|
||||
if (confFile.exists())
|
||||
{
|
||||
throw new Exception(_("similarWarpExist"));
|
||||
throw new Exception(tl("similarWarpExist"));
|
||||
}
|
||||
conf = new EssentialsConf(confFile);
|
||||
warpPoints.put(new StringIgnoreCase(name), conf);
|
||||
@@ -84,7 +84,7 @@ public class Warps implements IConf, net.ess3.api.IWarps
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
throw new IOException(_("invalidWarpName"));
|
||||
throw new IOException(tl("invalidWarpName"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,11 +94,11 @@ public class Warps implements IConf, net.ess3.api.IWarps
|
||||
EssentialsConf conf = warpPoints.get(new StringIgnoreCase(name));
|
||||
if (conf == null)
|
||||
{
|
||||
throw new Exception(_("warpNotExist"));
|
||||
throw new Exception(tl("warpNotExist"));
|
||||
}
|
||||
if (!conf.getFile().delete())
|
||||
{
|
||||
throw new Exception(_("warpDeleteError"));
|
||||
throw new Exception(tl("warpDeleteError"));
|
||||
}
|
||||
warpPoints.remove(new StringIgnoreCase(name));
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public class Warps implements IConf, net.ess3.api.IWarps
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.log(Level.WARNING, _("loadWarpError", filename), ex);
|
||||
logger.log(Level.WARNING, tl("loadWarpError", filename), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,18 +1,18 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
public class Worth implements IConf
|
||||
{
|
||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||
private final EssentialsConf config;
|
||||
|
||||
public Worth(File dataFolder)
|
||||
@@ -26,27 +26,49 @@ public class Worth implements IConf
|
||||
{
|
||||
String itemname = itemStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
|
||||
BigDecimal result;
|
||||
|
||||
//First check for matches with item name
|
||||
result = config.getBigDecimal("worth." + itemname + "." + itemStack.getDurability(), BigDecimal.ONE.negate());
|
||||
if (result.signum() < 0)
|
||||
{
|
||||
result = config.getBigDecimal("worth." + itemname + ".0", BigDecimal.ONE.negate());
|
||||
final ConfigurationSection itemNameMatch = config.getConfigurationSection("worth." + itemname);
|
||||
if (itemNameMatch != null && itemNameMatch.getKeys(false).size() == 1)
|
||||
{
|
||||
result = config.getBigDecimal("worth." + itemname + ".0", BigDecimal.ONE.negate());
|
||||
}
|
||||
}
|
||||
if (result.signum() < 0)
|
||||
{
|
||||
result = config.getBigDecimal("worth." + itemname + ".*", BigDecimal.ONE.negate());
|
||||
}
|
||||
if (result.signum() < 0)
|
||||
{
|
||||
result = config.getBigDecimal("worth." + itemname, BigDecimal.ONE.negate());
|
||||
}
|
||||
|
||||
//Now we should check for item ID
|
||||
if (result.signum() < 0)
|
||||
{
|
||||
result = config.getBigDecimal("worth." + itemStack.getTypeId() + "." + itemStack.getDurability(), BigDecimal.ONE.negate());
|
||||
}
|
||||
}
|
||||
if (result.signum() < 0)
|
||||
{
|
||||
result = config.getBigDecimal("worth." + itemStack.getTypeId() + ".0", BigDecimal.ONE.negate());
|
||||
final ConfigurationSection itemNumberMatch = config.getConfigurationSection("worth." + itemStack.getTypeId());
|
||||
if (itemNumberMatch != null && itemNumberMatch.getKeys(false).size() == 1)
|
||||
{
|
||||
result = config.getBigDecimal("worth." + itemStack.getTypeId() + ".0", BigDecimal.ONE.negate());
|
||||
}
|
||||
}
|
||||
if (result.signum() < 0)
|
||||
{
|
||||
result = config.getBigDecimal("worth." + itemStack.getTypeId() + ".*", BigDecimal.ONE.negate());
|
||||
}
|
||||
if (result.signum() < 0)
|
||||
{
|
||||
result = config.getBigDecimal("worth." + itemStack.getTypeId(), BigDecimal.ONE.negate());
|
||||
}
|
||||
}
|
||||
|
||||
//This is to match the old worth syntax
|
||||
if (result.signum() < 0)
|
||||
{
|
||||
result = config.getBigDecimal("worth-" + itemStack.getTypeId(), BigDecimal.ONE.negate());
|
||||
@@ -62,17 +84,19 @@ public class Worth implements IConf
|
||||
{
|
||||
if (is == null || is.getType() == Material.AIR)
|
||||
{
|
||||
throw new Exception(_("itemSellAir"));
|
||||
throw new Exception(tl("itemSellAir"));
|
||||
}
|
||||
int id = is.getTypeId();
|
||||
int amount = 0;
|
||||
|
||||
if (args.length > 1)
|
||||
{
|
||||
try {
|
||||
try
|
||||
{
|
||||
amount = Integer.parseInt(args[1].replaceAll("[^0-9]", ""));
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
throw new NotEnoughArgumentsException(ex);
|
||||
}
|
||||
if (args[1].startsWith("-"))
|
||||
@@ -86,11 +110,11 @@ public class Worth implements IConf
|
||||
|
||||
if (requireStack && !stack)
|
||||
{
|
||||
throw new Exception(_("itemMustBeStacked"));
|
||||
throw new Exception(tl("itemMustBeStacked"));
|
||||
}
|
||||
|
||||
int max = 0;
|
||||
for (ItemStack s : user.getInventory().getContents())
|
||||
for (ItemStack s : user.getBase().getInventory().getContents())
|
||||
{
|
||||
if (s == null || !s.isSimilar(is))
|
||||
{
|
||||
@@ -116,9 +140,9 @@ public class Worth implements IConf
|
||||
{
|
||||
if (!isBulkSell)
|
||||
{
|
||||
user.sendMessage(_("itemNotEnough2"));
|
||||
user.sendMessage(_("itemNotEnough3"));
|
||||
throw new Exception(_("itemNotEnough1"));
|
||||
user.sendMessage(tl("itemNotEnough2"));
|
||||
user.sendMessage(tl("itemNotEnough3"));
|
||||
throw new Exception(tl("itemNotEnough1"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -1,7 +1,8 @@
|
||||
package com.earth2me.essentials.api;
|
||||
|
||||
import com.earth2me.essentials.EssentialsConf;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.EssentialsUserConf;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import static com.earth2me.essentials.api.Economy.add;
|
||||
import static com.earth2me.essentials.api.Economy.divide;
|
||||
@@ -15,12 +16,15 @@ import static com.earth2me.essentials.api.Economy.setMoney;
|
||||
import static com.earth2me.essentials.api.Economy.substract;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import com.earth2me.essentials.utils.StringUtil;
|
||||
import com.google.common.base.Charsets;
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.MaxMoneyException;
|
||||
|
||||
|
||||
/**
|
||||
@@ -31,7 +35,7 @@ public class Economy
|
||||
public Economy()
|
||||
{
|
||||
}
|
||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||
private static final Logger logger = Logger.getLogger("Essentials");
|
||||
private static IEssentials ess;
|
||||
private static final String noCallBeforeLoad = "Essentials API is called before Essentials is loaded.";
|
||||
public static final MathContext MATH_CONTEXT = MathContext.DECIMAL128;
|
||||
@@ -51,31 +55,20 @@ public class Economy
|
||||
{
|
||||
folder.mkdirs();
|
||||
}
|
||||
EssentialsConf npcConfig = new EssentialsConf(new File(folder, StringUtil.sanitizeFileName(name) + ".yml"));
|
||||
UUID npcUUID = UUID.nameUUIDFromBytes(("NPC:" + name).getBytes(Charsets.UTF_8));
|
||||
EssentialsUserConf npcConfig = new EssentialsUserConf(name, npcUUID, new File(folder, npcUUID.toString() + ".yml"));
|
||||
npcConfig.load();
|
||||
npcConfig.setProperty("npc", true);
|
||||
npcConfig.setProperty("lastAccountName", name);
|
||||
npcConfig.setProperty("money", ess.getSettings().getStartingBalance());
|
||||
npcConfig.forceSave();
|
||||
ess.getUserMap().trackUUID(npcUUID, name);
|
||||
}
|
||||
|
||||
private static void deleteNPC(String name)
|
||||
{
|
||||
File folder = new File(ess.getDataFolder(), "userdata");
|
||||
if (!folder.exists())
|
||||
{
|
||||
folder.mkdirs();
|
||||
}
|
||||
File config = new File(folder, StringUtil.sanitizeFileName(name) + ".yml");
|
||||
EssentialsConf npcConfig = new EssentialsConf(config);
|
||||
npcConfig.load();
|
||||
if (npcConfig.hasProperty("npc") && npcConfig.getBoolean("npc", false))
|
||||
{
|
||||
if (!config.delete())
|
||||
{
|
||||
logger.log(Level.WARNING, _("deleteFileError", config));
|
||||
}
|
||||
ess.getUserMap().removeUser(name);
|
||||
}
|
||||
User user = ess.getUser(name);
|
||||
user.reset();
|
||||
}
|
||||
|
||||
private static User getUserByName(String name)
|
||||
@@ -146,7 +139,14 @@ public class Economy
|
||||
{
|
||||
throw new NoLoanPermittedException();
|
||||
}
|
||||
user.setMoney(balance);
|
||||
try
|
||||
{
|
||||
user.setMoney(balance);
|
||||
}
|
||||
catch (MaxMoneyException ex)
|
||||
{
|
||||
//TODO: Update API to show max balance errors
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials.api;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
|
||||
public class InvalidWorldException extends Exception
|
||||
@@ -9,7 +9,7 @@ public class InvalidWorldException extends Exception
|
||||
|
||||
public InvalidWorldException(final String world)
|
||||
{
|
||||
super(_("invalidWorld"));
|
||||
super(tl("invalidWorld"));
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package com.earth2me.essentials.api;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
|
||||
public class UserDoesNotExistException extends Exception
|
||||
{
|
||||
public UserDoesNotExistException(String name)
|
||||
{
|
||||
super(_("userDoesNotExist", name));
|
||||
super(tl("userDoesNotExist", name));
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.Server;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class Commandafk extends EssentialsCommand
|
||||
//user.sendMessage(_("markedAsNotAway"));
|
||||
if (!user.isHidden())
|
||||
{
|
||||
msg = _("userIsNotAway", user.getDisplayName());
|
||||
msg = tl("userIsNotAway", user.getDisplayName());
|
||||
}
|
||||
user.updateActivity(false);
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class Commandafk extends EssentialsCommand
|
||||
//user.sendMessage(_("markedAsAway"));
|
||||
if (!user.isHidden())
|
||||
{
|
||||
msg = _("userIsAway", user.getDisplayName());
|
||||
msg = tl("userIsAway", user.getDisplayName());
|
||||
}
|
||||
}
|
||||
if (!msg.isEmpty())
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.Server;
|
||||
@@ -18,16 +18,15 @@ public class Commandback extends EssentialsCommand
|
||||
{
|
||||
if (user.getLastLocation() == null)
|
||||
{
|
||||
throw new Exception(_("noLocationFound"));
|
||||
throw new Exception(tl("noLocationFound"));
|
||||
}
|
||||
if (user.getWorld() != user.getLastLocation().getWorld() && ess.getSettings().isWorldTeleportPermissions()
|
||||
&& !user.isAuthorized("essentials.worlds." + user.getLastLocation().getWorld().getName()))
|
||||
{
|
||||
throw new Exception(_("noPerm", "essentials.worlds." + user.getLastLocation().getWorld().getName()));
|
||||
throw new Exception(tl("noPerm", "essentials.worlds." + user.getLastLocation().getWorld().getName()));
|
||||
}
|
||||
final Trade charge = new Trade(this.getName(), ess);
|
||||
charge.isAffordableFor(user);
|
||||
user.sendMessage(_("backUsageMsg"));
|
||||
user.getTeleport().back(charge);
|
||||
throw new NoChargeException();
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.Backup;
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import org.bukkit.Server;
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@ public class Commandbackup extends EssentialsCommand
|
||||
final Backup backup = ess.getBackup();
|
||||
if (backup == null)
|
||||
{
|
||||
throw new Exception(_("backupDisabled"));
|
||||
throw new Exception(tl("backupDisabled"));
|
||||
}
|
||||
final String command = ess.getSettings().getBackupCommand();
|
||||
if (command == null || "".equals(command) || "save-all".equalsIgnoreCase(command))
|
||||
{
|
||||
throw new Exception(_("backupDisabled"));
|
||||
throw new Exception(tl("backupDisabled"));
|
||||
}
|
||||
backup.run();
|
||||
sender.sendMessage(_("backupStarted"));
|
||||
sender.sendMessage(tl("backupStarted"));
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import java.math.BigDecimal;
|
||||
@@ -24,7 +24,7 @@ public class Commandbalance extends EssentialsCommand
|
||||
}
|
||||
|
||||
User target = getPlayer(server, args, 0, true, true);
|
||||
sender.sendMessage(_("balanceOther", target.isHidden() ? target.getName() : target.getDisplayName(), NumberUtil.displayCurrency(target.getMoney(), ess)));
|
||||
sender.sendMessage(tl("balanceOther", target.isHidden() ? target.getName() : target.getDisplayName(), NumberUtil.displayCurrency(target.getMoney(), ess)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,12 +34,12 @@ public class Commandbalance extends EssentialsCommand
|
||||
{
|
||||
final User target = getPlayer(server, args, 0, true, true);
|
||||
final BigDecimal bal = target.getMoney();
|
||||
user.sendMessage(_("balanceOther", target.isHidden() ? target.getName() : target.getDisplayName(), NumberUtil.displayCurrency(bal, ess)));
|
||||
user.sendMessage(tl("balanceOther", target.isHidden() ? target.getName() : target.getDisplayName(), NumberUtil.displayCurrency(bal, ess)));
|
||||
}
|
||||
else if (args.length < 2)
|
||||
{
|
||||
final BigDecimal bal = user.getMoney();
|
||||
user.sendMessage(_("balance", NumberUtil.displayCurrency(bal, ess)));
|
||||
user.sendMessage(tl("balance", NumberUtil.displayCurrency(bal, ess)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.textreader.SimpleTextInput;
|
||||
import com.earth2me.essentials.textreader.TextPager;
|
||||
@@ -13,7 +13,7 @@ import java.util.Map.Entry;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import org.bukkit.Server;
|
||||
|
||||
//TODO: Remove op and replace with perm
|
||||
|
||||
public class Commandbalancetop extends EssentialsCommand
|
||||
{
|
||||
public Commandbalancetop()
|
||||
@@ -39,7 +39,8 @@ public class Commandbalancetop extends EssentialsCommand
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("force") && sender.getSender().isOp())
|
||||
if (args[0].equalsIgnoreCase("force")
|
||||
&& (!sender.isPlayer() || ess.getUser(sender.getPlayer()).isAuthorized("essentials.balancetop.force")))
|
||||
{
|
||||
force = true;
|
||||
}
|
||||
@@ -57,7 +58,7 @@ public class Commandbalancetop extends EssentialsCommand
|
||||
}
|
||||
if (ess.getUserMap().getUniqueUsers() > MINUSERS)
|
||||
{
|
||||
sender.sendMessage(_("orderBalances", ess.getUserMap().getUniqueUsers()));
|
||||
sender.sendMessage(tl("orderBalances", ess.getUserMap().getUniqueUsers()));
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -70,7 +71,7 @@ public class Commandbalancetop extends EssentialsCommand
|
||||
{
|
||||
if (ess.getUserMap().getUniqueUsers() > MINUSERS)
|
||||
{
|
||||
sender.sendMessage(_("orderBalances", ess.getUserMap().getUniqueUsers()));
|
||||
sender.sendMessage(tl("orderBalances", ess.getUserMap().getUniqueUsers()));
|
||||
}
|
||||
ess.runTaskAsynchronously(new Viewer(sender, page, force));
|
||||
}
|
||||
@@ -82,7 +83,7 @@ public class Commandbalancetop extends EssentialsCommand
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(cacheage);
|
||||
final DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
|
||||
sender.sendMessage(_("balanceTop", format.format(cal.getTime())));
|
||||
sender.sendMessage(tl("balanceTop", format.format(cal.getTime())));
|
||||
new TextPager(cache).showPage(Integer.toString(page), null, "balancetop", sender);
|
||||
}
|
||||
|
||||
@@ -118,7 +119,7 @@ public class Commandbalancetop extends EssentialsCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
for (String u : ess.getUserMap().getAllUniqueUsers())
|
||||
for (UUID u : ess.getUserMap().getAllUniqueUsers())
|
||||
{
|
||||
final User user = ess.getUserMap().getUser(u);
|
||||
if (user != null)
|
||||
@@ -142,7 +143,7 @@ public class Commandbalancetop extends EssentialsCommand
|
||||
}
|
||||
});
|
||||
|
||||
cache.getLines().add(_("serverTotal", NumberUtil.displayCurrency(totalMoney, ess)));
|
||||
cache.getLines().add(tl("serverTotal", NumberUtil.displayCurrency(totalMoney, ess)));
|
||||
int pos = 1;
|
||||
for (Map.Entry<String, BigDecimal> entry : sortedEntries)
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import com.earth2me.essentials.Console;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.OfflinePlayer;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.FormatUtil;
|
||||
@@ -33,20 +33,20 @@ public class Commandban extends EssentialsCommand
|
||||
catch (PlayerNotFoundException e)
|
||||
{
|
||||
nomatch = true;
|
||||
user = ess.getUser(new OfflinePlayer(args[0], ess));
|
||||
user = ess.getUser(new OfflinePlayer(args[0], ess.getServer()));
|
||||
}
|
||||
if (!user.isOnline())
|
||||
if (!user.getBase().isOnline())
|
||||
{
|
||||
if (sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.ban.offline"))
|
||||
{
|
||||
throw new Exception(_("banExemptOffline"));
|
||||
throw new Exception(tl("banExemptOffline"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (user.isAuthorized("essentials.ban.exempt") && sender.isPlayer())
|
||||
{
|
||||
throw new Exception(_("banExempt"));
|
||||
throw new Exception(tl("banExempt"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,21 +58,21 @@ public class Commandban extends EssentialsCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
banReason = _("defaultBanReason");
|
||||
banReason = tl("defaultBanReason");
|
||||
}
|
||||
|
||||
user.setBanReason(_("banFormat", banReason, senderName));
|
||||
user.setBanned(true);
|
||||
user.setBanReason(tl("banFormat", banReason, senderName));
|
||||
user.getBase().setBanned(true);
|
||||
user.setBanTimeout(0);
|
||||
user.kickPlayer(_("banFormat", banReason, senderName));
|
||||
user.getBase().kickPlayer(tl("banFormat", banReason, senderName));
|
||||
|
||||
server.getLogger().log(Level.INFO, _("playerBanned", senderName, user.getName(), banReason));
|
||||
server.getLogger().log(Level.INFO, tl("playerBanned", senderName, user.getName(), banReason));
|
||||
|
||||
if (nomatch)
|
||||
{
|
||||
sender.sendMessage(_("userUnknown", user.getName()));
|
||||
sender.sendMessage(tl("userUnknown", user.getName()));
|
||||
}
|
||||
|
||||
ess.broadcastMessage("essentials.ban.notify", _("playerBanned", senderName, user.getName(), banReason));
|
||||
ess.broadcastMessage("essentials.ban.notify", tl("playerBanned", senderName, user.getName(), banReason));
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import com.earth2me.essentials.Console;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.FormatUtil;
|
||||
import java.util.logging.Level;
|
||||
@@ -50,8 +50,8 @@ public class Commandbanip extends EssentialsCommand
|
||||
}
|
||||
|
||||
ess.getServer().banIP(ipAddress);
|
||||
server.getLogger().log(Level.INFO, _("playerBanIpAddress", senderName, ipAddress));
|
||||
server.getLogger().log(Level.INFO, tl("playerBanIpAddress", senderName, ipAddress));
|
||||
|
||||
ess.broadcastMessage("essentials.ban.notify", _("playerBanIpAddress", senderName, ipAddress));
|
||||
ess.broadcastMessage("essentials.ban.notify", tl("playerBanIpAddress", senderName, ipAddress));
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.LocationUtil;
|
||||
import org.bukkit.Location;
|
||||
@@ -41,11 +41,11 @@ public class Commandbigtree extends EssentialsCommand
|
||||
final boolean success = user.getWorld().generateTree(safeLocation, tree);
|
||||
if (success)
|
||||
{
|
||||
user.sendMessage(_("bigTreeSuccess"));
|
||||
user.sendMessage(tl("bigTreeSuccess"));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("bigTreeFailure"));
|
||||
throw new Exception(tl("bigTreeFailure"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
@@ -19,7 +19,7 @@ public class Commandbook extends EssentialsCommand
|
||||
@Override
|
||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
final ItemStack item = user.getItemInHand();
|
||||
final ItemStack item = user.getBase().getItemInHand();
|
||||
final String player = user.getName();
|
||||
if (item.getType() == Material.WRITTEN_BOOK)
|
||||
{
|
||||
@@ -31,11 +31,11 @@ public class Commandbook extends EssentialsCommand
|
||||
{
|
||||
bmeta.setAuthor(args[1]);
|
||||
item.setItemMeta(bmeta);
|
||||
user.sendMessage(_("bookAuthorSet", getFinalArg(args, 1)));
|
||||
user.sendMessage(tl("bookAuthorSet", getFinalArg(args, 1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("denyChangeAuthor"));
|
||||
throw new Exception(tl("denyChangeAuthor"));
|
||||
}
|
||||
}
|
||||
else if (args.length > 1 && args[0].equalsIgnoreCase("title"))
|
||||
@@ -44,11 +44,11 @@ public class Commandbook extends EssentialsCommand
|
||||
{
|
||||
bmeta.setTitle(args[1]);
|
||||
item.setItemMeta(bmeta);
|
||||
user.sendMessage(_("bookTitleSet", getFinalArg(args, 1)));
|
||||
user.sendMessage(tl("bookTitleSet", getFinalArg(args, 1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("denyChangeTitle"));
|
||||
throw new Exception(tl("denyChangeTitle"));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -57,12 +57,12 @@ public class Commandbook extends EssentialsCommand
|
||||
{
|
||||
ItemStack newItem = new ItemStack(Material.BOOK_AND_QUILL, item.getAmount());
|
||||
newItem.setItemMeta(bmeta);
|
||||
user.setItemInHand(newItem);
|
||||
user.sendMessage(_("editBookContents"));
|
||||
user.getBase().setItemInHand(newItem);
|
||||
user.sendMessage(tl("editBookContents"));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("denyBookEdit"));
|
||||
throw new Exception(tl("denyBookEdit"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,12 +75,12 @@ public class Commandbook extends EssentialsCommand
|
||||
}
|
||||
ItemStack newItem = new ItemStack(Material.WRITTEN_BOOK, item.getAmount());
|
||||
newItem.setItemMeta(bmeta);
|
||||
user.setItemInHand(newItem);
|
||||
user.sendMessage(_("bookLocked"));
|
||||
user.getBase().setItemInHand(newItem);
|
||||
user.sendMessage(tl("bookLocked"));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("holdBook"));
|
||||
throw new Exception(tl("holdBook"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
@@ -19,7 +19,7 @@ public class Commandbreak extends EssentialsCommand
|
||||
@Override
|
||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
final Block block = user.getTargetBlock(null, 20);
|
||||
final Block block = user.getBase().getTargetBlock(null, 20);
|
||||
if (block == null)
|
||||
{
|
||||
throw new NoChargeException();
|
||||
@@ -30,7 +30,7 @@ public class Commandbreak extends EssentialsCommand
|
||||
}
|
||||
if (block.getType() == Material.BEDROCK && !user.isAuthorized("essentials.break.bedrock"))
|
||||
{
|
||||
throw new Exception(_("noBreakBedrock"));
|
||||
throw new Exception(tl("noBreakBedrock"));
|
||||
}
|
||||
//final List<ItemStack> list = (List<ItemStack>)block.getDrops();
|
||||
//final BlockBreakEvent event = new BlockBreakEvent(block, user.getBase(), list);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.FormatUtil;
|
||||
import org.bukkit.Server;
|
||||
@@ -33,6 +33,6 @@ public class Commandbroadcast extends EssentialsCommand
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
ess.broadcastMessage(_("broadcast", FormatUtil.replaceFormat(getFinalArg(args, 0)).replace("\\n", "\n"), name));
|
||||
ess.broadcastMessage(tl("broadcast", FormatUtil.replaceFormat(getFinalArg(args, 0)).replace("\\n", "\n"), name));
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.Server;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class Commandburn extends EssentialsCommand
|
||||
}
|
||||
|
||||
User user = getPlayer(server, sender, args, 0);
|
||||
user.setFireTicks(Integer.parseInt(args[1]) * 20);
|
||||
sender.sendMessage(_("burnMsg", user.getDisplayName(), Integer.parseInt(args[1])));
|
||||
user.getBase().setFireTicks(Integer.parseInt(args[1]) * 20);
|
||||
sender.sendMessage(tl("burnMsg", user.getDisplayName(), Integer.parseInt(args[1])));
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import java.util.ArrayList;
|
||||
@@ -19,13 +19,13 @@ public class Commandclearinventory extends EssentialsCommand
|
||||
{
|
||||
super("clearinventory");
|
||||
}
|
||||
static int BASE_AMOUNT = 100000;
|
||||
static int EXTENDED_CAP = 8;
|
||||
private static final int BASE_AMOUNT = 100000;
|
||||
private static final int EXTENDED_CAP = 8;
|
||||
|
||||
@Override
|
||||
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
parseCommand(server, user.getSource(), args, user.isAuthorized("essentials.clearinventory.others"), user.isAuthorized("essentials.clearinventory.all"));
|
||||
parseCommand(server, user.getSource(), args, user.isAuthorized("essentials.clearinventory.others"), user.isAuthorized("essentials.clearinventory.all") || user.isAuthorized("essentials.clearinventory.multiple"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,7 +46,7 @@ public class Commandclearinventory extends EssentialsCommand
|
||||
|
||||
if (allowAll && args.length > 0 && args[0].contentEquals("*"))
|
||||
{
|
||||
sender.sendMessage(_("inventoryClearingFromAll"));
|
||||
sender.sendMessage(tl("inventoryClearingFromAll"));
|
||||
offset = 1;
|
||||
players = Arrays.asList(server.getOnlinePlayers());
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public class Commandclearinventory extends EssentialsCommand
|
||||
{
|
||||
if (showExtended)
|
||||
{
|
||||
sender.sendMessage(_("inventoryClearingAllItems", player.getDisplayName()));
|
||||
sender.sendMessage(tl("inventoryClearingAllItems", player.getDisplayName()));
|
||||
}
|
||||
player.getInventory().clear();
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public class Commandclearinventory extends EssentialsCommand
|
||||
{
|
||||
if (showExtended)
|
||||
{
|
||||
sender.sendMessage(_("inventoryClearingAllArmor", player.getDisplayName()));
|
||||
sender.sendMessage(tl("inventoryClearingAllArmor", player.getDisplayName()));
|
||||
}
|
||||
player.getInventory().clear();
|
||||
player.getInventory().setArmorContents(null);
|
||||
@@ -123,7 +123,7 @@ public class Commandclearinventory extends EssentialsCommand
|
||||
ItemStack stack = new ItemStack(type);
|
||||
if (showExtended)
|
||||
{
|
||||
sender.sendMessage(_("inventoryClearingAllStack", stack.getType().toString().toLowerCase(Locale.ENGLISH), player.getDisplayName()));
|
||||
sender.sendMessage(tl("inventoryClearingAllStack", stack.getType().toString().toLowerCase(Locale.ENGLISH), player.getDisplayName()));
|
||||
}
|
||||
player.getInventory().clear(type, data);
|
||||
}
|
||||
@@ -134,7 +134,7 @@ public class Commandclearinventory extends EssentialsCommand
|
||||
final int removedAmount = (BASE_AMOUNT - removedStack.getAmount());
|
||||
if (removedAmount > 0 || showExtended)
|
||||
{
|
||||
sender.sendMessage(_("inventoryClearingStack", removedAmount, stack.getType().toString().toLowerCase(Locale.ENGLISH), player.getDisplayName()));
|
||||
sender.sendMessage(tl("inventoryClearingStack", removedAmount, stack.getType().toString().toLowerCase(Locale.ENGLISH), player.getDisplayName()));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -146,14 +146,14 @@ public class Commandclearinventory extends EssentialsCommand
|
||||
ItemStack stack = new ItemStack(type, amount, data);
|
||||
if (player.getInventory().containsAtLeast(stack, amount))
|
||||
{
|
||||
sender.sendMessage(_("inventoryClearingStack", amount, stack.getType().toString().toLowerCase(Locale.ENGLISH), player.getDisplayName()));
|
||||
sender.sendMessage(tl("inventoryClearingStack", amount, stack.getType().toString().toLowerCase(Locale.ENGLISH), player.getDisplayName()));
|
||||
player.getInventory().removeItem(stack);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (showExtended)
|
||||
{
|
||||
sender.sendMessage(_("inventoryClearFail", player.getDisplayName(), amount, stack.getType().toString().toLowerCase(Locale.ENGLISH)));
|
||||
sender.sendMessage(tl("inventoryClearFail", player.getDisplayName(), amount, stack.getType().toString().toLowerCase(Locale.ENGLISH)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.Server;
|
||||
|
||||
@@ -53,6 +53,6 @@ public class Commandcompass extends EssentialsCommand
|
||||
{
|
||||
dir = "N";
|
||||
}
|
||||
user.sendMessage(_("compassBearing", dir, bearing));
|
||||
user.sendMessage(tl("compassBearing", dir, bearing));
|
||||
}
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ import com.earth2me.essentials.textreader.IText;
|
||||
import com.earth2me.essentials.textreader.KeywordReplacer;
|
||||
import com.earth2me.essentials.textreader.TextInput;
|
||||
import com.earth2me.essentials.textreader.TextPager;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import org.bukkit.Server;
|
||||
|
||||
|
||||
@@ -21,6 +22,19 @@ public class Commandcustomtext extends EssentialsCommand
|
||||
final IText input = new TextInput(sender, "custom", true, ess);
|
||||
final IText output = new KeywordReplacer(input, sender, ess);
|
||||
final TextPager pager = new TextPager(output);
|
||||
pager.showPage(commandLabel, args.length > 0 ? args[0] : null, null, sender);
|
||||
String chapter = commandLabel;
|
||||
String page;
|
||||
|
||||
if (commandLabel.equalsIgnoreCase("customtext") && args.length > 0 && !NumberUtil.isInt(commandLabel))
|
||||
{
|
||||
chapter = args[0];
|
||||
page = args.length > 1 ? args[1] : null;
|
||||
}
|
||||
else
|
||||
{
|
||||
page = args.length > 0 ? args[0] : null;
|
||||
}
|
||||
|
||||
pager.showPage(chapter, page, null, sender);
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Server;
|
||||
@@ -53,10 +53,10 @@ public class Commanddelhome extends EssentialsCommand
|
||||
|
||||
if (name.equalsIgnoreCase("bed"))
|
||||
{
|
||||
throw new Exception(_("invalidHomeName"));
|
||||
throw new Exception(tl("invalidHomeName"));
|
||||
}
|
||||
|
||||
user.delHome(name.toLowerCase(Locale.ENGLISH));
|
||||
sender.sendMessage(_("deleteHome", name));
|
||||
sender.sendMessage(tl("deleteHome", name));
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import org.bukkit.Server;
|
||||
|
||||
|
||||
@@ -21,6 +21,6 @@ public class Commanddeljail extends EssentialsCommand
|
||||
}
|
||||
|
||||
ess.getJails().removeJail(args[0]);
|
||||
sender.sendMessage(_("deleteJail", args[0]));
|
||||
sender.sendMessage(tl("deleteJail", args[0]));
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import org.bukkit.Server;
|
||||
|
||||
|
||||
@@ -21,6 +21,6 @@ public class Commanddelwarp extends EssentialsCommand
|
||||
}
|
||||
|
||||
ess.getWarps().removeWarp(args[0]);
|
||||
sender.sendMessage(_("deleteWarp", args[0]));
|
||||
sender.sendMessage(tl("deleteWarp", args[0]));
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.Server;
|
||||
|
||||
@@ -18,15 +18,15 @@ public class Commanddepth extends EssentialsCommand
|
||||
final int depth = user.getLocation().getBlockY() - 63;
|
||||
if (depth > 0)
|
||||
{
|
||||
user.sendMessage(_("depthAboveSea", depth));
|
||||
user.sendMessage(tl("depthAboveSea", depth));
|
||||
}
|
||||
else if (depth < 0)
|
||||
{
|
||||
user.sendMessage(_("depthBelowSea", (-depth)));
|
||||
user.sendMessage(tl("depthBelowSea", (-depth)));
|
||||
}
|
||||
else
|
||||
{
|
||||
user.sendMessage(_("depth"));
|
||||
user.sendMessage(tl("depth"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,11 +2,12 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.ChargeException;
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Locale;
|
||||
import net.ess3.api.MaxMoneyException;
|
||||
import org.bukkit.Server;
|
||||
|
||||
|
||||
@@ -40,23 +41,23 @@ public class Commandeco extends EssentialsLoopCommand
|
||||
throw new NotEnoughArgumentsException(ex);
|
||||
}
|
||||
|
||||
loopOfflinePlayers(server, sender, false, args[1], args);
|
||||
loopOfflinePlayers(server, sender, false, true, args[1], args);
|
||||
|
||||
if (cmd == Commandeco.EcoCommands.RESET || cmd == Commandeco.EcoCommands.SET)
|
||||
{
|
||||
if (args[1].contentEquals("**"))
|
||||
{
|
||||
server.broadcastMessage(_("resetBalAll", NumberUtil.displayCurrency(amount, ess)));
|
||||
server.broadcastMessage(tl("resetBalAll", NumberUtil.displayCurrency(amount, ess)));
|
||||
}
|
||||
else if (args[1].contentEquals("*"))
|
||||
{
|
||||
server.broadcastMessage(_("resetBal", NumberUtil.displayCurrency(amount, ess)));
|
||||
server.broadcastMessage(tl("resetBal", NumberUtil.displayCurrency(amount, ess)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updatePlayer(final Server server, final CommandSource sender, final User player, final String[] args) throws NotEnoughArgumentsException, ChargeException
|
||||
protected void updatePlayer(final Server server, final CommandSource sender, final User player, final String[] args) throws NotEnoughArgumentsException, ChargeException, MaxMoneyException
|
||||
{
|
||||
switch (cmd)
|
||||
{
|
||||
@@ -85,24 +86,31 @@ public class Commandeco extends EssentialsLoopCommand
|
||||
}
|
||||
else if (sender == null)
|
||||
{
|
||||
player.setMoney(minBalance);
|
||||
player.sendMessage(_("takenFromAccount", NumberUtil.displayCurrency(player.getMoney(), ess)));
|
||||
try
|
||||
{
|
||||
player.setMoney(minBalance);
|
||||
}
|
||||
catch (MaxMoneyException ex)
|
||||
{
|
||||
// Take shouldn't be able to throw a max money exception
|
||||
}
|
||||
player.sendMessage(tl("takenFromAccount", NumberUtil.displayCurrency(player.getMoney(), ess)));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ChargeException(_("insufficientFunds"));
|
||||
throw new ChargeException(tl("insufficientFunds"));
|
||||
}
|
||||
}
|
||||
|
||||
private void set(BigDecimal amount, final User player, final CommandSource sender)
|
||||
private void set(BigDecimal amount, final User player, final CommandSource sender) throws MaxMoneyException
|
||||
{
|
||||
BigDecimal minBalance = ess.getSettings().getMinMoney();
|
||||
boolean underMinimum = (amount.compareTo(minBalance) < 0);
|
||||
player.setMoney(underMinimum ? minBalance : amount);
|
||||
player.sendMessage(_("setBal", NumberUtil.displayCurrency(player.getMoney(), ess)));
|
||||
player.sendMessage(tl("setBal", NumberUtil.displayCurrency(player.getMoney(), ess)));
|
||||
if (sender != null)
|
||||
{
|
||||
sender.sendMessage(_("setBalOthers", player.getDisplayName(), NumberUtil.displayCurrency(player.getMoney(), ess)));
|
||||
sender.sendMessage(tl("setBalOthers", player.getDisplayName(), NumberUtil.displayCurrency(player.getMoney(), ess)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.Enchantments;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.MetaItemStack;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.StringUtil;
|
||||
@@ -26,10 +26,10 @@ public class Commandenchant extends EssentialsCommand
|
||||
@Override
|
||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
final ItemStack stack = user.getItemInHand();
|
||||
final ItemStack stack = user.getBase().getItemInHand();
|
||||
if (stack == null || stack.getType() == Material.AIR)
|
||||
{
|
||||
throw new Exception(_("nothingInHand"));
|
||||
throw new Exception(tl("nothingInHand"));
|
||||
}
|
||||
if (args.length == 0)
|
||||
{
|
||||
@@ -43,7 +43,7 @@ public class Commandenchant extends EssentialsCommand
|
||||
//enchantmentslist.add(enchantmentName);
|
||||
}
|
||||
}
|
||||
throw new NotEnoughArgumentsException(_("enchantments", StringUtil.joinList(enchantmentslist.toArray())));
|
||||
throw new NotEnoughArgumentsException(tl("enchantments", StringUtil.joinList(enchantmentslist.toArray())));
|
||||
}
|
||||
|
||||
int level = -1;
|
||||
@@ -64,17 +64,17 @@ public class Commandenchant extends EssentialsCommand
|
||||
final MetaItemStack metaStack = new MetaItemStack(stack);
|
||||
final Enchantment enchantment = metaStack.getEnchantment(user, args[0]);
|
||||
metaStack.addEnchantment(user.getSource(), allowUnsafe, enchantment, level);
|
||||
user.getInventory().setItemInHand(metaStack.getItemStack());
|
||||
user.getBase().getInventory().setItemInHand(metaStack.getItemStack());
|
||||
|
||||
user.updateInventory();
|
||||
user.getBase().updateInventory();
|
||||
final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH);
|
||||
if (level == 0)
|
||||
{
|
||||
user.sendMessage(_("enchantmentRemoved", enchantmentName.replace('_', ' ')));
|
||||
user.sendMessage(tl("enchantmentRemoved", enchantmentName.replace('_', ' ')));
|
||||
}
|
||||
else
|
||||
{
|
||||
user.sendMessage(_("enchantmentApplied", enchantmentName.replace('_', ' ')));
|
||||
user.sendMessage(tl("enchantmentApplied", enchantmentName.replace('_', ' ')));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -17,14 +17,14 @@ public class Commandenderchest extends EssentialsCommand
|
||||
if (args.length > 0 && user.isAuthorized("essentials.enderchest.others"))
|
||||
{
|
||||
final User invUser = getPlayer(server, user, args, 0);
|
||||
user.closeInventory();
|
||||
user.openInventory(invUser.getEnderChest());
|
||||
user.getBase().closeInventory();
|
||||
user.getBase().openInventory(invUser.getBase().getEnderChest());
|
||||
user.setEnderSee(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
user.closeInventory();
|
||||
user.openInventory(user.getEnderChest());
|
||||
user.getBase().closeInventory();
|
||||
user.getBase().openInventory(user.getBase().getEnderChest());
|
||||
user.setEnderSee(false);
|
||||
}
|
||||
|
||||
|
@@ -1,15 +1,18 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.EssentialsUpgrade;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.UserMap;
|
||||
import com.earth2me.essentials.metrics.Metrics;
|
||||
import com.earth2me.essentials.utils.DateUtil;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import com.google.common.base.Charsets;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.Sound;
|
||||
@@ -57,6 +60,14 @@ public class Commandessentials extends EssentialsCommand
|
||||
{
|
||||
run_cleanup(server, sender, commandLabel, args);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("uuidconvert"))
|
||||
{
|
||||
run_uuidconvert(server, sender, commandLabel, args);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("uuidtest"))
|
||||
{
|
||||
run_uuidtest(server, sender, commandLabel, args);
|
||||
}
|
||||
else
|
||||
{
|
||||
run_reload(server, sender, commandLabel, args);
|
||||
@@ -79,7 +90,7 @@ public class Commandessentials extends EssentialsCommand
|
||||
}
|
||||
if (disabledCommands.length() > 0)
|
||||
{
|
||||
sender.sendMessage(_("blockList"));
|
||||
sender.sendMessage(tl("blockList"));
|
||||
sender.sendMessage(disabledCommands.toString());
|
||||
}
|
||||
}
|
||||
@@ -104,7 +115,7 @@ public class Commandessentials extends EssentialsCommand
|
||||
private void run_reload(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
ess.reload();
|
||||
sender.sendMessage(_("essentialsReload", ess.getDescription().getVersion()));
|
||||
sender.sendMessage(tl("essentialsReload", ess.getDescription().getVersion()));
|
||||
}
|
||||
|
||||
private void run_nya(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
|
||||
@@ -255,7 +266,7 @@ public class Commandessentials extends EssentialsCommand
|
||||
sender.sendMessage("Unless you define larger default values, this command wil ignore people who have more than 0 money/homes/bans.");
|
||||
throw new Exception("/<command> cleanup <days> [money] [homes] [ban count]");
|
||||
}
|
||||
sender.sendMessage(_("cleaning"));
|
||||
sender.sendMessage(tl("cleaning"));
|
||||
|
||||
final long daysArg = Long.parseLong(args[1]);
|
||||
final double moneyArg = args.length >= 3 ? Double.parseDouble(args[2].replaceAll("[^0-9\\.]", "")) : 0;
|
||||
@@ -269,7 +280,7 @@ public class Commandessentials extends EssentialsCommand
|
||||
public void run()
|
||||
{
|
||||
Long currTime = System.currentTimeMillis();
|
||||
for (String u : userMap.getAllUniqueUsers())
|
||||
for (UUID u : userMap.getAllUniqueUsers())
|
||||
{
|
||||
final User user = ess.getUserMap().getUser(u);
|
||||
if (user == null)
|
||||
@@ -288,6 +299,11 @@ public class Commandessentials extends EssentialsCommand
|
||||
{
|
||||
user.setLastLogin(currTime);
|
||||
}
|
||||
|
||||
if (user.isNPC())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
long timeDiff = currTime - lastLog;
|
||||
long milliDays = daysArg * 24L * 60L * 60L * 1000L;
|
||||
@@ -307,9 +323,44 @@ public class Commandessentials extends EssentialsCommand
|
||||
|
||||
user.reset();
|
||||
}
|
||||
sender.sendMessage(_("cleaned"));
|
||||
sender.sendMessage(tl("cleaned"));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void run_uuidconvert(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
sender.sendMessage("Starting Essentials UUID userdata conversion, this may lag the server.");
|
||||
EssentialsUpgrade.uuidFileConvert(ess);
|
||||
sender.sendMessage("UUID conversion complete, check your server log for more information.");
|
||||
}
|
||||
|
||||
private void run_uuidtest(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
throw new Exception("/<command> uuidtest <name>");
|
||||
}
|
||||
String name = args[1];
|
||||
sender.sendMessage("Looking up UUID for " + name);
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (player.getName().equalsIgnoreCase(name))
|
||||
{
|
||||
sender.sendMessage("Online player: " + player.getUniqueId().toString());
|
||||
}
|
||||
}
|
||||
|
||||
org.bukkit.OfflinePlayer player = ess.getServer().getOfflinePlayer(name);
|
||||
UUID bukkituuid = player.getUniqueId();
|
||||
sender.sendMessage("Bukkit Lookup: " + bukkituuid.toString());
|
||||
|
||||
UUID npcuuid = UUID.nameUUIDFromBytes(("NPC:" + name).getBytes(Charsets.UTF_8));
|
||||
sender.sendMessage("NPC UUID: " + npcuuid.toString());
|
||||
|
||||
UUID offlineuuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8));
|
||||
sender.sendMessage("Offline Mode UUID: " + offlineuuid.toString());
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.craftbukkit.SetExpFix;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
@@ -159,7 +159,7 @@ public class Commandexp extends EssentialsCommand
|
||||
|
||||
private void showExp(final CommandSource sender, final User target)
|
||||
{
|
||||
sender.sendMessage(_("exp", target.getDisplayName(), SetExpFix.getTotalExperience(target.getBase()), target.getLevel(), SetExpFix.getExpUntilNextLevel(target.getBase())));
|
||||
sender.sendMessage(tl("exp", target.getDisplayName(), SetExpFix.getTotalExperience(target.getBase()), target.getBase().getLevel(), SetExpFix.getExpUntilNextLevel(target.getBase())));
|
||||
}
|
||||
|
||||
//TODO: Limit who can give negative exp?
|
||||
@@ -173,7 +173,7 @@ public class Commandexp extends EssentialsCommand
|
||||
int neededLevel = Integer.parseInt(strAmount);
|
||||
if (give)
|
||||
{
|
||||
neededLevel += target.getLevel();
|
||||
neededLevel += target.getBase().getLevel();
|
||||
}
|
||||
amount = (long)SetExpFix.getExpToLevel(neededLevel);
|
||||
SetExpFix.setTotalExperience(target.getBase(), 0);
|
||||
@@ -200,6 +200,6 @@ public class Commandexp extends EssentialsCommand
|
||||
amount = 0l;
|
||||
}
|
||||
SetExpFix.setTotalExperience(target.getBase(), (int)amount);
|
||||
sender.sendMessage(_("expSet", target.getDisplayName(), amount));
|
||||
sender.sendMessage(tl("expSet", target.getDisplayName(), amount));
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -22,7 +22,7 @@ public class Commandext extends EssentialsLoopCommand
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
loopOnlinePlayers(server, sender, true, args[0], null);
|
||||
loopOnlinePlayers(server, sender, true, true, args[0], null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -31,18 +31,18 @@ public class Commandext extends EssentialsLoopCommand
|
||||
if (args.length < 1)
|
||||
{
|
||||
extPlayer(user.getBase());
|
||||
user.sendMessage(_("extinguish"));
|
||||
user.sendMessage(tl("extinguish"));
|
||||
return;
|
||||
}
|
||||
|
||||
loopOnlinePlayers(server, user.getSource(), true, args[0], null);
|
||||
loopOnlinePlayers(server, user.getSource(), true, true, args[0], null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updatePlayer(final Server server, final CommandSource sender, final User player, final String[] args)
|
||||
{
|
||||
extPlayer(player.getBase());
|
||||
sender.sendMessage(_("extinguishOthers", player.getDisplayName()));
|
||||
sender.sendMessage(tl("extinguishOthers", player.getDisplayName()));
|
||||
}
|
||||
|
||||
private void extPlayer(final Player player)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -25,12 +25,12 @@ public class Commandfeed extends EssentialsLoopCommand
|
||||
|
||||
if (args.length > 0 && user.isAuthorized("essentials.feed.others"))
|
||||
{
|
||||
loopOnlinePlayers(server, user.getSource(), true, args[0], null);
|
||||
loopOnlinePlayers(server, user.getSource(), true, true, args[0], null);
|
||||
return;
|
||||
}
|
||||
|
||||
feedPlayer(user.getBase());
|
||||
user.sendMessage(_("feed"));
|
||||
user.sendMessage(tl("feed"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,7 +41,7 @@ public class Commandfeed extends EssentialsLoopCommand
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
loopOnlinePlayers(server, sender, true, args[0], null);
|
||||
loopOnlinePlayers(server, sender, true, true, args[0], null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,7 +50,7 @@ public class Commandfeed extends EssentialsLoopCommand
|
||||
try
|
||||
{
|
||||
feedPlayer(player.getBase());
|
||||
sender.sendMessage(_("feedOther", player.getDisplayName()));
|
||||
sender.sendMessage(tl("feedOther", player.getDisplayName()));
|
||||
}
|
||||
catch (QuietAbortException e)
|
||||
{
|
||||
@@ -71,5 +71,6 @@ public class Commandfeed extends EssentialsLoopCommand
|
||||
|
||||
player.setFoodLevel(flce.getFoodLevel() > 20 ? 20 : flce.getFoodLevel());
|
||||
player.setSaturation(10);
|
||||
player.setExhaustion(0F);
|
||||
}
|
||||
}
|
||||
|
@@ -50,8 +50,8 @@ public class Commandfireball extends EssentialsCommand
|
||||
type = LargeFireball.class;
|
||||
}
|
||||
}
|
||||
final Vector direction = user.getEyeLocation().getDirection().multiply(speed);
|
||||
projectile = (Projectile)user.getWorld().spawn(user.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), type);
|
||||
final Vector direction = user.getBase().getEyeLocation().getDirection().multiply(speed);
|
||||
projectile = (Projectile)user.getWorld().spawn(user.getBase().getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), type);
|
||||
projectile.setShooter(user.getBase());
|
||||
projectile.setVelocity(direction);
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.MetaItemStack;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
@@ -32,7 +32,6 @@ import org.bukkit.util.Vector;
|
||||
|
||||
public class Commandfirework extends EssentialsCommand
|
||||
{
|
||||
private final transient Pattern splitPattern = Pattern.compile("[:+',;.]");
|
||||
|
||||
public Commandfirework()
|
||||
{
|
||||
@@ -42,7 +41,7 @@ public class Commandfirework extends EssentialsCommand
|
||||
@Override
|
||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
final ItemStack stack = user.getItemInHand();
|
||||
final ItemStack stack = user.getBase().getItemInHand();
|
||||
if (stack.getType() == Material.FIREWORK)
|
||||
{
|
||||
if (args.length > 0)
|
||||
@@ -52,7 +51,7 @@ public class Commandfirework extends EssentialsCommand
|
||||
FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta();
|
||||
fmeta.clearEffects();
|
||||
stack.setItemMeta(fmeta);
|
||||
user.sendMessage(_("fireworkEffectsCleared"));
|
||||
user.sendMessage(tl("fireworkEffectsCleared"));
|
||||
}
|
||||
else if (args.length > 1 && (args[0].equalsIgnoreCase("power") || (args[0].equalsIgnoreCase("p"))))
|
||||
{
|
||||
@@ -64,7 +63,7 @@ public class Commandfirework extends EssentialsCommand
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
throw new Exception(_("invalidFireworkFormat", args[1], args[0]));
|
||||
throw new Exception(tl("invalidFireworkFormat", args[1], args[0]));
|
||||
}
|
||||
stack.setItemMeta(fmeta);
|
||||
}
|
||||
@@ -82,7 +81,7 @@ public class Commandfirework extends EssentialsCommand
|
||||
if (amount > serverLimit)
|
||||
{
|
||||
amount = serverLimit;
|
||||
user.sendMessage(_("mobSpawnLimit"));
|
||||
user.sendMessage(tl("mobSpawnLimit"));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -96,7 +95,7 @@ public class Commandfirework extends EssentialsCommand
|
||||
FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta();
|
||||
if (direction)
|
||||
{
|
||||
final Vector vector = user.getEyeLocation().getDirection().multiply(0.070);
|
||||
final Vector vector = user.getBase().getEyeLocation().getDirection().multiply(0.070);
|
||||
if (fmeta.getPower() > 1)
|
||||
{
|
||||
fmeta.setPower(1);
|
||||
@@ -117,7 +116,7 @@ public class Commandfirework extends EssentialsCommand
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
user.sendMessage(_("fireworkSyntax"));
|
||||
user.sendMessage(tl("fireworkSyntax"));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -128,15 +127,15 @@ public class Commandfirework extends EssentialsCommand
|
||||
FireworkEffect effect = mStack.getFireworkBuilder().build();
|
||||
if (fmeta.getEffects().size() > 0 && !user.isAuthorized("essentials.firework.multiple"))
|
||||
{
|
||||
throw new Exception(_("multipleCharges"));
|
||||
throw new Exception(tl("multipleCharges"));
|
||||
}
|
||||
fmeta.addEffect(effect);
|
||||
stack.setItemMeta(fmeta);
|
||||
}
|
||||
else
|
||||
{
|
||||
user.sendMessage(_("fireworkSyntax"));
|
||||
throw new Exception(_("fireworkColor"));
|
||||
user.sendMessage(tl("fireworkSyntax"));
|
||||
throw new Exception(tl("fireworkColor"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,7 +146,7 @@ public class Commandfirework extends EssentialsCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("holdFirework"));
|
||||
throw new Exception(tl("holdFirework"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.Server;
|
||||
|
||||
@@ -49,21 +49,21 @@ public class Commandfly extends EssentialsToggleCommand
|
||||
{
|
||||
if (enabled == null)
|
||||
{
|
||||
enabled = !user.getAllowFlight();
|
||||
enabled = !user.getBase().getAllowFlight();
|
||||
}
|
||||
|
||||
user.setFallDistance(0f);
|
||||
user.setAllowFlight(enabled);
|
||||
user.getBase().setFallDistance(0f);
|
||||
user.getBase().setAllowFlight(enabled);
|
||||
|
||||
if (!user.getAllowFlight())
|
||||
if (!user.getBase().getAllowFlight())
|
||||
{
|
||||
user.setFlying(false);
|
||||
user.getBase().setFlying(false);
|
||||
}
|
||||
|
||||
user.sendMessage(_("flyMode", _(enabled ? "enabled" : "disabled"), user.getDisplayName()));
|
||||
user.sendMessage(tl("flyMode", tl(enabled ? "enabled" : "disabled"), user.getDisplayName()));
|
||||
if (!sender.isPlayer() || !sender.getPlayer().equals(user.getBase()))
|
||||
{
|
||||
sender.sendMessage(_("flyMode", _(enabled ? "enabled" : "disabled"), user.getDisplayName()));
|
||||
sender.sendMessage(tl("flyMode", tl(enabled ? "enabled" : "disabled"), user.getDisplayName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -71,18 +71,17 @@ public class Commandgamemode extends EssentialsCommand
|
||||
}
|
||||
if (gameMode == null)
|
||||
{
|
||||
gameMode = user.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : user.getGameMode() == GameMode.CREATIVE ? GameMode.ADVENTURE : GameMode.SURVIVAL;
|
||||
gameMode = user.getBase().getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : user.getBase().getGameMode() == GameMode.CREATIVE ? GameMode.ADVENTURE : GameMode.SURVIVAL;
|
||||
}
|
||||
user.setGameMode(gameMode);
|
||||
user.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName()));
|
||||
user.getBase().setGameMode(gameMode);
|
||||
user.sendMessage(tl("gameMode", tl(user.getBase().getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName()));
|
||||
}
|
||||
|
||||
private void gamemodeOtherPlayers(final Server server, final CommandSource sender, final GameMode gameMode, final String name) throws NotEnoughArgumentsException, PlayerNotFoundException
|
||||
{
|
||||
//TODO: TL this
|
||||
if (name.trim().length() < 2 || gameMode == null)
|
||||
{
|
||||
throw new NotEnoughArgumentsException("You need to specify a valid player/mode.");
|
||||
throw new NotEnoughArgumentsException(tl("gameModeInvalid"));
|
||||
}
|
||||
|
||||
boolean skipHidden = sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.vanish.interact");
|
||||
@@ -96,8 +95,8 @@ public class Commandgamemode extends EssentialsCommand
|
||||
continue;
|
||||
}
|
||||
foundUser = true;
|
||||
player.setGameMode(gameMode);
|
||||
sender.sendMessage(_("gameMode", _(player.getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName()));
|
||||
player.getBase().setGameMode(gameMode);
|
||||
sender.sendMessage(tl("gameMode", tl(player.getBase().getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName()));
|
||||
}
|
||||
if (!foundUser)
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.utils.DateUtil;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import java.lang.management.ManagementFactory;
|
||||
@@ -37,11 +37,11 @@ public class Commandgc extends EssentialsCommand
|
||||
color = ChatColor.RED;
|
||||
}
|
||||
|
||||
sender.sendMessage(_("uptime", DateUtil.formatDateDiff(ManagementFactory.getRuntimeMXBean().getStartTime())));
|
||||
sender.sendMessage(_("tps", "" + color + NumberUtil.formatDouble(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(tl("uptime", DateUtil.formatDateDiff(ManagementFactory.getRuntimeMXBean().getStartTime())));
|
||||
sender.sendMessage(tl("tps", "" + color + NumberUtil.formatDouble(tps)));
|
||||
sender.sendMessage(tl("gcmax", (Runtime.getRuntime().maxMemory() / 1024 / 1024)));
|
||||
sender.sendMessage(tl("gctotal", (Runtime.getRuntime().totalMemory() / 1024 / 1024)));
|
||||
sender.sendMessage(tl("gcfree", (Runtime.getRuntime().freeMemory() / 1024 / 1024)));
|
||||
|
||||
List<World> worlds = server.getWorlds();
|
||||
for (World w : worlds)
|
||||
@@ -63,7 +63,7 @@ public class Commandgc extends EssentialsCommand
|
||||
tileEntities += chunk.getTileEntities().length;
|
||||
}
|
||||
|
||||
sender.sendMessage(_("gcWorld", worldType, w.getName(), w.getLoadedChunks().length, w.getEntities().size(), tileEntities));
|
||||
sender.sendMessage(tl("gcWorld", worldType, w.getName(), w.getLoadedChunks().length, w.getEntities().size(), tileEntities));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
@@ -39,15 +39,15 @@ public class Commandgetpos extends EssentialsCommand
|
||||
|
||||
private void outputPosition(final CommandSource sender, final Location coords, final Location distance)
|
||||
{
|
||||
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()));
|
||||
sender.sendMessage(tl("currentWorld", coords.getWorld().getName()));
|
||||
sender.sendMessage(tl("posX", coords.getBlockX()));
|
||||
sender.sendMessage(tl("posY", coords.getBlockY()));
|
||||
sender.sendMessage(tl("posZ", coords.getBlockZ()));
|
||||
sender.sendMessage(tl("posYaw", (coords.getYaw() + 180 + 360) % 360));
|
||||
sender.sendMessage(tl("posPitch", coords.getPitch()));
|
||||
if (distance != null && coords.getWorld().equals(distance.getWorld()))
|
||||
{
|
||||
sender.sendMessage(_("distance", coords.distance(distance)));
|
||||
sender.sendMessage(tl("distance", coords.distance(distance)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.MetaItemStack;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
@@ -39,7 +39,7 @@ public class Commandgive extends EssentialsCommand
|
||||
: (!ess.getUser(sender.getPlayer()).isAuthorized("essentials.itemspawn.exempt")
|
||||
&& !ess.getUser(sender.getPlayer()).canSpawnItem(stack.getTypeId()))))
|
||||
{
|
||||
throw new Exception(_("cantSpawnItem", itemname));
|
||||
throw new Exception(tl("cantSpawnItem", itemname));
|
||||
}
|
||||
|
||||
final User giveTo = getPlayer(server, sender, args, 0);
|
||||
@@ -69,44 +69,54 @@ public class Commandgive extends EssentialsCommand
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
MetaItemStack metaStack = new MetaItemStack(stack);
|
||||
if (!metaStack.canSpawn(ess))
|
||||
{
|
||||
throw new Exception(tl("unableToSpawnItem", itemname));
|
||||
}
|
||||
|
||||
if (args.length > 3)
|
||||
{
|
||||
MetaItemStack metaStack = new MetaItemStack(stack);
|
||||
boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments();
|
||||
if (allowUnsafe && sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.enchantments.allowunsafe"))
|
||||
{
|
||||
allowUnsafe = false;
|
||||
}
|
||||
|
||||
metaStack.parseStringMeta(sender, allowUnsafe, args, NumberUtil.isInt(args[3]) ? 4 : 3, ess);
|
||||
int metaStart = NumberUtil.isInt(args[3]) ? 4 : 3;
|
||||
|
||||
if (args.length > metaStart)
|
||||
{
|
||||
metaStack.parseStringMeta(sender, allowUnsafe, args, metaStart, ess);
|
||||
}
|
||||
|
||||
stack = metaStack.getItemStack();
|
||||
}
|
||||
|
||||
if (stack.getType() == Material.AIR)
|
||||
{
|
||||
throw new Exception(_("cantSpawnItem", "Air"));
|
||||
throw new Exception(tl("cantSpawnItem", "Air"));
|
||||
}
|
||||
|
||||
final String itemName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' ');
|
||||
sender.sendMessage(_("giveSpawn", stack.getAmount(), itemName, giveTo.getDisplayName()));
|
||||
sender.sendMessage(tl("giveSpawn", stack.getAmount(), itemName, giveTo.getDisplayName()));
|
||||
|
||||
Map<Integer, ItemStack> leftovers;
|
||||
|
||||
if (giveTo.isAuthorized("essentials.oversizedstacks"))
|
||||
{
|
||||
leftovers = InventoryWorkaround.addOversizedItems(giveTo.getInventory(), ess.getSettings().getOversizedStackSize(), stack);
|
||||
leftovers = InventoryWorkaround.addOversizedItems(giveTo.getBase().getInventory(), ess.getSettings().getOversizedStackSize(), stack);
|
||||
}
|
||||
else
|
||||
{
|
||||
leftovers = InventoryWorkaround.addItems(giveTo.getInventory(), stack);
|
||||
leftovers = InventoryWorkaround.addItems(giveTo.getBase().getInventory(), stack);
|
||||
}
|
||||
|
||||
for (ItemStack item : leftovers.values())
|
||||
{
|
||||
sender.sendMessage(_("giveSpawnFailure", item.getAmount(), itemName, giveTo.getDisplayName()));
|
||||
sender.sendMessage(tl("giveSpawnFailure", item.getAmount(), itemName, giveTo.getDisplayName()));
|
||||
}
|
||||
|
||||
giveTo.updateInventory();
|
||||
giveTo.getBase().updateInventory();
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import net.ess3.api.events.GodStatusChangeEvent;
|
||||
import org.bukkit.Server;
|
||||
@@ -60,16 +60,16 @@ public class Commandgod extends EssentialsToggleCommand
|
||||
{
|
||||
user.setGodModeEnabled(enabled);
|
||||
|
||||
if (enabled && user.getHealth() != 0)
|
||||
if (enabled && user.getBase().getHealth() != 0)
|
||||
{
|
||||
user.setHealth(user.getMaxHealth());
|
||||
user.setFoodLevel(20);
|
||||
user.getBase().setHealth(user.getBase().getMaxHealth());
|
||||
user.getBase().setFoodLevel(20);
|
||||
}
|
||||
|
||||
user.sendMessage(_("godMode", enabled ? _("enabled") : _("disabled")));
|
||||
user.sendMessage(tl("godMode", enabled ? tl("enabled") : tl("disabled")));
|
||||
if (!sender.isPlayer() || !sender.getPlayer().equals(user.getBase()))
|
||||
{
|
||||
sender.sendMessage(_("godMode", _(enabled ? "godEnabledFor" : "godDisabledFor", user.getDisplayName())));
|
||||
sender.sendMessage(tl("godMode", tl(enabled ? "godEnabledFor" : "godDisabledFor", user.getDisplayName())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import org.bukkit.Material;
|
||||
@@ -21,41 +21,41 @@ public class Commandhat extends EssentialsCommand
|
||||
{
|
||||
if (args.length > 0 && (args[0].contains("rem") || args[0].contains("off") || args[0].equalsIgnoreCase("0")))
|
||||
{
|
||||
final PlayerInventory inv = user.getInventory();
|
||||
final PlayerInventory inv = user.getBase().getInventory();
|
||||
final ItemStack head = inv.getHelmet();
|
||||
if (head == null || head.getType() == Material.AIR)
|
||||
{
|
||||
user.sendMessage(_("hatEmpty"));
|
||||
user.sendMessage(tl("hatEmpty"));
|
||||
}
|
||||
else
|
||||
{
|
||||
final ItemStack air = new ItemStack(Material.AIR);
|
||||
inv.setHelmet(air);
|
||||
InventoryWorkaround.addItems(user.getInventory(), head);
|
||||
user.sendMessage(_("hatRemoved"));
|
||||
InventoryWorkaround.addItems(user.getBase().getInventory(), head);
|
||||
user.sendMessage(tl("hatRemoved"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (user.getItemInHand().getType() != Material.AIR)
|
||||
if (user.getBase().getItemInHand().getType() != Material.AIR)
|
||||
{
|
||||
final ItemStack hand = user.getItemInHand();
|
||||
final ItemStack hand = user.getBase().getItemInHand();
|
||||
if (hand.getType().getMaxDurability() == 0)
|
||||
{
|
||||
final PlayerInventory inv = user.getInventory();
|
||||
final PlayerInventory inv = user.getBase().getInventory();
|
||||
final ItemStack head = inv.getHelmet();
|
||||
inv.setHelmet(hand);
|
||||
inv.setItemInHand(head);
|
||||
user.sendMessage(_("hatPlaced"));
|
||||
user.sendMessage(tl("hatPlaced"));
|
||||
}
|
||||
else
|
||||
{
|
||||
user.sendMessage(_("hatArmor"));
|
||||
user.sendMessage(tl("hatArmor"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
user.sendMessage(_("hatFail"));
|
||||
user.sendMessage(tl("hatFail"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -27,7 +27,7 @@ public class Commandheal extends EssentialsLoopCommand
|
||||
|
||||
if (args.length > 0 && user.isAuthorized("essentials.heal.others"))
|
||||
{
|
||||
loopOnlinePlayers(server, user.getSource(), true, args[0], null);
|
||||
loopOnlinePlayers(server, user.getSource(), true, true, args[0], null);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class Commandheal extends EssentialsLoopCommand
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
loopOnlinePlayers(server, sender, true, args[0], null);
|
||||
loopOnlinePlayers(server, sender, true, true, args[0], null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,7 +51,7 @@ public class Commandheal extends EssentialsLoopCommand
|
||||
try
|
||||
{
|
||||
healPlayer(player);
|
||||
sender.sendMessage(_("healOther", player.getDisplayName()));
|
||||
sender.sendMessage(tl("healOther", player.getDisplayName()));
|
||||
}
|
||||
catch (QuietAbortException e)
|
||||
{
|
||||
@@ -65,7 +65,7 @@ public class Commandheal extends EssentialsLoopCommand
|
||||
|
||||
if (player.getHealth() == 0)
|
||||
{
|
||||
throw new PlayerExemptException(_("healDead"));
|
||||
throw new PlayerExemptException(tl("healDead"));
|
||||
}
|
||||
|
||||
final double amount = player.getMaxHealth() - player.getHealth();
|
||||
@@ -85,7 +85,7 @@ public class Commandheal extends EssentialsLoopCommand
|
||||
player.setHealth(newAmount);
|
||||
player.setFoodLevel(20);
|
||||
player.setFireTicks(0);
|
||||
user.sendMessage(_("heal"));
|
||||
user.sendMessage(tl("heal"));
|
||||
for (PotionEffect effect : player.getActivePotionEffects())
|
||||
{
|
||||
player.removePotionEffect(effect.getType());
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.textreader.*;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
@@ -54,6 +54,6 @@ public class Commandhelp extends EssentialsCommand
|
||||
@Override
|
||||
protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
sender.sendMessage(_("helpConsole"));
|
||||
sender.sendMessage(tl("helpConsole"));
|
||||
}
|
||||
}
|
||||
|
@@ -2,12 +2,11 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import com.earth2me.essentials.Console;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.FormatUtil;
|
||||
import java.util.logging.Level;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class Commandhelpop extends EssentialsCommand
|
||||
@@ -21,7 +20,11 @@ public class Commandhelpop extends EssentialsCommand
|
||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
user.setDisplayNick();
|
||||
sendMessage(server, user.getSource(), user.getDisplayName(), args);
|
||||
final String message = sendMessage(server, user.getSource(), user.getDisplayName(), args);
|
||||
if (!user.isAuthorized("essentials.helpop.receive"))
|
||||
{
|
||||
user.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -30,23 +33,15 @@ public class Commandhelpop extends EssentialsCommand
|
||||
sendMessage(server, sender, Console.NAME, args);
|
||||
}
|
||||
|
||||
private void sendMessage(final Server server, final CommandSource sender, final String from, final String[] args) throws Exception
|
||||
private String sendMessage(final Server server, final CommandSource sender, final String from, final String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
final String message = _("helpOp", from, FormatUtil.stripFormat(getFinalArg(args, 0)));
|
||||
CommandSender cs = Console.getCommandSender(server);
|
||||
cs.sendMessage(message);
|
||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||
{
|
||||
final User player = ess.getUser(onlinePlayer);
|
||||
if (!player.isAuthorized("essentials.helpop.receive"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
player.sendMessage(message);
|
||||
}
|
||||
final String message = tl("helpOp", from, FormatUtil.stripFormat(getFinalArg(args, 0)));
|
||||
server.getLogger().log(Level.INFO, message);
|
||||
ess.broadcastMessage("essentials.helpop.receive", message);
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.StringUtil;
|
||||
@@ -18,6 +18,7 @@ public class Commandhome extends EssentialsCommand
|
||||
super("home");
|
||||
}
|
||||
|
||||
// This method contains an undocumented translation parameters #EasterEgg
|
||||
@Override
|
||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
@@ -45,7 +46,7 @@ public class Commandhome extends EssentialsCommand
|
||||
{
|
||||
if ("bed".equalsIgnoreCase(homeName) && user.isAuthorized("essentials.home.bed"))
|
||||
{
|
||||
final Location bed = player.getBedSpawnLocation();
|
||||
final Location bed = player.getBase().getBedSpawnLocation();
|
||||
if (bed != null)
|
||||
{
|
||||
user.getTeleport().teleport(bed, charge, TeleportCause.COMMAND);
|
||||
@@ -53,14 +54,14 @@ public class Commandhome extends EssentialsCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("bedMissing"));
|
||||
throw new Exception(tl("bedMissing"));
|
||||
}
|
||||
}
|
||||
goHome(user, player, homeName.toLowerCase(Locale.ENGLISH), charge);
|
||||
}
|
||||
catch (NotEnoughArgumentsException e)
|
||||
{
|
||||
Location bed = player.getBedSpawnLocation();
|
||||
Location bed = player.getBase().getBedSpawnLocation();
|
||||
final List<String> homes = player.getHomes();
|
||||
if (homes.isEmpty() && player.equals(user))
|
||||
{
|
||||
@@ -68,7 +69,7 @@ public class Commandhome extends EssentialsCommand
|
||||
}
|
||||
else if (homes.isEmpty())
|
||||
{
|
||||
throw new Exception(_("noHomeSetPlayer"));
|
||||
throw new Exception(tl("noHomeSetPlayer"));
|
||||
}
|
||||
else if (homes.size() == 1 && player.equals(user))
|
||||
{
|
||||
@@ -76,25 +77,43 @@ public class Commandhome extends EssentialsCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
final int count = homes.size();
|
||||
if (user.isAuthorized("essentials.home.bed"))
|
||||
{
|
||||
if (bed != null)
|
||||
{
|
||||
homes.add(_("bed"));
|
||||
homes.add(tl("bed"));
|
||||
}
|
||||
else
|
||||
{
|
||||
homes.add(_("bedNull"));
|
||||
homes.add(tl("bedNull"));
|
||||
}
|
||||
}
|
||||
user.sendMessage(_("homes", StringUtil.joinList(homes)));
|
||||
user.sendMessage(tl("homes", StringUtil.joinList(homes), count, getHomeLimit(player)));
|
||||
}
|
||||
}
|
||||
throw new NoChargeException();
|
||||
}
|
||||
|
||||
private void goHome(final User user, final User player, final String home, final Trade charge) throws Exception
|
||||
private String getHomeLimit(final User player)
|
||||
{
|
||||
if (!player.getBase().isOnline())
|
||||
{
|
||||
return "?";
|
||||
}
|
||||
if (player.isAuthorized("essentials.sethome.multiple.unlimited"))
|
||||
{
|
||||
return "*";
|
||||
}
|
||||
return Integer.toString(ess.getSettings().getHomeLimit(player));
|
||||
}
|
||||
|
||||
private void goHome(final User user, final User player, final String home, final Trade charge) throws Exception
|
||||
{
|
||||
if (home.length() < 1)
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
final Location loc = player.getHome(home);
|
||||
if (loc == null)
|
||||
{
|
||||
@@ -103,7 +122,7 @@ public class Commandhome extends EssentialsCommand
|
||||
if (user.getWorld() != loc.getWorld() && ess.getSettings().isWorldHomePermissions()
|
||||
&& !user.isAuthorized("essentials.worlds." + loc.getWorld().getName()))
|
||||
{
|
||||
throw new Exception(_("noPerm", "essentials.worlds." + loc.getWorld().getName()));
|
||||
throw new Exception(tl("noPerm", "essentials.worlds." + loc.getWorld().getName()));
|
||||
}
|
||||
user.getTeleport().teleport(loc, charge, TeleportCause.COMMAND);
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.Server;
|
||||
|
||||
@@ -23,7 +23,7 @@ public class Commandignore extends EssentialsCommand
|
||||
sb.append(s).append(" ");
|
||||
}
|
||||
String ignoredList = sb.toString().trim();
|
||||
user.sendMessage(ignoredList.length() > 0 ? _("ignoredList", ignoredList) : _("noIgnored"));
|
||||
user.sendMessage(ignoredList.length() > 0 ? tl("ignoredList", ignoredList) : tl("noIgnored"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -41,17 +41,17 @@ public class Commandignore extends EssentialsCommand
|
||||
throw new PlayerNotFoundException();
|
||||
}
|
||||
if (player.isIgnoreExempt()) {
|
||||
user.sendMessage(_("ignoreExempt"));
|
||||
user.sendMessage(tl("ignoreExempt"));
|
||||
}
|
||||
else if (user.isIgnoredPlayer(player))
|
||||
{
|
||||
user.setIgnoredPlayer(player, false);
|
||||
user.sendMessage(_("unignorePlayer", player.getName()));
|
||||
user.sendMessage(tl("unignorePlayer", player.getName()));
|
||||
}
|
||||
else
|
||||
{
|
||||
user.setIgnoredPlayer(player, true);
|
||||
user.sendMessage(_("ignorePlayer", player.getName()));
|
||||
user.sendMessage(tl("ignorePlayer", player.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -27,14 +27,14 @@ public class Commandinvsee extends EssentialsCommand
|
||||
if (args.length > 1 && user.isAuthorized("essentials.invsee.equip"))
|
||||
{
|
||||
inv = server.createInventory(invUser.getBase(), 9, "Equipped");
|
||||
inv.setContents(invUser.getInventory().getArmorContents());
|
||||
inv.setContents(invUser.getBase().getInventory().getArmorContents());
|
||||
}
|
||||
else
|
||||
{
|
||||
inv = invUser.getInventory();
|
||||
inv = invUser.getBase().getInventory();
|
||||
}
|
||||
user.closeInventory();
|
||||
user.openInventory(inv);
|
||||
user.getBase().closeInventory();
|
||||
user.getBase().openInventory(inv);
|
||||
user.setInvSee(true);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.MetaItemStack;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
@@ -34,7 +34,7 @@ public class Commanditem extends EssentialsCommand
|
||||
: (!user.isAuthorized("essentials.itemspawn.exempt")
|
||||
&& !user.canSpawnItem(stack.getTypeId())))
|
||||
{
|
||||
throw new Exception(_("cantSpawnItem", itemname));
|
||||
throw new Exception(tl("cantSpawnItem", itemname));
|
||||
}
|
||||
try
|
||||
{
|
||||
@@ -68,19 +68,19 @@ public class Commanditem extends EssentialsCommand
|
||||
|
||||
if (stack.getType() == Material.AIR)
|
||||
{
|
||||
throw new Exception(_("cantSpawnItem", "Air"));
|
||||
throw new Exception(tl("cantSpawnItem", "Air"));
|
||||
}
|
||||
|
||||
final String displayName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' ');
|
||||
user.sendMessage(_("itemSpawn", stack.getAmount(), displayName));
|
||||
user.sendMessage(tl("itemSpawn", stack.getAmount(), displayName));
|
||||
if (user.isAuthorized("essentials.oversizedstacks"))
|
||||
{
|
||||
InventoryWorkaround.addOversizedItems(user.getInventory(), ess.getSettings().getOversizedStackSize(), stack);
|
||||
InventoryWorkaround.addOversizedItems(user.getBase().getInventory(), ess.getSettings().getOversizedStackSize(), stack);
|
||||
}
|
||||
else
|
||||
{
|
||||
InventoryWorkaround.addItems(user.getInventory(), stack);
|
||||
InventoryWorkaround.addItems(user.getBase().getInventory(), stack);
|
||||
}
|
||||
user.updateInventory();
|
||||
user.getBase().updateInventory();
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -35,7 +35,7 @@ public class Commanditemdb extends EssentialsCommand
|
||||
{
|
||||
itemStack = ess.getItemDb().get(args[0]);
|
||||
}
|
||||
sender.sendMessage(_("itemType", itemStack.getType().toString(), itemStack.getTypeId() + ":" + Integer.toString(itemStack.getDurability())));
|
||||
sender.sendMessage(tl("itemType", itemStack.getType().toString(), itemStack.getTypeId() + ":" + Integer.toString(itemStack.getDurability())));
|
||||
|
||||
if (itemHeld && itemStack.getType() != Material.AIR)
|
||||
{
|
||||
@@ -43,13 +43,13 @@ public class Commanditemdb extends EssentialsCommand
|
||||
int durability = ((maxuses + 1) - itemStack.getDurability());
|
||||
if (maxuses != 0)
|
||||
{
|
||||
sender.sendMessage(_("durability", Integer.toString(durability)));
|
||||
sender.sendMessage(tl("durability", Integer.toString(durability)));
|
||||
}
|
||||
}
|
||||
final String itemNameList = ess.getItemDb().names(itemStack);
|
||||
if (itemNameList != null)
|
||||
{
|
||||
sender.sendMessage(_("itemNames", ess.getItemDb().names(itemStack)));
|
||||
sender.sendMessage(tl("itemNames", ess.getItemDb().names(itemStack)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user