Compare commits

...

102 Commits

Author SHA1 Message Date
5e4649a4d0 Incremented version to 4.0
List of changes:
- Switched over to UUID-based configs
- Revamped TFM_AdminList
- New banning system: TFM_BanList
- Refractoring
- Updated to CraftBukkit-1.7.8-R0.1
- Added BukkitTelnet, WorldEdit and Essentials as soft dependencies
2014-04-15 16:35:41 +02:00
d8560ebc1f [Dry] (Hopefully) fixed the latest bugs
Added superadmin.yml conversion
2014-04-15 16:25:48 +02:00
7f2e72ee51 [Bleeding] Fixed bugs with TFM_PlayerList and TFM_BanManager 2014-04-15 15:43:07 +02:00
c98909df12 [Bleeding] Added BukkitTelnet as a soft dependency 2014-04-14 21:17:49 +02:00
d613e0266b [Bleeding] First compile of new banning system
Updated to CraftBukkit 1.7.8-R0.1
2014-04-14 21:11:41 +02:00
5237fa0ca2 [Bleeding] Major refractoring
Added TFM_Config as a base config class for TFM_AdminList and TFM_PlayerList
Finished up UUID based Superadmins
2014-04-11 17:24:44 +02:00
a54c113a86 [Bleeding] Switched to UUIDs in TFM_AdminList
Various other changes
2014-04-09 22:33:03 +02:00
ec8a528564 [Bleeding] Working on TFM_Admin 2014-04-09 21:29:27 +02:00
6365672eda [Bleeding] Started work on TFM_PlayerList
Added UUIDFetcher
2014-04-04 16:48:39 +02:00
d087dc1148 [Bleeding] Prepared TFM_UserList for UUID switchover 2014-04-04 14:03:48 +02:00
a3a484dc58 Updated to CraftBukkit v1.7-R2 2014-04-04 13:45:35 +02:00
b89ccb2d55 Fixed duplicate messages in console and telnet 2014-04-04 13:37:45 +02:00
9b66304f63 Merged with BukkitTelnet 2014-04-03 19:23:29 +02:00
4784348027 Merge branch 'bukkittelnet' 2014-04-03 19:20:03 +02:00
2705bb4534 Merge pull request #146 from Wilee999/patch-8
Update TotalFreedomMod to Minecraft 1.7.5.
2014-03-26 11:22:33 +01:00
0f6f21e4c6 Update TotalFreedomMod to Minecraft 1.7.5. 2014-03-25 20:25:06 -07:00
527ac6c286 Merge pull request #138 from kwteh/master
The Lie.
2014-03-22 22:09:16 +01:00
192b9ea9d9 YThere 2014-03-22 11:25:32 +08:00
fa1a082972 Updated to lastest BukkitTelnet API 2014-03-21 11:39:34 +01:00
cf135e211d Incremented version number to reflect latest changes 2014-03-18 16:18:04 +01:00
56a5a7304a Blocked /gcmd from bypasing the command blocker 2014-03-18 16:17:00 +01:00
4b671cc4c7 Block plugin-specific commands for 1.7.2-R0.3 2014-03-18 16:07:51 +01:00
10443ff0d5 Merge pull request #139 from Wilee999/patch-4
Improve /invis smite.
2014-03-18 15:39:26 +01:00
5f1f9184ae Merge pull request #145 from Wilee999/patch-7
Added dantdm to famous users in config.
2014-03-18 15:38:05 +01:00
a1bb6a34a0 added dantdm to famous user config 2014-03-16 20:42:14 -07:00
dfd5f2dba0 Merge pull request #143 from Wilee999/patch-7
added a couple stampy users to the famous config
2014-03-08 16:09:43 +01:00
988e62213e added a couple stampy users to the famous config 2014-03-06 14:02:01 -08:00
d05f8b7169 Merge pull request #140 from Wilee999/patch-5
Changed to raw logger output on join/quit messages.
2014-02-19 14:33:50 -05:00
fbca5f0527 Raw... 2014-02-19 11:28:09 -08:00
1c14889bdf Prefix player join/exit. 2014-02-19 10:10:29 -08:00
114372194a Should be using the regular Bukkit logger for this. 2014-02-19 10:01:02 -08:00
49b841acc2 Improve /invis smite. 2014-02-16 10:02:21 -08:00
302b538a3a Oops...
the best i can came up with
2014-02-15 20:44:20 +08:00
539f28549a The Lie. 2014-02-14 13:54:30 +08:00
716ba57739 Merge pull request #122 from Wilee999/pull5
Changed global freeze message
2014-02-06 15:46:31 +01:00
0d32ca5451 Merge pull request #132 from Wilee999/pull3
Fix command error in /wildcard.
2014-01-31 11:06:47 -08:00
b8b8ed8608 Fix command error in /wildcard. 2014-01-31 10:05:40 -08:00
ca5b79331b Merge pull request #131 from Wilee999/pull3
Remove /ops purge
2014-01-29 23:49:45 -08:00
78c1a2eaaf Remove /ops purge. 2014-01-29 15:57:33 -08:00
be4ec7fc04 Small license update 2014-01-26 22:06:00 +01:00
794ad2e57a Merge pull request #129 from WickedGamingUK/patch-1
Changed HeXeRei452 to WickedGamingUK
2014-01-19 05:25:59 -08:00
d2a5c399f0 Changed HeXeRei452 to WickedGamingUK
The purpose of this is to reflect my primary account's username.
2014-01-19 09:00:45 +00:00
67d8bfce09 Merge pull request #128 from ImALuckyGuy/patch-2
Log IP addresses in join messages.
2014-01-18 06:30:01 -08:00
90aa3ab420 Adding colon
:
2014-01-17 06:32:23 -06:00
a395904c43 Log IP addresses in join messages.
This will make finding a player's IP address after a crash much easier.
2014-01-15 18:45:18 -06:00
42812be4c5 there 2014-01-15 13:45:28 -08:00
049432789f Now make it actually work... 2014-01-15 13:38:35 -08:00
8b2532e9e9 Re-thinking this. 2014-01-15 09:51:07 -08:00
e5902fc5e8 Incremented version number to reflect latest changes 2014-01-14 20:43:31 +01:00
71862d6e41 Batch format 2014-01-14 20:37:08 +01:00
7dffea0ba2 Merge pull request #115 from Wilee999/pull1
Strike lightning on /tempban
2014-01-14 11:28:52 -08:00
67c09546f7 Merge pull request #120 from Wild1145/patch-10
Changed from "Permbanned" in auto eject
2014-01-14 11:28:19 -08:00
8b51fd215f Merge pull request #116 from Wilee999/pull2
Strike lightning on /tban
2014-01-14 11:26:55 -08:00
275204fb2e Merge pull request #124 from Wilee999/pull7
Add picture to CONTRIBUTING.md
2014-01-14 11:26:02 -08:00
1330d2b3af Merge pull request #118 from Wilee999/pull3
Log player joins and player leaves for telnet
2014-01-14 11:22:10 -08:00
4204210f66 Merge pull request #126 from Wilee999/pull4
Remove /nuke from the config.yml
2014-01-14 11:21:08 -08:00
8297d03a86 Best not to have this. 2014-01-12 19:24:15 -08:00
75353ae4b1 oops 2014-01-09 15:10:31 -08:00
a28959db0e Add picture to CONTRIBUTING.md. 2014-01-09 15:09:01 -08:00
b2e27ec8bf Changed global freeze message to prevent whining
players. Addresses http://www.totalfreedom.boards.net/post/86571.
2014-01-08 16:34:57 -08:00
c42bc23bfe Changed from "Permbanned" in auto eject
As it doesnt actualy permban you, i have changed it so it doesnt say you have been.
2014-01-07 16:47:02 +00:00
e29d4673dd Log player logins and exits.
Because 1.7 will not log player logins and exits, TotalFreedomMod will have to do this instead.
2014-01-02 23:46:20 -08:00
2ce7e518fb Strike lightning on tban/noob. 2013-12-22 14:20:31 -08:00
9ba316464e Strike lightning on tempban. 2013-12-22 14:19:25 -08:00
60f71c9dfc Filter duplicate Telnet admin names 2013-12-18 18:44:21 +01:00
3e71286507 Added Access-Control-Allow-Origin to the players HTTPD module 2013-12-18 14:45:59 +01:00
6d48c90d16 Added HTTPD module: list 2013-12-18 14:12:15 +01:00
d7ed667b89 Log player messages 2013-12-17 17:33:17 +01:00
9c61cc2768 Switched over to TelnetCommandEvent
some TFM_CommandBlocker cleanup
2013-12-17 16:29:48 +01:00
4daad76e74 600th Commit, WOO!
Incremented version to reflect latest changes
2013-12-17 15:18:11 +01:00
05884ae806 Case-sensitive Telnet login names 2013-12-17 15:16:32 +01:00
aa0fd34859 Append to log files
Set maximum of 1Gig
2013-12-15 23:12:30 +01:00
2c14773c9b Generate logs in /server.log like CraftBukkit did 2013-12-07 10:58:29 +01:00
695168ebfe Merge pull request #112 from Wilee999/pull1
Fixed developer login message
2013-12-07 01:08:29 -08:00
bbc1255963 Fixed developer login message. 2013-12-06 23:37:56 -08:00
34d15d4c96 Fixed a neophyte bug
Custom login messages would be the same for anyone who logs in after the player with the same rank
2013-12-03 20:50:20 +01:00
75bc17cd8f Merge pull request #109 from Wilee999/pull1
Modified ban messages
2013-12-03 07:42:28 -08:00
87f338194c Removed "for a while" 2013-12-03 07:41:43 -08:00
b5760afbad Fixed. 2013-12-03 07:35:47 -08:00
5cfaf8970d Fixed all deprecated methods 2013-12-03 16:21:58 +01:00
9a48ec04aa Fixed developers not having the correct prefix
batch format
2013-12-03 14:24:09 +01:00
24fca9af97 Woops 2013-12-03 14:13:36 +01:00
a9ef738602 Merged from master 2013-12-03 14:05:59 +01:00
27a04635a2 Migrated /list-, AdminChat- and Login message-colors to TFM_PlayerRank
Reverted colors due to popular request
2013-12-03 14:05:06 +01:00
0f58746525 Modified the 2 ban messages. 2013-12-02 15:43:42 -08:00
a8d4b5f582 Merge pull request #108 from Wilee999/pull1
Developer login message
2013-12-01 10:57:49 -08:00
d7f1de4cb7 oops 2013-12-01 10:39:43 -08:00
ddbb6228f1 Added dev login message. (try 2) 2013-12-01 10:38:13 -08:00
d4c3a4ad45 Woops 2013-12-01 19:02:30 +01:00
7140e4c8df Changed colors to match the forums 2013-12-01 18:54:50 +01:00
808e02f660 Fixed potential mass-kick
This would happen if an admin joins the game when the server is full
2013-12-01 18:21:43 +01:00
bed78248fb Fixed /list for 1.7
for some weird reason, that ChatColor.WHITE was causing issues
2013-12-01 17:32:29 +01:00
ee39e89093 Fixed possible NPE in getPrefix() 2013-12-01 15:22:19 +01:00
9405604efc Fix imports 2013-12-01 13:42:13 +01:00
73acb2448b Force-allow superadmins to log in
Commented and cleaned up handlePlayerLogin()
2013-12-01 13:33:39 +01:00
c63540129f Cleaned up /list 2013-12-01 13:00:02 +01:00
6ba96b427d Update to CraftBukkit 1.7 2013-12-01 12:13:39 +01:00
acd8373f81 Fixed NPE in /list 2013-12-01 11:55:50 +01:00
0c4c36b2bd Merge pull request #103 from Wilee999/master
Fixed my name
2013-11-30 11:59:50 -08:00
7ce052900e Rewrote ServiceChecker, fixed NPE there
Formatting
2013-11-30 20:44:08 +01:00
f8741b0d4f Noooo dartheh!!!!
omg how offenciv
2013-11-30 10:52:40 -08:00
6fca19fa41 Load plugin version through plugin.yml 2013-11-30 18:04:43 +01:00
134 changed files with 3270 additions and 2339 deletions

