Compare commits

...

115 Commits
v3.3 ... v4.0

Author SHA1 Message Date
08e4a4a171 Moved permban list to a seperate class
Refractoring
Code cleanup
2014-04-21 23:09:10 +02:00
a0affddeed Refractored command handling to seperate class: TFM_CommandHandler
Cleanup, refractoring
2014-04-21 19:00:39 +02:00
c82113dc22 Fixed duplicate entries when adding/removing players
Some refractoring
2014-04-21 17:45:32 +02:00
9315227906 Actually make the default console senior permissions configurable 2014-04-21 15:08:52 +02:00
00e9b4ea1f [Bleeding] Cleaned up TFM_Command.senderHasPermission() 2014-04-21 14:56:24 +02:00
22b0781020 Allow the default CONSOLE to have senior permissions 2014-04-21 14:52:23 +02:00
7df24c6b86 Added more detailed build information to /tfm through appinfo.properties 2014-04-21 14:37:53 +02:00
0e9044ffc3 Allow compiling for Spigot 1.7.8 2014-04-17 18:29:08 +02:00
3371f54c06 Merged from master 2014-04-15 16:43:38 +02:00
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
92d7c58957 Merge pull request #148 from Wilee999/patch-5
Fix /invis smite bug where it spammed the smite message each player.
2014-04-13 00:56:57 +02:00
478244773b Fix /invis smite bug where it spammed the smite message each player. 2014-04-11 17:57:11 -07: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
b3b182e753 Merge pull request #141 from Wilee999/patch-5
Implement /tfipbanlist purge adminAction.
2014-04-09 23:10:48 +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
49601035a5 Implement /tfipbanlist purge adminAction. 2014-03-02 18:02:10 -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
147 changed files with 3655 additions and 2596 deletions

3
.gitignore vendored
View File

@ -17,3 +17,6 @@ manifest.mf
.Trashes .Trashes
ehthumbs.db ehthumbs.db
Thumbs.db Thumbs.db
# TFM files
buildcreator.properties

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

View File

@ -0,0 +1,2 @@
# Build creator configuration
program.buildcreator=Unknown

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 #Mon Apr 21 23:08:17 CEST 2014
build.number=617 build.number=787

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>

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:
@ -78,7 +78,6 @@ blocked_commands:
# 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'
@ -130,6 +129,10 @@ protected_areas_enabled: true
auto_protect_spawnpoints: true auto_protect_spawnpoints: true
auto_protect_radius: 25.0 auto_protect_radius: 25.0
# Give the default CONSOLE senior admin privileges.
# Handy in development environments.
console_is_senior: true
# Host Sender Names - Names that indicate automated services or host-based consoles you want to block from using some commands. # Host Sender Names - Names that indicate automated services or host-based consoles you want to block from using some commands.
# Make sure these are all lower-case. # Make sure these are all lower-case.
host_sender_names: host_sender_names:
@ -171,6 +174,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

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

@ -10,5 +10,5 @@ public @interface CommandPermissions
SourceType source(); SourceType source();
boolean block_host_console() default false; boolean blockHostConsole() default false;
} }

View File

