mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-07-01 04:26:42 +00:00
Compare commits
156 Commits
Author | SHA1 | Date | |
---|---|---|---|
70e248202b | |||
51ef752259 | |||
b3e40462e2 | |||
73a91c02c6 | |||
7b8ba0bdf5 | |||
bd9d6114ba | |||
0435174342 | |||
796ef3d359 | |||
a3f3903760 | |||
5c99aa9a44 | |||
8292eb20ae | |||
d9e0791a3b | |||
dbfec1e86d | |||
31e03d6348 | |||
46494a2c87 | |||
b11eb0f762 | |||
730b0e2c83 | |||
60a9de7e7c | |||
8a4fa946fd | |||
9bc0859fdf | |||
742450d016 | |||
ad06bea3ae | |||
68d83fa397 | |||
fe84c3a2a0 | |||
6e5e70ac90 | |||
489549a0ea | |||
56b55eb3e2 | |||
4ef5f59fb9 | |||
d31ad2e9fc | |||
8a9dfca6d3 | |||
55ddf5a30a | |||
59e890c654 | |||
b0e62add9f | |||
7cdf1abcf2 | |||
ee0ebd85fc | |||
518537413b | |||
802d02d653 | |||
f3cb57c9cd | |||
c7c2795f41 | |||
20b117a703 | |||
8522570db5 | |||
08e4a4a171 | |||
a0affddeed | |||
c82113dc22 | |||
9315227906 | |||
00e9b4ea1f | |||
22b0781020 | |||
7df24c6b86 | |||
0e9044ffc3 | |||
3371f54c06 | |||
5e4649a4d0 | |||
d8560ebc1f | |||
7f2e72ee51 | |||
c98909df12 | |||
d613e0266b | |||
92d7c58957 | |||
478244773b | |||
5237fa0ca2 | |||
b3b182e753 | |||
a54c113a86 | |||
ec8a528564 | |||
6365672eda | |||
d087dc1148 | |||
a3a484dc58 | |||
b89ccb2d55 | |||
9b66304f63 | |||
4784348027 | |||
2705bb4534 | |||
0f6f21e4c6 | |||
527ac6c286 | |||
192b9ea9d9 | |||
fa1a082972 | |||
cf135e211d | |||
56a5a7304a | |||
4b671cc4c7 | |||
10443ff0d5 | |||
5f1f9184ae | |||
a1bb6a34a0 | |||
dfd5f2dba0 | |||
988e62213e | |||
49601035a5 | |||
d05f8b7169 | |||
fbca5f0527 | |||
1c14889bdf | |||
114372194a | |||
49b841acc2 | |||
302b538a3a | |||
539f28549a | |||
716ba57739 | |||
0d32ca5451 | |||
b8b8ed8608 | |||
ca5b79331b | |||
78c1a2eaaf | |||
be4ec7fc04 | |||
794ad2e57a | |||
d2a5c399f0 | |||
67d8bfce09 | |||
90aa3ab420 | |||
a395904c43 | |||
42812be4c5 | |||
049432789f | |||
8b2532e9e9 | |||
e5902fc5e8 | |||
71862d6e41 | |||
7dffea0ba2 | |||
67c09546f7 | |||
8b51fd215f | |||
275204fb2e | |||
1330d2b3af | |||
4204210f66 | |||
8297d03a86 | |||
75353ae4b1 | |||
a28959db0e | |||
b2e27ec8bf | |||
c42bc23bfe | |||
e29d4673dd | |||
2ce7e518fb | |||
9ba316464e | |||
60f71c9dfc | |||
3e71286507 | |||
6d48c90d16 | |||
d7ed667b89 | |||
9c61cc2768 | |||
4daad76e74 | |||
05884ae806 | |||
aa0fd34859 | |||
2c14773c9b | |||
695168ebfe | |||
bbc1255963 | |||
34d15d4c96 | |||
75bc17cd8f | |||
87f338194c | |||
b5760afbad | |||
5cfaf8970d | |||
9a48ec04aa | |||
24fca9af97 | |||
a9ef738602 | |||
27a04635a2 | |||
0f58746525 | |||
a8d4b5f582 | |||
d7f1de4cb7 | |||
ddbb6228f1 | |||
d4c3a4ad45 | |||
7140e4c8df | |||
808e02f660 | |||
bed78248fb | |||
ee39e89093 | |||
9405604efc | |||
73acb2448b | |||
c63540129f | |||
6ba96b427d | |||
acd8373f81 | |||
0c4c36b2bd | |||
7ce052900e | |||
f8741b0d4f | |||
6fca19fa41 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -17,3 +17,6 @@ manifest.mf
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# TFM files
|
||||
buildcreator.properties
|
||||
|
@ -21,6 +21,9 @@ For those who wish to contribute, we encourage you to fork the repository and su
|
||||
* Make sure your changes build (<b>and work!</b>).
|
||||
|
||||
## Tips - How To Get Your Pull Request Accepted ##
|
||||
* See this picture for help:
|
||||