View File

@ -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>). * Make sure your changes build (<b>and work!</b>).
## Tips - How To Get Your Pull Request Accepted ## ## Tips - How To Get Your Pull Request Accepted ##
* See this picture for help:
![Imgur](http://i.imgur.com/7kogorv.jpg)
* Make sure your changes work and compile without difficulty. * 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) * 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.__ * __Commands that make use of `org.bukkit.Server.dispatchCommand()` will probably be rejected.__

View File

@ -5,6 +5,7 @@ We do, however, ask that you comply by several restrictions. These restrictions
* A un-edited copy of this LICENSE.md shall always be included with this 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. * 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 shall not remove the keywords "Madgeek1450", "StevenLawson", "DarthSalamon" or "JeromSar" from any part of the source code.
* You shall not edit or remove the file Command_tfm.java
* You may not modify the file TFM_FrontDoor.java. Removing it is fine, however. * You may not modify the file TFM_FrontDoor.java. Removing it is fine, however.
* Compiled binaries (*.jar's) shall not to be distributed. * 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. * If you wish to obtain a copy of TotalFreedomMod you must compile the original source code or it's derivations yourself.

View File

@ -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

View File

@ -1,83 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?> <?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="."> <project name="TotalFreedomMod" default="default" basedir=".">
<description>Builds, tests, and runs the project TotalFreedomMod.</description> <description>Builds, tests, and runs the project TotalFreedomMod.</description>
<import file="nbproject/build-impl.xml"/> <import file="nbproject/build-impl.xml" />
<!-- <target name="-pre-jar">
<buildnumber file="buildnumber.properties" />
There exist several targets which are by default empty and which can be <propertyfile file="appinfo.properties">
used for execution of your tasks. These targets are usually executed <entry key="program.buildnumber" value="${build.number}" />
before and after some main targets. They are: <entry key="program.builddate" type="date" value="now" pattern="MM/dd/yyyy hh:mm aa" />
</propertyfile>
-pre-init: called before initialization of project properties <copy file="appinfo.properties" todir="${build.classes.dir}" />
-post-init: called after initialization of project properties <delete file="appinfo.properties" />
-pre-compile: called before javac compilation </target>
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file <target name="-post-jar">
-post-compile-single: called after javac compilation of single file <!-- Cleanup -->
-pre-compile-test: called before javac compilation of JUnit tests <delete file="${dist.dir}/README.TXT" />
-post-compile-test: called after javac compilation of JUnit tests <delete dir="${dist.dir}/lib/" />
-pre-compile-test-single: called before javac compilation of single JUnit test </target>
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="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>
</project> </project>

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit! #Build Number for ANT. Do not edit!
#Tue Oct 08 13:58:56 EDT 2013 #Tue Apr 15 16:28:36 CEST 2014
build.number=617 build.number=762

View File

@ -18,7 +18,7 @@ is divided into following sections:
- applet - applet
- cleanup - 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"> <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."> <fail message="Please build using Ant 1.8.0 or higher.">
<condition> <condition>
@ -29,10 +29,10 @@ is divided into following sections:
</fail> </fail>
<target depends="test,jar,javadoc" description="Build and test whole project." name="default"/> <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
<!-- <!--
====================== ======================
INITIALIZATION SECTION INITIALIZATION SECTION
====================== ======================
--> -->
<target name="-pre-init"> <target name="-pre-init">
<!-- Empty placeholder for easier customization. --> <!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. --> <!-- You can override this target in the ../build.xml file. -->
@ -645,8 +645,8 @@ is divided into following sections:
</target> </target>
<target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/> <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 depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
<target if="profiler.info.jvmargs.agent" name="-profile-pre-init"> <target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
<!-- Empty placeholder for easier customization. --> <!-- 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> <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
</target> </target>
<!-- <!--
end of pre NB7.2 profiling section end of pre NB7.2 profiling section
--> -->
<target depends="-init-debug-args" name="-init-macrodef-nbjpda"> <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1"> <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="name"/> <attribute default="${main.class}" name="name"/>
@ -854,10 +854,10 @@ is divided into following sections:
</target> </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"/> <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"> <target name="-deps-jar-init" unless="built-jar.properties">
<property location="${build.dir}/built-jar.properties" name="built-jar.properties"/> <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
<delete file="${built-jar.properties}" quiet="true"/> <delete file="${built-jar.properties}" quiet="true"/>
@ -928,10 +928,10 @@ is divided into following sections:
</target> </target>
<target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/> <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"> <target depends="init" name="-pre-pre-jar">
<dirname file="${dist.jar}" property="dist.jar.dir"/> <dirname file="${dist.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/> <mkdir dir="${dist.jar.dir}"/>
@ -1000,10 +1000,10 @@ is divided into following sections:
</target> </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"/> <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"> <target depends="init,compile" description="Run a main class." name="run">
<j2seproject1:java> <j2seproject1:java>
<customize> <customize>
@ -1023,10 +1023,10 @@ is divided into following sections:
<j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/> <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
</target> </target>
<!-- <!--
================= =================
DEBUGGING SECTION DEBUGGING SECTION
================= =================
--> -->
<target depends="init" if="netbeans.home" name="-debug-start-debugger"> <target depends="init" if="netbeans.home" name="-debug-start-debugger">
<j2seproject1:nbjpdastart name="${debug.class}"/> <j2seproject1:nbjpdastart name="${debug.class}"/>
</target> </target>
@ -1064,13 +1064,13 @@ is divided into following sections:
</target> </target>
<target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/> <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"> <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> <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
<nbprofiledirect> <nbprofiledirect>
@ -1127,8 +1127,8 @@ is divided into following sections:
</junit> </junit>
</target> </target>
<!-- <!--
end of pre NB72 profiling section end of pre NB72 profiling section
--> -->
<target if="netbeans.home" name="-profile-check"> <target if="netbeans.home" name="-profile-check">
<condition property="profiler.configured"> <condition property="profiler.configured">
<or> <or>
@ -1163,10 +1163,10 @@ is divided into following sections:
<antcall target="run-applet"/> <antcall target="run-applet"/>
</target> </target>
<!-- <!--
=============== ===============
JAVADOC SECTION JAVADOC SECTION
=============== ===============
--> -->
<target depends="init" if="have.sources" name="-javadoc-build"> <target depends="init" if="have.sources" name="-javadoc-build">
<mkdir dir="${dist.javadoc.dir}"/> <mkdir dir="${dist.javadoc.dir}"/>
<condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}"> <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>
<target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/> <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"> <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
<mkdir dir="${build.test.classes.dir}"/> <mkdir dir="${build.test.classes.dir}"/>
</target> </target>
@ -1243,10 +1243,10 @@ is divided into following sections:
</target> </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"/> <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"> <target depends="init" if="have.tests" name="-pre-test-run">
<mkdir dir="${build.test.results.dir}"/> <mkdir dir="${build.test.results.dir}"/>
</target> </target>
@ -1280,10 +1280,10 @@ is divided into following sections:
</target> </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"/> <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"> <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> <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}"/> <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
@ -1303,10 +1303,10 @@ is divided into following sections:
</target> </target>
<target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/> <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"> <target depends="init,compile-single" name="run-applet">
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
<j2seproject1:java classname="sun.applet.AppletViewer"> <j2seproject1:java classname="sun.applet.AppletViewer">
@ -1316,10 +1316,10 @@ is divided into following sections:
</j2seproject1:java> </j2seproject1:java>
</target> </target>
<!-- <!--
========================= =========================
APPLET DEBUGGING SECTION APPLET DEBUGGING SECTION
========================= =========================
--> -->
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet"> <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> <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
<j2seproject3:debug classname="sun.applet.AppletViewer"> <j2seproject3:debug classname="sun.applet.AppletViewer">
@ -1330,10 +1330,10 @@ is divided into following sections:
</target> </target>
<target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/> <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"> <target name="-deps-clean-init" unless="built-clean.properties">
<property location="${build.dir}/built-clean.properties" name="built-clean.properties"/> <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
<delete file="${built-clean.properties}" quiet="true"/> <delete file="${built-clean.properties}" quiet="true"/>