@ -1,13 +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_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;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_CONSOLE, block_host_console = true) @CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandParameters(description = "Close server to non-superadmins.", usage = "/<command> [on | off]") @CommandParameters(description = "Close server to non-superadmins.", usage = "/<command> [on | off]")
public class Command_adminmode extends TFM_Command public class Command_adminmode extends TFM_Command
{ {
@ -31,7 +31,7 @@ public class Command_adminmode extends TFM_Command
TFM_Util.adminAction(sender.getName(), "Closing the server to non-superadmins.", true); 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

@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH, block_host_console = true) @CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(description = "Make some noise.", usage = "/<command>") @CommandParameters(description = "Make some noise.", usage = "/<command>")
public class Command_deafen extends TFM_Command public class Command_deafen extends TFM_Command
{ {

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:
try
{
TFM_WorldEditBridge.getInstance().undo(player, 15); 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;
@ -22,6 +22,7 @@ public class Command_invis extends TFM_Command
{ {
if (args[0].equalsIgnoreCase("smite")) if (args[0].equalsIgnoreCase("smite"))
{ {
TFM_Util.adminAction(sender.getName(), "Smiting all invisible players", true);
smite = true; smite = true;
} }
else else
@ -38,9 +39,9 @@ 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); player.setHealth(0.0);
smites++; smites++;
} }
} }

View File

@ -1,13 +1,13 @@
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;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH, block_host_console = true) @CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(description = "Kick all non-superadmins on server.", usage = "/<command>") @CommandParameters(description = "Kick all non-superadmins on server.", usage = "/<command>")
public class Command_kicknoob extends TFM_Command public class Command_kicknoob extends TFM_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())) onlineUsers.append("Connected ");
{ onlineUsers.append(listFilter == Command_list.ListFilter.ADMINS ? "admins: " : "players: ");
prefix = (ChatColor.DARK_PURPLE + "[Dev]"); onlineUsers.append(StringUtils.join(names, ChatColor.WHITE + ", "));
}
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, ", "));
if (senderIsConsole) if (senderIsConsole)
{ {

View File

@ -1,14 +1,16 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import java.io.File; import java.io.File;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Log; import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_PermbanList;
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;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true) @CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandParameters(description = "Download the superadmin and permban lists from the main TotalFreedom server.", usage = "/<command>") @CommandParameters(description = "Download the superadmin and permban lists from the main TotalFreedom server.", usage = "/<command>")
public class Command_listsync extends TFM_Command public class Command_listsync extends TFM_Command
{ {
@ -19,8 +21,10 @@ public class Command_listsync extends TFM_Command
try try
{ {
TFM_Util.downloadFile("http://madgeekonline.com/apps/get_superadmins_raw.php", new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE)); TFM_AdminList.createBackup();
TotalFreedomMod.loadSuperadminConfig(); TFM_Util.downloadFile("http://madgeekonline.com/apps/get_superadmins_raw.php", new File(TotalFreedomMod.plugin.getDataFolder(),
TotalFreedomMod.SUPERADMIN_FILE));
TFM_AdminList.load();
TFM_Util.adminAction(sender.getName(), TotalFreedomMod.SUPERADMIN_FILE + " downloaded.", false); TFM_Util.adminAction(sender.getName(), TotalFreedomMod.SUPERADMIN_FILE + " downloaded.", false);
} }
catch (Exception ex) catch (Exception ex)
@ -30,8 +34,10 @@ public class Command_listsync extends TFM_Command
try try
{ {
TFM_Util.downloadFile("http://madgeekonline.com/apps/get_permbans_raw.php", new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.PERMBAN_FILE)); TFM_PermbanList.createBackup();
TotalFreedomMod.loadPermbanConfig(); TFM_Util.downloadFile("http://madgeekonline.com/apps/get_permbans_raw.php", new File(TotalFreedomMod.plugin.getDataFolder(),
TotalFreedomMod.PERMBAN_FILE));
TFM_PermbanList.load();
TFM_Util.adminAction(sender.getName(), TotalFreedomMod.PERMBAN_FILE + " downloaded.", false); TFM_Util.adminAction(sender.getName(), TotalFreedomMod.PERMBAN_FILE + " downloaded.", false);
} }
catch (Exception ex) catch (Exception ex)

View File

@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true) @CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandParameters(description = "Block target's minecraft input. This is evil, and I never should have wrote it.", usage = "/<command> <all | purge | <<partialname> on | off>>") @CommandParameters(description = "Block target's minecraft input. This is evil, and I never should have wrote it.", usage = "/<command> <all | purge | <<partialname> on | off>>")
public class Command_lockup extends TFM_Command public class Command_lockup extends TFM_Command
{ {

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,11 +1,11 @@
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;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true) @CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandParameters(description = "Attempt to detect \"invisible griefers\" and \"nukers\".", usage = "/<command> <on | off> [range] [blockrate]") @CommandParameters(description = "Attempt to detect \"invisible griefers\" and \"nukers\".", usage = "/<command> <on | off> [range] [blockrate]")
public class Command_nonuke extends TFM_Command public class Command_nonuke extends TFM_Command
{ {

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,13 +1,14 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PermbanList;
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;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, block_host_console = true) @CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(description = "Manage permanently banned players and IPs.", usage = "/<command> <list | reload>") @CommandParameters(description = "Manage permanently banned players and IPs.", usage = "/<command> <list | reload>")
public class Command_permban extends TFM_Command public class Command_permban extends TFM_Command
{ {
@ -31,7 +32,8 @@ public class Command_permban extends TFM_Command
return true; return true;
} }
playerMsg("Reloading permban list...", ChatColor.RED); playerMsg("Reloading permban list...", ChatColor.RED);
TotalFreedomMod.loadPermbanConfig(); TFM_PermbanList.createBackup();
TFM_PermbanList.load();
dumplist(sender); dumplist(sender);
} }
else else
@ -44,24 +46,24 @@ public class Command_permban extends TFM_Command
private void dumplist(CommandSender sender) private void dumplist(CommandSender sender)
{ {
if (TotalFreedomMod.permbanned_players.isEmpty()) if (TFM_PermbanList.getPermbannedPlayers().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, TFM_PermbanList.getPermbannedPlayers().size() + " permanently banned players:");
playerMsg(sender, StringUtils.join(TotalFreedomMod.permbanned_players, ", ")); playerMsg(sender, StringUtils.join(TFM_PermbanList.getPermbannedPlayers(), ", "));
} }
if (TotalFreedomMod.permbanned_ips.isEmpty()) if (TFM_PermbanList.getPermbannedIps().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, TFM_PermbanList.getPermbannedIps().size() + " permanently banned IPs:");
playerMsg(sender, StringUtils.join(TotalFreedomMod.permbanned_ips, ", ")); playerMsg(sender, StringUtils.join(TFM_PermbanList.getPermbannedIps(), ", "));
} }
} }
} }

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,11 +1,11 @@
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;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true) @CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandParameters( @CommandParameters(
description = "Enable/disable the command prelogger. When this is on, logs will be filled with many duplicate messages.", description = "Enable/disable the command prelogger. When this is on, logs will be filled with many duplicate messages.",
usage = "/<command> <on | off>") usage = "/<command> <on | off>")

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,12 +1,12 @@
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;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true) @CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandParameters(description = "Broadcasts the given message. Supports colors.", usage = "/<command> <message>") @CommandParameters(description = "Broadcasts the given message. Supports colors.", usage = "/<command> <message>")
public class Command_rawsay extends TFM_Command public class Command_rawsay extends TFM_Command
{ {

View File

@ -7,7 +7,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;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, block_host_console = false) @CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, blockHostConsole = false)
@CommandParameters(description = "Remove all blocks of a certain type in the radius of certain players.", usage = "/<command> <block> [radius (default=50)] [player]") @CommandParameters(description = "Remove all blocks of a certain type in the radius of certain players.", usage = "/<command> <block> [radius (default=50)] [player]")
public class Command_ro extends TFM_Command public class Command_ro extends TFM_Command
{ {

View File

@ -1,13 +1,13 @@
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;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, block_host_console = true) @CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(description = "Issues a rollback on a player", usage = "/<command> <[partialname] | undo [partialname] purge [partialname] | purgeall>", aliases = "rb") @CommandParameters(description = "Issues a rollback on a player", usage = "/<command> <[partialname] | undo [partialname] purge [partialname] | purgeall>", aliases = "rb")
public class Command_rollback extends TFM_Command public class Command_rollback extends TFM_Command
{ {
@ -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,13 +1,15 @@
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.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;
@ -19,53 +21,52 @@ 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.getSuperNames(), ", "), ChatColor.GOLD);
}
else
{
if (!TFM_SuperadminList.isSeniorAdmin(sender, true))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;
} }
if (args[0].equals("clean")) if (args[0].equals("clean"))
{ {
TFM_Util.adminAction(sender.getName(), "Cleaning superadmin list", true);
TFM_SuperadminList.cleanSuperadminList(true);
playerMsg("Superadmins: " + StringUtils.join(TFM_SuperadminList.getSuperadminNames(), ", "), ChatColor.YELLOW);
}
else
{
return false;
}
return true; if (!TFM_AdminList.isSeniorAdmin(sender, true))
}
return true;
}
else if (args.length == 2)
{
if (args[0].equalsIgnoreCase("info"))
{
if (!TFM_SuperadminList.isUserSuperadmin(sender))
{ {
playerMsg(TotalFreedomMod.MSG_NO_PERMS); playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;
} }
TFM_Superadmin superadmin = TFM_SuperadminList.getAdminEntry(args[1].toLowerCase()); TFM_Util.adminAction(sender.getName(), "Cleaning superadmin list", true);
TFM_AdminList.cleanSuperadminList(true);
playerMsg("Superadmins: " + StringUtils.join(TFM_AdminList.getSuperUUIDs(), ", "), ChatColor.YELLOW);
return true;
}
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) if (superadmin == null)
{ {
try try
{ {
superadmin = TFM_SuperadminList.getAdminEntry(getPlayer(args[1]).getName().toLowerCase()); superadmin = TFM_AdminList.getEntry(getPlayer(args[1]).getName().toLowerCase());
} }
catch (PlayerNotFoundException ex) catch (PlayerNotFoundException ex)
{ {
@ -78,7 +79,7 @@ public class Command_saconfig extends TFM_Command
} }
else else
{ {
playerMsg(ChatColor.stripColor(TFM_Util.colorize(superadmin.toString()))); playerMsg(superadmin.toString());
} }
return true; return true;
@ -92,8 +93,7 @@ public class Command_saconfig extends TFM_Command
if (args[0].equalsIgnoreCase("add")) if (args[0].equalsIgnoreCase("add"))
{ {
Player player = null; OfflinePlayer player;
String admin_name = null;
try try
{ {
@ -101,32 +101,26 @@ public class Command_saconfig extends TFM_Command
} }
catch (PlayerNotFoundException ex) catch (PlayerNotFoundException ex)
{ {
TFM_Superadmin superadmin = TFM_SuperadminList.getAdminEntry(args[1].toLowerCase()); final TFM_Admin superadmin = TFM_AdminList.getEntry(args[1]);
if (superadmin != null)
{ if (superadmin == null)
admin_name = superadmin.getName();
}
else
{ {
playerMsg(ex.getMessage(), ChatColor.RED); playerMsg(ex.getMessage(), ChatColor.RED);
return true; return true;
} }
player = Bukkit.getOfflinePlayer(superadmin.getLastLoginName());
} }
if (player != null) TFM_Util.adminAction(sender.getName(), "Adding " + player.getName() + " to the superadmin list", true);
{ TFM_AdminList.addSuperadmin(player);
TFM_Util.adminAction(sender.getName(), "Adding " + player.getName() + " to the superadmin list.", true);
TFM_SuperadminList.addSuperadmin(player); return true;
} }
else if (admin_name != null)
if (TFM_Util.isRemoveCommand(args[0]))
{ {
TFM_Util.adminAction(sender.getName(), "Adding " + admin_name + " to the superadmin list.", true); if (!TFM_AdminList.isSeniorAdmin(sender))
TFM_SuperadminList.addSuperadmin(admin_name);
}
}
else if (TFM_Util.isRemoveCommand(args[0]))
{
if (!TFM_SuperadminList.isSeniorAdmin(sender))
{ {
playerMsg(TotalFreedomMod.MSG_NO_PERMS); playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;
@ -142,31 +136,23 @@ public class Command_saconfig extends TFM_Command
{ {
} }
if (!TFM_SuperadminList.getSuperadminNames().contains(targetName.toLowerCase())) if (!TFM_AdminList.getLowerSuperNames().contains(targetName.toLowerCase()))
{ {
playerMsg("Superadmin not found: " + targetName); playerMsg("Superadmin not found: " + targetName);
return true; return true;
} }
TFM_Util.adminAction(sender.getName(), "Removing " + targetName + " from the superadmin list", true); TFM_Util.adminAction(sender.getName(), "Removing " + targetName + " from the superadmin list", true);
TFM_SuperadminList.removeSuperadmin(targetName); TFM_AdminList.removeSuperadmin(Bukkit.getOfflinePlayer(targetName));
// Twitterbot // Twitterbot
if (TFM_ConfigEntry.TWITTERBOT_ENABLED.getBoolean()) if (TFM_ConfigEntry.TWITTERBOT_ENABLED.getBoolean())
{ {
TFM_TwitterHandler.getInstance().delTwitterVerbose(targetName, sender); TFM_TwitterHandler.getInstance().delTwitterVerbose(targetName, sender);
} }
}
else
{
return false;
}
return true; return true;
} }
else
{
return false; 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

@ -4,8 +4,10 @@ import java.util.Arrays;
import java.util.Collections; 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_Util;
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 +24,13 @@ 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();
TFM_Util.adminAction(sender.getName(), "Purging the IP ban list", true);
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 +47,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

@ -13,8 +13,15 @@ public class Command_tfm 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)
{ {
playerMsg("TotalFreedomMod for 'TotalFreedom', the original all-op server.", ChatColor.GOLD); playerMsg("TotalFreedomMod for 'Total Freedom', the original all-op server.", ChatColor.GOLD);
playerMsg(String.format("Version " + ChatColor.BLUE + "%s.%s" + ChatColor.BLUE + ", built %s.", TotalFreedomMod.pluginVersion, TotalFreedomMod.buildNumber, TotalFreedomMod.buildDate), ChatColor.GOLD); playerMsg(String.format("Version "
+ ChatColor.BLUE + "%s.%s" + ChatColor.GOLD + ", built "
+ ChatColor.BLUE + "%s" + ChatColor.GOLD + " by "
+ ChatColor.BLUE + "%s" + ChatColor.GOLD + ".",
TotalFreedomMod.pluginVersion,
TotalFreedomMod.buildNumber,
TotalFreedomMod.buildDate,
TotalFreedomMod.buildCreator), ChatColor.GOLD);
playerMsg("Created by Madgeek1450 and DarthSalamon.", ChatColor.GOLD); playerMsg("Created by Madgeek1450 and DarthSalamon.", ChatColor.GOLD);
playerMsg("Visit " + ChatColor.AQUA + "http://totalfreedom.me/" + ChatColor.GREEN + " for more information.", ChatColor.GREEN); playerMsg("Visit " + ChatColor.AQUA + "http://totalfreedom.me/" + ChatColor.GREEN + " for more information.", ChatColor.GREEN);

View File

@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true) @CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandParameters(description = "Update server files.", usage = "/<command>") @CommandParameters(description = "Update server files.", usage = "/<command>")
public class Command_tfupdate extends TFM_Command public class Command_tfupdate extends TFM_Command
{ {

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

@ -6,7 +6,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;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true) @CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandParameters(description = "Wipe the flatlands map. Requires manual restart after command is used.", usage = "/<command>") @CommandParameters(description = "Wipe the flatlands map. Requires manual restart after command is used.", usage = "/<command>")
public class Command_wipeflatlands extends TFM_Command public class Command_wipeflatlands extends TFM_Command
{ {

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;
@ -59,82 +59,78 @@ public abstract class TFM_Command
public boolean senderHasPermission() public boolean senderHasPermission()
{ {
CommandPermissions permissions = commandClass.getAnnotation(CommandPermissions.class); final CommandPermissions permissions = commandClass.getAnnotation(CommandPermissions.class);
if (permissions != null)
if (permissions == null)
{ {
boolean is_super = TFM_SuperadminList.isUserSuperadmin(this.commandSender); TFM_Log.warning(commandClass.getName() + " is missing permissions annotation.");
boolean is_senior = false; return true;
if (is_super)
{
is_senior = TFM_SuperadminList.isSeniorAdmin(this.commandSender);
} }
AdminLevel level = permissions.level(); boolean isSuper = TFM_AdminList.isSuperAdmin(commandSender);
SourceType source = permissions.source(); boolean isSenior = false;
boolean block_host_console = permissions.block_host_console();
Player sender_p = null; if (isSuper)
if (this.commandSender instanceof Player)
{ {
sender_p = (Player) this.commandSender; isSenior = TFM_AdminList.isSeniorAdmin(commandSender);
} }
if (sender_p == null) final AdminLevel level = permissions.level();
final SourceType source = permissions.source();
final boolean blockHostConsole = permissions.blockHostConsole();
if (!(commandSender instanceof Player))
{ {
if (source == SourceType.ONLY_IN_GAME) if (source == SourceType.ONLY_IN_GAME)
{ {
return false; return false;
} }
else if (level == AdminLevel.SENIOR && !is_senior)
if (level == AdminLevel.SENIOR && !isSenior)
{ {
return false; return false;
} }
else if (block_host_console && TFM_Util.isFromHostConsole(this.commandSender.getName()))
if (blockHostConsole && TFM_Util.isFromHostConsole(commandSender.getName()))
{ {
return false; return false;
} }
return true;
} }
else
{ final Player senderPlayer = (Player) commandSender;
if (source == SourceType.ONLY_CONSOLE) if (source == SourceType.ONLY_CONSOLE)
{ {
return false; return false;
} }
else if (level == AdminLevel.SENIOR)
{
if (is_senior)
{
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(sender_p);
Boolean superadminIdVerified = playerdata.isSuperadminIdVerified();
if (superadminIdVerified != null) if (level == AdminLevel.SENIOR)
{ {
if (!superadminIdVerified.booleanValue()) if (!isSenior)
{ {
return false; return false;
} }
}
} if (!TFM_PlayerData.getPlayerData(senderPlayer).isSuperadminIdVerified())
else
{ {
return false; return false;
} }
}
else if (level == AdminLevel.SUPER && !is_super)
{
return false;
}
else if (level == AdminLevel.OP && !sender_p.isOp())
{
return false;
}
}
return true; return true;
} }
else
if (level == AdminLevel.SUPER && !isSuper)
{ {
TFM_Log.warning(commandClass.getName() + " is missing permissions annotation."); return false;
} }
if (level == AdminLevel.OP && !senderPlayer.isOp())
{
return false;
}
return true; return true;
} }

View File

@ -0,0 +1,82 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class TFM_CommandHandler
{
public static final String COMMAND_PATH = TFM_Command.class.getPackage().getName(); // "me.StevenLawson.TotalFreedomMod.Commands";
public static final String COMMAND_PREFIX = "Command_";
public static boolean handleCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
{
final Player playerSender;
final boolean senderIsConsole;
if (sender instanceof Player)
{
senderIsConsole = false;
playerSender = (Player) sender;
TFM_Log.info(String.format("[PLAYER_COMMAND] %s (%s): /%s %s",
playerSender.getName(),
ChatColor.stripColor(playerSender.getDisplayName()),
commandLabel,
StringUtils.join(args, " ")), true);
}
else
{
senderIsConsole = true;
playerSender = null;
TFM_Log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s",
sender.getName(),
commandLabel,
StringUtils.join(args, " ")), true);
}
final TFM_Command dispatcher;
try
{
final ClassLoader classLoader = TotalFreedomMod.class.getClassLoader();
dispatcher = (TFM_Command) classLoader.loadClass(String.format("%s.%s%s",
COMMAND_PATH,
COMMAND_PREFIX,
cmd.getName().toLowerCase())).newInstance();
dispatcher.setup(TotalFreedomMod.plugin, sender, dispatcher.getClass());
}
catch (Exception ex)
{
TFM_Log.severe("Could not load command: " + cmd.getName());
TFM_Log.severe(ex);
sender.sendMessage(ChatColor.RED + "Command Error! Could not load command: " + cmd.getName());
return true;
}
if (!dispatcher.senderHasPermission())
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
try
{
return dispatcher.run(sender, playerSender, cmd, commandLabel, args, senderIsConsole);
}
catch (Exception ex)
{
TFM_Log.severe("Command Error: " + commandLabel);
TFM_Log.severe(ex);
sender.sendMessage(ChatColor.RED + "Command Error: " + ex.getMessage());
}
return true;
}
}

View File

@ -4,6 +4,7 @@ import java.io.IOException;
import java.security.CodeSource; import java.security.CodeSource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@ -23,11 +24,17 @@ import org.bukkit.plugin.Plugin;
public class TFM_CommandLoader public class TFM_CommandLoader
{ {
public static final Pattern COMMAND_CLASS_PATTERN = Pattern.compile(TotalFreedomMod.COMMAND_PATH.replace('.', '/') + "/(" + TotalFreedomMod.COMMAND_PREFIX + "[^\\$]+)\\.class"); public static final Pattern COMMAND_PATTERN;
private List<TFM_CommandInfo> commandList = null; private final List<TFM_CommandInfo> commandList;
static
{
COMMAND_PATTERN = Pattern.compile(TFM_CommandHandler.COMMAND_PATH.replace('.', '/') + "/(" + TFM_CommandHandler.COMMAND_PREFIX + "[^\\$]+)\\.class");
}
private TFM_CommandLoader() private TFM_CommandLoader()
{ {
commandList = new ArrayList<TFM_CommandInfo>();
} }
public void scan() public void scan()
@ -38,11 +45,8 @@ public class TFM_CommandLoader
TFM_Log.severe("Error loading commandMap."); TFM_Log.severe("Error loading commandMap.");
return; return;
} }
commandList.clear();
if (commandList == null) commandList.addAll(getCommands());
{
commandList = getCommands();
}
for (TFM_CommandInfo commandInfo : commandList) for (TFM_CommandInfo commandInfo : commandList)
{ {
@ -136,15 +140,15 @@ public class TFM_CommandLoader
while ((zipEntry = zip.getNextEntry()) != null) while ((zipEntry = zip.getNextEntry()) != null)
{ {
String entryName = zipEntry.getName(); String entryName = zipEntry.getName();
Matcher matcher = COMMAND_CLASS_PATTERN.matcher(entryName); Matcher matcher = COMMAND_PATTERN.matcher(entryName);
if (matcher.find()) if (matcher.find())
{ {
try try
{ {
Class<?> commandClass = Class.forName(TotalFreedomMod.COMMAND_PATH + "." + matcher.group(1)); Class<?> commandClass = Class.forName(TFM_CommandHandler.COMMAND_PATH + "." + matcher.group(1));
CommandPermissions commandPermissions = (CommandPermissions) commandClass.getAnnotation(CommandPermissions.class); CommandPermissions commandPermissions = commandClass.getAnnotation(CommandPermissions.class);
CommandParameters commandParameters = (CommandParameters) commandClass.getAnnotation(CommandParameters.class); CommandParameters commandParameters = commandClass.getAnnotation(CommandParameters.class);
if (commandPermissions != null && commandParameters != null) if (commandPermissions != null && commandParameters != null)
{ {
@ -153,7 +157,7 @@ public class TFM_CommandLoader
matcher.group(1).split("_")[1], matcher.group(1).split("_")[1],
commandPermissions.level(), commandPermissions.level(),
commandPermissions.source(), commandPermissions.source(),
commandPermissions.block_host_console(), commandPermissions.blockHostConsole(),
commandParameters.description(), commandParameters.description(),
commandParameters.usage(), commandParameters.usage(),
commandParameters.aliases()); commandParameters.aliases());
@ -202,7 +206,7 @@ public class TFM_CommandLoader
public List<String> getAliases() public List<String> getAliases()
{ {
return aliases; return Collections.unmodifiableList(aliases);
} }
public Class<?> getCommandClass() public Class<?> getCommandClass()

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;
}
}

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