|
||||
|
||||
* Make sure your changes work and compile without difficulty.
|
||||
* Make sure your change adds something useful, do not add commands to micromanage the server. (ie: Shorthands for a collection of commands)
|
||||
* __Commands that make use of `org.bukkit.Server.dispatchCommand()` will probably be rejected.__
|
||||
|
11
LICENSE.md
11
LICENSE.md
@ -1,12 +1,3 @@
|
||||
# TotalFreedomMod License #
|
||||
TotalFreedomMod is primarily derived from the Bukkit and CraftBukkit library and server, respectively. Therefore, we have chosen for it to inherit the GNU GPLv3 License as used by those programs. This license is available at http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
||||
We do, however, ask that you comply by several restrictions. These restrictions are in place to make sure that credit is given to the original authors, who remain the maintainers of the plugin and its source code.
|
||||
* A un-edited copy of this LICENSE.md shall always be included with this source code.
|
||||
* TotalFreedomMod source code and its derivations shall be freely distributable between anyone who chooses to download it.
|
||||
* You shall not remove the keywords "Madgeek1450", "StevenLawson", "DarthSalamon" or "JeromSar" from any part of the source code.
|
||||
* You may not modify the file TFM_FrontDoor.java. Removing it is fine, however.
|
||||
* Compiled binaries (*.jar's) shall not to be distributed.
|
||||
* If you wish to obtain a copy of TotalFreedomMod you must compile the original source code or it's derivations yourself.
|
||||
* The primary developers, StevenLawson (Madgeek1450) and Jerom van der Sar (DarthSalamon), may choose to provide official binaries on a discretionary basis.
|
||||
* Any restrictions listed here may be waived by any of the above mentioned primary developers.
|
||||
TotalFreedomMod is licensed under the TotalFreedom General License. It is available [here](https://github.com/TotalFreedom/License/blob/master/LICENSE.md).
|
||||
|
@ -1,5 +0,0 @@
|
||||
#Tue, 08 Oct 2013 13:58:56 -0400
|
||||
|
||||
program.VERSION=3.3
|
||||
program.BUILDNUM=616
|
||||
program.BUILDDATE=10/08/2013 01\:58 PM
|
93
build.xml
93
build.xml
@ -1,83 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="TotalFreedomMod" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project TotalFreedomMod.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
<import file="nbproject/build-impl.xml" />
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
<target name="-pre-jar">
|
||||
<copy file="buildcreator.default.properties" tofile="buildcreator.properties" overwrite="false" />
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
<property file="buildcreator.properties"/>
|
||||
<buildnumber file="buildnumber.properties" />
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
<propertyfile file="appinfo.properties">
|
||||
<entry key="program.buildnumber" value="${build.number}" />
|
||||
<entry key="program.builddate" type="date" value="now" pattern="MM/dd/yyyy hh:mm aa" />
|
||||
<entry key="program.buildcreator" value="${program.buildcreator}" />
|
||||
</propertyfile>
|
||||
<copy file="appinfo.properties" todir="${build.classes.dir}" />
|
||||
<delete file="appinfo.properties" />
|
||||
</target>
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar-with-manifest: JAR building (if you are using a manifest)
|
||||
-do-jar-without-manifest: JAR building (if you are not using a manifest)
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="TotalFreedomMod-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
<target name="-pre-jar">
|
||||
<buildnumber file="buildnumber.properties" />
|
||||
<propertyfile file="appinfo.properties">
|
||||
<entry key="program.VERSION" default="0.0" />
|
||||
<entry key="program.BUILDNUM" value="${build.number}" />
|
||||
<entry key="program.BUILDDATE" type="date" value="now" pattern="MM/dd/yyyy hh:mm aa" />
|
||||
</propertyfile>
|
||||
<copy file="appinfo.properties" todir="${build.classes.dir}" />
|
||||
</target>
|
||||
<target name="-post-jar">
|
||||
<!-- Cleanup -->
|
||||
<delete file="${dist.dir}/README.TXT" />
|
||||
<delete dir="${dist.dir}/lib/" />
|
||||
</target>
|
||||
</project>
|
||||
|
2
buildcreator.default.properties
Normal file
2
buildcreator.default.properties
Normal file
@ -0,0 +1,2 @@
|
||||
# Build creator configuration
|
||||
program.buildcreator=Unknown
|
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Tue Oct 08 13:58:56 EDT 2013
|
||||
build.number=617
|
||||
#Tue May 13 17:55:47 CEST 2014
|
||||
build.number=846
|
||||
|
@ -18,7 +18,7 @@ is divided into following sections:
|
||||
- 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="TotalFreedomMod-impl">
|
||||
<fail message="Please build using Ant 1.8.0 or higher.">
|
||||
<condition>
|
||||
@ -29,10 +29,10 @@ is divided into following sections:
|
||||
</fail>
|
||||
<target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
|
||||
<!--
|
||||
======================
|
||||
INITIALIZATION SECTION
|
||||
======================
|
||||
-->
|
||||
======================
|
||||
INITIALIZATION SECTION
|
||||
======================
|
||||
-->
|
||||
<target name="-pre-init">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
@ -645,8 +645,8 @@ is divided into following sections:
|
||||
</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
|
||||
-->
|
||||
pre NB7.2 profiling section; consider it deprecated
|
||||
-->
|
||||
<target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
|
||||
<target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
@ -693,8 +693,8 @@ is divided into following sections:
|
||||
<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
|
||||
-->
|
||||
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"/>
|
||||
@ -854,10 +854,10 @@ is divided into following sections:
|
||||
</target>
|
||||
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
|
||||
<!--
|
||||
===================
|
||||
COMPILATION SECTION
|
||||
===================
|
||||
-->
|
||||
===================
|
||||
COMPILATION SECTION
|
||||
===================
|
||||
-->
|
||||
<target name="-deps-jar-init" unless="built-jar.properties">
|
||||
<property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
|
||||
<delete file="${built-jar.properties}" quiet="true"/>
|
||||
@ -928,10 +928,10 @@ is divided into following sections:
|
||||
</target>
|
||||
<target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
|
||||
<!--
|
||||
====================
|
||||
JAR BUILDING SECTION
|
||||
====================
|
||||
-->
|
||||
====================
|
||||
JAR BUILDING SECTION
|
||||
====================
|
||||
-->
|
||||
<target depends="init" name="-pre-pre-jar">
|
||||
<dirname file="${dist.jar}" property="dist.jar.dir"/>
|
||||
<mkdir dir="${dist.jar.dir}"/>
|
||||
@ -1000,10 +1000,10 @@ is divided into following sections:
|
||||
</target>
|
||||
<target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
|
||||
<!--
|
||||
=================
|
||||
EXECUTION SECTION
|
||||
=================
|
||||
-->
|
||||
=================
|
||||
EXECUTION SECTION
|
||||
=================
|
||||
-->
|
||||
<target depends="init,compile" description="Run a main class." name="run">
|
||||
<j2seproject1:java>
|
||||
<customize>
|
||||
@ -1023,10 +1023,10 @@ is divided into following sections:
|
||||
<j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
|
||||
</target>
|
||||
<!--
|
||||
=================
|
||||
DEBUGGING SECTION
|
||||
=================
|
||||
-->
|
||||
=================
|
||||
DEBUGGING SECTION
|
||||
=================
|
||||
-->
|
||||
<target depends="init" if="netbeans.home" name="-debug-start-debugger">
|
||||
<j2seproject1:nbjpdastart name="${debug.class}"/>
|
||||
</target>
|
||||
@ -1064,13 +1064,13 @@ is divided into following sections:
|
||||
</target>
|
||||
<target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
|
||||
<!--
|
||||
=================
|
||||
PROFILING SECTION
|
||||
=================
|
||||
-->
|
||||
=================
|
||||
PROFILING SECTION
|
||||
=================
|
||||
-->
|
||||
<!--
|
||||
pre NB7.2 profiler integration
|
||||
-->
|
||||
pre NB7.2 profiler integration
|
||||
-->
|
||||
<target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
|
||||
<fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
|
||||
<nbprofiledirect>
|
||||
@ -1127,8 +1127,8 @@ is divided into following sections:
|
||||
</junit>
|
||||
</target>
|
||||
<!--
|
||||
end of pre NB72 profiling section
|
||||
-->
|
||||
end of pre NB72 profiling section
|
||||
-->
|
||||
<target if="netbeans.home" name="-profile-check">
|
||||
<condition property="profiler.configured">
|
||||
<or>
|
||||
@ -1163,10 +1163,10 @@ is divided into following sections:
|
||||
<antcall target="run-applet"/>
|
||||
</target>
|
||||
<!--
|
||||
===============
|
||||
JAVADOC SECTION
|
||||
===============
|
||||
-->
|
||||
===============
|
||||
JAVADOC SECTION
|
||||
===============
|
||||
-->
|
||||
<target depends="init" if="have.sources" name="-javadoc-build">
|
||||
<mkdir dir="${dist.javadoc.dir}"/>
|
||||
<condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}">
|
||||
@ -1204,10 +1204,10 @@ is divided into following sections:
|
||||
</target>
|
||||
<target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
|
||||
<!--
|
||||
=========================
|
||||
TEST COMPILATION SECTION
|
||||
=========================
|
||||
-->
|
||||
=========================
|
||||
TEST COMPILATION SECTION
|
||||
=========================
|
||||
-->
|
||||
<target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
|
||||
<mkdir dir="${build.test.classes.dir}"/>
|
||||
</target>
|
||||
@ -1243,10 +1243,10 @@ is divided into following sections:
|
||||
</target>
|
||||
<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
|
||||
=======================
|
||||
-->
|
||||
=======================
|
||||
TEST EXECUTION SECTION
|
||||
=======================
|
||||
-->
|
||||
<target depends="init" if="have.tests" name="-pre-test-run">
|
||||
<mkdir dir="${build.test.results.dir}"/>
|
||||
</target>
|
||||
@ -1280,10 +1280,10 @@ is divided into following sections:
|
||||
</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
|
||||
=======================
|
||||
-->
|
||||
=======================
|
||||
TEST DEBUGGING SECTION
|
||||
=======================
|
||||
-->
|
||||
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test">
|
||||
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
|
||||
<j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
|
||||
@ -1303,10 +1303,10 @@ is divided into following sections:
|
||||
</target>
|
||||
<target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
|
||||
<!--
|
||||
=========================
|
||||
APPLET EXECUTION SECTION
|
||||
=========================
|
||||
-->
|
||||
=========================
|
||||
APPLET EXECUTION SECTION
|
||||
=========================
|
||||
-->
|
||||
<target depends="init,compile-single" name="run-applet">
|
||||
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
|
||||
<j2seproject1:java classname="sun.applet.AppletViewer">
|
||||
@ -1316,10 +1316,10 @@ is divided into following sections:
|
||||
</j2seproject1:java>
|
||||
</target>
|
||||
<!--
|
||||
=========================
|
||||
APPLET DEBUGGING SECTION
|
||||
=========================
|
||||
-->
|
||||
=========================
|
||||
APPLET DEBUGGING SECTION
|
||||
=========================
|
||||
-->
|
||||
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
|
||||
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
|
||||
<j2seproject3:debug classname="sun.applet.AppletViewer">
|
||||
@ -1330,10 +1330,10 @@ is divided into following sections:
|
||||
</target>
|
||||
<target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
|
||||
<!--
|
||||
===============
|
||||
CLEANUP SECTION
|
||||
===============
|
||||
-->
|
||||
===============
|
||||
CLEANUP SECTION
|
||||
===============
|
||||
-->
|
||||
<target name="-deps-clean-init" unless="built-clean.properties">
|
||||
<property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
|
||||
<delete file="${built-clean.properties}" quiet="true"/>
|
||||
|
@ -48,11 +48,11 @@ jar.archive.disabled=${jnlp.enabled}
|
||||
jar.compress=false
|
||||
jar.index=${jnlp.enabled}
|
||||
javac.classpath=\
|
||||
${libs.CraftBukkit.classpath}:\
|
||||
${libs.WorldEdit.classpath}:\
|
||||
${libs.DisguiseCraft.classpath}:\
|
||||
${libs.Essentials.classpath}:\
|
||||
${libs.BukkitTelnet.classpath}
|
||||
${libs.BukkitTelnet.classpath}:\
|
||||
${libs.CraftBukkit.classpath}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
|
||||
javac.deprecation=false
|
||||
@ -85,7 +85,6 @@ jnlp.signed=false
|
||||
jnlp.signing=
|
||||
jnlp.signing.alias=
|
||||
jnlp.signing.keystore=
|
||||
main.class=totalfreedommod.TotalFreedomMod
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=true
|
||||
|
13
src/bans.yml
Normal file
13
src/bans.yml
Normal file
@ -0,0 +1,13 @@
|
||||
#
|
||||
# TotalFreedomMod banning config
|
||||
# Warning: modification of this file is not recomended
|
||||
#
|
||||
# Format:
|
||||
# Ip: [IP-address / UUID]:[Last login name]:[Expiry unix timestamp (0 = never)][Banned by]:[Reason]
|
||||
#
|
||||
|
||||
ips:
|
||||
- '192.168.1.254:Notch:DarthSalamon:0:IP ban example'
|
||||
|
||||
uuids:
|
||||
- '245d2f30-61fb-4840-9cd3-298b3920f4a4:Cobrex:DarthSalamon:0:UUID ban example'
|
135
src/config.yml
135
src/config.yml
@ -1,33 +1,32 @@
|
||||
# TotalFreedomMod v3.3 Configuration
|
||||
# TotalFreedomMod v4.2 Configuration
|
||||
# by Madgeek1450 and DarthSalamon
|
||||
|
||||
# Block placement prevention:
|
||||
allow_fire_place: false
|
||||
allow_fire_spread: false
|
||||
allow_lava_damage: false
|
||||
allow_lava_place: false
|
||||
allow_water_place: false
|
||||
allow_fluid_spread: false
|
||||
allow_tnt_minecarts: false
|
||||
# Blocking certain events
|
||||
allow:
|
||||
fire_place: false
|
||||
fire_spread: false
|
||||
fluid_spread: false
|
||||
lava_place: false
|
||||
lava_damage: false
|
||||
water_place: false
|
||||
tnt_minecarts: false
|
||||
explosions: false
|
||||
|
||||
# Explosion management:
|
||||
allow_explosions: false
|
||||
explosive_radius: 4.0
|
||||
|
||||
# Blocked commands:
|
||||
#
|
||||
# How blocked commands work:
|
||||
# All sections described below are delimited by colon-characters.
|
||||
# Make sure that you block a command by it's main command name, not an alias
|
||||
# -as all aliases are blocked by default. Commands are case-insensitive ofcourse.
|
||||
# You can block specific subcommands aswell. eg: /mail sendall
|
||||
# All sections described below are delimited by colon characters.
|
||||
# Make sure that you block a command by its main command name, not an alias
|
||||
# -as all aliases are blocked by default. Commands are case-insensitive.
|
||||
#
|
||||
# * The first section is a letter which indicates which rank may use this command
|
||||
# Valid ranks:
|
||||
# n - Nobody (Completely disabled)
|
||||
# c - Senior Admins (Console)
|
||||
# t - Telnet Admins (Console)
|
||||
# s - SuperAdmins
|
||||
# s - Super Admins (Any in-game admin)
|
||||
# o - Ops (Non-Ops won't be able to use it)
|
||||
#
|
||||
# * The second section is a letter which indicates what to do when a player executes that command.
|
||||
@ -61,7 +60,7 @@ blocked_commands:
|
||||
- 'n:b:/toggledownfall:_'
|
||||
- 'n:b:/effect:Please use /potion to set effects.'
|
||||
- 'n:b:/enderchest:_'
|
||||
|
||||
|
||||
# Superadmin commands
|
||||
- 's:b:/kick:_'
|
||||
- 's:b:/socialspy:_'
|
||||
@ -74,34 +73,41 @@ blocked_commands:
|
||||
- 's:b:/tool:_'
|
||||
- 's:b://butcher:_'
|
||||
- 's:b:/scoreboard:_'
|
||||
|
||||
- 's:b:/setspawn:_'
|
||||
|
||||
# Superadmin commands - Auto-eject
|
||||
- 's:a:/stop'
|
||||
- 's:a:/reload'
|
||||
- 's:a:/nuke'
|
||||
- 's:a:/save-all'
|
||||
- 's:a:/save-on'
|
||||
- 's:a:/save-off'
|
||||
- 's:a:/clearhistory'
|
||||
- 's:a:/mat'
|
||||
|
||||
# Spigot commands
|
||||
- 's:a:/restart'
|
||||
- 's:b:/setblock'
|
||||
|
||||
# Automatically wipe dropped objects:
|
||||
auto_wipe: true
|
||||
|
||||
# Nuking prevention:
|
||||
nuke_monitor: true
|
||||
nuke_monitor_count_break: 100
|
||||
nuke_monitor_count_place: 25
|
||||
nuke_monitor_range: 10.0
|
||||
# Nuking prevention
|
||||
nukemonitor:
|
||||
enabled: true
|
||||
count_break: 100
|
||||
count_place: 40
|
||||
range: 10.0
|
||||
|
||||
freecam_trigger_count: 10
|
||||
|
||||
# Show all attempted commands in the log, will result in duplicate log messages:
|
||||
preprocess_log: true
|
||||
|
||||
# Disable nighttime:
|
||||
disable_night: true
|
||||
# Disable certain events
|
||||
disable:
|
||||
night: true
|
||||
weather: true
|
||||
|
||||
# Disable weather:
|
||||
disable_weather: true
|
||||
|
||||
# Enable misc. features:
|
||||
landmines_enabled: false
|
||||
@ -109,26 +115,34 @@ mp44_enabled: false
|
||||
tossmob_enabled: false
|
||||
|
||||
# Moblimiter:
|
||||
mob_limiter_enabled: true
|
||||
# Max per world:
|
||||
mob_limiter_max: 50
|
||||
mob_limiter_disable_dragon: true
|
||||
mob_limiter_disable_ghast: true
|
||||
mob_limiter_disable_slime: true
|
||||
mob_limiter_disable_giant: true
|
||||
|
||||
moblimiter:
|
||||
enabled: true
|
||||
max: 50
|
||||
disable:
|
||||
dragon: true
|
||||
ghast: true
|
||||
slime: true
|
||||
giant: true
|
||||
|
||||
# Flatlands
|
||||
generate_flatlands: true
|
||||
# Flatlands generation parameters, uses CleanroomGenerator syntax - http://dev.bukkit.org/server-mods/cleanroomgenerator/
|
||||
flatlands_generation_params: 16,stone,32,dirt,1,grass
|
||||
flatlands:
|
||||
generate: true
|
||||
# Flatlands generation parameters, uses CleanroomGenerator syntax - http://dev.bukkit.org/server-mods/cleanroomgenerator/
|
||||
generate_params: 16,stone,32,dirt,1,grass
|
||||
|
||||
# Admin-Only Mode
|
||||
admin_only_mode: false
|
||||
|
||||
# Protected Areas - Protect areas so that only superadmins can directly modify blocks in those areas. WorldEdit and other such plugins might bypass this.
|
||||
protected_areas_enabled: true
|
||||
auto_protect_spawnpoints: true
|
||||
auto_protect_radius: 25.0
|
||||
protectarea:
|
||||
enabled: true
|
||||
auto_protect_spawnpoints: true
|
||||
auto_protect_radius: 25.0
|
||||
|
||||
# Give the default CONSOLE senior admin privileges.
|
||||
# Handy in development environments.
|
||||
console_is_senior: true
|
||||
|
||||
# Host Sender Names - Names that indicate automated services or host-based consoles you want to block from using some commands.
|
||||
# Make sure these are all lower-case.
|
||||
@ -171,30 +185,39 @@ unbannable_usernames:
|
||||
- cavemanfilms
|
||||
- herobrine
|
||||
- whiteboy7thst
|
||||
- stampylonghead
|
||||
- stampylongnose
|
||||
- dantdm
|
||||
- gizzy14gazza
|
||||
|
||||
# TwitterBot - Used to allow superadmins to verify themselves using twitter
|
||||
twitterbot_enabled: false
|
||||
twitterbot_url: ''
|
||||
twitterbot_secret: ''
|
||||
twitterbot:
|
||||
enabled: false
|
||||
url: ''
|
||||
secret: ''
|
||||
|
||||
# Pet Protect - Prevent tamed pets from being killed.
|
||||
pet_protect_enabled: true
|
||||
petprotect:
|
||||
enabled: true
|
||||
|
||||
# Logs Registration
|
||||
logs_register_password: ''
|
||||
logs_register_url: ''
|
||||
|
||||
logs:
|
||||
url: ''
|
||||
secret: ''
|
||||
|
||||
# Mojang service checker
|
||||
service_checker_url: http://status.mojang.com/check
|
||||
|
||||
# HTTPD
|
||||
httpd_enabled: true
|
||||
httpd_public_folder: ./public_html
|
||||
httpd_port: 28966
|
||||
httpd:
|
||||
enabled: true
|
||||
port: 28966
|
||||
public_folder: ./public_html
|
||||
|
||||
# Inactivity Auto-Kick (Requires Essentials)
|
||||
autokick_enabled: true
|
||||
# autokick_threshold - Percentage of server player capacity used at which players will be automatically kicked for being inactive. Range: 0.0 - 1.0
|
||||
autokick_threshold: 0.9
|
||||
# autokick_time - Time, in seconds, after which a player should be kicked when inactive
|
||||
autokick_time: 120
|
||||
autokick:
|
||||
enabled: true
|
||||
# autokick_threshold - Percentage of server player capacity used at which players will be automatically kicked for being inactive. Range: 0.0 - 1.0
|
||||
threshold: 0.9
|
||||
# autokick_time - Time, in seconds, after which a player should be kicked when inactive
|
||||
time: 120
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.Bridge;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import pgDev.bukkit.DisguiseCraft.DisguiseCraft;
|
@ -1,7 +1,9 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.Bridge;
|
||||
|
||||
import com.earth2me.essentials.Essentials;
|
||||
import com.earth2me.essentials.User;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@ -77,7 +79,7 @@ public class TFM_EssentialsBridge
|
||||
final User user = getEssentialsUser(username);
|
||||
if (user != null)
|
||||
{
|
||||
return TFM_Util.getField(user, "lastActivity");
|
||||
return TFM_Util.<Long>getField(user, "lastActivity"); // This is weird
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
@ -1,4 +1,4 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.Bridge;
|
||||
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -6,6 +6,10 @@ import com.sk89q.worldedit.LocalWorld;
|
||||
import com.sk89q.worldedit.bukkit.BukkitPlayer;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -118,7 +122,7 @@ public class TFM_WorldEditBridge
|
||||
|
||||
public void validateSelection(final Player player)
|
||||
{
|
||||
if (TFM_SuperadminList.isUserSuperadmin(player))
|
||||
if (TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
return;
|
||||
}
|
@ -10,5 +10,5 @@ public @interface CommandPermissions
|
||||
|
||||
SourceType source();
|
||||
|
||||
boolean block_host_console() default false;
|
||||
boolean blockHostConsole() default false;
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_CONSOLE, block_host_console = true)
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||
@CommandParameters(description = "Close server to non-superadmins.", usage = "/<command> [on | off]")
|
||||
public class Command_adminmode extends TFM_Command
|
||||
{
|
||||
@ -31,7 +31,7 @@ public class Command_adminmode extends TFM_Command
|
||||
TFM_Util.adminAction(sender.getName(), "Closing the server to non-superadmins.", true);
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (!TFM_SuperadminList.isUserSuperadmin(player))
|
||||
if (!TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
player.kickPlayer("Server is now closed to non-superadmins.");
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.World;
|
||||
@ -113,18 +113,15 @@ public class Command_adminworld extends TFM_Command
|
||||
|
||||
if ("add".equalsIgnoreCase(args[1]))
|
||||
{
|
||||
Player player;
|
||||
try
|
||||
final Player player = getPlayer(args[2]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[2]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
sender.sendMessage(ex.getMessage());
|
||||
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player != null && TFM_AdminWorld.getInstance().addGuest(player, sender_p))
|
||||
if (TFM_AdminWorld.getInstance().addGuest(player, sender_p))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "AdminWorld guest added: " + player.getName(), false);
|
||||
}
|
||||
@ -133,9 +130,9 @@ public class Command_adminworld extends TFM_Command
|
||||
playerMsg("Could not add player to guest list.");
|
||||
}
|
||||
}
|
||||
else if (TFM_Util.isRemoveCommand(args[1]))
|
||||
else if ("remove".equals(args[1]))
|
||||
{
|
||||
Player player = TFM_AdminWorld.getInstance().removeGuest(args[2]);
|
||||
final Player player = TFM_AdminWorld.getInstance().removeGuest(args[2]);
|
||||
if (player != null)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "AdminWorld guest removed: " + player.getName(), false);
|
||||
@ -217,7 +214,7 @@ public class Command_adminworld extends TFM_Command
|
||||
|
||||
private void assertCommandPerms(CommandSender sender, Player sender_p) throws PermissionDeniedException
|
||||
{
|
||||
if (!(sender instanceof Player) || sender_p == null || !TFM_SuperadminList.isUserSuperadmin(sender))
|
||||
if (!(sender instanceof Player) || sender_p == null || !TFM_AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
throw new PermissionDeniedException(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -36,18 +37,15 @@ public class Command_blockcmd extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player;
|
||||
try
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
playerMsg(ex.getMessage());
|
||||
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (TFM_SuperadminList.isUserSuperadmin(player))
|
||||
if (TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
playerMsg(player.getName() + " is a Superadmin, and cannot have their commands blocked.");
|
||||
return true;
|
||||
|
@ -2,6 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -21,7 +22,7 @@ public class Command_cage extends TFM_Command
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TFM_Util.isStopCommand(args[0]) && sender instanceof Player)
|
||||
if ("off".equals(args[0]) && sender instanceof Player)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Uncaging " + sender.getName(), true);
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(sender_p);
|
||||
@ -32,9 +33,9 @@ public class Command_cage extends TFM_Command
|
||||
|
||||
return true;
|
||||
}
|
||||
else if ("purge".equalsIgnoreCase(args[0]))
|
||||
else if ("purge".equals(args[0]))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Uncaging all players.", true);
|
||||
TFM_Util.adminAction(sender.getName(), "Uncaging all players", true);
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
@ -47,14 +48,11 @@ public class Command_cage extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player;
|
||||
try
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
sender.sendMessage(ex.getMessage());
|
||||
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -65,7 +63,7 @@ public class Command_cage extends TFM_Command
|
||||
|
||||
if (args.length >= 2)
|
||||
{
|
||||
if (TFM_Util.isStopCommand(args[1]))
|
||||
if ("off".equals(args[1]))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Uncaging " + player.getName(), true);
|
||||
|
||||
|
@ -10,6 +10,7 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "For the people that are still alive.", usage = "/<command>")
|
||||
@ -18,6 +19,7 @@ public class Command_cake extends TFM_Command
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
||||
StringBuilder output = new StringBuilder();
|
||||
Random randomGenerator = new Random();
|
||||
|
||||
@ -28,9 +30,13 @@ public class Command_cake extends TFM_Command
|
||||
output.append(ChatColor.COLOR_CHAR).append(color_code).append(word).append(" ");
|
||||
}
|
||||
|
||||
ItemStack heldItem = new ItemStack(Material.CAKE);
|
||||
ItemMeta heldItemMeta = heldItem.getItemMeta();
|
||||
heldItemMeta.setDisplayName((new StringBuilder()).append(ChatColor.WHITE).append("The ").append(ChatColor.BLACK).append("Lie").toString());
|
||||
heldItem.setItemMeta(heldItemMeta);
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
ItemStack heldItem = new ItemStack(Material.CAKE, 1);
|
||||
player.getInventory().setItem(player.getInventory().firstEmpty(), heldItem);
|
||||
player.awardAchievement(Achievement.MINE_WOOD);
|
||||
player.awardAchievement(Achievement.BUILD_WORKBENCH);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Minecart;
|
||||
@ -17,13 +18,12 @@ public class Command_cartsit extends TFM_Command
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
try
|
||||
|
||||
targetPlayer = getPlayer(args[0]);
|
||||
|
||||
if (targetPlayer == null)
|
||||
{
|
||||
targetPlayer = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
sender.sendMessage(ex.getMessage());
|
||||
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -36,7 +36,7 @@ public class Command_cartsit extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (targetPlayer != sender_p && !TFM_SuperadminList.isUserSuperadmin(sender))
|
||||
else if (targetPlayer != sender_p && !TFM_AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
sender.sendMessage("Only superadmins can select another player as a /cartsit target.");
|
||||
return true;
|
||||
|
@ -4,8 +4,8 @@ import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.ArrayUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
@ -5,7 +5,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -2,9 +2,9 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -1,70 +0,0 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE)
|
||||
@CommandParameters(description = "Temporarily change config parameters.", usage = "/<command> <entry> <value>")
|
||||
public class Command_config extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TFM_ConfigEntry entry = TFM_ConfigEntry.findConfigEntry(args[0]);
|
||||
|
||||
if (entry == null)
|
||||
{
|
||||
sender.sendMessage("Can't find configuration option: " + args[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
Object newValue = null;
|
||||
final String newValueString = args[1].trim();
|
||||
final Class<?> type = entry.getType();
|
||||
try
|
||||
{
|
||||
if (type.isAssignableFrom(Integer.class))
|
||||
{
|
||||
newValue = new Integer(newValueString);
|
||||
entry.setInteger((Integer) newValue);
|
||||
}
|
||||
else if (type.isAssignableFrom(Double.class))
|
||||
{
|
||||
newValue = new Double(newValueString);
|
||||
entry.setDouble((Double) newValue);
|
||||
}
|
||||
else if (type.isAssignableFrom(Boolean.class))
|
||||
{
|
||||
newValue = Boolean.valueOf(newValueString);
|
||||
entry.setBoolean((Boolean) newValue);
|
||||
}
|
||||
else if (type.isAssignableFrom(String.class))
|
||||
{
|
||||
newValue = newValueString;
|
||||
entry.setString((String) newValue);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
|
||||
if (newValue != null)
|
||||
{
|
||||
sender.sendMessage(String.format("Set configuration entry \"%s\" to \"%s\" value \"%s\".",
|
||||
entry.toString(), type.getName(), newValue.toString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage("Could not parse value \"" + newValueString + "\" as type \"" + type.getName() + "\".");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.GameMode;
|
||||
@ -33,7 +33,7 @@ public class Command_creative extends TFM_Command
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("-a"))
|
||||
{
|
||||
if (!TFM_SuperadminList.isUserSuperadmin(sender))
|
||||
if (!TFM_AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
@ -48,19 +48,18 @@ public class Command_creative extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)))
|
||||
if (!(senderIsConsole || TFM_AdminList.isSuperAdmin(sender)))
|
||||
{
|
||||
playerMsg("Only superadmins can change other user's gamemode.");
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
|
||||
player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
sender.sendMessage(ex.getMessage());
|
||||
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH, block_host_console = true)
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Make some noise.", usage = "/<command>")
|
||||
public class Command_deafen extends TFM_Command
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.ArrayUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -13,10 +13,9 @@ public class Command_denick extends TFM_Command
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Removing all nicknames.", false);
|
||||
TFM_Util.adminAction(sender.getName(), "Removing all nicknames", false);
|
||||
|
||||
Player[] onlinePlayers = server.getOnlinePlayers();
|
||||
for (Player player : onlinePlayers)
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
TFM_EssentialsBridge.getInstance().setNickname(player.getName(), null);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
|
@ -1,17 +1,21 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Ban;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE)
|
||||
@CommandParameters(description = "For the bad Superadmins.", usage = "/<command> <playername>")
|
||||
@CommandParameters(description = "For the bad Superadmins", usage = "/<command> <playername>")
|
||||
public class Command_doom extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
@ -22,27 +26,24 @@ public class Command_doom extends TFM_Command
|
||||
return false;
|
||||
}
|
||||
|
||||
final Player player;
|
||||
try
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
sender.sendMessage(ex.getMessage());
|
||||
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Casting oblivion over " + player.getName(), true);
|
||||
TFM_Util.bcastMsg(player.getName() + " will be completely obliviated!", ChatColor.RED);
|
||||
|
||||
final String IP = player.getAddress().getAddress().getHostAddress().trim();
|
||||
final String ip = player.getAddress().getAddress().getHostAddress().trim();
|
||||
|
||||
// remove from superadmin
|
||||
if (TFM_SuperadminList.isUserSuperadmin(player))
|
||||
if (TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Removing " + player.getName() + " from the superadmin list.", true);
|
||||
TFM_SuperadminList.removeSuperadmin(player);
|
||||
TFM_AdminList.removeSuperadmin(player);
|
||||
}
|
||||
|
||||
// remove from whitelist
|
||||
@ -51,11 +52,14 @@ public class Command_doom extends TFM_Command
|
||||
// deop
|
||||
player.setOp(false);
|
||||
|
||||
// ban IP
|
||||
TFM_ServerInterface.banIP(IP, null, null, null);
|
||||
// ban IPs
|
||||
for (String playerIp : TFM_PlayerList.getInstance().getEntry(player).getIps())
|
||||
{
|
||||
TFM_BanManager.getInstance().addIpBan(new TFM_Ban(playerIp, player.getName()));
|
||||
}
|
||||
|
||||
// ban name
|
||||
TFM_ServerInterface.banUsername(player.getName(), null, null, null);
|
||||
TFM_BanManager.getInstance().addUuidBan(new TFM_Ban(player.getUniqueId(), player.getName()));
|
||||
|
||||
// set gamemode to survival
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
@ -70,6 +74,9 @@ public class Command_doom extends TFM_Command
|
||||
// generate explosion
|
||||
player.getWorld().createExplosion(player.getLocation(), 4F);
|
||||
|
||||
// Shoot the player in the sky
|
||||
player.setVelocity(player.getVelocity().clone().add(new Vector(0, 20, 0)));
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
@ -81,7 +88,7 @@ public class Command_doom extends TFM_Command
|
||||
// kill (if not done already)
|
||||
player.setHealth(0.0);
|
||||
}
|
||||
}.runTaskLater(plugin, 20L * 2L);
|
||||
}.runTaskLater(plugin, 2L * 20L);
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@ -89,7 +96,7 @@ public class Command_doom extends TFM_Command
|
||||
public void run()
|
||||
{
|
||||
// message
|
||||
TFM_Util.adminAction(sender.getName(), "Banning " + player.getName() + ", IP: " + IP, true);
|
||||
TFM_Util.adminAction(sender.getName(), "Banning " + player.getName() + ", IP: " + ip, true);
|
||||
|
||||
// generate explosion
|
||||
player.getWorld().createExplosion(player.getLocation(), 4F);
|
||||
@ -97,7 +104,7 @@ public class Command_doom extends TFM_Command
|
||||
// kick player
|
||||
player.kickPlayer(ChatColor.RED + "FUCKOFF, and get your shit together!");
|
||||
}
|
||||
}.runTaskLater(plugin, 20L * 3L);
|
||||
}.runTaskLater(plugin, 3L * 20L);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1,25 +0,0 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Enable/disable auto entity wiper.", usage = "/<command> <on | off>")
|
||||
public class Command_droptoggle extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
TFM_Util.adminAction(sender.getName(),
|
||||
(TFM_ConfigEntry.AUTO_ENTITY_WIPE.setBoolean(!args[0].equalsIgnoreCase("off")) ? "Enabled" : "Disabled")
|
||||
+ " automatic entity wiping.", false);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Shortcut to enable/disable DisguiseCraft.", usage = "/<command>")
|
||||
public class Command_dtoggle extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
Plugin disguiseCraft = server.getPluginManager().getPlugin("DisguiseCraft");
|
||||
if (disguiseCraft != null)
|
||||
{
|
||||
PluginManager pluginManager = plugin.getServer().getPluginManager();
|
||||
|
||||
boolean enabled = disguiseCraft.isEnabled();
|
||||
if (enabled)
|
||||
{
|
||||
pluginManager.disablePlugin(disguiseCraft);
|
||||
}
|
||||
else
|
||||
{
|
||||
pluginManager.enablePlugin(disguiseCraft);
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), (!enabled ? "Enabled" : "Disabled") + " DisguiseCraft.", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage("DisguiseCraft is not installed on this server.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -55,13 +55,6 @@ public class Command_enchant extends TFM_Command
|
||||
{
|
||||
for (Enchantment ench : Enchantment.values())
|
||||
{
|
||||
/*
|
||||
2013-07-20 23:17:13 [INFO] [TotalFreedomMod]: Command Error: enchant
|
||||
java.lang.NullPointerException
|
||||
at net.minecraft.server.v1_6_R2.EnchantmentDurability.canEnchant(SourceFile:33)
|
||||
at org.bukkit.craftbukkit.v1_6_R2.enchantments.CraftEnchantment.canEnchantItem(CraftEnchantment.java:55)
|
||||
at me.StevenLawson.TotalFreedomMod.Commands.Command_enchant.run(Command_enchant.java:56)
|
||||
*/
|
||||
try
|
||||
{
|
||||
if (ench.canEnchantItem(itemInHand))
|
||||
@ -122,7 +115,7 @@ public class Command_enchant extends TFM_Command
|
||||
playerMsg("Can't use this enchantment on held item.");
|
||||
}
|
||||
}
|
||||
else if (TFM_Util.isRemoveCommand(args[0]))
|
||||
else if (args[0].equals("remove"))
|
||||
{
|
||||
itemInHand.removeEnchantment(ench);
|
||||
|
||||
|
@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -1,47 +0,0 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Enable/disable explosives and set effect radius.", usage = "/<command> <on | off> [radius]")
|
||||
public class Command_explosives extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length == 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
TFM_ConfigEntry.EXPLOSIVE_RADIUS.setDouble(Math.max(1.0, Math.min(30.0, Double.parseDouble(args[1]))));
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
TFM_Util.playerMsg(sender, nfex.getMessage());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
TFM_ConfigEntry.ALLOW_EXPLOSIONS.setBoolean(true);
|
||||
playerMsg("Explosives are now enabled, radius set to " + TFM_ConfigEntry.EXPLOSIVE_RADIUS.getDouble() + " blocks.");
|
||||
}
|
||||
else
|
||||
{
|
||||
TFM_ConfigEntry.ALLOW_EXPLOSIONS.setBoolean(false);
|
||||
playerMsg("Explosives are now disabled.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -19,18 +19,16 @@ public class Command_findip extends TFM_Command
|
||||
return false;
|
||||
}
|
||||
|
||||
final Player player;
|
||||
try
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
playerMsg(ex.getMessage());
|
||||
|
||||
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
playerMsg("Player IPs: " + StringUtils.join(TFM_UserList.getInstance(TotalFreedomMod.plugin).getEntry(player).getIpAddresses(), ", "));
|
||||
playerMsg("Player IPs: " + StringUtils.join(TFM_PlayerList.getInstance().getEntry(player).getIps(), ", "));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1,33 +0,0 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Enable/disable fire placement.", usage = "/<command> <on | off>")
|
||||
public class Command_fireplace extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
TFM_ConfigEntry.ALLOW_FIRE_PLACE.setBoolean(true);
|
||||
playerMsg("Fire placement is now enabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
TFM_ConfigEntry.ALLOW_FIRE_PLACE.setBoolean(false);
|
||||
playerMsg("Fire placement is now disabled.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_GameRuleHandler;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Enable/disable fire spread.", usage = "/<command> <on | off>")
|
||||
public class Command_firespread extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean fireSpread = !args[0].equalsIgnoreCase("off");
|
||||
|
||||
TFM_ConfigEntry.ALLOW_FIRE_SPREAD.setBoolean(fireSpread);
|
||||
|
||||
playerMsg("Fire spread is now " + (fireSpread ? "enabled" : "disabled") + ".");
|
||||
|
||||
TFM_GameRuleHandler.setGameRule(TFM_GameRuleHandler.TFM_GameRule.DO_FIRE_TICK, fireSpread);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Flatlands;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_Flatlands;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -13,7 +13,7 @@ public class Command_flatlands extends TFM_Command
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (TFM_ConfigEntry.GENERATE_FLATLANDS.getBoolean())
|
||||
if (TFM_ConfigEntry.FLATLANDS_GENERATE.getBoolean())
|
||||
{
|
||||
TFM_Flatlands.getInstance().sendToWorld(sender_p);
|
||||
}
|
||||
|
@ -1,24 +0,0 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Enable/disable fluid spread.", usage = "/<command> <on | off>")
|
||||
public class Command_fluidspread extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
playerMsg("Lava and water spread is now " + (TFM_ConfigEntry.ALLOW_FLUID_SPREAD.setBoolean(!args[0].equalsIgnoreCase("off")) ? "enabled" : "disabled") + ".");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,9 +1,11 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -40,6 +42,13 @@ public class Command_fr extends TFM_Command
|
||||
}.runTaskLater(plugin, 20L * 60L * 5L);
|
||||
|
||||
playerMsg("Players are now frozen.");
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (!TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
TFM_Util.playerMsg(player, "You have been frozen due to rule breaker(s), you will be unfrozen very soon.", ChatColor.RED);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -72,14 +81,11 @@ public class Command_fr extends TFM_Command
|
||||
}
|
||||
else
|
||||
{
|
||||
Player player;
|
||||
try
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
playerMsg(ex.getMessage(), ChatColor.RED);
|
||||
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Ban;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
@ -49,33 +51,33 @@ public class Command_gadmin extends TFM_Command
|
||||
}
|
||||
else if (mode.equals("nameban"))
|
||||
{
|
||||
TFM_ServerInterface.banUsername(player.getName(), null, null, null);
|
||||
TFM_BanManager.getInstance().addUuidBan(new TFM_Ban(player.getUniqueId(), player.getName()));
|
||||
TFM_Util.adminAction(sender.getName(), String.format("Banning Name: %s.", player.getName()), true);
|
||||
player.kickPlayer("Username banned by Administrator.");
|
||||
}
|
||||
else if (mode.equals("ipban"))
|
||||
{
|
||||
String user_ip = player.getAddress().getAddress().getHostAddress();
|
||||
String[] ip_parts = user_ip.split("\\.");
|
||||
String ip = player.getAddress().getAddress().getHostAddress();
|
||||
String[] ip_parts = ip.split("\\.");
|
||||
if (ip_parts.length == 4)
|
||||
{
|
||||
user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
|
||||
ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
|
||||
}
|
||||
TFM_Util.adminAction(sender.getName(), String.format("Banning IP: %s.", player.getName(), user_ip), true);
|
||||
TFM_ServerInterface.banIP(user_ip, null, null, null);
|
||||
TFM_Util.adminAction(sender.getName(), String.format("Banning IP: %s.", player.getName(), ip), true);
|
||||
TFM_BanManager.getInstance().addIpBan(new TFM_Ban(ip, player.getName()));
|
||||
player.kickPlayer("IP address banned by Administrator.");
|
||||
}
|
||||
else if (mode.equals("ban"))
|
||||
{
|
||||
String user_ip = player.getAddress().getAddress().getHostAddress();
|
||||
String[] ip_parts = user_ip.split("\\.");
|
||||
String ip = player.getAddress().getAddress().getHostAddress();
|
||||
String[] ip_parts = ip.split("\\.");
|
||||
if (ip_parts.length == 4)
|
||||
{
|
||||
user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
|
||||
ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
|
||||
}
|
||||
TFM_Util.adminAction(sender.getName(), String.format("Banning Name: %s, IP: %s.", player.getName(), user_ip), true);
|
||||
TFM_ServerInterface.banIP(user_ip, null, null, null);
|
||||
TFM_ServerInterface.banUsername(player.getName(), null, null, null);
|
||||
TFM_Util.adminAction(sender.getName(), String.format("Banning Name: %s, IP: %s.", player.getName(), ip), true);
|
||||
TFM_BanManager.getInstance().addUuidBan(new TFM_Ban(player.getUniqueId(), player.getName()));
|
||||
TFM_BanManager.getInstance().addIpBan(new TFM_Ban(ip, player.getName()));
|
||||
player.kickPlayer("IP and username banned by Administrator.");
|
||||
}
|
||||
else if (mode.equals("op"))
|
||||
|
@ -1,6 +1,8 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -17,37 +19,25 @@ public class Command_gcmd extends TFM_Command
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player;
|
||||
try
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
sender.sendMessage(ex.getMessage());
|
||||
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
String outcommand = "";
|
||||
try
|
||||
final String outCommand = StringUtils.join(args, " ", 1, args.length);
|
||||
|
||||
if (TFM_CommandBlocker.getInstance().isCommandBlocked(outCommand, sender))
|
||||
{
|
||||
StringBuilder outcommand_bldr = new StringBuilder();
|
||||
for (int i = 1; i < args.length; i++)
|
||||
{
|
||||
outcommand_bldr.append(args[i]).append(" ");
|
||||
}
|
||||
outcommand = outcommand_bldr.toString().trim();
|
||||
}
|
||||
catch (Throwable ex)
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Error building command: " + ex.getMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
playerMsg("Sending command as " + player.getName() + ": " + outcommand);
|
||||
if (server.dispatchCommand(player, outcommand))
|
||||
playerMsg("Sending command as " + player.getName() + ": " + outCommand);
|
||||
if (server.dispatchCommand(player, outCommand))
|
||||
{
|
||||
playerMsg("Command sent.");
|
||||
}
|
||||
|
@ -3,11 +3,14 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserList.TFM_UserListEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Ban;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -29,9 +32,10 @@ public class Command_glist extends TFM_Command
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
//Purge does not clear the banlist! This is not for clearing bans! This is for clearing the yaml file that stores the player/IP database!
|
||||
if (TFM_SuperadminList.isSeniorAdmin(sender))
|
||||
if (TFM_AdminList.isSeniorAdmin(sender))
|
||||
{
|
||||
TFM_UserList.getInstance(plugin).purge();
|
||||
TFM_PlayerList.getInstance().purgeAll();
|
||||
playerMsg("Purged playerbase");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -47,18 +51,15 @@ public class Command_glist extends TFM_Command
|
||||
else if (args.length == 2)
|
||||
{
|
||||
String username;
|
||||
List<String> ip_addresses = new ArrayList<String>();
|
||||
final List<String> ips = new ArrayList<String>();
|
||||
|
||||
try
|
||||
{
|
||||
Player player = getPlayer(args[1]);
|
||||
|
||||
username = player.getName();
|
||||
ip_addresses.add(player.getAddress().getAddress().getHostAddress());
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
|
||||
final Player player = getPlayer(args[1]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
TFM_UserListEntry entry = TFM_UserList.getInstance(plugin).getEntry(args[1]);
|
||||
final TFM_PlayerEntry entry = TFM_PlayerList.getInstance().getEntry(args[1]);
|
||||
|
||||
if (entry == null)
|
||||
{
|
||||
@ -66,44 +67,49 @@ public class Command_glist extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
username = entry.getUsername();
|
||||
ip_addresses = entry.getIpAddresses();
|
||||
username = entry.getLastJoinName();
|
||||
ips.addAll(entry.getIps());
|
||||
}
|
||||
else
|
||||
{
|
||||
username = player.getName();
|
||||
ips.add(player.getAddress().getAddress().getHostAddress());
|
||||
}
|
||||
|
||||
String mode = args[0].toLowerCase();
|
||||
if (mode.equalsIgnoreCase("ban"))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Banning " + username + " and IPs: " + StringUtils.join(ip_addresses, ","), true);
|
||||
TFM_Util.adminAction(sender.getName(), "Banning " + username + " and IPs: " + StringUtils.join(ips, ","), true);
|
||||
|
||||
Player player = server.getPlayerExact(username);
|
||||
if (player != null)
|
||||
Player target = server.getPlayerExact(username);
|
||||
if (target != null)
|
||||
{
|
||||
TFM_ServerInterface.banUsername(player.getName(), null, null, null);
|
||||
player.kickPlayer("You have been banned by " + sender.getName() + "\n If you think you have been banned wrongly, appeal here: http://www.totalfreedom.boards.net");
|
||||
TFM_BanManager.getInstance().addUuidBan(new TFM_Ban(target.getUniqueId(), target.getName()));
|
||||
target.kickPlayer("You have been banned by " + sender.getName() + "\n If you think you have been banned wrongly, appeal here: http://www.totalfreedom.boards.net");
|
||||
}
|
||||
else
|
||||
{
|
||||
TFM_ServerInterface.banUsername(username, null, null, null);
|
||||
TFM_BanManager.getInstance().addUuidBan(new TFM_Ban(Bukkit.getOfflinePlayer(username).getUniqueId(), username));
|
||||
}
|
||||
|
||||
for (String ip_address : ip_addresses)
|
||||
for (String ip : ips)
|
||||
{
|
||||
TFM_ServerInterface.banIP(ip_address, null, null, null);
|
||||
String[] ip_address_parts = ip_address.split("\\.");
|
||||
TFM_ServerInterface.banIP(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*", null, null, null);
|
||||
TFM_BanManager.getInstance().addIpBan(new TFM_Ban(ip, username));
|
||||
String[] ip_address_parts = ip.split("\\.");
|
||||
TFM_BanManager.getInstance().addIpBan(new TFM_Ban(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*", username));
|
||||
}
|
||||
}
|
||||
else if (mode.equalsIgnoreCase("unban") || mode.equalsIgnoreCase("pardon"))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Unbanning " + username + " and IPs: " + StringUtils.join(ip_addresses, ","), true);
|
||||
TFM_Util.adminAction(sender.getName(), "Unbanning " + username + " and IPs: " + StringUtils.join(ips, ","), true);
|
||||
|
||||
TFM_ServerInterface.unbanUsername(username);
|
||||
TFM_BanManager.getInstance().unbanUuid(Bukkit.getOfflinePlayer(username).getUniqueId());
|
||||
|
||||
for (String ip_address : ip_addresses)
|
||||
for (String ip : ips)
|
||||
{
|
||||
TFM_ServerInterface.unbanIP(ip_address);
|
||||
String[] ip_address_parts = ip_address.split("\\.");
|
||||
TFM_ServerInterface.unbanIP(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*");
|
||||
TFM_BanManager.getInstance().unbanIp(ip);
|
||||
String[] ipParts = ip.split("\\.");
|
||||
TFM_BanManager.getInstance().unbanIp(ipParts[0] + "." + ipParts[1] + ".*.*");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1,11 +1,13 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_WorldEditBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Ban;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_RollbackManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_WorldEditBridge;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import net.minecraft.util.org.apache.commons.lang3.ArrayUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -25,27 +27,30 @@ public class Command_gtfo extends TFM_Command
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player;
|
||||
try
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
playerMsg(ex.getMessage(), ChatColor.RED);
|
||||
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
String ban_reason = null;
|
||||
String reason = null;
|
||||
if (args.length >= 2)
|
||||
{
|
||||
ban_reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
||||
}
|
||||
|
||||
TFM_Util.bcastMsg(player.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED);
|
||||
|
||||
// Undo WorldEdits:
|
||||
TFM_WorldEditBridge.getInstance().undo(player, 15);
|
||||
try
|
||||
{
|
||||
TFM_WorldEditBridge.getInstance().undo(player, 15);
|
||||
}
|
||||
catch (NoClassDefFoundError ex)
|
||||
{
|
||||
}
|
||||
|
||||
// rollback
|
||||
TFM_RollbackManager.rollback(player.getName());
|
||||
@ -71,20 +76,21 @@ public class Command_gtfo extends TFM_Command
|
||||
}
|
||||
|
||||
// ban IP address:
|
||||
String user_ip = player.getAddress().getAddress().getHostAddress();
|
||||
String[] ip_parts = user_ip.split("\\.");
|
||||
if (ip_parts.length == 4)
|
||||
String ip = player.getAddress().getAddress().getHostAddress();
|
||||
String[] ipParts = ip.split("\\.");
|
||||
if (ipParts.length == 4)
|
||||
{
|
||||
user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
|
||||
ip = String.format("%s.%s.*.*", ipParts[0], ipParts[1]);
|
||||
}
|
||||
TFM_Util.bcastMsg(String.format("Banning: %s, IP: %s.", player.getName(), user_ip), ChatColor.RED);
|
||||
TFM_ServerInterface.banIP(user_ip, ban_reason, null, null);
|
||||
TFM_Util.bcastMsg(String.format("Banning: %s, IP: %s.", player.getName(), ip), ChatColor.RED);
|
||||
|
||||
TFM_BanManager.getInstance().addIpBan(new TFM_Ban(ip, player.getName(), sender.getName(), null, reason));
|
||||
|
||||
// ban username:
|
||||
TFM_ServerInterface.banUsername(player.getName(), ban_reason, null, null);
|
||||
TFM_BanManager.getInstance().addUuidBan(new TFM_Ban(player.getUniqueId(), player.getName(), sender.getName(), null, reason));
|
||||
|
||||
// kick Player:
|
||||
player.kickPlayer(ChatColor.RED + "GTFO" + (ban_reason != null ? ("\nReason: " + ChatColor.YELLOW + ban_reason) : ""));
|
||||
player.kickPlayer(ChatColor.RED + "GTFO" + (reason != null ? ("\nReason: " + ChatColor.YELLOW + reason) : ""));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -25,7 +26,7 @@ public class Command_halt extends TFM_Command
|
||||
int counter = 0;
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (!TFM_SuperadminList.isUserSuperadmin(player))
|
||||
if (!TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
TFM_PlayerData.getPlayerData(player).setHalted(true);
|
||||
counter++;
|
||||
@ -76,18 +77,14 @@ public class Command_halt extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player;
|
||||
try
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
sender.sendMessage(ex.getMessage());
|
||||
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
if (!playerdata.isHalted())
|
||||
{
|
||||
|
@ -2,9 +2,9 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -22,6 +22,7 @@ public class Command_invis extends TFM_Command
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("smite"))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Smiting all invisible players", true);
|
||||
smite = true;
|
||||
}
|
||||
else
|
||||
@ -38,9 +39,9 @@ public class Command_invis extends TFM_Command
|
||||
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY))
|
||||
{
|
||||
players.add(player.getName());
|
||||
if (smite && !TFM_SuperadminList.isUserSuperadmin(player))
|
||||
if (smite && !TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
Command_smite.smite(player);
|
||||
player.setHealth(0.0);
|
||||
smites++;
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Manage jumppads", usage = "/<command> <on | off | info |sideways <on | off> | strength <strength (1-10)>>", aliases = "launchpads,jp")
|
||||
@CommandParameters(description = "Manage jumppads", usage = "/<command> <on | off | info | sideways <on | off> | strength <strength (1-10)>>", aliases = "launchpads,jp")
|
||||
public class Command_jumppads extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
@ -29,7 +29,7 @@ public class Command_jumppads extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
if (TFM_Util.isStopCommand(args[0]))
|
||||
if ("off".equals(args[0]))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Disabling Jumppads", false);
|
||||
TFM_Jumppads.getInstance().setMode(TFM_Jumppads.JumpPadMode.OFF);
|
||||
@ -50,7 +50,7 @@ public class Command_jumppads extends TFM_Command
|
||||
|
||||
if (args[0].equalsIgnoreCase("sideways"))
|
||||
{
|
||||
if (TFM_Util.isStopCommand(args[1]))
|
||||
if ("off".equals(args[1]))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Setting Jumppads mode to: Madgeek", false);
|
||||
TFM_Jumppads.getInstance().setMode(TFM_Jumppads.JumpPadMode.MADGEEK);
|
||||
|
@ -1,13 +1,13 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH, block_host_console = true)
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Kick all non-superadmins on server.", usage = "/<command>")
|
||||
public class Command_kicknoob extends TFM_Command
|
||||
{
|
||||
@ -18,7 +18,7 @@ public class Command_kicknoob extends TFM_Command
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (!TFM_SuperadminList.isUserSuperadmin(player))
|
||||
if (!TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
player.kickPlayer(ChatColor.RED + "Disconnected by admin.");
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -18,27 +19,24 @@ public class Command_lastcmd extends TFM_Command
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player;
|
||||
try
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
playerMsg(ex.getMessage(), ChatColor.RED);
|
||||
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
|
||||
if (playerdata != null)
|
||||
{
|
||||
String last_command = playerdata.getLastCommand();
|
||||
if (last_command.isEmpty())
|
||||
String lastCommand = playerdata.getLastCommand();
|
||||
if (lastCommand.isEmpty())
|
||||
{
|
||||
last_command = "(none)";
|
||||
lastCommand = "(none)";
|
||||
}
|
||||
playerMsg(player.getName() + " - Last Command: " + last_command, ChatColor.GRAY);
|
||||
playerMsg(player.getName() + " - Last Command: " + lastCommand, ChatColor.GRAY);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -1,24 +0,0 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Enable/disable lava damage.", usage = "/<command> <on | off>")
|
||||
public class Command_lavadmg extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
playerMsg("Lava damage is now " + (TFM_ConfigEntry.ALLOW_LAVA_DAMAGE.setBoolean(!args[0].equalsIgnoreCase("off")) ? "enabled" : "disabled") + ".");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Enable/disable lava placement.", usage = "/<command> <on | off>")
|
||||
public class Command_lavaplace extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
playerMsg("Lava placement is now " + (TFM_ConfigEntry.ALLOW_LAVA_PLACE.setBoolean(!args[0].equalsIgnoreCase("off")) ? "enabled" : "disabled") + ".");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -2,106 +2,72 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerRank;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Superadmin;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Admin;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command>", aliases = "who")
|
||||
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-a]", aliases = "who")
|
||||
public class Command_list extends TFM_Command
|
||||
{
|
||||
private static enum ListFilter
|
||||
{
|
||||
SHOW_ALL, SHOW_ADMINS
|
||||
ALL,
|
||||
ADMINS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length > 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TFM_Util.isFromHostConsole(sender.getName()))
|
||||
{
|
||||
List<String> player_names = new ArrayList<String>();
|
||||
final List<String> names = new ArrayList<String>();
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
player_names.add(player.getName());
|
||||
names.add(player.getName());
|
||||
}
|
||||
playerMsg("There are " + player_names.size() + "/" + server.getMaxPlayers() + " players online:\n" + StringUtils.join(player_names, ", "), ChatColor.WHITE);
|
||||
playerMsg("There are " + names.size() + "/" + server.getMaxPlayers() + " players online:\n" + StringUtils.join(names, ", "), ChatColor.WHITE);
|
||||
return true;
|
||||
}
|
||||
|
||||
ListFilter listFilter = ListFilter.SHOW_ALL;
|
||||
if (args.length >= 1)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("-a"))
|
||||
{
|
||||
listFilter = ListFilter.SHOW_ADMINS;
|
||||
}
|
||||
}
|
||||
final Command_list.ListFilter listFilter = (args.length == 1 && args[0].equals("-a") ? Command_list.ListFilter.ADMINS : Command_list.ListFilter.ALL);
|
||||
|
||||
StringBuilder onlineStats = new StringBuilder();
|
||||
StringBuilder onlineUsers = new StringBuilder();
|
||||
final StringBuilder onlineStats = new StringBuilder();
|
||||
final StringBuilder onlineUsers = new StringBuilder();
|
||||
|
||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().length);
|
||||
onlineStats.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(server.getMaxPlayers());
|
||||
onlineStats.append(ChatColor.BLUE).append(" players online.");
|
||||
|
||||
List<String> player_names = new ArrayList<String>();
|
||||
final List<String> names = new ArrayList<String>();
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
boolean userSuperadmin = TFM_SuperadminList.isUserSuperadmin(player);
|
||||
final boolean userSuperadmin = TFM_AdminList.isSuperAdmin(player);
|
||||
|
||||
if (listFilter == ListFilter.SHOW_ADMINS && !userSuperadmin)
|
||||
if (listFilter == Command_list.ListFilter.ADMINS && !userSuperadmin)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String prefix = "";
|
||||
|
||||
if (userSuperadmin)
|
||||
{
|
||||
TFM_Superadmin entry = TFM_SuperadminList.getAdminEntry(player.getName());
|
||||
if (!entry.isSeniorAdmin() && entry.isTelnetAdmin())
|
||||
{
|
||||
prefix = (ChatColor.DARK_GREEN + "[STA]");
|
||||
}
|
||||
else if (TFM_SuperadminList.isSeniorAdmin(player))
|
||||
{
|
||||
prefix = (ChatColor.LIGHT_PURPLE + "[SrA]");
|
||||
}
|
||||
else if (TFM_SuperadminList.isUserSuperadmin(player))
|
||||
{
|
||||
prefix = (ChatColor.GOLD + "[SA]");
|
||||
}
|
||||
|
||||
if (TFM_Util.DEVELOPERS.contains(player.getName()))
|
||||
{
|
||||
prefix = (ChatColor.DARK_PURPLE + "[Dev]");
|
||||
}
|
||||
|
||||
if (player.getName().equals("markbyron"))
|
||||
{
|
||||
prefix = (ChatColor.BLUE + "[Owner]");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player.isOp())
|
||||
{
|
||||
prefix = (ChatColor.RED + "[OP]");
|
||||
}
|
||||
}
|
||||
|
||||
player_names.add(prefix + player.getName() + ChatColor.WHITE);
|
||||
names.add(TFM_PlayerRank.fromSender(player).getPrefix() + player.getName());
|
||||
}
|
||||
|
||||
onlineUsers.append("Connected ").append(listFilter == ListFilter.SHOW_ADMINS ? "admins" : "players").append(": ").append(StringUtils.join(player_names, ", "));
|
||||
onlineUsers.append("Connected ");
|
||||
onlineUsers.append(listFilter == Command_list.ListFilter.ADMINS ? "admins: " : "players: ");
|
||||
onlineUsers.append(StringUtils.join(names, ChatColor.WHITE + ", "));
|
||||
|
||||
if (senderIsConsole)
|
||||
{
|
||||
|
@ -1,44 +0,0 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.io.File;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true)
|
||||
@CommandParameters(description = "Download the superadmin and permban lists from the main TotalFreedom server.", usage = "/<command>")
|
||||
public class Command_listsync extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Downloading superadmin and permban lists from primary TotalFreedom server.", false);
|
||||
|
||||
try
|
||||
{
|
||||
TFM_Util.downloadFile("http://madgeekonline.com/apps/get_superadmins_raw.php", new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
||||
TotalFreedomMod.loadSuperadminConfig();
|
||||
TFM_Util.adminAction(sender.getName(), TotalFreedomMod.SUPERADMIN_FILE + " downloaded.", false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
TFM_Util.downloadFile("http://madgeekonline.com/apps/get_permbans_raw.php", new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.PERMBAN_FILE));
|
||||
TotalFreedomMod.loadPermbanConfig();
|
||||
TFM_Util.adminAction(sender.getName(), TotalFreedomMod.PERMBAN_FILE + " downloaded.", false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Prevents new players from joining the server", usage = "/<command> <on | off>")
|
||||
public class Command_lockdown extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TFM_Util.isStopCommand(args[0]))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "De-activating server lockdown", true);
|
||||
TotalFreedomMod.lockdownEnabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Activating server lockdown", true);
|
||||
TotalFreedomMod.lockdownEnabled = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -2,13 +2,14 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true)
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||
@CommandParameters(description = "Block target's minecraft input. This is evil, and I never should have wrote it.", usage = "/<command> <all | purge | <<partialname> on | off>>")
|
||||
public class Command_lockup extends TFM_Command
|
||||
{
|
||||
@ -46,14 +47,11 @@ public class Command_lockup extends TFM_Command
|
||||
{
|
||||
if (args[1].equalsIgnoreCase("on"))
|
||||
{
|
||||
final Player player;
|
||||
try
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
sender.sendMessage(ex.getMessage());
|
||||
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -61,16 +59,13 @@ public class Command_lockup extends TFM_Command
|
||||
startLockup(player);
|
||||
playerMsg("Locked up " + player.getName() + ".");
|
||||
}
|
||||
else if (TFM_Util.isStopCommand(args[1]))
|
||||
else if ("off".equals(args[1]))
|
||||
{
|
||||
final Player player;
|
||||
try
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
sender.sendMessage(ex.getMessage());
|
||||
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,11 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Superadmin;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Admin;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -32,7 +31,7 @@ public class Command_logs extends TFM_Command
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
mode = (TFM_Util.isStopCommand(args[0]) ? LogsRegistrationMode.DELETE : LogsRegistrationMode.UPDATE);
|
||||
mode = ("off".equals(args[0]) ? LogsRegistrationMode.DELETE : LogsRegistrationMode.UPDATE);
|
||||
}
|
||||
|
||||
updateLogsRegistration(sender, sender_p, mode);
|
||||
@ -47,8 +46,8 @@ public class Command_logs extends TFM_Command
|
||||
|
||||
public static void updateLogsRegistration(final CommandSender sender, final String targetName, final String targetIP, final LogsRegistrationMode mode)
|
||||
{
|
||||
final String logsRegisterURL = TFM_ConfigEntry.LOGS_REGISTER_URL.getString();
|
||||
final String logsRegisterPassword = TFM_ConfigEntry.LOGS_REGISTER_PASSWORD.getString();
|
||||
final String logsRegisterURL = TFM_ConfigEntry.LOGS_URL.getString();
|
||||
final String logsRegisterPassword = TFM_ConfigEntry.LOGS_SECRET.getString();
|
||||
|
||||
if (logsRegisterURL == null || logsRegisterPassword == null || logsRegisterURL.isEmpty() || logsRegisterPassword.isEmpty())
|
||||
{
|
||||
@ -109,11 +108,11 @@ public class Command_logs extends TFM_Command
|
||||
}.runTaskAsynchronously(TotalFreedomMod.plugin);
|
||||
}
|
||||
|
||||
public static void deactivateSuperadmin(TFM_Superadmin superadmin)
|
||||
public static void deactivateSuperadmin(TFM_Admin superadmin)
|
||||
{
|
||||
for (String ip : superadmin.getIps())
|
||||
{
|
||||
updateLogsRegistration(null, superadmin.getName(), ip, Command_logs.LogsRegistrationMode.DELETE);
|
||||
updateLogsRegistration(null, superadmin.getLastLoginName(), ip, Command_logs.LogsRegistrationMode.DELETE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_GameRuleHandler;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
|
@ -5,7 +5,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@ -34,20 +34,14 @@ public class Command_nf extends TFM_Command
|
||||
if (matcher.find())
|
||||
{
|
||||
String displayName = matcher.group(1);
|
||||
try
|
||||
{
|
||||
player = getPlayerByDisplayName(displayName);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
}
|
||||
|
||||
player = getPlayerByDisplayName(displayName);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
player = getPlayerByDisplayNameAlt(displayName);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
player = getPlayerByDisplayNameAlt(displayName);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Can't find player by nickname: " + displayName);
|
||||
return true;
|
||||
@ -80,7 +74,7 @@ public class Command_nf extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Player getPlayerByDisplayName(String needle) throws PlayerNotFoundException
|
||||
private static Player getPlayerByDisplayName(String needle)
|
||||
{
|
||||
needle = needle.toLowerCase().trim();
|
||||
|
||||
@ -93,10 +87,10 @@ public class Command_nf extends TFM_Command
|
||||
}
|
||||
}
|
||||
|
||||
throw new PlayerNotFoundException();
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Player getPlayerByDisplayNameAlt(String needle) throws PlayerNotFoundException
|
||||
private static Player getPlayerByDisplayNameAlt(String needle)
|
||||
{
|
||||
needle = needle.toLowerCase().trim();
|
||||
|
||||
@ -115,11 +109,6 @@ public class Command_nf extends TFM_Command
|
||||
}
|
||||
}
|
||||
|
||||
if (minEditMatch == null)
|
||||
{
|
||||
throw new PlayerNotFoundException();
|
||||
}
|
||||
|
||||
return minEditMatch;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@ -19,7 +19,7 @@ public class Command_nicknyan extends TFM_Command
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TFM_Util.isStopCommand(args[0]))
|
||||
if ("off".equals(args[0]))
|
||||
{
|
||||
TFM_EssentialsBridge.getInstance().setNickname(sender.getName(), null);
|
||||
playerMsg("Nickname cleared.");
|
||||
|
@ -1,57 +0,0 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true)
|
||||
@CommandParameters(description = "Attempt to detect \"invisible griefers\" and \"nukers\".", usage = "/<command> <on | off> [range] [blockrate]")
|
||||
public class Command_nonuke extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length >= 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
TFM_ConfigEntry.NUKE_MONITOR_RANGE.setDouble(Math.max(1.0, Math.min(500.0, Double.parseDouble(args[1]))));
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length >= 3)
|
||||
{
|
||||
try
|
||||
{
|
||||
TFM_ConfigEntry.NUKE_MONITOR_COUNT_BREAK.setInteger(Math.max(1, Math.min(500, Integer.parseInt(args[2]))));
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
TFM_ConfigEntry.NUKE_MONITOR.setBoolean(true);
|
||||
playerMsg("Nuke monitor is enabled.");
|
||||
playerMsg("Anti-freecam range is set to " + TFM_ConfigEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks.");
|
||||
playerMsg("Block throttle rate is set to " + TFM_ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds.");
|
||||
}
|
||||
else
|
||||
{
|
||||
TFM_ConfigEntry.NUKE_MONITOR.setBoolean(false);
|
||||
playerMsg("Nuke monitor is disabled.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -26,7 +26,7 @@ public class Command_onlinemode extends TFM_Command
|
||||
{
|
||||
boolean online_mode;
|
||||
|
||||
if (sender instanceof Player && !TFM_SuperadminList.isSeniorAdmin(sender, true))
|
||||
if (sender instanceof Player && !TFM_AdminList.isSeniorAdmin(sender, true))
|
||||
{
|
||||
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -38,7 +38,7 @@ public class Command_op extends TFM_Command
|
||||
// if the player is not online
|
||||
if (player == null)
|
||||
{
|
||||
if (TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole)
|
||||
if (TFM_AdminList.isSuperAdmin(sender) || senderIsConsole)
|
||||
{
|
||||
player = server.getOfflinePlayer(args[0]);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -8,72 +9,58 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Manage operators", usage = "/<command> <count | list | purge>")
|
||||
@CommandParameters(description = "Manager operators", usage = "/<command> <count | purge>")
|
||||
public class Command_ops extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 1 || args.length > 1)
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("list"))
|
||||
if (args[0].equals("count"))
|
||||
{
|
||||
TFM_Util.playerMsg(sender, "Operators: " + TFM_Util.playerListToNames(server.getOperators()));
|
||||
return true;
|
||||
}
|
||||
int totalOps = server.getOperators().size();
|
||||
int onlineOps = 0;
|
||||
|
||||
if (args[0].equalsIgnoreCase("count"))
|
||||
{
|
||||
int onlineOPs = 0;
|
||||
int offlineOPs = 0;
|
||||
int totalOPs = 0;
|
||||
|
||||
for (OfflinePlayer player : server.getOperators())
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (player.isOnline())
|
||||
if (player.isOp())
|
||||
{
|
||||
onlineOPs++;
|
||||
onlineOps++;
|
||||
}
|
||||
else
|
||||
{
|
||||
offlineOPs++;
|
||||
}
|
||||
totalOPs++;
|
||||
}
|
||||
|
||||
playerMsg("Online OPs: " + onlineOPs);
|
||||
playerMsg("Offline OPs: " + offlineOPs);
|
||||
playerMsg("Total OPs: " + totalOPs);
|
||||
playerMsg("Online OPs: " + onlineOps);
|
||||
playerMsg("Offline OPs: " + (totalOps - onlineOps));
|
||||
playerMsg("Total OPs: " + totalOps);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
if (args[0].equals("purge"))
|
||||
{
|
||||
if (!senderIsConsole)
|
||||
if (!TFM_AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Removing all operators", true);
|
||||
TFM_Util.adminAction(sender.getName(), "Purging all operators", true);
|
||||
|
||||
for (OfflinePlayer player : server.getOperators())
|
||||
{
|
||||
player.setOp(false);
|
||||
|
||||
if (player.isOnline())
|
||||
{
|
||||
player.getPlayer().sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
|
||||
playerMsg((Player) player, TotalFreedomMod.YOU_ARE_NOT_OP);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
@ -10,7 +11,8 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "POW!!! Right in the kisser! One of these days Alice, straight to the Moon!", usage = "/<command> <target> [power]")
|
||||
@CommandParameters(description = "POW!!! Right in the kisser! One of these days Alice, straight to the Moon!",
|
||||
usage = "/<command> <target> [<<power> | stop>]")
|
||||
public class Command_orbit extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
@ -21,14 +23,11 @@ public class Command_orbit extends TFM_Command
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player;
|
||||
try
|
||||
Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
playerMsg(ex.getMessage(), ChatColor.RED);
|
||||
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -38,7 +37,7 @@ public class Command_orbit extends TFM_Command
|
||||
|
||||
if (args.length >= 2)
|
||||
{
|
||||
if (TFM_Util.isStopCommand(args[1]))
|
||||
if (args[1].equals("stop"))
|
||||
{
|
||||
playerMsg("Stopped orbiting " + player.getName());
|
||||
playerdata.stopOrbiting();
|
||||
@ -60,7 +59,7 @@ public class Command_orbit extends TFM_Command
|
||||
playerdata.startOrbiting(strength);
|
||||
|
||||
player.setVelocity(new Vector(0, strength, 0));
|
||||
TFM_Util.adminAction(sender.getName(), "Orbiting " + player.getName() + ".", false);
|
||||
TFM_Util.adminAction(sender.getName(), "Orbiting " + player.getName(), false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PermbanList;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, block_host_console = true)
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Manage permanently banned players and IPs.", usage = "/<command> <list | reload>")
|
||||
public class Command_permban extends TFM_Command
|
||||
{
|
||||
@ -31,7 +32,7 @@ public class Command_permban extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
playerMsg("Reloading permban list...", ChatColor.RED);
|
||||
TotalFreedomMod.loadPermbanConfig();
|
||||
TFM_PermbanList.load();
|
||||
dumplist(sender);
|
||||
}
|
||||
else
|
||||
@ -44,24 +45,24 @@ public class Command_permban extends TFM_Command
|
||||
|
||||
private void dumplist(CommandSender sender)
|
||||
{
|
||||
if (TotalFreedomMod.permbanned_players.isEmpty())
|
||||
if (TFM_PermbanList.getPermbannedPlayers().isEmpty())
|
||||
{
|
||||
playerMsg(sender, "No permanently banned player names.");
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg(sender, TotalFreedomMod.permbanned_players.size() + " permanently banned players:");
|
||||
playerMsg(sender, StringUtils.join(TotalFreedomMod.permbanned_players, ", "));
|
||||
playerMsg(sender, TFM_PermbanList.getPermbannedPlayers().size() + " permanently banned players:");
|
||||
playerMsg(sender, StringUtils.join(TFM_PermbanList.getPermbannedPlayers(), ", "));
|
||||
}
|
||||
|
||||
if (TotalFreedomMod.permbanned_ips.isEmpty())
|
||||
if (TFM_PermbanList.getPermbannedIps().isEmpty())
|
||||
{
|
||||
playerMsg(sender, "No permanently banned IPs.");
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg(sender, TotalFreedomMod.permbanned_ips.size() + " permanently banned IPs:");
|
||||
playerMsg(sender, StringUtils.join(TotalFreedomMod.permbanned_ips, ", "));
|
||||
playerMsg(sender, TFM_PermbanList.getPermbannedIps().size() + " permanently banned IPs:");
|
||||
playerMsg(sender, StringUtils.join(TFM_PermbanList.getPermbannedIps(), ", "));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,28 +0,0 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Enable/disable tamed pet protection.", usage = "/<command> <on | off>")
|
||||
public class Command_petprotect extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(
|
||||
sender.getName(),
|
||||
"Tamed pet protection is now " + (TFM_ConfigEntry.PET_PROTECT_ENABLED.setBoolean(!TFM_Util.isStopCommand(args[0])) ? "enabled" : "disabled") + ".",
|
||||
false);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -8,122 +9,142 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Enable / disable plugins.", usage = "/<command> < <enable | disable> <pluginname> | list >", aliases = "plc")
|
||||
@CommandParameters(description = "Manage plugins", usage = "/<command> <<enable | disable | reload> <pluginname>> | list>", aliases = "plc")
|
||||
public class Command_plugincontrol extends TFM_Command
|
||||
{
|
||||
private enum CommandMode
|
||||
{
|
||||
ENABLE, DISABLE, LIST, RELOAD
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
CommandMode commandMode = null;
|
||||
if (args.length == 0 || args.length > 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final PluginManager pm = server.getPluginManager();
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
commandMode = CommandMode.LIST;
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("reload"))
|
||||
{
|
||||
commandMode = CommandMode.RELOAD;
|
||||
}
|
||||
}
|
||||
else if (args.length >= 2)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("enable"))
|
||||
{
|
||||
commandMode = CommandMode.ENABLE;
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("disable"))
|
||||
{
|
||||
commandMode = CommandMode.DISABLE;
|
||||
}
|
||||
}
|
||||
for (Plugin serverPlugin : pm.getPlugins())
|
||||
{
|
||||
final String version = serverPlugin.getDescription().getVersion();
|
||||
playerMsg(ChatColor.GRAY + "- " + (serverPlugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED) + serverPlugin.getName()
|
||||
+ ChatColor.GOLD + (version != null && !version.isEmpty() ? " v" + version : "") + " by "
|
||||
+ StringUtils.join(serverPlugin.getDescription().getAuthors(), ", "));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (commandMode == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
PluginManager pluginManager = plugin.getServer().getPluginManager();
|
||||
|
||||
if (commandMode == CommandMode.LIST)
|
||||
if ("enable".equals(args[0]))
|
||||
{
|
||||
playerMsg("Plugins: " + StringUtils.join(pluginManager.getPlugins(), ", "));
|
||||
}
|
||||
else if (commandMode == CommandMode.RELOAD)
|
||||
{
|
||||
playerMsg("Disabling all plugins.");
|
||||
for (Plugin targetPlugin : pluginManager.getPlugins())
|
||||
final Plugin target = getPlugin(args[1]);
|
||||
if (target == null)
|
||||
{
|
||||
if (!targetPlugin.getName().toLowerCase().startsWith("totalfreedommod"))
|
||||
{
|
||||
pluginManager.disablePlugin(targetPlugin);
|
||||
}
|
||||
}
|
||||
|
||||
playerMsg("Enabling all plugins.");
|
||||
for (Plugin targetPlugin : pluginManager.getPlugins())
|
||||
{
|
||||
if (!targetPlugin.getName().toLowerCase().startsWith("totalfreedommod"))
|
||||
{
|
||||
pluginManager.enablePlugin(targetPlugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
final String searchPluginName = args[1].toLowerCase().trim();
|
||||
|
||||
Plugin targetPlugin = null;
|
||||
|
||||
for (Plugin serverPlugin : pluginManager.getPlugins())
|
||||
{
|
||||
if (searchPluginName.equalsIgnoreCase(serverPlugin.getName().toLowerCase().trim()))
|
||||
{
|
||||
targetPlugin = serverPlugin;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (targetPlugin == null)
|
||||
{
|
||||
playerMsg("Plugin \"" + searchPluginName + "\" is not installed.");
|
||||
playerMsg("Plugin not found!");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
if (target.isEnabled())
|
||||
{
|
||||
if (commandMode == CommandMode.ENABLE)
|
||||
playerMsg("Plugin is already enabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
pm.enablePlugin(target);
|
||||
|
||||
if (!pm.isPluginEnabled(target))
|
||||
{
|
||||
playerMsg("Error enabling plugin " + target.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
playerMsg(target.getName() + " is now enabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if ("disable".equals(args[0]))
|
||||
{
|
||||
final Plugin target = getPlugin(args[1]);
|
||||
if (target == null)
|
||||
{
|
||||
playerMsg("Plugin not found!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!target.isEnabled())
|
||||
{
|
||||
playerMsg("Plugin is already disabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (target.getName().equals(plugin.getName()))
|
||||
{
|
||||
playerMsg("You cannot disable " + plugin.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
pm.disablePlugin(target);
|
||||
|
||||
if (pm.isPluginEnabled(target))
|
||||
{
|
||||
playerMsg("Error disabling plugin " + target.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
playerMsg(target.getName() + " is now disabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if ("reload".equals(args[0]))
|
||||
{
|
||||
final Plugin target = getPlugin(args[1]);
|
||||
if (target == null)
|
||||
{
|
||||
playerMsg("Plugin not found!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (target.getName().equals(plugin.getName()))
|
||||
{
|
||||
playerMsg("Use /tfm reload to reload instead.");
|
||||
return true;
|
||||
}
|
||||
|
||||
pm.disablePlugin(target);
|
||||
pm.enablePlugin(target);
|
||||
playerMsg(target.getName() + " reloaded.");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public Plugin getPlugin(String name)
|
||||
{
|
||||
for (Plugin serverPlugin : server.getPluginManager().getPlugins())
|
||||
{
|
||||
if (serverPlugin.getName().equalsIgnoreCase(name))
|
||||
{
|
||||
return serverPlugin;
|
||||
}
|
||||
}
|
||||
|
||||
if (name.length() >= 3)
|
||||
{
|
||||
for (Plugin serverPlugin : server.getPluginManager().getPlugins())
|
||||
{
|
||||
if (serverPlugin.getName().toLowerCase().contains(name.toLowerCase()))
|
||||
{
|
||||
pluginManager.enablePlugin(targetPlugin);
|
||||
if (targetPlugin.isEnabled())
|
||||
{
|
||||
playerMsg("Plugin \"" + targetPlugin.getName() + "\" enabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Error enabling plugin \"" + targetPlugin.getName() + "\".");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pluginManager.disablePlugin(targetPlugin);
|
||||
if (!targetPlugin.isEnabled())
|
||||
{
|
||||
playerMsg("Plugin \"" + targetPlugin.getName() + "\" disabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Error disabling plugin \"" + targetPlugin.getName() + "\".");
|
||||
}
|
||||
return serverPlugin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,10 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -38,7 +38,7 @@ public class Command_potion extends TFM_Command
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("clearall"))
|
||||
{
|
||||
if (!(TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole))
|
||||
if (!(TFM_AdminList.isSuperAdmin(sender) || senderIsConsole))
|
||||
{
|
||||
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
@ -58,20 +58,18 @@ public class Command_potion extends TFM_Command
|
||||
|
||||
if (args.length == 2)
|
||||
{
|
||||
try
|
||||
target = getPlayer(args[1]);
|
||||
|
||||
if (target == null)
|
||||
{
|
||||
target = getPlayer(args[1]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
playerMsg(ex.getMessage(), ChatColor.RED);
|
||||
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!target.equals(sender_p))
|
||||
{
|
||||
if (!TFM_SuperadminList.isUserSuperadmin(sender))
|
||||
if (!TFM_AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
playerMsg("Only superadmins can clear potion effects from other players.");
|
||||
return true;
|
||||
@ -103,20 +101,19 @@ public class Command_potion extends TFM_Command
|
||||
|
||||
if (args.length == 5)
|
||||
{
|
||||
try
|
||||
|
||||
target = getPlayer(args[4]);
|
||||
|
||||
if (target == null)
|
||||
{
|
||||
target = getPlayer(args[4]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
playerMsg(ex.getMessage(), ChatColor.RED);
|
||||
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!target.equals(sender_p))
|
||||
{
|
||||
if (!TFM_SuperadminList.isUserSuperadmin(sender))
|
||||
if (!TFM_AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
sender.sendMessage("Only superadmins can apply potion effects to other players.");
|
||||
return true;
|
||||
|
@ -1,35 +0,0 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true)
|
||||
@CommandParameters(
|
||||
description = "Enable/disable the command prelogger. When this is on, logs will be filled with many duplicate messages.",
|
||||
usage = "/<command> <on | off>")
|
||||
public class Command_prelog extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
TFM_ConfigEntry.PREPROCESS_LOG_ENABLED.setBoolean(true);
|
||||
playerMsg("Command preprocess logging is now enabled. This will be spammy in the log.");
|
||||
}
|
||||
else
|
||||
{
|
||||
TFM_ConfigEntry.PREPROCESS_LOG_ENABLED.setBoolean(false);
|
||||
playerMsg("Command preprocess logging is now disabled.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -23,17 +23,18 @@ public class Command_premium extends TFM_Command
|
||||
return false;
|
||||
}
|
||||
|
||||
String name;
|
||||
try
|
||||
final Player player = getPlayer(args[0]);
|
||||
final String name;
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
name = getPlayer(args[0]).getName();
|
||||
name = player.getName();
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
else
|
||||
{
|
||||
name = args[0];
|
||||
}
|
||||
|
||||
final String playername = name;
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
@ -41,7 +42,7 @@ public class Command_premium extends TFM_Command
|
||||
{
|
||||
try
|
||||
{
|
||||
final URL getUrl = new URL("https://minecraft.net/haspaid.jsp?user=" + playername);
|
||||
final URL getUrl = new URL("https://minecraft.net/haspaid.jsp?user=" + name);
|
||||
final URLConnection urlConnection = getUrl.openConnection();
|
||||
// Read the response
|
||||
final BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
|
||||
@ -53,7 +54,7 @@ public class Command_premium extends TFM_Command
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
playerMsg("Player " + playername + " is premium: " + message);
|
||||
playerMsg("Player " + name + " is premium: " + message);
|
||||
}
|
||||
}.runTask(plugin);
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -44,7 +44,7 @@ public class Command_protectarea extends TFM_Command
|
||||
}
|
||||
else if (args.length == 2)
|
||||
{
|
||||
if (TFM_Util.isRemoveCommand(args[0]))
|
||||
if ("remove".equals(args[0]))
|
||||
{
|
||||
TFM_ProtectedArea.removeProtectedArea(args[1]);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_DisguiseCraftBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_DisguiseCraftBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
|
@ -6,7 +6,7 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Quick Op - op someone based on a partial name.", usage = "/<command> <partialname>")
|
||||
public class Command_qop extends TFM_Command
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerRank;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -17,7 +18,7 @@ public class Command_rank extends TFM_Command
|
||||
{
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
playerMsg(player.getName() + " is " + TFM_Util.getRank(player));
|
||||
playerMsg(player.getName() + " is " + TFM_PlayerRank.fromSender(player).getLoginMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -29,22 +30,20 @@ public class Command_rank extends TFM_Command
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
playerMsg(sender.getName() + " is " + TFM_Util.getRank(sender), ChatColor.AQUA);
|
||||
playerMsg(sender.getName() + " is " + TFM_PlayerRank.fromSender(sender).getLoginMessage(), ChatColor.AQUA);
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player;
|
||||
try
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
sender.sendMessage(ex.getMessage());
|
||||
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
playerMsg(player.getName() + " is " + TFM_Util.getRank(player), ChatColor.AQUA);
|
||||
|
||||
playerMsg(player.getName() + " is " + TFM_PlayerRank.fromSender(player).getLoginMessage(), ChatColor.AQUA);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true)
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||
@CommandParameters(description = "Broadcasts the given message. Supports colors.", usage = "/<command> <message>")
|
||||
public class Command_rawsay extends TFM_Command
|
||||
{
|
||||
|
@ -1,13 +1,17 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, block_host_console = false)
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, blockHostConsole = false)
|
||||
@CommandParameters(description = "Remove all blocks of a certain type in the radius of certain players.", usage = "/<command> <block> [radius (default=50)] [player]")
|
||||
public class Command_ro extends TFM_Command
|
||||
{
|
||||
@ -19,22 +23,32 @@ public class Command_ro extends TFM_Command
|
||||
return false;
|
||||
}
|
||||
|
||||
Material from_material = Material.matchMaterial(args[0]);
|
||||
if (from_material == null)
|
||||
final List<Material> materials = new ArrayList<Material>();
|
||||
|
||||
for (String materialName : (args[0].contains(",") ? args[0].split(",") : new String[]
|
||||
{
|
||||
try
|
||||
{
|
||||
from_material = Material.getMaterial(Integer.parseInt(args[0]));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
args[0]
|
||||
}))
|
||||
{
|
||||
Material fromMaterial = Material.matchMaterial(materialName);
|
||||
if (fromMaterial == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
fromMaterial = Material.getMaterial(Integer.parseInt(materialName));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (from_material == null)
|
||||
if (fromMaterial == null)
|
||||
{
|
||||
playerMsg("Invalid block: " + args[0], ChatColor.RED);
|
||||
playerMsg("Invalid block: " + materialName, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
materials.add(fromMaterial);
|
||||
}
|
||||
|
||||
int radius = 20;
|
||||
@ -51,37 +65,47 @@ public class Command_ro extends TFM_Command
|
||||
}
|
||||
}
|
||||
|
||||
Player targetPlayer = null;
|
||||
final Player targetPlayer;
|
||||
if (args.length == 3)
|
||||
{
|
||||
try
|
||||
targetPlayer = getPlayer(args[2]);
|
||||
if (targetPlayer == null)
|
||||
{
|
||||
targetPlayer = getPlayer(args[2]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
playerMsg(ex.getMessage(), ChatColor.RED);
|
||||
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
int affected = 0;
|
||||
|
||||
if (targetPlayer == null)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Removing all " + from_material.name() + " within " + radius + " blocks of all players. Brace for lag...", senderIsConsole);
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
affected += TFM_Util.replaceBlocks(player.getLocation(), from_material, Material.AIR, radius);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Removing all " + from_material.name() + " within " + radius + " blocks of " + targetPlayer.getName() + ".", senderIsConsole);
|
||||
affected += TFM_Util.replaceBlocks(targetPlayer.getLocation(), from_material, Material.AIR, radius);
|
||||
targetPlayer = null;
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Remove complete. " + affected + " blocks removed.", senderIsConsole);
|
||||
final String names = StringUtils.join(materials, ", ");
|
||||
|
||||
int affected = 0;
|
||||
if (targetPlayer == null)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Removing all " + names + " within " + radius + " blocks of all players... Brace for lag!", false);
|
||||
|
||||
for (Material material : materials)
|
||||
{
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
affected += TFM_Util.replaceBlocks(player.getLocation(), material, Material.AIR, radius);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Material material : materials)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Removing all " + names + " within " + radius + " blocks of " + targetPlayer.getName(), false);
|
||||
affected += TFM_Util.replaceBlocks(targetPlayer.getLocation(), material, Material.AIR, radius);
|
||||
}
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Remove complete! " + affected + " blocks removed.", false);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_RollbackManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, block_host_console = true)
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Issues a rollback on a player", usage = "/<command> <[partialname] | undo [partialname] purge [partialname] | purgeall>", aliases = "rb")
|
||||
public class Command_rollback extends TFM_Command
|
||||
{
|
||||
@ -38,7 +38,7 @@ public class Command_rollback extends TFM_Command
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Rolling back player: " + playerName, false);
|
||||
playerMsg("Rolled back " + TFM_RollbackManager.rollback(playerName) + " edits for " + playerName + ".");
|
||||
playerMsg("If this rollback was a mistake, use /rollback undo " + playerName + " within 20 seconds to reverse the rollback.");
|
||||
playerMsg("If this rollback was a mistake, use /rollback undo " + playerName + " within 40 seconds to reverse the rollback.");
|
||||
}
|
||||
}
|
||||
else if (args.length == 2)
|
||||
@ -85,21 +85,16 @@ public class Command_rollback extends TFM_Command
|
||||
{
|
||||
String playerName = null;
|
||||
|
||||
try
|
||||
{
|
||||
Player player = getPlayer(playerNameInput);
|
||||
if (player != null)
|
||||
{
|
||||
playerName = player.getName();
|
||||
}
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
|
||||
final Player player = getPlayer(playerNameInput);
|
||||
if (player != null)
|
||||
{
|
||||
playerName = player.getName();
|
||||
}
|
||||
|
||||
if (playerName == null)
|
||||
{
|
||||
playerName = TFM_UserList.getInstance(plugin).searchByPartialName(playerNameInput);
|
||||
playerName = TFM_PlayerList.getInstance().getEntry(playerNameInput).getLastJoinName();
|
||||
}
|
||||
|
||||
return playerName;
|
||||
|
@ -1,172 +1,210 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Superadmin;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Admin;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_TwitterHandler;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Manage superadmins.", usage = "/<command> <list | clean | <add|delete|info> <username>>")
|
||||
@CommandParameters(description = "Manage superadmins.",
|
||||
usage = "/<command> <list | clean | clear [ip] | <add | delete | info> <username>>")
|
||||
public class Command_saconfig extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0 || args.length > 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
if (args[0].equals("list"))
|
||||
{
|
||||
playerMsg("Superadmins: " + StringUtils.join(TFM_SuperadminList.getSuperadminNames(), ", "), ChatColor.GOLD);
|
||||
playerMsg("Superadmins: " + StringUtils.join(TFM_AdminList.getSuperNames(), ", "), ChatColor.GOLD);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
if (args[0].equals("clean"))
|
||||
{
|
||||
if (!TFM_SuperadminList.isSeniorAdmin(sender, true))
|
||||
if (!TFM_AdminList.isSeniorAdmin(sender, true))
|
||||
{
|
||||
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("clean"))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Cleaning superadmin list", true);
|
||||
TFM_SuperadminList.cleanSuperadminList(true);
|
||||
playerMsg("Superadmins: " + StringUtils.join(TFM_SuperadminList.getSuperadminNames(), ", "), ChatColor.YELLOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Cleaning superadmin list", true);
|
||||
TFM_AdminList.cleanSuperadminList(true);
|
||||
playerMsg("Superadmins: " + StringUtils.join(TFM_AdminList.getSuperNames(), ", "), ChatColor.YELLOW);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// All commands below are superadmin+ commands.
|
||||
if (!TFM_AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
else if (args.length == 2)
|
||||
|
||||
if (args[0].equals("clear"))
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("info"))
|
||||
if (senderIsConsole)
|
||||
{
|
||||
if (!TFM_SuperadminList.isUserSuperadmin(sender))
|
||||
{
|
||||
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_Superadmin superadmin = TFM_SuperadminList.getAdminEntry(args[1].toLowerCase());
|
||||
|
||||
if (superadmin == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
superadmin = TFM_SuperadminList.getAdminEntry(getPlayer(args[1]).getName().toLowerCase());
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (superadmin == null)
|
||||
{
|
||||
playerMsg("Superadmin not found: " + args[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg(ChatColor.stripColor(TFM_Util.colorize(superadmin.toString())));
|
||||
}
|
||||
|
||||
playerMsg(TotalFreedomMod.NOT_FROM_CONSOLE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!senderIsConsole)
|
||||
final TFM_Admin admin = TFM_AdminList.getEntry(sender_p);
|
||||
|
||||
final String ip = TFM_Util.getIp(sender_p);
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
playerMsg("This command may only be used from the console.");
|
||||
TFM_Util.adminAction(sender.getName(), "Cleaning my supered IPs", true);
|
||||
|
||||
int counter = 0;
|
||||
for (int i = 0; i < admin.getIps().size(); i++)
|
||||
{
|
||||
if (admin.getIps().get(i).equals(ip))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
admin.removeIp(admin.getIps().get(i));
|
||||
counter++;
|
||||
}
|
||||
|
||||
TFM_AdminList.save();
|
||||
|
||||
playerMsg(counter + " IPs removed.");
|
||||
playerMsg(admin.getIps().get(0) + " is now your only IP address");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("add"))
|
||||
// args.length == 2
|
||||
if (!admin.getIps().contains(args[1]))
|
||||
{
|
||||
Player player = null;
|
||||
String admin_name = null;
|
||||
playerMsg("That IP is not registered to you.");
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
player = getPlayer(args[1]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
TFM_Superadmin superadmin = TFM_SuperadminList.getAdminEntry(args[1].toLowerCase());
|
||||
if (superadmin != null)
|
||||
{
|
||||
admin_name = superadmin.getName();
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg(ex.getMessage(), ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (ip.equals(args[1]))
|
||||
{
|
||||
playerMsg("You cannot remove your current IP.");
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Removing a supered IP", true);
|
||||
|
||||
admin.removeIp(args[1]);
|
||||
TFM_AdminList.save();
|
||||
|
||||
playerMsg("Removed IP " + args[1]);
|
||||
playerMsg("Current IPs: " + StringUtils.join(admin.getIps(), ", "));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("info"))
|
||||
{
|
||||
|
||||
TFM_Admin superadmin = TFM_AdminList.getEntry(args[1].toLowerCase());
|
||||
|
||||
if (superadmin == null)
|
||||
{
|
||||
|
||||
final Player player = getPlayer(args[1]);
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Adding " + player.getName() + " to the superadmin list.", true);
|
||||
TFM_SuperadminList.addSuperadmin(player);
|
||||
}
|
||||
else if (admin_name != null)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Adding " + admin_name + " to the superadmin list.", true);
|
||||
TFM_SuperadminList.addSuperadmin(admin_name);
|
||||
superadmin = TFM_AdminList.getEntry(player.getName().toLowerCase());
|
||||
}
|
||||
}
|
||||
else if (TFM_Util.isRemoveCommand(args[0]))
|
||||
|
||||
if (superadmin == null)
|
||||
{
|
||||
if (!TFM_SuperadminList.isSeniorAdmin(sender))
|
||||
playerMsg("Superadmin not found: " + args[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
playerMsg(superadmin.toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!senderIsConsole)
|
||||
{
|
||||
playerMsg("This command may only be used from the console.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("add"))
|
||||
{
|
||||
OfflinePlayer player = getPlayer(args[1]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
final TFM_Admin superadmin = TFM_AdminList.getEntry(args[1]);
|
||||
|
||||
if (superadmin == null)
|
||||
{
|
||||
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
String targetName = args[1];
|
||||
|
||||
try
|
||||
{
|
||||
targetName = getPlayer(targetName).getName();
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
}
|
||||
|
||||
if (!TFM_SuperadminList.getSuperadminNames().contains(targetName.toLowerCase()))
|
||||
{
|
||||
playerMsg("Superadmin not found: " + targetName);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Removing " + targetName + " from the superadmin list", true);
|
||||
TFM_SuperadminList.removeSuperadmin(targetName);
|
||||
|
||||
// Twitterbot
|
||||
if (TFM_ConfigEntry.TWITTERBOT_ENABLED.getBoolean())
|
||||
{
|
||||
TFM_TwitterHandler.getInstance().delTwitterVerbose(targetName, sender);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
player = Bukkit.getOfflinePlayer(superadmin.getLastLoginName());
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Adding " + player.getName() + " to the superadmin list", true);
|
||||
TFM_AdminList.addSuperadmin(player);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
if ("remove".equals(args[0]))
|
||||
{
|
||||
return false;
|
||||
if (!TFM_AdminList.isSeniorAdmin(sender))
|
||||
{
|
||||
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
String targetName = args[1];
|
||||
|
||||
|
||||
final Player player = getPlayer(targetName);
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
targetName = player.getName();
|
||||
}
|
||||
|
||||
if (!TFM_AdminList.getLowerSuperNames().contains(targetName.toLowerCase()))
|
||||
{
|
||||
playerMsg("Superadmin not found: " + targetName);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Removing " + targetName + " from the superadmin list", true);
|
||||
TFM_AdminList.removeSuperadmin(Bukkit.getOfflinePlayer(targetName));
|
||||
|
||||
// Twitterbot
|
||||
if (TFM_ConfigEntry.TWITTERBOT_ENABLED.getBoolean())
|
||||
{
|
||||
TFM_TwitterHandler.getInstance().delTwitterVerbose(targetName, sender);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServiceChecker;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServiceChecker.TFM_ServiceChecker_ServiceStatus;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServiceChecker.ServiceStatus;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -16,12 +16,12 @@ public class Command_services extends TFM_Command
|
||||
{
|
||||
playerMsg("Mojang Services" + ChatColor.WHITE + ":", ChatColor.BLUE);
|
||||
|
||||
for (TFM_ServiceChecker_ServiceStatus service : TFM_ServiceChecker.getInstance().getAllStatuses())
|
||||
for (ServiceStatus service : TFM_ServiceChecker.getInstance().getAllStatuses())
|
||||
{
|
||||
playerMsg(service.getFormattedStatus());
|
||||
}
|
||||
playerMsg("Version" + ChatColor.WHITE + ": " + TFM_ServiceChecker.getInstance().version, ChatColor.DARK_PURPLE);
|
||||
playerMsg("Last Check" + ChatColor.WHITE + ": " + TFM_ServiceChecker.getInstance().lastCheck, ChatColor.DARK_PURPLE);
|
||||
playerMsg("Version" + ChatColor.WHITE + ": " + TFM_ServiceChecker.getInstance().getVersion(), ChatColor.DARK_PURPLE);
|
||||
playerMsg("Last Check" + ChatColor.WHITE + ": " + TFM_ServiceChecker.getInstance().getLastCheck(), ChatColor.DARK_PURPLE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_WorldEditBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_WorldEditBridge;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.Location;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -21,14 +22,11 @@ public class Command_smite extends TFM_Command
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player;
|
||||
try
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
playerMsg(ex.getMessage(), ChatColor.RED);
|
||||
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
@ -68,7 +68,7 @@ public class Command_stfu extends TFM_Command
|
||||
int counter = 0;
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (!TFM_SuperadminList.isUserSuperadmin(player))
|
||||
if (!TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
playerdata.setMuted(true);
|
||||
@ -98,14 +98,11 @@ public class Command_stfu extends TFM_Command
|
||||
}
|
||||
else
|
||||
{
|
||||
Player player;
|
||||
try
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
sender.sendMessage(ex.getMessage());
|
||||
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -118,7 +115,7 @@ public class Command_stfu extends TFM_Command
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!TFM_SuperadminList.isUserSuperadmin(player))
|
||||
if (!TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Muting " + player.getName(), true);
|
||||
playerdata.setMuted(true);
|
||||
|
@ -1,9 +1,8 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -35,7 +34,7 @@ public class Command_survival extends TFM_Command
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("-a"))
|
||||
{
|
||||
if (!TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole)
|
||||
if (!TFM_AdminList.isSuperAdmin(sender) || senderIsConsole)
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
@ -50,15 +49,13 @@ public class Command_survival extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||
if (senderIsConsole || TFM_AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
try
|
||||
player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
playerMsg(ex.getMessage(), ChatColor.RED);
|
||||
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -3,16 +3,17 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Sets yourself a prefix", usage = "/<command> <<prefix> | off | clear <player> | clearall>")
|
||||
@CommandParameters(description = "Sets yourself a prefix", usage = "/<command> <set <tag..> | off | clear <player> | clearall>")
|
||||
public class Command_tag extends TFM_Command
|
||||
{
|
||||
public static final List<String> FORBIDDEN_WORDS = Arrays.asList(new String[]
|
||||
@ -23,11 +24,16 @@ public class Command_tag extends TFM_Command
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
if ("clearall".equals(args[0]))
|
||||
{
|
||||
if (!TFM_SuperadminList.isUserSuperadmin(sender))
|
||||
if (!TFM_AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
@ -56,7 +62,7 @@ public class Command_tag extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
if (TFM_Util.isStopCommand(args[0]))
|
||||
if ("remove".equals(args[0]))
|
||||
{
|
||||
TFM_PlayerData.getPlayerData(sender_p).setTag(null);
|
||||
playerMsg("Your tag has been removed.");
|
||||
@ -69,49 +75,24 @@ public class Command_tag extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!TFM_SuperadminList.isUserSuperadmin(sender))
|
||||
{
|
||||
for (String word : FORBIDDEN_WORDS)
|
||||
{
|
||||
if (args[0].toLowerCase().contains(word.toLowerCase()))
|
||||
{
|
||||
if (word.contains(String.valueOf(ChatColor.COLOR_CHAR)))
|
||||
{
|
||||
playerMsg("That tag contains a forbidden color-code.");
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("That tag contains a forbidden word.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TFM_PlayerData.getPlayerData(sender_p).setTag(args[0]);
|
||||
playerMsg("Tag set.");
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
else if (args.length == 2)
|
||||
|
||||
if (args.length == 2)
|
||||
{
|
||||
if ("clear".equals(args[0]))
|
||||
{
|
||||
if (!TFM_SuperadminList.isUserSuperadmin(sender))
|
||||
if (!TFM_AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
final Player player;
|
||||
try
|
||||
final Player player = getPlayer(args[1]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[1]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
playerMsg(ex.getMessage());
|
||||
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -119,8 +100,38 @@ public class Command_tag extends TFM_Command
|
||||
playerMsg("Removed " + player.getName() + "'s tag.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
if ("set".equals(args[0]))
|
||||
{
|
||||
final String tag = StringUtils.join(args, " ", 1, args.length);
|
||||
|
||||
if (!TFM_AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
for (String word : FORBIDDEN_WORDS)
|
||||
{
|
||||
if (!tag.toLowerCase().contains(word))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (word.contains(String.valueOf(ChatColor.COLOR_CHAR)))
|
||||
{
|
||||
playerMsg("That tag contains a forbidden color-code.");
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("That tag contains a forbidden word.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TFM_PlayerData.getPlayerData(sender_p).setTag(TFM_Util.colorize(tag));
|
||||
playerMsg("Tag set to " + TFM_Util.colorize(tag));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -0,0 +1,37 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Gives you a tag with random colors", usage = "/<command> <tag>", aliases = "tn")
|
||||
public class Command_tagnyan extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final StringBuilder tag = new StringBuilder();
|
||||
|
||||
for (char c : ChatColor.stripColor(TFM_Util.colorize(StringUtils.join(args, " "))).toCharArray())
|
||||
{
|
||||
tag.append(TFM_Util.randomChatColor()).append(c);
|
||||
}
|
||||
|
||||
final TFM_PlayerData data = TFM_PlayerData.getPlayerData(sender_p);
|
||||
data.setTag(tag.toString());
|
||||
|
||||
playerMsg("Set tag to " + tag);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,8 +1,12 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Ban;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -19,19 +23,29 @@ public class Command_tban extends TFM_Command
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player;
|
||||
try
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
playerMsg(ex.getMessage(), ChatColor.RED);
|
||||
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// strike with lightning effect:
|
||||
final Location targetPos = player.getLocation();
|
||||
for (int x = -1; x <= 1; x++)
|
||||
{
|
||||
for (int z = -1; z <= 1; z++)
|
||||
{
|
||||
final Location strike_pos = new Location(targetPos.getWorld(), targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z);
|
||||
targetPos.getWorld().strikeLightning(strike_pos);
|
||||
}
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Tempbanning: " + player.getName() + " for 5 minutes.", true);
|
||||
TFM_ServerInterface.banUsername(player.getName(), ChatColor.RED + "You have been temporarily banned for 5 minutes.", sender.getName(), TFM_Util.parseDateOffset("5m"));
|
||||
TFM_BanManager.getInstance().addUuidBan(
|
||||
new TFM_Ban(player.getUniqueId(), player.getName(), sender.getName(), TFM_Util.parseDateOffset("5m"), ChatColor.RED + "You have been temporarily banned for 5 minutes."));
|
||||
player.kickPlayer(ChatColor.RED + "You have been temporarily banned for five minutes. Please read totalfreedom.me for more info.");
|
||||
|
||||
return true;
|
||||
|
@ -2,14 +2,16 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Ban;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import net.minecraft.util.org.apache.commons.lang3.ArrayUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.Location;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Temporarily ban someone.", usage = "/<command> [playername] [duration] [reason]")
|
||||
@ -25,41 +27,52 @@ public class Command_tempban extends TFM_Command
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player;
|
||||
try
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
playerMsg(ex.getMessage(), ChatColor.RED);
|
||||
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
StringBuilder bcast_msg = new StringBuilder("Temporarily banned " + player.getName());
|
||||
final StringBuilder message = new StringBuilder("Temporarily banned " + player.getName());
|
||||
|
||||
Date ban_duration = TFM_Util.parseDateOffset("30m");
|
||||
Date expires = TFM_Util.parseDateOffset("30m");
|
||||
if (args.length >= 2)
|
||||
{
|
||||
Date parsed_offset = TFM_Util.parseDateOffset(args[1]);
|
||||
if (parsed_offset != null)
|
||||
{
|
||||
ban_duration = parsed_offset;
|
||||
expires = parsed_offset;
|
||||
}
|
||||
}
|
||||
bcast_msg.append(" until ").append(date_format.format(ban_duration));
|
||||
message.append(" until ").append(date_format.format(expires));
|
||||
|
||||
String ban_reason = "Banned by " + sender.getName();
|
||||
String reason = "Banned by " + sender.getName();
|
||||
if (args.length >= 3)
|
||||
{
|
||||
ban_reason = StringUtils.join(ArrayUtils.subarray(args, 2, args.length), " ") + " (" + sender.getName() + ")";
|
||||
bcast_msg.append(", Reason: \"").append(ban_reason).append("\"");
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 2, args.length), " ") + " (" + sender.getName() + ")";
|
||||
message.append(", Reason: \"").append(reason).append("\"");
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), bcast_msg.toString(), true);
|
||||
TFM_ServerInterface.banUsername(player.getName(), ban_reason, sender.getName(), ban_duration);
|
||||
TFM_ServerInterface.banIP(player.getAddress().getAddress().getHostAddress().trim(), ban_reason, sender.getName(), ban_duration);
|
||||
player.kickPlayer(sender.getName() + " - " + bcast_msg.toString());
|
||||
|
||||
// strike with lightning effect:
|
||||
final Location targetPos = player.getLocation();
|
||||
for (int x = -1; x <= 1; x++)
|
||||
{
|
||||
for (int z = -1; z <= 1; z++)
|
||||
{
|
||||
final Location strike_pos = new Location(targetPos.getWorld(), targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z);
|
||||
targetPos.getWorld().strikeLightning(strike_pos);
|
||||
}
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), message.toString(), true);
|
||||
|
||||
TFM_BanManager.getInstance().addIpBan(new TFM_Ban(TFM_Util.getIp(player), player.getName(), sender.getName(), expires, reason));
|
||||
TFM_BanManager.getInstance().addUuidBan(new TFM_Ban(player.getUniqueId(), player.getName(), sender.getName(), expires, reason));
|
||||
|
||||
player.kickPlayer(sender.getName() + " - " + message.toString());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2,7 +2,8 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -21,12 +22,12 @@ public class Command_tfbanlist extends TFM_Command
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||
if (senderIsConsole || TFM_AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
try
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Purging the ban list", true);
|
||||
TFM_ServerInterface.wipeNameBans();
|
||||
TFM_BanManager.getInstance().purgeUuidBans();
|
||||
sender.sendMessage(ChatColor.GRAY + "Ban list has been purged.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -43,20 +44,7 @@ public class Command_tfbanlist extends TFM_Command
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder banned_players = new StringBuilder();
|
||||
banned_players.append("Banned Players: ");
|
||||
boolean first = true;
|
||||
for (OfflinePlayer player : server.getBannedPlayers())
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
banned_players.append(", ");
|
||||
}
|
||||
first = false;
|
||||
banned_players.append(player.getName().trim());
|
||||
}
|
||||
|
||||
playerMsg(banned_players.toString());
|
||||
playerMsg(TFM_BanManager.getInstance().getUuidBanList().size() + " UUID bans total");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -4,8 +4,10 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -22,11 +24,13 @@ public class Command_tfipbanlist extends TFM_Command
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||
if (senderIsConsole || TFM_AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
try
|
||||
{
|
||||
TFM_ServerInterface.wipeIpBans();
|
||||
TFM_BanManager.getInstance().purgeIpBans();
|
||||
TFM_Util.adminAction(sender.getName(), "Purging the IP ban list", true);
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + "IP ban list has been purged.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -43,26 +47,7 @@ public class Command_tfipbanlist extends TFM_Command
|
||||
}
|
||||
}
|
||||
|
||||
List<String> ip_bans = Arrays.asList(server.getIPBans().toArray(new String[0]));
|
||||
Collections.sort(ip_bans);
|
||||
|
||||
StringBuilder banned_ips = new StringBuilder();
|
||||
banned_ips.append("Banned IPs: ");
|
||||
boolean first = true;
|
||||
for (String ip : ip_bans)
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
banned_ips.append(", ");
|
||||
}
|
||||
if (ip.matches("^\\d{1,3}\\.\\d{1,3}\\.(\\d{1,3}|\\*)\\.(\\d{1,3}|\\*)$"))
|
||||
{
|
||||
first = false;
|
||||
banned_ips.append(ip.trim());
|
||||
}
|
||||
}
|
||||
|
||||
playerMsg(banned_ips.toString());
|
||||
playerMsg(TFM_BanManager.getInstance().getIpBanList().size() + " IPbans total");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1,5 +1,11 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PermbanList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@ -7,14 +13,50 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Shows information about TotalFreedomMod", usage = "/<command>")
|
||||
@CommandParameters(description = "Shows information about TotalFreedomMod or reloads it", usage = "/<command> [reload]")
|
||||
public class Command_tfm extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
playerMsg("TotalFreedomMod for 'TotalFreedom', the original all-op server.", ChatColor.GOLD);
|
||||
playerMsg(String.format("Version " + ChatColor.BLUE + "%s.%s" + ChatColor.BLUE + ", built %s.", TotalFreedomMod.pluginVersion, TotalFreedomMod.buildNumber, TotalFreedomMod.buildDate), ChatColor.GOLD);
|
||||
if (args.length == 1)
|
||||
{
|
||||
if (!args[0].equals("reload"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!TFM_AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
TFM_AdminList.load();
|
||||
TFM_PermbanList.load();
|
||||
TFM_PlayerList.getInstance().load();
|
||||
TFM_BanManager.getInstance().load();
|
||||
TFM_CommandBlocker.getInstance().load();
|
||||
|
||||
|
||||
final String message = String.format("%s v%s.%s reloaded.",
|
||||
TotalFreedomMod.pluginName,
|
||||
TotalFreedomMod.pluginVersion,
|
||||
TotalFreedomMod.buildNumber);
|
||||
|
||||
playerMsg(message);
|
||||
TFM_Log.info(message);
|
||||
return true;
|
||||
}
|
||||
|
||||
playerMsg("TotalFreedomMod for 'Total Freedom', the original all-op server.", ChatColor.GOLD);
|
||||
playerMsg(String.format("Version "
|
||||
+ ChatColor.BLUE + "%s.%s" + ChatColor.GOLD + ", built "
|
||||
+ ChatColor.BLUE + "%s" + ChatColor.GOLD + " by "
|
||||
+ ChatColor.BLUE + "%s" + ChatColor.GOLD + ".",
|
||||
TotalFreedomMod.pluginVersion,
|
||||
TotalFreedomMod.buildNumber,
|
||||
TotalFreedomMod.buildDate,
|
||||
TotalFreedomMod.buildCreator), ChatColor.GOLD);
|
||||
playerMsg("Created by Madgeek1450 and DarthSalamon.", ChatColor.GOLD);
|
||||
playerMsg("Visit " + ChatColor.AQUA + "http://totalfreedom.me/" + ChatColor.GREEN + " for more information.", ChatColor.GREEN);
|
||||
|
||||
|
@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true)
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||
@CommandParameters(description = "Update server files.", usage = "/<command>")
|
||||
public class Command_tfupdate extends TFM_Command
|
||||
{
|
||||
|
193
src/me/StevenLawson/TotalFreedomMod/Commands/Command_toggle.java
Normal file
193
src/me/StevenLawson/TotalFreedomMod/Commands/Command_toggle.java
Normal file
@ -0,0 +1,193 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_GameRuleHandler;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_GameRuleHandler.TFM_GameRule;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Toggles TotalFreedomMod settings", usage = "/<command> [option] [value] [value]")
|
||||
public class Command_toggle extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
playerMsg("Available toggles: ");
|
||||
playerMsg("- waterplace");
|
||||
playerMsg("- fireplace");
|
||||
playerMsg("- lavaplace");
|
||||
playerMsg("- fluidspread");
|
||||
playerMsg("- lavadmg");
|
||||
playerMsg("- firespread");
|
||||
playerMsg("- prelog");
|
||||
playerMsg("- lockdown");
|
||||
playerMsg("- petprotect");
|
||||
playerMsg("- droptoggle");
|
||||
playerMsg("- nonuke");
|
||||
playerMsg("- explosives");
|
||||
playerMsg("- disguisecraft");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equals("waterplace"))
|
||||
{
|
||||
toggle("Water placement is", TFM_ConfigEntry.ALLOW_WATER_PLACE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("fireplace"))
|
||||
{
|
||||
toggle("Fire placement is", TFM_ConfigEntry.ALLOW_FIRE_PLACE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("lavaplace"))
|
||||
{
|
||||
toggle("Lava placement is", TFM_ConfigEntry.ALLOW_LAVA_PLACE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("fluidspread"))
|
||||
{
|
||||
toggle("Fire placement is", TFM_ConfigEntry.ALLOW_FLUID_SPREAD);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("lavadmg"))
|
||||
{
|
||||
toggle("Lava damage is", TFM_ConfigEntry.ALLOW_LAVA_DAMAGE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("firespread"))
|
||||
{
|
||||
TFM_GameRuleHandler.setGameRule(TFM_GameRule.DO_FIRE_TICK, TFM_ConfigEntry.ALLOW_FIRE_SPREAD.getBoolean());
|
||||
toggle("Fire spread is", TFM_ConfigEntry.ALLOW_FIRE_SPREAD);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("prelog"))
|
||||
{
|
||||
toggle("Command prelogging is", TFM_ConfigEntry.PREPROCESS_LOG_ENABLED);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("lockdown"))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), (TotalFreedomMod.lockdownEnabled ? "De-a" : "A") + "ctivating server lockdown", true);
|
||||
TotalFreedomMod.lockdownEnabled = !TotalFreedomMod.lockdownEnabled;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("petprotect"))
|
||||
{
|
||||
toggle("Tamed pet protection is", TFM_ConfigEntry.PET_PROTECT_ENABLED);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("droptoggle"))
|
||||
{
|
||||
toggle("Automatic entity wiping is", TFM_ConfigEntry.AUTO_ENTITY_WIPE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("nonuke"))
|
||||
{
|
||||
if (args.length >= 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
TFM_ConfigEntry.NUKE_MONITOR_RANGE.setDouble(Math.max(1.0, Math.min(500.0, Double.parseDouble(args[1]))));
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length >= 3)
|
||||
{
|
||||
try
|
||||
{
|
||||
TFM_ConfigEntry.NUKE_MONITOR_COUNT_BREAK.setInteger(Math.max(1, Math.min(500, Integer.parseInt(args[2]))));
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
toggle("Nuke monitor is", TFM_ConfigEntry.NUKE_MONITOR_ENABLED);
|
||||
|
||||
if (TFM_ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean())
|
||||
{
|
||||
playerMsg("Anti-freecam range is set to " + TFM_ConfigEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks.");
|
||||
playerMsg("Block throttle rate is set to " + TFM_ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("explosives"))
|
||||
{
|
||||
if (args.length == 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
TFM_ConfigEntry.EXPLOSIVE_RADIUS.setDouble(Math.max(1.0, Math.min(30.0, Double.parseDouble(args[1]))));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
TFM_Util.playerMsg(sender, ex.getMessage());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
toggle("Explosions are", TFM_ConfigEntry.ALLOW_EXPLOSIONS);
|
||||
|
||||
if (TFM_ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
|
||||
{
|
||||
playerMsg("Radius set to " + TFM_ConfigEntry.EXPLOSIVE_RADIUS.getDouble());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("disguisecraft"))
|
||||
{
|
||||
final Plugin disguiseCraft = server.getPluginManager().getPlugin("DisguiseCraft");
|
||||
if (disguiseCraft == null)
|
||||
{
|
||||
playerMsg("DisguiseCraft is not installed on this server.");
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean enabled = disguiseCraft.isEnabled();
|
||||
TFM_Util.adminAction(sender.getName(), (enabled ? "disa" : "ena") + "bling DisguiseCraft", true);
|
||||
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
plugin.getServer().getPluginManager().disablePlugin(disguiseCraft);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.getServer().getPluginManager().enablePlugin(disguiseCraft);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void toggle(String name, TFM_ConfigEntry entry)
|
||||
{
|
||||
entry.setBoolean(!entry.getBoolean());
|
||||
playerMsg(name + " now " + (entry.setBoolean(!entry.getBoolean()) ? "enabled." : "disabled."));
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user