diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-08-21 19:34:26 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-08-21 19:34:26 +0100 |
commit | 44e9c6ebfc2bb6c86f61e46d03574920d5e2fddb (patch) | |
tree | 6c30e726bbdce5dc4c8fb3bdedf186dee116a179 | |
parent | 03a93bfeff030aec6a5c22109d8be18cc8dab6e7 (diff) | |
parent | a836576211b1fe7b027d903a384b56a9f2852eac (diff) | |
download | Essentials-44e9c6ebfc2bb6c86f61e46d03574920d5e2fddb.tar Essentials-44e9c6ebfc2bb6c86f61e46d03574920d5e2fddb.tar.gz Essentials-44e9c6ebfc2bb6c86f61e46d03574920d5e2fddb.tar.lz Essentials-44e9c6ebfc2bb6c86f61e46d03574920d5e2fddb.tar.xz Essentials-44e9c6ebfc2bb6c86f61e46d03574920d5e2fddb.zip |
Merge branch '2.9' into release
137 files changed, 1653 insertions, 10076 deletions
diff --git a/.gitignore b/.gitignore index eda2b5917..524ed1334 100644 --- a/.gitignore +++ b/.gitignore @@ -1,42 +1,45 @@ -.DS_Store -/BuildAll/nbproject/private/ -/EssentialsProtect/nbproject/private/ -/EssentialsChat/nbproject/private/ -/EssentialsGroupBridge/nbproject/private/ -/EssentialsGeoIP/nbproject/private/ -/EssentialsSpawn/nbproject/private/ -/EssentialsXMPP/nbproject/private/ -/EssentialsGroupManager/nbproject/private/ -/BuildAll/build/ -/EssentialsGroupBridge/dist/ -/EssentialsGroupBridge/build/ -/EssentialsGeoIP/dist/ -/EssentialsGeoIP/build/ -/EssentialsGroupManager/build/ -/EssentialsGroupManager/dist/ -/BuildAll/dist/ -/EssentialsChat/build/ -/EssentialsChat/dist/ -/EssentialsSpawn/build/ -/EssentialsSpawn/dist/ -/EssentialsXMPP/dist/ -/EssentialsXMPP/build/ -/EssentialsProtect/dist/ -/EssentialsProtect/build/ -/EssentialsPermissionsCommands/nbproject/private/ -/EssentialsPermissionsCommands/build/ -/EssentialsPermissionsCommands/dist/ -/Essentials/nbproject/private/ -/Essentials/dist/ -/Essentials/build/ -/YamlAnnotations/ -/EssentialsUpdate/nbproject/private/ -/EssentialsRelease/ -/EssentialsUpdate/dist/ -/EssentialsUpdate/build/ -/WebPush/apikey.php -/WebPush/nbproject/private -/.idea +.DS_Store
+/BuildAll/nbproject/private/
+/EssentialsProtect/nbproject/private/
+/EssentialsChat/nbproject/private/
+/EssentialsGroupBridge/nbproject/private/
+/EssentialsGeoIP/nbproject/private/
+/EssentialsSpawn/nbproject/private/
+/EssentialsXMPP/nbproject/private/
+/EssentialsGroupManager/nbproject/private/
+/BuildAll/build/
+/EssentialsGroupBridge/dist/
+/EssentialsGroupBridge/build/
+/EssentialsGeoIP/dist/
+/EssentialsGeoIP/build/
+/EssentialsGroupManager/build/
+/EssentialsGroupManager/dist/
+/BuildAll/dist/
+/EssentialsChat/build/
+/EssentialsChat/dist/
+/EssentialsSpawn/build/
+/EssentialsSpawn/dist/
+/EssentialsXMPP/dist/
+/EssentialsXMPP/build/
+/EssentialsProtect/dist/
+/EssentialsProtect/build/
+/EssentialsPermissionsCommands/nbproject/private/
+/EssentialsPermissionsCommands/build/
+/EssentialsPermissionsCommands/dist/
+/Essentials/nbproject/private/
+/Essentials/dist/
+/Essentials/build/
+/YamlAnnotations/
+/EssentialsUpdate/nbproject/private/
+/EssentialsRelease/
+/EssentialsUpdate/dist/
+/EssentialsUpdate/build/
+/WebPush/apikey.php
+/WebPush/nbproject/private
+/.idea
*.iml
/EssentialsGroupManager/bin
-/EssentialsGroupManager/.externalToolBuilders
\ No newline at end of file +/EssentialsGroupManager/.externalToolBuilders
+/EssentialsAntiBuild/nbproject/private/
+/EssentialsAntiBuild/dist/
+/EssentialsAntiBuild/build/
\ No newline at end of file diff --git a/BuildAll/nbproject/build-impl.xml b/BuildAll/nbproject/build-impl.xml index 58eac422c..d52f998c1 100644 --- a/BuildAll/nbproject/build-impl.xml +++ b/BuildAll/nbproject/build-impl.xml @@ -12,9 +12,9 @@ is divided into following sections: - execution - debugging - javadoc - - test compilation - - test execution - - test debugging + - junit compilation + - junit execution + - junit debugging - applet - cleanup @@ -181,7 +181,6 @@ is divided into following sections: </and> </condition> <property name="run.jvmargs" value=""/> - <property name="run.jvmargs.ide" value=""/> <property name="javac.compilerargs" value=""/> <property name="work.dir" value="${basedir}"/> <condition property="no.deps"> @@ -226,27 +225,6 @@ is divided into following sections: <property name="jar.index.metainf" value="${jar.index}"/> <property name="copylibs.rebase" value="true"/> <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/> - <condition property="junit.available"> - <or> - <available classname="org.junit.Test" classpath="${run.test.classpath}"/> - <available classname="junit.framework.Test" classpath="${run.test.classpath}"/> - </or> - </condition> - <condition property="testng.available"> - <available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/> - </condition> - <condition property="junit+testng.available"> - <and> - <istrue value="${junit.available}"/> - <istrue value="${testng.available}"/> - </and> - </condition> - <condition else="testng" property="testng.mode" value="mixed"> - <istrue value="${junit+testng.available}"/> - </condition> - <condition else="" property="testng.debug.mode" value="-mixed"> - <istrue value="${junit+testng.available}"/> - </condition> </target> <target name="-post-init"> <!-- Empty placeholder for easier customization. --> @@ -379,193 +357,11 @@ is divided into following sections: </sequential> </macrodef> </target> - <target if="${junit.available}" name="-init-macrodef-junit-init"> - <condition else="false" property="nb.junit.batch" value="true"> - <and> - <istrue value="${junit.available}"/> - <not> - <isset property="test.method"/> - </not> - </and> - </condition> - <condition else="false" property="nb.junit.single" value="true"> - <and> - <istrue value="${junit.available}"/> - <isset property="test.method"/> - </and> - </condition> - </target> - <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}"> + <target name="-init-macrodef-junit"> <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> <attribute default="${includes}" name="includes"/> <attribute default="${excludes}" name="excludes"/> <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <element name="customize" optional="true"/> - <sequential> - <property name="junit.forkmode" value="perTest"/> - <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> - <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> - <syspropertyset> - <propertyref prefix="test-sys-prop."/> - <mapper from="test-sys-prop.*" to="*" type="glob"/> - </syspropertyset> - <formatter type="brief" usefile="false"/> - <formatter type="xml"/> - <jvmarg value="-ea"/> - <customize/> - </junit> - </sequential> - </macrodef> - </target> - <target if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}"> - <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <element name="customize" optional="true"/> - <sequential> - <property name="junit.forkmode" value="perTest"/> - <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> - <batchtest todir="${build.test.results.dir}"> - <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> - <filename name="@{testincludes}"/> - </fileset> - </batchtest> - <syspropertyset> - <propertyref prefix="test-sys-prop."/> - <mapper from="test-sys-prop.*" to="*" type="glob"/> - </syspropertyset> - <formatter type="brief" usefile="false"/> - <formatter type="xml"/> - <jvmarg value="-ea"/> - <customize/> - </junit> - </sequential> - </macrodef> - </target> - <target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/> - <target if="${testng.available}" name="-init-macrodef-testng"> - <macrodef name="testng" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <element name="customize" optional="true"/> - <sequential> - <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}"> - <isset property="test.method"/> - </condition> - <union id="test.set"> - <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}"> - <filename name="@{testincludes}"/> - </fileset> - </union> - <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/> - <testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="BuildAll" testname="TestNG tests" workingDir="${work.dir}"> - <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> - <propertyset> - <propertyref prefix="test-sys-prop."/> - <mapper from="test-sys-prop.*" to="*" type="glob"/> - </propertyset> - <customize/> - </testng> - </sequential> - </macrodef> - </target> - <target name="-init-macrodef-test-impl"> - <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <element implicit="true" name="customize" optional="true"/> - <sequential> - <echo>No tests executed.</echo> - </sequential> - </macrodef> - </target> - <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl"> - <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <element implicit="true" name="customize" optional="true"/> - <sequential> - <j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> - <customize/> - </j2seproject3:junit> - </sequential> - </macrodef> - </target> - <target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl"> - <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <element implicit="true" name="customize" optional="true"/> - <sequential> - <j2seproject3:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> - <customize/> - </j2seproject3:testng> - </sequential> - </macrodef> - </target> - <target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test"> - <macrodef name="test" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <sequential> - <j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> - <customize> - <classpath> - <path path="${run.test.classpath}"/> - </classpath> - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> - <jvmarg line="${run.jvmargs}"/> - <jvmarg line="${run.jvmargs.ide}"/> - </customize> - </j2seproject3:test-impl> - </sequential> - </macrodef> - </target> - <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}"> - <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <element name="customize" optional="true"/> - <sequential> - <property name="junit.forkmode" value="perTest"/> - <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> - <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> - <syspropertyset> - <propertyref prefix="test-sys-prop."/> - <mapper from="test-sys-prop.*" to="*" type="glob"/> - </syspropertyset> - <formatter type="brief" usefile="false"/> - <formatter type="xml"/> - <jvmarg value="-ea"/> - <jvmarg line="${debug-args-line}"/> - <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> - <customize/> - </junit> - </sequential> - </macrodef> - </target> - <target if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch"> - <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <element name="customize" optional="true"/> <sequential> <property name="junit.forkmode" value="perTest"/> <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> @@ -574,129 +370,32 @@ is divided into following sections: <filename name="@{testincludes}"/> </fileset> </batchtest> + <classpath> + <path path="${run.test.classpath}"/> + </classpath> <syspropertyset> <propertyref prefix="test-sys-prop."/> <mapper from="test-sys-prop.*" to="*" type="glob"/> </syspropertyset> <formatter type="brief" usefile="false"/> <formatter type="xml"/> + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> <jvmarg value="-ea"/> - <jvmarg line="${debug-args-line}"/> - <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> - <customize/> + <jvmarg line="${run.jvmargs}"/> </junit> </sequential> </macrodef> </target> - <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl"> - <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <element implicit="true" name="customize" optional="true"/> - <sequential> - <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> - <customize/> - </j2seproject3:junit-debug> - </sequential> - </macrodef> - </target> - <target if="${testng.available}" name="-init-macrodef-testng-debug"> - <macrodef name="testng-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${main.class}" name="testClass"/> - <attribute default="" name="testMethod"/> - <element name="customize2" optional="true"/> - <sequential> - <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}"> - <isset property="test.method"/> - </condition> - <condition else="-suitename BuildAll -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}"> - <matches pattern=".*\.xml" string="@{testClass}"/> - </condition> - <delete dir="${build.test.results.dir}" quiet="true"/> - <mkdir dir="${build.test.results.dir}"/> - <j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}"> - <customize> - <customize2/> - <jvmarg value="-ea"/> - <arg line="${testng.debug.mode}"/> - <arg line="-d ${build.test.results.dir}"/> - <arg line="-listener org.testng.reporters.VerboseReporter"/> - <arg line="${testng.cmd.args}"/> - </customize> - </j2seproject3:debug> - </sequential> - </macrodef> - </target> - <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl"> - <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${main.class}" name="testClass"/> - <attribute default="" name="testMethod"/> - <element implicit="true" name="customize2" optional="true"/> - <sequential> - <j2seproject3:testng-debug testClass="@{testClass}" testMethod="@{testMethod}"> - <customize2/> - </j2seproject3:testng-debug> - </sequential> - </macrodef> - </target> - <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit"> - <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <attribute default="${main.class}" name="testClass"/> - <attribute default="" name="testMethod"/> - <sequential> - <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> - <customize> - <classpath> - <path path="${run.test.classpath}"/> - </classpath> - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> - <jvmarg line="${run.jvmargs}"/> - <jvmarg line="${run.jvmargs.ide}"/> - </customize> - </j2seproject3:test-debug-impl> - </sequential> - </macrodef> - </target> - <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng"> - <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <attribute default="${main.class}" name="testClass"/> - <attribute default="" name="testMethod"/> - <sequential> - <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}"> - <customize2> - <syspropertyset> - <propertyref prefix="test-sys-prop."/> - <mapper from="test-sys-prop.*" to="*" type="glob"/> - </syspropertyset> - </customize2> - </j2seproject3:testng-debug-impl> - </sequential> - </macrodef> - </target> - <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/> - <!-- - pre NB7.2 profiling section; consider it deprecated - --> - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/> - <target if="profiler.info.jvmargs.agent" name="-profile-pre-init"> + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/> + <target name="-profile-pre-init"> <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> - <target if="profiler.info.jvmargs.agent" name="-profile-post-init"> + <target name="-profile-post-init"> <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> - <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile"> + <target name="-profile-init-macrodef-profile"> <macrodef name="resolve"> <attribute name="name"/> <attribute name="value"/> @@ -728,13 +427,10 @@ is divided into following sections: </sequential> </macrodef> </target> - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check"> + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check"> <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail> <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail> </target> - <!-- - end of pre NB7.2 profiling section - --> <target depends="-init-debug-args" name="-init-macrodef-nbjpda"> <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1"> <attribute default="${main.class}" name="name"/> @@ -792,7 +488,6 @@ is divided into following sections: <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> <jvmarg line="${run.jvmargs}"/> - <jvmarg line="${run.jvmargs.ide}"/> <classpath> <path path="@{classpath}"/> </classpath> @@ -809,7 +504,6 @@ is divided into following sections: <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1"> <attribute default="${main.class}" name="classname"/> <attribute default="${run.classpath}" name="classpath"/> - <attribute default="jvm" name="jvm"/> <element name="customize" optional="true"/> <sequential> <java classname="@{classname}" dir="${work.dir}" fork="true"> @@ -817,7 +511,6 @@ is divided into following sections: <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> <jvmarg line="${run.jvmargs}"/> - <jvmarg line="${run.jvmargs.ide}"/> <classpath> <path path="@{classpath}"/> </classpath> @@ -844,9 +537,6 @@ is divided into following sections: <path path="${run.classpath.without.build.classes.dir}"/> <chainedmapper> <flattenmapper/> - <filtermapper> - <replacestring from=" " to="%20"/> - </filtermapper> <globmapper from="*" to="lib/*"/> </chainedmapper> </pathconvert> @@ -892,7 +582,7 @@ is divided into following sections: <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline"> <property name="ap.cmd.line.internal" value=""/> </target> - <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/> + <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/> <!-- =================== COMPILATION SECTION @@ -950,6 +640,13 @@ is divided into following sections: </antcall> <antcall target="-maybe-call-dep"> <param name="call.built.properties" value="${built-jar.properties}"/> + <param location="${project.EssentialsAntiBuild}" name="call.subproject"/> + <param location="${project.EssentialsAntiBuild}/build.xml" name="call.script"/> + <param name="call.target" value="jar"/> + <param name="transfer.built-jar.properties" value="${built-jar.properties}"/> + </antcall> + <antcall target="-maybe-call-dep"> + <param name="call.built.properties" value="${built-jar.properties}"/> <param location="${project.EssentialsProtect}" name="call.subproject"/> <param location="${project.EssentialsProtect}/build.xml" name="call.script"/> <param name="call.target" value="jar"/> @@ -1164,11 +861,7 @@ is divided into following sections: PROFILING SECTION ================= --> - <!-- - pre NB7.2 profiler integration - --> - <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72"> - <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> + <target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile"> <nbprofiledirect> <classpath> <path path="${run.classpath}"/> @@ -1176,9 +869,8 @@ is divided into following sections: </nbprofiledirect> <profile/> </target> - <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72"> + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single"> <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail> - <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> <nbprofiledirect> <classpath> <path path="${run.classpath}"/> @@ -1186,8 +878,12 @@ is divided into following sections: </nbprofiledirect> <profile classname="${profile.class}"/> </target> - <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72"> - <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> + <!-- + ========================= + APPLET PROFILING SECTION + ========================= + --> + <target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet"> <nbprofiledirect> <classpath> <path path="${run.classpath}"/> @@ -1199,8 +895,12 @@ is divided into following sections: </customize> </profile> </target> - <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72"> - <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> + <!-- + ========================= + TESTS PROFILING SECTION + ========================= + --> + <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single"> <nbprofiledirect> <classpath> <path path="${run.test.classpath}"/> @@ -1223,42 +923,6 @@ is divided into following sections: </junit> </target> <!-- - end of pre NB72 profiling section - --> - <target if="netbeans.home" name="-profile-check"> - <condition property="profiler.configured"> - <or> - <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/> - <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/> - </or> - </condition> - </target> - <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent"> - <startprofiler/> - <antcall target="run"/> - </target> - <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent"> - <fail unless="run.class">Must select one file in the IDE or set run.class</fail> - <startprofiler/> - <antcall target="run-single"/> - </target> - <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/> - <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs"> - <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> - <startprofiler/> - <antcall target="test-single"/> - </target> - <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main"> - <fail unless="run.class">Must select one file in the IDE or set run.class</fail> - <startprofiler/> - <antcal target="run-test-with-main"/> - </target> - <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent"> - <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> - <startprofiler/> - <antcall target="run-applet"/> - </target> - <!-- =============== JAVADOC SECTION =============== @@ -1301,7 +965,7 @@ is divided into following sections: <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/> <!-- ========================= - TEST COMPILATION SECTION + JUNIT COMPILATION SECTION ========================= --> <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test"> @@ -1344,14 +1008,14 @@ is divided into following sections: <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/> <!-- ======================= - TEST EXECUTION SECTION + JUNIT EXECUTION SECTION ======================= --> <target depends="init" if="have.tests" name="-pre-test-run"> <mkdir dir="${build.test.results.dir}"/> </target> <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run"> - <j2seproject3:test testincludes="**/*Test.java"/> + <j2seproject3:junit testincludes="**/*Test.java"/> </target> <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run"> <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> @@ -1364,40 +1028,39 @@ is divided into following sections: </target> <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single"> <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> - <j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/> + <j2seproject3:junit excludes="" includes="${test.includes}"/> </target> <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single"> <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> </target> <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/> - <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method"> - <fail unless="test.class">Must select some files in the IDE or set test.class</fail> - <fail unless="test.method">Must select some method in the IDE or set test.method</fail> - <j2seproject3:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/> - </target> - <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method"> - <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> - </target> - <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/> <!-- ======================= - TEST DEBUGGING SECTION + JUNIT DEBUGGING SECTION ======================= --> - <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test"> + <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test"> <fail unless="test.class">Must select one file in the IDE or set test.class</fail> - <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/> - </target> - <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method"> - <fail unless="test.class">Must select one file in the IDE or set test.class</fail> - <fail unless="test.method">Must select some method in the IDE or set test.method</fail> - <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/> + <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/> + <delete file="${test.report.file}"/> + <mkdir dir="${build.test.results.dir}"/> + <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}"> + <customize> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <arg value="${test.class}"/> + <arg value="showoutput=true"/> + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/> + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/> + </customize> + </j2seproject3:debug> </target> <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test"> <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/> </target> <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/> - <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/> <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test"> <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/> </target> @@ -1486,6 +1149,13 @@ is divided into following sections: </antcall> <antcall target="-maybe-call-dep"> <param name="call.built.properties" value="${built-clean.properties}"/> + <param location="${project.EssentialsAntiBuild}" name="call.subproject"/> + <param location="${project.EssentialsAntiBuild}/build.xml" name="call.script"/> + <param name="call.target" value="clean"/> + <param name="transfer.built-clean.properties" value="${built-clean.properties}"/> + </antcall> + <antcall target="-maybe-call-dep"> + <param name="call.built.properties" value="${built-clean.properties}"/> <param location="${project.EssentialsProtect}" name="call.subproject"/> <param location="${project.EssentialsProtect}/build.xml" name="call.script"/> <param name="call.target" value="clean"/> @@ -1518,12 +1188,9 @@ is divided into following sections: <target name="-check-call-dep"> <property file="${call.built.properties}" prefix="already.built."/> <condition property="should.call.dep"> - <and> - <not> - <isset property="already.built.${call.subproject}"/> - </not> - <available file="${call.script}"/> - </and> + <not> + <isset property="already.built.${call.subproject}"/> + </not> </condition> </target> <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep"> diff --git a/BuildAll/nbproject/genfiles.properties b/BuildAll/nbproject/genfiles.properties index 95b41a19a..de7702440 100644 --- a/BuildAll/nbproject/genfiles.properties +++ b/BuildAll/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=51b33957 +build.xml.data.CRC32=b4df970c build.xml.script.CRC32=7a797370 -build.xml.stylesheet.CRC32=28e38971@1.44.1.45 +build.xml.stylesheet.CRC32=28e38971@1.50.3.46 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=51b33957 -nbproject/build-impl.xml.script.CRC32=2a17f1e9 -nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46 +nbproject/build-impl.xml.data.CRC32=b4df970c +nbproject/build-impl.xml.script.CRC32=1fd6d3cc +nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.3.46 diff --git a/BuildAll/nbproject/project.properties b/BuildAll/nbproject/project.properties index 246ea1240..2bbfdd15b 100644 --- a/BuildAll/nbproject/project.properties +++ b/BuildAll/nbproject/project.properties @@ -66,6 +66,7 @@ jar.compress=true javac.classpath=\ ${reference.Essentials.jar}:\ ${reference.EssentialsChat.jar}:\ + ${reference.EssentialsAntiBuild.jar}:\ ${reference.EssentialsProtect.jar}:\ ${reference.EssentialsSpawn.jar}:\ ${reference.EssentialsGeoIP.jar}:\ @@ -103,6 +104,7 @@ project.EssentialsChat=../EssentialsChat project.EssentialsGeoIP=../EssentialsGeoIP project.EssentialsGroupBridge=../EssentialsGroupBridge project.EssentialsGroupManager=../EssentialsGroupManager +project.EssentialsAntiBuild=../EssentialsAntiBuild project.EssentialsProtect=../EssentialsProtect project.EssentialsSpawn=../EssentialsSpawn project.EssentialsXMPP=../EssentialsXMPP @@ -111,6 +113,7 @@ reference.EssentialsChat.jar=${project.EssentialsChat}/dist/EssentialsChat.jar reference.EssentialsGeoIP.jar=${project.EssentialsGeoIP}/dist/EssentialsGeoIP.jar reference.EssentialsGroupBridge.jar=${project.EssentialsGroupBridge}/dist/EssentialsGroupBridge.jar reference.EssentialsGroupManager.jar=${project.EssentialsGroupManager}/dist/EssentialsGroupManager.jar +reference.EssentialsAntiBuild.jar=${project.EssentialsAntiBuild}/dist/EssentialsAntiBuild.jar reference.EssentialsProtect.jar=${project.EssentialsProtect}/dist/EssentialsProtect.jar reference.EssentialsSpawn.jar=${project.EssentialsSpawn}/dist/EssentialsSpawn.jar reference.EssentialsXMPP.jar=${project.EssentialsXMPP}/dist/EssentialsXMPP.jar diff --git a/BuildAll/nbproject/project.xml b/BuildAll/nbproject/project.xml index 420233ac9..7a2d6b451 100644 --- a/BuildAll/nbproject/project.xml +++ b/BuildAll/nbproject/project.xml @@ -56,6 +56,14 @@ <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> diff --git a/Essentials/nbproject/project.properties b/Essentials/nbproject/project.properties index 7a5ffe7bb..a9cebbb92 100644 --- a/Essentials/nbproject/project.properties +++ b/Essentials/nbproject/project.properties @@ -1,5 +1,5 @@ annotation.processing.enabled=true -annotation.processing.enabled.in.editor=false +annotation.processing.enabled.in.editor=true annotation.processing.processors.list=lombok.core.AnnotationProcessor annotation.processing.run.all.processors=false annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output diff --git a/Essentials/src/com/earth2me/essentials/I18n.java b/Essentials/src/com/earth2me/essentials/I18n.java index 97d500a6a..c00180087 100644 --- a/Essentials/src/com/earth2me/essentials/I18n.java +++ b/Essentials/src/com/earth2me/essentials/I18n.java @@ -70,7 +70,8 @@ public class I18n implements II18n public static String _(final String string, final Object... objects) { - if (instance == null) { + if (instance == null) + { return ""; } if (objects.length == 0) @@ -85,11 +86,20 @@ public class I18n implements II18n public String format(final String string, final Object... objects) { - final String format = translate(string); + String format = translate(string); MessageFormat messageFormat = messageFormatCache.get(format); if (messageFormat == null) { - messageFormat = new MessageFormat(format); + try + { + messageFormat = new MessageFormat(format); + } + catch (IllegalArgumentException e) + { + ess.getLogger().log(Level.SEVERE, "Invalid Translation key for '" + string + "': " + e.getMessage()); + format = format.replaceAll("\\{(\\D*?)\\}", "\\[$1\\]"); + messageFormat = new MessageFormat(format); + } messageFormatCache.put(format, messageFormat); } return messageFormat.format(objects); diff --git a/Essentials/src/com/earth2me/essentials/IConf.java b/Essentials/src/com/earth2me/essentials/IConf.java index 580e6232f..a523f8638 100644 --- a/Essentials/src/com/earth2me/essentials/IConf.java +++ b/Essentials/src/com/earth2me/essentials/IConf.java @@ -1,9 +1,5 @@ package com.earth2me.essentials; -/** - * @deprecated New interface will be IReload in api package - */ -@Deprecated public interface IConf { public void reloadConfig(); } diff --git a/Essentials/src/com/earth2me/essentials/IEssentials.java b/Essentials/src/com/earth2me/essentials/IEssentials.java index f12798db3..9d61391d1 100644 --- a/Essentials/src/com/earth2me/essentials/IEssentials.java +++ b/Essentials/src/com/earth2me/essentials/IEssentials.java @@ -12,10 +12,6 @@ import org.bukkit.plugin.Plugin; import org.bukkit.scheduler.BukkitScheduler; -/** - * @deprecated This will be moved to the api package soon - */ -@Deprecated public interface IEssentials extends Plugin { void addReloadListener(IConf listener); diff --git a/Essentials/src/com/earth2me/essentials/IUser.java b/Essentials/src/com/earth2me/essentials/IUser.java index bfa9ed146..8c0d6212f 100644 --- a/Essentials/src/com/earth2me/essentials/IUser.java +++ b/Essentials/src/com/earth2me/essentials/IUser.java @@ -5,10 +5,6 @@ import org.bukkit.Location; import org.bukkit.entity.Player; -/** - * @deprecated This will be moved to the api package soon - */ -@Deprecated public interface IUser extends Player { long getLastTeleportTimestamp(); diff --git a/Essentials/src/com/earth2me/essentials/Kit.java b/Essentials/src/com/earth2me/essentials/Kit.java index 5a907beb3..136c1d6f5 100644 --- a/Essentials/src/com/earth2me/essentials/Kit.java +++ b/Essentials/src/com/earth2me/essentials/Kit.java @@ -78,6 +78,7 @@ public class Kit { throw new Exception(_("kitError2")); } + try { diff --git a/Essentials/src/com/earth2me/essentials/Trade.java b/Essentials/src/com/earth2me/essentials/Trade.java index 3d3f36d8c..707665d93 100644 --- a/Essentials/src/com/earth2me/essentials/Trade.java +++ b/Essentials/src/com/earth2me/essentials/Trade.java @@ -63,6 +63,12 @@ public class Trade public void isAffordableFor(final IUser user) throws ChargeException { + + if (ess.getSettings().isDebug()) + { + ess.getLogger().log(Level.INFO, "checking if " + user.getName() + " can afford charge."); + } + if (getMoney() != null && getMoney() > 0 && !user.canAfford(getMoney())) @@ -206,8 +212,17 @@ public class Trade cost = ess.getSettings().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command); if (cost == 0.0 && fallbackCommand != null && !fallbackCommand.isEmpty()) { + if (ess.getSettings().isDebug()) + { + ess.getLogger().log(Level.INFO, "checking fallback command cost (" + fallbackCommand + ") cost for " + user.getName()); + } cost = ess.getSettings().getCommandCost(fallbackCommand.charAt(0) == '/' ? fallbackCommand.substring(1) : fallbackCommand); } + + if (ess.getSettings().isDebug()) + { + ess.getLogger().log(Level.INFO, "calculated command (" + command + ") cost for " + user.getName() + " as " + cost); + } } return cost; } diff --git a/Essentials/src/com/earth2me/essentials/api/IAlternativeCommandsHandler.java b/Essentials/src/com/earth2me/essentials/api/IAlternativeCommandsHandler.java deleted file mode 100644 index 11619bca4..000000000 --- a/Essentials/src/com/earth2me/essentials/api/IAlternativeCommandsHandler.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.earth2me.essentials.api; - -import java.util.Map; -import org.bukkit.command.PluginCommand; - - -public interface IAlternativeCommandsHandler -{ - Map<String, String> disabledCommands(); -} diff --git a/Essentials/src/com/earth2me/essentials/api/IEssentials.java b/Essentials/src/com/earth2me/essentials/api/IEssentials.java deleted file mode 100644 index c04bed0bd..000000000 --- a/Essentials/src/com/earth2me/essentials/api/IEssentials.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.earth2me.essentials.api; - -import com.earth2me.essentials.perm.IPermissionsHandler; -import com.earth2me.essentials.register.payment.Methods; -import org.bukkit.World; -import org.bukkit.command.CommandSender; -import org.bukkit.plugin.Plugin; - - -public interface IEssentials extends Plugin, IReload -{ - void addReloadListener(IReload listener); - - IUser getUser(Object base); - - int broadcastMessage(IUser sender, String message); - - II18n getI18n(); - - ISettings getSettings(); - - IJails getJail(); - - IWarps getWarps(); - - IWorth getWorth(); - - IItemDb getItemDb(); - - IUserMap getUserMap(); - - IEssentialsEconomy getEconomy(); - - World getWorld(String name); - - Methods getPaymentMethod(); - - int scheduleAsyncDelayedTask(Runnable run); - - int scheduleSyncDelayedTask(Runnable run); - - int scheduleSyncDelayedTask(Runnable run, long delay); - - int scheduleSyncRepeatingTask(Runnable run, long delay, long period); - - IPermissionsHandler getPermissionsHandler(); - - IAlternativeCommandsHandler getAlternativeCommandsHandler(); - - void showCommandError(CommandSender sender, String commandLabel, Throwable exception); -} diff --git a/Essentials/src/com/earth2me/essentials/api/IEssentialsEconomy.java b/Essentials/src/com/earth2me/essentials/api/IEssentialsEconomy.java deleted file mode 100644 index 72fb89d26..000000000 --- a/Essentials/src/com/earth2me/essentials/api/IEssentialsEconomy.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.earth2me.essentials.api; - - -public interface IEssentialsEconomy -{ - double getMoney(String name) throws UserDoesNotExistException; - - void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException; - - void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException; - - void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException; - - void divide(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException; - - void multiply(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException; - - void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException; - - boolean hasEnough(String name, double amount) throws UserDoesNotExistException; - - boolean hasMore(String name, double amount) throws UserDoesNotExistException; - - boolean hasLess(String name, double amount) throws UserDoesNotExistException; - - boolean isNegative(String name) throws UserDoesNotExistException; - - String format(double amount); - - boolean playerExists(String name); - - boolean isNPC(String name) throws UserDoesNotExistException; - - boolean createNPC(String name); - - void removeNPC(String name) throws UserDoesNotExistException; -} diff --git a/Essentials/src/com/earth2me/essentials/api/ISettings.java b/Essentials/src/com/earth2me/essentials/api/ISettings.java deleted file mode 100644 index eff65ad87..000000000 --- a/Essentials/src/com/earth2me/essentials/api/ISettings.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.earth2me.essentials.api; - -import com.earth2me.essentials.settings.Settings; -import com.earth2me.essentials.storage.IStorageObjectHolder; - - -public interface ISettings extends IStorageObjectHolder<Settings> -{ - -} diff --git a/Essentials/src/com/earth2me/essentials/api/IUser.java b/Essentials/src/com/earth2me/essentials/api/IUser.java deleted file mode 100644 index 5d2f9d4b8..000000000 --- a/Essentials/src/com/earth2me/essentials/api/IUser.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.earth2me.essentials.api; - -import com.earth2me.essentials.commands.IEssentialsCommand; -import org.bukkit.Location; -import org.bukkit.entity.Player; - - -public interface IUser extends Player, IReload -{ - long getLastTeleportTimestamp(); - - boolean isAuthorized(String node); - - boolean isAuthorized(IEssentialsCommand cmd); - - boolean isAuthorized(IEssentialsCommand cmd, String permissionPrefix); - - void setLastTeleportTimestamp(long time); - - Location getLastLocation(); - - Player getBase(); - - double getMoney(); - - void takeMoney(double value); - - void giveMoney(double value); - - String getGroup(); - - void setLastLocation(); - - Location getHome(String name) throws Exception; - - Location getHome(Location loc) throws Exception; - - boolean isHidden(); - - ITeleport getTeleport(); - - void setJail(String jail); -} diff --git a/Essentials/src/com/earth2me/essentials/api/IUserMap.java b/Essentials/src/com/earth2me/essentials/api/IUserMap.java deleted file mode 100644 index 9e609ab37..000000000 --- a/Essentials/src/com/earth2me/essentials/api/IUserMap.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.earth2me.essentials.api; - -import java.io.File; -import java.util.Set; - - -public interface IUserMap -{ - boolean userExists(final String name); - - IUser getUser(final String name); - - void removeUser(final String name); - - Set<String> getAllUniqueUsers(); - - int getUniqueUsers(); - - File getUserFile(final String name); -} diff --git a/Essentials/src/com/earth2me/essentials/api/IWarps.java b/Essentials/src/com/earth2me/essentials/api/IWarps.java deleted file mode 100644 index 14779e327..000000000 --- a/Essentials/src/com/earth2me/essentials/api/IWarps.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.earth2me.essentials.api; - -import java.util.Collection; -import org.bukkit.Location; - - -public interface IWarps extends IReload -{ - Location getWarp(String warp) throws Exception; - - Collection<String> getWarps(); - - void removeWarp(String name) throws Exception; - - void setWarp(String name, Location loc) throws Exception; -} diff --git a/Essentials/src/com/earth2me/essentials/api/IWorth.java b/Essentials/src/com/earth2me/essentials/api/IWorth.java deleted file mode 100644 index 4add98771..000000000 --- a/Essentials/src/com/earth2me/essentials/api/IWorth.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.earth2me.essentials.api; - -import org.bukkit.inventory.ItemStack; - - -public interface IWorth extends IReload -{ - double getPrice(ItemStack itemStack); - - void setPrice(ItemStack itemStack, double price); -} diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java index 01e8ab5b3..f98cce98a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java @@ -3,6 +3,7 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; +import java.util.logging.Level; import org.bukkit.Server; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -55,6 +56,8 @@ public class Commandban extends EssentialsCommand user.setBanReason(banReason); user.setBanned(true); user.kickPlayer(banReason); + + server.getLogger().log(Level.INFO, _("playerBanned", senderName, user.getName(), banReason)); for (Player onlinePlayer : server.getOnlinePlayers()) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java index 39f7d936a..af4bafc4b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java @@ -23,53 +23,86 @@ public class Commandgamemode extends EssentialsCommand { throw new NotEnoughArgumentsException(); } - gamemodeOtherPlayers(server, sender, args); + GameMode gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH)); + gamemodeOtherPlayers(server, sender, gameMode, args[1]); } @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - if (args.length < 1) + GameMode gameMode; + if (args.length == 0) { - throw new NotEnoughArgumentsException(); + gameMode = matchGameMode(commandLabel); } - - if (args.length > 1 && args[1].trim().length() > 2 && user.isAuthorized("essentials.gamemode.others")) + else if (args.length > 1 && args[1].trim().length() > 2 && user.isAuthorized("essentials.gamemode.others")) { - gamemodeOtherPlayers(server, user, args); + gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH)); + gamemodeOtherPlayers(server, user, gameMode, args[1]); return; } - performSetMode(args[0].toLowerCase(Locale.ENGLISH), user); + else + { + try { + gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH)); + } + catch (NotEnoughArgumentsException e) { + gameMode = matchGameMode(commandLabel); + gamemodeOtherPlayers(server, user, gameMode, args[0]); + return; + } + } + user.setGameMode(gameMode); user.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName())); } - private void gamemodeOtherPlayers(final Server server, final CommandSender sender, final String[] args) + private void gamemodeOtherPlayers(final Server server, final CommandSender sender, final GameMode gameMode, final String player) throws NotEnoughArgumentsException { - for (Player matchPlayer : server.matchPlayer(args[1])) + //TODO: TL this + if (player.trim().length() < 2) { - final User player = ess.getUser(matchPlayer); - if (player.isHidden()) + throw new NotEnoughArgumentsException("You need to specify a valid player/mode."); + } + + boolean foundUser = false; + for (Player matchPlayer : server.matchPlayer(player)) + { + final User user = ess.getUser(matchPlayer); + if (user.isHidden()) { continue; } - performSetMode(args[0].toLowerCase(Locale.ENGLISH), player); - sender.sendMessage(_("gameMode", _(player.getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName())); + user.setGameMode(gameMode); + sender.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName())); + foundUser = true; + } + if (!foundUser) + { + throw new NotEnoughArgumentsException(_("playerNotFound")); } } - private void performSetMode(String mode, Player player) + private GameMode matchGameMode(String modeString) throws NotEnoughArgumentsException { - if (mode.contains("survi") || mode.equalsIgnoreCase("0") || mode.equalsIgnoreCase("s")) + GameMode mode = null; + if (modeString.equalsIgnoreCase("gmc") || modeString.equalsIgnoreCase("egmc") + || modeString.contains("creat") || modeString.equalsIgnoreCase("1") || modeString.equalsIgnoreCase("c")) { - player.setGameMode(GameMode.SURVIVAL); + mode = GameMode.CREATIVE; } - else if (mode.contains("creat") || mode.equalsIgnoreCase("1") || mode.equalsIgnoreCase("c")) + else if (modeString.equalsIgnoreCase("gms") || modeString.equalsIgnoreCase("egms") + || modeString.contains("survi") || modeString.equalsIgnoreCase("0") || modeString.equalsIgnoreCase("s")) { - player.setGameMode(GameMode.CREATIVE); + mode = GameMode.SURVIVAL; } - else if (mode.contains("advent") || mode.equalsIgnoreCase("2") || mode.equalsIgnoreCase("a")) + else if (modeString.equalsIgnoreCase("gma") || modeString.equalsIgnoreCase("egma") + || modeString.contains("advent") || modeString.equalsIgnoreCase("2") || modeString.equalsIgnoreCase("a")) { - player.setGameMode(GameMode.ADVENTURE); + mode = GameMode.ADVENTURE; + } + else { + throw new NotEnoughArgumentsException(); } + return mode; } }
\ No newline at end of file diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java index 3e2e08b50..287a3cc62 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java @@ -3,6 +3,7 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; +import java.util.logging.Level; import org.bukkit.Server; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -31,6 +32,8 @@ public class Commandkick extends EssentialsCommand final String kickReason = args.length > 1 ? getFinalArg(args, 1) : _("kickDefault"); user.kickPlayer(kickReason); final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; + + server.getLogger().log(Level.INFO, _("playerKicked", senderName, user.getName(), kickReason)); for (Player onlinePlayer : server.getOnlinePlayers()) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java index 77994f156..a2e58227b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java @@ -21,6 +21,12 @@ public class Commandkill extends EssentialsCommand { throw new NotEnoughArgumentsException(); } + + //TODO: TL this + if (args[0].trim().length() < 2) + { + throw new NotEnoughArgumentsException("You need to specify a player to kill."); + } for (Player matchPlayer : server.matchPlayer(args[0])) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java index baa8ba014..fe2f49292 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java @@ -26,12 +26,12 @@ public class Commandkit extends EssentialsCommand else if (args.length > 1 && user.isAuthorized("essentials.kit.others")) { final User userTo = getPlayer(server, args, 1, true); - final String kitName = Util.sanitizeString(args[0].toLowerCase(Locale.ENGLISH)); + final String kitName = Util.sanitizeString(args[0].toLowerCase(Locale.ENGLISH)).trim(); giveKit(userTo, user, kitName); } else { - final String kitName = Util.sanitizeString(args[0].toLowerCase(Locale.ENGLISH)); + final String kitName = Util.sanitizeString(args[0].toLowerCase(Locale.ENGLISH)).trim(); giveKit(user, user, kitName); } } @@ -59,7 +59,12 @@ public class Commandkit extends EssentialsCommand } private void giveKit(User userTo, User userFrom, String kitName) throws Exception - { + { + if (kitName.isEmpty()) + { + throw new Exception(_("kitError2")); + } + final Map<String, Object> kit = ess.getSettings().getKit(kitName); if (!userFrom.isAuthorized("essentials.kit." + kitName)) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java index fe39a1c04..6b6392cdb 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java @@ -21,7 +21,7 @@ public class Commandmsg extends EssentialsCommand @Override public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception { - if (args.length < 2 || args[0].trim().length() < 3 || args[1].trim().isEmpty()) + if (args.length < 2 || args[0].trim().length() < 2 || args[1].trim().isEmpty()) { throw new NotEnoughArgumentsException(); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java index fde9be58a..5ce131281 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java @@ -22,7 +22,8 @@ public class Commandpay extends EssentialsCommand throw new NotEnoughArgumentsException(); } - if (args[0].trim().length() < 3) + //TODO: TL this + if (args[0].trim().length() < 2) { throw new NotEnoughArgumentsException("You need to specify a player to pay."); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java index 84df12900..f3727548f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java @@ -56,7 +56,7 @@ public class Commandwarp extends EssentialsCommand @Override public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception { - if (args.length < 2 || args[0].matches("[0-9]+")) + if (args.length < 2 || Util.isInt(args[0])) { warpList(sender, args); throw new NoChargeException(); @@ -94,7 +94,7 @@ public class Commandwarp extends EssentialsCommand } } int page = 1; - if (args.length > 0) + if (args.length > 0 && Util.isInt(args[0])) { page = Integer.parseInt(args[0]); } diff --git a/Essentials/src/com/earth2me/essentials/perm/BPermissions2Handler.java b/Essentials/src/com/earth2me/essentials/perm/BPermissions2Handler.java index f4122bf53..d8c5c9c12 100644 --- a/Essentials/src/com/earth2me/essentials/perm/BPermissions2Handler.java +++ b/Essentials/src/com/earth2me/essentials/perm/BPermissions2Handler.java @@ -44,7 +44,7 @@ public class BPermissions2Handler extends SuperpermsHandler @Override public boolean canBuild(final Player base, final String group) { - return hasPermission(base, "essentials.build") || hasPermission(base, "bPermissions.build"); + return hasPermission(base, "bPermissions.build"); } @Override diff --git a/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java index fea268f90..a542c3d66 100644 --- a/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java +++ b/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java @@ -56,7 +56,7 @@ public class BPermissionsHandler extends SuperpermsHandler @Override public boolean canBuild(final Player base, final String group) { - return hasPermission(base, "essentials.build") || hasPermission(base, "bPermissions.build"); + return hasPermission(base, "bPermissions.build"); } @Override diff --git a/Essentials/src/com/earth2me/essentials/perm/PermissionsBukkitHandler.java b/Essentials/src/com/earth2me/essentials/perm/PermissionsBukkitHandler.java index aef6401d9..315cfa363 100644 --- a/Essentials/src/com/earth2me/essentials/perm/PermissionsBukkitHandler.java +++ b/Essentials/src/com/earth2me/essentials/perm/PermissionsBukkitHandler.java @@ -78,6 +78,6 @@ public class PermissionsBukkitHandler extends SuperpermsHandler @Override public boolean canBuild(Player base, String group) { - return hasPermission(base, "essentials.build") || hasPermission(base, "permissions.build"); + return hasPermission(base, "permissions.build"); } } diff --git a/Essentials/src/com/earth2me/essentials/perm/PrivilegesHandler.java b/Essentials/src/com/earth2me/essentials/perm/PrivilegesHandler.java index 6cc97f30e..03db3502b 100644 --- a/Essentials/src/com/earth2me/essentials/perm/PrivilegesHandler.java +++ b/Essentials/src/com/earth2me/essentials/perm/PrivilegesHandler.java @@ -55,7 +55,7 @@ public class PrivilegesHandler extends SuperpermsHandler @Override public boolean canBuild(Player base, String group) { - return hasPermission(base, "essentials.build") || hasPermission(base, "privileges.build"); + return hasPermission(base, "privileges.build"); } } diff --git a/Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java b/Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java index 2e767cb72..aedd4c5ae 100644 --- a/Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java +++ b/Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java @@ -21,7 +21,7 @@ public class SuperpermsHandler implements IPermissionsHandler @Override public boolean canBuild(final Player base, final String group) { - return hasPermission(base, "essentials.build"); + return false; } @Override diff --git a/Essentials/src/com/earth2me/essentials/settings/Backup.java b/Essentials/src/com/earth2me/essentials/settings/Backup.java deleted file mode 100644 index f43af47c0..000000000 --- a/Essentials/src/com/earth2me/essentials/settings/Backup.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.earth2me.essentials.settings; - -import com.earth2me.essentials.storage.Comment; -import com.earth2me.essentials.storage.StorageObject; -import lombok.Data; -import lombok.EqualsAndHashCode; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class Backup implements StorageObject -{ - @Comment("Interval in minutes") - private long interval = 60; - @Comment("Add a command that backups your data, e.g. 'rdiff-backup World1 backups/World1'") - private String command; -} diff --git a/Essentials/src/com/earth2me/essentials/settings/Chat.java b/Essentials/src/com/earth2me/essentials/settings/Chat.java deleted file mode 100644 index 623228c4e..000000000 --- a/Essentials/src/com/earth2me/essentials/settings/Chat.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.earth2me.essentials.settings; - -import com.earth2me.essentials.storage.Comment; -import com.earth2me.essentials.storage.StorageObject; -import lombok.Data; -import lombok.EqualsAndHashCode; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class Chat implements StorageObject -{ - @Comment("The character(s) to prefix all nicknames, so that you know they are not true usernames.") - private String nicknamePrefix = "~"; - @Comment("Disable this if you have any other plugin, that modifies the displayname of a user.") - private boolean changeDisplayname = true; - private String displaynameFormat = "{PREFIX}{NICKNAMEPREFIX}{NAME}{SUFFIX}"; - @Comment( - { - "If EssentialsChat is installed, this will define how far a player's voice travels, in blocks. Set to 0 to make all chat global.", - "Note that users with the \"essentials.chat.spy\" permission will hear everything, regardless of this setting.", - "Users with essentials.chat.shout can override this by prefixing text with an exclamation mark (!)", - "Or with essentials.chat.question can override this by prefixing text with a question mark (?)", - "You can add command costs for shout/question by adding chat-shout and chat-question to the command costs section." - }) - private int localRadius = 0; - @Comment("Set the default chat format here, it will be overwritten by group specific chat formats.") - private String defaultFormat = "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}"; -} diff --git a/Essentials/src/com/earth2me/essentials/settings/Commands.java b/Essentials/src/com/earth2me/essentials/settings/Commands.java deleted file mode 100644 index 08efc881c..000000000 --- a/Essentials/src/com/earth2me/essentials/settings/Commands.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.earth2me.essentials.settings; - -import com.earth2me.essentials.settings.commands.*; -import com.earth2me.essentials.storage.Comment; -import com.earth2me.essentials.storage.ListType; -import com.earth2me.essentials.storage.StorageObject; -import java.util.ArrayList; -import java.util.List; -import lombok.Data; -import lombok.EqualsAndHashCode; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class Commands implements StorageObject -{ - private Afk afk = new Afk(); - private God god = new God(); - private Help help = new Help(); - private Home home = new Home(); - private Kit kit = new Kit(); - private Lightning lightning = new Lightning(); - private Spawnmob spawnmob = new Spawnmob(); - @ListType - @Comment( - { - "When a command conflicts with another plugin, by default, Essentials will try to force the OTHER plugin to take", - "priority. If a command is in this list, Essentials will try to give ITSELF priority. This does not always work:", - "usually whichever plugin was updated most recently wins out. However, the full name of the command will always work.", - "For example, if WorldGuard and Essentials are both enabled, and WorldGuard takes control over /god, /essentials:god", - "will still map to Essentials, whereas it might normally get forced upon WorldGuard. Commands prefixed with an \"e\",", - "such as /egod, will always grant Essentials priority.", - "We should try to take priority over /god. If this doesn't work, use /essentials:god or /egod.", - "If god is set using WorldGuard, use /ungod to remove then use whichever you see fit." - }) - private List<String> overwritten = new ArrayList<String>(); - @ListType - @Comment("Disabled commands will be completelly unavailable on the server.") - private List<String> disabled = new ArrayList<String>(); -} diff --git a/Essentials/src/com/earth2me/essentials/settings/Economy.java b/Essentials/src/com/earth2me/essentials/settings/Economy.java deleted file mode 100644 index 5872dada9..000000000 --- a/Essentials/src/com/earth2me/essentials/settings/Economy.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.earth2me.essentials.settings; - -import com.earth2me.essentials.storage.Comment; -import com.earth2me.essentials.storage.MapValueType; -import com.earth2me.essentials.storage.StorageObject; -import java.util.HashMap; -import java.util.Map; -import lombok.Data; -import lombok.EqualsAndHashCode; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class Economy implements StorageObject -{ - @Comment("Defines the balance with which new players begin. Defaults to 0.") - private double startingBalance = 0.0; - @MapValueType(Double.class) - @Comment("Defines the cost to use the given commands PER USE") - private Map<String, Double> commandCosts = new HashMap<String, Double>(); - @Comment("Set this to a currency symbol you want to use.") - private String currencySymbol = "$"; - - public String getCurrencySymbol() - { - return currencySymbol == null || currencySymbol.isEmpty() ? "$" : currencySymbol.substring(0, 1); - } - private final transient static double MAXMONEY = 10000000000000.0; - @Comment( - { - "Set the maximum amount of money a player can have", - "The amount is always limited to 10 trillions because of the limitations of a java double" - }) - private double maxMoney = MAXMONEY; - - public double getMaxMoney() - { - return Math.abs(maxMoney) > MAXMONEY ? MAXMONEY : Math.abs(maxMoney); - } - @Comment("Enable this to log all interactions with trade/buy/sell signs and sell command") - private boolean logEnabled = false; - private Worth worth = new Worth(); -} diff --git a/Essentials/src/com/earth2me/essentials/settings/General.java b/Essentials/src/com/earth2me/essentials/settings/General.java deleted file mode 100644 index a7cf537bb..000000000 --- a/Essentials/src/com/earth2me/essentials/settings/General.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.earth2me.essentials.settings; - -import com.earth2me.essentials.storage.Comment; -import com.earth2me.essentials.storage.StorageObject; -import lombok.Data; -import lombok.EqualsAndHashCode; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class General implements StorageObject -{ - @Comment("Backup runs a command while saving is disabled") - private Backup backup = new Backup(); - @Comment("You can disable the death messages of minecraft.") - private boolean deathMessages = true; - @Comment("Turn this on, if you want to see more error messages, if something goes wrong.") - private boolean debug = false; - @Comment( - { - "Set the locale here, if you want to change the language of Essentials.", - "If this is not set, Essentials will use the language of your computer.", - "Available locales: da, de, en, fr, nl" - }) - private String locale; - @Comment( - { - "Should we announce to the server when someone logs in for the first time?", - "If so, use this format, replacing {DISPLAYNAME} with the player name.", - "If not, set to ''" - }) - private String newPlayerAnnouncement = "&dWelcome {DISPLAYNAME} to the server!"; -} diff --git a/Essentials/src/com/earth2me/essentials/settings/GroupOptions.java b/Essentials/src/com/earth2me/essentials/settings/GroupOptions.java deleted file mode 100644 index 7b16a471b..000000000 --- a/Essentials/src/com/earth2me/essentials/settings/GroupOptions.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.earth2me.essentials.settings; - -import com.earth2me.essentials.storage.Comment; -import com.earth2me.essentials.storage.StorageObject; -import lombok.Data; -import lombok.EqualsAndHashCode; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class GroupOptions implements StorageObject -{ - @Comment("Message format of chat messages") - private String messageFormat; - @Comment("Prefix for name") - private String prefix; - @Comment("Suffix for name") - private String suffix; - @Comment("Amount of homes a player can have") - private Integer homes; - @Comment("Cooldown between teleports") - private Integer teleportCooldown; - @Comment("Delay before teleport") - private Integer teleportDelay; - @Comment("Cooldown between heals") - private Integer healCooldown; -} diff --git a/Essentials/src/com/earth2me/essentials/settings/Groups.java b/Essentials/src/com/earth2me/essentials/settings/Groups.java deleted file mode 100644 index 5e67db890..000000000 --- a/Essentials/src/com/earth2me/essentials/settings/Groups.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.earth2me.essentials.settings; - -import com.earth2me.essentials.storage.Comment; -import com.earth2me.essentials.storage.MapValueType; -import com.earth2me.essentials.storage.StorageObject; -import java.util.LinkedHashMap; -import lombok.Data; -import lombok.EqualsAndHashCode; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class Groups implements StorageObject -{ - public Groups() - { - GroupOptions defaultOptions = new GroupOptions(); - groups.put("default", defaultOptions); - } - @Comment( - { - "The order of the groups matters, the groups are checked from top to bottom.", - "All group names have to be lower case.", - "The groups can be connected to users using the permission essentials.groups.groupname" - }) - @MapValueType(GroupOptions.class) - private LinkedHashMap<String, GroupOptions> groups = new LinkedHashMap<String, GroupOptions>(); -} diff --git a/Essentials/src/com/earth2me/essentials/settings/Locations.java b/Essentials/src/com/earth2me/essentials/settings/Locations.java deleted file mode 100644 index 7e7f1a63d..000000000 --- a/Essentials/src/com/earth2me/essentials/settings/Locations.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.earth2me.essentials.settings; - -import com.earth2me.essentials.storage.MapValueType; -import com.earth2me.essentials.storage.StorageObject; -import java.util.HashMap; -import java.util.Map; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.bukkit.Location; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class Locations implements StorageObject -{ - @MapValueType(Location.class) - Map<String, Location> jails = new HashMap<String, Location>(); - @MapValueType(Location.class) - Map<String, Location> warps = new HashMap<String, Location>(); - @MapValueType(Location.class) - Map<String, Location> spawns = new HashMap<String, Location>(); -} diff --git a/Essentials/src/com/earth2me/essentials/settings/Settings.java b/Essentials/src/com/earth2me/essentials/settings/Settings.java deleted file mode 100644 index 4c2ff2dd9..000000000 --- a/Essentials/src/com/earth2me/essentials/settings/Settings.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.earth2me.essentials.settings; - -import com.earth2me.essentials.storage.Comment; -import com.earth2me.essentials.storage.StorageObject; -import lombok.Data; -import lombok.EqualsAndHashCode; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class Settings implements StorageObject -{ - @Comment( - { - "##########################################################", - "+------------------------------------------------------+ #", - "| General Settings | #", - "+------------------------------------------------------+ #", - "##########################################################" - }) - private General general = new General(); - @Comment( - { - "##########################################################", - "+------------------------------------------------------+ #", - "| Chat Settings | #", - "+------------------------------------------------------+ #", - "##########################################################" - }) - private Chat chat = new Chat(); - @Comment( - { - "##########################################################", - "+------------------------------------------------------+ #", - "| Economy Settings | #", - "+------------------------------------------------------+ #", - "##########################################################" - }) - private Economy economy = new Economy(); - @Comment( - { - "##########################################################", - "+------------------------------------------------------+ #", - "| Commands Settings | #", - "+------------------------------------------------------+ #", - "##########################################################" - }) - private Commands commands = new Commands(); - @Comment( - { - "##########################################################", - "+------------------------------------------------------+ #", - "| Group Settings | #", - "+------------------------------------------------------+ #", - "##########################################################" - }) - private Groups groups = new Groups(); -} diff --git a/Essentials/src/com/earth2me/essentials/settings/Worth.java b/Essentials/src/com/earth2me/essentials/settings/Worth.java deleted file mode 100644 index 707f907cf..000000000 --- a/Essentials/src/com/earth2me/essentials/settings/Worth.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.earth2me.essentials.settings; - -import com.earth2me.essentials.storage.EnchantmentLevel; -import com.earth2me.essentials.storage.MapKeyType; -import com.earth2me.essentials.storage.MapValueType; -import com.earth2me.essentials.storage.StorageObject; -import java.util.HashMap; -import java.util.Map; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.material.MaterialData; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class Worth implements StorageObject -{ - @MapKeyType(MaterialData.class) - @MapValueType(Double.class) - private Map<MaterialData, Double> sell = new HashMap<MaterialData, Double>(); - @MapKeyType(MaterialData.class) - @MapValueType(Double.class) - private Map<MaterialData, Double> buy = new HashMap<MaterialData, Double>(); - @MapKeyType(EnchantmentLevel.class) - @MapValueType(Double.class) - private Map<EnchantmentLevel, Double> enchantmentMultiplier = new HashMap<EnchantmentLevel, Double>(); - - public Worth() - { - sell.put(new MaterialData(Material.APPLE, (byte)0), 1.0); - } -} diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/Afk.java b/Essentials/src/com/earth2me/essentials/settings/commands/Afk.java deleted file mode 100644 index 80cae7e8a..000000000 --- a/Essentials/src/com/earth2me/essentials/settings/commands/Afk.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.earth2me.essentials.settings.commands; - -import com.earth2me.essentials.storage.Comment; -import com.earth2me.essentials.storage.StorageObject; -import lombok.Data; -import lombok.EqualsAndHashCode; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class Afk implements StorageObject -{ - @Comment( - { - "After this timeout in seconds, the user will be set as afk.", - "Set to -1 for no timeout." - }) - private int autoAFK = 300; - @Comment( - { - "Auto-AFK Kick", - "After this timeout in seconds, the user will be kicked from the server.", - "Set to -1 for no timeout." - }) - private int autoAFKKick = -1; - @Comment( - { - "Set this to true, if you want to freeze the player, if he is afk.", - "Other players or monsters can't push him out of afk mode then.", - "This will also enable temporary god mode for the afk player.", - "The player has to use the command /afk to leave the afk mode.", - "You have to add a message to your welcome message or help page,", - "since the player will not get a message, if he tries to move." - }) - private boolean freezeAFKPlayers = false; -} diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/God.java b/Essentials/src/com/earth2me/essentials/settings/commands/God.java deleted file mode 100644 index a6f5dbfc3..000000000 --- a/Essentials/src/com/earth2me/essentials/settings/commands/God.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.earth2me.essentials.settings.commands; - -import com.earth2me.essentials.storage.Comment; -import com.earth2me.essentials.storage.StorageObject; -import lombok.Data; -import lombok.EqualsAndHashCode; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class God implements StorageObject -{ - @Comment("Turn off god mode when people exit") - private boolean removeOnDisconnect = false; -} diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/Help.java b/Essentials/src/com/earth2me/essentials/settings/commands/Help.java deleted file mode 100644 index 0b4787471..000000000 --- a/Essentials/src/com/earth2me/essentials/settings/commands/Help.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.earth2me.essentials.settings.commands; - -import com.earth2me.essentials.storage.Comment; -import com.earth2me.essentials.storage.StorageObject; -import lombok.Data; -import lombok.EqualsAndHashCode; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class Help implements StorageObject -{ - @Comment("Show other plugins commands in help") - private boolean showNonEssCommandsInHelp = true; - @Comment( - { - "Hide plugins which don't give a permission in their plugin.yml for each command.", - "You can override a true value here for a single plugin by adding a permission to a user/group.", - "The individual permission is: essentials.help.<plugin>, anyone with essentials.* or '*' will see all help this setting reguardless.", - "You can use negative permissions to remove access to just a single plugins help if the following is enabled." - }) - private boolean hidePermissionlessCommands = true; -} diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/Home.java b/Essentials/src/com/earth2me/essentials/settings/commands/Home.java deleted file mode 100644 index 8b3a0ca82..000000000 --- a/Essentials/src/com/earth2me/essentials/settings/commands/Home.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.earth2me.essentials.settings.commands; - -import com.earth2me.essentials.storage.Comment; -import com.earth2me.essentials.storage.StorageObject; -import lombok.Data; -import lombok.EqualsAndHashCode; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class Home implements StorageObject -{ - @Comment("When players die, should they respawn at their homes, instead of the spawnpoint?") - private boolean respawnAtHome = false; - @Comment( - { - "When a player interacts with a bed, should their home be set to that location?", - "If you enable this and remove default player access to the /sethome command, ", - "you can make beds the only way for players to set their home location." - }) - private boolean bedSetsHome = false; - @Comment("If no home is set, should the player be send to spawn, when /home is used.") - private boolean spawnIfNoHome = false; -} diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/Kit.java b/Essentials/src/com/earth2me/essentials/settings/commands/Kit.java deleted file mode 100644 index 87aa42d3c..000000000 --- a/Essentials/src/com/earth2me/essentials/settings/commands/Kit.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.earth2me.essentials.settings.commands; - -import com.earth2me.essentials.storage.MapValueType; -import com.earth2me.essentials.storage.StorageObject; -import java.util.HashMap; -import java.util.Map; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class Kit implements StorageObject -{ - public Kit() - { - final KitObject kit = new KitObject(); - kit.setDelay(10.0); - kit.getItems().add(new ItemStack(Material.DIAMOND_SPADE, 1)); - kit.getItems().add(new ItemStack(Material.DIAMOND_PICKAXE, 1)); - kit.getItems().add(new ItemStack(Material.DIAMOND_AXE, 1)); - kits.put("tools", kit); - } - @MapValueType(KitObject.class) - private Map<String, KitObject> kits = new HashMap<String, KitObject>(); -} diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/KitObject.java b/Essentials/src/com/earth2me/essentials/settings/commands/KitObject.java deleted file mode 100644 index fe0353be9..000000000 --- a/Essentials/src/com/earth2me/essentials/settings/commands/KitObject.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.earth2me.essentials.settings.commands; - -import com.earth2me.essentials.storage.ListType; -import com.earth2me.essentials.storage.StorageObject; -import java.util.ArrayList; -import java.util.List; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.bukkit.inventory.ItemStack; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class KitObject implements StorageObject -{ - @ListType(ItemStack.class) - private List<ItemStack> items = new ArrayList<ItemStack>(); - private Double delay; -} diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/Lightning.java b/Essentials/src/com/earth2me/essentials/settings/commands/Lightning.java deleted file mode 100644 index e40e645da..000000000 --- a/Essentials/src/com/earth2me/essentials/settings/commands/Lightning.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.earth2me.essentials.settings.commands; - -import com.earth2me.essentials.storage.Comment; -import com.earth2me.essentials.storage.StorageObject; -import lombok.Data; -import lombok.EqualsAndHashCode; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class Lightning implements StorageObject -{ - @Comment("Shall we notify users when using /lightning") - private boolean warnPlayer = true; -} diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/Spawnmob.java b/Essentials/src/com/earth2me/essentials/settings/commands/Spawnmob.java deleted file mode 100644 index 37d41c296..000000000 --- a/Essentials/src/com/earth2me/essentials/settings/commands/Spawnmob.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.earth2me.essentials.settings.commands; - -import com.earth2me.essentials.storage.Comment; -import com.earth2me.essentials.storage.StorageObject; -import lombok.Data; -import lombok.EqualsAndHashCode; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class Spawnmob implements StorageObject -{ - @Comment("The maximum amount of monsters, a player can spawn with a call of /spawnmob.") - private int limit = 10; -} diff --git a/Essentials/src/com/earth2me/essentials/signs/SignKit.java b/Essentials/src/com/earth2me/essentials/signs/SignKit.java index 148854010..aee1d7dea 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignKit.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignKit.java @@ -19,7 +19,7 @@ public class SignKit extends EssentialsSign { validateTrade(sign, 3, ess); - final String kitName = sign.getLine(1).toLowerCase(Locale.ENGLISH); + final String kitName = sign.getLine(1).toLowerCase(Locale.ENGLISH).trim(); if (kitName.isEmpty()) { @@ -48,7 +48,7 @@ public class SignKit extends EssentialsSign @Override protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException { - final String kitName = sign.getLine(1).toLowerCase(Locale.ENGLISH); + final String kitName = sign.getLine(1).toLowerCase(Locale.ENGLISH).trim(); final String group = sign.getLine(2); if ((!group.isEmpty() && ("§2Everyone".equals(group) || player.inGroup(group))) || (group.isEmpty() && (player.isAuthorized("essentials.kit." + kitName)))) diff --git a/Essentials/src/com/earth2me/essentials/storage/IStorageObjectHolder.java b/Essentials/src/com/earth2me/essentials/storage/IStorageObjectHolder.java index f48e54002..4e860bd8c 100644 --- a/Essentials/src/com/earth2me/essentials/storage/IStorageObjectHolder.java +++ b/Essentials/src/com/earth2me/essentials/storage/IStorageObjectHolder.java @@ -1,7 +1,5 @@ package com.earth2me.essentials.storage; -import com.earth2me.essentials.user.UserData; - public interface IStorageObjectHolder<T extends StorageObject> { diff --git a/Essentials/src/com/earth2me/essentials/user/Ban.java b/Essentials/src/com/earth2me/essentials/user/Ban.java deleted file mode 100644 index ba1c22333..000000000 --- a/Essentials/src/com/earth2me/essentials/user/Ban.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.earth2me.essentials.user; - -import com.earth2me.essentials.storage.StorageObject; -import lombok.Data; -import lombok.EqualsAndHashCode; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class Ban implements StorageObject -{ - private String reason; - private long timeout; -} diff --git a/Essentials/src/com/earth2me/essentials/user/IOfflinePlayer.java b/Essentials/src/com/earth2me/essentials/user/IOfflinePlayer.java deleted file mode 100644 index 4cdee715b..000000000 --- a/Essentials/src/com/earth2me/essentials/user/IOfflinePlayer.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.earth2me.essentials.user; - -import org.bukkit.Location; - - -public interface IOfflinePlayer -{ - String getName(); - - String getDisplayName(); - - Location getBedSpawnLocation(); - - void setBanned(boolean bln); -}
\ No newline at end of file diff --git a/Essentials/src/com/earth2me/essentials/user/IOfflineUser.java b/Essentials/src/com/earth2me/essentials/user/IOfflineUser.java deleted file mode 100644 index d6266df49..000000000 --- a/Essentials/src/com/earth2me/essentials/user/IOfflineUser.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.earth2me.essentials.user; - -import com.earth2me.essentials.storage.IStorageObjectHolder; - - -public interface IOfflineUser extends IStorageObjectHolder<UserData>, IOfflinePlayer -{ - -} diff --git a/Essentials/src/com/earth2me/essentials/user/Inventory.java b/Essentials/src/com/earth2me/essentials/user/Inventory.java deleted file mode 100644 index 0812f54a0..000000000 --- a/Essentials/src/com/earth2me/essentials/user/Inventory.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.earth2me.essentials.user; - -import com.earth2me.essentials.storage.MapKeyType; -import com.earth2me.essentials.storage.MapValueType; -import com.earth2me.essentials.storage.StorageObject; -import java.util.HashMap; -import java.util.Map; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class Inventory implements StorageObject -{ - private int size; - @MapKeyType(Integer.class) - @MapValueType(ItemStack.class) - private Map<Integer, ItemStack> items = new HashMap<Integer, ItemStack>(); - - public Inventory() - { - items.put(1, new ItemStack(Material.APPLE, 64)); - } -} diff --git a/Essentials/src/com/earth2me/essentials/user/User.java b/Essentials/src/com/earth2me/essentials/user/User.java deleted file mode 100644 index 589e26737..000000000 --- a/Essentials/src/com/earth2me/essentials/user/User.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.earth2me.essentials.user; - -import com.earth2me.essentials.IEssentials; -import com.earth2me.essentials.IUser; -import com.earth2me.essentials.Teleport; -import com.earth2me.essentials.commands.IEssentialsCommand; -import lombok.Cleanup; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.entity.Player; - - -public class User extends UserBase implements IUser -{ - public User(final Player base, final IEssentials ess) - { - super(base, ess); - } - - public User(final OfflinePlayer offlinePlayer, final IEssentials ess) - { - super(offlinePlayer, ess); - } - - public void example() - { - // Cleanup will call close at the end of the function - @Cleanup - final User user = this; - - // read lock allows to read data from the user - user.acquireReadLock(); - final double money = user.getData().getMoney(); - - // write lock allows only one thread to modify the data - user.acquireWriteLock(); - user.getData().setMoney(10 + money); - } - - @Override - public void finishRead() - { - } - - @Override - public void finishWrite() - { - } - - @Override - public long getLastTeleportTimestamp() - { - acquireReadLock(); - try - { - return getData().getTimestamps().get("lastteleport"); - } - finally - { - unlock(); - } - } - - @Override - public boolean isAuthorized(String node) - { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public boolean isAuthorized(IEssentialsCommand cmd) - { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public boolean isAuthorized(IEssentialsCommand cmd, String permissionPrefix) - { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void setLastTeleportTimestamp(long time) - { - acquireWriteLock(); - try - { - getData().getTimestamps().put("lastteleport", time); - } - finally - { - unlock(); - } - } - - @Override - public Location getLastLocation() - { - acquireReadLock(); - try - { - return getData().getLastLocation(); - } - finally - { - unlock(); - } - } - - @Override - public double getMoney() - { - acquireReadLock(); - try - { - return getData().getMoney(); - } - finally - { - unlock(); - } - } - - @Override - public void takeMoney(double value) - { - acquireWriteLock(); - try - { - getData().setMoney(getData().getMoney() - value); - } - finally - { - unlock(); - } - } - - @Override - public void giveMoney(double value) - { - acquireWriteLock(); - try - { - getData().setMoney(getData().getMoney() + value); - } - finally - { - unlock(); - } - } - - @Override - public String getGroup() - { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void setLastLocation() - { - acquireWriteLock(); - try - { - getData().setLastLocation(base.getLocation()); - } - finally - { - unlock(); - } - } - - @Override - public Location getHome(String name) throws Exception - { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public Location getHome(Location loc) throws Exception - { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public boolean isHidden() - { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public Teleport getTeleport() - { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void setJail(final String jail) - { - acquireWriteLock(); - try - { - getData().setJail(jail); - } - finally - { - unlock(); - } - } - - @Override - public boolean canAfford(final double cost) - { - final double mon = getMoney(); - if (isAuthorized("essentials.eco.loan")) - { - return (mon - cost) >= ess.getSettings().getMinMoney(); - } - return cost <= mon; - } -} diff --git a/Essentials/src/com/earth2me/essentials/user/UserBase.java b/Essentials/src/com/earth2me/essentials/user/UserBase.java deleted file mode 100644 index 587ed084b..000000000 --- a/Essentials/src/com/earth2me/essentials/user/UserBase.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.earth2me.essentials.user; - -import com.earth2me.essentials.IEssentials; -import com.earth2me.essentials.storage.AsyncStorageObjectHolder; -import java.io.File; -import lombok.Delegate; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.command.CommandSender; -import org.bukkit.configuration.serialization.ConfigurationSerializable; -import org.bukkit.entity.Entity; -import org.bukkit.entity.HumanEntity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.permissions.Permissible; -import org.bukkit.permissions.ServerOperator; -import org.bukkit.OfflinePlayer; - - -public abstract class UserBase extends AsyncStorageObjectHolder<UserData> implements Player, IOfflineUser -{ - - @Delegate(types = - { - Player.class, Entity.class, CommandSender.class, ServerOperator.class, - HumanEntity.class, ConfigurationSerializable.class, LivingEntity.class, - Permissible.class - },excludes=IOfflinePlayer.class) - protected Player base; - protected transient OfflinePlayer offlinePlayer; - - public UserBase(final Player base, final IEssentials ess) - { - super(ess, UserData.class); - this.base = base; - reloadConfig(); - } - - public UserBase(final OfflinePlayer offlinePlayer, final IEssentials ess) - { - super(ess, UserData.class); - this.offlinePlayer = offlinePlayer; - reloadConfig(); - } - - public final Player getBase() - { - return base; - } - - public final Player setBase(final Player base) - { - return this.base = base; - } - - public void update(final Player base) - { - setBase(base); - } - - public void update(final OfflinePlayer offlinePlayer) - { - this.offlinePlayer = offlinePlayer; - } - - public void dispose() - { - this.offlinePlayer = Bukkit.getOfflinePlayer(base.getName()); - this.base = null; - } - - public boolean isOnlineUser() { - return base != null; - } - - @Override - public String getName() - { - if (isOnlineUser()) { - return base.getName(); - } else { - return offlinePlayer.getName(); - } - } - - @Override - public String getDisplayName() - { - if (isOnlineUser()) { - return base.getDisplayName(); - } else { - return offlinePlayer.getName(); - } - } - - @Override - public Location getBedSpawnLocation() - { - return base.getBedSpawnLocation(); - } - - @Override - public void setBanned(boolean bln) - { - if (isOnlineUser()) { - base.setBanned(bln); - } else { - offlinePlayer.setBanned(bln); - } - } - - @Override - public File getStorageFile() - { - return ess.getUserMap().getUserFile(getName()); - } -} diff --git a/Essentials/src/com/earth2me/essentials/user/UserData.java b/Essentials/src/com/earth2me/essentials/user/UserData.java deleted file mode 100644 index 4586d0627..000000000 --- a/Essentials/src/com/earth2me/essentials/user/UserData.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.earth2me.essentials.user; - -import com.earth2me.essentials.storage.ListType; -import com.earth2me.essentials.storage.MapKeyType; -import com.earth2me.essentials.storage.MapValueType; -import com.earth2me.essentials.storage.StorageObject; -import java.util.*; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.bukkit.Location; -import org.bukkit.Material; - - -@Data -@EqualsAndHashCode(callSuper = false) -public class UserData implements StorageObject -{ - private String nickname; - private double money; - @MapValueType(Location.class) - private Map<String, Location> homes = new HashMap<String, Location>(); - @ListType(Material.class) - private Set<Material> unlimited = new HashSet<Material>(); - @MapValueType(List.class) - @MapKeyType(Material.class) - private Map<Material, List<String>> powerTools = new HashMap<Material, List<String>>(); - private Location lastLocation; - @MapValueType(Long.class) - private Map<String, Long> timestamps; - private String jail; - @ListType - private List<String> mails; - private Inventory inventory; - private boolean teleportEnabled; - @ListType - private Set<String> ignore; - private boolean godmode; - private boolean muted; - private boolean jailed; - private Ban ban; - private String ipAddress; - private boolean afk; - private boolean newplayer = true; - private String geolocation; - private boolean socialspy; - private boolean npc; - private boolean powertoolsenabled; - - public UserData() - { - unlimited.add(Material.AIR); - unlimited.add(Material.ARROW); - unlimited.add(Material.APPLE); - powerTools.put(Material.DEAD_BUSH, Collections.singletonList("test")); - } -} diff --git a/Essentials/src/com/earth2me/essentials/user/UserMap.java b/Essentials/src/com/earth2me/essentials/user/UserMap.java deleted file mode 100644 index 821ee4c8f..000000000 --- a/Essentials/src/com/earth2me/essentials/user/UserMap.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.earth2me.essentials.user; - -import com.earth2me.essentials.IConf; -import com.earth2me.essentials.IEssentials; -import com.earth2me.essentials.Util; -import com.google.common.cache.Cache; -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.Collections; -import java.util.Locale; -import java.util.Set; -import java.util.concurrent.ConcurrentSkipListSet; -import java.util.concurrent.ExecutionException; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - - -public class UserMap extends CacheLoader<String, User> implements IConf -{ - private final transient IEssentials ess; - private final transient Cache<String, User> users = CacheBuilder.newBuilder().softValues().build(this); - private final transient ConcurrentSkipListSet<String> keys = new ConcurrentSkipListSet<String>(); - - public UserMap(final IEssentials ess) - { - super(); - this.ess = ess; - loadAllUsersAsync(ess); - } - - private void loadAllUsersAsync(final IEssentials ess) - { - ess.scheduleAsyncDelayedTask(new Runnable() - { - @Override - public void run() - { - final File userdir = new File(ess.getDataFolder(), "userdata"); - if (!userdir.exists()) - { - return; - } - keys.clear(); - users.invalidateAll(); - for (String string : userdir.list()) - { - if (!string.endsWith(".yml")) - { - continue; - } - final String name = string.substring(0, string.length() - 4); - keys.add(name.toLowerCase(Locale.ENGLISH)); - } - } - }); - } - - public boolean userExists(final String name) - { - return keys.contains(name.toLowerCase(Locale.ENGLISH)); - } - - public User getUser(final String name) - { - try - { - return users.get(name.toLowerCase(Locale.ENGLISH)); - } - catch (ExecutionException ex) - { - return null; - } - catch (UncheckedExecutionException ex) - { - return null; - } - } - - @Override - public User load(final String name) throws Exception - { - for (Player player : ess.getServer().getOnlinePlayers()) - { - if (player.getName().equalsIgnoreCase(name)) - { - keys.add(name.toLowerCase(Locale.ENGLISH)); - return new User(player, ess); - } - } - final File userFile = getUserFile(name); - if (userFile.exists()) - { - keys.add(name.toLowerCase(Locale.ENGLISH)); - return new User(Bukkit.getOfflinePlayer(name), ess); - } - throw new Exception("User not found!"); - } - - @Override - public void reloadConfig() - { - loadAllUsersAsync(ess); - } - - public void removeUser(final String name) - { - keys.remove(name.toLowerCase(Locale.ENGLISH)); - users.invalidate(name.toLowerCase(Locale.ENGLISH)); - } - - public Set<String> getAllUniqueUsers() - { - return Collections.unmodifiableSet(keys); - } - - public int getUniqueUsers() - { - return keys.size(); - } - - public File getUserFile(final String name) - { - final File userFolder = new File(ess.getDataFolder(), "userdata"); - return new File(userFolder, Util.sanitizeFileName(name) + ".yml"); - } -} diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index 617fb6677..e7813af8b 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -450,28 +450,6 @@ protect: password: 'root' mysqlDb: 'jdbc:mysql://localhost:3306/minecraft' - # For which block types would you like to be alerted? - # You can find a list of IDs in plugins/Essentials/items.csv after loading Essentials for the first time. - # 10 = lava :: 11 = still lava :: 46 = TNT :: 327 = lava bucket - alert: - on-placement: 10,11,46,327 - on-use: 327 - on-break: - - blacklist: - - # Which blocks should people be prevented from placing - placement: 10,11,46,327 - - # Which items should people be prevented from using - usage: 327 - - # Which blocks should people be prevented from breaking - break: - - # Which blocks should not be pushed by pistons - piston: - # General physics/behavior modifications prevent: lava-flow: false @@ -532,10 +510,10 @@ protect: # Protect various blocks. protect: # Protect all signs - signs: true + signs: false # Prevent users from destroying rails - rails: true + rails: false # Blocks below rails/signs are also protected if the respective rail/sign is protected. # This makes it more difficult to circumvent protection, and should be enabled. @@ -577,6 +555,20 @@ protect: # Should the damage after hit by a lightning be disabled? lightning: false + # Disable weather options + weather: + storm: false + thunder: false + lightning: false + +############################################################ +# +------------------------------------------------------+ # +# | EssentialsAntiBuild | # +# +------------------------------------------------------+ # +############################################################ + + # Disable various default physics and behaviors + # Should people with build: false in permissions be allowed to build # Set true to disable building for those people build: true @@ -587,12 +579,28 @@ protect: # Should we tell people they are not allowed to build warn-on-build-disallow: true + + # For which block types would you like to be alerted? + # You can find a list of IDs in plugins/Essentials/items.csv after loading Essentials for the first time. + # 10 = lava :: 11 = still lava :: 46 = TNT :: 327 = lava bucket + alert: + on-placement: 10,11,46,327 + on-use: 327 + on-break: - # Disable weather options - weather: - storm: false - thunder: false - lightning: false + blacklist: + + # Which blocks should people be prevented from placing + placement: 10,11,46,327 + + # Which items should people be prevented from using + usage: 327 + + # Which blocks should people be prevented from breaking + break: + + # Which blocks should not be pushed by pistons + piston: ############################################################ # +------------------------------------------------------+ # diff --git a/Essentials/src/items.csv b/Essentials/src/items.csv index 986331445..d38b471af 100644 --- a/Essentials/src/items.csv +++ b/Essentials/src/items.csv @@ -22,6 +22,20 @@ wplank,5,0 plankwooden,5,0 plankwood,5,0 plankw,5,0 +oakplank,5,0 +oakwoodenplank,5,0 +oakwoodplank,5,0 +oakwplank,5,0 +oakplankwooden,5,0 +oakplankwood,5,0 +oakplankw,5,0 +oplank,5,0 +owoodenplank,5,0 +owoodplank,5,0 +owplank,5,0 +oplankwooden,5,0 +oplankwood,5,0 +oplankw,5,0 darkplank,5,1 darkwoodenplank,5,1 darkwoodplank,5,1 @@ -50,6 +64,20 @@ swplank,5,1 splankwooden,5,1 splankwood,5,1 splankw,5,1 +pineplank,5,1 +pinewoodenplank,5,1 +pinewoodplank,5,1 +pinewplank,5,1 +pineplankwooden,5,1 +pineplankwood,5,1 +pineplankw,5,1 +pplank,5,1 +pwoodenplank,5,1 +pwoodplank,5,1 +pwplank,5,1 +pplankwooden,5,1 +pplankwood,5,1 +pplankw,5,1 lightplank,5,2 lightwoodenplank,5,2 lightwoodplank,5,2 @@ -57,6 +85,13 @@ lightwplank,5,2 lightplankwooden,5,2 lightplankwood,5,2 lightplankw,5,2 +lplank,5,2 +lwoodenplank,5,2 +lwoodplank,5,2 +lwplank,5,2 +lplankwooden,5,2 +lplankwood,5,2 +lplankw,5,2 birchplank,5,2 birchwoodenplank,5,2 birchwoodplank,5,2 @@ -71,6 +106,19 @@ bwplank,5,2 bplankwooden,5,2 bplankwood,5,2 bplankw,5,2 +whiteplank,5,2 +whitewoodenplank,5,2 +whitewoodplank,5,2 +whitewplank,5,2 +whiteplankwooden,5,2 +whiteplankwood,5,2 +whiteplankw,5,2 +wwoodenplank,5,2 +wwoodplank,5,2 +wwplank,5,2 +wplankwooden,5,2 +wplankwood,5,2 +wplankw,5,2 jungleplank,5,3 junglewoodenplank,5,3 junglewoodplank,5,3 @@ -85,6 +133,20 @@ jwplank,5,3 jplankwooden,5,3 jplankwood,5,3 jplankw,5,3 +forestplank,5,3 +forestwoodenplank,5,3 +forestwoodplank,5,3 +forestwplank,5,3 +forestplankwooden,5,3 +forestplankwood,5,3 +forestplankw,5,3 +fplank,5,3 +fwoodenplank,5,3 +fwoodplank,5,3 +fwplank,5,3 +fplankwooden,5,3 +fplankwood,5,3 +fplankw,5,3 sapling,6,0 treesapling,6,0 logsapling,6,0 @@ -94,162 +156,91 @@ oaktreesapling,6,0 oaklogsapling,6,0 oaktrunksapling,6,0 oakwoodsapling,6,0 -normaltreesapling,6,0 -normallogsapling,6,0 -normaltrunksapling,6,0 -normalwoodsapling,6,0 osapling,6,0 otreesapling,6,0 ologsapling,6,0 otrunksapling,6,0 owoodsapling,6,0 -nsapling,6,0 -ntreesapling,6,0 -nlogsapling,6,0 -ntrunksapling,6,0 -nwoodsapling,6,0 -treesap,6,0 -logsap,6,0 -trunksap,6,0 -woodsap,6,0 -oaktreesap,6,0 -oaklogsap,6,0 -oaktrunksap,6,0 -oakwoodsap,6,0 -osap,6,0 -otreesap,6,0 -ologsap,6,0 -otrunksap,6,0 -owoodsap,6,0 darksapling,6,1 darktreesapling,6,1 darklogsapling,6,1 darktrunksapling,6,1 darkwoodsapling,6,1 -blacksapling,6,1 -blacktreesapling,6,1 -blacklogsapling,6,1 -blacktrunksapling,6,1 -blackwoodsapling,6,1 sprucesapling,6,1 sprucetreesapling,6,1 sprucelogsapling,6,1 sprucetrunksapling,6,1 sprucewoodsapling,6,1 +pinesapling,6,1 +pinetreesapling,6,1 +pinelogsapling,6,1 +pinetrunksapling,6,1 +pinewoodsapling,6,1 dsapling,6,1 dtreesapling,6,1 dlogsapling,6,1 dtrunksapling,6,1 dwoodsapling,6,1 -blsapling,6,1 -bltreesapling,6,1 -bllogsapling,6,1 -bltrunksapling,6,1 -blwoodsapling,6,1 ssapling,6,1 streesapling,6,1 slogsapling,6,1 strunksapling,6,1 swoodsapling,6,1 -darksap,6,1 -darktreesap,6,1 -darklogsap,6,1 -darktrunksap,6,1 -darkwoodsap,6,1 -blacksap,6,1 -blacktreesap,6,1 -blacklogsap,6,1 -blacktrunksap,6,1 -blackwoodsap,6,1 -pinesap,6,1 -pinetreesap,6,1 -pinelogsap,6,1 -pinetrunksap,6,1 -pinewoodsap,6,1 -sprucesap,6,1 -sprucetreesap,6,1 -sprucelogsap,6,1 -sprucetrunksap,6,1 -sprucewoodsap,6,1 -dsap,6,1 -dtreesap,6,1 -dlogsap,6,1 -dtrunksap,6,1 -dwoodsap,6,1 -blsap,6,1 -bltreesap,6,1 -bllogsap,6,1 -bltrunksap,6,1 -blwoodsap,6,1 -ssap,6,1 -streesap,6,1 -slogsap,6,1 -strunksap,6,1 -swoodsap,6,1 +psapling,6,1 +ptreesapling,6,1 +plogsapling,6,1 +ptrunksapling,6,1 +pwoodsapling,6,1 birchsapling,6,2 birchtreesapling,6,2 birchlogsapling,6,2 birchtrunksapling,6,2 birchwoodsapling,6,2 +lightsapling,6,2 +lighttreesapling,6,2 +lightlogsapling,6,2 +lighttrunksapling,6,2 +lightwoodsapling,6,2 whitesapling,6,2 whitetreesapling,6,2 whitelogsapling,6,2 whitetrunksapling,6,2 whitewoodsapling,6,2 -bisapling,6,2 -bitreesapling,6,2 -bilogsapling,6,2 -bitrunksapling,6,2 -biwoodsapling,6,2 bsapling,6,2 btreesapling,6,2 blogsapling,6,2 btrunksapling,6,2 bwoodsapling,6,2 -pasapling,6,2 -patreesapling,6,2 -palogsapling,6,2 -patrunksapling,6,2 -pawoodsapling,6,2 +lsapling,6,2 +ltreesapling,6,2 +llogsapling,6,2 +ltrunksapling,6,2 +lwoodsapling,6,2 wsapling,6,2 wtreesapling,6,2 wlogsapling,6,2 wtrunksapling,6,2 wwoodsapling,6,2 -birchsap,6,2 -birchtreesap,6,2 -birchlogsap,6,2 -birchtrunksap,6,2 -birchwoodsap,6,2 -whitesap,6,2 -whitetreesap,6,2 -whitelogsap,6,2 -whitetrunksap,6,2 -whitewoodsap,6,2 -bisap,6,2 -bitreesap,6,2 -bilogsap,6,2 -bitrunksap,6,2 -biwoodsap,6,2 -bsap,6,2 -btreesap,6,2 -blogsap,6,2 -btrunksap,6,2 -bwoodsap,6,2 -pasap,6,2 -patreesap,6,2 -palogsap,6,2 -patrunksap,6,2 -pawoodsap,6,2 -wsap,6,2 -wtreesap,6,2 -wlogsap,6,2 -wtrunksap,6,2 -wwoodsap,6,2 junglesapling,6,3 +jungletreesapling,6,3 +junglelogsapling,6,3 +jungletrunksapling,6,3 +junglewoodsapling,6,3 +forestsapling,6,3 +foresttreesapling,6,3 +forestlogsapling,6,3 +foresttrunksapling,6,3 +forestwoodsapling,6,3 jsapling,6,3 -junglesap,6,3 -jsap,6,3 +jtreesapling,6,3 +jlogsapling,6,3 +jtrunksapling,6,3 +jwoodsapling,6,3 +fsapling,6,3 +ftreesapling,6,3 +flogsapling,6,3 +ftrunksapling,6,3 +fwoodsapling,6,3 bedrock,7,0 oprock,7,0 opblock,7,0 @@ -291,6 +282,7 @@ tree,17,0 log,17,0 trunk,17,0 wood,17,0 +oak,17,0 oaktree,17,0 oaklog,17,0 oaktrunk,17,0 @@ -299,44 +291,48 @@ otree,17,0 olog,17,0 otrunk,17,0 owood,17,0 +dark,17,1 darktree,17,1 darklog,17,1 darktrunk,17,1 darkwood,17,1 -blacktree,17,1 -blacklog,17,1 -blacktrunk,17,1 -blackwood,17,1 spruce,17,1 sprucetree,17,1 sprucelog,17,1 sprucetrunk,17,1 sprucewood,17,1 +pine,17,1 +pinetree,17,1 +pinelog,17,1 +pinetrunk,17,1 +pinewood,17,1 dtree,17,1 dlog,17,1 dtrunk,17,1 dwood,17,1 -bltree,17,1 -bllog,17,1 -bltrunk,17,1 -blwood,17,1 stree,17,1 slog,17,1 strunk,17,1 swood,17,1 +ptree,17,1 +plog,17,1 +ptrunk,17,1 +pwood,17,1 birch,17,2 birchtree,17,2 birchlog,17,2 birchtrunk,17,2 birchwood,17,2 +white,17,2 whitetree,17,2 whitelog,17,2 whitetrunk,17,2 whitewood,17,2 -bitree,17,2 -bilog,17,2 -bitrunk,17,2 -biwood,17,2 +light,17,2 +lighttree,17,2 +lightlog,17,2 +lighttrunk,17,2 +lightwood,17,2 btree,17,2 blog,17,2 btrunk,17,2 @@ -345,18 +341,38 @@ wtree,17,2 wlog,17,2 wtrunk,17,2 wwood,17,2 -junglewood,17,3 -jwood,17,3 +ltree,17,2 +llog,17,2 +ltrunk,17,2 +lwood,17,2 +jungle,17,3 +jungletree,17,3 junglelog,17,3 +jungletrunk,17,3 +junglewood,17,3 +forest,17,3 +foresttree,17,3 +forestlog,17,3 +foresttrunk,17,3 +forestwood,17,3 +jtree,17,3 jlog,17,3 -monkeytree,17,3 -monkeylog,17,3 +jtrunk,17,3 +jwood,17,3 +ftree,17,3 +flog,17,3 +ftrunk,17,3 +fwood,17,3 leaves,18,4 leaf,18,4 treeleaves,18,4 logleaves,18,4 trunkleaves,18,4 woodleaves,18,4 +oakleaves,18,4 +oakleaf,18,4 +oleaves,18,4 +oleaf,18,4 oaktreeleaves,18,4 oaklogleaves,18,4 oaktrunkleaves,18,4 @@ -377,8 +393,70 @@ otreeleaf,18,4 ologleaf,18,4 otrunkleaf,18,4 owoodleaf,18,4 +spruceleaves,18,5 +spruceleaf,18,5 +sleaves,18,5 +sleaf,18,5 +sprucetreeleaves,18,5 +sprucelogleaves,18,5 +sprucetrunkleaves,18,5 +sprucewoodleaves,18,5 +streeleaves,18,5 +slogleaves,18,5 +strunkleaves,18,5 +swoodleaves,18,5 +pineleaves,18,5 +pineleaf,18,5 +pleaves,18,5 +pleaf,18,5 +pinetreeleaves,18,5 +pinelogleaves,18,5 +pinetrunkleaves,18,5 +pinewoodleaves,18,5 +ptreeleaves,18,5 +plogleaves,18,5 +ptrunkleaves,18,5 +pwoodleaves,18,5 +darkleaves,18,5 +darkleaf,18,5 +dleaves,18,5 +dleaf,18,5 +darktreeleaves,18,5 +darklogleaves,18,5 +darktrunkleaves,18,5 +darkwoodleaves,18,5 +dtreeleaves,18,5 +dlogleaves,18,5 +dtrunkleaves,18,5 +dwoodleaves,18,5 +sprucetreeleaf,18,5 +sprucelogleaf,18,5 +sprucetrunkleaf,18,5 +sprucewoodleaf,18,5 +streeleaf,18,5 +slogleaf,18,5 +strunkleaf,18,5 +swoodleaf,18,5 +pinetreeleaf,18,5 +pinelogleaf,18,5 +pinetrunkleaf,18,5 +pinewoodleaf,18,5 +ptreeleaf,18,5 +plogleaf,18,5 +ptrunkleaf,18,5 +pwoodleaf,18,5 +darktreeleaf,18,5 +darklogleaf,18,5 +darktrunkleaf,18,5 +darkwoodleaf,18,5 +dtreeleaf,18,5 +dlogleaf,18,5 +dtrunkleaf,18,5 +dwoodleaf,18,5 birchleaves,18,6 birchleaf,18,6 +bleaves,18,6 +bleaf,18,6 birchtreeleaves,18,6 birchlogleaves,18,6 birchtrunkleaves,18,6 @@ -387,10 +465,30 @@ btreeleaves,18,6 blogleaves,18,6 btrunkleaves,18,6 bwoodleaves,18,6 -bitreeleaves,18,6 -bilogleaves,18,6 -bitrunkleaves,18,6 -biwoodleaves,18,6 +lightleaves,18,6 +lightleaf,18,6 +lleaves,18,6 +lleaf,18,6 +lighttreeleaves,18,6 +lightlogleaves,18,6 +lighttrunkleaves,18,6 +lightwoodleaves,18,6 +ltreeleaves,18,6 +llogleaves,18,6 +ltrunkleaves,18,6 +lwoodleaves,18,6 +whiteleaves,18,6 +whiteleaf,18,6 +wleaves,18,6 +wleaf,18,6 +whitetreeleaves,18,6 +whitelogleaves,18,6 +whitetrunkleaves,18,6 +whitewoodleaves,18,6 +wtreeleaves,18,6 +wlogleaves,18,6 +wtrunkleaves,18,6 +wwoodleaves,18,6 birchtreeleaf,18,6 birchlogleaf,18,6 birchtrunkleaf,18,6 @@ -399,16 +497,62 @@ btreeleaf,18,6 blogleaf,18,6 btrunkleaf,18,6 bwoodleaf,18,6 -bitreeleaf,18,6 -bilogleaf,18,6 -bitrunkleaf,18,6 -biwoodleaf,18,6 +lighttreeleaf,18,6 +lightlogleaf,18,6 +lighttrunkleaf,18,6 +lightwoodleaf,18,6 +ltreeleaf,18,6 +llogleaf,18,6 +ltrunkleaf,18,6 +lwoodleaf,18,6 +whitetreeleaf,18,6 +whitelogleaf,18,6 +whitetrunkleaf,18,6 +whitewoodleaf,18,6 +wtreeleaf,18,6 +wlogleaf,18,6 +wtrunkleaf,18,6 +wwoodleaf,18,6 jungleleaves,18,7 +jungleleaf,18,7 jleaves,18,7 jleaf,18,7 -jungleleaf,18,7 -monkeyleaf,18,7 -monkeyleaves,18,7 +jungletreeleaves,18,7 +junglelogleaves,18,7 +jungletrunkleaves,18,7 +junglewoodleaves,18,7 +jtreeleaves,18,7 +jlogleaves,18,7 +jtrunkleaves,18,7 +jwoodleaves,18,7 +forestleaves,18,7 +forestleaf,18,7 +fleaves,18,7 +fleaf,18,7 +foresttreeleaves,18,7 +forestlogleaves,18,7 +foresttrunkleaves,18,7 +forestwoodleaves,18,7 +ftreeleaves,18,7 +flogleaves,18,7 +ftrunkleaves,18,7 +fwoodleaves,18,7 +jungletreeleaf,18,7 +junglelogleaf,18,7 +jungletrunkleaf,18,7 +junglewoodleaf,18,7 +jtreeleaf,18,7 +jlogleaf,18,7 +jtrunkleaf,18,7 +jwoodleaf,18,7 +foresttreeleaf,18,7 +forestlogleaf,18,7 +foresttrunkleaf,18,7 +forestwoodleaf,18,7 +ftreeleaf,18,7 +flogleaf,18,7 +ftrunkleaf,18,7 +fwoodleaf,18,7 sponge,19,0 glass,20,0 lapislazuliore,21,0 @@ -586,6 +730,12 @@ lightgrecotton,35,5 lgrecloth,35,5 lgrewool,35,5 lgrecotton,35,5 +limecloth,35,5 +limewool,35,5 +limecotton,35,5 +lcloth,35,5 +lwool,35,5 +lcotton,35,5 pinkcloth,35,6 pinkwool,35,6 pinkcotton,35,6 @@ -1104,6 +1254,9 @@ mcobblestone,48,0 mossycobble,48,0 mosscobble,48,0 mcobble,48,0 +mossstone,48,0 +mossystone,48,0 +mstone,48,0 obsidian,49,0 obsi,49,0 obby,49,0 @@ -2821,6 +2974,8 @@ flintiron,259,0 flinttinder,259,0 lighter,259,0 apple,260,0 +normalapple,260,0 +redapple,260,0 bow,261,0 arrow,262,0 coal,263,0 @@ -3205,6 +3360,27 @@ picture,321,0 goldenapple,322,0 goldapple,322,0 gapple,322,0 +enchantedgoldenapple,322,1 +enchantedgoldapple,322,1 +enchantedgapple,322,1 +supergoldenapple,322,1 +supergoldapple,322,1 +supergapple,322,1 +magicalgoldenapple,322,1 +magicalgoldapple,322,1 +magicalgapple,322,1 +magicgoldenapple,322,1 +magicgoldapple,322,1 +magicgapple,322,1 +egoldenapple,322,1 +egoldapple,322,1 +egapple,322,1 +sgoldenapple,322,1 +sgoldapple,322,1 +sgapple,322,1 +mgoldenapple,322,1 +mgoldapple,322,1 +mgapple,322,1 sign,323,0 woodendoor,324,0 wooddoor,324,0 @@ -3628,8 +3804,24 @@ delay,356,0 dioder,356,0 diode,356,0 cookie,357,0 -map,358,0 chart,358,0 +map,358,0 +map_0,358,0 +map_1,358,1 +map_2,358,2 +map_3,358,3 +map_4,358,4 +map_5,358,5 +map_6,358,6 +map_7,358,7 +map_8,358,8 +map_9,358,9 +map_10,358,10 +map_11,358,11 +map_12,358,12 +map_13,358,13 +map_14,358,14 +map_15,358,15 shears,359,0 shear,359,0 sheers,359,0 @@ -4108,7 +4300,7 @@ spldmgpotion,373,16396 splharmingpot,373,16396 spldamagepot,373,16396 spldmgpot,373,16396 -sdpot,373,16396 +spdpot,373,16396 splashregenerationleveliipotion,373,16417 splashregenerateleveliipotion,373,16417 splashregenleveliipotion,373,16417 @@ -4798,10 +4990,10 @@ redmusicrecord,2259,0 redmusicdisk,2259,0 redmusicdisc,2259,0 redmusiccd,2259,0 -chripmusicrecord,2259,0 -chripmusicdisk,2259,0 -chripmusicdisc,2259,0 -chripmusiccd,2259,0 +chirpmusicrecord,2259,0 +chirpmusicdisk,2259,0 +chirpmusicdisc,2259,0 +chirpmusiccd,2259,0 remusicrecord,2259,0 remusicdisk,2259,0 remusicdisc,2259,0 @@ -4810,10 +5002,10 @@ redmrecord,2259,0 redmdisk,2259,0 redmdisc,2259,0 redmcd,2259,0 -chripmrecord,2259,0 -chripmdisk,2259,0 -chripmdisc,2259,0 -chripmcd,2259,0 +chirpmrecord,2259,0 +chirpmdisk,2259,0 +chirpmdisc,2259,0 +chirpmcd,2259,0 remrecord,2259,0 remdisk,2259,0 remdisc,2259,0 @@ -4822,10 +5014,10 @@ redrecord,2259,0 reddisk,2259,0 reddisc,2259,0 redcd,2259,0 -chriprecord,2259,0 -chripdisk,2259,0 -chripdisc,2259,0 -chripcd,2259,0 +chirprecord,2259,0 +chirpdisk,2259,0 +chirpdisc,2259,0 +chirpcd,2259,0 rerecord,2259,0 redisk,2259,0 redisc,2259,0 @@ -4905,7 +5097,7 @@ cd5,2260,0 5record,2260,0 5disk,2260,0 5disc,2260,0 -5cs,2260,0 +5cd,2260,0 purplemusicrecord,2261,0 purplemusicdisk,2261,0 purplemusicdisc,2261,0 @@ -5149,7 +5341,7 @@ cd10,2265,0 10record,2265,0 10disk,2265,0 10disc,2265,0 -10cs,2265,0 +10cd,2265,0 crackedmusicrecord,2266,0 crackedmusicdisk,2266,0 crackedmusicdisc,2266,0 diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties index 252d077ec..dd7bf3846 100644 --- a/Essentials/src/messages_se.properties +++ b/Essentials/src/messages_se.properties @@ -3,16 +3,16 @@ # Translations start here # by: oggehej, corrected by NeonMaster. action=* {0} {1} -addedToAccount=\u00a7a{0} har blivit tillagt p\u00c3\u00a5 ditt konto. -addedToOthersAccount=\u00a7a{0} har blivit tillagt p\u00c3\u00a5 {1}\u00a7a konto. Ny balans: {2} +addedToAccount=\u00a7a{0} har blivit tillagt p\u00e5 ditt konto. +addedToOthersAccount=\u00a7a{0} har blivit tillagt p\u00e5 {1}\u00a7a konto. Ny balans: {2} adventure = adventure -alertBroke=gjorde s\u00c3\u00b6nder: +alertBroke=gjorde s\u00f6nder: alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} at: {3} alertPlaced=placerade: -alertUsed=anv\u00c3\u00a4nde: -autoAfkKickReason=Du har blivit utsparkad f\u00c3\u00b6r att ha varit inaktiv i mer \u00c3\u00a4n {0} minuter. -backAfterDeath=\u00a77Anv\u00c3\u00a4nd /back kommandot f\u00c3\u00b6r att komma tillbaka till din d\u00c3\u00b6dsplats. -backUsageMsg=\u00a77Tar dig tillbaka till din f\u00c3\u00b6reg\u00c3\u00a5ende position. +alertUsed=anv\u00e4nde: +autoAfkKickReason=Du har blivit utsparkad f\u00f6r att ha varit inaktiv i mer \u00e4n {0} minuter. +backAfterDeath=\u00a77Anv\u00e4nd /back kommandot f\u00f6r att komma tillbaka till din d\u00f6dsplats. +backUsageMsg=\u00a77Tar dig tillbaka till din f\u00f6reg\u00e5ende position. backupDisabled=Ett externt backup-skript har inte blivit konfigurerat. backupFinished=Backup klar backupStarted=Backup startad @@ -20,418 +20,418 @@ balance=\u00a77Balans: {0} balanceTop=\u00a77Topp balans ({0}) banExempt=\u00a7cDu kan inte banna den spelaren. banIpAddress=\u00a77Bannade IP-adress -bannedIpsFileError=Kunde inte l\u00c3\u00a4sa banned-ips.txt +bannedIpsFileError=Kunde inte l\u00e4sa banned-ips.txt bannedIpsFileNotFound=banned-ips.txt hittades inte -bannedPlayersFileError=Kunde inte l\u00c3\u00a4sa banned-players.txt +bannedPlayersFileError=Kunde inte l\u00e4sa banned-players.txt bannedPlayersFileNotFound=banned-players.txt hittades inte -bigTreeFailure=\u00a7cEtt stort tr\u00c3\u00a4d kunde inte genereras misslyckades. F\u00c3\u00b6s\u00c3\u00b6k igen p\u00c3\u00a5 gr\u00c3\u00a4s eller jord. -bigTreeSuccess= \u00a77Stort tr\u00c3\u00a4d genererat. -blockList=Essentials vidarebefordrade f\u00c3\u00b6ljande kommandon till ett annat insticksprogram: -broadcast=[\u00a7cUts\u00c3\u00a4ndning\u00a7f]\u00a7a {0} -buildAlert=\u00a7cDu har inte till\u00c3\u00a5telse att bygga -bukkitFormatChanged=Bukkit versionsformat bytt. Version \u00c3\u00a4r inte kollad. -burnMsg=\u00a77Du satte eld p\u00c3\u00a5 {0} i {1} sekunder. +bigTreeFailure=\u00a7cEtt stort tr\u00e4d kunde inte genereras misslyckades. F\u00f6s\u00f6k igen p\u00e5 gr\u00e4s eller jord. +bigTreeSuccess= \u00a77Stort tr\u00e4d genererat. +blockList=Essentials vidarebefordrade f\u00f6ljande kommandon till ett annat insticksprogram: +broadcast=[\u00a7cUts\u00e4ndning\u00a7f]\u00a7a {0} +buildAlert=\u00a7cDu har inte till\u00e5telse att bygga +bukkitFormatChanged=Bukkit versionsformat bytt. Version \u00e4r inte kollad. +burnMsg=\u00a77Du satte eld p\u00e5 {0} i {1} sekunder. canTalkAgain=\u00a77Du kan nu prata igen! cantFindGeoIpDB=Kunde inte hitta GeoIP-databasen! -cantReadGeoIpDB=Kunde inte l\u00c3\u00a4sa inneh\u00c3\u00a5ll fr\u00c3\u00a5n GeoIP-databasen! -cantSpawnItem=\u00a7cDu har inte beh\u00c3\u00b6righet att spawna {0} +cantReadGeoIpDB=Kunde inte l\u00e4sa inneh\u00e5ll fr\u00e5n GeoIP-databasen! +cantSpawnItem=\u00a7cDu har inte beh\u00f6righet att spawna {0} chatTypeLocal=[L] chatTypeSpy=[Spy] commandFailed=Kommando {0} misslyckades: -commandHelpFailedForPlugin=Kunde inte hitta hj\u00c3\u00a4lp f\u00c3\u00b6r: {0} -commandNotLoaded=\u00a7cKommando {0} \u00c3\u00a4r felaktigt laddat. -compassBearing=\u00a77B\u00c3\u00a4ring: {0} ({1} grader). +commandHelpFailedForPlugin=Kunde inte hitta hj\u00e4lp f\u00f6r: {0} +commandNotLoaded=\u00a7cKommando {0} \u00e4r felaktigt laddat. +compassBearing=\u00a77B\u00e4ring: {0} ({1} grader). configFileMoveError=Kunde inte flytta config.yml till backup-platsen. -configFileRenameError=Kunde inte byta namn p\u00c3\u00a5 temp-filen till config.yml +configFileRenameError=Kunde inte byta namn p\u00e5 temp-filen till config.yml connectedPlayers=Anslutna spelare: -connectionFailed=Kunde inte \u00c3\u00b6ppna anslutning. +connectionFailed=Kunde inte \u00f6ppna anslutning. cooldownWithMessage=\u00a7cNedkylning: {0} corruptNodeInConfig=\u00a74Notice: Din konfigurationsfil har en korrupt {0} nod. couldNotFindTemplate=Kunde inte hitta mallen {0} -creatingConfigFromTemplate=Skapar konfiguration fr\u00c3\u00a5n mallen: {0} +creatingConfigFromTemplate=Skapar konfiguration fr\u00e5n mallen: {0} creatingEmptyConfig=Skapar tom konfiguration: {0} creative=kreativ currency={0}{1} -currentWorld=Nuvarande v\u00c3\u00a4rld: {0} +currentWorld=Nuvarande v\u00e4rld: {0} day=dag days=dagar defaultBanReason=Banhammaren har talat! deleteFileError=Kunde inte radera filen: {0} deleteHome=\u00a77Hemmet {0} har tagits bort. -deleteJail=\u00a77F\u00c3\u00a4ngelset {0} har tagits bort. +deleteJail=\u00a77F\u00e4ngelset {0} har tagits bort. deleteWarp=\u00a77Warpen {0} har tagits bort. -deniedAccessCommand={0} nekades \u00c3\u00a5tkomst till kommandot. -dependancyDownloaded=[Essentials] Beroende {0} laddades ner framg\u00c3\u00a5ngsrikt. -dependancyException=[Essentials] Ett fel uppstod n\u00c3\u00a4r ett beroende laddades ner. -dependancyNotFound=[Essentials] Ett n\u00c3\u00b6dv\u00c3\u00a4ndigt beroende hittades inte, laddar ner nu. -depth=\u00a77Du \u00c3\u00a4r p\u00c3\u00a5 havsniv\u00c3\u00a5n. -depthAboveSea=\u00a77Du \u00c3\u00a4r {0} block ovanf\u00c3\u00b6r havsni\u00c3\u00a5n. -depthBelowSea=\u00a77Du \u00c3\u00a4r {0} block under havsniv\u00c3\u00a5n. -destinationNotSet=Ingen destination \u00c3\u00a4r inst\u00c3\u00a4lld. -disableUnlimited=\u00a77Inaktiverade o\u00c3\u00a4ndligt placerande av {0} f\u00c3\u00b6r {1}. +deniedAccessCommand={0} nekades \u00e5tkomst till kommandot. +dependancyDownloaded=[Essentials] Beroende {0} laddades ner framg\u00e5ngsrikt. +dependancyException=[Essentials] Ett fel uppstod n\u00e4r ett beroende laddades ner. +dependancyNotFound=[Essentials] Ett n\u00f6dv\u00e4ndigt beroende hittades inte, laddar ner nu. +depth=\u00a77Du \u00e4r p\u00e5 havsniv\u00e5n. +depthAboveSea=\u00a77Du \u00e4r {0} block ovanf\u00f6r havsni\u00e5n. +depthBelowSea=\u00a77Du \u00e4r {0} block under havsniv\u00e5n. +destinationNotSet=Ingen destination \u00e4r inst\u00e4lld. +disableUnlimited=\u00a77Inaktiverade o\u00e4ndligt placerande av {0} f\u00f6r {1}. disabled=inaktiverad -disabledToSpawnMob=Att spawna fram den h\u00c3\u00a4r moben \u00c3\u00a4r inaktiverat i configurationsfilen. -dontMoveMessage=\u00a77Teleporteringen p\u00c3\u00a5b\u00c3\u00b6rjas om {0}. R\u00c3\u00b6r dig inte. -downloadingGeoIp=Laddar ner GeoIP-databasen... det h\u00c3\u00a4r kan ta en stund (land: 0.6 MB, stad: 20MB) -duplicatedUserdata=Dublicerad anv\u00c3\u00a4ndardata: {0} och {1} -durability=\u00a77Det h\u00c3\u00a4r verktyget har \u00a7c{0}\u00a77 anv\u00c3\u00a4ndningar kvar -enableUnlimited=\u00a77Ger o\u00c3\u00a4ndligt av {0} till {1}. +disabledToSpawnMob=Att spawna fram den h\u00e4r moben \u00e4r inaktiverat i configurationsfilen. +dontMoveMessage=\u00a77Teleporteringen p\u00e5b\u00f6rjas om {0}. R\u00f6r dig inte. +downloadingGeoIp=Laddar ner GeoIP-databasen... det h\u00e4r kan ta en stund (land: 0.6 MB, stad: 20MB) +duplicatedUserdata=Dublicerad anv\u00e4ndardata: {0} och {1} +durability=\u00a77Det h\u00e4r verktyget har \u00a7c{0}\u00a77 anv\u00e4ndningar kvar +enableUnlimited=\u00a77Ger o\u00e4ndligt av {0} till {1}. enabled=aktiverad -enchantmentApplied = \u00a77F\u00c3\u00b6rtrollningen {0} har blivit till\u00c3\u00a4mpad p\u00c3\u00a5 saken du har i handen. -enchantmentNotFound = \u00a7cF\u00c3\u00b6rtrollningen hittades inte -enchantmentPerm = \u00a7cDu har inte beh\u00c3\u00b6righet att {0} -enchantmentRemoved = \u00a77F\u00c3\u00b6rtrollningen {0} har tagits bort fr\u00c3\u00a5n saken i din hand. -enchantments = \u00a77F\u00c3\u00b6rtrollningar: {0} +enchantmentApplied = \u00a77F\u00f6rtrollningen {0} har blivit till\u00e4mpad p\u00e5 saken du har i handen. +enchantmentNotFound = \u00a7cF\u00f6rtrollningen hittades inte +enchantmentPerm = \u00a7cDu har inte beh\u00f6righet att {0} +enchantmentRemoved = \u00a77F\u00f6rtrollningen {0} har tagits bort fr\u00e5n saken i din hand. +enchantments = \u00a77F\u00f6rtrollningar: {0} errorCallingCommand=Kunde inte kontakta kommandot /{0} errorWithMessage=\u00a7cFel: {0} -essentialsHelp1=Filen \u00c3\u00a4r trasig och Essentials kan inte \u00c3\u00b6ppna den. Essentials \u00c3\u00a4r nu inaktiverat. Om du inte kan fixa problemet sj\u00c3\u00a4lv, g\u00c3\u00a5 till http://tiny.cc/EssentialsChat -essentialsHelp2=Filen \u00c3\u00a4r trasig och Essentials kan inte \u00c3\u00b6ppna den. Essentials \u00c3\u00a4r nu inaktiverat. Om du inte kan fixa problemet sj\u00c3\u00a4lv, skriv /essentialshelp i spelet eller g\u00c3\u00a5 till http://tiny.cc/EssentialsChat +essentialsHelp1=Filen \u00e4r trasig och Essentials kan inte \u00f6ppna den. Essentials \u00e4r nu inaktiverat. Om du inte kan fixa problemet sj\u00e4lv, g\u00e5 till http://tiny.cc/EssentialsChat +essentialsHelp2=Filen \u00e4r trasig och Essentials kan inte \u00f6ppna den. Essentials \u00e4r nu inaktiverat. Om du inte kan fixa problemet sj\u00e4lv, skriv /essentialshelp i spelet eller g\u00e5 till http://tiny.cc/EssentialsChat essentialsReload=\u00a77Essentials Omladdat {0} -exp=\u00a7c{0} \u00a77har\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) och beh\u00c3\u00b6ver\u00a7c {3} \u00a77mer erfarenhet f\u00c3\u00b6r att g\u00c3\u00a5 upp en niv\u00c3\u00a5. +exp=\u00a7c{0} \u00a77har\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) och beh\u00f6ver\u00a7c {3} \u00a77mer erfarenhet f\u00f6r att g\u00e5 upp en niv\u00e5. expSet=\u00a7c{0} \u00a77har nu\u00a7c {1} \u00a77erfarenhet. -extinguish=\u00a77Du sl\u00c3\u00a4ckte dig sj\u00c3\u00a4lv. -extinguishOthers=\u00a77Du sl\u00c3\u00a4ckte {0}. -failedToCloseConfig=Kunde inte st\u00c3\u00a4nga konfiguration {0} +extinguish=\u00a77Du sl\u00e4ckte dig sj\u00e4lv. +extinguishOthers=\u00a77Du sl\u00e4ckte {0}. +failedToCloseConfig=Kunde inte st\u00e4nga konfiguration {0} failedToCreateConfig=Kunde inte skapa konfiguration {0} failedToWriteConfig=Kunde inte skriva konfiguration {0} false=falskt -feed=\u00a77Din hunger \u00c3\u00a4r m\u00c3\u00a4ttad. +feed=\u00a77Din hunger \u00e4r m\u00e4ttad. feedOther=\u00a77Matade {0}. fileRenameError=Namnbytet av filen {0} misslyckades -flyMode=\u00a77Aktiverade flygl\u00c3\u00a4ge {0} f\u00c3\u00b6r {1}. +flyMode=\u00a77Aktiverade flygl\u00e4ge {0} f\u00f6r {1}. foreverAlone=\u00a7cDu har ingen att svara. freedMemory=Befriade {0} MB. -gameMode=\u00a77Satte {0}s spell\u00c3\u00a4ge till {1}. +gameMode=\u00a77Satte {0}s spell\u00e4ge till {1}. gcchunks= bitar, gcentities= enheter gcfree=Ledigt minne: {0} MB gcmax=Maximalt minne: {0} MB gctotal=Tilldelat minne: {0} MB -geoIpUrlEmpty=Nerladdningsadressen f\u00c3\u00b6r GeoIP \u00c3\u00a4r tom. -geoIpUrlInvalid=Nerladdningsadressen f\u00c3\u00b6r GeoIP \u00c3\u00a4r ogiltig. -geoipJoinFormat=Spelaren {0} kommer fr\u00c3\u00a5n {1} -godDisabledFor=inaktiverat f\u00c3\u00b6r {0} -godEnabledFor=aktiverat f\u00c3\u00b6r {0} -godMode=\u00a77Od\u00c3\u00b6dlighet {0}. -hatArmor=\u00a7cFel, du kan inte anv\u00c3\u00a4nda den h\u00c3\u00a4r saken som en hatt! -hatFail=\u00a7cDu m\u00c3\u00a5ste ha n\u00c3\u00a5gonting att b\u00c3\u00a4ra i din hand. +geoIpUrlEmpty=Nerladdningsadressen f\u00f6r GeoIP \u00e4r tom. +geoIpUrlInvalid=Nerladdningsadressen f\u00f6r GeoIP \u00e4r ogiltig. +geoipJoinFormat=Spelaren {0} kommer fr\u00e5n {1} +godDisabledFor=inaktiverat f\u00f6r {0} +godEnabledFor=aktiverat f\u00f6r {0} +godMode=\u00a77Od\u00f6dlighet {0}. +hatArmor=\u00a7cFel, du kan inte anv\u00e4nda den h\u00e4r saken som en hatt! +hatFail=\u00a7cDu m\u00e5ste ha n\u00e5gonting att b\u00e4ra i din hand. hatPlaced=\u00a7eNjut av din nya hatt! haveBeenReleased=\u00a77Du har blivit friad -heal=\u00a77Du har blivit l\u00c3\u00a4kt. -healOther=\u00a77L\u00c3\u00a4kte {0}. -helpConsole=F\u00c3\u00b6r att visa hj\u00c3\u00a4lp fr\u00c3\u00a5n konsolen, skriv ?. -helpFrom=\u00a77Kommandon fr\u00c3\u00a5n {0}: +heal=\u00a77Du har blivit l\u00e4kt. +healOther=\u00a77L\u00e4kte {0}. +helpConsole=F\u00f6r att visa hj\u00e4lp fr\u00e5n konsolen, skriv ?. +helpFrom=\u00a77Kommandon fr\u00e5n {0}: helpLine=\u00a76/{0}\u00a7f: {1} helpMatching=\u00a77Kommandon matchar "{0}": -helpOp=\u00a7c[OpHj\u00c3\u00a4lp]\u00a7f \u00a77{0}:\u00a7f {1} +helpOp=\u00a7c[OpHj\u00e4lp]\u00a7f \u00a77{0}:\u00a7f {1} helpPages=Sida \u00a7c{0}\u00a7f av \u00a7c{1}\u00a7f: -helpPlugin=\u00a74{0}\u00a7f: Hj\u00c3\u00a4lp f\u00c3\u00b6r insticksprogram: /help {1} -holeInFloor=H\u00c3\u00a5l i golvet -homeSet=\u00a77Hem inst\u00c3\u00a4llt. -homeSetToBed=\u00a77Ditt hem \u00c3\u00a4r nu inst\u00c3\u00a4llt till den h\u00c3\u00a4r s\u00c3\u00a4ngen. +helpPlugin=\u00a74{0}\u00a7f: Hj\u00e4lp f\u00f6r insticksprogram: /help {1} +holeInFloor=H\u00e5l i golvet +homeSet=\u00a77Hem inst\u00e4llt. +homeSetToBed=\u00a77Ditt hem \u00e4r nu inst\u00e4llt till den h\u00e4r s\u00e4ngen. homes=Hem: {0} hour=timme hours=timmar -ignorePlayer=Du ignorerar spelaren {0} fr\u00c3\u00a5n och med nu. +ignorePlayer=Du ignorerar spelaren {0} fr\u00e5n och med nu. illegalDate=Felaktigt datumformat. -infoChapter=V\u00c3\u00a4lj kapitel: +infoChapter=V\u00e4lj kapitel: infoChapterPages=Kapitel {0}, sida \u00a7c{1}\u00a7f av \u00a7c{2}\u00a7f: -infoFileDoesNotExist=Filen info.txt finns inte. Skapar en f\u00c3\u00b6r dig. +infoFileDoesNotExist=Filen info.txt finns inte. Skapar en f\u00f6r dig. infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Sida \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- -infoUnknownChapter=Ok\u00c3\u00a4nt kapitel. -invBigger=De andra anv\u00c3\u00a4ndarnas f\u00c3\u00b6rr\u00c3\u00a5d \u00c3\u00a4r st\u00c3\u00b6rre \u00c3\u00a4n ditt. -invRestored=Ditt f\u00c3\u00b6rr\u00c3\u00a5d har blivit \u00c3\u00a5terst\u00c3\u00a4llt. -invSee=Du ser nu {0}s f\u00c3\u00b6rr\u00c3\u00a5d. -invSeeHelp=Anv\u00c3\u00a4nd /invsee f\u00c3\u00b6r att \u00c3\u00a5terst\u00c3\u00a4lla ditt f\u00c3\u00b6rr\u00c3\u00a5d. +infoUnknownChapter=Ok\u00e4nt kapitel. +invBigger=De andra anv\u00e4ndarnas f\u00f6rr\u00e5d \u00e4r st\u00f6rre \u00e4n ditt. +invRestored=Ditt f\u00f6rr\u00e5d har blivit \u00e5terst\u00e4llt. +invSee=Du ser nu {0}s f\u00f6rr\u00e5d. +invSeeHelp=Anv\u00e4nd /invsee f\u00f6r att \u00e5terst\u00e4lla ditt f\u00f6rr\u00e5d. invalidCharge=\u00a7cOgiltig laddning. invalidHome=Hemmet {0} finns inte invalidMob=Ogiltig monster-typ. invalidServer=Ogiltig server! -invalidSignLine=Rad {0} p\u00c3\u00a5 skylten \u00c3\u00a4r ogiltig. -invalidWorld=\u00a7cOgiltig v\u00c3\u00a4rld. -inventoryCleared=\u00a77F\u00c3\u00b6rr\u00c3\u00a5d rensat. -inventoryClearedOthers=\u00a77F\u00c3\u00b6rr\u00c3\u00a5det av \u00a7c{0}\u00a77 \u00c3\u00a4r rensat. -is=\u00c3\u00a4r -itemCannotBeSold=Det objektet kan inte s\u00c3\u00a4ljas till servern. -itemMustBeStacked=Objektet m\u00c3\u00a5ste k\u00c3\u00b6pas i staplar. En m\u00c3\u00a4ngd av 2s kommer bli 2 staplar, etc. -itemNotEnough1=\u00a7cDu har inte tillr\u00c3\u00a4ckligt av den saken f\u00c3\u00b6r att s\u00c3\u00a4lja. -itemNotEnough2=\u00a77Om du ville s\u00c3\u00a4lja alla block av den typen, anv\u00c3\u00a4nd /sell blocknamn -itemNotEnough3=\u00a77/sell blocknamn -1 kommer att s\u00c3\u00a4lja allt av den blocktypen f\u00c3\u00b6rutom 1 o.s.v. -itemSellAir=F\u00c3\u00b6rs\u00c3\u00b6kte du att s\u00c3\u00a4lja luft? S\u00c3\u00a4tt en sak i din hand. -itemSold=\u00a77S\u00c3\u00a5lde f\u00c3\u00b6r \u00a7c{0} \u00a77({1} {2} f\u00c3\u00b6r {3} styck) -itemSoldConsole={0} s\u00c3\u00a5lde {1} f\u00c3\u00b6r \u00a77{2} \u00a77({3} saker f\u00c3\u00b6r {4} styck) +invalidSignLine=Rad {0} p\u00e5 skylten \u00e4r ogiltig. +invalidWorld=\u00a7cOgiltig v\u00e4rld. +inventoryCleared=\u00a77F\u00f6rr\u00e5d rensat. +inventoryClearedOthers=\u00a77F\u00f6rr\u00e5det av \u00a7c{0}\u00a77 \u00e4r rensat. +is=\u00e4r +itemCannotBeSold=Det objektet kan inte s\u00e4ljas till servern. +itemMustBeStacked=Objektet m\u00e5ste k\u00f6pas i staplar. En m\u00e4ngd av 2s kommer bli 2 staplar, etc. +itemNotEnough1=\u00a7cDu har inte tillr\u00e4ckligt av den saken f\u00f6r att s\u00e4lja. +itemNotEnough2=\u00a77Om du ville s\u00e4lja alla block av den typen, anv\u00e4nd /sell blocknamn +itemNotEnough3=\u00a77/sell blocknamn -1 kommer att s\u00e4lja allt av den blocktypen f\u00f6rutom 1 o.s.v. +itemSellAir=F\u00f6rs\u00f6kte du att s\u00e4lja luft? S\u00e4tt en sak i din hand. +itemSold=\u00a77S\u00e5lde f\u00f6r \u00a7c{0} \u00a77({1} {2} f\u00f6r {3} styck) +itemSoldConsole={0} s\u00e5lde {1} f\u00f6r \u00a77{2} \u00a77({3} saker f\u00f6r {4} styck) itemSpawn=\u00a77Ger {0} stycken {1} itemsCsvNotLoaded=Kunde inte ladda items.csv. -jailAlreadyIncarcerated=\u00a7cPersonen \u00c3\u00a4r redan i f\u00c3\u00a4ngelse: {0} -jailMessage=\u00a7cBryter du mot reglerna, f\u00c3\u00a5r du st\u00c3\u00a5 ditt kast. -jailNotExist=Det f\u00c3\u00a4ngelset finns inte. -jailReleased=\u00a77Spelaren \u00a7e{0}\u00a77 \u00c3\u00a4r frisl\u00c3\u00a4ppt. -jailReleasedPlayerNotify=\u00a77Du har blivit frisl\u00c3\u00a4ppt! -jailSentenceExtended=F\u00c3\u00a4ngelsestraffet f\u00c3\u00b6rl\u00c3\u00a4ngt till: {0) -jailSet=\u00a77F\u00c3\u00a4ngelset {0} har skapats -jumpError=Det skulle skadat din dators hj\u00c3\u00a4rna. -kickDefault=Utsparkad fr\u00c3\u00a5n server +jailAlreadyIncarcerated=\u00a7cPersonen \u00e4r redan i f\u00e4ngelse: {0} +jailMessage=\u00a7cBryter du mot reglerna, f\u00e5r du st\u00e5 ditt kast. +jailNotExist=Det f\u00e4ngelset finns inte. +jailReleased=\u00a77Spelaren \u00a7e{0}\u00a77 \u00e4r frisl\u00e4ppt. +jailReleasedPlayerNotify=\u00a77Du har blivit frisl\u00e4ppt! +jailSentenceExtended=F\u00e4ngelsestraffet f\u00f6rl\u00e4ngt till: {0) +jailSet=\u00a77F\u00e4ngelset {0} har skapats +jumpError=Det skulle skadat din dators hj\u00e4rna. +kickDefault=Utsparkad fr\u00e5n server kickExempt=\u00a7cDu kan inte sparka ut den spelaren. -kickedAll=\u00a7cSparkade ut alla spelare fr\u00c3\u00a5n servern -kill=\u00a77D\u00c3\u00b6dade {0}. +kickedAll=\u00a7cSparkade ut alla spelare fr\u00e5n servern +kill=\u00a77D\u00f6dade {0}. kitError2=\u00a7cDet kit:et finns inte eller har blivit felaktigt definierat. kitError=\u00a7cDet finns inga giltiga kit. -kitErrorHelp=\u00a7cKanske en sak fattar m\u00c3\u00a4ngd i konfigurationen? +kitErrorHelp=\u00a7cKanske en sak fattar m\u00e4ngd i konfigurationen? kitGive=\u00a77Ger kit {0}. -kitInvFull=\u00a7cDitt F\u00c3\u00b6rr\u00c3\u00a5d var fullt, placerar kit p\u00c3\u00a5 golvet -kitTimed=\u00a7cDu kan inte anv\u00c3\u00a4nda det kit:et igen p\u00c3\u00a5 {0}. +kitInvFull=\u00a7cDitt F\u00f6rr\u00e5d var fullt, placerar kit p\u00e5 golvet +kitTimed=\u00a7cDu kan inte anv\u00e4nda det kit:et igen p\u00e5 {0}. kits=\u00a77Kit: {0} -lightningSmited=\u00a77Blixten har slagit ner p\u00c3\u00a5 dig -lightningUse=\u00a77En blixt kommer sl\u00c3\u00a5 ner p\u00c3\u00a5 {0} +lightningSmited=\u00a77Blixten har slagit ner p\u00e5 dig +lightningUse=\u00a77En blixt kommer sl\u00e5 ner p\u00e5 {0} listAfkTag = \u00a77[AFK]\u00a7f -listAmount = \u00a79Det \u00c3\u00a4r \u00a7c{0}\u00a79 av maximalt \u00a7c{1}\u00a79 spelare online. -listAmountHidden = \u00a79Det \u00c3\u00a4r \u00a7c{0}\u00a77/{1}\u00a79 Av maximalt \u00a7c{2}\u00a79 spelare online. +listAmount = \u00a79Det \u00e4r \u00a7c{0}\u00a79 av maximalt \u00a7c{1}\u00a79 spelare online. +listAmountHidden = \u00a79Det \u00e4r \u00a7c{0}\u00a77/{1}\u00a79 Av maximalt \u00a7c{2}\u00a79 spelare online. listGroupTag={0}\u00a7f: -listHiddenTag = \u00a77[G\u00c3\u0096MD]\u00a7f +listHiddenTag = \u00a77[G\u00d6MD]\u00a7f loadWarpError=Kunde inte ladda warp {0} localFormat=Lokal: <{0}> {1} -mailClear=\u00a7cF\u00c3\u00b6r att markera dina meddelanden som l\u00c3\u00a4sta, skriv /mail clear +mailClear=\u00a7cF\u00f6r att markera dina meddelanden som l\u00e4sta, skriv /mail clear mailCleared=\u00a77Meddelanden rensade! mailSent=\u00a77Meddelandet skickad! -markMailAsRead=\u00a7cF\u00c3\u00b6r att markera dina meddelanden som l\u00c3\u00a4sta, skriv /mail clear -markedAsAway=\u00a77Du \u00c3\u00a4r nu markerad som borta. -markedAsNotAway=\u00a77Du \u00c3\u00a4r inte l\u00c3\u00a4ngre markerad som borta. -maxHomes=Du kan inte ha fler \u00c3\u00a4n {0} hem. -mayNotJail=\u00a7cDu f\u00c3\u00a5r inte s\u00c3\u00a4tta den personen i f\u00c3\u00a4ngelse +markMailAsRead=\u00a7cF\u00f6r att markera dina meddelanden som l\u00e4sta, skriv /mail clear +markedAsAway=\u00a77Du \u00e4r nu markerad som borta. +markedAsNotAway=\u00a77Du \u00e4r inte l\u00e4ngre markerad som borta. +maxHomes=Du kan inte ha fler \u00e4n {0} hem. +mayNotJail=\u00a7cDu f\u00e5r inte s\u00e4tta den personen i f\u00e4ngelse me=jag minute=minut minutes=minuter missingItems=Du har inte {0}x {1}. -missingPrefixSuffix=Saknar ett prefix eller suffix f\u00c3\u00b6r {0} -mobSpawnError=Fel n\u00c3\u00a4r mob-spawnaren f\u00c3\u00b6rs\u00c3\u00b6kte att \u00c3\u00a4ndras. -mobSpawnLimit=M\u00c3\u00a4ngden mobs begr\u00c3\u00a4nsad till serverns maxgr\u00c3\u00a4ns -mobSpawnTarget=M\u00c3\u00a5lblocket m\u00c3\u00a5ste vara en mob-spawnare. +missingPrefixSuffix=Saknar ett prefix eller suffix f\u00f6r {0} +mobSpawnError=Fel n\u00e4r mob-spawnaren f\u00f6rs\u00f6kte att \u00e4ndras. +mobSpawnLimit=M\u00e4ngden mobs begr\u00e4nsad till serverns maxgr\u00e4ns +mobSpawnTarget=M\u00e5lblocket m\u00e5ste vara en mob-spawnare. mobsAvailable=\u00a77Mobs: {0} -moneyRecievedFrom=\u00a7a{0} har tagits emot fr\u00c3\u00a5n {1} +moneyRecievedFrom=\u00a7a{0} har tagits emot fr\u00e5n {1} moneySentTo=\u00a7a{0} har skickats till {1} -moneyTaken={0} \u00c3\u00a4r taget fr\u00c3\u00a5n ditt bankkonto. -month=m\u00c3\u00a5nad -months=m\u00c3\u00a5nader -moreThanZero=M\u00c3\u00a5ngden m\u00c3\u00a5ste vara st\u00c3\u00b6rre \u00c3\u00a4n 0. +moneyTaken={0} \u00e4r taget fr\u00e5n ditt bankkonto. +month=m\u00e5nad +months=m\u00e5nader +moreThanZero=M\u00e5ngden m\u00e5ste vara st\u00f6rre \u00e4n 0. msgFormat=\u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} muteExempt=\u00a7cDu kan inte tysta den spelaren. -mutedPlayer=Spelaren {0} \u00c3\u00a4r tystad. -mutedPlayerFor=Spelaren {0} \u00c3\u00a4r tystad i {1}. -mutedUserSpeaks={0} f\u00c3\u00b6rs\u00c3\u00b6kte att prata, men blev tystad. -nearbyPlayers=Spelare i n\u00c3\u00a4rheten: {0} -negativeBalanceError=Anv\u00c3\u00a4ndaren \u00c3\u00a4r inte till\u00c3\u00a5ten att ha en negativ balans. -nickChanged=Smeknamn \u00c3\u00a4ndrat. -nickDisplayName=\u00a77Du m\u00c3\u00a5ste aktivera change-displayname i Essentials-konfigurationen. -nickInUse=\u00a7cDet namnet anv\u00c3\u00a4nds redan. -nickNamesAlpha=\u00a7cSmeknamn m\u00c3\u00a5ste vara alfanumeriska. -nickNoMore=\u00a77Du har inte ett smeknamn l\u00c3\u00a4ngre -nickOthersPermission=\u00a7cDu har inte tillst\u00c3\u00a5nd att \u00c3\u00a4ndra andras smeknamn -nickSet=\u00a77Ditt smeknamn \u00c3\u00a4r nu \u00a7c{0} -noAccessCommand=\u00a7cDu har inte tillg\u00c3\u00a5ng till det kommandot. -noAccessPermission=\u00a7cDu har inte tillst\u00c3\u00a5nd till att komma \u00c3\u00a5t det {0}. -noBreakBedrock=Du har inte till\u00c3\u00a5telse att f\u00c3\u00b6rst\u00c3\u00b6ra berggrund. -noDestroyPermission=\u00a7Du har inte till\u00c3\u00a5telse att f\u00c3\u00b6rst\u00c3\u00b6ra det {0}. -noDurability=\u00a7cDen saken har inte en h\u00c3\u00a5llbarhet. -noGodWorldWarning=\u00a7cVarning! Od\u00c3\u00b6dlighet i den h\u00c3\u00a4r v\u00c3\u00a4rlden \u00c3\u00a4r inaktiverat. +mutedPlayer=Spelaren {0} \u00e4r tystad. +mutedPlayerFor=Spelaren {0} \u00e4r tystad i {1}. +mutedUserSpeaks={0} f\u00f6rs\u00f6kte att prata, men blev tystad. +nearbyPlayers=Spelare i n\u00e4rheten: {0} +negativeBalanceError=Anv\u00e4ndaren \u00e4r inte till\u00e5ten att ha en negativ balans. +nickChanged=Smeknamn \u00e4ndrat. +nickDisplayName=\u00a77Du m\u00e5ste aktivera change-displayname i Essentials-konfigurationen. +nickInUse=\u00a7cDet namnet anv\u00e4nds redan. +nickNamesAlpha=\u00a7cSmeknamn m\u00e5ste vara alfanumeriska. +nickNoMore=\u00a77Du har inte ett smeknamn l\u00e4ngre +nickOthersPermission=\u00a7cDu har inte tillst\u00e5nd att \u00e4ndra andras smeknamn +nickSet=\u00a77Ditt smeknamn \u00e4r nu \u00a7c{0} +noAccessCommand=\u00a7cDu har inte tillg\u00e5ng till det kommandot. +noAccessPermission=\u00a7cDu har inte tillst\u00e5nd till att komma \u00e5t det {0}. +noBreakBedrock=Du har inte till\u00e5telse att f\u00f6rst\u00f6ra berggrund. +noDestroyPermission=\u00a7Du har inte till\u00e5telse att f\u00f6rst\u00f6ra det {0}. +noDurability=\u00a7cDen saken har inte en h\u00e5llbarhet. +noGodWorldWarning=\u00a7cVarning! Od\u00f6dlighet i den h\u00e4r v\u00e4rlden \u00e4r inaktiverat. noHelpFound=\u00a7cInga matchande kommandon. noHomeSet=Du har inte angett ett hem. -noHomeSetPlayer=Den h\u00c3\u00a4r spelaren har inte ett hem. -noKitPermission=\u00a7cDu beh\u00c3\u00b6ver \u00a7c{0}\u00a7c tillst\u00c3\u00a5nd f\u00c3\u00b6r att anv\u00c3\u00a4nda det kitet. -noKits=\u00a77Det finns inga kits tillg\u00c3\u00a4ngliga \u00c3\u00a4n +noHomeSetPlayer=Den h\u00e4r spelaren har inte ett hem. +noKitPermission=\u00a7cDu beh\u00f6ver \u00a7c{0}\u00a7c tillst\u00e5nd f\u00f6r att anv\u00e4nda det kitet. +noKits=\u00a77Det finns inga kits tillg\u00e4ngliga \u00e4n noMail=Du har inget meddelande -noMotd=\u00a7cDet finns inget meddelande f\u00c3\u00b6r dagen. +noMotd=\u00a7cDet finns inget meddelande f\u00f6r dagen. noNewMail=\u00a77Du har inget nytt meddelande. -noPendingRequest=Du har inga v\u00c3\u00a4ntande f\u00c3\u00b6rfr\u00c3\u00a5gan. -noPerm=\u00a7cDu har inte \u00a7f{0}\u00a7c till\u00c3\u00a5telse. -noPermToSpawnMob=\u00a7cDu har inte till\u00c3\u00a5telse att spawna den h\u00c3\u00a4r moben. -noPlacePermission=\u00a7cDu har inte till\u00c3\u00a5telse att placera ett block n\u00c3\u00a4ra den skylten. +noPendingRequest=Du har inga v\u00e4ntande f\u00f6rfr\u00e5gan. +noPerm=\u00a7cDu har inte \u00a7f{0}\u00a7c till\u00e5telse. +noPermToSpawnMob=\u00a7cDu har inte till\u00e5telse att spawna den h\u00e4r moben. +noPlacePermission=\u00a7cDu har inte till\u00e5telse att placera ett block n\u00e4ra den skylten. noPowerTools=Du har inga power-tools tilldelade. -noRules=\u00a7cDet finns inga specifierade regler \u00c3\u00a4n. -noWarpsDefined=Inga warpar \u00c3\u00a4r definerade +noRules=\u00a7cDet finns inga specifierade regler \u00e4n. +noWarpsDefined=Inga warpar \u00e4r definerade none=inga -notAllowedToQuestion=\u00a7cDu har inte tillst\u00c3\u00a5nd att anv\u00c3\u00a4nda den fr\u00c3\u00a5gan. -notAllowedToShout=\u00a7cDu har inte tillst\u00c3\u00a5nd att ropa. +notAllowedToQuestion=\u00a7cDu har inte tillst\u00e5nd att anv\u00e4nda den fr\u00e5gan. +notAllowedToShout=\u00a7cDu har inte tillst\u00e5nd att ropa. notEnoughExperience=Du har inte nog med erfarenhet. -notEnoughMoney=Du har inte tillr\u00c3\u00a4ckligt med pengar. -notRecommendedBukkit= * ! * Bukkit-versionen \u00c3\u00a4r inte rekommenderad f\u00c3\u00b6r den h\u00c3\u00a4r versionen av Essentials. -notSupportedYet=St\u00c3\u00b6ds inte \u00c3\u00a4n. +notEnoughMoney=Du har inte tillr\u00e4ckligt med pengar. +notRecommendedBukkit= * ! * Bukkit-versionen \u00e4r inte rekommenderad f\u00f6r den h\u00e4r versionen av Essentials. +notSupportedYet=St\u00f6ds inte \u00e4n. nothingInHand = \u00a7cDu har inget i din hand. now=nu -nuke=L\u00c3\u00a5t d\u00c3\u00b6d regna \u00c3\u00b6ver dem -numberRequired=Det ska vara ett nummer d\u00c3\u00a4r, dumbom. -onlyDayNight=/time st\u00c3\u00b6der bara day(dag) eller night(natt). -onlyPlayers=Bara spelare som \u00c3\u00a4r online kan anv\u00c3\u00a4nda {0}. -onlySunStorm=/weather st\u00c3\u00b6der bara sun(sol) eller storm(storm). -orderBalances=Best\u00c3\u00a4ller balanser av {0} anv\u00c3\u00a4ndare, v\u00c3\u00a4nligen v\u00c3\u00a4nta... -pTimeCurrent=\u00a7e{0}'*s\u00a7f klockan \u00c3\u00a4r {1}. -pTimeCurrentFixed=\u00a7e{0}''s\u00a7f tiden \u00c3\u00a4r fixerad till {1}. -pTimeNormal=\u00a7e{0}''s\u00a7f tiden \u00c3\u00a4r normal och matchar servern. -pTimeOthersPermission=\u00a7cDu har inte beh\u00c3\u00b6righet att st\u00c3\u00a4lla in andra spelares tid. +nuke=L\u00e5t d\u00f6d regna \u00f6ver dem +numberRequired=Det ska vara ett nummer d\u00e4r, dumbom. +onlyDayNight=/time st\u00f6der bara day(dag) eller night(natt). +onlyPlayers=Bara spelare som \u00e4r online kan anv\u00e4nda {0}. +onlySunStorm=/weather st\u00f6der bara sun(sol) eller storm(storm). +orderBalances=Best\u00e4ller balanser av {0} anv\u00e4ndare, v\u00e4nligen v\u00e4nta... +pTimeCurrent=\u00a7e{0}'*s\u00a7f klockan \u00e4r {1}. +pTimeCurrentFixed=\u00a7e{0}''s\u00a7f tiden \u00e4r fixerad till {1}. +pTimeNormal=\u00a7e{0}''s\u00a7f tiden \u00e4r normal och matchar servern. +pTimeOthersPermission=\u00a7cDu har inte beh\u00f6righet att st\u00e4lla in andra spelares tid. pTimePlayers=Dessa spelare har sin egen tid: -pTimeReset=Spelarens tid har blivit \u00c3\u00a5terst\u00c3\u00a4lld till: \u00a7e{0} -pTimeSet=Spelarens tid \u00c3\u00a4r inst\u00c3\u00a4lld till \u00a73{0}\u00a7f till: \u00a7e{1} -pTimeSetFixed=Spelarens tid \u00c3\u00a4r fixerad till \u00a73{0}\u00a7f f\u00c3\u00b6r: \u00a7e{1} -parseError=Fel vid tolkning av {0} p\u00c3\u00a5 rad {1} -pendingTeleportCancelled=\u00a7cAvvaktande teleporteringsbeg\u00c3\u00a4ran \u00c3\u00a4r avbruten. +pTimeReset=Spelarens tid har blivit \u00e5terst\u00e4lld till: \u00a7e{0} +pTimeSet=Spelarens tid \u00e4r inst\u00e4lld till \u00a73{0}\u00a7f till: \u00a7e{1} +pTimeSetFixed=Spelarens tid \u00e4r fixerad till \u00a73{0}\u00a7f f\u00f6r: \u00a7e{1} +parseError=Fel vid tolkning av {0} p\u00e5 rad {1} +pendingTeleportCancelled=\u00a7cAvvaktande teleporteringsbeg\u00e4ran \u00e4r avbruten. permissionsError=Saknar Permissions/GroupManager; chattens prefixer/suffixer kommer vara inaktiverade. -playerBanned=\u00a7cSpelaren {0} bannad {1} f\u00c3\u00b6r {2} -playerInJail=\u00a7cSpelaren \u00c3\u00a4r redan i f\u00c3\u00a4ngelse {0}. -playerJailed=\u00a77Spelaren {0} f\u00c3\u00a4ngslad. -playerJailedFor= \u00a77Spelaren {0} f\u00c3\u00a4ngslad f\u00c3\u00b6r {1}. -playerKicked=\u00a7cSpelaren {0} har sparkat ut {1} f\u00c3\u00b6r {2} +playerBanned=\u00a7cSpelaren {0} bannad {1} f\u00f6r {2} +playerInJail=\u00a7cSpelaren \u00e4r redan i f\u00e4ngelse {0}. +playerJailed=\u00a77Spelaren {0} f\u00e4ngslad. +playerJailedFor= \u00a77Spelaren {0} f\u00e4ngslad f\u00f6r {1}. +playerKicked=\u00a7cSpelaren {0} har sparkat ut {1} f\u00f6r {2} playerMuted=\u00a77Du har blivit tystad -playerMutedFor=\u00a77Du har blivit tystad f\u00c3\u00b6r {0} -playerNeverOnServer=\u00a7cSpelaren {0} har aldrig varit p\u00c3\u00a5 den h\u00c3\u00a4r servern. +playerMutedFor=\u00a77Du har blivit tystad f\u00f6r {0} +playerNeverOnServer=\u00a7cSpelaren {0} har aldrig varit p\u00e5 den h\u00e4r servern. playerNotFound=\u00a7cSpelaren hittades inte. playerUnmuted=\u00a77Du kan nu prata pong=Pong! -possibleWorlds=\u00a77M\u00c3\u00b6jliga v\u00c3\u00a4rdar \u00c3\u00a4r nummer mellan 0 och {0}. +possibleWorlds=\u00a77M\u00f6jliga v\u00e4rdar \u00e4r nummer mellan 0 och {0}. powerToolAir=Kommandot kan inte tilldelas luft. -powerToolAlreadySet=Kommandot \u00a7c{0}\u00a7f \u00c3\u00a4r redan tilldelat {1}. +powerToolAlreadySet=Kommandot \u00a7c{0}\u00a7f \u00e4r redan tilldelat {1}. powerToolAttach=\u00a7c{0}\u00a7f kommandot tilldelat {1}. powerToolClearAll=Alla powertool-kommandon har blivit rensade. -powerToolList={1} har f\u00c3\u00b6ljane kommandon: \u00a7c{0}\u00a7f. +powerToolList={1} har f\u00f6ljane kommandon: \u00a7c{0}\u00a7f. powerToolListEmpty={0} har inga kommandon tilldelade. powerToolNoSuchCommandAssigned=Kommandot \u00a7c{0}\u00a7f har inte blivit tilldelat {1}. -powerToolRemove=Kommandot \u00a7c{0}\u00a7f \u00c3\u00a4r borttaget fr\u00c3\u00a5n {1}. -powerToolRemoveAll=Alla kommandon \u00c3\u00a4r borttagna fr\u00c3\u00a5n {0}. +powerToolRemove=Kommandot \u00a7c{0}\u00a7f \u00e4r borttaget fr\u00e5n {1}. +powerToolRemoveAll=Alla kommandon \u00e4r borttagna fr\u00e5n {0}. powerToolsDisabled=Alla dina powertools har blivit inaktiverade. powerToolsEnabled=Alla dina powertools har blivit aktiverade. -protectionOwner=\u00a76[EssentialsProtect] Skydds\u00c3\u00a4gare: {0} -questionFormat=\u00a77[Fr\u00c3\u00a5ga]\u00a7f {0} -readNextPage=Skriv /{0} {1} f\u00c3\u00b6r att l\u00c3\u00a4sa n\u00c3\u00a4sta sida +protectionOwner=\u00a76[EssentialsProtect] Skydds\u00e4gare: {0} +questionFormat=\u00a77[Fr\u00e5ga]\u00a7f {0} +readNextPage=Skriv /{0} {1} f\u00f6r att l\u00e4sa n\u00e4sta sida reloadAllPlugins=\u00a77Laddade om alla insticksprogram. removed=\u00a77Tog bort {0} enheter. repair=Du har reparerat din: \u00a7e{0}. -repairAlreadyFixed=\u00a77Den h\u00c3\u00a4r saken beh\u00c3\u00b6ver inte repareras. -repairEnchanted=\u00a77Du har inte beh\u00c3\u00b6righet att reparera f\u00c3\u00b6rtrollade saker. -repairInvalidType=\u00a7cDen h\u00c3\u00a4r saken kan inte bli reparerad. -repairNone=Det var inga saker som beh\u00c3\u00b6ver repareras. -requestAccepted=\u00a77Teleporterings-f\u00c3\u00b6rfr\u00c3\u00a5gan accepterad. -requestAcceptedFrom=\u00a77{0} accepterade din teleportations-f\u00c3\u00b6rfr\u00c3\u00a5gan. -requestDenied=\u00a77Teleportations-f\u00c3\u00b6rfr\u00c3\u00a5gan nekad. -requestDeniedFrom=\u00a77{0} nekade din teleportations-f\u00c3\u00b6rfr\u00c3\u00a5gan. -requestSent=\u00a77F\u00c3\u00b6rfr\u00c3\u00a5gan skickad till {0}\u00a77. -requestTimedOut=\u00a7cTeleportations-f\u00c3\u00b6rfr\u00c3\u00a5gan har g\u00c3\u00a5tt ut -requiredBukkit= * ! * Du beh\u00c3\u00b6ver minst bygge {0} av CraftBukkit, ladda ner den fr\u00c3\u00a5n http://dl.bukkit.org/downloads/craftbukkit/ -returnPlayerToJailError=Ett fel uppstod n\u00c3\u00a4r spelaren {0} skulle \u00c3\u00a5terv\u00c3\u00a4nda till f\u00c3\u00a4ngelset: {1} +repairAlreadyFixed=\u00a77Den h\u00e4r saken beh\u00f6ver inte repareras. +repairEnchanted=\u00a77Du har inte beh\u00f6righet att reparera f\u00f6rtrollade saker. +repairInvalidType=\u00a7cDen h\u00e4r saken kan inte bli reparerad. +repairNone=Det var inga saker som beh\u00f6ver repareras. +requestAccepted=\u00a77Teleporterings-f\u00f6rfr\u00e5gan accepterad. +requestAcceptedFrom=\u00a77{0} accepterade din teleportations-f\u00f6rfr\u00e5gan. +requestDenied=\u00a77Teleportations-f\u00f6rfr\u00e5gan nekad. +requestDeniedFrom=\u00a77{0} nekade din teleportations-f\u00f6rfr\u00e5gan. +requestSent=\u00a77F\u00f6rfr\u00e5gan skickad till {0}\u00a77. +requestTimedOut=\u00a7cTeleportations-f\u00f6rfr\u00e5gan har g\u00e5tt ut +requiredBukkit= * ! * Du beh\u00f6ver minst bygge {0} av CraftBukkit, ladda ner den fr\u00e5n http://dl.bukkit.org/downloads/craftbukkit/ +returnPlayerToJailError=Ett fel uppstod n\u00e4r spelaren {0} skulle \u00e5terv\u00e4nda till f\u00e4ngelset: {1} second=sekund seconds=sekunder -seenOffline=Spelaren {0} \u00c3\u00a4r offline sedan {1} -seenOnline=Spelaren {0} \u00c3\u00a4r online sedan {1} -serverFull=Servern \u00c3\u00a4r full -serverTotal=Totalt p\u00c3\u00a5 servern: {0} +seenOffline=Spelaren {0} \u00e4r offline sedan {1} +seenOnline=Spelaren {0} \u00e4r online sedan {1} +serverFull=Servern \u00e4r full +serverTotal=Totalt p\u00e5 servern: {0} setSpawner=Bytte typen av spawnare till {0} -sheepMalformedColor=Felformulerad f\u00c3\u00a4rg. +sheepMalformedColor=Felformulerad f\u00e4rg. shoutFormat=\u00a77[Hojtning]\u00a7f {0} signFormatFail=\u00a74[{0}] signFormatSuccess=\u00a71[{0}] signFormatTemplate=[{0}] -signProtectInvalidLocation=\u00a74Du har inte till\u00c3\u00a5telse att g\u00c3\u00b6ra skyltar h\u00c3\u00a4r. +signProtectInvalidLocation=\u00a74Du har inte till\u00e5telse att g\u00f6ra skyltar h\u00e4r. similarWarpExist=En warp med ett liknande namn finns redan. slimeMalformedSize=Felformulerad storlek. -soloMob=Det h\u00c3\u00a4r monstret gillar att vara ensam -spawnSet=\u00a77Spawnpunkten inst\u00c3\u00a4lld f\u00c3\u00b6r gruppen {0}. +soloMob=Det h\u00e4r monstret gillar att vara ensam +spawnSet=\u00a77Spawnpunkten inst\u00e4lld f\u00f6r gruppen {0}. spawned=spawnade -sudoExempt=Du kan inte g\u00c3\u00b6ra en sudo p\u00c3\u00a5 den h\u00c3\u00a4r anv\u00c3\u00a4ndaren +sudoExempt=Du kan inte g\u00f6ra en sudo p\u00e5 den h\u00e4r anv\u00e4ndaren sudoRun=Tvingar {0} att springa: /{1} {2} -suicideMessage=\u00a77Adj\u00c3\u00b6 grymma v\u00c3\u00a4rld... +suicideMessage=\u00a77Adj\u00f6 grymma v\u00e4rld... suicideSuccess= \u00a77{0} tog sitt eget liv -survival=\u00c3\u00b6verlevnad -takenFromAccount=\u00a7c{0} har tagits fr\u00c3\u00a5n ditt konto. -takenFromOthersAccount=\u00a7c{0} taget fr\u00c3\u00a5n {1}\u00a7c konto. Ny balans: {2} -teleportAAll=\u00a77Teleportations-f\u00c3\u00b6rfr\u00c3\u00a5gan skickad till alla spelare... +survival=\u00f6verlevnad +takenFromAccount=\u00a7c{0} har tagits fr\u00e5n ditt konto. +takenFromOthersAccount=\u00a7c{0} taget fr\u00e5n {1}\u00a7c konto. Ny balans: {2} +teleportAAll=\u00a77Teleportations-f\u00f6rfr\u00e5gan skickad till alla spelare... teleportAll=\u00a77Teleporterar alla spelare... teleportAtoB=\u00a77{0}\u00a77 teleporterade dig till {1}\u00a77. teleportDisabled={0} har teleportering inaktiverat. -teleportHereRequest=\u00a7c{0}\u00a7c har fr\u00c3\u00a5gat dig om du vill teleportera till dem. +teleportHereRequest=\u00a7c{0}\u00a7c har fr\u00e5gat dig om du vill teleportera till dem. teleportNewPlayerError=Messlyckades med att teleportera ny spelare -teleportRequest=\u00a7c{0}\u00a7c har beg\u00c3\u00a4rt att f\u00c3\u00a5 teleportera sig till dig. -teleportRequestTimeoutInfo=\u00a77Den h\u00c3\u00a4r beg\u00c3\u00a4ran kommer att g\u00c3\u00a5 ut efter {0} sekunder. +teleportRequest=\u00a7c{0}\u00a7c har beg\u00e4rt att f\u00e5 teleportera sig till dig. +teleportRequestTimeoutInfo=\u00a77Den h\u00e4r beg\u00e4ran kommer att g\u00e5 ut efter {0} sekunder. teleportTop=\u00a77Teleporterar till toppen. -teleportationCommencing=\u00a77Teleporteringen p\u00c3\u00a5b\u00c3\u00b6rjas... +teleportationCommencing=\u00a77Teleporteringen p\u00e5b\u00f6rjas... teleportationDisabled=\u00a77Teleportering inaktiverat. teleportationEnabled=\u00a77Teleportering aktiverat. teleporting=\u00a77Teleporterar... teleportingPortal=\u00a77Teleporterar via portal. -tempBanned=Tempor\u00c3\u00a4rt bannad fr\u00c3\u00a5n servern f\u00c3\u00b6r {0} -tempbanExempt=\u00a77Du kan inte tempor\u00c3\u00a4rt banna den spelaren -thunder= Du {0} \u00c3\u00a5ska i din v\u00c3\u00a4rld -thunderDuration=Du {0} i din v\u00c3\u00a4rld i {1} sekunder. -timeBeforeHeal=Tid f\u00c3\u00b6re n\u00c3\u00a4ste l\u00c3\u00a4kning: {0} -timeBeforeTeleport=Tid f\u00c3\u00b6re n\u00c3\u00a4sta teleportering: {0} +tempBanned=Tempor\u00e4rt bannad fr\u00e5n servern f\u00f6r {0} +tempbanExempt=\u00a77Du kan inte tempor\u00e4rt banna den spelaren +thunder= Du {0} \u00e5ska i din v\u00e4rld +thunderDuration=Du {0} i din v\u00e4rld i {1} sekunder. +timeBeforeHeal=Tid f\u00f6re n\u00e4ste l\u00e4kning: {0} +timeBeforeTeleport=Tid f\u00f6re n\u00e4sta teleportering: {0} timeFormat=\u00a73{0}\u00a7f eller \u00a73{1}\u00a7f eller \u00a73{2}\u00a7f timePattern=(?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)? -timeSet=Tid inst\u00c3\u00a4lld i alla v\u00c3\u00a4rldar. -timeSetPermission=\u00a7cDu har inte tillst\u00c3\u00a5nd att st\u00c3\u00a4lla in tiden. -timeWorldCurrent=Den nuvarande tiden i {0} \u00c3\u00a4r \u00a73{1} -timeWorldSet=Tiden \u00c3\u00a4r nu {0} i: \u00a7c{1} +timeSet=Tid inst\u00e4lld i alla v\u00e4rldar. +timeSetPermission=\u00a7cDu har inte tillst\u00e5nd att st\u00e4lla in tiden. +timeWorldCurrent=Den nuvarande tiden i {0} \u00e4r \u00a73{1} +timeWorldSet=Tiden \u00e4r nu {0} i: \u00a7c{1} tps=Nuvarande TPS = {0} -tradeCompleted=\u00a77K\u00c3\u00b6p avslutat. -tradeSignEmpty=K\u00c3\u00b6pskylten har inget tillg\u00c3\u00a4ngligt f\u00c3\u00b6r dig. -tradeSignEmptyOwner=Det finns inget att fr\u00c3\u00a5n den h\u00c3\u00a4r k\u00c3\u00b6pskylten. -treeFailure=\u00a7cTr\u00c3\u00a4dgenereringn misslyckades. Prova igen p\u00c3\u00a5 gr\u00c3\u00a4s eller jord. -treeSpawned=\u00a77Tr\u00c3\u00a4d genererat. +tradeCompleted=\u00a77K\u00f6p avslutat. +tradeSignEmpty=K\u00f6pskylten har inget tillg\u00e4ngligt f\u00f6r dig. +tradeSignEmptyOwner=Det finns inget att fr\u00e5n den h\u00e4r k\u00f6pskylten. +treeFailure=\u00a7cTr\u00e4dgenereringn misslyckades. Prova igen p\u00e5 gr\u00e4s eller jord. +treeSpawned=\u00a77Tr\u00e4d genererat. true=sant -typeTpaccept=\u00a77F\u00c3\u00b6r att teleportera, skriv \u00a7c/tpaccept\u00a77. -typeTpdeny=\u00a77F\u00c3\u00b6r att neka denna f\u00c3\u00b6rfr\u00c3\u00a5gan, skriv \u00a7c/tpdeny\u00a77. -typeWorldName=\u00a77Du kan ocks\u00c3\u00a5 skriva namnet av en specifik v\u00c3\u00a4rld. +typeTpaccept=\u00a77F\u00f6r att teleportera, skriv \u00a7c/tpaccept\u00a77. +typeTpdeny=\u00a77F\u00f6r att neka denna f\u00f6rfr\u00e5gan, skriv \u00a7c/tpdeny\u00a77. +typeWorldName=\u00a77Du kan ocks\u00e5 skriva namnet av en specifik v\u00e4rld. unableToSpawnMob=Kunde inte spawna moben. -unbannedIP=Tog bort bannlysningen fr\u00c3\u00a5n IP-adress. -unbannedPlayer=Tog bort bannlysningen fr\u00c3\u00a5n spelaren. -unignorePlayer=Du ignorerar inte spelaren {0} l\u00c3\u00a4ngre. -unknownItemId=Ok\u00c3\u00a4nt objekt-ID: {0} -unknownItemInList=Ok\u00c3\u00a4nt objekt {0} i listan {1}. -unknownItemName=Ok\u00c3\u00a4nt objektnamn: {0} -unlimitedItemPermission=\u00a7cInget tillst\u00c3\u00a5nd f\u00c3\u00b6r obegr\u00c3\u00a4nsad tillg\u00c3\u00a5ng av {0}. -unlimitedItems=Obegr\u00c3\u00a4nsade objekt: -unmutedPlayer=Spelaren {0} \u00c3\u00a4r inte bannlyst l\u00c3\u00a4ngre. -unvanished=\u00a7aDu \u00c3\u00a4r synlig igen. +unbannedIP=Tog bort bannlysningen fr\u00e5n IP-adress. +unbannedPlayer=Tog bort bannlysningen fr\u00e5n spelaren. +unignorePlayer=Du ignorerar inte spelaren {0} l\u00e4ngre. +unknownItemId=Ok\u00e4nt objekt-ID: {0} +unknownItemInList=Ok\u00e4nt objekt {0} i listan {1}. +unknownItemName=Ok\u00e4nt objektnamn: {0} +unlimitedItemPermission=\u00a7cInget tillst\u00e5nd f\u00f6r obegr\u00e4nsad tillg\u00e5ng av {0}. +unlimitedItems=Obegr\u00e4nsade objekt: +unmutedPlayer=Spelaren {0} \u00e4r inte bannlyst l\u00e4ngre. +unvanished=\u00a7aDu \u00e4r synlig igen. unvanishedReload=\u00a7cEn omladdning har tvingat dig att bli synlig. upgradingFilesError=Fel vid uppgradering av filerna -userDoesNotExist=Anv\u00c3\u00a4ndaren {0} existerar inte. -userIsAway={0} \u00c3\u00a4r nu AFK -userIsNotAway={0} \u00c3\u00a4r inte l\u00c3\u00a4ngre AFK -userJailed=\u00a77Du har blivit f\u00c3\u00a4ngslad -userUsedPortal={0} anv\u00c3\u00a4nde en existerande utg\u00c3\u00a5ngsportal. +userDoesNotExist=Anv\u00e4ndaren {0} existerar inte. +userIsAway={0} \u00e4r nu AFK +userIsNotAway={0} \u00e4r inte l\u00e4ngre AFK +userJailed=\u00a77Du har blivit f\u00e4ngslad +userUsedPortal={0} anv\u00e4nde en existerande utg\u00e5ngsportal. userdataMoveBackError=Kunde inte flytta userdata/{0}.tmp till userdata/{1} userdataMoveError=Kunde inte flytta userdata/{0} till userdata/{1}.tmp -usingTempFolderForTesting=Anv\u00c3\u00a4nder tempor\u00c3\u00a4r mapp mapp f\u00c3\u00b6r testning: -vanished=\u00a7aDu \u00c3\u00a4r nu osynlig. -versionMismatch=Versionerna matchar inte! V\u00c3\u00a4nligen uppgradera {0} till samma version. -versionMismatchAll=Versionerna matchar inte! V\u00c3\u00a4nligen uppgradera alla Essentials jars till samma version. -voiceSilenced=\u00a77Din r\u00c3\u00b6st har tystats +usingTempFolderForTesting=Anv\u00e4nder tempor\u00e4r mapp mapp f\u00f6r testning: +vanished=\u00a7aDu \u00e4r nu osynlig. +versionMismatch=Versionerna matchar inte! V\u00e4nligen uppgradera {0} till samma version. +versionMismatchAll=Versionerna matchar inte! V\u00e4nligen uppgradera alla Essentials jars till samma version. +voiceSilenced=\u00a77Din r\u00f6st har tystats warpDeleteError=Problem med att ta bort warp-filen. -warpListPermission=\u00a7cDu har inte tillst\u00c3\u00a5nd att lista warparna. +warpListPermission=\u00a7cDu har inte tillst\u00e5nd att lista warparna. warpNotExist=Den warpen finns inte. -warpOverwrite=\u00a7cDu kan inte skriva \u00c3\u00b6ver den warpen. -warpSet=\u00a77Warpen {0} inst\u00c3\u00a4lld. -warpUsePermission=\u00a7cDU har inte tillst\u00c3\u00a5nd att anv\u00c3\u00a4nda den warpen. +warpOverwrite=\u00a7cDu kan inte skriva \u00f6ver den warpen. +warpSet=\u00a77Warpen {0} inst\u00e4lld. +warpUsePermission=\u00a7cDU har inte tillst\u00e5nd att anv\u00e4nda den warpen. warpingTo=\u00a77Warpar till {0}. warps=Warpar: {0} warpsCount=\u00a77Det finns {0} warpar. Visar sida {1} av {2}. -weatherStorm=\u00a77Du har st\u00c3\u00a4llt in v\u00c3\u00a4dret till storm i {0} -weatherStormFor=\u00a77Du har st\u00c3\u00a4llt in v\u00c3\u00a4dret till storm i {0} f\u00c3\u00b6r {1} sekunder -weatherSun=\u00a77Du har st\u00c3\u00a4llt in v\u00c3\u00a4dret till sol i {0} -weatherSunFor=\u00a77Du har st\u00c3\u00a4llt in v\u00c3\u00a4dret till sol i {0} f\u00c3\u00b6r {1} sekunder +weatherStorm=\u00a77Du har st\u00e4llt in v\u00e4dret till storm i {0} +weatherStormFor=\u00a77Du har st\u00e4llt in v\u00e4dret till storm i {0} f\u00f6r {1} sekunder +weatherSun=\u00a77Du har st\u00e4llt in v\u00e4dret till sol i {0} +weatherSunFor=\u00a77Du har st\u00e4llt in v\u00e4dret till sol i {0} f\u00f6r {1} sekunder whoisBanned=\u00a79 - Bannade spelare: {0} -whoisExp=\u00a79 - Erfarenhet: {0} (Niv\u00c3\u00a5 {1}) -whoisGamemode=\u00a79 - Spell\u00c3\u00a4ge: {0} +whoisExp=\u00a79 - Erfarenhet: {0} (Niv\u00e5 {1}) +whoisGamemode=\u00a79 - Spell\u00e4ge: {0} whoisGeoLocation=\u00a79 - Plats: {0} -whoisGod=\u00a79 - Od\u00c3\u00b6dlighet: {0} -whoisHealth=\u00a79 - H\u00c3\u00a4lsa: {0}/20 +whoisGod=\u00a79 - Od\u00f6dlighet: {0} +whoisHealth=\u00a79 - H\u00e4lsa: {0}/20 whoisIPAddress=\u00a79 - IP-Adress: {0} -whoisIs={0} \u00c3\u00a4r {1} -whoisJail=\u00a79 - F\u00c3\u00a4ngelse: {0} +whoisIs={0} \u00e4r {1} +whoisJail=\u00a79 - F\u00e4ngelse: {0} whoisLocation=\u00a79 - Plats: ({0}, {1}, {2}, {3}) whoisMoney=\u00a79 - Pengar: {0} -whoisOP=\u00a79 - Operat\u00c3\u00b6rer: {0} -whoisStatusAvailable=\u00a79 - Status: Tillg\u00c3\u00a4nglig +whoisOP=\u00a79 - Operat\u00f6rer: {0} +whoisStatusAvailable=\u00a79 - Status: Tillg\u00e4nglig whoisStatusAway=\u00a79 - Status: \u00a7cBorta\u00a7f -worth=\u00a77Stapeln med {0} ({2} objekt) \u00c3\u00a4r v\u00c3\u00a4rd \u00a7c{1}\u00a77 ({3} styck) -worthMeta=\u00a77Stapeln med {0} av typ {1} ({3} objekt) \u00c3\u00a4r v\u00c3\u00a4rd \u00a7c{2}\u00a77 ({4} styck) -worthSet=V\u00c3\u00a4rdet inst\u00c3\u00a4llt -year=\u00c3\u00a5r -years=\u00c3\u00a5r -youAreHealed=\u00a77Du har blivit l\u00c3\u00a4kt. -youHaveNewMail=\u00a7cDu har {0} meddelanden!\u00a7f Skriv \u00a77/mail read\u00a7f f\u00c3\u00b6r att l\u00c3\u00a4sa dina meddelanden.
\ No newline at end of file +worth=\u00a77Stapeln med {0} ({2} objekt) \u00e4r v\u00e4rd \u00a7c{1}\u00a77 ({3} styck) +worthMeta=\u00a77Stapeln med {0} av typ {1} ({3} objekt) \u00e4r v\u00e4rd \u00a7c{2}\u00a77 ({4} styck) +worthSet=V\u00e4rdet inst\u00e4llt +year=\u00e5r +years=\u00e5r +youAreHealed=\u00a77Du har blivit l\u00e4kt. +youHaveNewMail=\u00a7cDu har {0} meddelanden!\u00a7f Skriv \u00a77/mail read\u00a7f f\u00f6r att l\u00e4sa dina meddelanden.
\ No newline at end of file diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index 98af00ea3..1ef0a0aee 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -118,7 +118,7 @@ commands: gamemode: description: Change player gamemode. usage: /<command> <survival|creative|adventure> [player] - aliases: [gm,creative,creativemode,egamemode,ecreative,ecreativemode,egm] + aliases: [gm,creative,creativemode,survival,survivalmode,adventure,adventuremode,gmc,gma,gms,egamemod,eecreative,ecreativemode,esurvival,esurvivalmode,eadventure,eadventuremode,egmc,egma,egms,egm] getpos: description: Get your current coordinates or those of a player. usage: /<command> [player] @@ -423,7 +423,7 @@ commands: usage: /<command> <pagenumber|warp> [player] aliases: [ewarp,warps,ewarps] weather: - description: Setting the weather. + description: Sets the weather. usage: /<command> <storm/sun> [duration] aliases: [sky,sun,storm,eweather,rain,erain,esky,esun,estorm] whois: diff --git a/Essentials/src/worth.yml b/Essentials/src/worth.yml index d0e9281b3..600795d41 100644 --- a/Essentials/src/worth.yml +++ b/Essentials/src/worth.yml @@ -1,199 +1,167 @@ worth: - stonebutton: - '0': 7.0 - wood: 1.0 - arrow: 10.0 - diamondpickaxe: 1000.0 - rawfish: 5.0 - minecart: 20.0 - leatherchestplate: 40.0 - storageminecart: 35.0 - leaves: - '0': 0.0 - feather: 3.0 - goldchestplate: 600.0 - mushroomsoup: 30.0 - bread: 20.0 - stationarywater: - '0': 1.0 - workbench: 20.0 - stonehoe: 40.0 - brownmushroom: 2.0 - wool: - '0': 8.0 - mossycobblestone: 90.0 - diamondhoe: 600.0 - woodsword: 10.0 - torch: - '0': 1.0 - grass: 1.0 - poweredminecart: 30.0 - snowball: 1.0 - goldenapple: 500.0 - leatherleggings: 20.0 - log: - '0': 2.0 - diamondaxe: 1000.0 - slimeball: 50.0 - fence: 10.0 - stonespade: 40.0 - claybrick: 10.0 - noteblock: 40.0 - ironaxe: 60.0 - coalore: 15.0 - clayball: 8.0 - fishingrod: 25.0 - ironhoe: 60.0 - goldrecord: 950.0 - ironpickaxe: 80.0 - irondoor: 35.0 - bucket: 10.0 - redrose: 2.0 - grilledpork: 6.0 - gravel: 1.0 - wooddoor: 30.0 - chainmailhelmet: 40.0 - ironchestplate: 300.0 - diamondblock: 1500.0 - diamondhelmet: 1500.0 - goldhelmet: 300.0 - redstonetorchon: - '0': 10.0 - ironspade: 40.0 - furnace: - '0': 10.0 - ironsword: 60.0 - dispenser: - '0': 9.0 - woodaxe: 10.0 - seeds: 5.0 - painting: 50.0 - woodplate: - '0': 10.0 - redstoneore: 30.0 - diamondspade: 350.0 - waterbucket: 10.0 - water: - '0': 1.0 - bedrock: 1000.0 - irondoorblock: - '0': 15.0 - goldhoe: 200.0 - sand: 1.0 - goldsword: 200.0 - stoneaxe: 40.0 - bookshelf: 20.0 - ironblock: 160.0 - jackolantern: - '0': 60.0 - boat: 5.0 - diamondchestplate: 3000.0 - redstonewire: - '0': 7.0 - redmushroom: 2.0 - string: 5.0 - stoneplate: - '0': 10.0 - wallsign: - '0': 1.0 - cactus: - '0': 10.0 - sulphur: 19.0 - rails: - '0': 40.0 - ironore: 18.0 - leatherhelmet: 20.0 - stone: 2.0 - egg: 1.0 - diamondore: 200.0 - woodhoe: 10.0 - goldleggings: 400.0 - chainmailleggings: 50.0 - yellowflower: 2.0 - ironhelmet: 120.0 - obsidian: 130.0 - dirt: 1.0 - leather: 10.0 - leatherboots: 17.0 - lever: - '0': 7.0 - cobblestone: 1.0 - cake: 100.0 - woodstairs: - '0': 8.0 - ironingot: 20.0 - goldore: 45.0 - pumpkin: - '0': 50.0 - bed: 25.0 - watch: 100.0 - ironleggings: 250.0 - sign: 10.0 - doublestep: - '0': 3.0 - woodpickaxe: 10.0 - stonepickaxe: 40.0 - chainmailboots: 30.0 - diamondleggings: 2200.0 - cookedfish: 20.0 - saddle: 100.0 - cobblestonestairs: - '0': 22.0 - tnt: 10000.0 - glowingredstoneore: 30.0 - apple: 10.0 - woodspade: 10.0 - goldingot: 50.0 - diode: 10.0 - soil: - '0': 3.0 - clay: 3.0 - goldblock: 400.0 - stick: 1.0 - paper: 30.0 - brick: 40.0 - stationarylava: - '0': 1.0 - chest: 15.0 - sandstone: 5.0 - goldpickaxe: 300.0 - compass: 50.0 - sugarcane: 10.0 - diamondsword: 700.0 - goldboots: 250.0 - sponge: 80.0 - stonesword: 40.0 - coal: - '0': 3.0 - goldaxe: 300.0 - bone: 10.0 - diamond: 230.0 - glass: 10.0 - goldspade: 220.0 - lapisblock: 500.0 - lavabucket: 30.0 - wheat: 9.0 - ladder: - '0': 10.0 - sugarcaneblock: - '0': 15.0 - bowl: 6.0 - chainmailchestplate: 40.0 - sapling: - '0': 2.0 - diamondboots: 1500.0 - lapisore: 100.0 - lava: - '0': 1.0 - milkbucket: 15.0 - redstone: 1.0 - greenrecord: 1000.0 - inksack: - '0': 10.0 - glowstonedust: 11.0 - book: 35.0 - bow: 75.0 - ironboots: 50.0 - step: - '0': 3.0 - sugar: 5.0 + stonebutton: 6.0 + wood: 0.50 + arrow: 3.50 + diamondpickaxe: 650.0 + rawfish: 5.0 + minecart: 23.0 + leatherchestplate: 85.0 + storageminecart: 30.0 + leaves: 1.0 + feather: 3.0 + goldchestplate: 6.5 + mushroomsoup: 4.5 + bread: 30.0 + stationarywater: 1.0 + workbench: 2.5 + stonehoe: 2.5 + brownmushroom: 2.0 + wool: 20.0 + mossycobblestone: 90.0 + diamondhoe: 400.0 + woodsword: 1.0 + torch: 4.0 + grass: 1.0 + poweredminecart: 32.0 + snowball: 1.0 + goldenapple: 100.0 + leatherleggings: 75.0 + log: 2.0 + diamondaxe: 650.0 + slimeball: 50.0 + fence: 1.0 + stonespade: 1.5 + claybrick: 5.0 + noteblock: 36.0 + ironaxe: 22.0 + coalore: 15.0 + clayball: 3.0 + fishingrod: 10.0 + ironhoe: 22.0 + goldrecord: 100.0 + ironpickaxe: 22.0 + irondoor: 22.0 + bucket: 22.0 + redrose: 2.0 + grilledpork: 7.0 + gravel: 1.0 + wooddoor: 3.0 + chainmailhelmet: 40.0 + ironchestplate: 22.0 + diamondblock: 2000.0 + diamondhelmet: 1000.0 + goldhelmet: 6.0 + redstonetorchon: 32.0 + ironspade: 22.0 + furnace: 8.5 + ironsword: 22.0 + dispenser: 58.0 + woodaxe: 2.0 + seeds: 2.0 + painting: 25.0 + woodplate: 1.0 + redstoneore: 30.0 + diamondspade: 210.0 + waterbucket: 40.0 + water: 1.0 + bedrock: 100.0 + irondoorblock: 15.0 + goldhoe: 6.0 + sand: 1.0 + goldsword: 6.0 + stoneaxe: 3.0 + bookshelf: 140.0 + ironblock: 190.0 + jackolantern: 56.0 + boat: 3.0 + diamondchestplate: 1750.0 + redstonewire: 30.0 + redmushroom: 2.0 + string: 5.0 + stoneplate: 6.0 + wallsign: 1.0 + cactus: 10.0 + sulphur: 20.0 + rails: 22.0 + ironore: 18.0 + leatherhelmet: 52.0 + stone: 3.00 + egg: 1.0 + diamondore: 200.0 + woodhoe: 2.0 + goldleggings: 6.0 + chainmailleggings: 50.0 + yellowflower: 2.0 + ironhelmet: 22.0 + obsidian: 130.0 + dirt: 1.0 + leather: 10.0 + leatherboots: 42.0 + lever: 1.0 + cobblestone: 1.0 + cake: 180.0 + woodstairs: 1.0 + ironingot: 22.0 + goldore: 45.0 + pumpkin: 50.0 + bed: 68.0 + watch: 6.0 + ironleggings: 22.0 + sign: 1.5 + doublestep: 1.0 + woodpickaxe: 2.0 + stonepickaxe: 4.0 + chainmailboots: 30.0 + diamondleggings: 1500.0 + cookedfish: 7.0 + saddle: 100.0 + cobblestonestairs: 1.5 + tnt: 100.0 + glowingredstoneore: 30.0 + apple: 10.0 + woodspade: 1.0 + goldingot: 105.0 + diode: 110.0 + soil: 1.0 + clay: 12.0 + goldblock: 450.0 + stick: 0.25 + paper: 10.0 + brick: 21.0 + stationarylava: 1.0 + chest: 4.0 + sandstone: 3.0 + goldpickaxe: 6.0 + compass: 22.0 + sugarcane: 10.0 + diamondsword: 420.0 + goldboots: 6.0 + sponge: 80.0 + stonesword: 2.5 + coal: 15.0 + goldaxe: 6.0 + bone: 2.0 + diamond: 200.0 + glass: 3.00 + goldspade: 6.0 + lapisblock: 950.0 + lavabucket: 40.0 + wheat: 9.0 + ladder: 0.5 + sugarcaneblock: 15.0 + bowl: 0.50 + chainmailchestplate: 40.0 + sapling: 2.0 + diamondboots: 850.0 + lapisore: 100.0 + lava: 25.0 + milkbucket: 40.0 + redstone: 32.0 + greenrecord: 100.0 + inksack: 10.0 + glowstonedust: 10.0 + book: 45.0 + bow: 15.0 + ironboots: 22.0 + step: 1.5 + sugar: 10.0 diff --git a/Essentials/test/com/earth2me/essentials/StorageTest.java b/Essentials/test/com/earth2me/essentials/StorageTest.java index b7fe23433..d4ea07f46 100644 --- a/Essentials/test/com/earth2me/essentials/StorageTest.java +++ b/Essentials/test/com/earth2me/essentials/StorageTest.java @@ -1,10 +1,5 @@ package com.earth2me.essentials; -import com.earth2me.essentials.settings.Settings; -import com.earth2me.essentials.storage.ObjectLoadException; -import com.earth2me.essentials.storage.StorageObject; -import com.earth2me.essentials.storage.YamlStorageReader; -import com.earth2me.essentials.storage.YamlStorageWriter; import java.io.*; import junit.framework.TestCase; import org.bukkit.Location; @@ -40,100 +35,6 @@ public class StorageTest extends TestCase } @Test - public void testSettings() - { - try - { - assertTrue(StorageObject.class.isAssignableFrom(Settings.class)); - ExecuteTimer ext = new ExecuteTimer(); - ext.start(); - final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]); - final Reader reader = new InputStreamReader(bais); - final Settings settings = new YamlStorageReader(reader, null).load(Settings.class); - ext.mark("load empty settings"); - final ByteArrayInputStream bais3 = new ByteArrayInputStream(new byte[0]); - final Reader reader3 = new InputStreamReader(bais3); - final Settings settings3 = new YamlStorageReader(reader3, null).load(Settings.class); - ext.mark("load empty settings (class cached)"); - final ByteArrayOutputStream baos = new ByteArrayOutputStream(); - final PrintWriter writer = new PrintWriter(baos); - new YamlStorageWriter(writer).save(settings); - writer.close(); - ext.mark("write settings"); - byte[] written = baos.toByteArray(); - System.out.println(new String(written)); - final ByteArrayInputStream bais2 = new ByteArrayInputStream(written); - final Reader reader2 = new InputStreamReader(bais2); - final Settings settings2 = new YamlStorageReader(reader2, null).load(Settings.class); - System.out.println(settings.toString()); - System.out.println(settings2.toString()); - ext.mark("reload settings"); - System.out.println(ext.end()); - //assertEquals("Default and rewritten config should be equal", settings, settings2); - //that assertion fails, because empty list and maps return as null - } - catch (ObjectLoadException ex) - { - fail(ex.getMessage()); - } - } - - @Test - public void testUserdata() - { - try - { - FakeServer server = new FakeServer(); - World world = server.createWorld("testWorld", Environment.NORMAL); - ExecuteTimer ext = new ExecuteTimer(); - ext.start(); - final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]); - final Reader reader = new InputStreamReader(bais); - final com.earth2me.essentials.user.UserData userdata = new YamlStorageReader(reader, null).load(com.earth2me.essentials.user.UserData.class); - ext.mark("load empty user"); - final ByteArrayInputStream bais3 = new ByteArrayInputStream(new byte[0]); - final Reader reader3 = new InputStreamReader(bais3); - final com.earth2me.essentials.user.UserData userdata3 = new YamlStorageReader(reader3, null).load(com.earth2me.essentials.user.UserData.class); - ext.mark("load empty user (class cached)"); - - for (int j = 0; j < 10000; j++) - { - userdata.getHomes().put("home", new Location(world, j, j, j)); - } - ext.mark("change home 10000 times"); - final ByteArrayOutputStream baos = new ByteArrayOutputStream(); - final PrintWriter writer = new PrintWriter(baos); - new YamlStorageWriter(writer).save(userdata); - writer.close(); - ext.mark("write user"); - final ByteArrayOutputStream baos2 = new ByteArrayOutputStream(); - final PrintWriter writer2 = new PrintWriter(baos2); - new YamlStorageWriter(writer2).save(userdata); - writer2.close(); - ext.mark("write user (cached)"); - byte[] written = baos.toByteArray(); - System.out.println(new String(written)); - ext.mark("debug output"); - final ByteArrayInputStream bais2 = new ByteArrayInputStream(written); - final Reader reader2 = new InputStreamReader(bais2); - final com.earth2me.essentials.user.UserData userdata2 = new YamlStorageReader(reader2, null).load(com.earth2me.essentials.user.UserData.class); - ext.mark("reload file"); - final ByteArrayInputStream bais4 = new ByteArrayInputStream(written); - final Reader reader4 = new InputStreamReader(bais4); - final com.earth2me.essentials.user.UserData userdata4 = new YamlStorageReader(reader4, null).load(com.earth2me.essentials.user.UserData.class); - ext.mark("reload file (cached)"); - System.out.println(userdata.toString()); - System.out.println(userdata2.toString()); - System.out.println(ext.end()); - } - catch (ObjectLoadException ex) - { - fail(ex.getMessage()); - } - - } - - @Test public void testOldUserdata() { ExecuteTimer ext = new ExecuteTimer(); diff --git a/EssentialsUpdate/build.xml b/EssentialsAntiBuild/build.xml index dedb62afa..8cae8a7c1 100644 --- a/EssentialsUpdate/build.xml +++ b/EssentialsAntiBuild/build.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE project [ <!ENTITY buildinc SYSTEM "../build.inc.xml"> ]> <!-- 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.) --> @@ -7,9 +8,9 @@ <!-- 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="EssentialsUpdate" default="default" basedir="."> - <description>Builds, tests, and runs the project EssentialsUpdate.</description> - <import file="nbproject/build-impl.xml"/> +<project name="EssentialsAntiBuild" default="default" basedir="."> + <description>Builds, tests, and runs the project EssentialsAntiBuild.</description> + <import file="nbproject/build-impl.xml"/> <!-- There exist several targets which are by default empty and which can be @@ -59,7 +60,7 @@ An example of overriding the target for project execution could look like this: - <target name="run" depends="EssentialsUpdate-impl.jar"> + <target name="run" depends="EssentialsProtect-impl.jar"> <exec dir="bin" executable="launcher.exe"> <arg file="${dist.jar}"/> </exec> @@ -71,4 +72,12 @@ nbproject/build-impl.xml file. --> + <target name="-post-jar"> + <jar jarfile="${dist.dir}/EssentialsAntiBuild.jar"> + <zipfileset src="${dist.jar}" excludes="META-INF/*" /> + <manifest> + <attribute name="Classpath" value="EssentialsAntiBuild.jar"/> + </manifest> + </jar> + </target> </project> diff --git a/EssentialsUpdate/nbproject/build-impl.xml b/EssentialsAntiBuild/nbproject/build-impl.xml index 25ef36b98..fd7175255 100644 --- a/EssentialsUpdate/nbproject/build-impl.xml +++ b/EssentialsAntiBuild/nbproject/build-impl.xml @@ -12,14 +12,14 @@ is divided into following sections: - execution - debugging - javadoc - - test compilation - - test execution - - test debugging + - junit compilation + - junit execution + - junit debugging - applet - cleanup --> -<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="EssentialsUpdate-impl"> +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="EssentialsAntiBuild-impl"> <fail message="Please build using Ant 1.8.0 or higher."> <condition> <not> @@ -181,7 +181,6 @@ is divided into following sections: </and> </condition> <property name="run.jvmargs" value=""/> - <property name="run.jvmargs.ide" value=""/> <property name="javac.compilerargs" value=""/> <property name="work.dir" value="${basedir}"/> <condition property="no.deps"> @@ -226,27 +225,6 @@ is divided into following sections: <property name="jar.index.metainf" value="${jar.index}"/> <property name="copylibs.rebase" value="true"/> <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/> - <condition property="junit.available"> - <or> - <available classname="org.junit.Test" classpath="${run.test.classpath}"/> - <available classname="junit.framework.Test" classpath="${run.test.classpath}"/> - </or> - </condition> - <condition property="testng.available"> - <available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/> - </condition> - <condition property="junit+testng.available"> - <and> - <istrue value="${junit.available}"/> - <istrue value="${testng.available}"/> - </and> - </condition> - <condition else="testng" property="testng.mode" value="mixed"> - <istrue value="${junit+testng.available}"/> - </condition> - <condition else="" property="testng.debug.mode" value="-mixed"> - <istrue value="${junit+testng.available}"/> - </condition> </target> <target name="-post-init"> <!-- Empty placeholder for easier customization. --> @@ -379,193 +357,11 @@ is divided into following sections: </sequential> </macrodef> </target> - <target if="${junit.available}" name="-init-macrodef-junit-init"> - <condition else="false" property="nb.junit.batch" value="true"> - <and> - <istrue value="${junit.available}"/> - <not> - <isset property="test.method"/> - </not> - </and> - </condition> - <condition else="false" property="nb.junit.single" value="true"> - <and> - <istrue value="${junit.available}"/> - <isset property="test.method"/> - </and> - </condition> - </target> - <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}"> - <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <element name="customize" optional="true"/> - <sequential> - <property name="junit.forkmode" value="perTest"/> - <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> - <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> - <syspropertyset> - <propertyref prefix="test-sys-prop."/> - <mapper from="test-sys-prop.*" to="*" type="glob"/> - </syspropertyset> - <formatter type="brief" usefile="false"/> - <formatter type="xml"/> - <jvmarg value="-ea"/> - <customize/> - </junit> - </sequential> - </macrodef> - </target> - <target if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}"> + <target name="-init-macrodef-junit"> <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> <attribute default="${includes}" name="includes"/> <attribute default="${excludes}" name="excludes"/> <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <element name="customize" optional="true"/> - <sequential> - <property name="junit.forkmode" value="perTest"/> - <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> - <batchtest todir="${build.test.results.dir}"> - <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> - <filename name="@{testincludes}"/> - </fileset> - </batchtest> - <syspropertyset> - <propertyref prefix="test-sys-prop."/> - <mapper from="test-sys-prop.*" to="*" type="glob"/> - </syspropertyset> - <formatter type="brief" usefile="false"/> - <formatter type="xml"/> - <jvmarg value="-ea"/> - <customize/> - </junit> - </sequential> - </macrodef> - </target> - <target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/> - <target if="${testng.available}" name="-init-macrodef-testng"> - <macrodef name="testng" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <element name="customize" optional="true"/> - <sequential> - <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}"> - <isset property="test.method"/> - </condition> - <union id="test.set"> - <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}"> - <filename name="@{testincludes}"/> - </fileset> - </union> - <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/> - <testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="EssentialsUpdate" testname="TestNG tests" workingDir="${work.dir}"> - <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> - <propertyset> - <propertyref prefix="test-sys-prop."/> - <mapper from="test-sys-prop.*" to="*" type="glob"/> - </propertyset> - <customize/> - </testng> - </sequential> - </macrodef> - </target> - <target name="-init-macrodef-test-impl"> - <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <element implicit="true" name="customize" optional="true"/> - <sequential> - <echo>No tests executed.</echo> - </sequential> - </macrodef> - </target> - <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl"> - <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <element implicit="true" name="customize" optional="true"/> - <sequential> - <j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> - <customize/> - </j2seproject3:junit> - </sequential> - </macrodef> - </target> - <target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl"> - <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <element implicit="true" name="customize" optional="true"/> - <sequential> - <j2seproject3:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> - <customize/> - </j2seproject3:testng> - </sequential> - </macrodef> - </target> - <target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test"> - <macrodef name="test" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <sequential> - <j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> - <customize> - <classpath> - <path path="${run.test.classpath}"/> - </classpath> - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> - <jvmarg line="${run.jvmargs}"/> - <jvmarg line="${run.jvmargs.ide}"/> - </customize> - </j2seproject3:test-impl> - </sequential> - </macrodef> - </target> - <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}"> - <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <element name="customize" optional="true"/> - <sequential> - <property name="junit.forkmode" value="perTest"/> - <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> - <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> - <syspropertyset> - <propertyref prefix="test-sys-prop."/> - <mapper from="test-sys-prop.*" to="*" type="glob"/> - </syspropertyset> - <formatter type="brief" usefile="false"/> - <formatter type="xml"/> - <jvmarg value="-ea"/> - <jvmarg line="${debug-args-line}"/> - <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> - <customize/> - </junit> - </sequential> - </macrodef> - </target> - <target if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch"> - <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <element name="customize" optional="true"/> <sequential> <property name="junit.forkmode" value="perTest"/> <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> @@ -574,129 +370,32 @@ is divided into following sections: <filename name="@{testincludes}"/> </fileset> </batchtest> + <classpath> + <path path="${run.test.classpath}"/> + </classpath> <syspropertyset> <propertyref prefix="test-sys-prop."/> <mapper from="test-sys-prop.*" to="*" type="glob"/> </syspropertyset> <formatter type="brief" usefile="false"/> <formatter type="xml"/> + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> <jvmarg value="-ea"/> - <jvmarg line="${debug-args-line}"/> - <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> - <customize/> + <jvmarg line="${run.jvmargs}"/> </junit> </sequential> </macrodef> </target> - <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl"> - <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <element implicit="true" name="customize" optional="true"/> - <sequential> - <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> - <customize/> - </j2seproject3:junit-debug> - </sequential> - </macrodef> - </target> - <target if="${testng.available}" name="-init-macrodef-testng-debug"> - <macrodef name="testng-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${main.class}" name="testClass"/> - <attribute default="" name="testMethod"/> - <element name="customize2" optional="true"/> - <sequential> - <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}"> - <isset property="test.method"/> - </condition> - <condition else="-suitename EssentialsUpdate -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}"> - <matches pattern=".*\.xml" string="@{testClass}"/> - </condition> - <delete dir="${build.test.results.dir}" quiet="true"/> - <mkdir dir="${build.test.results.dir}"/> - <j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}"> - <customize> - <customize2/> - <jvmarg value="-ea"/> - <arg line="${testng.debug.mode}"/> - <arg line="-d ${build.test.results.dir}"/> - <arg line="-listener org.testng.reporters.VerboseReporter"/> - <arg line="${testng.cmd.args}"/> - </customize> - </j2seproject3:debug> - </sequential> - </macrodef> - </target> - <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl"> - <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${main.class}" name="testClass"/> - <attribute default="" name="testMethod"/> - <element implicit="true" name="customize2" optional="true"/> - <sequential> - <j2seproject3:testng-debug testClass="@{testClass}" testMethod="@{testMethod}"> - <customize2/> - </j2seproject3:testng-debug> - </sequential> - </macrodef> - </target> - <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit"> - <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <attribute default="${main.class}" name="testClass"/> - <attribute default="" name="testMethod"/> - <sequential> - <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> - <customize> - <classpath> - <path path="${run.test.classpath}"/> - </classpath> - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> - <jvmarg line="${run.jvmargs}"/> - <jvmarg line="${run.jvmargs.ide}"/> - </customize> - </j2seproject3:test-debug-impl> - </sequential> - </macrodef> - </target> - <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng"> - <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <attribute default="" name="testmethods"/> - <attribute default="${main.class}" name="testClass"/> - <attribute default="" name="testMethod"/> - <sequential> - <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}"> - <customize2> - <syspropertyset> - <propertyref prefix="test-sys-prop."/> - <mapper from="test-sys-prop.*" to="*" type="glob"/> - </syspropertyset> - </customize2> - </j2seproject3:testng-debug-impl> - </sequential> - </macrodef> - </target> - <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/> - <!-- - pre NB7.2 profiling section; consider it deprecated - --> - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/> - <target if="profiler.info.jvmargs.agent" name="-profile-pre-init"> + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/> + <target name="-profile-pre-init"> <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> - <target if="profiler.info.jvmargs.agent" name="-profile-post-init"> + <target name="-profile-post-init"> <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> - <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile"> + <target name="-profile-init-macrodef-profile"> <macrodef name="resolve"> <attribute name="name"/> <attribute name="value"/> @@ -728,13 +427,10 @@ is divided into following sections: </sequential> </macrodef> </target> - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check"> + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check"> <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail> <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail> </target> - <!-- - end of pre NB7.2 profiling section - --> <target depends="-init-debug-args" name="-init-macrodef-nbjpda"> <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1"> <attribute default="${main.class}" name="name"/> @@ -792,7 +488,6 @@ is divided into following sections: <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> <jvmarg line="${run.jvmargs}"/> - <jvmarg line="${run.jvmargs.ide}"/> <classpath> <path path="@{classpath}"/> </classpath> @@ -809,7 +504,6 @@ is divided into following sections: <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1"> <attribute default="${main.class}" name="classname"/> <attribute default="${run.classpath}" name="classpath"/> - <attribute default="jvm" name="jvm"/> <element name="customize" optional="true"/> <sequential> <java classname="@{classname}" dir="${work.dir}" fork="true"> @@ -817,7 +511,6 @@ is divided into following sections: <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> <jvmarg line="${run.jvmargs}"/> - <jvmarg line="${run.jvmargs.ide}"/> <classpath> <path path="@{classpath}"/> </classpath> @@ -844,9 +537,6 @@ is divided into following sections: <path path="${run.classpath.without.build.classes.dir}"/> <chainedmapper> <flattenmapper/> - <filtermapper> - <replacestring from=" " to="%20"/> - </filtermapper> <globmapper from="*" to="lib/*"/> </chainedmapper> </pathconvert> @@ -892,7 +582,7 @@ is divided into following sections: <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline"> <property name="ap.cmd.line.internal" value=""/> </target> - <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/> + <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/> <!-- =================== COMPILATION SECTION @@ -903,7 +593,7 @@ is divided into following sections: <delete file="${built-jar.properties}" quiet="true"/> </target> <target if="already.built.jar.${basedir}" name="-warn-already-built-jar"> - <echo level="warn" message="Cycle detected: EssentialsUpdate was already built"/> + <echo level="warn" message="Cycle detected: EssentialsAntiBuild was already built"/> </target> <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps"> <mkdir dir="${build.dir}"/> @@ -913,6 +603,13 @@ is divided into following sections: <propertyfile file="${built-jar.properties}"> <entry key="${basedir}" value=""/> </propertyfile> + <antcall target="-maybe-call-dep"> + <param name="call.built.properties" value="${built-jar.properties}"/> + <param location="${project.Essentials}" name="call.subproject"/> + <param location="${project.Essentials}/build.xml" name="call.script"/> + <param name="call.target" value="jar"/> + <param name="transfer.built-jar.properties" value="${built-jar.properties}"/> + </antcall> </target> <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/> <target depends="init" name="-check-automatic-build"> @@ -1108,11 +805,7 @@ is divided into following sections: PROFILING SECTION ================= --> - <!-- - pre NB7.2 profiler integration - --> - <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72"> - <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> + <target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile"> <nbprofiledirect> <classpath> <path path="${run.classpath}"/> @@ -1120,9 +813,8 @@ is divided into following sections: </nbprofiledirect> <profile/> </target> - <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72"> + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single"> <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail> - <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> <nbprofiledirect> <classpath> <path path="${run.classpath}"/> @@ -1130,8 +822,12 @@ is divided into following sections: </nbprofiledirect> <profile classname="${profile.class}"/> </target> - <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72"> - <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> + <!-- + ========================= + APPLET PROFILING SECTION + ========================= + --> + <target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet"> <nbprofiledirect> <classpath> <path path="${run.classpath}"/> @@ -1143,8 +839,12 @@ is divided into following sections: </customize> </profile> </target> - <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72"> - <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> + <!-- + ========================= + TESTS PROFILING SECTION + ========================= + --> + <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single"> <nbprofiledirect> <classpath> <path path="${run.test.classpath}"/> @@ -1167,42 +867,6 @@ is divided into following sections: </junit> </target> <!-- - end of pre NB72 profiling section - --> - <target if="netbeans.home" name="-profile-check"> - <condition property="profiler.configured"> - <or> - <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/> - <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/> - </or> - </condition> - </target> - <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent"> - <startprofiler/> - <antcall target="run"/> - </target> - <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent"> - <fail unless="run.class">Must select one file in the IDE or set run.class</fail> - <startprofiler/> - <antcall target="run-single"/> - </target> - <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/> - <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs"> - <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> - <startprofiler/> - <antcall target="test-single"/> - </target> - <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main"> - <fail unless="run.class">Must select one file in the IDE or set run.class</fail> - <startprofiler/> - <antcal target="run-test-with-main"/> - </target> - <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent"> - <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> - <startprofiler/> - <antcall target="run-applet"/> - </target> - <!-- =============== JAVADOC SECTION =============== @@ -1245,7 +909,7 @@ is divided into following sections: <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/> <!-- ========================= - TEST COMPILATION SECTION + JUNIT COMPILATION SECTION ========================= --> <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test"> @@ -1288,14 +952,14 @@ is divided into following sections: <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/> <!-- ======================= - TEST EXECUTION SECTION + JUNIT EXECUTION SECTION ======================= --> <target depends="init" if="have.tests" name="-pre-test-run"> <mkdir dir="${build.test.results.dir}"/> </target> <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run"> - <j2seproject3:test testincludes="**/*Test.java"/> + <j2seproject3:junit testincludes="**/*Test.java"/> </target> <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run"> <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> @@ -1308,40 +972,39 @@ is divided into following sections: </target> <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single"> <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> - <j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/> + <j2seproject3:junit excludes="" includes="${test.includes}"/> </target> <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single"> <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> </target> <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/> - <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method"> - <fail unless="test.class">Must select some files in the IDE or set test.class</fail> - <fail unless="test.method">Must select some method in the IDE or set test.method</fail> - <j2seproject3:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/> - </target> - <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method"> - <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> - </target> - <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/> <!-- ======================= - TEST DEBUGGING SECTION + JUNIT DEBUGGING SECTION ======================= --> - <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test"> + <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test"> <fail unless="test.class">Must select one file in the IDE or set test.class</fail> - <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/> - </target> - <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method"> - <fail unless="test.class">Must select one file in the IDE or set test.class</fail> - <fail unless="test.method">Must select some method in the IDE or set test.method</fail> - <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/> + <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/> + <delete file="${test.report.file}"/> + <mkdir dir="${build.test.results.dir}"/> + <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}"> + <customize> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <arg value="${test.class}"/> + <arg value="showoutput=true"/> + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/> + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/> + </customize> + </j2seproject3:debug> </target> <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test"> <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/> </target> <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/> - <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/> <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test"> <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/> </target> @@ -1383,7 +1046,7 @@ is divided into following sections: <delete file="${built-clean.properties}" quiet="true"/> </target> <target if="already.built.clean.${basedir}" name="-warn-already-built-clean"> - <echo level="warn" message="Cycle detected: EssentialsUpdate was already built"/> + <echo level="warn" message="Cycle detected: EssentialsAntiBuild was already built"/> </target> <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps"> <mkdir dir="${build.dir}"/> @@ -1393,6 +1056,13 @@ is divided into following sections: <propertyfile file="${built-clean.properties}"> <entry key="${basedir}" value=""/> </propertyfile> + <antcall target="-maybe-call-dep"> + <param name="call.built.properties" value="${built-clean.properties}"/> + <param location="${project.Essentials}" name="call.subproject"/> + <param location="${project.Essentials}/build.xml" name="call.script"/> + <param name="call.target" value="clean"/> + <param name="transfer.built-clean.properties" value="${built-clean.properties}"/> + </antcall> </target> <target depends="init" name="-do-clean"> <delete dir="${build.dir}"/> @@ -1406,12 +1076,9 @@ is divided into following sections: <target name="-check-call-dep"> <property file="${call.built.properties}" prefix="already.built."/> <condition property="should.call.dep"> - <and> - <not> - <isset property="already.built.${call.subproject}"/> - </not> - <available file="${call.script}"/> - </and> + <not> + <isset property="already.built.${call.subproject}"/> + </not> </condition> </target> <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep"> diff --git a/EssentialsAntiBuild/nbproject/genfiles.properties b/EssentialsAntiBuild/nbproject/genfiles.properties new file mode 100644 index 000000000..61188645c --- /dev/null +++ b/EssentialsAntiBuild/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=ff207988 +build.xml.script.CRC32=1ed11cc3 +build.xml.stylesheet.CRC32=28e38971@1.38.3.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=ddb4519c +nbproject/build-impl.xml.script.CRC32=cfb9443d +nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.3.46 diff --git a/EssentialsUpdate/nbproject/project.properties b/EssentialsAntiBuild/nbproject/project.properties index 88315dfa0..10fe0db04 100644 --- a/EssentialsUpdate/nbproject/project.properties +++ b/EssentialsAntiBuild/nbproject/project.properties @@ -1,9 +1,10 @@ annotation.processing.enabled=true annotation.processing.enabled.in.editor=false +annotation.processing.processors.list= annotation.processing.run.all.processors=true annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -application.title=EssentialsUpdate -application.vendor=essentialsteam +application.title=EssentialsAntiBuild +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 @@ -59,14 +60,17 @@ debug.test.classpath=\ ${run.test.classpath} # This directory is removed when the project is cleaned: dist.dir=dist -dist.jar=${dist.dir}/EssentialsUpdate.jar +dist.jar=${dist.dir}/original-EssentialsAntiBuild.jar dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= file.reference.bukkit.jar=../lib/bukkit.jar includes=** +jar.archive.disabled=${jnlp.enabled} jar.compress=true +jar.index=${jnlp.enabled} javac.classpath=\ + ${reference.Essentials.jar}:\ ${file.reference.bukkit.jar} # Space-separated list of extra javac options javac.compilerargs= @@ -92,11 +96,18 @@ javadoc.splitindex=true javadoc.use=true javadoc.version=false javadoc.windowtitle= -main.class= +jnlp.codebase.type=no.codebase +jnlp.descriptor=application +jnlp.enabled=false +jnlp.mixed.code=defaut +jnlp.offline-allowed=false +jnlp.signed=false manifest.file=manifest.mf meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=false +mkdist.disabled=true platform.active=default_platform +project.Essentials=../Essentials +reference.Essentials.jar=${project.Essentials}/dist/Essentials.jar run.classpath=\ ${javac.classpath}:\ ${build.classes.dir} diff --git a/EssentialsUpdate/nbproject/project.xml b/EssentialsAntiBuild/nbproject/project.xml index 6b0efd00f..931bed5ea 100644 --- a/EssentialsUpdate/nbproject/project.xml +++ b/EssentialsAntiBuild/nbproject/project.xml @@ -3,7 +3,7 @@ <type>org.netbeans.modules.java.j2seproject</type> <configuration> <data xmlns="http://www.netbeans.org/ns/j2se-project/3"> - <name>EssentialsUpdate</name> + <name>EssentialsAntiBuild</name> <source-roots> <root id="src.dir"/> </source-roots> @@ -14,5 +14,15 @@ <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> + </references> </configuration> </project> diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/AntiBuildConfig.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/AntiBuildConfig.java new file mode 100644 index 000000000..1aa33d02a --- /dev/null +++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/AntiBuildConfig.java @@ -0,0 +1,73 @@ +package com.earth2me.essentials.antibuild; + + +public enum AntiBuildConfig +{ + disable_build("protect.disable.build", true), + disable_use("protect.disable.use", true), + alert_on_placement("protect.alert.on-placement"), + alert_on_use("protect.alert.on-use"), + alert_on_break("protect.alert.on-break"), + blacklist_placement("protect.blacklist.placement"), + blacklist_usage("protect.blacklist.usage"), + blacklist_break("protect.blacklist.break"), + blacklist_piston("protect.blacklist.piston"); + private final String configName; + private final String defValueString; + private final boolean defValueBoolean; + private final boolean isList; + private final boolean isString; + + private AntiBuildConfig(final String configName) + { + this(configName, null, false, true, false); + } + + private AntiBuildConfig(final String configName, final boolean defValueBoolean) + { + this(configName, null, defValueBoolean, false, false); + } + + private AntiBuildConfig(final String configName, final String defValueString, final boolean defValueBoolean, final boolean isList, final boolean isString) + { + this.configName = configName; + this.defValueString = defValueString; + this.defValueBoolean = defValueBoolean; + this.isList = isList; + this.isString = isString; + } + + /** + * @return the configName + */ + public String getConfigName() + { + return configName; + } + + /** + * @return the default value String + */ + public String getDefaultValueString() + { + return defValueString; + } + + /** + * @return the default value boolean + */ + public boolean getDefaultValueBoolean() + { + return defValueBoolean; + } + + public boolean isString() + { + return isString; + } + + public boolean isList() + { + return isList; + } +} diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuild.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuild.java new file mode 100644 index 000000000..c7b2eb7dd --- /dev/null +++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuild.java @@ -0,0 +1,65 @@ +package com.earth2me.essentials.antibuild; + +import java.util.EnumMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; + + +public class EssentialsAntiBuild extends JavaPlugin implements IAntiBuild +{ + private static final Logger LOGGER = Logger.getLogger("Minecraft"); + private final transient Map<AntiBuildConfig, Boolean> settingsBoolean = new EnumMap<AntiBuildConfig, Boolean>(AntiBuildConfig.class); + private final transient Map<AntiBuildConfig, List<Integer>> settingsList = new EnumMap<AntiBuildConfig, List<Integer>>(AntiBuildConfig.class); + private transient EssentialsConnect ess = null; + + @Override + public void onEnable() + { + final PluginManager pm = this.getServer().getPluginManager(); + final Plugin essPlugin = pm.getPlugin("Essentials"); + if (essPlugin == null || !essPlugin.isEnabled()) + { + return; + } + ess = new EssentialsConnect(essPlugin, this); + + final EssentialsAntiBuildListener blockListener = new EssentialsAntiBuildListener(this); + pm.registerEvents(blockListener, this); + } + + @Override + public boolean checkProtectionItems(final AntiBuildConfig list, final int id) + { + final List<Integer> itemList = settingsList.get(list); + return itemList != null && !itemList.isEmpty() && itemList.contains(id); + } + + @Override + public EssentialsConnect getEssentialsConnect() + { + return ess; + } + + @Override + public Map<AntiBuildConfig, Boolean> getSettingsBoolean() + { + return settingsBoolean; + } + + @Override + public Map<AntiBuildConfig, List<Integer>> getSettingsList() + { + return settingsList; + } + + @Override + public boolean getSettingBool(final AntiBuildConfig protectConfig) + { + final Boolean bool = settingsBoolean.get(protectConfig); + return bool == null ? protectConfig.getDefaultValueBoolean() : bool; + } +} diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java new file mode 100644 index 000000000..3c5d9b889 --- /dev/null +++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java @@ -0,0 +1,215 @@ +package com.earth2me.essentials.antibuild; + +import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.User; +import java.util.logging.Level; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.event.Event.Result; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.*; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; + + +public class EssentialsAntiBuildListener implements Listener +{ + final private transient IAntiBuild prot; + final private transient IEssentials ess; + + public EssentialsAntiBuildListener(final IAntiBuild parent) + { + this.prot = parent; + this.ess = prot.getEssentialsConnect().getEssentials(); + } + + private boolean metaPermCheck(User user, String action, Block block) + { + if (block == null) + { + return false; + } + return metaPermCheck(user, action, block.getTypeId(), block.getData()); + } + + private boolean metaPermCheck(User user, String action, int blockId, byte data) + { + final String blockPerm = "essentials.build." + action + "." + blockId; + final String dataPerm = blockPerm + ":" + data; + + if (user.isPermissionSet(dataPerm)) + { + return user.isAuthorized(dataPerm); + } + else + { + if (ess.getSettings().isDebug()) + { + ess.getLogger().log(Level.INFO, "abort checking if " + user.getName() + " has " + dataPerm + " - not directly set"); + } + } + + return user.isAuthorized(blockPerm); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onBlockPlace(final BlockPlaceEvent event) + { + if (event.isCancelled()) + { + return; + } + + final User user = ess.getUser(event.getPlayer()); + + if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build") + && !metaPermCheck(user, "place", event.getBlock())) + { + if (ess.getSettings().warnOnBuildDisallow()) + { + user.sendMessage(_("buildAlert")); + } + event.setCancelled(true); + return; + } + + final Block blockPlaced = event.getBlockPlaced(); + final int id = blockPlaced.getTypeId(); + + if (prot.checkProtectionItems(AntiBuildConfig.blacklist_placement, id) && !user.isAuthorized("essentials.protect.exemptplacement")) + { + event.setCancelled(true); + return; + } + + if (prot.checkProtectionItems(AntiBuildConfig.alert_on_placement, id) + && !user.isAuthorized("essentials.protect.alerts.notrigger")) + { + prot.getEssentialsConnect().alert(user, blockPlaced.getType().toString(), _("alertPlaced")); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onBlockBreak(final BlockBreakEvent event) + { + if (event.isCancelled()) + { + return; + } + final User user = ess.getUser(event.getPlayer()); + + if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build") + && !metaPermCheck(user, "break", event.getBlock())) + { + if (ess.getSettings().warnOnBuildDisallow()) + { + user.sendMessage(_("buildAlert")); + } + event.setCancelled(true); + return; + } + final Block block = event.getBlock(); + final int typeId = block.getTypeId(); + + if (prot.checkProtectionItems(AntiBuildConfig.blacklist_break, typeId) + && !user.isAuthorized("essentials.protect.exemptbreak")) + { + event.setCancelled(true); + return; + } + final Material type = block.getType(); + + if (prot.checkProtectionItems(AntiBuildConfig.alert_on_break, typeId) + && !user.isAuthorized("essentials.protect.alerts.notrigger")) + { + prot.getEssentialsConnect().alert(user, type.toString(), _("alertBroke")); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onBlockPistonExtend(BlockPistonExtendEvent event) + { + if (event.isCancelled()) + { + return; + } + for (Block block : event.getBlocks()) + { + if (prot.checkProtectionItems(AntiBuildConfig.blacklist_piston, block.getTypeId())) + { + event.setCancelled(true); + return; + } + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onBlockPistonRetract(BlockPistonRetractEvent event) + { + if (event.isCancelled() || !event.isSticky()) + { + return; + } + final Block block = event.getRetractLocation().getBlock(); + if (prot.checkProtectionItems(AntiBuildConfig.blacklist_piston, block.getTypeId())) + { + event.setCancelled(true); + return; + } + } + + @EventHandler(priority = EventPriority.LOW) + public void onPlayerInteract(final PlayerInteractEvent event) + { + // Do not return if cancelled, because the interact event has 2 cancelled states. + final User user = ess.getUser(event.getPlayer()); + + if (event.hasItem() + && (event.getItem().getType() == Material.WATER_BUCKET + || event.getItem().getType() == Material.LAVA_BUCKET) + && prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build")) + { + if (ess.getSettings().warnOnBuildDisallow()) + { + user.sendMessage(_("buildAlert")); + } + event.setCancelled(true); + return; + } + + final ItemStack item = event.getItem(); + if (item != null + && prot.checkProtectionItems(AntiBuildConfig.blacklist_usage, item.getTypeId()) + && !user.isAuthorized("essentials.protect.exemptusage")) + { + event.setCancelled(true); + return; + } + + if (item != null + && prot.checkProtectionItems(AntiBuildConfig.alert_on_use, item.getTypeId()) + && !user.isAuthorized("essentials.protect.alerts.notrigger")) + { + prot.getEssentialsConnect().alert(user, item.getType().toString(), _("alertUsed")); + } + + if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.interact") && !user.isAuthorized("essentials.build")) + { + if (!metaPermCheck(user, "interact", event.getClickedBlock())) + { + event.setUseInteractedBlock(Result.DENY); + if (ess.getSettings().warnOnBuildDisallow()) + { + user.sendMessage(_("buildAlert")); + } + } + if (event.hasItem() && !metaPermCheck(user, "use", event.getItem().getTypeId(), event.getItem().getData().getData())) + { + event.setUseItemInHand(Result.DENY); + } + } + } +} diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsConnect.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsConnect.java new file mode 100644 index 000000000..c25898f78 --- /dev/null +++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsConnect.java @@ -0,0 +1,80 @@ +package com.earth2me.essentials.antibuild; + +import com.earth2me.essentials.IConf; +import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.User; +import static com.earth2me.essentials.I18n._; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; + + +public class EssentialsConnect +{ + private static final Logger LOGGER = Logger.getLogger("Minecraft"); + private final transient IEssentials ess; + private final transient IAntiBuild protect; + + public EssentialsConnect(Plugin essPlugin, Plugin essProtect) + { + if (!essProtect.getDescription().getVersion().equals(essPlugin.getDescription().getVersion())) + { + LOGGER.log(Level.WARNING, _("versionMismatchAll")); + } + ess = (IEssentials)essPlugin; + protect = (IAntiBuild)essProtect; + AntiBuildReloader pr = new AntiBuildReloader(); + pr.reloadConfig(); + ess.addReloadListener(pr); + } + + public void onDisable() + { + } + + public IEssentials getEssentials() + { + return ess; + } + + public void alert(final User user, final String item, final String type) + { + final Location loc = user.getLocation(); + final String warnMessage = _("alertFormat", user.getName(), type, item, + loc.getWorld().getName() + "," + loc.getBlockX() + "," + + loc.getBlockY() + "," + loc.getBlockZ()); + LOGGER.log(Level.WARNING, warnMessage); + for (Player p : ess.getServer().getOnlinePlayers()) + { + final User alertUser = ess.getUser(p); + if (alertUser.isAuthorized("essentials.protect.alerts")) + { + alertUser.sendMessage(warnMessage); + } + } + } + + + private class AntiBuildReloader implements IConf + { + @Override + public void reloadConfig() + { + for (AntiBuildConfig protectConfig : AntiBuildConfig.values()) + { + if (protectConfig.isList()) + { + protect.getSettingsList().put(protectConfig, ess.getSettings().getProtectList(protectConfig.getConfigName())); + } + else + { + protect.getSettingsBoolean().put(protectConfig, ess.getSettings().getProtectBoolean(protectConfig.getConfigName(), protectConfig.getDefaultValueBoolean())); + } + + } + + } + } +} diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/IAntiBuild.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/IAntiBuild.java new file mode 100644 index 000000000..c7b370006 --- /dev/null +++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/IAntiBuild.java @@ -0,0 +1,19 @@ +package com.earth2me.essentials.antibuild; + +import java.util.List; +import java.util.Map; +import org.bukkit.plugin.Plugin; + + +public interface IAntiBuild extends Plugin +{ + boolean checkProtectionItems(final AntiBuildConfig list, final int id); + + boolean getSettingBool(final AntiBuildConfig protectConfig); + + EssentialsConnect getEssentialsConnect(); + + Map<AntiBuildConfig, Boolean> getSettingsBoolean(); + + Map<AntiBuildConfig, List<Integer>> getSettingsList(); +} diff --git a/EssentialsAntiBuild/src/plugin.yml b/EssentialsAntiBuild/src/plugin.yml new file mode 100644 index 000000000..ea880af14 --- /dev/null +++ b/EssentialsAntiBuild/src/plugin.yml @@ -0,0 +1,9 @@ +# This determines the command prefix when there are conflicts (/name:home, /name:help, etc.) +name: EssentialsAntiBuild +main: com.earth2me.essentials.antibuild.EssentialsAntiBuild +# Note to developers: This next line cannot change, or the automatic versioning system will break. +version: TeamCity +website: http://www.earth2me.net:8001/ +description: Provides build protection. +authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits] +softdepend: [Essentials]
\ No newline at end of file diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java index 1ebb6389c..bc6b27aea 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java @@ -172,7 +172,7 @@ public abstract class EssentialsChatPlayer implements Listener } } - String message = String.format(event.getFormat(), type.concat(sender.getDisplayName()), event.getMessage()); + String message = type.concat(String.format(event.getFormat(), sender.getDisplayName(), event.getMessage())); synchronized (listeners) { for (Map.Entry<String, IEssentialsChatListener> listener : listeners.entrySet()) diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java index 7503c334c..e17264ca9 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.protect; import com.earth2me.essentials.IConf; import com.earth2me.essentials.IEssentials; -import com.earth2me.essentials.User; import com.earth2me.essentials.protect.data.ProtectedBlockMemory; import com.earth2me.essentials.protect.data.ProtectedBlockMySQL; import com.earth2me.essentials.protect.data.ProtectedBlockSQLite; @@ -10,8 +9,6 @@ import java.beans.PropertyVetoException; import static com.earth2me.essentials.I18n._; import java.util.logging.Level; import java.util.logging.Logger; -import org.bukkit.Location; -import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -43,23 +40,6 @@ public class EssentialsConnect return ess; } - public void alert(final User user, final String item, final String type) - { - final Location loc = user.getLocation(); - final String warnMessage = _("alertFormat", user.getName(), type, item, - loc.getWorld().getName() + "," + loc.getBlockX() + "," - + loc.getBlockY() + "," + loc.getBlockZ()); - LOGGER.log(Level.WARNING, warnMessage); - for (Player p : ess.getServer().getOnlinePlayers()) - { - final User alertUser = ess.getUser(p); - if (alertUser.isAuthorized("essentials.protect.alerts")) - { - alertUser.sendMessage(warnMessage); - } - } - } - private class ProtectReloader implements IConf { diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java index 9c257662d..06dc03656 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java @@ -74,13 +74,6 @@ public class EssentialsProtect extends JavaPlugin implements IProtect } @Override - public boolean checkProtectionItems(final ProtectConfig list, final int id) - { - final List<Integer> itemList = settingsList.get(list); - return itemList != null && !itemList.isEmpty() && itemList.contains(id); - } - - @Override public IProtectedBlock getStorage() { return storage; diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java index 8e5e9cca8..bd760b0ec 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java @@ -1,6 +1,5 @@ package com.earth2me.essentials.protect; -import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; import com.earth2me.essentials.protect.data.IProtectedBlock; @@ -36,26 +35,9 @@ public class EssentialsProtectBlockListener implements Listener final User user = ess.getUser(event.getPlayer()); - if (prot.getSettingBool(ProtectConfig.disable_build) && !user.canBuild()) - { - event.setCancelled(true); - return; - } - final Block blockPlaced = event.getBlockPlaced(); final int id = blockPlaced.getTypeId(); - if (prot.checkProtectionItems(ProtectConfig.blacklist_placement, id) && !user.isAuthorized("essentials.protect.exemptplacement")) - { - event.setCancelled(true); - return; - } - - if (!user.hasPermission("essentials.protect.alerts.notrigger") - && prot.checkProtectionItems(ProtectConfig.alert_on_placement, id)) - { - prot.getEssentialsConnect().alert(user, blockPlaced.getType().toString(), _("alertPlaced")); - } final Block below = blockPlaced.getRelative(BlockFace.DOWN); if ((below.getType() == Material.RAILS || below.getType() == Material.POWERED_RAIL || below.getType() == Material.DETECTOR_RAIL) @@ -234,27 +216,11 @@ public class EssentialsProtectBlockListener implements Listener } final User user = ess.getUser(event.getPlayer()); - if (prot.getSettingBool(ProtectConfig.disable_build) && !user.canBuild()) - { - event.setCancelled(true); - return; - } final Block block = event.getBlock(); final int typeId = block.getTypeId(); - if (prot.checkProtectionItems(ProtectConfig.blacklist_break, typeId) - && !user.isAuthorized("essentials.protect.exemptbreak")) - { - event.setCancelled(true); - return; - } final Material type = block.getType(); - if (!user.hasPermission("essentials.protect.alerts.notrigger") - && prot.checkProtectionItems(ProtectConfig.alert_on_break, typeId)) - { - prot.getEssentialsConnect().alert(user, type.toString(), _("alertBroke")); - } final IProtectedBlock storage = prot.getStorage(); if (user.isAuthorized("essentials.protect.admin")) @@ -333,11 +299,6 @@ public class EssentialsProtectBlockListener implements Listener } for (Block block : event.getBlocks()) { - if (prot.checkProtectionItems(ProtectConfig.blacklist_piston, block.getTypeId())) - { - event.setCancelled(true); - return; - } if ((block.getRelative(BlockFace.UP).getType() == Material.RAILS || block.getType() == Material.RAILS || block.getRelative(BlockFace.UP).getType() == Material.POWERED_RAIL @@ -385,11 +346,6 @@ public class EssentialsProtectBlockListener implements Listener return; } final Block block = event.getRetractLocation().getBlock(); - if (prot.checkProtectionItems(ProtectConfig.blacklist_piston, block.getTypeId())) - { - event.setCancelled(true); - return; - } if ((block.getRelative(BlockFace.UP).getType() == Material.RAILS || block.getType() == Material.RAILS || block.getRelative(BlockFace.UP).getType() == Material.POWERED_RAIL diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java index 6e515e56d..393376b6f 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java @@ -3,14 +3,12 @@ package com.earth2me.essentials.protect; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; -import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; public class EssentialsProtectPlayerListener implements Listener @@ -30,38 +28,6 @@ public class EssentialsProtectPlayerListener implements Listener // Do not return if cancelled, because the interact event has 2 cancelled states. final User user = ess.getUser(event.getPlayer()); - if (event.hasItem() - && (event.getItem().getType() == Material.WATER_BUCKET - || event.getItem().getType() == Material.LAVA_BUCKET) - && prot.getSettingBool(ProtectConfig.disable_build) && !user.canBuild()) - { - if (ess.getSettings().warnOnBuildDisallow()) - { - user.sendMessage(_("buildAlert")); - } - event.setCancelled(true); - return; - } - - if (prot.getSettingBool(ProtectConfig.disable_use) && !user.canBuild()) - { - if (ess.getSettings().warnOnBuildDisallow()) - { - user.sendMessage(_("buildAlert")); - } - event.setCancelled(true); - return; - } - - final ItemStack item = event.getItem(); - if (item != null - && prot.checkProtectionItems(ProtectConfig.blacklist_usage, item.getTypeId()) - && !user.isAuthorized("essentials.protect.exemptusage")) - { - event.setCancelled(true); - return; - } - if (user.isAuthorized("essentials.protect.ownerinfo") && event.getAction() == Action.RIGHT_CLICK_BLOCK) { final StringBuilder stringBuilder = new StringBuilder(); @@ -82,11 +48,5 @@ public class EssentialsProtectPlayerListener implements Listener user.sendMessage(_("protectionOwner", ownerNames)); } } - if (item != null - && !user.hasPermission("essentials.protect.alerts.notrigger") - && prot.checkProtectionItems(ProtectConfig.alert_on_use, item.getTypeId())) - { - prot.getEssentialsConnect().alert(user, item.getType().toString(), _("alertUsed")); - } } } diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java index afcb6e8ce..b82481267 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java @@ -8,8 +8,6 @@ import org.bukkit.plugin.Plugin; public interface IProtect extends Plugin { - boolean checkProtectionItems(final ProtectConfig list, final int id); - boolean getSettingBool(final ProtectConfig protectConfig); String getSettingString(final ProtectConfig protectConfig); diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java index bee8d0f4d..31141d7e7 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java @@ -10,8 +10,6 @@ public enum ProtectConfig memstore("protect.memstore", false), disable_contactdmg("protect.disable.contactdmg", false), disable_lavadmg("protect.disable.lavadmg", false), - disable_build("protect.disable.build", true), - disable_use("protect.disable.use", true), disable_pvp("protect.disable.pvp", false), disable_projectiles("protect.disable.projectiles", false), disable_fall("protect.disable.fall", false), @@ -47,14 +45,7 @@ public enum ProtectConfig protect_below_rails("protect.protect.block-below", true), protect_signs("protect.protect.signs", true), protect_against_signs("protect.protect.block-below", true), - enderdragon_fakeexplosions("protect.enderdragon-fakeexplosions", false), - alert_on_placement("protect.alert.on-placement"), - alert_on_use("protect.alert.on-use"), - alert_on_break("protect.alert.on-break"), - blacklist_placement("protect.blacklist.placement"), - blacklist_usage("protect.blacklist.usage"), - blacklist_break("protect.blacklist.break"), - blacklist_piston("protect.blacklist.piston"); + enderdragon_fakeexplosions("protect.enderdragon-fakeexplosions", false); private final String configName; private final String defValueString; private final boolean defValueBoolean; diff --git a/EssentialsUpdate/nbproject/genfiles.properties b/EssentialsUpdate/nbproject/genfiles.properties deleted file mode 100644 index 39c782bce..000000000 --- a/EssentialsUpdate/nbproject/genfiles.properties +++ /dev/null @@ -1,8 +0,0 @@ -build.xml.data.CRC32=fd4b98a9 -build.xml.script.CRC32=334f342d -build.xml.stylesheet.CRC32=28e38971@1.44.1.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=fd4b98a9 -nbproject/build-impl.xml.script.CRC32=966cfa4e -nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46 diff --git a/EssentialsUpdate/nbproject/pmd.settings b/EssentialsUpdate/nbproject/pmd.settings deleted file mode 100644 index 6a34e356c..000000000 --- a/EssentialsUpdate/nbproject/pmd.settings +++ /dev/null @@ -1 +0,0 @@ -DoNotUseThreads diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/AbstractWorkListener.java b/EssentialsUpdate/src/com/earth2me/essentials/update/AbstractWorkListener.java deleted file mode 100644 index d2cbb8a64..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/AbstractWorkListener.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.earth2me.essentials.update; - -import org.bukkit.plugin.Plugin; - - -public abstract class AbstractWorkListener -{ - public AbstractWorkListener(final Plugin plugin, final VersionInfo newVersionInfo) - { - this.plugin = plugin; - this.newVersionInfo = newVersionInfo; - } - private final transient Plugin plugin; - private final transient VersionInfo newVersionInfo; - - public final void onWorkAbort() - { - onWorkAbort(null); - } - - public abstract void onWorkAbort(String message); - - public final void onWorkDone() - { - onWorkDone(null); - } - - public abstract void onWorkDone(String message); - - public VersionInfo getNewVersionInfo() - { - return newVersionInfo; - } - - public Plugin getPlugin() - { - return plugin; - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java b/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java deleted file mode 100644 index 63cdc094a..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.earth2me.essentials.update; - -import com.earth2me.essentials.update.chat.*; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.PluginManager; - - -public class EssentialsHelp implements Listener -{ - private transient Player chatUser; - private final transient Server server; - private final transient Plugin plugin; - private transient IrcBot ircBot; - private final transient Map<String, Command> commands = new HashMap<String, Command>(); - - public EssentialsHelp(final Plugin plugin) - { - super(); - this.plugin = plugin; - this.server = plugin.getServer(); - commands.put("!help", new HelpCommand()); - commands.put("!list", new ListCommand()); - commands.put("!startup", new StartupCommand(plugin)); - commands.put("!errors", new ErrorsCommand(plugin)); - commands.put("!config", new ConfigCommand(plugin)); - } - - public void registerEvents() - { - final PluginManager pluginManager = server.getPluginManager(); - pluginManager.registerEvents(this, plugin); - } - - public void onCommand(final CommandSender sender) - { - if (sender instanceof Player && sender.hasPermission("essentials.helpchat")) - { - if (chatUser == null) - { - chatUser = (Player)sender; - ircBot = null; - sender.sendMessage("You will be connected to the Essentials Help Chat."); - sender.sendMessage("All your chat messages will be forwarded to the channel. You can't chat with other players on your server while in help chat, but you can use commands."); - sender.sendMessage("Please be patient, if noone is available, check back later."); - sender.sendMessage("Type !help to get a list of all commands."); - sender.sendMessage("Type !quit to leave the channel."); - sender.sendMessage("Do you want to join the channel now? (yes/no)"); - } - if (!chatUser.equals(sender)) - { - sender.sendMessage("The player " + chatUser.getDisplayName() + " is already using the essentialshelp."); - } - } - else - { - sender.sendMessage("Please run the command as op from in game."); - } - } - - public void onDisable() - { - closeConnection(); - } - - private boolean sendChatMessage(final Player player, final String message) - { - final String messageCleaned = message.trim(); - if (messageCleaned.isEmpty()) - { - return false; - } - if (ircBot == null) - { - return handleAnswer(messageCleaned, player); - } - else - { - if (ircBot.isKicked()) - { - closeConnection(); - return false; - } - final String lowMessage = messageCleaned.toLowerCase(Locale.ENGLISH); - if (lowMessage.startsWith("!quit")) - { - closeConnection(); - player.sendMessage("Connection closed."); - return true; - } - if (!ircBot.isConnected() || ircBot.getChannels().length == 0) - { - return false; - } - if (handleCommands(lowMessage, player)) - { - return true; - } - ircBot.sendMessage(messageCleaned); - chatUser.sendMessage("§6" + ircBot.getNick() + ": §7" + messageCleaned); - return true; - } - } - - private void closeConnection() - { - chatUser = null; - if (ircBot != null) - { - ircBot.quit(); - ircBot = null; - } - } - - private boolean handleAnswer(final String message, final Player player) - { - if (message.equalsIgnoreCase("yes")) - { - player.sendMessage("Connecting..."); - connectToIRC(player); - return true; - } - if (message.equalsIgnoreCase("no") || message.equalsIgnoreCase("!quit")) - { - chatUser = null; - return true; - } - return false; - } - - private boolean handleCommands(final String lowMessage, final Player player) - { - final String[] parts = lowMessage.split(" "); - if (commands.containsKey(parts[0])) - { - commands.get(parts[0]).run(ircBot, player); - return true; - } - return false; - } - - private void connectToIRC(final Player player) - { - ircBot = new IrcBot(player, "Ess_" + player.getName(), UsernameUtil.createUsername(player)); - } - - @EventHandler - public void onPlayerChat(final AsyncPlayerChatEvent event) - { - if (event.getPlayer() == chatUser) - { - final boolean success = sendChatMessage(event.getPlayer(), event.getMessage()); - event.setCancelled(success); - } - } - - @EventHandler - public void onPlayerQuit(final PlayerQuitEvent event) - { - closeConnection(); - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsUpdate.java b/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsUpdate.java deleted file mode 100644 index be6e42ce9..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsUpdate.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.earth2me.essentials.update; - -import java.util.logging.Level; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.plugin.java.JavaPlugin; - - -public class EssentialsUpdate extends JavaPlugin -{ - private transient EssentialsHelp essentialsHelp; - private transient UpdateProcess updateProcess; - - @Override - public void onEnable() - { - if (!getDataFolder().exists() && !getDataFolder().mkdirs()) - { - Bukkit.getLogger().log(Level.SEVERE, "Could not create data folder: {0}", getDataFolder().getPath()); - } - essentialsHelp = new EssentialsHelp(this); - essentialsHelp.registerEvents(); - - final UpdateCheck updateCheck = new UpdateCheck(this); - updateCheck.checkForUpdates(); - updateProcess = new UpdateProcess(this, updateCheck); - updateProcess.registerEvents(); - - Bukkit.getLogger().log(Level.INFO, "EssentialsUpdate {0} loaded.", getDescription().getVersion()); - - if (updateCheck.isEssentialsInstalled()) - { - updateCheck.scheduleUpdateTask(); - } - else - { - Bukkit.getLogger().info("Essentials is ready for installation. Join the game and follow the instructions."); - } - } - - @Override - public void onDisable() - { - essentialsHelp.onDisable(); - } - - @Override - public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) - { - if (command.getName().equalsIgnoreCase("essentialsupdate")) - { - updateProcess.onCommand(sender); - } - if (command.getName().equalsIgnoreCase("essentialshelp")) - { - essentialsHelp.onCommand(sender); - } - return true; - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/GetFile.java b/EssentialsUpdate/src/com/earth2me/essentials/update/GetFile.java deleted file mode 100644 index 06b414e93..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/GetFile.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.earth2me.essentials.update; - -import java.io.*; -import java.math.BigInteger; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLConnection; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.logging.Level; -import org.bukkit.Bukkit; - - -public class GetFile -{ - private transient URLConnection connection; - private transient MessageDigest digest; - - public GetFile(final String urlString) throws MalformedURLException, IOException - { - this(new URL(urlString)); - } - - public GetFile(final URL url) throws IOException - { - this.connection = url.openConnection(); - this.connection.setConnectTimeout(1000); - this.connection.setReadTimeout(5000); - this.connection.setUseCaches(false); - this.connection.connect(); - final int respCode = ((HttpURLConnection)this.connection).getResponseCode(); - if (respCode >= 300 && respCode < 400 && this.connection.getHeaderField("Location") != null) - { - connection.getInputStream().close(); - final URL redirect = new URL(this.connection.getHeaderField("Location")); - this.connection = redirect.openConnection(); - this.connection.setConnectTimeout(1000); - this.connection.setReadTimeout(5000); - this.connection.setUseCaches(false); - this.connection.connect(); - } - } - - public void saveTo(final File file) throws IOException - { - try - { - saveTo(file, null); - } - catch (NoSuchAlgorithmException ex) - { - throw new RuntimeException(ex); - } - } - - public void saveTo(final File file, final String key) throws IOException, NoSuchAlgorithmException - { - if (key != null) - { - digest = MessageDigest.getInstance("SHA256"); - } - final byte[] buffer = new byte[1024 * 8]; - boolean brokenFile = false; - final BufferedInputStream input = new BufferedInputStream(connection.getInputStream()); - try - { - final BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(file)); - try - { - int length; - do - { - length = input.read(buffer); - if (length >= 0) - { - if (key != null) - { - digest.update(buffer, 0, length); - } - output.write(buffer, 0, length); - } - } - while (length >= 0); - if (key != null) - { - final byte[] checksum = digest.digest(); - final String checksumString = new BigInteger(checksum).toString(36); - if (!checksumString.equals(key)) - { - brokenFile = true; - } - } - } - finally - { - output.close(); - } - if (brokenFile && !file.delete()) - { - Bukkit.getLogger().log(Level.SEVERE, "Could not delete file {0}", file.getPath()); - } - } - finally - { - input.close(); - } - if (brokenFile) - { - throw new IOException("Checksum check failed."); - } - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/ModuleInfo.java b/EssentialsUpdate/src/com/earth2me/essentials/update/ModuleInfo.java deleted file mode 100644 index 722fca3e1..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/ModuleInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.earth2me.essentials.update; - -import java.net.MalformedURLException; -import java.net.URL; -import org.bukkit.configuration.Configuration; - - -public class ModuleInfo -{ - private final transient String url; - private final transient String version; - private final transient String hash; - - public ModuleInfo(final Configuration updateConfig, final String path) - { - url = updateConfig.getString(path + ".url", null); - version = updateConfig.getString(path + ".version", null); - hash = updateConfig.getString(path + ".hash", null); - } - - public URL getUrl() throws MalformedURLException - { - return new URL(url); - } - - public String getVersion() - { - return version; - } - - public String getHash() - { - return hash; - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/PastieUpload.java b/EssentialsUpdate/src/com/earth2me/essentials/update/PastieUpload.java deleted file mode 100644 index 6cad44e4d..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/PastieUpload.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.earth2me.essentials.update; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - - -public class PastieUpload -{ - private final transient PostToUrl connection; - - public PastieUpload() throws MalformedURLException - { - connection = new PostToUrl(new URL("http://pastie.org/pastes")); - } - - public String send(final String data) throws IOException - { - final Map<String, Object> map = new HashMap<String, Object>(); - map.put("paste[parser_id]", "19"); - map.put("paste[authorization]", "burger"); - map.put("paste[body]", data); - map.put("paste[restricted]", "1"); - final String html = connection.send(map); - final Matcher matcher = Pattern.compile("(?s).*\\?key=([a-z0-9]+).*").matcher(html); - if (matcher.matches()) - { - final String key = matcher.group(1); - return "http://pastie.org/private/" + key; - } - else - { - throw new IOException("Failed to upload to pastie.org"); - } - } -}
\ No newline at end of file diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/PostToUrl.java b/EssentialsUpdate/src/com/earth2me/essentials/update/PostToUrl.java deleted file mode 100644 index c8978961b..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/PostToUrl.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.earth2me.essentials.update; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.math.BigInteger; -import java.net.URL; -import java.net.URLConnection; -import java.nio.charset.Charset; -import java.util.Map; -import java.util.Random; - - -public class PostToUrl -{ - private final transient URL url; - private final transient String boundary; - private final transient Random random = new Random(); - private final static String CRLF = "\r\n"; - private final static Charset UTF8 = Charset.forName("utf-8"); - - public PostToUrl(final URL url) - { - this.url = url; - final byte[] bytes = new byte[32]; - random.nextBytes(bytes); - this.boundary = "----------" + new BigInteger(bytes).toString(Character.MAX_RADIX) + "_$"; - } - - public String send(final Map<String, Object> data) throws IOException - { - final URLConnection connection = url.openConnection(); - connection.setRequestProperty("content-type", "multipart/form-data; boundary=" + boundary); - final StringBuilder dataBuilder = new StringBuilder(); - for (Map.Entry<String, Object> entry : data.entrySet()) - { - if (entry.getValue() instanceof String) - { - dataBuilder.append("--").append(boundary).append(CRLF); - dataBuilder.append("Content-Disposition: form-data; name=\"").append(entry.getKey()).append('"').append(CRLF); - dataBuilder.append(CRLF); - dataBuilder.append(entry.getValue()).append(CRLF); - } - // TODO: Add support for file upload - } - dataBuilder.append("--").append(boundary).append("--").append(CRLF); - dataBuilder.append(CRLF); - connection.setDoOutput(true); - final byte[] message = dataBuilder.toString().getBytes(UTF8); - connection.setRequestProperty("content-length", Integer.toString(message.length)); - connection.connect(); - final OutputStream stream = connection.getOutputStream(); - stream.write(message); - stream.close(); - final BufferedReader page = new BufferedReader(new InputStreamReader(connection.getInputStream(), UTF8)); - final StringBuilder input = new StringBuilder(); - String line; - while ((line = page.readLine()) != null) - { - input.append(line).append("\n"); - } - page.close(); - return input.toString(); - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateCheck.java b/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateCheck.java deleted file mode 100644 index 29afc4d3f..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateCheck.java +++ /dev/null @@ -1,202 +0,0 @@ -package com.earth2me.essentials.update; - -import java.io.File; -import java.util.Map; -import java.util.Map.Entry; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.bukkit.Bukkit; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.PluginManager; - - -public class UpdateCheck -{ - private transient CheckResult result = CheckResult.UNKNOWN; - private transient Version currentVersion; - private transient Version newVersion = null; - private transient int bukkitResult = 0; - private transient UpdateFile updateFile; - private final static int CHECK_INTERVAL = 20 * 60 * 60 * 6; - private final transient Plugin plugin; - private transient boolean essentialsInstalled; - - public UpdateCheck(final Plugin plugin) - { - this.plugin = plugin; - updateFile = new UpdateFile(plugin); - checkForEssentials(); - } - - private void checkForEssentials() - { - final PluginManager pluginManager = plugin.getServer().getPluginManager(); - final Plugin essentials = pluginManager.getPlugin("Essentials"); - essentialsInstalled = essentials != null; - if (essentialsInstalled) - { - currentVersion = new Version(essentials.getDescription().getVersion()); - } - else - { - if (new File(plugin.getDataFolder().getParentFile(), "Essentials.jar").exists()) - { - Bukkit.getLogger().severe("Essentials.jar found, but not recognized by Bukkit. Broken download?"); - } - } - } - - public void scheduleUpdateTask() - { - plugin.getServer().getScheduler().scheduleAsyncRepeatingTask(plugin, new Runnable() - { - @Override - public void run() - { - updateFile = new UpdateFile(plugin); - checkForUpdates(); - } - }, CHECK_INTERVAL, CHECK_INTERVAL); - } - - public boolean isEssentialsInstalled() - { - return essentialsInstalled; - } - - public CheckResult getResult() - { - return result; - } - - public int getNewBukkitVersion() - { - return bukkitResult; - } - - public VersionInfo getNewVersionInfo() - { - return updateFile.getVersions().get(newVersion); - } - - - public enum CheckResult - { - NEW_ESS, NEW_ESS_BUKKIT, NEW_BUKKIT, OK, UNKNOWN - } - - public void checkForUpdates() - { - if (currentVersion == null) - { - return; - } - final Map<Version, VersionInfo> versions = updateFile.getVersions(); - final int bukkitVersion = getBukkitVersion(); - Version higher = null; - Version found = null; - Version lower = null; - int bukkitHigher = 0; - int bukkitLower = 0; - for (Entry<Version, VersionInfo> entry : versions.entrySet()) - { - final int minBukkit = entry.getValue().getMinBukkit(); - final int maxBukkit = entry.getValue().getMaxBukkit(); - if (minBukkit == 0 || maxBukkit == 0) - { - continue; - } - if (bukkitVersion <= maxBukkit) - { - if (bukkitVersion < minBukkit) - { - if (higher == null || higher.compareTo(entry.getKey()) < 0) - { - - higher = entry.getKey(); - bukkitHigher = minBukkit; - } - } - else - { - if (found == null || found.compareTo(entry.getKey()) < 0) - { - found = entry.getKey(); - } - } - } - else - { - if (lower == null || lower.compareTo(entry.getKey()) < 0) - { - lower = entry.getKey(); - bukkitLower = minBukkit; - } - } - } - if (found != null) - { - if (found.compareTo(currentVersion) > 0) - { - result = CheckResult.NEW_ESS; - newVersion = found; - } - else - { - result = CheckResult.OK; - } - } - else if (higher != null) - { - if (higher.compareTo(currentVersion) > 0) - { - newVersion = higher; - result = CheckResult.NEW_ESS_BUKKIT; - bukkitResult = bukkitHigher; - } - else if (higher.compareTo(currentVersion) < 0) - { - result = CheckResult.UNKNOWN; - } - else - { - result = CheckResult.NEW_BUKKIT; - bukkitResult = bukkitHigher; - } - } - else if (lower != null) - { - if (lower.compareTo(currentVersion) > 0) - { - result = CheckResult.NEW_ESS_BUKKIT; - newVersion = lower; - bukkitResult = bukkitLower; - } - else if (lower.compareTo(currentVersion) < 0) - { - result = CheckResult.UNKNOWN; - } - else - { - result = CheckResult.NEW_BUKKIT; - bukkitResult = bukkitLower; - } - } - - } - - private int getBukkitVersion() - { - final Matcher versionMatch = Pattern.compile("git-Bukkit-([0-9]+).([0-9]+).([0-9]+)-[0-9]+-[0-9a-z]+-b([0-9]+)jnks.*").matcher(plugin.getServer().getVersion()); - if (versionMatch.matches()) - { - return Integer.parseInt(versionMatch.group(4)); - } - throw new NumberFormatException("Bukkit Version changed!"); - } - - public Version getNewVersion() - { - return newVersion; - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateFile.java b/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateFile.java deleted file mode 100644 index 3d465e2e8..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateFile.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.earth2me.essentials.update; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.math.BigInteger; -import java.security.KeyFactory; -import java.security.PublicKey; -import java.security.Signature; -import java.security.spec.X509EncodedKeySpec; -import java.util.Collections; -import java.util.Map; -import java.util.TreeMap; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.bukkit.Bukkit; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.plugin.Plugin; - - -public class UpdateFile -{ - private final static Logger LOGGER = Bukkit.getLogger(); - private final static String UPDATE_URL = "http://goo.gl/67jev"; - private final static BigInteger PUBLIC_KEY = new BigInteger("5ha6a2d4qdy17ttkg8evh74sl5a87djojwenu12k1lvy8ui6003e6l06rntczpoh99mhc3txj8mqlxw111oyy9yl7s7qpyluyzix3j1odxrxx4u52gxvyu6qiteapczkzvi7rxgeqsozz7b19rdx73a7quo9ybwpz1cr82r7x5k0pg2a73pjjsv2j1awr13azo7klrcxp9y5xxwf5qv1s3tw4zqftli18u0ek5qkbzfbgk1v5n2f11pkwwk6p0mibrn26wnjbv11vyiqgu95o7busmt6vf5q7grpcenl637w83mbin56s3asj1131b2mscj9xep3cbj7la9tgsxl5bj87vzy8sk2d34kzwqdqgh9nry43nqqus12l1stmiv184r8r3jcy8w43e8h1u1mzklldb5eytkuhayqik8l3ns04hwt8sgacvw534be8sx26qrn5s1", 36); - private final transient File file; - private transient YamlConfiguration updateConfig; - private final transient Plugin plugin; - private final transient TreeMap<Version, VersionInfo> versions = new TreeMap<Version, VersionInfo>(); - - public UpdateFile(final Plugin plugin) - { - this.plugin = plugin; - final long lastUpdate = Long.parseLong(plugin.getConfig().getString("lastupdate", "0")); - file = new File(plugin.getDataFolder(), "update.yml"); - if (lastUpdate < System.currentTimeMillis() - 1000 * 60 * 60 * 6 || !file.exists()) - { - if (file.exists() && !file.delete()) - { - LOGGER.log(Level.SEVERE, "Could not delete file update.yml!"); - return; - } - if (!downloadFile() || !checkFile()) - { - LOGGER.log(Level.SEVERE, "Could not download and verify file update.yml!"); - return; - } - } - try - { - readVersions(); - } - catch (Exception ex) - { - LOGGER.log(Level.SEVERE, "Could not load update.yml!"); - return; - } - } - - private boolean downloadFile() - { - GetFile getFile; - try - { - getFile = new GetFile(UPDATE_URL); - getFile.saveTo(file); - plugin.getConfig().set("lastupdate", System.currentTimeMillis()); - plugin.getConfig().save(new File(plugin.getDataFolder(), "config.yml")); - return true; - } - catch (IOException ex) - { - LOGGER.log(Level.SEVERE, "Error while downloading update.yml", ex); - return false; - } - } - - private boolean checkFile() - { - BufferedInputStream bis = null; - try - { - bis = new BufferedInputStream(new FileInputStream(file)); - if (bis.read() != '#') - { - throw new IOException("File has to start with #"); - } - final StringBuilder length = new StringBuilder(); - final StringBuilder signature = new StringBuilder(); - boolean isSignature = false; - do - { - final int cur = bis.read(); - if (cur == -1) - { - break; - } - if (cur == ':') - { - isSignature = true; - } - else if (cur == '\n') - { - break; - } - else if ((cur >= '0' && cur <= '9') - || (cur >= 'a' && cur <= 'z')) - { - if (isSignature) - { - signature.append((char)cur); - } - else - { - length.append((char)cur); - } - } - else - { - throw new IOException("Illegal character in signature!"); - } - } - while (true); - if (length.length() == 0 || signature.length() == 0) - { - throw new IOException("Broken signature!"); - } - final int sigLength = new BigInteger(length.toString(), 36).intValue(); - if (sigLength < 0 || sigLength > 2048) - { - throw new IOException("Invalid signature length!"); - } - final byte[] sigBytes = new BigInteger(signature.toString(), 36).toByteArray(); - if (sigLength < sigBytes.length) - { - throw new IOException("Length is less then available bytes."); - } - byte[] realBytes; - if (sigLength == sigBytes.length) - { - realBytes = sigBytes; - } - else - { - realBytes = new byte[sigLength]; - System.arraycopy(sigBytes, 0, realBytes, sigLength - sigBytes.length, sigBytes.length); - } - final X509EncodedKeySpec pubKeySpec = new X509EncodedKeySpec(PUBLIC_KEY.toByteArray()); - final KeyFactory keyFactory = KeyFactory.getInstance("RSA"); - final PublicKey pubKey = keyFactory.generatePublic(pubKeySpec); - final Signature rsa = Signature.getInstance("SHA256withRSA"); - rsa.initVerify(pubKey); - final byte[] buffer = new byte[2048]; - int readLength; - do - { - readLength = bis.read(buffer); - if (readLength >= 0) - { - rsa.update(buffer, 0, readLength); - } - } - while (readLength >= 0); - return rsa.verify(realBytes); - } - catch (Exception ex) - { - LOGGER.log(Level.SEVERE, ex.getMessage(), ex); - } - finally - { - try - { - if (bis != null) - { - bis.close(); - } - } - catch (IOException ex) - { - LOGGER.log(Level.SEVERE, ex.getMessage(), ex); - } - } - return false; - } - - private void readVersions() throws Exception - { - updateConfig = new YamlConfiguration(); - updateConfig.load(file); - versions.clear(); - for (String versionString : updateConfig.getKeys(false)) - { - final Version version = new Version(versionString); - final VersionInfo info = new VersionInfo(updateConfig, versionString); - versions.put(version, info); - } - } - - public Map<Version, VersionInfo> getVersions() - { - return Collections.unmodifiableMap(versions.descendingMap()); - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java b/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java deleted file mode 100644 index 29c227794..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java +++ /dev/null @@ -1,199 +0,0 @@ -package com.earth2me.essentials.update; - -import com.earth2me.essentials.update.states.InstallationFinishedEvent; -import com.earth2me.essentials.update.states.StateMachine; -import com.earth2me.essentials.update.tasks.SelfUpdate; -import java.util.logging.Level; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.plugin.Plugin; - - -public class UpdateProcess implements Listener -{ - private transient Player currentPlayer; - private final transient Plugin plugin; - private final transient UpdateCheck updateCheck; - private transient StateMachine stateMachine; - - public UpdateProcess(final Plugin plugin, final UpdateCheck updateCheck) - { - super(); - this.plugin = plugin; - this.updateCheck = updateCheck; - } - - public void registerEvents() - { - plugin.getServer().getPluginManager().registerEvents(this, plugin); - } - - public boolean selfUpdate() - { - if (new Version(plugin.getDescription().getVersion()).compareTo(updateCheck.getNewVersion()) < 0) - { - if (currentPlayer != null) - { - currentPlayer.sendMessage("A newer version of EssentialsUpdate is found. Downloading new file and reloading server."); - } - Bukkit.getLogger().log(Level.INFO, "A newer version of EssentialsUpdate is found. Downloading new file and reloading server."); - new SelfUpdate(new AbstractWorkListener(plugin, updateCheck.getNewVersionInfo()) - { - @Override - public void onWorkAbort(final String message) - { - if (message != null && !message.isEmpty() - && UpdateProcess.this.currentPlayer != null - && UpdateProcess.this.currentPlayer.isOnline()) - { - UpdateProcess.this.currentPlayer.sendMessage(message); - } - if (message != null && !message.isEmpty()) - { - Bukkit.getLogger().log(Level.SEVERE, message); - } - UpdateProcess.this.currentPlayer = null; - } - - @Override - public void onWorkDone(final String message) - { - if (message != null && !message.isEmpty() - && UpdateProcess.this.currentPlayer != null - && UpdateProcess.this.currentPlayer.isOnline()) - { - UpdateProcess.this.currentPlayer.sendMessage(message); - } - if (message != null && !message.isEmpty()) - { - Bukkit.getLogger().log(Level.INFO, message); - } - UpdateProcess.this.currentPlayer = null; - } - }).start(); - return true; - } - if (updateCheck.getResult() == UpdateCheck.CheckResult.NEW_ESS_BUKKIT) - { - final String message = "Please update bukkit to version " + updateCheck.getNewBukkitVersion() + " before updating Essentials."; - if (currentPlayer != null) - { - currentPlayer.sendMessage(message); - } - Bukkit.getLogger().log(Level.INFO, message); - currentPlayer = null; - return true; - } - return false; - } - - @EventHandler - public void onInstallationFinished(final InstallationFinishedEvent event) - { - UpdateProcess.this.currentPlayer = null; - } - - @EventHandler(priority = EventPriority.LOWEST) - public void onPlayerChat(final AsyncPlayerChatEvent event) - { - if (event.getPlayer() == currentPlayer) - { - final StateMachine.MachineResult result = stateMachine.reactOnMessage(event.getMessage()); - if (result == StateMachine.MachineResult.ABORT) - { - currentPlayer.sendMessage("Installation wizard aborted. You can restart it using /essentialsupdate."); - currentPlayer = null; - } - if (result == StateMachine.MachineResult.DONE) - { - startWork(); - } - event.setCancelled(true); - return; - } - } - - @EventHandler - public void onPlayerJoin(final PlayerJoinEvent event) - { - final Player player = event.getPlayer(); - if (currentPlayer.getName().equals(player.getName())) - { - currentPlayer = player; - player.sendMessage("You quit the game, while the installation wizard was running."); - player.sendMessage("The installation wizard will now resume."); - player.sendMessage("You can exit the wizard by typing quit into the chat."); - stateMachine.resumeInstallation(player); - } - if (player.hasPermission("essentials.update") && !updateCheck.isEssentialsInstalled()) - { - player.sendMessage("Hello " + player.getDisplayName()); - player.sendMessage("Please type /essentialsupdate into the chat to start the installation of Essentials."); - } - if (player.hasPermission("essentials.update")) - { - final UpdateCheck.CheckResult result = updateCheck.getResult(); - switch (result) - { - case NEW_ESS: - player.sendMessage("The new version " + updateCheck.getNewVersion().toString() + " for Essentials is available. Please type /essentialsupdate to update."); - break; - case NEW_BUKKIT: - player.sendMessage("Your bukkit version is not the recommended build for Essentials, please update to version " + updateCheck.getNewBukkitVersion() + "."); - break; - case NEW_ESS_BUKKIT: - player.sendMessage("There is a new version " + updateCheck.getNewVersion().toString() + " of Essentials for Bukkit " + updateCheck.getNewBukkitVersion()); - break; - default: - } - } - } - - public void onCommand(final CommandSender sender) - { - if (sender instanceof Player && sender.hasPermission("essentials.update")) - { - if (currentPlayer == null) - { - currentPlayer = (Player)sender; - if (selfUpdate()) - { - return; - } - stateMachine = new StateMachine(plugin, currentPlayer, updateCheck); - final StateMachine.MachineResult result = stateMachine.askQuestion(); - if (result == StateMachine.MachineResult.DONE) - { - startWork(); - } - } - if (!currentPlayer.equals(sender)) - { - sender.sendMessage("The player " + currentPlayer.getDisplayName() + " is already using the wizard."); - } - } - else - { - sender.sendMessage("Please run the command as op from in game."); - } - } - - private void startWork() - { - currentPlayer.sendMessage("Installation wizard done. Starting installation."); - Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() - { - @Override - public void run() - { - stateMachine.startWork(); - } - }); - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/Version.java b/EssentialsUpdate/src/com/earth2me/essentials/update/Version.java deleted file mode 100644 index a82f49abf..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/Version.java +++ /dev/null @@ -1,173 +0,0 @@ -package com.earth2me.essentials.update; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - - -public class Version implements Comparable<Version> -{ - public enum Type - { - STABLE, PREVIEW, DEVELOPER - } - - public int getMajor() - { - return major; - } - - public int getMinor() - { - return minor; - } - - public int getBuild() - { - return build; - } - - public Type getType() - { - return type; - } - private final transient int major; - private final transient int minor; - private final transient int build; - private final transient Type type; - - public Version(final String versionString) - { - final Matcher matcher = Pattern.compile("(Pre|Dev)?([0-9]+)[_\\.]([0-9]+)[_\\.]([0-9]+).*").matcher(versionString); - if (!matcher.matches() || matcher.groupCount() < 4) - { - type = Type.DEVELOPER; - major = 99; - minor = build = 0; - return; - } - if (versionString.startsWith("Pre")) - { - type = Type.PREVIEW; - } - else if (versionString.startsWith("Dev")) - { - type = Type.DEVELOPER; - } - else - { - type = Type.STABLE; - } - major = Integer.parseInt(matcher.group(2)); - minor = Integer.parseInt(matcher.group(3)); - build = Integer.parseInt(matcher.group(4)); - } - - @Override - public int compareTo(final Version other) - { - int ret = 0; - if (other.getType() == Type.DEVELOPER && getType() != Type.DEVELOPER) - { - ret = -1; - } - else if (getType() == Type.DEVELOPER && other.getType() != Type.DEVELOPER) - { - ret = 1; - } - else if (other.getMajor() > getMajor()) - { - ret = -1; - } - else if (getMajor() > other.getMajor()) - { - ret = 1; - } - else if (other.getMinor() > getMinor()) - { - ret = -1; - } - else if (getMinor() > other.getMinor()) - { - ret = 1; - } - else if (other.getBuild() > getBuild()) - { - ret = -1; - } - else if (getBuild() > other.getBuild()) - { - ret = 1; - } - else if (other.getType() == Type.STABLE && getType() == Type.PREVIEW) - { - ret = -1; - } - else if (getType() == Type.STABLE && other.getType() == Type.PREVIEW) - { - ret = 1; - } - return ret; - } - - @Override - public boolean equals(final Object obj) - { - if (obj == null) - { - return false; - } - if (getClass() != obj.getClass()) - { - return false; - } - final Version other = (Version)obj; - if (this.major != other.major) - { - return false; - } - if (this.minor != other.minor) - { - return false; - } - if (this.build != other.build) - { - return false; - } - if (this.type != other.type) - { - return false; - } - return true; - } - - @Override - public int hashCode() - { - int hash = 5; - hash = 71 * hash + this.major; - hash = 71 * hash + this.minor; - hash = 71 * hash + this.build; - hash = 71 * hash + (this.type == null ? 0 : this.type.hashCode()); - return hash; - } - - @Override - public String toString() - { - final StringBuilder builder = new StringBuilder(); - if (type == Type.DEVELOPER) - { - builder.append("Dev"); - } - if (type == Type.PREVIEW) - { - builder.append("Pre"); - } - builder.append(major); - builder.append('.'); - builder.append(minor); - builder.append('.'); - builder.append(build); - return builder.toString(); - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/VersionInfo.java b/EssentialsUpdate/src/com/earth2me/essentials/update/VersionInfo.java deleted file mode 100644 index c06aa2e64..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/VersionInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.earth2me.essentials.update; - -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.bukkit.configuration.Configuration; - - -public class VersionInfo -{ - private final transient List<String> changelog; - private final transient int minBukkit; - private final transient int maxBukkit; - private final transient Map<String, ModuleInfo> modules; - - public VersionInfo(final Configuration updateConfig, final String path) - { - changelog = updateConfig.getStringList(path + ".changelog"); - minBukkit = updateConfig.getInt(path + ".min-bukkit", 0); - maxBukkit = updateConfig.getInt(path + ".max-bukkit", 0); - modules = new HashMap<String, ModuleInfo>(); - final String modulesPath = path + ".modules"; - for (String module : updateConfig.getKeys(false)) - { - modules.put(module, new ModuleInfo(updateConfig, modulesPath + module)); - } - } - - public List<String> getChangelog() - { - return Collections.unmodifiableList(changelog); - } - - public int getMinBukkit() - { - return minBukkit; - } - - public int getMaxBukkit() - { - return maxBukkit; - } - - public Map<String, ModuleInfo> getModules() - { - return Collections.unmodifiableMap(modules); - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/AbstractFileCommand.java b/EssentialsUpdate/src/com/earth2me/essentials/update/chat/AbstractFileCommand.java deleted file mode 100644 index 7c99d28f6..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/AbstractFileCommand.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.earth2me.essentials.update.chat; - -import com.earth2me.essentials.update.PastieUpload; -import java.io.*; -import java.nio.charset.Charset; -import org.bukkit.plugin.Plugin; - - -public abstract class AbstractFileCommand implements Command -{ - private final transient Plugin plugin; - private final static Charset UTF8 = Charset.forName("utf-8"); - - public AbstractFileCommand(final Plugin plugin) - { - this.plugin = plugin; - } - - protected BufferedReader getServerLogReader() throws IOException - { - final File bukkitFolder = plugin.getDataFolder().getAbsoluteFile().getParentFile().getParentFile(); - if (bukkitFolder == null || !bukkitFolder.exists()) - { - throw new IOException("Bukkit folder not found."); - } - final File logFile = new File(bukkitFolder, "server.log"); - if (!logFile.exists()) - { - throw new IOException("Server log not found."); - } - final FileInputStream fis = new FileInputStream(logFile); - try - { - if (logFile.length() > 1000000) - { - fis.skip(logFile.length() - 1000000); - } - return new BufferedReader(new InputStreamReader(fis)); - } - catch (IOException ex) - { - fis.close(); - throw ex; - } - } - - protected BufferedReader getPluginConfig(final String pluginName, final String fileName) throws IOException - { - final File configFolder = new File(plugin.getDataFolder().getAbsoluteFile().getParentFile(), pluginName); - if (!configFolder.exists()) - { - throw new IOException(pluginName + " plugin folder not found."); - } - final File configFile = new File(configFolder, fileName); - if (!configFile.exists()) - { - throw new IOException(pluginName + " plugin file " + fileName + " not found."); - } - return new BufferedReader(new InputStreamReader(new FileInputStream(configFile), UTF8)); - - } - - protected String uploadToPastie(final StringBuilder input) throws IOException - { - if (input.length() > 15000) - { - input.delete(0, input.length() - 15000); - input.append("## Cropped after 15000 bytes"); - } - final PastieUpload pastie = new PastieUpload(); - return pastie.send(input.toString()); - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/Command.java b/EssentialsUpdate/src/com/earth2me/essentials/update/chat/Command.java deleted file mode 100644 index ad4c75e43..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/Command.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.earth2me.essentials.update.chat; - -import org.bukkit.entity.Player; - - -public interface Command -{ - void run(final IrcBot ircBot, final Player player); -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ConfigCommand.java b/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ConfigCommand.java deleted file mode 100644 index de2c6a830..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ConfigCommand.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.earth2me.essentials.update.chat; - -import java.io.BufferedReader; -import java.io.IOException; -import java.util.logging.Level; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - - -public class ConfigCommand extends AbstractFileCommand implements Command -{ - public ConfigCommand(final Plugin plugin) - { - super(plugin); - } - - @Override - public void run(final IrcBot ircBot, final Player player) - { - BufferedReader page = null; - try - { - page = getPluginConfig("Essentials", "config.yml"); - final StringBuilder input = new StringBuilder(); - do - { - final String line = page.readLine(); - if (line == null) - { - break; - } - else - { - input.append(line).append("\n"); - } - } - while (true); - page.close(); - final String message = "Essentials config.yml: " + uploadToPastie(input); - player.sendMessage("§6" + ircBot.getNick() + ": §7" + message); - ircBot.sendMessage(message); - } - catch (IOException ex) - { - Bukkit.getLogger().log(Level.SEVERE, null, ex); - player.sendMessage(ex.getMessage()); - } - finally - { - try - { - if (page != null) - { - page.close(); - } - } - catch (IOException ex) - { - Bukkit.getLogger().log(Level.SEVERE, null, ex); - player.sendMessage(ex.getMessage()); - } - } - - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ErrorsCommand.java b/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ErrorsCommand.java deleted file mode 100644 index 41aa551c4..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ErrorsCommand.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.earth2me.essentials.update.chat; - -import java.io.BufferedReader; -import java.io.IOException; -import java.util.logging.Level; -import java.util.regex.Pattern; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - - -public class ErrorsCommand extends AbstractFileCommand implements Command -{ - private final transient Pattern pattern = Pattern.compile("^[0-9 :-]+\\[INFO\\].*"); - - public ErrorsCommand(final Plugin plugin) - { - super(plugin); - } - - @Override - public void run(final IrcBot ircBot, final Player player) - { - BufferedReader page = null; - try - { - page = getServerLogReader(); - final StringBuilder input = new StringBuilder(); - do - { - final String line = page.readLine(); - if (line == null) - { - break; - } - else - { - if (!pattern.matcher(line).matches()) - { - input.append(line).append("\n"); - } - } - } - while (true); - page.close(); - final String message = "Errors: " + uploadToPastie(input); - player.sendMessage("§6" + ircBot.getNick() + ": §7" + message); - ircBot.sendMessage(message); - } - catch (IOException ex) - { - Bukkit.getLogger().log(Level.SEVERE, null, ex); - player.sendMessage(ex.getMessage()); - } - finally - { - try - { - if (page != null) - { - page.close(); - } - } - catch (IOException ex) - { - Bukkit.getLogger().log(Level.SEVERE, null, ex); - player.sendMessage(ex.getMessage()); - } - } - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/HelpCommand.java b/EssentialsUpdate/src/com/earth2me/essentials/update/chat/HelpCommand.java deleted file mode 100644 index a6f76cece..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/HelpCommand.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.earth2me.essentials.update.chat; - -import org.bukkit.entity.Player; - - -public class HelpCommand implements Command -{ - @Override - public void run(final IrcBot ircBot, final Player player) - { - player.sendMessage("Commands: (Note: Files send to the chat will be public viewable.)"); - player.sendMessage("!errors - Send the last server errors to the chat."); - player.sendMessage("!startup - Send the last startup messages to the chat."); - player.sendMessage("!config - Sends your Essentials config to the chat."); - player.sendMessage("!list - List all players in chat."); - player.sendMessage("!quit - Leave chat."); - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/IrcBot.java b/EssentialsUpdate/src/com/earth2me/essentials/update/chat/IrcBot.java deleted file mode 100644 index 31e9384ee..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/IrcBot.java +++ /dev/null @@ -1,198 +0,0 @@ -package com.earth2me.essentials.update.chat; - -import java.io.IOException; -import java.util.logging.Level; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.jibble.pircbot.Colors; -import org.jibble.pircbot.IrcException; -import org.jibble.pircbot.PircBot; -import org.jibble.pircbot.User; - - -public class IrcBot extends PircBot -{ - private static final String CHANNEL = "#essentials"; - private static final int PORT = 6667; - private static final String SERVER = "irc.esper.net"; - private transient boolean reconnect = true; - private final transient Player player; - private transient boolean kicked = false; - - public IrcBot(final Player player, final String nickName, final String versionString) - { - super(); - this.player = player; - setName(nickName); - setLogin("esshelp"); - setVersion(versionString); - connect(); - joinChannel(CHANNEL); - } - - private void connect() - { - try - { - connect(SERVER, PORT); - return; - } - catch (IOException ex) - { - Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex); - } - catch (IrcException ex) - { - Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex); - } - } - - public void quit() - { - reconnect = false; - disconnect(); - } - - @Override - protected void onConnect() - { - reconnect = true; - } - - @Override - protected void onDisconnect() - { - if (reconnect) - { - int tries = 10; - while (!isConnected()) - { - try - { - tries--; - reconnect(); - } - catch (Exception e) - { - Bukkit.getLogger().log(Level.WARNING, e.getMessage(), e); - try - { - Thread.sleep(10000); - } - catch (InterruptedException ex) - { - Bukkit.getLogger().log(Level.WARNING, e.getMessage(), e); - } - } - if (tries <= 0) - { - player.sendMessage("Connection lost to server."); - kicked = true; - break; - } - } - } - } - - @Override - protected void onKick(final String channel, final String kickerNick, - final String kickerLogin, final String kickerHostname, - final String recipientNick, final String reason) - { - if (recipientNick.equals(getNick())) - { - player.sendMessage("You have been kicked from the channel: " + reason); - quit(); - kicked = true; - } - } - - public boolean isKicked() - { - return kicked; - } - - @Override - protected void onMessage(final String channel, final String sender, - final String login, final String hostname, - final String message) - { - player.sendMessage(formatChatMessage(sender, message, false)); - } - - @Override - protected void onAction(final String sender, final String login, - final String hostname, final String target, - final String action) - { - player.sendMessage(formatChatMessage(sender, action, true)); - } - - @Override - protected void onNotice(final String sourceNick, final String sourceLogin, - final String sourceHostname, final String target, - final String notice) - { - player.sendMessage(formatChatMessage(sourceNick, notice, false)); - } - - @Override - protected void onTopic(final String channel, final String topic, - final String setBy, final long date, - final boolean changed) - { - player.sendMessage(formatChatMessage(channel, topic, false)); - } - - public String formatChatMessage(final String nick, final String message, final boolean action) - { - final StringBuilder builder = new StringBuilder(); - builder.append("§6"); - if (action) - { - builder.append('*'); - } - builder.append(nick); - if (!action) - { - builder.append(':'); - } - builder.append(" §7"); - builder.append(replaceColors(message)); - return builder.toString(); - } - - private String replaceColors(final String message) - { - String m = Colors.removeFormatting(message); - m = m.replaceAll("\u000310(,(0?[0-9]|1[0-5]))?", "§b"); - m = m.replaceAll("\u000311(,(0?[0-9]|1[0-5]))?", "§f"); - m = m.replaceAll("\u000312(,(0?[0-9]|1[0-5]))?", "§9"); - m = m.replaceAll("\u000313(,(0?[0-9]|1[0-5]))?", "§d"); - m = m.replaceAll("\u000314(,(0?[0-9]|1[0-5]))?", "§8"); - m = m.replaceAll("\u000315(,(0?[0-9]|1[0-5]))?", "§7"); - m = m.replaceAll("\u00030?1(,(0?[0-9]|1[0-5]))?", "§0"); - m = m.replaceAll("\u00030?2(,(0?[0-9]|1[0-5]))?", "§1"); - m = m.replaceAll("\u00030?3(,(0?[0-9]|1[0-5]))?", "§2"); - m = m.replaceAll("\u00030?4(,(0?[0-9]|1[0-5]))?", "§c"); - m = m.replaceAll("\u00030?5(,(0?[0-9]|1[0-5]))?", "§4"); - m = m.replaceAll("\u00030?6(,(0?[0-9]|1[0-5]))?", "§5"); - m = m.replaceAll("\u00030?7(,(0?[0-9]|1[0-5]))?", "§6"); - m = m.replaceAll("\u00030?8(,(0?[0-9]|1[0-5]))?", "§e"); - m = m.replaceAll("\u00030?9(,(0?[0-9]|1[0-5]))?", "§a"); - m = m.replaceAll("\u00030?0(,(0?[0-9]|1[0-5]))?", "§f"); - m = m.replace("\u000f", "§7"); - m = Colors.removeColors(m); - return m; - } - - public void sendMessage(final String message) - { - sendMessage(CHANNEL, message); - } - - public User[] getUsers() - { - return getUsers(CHANNEL); - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ListCommand.java b/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ListCommand.java deleted file mode 100644 index 9aa932efa..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ListCommand.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.earth2me.essentials.update.chat; - -import org.bukkit.entity.Player; -import org.jibble.pircbot.User; - - -public class ListCommand implements Command -{ - @Override - public void run(final IrcBot ircBot, final Player player) - { - final User[] members = ircBot.getUsers(); - final StringBuilder message = new StringBuilder(); - for (User user : members) - { - if (message.length() > 0) - { - message.append("§f, "); - } - if (user.isOp() || user.hasVoice()) - { - message.append("§6"); - } - else - { - message.append("§7"); - } - message.append(user.getPrefix()).append(user.getNick()); - } - player.sendMessage(message.toString()); - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/StartupCommand.java b/EssentialsUpdate/src/com/earth2me/essentials/update/chat/StartupCommand.java deleted file mode 100644 index f244d6e3a..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/StartupCommand.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.earth2me.essentials.update.chat; - -import java.io.BufferedReader; -import java.io.IOException; -import java.util.logging.Level; -import java.util.regex.Pattern; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - - -public class StartupCommand extends AbstractFileCommand implements Command -{ - private final transient Pattern patternStart = Pattern.compile("^[0-9 :-]+\\[INFO\\] Starting minecraft server version.*"); - private final transient Pattern patternEnd = Pattern.compile("^[0-9 :-]+\\[INFO\\] Done \\([0-9.,]+s\\)! For help, type \"help\".*"); - - public StartupCommand(final Plugin plugin) - { - super(plugin); - } - - @Override - public void run(final IrcBot ircBot, final Player player) - { - BufferedReader page = null; - try - { - page = getServerLogReader(); - final StringBuilder input = new StringBuilder(); - String line; - boolean log = false; - while ((line = page.readLine()) != null) - { - if (patternStart.matcher(line).matches()) - { - if (input.length() > 0) - { - input.delete(0, input.length()); - } - log = true; - } - if (log) - { - input.append(line).append("\n"); - } - if (patternEnd.matcher(line).matches()) - { - log = false; - } - } - page.close(); - final String message = "Startup: " + uploadToPastie(input); - player.sendMessage("§6" + ircBot.getNick() + ": §7" + message); - ircBot.sendMessage(message); - } - catch (IOException ex) - { - Bukkit.getLogger().log(Level.SEVERE, null, ex); - player.sendMessage(ex.getMessage()); - } - finally - { - try - { - if (page != null) - { - page.close(); - } - } - catch (IOException ex) - { - Bukkit.getLogger().log(Level.SEVERE, null, ex); - player.sendMessage(ex.getMessage()); - } - } - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/UsernameUtil.java b/EssentialsUpdate/src/com/earth2me/essentials/update/chat/UsernameUtil.java deleted file mode 100644 index 3df615652..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/UsernameUtil.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.earth2me.essentials.update.chat; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.bukkit.Bukkit; -import org.bukkit.Server; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - - -public final class UsernameUtil -{ - private static final Pattern CB_PATTERN = Pattern.compile("git-Bukkit-([0-9]+).([0-9]+).([0-9]+)-[0-9]+-[0-9a-z]+-b([0-9]+)jnks.*"); - - private UsernameUtil() - { - } - - public static String createUsername(final Player player) - { - final StringBuilder nameBuilder = new StringBuilder(); - final Server server = Bukkit.getServer(); - nameBuilder.append(player.getName()); - - addCraftBukkitVersion(server, nameBuilder); - addEssentialsVersion(server, nameBuilder); - addGroupManagerVersion(server, nameBuilder); - addPermissionsExVersion(server, nameBuilder); - addPermissionsBukkitVersion(server, nameBuilder); - addBPermissionsVersion(server, nameBuilder); - addPermissionsVersion(server, nameBuilder); - - return nameBuilder.toString(); - } - - private static void addPermissionsVersion(final Server server, final StringBuilder nameBuilder) - { - final Plugin perm = server.getPluginManager().getPlugin("Permissions"); - if (perm != null) - { - nameBuilder.append(" P"); - if (!perm.isEnabled()) - { - nameBuilder.append('!'); - } - nameBuilder.append(perm.getDescription().getVersion()); - } - } - - private static void addBPermissionsVersion(final Server server, final StringBuilder nameBuilder) - { - final Plugin bperm = server.getPluginManager().getPlugin("bPermissions"); - if (bperm != null) - { - nameBuilder.append(" BP"); - if (!bperm.isEnabled()) - { - nameBuilder.append('!'); - } - nameBuilder.append(bperm.getDescription().getVersion()); - } - } - - private static void addPermissionsBukkitVersion(final Server server, final StringBuilder nameBuilder) - { - final Plugin permb = server.getPluginManager().getPlugin("PermissionsBukkit"); - if (permb != null) - { - nameBuilder.append(" PB"); - if (!permb.isEnabled()) - { - nameBuilder.append('!'); - } - nameBuilder.append(permb.getDescription().getVersion()); - } - } - - private static void addPermissionsExVersion(final Server server, final StringBuilder nameBuilder) - { - final Plugin pex = server.getPluginManager().getPlugin("PermissionsEx"); - if (pex != null) - { - nameBuilder.append(" PEX"); - if (!pex.isEnabled()) - { - nameBuilder.append('!'); - } - nameBuilder.append(pex.getDescription().getVersion()); - } - } - - private static void addGroupManagerVersion(final Server server, final StringBuilder nameBuilder) - { - final Plugin groupManager = server.getPluginManager().getPlugin("GroupManager"); - if (groupManager != null) - { - nameBuilder.append(" GM"); - if (!groupManager.isEnabled()) - { - nameBuilder.append('!'); - } - } - } - - private static void addEssentialsVersion(final Server server, final StringBuilder nameBuilder) - { - final Plugin essentials = server.getPluginManager().getPlugin("Essentials"); - if (essentials != null) - { - nameBuilder.append(" ESS"); - nameBuilder.append(essentials.getDescription().getVersion()); - } - } - - private static void addCraftBukkitVersion(final Server server, final StringBuilder nameBuilder) - { - final Matcher versionMatch = CB_PATTERN.matcher(server.getVersion()); - if (versionMatch.matches()) - { - nameBuilder.append(" CB"); - nameBuilder.append(versionMatch.group(4)); - } - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java deleted file mode 100644 index 2c85c39fd..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.earth2me.essentials.update.states; - -import com.earth2me.essentials.update.AbstractWorkListener; -import org.bukkit.entity.Player; - - -public abstract class AbstractState -{ - private transient boolean abortion = false; - private final transient StateMap stateMap; - - public AbstractState(final StateMap stateMap) - { - this.stateMap = stateMap; - } - - public <T extends AbstractState> T getState(final Class<? extends T> stateClass) - { - if (!stateMap.containsKey(stateClass)) - { - try - { - final AbstractState state = stateClass.getConstructor(StateMap.class).newInstance(stateMap); - stateMap.put(stateClass, state); - } - catch (Exception ex) - { - /* - * This should never happen. All states, that are added to the map automatically, have to have a - * Constructor that accepts the StateMap. - */ - throw new RuntimeException(ex); - } - } - return (T)stateMap.get(stateClass); - } - - public abstract AbstractState getNextState(); - - /** - * Check if we already know the answer, so the user does not have to answer the question. - * - * @return true, if the answer could be guessed. - */ - public boolean guessAnswer() - { - return false; - } - - /** - * Ask the user the question. - * @param sender - */ - public abstract void askQuestion(Player sender); - - /** - * React on the answer and set internal variables - * @param answer - * @return true, if the answer could be recognized as a valid answer - */ - public abstract boolean reactOnAnswer(String answer); - - public final AbstractState reactOnAnswer(final Player sender, final String answer) - { - final String trimmedAnswer = answer.trim(); - if (trimmedAnswer.equalsIgnoreCase("quit") - || trimmedAnswer.equalsIgnoreCase("bye") - || trimmedAnswer.equalsIgnoreCase("abort") - || trimmedAnswer.equalsIgnoreCase("cancel") - || trimmedAnswer.equalsIgnoreCase("exit")) - { - abort(); - return null; - } - try - { - final boolean found = reactOnAnswer(trimmedAnswer); - if (found) - { - return getNextState(); - } - else - { - sender.sendMessage("Answer not recognized."); - return this; - } - } - catch (RuntimeException ex) - { - sender.sendMessage(ex.toString()); - return this; - } - } - - /** - * Do something based on the answer, that the user gave. - */ - public void doWork(final AbstractWorkListener listener) - { - listener.onWorkDone(); - } - - public boolean isAbortion() - { - return abortion; - } - - protected void abort() - { - abortion = true; - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractYesNoState.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractYesNoState.java deleted file mode 100644 index 67baf6bb6..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractYesNoState.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.earth2me.essentials.update.states; - - -public abstract class AbstractYesNoState extends AbstractState -{ - private boolean answer = false; - private final transient Class<? extends AbstractState> yesState; - private final transient Class<? extends AbstractState> noState; - - public AbstractYesNoState(final StateMap states, final Class<? extends AbstractState> nextState) - { - this(states, nextState, nextState); - } - - public AbstractYesNoState(final StateMap states, final Class<? extends AbstractState> yesState, final Class<? extends AbstractState> noState) - { - super(states); - this.yesState = yesState; - this.noState = noState; - } - - @Override - public AbstractState getNextState() - { - return answer - ? (yesState == null ? null : getState(yesState)) - : (noState == null ? null : getState(noState)); - } - - @Override - public boolean reactOnAnswer(final String answer) - { - if (answer.equalsIgnoreCase("yes") - || answer.equalsIgnoreCase("y")) - { - this.answer = true; - return true; - } - if (answer.equalsIgnoreCase("no") - || answer.equalsIgnoreCase("n")) - { - this.answer = false; - return true; - } - return false; - } - - public boolean getAnswer() - { - return answer; - } - - protected void setAnswer(final boolean answer) - { - this.answer = answer; - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AdvancedMode.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/AdvancedMode.java deleted file mode 100644 index 88d9efc4a..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AdvancedMode.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.earth2me.essentials.update.states; - -import org.bukkit.entity.Player; - - -public class AdvancedMode extends AbstractYesNoState -{ - public AdvancedMode(final StateMap states) - { - super(states, EssentialsChat.class); - } - - @Override - public void askQuestion(final Player sender) - { - sender.sendMessage("This installation mode has a lot of options."); - sender.sendMessage("Do you want use the advanced mode to see all questions?"); - sender.sendMessage("Otherwise the default values will be used."); - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/Changelog.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/Changelog.java deleted file mode 100644 index 10a4f33c5..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/Changelog.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.earth2me.essentials.update.states; - -import com.earth2me.essentials.update.UpdateCheck; -import com.earth2me.essentials.update.VersionInfo; -import java.util.List; -import org.bukkit.entity.Player; - - -public class Changelog extends AbstractState -{ - private static final int CHANGES_PER_PAGE = 5; - private transient int page = 0; - private transient boolean confirmed = false; - private transient final List<String> changes; - private transient final int pages; - - public Changelog(final StateMap stateMap) - { - super(stateMap); - changes = getChanges(); - pages = changes.size() / CHANGES_PER_PAGE + (changes.size() % CHANGES_PER_PAGE > 0 ? 1 : 0); - } - - @Override - public AbstractState getNextState() - { - return confirmed ? getState(EssentialsChat.class) : this; - } - - @Override - public boolean guessAnswer() - { - if (pages == 0) - { - confirmed = true; - } - return confirmed; - } - - private List<String> getChanges() - { - final UpdateCheck updateCheck = getState(UpdateOrInstallation.class).getUpdateCheck(); - final VersionInfo versionInfo = updateCheck.getNewVersionInfo(); - return versionInfo.getChangelog(); - } - - @Override - public void askQuestion(final Player sender) - { - if (pages > 1) - { - sender.sendMessage("Changelog, page " + page + " of " + pages + ":"); - } - else - { - sender.sendMessage("Changelog:"); - } - for (int i = page * CHANGES_PER_PAGE; i < Math.min(page * CHANGES_PER_PAGE + CHANGES_PER_PAGE, changes.size()); i++) - { - sender.sendMessage(changes.get(i)); - } - if (pages > 1) - { - sender.sendMessage("Select a page by typing the numbers 1 to " + pages + " to view all changes and then type confirm or abort."); - } - else - { - sender.sendMessage("Type confirm to update Essentials or abort to cancel the update."); - } - } - - @Override - public boolean reactOnAnswer(final String answer) - { - if (answer.equalsIgnoreCase("confirm")) - { - confirmed = true; - return true; - } - if (answer.matches("[0-9]+")) - { - final int page = Integer.parseInt(answer); - if (page <= pages && page > 0) - { - this.page = page - 1; - return true; - } - } - return false; - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChat.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChat.java deleted file mode 100644 index 6aaed634a..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChat.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.earth2me.essentials.update.states; - -import com.earth2me.essentials.update.AbstractWorkListener; -import com.earth2me.essentials.update.tasks.InstallModule; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - - -public class EssentialsChat extends AbstractYesNoState -{ - public EssentialsChat(final StateMap states) - { - super(states, EssentialsChatSettings.class, EssentialsSpawn.class); - } - - @Override - public boolean guessAnswer() - { - final Plugin plugin = Bukkit.getPluginManager().getPlugin("EssentialsChat"); - if (plugin != null) - { - setAnswer(true); - return true; - } - return false; - } - - @Override - public void askQuestion(final Player sender) - { - sender.sendMessage("Do you want to install EssentialsChat? (yes/no)"); - sender.sendMessage("EssentialsChat is a simple chat formatting plugin"); - sender.sendMessage("It allows you to make user prefixes and coloured text."); - } - - @Override - public void doWork(final AbstractWorkListener listener) - { - if (getAnswer()) - { - new InstallModule(listener, "EssentialsChat").start(); - return; - } - listener.onWorkDone(); - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChatSettings.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChatSettings.java deleted file mode 100644 index 6666ff371..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChatSettings.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.earth2me.essentials.update.states; - -import org.bukkit.entity.Player; - - -public class EssentialsChatSettings extends AbstractYesNoState -{ - public EssentialsChatSettings(final StateMap states) - { - super(states, EssentialsSpawn.class); - } - - @Override - public boolean guessAnswer() - { - if (getState(AdvancedMode.class).getAnswer()) - { - setAnswer(false); - return true; - } - return false; - } - - @Override - public void askQuestion(final Player sender) - { - sender.sendMessage("Would you like to configure EssentialsChat to prefix ingame messages with their group?"); - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsGeoIP.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsGeoIP.java deleted file mode 100644 index a91a44787..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsGeoIP.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.earth2me.essentials.update.states; - -import com.earth2me.essentials.update.AbstractWorkListener; -import com.earth2me.essentials.update.tasks.InstallModule; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - - -public class EssentialsGeoIP extends AbstractYesNoState -{ - public EssentialsGeoIP(final StateMap states) - { - super(states, null); - } - - @Override - public boolean guessAnswer() - { - final Plugin plugin = Bukkit.getPluginManager().getPlugin("EssentialsGeoIP"); - if (plugin != null) - { - setAnswer(true); - return true; - } - return false; - } - - @Override - public void askQuestion(final Player sender) - { - sender.sendMessage("Do you want to install EssentialsGeoIP? (yes/no)"); - sender.sendMessage("EssentialsGeoIP performs a IP lookup on joining players"); - sender.sendMessage("It allows you get a rough idea of where a player is from."); - } - - @Override - public void doWork(final AbstractWorkListener listener) - { - if (getAnswer()) - { - new InstallModule(listener, "EssentialsGeoIP").start(); - return; - } - listener.onWorkDone(); - } -}
\ No newline at end of file diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsProtect.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsProtect.java deleted file mode 100644 index ca0337d30..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsProtect.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.earth2me.essentials.update.states; - -import com.earth2me.essentials.update.AbstractWorkListener; -import com.earth2me.essentials.update.tasks.InstallModule; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - - -public class EssentialsProtect extends AbstractYesNoState -{ - public EssentialsProtect(final StateMap states) - { - super(states, null); - } - - @Override - public boolean guessAnswer() - { - final Plugin plugin = Bukkit.getPluginManager().getPlugin("EssentialsProtect"); - if (plugin != null) - { - setAnswer(true); - return true; - } - return false; - } - - @Override - public void askQuestion(final Player sender) - { - sender.sendMessage("Do you want to install EssentialsProtect? (yes/no)"); - sender.sendMessage("EssentialsProtect is a basic world protection system"); - sender.sendMessage("It allows you to set server wide rules, such as disabling creeper explosions, and preventing fire spread."); - } - - @Override - public void doWork(final AbstractWorkListener listener) - { - if (getAnswer()) - { - new InstallModule(listener, "EssentialsProtect").start(); - return; - } - listener.onWorkDone(); - } -}
\ No newline at end of file diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsSpawn.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsSpawn.java deleted file mode 100644 index 2a87638ba..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsSpawn.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.earth2me.essentials.update.states; - -import com.earth2me.essentials.update.AbstractWorkListener; -import com.earth2me.essentials.update.tasks.InstallModule; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - - -public class EssentialsSpawn extends AbstractYesNoState -{ - public EssentialsSpawn(final StateMap states) - { - super(states, null); - } - - @Override - public boolean guessAnswer() - { - final Plugin plugin = Bukkit.getPluginManager().getPlugin("EssentialsSpawn"); - if (plugin != null) - { - setAnswer(true); - return true; - } - return false; - } - - @Override - public void askQuestion(final Player sender) - { - sender.sendMessage("Do you want to install EssentialsSpawn? (yes/no)"); - sender.sendMessage("EssentialsSpawn lets you control player spawning"); - sender.sendMessage("It allows you to set different places where players spawn on death, new players join and allows players to return to spawn."); - } - - @Override - public void doWork(final AbstractWorkListener listener) - { - if (getAnswer()) - { - new InstallModule(listener, "EssentialsSpawn").start(); - return; - } - listener.onWorkDone(); - } -}
\ No newline at end of file diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java deleted file mode 100644 index 82d9ee627..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.earth2me.essentials.update.states; - -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - - -public class InstallationFinishedEvent extends Event -{ - public InstallationFinishedEvent() - { - super(); - } - - @Override - public HandlerList getHandlers() - { - throw new UnsupportedOperationException("Not supported yet."); - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java deleted file mode 100644 index 6ce926f92..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java +++ /dev/null @@ -1,183 +0,0 @@ -package com.earth2me.essentials.update.states; - -import com.earth2me.essentials.update.AbstractWorkListener; -import com.earth2me.essentials.update.UpdateCheck; -import java.util.Iterator; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - - -public class StateMachine extends AbstractWorkListener implements Runnable -{ - public enum MachineResult - { - ABORT, WAIT, DONE, NONE - } - private final transient StateMap states = new StateMap(); - private transient AbstractState current; - private transient Player player; - private transient MachineResult result = MachineResult.NONE; - - public StateMachine(final Plugin plugin, final Player player, final UpdateCheck updateCheck) - { - super(plugin, updateCheck.getNewVersionInfo()); - this.player = player; - states.clear(); - final UpdateOrInstallation state = new UpdateOrInstallation(states, updateCheck); - current = states.put(UpdateOrInstallation.class, state); - } - - public MachineResult askQuestion() - { - try - { - while (current.guessAnswer()) - { - current = current.getNextState(); - if (current == null) - { - result = MachineResult.DONE; - break; - } - } - if (current != null) - { - if (player.isOnline()) - { - current.askQuestion(player); - } - result = MachineResult.WAIT; - } - } - catch (RuntimeException ex) - { - player.sendMessage(ex.getMessage()); - finish(); - result = MachineResult.ABORT; - } - return result; - } - - public MachineResult reactOnMessage(final String message) - { - result = MachineResult.NONE; - final AbstractState next = current.reactOnAnswer(player, message); - if (next == null) - { - if (current.isAbortion()) - { - finish(); - result = MachineResult.ABORT; - } - else - { - result = MachineResult.DONE; - } - } - else - { - current = next; - askQuestion(); - } - return result; - } - private transient Iterator<AbstractState> iterator; - - public void startWork() - { - iterator = states.values().iterator(); - Bukkit.getScheduler().scheduleAsyncDelayedTask(getPlugin(), this); - } - - @Override - public void run() - { - if (!iterator.hasNext()) - { - Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() - { - @Override - public void run() - { - if (StateMachine.this.player.isOnline()) - { - StateMachine.this.player.sendMessage("Installation done. Reloading server."); - } - finish(); - Bukkit.getServer().reload(); - } - }); - return; - } - final AbstractState state = iterator.next(); - state.doWork(this); - } - - @Override - public void onWorkAbort(final String message) - { - finish(); - Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() - { - @Override - public void run() - { - if (message != null && !message.isEmpty() && StateMachine.this.player.isOnline()) - { - StateMachine.this.player.sendMessage(message); - } - } - }); - } - - @Override - public void onWorkDone(final String message) - { - Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() - { - @Override - public void run() - { - if (message != null && !message.isEmpty() && StateMachine.this.player.isOnline()) - { - StateMachine.this.player.sendMessage(message); - } - Bukkit.getScheduler().scheduleAsyncDelayedTask(getPlugin(), StateMachine.this); - } - }); - } - - private void finish() - { - current = null; - iterator = null; - states.clear(); - getPlugin().getServer().getPluginManager().callEvent(new InstallationFinishedEvent()); - } - - public void resumeInstallation(final Player player) - { - this.player = player; - if (result == MachineResult.WAIT) - { - if (current == null) - { - throw new RuntimeException("State is WAIT, but current state is null!"); - } - current.askQuestion(player); - } - if (result == MachineResult.DONE && iterator != null) - { - player.sendMessage("Installation is still running."); - } - if (result == MachineResult.ABORT) - { - throw new RuntimeException("Player should not be able to resume an aborted installation."); - } - if (result == MachineResult.NONE) - { - throw new RuntimeException("State machine in an undefined state."); - } - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMap.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMap.java deleted file mode 100644 index cca4223d6..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMap.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.earth2me.essentials.update.states; - -import java.util.LinkedHashMap; - - -public class StateMap extends LinkedHashMap<Class<? extends AbstractState>, AbstractState> -{ - public StateMap() - { - super(50); - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/UpdateOrInstallation.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/UpdateOrInstallation.java deleted file mode 100644 index 6b48f90be..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/UpdateOrInstallation.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.earth2me.essentials.update.states; - -import com.earth2me.essentials.update.UpdateCheck; -import org.bukkit.entity.Player; - - -public class UpdateOrInstallation extends AbstractState -{ - private final transient UpdateCheck updateCheck; - private transient boolean update = false; - - public UpdateOrInstallation(final StateMap stateMap, final UpdateCheck updateCheck) - { - super(stateMap); - this.updateCheck = updateCheck; - } - - @Override - public boolean guessAnswer() - { - if (getUpdateCheck().isEssentialsInstalled()) - { - update = true; - } - return update; - } - - @Override - public AbstractState getNextState() - { - return update ? getState(Changelog.class) : getState(EssentialsChat.class); - } - - @Override - public void askQuestion(final Player sender) - { - sender.sendMessage("Thank you for choosing Essentials."); - sender.sendMessage("The following installation wizard will guide you through the installation of Essentials."); - sender.sendMessage("Your answers will be saved for a later update."); - sender.sendMessage("Please answer the messages with yes or no, if not otherwise stated."); - sender.sendMessage("Write bye/exit/quit if you want to exit the wizard at anytime."); - sender.sendMessage("Type ok to continue..."); - } - - @Override - public boolean reactOnAnswer(final String answer) - { - return answer.equalsIgnoreCase("ok") || answer.equalsIgnoreCase("k") || answer.equalsIgnoreCase("continue"); - } - - public UpdateCheck getUpdateCheck() - { - return updateCheck; - } - - public boolean isUpdate() - { - return update; - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/InstallModule.java b/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/InstallModule.java deleted file mode 100644 index 778f5172f..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/InstallModule.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.earth2me.essentials.update.tasks; - -import com.earth2me.essentials.update.AbstractWorkListener; -import com.earth2me.essentials.update.GetFile; -import com.earth2me.essentials.update.ModuleInfo; -import com.earth2me.essentials.update.VersionInfo; -import java.io.File; -import java.net.URL; -import java.util.logging.Level; -import org.bukkit.Bukkit; - - -public class InstallModule implements Runnable, Task -{ - protected final transient AbstractWorkListener listener; - private final transient String moduleName; - private final transient String fileName; - - public InstallModule(final AbstractWorkListener listener, final String moduleName) - { - this(listener, moduleName, moduleName + ".jar"); - } - - public InstallModule(final AbstractWorkListener listener, final String moduleName, final String fileName) - { - this.listener = listener; - this.moduleName = moduleName; - this.fileName = fileName; - } - - @Override - public void start() - { - Bukkit.getScheduler().scheduleAsyncDelayedTask(listener.getPlugin(), this); - } - - @Override - public void run() - { - final VersionInfo info = listener.getNewVersionInfo(); - final ModuleInfo module = info.getModules().get(moduleName); - if (module == null) - { - listener.onWorkAbort("Module " + moduleName + " not found in VersionInfo."); - return; - } - try - { - final URL downloadUrl = module.getUrl(); - final GetFile getFile = new GetFile(downloadUrl); - getFile.saveTo(new File(listener.getPlugin().getServer().getUpdateFolderFile(), fileName), module.getHash()); - listener.onWorkDone("Module " + moduleName + " downloaded."); - } - catch (Exception ex) - { - Bukkit.getLogger().log(Level.SEVERE, "Failed to download module " + moduleName + " to " + fileName, ex); - listener.onWorkAbort("An error occured, please check your server log."); - return; - } - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/SelfUpdate.java b/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/SelfUpdate.java deleted file mode 100644 index 3baf86be7..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/SelfUpdate.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.earth2me.essentials.update.tasks; - -import com.earth2me.essentials.update.AbstractWorkListener; -import org.bukkit.Bukkit; - - -public class SelfUpdate extends AbstractWorkListener implements Task, Runnable -{ - private final transient AbstractWorkListener listener; - - public SelfUpdate(final AbstractWorkListener listener) - { - super(listener.getPlugin(), listener.getNewVersionInfo()); - this.listener = listener; - } - - @Override - public void onWorkAbort(final String message) - { - listener.onWorkAbort(message); - } - - @Override - public void onWorkDone(final String message) - { - listener.onWorkDone(message); - Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() - { - @Override - public void run() - { - Bukkit.getServer().reload(); - } - }); - } - - @Override - public void start() - { - Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), this); - } - - @Override - public void run() - { - Bukkit.getScheduler().scheduleAsyncDelayedTask(getPlugin(), new Runnable() - { - @Override - public void run() - { - new InstallModule(SelfUpdate.this, "EssentialsUpdate").start(); - } - }); - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/Task.java b/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/Task.java deleted file mode 100644 index 3f1d572ed..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/Task.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.earth2me.essentials.update.tasks; - - -public interface Task -{ - void start(); -} diff --git a/EssentialsUpdate/src/org/jibble/pircbot/Colors.java b/EssentialsUpdate/src/org/jibble/pircbot/Colors.java deleted file mode 100755 index c763cba22..000000000 --- a/EssentialsUpdate/src/org/jibble/pircbot/Colors.java +++ /dev/null @@ -1,293 +0,0 @@ -/* -Copyright Paul James Mutton, 2001-2009, http://www.jibble.org/ - -This file is part of PircBot. - -This software is dual-licensed, allowing you to choose between the GNU -General Public License (GPL) and the www.jibble.org Commercial License. -Since the GPL may be too restrictive for use in a proprietary application, -a commercial license is also provided. Full license information can be -found at http://www.jibble.org/licenses/ - -*/ - - -package org.jibble.pircbot; - -/** - * The Colors class provides several static fields and methods that you may - * find useful when writing an IRC Bot. - * <p> - * This class contains constants that are useful for formatting lines - * sent to IRC servers. These constants allow you to apply various - * formatting to the lines, such as colours, boldness, underlining - * and reverse text. - * <p> - * The class contains static methods to remove colours and formatting - * from lines of IRC text. - * <p> - * Here are some examples of how to use the contants from within a - * class that extends PircBot and imports org.jibble.pircbot.*; - * - * <pre> sendMessage("#cs", Colors.BOLD + "A bold hello!"); - * <b>A bold hello!</b> - * sendMessage("#cs", Colors.RED + "Red" + Colors.NORMAL + " text"); - * <font color="red">Red</font> text - * sendMessage("#cs", Colors.BOLD + Colors.RED + "Bold and red"); - * <b><font color="red">Bold and red</font></b></pre> - * - * Please note that some IRC channels may be configured to reject any - * messages that use colours. Also note that older IRC clients may be - * unable to correctly display lines that contain colours and other - * control characters. - * <p> - * Note that this class name has been spelt in the American style in - * order to remain consistent with the rest of the Java API. - * - * - * @since 0.9.12 - * @author Paul James Mutton, - * <a href="http://www.jibble.org/">http://www.jibble.org/</a> - * @version 1.5.0 (Build time: Mon Dec 14 20:07:17 2009) - */ -public class Colors { - - - /** - * Removes all previously applied color and formatting attributes. - */ - public static final String NORMAL = "\u000f"; - - - /** - * Bold text. - */ - public static final String BOLD = "\u0002"; - - - /** - * Underlined text. - */ - public static final String UNDERLINE = "\u001f"; - - - /** - * Reversed text (may be rendered as italic text in some clients). - */ - public static final String REVERSE = "\u0016"; - - - /** - * White coloured text. - */ - public static final String WHITE = "\u000300"; - - - /** - * Black coloured text. - */ - public static final String BLACK = "\u000301"; - - - /** - * Dark blue coloured text. - */ - public static final String DARK_BLUE = "\u000302"; - - - /** - * Dark green coloured text. - */ - public static final String DARK_GREEN = "\u000303"; - - - /** - * Red coloured text. - */ - public static final String RED = "\u000304"; - - - /** - * Brown coloured text. - */ - public static final String BROWN = "\u000305"; - - - /** - * Purple coloured text. - */ - public static final String PURPLE = "\u000306"; - - - /** - * Olive coloured text. - */ - public static final String OLIVE = "\u000307"; - - - /** - * Yellow coloured text. - */ - public static final String YELLOW = "\u000308"; - - - /** - * Green coloured text. - */ - public static final String GREEN = "\u000309"; - - - /** - * Teal coloured text. - */ - public static final String TEAL = "\u000310"; - - - /** - * Cyan coloured text. - */ - public static final String CYAN = "\u000311"; - - - /** - * Blue coloured text. - */ - public static final String BLUE = "\u000312"; - - - /** - * Magenta coloured text. - */ - public static final String MAGENTA = "\u000313"; - - - /** - * Dark gray coloured text. - */ - public static final String DARK_GRAY = "\u000314"; - - - /** - * Light gray coloured text. - */ - public static final String LIGHT_GRAY = "\u000315"; - - - /** - * This class should not be constructed. - */ - private Colors() { - - } - - - /** - * Removes all colours from a line of IRC text. - * - * @since PircBot 1.2.0 - * - * @param line the input text. - * - * @return the same text, but with all colours removed. - */ - public static String removeColors(String line) { - int length = line.length(); - StringBuffer buffer = new StringBuffer(); - int i = 0; - while (i < length) { - char ch = line.charAt(i); - if (ch == '\u0003') { - i++; - // Skip "x" or "xy" (foreground color). - if (i < length) { - ch = line.charAt(i); - if (Character.isDigit(ch)) { - i++; - if (i < length) { - ch = line.charAt(i); - if (Character.isDigit(ch)) { - i++; - } - } - // Now skip ",x" or ",xy" (background color). - if (i < length) { - ch = line.charAt(i); - if (ch == ',') { - i++; - if (i < length) { - ch = line.charAt(i); - if (Character.isDigit(ch)) { - i++; - if (i < length) { - ch = line.charAt(i); - if (Character.isDigit(ch)) { - i++; - } - } - } - else { - // Keep the comma. - i--; - } - } - else { - // Keep the comma. - i--; - } - } - } - } - } - } - else if (ch == '\u000f') { - i++; - } - else { - buffer.append(ch); - i++; - } - } - return buffer.toString(); - } - - - /** - * Remove formatting from a line of IRC text. - * - * @since PircBot 1.2.0 - * - * @param line the input text. - * - * @return the same text, but without any bold, underlining, reverse, etc. - */ - public static String removeFormatting(String line) { - int length = line.length(); - StringBuffer buffer = new StringBuffer(); - for (int i = 0; i < length; i++) { - char ch = line.charAt(i); - if (ch == '\u000f' || ch == '\u0002' || ch == '\u001f' || ch == '\u0016') { - // Don't add this character. - } - else { - buffer.append(ch); - } - } - return buffer.toString(); - } - - - /** - * Removes all formatting and colours from a line of IRC text. - * - * @since PircBot 1.2.0 - * - * @param line the input text. - * - * @return the same text, but without formatting and colour characters. - * - */ - public static String removeFormattingAndColors(String line) { - return removeFormatting(removeColors(line)); - } - -} diff --git a/EssentialsUpdate/src/org/jibble/pircbot/InputThread.java b/EssentialsUpdate/src/org/jibble/pircbot/InputThread.java deleted file mode 100755 index a24815210..000000000 --- a/EssentialsUpdate/src/org/jibble/pircbot/InputThread.java +++ /dev/null @@ -1,169 +0,0 @@ -/* -Copyright Paul James Mutton, 2001-2009, http://www.jibble.org/ - -This file is part of PircBot. - -This software is dual-licensed, allowing you to choose between the GNU -General Public License (GPL) and the www.jibble.org Commercial License. -Since the GPL may be too restrictive for use in a proprietary application, -a commercial license is also provided. Full license information can be -found at http://www.jibble.org/licenses/ - -*/ - - -package org.jibble.pircbot; - -import java.io.*; -import java.net.Socket; -import java.util.StringTokenizer; - -/** - * A Thread which reads lines from the IRC server. It then - * passes these lines to the PircBot without changing them. - * This running Thread also detects disconnection from the server - * and is thus used by the OutputThread to send lines to the server. - * - * @author Paul James Mutton, - * <a href="http://www.jibble.org/">http://www.jibble.org/</a> - * @version 1.5.0 (Build time: Mon Dec 14 20:07:17 2009) - */ -public class InputThread extends Thread { - - /** - * The InputThread reads lines from the IRC server and allows the - * PircBot to handle them. - * - * @param bot An instance of the underlying PircBot. - * @param breader The BufferedReader that reads lines from the server. - * @param bwriter The BufferedWriter that sends lines to the server. - */ - InputThread(PircBot bot, Socket socket, BufferedReader breader, BufferedWriter bwriter) { - _bot = bot; - _socket = socket; - _breader = breader; - _bwriter = bwriter; - this.setName(this.getClass() + "-Thread"); - } - - - /** - * Sends a raw line to the IRC server as soon as possible, bypassing the - * outgoing message queue. - * - * @param line The raw line to send to the IRC server. - */ - void sendRawLine(String line) { - OutputThread.sendRawLine(_bot, _bwriter, line); - } - - - /** - * Returns true if this InputThread is connected to an IRC server. - * The result of this method should only act as a rough guide, - * as the result may not be valid by the time you act upon it. - * - * @return True if still connected. - */ - boolean isConnected() { - return _isConnected; - } - - - /** - * Called to start this Thread reading lines from the IRC server. - * When a line is read, this method calls the handleLine method - * in the PircBot, which may subsequently call an 'onXxx' method - * in the PircBot subclass. If any subclass of Throwable (i.e. - * any Exception or Error) is thrown by your method, then this - * method will print the stack trace to the standard output. It - * is probable that the PircBot may still be functioning normally - * after such a problem, but the existance of any uncaught exceptions - * in your code is something you should really fix. - */ - public void run() { - try { - boolean running = true; - while (running) { - try { - String line = null; - while ((line = _breader.readLine()) != null) { - try { - _bot.handleLine(line); - } - catch (Throwable t) { - // Stick the whole stack trace into a String so we can output it nicely. - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - t.printStackTrace(pw); - pw.flush(); - StringTokenizer tokenizer = new StringTokenizer(sw.toString(), "\r\n"); - synchronized (_bot) { - _bot.log("### Your implementation of PircBot is faulty and you have"); - _bot.log("### allowed an uncaught Exception or Error to propagate in your"); - _bot.log("### code. It may be possible for PircBot to continue operating"); - _bot.log("### normally. Here is the stack trace that was produced: -"); - _bot.log("### "); - while (tokenizer.hasMoreTokens()) { - _bot.log("### " + tokenizer.nextToken()); - } - } - } - } - if (line == null) { - // The server must have disconnected us. - running = false; - } - } - catch (InterruptedIOException iioe) { - // This will happen if we haven't received anything from the server for a while. - // So we shall send it a ping to check that we are still connected. - this.sendRawLine("PING " + (System.currentTimeMillis() / 1000)); - // Now we go back to listening for stuff from the server... - } - } - } - catch (Exception e) { - // Do nothing. - } - - // If we reach this point, then we must have disconnected. - try { - _socket.close(); - } - catch (Exception e) { - // Just assume the socket was already closed. - } - - if (!_disposed) { - _bot.log("*** Disconnected."); - _isConnected = false; - _bot.onDisconnect(); - } - - } - - - /** - * Closes the socket without onDisconnect being called subsequently. - */ - public void dispose () { - try { - _disposed = true; - _socket.close(); - } - catch (Exception e) { - // Do nothing. - } - } - - private PircBot _bot = null; - private Socket _socket = null; - private BufferedReader _breader = null; - private BufferedWriter _bwriter = null; - private boolean _isConnected = true; - private boolean _disposed = false; - - public static final int MAX_LINE_LENGTH = 512; - -} diff --git a/EssentialsUpdate/src/org/jibble/pircbot/IrcException.java b/EssentialsUpdate/src/org/jibble/pircbot/IrcException.java deleted file mode 100755 index d07d8a956..000000000 --- a/EssentialsUpdate/src/org/jibble/pircbot/IrcException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright Paul James Mutton, 2001-2009, http://www.jibble.org/ - -This file is part of PircBot. - -This software is dual-licensed, allowing you to choose between the GNU -General Public License (GPL) and the www.jibble.org Commercial License. -Since the GPL may be too restrictive for use in a proprietary application, -a commercial license is also provided. Full license information can be -found at http://www.jibble.org/licenses/ - -*/ - -package org.jibble.pircbot; - -/** - * An IrcException class. - * - * @since 0.9 - * @author Paul James Mutton, - * <a href="http://www.jibble.org/">http://www.jibble.org/</a> - * @version 1.5.0 (Build time: Mon Dec 14 20:07:17 2009) - */ -public class IrcException extends Exception { - - /** - * Constructs a new IrcException. - * - * @param e The error message to report. - */ - public IrcException(String e) { - super(e); - } - -} diff --git a/EssentialsUpdate/src/org/jibble/pircbot/NickAlreadyInUseException.java b/EssentialsUpdate/src/org/jibble/pircbot/NickAlreadyInUseException.java deleted file mode 100755 index 33887be34..000000000 --- a/EssentialsUpdate/src/org/jibble/pircbot/NickAlreadyInUseException.java +++ /dev/null @@ -1,38 +0,0 @@ -/* -Copyright Paul James Mutton, 2001-2009, http://www.jibble.org/ - -This file is part of PircBot. - -This software is dual-licensed, allowing you to choose between the GNU -General Public License (GPL) and the www.jibble.org Commercial License. -Since the GPL may be too restrictive for use in a proprietary application, -a commercial license is also provided. Full license information can be -found at http://www.jibble.org/licenses/ - -*/ - - -package org.jibble.pircbot; - -/** - * A NickAlreadyInUseException class. This exception is - * thrown when the PircBot attempts to join an IRC server - * with a user name that is already in use. - * - * @since 0.9 - * @author Paul James Mutton, - * <a href="http://www.jibble.org/">http://www.jibble.org/</a> - * @version 1.5.0 (Build time: Mon Dec 14 20:07:17 2009) - */ -public class NickAlreadyInUseException extends IrcException { - - /** - * Constructs a new IrcException. - * - * @param e The error message to report. - */ - public NickAlreadyInUseException(String e) { - super(e); - } - -} diff --git a/EssentialsUpdate/src/org/jibble/pircbot/OutputThread.java b/EssentialsUpdate/src/org/jibble/pircbot/OutputThread.java deleted file mode 100755 index 7eddee873..000000000 --- a/EssentialsUpdate/src/org/jibble/pircbot/OutputThread.java +++ /dev/null @@ -1,104 +0,0 @@ -/* -Copyright Paul James Mutton, 2001-2009, http://www.jibble.org/ - -This file is part of PircBot. - -This software is dual-licensed, allowing you to choose between the GNU -General Public License (GPL) and the www.jibble.org Commercial License. -Since the GPL may be too restrictive for use in a proprietary application, -a commercial license is also provided. Full license information can be -found at http://www.jibble.org/licenses/ - -*/ - - -package org.jibble.pircbot; - -import java.io.BufferedWriter; - -/** - * A Thread which is responsible for sending messages to the IRC server. - * Messages are obtained from the outgoing message queue and sent - * immediately if possible. If there is a flood of messages, then to - * avoid getting kicked from a channel, we put a small delay between - * each one. - * - * @author Paul James Mutton, - * <a href="http://www.jibble.org/">http://www.jibble.org/</a> - * @version 1.5.0 (Build time: Mon Dec 14 20:07:17 2009) - */ -public class OutputThread extends Thread { - - - /** - * Constructs an OutputThread for the underlying PircBot. All messages - * sent to the IRC server are sent by this OutputThread to avoid hammering - * the server. Messages are sent immediately if possible. If there are - * multiple messages queued, then there is a delay imposed. - * - * @param bot The underlying PircBot instance. - * @param outQueue The Queue from which we will obtain our messages. - */ - OutputThread(PircBot bot, Queue outQueue) { - _bot = bot; - _outQueue = outQueue; - this.setName(this.getClass() + "-Thread"); - } - - - /** - * A static method to write a line to a BufferedOutputStream and then pass - * the line to the log method of the supplied PircBot instance. - * - * @param bot The underlying PircBot instance. - * @param out The BufferedOutputStream to write to. - * @param line The line to be written. "\r\n" is appended to the end. - * @param encoding The charset to use when encoing this string into a - * byte array. - */ - static void sendRawLine(PircBot bot, BufferedWriter bwriter, String line) { - if (line.length() > bot.getMaxLineLength() - 2) { - line = line.substring(0, bot.getMaxLineLength() - 2); - } - synchronized(bwriter) { - try { - bwriter.write(line + "\r\n"); - bwriter.flush(); - bot.log(">>>" + line); - } - catch (Exception e) { - // Silent response - just lose the line. - } - } - } - - - /** - * This method starts the Thread consuming from the outgoing message - * Queue and sending lines to the server. - */ - public void run() { - try { - boolean running = true; - while (running) { - // Small delay to prevent spamming of the channel - Thread.sleep(_bot.getMessageDelay()); - - String line = (String) _outQueue.next(); - if (line != null) { - _bot.sendRawLine(line); - } - else { - running = false; - } - } - } - catch (InterruptedException e) { - // Just let the method return naturally... - } - } - - private PircBot _bot = null; - private Queue _outQueue = null; - -} diff --git a/EssentialsUpdate/src/org/jibble/pircbot/PircBot.java b/EssentialsUpdate/src/org/jibble/pircbot/PircBot.java deleted file mode 100755 index 28148075f..000000000 --- a/EssentialsUpdate/src/org/jibble/pircbot/PircBot.java +++ /dev/null @@ -1,2809 +0,0 @@ -/* -Copyright Paul James Mutton, 2001-2009, http://www.jibble.org/ - -This file is part of PircBot. - -This software is dual-licensed, allowing you to choose between the GNU -General Public License (GPL) and the www.jibble.org Commercial License. -Since the GPL may be too restrictive for use in a proprietary application, -a commercial license is also provided. Full license information can be -found at http://www.jibble.org/licenses/ - -*/ - - -package org.jibble.pircbot; - -import java.io.*; -import java.net.InetAddress; -import java.net.Socket; -import java.util.*; - -/** - * PircBot is a Java framework for writing IRC bots quickly and easily. - * <p> - * It provides an event-driven architecture to handle common IRC - * events, flood protection, DCC support, ident support, and more. - * The comprehensive logfile format is suitable for use with pisg to generate - * channel statistics. - * <p> - * Methods of the PircBot class can be called to send events to the IRC server - * that it connects to. For example, calling the sendMessage method will - * send a message to a channel or user on the IRC server. Multiple servers - * can be supported using multiple instances of PircBot. - * <p> - * To perform an action when the PircBot receives a normal message from the IRC - * server, you would override the onMessage method defined in the PircBot - * class. All on<i>XYZ</i> methods in the PircBot class are automatically called - * when the event <i>XYZ</i> happens, so you would override these if you wish - * to do something when it does happen. - * <p> - * Some event methods, such as onPing, should only really perform a specific - * function (i.e. respond to a PING from the server). For your convenience, such - * methods are already correctly implemented in the PircBot and should not - * normally need to be overridden. Please read the full documentation for each - * method to see which ones are already implemented by the PircBot class. - * <p> - * Please visit the PircBot homepage at - * <a href="http://www.jibble.org/pircbot.php">http://www.jibble.org/pircbot.php</a> - * for full revision history, a beginners guide to creating your first PircBot - * and a list of some existing Java IRC bots and clients that use the PircBot - * framework. - * - * @author Paul James Mutton, - * <a href="http://www.jibble.org/">http://www.jibble.org/</a> - * @version 1.5.0 (Build time: Mon Dec 14 20:07:17 2009) - */ -public abstract class PircBot implements ReplyConstants { - - - /** - * The definitive version number of this release of PircBot. - * (Note: Change this before automatically building releases) - */ - public static final String VERSION = "1.5.0"; - - - private static final int OP_ADD = 1; - private static final int OP_REMOVE = 2; - private static final int VOICE_ADD = 3; - private static final int VOICE_REMOVE = 4; - - - /** - * Constructs a PircBot with the default settings. Your own constructors - * in classes which extend the PircBot abstract class should be responsible - * for changing the default settings if required. - */ - public PircBot() {} - - - /** - * Attempt to connect to the specified IRC server. - * The onConnect method is called upon success. - * - * @param hostname The hostname of the server to connect to. - * - * @throws IOException if it was not possible to connect to the server. - * @throws IrcException if the server would not let us join it. - * @throws NickAlreadyInUseException if our nick is already in use on the server. - */ - public final synchronized void connect(String hostname) throws IOException, IrcException, NickAlreadyInUseException { - this.connect(hostname, 6667, null); - } - - - /** - * Attempt to connect to the specified IRC server and port number. - * The onConnect method is called upon success. - * - * @param hostname The hostname of the server to connect to. - * @param port The port number to connect to on the server. - * - * @throws IOException if it was not possible to connect to the server. - * @throws IrcException if the server would not let us join it. - * @throws NickAlreadyInUseException if our nick is already in use on the server. - */ - public final synchronized void connect(String hostname, int port) throws IOException, IrcException, NickAlreadyInUseException { - this.connect(hostname, port, null); - } - - - /** - * Attempt to connect to the specified IRC server using the supplied - * password. - * The onConnect method is called upon success. - * - * @param hostname The hostname of the server to connect to. - * @param port The port number to connect to on the server. - * @param password The password to use to join the server. - * - * @throws IOException if it was not possible to connect to the server. - * @throws IrcException if the server would not let us join it. - * @throws NickAlreadyInUseException if our nick is already in use on the server. - */ - public final synchronized void connect(String hostname, int port, String password) throws IOException, IrcException, NickAlreadyInUseException { - - _server = hostname; - _port = port; - _password = password; - - if (isConnected()) { - throw new IOException("The PircBot is already connected to an IRC server. Disconnect first."); - } - - // Don't clear the outqueue - there might be something important in it! - - // Clear everything we may have know about channels. - this.removeAllChannels(); - - // Connect to the server. - Socket socket = new Socket(hostname, port); - this.log("*** Connected to server."); - - _inetAddress = socket.getLocalAddress(); - - InputStreamReader inputStreamReader = null; - OutputStreamWriter outputStreamWriter = null; - if (getEncoding() != null) { - // Assume the specified encoding is valid for this JVM. - inputStreamReader = new InputStreamReader(socket.getInputStream(), getEncoding()); - outputStreamWriter = new OutputStreamWriter(socket.getOutputStream(), getEncoding()); - } - else { - // Otherwise, just use the JVM's default encoding. - inputStreamReader = new InputStreamReader(socket.getInputStream()); - outputStreamWriter = new OutputStreamWriter(socket.getOutputStream()); - } - - BufferedReader breader = new BufferedReader(inputStreamReader); - BufferedWriter bwriter = new BufferedWriter(outputStreamWriter); - - // Attempt to join the server. - if (password != null && !password.equals("")) { - OutputThread.sendRawLine(this, bwriter, "PASS " + password); - } - String nick = this.getName(); - OutputThread.sendRawLine(this, bwriter, "NICK " + nick); - OutputThread.sendRawLine(this, bwriter, "USER " + this.getLogin() + " 8 * :" + this.getVersion()); - - _inputThread = new InputThread(this, socket, breader, bwriter); - - // Read stuff back from the server to see if we connected. - String line = null; - int tries = 1; - while ((line = breader.readLine()) != null) { - - this.handleLine(line); - - int firstSpace = line.indexOf(" "); - int secondSpace = line.indexOf(" ", firstSpace + 1); - if (secondSpace >= 0) { - String code = line.substring(firstSpace + 1, secondSpace); - - if (code.equals("004")) { - // We're connected to the server. - break; - } - else if (code.equals("433")) { - if (_autoNickChange) { - tries++; - nick = getName() + tries; - OutputThread.sendRawLine(this, bwriter, "NICK " + nick); - } - else { - socket.close(); - _inputThread = null; - throw new NickAlreadyInUseException(line); - } - } - else if (code.equals("439")) { - // No action required. - } - else if (code.startsWith("5") || code.startsWith("4")) { - socket.close(); - _inputThread = null; - throw new IrcException("Could not log into the IRC server: " + line); - } - } - this.setNick(nick); - - } - - this.log("*** Logged onto server."); - - // This makes the socket timeout on read operations after 5 minutes. - // Maybe in some future version I will let the user change this at runtime. - socket.setSoTimeout(5 * 60 * 1000); - - // Now start the InputThread to read all other lines from the server. - _inputThread.start(); - - // Now start the outputThread that will be used to send all messages. - if (_outputThread == null) { - _outputThread = new OutputThread(this, _outQueue); - _outputThread.start(); - } - - this.onConnect(); - - } - - - /** - * Reconnects to the IRC server that we were previously connected to. - * If necessary, the appropriate port number and password will be used. - * This method will throw an IrcException if we have never connected - * to an IRC server previously. - * - * @since PircBot 0.9.9 - * - * @throws IOException if it was not possible to connect to the server. - * @throws IrcException if the server would not let us join it. - * @throws NickAlreadyInUseException if our nick is already in use on the server. - */ - public final synchronized void reconnect() throws IOException, IrcException, NickAlreadyInUseException{ - if (getServer() == null) { - throw new IrcException("Cannot reconnect to an IRC server because we were never connected to one previously!"); - } - connect(getServer(), getPort(), getPassword()); - } - - - /** - * This method disconnects from the server cleanly by calling the - * quitServer() method. Providing the PircBot was connected to an - * IRC server, the onDisconnect() will be called as soon as the - * disconnection is made by the server. - * - * @see #quitServer() quitServer - * @see #quitServer(String) quitServer - */ - public final synchronized void disconnect() { - this.quitServer(); - } - - - /** - * When you connect to a server and your nick is already in use and - * this is set to true, a new nick will be automatically chosen. - * This is done by adding numbers to the end of the nick until an - * available nick is found. - * - * @param autoNickChange Set to true if you want automatic nick changes - * during connection. - */ - public void setAutoNickChange(boolean autoNickChange) { - _autoNickChange = autoNickChange; - } - - /** - * Joins a channel. - * - * @param channel The name of the channel to join (eg "#cs"). - */ - public final void joinChannel(String channel) { - this.sendRawLine("JOIN " + channel); - } - - - /** - * Joins a channel with a key. - * - * @param channel The name of the channel to join (eg "#cs"). - * @param key The key that will be used to join the channel. - */ - public final void joinChannel(String channel, String key) { - this.joinChannel(channel + " " + key); - } - - - /** - * Parts a channel. - * - * @param channel The name of the channel to leave. - */ - public final void partChannel(String channel) { - this.sendRawLine("PART " + channel); - } - - - /** - * Parts a channel, giving a reason. - * - * @param channel The name of the channel to leave. - * @param reason The reason for parting the channel. - */ - public final void partChannel(String channel, String reason) { - this.sendRawLine("PART " + channel + " :" + reason); - } - - - /** - * Quits from the IRC server. - * Providing we are actually connected to an IRC server, the - * onDisconnect() method will be called as soon as the IRC server - * disconnects us. - */ - public final void quitServer() { - this.quitServer(""); - } - - - /** - * Quits from the IRC server with a reason. - * Providing we are actually connected to an IRC server, the - * onDisconnect() method will be called as soon as the IRC server - * disconnects us. - * - * @param reason The reason for quitting the server. - */ - public final void quitServer(String reason) { - this.sendRawLine("QUIT :" + reason); - } - - - /** - * Sends a raw line to the IRC server as soon as possible, bypassing the - * outgoing message queue. - * - * @param line The raw line to send to the IRC server. - */ - public final synchronized void sendRawLine(String line) { - if (isConnected()) { - _inputThread.sendRawLine(line); - } - } - - /** - * Sends a raw line through the outgoing message queue. - * - * @param line The raw line to send to the IRC server. - */ - public final synchronized void sendRawLineViaQueue(String line) { - if (line == null) { - throw new NullPointerException("Cannot send null messages to server"); - } - if (isConnected()) { - _outQueue.add(line); - } - } - - - /** - * Sends a message to a channel or a private message to a user. These - * messages are added to the outgoing message queue and sent at the - * earliest possible opportunity. - * <p> - * Some examples: - - * <pre> // Send the message "Hello!" to the channel #cs. - * sendMessage("#cs", "Hello!"); - * - * // Send a private message to Paul that says "Hi". - * sendMessage("Paul", "Hi");</pre> - * - * You may optionally apply colours, boldness, underlining, etc to - * the message by using the <code>Colors</code> class. - * - * @param target The name of the channel or user nick to send to. - * @param message The message to send. - * - * @see Colors - */ - public final void sendMessage(String target, String message) { - _outQueue.add("PRIVMSG " + target + " :" + message); - } - - - /** - * Sends an action to the channel or to a user. - * - * @param target The name of the channel or user nick to send to. - * @param action The action to send. - * - * @see Colors - */ - public final void sendAction(String target, String action) { - sendCTCPCommand(target, "ACTION " + action); - } - - - /** - * Sends a notice to the channel or to a user. - * - * @param target The name of the channel or user nick to send to. - * @param notice The notice to send. - */ - public final void sendNotice(String target, String notice) { - _outQueue.add("NOTICE " + target + " :" + notice); - } - - - /** - * Sends a CTCP command to a channel or user. (Client to client protocol). - * Examples of such commands are "PING <number>", "FINGER", "VERSION", etc. - * For example, if you wish to request the version of a user called "Dave", - * then you would call <code>sendCTCPCommand("Dave", "VERSION");</code>. - * The type of response to such commands is largely dependant on the target - * client software. - * - * @since PircBot 0.9.5 - * - * @param target The name of the channel or user to send the CTCP message to. - * @param command The CTCP command to send. - */ - public final void sendCTCPCommand(String target, String command) { - _outQueue.add("PRIVMSG " + target + " :\u0001" + command + "\u0001"); - } - - - /** - * Attempt to change the current nick (nickname) of the bot when it - * is connected to an IRC server. - * After confirmation of a successful nick change, the getNick method - * will return the new nick. - * - * @param newNick The new nick to use. - */ - public final void changeNick(String newNick) { - this.sendRawLine("NICK " + newNick); - } - - - /** - * Identify the bot with NickServ, supplying the appropriate password. - * Some IRC Networks (such as freenode) require users to <i>register</i> and - * <i>identify</i> with NickServ before they are able to send private messages - * to other users, thus reducing the amount of spam. If you are using - * an IRC network where this kind of policy is enforced, you will need - * to make your bot <i>identify</i> itself to NickServ before you can send - * private messages. Assuming you have already registered your bot's - * nick with NickServ, this method can be used to <i>identify</i> with - * the supplied password. It usually makes sense to identify with NickServ - * immediately after connecting to a server. - * <p> - * This method issues a raw NICKSERV command to the server, and is therefore - * safer than the alternative approach of sending a private message to - * NickServ. The latter approach is considered dangerous, as it may cause - * you to inadvertently transmit your password to an untrusted party if you - * connect to a network which does not run a NickServ service and where the - * untrusted party has assumed the nick "NickServ". However, if your IRC - * network is only compatible with the private message approach, you may - * typically identify like so: - * <pre>sendMessage("NickServ", "identify PASSWORD");</pre> - * - * @param password The password which will be used to identify with NickServ. - */ - public final void identify(String password) { - this.sendRawLine("NICKSERV IDENTIFY " + password); - } - - - /** - * Set the mode of a channel. - * This method attempts to set the mode of a channel. This - * may require the bot to have operator status on the channel. - * For example, if the bot has operator status, we can grant - * operator status to "Dave" on the #cs channel - * by calling setMode("#cs", "+o Dave"); - * An alternative way of doing this would be to use the op method. - * - * @param channel The channel on which to perform the mode change. - * @param mode The new mode to apply to the channel. This may include - * zero or more arguments if necessary. - * - * @see #op(String,String) op - */ - public final void setMode(String channel, String mode) { - this.sendRawLine("MODE " + channel + " " + mode); - } - - - /** - * Sends an invitation to join a channel. Some channels can be marked - * as "invite-only", so it may be useful to allow a bot to invite people - * into it. - * - * @param nick The nick of the user to invite - * @param channel The channel you are inviting the user to join. - * - */ - public final void sendInvite(String nick, String channel) { - this.sendRawLine("INVITE " + nick + " :" + channel); - } - - - /** - * Bans a user from a channel. An example of a valid hostmask is - * "*!*compu@*.18hp.net". This may be used in conjunction with the - * kick method to permanently remove a user from a channel. - * Successful use of this method may require the bot to have operator - * status itself. - * - * @param channel The channel to ban the user from. - * @param hostmask A hostmask representing the user we're banning. - */ - public final void ban(String channel, String hostmask) { - this.sendRawLine("MODE " + channel + " +b " + hostmask); - } - - - /** - * Unbans a user from a channel. An example of a valid hostmask is - * "*!*compu@*.18hp.net". - * Successful use of this method may require the bot to have operator - * status itself. - * - * @param channel The channel to unban the user from. - * @param hostmask A hostmask representing the user we're unbanning. - */ - public final void unBan(String channel, String hostmask) { - this.sendRawLine("MODE " + channel + " -b " + hostmask); - } - - - /** - * Grants operator privilidges to a user on a channel. - * Successful use of this method may require the bot to have operator - * status itself. - * - * @param channel The channel we're opping the user on. - * @param nick The nick of the user we are opping. - */ - public final void op(String channel, String nick) { - this.setMode(channel, "+o " + nick); - } - - - /** - * Removes operator privilidges from a user on a channel. - * Successful use of this method may require the bot to have operator - * status itself. - * - * @param channel The channel we're deopping the user on. - * @param nick The nick of the user we are deopping. - */ - public final void deOp(String channel, String nick) { - this.setMode(channel, "-o " + nick); - } - - - /** - * Grants voice privilidges to a user on a channel. - * Successful use of this method may require the bot to have operator - * status itself. - * - * @param channel The channel we're voicing the user on. - * @param nick The nick of the user we are voicing. - */ - public final void voice(String channel, String nick) { - this.setMode(channel, "+v " + nick); - } - - - /** - * Removes voice privilidges from a user on a channel. - * Successful use of this method may require the bot to have operator - * status itself. - * - * @param channel The channel we're devoicing the user on. - * @param nick The nick of the user we are devoicing. - */ - public final void deVoice(String channel, String nick) { - this.setMode(channel, "-v " + nick); - } - - - /** - * Set the topic for a channel. - * This method attempts to set the topic of a channel. This - * may require the bot to have operator status if the topic - * is protected. - * - * @param channel The channel on which to perform the mode change. - * @param topic The new topic for the channel. - * - */ - public final void setTopic(String channel, String topic) { - this.sendRawLine("TOPIC " + channel + " :" + topic); - } - - - /** - * Kicks a user from a channel. - * This method attempts to kick a user from a channel and - * may require the bot to have operator status in the channel. - * - * @param channel The channel to kick the user from. - * @param nick The nick of the user to kick. - */ - public final void kick(String channel, String nick) { - this.kick(channel, nick, ""); - } - - - /** - * Kicks a user from a channel, giving a reason. - * This method attempts to kick a user from a channel and - * may require the bot to have operator status in the channel. - * - * @param channel The channel to kick the user from. - * @param nick The nick of the user to kick. - * @param reason A description of the reason for kicking a user. - */ - public final void kick(String channel, String nick, String reason) { - this.sendRawLine("KICK " + channel + " " + nick + " :" + reason); - } - - - /** - * Issues a request for a list of all channels on the IRC server. - * When the PircBot receives information for each channel, it will - * call the onChannelInfo method, which you will need to override - * if you want it to do anything useful. - * - * @see #onChannelInfo(String,int,String) onChannelInfo - */ - public final void listChannels() { - this.listChannels(null); - } - - - /** - * Issues a request for a list of all channels on the IRC server. - * When the PircBot receives information for each channel, it will - * call the onChannelInfo method, which you will need to override - * if you want it to do anything useful. - * <p> - * Some IRC servers support certain parameters for LIST requests. - * One example is a parameter of ">10" to list only those channels - * that have more than 10 users in them. Whether these parameters - * are supported or not will depend on the IRC server software. - * - * @param parameters The parameters to supply when requesting the - * list. - * - * @see #onChannelInfo(String,int,String) onChannelInfo - */ - public final void listChannels(String parameters) { - if (parameters == null) { - this.sendRawLine("LIST"); - } - else { - this.sendRawLine("LIST " + parameters); - } - } - - /** - * Adds a line to the log. This log is currently output to the standard - * output and is in the correct format for use by tools such as pisg, the - * Perl IRC Statistics Generator. You may override this method if you wish - * to do something else with log entries. - * Each line in the log begins with a number which - * represents the logging time (as the number of milliseconds since the - * epoch). This timestamp and the following log entry are separated by - * a single space character, " ". Outgoing messages are distinguishable - * by a log entry that has ">>>" immediately following the space character - * after the timestamp. DCC events use "+++" and warnings about unhandled - * Exceptions and Errors use "###". - * <p> - * This implementation of the method will only cause log entries to be - * output if the PircBot has had its verbose mode turned on by calling - * setVerbose(true); - * - * @param line The line to add to the log. - */ - public void log(String line) { - if (_verbose) { - System.out.println(System.currentTimeMillis() + " " + line); - } - } - - - /** - * This method handles events when any line of text arrives from the server, - * then calling the appropriate method in the PircBot. This method is - * protected and only called by the InputThread for this instance. - * <p> - * This method may not be overridden! - * - * @param line The raw line of text from the server. - */ - protected void handleLine(String line) { - this.log(line); - - // Check for server pings. - if (line.startsWith("PING ")) { - // Respond to the ping and return immediately. - this.onServerPing(line.substring(5)); - return; - } - - String sourceNick = ""; - String sourceLogin = ""; - String sourceHostname = ""; - - StringTokenizer tokenizer = new StringTokenizer(line); - String senderInfo = tokenizer.nextToken(); - String command = tokenizer.nextToken(); - String target = null; - - int exclamation = senderInfo.indexOf("!"); - int at = senderInfo.indexOf("@"); - if (senderInfo.startsWith(":")) { - if (exclamation > 0 && at > 0 && exclamation < at) { - sourceNick = senderInfo.substring(1, exclamation); - sourceLogin = senderInfo.substring(exclamation + 1, at); - sourceHostname = senderInfo.substring(at + 1); - } - else { - - if (tokenizer.hasMoreTokens()) { - String token = command; - - int code = -1; - try { - code = Integer.parseInt(token); - } - catch (NumberFormatException e) { - // Keep the existing value. - } - - if (code != -1) { - String errorStr = token; - String response = line.substring(line.indexOf(errorStr, senderInfo.length()) + 4, line.length()); - this.processServerResponse(code, response); - // Return from the method. - return; - } - else { - // This is not a server response. - // It must be a nick without login and hostname. - // (or maybe a NOTICE or suchlike from the server) - sourceNick = senderInfo; - target = token; - } - } - else { - // We don't know what this line means. - this.onUnknown(line); - // Return from the method; - return; - } - - } - } - - command = command.toUpperCase(Locale.ENGLISH); - if (sourceNick.startsWith(":")) { - sourceNick = sourceNick.substring(1); - } - if (target == null) { - target = tokenizer.nextToken(); - } - if (target.startsWith(":")) { - target = target.substring(1); - } - - // Check for CTCP requests. - if (command.equals("PRIVMSG") && line.indexOf(":\u0001") > 0 && line.endsWith("\u0001")) { - String request = line.substring(line.indexOf(":\u0001") + 2, line.length() - 1); - if (request.equals("VERSION")) { - // VERSION request - this.onVersion(sourceNick, sourceLogin, sourceHostname, target); - } - else if (request.startsWith("ACTION ")) { - // ACTION request - this.onAction(sourceNick, sourceLogin, sourceHostname, target, request.substring(7)); - } - else if (request.startsWith("PING ")) { - // PING request - this.onPing(sourceNick, sourceLogin, sourceHostname, target, request.substring(5)); - } - else if (request.equals("TIME")) { - // TIME request - this.onTime(sourceNick, sourceLogin, sourceHostname, target); - } - else if (request.equals("FINGER")) { - // FINGER request - this.onFinger(sourceNick, sourceLogin, sourceHostname, target); - } - else { - // An unknown CTCP message - ignore it. - this.onUnknown(line); - } - } - else if (command.equals("PRIVMSG") && _channelPrefixes.indexOf(target.charAt(0)) >= 0) { - // This is a normal message to a channel. - this.onMessage(target, sourceNick, sourceLogin, sourceHostname, line.substring(line.indexOf(" :") + 2)); - } - else if (command.equals("PRIVMSG")) { - // This is a private message to us. - this.onPrivateMessage(sourceNick, sourceLogin, sourceHostname, line.substring(line.indexOf(" :") + 2)); - } - else if (command.equals("JOIN")) { - // Someone is joining a channel. - String channel = target; - this.addUser(channel, new User("", sourceNick)); - this.onJoin(channel, sourceNick, sourceLogin, sourceHostname); - } - else if (command.equals("PART")) { - // Someone is parting from a channel. - this.removeUser(target, sourceNick); - if (sourceNick.equals(this.getNick())) { - this.removeChannel(target); - } - this.onPart(target, sourceNick, sourceLogin, sourceHostname); - } - else if (command.equals("NICK")) { - // Somebody is changing their nick. - String newNick = target; - this.renameUser(sourceNick, newNick); - if (sourceNick.equals(this.getNick())) { - // Update our nick if it was us that changed nick. - this.setNick(newNick); - } - this.onNickChange(sourceNick, sourceLogin, sourceHostname, newNick); - } - else if (command.equals("NOTICE")) { - // Someone is sending a notice. - this.onNotice(sourceNick, sourceLogin, sourceHostname, target, line.substring(line.indexOf(" :") + 2)); - } - else if (command.equals("QUIT")) { - // Someone has quit from the IRC server. - if (sourceNick.equals(this.getNick())) { - this.removeAllChannels(); - } - else { - this.removeUser(sourceNick); - } - this.onQuit(sourceNick, sourceLogin, sourceHostname, line.substring(line.indexOf(" :") + 2)); - } - else if (command.equals("KICK")) { - // Somebody has been kicked from a channel. - String recipient = tokenizer.nextToken(); - if (recipient.equals(this.getNick())) { - this.removeChannel(target); - } - this.removeUser(target, recipient); - this.onKick(target, sourceNick, sourceLogin, sourceHostname, recipient, line.substring(line.indexOf(" :") + 2)); - } - else if (command.equals("MODE")) { - // Somebody is changing the mode on a channel or user. - String mode = line.substring(line.indexOf(target, 2) + target.length() + 1); - if (mode.startsWith(":")) { - mode = mode.substring(1); - } - this.processMode(target, sourceNick, sourceLogin, sourceHostname, mode); - } - else if (command.equals("TOPIC")) { - // Someone is changing the topic. - this.onTopic(target, line.substring(line.indexOf(" :") + 2), sourceNick, System.currentTimeMillis(), true); - } - else if (command.equals("INVITE")) { - // Somebody is inviting somebody else into a channel. - this.onInvite(target, sourceNick, sourceLogin, sourceHostname, line.substring(line.indexOf(" :") + 2)); - } - else { - // If we reach this point, then we've found something that the PircBot - // Doesn't currently deal with. - this.onUnknown(line); - } - - } - - - /** - * This method is called once the PircBot has successfully connected to - * the IRC server. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.6 - */ - protected void onConnect() {} - - - /** - * This method carries out the actions to be performed when the PircBot - * gets disconnected. This may happen if the PircBot quits from the - * server, or if the connection is unexpectedly lost. - * <p> - * Disconnection from the IRC server is detected immediately if either - * we or the server close the connection normally. If the connection to - * the server is lost, but neither we nor the server have explicitly closed - * the connection, then it may take a few minutes to detect (this is - * commonly referred to as a "ping timeout"). - * <p> - * If you wish to get your IRC bot to automatically rejoin a server after - * the connection has been lost, then this is probably the ideal method to - * override to implement such functionality. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - */ - protected void onDisconnect() {} - - - /** - * This method is called by the PircBot when a numeric response - * is received from the IRC server. We use this method to - * allow PircBot to process various responses from the server - * before then passing them on to the onServerResponse method. - * <p> - * Note that this method is private and should not appear in any - * of the javadoc generated documenation. - * - * @param code The three-digit numerical code for the response. - * @param response The full response from the IRC server. - */ - private final void processServerResponse(int code, String response) { - - if (code == RPL_LIST) { - // This is a bit of information about a channel. - int firstSpace = response.indexOf(' '); - int secondSpace = response.indexOf(' ', firstSpace + 1); - int thirdSpace = response.indexOf(' ', secondSpace + 1); - int colon = response.indexOf(':'); - String channel = response.substring(firstSpace + 1, secondSpace); - int userCount = 0; - try { - userCount = Integer.parseInt(response.substring(secondSpace + 1, thirdSpace)); - } - catch (NumberFormatException e) { - // Stick with the value of zero. - } - String topic = response.substring(colon + 1); - this.onChannelInfo(channel, userCount, topic); - } - else if (code == RPL_TOPIC) { - // This is topic information about a channel we've just joined. - int firstSpace = response.indexOf(' '); - int secondSpace = response.indexOf(' ', firstSpace + 1); - int colon = response.indexOf(':'); - String channel = response.substring(firstSpace + 1, secondSpace); - String topic = response.substring(colon + 1); - - _topics.put(channel, topic); - - // For backwards compatibility only - this onTopic method is deprecated. - this.onTopic(channel, topic); - } - else if (code == RPL_TOPICINFO) { - StringTokenizer tokenizer = new StringTokenizer(response); - tokenizer.nextToken(); - String channel = tokenizer.nextToken(); - String setBy = tokenizer.nextToken(); - long date = 0; - try { - date = Long.parseLong(tokenizer.nextToken()) * 1000; - } - catch (NumberFormatException e) { - // Stick with the default value of zero. - } - - String topic = (String) _topics.get(channel); - _topics.remove(channel); - - this.onTopic(channel, topic, setBy, date, false); - } - else if (code == RPL_NAMREPLY) { - // This is a list of nicks in a channel that we've just joined. - int channelEndIndex = response.indexOf(" :"); - String channel = response.substring(response.lastIndexOf(' ', channelEndIndex - 1) + 1, channelEndIndex); - - StringTokenizer tokenizer = new StringTokenizer(response.substring(response.indexOf(" :") + 2)); - while (tokenizer.hasMoreTokens()) { - String nick = tokenizer.nextToken(); - String prefix = ""; - if (nick.startsWith("@")) { - // User is an operator in this channel. - prefix = "@"; - } - else if (nick.startsWith("+")) { - // User is voiced in this channel. - prefix = "+"; - } - else if (nick.startsWith(".")) { - // Some wibbly status I've never seen before... - prefix = "."; - } - nick = nick.substring(prefix.length()); - this.addUser(channel, new User(prefix, nick)); - } - } - else if (code == RPL_ENDOFNAMES) { - // This is the end of a NAMES list, so we know that we've got - // the full list of users in the channel that we just joined. - String channel = response.substring(response.indexOf(' ') + 1, response.indexOf(" :")); - User[] users = this.getUsers(channel); - this.onUserList(channel, users); - } - - this.onServerResponse(code, response); - } - - - /** - * This method is called when we receive a numeric response from the - * IRC server. - * <p> - * Numerics in the range from 001 to 099 are used for client-server - * connections only and should never travel between servers. Replies - * generated in response to commands are found in the range from 200 - * to 399. Error replies are found in the range from 400 to 599. - * <p> - * For example, we can use this method to discover the topic of a - * channel when we join it. If we join the channel #test which - * has a topic of "I am King of Test" then the response - * will be "<code>PircBot #test :I Am King of Test</code>" - * with a code of 332 to signify that this is a topic. - * (This is just an example - note that overriding the - * <code>onTopic</code> method is an easier way of finding the - * topic for a channel). Check the IRC RFC for the full list of other - * command response codes. - * <p> - * PircBot implements the interface ReplyConstants, which contains - * contstants that you may find useful here. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @param code The three-digit numerical code for the response. - * @param response The full response from the IRC server. - * - * @see ReplyConstants - */ - protected void onServerResponse(int code, String response) {} - - - /** - * This method is called when we receive a user list from the server - * after joining a channel. - * <p> - * Shortly after joining a channel, the IRC server sends a list of all - * users in that channel. The PircBot collects this information and - * calls this method as soon as it has the full list. - * <p> - * To obtain the nick of each user in the channel, call the getNick() - * method on each User object in the array. - * <p> - * At a later time, you may call the getUsers method to obtain an - * up to date list of the users in the channel. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 1.0.0 - * - * @param channel The name of the channel. - * @param users An array of User objects belonging to this channel. - * - * @see User - */ - protected void onUserList(String channel, User[] users) {} - - - /** - * This method is called whenever a message is sent to a channel. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @param channel The channel to which the message was sent. - * @param sender The nick of the person who sent the message. - * @param login The login of the person who sent the message. - * @param hostname The hostname of the person who sent the message. - * @param message The actual message sent to the channel. - */ - protected void onMessage(String channel, String sender, String login, String hostname, String message) {} - - - /** - * This method is called whenever a private message is sent to the PircBot. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @param sender The nick of the person who sent the private message. - * @param login The login of the person who sent the private message. - * @param hostname The hostname of the person who sent the private message. - * @param message The actual message. - */ - protected void onPrivateMessage(String sender, String login, String hostname, String message) {} - - - /** - * This method is called whenever an ACTION is sent from a user. E.g. - * such events generated by typing "/me goes shopping" in most IRC clients. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @param sender The nick of the user that sent the action. - * @param login The login of the user that sent the action. - * @param hostname The hostname of the user that sent the action. - * @param target The target of the action, be it a channel or our nick. - * @param action The action carried out by the user. - */ - protected void onAction(String sender, String login, String hostname, String target, String action) {} - - - /** - * This method is called whenever we receive a notice. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @param sourceNick The nick of the user that sent the notice. - * @param sourceLogin The login of the user that sent the notice. - * @param sourceHostname The hostname of the user that sent the notice. - * @param target The target of the notice, be it our nick or a channel name. - * @param notice The notice message. - */ - protected void onNotice(String sourceNick, String sourceLogin, String sourceHostname, String target, String notice) {} - - - /** - * This method is called whenever someone (possibly us) joins a channel - * which we are on. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @param channel The channel which somebody joined. - * @param sender The nick of the user who joined the channel. - * @param login The login of the user who joined the channel. - * @param hostname The hostname of the user who joined the channel. - */ - protected void onJoin(String channel, String sender, String login, String hostname) {} - - - /** - * This method is called whenever someone (possibly us) parts a channel - * which we are on. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @param channel The channel which somebody parted from. - * @param sender The nick of the user who parted from the channel. - * @param login The login of the user who parted from the channel. - * @param hostname The hostname of the user who parted from the channel. - */ - protected void onPart(String channel, String sender, String login, String hostname) {} - - - /** - * This method is called whenever someone (possibly us) changes nick on any - * of the channels that we are on. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @param oldNick The old nick. - * @param login The login of the user. - * @param hostname The hostname of the user. - * @param newNick The new nick. - */ - protected void onNickChange(String oldNick, String login, String hostname, String newNick) {} - - - /** - * This method is called whenever someone (possibly us) is kicked from - * any of the channels that we are in. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @param channel The channel from which the recipient was kicked. - * @param kickerNick The nick of the user who performed the kick. - * @param kickerLogin The login of the user who performed the kick. - * @param kickerHostname The hostname of the user who performed the kick. - * @param recipientNick The unfortunate recipient of the kick. - * @param reason The reason given by the user who performed the kick. - */ - protected void onKick(String channel, String kickerNick, String kickerLogin, String kickerHostname, String recipientNick, String reason) {} - - - /** - * This method is called whenever someone (possibly us) quits from the - * server. We will only observe this if the user was in one of the - * channels to which we are connected. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @param sourceNick The nick of the user that quit from the server. - * @param sourceLogin The login of the user that quit from the server. - * @param sourceHostname The hostname of the user that quit from the server. - * @param reason The reason given for quitting the server. - */ - protected void onQuit(String sourceNick, String sourceLogin, String sourceHostname, String reason) {} - - - /** - * This method is called whenever a user sets the topic, or when - * PircBot joins a new channel and discovers its topic. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @param channel The channel that the topic belongs to. - * @param topic The topic for the channel. - * - * @deprecated As of 1.2.0, replaced by {@link #onTopic(String,String,String,long,boolean)} - */ - protected void onTopic(String channel, String topic) {} - - - /** - * This method is called whenever a user sets the topic, or when - * PircBot joins a new channel and discovers its topic. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @param channel The channel that the topic belongs to. - * @param topic The topic for the channel. - * @param setBy The nick of the user that set the topic. - * @param date When the topic was set (milliseconds since the epoch). - * @param changed True if the topic has just been changed, false if - * the topic was already there. - * - */ - protected void onTopic(String channel, String topic, String setBy, long date, boolean changed) {} - - - /** - * After calling the listChannels() method in PircBot, the server - * will start to send us information about each channel on the - * server. You may override this method in order to receive the - * information about each channel as soon as it is received. - * <p> - * Note that certain channels, such as those marked as hidden, - * may not appear in channel listings. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @param channel The name of the channel. - * @param userCount The number of users visible in this channel. - * @param topic The topic for this channel. - * - * @see #listChannels() listChannels - */ - protected void onChannelInfo(String channel, int userCount, String topic) {} - - - /** - * Called when the mode of a channel is set. We process this in - * order to call the appropriate onOp, onDeop, etc method before - * finally calling the override-able onMode method. - * <p> - * Note that this method is private and is not intended to appear - * in the javadoc generated documentation. - * - * @param target The channel or nick that the mode operation applies to. - * @param sourceNick The nick of the user that set the mode. - * @param sourceLogin The login of the user that set the mode. - * @param sourceHostname The hostname of the user that set the mode. - * @param mode The mode that has been set. - */ - private final void processMode(String target, String sourceNick, String sourceLogin, String sourceHostname, String mode) { - - if (_channelPrefixes.indexOf(target.charAt(0)) >= 0) { - // The mode of a channel is being changed. - String channel = target; - StringTokenizer tok = new StringTokenizer(mode); - String[] params = new String[tok.countTokens()]; - - int t = 0; - while (tok.hasMoreTokens()) { - params[t] = tok.nextToken(); - t++; - } - - char pn = ' '; - int p = 1; - - // All of this is very large and ugly, but it's the only way of providing - // what the users want :-/ - for (int i = 0; i < params[0].length(); i++) { - char atPos = params[0].charAt(i); - - if (atPos == '+' || atPos == '-') { - pn = atPos; - } - else if (atPos == 'o') { - if (pn == '+') { - this.updateUser(channel, OP_ADD, params[p]); - onOp(channel, sourceNick, sourceLogin, sourceHostname, params[p]); - } - else { - this.updateUser(channel, OP_REMOVE, params[p]); - onDeop(channel, sourceNick, sourceLogin, sourceHostname, params[p]); - } - p++; - } - else if (atPos == 'v') { - if (pn == '+') { - this.updateUser(channel, VOICE_ADD, params[p]); - onVoice(channel, sourceNick, sourceLogin, sourceHostname, params[p]); - } - else { - this.updateUser(channel, VOICE_REMOVE, params[p]); - onDeVoice(channel, sourceNick, sourceLogin, sourceHostname, params[p]); - } - p++; - } - else if (atPos == 'k') { - if (pn == '+') { - onSetChannelKey(channel, sourceNick, sourceLogin, sourceHostname, params[p]); - } - else { - onRemoveChannelKey(channel, sourceNick, sourceLogin, sourceHostname, params[p]); - } - p++; - } - else if (atPos == 'l') { - if (pn == '+') { - onSetChannelLimit(channel, sourceNick, sourceLogin, sourceHostname, Integer.parseInt(params[p])); - p++; - } - else { - onRemoveChannelLimit(channel, sourceNick, sourceLogin, sourceHostname); - } - } - else if (atPos == 'b') { - if (pn == '+') { - onSetChannelBan(channel, sourceNick, sourceLogin, sourceHostname,params[p]); - } - else { - onRemoveChannelBan(channel, sourceNick, sourceLogin, sourceHostname, params[p]); - } - p++; - } - else if (atPos == 't') { - if (pn == '+') { - onSetTopicProtection(channel, sourceNick, sourceLogin, sourceHostname); - } - else { - onRemoveTopicProtection(channel, sourceNick, sourceLogin, sourceHostname); - } - } - else if (atPos == 'n') { - if (pn == '+') { - onSetNoExternalMessages(channel, sourceNick, sourceLogin, sourceHostname); - } - else { - onRemoveNoExternalMessages(channel, sourceNick, sourceLogin, sourceHostname); - } - } - else if (atPos == 'i') { - if (pn == '+') { - onSetInviteOnly(channel, sourceNick, sourceLogin, sourceHostname); - } - else { - onRemoveInviteOnly(channel, sourceNick, sourceLogin, sourceHostname); - } - } - else if (atPos == 'm') { - if (pn == '+') { - onSetModerated(channel, sourceNick, sourceLogin, sourceHostname); - } - else { - onRemoveModerated(channel, sourceNick, sourceLogin, sourceHostname); - } - } - else if (atPos == 'p') { - if (pn == '+') { - onSetPrivate(channel, sourceNick, sourceLogin, sourceHostname); - } - else { - onRemovePrivate(channel, sourceNick, sourceLogin, sourceHostname); - } - } - else if (atPos == 's') { - if (pn == '+') { - onSetSecret(channel, sourceNick, sourceLogin, sourceHostname); - } - else { - onRemoveSecret(channel, sourceNick, sourceLogin, sourceHostname); - } - } - } - - this.onMode(channel, sourceNick, sourceLogin, sourceHostname, mode); - } - else { - // The mode of a user is being changed. - String nick = target; - this.onUserMode(nick, sourceNick, sourceLogin, sourceHostname, mode); - } - } - - - /** - * Called when the mode of a channel is set. - * <p> - * You may find it more convenient to decode the meaning of the mode - * string by overriding the onOp, onDeOp, onVoice, onDeVoice, - * onChannelKey, onDeChannelKey, onChannelLimit, onDeChannelLimit, - * onChannelBan or onDeChannelBan methods as appropriate. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @param channel The channel that the mode operation applies to. - * @param sourceNick The nick of the user that set the mode. - * @param sourceLogin The login of the user that set the mode. - * @param sourceHostname The hostname of the user that set the mode. - * @param mode The mode that has been set. - * - */ - protected void onMode(String channel, String sourceNick, String sourceLogin, String sourceHostname, String mode) {} - - - /** - * Called when the mode of a user is set. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 1.2.0 - * - * @param targetNick The nick that the mode operation applies to. - * @param sourceNick The nick of the user that set the mode. - * @param sourceLogin The login of the user that set the mode. - * @param sourceHostname The hostname of the user that set the mode. - * @param mode The mode that has been set. - * - */ - protected void onUserMode(String targetNick, String sourceNick, String sourceLogin, String sourceHostname, String mode) {} - - - - /** - * Called when a user (possibly us) gets granted operator status for a channel. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - * @param recipient The nick of the user that got 'opped'. - */ - protected void onOp(String channel, String sourceNick, String sourceLogin, String sourceHostname, String recipient) {} - - - /** - * Called when a user (possibly us) gets operator status taken away. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - * @param recipient The nick of the user that got 'deopped'. - */ - protected void onDeop(String channel, String sourceNick, String sourceLogin, String sourceHostname, String recipient) {} - - - /** - * Called when a user (possibly us) gets voice status granted in a channel. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - * @param recipient The nick of the user that got 'voiced'. - */ - protected void onVoice(String channel, String sourceNick, String sourceLogin, String sourceHostname, String recipient) {} - - - /** - * Called when a user (possibly us) gets voice status removed. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - * @param recipient The nick of the user that got 'devoiced'. - */ - protected void onDeVoice(String channel, String sourceNick, String sourceLogin, String sourceHostname, String recipient) {} - - - /** - * Called when a channel key is set. When the channel key has been set, - * other users may only join that channel if they know the key. Channel keys - * are sometimes referred to as passwords. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - * @param key The new key for the channel. - */ - protected void onSetChannelKey(String channel, String sourceNick, String sourceLogin, String sourceHostname, String key) {} - - - /** - * Called when a channel key is removed. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - * @param key The key that was in use before the channel key was removed. - */ - protected void onRemoveChannelKey(String channel, String sourceNick, String sourceLogin, String sourceHostname, String key) {} - - - /** - * Called when a user limit is set for a channel. The number of users in - * the channel cannot exceed this limit. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - * @param limit The maximum number of users that may be in this channel at the same time. - */ - protected void onSetChannelLimit(String channel, String sourceNick, String sourceLogin, String sourceHostname, int limit) {} - - - /** - * Called when the user limit is removed for a channel. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - */ - protected void onRemoveChannelLimit(String channel, String sourceNick, String sourceLogin, String sourceHostname) {} - - - /** - * Called when a user (possibly us) gets banned from a channel. Being - * banned from a channel prevents any user with a matching hostmask from - * joining the channel. For this reason, most bans are usually directly - * followed by the user being kicked :-) - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - * @param hostmask The hostmask of the user that has been banned. - */ - protected void onSetChannelBan(String channel, String sourceNick, String sourceLogin, String sourceHostname, String hostmask) {} - - - /** - * Called when a hostmask ban is removed from a channel. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - * @param hostmask - */ - protected void onRemoveChannelBan(String channel, String sourceNick, String sourceLogin, String sourceHostname, String hostmask) {} - - - /** - * Called when topic protection is enabled for a channel. Topic protection - * means that only operators in a channel may change the topic. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - */ - protected void onSetTopicProtection(String channel, String sourceNick, String sourceLogin, String sourceHostname) {} - - - /** - * Called when topic protection is removed for a channel. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - */ - protected void onRemoveTopicProtection(String channel, String sourceNick, String sourceLogin, String sourceHostname) {} - - - /** - * Called when a channel is set to only allow messages from users that - * are in the channel. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - */ - protected void onSetNoExternalMessages(String channel, String sourceNick, String sourceLogin, String sourceHostname) {} - - - /** - * Called when a channel is set to allow messages from any user, even - * if they are not actually in the channel. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - */ - protected void onRemoveNoExternalMessages(String channel, String sourceNick, String sourceLogin, String sourceHostname) {} - - - /** - * Called when a channel is set to 'invite only' mode. A user may only - * join the channel if they are invited by someone who is already in the - * channel. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - */ - protected void onSetInviteOnly(String channel, String sourceNick, String sourceLogin, String sourceHostname) {} - - - /** - * Called when a channel has 'invite only' removed. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - */ - protected void onRemoveInviteOnly(String channel, String sourceNick, String sourceLogin, String sourceHostname) {} - - - /** - * Called when a channel is set to 'moderated' mode. If a channel is - * moderated, then only users who have been 'voiced' or 'opped' may speak - * or change their nicks. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - */ - protected void onSetModerated(String channel, String sourceNick, String sourceLogin, String sourceHostname) {} - - - /** - * Called when a channel has moderated mode removed. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - */ - protected void onRemoveModerated(String channel, String sourceNick, String sourceLogin, String sourceHostname) {} - - - /** - * Called when a channel is marked as being in private mode. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - */ - protected void onSetPrivate(String channel, String sourceNick, String sourceLogin, String sourceHostname) {} - - - /** - * Called when a channel is marked as not being in private mode. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - */ - protected void onRemovePrivate(String channel, String sourceNick, String sourceLogin, String sourceHostname) {} - - - /** - * Called when a channel is set to be in 'secret' mode. Such channels - * typically do not appear on a server's channel listing. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - */ - protected void onSetSecret(String channel, String sourceNick, String sourceLogin, String sourceHostname) {} - - - /** - * Called when a channel has 'secret' mode removed. - * <p> - * This is a type of mode change and is also passed to the onMode - * method in the PircBot class. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param channel The channel in which the mode change took place. - * @param sourceNick The nick of the user that performed the mode change. - * @param sourceLogin The login of the user that performed the mode change. - * @param sourceHostname The hostname of the user that performed the mode change. - */ - protected void onRemoveSecret(String channel, String sourceNick, String sourceLogin, String sourceHostname) {} - - - /** - * Called when we are invited to a channel by a user. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @since PircBot 0.9.5 - * - * @param targetNick The nick of the user being invited - should be us! - * @param sourceNick The nick of the user that sent the invitation. - * @param sourceLogin The login of the user that sent the invitation. - * @param sourceHostname The hostname of the user that sent the invitation. - * @param channel The channel that we're being invited to. - */ - protected void onInvite(String targetNick, String sourceNick, String sourceLogin, String sourceHostname, String channel) {} - - - /** - * This method used to be called when a DCC SEND request was sent to the PircBot. - * Please use the onIncomingFileTransfer method to receive files, as it - * has better functionality and supports resuming. - * - * @deprecated As of PircBot 1.2.0, use {@link #onIncomingFileTransfer(DccFileTransfer)} - */ - protected void onDccSendRequest(String sourceNick, String sourceLogin, String sourceHostname, String filename, long address, int port, int size) {} - - - /** - * This method used to be called when a DCC CHAT request was sent to the PircBot. - * Please use the onIncomingChatRequest method to accept chats, as it - * has better functionality. - * - * @deprecated As of PircBot 1.2.0, use {@link #onIncomingChatRequest(DccChat)} - */ - protected void onDccChatRequest(String sourceNick, String sourceLogin, String sourceHostname, long address, int port) {} - - - /** - * This method is called whenever we receive a VERSION request. - * This abstract implementation responds with the PircBot's _version string, - * so if you override this method, be sure to either mimic its functionality - * or to call super.onVersion(...); - * - * @param sourceNick The nick of the user that sent the VERSION request. - * @param sourceLogin The login of the user that sent the VERSION request. - * @param sourceHostname The hostname of the user that sent the VERSION request. - * @param target The target of the VERSION request, be it our nick or a channel name. - */ - protected void onVersion(String sourceNick, String sourceLogin, String sourceHostname, String target) { - this.sendRawLine("NOTICE " + sourceNick + " :\u0001VERSION " + _version + "\u0001"); - } - - - /** - * This method is called whenever we receive a PING request from another - * user. - * <p> - * This abstract implementation responds correctly, so if you override this - * method, be sure to either mimic its functionality or to call - * super.onPing(...); - * - * @param sourceNick The nick of the user that sent the PING request. - * @param sourceLogin The login of the user that sent the PING request. - * @param sourceHostname The hostname of the user that sent the PING request. - * @param target The target of the PING request, be it our nick or a channel name. - * @param pingValue The value that was supplied as an argument to the PING command. - */ - protected void onPing(String sourceNick, String sourceLogin, String sourceHostname, String target, String pingValue) { - this.sendRawLine("NOTICE " + sourceNick + " :\u0001PING " + pingValue + "\u0001"); - } - - - /** - * The actions to perform when a PING request comes from the server. - * <p> - * This sends back a correct response, so if you override this method, - * be sure to either mimic its functionality or to call - * super.onServerPing(response); - * - * @param response The response that should be given back in your PONG. - */ - protected void onServerPing(String response) { - this.sendRawLine("PONG " + response); - } - - - /** - * This method is called whenever we receive a TIME request. - * <p> - * This abstract implementation responds correctly, so if you override this - * method, be sure to either mimic its functionality or to call - * super.onTime(...); - * - * @param sourceNick The nick of the user that sent the TIME request. - * @param sourceLogin The login of the user that sent the TIME request. - * @param sourceHostname The hostname of the user that sent the TIME request. - * @param target The target of the TIME request, be it our nick or a channel name. - */ - protected void onTime(String sourceNick, String sourceLogin, String sourceHostname, String target) { - this.sendRawLine("NOTICE " + sourceNick + " :\u0001TIME " + new Date().toString() + "\u0001"); - } - - - /** - * This method is called whenever we receive a FINGER request. - * <p> - * This abstract implementation responds correctly, so if you override this - * method, be sure to either mimic its functionality or to call - * super.onFinger(...); - * - * @param sourceNick The nick of the user that sent the FINGER request. - * @param sourceLogin The login of the user that sent the FINGER request. - * @param sourceHostname The hostname of the user that sent the FINGER request. - * @param target The target of the FINGER request, be it our nick or a channel name. - */ - protected void onFinger(String sourceNick, String sourceLogin, String sourceHostname, String target) { - this.sendRawLine("NOTICE " + sourceNick + " :\u0001FINGER " + _finger + "\u0001"); - } - - - /** - * This method is called whenever we receive a line from the server that - * the PircBot has not been programmed to recognise. - * <p> - * The implementation of this method in the PircBot abstract class - * performs no actions and may be overridden as required. - * - * @param line The raw line that was received from the server. - */ - protected void onUnknown(String line) { - // And then there were none :) - } - - - /** - * Sets the verbose mode. If verbose mode is set to true, then log entries - * will be printed to the standard output. The default value is false and - * will result in no output. For general development, we strongly recommend - * setting the verbose mode to true. - * - * @param verbose true if verbose mode is to be used. Default is false. - */ - public final void setVerbose(boolean verbose) { - _verbose = verbose; - } - - - /** - * Sets the name of the bot, which will be used as its nick when it - * tries to join an IRC server. This should be set before joining - * any servers, otherwise the default nick will be used. You would - * typically call this method from the constructor of the class that - * extends PircBot. - * <p> - * The changeNick method should be used if you wish to change your nick - * when you are connected to a server. - * - * @param name The new name of the Bot. - */ - protected final void setName(String name) { - _name = name; - } - - - /** - * Sets the internal nick of the bot. This is only to be called by the - * PircBot class in response to notification of nick changes that apply - * to us. - * - * @param nick The new nick. - */ - private final void setNick(String nick) { - _nick = nick; - } - - - /** - * Sets the internal login of the Bot. This should be set before joining - * any servers. - * - * @param login The new login of the Bot. - */ - protected final void setLogin(String login) { - _login = login; - } - - - /** - * Sets the internal version of the Bot. This should be set before joining - * any servers. - * - * @param version The new version of the Bot. - */ - protected final void setVersion(String version) { - _version = version; - } - - - /** - * Sets the interal finger message. This should be set before joining - * any servers. - * - * @param finger The new finger message for the Bot. - */ - protected final void setFinger(String finger) { - _finger = finger; - } - - - /** - * Gets the name of the PircBot. This is the name that will be used as - * as a nick when we try to join servers. - * - * @return The name of the PircBot. - */ - public final String getName() { - return _name; - } - - - /** - * Returns the current nick of the bot. Note that if you have just changed - * your nick, this method will still return the old nick until confirmation - * of the nick change is received from the server. - * <p> - * The nick returned by this method is maintained only by the PircBot - * class and is guaranteed to be correct in the context of the IRC server. - * - * @since PircBot 1.0.0 - * - * @return The current nick of the bot. - */ - public String getNick() { - return _nick; - } - - - /** - * Gets the internal login of the PircBot. - * - * @return The login of the PircBot. - */ - public final String getLogin() { - return _login; - } - - - /** - * Gets the internal version of the PircBot. - * - * @return The version of the PircBot. - */ - public final String getVersion() { - return _version; - } - - - /** - * Gets the internal finger message of the PircBot. - * - * @return The finger message of the PircBot. - */ - public final String getFinger() { - return _finger; - } - - - /** - * Returns whether or not the PircBot is currently connected to a server. - * The result of this method should only act as a rough guide, - * as the result may not be valid by the time you act upon it. - * - * @return True if and only if the PircBot is currently connected to a server. - */ - public final synchronized boolean isConnected() { - return _inputThread != null && _inputThread.isConnected(); - } - - - /** - * Sets the number of milliseconds to delay between consecutive - * messages when there are multiple messages waiting in the - * outgoing message queue. This has a default value of 1000ms. - * It is a good idea to stick to this default value, as it will - * prevent your bot from spamming servers and facing the subsequent - * wrath! However, if you do need to change this delay value (<b>not - * recommended</b>), then this is the method to use. - * - * @param delay The number of milliseconds between each outgoing message. - * - */ - public final void setMessageDelay(long delay) { - if (delay < 0) { - throw new IllegalArgumentException("Cannot have a negative time."); - } - _messageDelay = delay; - } - - - /** - * Returns the number of milliseconds that will be used to separate - * consecutive messages to the server from the outgoing message queue. - * - * @return Number of milliseconds. - */ - public final long getMessageDelay() { - return _messageDelay; - } - - - /** - * Gets the maximum length of any line that is sent via the IRC protocol. - * The IRC RFC specifies that line lengths, including the trailing \r\n - * must not exceed 512 bytes. Hence, there is currently no option to - * change this value in PircBot. All lines greater than this length - * will be truncated before being sent to the IRC server. - * - * @return The maximum line length (currently fixed at 512) - */ - public final int getMaxLineLength() { - return InputThread.MAX_LINE_LENGTH; - } - - - /** - * Gets the number of lines currently waiting in the outgoing message Queue. - * If this returns 0, then the Queue is empty and any new message is likely - * to be sent to the IRC server immediately. - * - * @since PircBot 0.9.9 - * - * @return The number of lines in the outgoing message Queue. - */ - public final int getOutgoingQueueSize() { - return _outQueue.size(); - } - - - /** - * Returns the name of the last IRC server the PircBot tried to connect to. - * This does not imply that the connection attempt to the server was - * successful (we suggest you look at the onConnect method). - * A value of null is returned if the PircBot has never tried to connect - * to a server. - * - * @return The name of the last machine we tried to connect to. Returns - * null if no connection attempts have ever been made. - */ - public final String getServer() { - return _server; - } - - - /** - * Returns the port number of the last IRC server that the PircBot tried - * to connect to. - * This does not imply that the connection attempt to the server was - * successful (we suggest you look at the onConnect method). - * A value of -1 is returned if the PircBot has never tried to connect - * to a server. - * - * @since PircBot 0.9.9 - * - * @return The port number of the last IRC server we connected to. - * Returns -1 if no connection attempts have ever been made. - */ - public final int getPort() { - return _port; - } - - - /** - * Returns the last password that we used when connecting to an IRC server. - * This does not imply that the connection attempt to the server was - * successful (we suggest you look at the onConnect method). - * A value of null is returned if the PircBot has never tried to connect - * to a server using a password. - * - * @since PircBot 0.9.9 - * - * @return The last password that we used when connecting to an IRC server. - * Returns null if we have not previously connected using a password. - */ - public final String getPassword() { - return _password; - } - - - /** - * A convenient method that accepts an IP address represented as a - * long and returns an integer array of size 4 representing the same - * IP address. - * - * @since PircBot 0.9.4 - * - * @param address the long value representing the IP address. - * - * @return An int[] of size 4. - */ - public int[] longToIp(long address) { - int[] ip = new int[4]; - for (int i = 3; i >= 0; i--) { - ip[i] = (int) (address % 256); - address = address / 256; - } - return ip; - } - - - /** - * A convenient method that accepts an IP address represented by a byte[] - * of size 4 and returns this as a long representation of the same IP - * address. - * - * @since PircBot 0.9.4 - * - * @param address the byte[] of size 4 representing the IP address. - * - * @return a long representation of the IP address. - */ - public long ipToLong(byte[] address) { - if (address.length != 4) { - throw new IllegalArgumentException("byte array must be of length 4"); - } - long ipNum = 0; - long multiplier = 1; - for (int i = 3; i >= 0; i--) { - int byteVal = (address[i] + 256) % 256; - ipNum += byteVal*multiplier; - multiplier *= 256; - } - return ipNum; - } - - - /** - * Sets the encoding charset to be used when sending or receiving lines - * from the IRC server. If set to null, then the platform's default - * charset is used. You should only use this method if you are - * trying to send text to an IRC server in a different charset, e.g. - * "GB2312" for Chinese encoding. If a PircBot is currently connected - * to a server, then it must reconnect before this change takes effect. - * - * @since PircBot 1.0.4 - * - * @param charset The new encoding charset to be used by PircBot. - * - * @throws UnsupportedEncodingException If the named charset is not - * supported. - */ - public void setEncoding(String charset) throws UnsupportedEncodingException { - // Just try to see if the charset is supported first... - "".getBytes(charset); - - _charset = charset; - } - - - /** - * Returns the encoding used to send and receive lines from - * the IRC server, or null if not set. Use the setEncoding - * method to change the encoding charset. - * - * @since PircBot 1.0.4 - * - * @return The encoding used to send outgoing messages, or - * null if not set. - */ - public String getEncoding() { - return _charset; - } - - /** - * Returns the InetAddress used by the PircBot. - * This can be used to find the I.P. address from which the PircBot is - * connected to a server. - * - * @since PircBot 1.4.4 - * - * @return The current local InetAddress, or null if never connected. - */ - public InetAddress getInetAddress() { - return _inetAddress; - } - - - /** - * Sets the InetAddress to be used when sending DCC chat or file transfers. - * This can be very useful when you are running a bot on a machine which - * is behind a firewall and you need to tell receiving clients to connect - * to a NAT/router, which then forwards the connection. - * - * @since PircBot 1.4.4 - * - * @param dccInetAddress The new InetAddress, or null to use the default. - */ - public void setDccInetAddress(InetAddress dccInetAddress) { - _dccInetAddress = dccInetAddress; - } - - - /** - * Returns the InetAddress used when sending DCC chat or file transfers. - * If this is null, the default InetAddress will be used. - * - * @since PircBot 1.4.4 - * - * @return The current DCC InetAddress, or null if left as default. - */ - public InetAddress getDccInetAddress() { - return _dccInetAddress; - } - - - /** - * Returns the set of port numbers to be used when sending a DCC chat - * or file transfer. This is useful when you are behind a firewall and - * need to set up port forwarding. The array of port numbers is traversed - * in sequence until a free port is found to listen on. A DCC tranfer will - * fail if all ports are already in use. - * If set to null, <i>any</i> free port number will be used. - * - * @since PircBot 1.4.4 - * - * @return An array of port numbers that PircBot can use to send DCC - * transfers, or null if any port is allowed. - */ - public int[] getDccPorts() { - if (_dccPorts == null || _dccPorts.length == 0) { - return null; - } - // Clone the array to prevent external modification. - return (int[]) _dccPorts.clone(); - } - - - /** - * Sets the choice of port numbers that can be used when sending a DCC chat - * or file transfer. This is useful when you are behind a firewall and - * need to set up port forwarding. The array of port numbers is traversed - * in sequence until a free port is found to listen on. A DCC tranfer will - * fail if all ports are already in use. - * If set to null, <i>any</i> free port number will be used. - * - * @since PircBot 1.4.4 - * - * @param ports The set of port numbers that PircBot may use for DCC - * transfers, or null to let it use any free port (default). - * - */ - public void setDccPorts(int[] ports) { - if (ports == null || ports.length == 0) { - _dccPorts = null; - } - else { - // Clone the array to prevent external modification. - _dccPorts = (int[]) ports.clone(); - } - } - - - /** - * Returns true if and only if the object being compared is the exact - * same instance as this PircBot. This may be useful if you are writing - * a multiple server IRC bot that uses more than one instance of PircBot. - * - * @since PircBot 0.9.9 - * - * @return true if and only if Object o is a PircBot and equal to this. - */ - public boolean equals(Object o) { - // This probably has the same effect as Object.equals, but that may change... - if (o instanceof PircBot) { - PircBot other = (PircBot) o; - return other == this; - } - return false; - } - - - /** - * Returns the hashCode of this PircBot. This method can be called by hashed - * collection classes and is useful for managing multiple instances of - * PircBots in such collections. - * - * @since PircBot 0.9.9 - * - * @return the hash code for this instance of PircBot. - */ - public int hashCode() { - return super.hashCode(); - } - - - /** - * Returns a String representation of this object. - * You may find this useful for debugging purposes, particularly - * if you are using more than one PircBot instance to achieve - * multiple server connectivity. The format of - * this String may change between different versions of PircBot - * but is currently something of the form - * <code> - * Version{PircBot x.y.z Java IRC Bot - www.jibble.org} - * Connected{true} - * Server{irc.dal.net} - * Port{6667} - * Password{} - * </code> - * - * @since PircBot 0.9.10 - * - * @return a String representation of this object. - */ - public String toString() { - return "Version{" + _version + "}" + - " Connected{" + isConnected() + "}" + - " Server{" + _server + "}" + - " Port{" + _port + "}" + - " Password{" + _password + "}"; - } - - - /** - * Returns an array of all users in the specified channel. - * <p> - * There are some important things to note about this method:- - * <ul> - * <li>This method may not return a full list of users if you call it - * before the complete nick list has arrived from the IRC server. - * </li> - * <li>If you wish to find out which users are in a channel as soon - * as you join it, then you should override the onUserList method - * instead of calling this method, as the onUserList method is only - * called as soon as the full user list has been received. - * </li> - * <li>This method will return immediately, as it does not require any - * interaction with the IRC server. - * </li> - * <li>The bot must be in a channel to be able to know which users are - * in it. - * </li> - * </ul> - * - * @since PircBot 1.0.0 - * - * @param channel The name of the channel to list. - * - * @return An array of User objects. This array is empty if we are not - * in the channel. - * - * @see #onUserList(String,User[]) onUserList - */ - public final User[] getUsers(String channel) { - channel = channel.toLowerCase(Locale.ENGLISH); - User[] userArray = new User[0]; - synchronized (_channels) { - Hashtable users = (Hashtable) _channels.get(channel); - if (users != null) { - userArray = new User[users.size()]; - Enumeration enumeration = users.elements(); - for (int i = 0; i < userArray.length; i++) { - User user = (User) enumeration.nextElement(); - userArray[i] = user; - } - } - } - return userArray; - } - - - /** - * Returns an array of all channels that we are in. Note that if you - * call this method immediately after joining a new channel, the new - * channel may not appear in this array as it is not possible to tell - * if the join was successful until a response is received from the - * IRC server. - * - * @since PircBot 1.0.0 - * - * @return A String array containing the names of all channels that we - * are in. - */ - public final String[] getChannels() { - String[] channels = new String[0]; - synchronized (_channels) { - channels = new String[_channels.size()]; - Enumeration enumeration = _channels.keys(); - for (int i = 0; i < channels.length; i++) { - channels[i] = (String) enumeration.nextElement(); - } - } - return channels; - } - - - /** - * Disposes of all thread resources used by this PircBot. This may be - * useful when writing bots or clients that use multiple servers (and - * therefore multiple PircBot instances) or when integrating a PircBot - * with an existing program. - * <p> - * Each PircBot runs its own threads for dispatching messages from its - * outgoing message queue and receiving messages from the server. - * Calling dispose() ensures that these threads are - * stopped, thus freeing up system resources and allowing the PircBot - * object to be garbage collected if there are no other references to - * it. - * <p> - * Once a PircBot object has been disposed, it should not be used again. - * Attempting to use a PircBot that has been disposed may result in - * unpredictable behaviour. - * - * @since 1.2.2 - */ - public synchronized void dispose() { - //System.out.println("disposing..."); - _outputThread.interrupt(); - _inputThread.dispose(); - } - - - /** - * Add a user to the specified channel in our memory. - * Overwrite the existing entry if it exists. - */ - private final void addUser(String channel, User user) { - channel = channel.toLowerCase(Locale.ENGLISH); - synchronized (_channels) { - Hashtable users = (Hashtable) _channels.get(channel); - if (users == null) { - users = new Hashtable(); - _channels.put(channel, users); - } - users.put(user, user); - } - } - - - /** - * Remove a user from the specified channel in our memory. - */ - private final User removeUser(String channel, String nick) { - channel = channel.toLowerCase(Locale.ENGLISH); - User user = new User("", nick); - synchronized (_channels) { - Hashtable users = (Hashtable) _channels.get(channel); - if (users != null) { - return (User) users.remove(user); - } - } - return null; - } - - - /** - * Remove a user from all channels in our memory. - */ - private final void removeUser(String nick) { - synchronized (_channels) { - Enumeration enumeration = _channels.keys(); - while (enumeration.hasMoreElements()) { - String channel = (String) enumeration.nextElement(); - this.removeUser(channel, nick); - } - } - } - - - /** - * Rename a user if they appear in any of the channels we know about. - */ - private final void renameUser(String oldNick, String newNick) { - synchronized (_channels) { - Enumeration enumeration = _channels.keys(); - while (enumeration.hasMoreElements()) { - String channel = (String) enumeration.nextElement(); - User user = this.removeUser(channel, oldNick); - if (user != null) { - user = new User(user.getPrefix(), newNick); - this.addUser(channel, user); - } - } - } - } - - - /** - * Removes an entire channel from our memory of users. - */ - private final void removeChannel(String channel) { - channel = channel.toLowerCase(Locale.ENGLISH); - synchronized (_channels) { - _channels.remove(channel); - } - } - - - /** - * Removes all channels from our memory of users. - */ - private final void removeAllChannels() { - synchronized(_channels) { - _channels = new Hashtable(); - } - } - - - private final void updateUser(String channel, int userMode, String nick) { - channel = channel.toLowerCase(Locale.ENGLISH); - synchronized (_channels) { - Hashtable users = (Hashtable) _channels.get(channel); - User newUser = null; - if (users != null) { - Enumeration enumeration = users.elements(); - while(enumeration.hasMoreElements()) { - User userObj = (User) enumeration.nextElement(); - if (userObj.getNick().equalsIgnoreCase(nick)) { - if (userMode == OP_ADD) { - if (userObj.hasVoice()) { - newUser = new User("@+", nick); - } - else { - newUser = new User("@", nick); - } - } - else if (userMode == OP_REMOVE) { - if(userObj.hasVoice()) { - newUser = new User("+", nick); - } - else { - newUser = new User("", nick); - } - } - else if (userMode == VOICE_ADD) { - if(userObj.isOp()) { - newUser = new User("@+", nick); - } - else { - newUser = new User("+", nick); - } - } - else if (userMode == VOICE_REMOVE) { - if(userObj.isOp()) { - newUser = new User("@", nick); - } - else { - newUser = new User("", nick); - } - } - } - } - } - if (newUser != null) { - users.put(newUser, newUser); - } - else { - // just in case ... - newUser = new User("", nick); - users.put(newUser, newUser); - } - } - } - - - // Connection stuff. - private InputThread _inputThread = null; - private OutputThread _outputThread = null; - private String _charset = null; - private InetAddress _inetAddress = null; - - // Details about the last server that we connected to. - private String _server = null; - private int _port = -1; - private String _password = null; - - // Outgoing message stuff. - private Queue _outQueue = new Queue(); - private long _messageDelay = 1000; - - // A Hashtable of channels that points to a selfreferential Hashtable of - // User objects (used to remember which users are in which channels). - private Hashtable _channels = new Hashtable(); - - // A Hashtable to temporarily store channel topics when we join them - // until we find out who set that topic. - private Hashtable _topics = new Hashtable(); - - private int[] _dccPorts = null; - private InetAddress _dccInetAddress = null; - - // Default settings for the PircBot. - private boolean _autoNickChange = false; - private boolean _verbose = false; - private String _name = "PircBot"; - private String _nick = _name; - private String _login = "PircBot"; - private String _version = "PircBot " + VERSION + " Java IRC Bot - www.jibble.org"; - private String _finger = "You ought to be arrested for fingering a bot!"; - - private String _channelPrefixes = "#&+!"; -} diff --git a/EssentialsUpdate/src/org/jibble/pircbot/Queue.java b/EssentialsUpdate/src/org/jibble/pircbot/Queue.java deleted file mode 100755 index fd8d47781..000000000 --- a/EssentialsUpdate/src/org/jibble/pircbot/Queue.java +++ /dev/null @@ -1,146 +0,0 @@ -/* -Copyright Paul James Mutton, 2001-2009, http://www.jibble.org/ - -This file is part of PircBot. - -This software is dual-licensed, allowing you to choose between the GNU -General Public License (GPL) and the www.jibble.org Commercial License. -Since the GPL may be too restrictive for use in a proprietary application, -a commercial license is also provided. Full license information can be -found at http://www.jibble.org/licenses/ - -*/ - - -package org.jibble.pircbot; - -import java.util.Vector; - -/** - * Queue is a definition of a data structure that may - * act as a queue - that is, data can be added to one end of the - * queue and data can be requested from the head end of the queue. - * This class is thread safe for multiple producers and a single - * consumer. The next() method will block until there is data in - * the queue. - * - * This has now been modified so that it is compatible with - * the earlier JDK1.1 in order to be suitable for running on - * mobile appliances. This means replacing the LinkedList with - * a Vector, which is hardly ideal, but this Queue is typically - * only polled every second before dispatching messages. - * - * @author Paul James Mutton, - * <a href="http://www.jibble.org/">http://www.jibble.org/</a> - * @version 1.5.0 (Build time: Mon Dec 14 20:07:17 2009) - */ -public class Queue { - - - /** - * Constructs a Queue object of unlimited size. - */ - public Queue() { - - } - - - /** - * Adds an Object to the end of the Queue. - * - * @param o The Object to be added to the Queue. - */ - public void add(Object o) { - synchronized(_queue) { - _queue.addElement(o); - _queue.notify(); - } - } - - - /** - * Adds an Object to the front of the Queue. - * - * @param o The Object to be added to the Queue. - */ - public void addFront(Object o) { - synchronized(_queue) { - _queue.insertElementAt(o, 0); - _queue.notify(); - } - } - - - /** - * Returns the Object at the front of the Queue. This - * Object is then removed from the Queue. If the Queue - * is empty, then this method shall block until there - * is an Object in the Queue to return. - * - * @return The next item from the front of the queue. - */ - public Object next() { - - Object o = null; - - // Block if the Queue is empty. - synchronized(_queue) { - if (_queue.size() == 0) { - try { - _queue.wait(); - } - catch (InterruptedException e) { - return null; - } - } - - // Return the Object. - try { - o = _queue.firstElement(); - _queue.removeElementAt(0); - } - catch (ArrayIndexOutOfBoundsException e) { - throw new InternalError("Race hazard in Queue object."); - } - } - - return o; - } - - - /** - * Returns true if the Queue is not empty. If another - * Thread empties the Queue before <b>next()</b> is - * called, then the call to <b>next()</b> shall block - * until the Queue has been populated again. - * - * @return True only if the Queue not empty. - */ - public boolean hasNext() { - return (this.size() != 0); - } - - - /** - * Clears the contents of the Queue. - */ - public void clear() { - synchronized(_queue) { - _queue.removeAllElements(); - } - } - - - /** - * Returns the size of the Queue. - * - * @return The current size of the queue. - */ - public int size() { - return _queue.size(); - } - - - private Vector _queue = new Vector(); - -} diff --git a/EssentialsUpdate/src/org/jibble/pircbot/ReplyConstants.java b/EssentialsUpdate/src/org/jibble/pircbot/ReplyConstants.java deleted file mode 100755 index 2d8e696d5..000000000 --- a/EssentialsUpdate/src/org/jibble/pircbot/ReplyConstants.java +++ /dev/null @@ -1,176 +0,0 @@ -/* -Copyright Paul James Mutton, 2001-2009, http://www.jibble.org/ - -This file is part of PircBot. - -This software is dual-licensed, allowing you to choose between the GNU -General Public License (GPL) and the www.jibble.org Commercial License. -Since the GPL may be too restrictive for use in a proprietary application, -a commercial license is also provided. Full license information can be -found at http://www.jibble.org/licenses/ - -*/ - - -package org.jibble.pircbot; - -/** - * This interface contains the values of all numeric replies specified - * in section 6 of RFC 1459. Refer to RFC 1459 for further information. - * <p> - * If you override the onServerResponse method in the PircBot class, - * you may find these constants useful when comparing the numeric - * value of a given code. - * - * @since 1.0.0 - * @author Paul James Mutton, - * <a href="http://www.jibble.org/">http://www.jibble.org/</a> - * @version 1.5.0 (Build time: Mon Dec 14 20:07:17 2009) - */ -public interface ReplyConstants { - - - // Error Replies. - public static final int ERR_NOSUCHNICK = 401; - public static final int ERR_NOSUCHSERVER = 402; - public static final int ERR_NOSUCHCHANNEL = 403; - public static final int ERR_CANNOTSENDTOCHAN = 404; - public static final int ERR_TOOMANYCHANNELS = 405; - public static final int ERR_WASNOSUCHNICK = 406; - public static final int ERR_TOOMANYTARGETS = 407; - public static final int ERR_NOORIGIN = 409; - public static final int ERR_NORECIPIENT = 411; - public static final int ERR_NOTEXTTOSEND = 412; - public static final int ERR_NOTOPLEVEL = 413; - public static final int ERR_WILDTOPLEVEL = 414; - public static final int ERR_UNKNOWNCOMMAND = 421; - public static final int ERR_NOMOTD = 422; - public static final int ERR_NOADMININFO = 423; - public static final int ERR_FILEERROR = 424; - public static final int ERR_NONICKNAMEGIVEN = 431; - public static final int ERR_ERRONEUSNICKNAME = 432; - public static final int ERR_NICKNAMEINUSE = 433; - public static final int ERR_NICKCOLLISION = 436; - public static final int ERR_USERNOTINCHANNEL = 441; - public static final int ERR_NOTONCHANNEL = 442; - public static final int ERR_USERONCHANNEL = 443; - public static final int ERR_NOLOGIN = 444; - public static final int ERR_SUMMONDISABLED = 445; - public static final int ERR_USERSDISABLED = 446; - public static final int ERR_NOTREGISTERED = 451; - public static final int ERR_NEEDMOREPARAMS = 461; - public static final int ERR_ALREADYREGISTRED = 462; - public static final int ERR_NOPERMFORHOST = 463; - public static final int ERR_PASSWDMISMATCH = 464; - public static final int ERR_YOUREBANNEDCREEP = 465; - public static final int ERR_KEYSET = 467; - public static final int ERR_CHANNELISFULL = 471; - public static final int ERR_UNKNOWNMODE = 472; - public static final int ERR_INVITEONLYCHAN = 473; - public static final int ERR_BANNEDFROMCHAN = 474; - public static final int ERR_BADCHANNELKEY = 475; - public static final int ERR_NOPRIVILEGES = 481; - public static final int ERR_CHANOPRIVSNEEDED = 482; - public static final int ERR_CANTKILLSERVER = 483; - public static final int ERR_NOOPERHOST = 491; - public static final int ERR_UMODEUNKNOWNFLAG = 501; - public static final int ERR_USERSDONTMATCH = 502; - - - // Command Responses. - public static final int RPL_TRACELINK = 200; - public static final int RPL_TRACECONNECTING = 201; - public static final int RPL_TRACEHANDSHAKE = 202; - public static final int RPL_TRACEUNKNOWN = 203; - public static final int RPL_TRACEOPERATOR = 204; - public static final int RPL_TRACEUSER = 205; - public static final int RPL_TRACESERVER = 206; - public static final int RPL_TRACENEWTYPE = 208; - public static final int RPL_STATSLINKINFO = 211; - public static final int RPL_STATSCOMMANDS = 212; - public static final int RPL_STATSCLINE = 213; - public static final int RPL_STATSNLINE = 214; - public static final int RPL_STATSILINE = 215; - public static final int RPL_STATSKLINE = 216; - public static final int RPL_STATSYLINE = 218; - public static final int RPL_ENDOFSTATS = 219; - public static final int RPL_UMODEIS = 221; - public static final int RPL_STATSLLINE = 241; - public static final int RPL_STATSUPTIME = 242; - public static final int RPL_STATSOLINE = 243; - public static final int RPL_STATSHLINE = 244; - public static final int RPL_LUSERCLIENT = 251; - public static final int RPL_LUSEROP = 252; - public static final int RPL_LUSERUNKNOWN = 253; - public static final int RPL_LUSERCHANNELS = 254; - public static final int RPL_LUSERME = 255; - public static final int RPL_ADMINME = 256; - public static final int RPL_ADMINLOC1 = 257; - public static final int RPL_ADMINLOC2 = 258; - public static final int RPL_ADMINEMAIL = 259; - public static final int RPL_TRACELOG = 261; - public static final int RPL_NONE = 300; - public static final int RPL_AWAY = 301; - public static final int RPL_USERHOST = 302; - public static final int RPL_ISON = 303; - public static final int RPL_UNAWAY = 305; - public static final int RPL_NOWAWAY = 306; - public static final int RPL_WHOISUSER = 311; - public static final int RPL_WHOISSERVER = 312; - public static final int RPL_WHOISOPERATOR = 313; - public static final int RPL_WHOWASUSER = 314; - public static final int RPL_ENDOFWHO = 315; - public static final int RPL_WHOISIDLE = 317; - public static final int RPL_ENDOFWHOIS = 318; - public static final int RPL_WHOISCHANNELS = 319; - public static final int RPL_LISTSTART = 321; - public static final int RPL_LIST = 322; - public static final int RPL_LISTEND = 323; - public static final int RPL_CHANNELMODEIS = 324; - public static final int RPL_NOTOPIC = 331; - public static final int RPL_TOPIC = 332; - public static final int RPL_TOPICINFO = 333; - public static final int RPL_INVITING = 341; - public static final int RPL_SUMMONING = 342; - public static final int RPL_VERSION = 351; - public static final int RPL_WHOREPLY = 352; - public static final int RPL_NAMREPLY = 353; - public static final int RPL_LINKS = 364; - public static final int RPL_ENDOFLINKS = 365; - public static final int RPL_ENDOFNAMES = 366; - public static final int RPL_BANLIST = 367; - public static final int RPL_ENDOFBANLIST = 368; - public static final int RPL_ENDOFWHOWAS = 369; - public static final int RPL_INFO = 371; - public static final int RPL_MOTD = 372; - public static final int RPL_ENDOFINFO = 374; - public static final int RPL_MOTDSTART = 375; - public static final int RPL_ENDOFMOTD = 376; - public static final int RPL_YOUREOPER = 381; - public static final int RPL_REHASHING = 382; - public static final int RPL_TIME = 391; - public static final int RPL_USERSSTART = 392; - public static final int RPL_USERS = 393; - public static final int RPL_ENDOFUSERS = 394; - public static final int RPL_NOUSERS = 395; - - - // Reserved Numerics. - public static final int RPL_TRACECLASS = 209; - public static final int RPL_STATSQLINE = 217; - public static final int RPL_SERVICEINFO = 231; - public static final int RPL_ENDOFSERVICES = 232; - public static final int RPL_SERVICE = 233; - public static final int RPL_SERVLIST = 234; - public static final int RPL_SERVLISTEND = 235; - public static final int RPL_WHOISCHANOP = 316; - public static final int RPL_KILLDONE = 361; - public static final int RPL_CLOSING = 362; - public static final int RPL_CLOSEEND = 363; - public static final int RPL_INFOSTART = 373; - public static final int RPL_MYPORTIS = 384; - public static final int ERR_YOUWILLBEBANNED = 466; - public static final int ERR_BADCHANMASK = 476; - public static final int ERR_NOSERVICEHOST = 492; - -} diff --git a/EssentialsUpdate/src/org/jibble/pircbot/User.java b/EssentialsUpdate/src/org/jibble/pircbot/User.java deleted file mode 100755 index 37f981b19..000000000 --- a/EssentialsUpdate/src/org/jibble/pircbot/User.java +++ /dev/null @@ -1,163 +0,0 @@ -/* -Copyright Paul James Mutton, 2001-2009, http://www.jibble.org/ - -This file is part of PircBot. - -This software is dual-licensed, allowing you to choose between the GNU -General Public License (GPL) and the www.jibble.org Commercial License. -Since the GPL may be too restrictive for use in a proprietary application, -a commercial license is also provided. Full license information can be -found at http://www.jibble.org/licenses/ - -*/ - -package org.jibble.pircbot; - -import java.util.Locale; - -/** - * This class is used to represent a user on an IRC server. - * Instances of this class are returned by the getUsers method - * in the PircBot class. - * <p> - * Note that this class no longer implements the Comparable interface - * for Java 1.1 compatibility reasons. - * - * @since 1.0.0 - * @author Paul James Mutton, - * <a href="http://www.jibble.org/">http://www.jibble.org/</a> - * @version 1.5.0 (Build time: Mon Dec 14 20:07:17 2009) - */ -public class User { - - - /** - * Constructs a User object with a known prefix and nick. - * - * @param prefix The status of the user, for example, "@". - * @param nick The nick of the user. - */ - User(String prefix, String nick) { - _prefix = prefix; - _nick = nick; - _lowerNick = nick.toLowerCase(Locale.ENGLISH); - } - - - /** - * Returns the prefix of the user. If the User object has been obtained - * from a list of users in a channel, then this will reflect the user's - * status in that channel. - * - * @return The prefix of the user. If there is no prefix, then an empty - * String is returned. - */ - public String getPrefix() { - return _prefix; - } - - - /** - * Returns whether or not the user represented by this object is an - * operator. If the User object has been obtained from a list of users - * in a channel, then this will reflect the user's operator status in - * that channel. - * - * @return true if the user is an operator in the channel. - */ - public boolean isOp() { - return _prefix.indexOf('@') >= 0; - } - - - /** - * Returns whether or not the user represented by this object has - * voice. If the User object has been obtained from a list of users - * in a channel, then this will reflect the user's voice status in - * that channel. - * - * @return true if the user has voice in the channel. - */ - public boolean hasVoice() { - return _prefix.indexOf('+') >= 0; - } - - - /** - * Returns the nick of the user. - * - * @return The user's nick. - */ - public String getNick() { - return _nick; - } - - - /** - * Returns the nick of the user complete with their prefix if they - * have one, e.g. "@Dave". - * - * @return The user's prefix and nick. - */ - public String toString() { - return this.getPrefix() + this.getNick(); - } - - - /** - * Returns true if the nick represented by this User object is the same - * as the argument. A case insensitive comparison is made. - * - * @return true if the nicks are identical (case insensitive). - */ - public boolean equals(String nick) { - return nick.toLowerCase(Locale.ENGLISH).equals(_lowerNick); - } - - - /** - * Returns true if the nick represented by this User object is the same - * as the nick of the User object given as an argument. - * A case insensitive comparison is made. - * - * @return true if o is a User object with a matching lowercase nick. - */ - public boolean equals(Object o) { - if (o instanceof User) { - User other = (User) o; - return other._lowerNick.equals(_lowerNick); - } - return false; - } - - - /** - * Returns the hash code of this User object. - * - * @return the hash code of the User object. - */ - public int hashCode() { - return _lowerNick.hashCode(); - } - - - /** - * Returns the result of calling the compareTo method on lowercased - * nicks. This is useful for sorting lists of User objects. - * - * @return the result of calling compareTo on lowercased nicks. - */ - public int compareTo(Object o) { - if (o instanceof User) { - User other = (User) o; - return other._lowerNick.compareTo(_lowerNick); - } - return -1; - } - - - private String _prefix; - private String _nick; - private String _lowerNick; - -} diff --git a/EssentialsUpdate/src/plugin.yml b/EssentialsUpdate/src/plugin.yml deleted file mode 100644 index b8dbe8e25..000000000 --- a/EssentialsUpdate/src/plugin.yml +++ /dev/null @@ -1,21 +0,0 @@ -# This determines the command prefix when there are conflicts (/name:home, /name:help, etc.) -name: EssentialsUpdate -main: com.earth2me.essentials.update.EssentialsUpdate -# Note to developers: This next line cannot change, or the automatic versioning system will break. -version: TeamCity -description: This plugin allows to install or update all Essentials plugins -authors: [snowleo] -commands: - essentialsupdate: - description: Install or update the Essentials plugins. - usage: /<command> - essentialshelp: - description: Get help from the Essentials support chat. - usage: /<command> -permissions: - essentials.update: - description: Allows you to update Essentials - default: op - essentials.helpchat: - description: Allows you to join Essentials help chat - default: op
\ No newline at end of file diff --git a/EssentialsUpdate/test/com/earth2me/essentials/update/UploadTest.java b/EssentialsUpdate/test/com/earth2me/essentials/update/UploadTest.java deleted file mode 100644 index a51f03bd7..000000000 --- a/EssentialsUpdate/test/com/earth2me/essentials/update/UploadTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.earth2me.essentials.update; - -import java.io.IOException; -import java.util.logging.Level; -import java.util.logging.Logger; -import junit.framework.TestCase; -import org.junit.Test; - - -public class UploadTest extends TestCase -{ - @Test - public void testPastieUpload() - { - try - { - final PastieUpload pastie = new PastieUpload(); - assertNotNull(pastie); - //final String url = pastie.send("test"); - //System.out.println(url); - } - catch (IOException ex) - { - Logger.getLogger(UploadTest.class.getName()).log(Level.SEVERE, null, ex); - } - } -} diff --git a/EssentialsUpdate/test/com/earth2me/essentials/update/VersionTest.java b/EssentialsUpdate/test/com/earth2me/essentials/update/VersionTest.java deleted file mode 100644 index 024f2248b..000000000 --- a/EssentialsUpdate/test/com/earth2me/essentials/update/VersionTest.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.earth2me.essentials.update; - -import com.earth2me.essentials.update.Version.Type; -import java.util.TreeSet; -import junit.framework.TestCase; -import org.junit.Test; - - -public class VersionTest extends TestCase -{ - @Test - public void testStable() - { - final Version instance = new Version("1.2.3"); - assertEquals("Testing Major", 1, instance.getMajor()); - assertEquals("Testing Minor", 2, instance.getMinor()); - assertEquals("Testing Build", 3, instance.getBuild()); - assertEquals("Testing Type", Type.STABLE, instance.getType()); - } - - @Test - public void testDev() - { - final Version instance = new Version("Dev2.3.4"); - assertEquals("Testing Major", 2, instance.getMajor()); - assertEquals("Testing Minor", 3, instance.getMinor()); - assertEquals("Testing Build", 4, instance.getBuild()); - assertEquals("Testing Type", Type.DEVELOPER, instance.getType()); - } - - @Test - public void testTeamCity() - { - final Version instance = new Version("Teamcity"); - assertEquals("Testing Type", Type.DEVELOPER, instance.getType()); - } - - @Test - public void testPre() - { - final Version instance = new Version("Pre5.7.400.2"); - assertEquals("Testing Major", 5, instance.getMajor()); - assertEquals("Testing Minor", 7, instance.getMinor()); - assertEquals("Testing Build", 400, instance.getBuild()); - assertEquals("Testing Type", Type.PREVIEW, instance.getType()); - } - - @Test - public void testCompareTo() - { - final Version verA = new Version("1.1.1"); - final Version verB = new Version("Dev1.1.2"); - final Version verC = new Version("1.1.2"); - final Version verD = new Version("1.2.0"); - final Version verE = new Version("2.0.0"); - final Version verF = new Version("Pre1.1.1.1"); - final Version verG = new Version("Dev1.2.2"); - assertTrue("Testing dev", verA.compareTo(verB) < 0); - assertTrue("Testing dev", verB.compareTo(verA) > 0); - assertTrue("Testing build", verA.compareTo(verC) < 0); - assertTrue("Testing build", verC.compareTo(verA) > 0); - assertTrue("Testing minor", verA.compareTo(verD) < 0); - assertTrue("Testing minor", verD.compareTo(verA) > 0); - assertTrue("Testing major", verA.compareTo(verE) < 0); - assertTrue("Testing major", verE.compareTo(verA) > 0); - assertTrue("Testing pre", verF.compareTo(verA) < 0); - assertTrue("Testing pre", verA.compareTo(verF) > 0); - assertTrue("Testing dev vs dev", verB.compareTo(verG) < 0); - assertTrue("Testing dev vs dev", verG.compareTo(verB) > 0); - final TreeSet<Version> set = new TreeSet<Version>(); - set.add(verA); - set.add(verB); - set.add(verC); - set.add(verD); - set.add(verE); - set.add(verF); - set.add(verG); - assertEquals("Testing sorting", verF, set.pollFirst()); - assertEquals("Testing sorting", verA, set.pollFirst()); - assertEquals("Testing sorting", verC, set.pollFirst()); - assertEquals("Testing sorting", verD, set.pollFirst()); - assertEquals("Testing sorting", verE, set.pollFirst()); - assertEquals("Testing sorting", verB, set.pollFirst()); - assertEquals("Testing sorting", verG, set.pollFirst()); - } -} @@ -16,6 +16,7 @@ <target name="buildRest" depends="buildEss"> <ant dir="EssentialsChat" antfile="build.xml"/> <ant dir="EssentialsSpawn" antfile="build.xml"/> + <ant dir="EssentialsAntiBuild" antfile="build.xml"/> <ant dir="EssentialsProtect" antfile="build.xml"/> <ant dir="EssentialsGeoIP" antfile="build.xml"/> <ant dir="EssentialsXMPP" antfile="build.xml"/> |