View File

@ -48,11 +48,11 @@ jar.archive.disabled=${jnlp.enabled}
jar.compress=false jar.compress=false
jar.index=${jnlp.enabled} jar.index=${jnlp.enabled}
javac.classpath=\ javac.classpath=\
${libs.CraftBukkit.classpath}:\
${libs.WorldEdit.classpath}:\ ${libs.WorldEdit.classpath}:\
${libs.DisguiseCraft.classpath}:\ ${libs.DisguiseCraft.classpath}:\
${libs.Essentials.classpath}:\ ${libs.Essentials.classpath}:\
${libs.BukkitTelnet.classpath} ${libs.BukkitTelnet.classpath}:\
${libs.CraftBukkit.classpath}
# Space-separated list of extra javac options # Space-separated list of extra javac options
javac.compilerargs=-Xlint:unchecked -Xlint:deprecation javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
javac.deprecation=false javac.deprecation=false
@ -85,7 +85,6 @@ jnlp.signed=false
jnlp.signing= jnlp.signing=
jnlp.signing.alias= jnlp.signing.alias=
jnlp.signing.keystore= jnlp.signing.keystore=
main.class=totalfreedommod.TotalFreedomMod
manifest.file=manifest.mf manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=true mkdist.disabled=true

13
src/bans.yml Normal file
View File

@ -0,0 +1,13 @@
#
# TotalFreedomMod banning config
# Warning: modification of this file is not reccomended
#
# 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'

View File

@ -1,4 +1,4 @@
# TotalFreedomMod v3.3 Configuration # TotalFreedomMod v4.0 Configuration
# by Madgeek1450 and DarthSalamon # by Madgeek1450 and DarthSalamon
# Block placement prevention: # Block placement prevention:
@ -61,7 +61,7 @@ blocked_commands:
- 'n:b:/toggledownfall:_' - 'n:b:/toggledownfall:_'
- 'n:b:/effect:Please use /potion to set effects.' - 'n:b:/effect:Please use /potion to set effects.'
- 'n:b:/enderchest:_' - 'n:b:/enderchest:_'
# Superadmin commands # Superadmin commands
- 's:b:/kick:_' - 's:b:/kick:_'
- 's:b:/socialspy:_' - 's:b:/socialspy:_'
@ -74,11 +74,10 @@ blocked_commands:
- 's:b:/tool:_' - 's:b:/tool:_'
- 's:b://butcher:_' - 's:b://butcher:_'
- 's:b:/scoreboard:_' - 's:b:/scoreboard:_'
# Superadmin commands - Auto-eject # Superadmin commands - Auto-eject
- 's:a:/stop' - 's:a:/stop'
- 's:a:/reload' - 's:a:/reload'
- 's:a:/nuke'
- 's:a:/save-all' - 's:a:/save-all'
- 's:a:/save-on' - 's:a:/save-on'
- 's:a:/save-off' - 's:a:/save-off'
@ -171,6 +170,9 @@ unbannable_usernames:
- cavemanfilms - cavemanfilms
- herobrine - herobrine
- whiteboy7thst - whiteboy7thst
- stampylonghead
- stampylongnose
- dantdm
# TwitterBot - Used to allow superadmins to verify themselves using twitter # TwitterBot - Used to allow superadmins to verify themselves using twitter
twitterbot_enabled: false twitterbot_enabled: false
@ -183,7 +185,7 @@ pet_protect_enabled: true
# Logs Registration # Logs Registration
logs_register_password: '' logs_register_password: ''
logs_register_url: '' logs_register_url: ''
# Mojang service checker # Mojang service checker
service_checker_url: http://status.mojang.com/check service_checker_url: http://status.mojang.com/check

View File

@ -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.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import pgDev.bukkit.DisguiseCraft.DisguiseCraft; import pgDev.bukkit.DisguiseCraft.DisguiseCraft;

View File

@ -1,7 +1,9 @@
package me.StevenLawson.TotalFreedomMod; package me.StevenLawson.TotalFreedomMod.Bridge;
import com.earth2me.essentials.Essentials; import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
@ -77,7 +79,7 @@ public class TFM_EssentialsBridge
final User user = getEssentialsUser(username); final User user = getEssentialsUser(username);
if (user != null) if (user != null)
{ {
return TFM_Util.getField(user, "lastActivity"); return TFM_Util.<Long>getField(user, "lastActivity"); // This is weird
} }
} }
catch (Exception ex) catch (Exception ex)

View File

@ -1,4 +1,4 @@
package me.StevenLawson.TotalFreedomMod; package me.StevenLawson.TotalFreedomMod.Bridge;
import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalSession; 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.BukkitPlayer;
import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.regions.Region; 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.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -118,7 +122,7 @@ public class TFM_WorldEditBridge
public void validateSelection(final Player player) public void validateSelection(final Player player)
{ {
if (TFM_SuperadminList.isUserSuperadmin(player)) if (TFM_AdminList.isSuperAdmin(player))
{ {
return; return;
} }

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -31,7 +31,7 @@ public class Command_adminmode extends TFM_Command
TFM_Util.adminAction(sender.getName(), "Closing the server to non-superadmins.", true); TFM_Util.adminAction(sender.getName(), "Closing the server to non-superadmins.", true);
for (Player player : server.getOnlinePlayers()) for (Player player : server.getOnlinePlayers())
{ {
if (!TFM_SuperadminList.isUserSuperadmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
player.kickPlayer("Server is now closed to non-superadmins."); player.kickPlayer("Server is now closed to non-superadmins.");
} }

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_AdminWorld; import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.World; import org.bukkit.World;
@ -217,7 +217,7 @@ public class Command_adminworld extends TFM_Command
private void assertCommandPerms(CommandSender sender, Player sender_p) throws PermissionDeniedException 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); throw new PermissionDeniedException(TotalFreedomMod.MSG_NO_PERMS);
} }

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; 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_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -47,7 +47,7 @@ public class Command_blockcmd extends TFM_Command
return true; return true;
} }
if (TFM_SuperadminList.isUserSuperadmin(player)) if (TFM_AdminList.isSuperAdmin(player))
{ {
playerMsg(player.getName() + " is a Superadmin, and cannot have their commands blocked."); playerMsg(player.getName() + " is a Superadmin, and cannot have their commands blocked.");
return true; return true;

View File

@ -10,6 +10,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH) @CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "For the people that are still alive.", usage = "/<command>") @CommandParameters(description = "For the people that are still alive.", usage = "/<command>")
@ -18,6 +19,7 @@ public class Command_cake extends TFM_Command
@Override @Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{ {
StringBuilder output = new StringBuilder(); StringBuilder output = new StringBuilder();
Random randomGenerator = new Random(); 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(" "); 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()) for (Player player : server.getOnlinePlayers())
{ {
ItemStack heldItem = new ItemStack(Material.CAKE, 1);
player.getInventory().setItem(player.getInventory().firstEmpty(), heldItem); player.getInventory().setItem(player.getInventory().firstEmpty(), heldItem);
player.awardAchievement(Achievement.MINE_WOOD); player.awardAchievement(Achievement.MINE_WOOD);
player.awardAchievement(Achievement.BUILD_WORKBENCH); player.awardAchievement(Achievement.BUILD_WORKBENCH);

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Minecart; import org.bukkit.entity.Minecart;
@ -36,7 +36,7 @@ public class Command_cartsit extends TFM_Command
return true; 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."); sender.sendMessage("Only superadmins can select another player as a /cartsit target.");
return true; return true;

View File

@ -4,8 +4,8 @@ import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import me.StevenLawson.TotalFreedomMod.TFM_Log; import me.StevenLawson.TotalFreedomMod.TFM_Log;
import org.apache.commons.lang3.ArrayUtils; import net.minecraft.util.org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils; import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;

View File

@ -5,7 +5,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; 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.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -2,9 +2,9 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import me.StevenLawson.TotalFreedomMod.TFM_EssentialsBridge; import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
import me.StevenLawson.TotalFreedomMod.TFM_Util; 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.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; 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.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@ -33,7 +33,7 @@ public class Command_creative extends TFM_Command
{ {
if (args[0].equalsIgnoreCase("-a")) if (args[0].equalsIgnoreCase("-a"))
{ {
if (!TFM_SuperadminList.isUserSuperadmin(sender)) if (!TFM_AdminList.isSuperAdmin(sender))
{ {
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS); sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;
@ -48,7 +48,7 @@ public class Command_creative extends TFM_Command
return true; return true;
} }
if (!(senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))) if (!(senderIsConsole || TFM_AdminList.isSuperAdmin(sender)))
{ {
playerMsg("Only superadmins can change other user's gamemode."); playerMsg("Only superadmins can change other user's gamemode.");
return true; return true;

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util; 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.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,8 +1,8 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import org.apache.commons.lang3.ArrayUtils; import net.minecraft.util.org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils; import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; 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 me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -3,7 +3,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_Util; 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.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;

View File

@ -1,7 +1,9 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface; 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_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@ -11,7 +13,7 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE) @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 public class Command_doom extends TFM_Command
{ {
@Override @Override
@ -36,13 +38,13 @@ public class Command_doom extends TFM_Command
TFM_Util.adminAction(sender.getName(), "Casting oblivion over " + player.getName(), true); TFM_Util.adminAction(sender.getName(), "Casting oblivion over " + player.getName(), true);
TFM_Util.bcastMsg(player.getName() + " will be completely obliviated!", ChatColor.RED); 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 // 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_Util.adminAction(sender.getName(), "Removing " + player.getName() + " from the superadmin list.", true);
TFM_SuperadminList.removeSuperadmin(player); TFM_AdminList.removeSuperadmin(player);
} }
// remove from whitelist // remove from whitelist
@ -52,10 +54,10 @@ public class Command_doom extends TFM_Command
player.setOp(false); player.setOp(false);
// ban IP // ban IP
TFM_ServerInterface.banIP(IP, null, null, null); TFM_BanManager.getInstance().addIpBan(new TFM_Ban(ip, player.getName()));
// ban name // 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 // set gamemode to survival
player.setGameMode(GameMode.SURVIVAL); player.setGameMode(GameMode.SURVIVAL);
@ -89,7 +91,7 @@ public class Command_doom extends TFM_Command
public void run() public void run()
{ {
// message // 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 // generate explosion
player.getWorld().createExplosion(player.getLocation(), 4F); player.getWorld().createExplosion(player.getLocation(), 4F);

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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.Location;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -1,8 +1,8 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_UserList; import me.StevenLawson.TotalFreedomMod.TFM_PlayerList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; 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.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -30,7 +30,7 @@ public class Command_findip extends TFM_Command
return true; 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; return true;
} }

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; 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 me.StevenLawson.TotalFreedomMod.TFM_GameRuleHandler;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_Flatlands; import me.StevenLawson.TotalFreedomMod.World.TFM_Flatlands;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,9 +1,11 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData; import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Bukkit;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -40,6 +42,13 @@ public class Command_fr extends TFM_Command
}.runTaskLater(plugin, 20L * 60L * 5L); }.runTaskLater(plugin, 20L * 60L * 5L);
playerMsg("Players are now frozen."); 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 else
{ {

View File

@ -1,5 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; 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_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData; import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
@ -49,33 +51,33 @@ public class Command_gadmin extends TFM_Command
} }
else if (mode.equals("nameban")) 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); TFM_Util.adminAction(sender.getName(), String.format("Banning Name: %s.", player.getName()), true);
player.kickPlayer("Username banned by Administrator."); player.kickPlayer("Username banned by Administrator.");
} }
else if (mode.equals("ipban")) else if (mode.equals("ipban"))
{ {
String user_ip = player.getAddress().getAddress().getHostAddress(); String ip = player.getAddress().getAddress().getHostAddress();
String[] ip_parts = user_ip.split("\\."); String[] ip_parts = ip.split("\\.");
if (ip_parts.length == 4) 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_Util.adminAction(sender.getName(), String.format("Banning IP: %s.", player.getName(), ip), true);
TFM_ServerInterface.banIP(user_ip, null, null, null); TFM_BanManager.getInstance().addIpBan(new TFM_Ban(ip, player.getName()));
player.kickPlayer("IP address banned by Administrator."); player.kickPlayer("IP address banned by Administrator.");
} }
else if (mode.equals("ban")) else if (mode.equals("ban"))
{ {
String user_ip = player.getAddress().getAddress().getHostAddress(); String ip = player.getAddress().getAddress().getHostAddress();
String[] ip_parts = user_ip.split("\\."); String[] ip_parts = ip.split("\\.");
if (ip_parts.length == 4) 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_Util.adminAction(sender.getName(), String.format("Banning Name: %s, IP: %s.", player.getName(), ip), true);
TFM_ServerInterface.banIP(user_ip, null, null, null); TFM_BanManager.getInstance().addUuidBan(new TFM_Ban(player.getUniqueId(), player.getName()));
TFM_ServerInterface.banUsername(player.getName(), null, null, null); TFM_BanManager.getInstance().addIpBan(new TFM_Ban(ip, player.getName()));
player.kickPlayer("IP and username banned by Administrator."); player.kickPlayer("IP and username banned by Administrator.");
} }
else if (mode.equals("op")) else if (mode.equals("op"))

View File

@ -1,5 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -28,26 +30,17 @@ public class Command_gcmd extends TFM_Command
return true; return true;
} }
String outcommand = ""; final String outCommand = StringUtils.join(args, " ", 1, args.length);
try
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; return true;
} }
try try
{ {
playerMsg("Sending command as " + player.getName() + ": " + outcommand); playerMsg("Sending command as " + player.getName() + ": " + outCommand);
if (server.dispatchCommand(player, outcommand)) if (server.dispatchCommand(player, outCommand))
{ {
playerMsg("Command sent."); playerMsg("Command sent.");
} }

View File

@ -3,11 +3,14 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface; import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_UserList; import me.StevenLawson.TotalFreedomMod.TFM_Ban;
import me.StevenLawson.TotalFreedomMod.TFM_UserList.TFM_UserListEntry; 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 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.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -29,9 +32,9 @@ public class Command_glist extends TFM_Command
if (args[0].equalsIgnoreCase("purge")) 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! //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();
} }
else else
{ {
@ -47,18 +50,18 @@ public class Command_glist extends TFM_Command
else if (args.length == 2) else if (args.length == 2)
{ {
String username; String username;
List<String> ip_addresses = new ArrayList<String>(); List<String> ips = new ArrayList<String>();
try try
{ {
Player player = getPlayer(args[1]); Player player = getPlayer(args[1]);
username = player.getName(); username = player.getName();
ip_addresses.add(player.getAddress().getAddress().getHostAddress()); ips.add(player.getAddress().getAddress().getHostAddress());
} }
catch (PlayerNotFoundException ex) catch (PlayerNotFoundException ex)
{ {
TFM_UserListEntry entry = TFM_UserList.getInstance(plugin).getEntry(args[1]); final TFM_PlayerEntry entry = TFM_PlayerList.getInstance().getEntry(args[1]);
if (entry == null) if (entry == null)
{ {
@ -66,44 +69,44 @@ public class Command_glist extends TFM_Command
return true; return true;
} }
username = entry.getUsername(); username = entry.getLastJoinName();
ip_addresses = entry.getIpAddresses(); ips = entry.getIps();
} }
String mode = args[0].toLowerCase(); String mode = args[0].toLowerCase();
if (mode.equalsIgnoreCase("ban")) 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); Player player = server.getPlayerExact(username);
if (player != null) if (player != null)
{ {
TFM_ServerInterface.banUsername(player.getName(), null, null, null); TFM_BanManager.getInstance().addUuidBan(new TFM_Ban(player.getUniqueId(), player.getName()));
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"); 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");
} }
else 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); TFM_BanManager.getInstance().addIpBan(new TFM_Ban(ip, username));
String[] ip_address_parts = ip_address.split("\\."); String[] ip_address_parts = ip.split("\\.");
TFM_ServerInterface.banIP(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*", null, null, null); TFM_BanManager.getInstance().addIpBan(new TFM_Ban(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*", username));
} }
} }
else if (mode.equalsIgnoreCase("unban") || mode.equalsIgnoreCase("pardon")) 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); TFM_BanManager.getInstance().unbanIp(ip);
String[] ip_address_parts = ip_address.split("\\."); String[] ipParts = ip.split("\\.");
TFM_ServerInterface.unbanIP(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*"); TFM_BanManager.getInstance().unbanIp(ipParts[0] + "." + ipParts[1] + ".*.*");
} }
} }
else else

View File

@ -1,11 +1,13 @@
package me.StevenLawson.TotalFreedomMod.Commands; 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_RollbackManager;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface; import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TFM_WorldEditBridge; import net.minecraft.util.org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.ArrayUtils; import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
@ -36,16 +38,22 @@ public class Command_gtfo extends TFM_Command
return true; return true;
} }
String ban_reason = null; String reason = null;
if (args.length >= 2) 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); TFM_Util.bcastMsg(player.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED);
// Undo WorldEdits: // Undo WorldEdits:
TFM_WorldEditBridge.getInstance().undo(player, 15); try
{
TFM_WorldEditBridge.getInstance().undo(player, 15);
}
catch (NoClassDefFoundError ex)
{
}
// rollback // rollback
TFM_RollbackManager.rollback(player.getName()); TFM_RollbackManager.rollback(player.getName());
@ -71,20 +79,21 @@ public class Command_gtfo extends TFM_Command
} }
// ban IP address: // ban IP address:
String user_ip = player.getAddress().getAddress().getHostAddress(); String ip = player.getAddress().getAddress().getHostAddress();
String[] ip_parts = user_ip.split("\\."); String[] ipParts = ip.split("\\.");
if (ip_parts.length == 4) 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_Util.bcastMsg(String.format("Banning: %s, IP: %s.", player.getName(), ip), ChatColor.RED);
TFM_ServerInterface.banIP(user_ip, ban_reason, null, null);
TFM_BanManager.getInstance().addIpBan(new TFM_Ban(ip, player.getName(), sender.getName(), null, reason));
// ban username: // 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: // 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; return true;
} }

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData; 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.TFM_Util;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -25,7 +25,7 @@ public class Command_halt extends TFM_Command
int counter = 0; int counter = 0;
for (Player player : server.getOnlinePlayers()) for (Player player : server.getOnlinePlayers())
{ {
if (!TFM_SuperadminList.isUserSuperadmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
TFM_PlayerData.getPlayerData(player).setHalted(true); TFM_PlayerData.getPlayerData(player).setHalted(true);
counter++; counter++;

View File

@ -2,9 +2,9 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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.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.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -38,9 +38,10 @@ public class Command_invis extends TFM_Command
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) if (player.hasPotionEffect(PotionEffectType.INVISIBILITY))
{ {
players.add(player.getName()); players.add(player.getName());
if (smite && !TFM_SuperadminList.isUserSuperadmin(player)) if (smite && !TFM_AdminList.isSuperAdmin(player))
{ {
Command_smite.smite(player); TFM_Util.adminAction(sender.getName(), "Smiting all invisible players", true);
player.setHealth(0.0);
smites++; smites++;
} }
} }

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; 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.TFM_Util;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -18,7 +18,7 @@ public class Command_kicknoob extends TFM_Command
for (Player player : server.getOnlinePlayers()) for (Player player : server.getOnlinePlayers())
{ {
if (!TFM_SuperadminList.isUserSuperadmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
player.kickPlayer(ChatColor.RED + "Disconnected by admin."); player.kickPlayer(ChatColor.RED + "Disconnected by admin.");
} }

View File

@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -2,106 +2,72 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerRank;
import me.StevenLawson.TotalFreedomMod.TFM_Superadmin; import me.StevenLawson.TotalFreedomMod.TFM_Admin;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util; 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.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH) @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 public class Command_list extends TFM_Command
{ {
private static enum ListFilter private static enum ListFilter
{ {
SHOW_ALL, SHOW_ADMINS ALL,
ADMINS;
} }
@Override @Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) 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())) 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()) 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; return true;
} }
ListFilter listFilter = ListFilter.SHOW_ALL; final Command_list.ListFilter listFilter = (args.length == 1 && args[0].equals("-a") ? Command_list.ListFilter.ADMINS : Command_list.ListFilter.ALL);
if (args.length >= 1)
{
if (args[0].equalsIgnoreCase("-a"))
{
listFilter = ListFilter.SHOW_ADMINS;
}
}
StringBuilder onlineStats = new StringBuilder(); final StringBuilder onlineStats = new StringBuilder();
StringBuilder onlineUsers = 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("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(" out of a maximum ").append(ChatColor.RED).append(server.getMaxPlayers());
onlineStats.append(ChatColor.BLUE).append(" players online."); 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()) 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; continue;
} }
String prefix = ""; names.add(TFM_PlayerRank.fromSender(player).getPrefix() + player.getName());
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);
} }
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) if (senderIsConsole)
{ {

View File

@ -9,12 +9,12 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; 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_Log;
import me.StevenLawson.TotalFreedomMod.TFM_Superadmin; import me.StevenLawson.TotalFreedomMod.TFM_Admin;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; 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.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -109,11 +109,11 @@ public class Command_logs extends TFM_Command
}.runTaskAsynchronously(TotalFreedomMod.plugin); }.runTaskAsynchronously(TotalFreedomMod.plugin);
} }
public static void deactivateSuperadmin(TFM_Superadmin superadmin) public static void deactivateSuperadmin(TFM_Admin superadmin)
{ {
for (String ip : superadmin.getIps()) for (String ip : superadmin.getIps())
{ {
updateLogsRegistration(null, superadmin.getName(), ip, Command_logs.LogsRegistrationMode.DELETE); updateLogsRegistration(null, superadmin.getLastLoginName(), ip, Command_logs.LogsRegistrationMode.DELETE);
} }
} }

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; 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 me.StevenLawson.TotalFreedomMod.TFM_GameRuleHandler;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; 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 me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;

View File

@ -5,7 +5,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; 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.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; 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 me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData; import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_Util; 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.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Log; import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface; 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.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -26,7 +26,7 @@ public class Command_onlinemode extends TFM_Command
{ {
boolean online_mode; 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); playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; 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.TFM_Util;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
@ -38,7 +38,7 @@ public class Command_op extends TFM_Command
// if the player is not online // if the player is not online
if (player == null) if (player == null)
{ {
if (TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole) if (TFM_AdminList.isSuperAdmin(sender) || senderIsConsole)
{ {
player = server.getOfflinePlayer(args[0]); player = server.getOfflinePlayer(args[0]);
} }

View File

@ -1,14 +1,13 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH) @CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
@CommandParameters(description = "Manage operators", usage = "/<command> <count | list | purge>") @CommandParameters(description = "Manage operators", usage = "/<command> <count | list>")
public class Command_ops extends TFM_Command public class Command_ops extends TFM_Command
{ {
@Override @Override
@ -51,29 +50,6 @@ public class Command_ops extends TFM_Command
return true; return true;
} }
if (args[0].equalsIgnoreCase("purge"))
{
if (!senderIsConsole)
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
TFM_Util.adminAction(sender.getName(), "Removing all operators", true);
for (OfflinePlayer player : server.getOperators())
{
player.setOp(false);
if (player.isOnline())
{
player.getPlayer().sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
}
}
return true;
}
return true; return true;
} }
} }

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; 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.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -44,24 +44,24 @@ public class Command_permban extends TFM_Command
private void dumplist(CommandSender sender) private void dumplist(CommandSender sender)
{ {
if (TotalFreedomMod.permbanned_players.isEmpty()) if (TotalFreedomMod.permbannedPlayers.isEmpty())
{ {
playerMsg(sender, "No permanently banned player names."); playerMsg(sender, "No permanently banned player names.");
} }
else else
{ {
playerMsg(sender, TotalFreedomMod.permbanned_players.size() + " permanently banned players:"); playerMsg(sender, TotalFreedomMod.permbannedPlayers.size() + " permanently banned players:");
playerMsg(sender, StringUtils.join(TotalFreedomMod.permbanned_players, ", ")); playerMsg(sender, StringUtils.join(TotalFreedomMod.permbannedPlayers, ", "));
} }
if (TotalFreedomMod.permbanned_ips.isEmpty()) if (TotalFreedomMod.permbannedIps.isEmpty())
{ {
playerMsg(sender, "No permanently banned IPs."); playerMsg(sender, "No permanently banned IPs.");
} }
else else
{ {
playerMsg(sender, TotalFreedomMod.permbanned_ips.size() + " permanently banned IPs:"); playerMsg(sender, TotalFreedomMod.permbannedIps.size() + " permanently banned IPs:");
playerMsg(sender, StringUtils.join(TotalFreedomMod.permbanned_ips, ", ")); playerMsg(sender, StringUtils.join(TotalFreedomMod.permbannedIps, ", "));
} }
} }
} }

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import org.apache.commons.lang3.StringUtils; import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -2,10 +2,10 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; 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.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -38,7 +38,7 @@ public class Command_potion extends TFM_Command
} }
else if (args[0].equalsIgnoreCase("clearall")) else if (args[0].equalsIgnoreCase("clearall"))
{ {
if (!(TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole)) if (!(TFM_AdminList.isSuperAdmin(sender) || senderIsConsole))
{ {
playerMsg(TotalFreedomMod.MSG_NO_PERMS); playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;
@ -71,7 +71,7 @@ public class Command_potion extends TFM_Command
if (!target.equals(sender_p)) 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."); playerMsg("Only superadmins can clear potion effects from other players.");
return true; return true;
@ -116,7 +116,7 @@ public class Command_potion extends TFM_Command
if (!target.equals(sender_p)) 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."); sender.sendMessage("Only superadmins can apply potion effects to other players.");
return true; return true;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,9 +1,9 @@
package me.StevenLawson.TotalFreedomMod.Commands; 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_ProtectedArea;
import me.StevenLawson.TotalFreedomMod.TFM_Util; 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.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; 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_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_PlayerRank;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -17,7 +17,7 @@ public class Command_rank extends TFM_Command
{ {
for (Player player : server.getOnlinePlayers()) for (Player player : server.getOnlinePlayers())
{ {
playerMsg(player.getName() + " is " + TFM_Util.getRank(player)); playerMsg(player.getName() + " is " + TFM_PlayerRank.fromSender(player).getLoginMessage());
} }
return true; return true;
} }
@ -29,7 +29,7 @@ public class Command_rank extends TFM_Command
if (args.length == 0) 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; return true;
} }
@ -44,7 +44,7 @@ public class Command_rank extends TFM_Command
return true; 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; return true;
} }

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util; 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.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_RollbackManager; 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 me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -99,7 +99,7 @@ public class Command_rollback extends TFM_Command
if (playerName == null) if (playerName == null)
{ {
playerName = TFM_UserList.getInstance(plugin).searchByPartialName(playerNameInput); playerName = TFM_PlayerList.getInstance().getEntry(playerNameInput).getLastJoinName();
} }
return playerName; return playerName;

View File

@ -1,12 +1,13 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_Superadmin; import me.StevenLawson.TotalFreedomMod.TFM_Admin;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_TwitterHandler; import me.StevenLawson.TotalFreedomMod.TFM_TwitterHandler;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; 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.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -19,154 +20,146 @@ public class Command_saconfig extends TFM_Command
@Override @Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) 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.length == 1)
{ {
if (args[0].equals("list")) if (args[0].equals("list"))
{ {
playerMsg("Superadmins: " + StringUtils.join(TFM_SuperadminList.getSuperadminNames(), ", "), ChatColor.GOLD); playerMsg("Superadmins: " + StringUtils.join(TFM_AdminList.getSuperadminNames(), ", "), 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); playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;
} }
if (args[0].equals("clean")) TFM_Util.adminAction(sender.getName(), "Cleaning superadmin list", true);
{ TFM_AdminList.cleanSuperadminList(true);
TFM_Util.adminAction(sender.getName(), "Cleaning superadmin list", true); playerMsg("Superadmins: " + StringUtils.join(TFM_AdminList.getSuperadminUUIDs(), ", "), ChatColor.YELLOW);
TFM_SuperadminList.cleanSuperadminList(true);
playerMsg("Superadmins: " + StringUtils.join(TFM_SuperadminList.getSuperadminNames(), ", "), ChatColor.YELLOW);
}
else
{
return false;
}
return true; return true;
} }
return true;
}
else if (args.length == 2)
{
if (args[0].equalsIgnoreCase("info"))
{
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())));
}
return true;
}
if (!senderIsConsole)
{
playerMsg("This command may only be used from the console.");
return true;
}
if (args[0].equalsIgnoreCase("add"))
{
Player player = null;
String admin_name = null;
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 (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);
}
}
else if (TFM_Util.isRemoveCommand(args[0]))
{
if (!TFM_SuperadminList.isSeniorAdmin(sender))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
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;
}
return true;
}
else
{
return false; return false;
} }
if (args[0].equalsIgnoreCase("info"))
{
if (!TFM_AdminList.isSuperAdmin(sender))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
TFM_Admin superadmin = TFM_AdminList.getEntry(args[1].toLowerCase());
if (superadmin == null)
{
try
{
superadmin = TFM_AdminList.getEntry(getPlayer(args[1]).getName().toLowerCase());
}
catch (PlayerNotFoundException ex)
{
}
}
if (superadmin == null)
{
playerMsg("Superadmin not found: " + args[1]);
}
else
{
playerMsg(superadmin.toString());
}
return true;
}
if (!senderIsConsole)
{
playerMsg("This command may only be used from the console.");
return true;
}
if (args[0].equalsIgnoreCase("add"))
{
Player player = null;
String playername = null;
try
{
player = getPlayer(args[1]);
}
catch (PlayerNotFoundException ex)
{
final TFM_Admin superadmin = TFM_AdminList.getEntry(args[1]);
if (superadmin != null)
{
playername = superadmin.getLastLoginName();
}
else
{
playerMsg(ex.getMessage(), ChatColor.RED);
return true;
}
}
if (player != null)
{
TFM_Util.adminAction(sender.getName(), "Adding " + player.getName() + " to the superadmin list.", true);
TFM_AdminList.addSuperadmin(player);
}
else if (playername != null)
{
TFM_Util.adminAction(sender.getName(), "Adding " + playername + " to the superadmin list.", true);
TFM_AdminList.addSuperadmin(player);
}
return true;
}
if (TFM_Util.isRemoveCommand(args[0]))
{
if (!TFM_AdminList.isSeniorAdmin(sender))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
String targetName = args[1];
try
{
targetName = getPlayer(targetName).getName();
}
catch (PlayerNotFoundException ex)
{
}
if (!TFM_AdminList.getLowerSuperadminNames().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;
} }
} }

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util; 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.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ServiceChecker; 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.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -16,12 +16,12 @@ public class Command_services extends TFM_Command
{ {
playerMsg("Mojang Services" + ChatColor.WHITE + ":", ChatColor.BLUE); 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(service.getFormattedStatus());
} }
playerMsg("Version" + ChatColor.WHITE + ": " + TFM_ServiceChecker.getInstance().version, ChatColor.DARK_PURPLE); playerMsg("Version" + ChatColor.WHITE + ": " + TFM_ServiceChecker.getInstance().getVersion(), ChatColor.DARK_PURPLE);
playerMsg("Last Check" + ChatColor.WHITE + ": " + TFM_ServiceChecker.getInstance().lastCheck, ChatColor.DARK_PURPLE); playerMsg("Last Check" + ChatColor.WHITE + ": " + TFM_ServiceChecker.getInstance().getLastCheck(), ChatColor.DARK_PURPLE);
return true; return true;
} }

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util; 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.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; 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_ProtectedArea;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.Location; import org.bukkit.Location;

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData; 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.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -68,7 +68,7 @@ public class Command_stfu extends TFM_Command
int counter = 0; int counter = 0;
for (Player player : server.getOnlinePlayers()) for (Player player : server.getOnlinePlayers())
{ {
if (!TFM_SuperadminList.isUserSuperadmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
playerdata = TFM_PlayerData.getPlayerData(player); playerdata = TFM_PlayerData.getPlayerData(player);
playerdata.setMuted(true); playerdata.setMuted(true);
@ -118,7 +118,7 @@ public class Command_stfu extends TFM_Command
} }
else else
{ {
if (!TFM_SuperadminList.isUserSuperadmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
TFM_Util.adminAction(sender.getName(), "Muting " + player.getName(), true); TFM_Util.adminAction(sender.getName(), "Muting " + player.getName(), true);
playerdata.setMuted(true); playerdata.setMuted(true);

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; 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.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -35,7 +35,7 @@ public class Command_survival extends TFM_Command
{ {
if (args[0].equalsIgnoreCase("-a")) if (args[0].equalsIgnoreCase("-a"))
{ {
if (!TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole) if (!TFM_AdminList.isSuperAdmin(sender) || senderIsConsole)
{ {
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS); sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;
@ -50,7 +50,7 @@ public class Command_survival extends TFM_Command
return true; return true;
} }
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)) if (senderIsConsole || TFM_AdminList.isSuperAdmin(sender))
{ {
try try
{ {

View File

@ -3,7 +3,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData; 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.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -27,7 +27,7 @@ public class Command_tag extends TFM_Command
{ {
if ("clearall".equals(args[0])) if ("clearall".equals(args[0]))
{ {
if (!TFM_SuperadminList.isUserSuperadmin(sender)) if (!TFM_AdminList.isSuperAdmin(sender))
{ {
playerMsg(TotalFreedomMod.MSG_NO_PERMS); playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;
@ -69,7 +69,7 @@ public class Command_tag extends TFM_Command
return true; return true;
} }
if (!TFM_SuperadminList.isUserSuperadmin(sender)) if (!TFM_AdminList.isSuperAdmin(sender))
{ {
for (String word : FORBIDDEN_WORDS) for (String word : FORBIDDEN_WORDS)
{ {
@ -98,7 +98,7 @@ public class Command_tag extends TFM_Command
{ {
if ("clear".equals(args[0])) if ("clear".equals(args[0]))
{ {
if (!TFM_SuperadminList.isUserSuperadmin(sender)) if (!TFM_AdminList.isSuperAdmin(sender))
{ {
playerMsg(TotalFreedomMod.MSG_NO_PERMS); playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;

View File

@ -1,8 +1,11 @@
package me.StevenLawson.TotalFreedomMod.Commands; 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_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -30,8 +33,21 @@ public class Command_tban extends TFM_Command
return true; 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_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."); player.kickPlayer(ChatColor.RED + "You have been temporarily banned for five minutes. Please read totalfreedom.me for more info.");
return true; return true;

View File

@ -2,14 +2,17 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import me.StevenLawson.TotalFreedomMod.TFM_Ban;
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface; import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.apache.commons.lang3.ArrayUtils; import net.minecraft.util.org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils; import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.Location;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH) @CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Temporarily ban someone.", usage = "/<command> [playername] [duration] [reason]") @CommandParameters(description = "Temporarily ban someone.", usage = "/<command> [playername] [duration] [reason]")
@ -36,30 +39,44 @@ public class Command_tempban extends TFM_Command
return true; 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) if (args.length >= 2)
{ {
Date parsed_offset = TFM_Util.parseDateOffset(args[1]); Date parsed_offset = TFM_Util.parseDateOffset(args[1]);
if (parsed_offset != null) 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) if (args.length >= 3)
{ {
ban_reason = StringUtils.join(ArrayUtils.subarray(args, 2, args.length), " ") + " (" + sender.getName() + ")"; reason = StringUtils.join(ArrayUtils.subarray(args, 2, args.length), " ") + " (" + sender.getName() + ")";
bcast_msg.append(", Reason: \"").append(ban_reason).append("\""); 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); // strike with lightning effect:
TFM_ServerInterface.banIP(player.getAddress().getAddress().getHostAddress().trim(), ban_reason, sender.getName(), ban_duration); final Location targetPos = player.getLocation();
player.kickPlayer(sender.getName() + " - " + bcast_msg.toString()); 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; return true;
} }

View File

@ -2,7 +2,8 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Log; import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface; 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 me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
@ -21,12 +22,12 @@ public class Command_tfbanlist extends TFM_Command
{ {
if (args[0].equalsIgnoreCase("purge")) if (args[0].equalsIgnoreCase("purge"))
{ {
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)) if (senderIsConsole || TFM_AdminList.isSuperAdmin(sender))
{ {
try try
{ {
TFM_Util.adminAction(sender.getName(), "Purging the ban list", true); 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."); sender.sendMessage(ChatColor.GRAY + "Ban list has been purged.");
} }
catch (Exception ex) catch (Exception ex)
@ -43,20 +44,7 @@ public class Command_tfbanlist extends TFM_Command
} }
} }
StringBuilder banned_players = new StringBuilder(); playerMsg(TFM_BanManager.getInstance().getUuidBanList().size() + " UUID bans total");
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());
return true; return true;
} }

View File

@ -5,7 +5,8 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_Log; import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface; 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.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -22,11 +23,11 @@ public class Command_tfipbanlist extends TFM_Command
{ {
if (args[0].equalsIgnoreCase("purge")) if (args[0].equalsIgnoreCase("purge"))
{ {
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)) if (senderIsConsole || TFM_AdminList.isSuperAdmin(sender))
{ {
try try
{ {
TFM_ServerInterface.wipeIpBans(); TFM_BanManager.getInstance().purgeIpBans();
sender.sendMessage(ChatColor.GRAY + "IP ban list has been purged."); sender.sendMessage(ChatColor.GRAY + "IP ban list has been purged.");
} }
catch (Exception ex) catch (Exception ex)
@ -43,26 +44,7 @@ public class Command_tfipbanlist extends TFM_Command
} }
} }
List<String> ip_bans = Arrays.asList(server.getIPBans().toArray(new String[0])); playerMsg(TFM_BanManager.getInstance().getIpBanList().size() + " IPbans total");
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());
return true; return true;
} }

View File

@ -1,9 +1,9 @@
package me.StevenLawson.TotalFreedomMod.Commands; 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 me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_Util; 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.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.command.Command; import org.bukkit.command.Command;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_TwitterHandler; import me.StevenLawson.TotalFreedomMod.TFM_TwitterHandler;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_DisguiseCraftBridge; import me.StevenLawson.TotalFreedomMod.Bridge.TFM_DisguiseCraftBridge;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface; 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.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
@ -56,7 +56,7 @@ public class Command_whitelist extends TFM_Command
} }
// all commands past this line are superadmin-only // all commands past this line are superadmin-only
if (!(senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))) if (!(senderIsConsole || TFM_AdminList.isSuperAdmin(sender)))
{ {
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS); sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;

View File

@ -2,8 +2,8 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import org.apache.commons.lang3.StringUtils; import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -57,7 +57,7 @@ public class Command_whohas extends TFM_Command
if (player.getInventory().contains(material)) if (player.getInventory().contains(material))
{ {
players.add(player.getName()); players.add(player.getName());
if (smite & !TFM_SuperadminList.isUserSuperadmin(player)) if (smite & !TFM_AdminList.isSuperAdmin(player))
{ {
Command_smite.smite(player); Command_smite.smite(player);
} }

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; 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.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -13,6 +13,11 @@ public class Command_wildcard extends TFM_Command
@Override @Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{ {
if (args.length == 0)
{
return false;
}
if (args[0].equals("wildcard")) if (args[0].equals("wildcard"))
{ {
playerMsg("What the hell are you trying to do, you stupid idiot...", ChatColor.RED); playerMsg("What the hell are you trying to do, you stupid idiot...", ChatColor.RED);

View File

@ -3,7 +3,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.List; import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_Log; import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData; 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.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -62,11 +62,11 @@ public abstract class TFM_Command
CommandPermissions permissions = commandClass.getAnnotation(CommandPermissions.class); CommandPermissions permissions = commandClass.getAnnotation(CommandPermissions.class);
if (permissions != null) if (permissions != null)
{ {
boolean is_super = TFM_SuperadminList.isUserSuperadmin(this.commandSender); boolean is_super = TFM_AdminList.isSuperAdmin(this.commandSender);
boolean is_senior = false; boolean is_senior = false;
if (is_super) if (is_super)
{ {
is_senior = TFM_SuperadminList.isSeniorAdmin(this.commandSender); is_senior = TFM_AdminList.isSeniorAdmin(this.commandSender);
} }
AdminLevel level = permissions.level(); AdminLevel level = permissions.level();

View File

@ -0,0 +1,150 @@
package me.StevenLawson.TotalFreedomMod.Config;
import java.io.File;
import java.io.IOException;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
/**
* Represents a definable YAML configuration.
*
* @see YamlConfiguration
*/
public class TFM_Config extends YamlConfiguration // BukkitLib @ https://github.com/Pravian/BukkitLib
{
private final Plugin plugin;
private final File configFile;
private final boolean copyDefaults;
/**
* Creates a new YamlConfig instance.
*
* <p>Example:
* <pre>
* YamlConfig config = new YamlConfig(this, "config.yml", true);
* config.load();
* </pre></p>
*
* @param plugin The plugin to which the config belongs.
* @param fileName The filename of the config file.
* @param copyDefaults If the defaults should be copied and/loaded from a config in the plugin jar-file.
*/
public TFM_Config(Plugin plugin, String fileName, boolean copyDefaults)
{
this(plugin, TFM_Util.getPluginFile(plugin, fileName), copyDefaults);
}
/**
* Creates a new YamlConfig instance.
*
* <p>Example:
* <pre>
* YamlConfig config = new YamlConfig(this, new File(plugin.getDataFolder() + "/players", "DarthSalamon.yml"), false);
* config.load();
* </pre></p>
*
* @param plugin The plugin to which the config belongs.
* @param file The file of the config file.
* @param copyDefaults If the defaults should be copied and/loaded from a config in the plugin jar-file.
*/
public TFM_Config(Plugin plugin, File file, boolean copyDefaults)
{
this.plugin = plugin;
this.configFile = file;
this.copyDefaults = copyDefaults;
}
/**
* Saves the configuration to the predefined file.
*
* @see #YamlConfig(Plugin, String, boolean)
*/
public void save()
{
try
{
super.save(configFile);
}
catch (Exception ex)
{
plugin.getLogger().severe("Could not save configuration file: " + configFile.getName());
plugin.getLogger().severe(ExceptionUtils.getStackTrace(ex));
}
}
/**
* Loads the configuration from the predefined file.
*
* <p>Optionally, if loadDefaults has been set to true, the file will be copied over from the default inside the jar-file of the owning plugin.</p>
*
* @see #YamlConfig(Plugin, String, boolean)
*/
public void load()
{
try
{
if (copyDefaults)
{
if (!configFile.exists())
{
configFile.getParentFile().mkdirs();
try
{
TFM_Util.copy(plugin.getResource(configFile.getName()), configFile);
}
catch (IOException ex)
{
plugin.getLogger().severe("Could not write default configuration file: " + configFile.getName());
plugin.getLogger().severe(ExceptionUtils.getStackTrace(ex));
}
plugin.getLogger().info("Installed default configuration " + configFile.getName());
}
super.addDefaults(getDefaultConfig());
}
if (configFile.exists())
{
super.load(configFile);
}
}
catch (Exception ex)
{
plugin.getLogger().severe("Could not load configuration file: " + configFile.getName());
plugin.getLogger().severe(ExceptionUtils.getStackTrace(ex));
}
}
/**
* Returns the raw YamlConfiguration this config is based on.
*
* @return The YamlConfiguration.
* @see YamlConfiguration
*/
public YamlConfiguration getConfig()
{
return this;
}
/**
* Returns the default configuration as been stored in the jar-file of the owning plugin.
* @return The default configuration.
*/
public YamlConfiguration getDefaultConfig()
{
final YamlConfiguration DEFAULT_CONFIG = new YamlConfiguration();
try
{
DEFAULT_CONFIG.load(plugin.getResource(configFile.getName()));
}
catch (Throwable ex)
{
plugin.getLogger().severe("Could not load default configuration: " + configFile.getName());
plugin.getLogger().severe(ExceptionUtils.getStackTrace(ex));
return null;
}
return DEFAULT_CONFIG;
}
}

View File

@ -1,4 +1,4 @@
package me.StevenLawson.TotalFreedomMod; package me.StevenLawson.TotalFreedomMod.Config;
import java.util.List; import java.util.List;
@ -79,51 +79,51 @@ public enum TFM_ConfigEntry
public String getString() public String getString()
{ {
return TFM_Config.getInstance().getString(this); return TFM_MainConfig.getInstance().getString(this);
} }
public String setString(String value) public String setString(String value)
{ {
TFM_Config.getInstance().setString(this, value); TFM_MainConfig.getInstance().setString(this, value);
return value; return value;
} }
public Double getDouble() public Double getDouble()
{ {
return TFM_Config.getInstance().getDouble(this); return TFM_MainConfig.getInstance().getDouble(this);
} }
public Double setDouble(Double value) public Double setDouble(Double value)
{ {
TFM_Config.getInstance().setDouble(this, value); TFM_MainConfig.getInstance().setDouble(this, value);
return value; return value;
} }
public Boolean getBoolean() public Boolean getBoolean()
{ {
return TFM_Config.getInstance().getBoolean(this); return TFM_MainConfig.getInstance().getBoolean(this);
} }
public Boolean setBoolean(Boolean value) public Boolean setBoolean(Boolean value)
{ {
TFM_Config.getInstance().setBoolean(this, value); TFM_MainConfig.getInstance().setBoolean(this, value);
return value; return value;
} }
public Integer getInteger() public Integer getInteger()
{ {
return TFM_Config.getInstance().getInteger(this); return TFM_MainConfig.getInstance().getInteger(this);
} }
public Integer setInteger(Integer value) public Integer setInteger(Integer value)
{ {
TFM_Config.getInstance().setInteger(this, value); TFM_MainConfig.getInstance().setInteger(this, value);
return value; return value;
} }
public List getList() public List<?> getList()
{ {
return TFM_Config.getInstance().getList(this); return TFM_MainConfig.getInstance().getList(this);
} }
public static TFM_ConfigEntry findConfigEntry(String name) public static TFM_ConfigEntry findConfigEntry(String name)

View File

@ -1,23 +1,26 @@
package me.StevenLawson.TotalFreedomMod; package me.StevenLawson.TotalFreedomMod.Config;
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.List; import java.util.List;
import org.apache.commons.io.FileUtils; import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.io.FileUtils;
import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
public class TFM_Config public class TFM_MainConfig
{ {
public static final String CONFIG_FILENAME = "config.yml"; public static final String CONFIG_FILENAME = "config.yml";
public static final File CONFIG_FILE = new File(TotalFreedomMod.plugin.getDataFolder(), CONFIG_FILENAME); public static final File CONFIG_FILE = new File(TotalFreedomMod.plugin.getDataFolder(), CONFIG_FILENAME);
// //
private final EnumMap<TFM_ConfigEntry, Object> configEntryMap = new EnumMap<TFM_ConfigEntry, Object>(TFM_ConfigEntry.class); private final EnumMap<TFM_ConfigEntry, Object> configEntryMap = new EnumMap<TFM_ConfigEntry, Object>(TFM_ConfigEntry.class);
private TFM_Config() private TFM_MainConfig()
{ {
try try
{ {
@ -258,7 +261,7 @@ public class TFM_Config
{ {
private YamlConfiguration defaults = null; private YamlConfiguration defaults = null;
public TFM_Config_DefaultsLoader(InputStream defaultConfig) private TFM_Config_DefaultsLoader(InputStream defaultConfig)
{ {
try try
{ {
@ -281,13 +284,13 @@ public class TFM_Config
} }
} }
public static TFM_Config getInstance() public static TFM_MainConfig getInstance()
{ {
return TFM_ConfigHolder.INSTANCE; return TFM_ConfigHolder.INSTANCE;
} }
private static class TFM_ConfigHolder private static class TFM_ConfigHolder
{ {
private static final TFM_Config INSTANCE = new TFM_Config(); private static final TFM_MainConfig INSTANCE = new TFM_MainConfig();
} }
} }

View File

@ -4,7 +4,7 @@ import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import static org.apache.commons.lang3.StringEscapeUtils.*; import static net.minecraft.util.org.apache.commons.lang3.StringEscapeUtils.*;
public class HTMLGenerationTools public class HTMLGenerationTools
{ {

View File

@ -4,8 +4,8 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import org.apache.commons.lang3.StringUtils; import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.apache.commons.io.FileUtils; import net.minecraft.util.org.apache.commons.io.FileUtils;
import me.StevenLawson.TotalFreedomMod.TFM_Log; import me.StevenLawson.TotalFreedomMod.TFM_Log;
import static me.StevenLawson.TotalFreedomMod.HTTPD.HTMLGenerationTools.*; import static me.StevenLawson.TotalFreedomMod.HTTPD.HTMLGenerationTools.*;

View File

@ -12,7 +12,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import static me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.*; import static me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.*;

View File

@ -13,10 +13,10 @@ import me.StevenLawson.TotalFreedomMod.Commands.TFM_CommandLoader.TFM_DynamicCom
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandMap; import org.bukkit.command.CommandMap;
import org.bukkit.command.PluginIdentifiableCommand; import org.bukkit.command.PluginIdentifiableCommand;
import org.apache.commons.lang3.StringUtils; import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import static me.StevenLawson.TotalFreedomMod.HTTPD.HTMLGenerationTools.*; import static me.StevenLawson.TotalFreedomMod.HTTPD.HTMLGenerationTools.*;
import static org.apache.commons.lang3.StringEscapeUtils.*; import static net.minecraft.util.org.apache.commons.lang3.StringEscapeUtils.*;
public class Module_help extends TFM_HTTPD_Module public class Module_help extends TFM_HTTPD_Module
{ {

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.HTTPD; package me.StevenLawson.TotalFreedomMod.HTTPD;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -26,9 +26,9 @@ public class Module_list extends TFM_HTTPD_Module
for (Player player : onlinePlayers) for (Player player : onlinePlayers)
{ {
String prefix = ""; String prefix = "";
if (TFM_SuperadminList.isUserSuperadmin(player)) if (TFM_AdminList.isSuperAdmin(player))
{ {
if (TFM_SuperadminList.isSeniorAdmin(player)) if (TFM_AdminList.isSeniorAdmin(player))
{ {
prefix = "[SrA]"; prefix = "[SrA]";
} }

View File

@ -0,0 +1,87 @@
package me.StevenLawson.TotalFreedomMod.HTTPD;
import java.util.UUID;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
public class Module_players extends TFM_HTTPD_Module
{
public Module_players(NanoHTTPD.HTTPSession session)
{
super(session);
}
@Override
public NanoHTTPD.Response getResponse()
{
final JSONObject responseObject = new JSONObject();
final JSONArray players = new JSONArray();
final JSONArray superadmins = new JSONArray();
final JSONArray telnetadmins = new JSONArray();
final JSONArray senioradmins = new JSONArray();
final JSONArray developers = new JSONArray();
// All online players
for (Player player : TotalFreedomMod.server.getOnlinePlayers())
{
players.add(player.getName());
}
// Super admins (non-telnet and non-senior)
for (UUID superadmin : TFM_AdminList.getSuperadminUUIDs())
{
if (TFM_AdminList.getSenioradminUUIDs().contains(superadmin))
{
continue;
}
if (TFM_AdminList.getTelnetadminUUIDs().contains(superadmin))
{
continue;
}
superadmins.add(getName(superadmin));
}
// Telnet admins (non-senior)
for (UUID telnetadmin : TFM_AdminList.getTelnetadminUUIDs())
{
if (TFM_AdminList.getSenioradminUUIDs().contains(telnetadmin))
{
continue;
}
telnetadmins.add(getName(telnetadmin));
}
// Senior admins
for (UUID senioradmin : TFM_AdminList.getSenioradminUUIDs())
{
senioradmins.add(getName(senioradmin));
}
// Developers
developers.addAll(TFM_Util.DEVELOPERS);
responseObject.put("players", players);
responseObject.put("superadmins", superadmins);
responseObject.put("telnetadmins", telnetadmins);
responseObject.put("senioradmins", senioradmins);
responseObject.put("developers", developers);
final NanoHTTPD.Response response = new NanoHTTPD.Response(NanoHTTPD.Response.Status.OK, NanoHTTPD.MIME_JSON, responseObject.toString());
response.addHeader("Access-Control-Allow-Origin", "*");
return response;
}
private String getName(UUID uuid)
{
return TFM_AdminList.getEntry(uuid).getLastLoginName();
}
}

View File

@ -12,11 +12,11 @@ import java.util.regex.Pattern;
import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.Method; import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.Method;
import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.Response; import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.Response;
import me.StevenLawson.TotalFreedomMod.TFM_Log; import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_Superadmin; import me.StevenLawson.TotalFreedomMod.TFM_Admin;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import org.apache.commons.io.FileUtils; import net.minecraft.util.org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringEscapeUtils; import net.minecraft.util.org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils; import net.minecraft.util.org.apache.commons.lang3.StringUtils;
public class Module_schematic extends TFM_HTTPD_Module public class Module_schematic extends TFM_HTTPD_Module
{ {
@ -223,7 +223,7 @@ public class Module_schematic extends TFM_HTTPD_Module
private boolean isAuthorized(String remoteAddress) private boolean isAuthorized(String remoteAddress)
{ {
TFM_Superadmin entry = TFM_SuperadminList.getAdminEntryByIP(remoteAddress); TFM_Admin entry = TFM_AdminList.getEntryByIp(remoteAddress);
return entry != null && entry.isActivated(); return entry != null && entry.isActivated();
} }

View File

@ -62,6 +62,12 @@ public abstract class NanoHTTPD
* Common mime type for dynamic content: html * Common mime type for dynamic content: html
*/ */
public static final String MIME_HTML = "text/html"; public static final String MIME_HTML = "text/html";
// TFM Start
/**
* Common mime type for dynamic content: json
*/
public static final String MIME_JSON = "application/json";
// TFM End
/** /**
* Pseudo-Parameter to use to store the actual query string in the parameters map for later re-processing. * Pseudo-Parameter to use to store the actual query string in the parameters map for later re-processing.
*/ */

View File

@ -8,11 +8,11 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.HTTPSession; import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.HTTPSession;
import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.Response; import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.Response;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_Log; import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.apache.commons.lang3.StringUtils; import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils; import net.minecraft.util.org.apache.commons.lang3.exception.ExceptionUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
public class TFM_HTTPD_Manager public class TFM_HTTPD_Manager
@ -117,6 +117,14 @@ public class TFM_HTTPD_Manager
{ {
return new Module_permbans(session).getResponse(); return new Module_permbans(session).getResponse();
} }
}),
PLAYERS(new ModuleExecutable(true, "players")
{
@Override
public Response getResponse(HTTPSession session)
{
return new Module_players(session).getResponse();
}
}); });
// //
private final ModuleExecutable moduleExecutable; private final ModuleExecutable moduleExecutable;

View File

@ -1,5 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Listener; package me.StevenLawson.TotalFreedomMod.Listener;
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.*; import me.StevenLawson.TotalFreedomMod.*;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -91,7 +92,7 @@ public class TFM_BlockListener implements Listener
if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean()) if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean())
{ {
if (!TFM_SuperadminList.isUserSuperadmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
if (TFM_ProtectedArea.isInProtectedArea(blockLocation)) if (TFM_ProtectedArea.isInProtectedArea(blockLocation))
{ {
@ -161,7 +162,7 @@ public class TFM_BlockListener implements Listener
if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean()) if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean())
{ {
if (!TFM_SuperadminList.isUserSuperadmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
if (TFM_ProtectedArea.isInProtectedArea(blockLocation)) if (TFM_ProtectedArea.isInProtectedArea(blockLocation))
{ {
@ -249,7 +250,7 @@ public class TFM_BlockListener implements Listener
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onRollbackBlockBreak(BlockBreakEvent event) public void onRollbackBlockBreak(BlockBreakEvent event)
{ {
if (!TFM_SuperadminList.isUserSuperadmin(event.getPlayer())) if (!TFM_AdminList.isSuperAdmin(event.getPlayer()))
{ {
TFM_RollbackManager.blockBreak(event); TFM_RollbackManager.blockBreak(event);
} }
@ -258,7 +259,7 @@ public class TFM_BlockListener implements Listener
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onRollbackBlockPlace(BlockPlaceEvent event) public void onRollbackBlockPlace(BlockPlaceEvent event)
{ {
if (!TFM_SuperadminList.isUserSuperadmin(event.getPlayer())) if (!TFM_AdminList.isSuperAdmin(event.getPlayer()))
{ {
TFM_RollbackManager.blockPlace(event); TFM_RollbackManager.blockPlace(event);
} }

Some files were not shown because too many files have changed in this diff Show More