Compare commits

..

257 Commits

Author SHA1 Message Date
4ca3593653 Release v4.3 2015-02-16 17:13:21 +01:00
af52dec24a Store UUIDs in a SQLite database. Resolves #373 and resolves #406 2015-02-16 17:00:38 +01:00
34ebb3586c Resolve PlayerRank entries by IP. Resolves #415 2015-02-16 15:49:10 +01:00
eee8682959 Merge branch 'master' into commandblocker 2015-02-15 19:28:10 +01:00
af1dd2e9ff Added support for blocking subcommands. Resolves #357, Resolves #365 and Resolves #334 2015-02-15 19:27:35 +01:00
ade60ad611 Updated developer names. Resolves #421 2015-02-13 18:08:27 +01:00
e699ad1663 Cleanup: Mass reformat and organize imports 2015-01-15 15:47:10 +01:00
e2308ee904 Block /spreadplayers in config. Closes #382 2014-12-06 15:02:51 +01:00
d14a595ac4 Update to Spigot's CraftBukkit 1.8
Corrected the version check number

Moved Apache Commons reference to imports section
2014-11-30 13:54:29 +01:00
5190af0a6b Merge pull request #377 from ItzLevvie/patch-3
Fixed spelling mistake in TFM_PlayerData.java
2014-11-25 20:39:00 +01:00
a11b87ec83 Fixed spelling mistake in TFM_PlayerData.java 2014-11-25 19:29:58 +00:00
c7a0604afc Move unfreeze and unmute tasks to TFM_PlayerData. Resolves #352
Mass format & cleanup
2014-11-20 23:20:31 +01:00
9970277134 Fixed last bugs with ForceIP. Closes #354 2014-11-13 21:14:21 +01:00
49f6879ccb Merged with master 2014-11-13 19:22:18 +01:00
794b76321a Avoid adding blocked IPs to the superadmin list 2014-11-13 18:37:49 +01:00
e5b4ae0e3e Merge with master 2014-11-02 14:22:53 +01:00
310ce4f75a Ported all useful features from MobArena over to TFM 2014-11-02 14:20:10 +01:00
cf072dc0d5 Merge pull request #353 from Wild1145/master
ForceIP bugfixes.
2014-11-01 21:00:19 +01:00
7fe0b562ee Cleaned it up a bit as suggested by @jeromsar 2014-11-01 19:55:45 +00:00
6f6fdb28bf Minor tweaks to default port, Heartbeat and blocked cmd's 2014-11-01 19:51:43 +00:00
524d4da9d8 Bug Crunching on the ForceIP - Should work a lot better now. 2014-11-01 19:46:00 +00:00
0aa0bae0ad Merge pull request #349 from Wild1145/master
Added ForceIP. Resolves #224
2014-11-01 20:14:27 +01:00
fcf52ba02a Managed to tweak the port requirement, isnt actually needed like I thought. 2014-11-01 17:44:07 +00:00
8a92ff132b Changed the default config entry for the server address & added a little tweak. 2014-11-01 15:36:24 +00:00
99043a7c49 Removed Hostname and Port from the config - Now using the server address. 2014-11-01 12:10:08 +00:00
2a71be4050 Tweaked the config notes for Hostname & Port to make it a bit more descriptive 2014-10-31 18:10:06 +00:00
b43ef812a2 Fixed another slight formatting issue. 2014-10-31 18:05:25 +00:00
7981adaf85 Fixed Formatting Issues - Forgot it was allman style there. 2014-10-31 17:57:44 +00:00
1bc22a817a Removed the whitespace. 2014-10-31 17:52:57 +00:00
57a6b35457 Added the ForceIP feature - Resolves #224 2014-10-31 17:47:05 +00:00
8b45482d0a [Bleeding] Block listed IPs from being supered. Resolves #201 2014-10-30 19:44:05 +01:00
af64a77268 Officially compiling for Spigot for the time being 2014-10-30 19:28:47 +01:00
5c50069f21 Merge pull request #346 from ItzLevvie/patch-2
Fixed spelling mistake in Command_rd.java
2014-10-25 14:20:53 -04:00
3c329667a4 Fixed spelling mistake in Command_rd.java 2014-10-25 19:08:44 +01:00
1565c9643d Merge branch 'Obi2kanobi-master' 2014-10-01 13:22:10 -04:00
84ef49bf65 Tweak whitespace, change description. 2014-10-01 13:21:52 -04:00
878075c898 Merge branch 'master' of https://github.com/Obi2kanobi/TotalFreedomMod into Obi2kanobi-master 2014-10-01 13:18:09 -04:00
c74763c96a Adjust filename filter for schematic manager. 2014-09-28 18:24:48 -04:00
d01f9d0b2f Smite players with /stfu -s. Fixes #325. 2014-09-28 22:14:52 +01:00
e780c4ffec Change to v1_7_R4 for Spigot's pseudo-1.8 support. 2014-09-24 18:37:12 -04:00
3968dbe0a2 Merge pull request #316 from KingDragonRider/master
Blocked /size and //mask. Resolves #316
2014-09-23 21:23:49 +02:00
ff9164714c Restructured /saconfig. Resolves #322. Resolves #303. 2014-09-19 19:59:29 -04:00
72e105eb34 Added extra blocked commands used to bypass //brush
I've added commands which enable //brush even though it is blocked (/size and //mask) to the blocked commands list (for superadmins only).
2014-09-13 17:16:55 +01:00
f4440fd262 Merge pull request #310 from ItzLevvie/patch-1
Blocked "/setidletimeout" in config.yml
2014-09-13 17:49:56 +02:00
587b84a489 Blocked "/setidletimeout" in Config
Closes https://github.com/TotalFreedom/TotalFreedomMod/issues/307
2014-09-03 17:15:38 +01:00
107952f0ba Modified /ro to not affect adminworld. 2014-08-30 15:18:45 -04:00
8cae042857 Don't write spoofed UUIDs to cache 2014-08-30 16:24:35 +02:00
d1b73592af Compatibility with old builds of WorldEdit. 2014-08-27 20:53:43 -04:00
b7175d73ab Fixed AIOOBE in /rollback 2014-08-27 13:30:46 +02:00
9c976b381b Added TFM_UuidManager to cache UUIDs. Resolves #255
All methods related to UUIDs in TFM_Util have been moved to TFM_UuidManager
2014-08-27 11:42:49 +02:00
0c99862793 Perform backups in a seperate folder
Perform weekly backups on config.yml
Minor refractoring
2014-08-27 10:58:26 +02:00
0240b65fad Save and remove player entries on leave
Removed timer for player loading, applied to plugin instead
2014-08-27 00:28:44 +02:00
b6d3e5baca Merged with master 2014-08-26 18:25:27 +02:00
15650b84cf Fixed duplicate ban entries
Bans are equal when:
a) The ban-type matches
b) The ban-subject matches
Small changes
2014-08-26 18:23:48 +02:00
9233bcfedc Added some getters for TFM_Announcer 2014-08-25 20:05:10 +02:00
b0aa4a850d Added Announcer. Resolves #226
Organised onEnable()
Formatting
2014-08-25 20:01:54 +02:00
af97481d11 Return false on incorrect args in Command_rollback. Fixes #296 2014-08-25 18:47:29 +02:00
3c6e706c98 Merged with master 2014-08-25 14:07:47 +02:00
aca62caec1 Revamped TFM_BanManager, TFM_Ban and TFM_ServerInterface
Better ban type checking
Moved ban reason compilation to TFM_Ban
TFM_ServerInterface: Less expensive operations first
Command_rollback now polls TFM_RollbackManager for available players
2014-08-25 13:57:13 +02:00
eaa23985bd Merge pull request #294 from Obi2kanobi/contributing
Format GTFO reason broadcast. Fixes #293
2014-08-24 11:21:24 +01:00
e3f9452b9f Fix GTFO broadcast formatting. Fixes #293 2014-08-24 00:30:56 +01:00
755080d0a4 Code refactoring and cleanup. 2014-08-23 14:19:25 -04:00
0f764b976b Tweak /cake. Fixes #295. 2014-08-23 13:52:26 -04:00
d0a435a5d6 Added preliminary TFM support for TelnetRequestDataTagsEvent. 2014-08-20 21:23:22 -04:00
b02764ddca lang.StringUtils -> lang3.StringUtils
Remove bold from /nickclean.
2014-08-18 16:48:52 -04:00
b3c28d33f2 Fixed broken format for /gadmin ipban. 2014-08-15 22:53:57 -04:00
6ad1187eef Merge branch 'patch-2' 2014-08-15 16:29:53 -04:00
1bf1267b49 Remove extra lines. 2014-08-15 16:29:40 -04:00
d2f6f7f51a Make '/tfm reload' update blocked commands. Resolves #265.
Config must be reloaded in order to pull in any changes to blocked commands list.
2014-08-15 16:16:45 -04:00
dc2c996516 Block tags containing "console", fixes #260. 2014-08-15 15:59:43 -04:00
f502e44764 Added /nickclean - mass remove distracting things from player nicknames. 2014-08-14 19:07:52 -04:00
c490a3d62e Now made qdeop require you to be op else it wont try to deop the player. 2014-08-14 22:37:20 +01:00
9a2dc52e87 Using qop should now only op those who are not op.
This will further reduce the amount of spam and doesn't spam everyone with "you are now op".
2014-08-14 22:32:45 +01:00
a1c11f4e0f Using playerMsg(final String message) instead of playerMsg(final CommandSender sender, final String message) when possible. 2014-08-14 15:49:48 -04:00
48fd4c590d Use TFM_Command.playerMsg instead of TFM_Util.playerMsg for commands. 2014-08-13 20:56:04 -04:00
97cde0cfd4 Modified /qop and /qdeop to be a bit less spammy when multiple matches are found. 2014-08-13 20:11:12 -04:00
429269d8d2 Partial fix for #267.
Still need to implement method to kick people off telnet if they are deactivated while connected.

Also - 800th commit! Woohoo!
2014-08-12 19:38:32 -04:00
1a50c16d9a Rework tags (now they won't duplicate when Essentials changes display name). 2014-08-12 18:25:57 -04:00
891d8d178f Use commons' substring function to avoid IndexOutOfBoundsExceptions. 2014-08-12 15:32:56 -04:00
fc1c487dce Woops 2014-08-09 18:53:54 +02:00
e2cc14370a Added /forestgen to blocked commands 2014-08-09 18:13:15 +02:00
d5d6f18fb4 Truncate string argument on calls calls to setPlayerListName. Resolves #262. 2014-08-07 20:47:15 -04:00
00e22dc56e Formatting fix for CONTRIBUTING.md 2014-08-02 21:58:57 +02:00
40b475ea0c Merge branch 'master' of https://github.com/TotalFreedom/TotalFreedomMod 2014-08-02 21:55:03 +02:00
65eabbdba4 Added links 2014-08-02 21:54:18 +02:00
cb4a47d812 Made some changes to CONTRIBUTING.md 2014-08-02 21:45:57 +02:00
ecbd70493b Merge branch 'master' of https://github.com/TotalFreedom/TotalFreedomMod 2014-08-02 11:14:55 -04:00
4988140268 Fixed mixed string concatenation / String.format usage.
Doesn't make much sense to use string concatenation and a String.format to generate the same output. I believe this method is much more readable.
2014-08-02 11:14:37 -04:00
57b0aadb9b Added some comments regarding the license 2014-08-02 17:10:54 +02:00
ef9ce2a9a7 [Bleeding] First compile of new playerdata system. Resolves #223
The new TFM_PlayerList stores player under /players/[uuid].yml and only caches online players. When players log in, their playerdata will be loaded.
2014-08-02 16:27:43 +02:00
2c92b0874e Merge pull request #253 from PacksGamingHD/patch-2
Fixed compile error.
2014-08-02 14:05:20 +02:00
927560ad75 TotalFreedomMod won't compile like that. 2014-08-01 23:01:04 -07:00
c8dbc8a623 Merge pull request #251 from LevnettUKRonit/patch-2
Add ban reason to /gtfo
2014-08-01 17:58:10 +02:00
11eef83a65 Fixed the ban reason on the same line as the actual ban
Resolves https://github.com/TotalFreedom/TotalFreedomMod/pull/250
2014-08-01 15:39:07 +01:00
a2439a7093 Merge pull request #249 from LevnettUKRonit/patch-1
Update config.yml
2014-07-30 14:12:07 +01:00
d8697590a7 Update config.yml
Closes https://github.com/TotalFreedom/TotalFreedomMod/issues/233
2014-07-30 14:07:31 +01:00
6d98604cf0 Update config.yml 2014-07-30 09:27:21 +01:00
3d6be1cd51 Significantly speed up player list loading. 2014-07-29 22:38:08 -04:00
01edfed307 Tweak /whohas. Note the change from bitwise & to logical && resolving possible bug. 2014-07-26 11:48:17 -04:00
5e4d1d0d6d Limit duration and amplifier for /potion command. Resolves #243 2014-07-26 11:47:23 -04:00
86f61f1487 Restructure gadmin. Resolves #245 2014-07-25 23:11:44 -04:00
461cfa7bdc Switched from Essentials' StringUtil to Apache Commons StringUtils. 2014-07-20 17:40:06 -04:00
75b296496e Removed DisguiseCraft support. 2014-07-20 17:25:45 -04:00
183277db21 Clean up sources of compile warnings.
Move anything that causes deprecation warnings into TFM_DepreciationAggregator if no alternative implementation possible.
2014-07-19 21:02:00 -04:00
2b597867f0 Eliminate usage of deprecated org.bukkit.Server.matchPlayer
Suppress unchecked cast warnings in Module_players.
2014-07-19 17:39:42 -04:00
7f7312c0a2 Fix landmine. 2014-07-19 17:34:12 -04:00
73214165a5 Fix glitch in clownfish smacker. 2014-07-19 15:29:07 -04:00
54be4f7e88 Added clownfish smacker. 2014-07-19 14:59:02 -04:00
3ccab5f534 Fixed exploit that allows command blocker to be bypassed. 2014-07-17 17:28:32 -04:00
f635af5f95 Fix error when using /ops purge. 2014-07-16 20:41:14 -04:00
cc3a183cac Fixed toggle message for /toggle fluidspread. 2014-07-13 22:43:27 -04:00
173b686658 Add HTTPD Module_logs, resolves #238 2014-07-13 18:04:08 -04:00
a0d5743232 Ensure UUID is never null at login. Amends #214 and fixes #229 2014-06-30 19:09:26 +02:00
7598d211cd Correctly display permban URL. Fixes #228 2014-06-30 17:51:13 +02:00
6b064d0e68 Correctly reference static members in TFM_Jumppads. Fixes #225 2014-06-30 17:35:58 +02:00
8fc0673bb2 /tfm: Return true when the player doesn't have permission. Fixes #227 2014-06-30 17:30:16 +02:00
aa062a9d11 Ensure UUID is never null for non-existing players
Currently, the player's name is SHA-1'ed and the first 32 hexadecimal
characters are formed into a 'spoofed UUID'. I think this is the best solution
2014-06-29 16:40:53 +02:00
8b4b2f97e0 Finished TFM_UuidResolver and /uuid. Resolves #214 2014-06-29 12:09:03 +02:00
c4f1d0c06f Merge from master 2014-06-29 10:53:39 +02:00
20d4e886fc Merge from bleeding 2014-06-28 22:31:33 +02:00
e36ace1671 [Bleeding] Started work on TFM_UuidFetcher 2014-06-28 22:24:36 +02:00
2f055fbecb /gadmin: return false if required args are not present. Resolves #220 2014-06-28 12:00:16 +02:00
d193686c79 Block //snow. Resolves #217 2014-06-28 11:50:15 +02:00
ba2ada569f [Bleeding] Fixed permissions through console. Resolves #195 2014-06-28 11:43:05 +02:00
850fd9aa4a [Bleeding] Save when purging (ip)ban list. Resolves #219
Small changes
2014-06-28 00:22:55 +02:00
1fb14ca1dd Added /list -a. Resolves #194 2014-06-22 18:07:02 +02:00
499472a126 Remove adminworld guests properly. Fixes #202 2014-06-22 17:53:50 +02:00
28459e4702 Merge branch 'master' of https://github.com/TotalFreedom/TotalFreedomMod 2014-06-22 17:13:30 +02:00
57dda8367c Merge branch 'Wilee999-patch-3' 2014-06-22 17:12:56 +02:00
cdf03b4353 Perform suggested changes. Fixes #184 2014-06-22 17:12:30 +02:00
5ec66e8c7e Merge branch 'patch-3' of https://github.com/Wilee999/TotalFreedomMod into Wilee999-patch-3 2014-06-22 17:06:54 +02:00
f57aeb8fb0 Merge pull request #210 from WickedGamingUK/patch-1
Java Code Conventions
2014-06-22 16:58:46 +02:00
adb3834836 Don't double toggle in /toggle. Fixes #193 2014-06-22 16:56:02 +02:00
d82d6fd704 Updated latest WorldEdit methods 2014-06-22 16:50:57 +02:00
ec0683f610 Java Code Conventions 2014-06-18 16:36:52 +01:00
2d118a44a9 Removed xXWilee99Xx from the developer list 2014-06-16 15:50:16 +02:00
64cd7f7393 Merge pull request #204 from LevnettUKRonit/patch-4
Added aliases /gmc to /creative
2014-06-10 16:42:13 +02:00
9a1fc8ea36 Merge pull request #205 from LevnettUKRonit/patch-5
Added alias /gms to /survival
2014-06-10 16:41:38 +02:00
75247af337 Added aliases /gms 2014-06-09 17:48:57 +01:00
d20b062b70 Added aliases /gmc 2014-06-09 17:25:31 +01:00
4b36574255 Merge pull request #199 from LevnettUKRonit/patch-3
Changed /tag remove to /tag off to match usage.
2014-06-08 10:47:11 +02:00
bba42797d8 Changed /tag remove to /tag off to match usage. 2014-05-29 17:22:28 +01:00
365e38e63a Merge pull request #196 from LevnettUKRonit/patch-1
Telnet Admin should be dark green. Fixes #192.
2014-05-28 17:05:50 +02:00
5a3106ace8 Fixed TFM_PlayerListener.java
Fixed where it said Telnet Admin was light green its now ChatColor.DARK_GREEN
2014-05-28 09:53:23 +01:00
8cb4ef111c Rename /saconfig clear to /saconfig clearme. Closes #189 2014-05-19 19:46:40 +02:00
50d6cf471c Incremented version number for development towards next release 2014-05-19 19:33:18 +02:00
e942f0bf75 Removed most singleton patterns. Resolves #181 2014-05-19 19:32:25 +02:00
f8231aeb3f Stable release v4.2 2014-05-19 14:25:04 +02:00
eddbcf515c Allow customization of Owners. Appends to #178 and commit 67c86aea 2014-05-19 14:21:37 +02:00
00ac914066 Unban fuzzy IPs for admins. Fixes #187 2014-05-16 15:39:40 +02:00
179fe9d665 Organise TFM_ConfigEntry values by type 2014-05-16 15:30:02 +02:00
67c86aea24 Added config values for MOTD, server name and address. Resolves #178 2014-05-16 15:18:24 +02:00
e4bb1ef6aa Auto-freeze on imposter login; adds: http://www.totalfreedom.boards.net/thread/12123 2014-05-15 18:57:34 -07:00
16b02e3dec Changed /saconfig remove to /saconfig delete to match usage. Fixes #183 2014-05-14 16:22:56 +02:00
70e248202b Increment version number to 4.2 2014-05-13 17:56:21 +02:00
51ef752259 Don't warn when finding unknown services in ServiceChecker 2014-05-13 17:18:08 +02:00
b3e40462e2 Preload player when logging in. Fixes #182 2014-05-13 17:11:32 +02:00
73a91c02c6 Re-implement unbannable usernames. Resolves #180 2014-05-13 17:01:55 +02:00
7b8ba0bdf5 Revamp /plugincontrol. Fixes #159 2014-05-13 16:32:01 +02:00
bd9d6114ba Add /wipeuserdata. Resolves #177 2014-05-11 19:04:01 +02:00
0435174342 Perform daily and weekly backups. Resolves #163 2014-05-11 18:41:58 +02:00
796ef3d359 Refractored .createBackup() to TFM_Util.createBackup(String) 2014-05-11 18:15:04 +02:00
a3f3903760 Increase default nuking block place threshold. Resolves #169 2014-05-11 18:05:51 +02:00
5c99aa9a44 Merge pull request #176 from Wild1145/patch-1
Removed Legacy Login
2014-05-11 17:54:22 +02:00
8292eb20ae Removed Legacy Login
Due to HeartBleed Mojang had to disable the legacy login servers. They will always show as "Offline" so may as well just remove them.
2014-05-11 12:56:01 +02:00
d9e0791a3b Merge pull request #175 from Wild1145/master
Added Telent check along with Auto Prefix and Auto color tab
2014-05-10 23:44:39 +02:00
dbfec1e86d Added Color Tabs and Auto Prefixes. Resolves #173 2014-05-10 22:42:37 +01:00
31e03d6348 Added a telnet checker. 2014-05-10 22:40:32 +01:00
46494a2c87 Reset 2014-05-10 22:40:19 +01:00
b11eb0f762 Added in both player tab colours, Auto Prefixes and a telnet checker 2014-05-10 22:35:45 +01:00
730b0e2c83 Merge with master 2014-05-07 12:53:05 +02:00
60a9de7e7c [Bleeding] Allow spaces in tags. Resolves #160 2014-05-05 16:25:57 +02:00
8a4fa946fd Make /doom ban all IPs
Before, /doom would only ban the current IP
2014-05-05 16:10:14 +02:00
9bc0859fdf Added /tagnyan. Resolves #170 2014-05-05 16:03:30 +02:00
742450d016 Convert stop/remove to string literals. Resolves #168
Removed TFM_Util.isStopCommand(String) and TFM_Util.isRemoveCommand(String)
2014-05-05 15:31:12 +02:00
ad06bea3ae Fixed bugs with /saconfig clear. Resolves #167
Admins can now use /saconfig clear [ip] to remove the designated IP (only their own IPs can be removed. They can also simply use /saconfig clear to remove all IPs but the current one. /saconfig clear is safe, meaning you can't remove your current IP or an IP that doesn't belong to you.
2014-05-05 14:27:33 +02:00
68d83fa397 Allow admins to remove their own IPs 2014-05-05 14:10:32 +02:00
fe84c3a2a0 Removed Command_listsync. Resolves #166
@markbyrn wants it removed. It also didn't have much of a use, associated servers wouldn't use it since it overwrites the current superadmin and permban config.
2014-05-05 13:35:47 +02:00
6e5e70ac90 [Bleeding] A little more config tweaking 2014-05-05 13:30:17 +02:00
489549a0ea Warn when NMS versions don't match. Resolves #165 2014-05-05 00:01:57 +02:00
56b55eb3e2 [Bleeding] Fixed last errors due to misconfigured config 2014-05-04 23:07:26 +02:00
4ef5f59fb9 [Bleeding] Fixed startup error due to misconfigured config 2014-05-04 23:03:34 +02:00
d31ad2e9fc [Bleeding] Remove player online check through PlayerNotFoundException
getPlayer(String) now returns null when the player could not be found
2014-04-26 13:55:24 +02:00
8a9dfca6d3 [Bleeding] Config refractoring 2014-04-26 13:21:36 +02:00
55ddf5a30a Merge branch 'master' into bleeding 2014-04-25 17:36:08 +02:00
59e890c654 Added more startup statistics 2014-04-25 17:26:10 +02:00
b0e62add9f Reupdate index lists when adding an admin. Fixes #156 2014-04-25 17:10:43 +02:00
7cdf1abcf2 [Bleeding] Fix invalid characters in usernames 2014-04-23 19:30:11 +02:00
ee0ebd85fc Increment to version 4.1 to reflect latest changes 2014-04-23 17:03:33 +02:00
518537413b Allow use of multiple blocks in /ro. Closes #87 2014-04-23 17:00:44 +02:00
802d02d653 Shoot players in the sky when using /doom. Closes #142 2014-04-23 16:43:12 +02:00
f3cb57c9cd Extend command rollback time. Closes #136
Addresses http://www.totalfreedom.boards.net/thread/9531/problem-suggestion
2014-04-23 16:38:47 +02:00
c7c2795f41 Tweaked /ops and /qop 2014-04-23 16:36:11 +02:00
20b117a703 Moved toggle commands (/firespread, /lavadmg, etc) to /toggle 2014-04-23 16:23:50 +02:00
8522570db5 Move license to separate project 2014-04-22 23:19:40 +02:00
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
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
190 changed files with 7532 additions and 4697 deletions

3
.gitignore vendored
View File

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

View File

@ -1,51 +1,93 @@
# Contributing to TotalFreedomMod #
TotalFreedomMod is a CraftBukkit server plugin designed primarily to support the [Official TotalFreedom Minecraft Server](http://totalfreedom.me/). However, it can be used in a variety of other configurations with minimal fuss.
For those who wish to contribute, we encourage you to fork the repository and submit pull requests. Below you will find guidelines that will explain this process in further detail.
For those who wish to contribute, we encourage you to fork the repository and submit pull requests. Below you will find guidelines that explain this process in further detail.
## Quick Guide ##
1. Create or find an issue on our [Issue Tracker](https://github.com/TotalFreedom/TotalFreedomMod/issues).
2. Does your change fits TotalFreedomMod's goals?
3. Fork TotalFreedomMod if you haven't done so already.
4. Make a branch dedicated to your change.
5. Make your change.
6. Commit your change according to the [committing guidelines](#committing-your-changes).
7. Push your branch and submit a pull request.
## Getting Started ##
* Make sure you have a [GitHub account](https://github.com/signup/free)
* If the issue is a bug, submit a ticket for it, assuming one does not already exist.
* Clearly describe the issue including steps to reproduce it.
* Make sure you fill in the earliest version that you know has the issue.
* Fork the repository on GitHub
* Search the issue tracker for your bug report or feature request.
* If the issue does not exist already, create it.
* Clearly describe the issue.
* If your issue is a bug, describe the steps needed to reproduce it.
* If your issue is a feature request, ensure it fits TotalFreedomMod's goals and describe your feature in detail.
* Fork the repository on GitHub.
## Does the change fit TotalFreedomMod's goals? ##
As a rough guideline, ask yourself the following questions to determine if your proposed change fits the TotalFreedomMod project's goals. Please remember that this is only a rough guideline and may or may not reflect the definitive answer to this question.
* Is the change in line with the principles of "Total Freedom"?
TotalFreedom is a freedom-based server. We don't normally make changes that restrict players unless absolutely necessary.
* Is the change directed towards the TotalFreedom server?
Changes must be directed towards the TotalFreedom server. Changes such as adding ranks, adding the name of other TotalFreedom-like servers will not likely be accepted.
* Does the change add a feature that involves micromanagement?
Pull requests that involve adding a micromanagement feature will likely not be accepted. This includes shorthands for multiple commands.
* Is a similar feature already present?
Features that have very similar alternatives will not be added. For example: A command that temporarily bans a player from the server is very similar to the _/tban_ command and thus will likely not be accepted.
## Making Changes ##
* Create a topic branch from where you want to base your work.
* This is usually the master branch.
* Only target release branches if you are certain your addition must be on that branch.
* To quickly create a topic branch based on master; `git checkout -b contribution` - Please avoid working directly on the `master` branch.
* Make changes and commit where necessary.
* Name your branch something relevant to the change you are going to make.
* To quickly create a topic branch based on master, use `git checkout master` followed by `git checkout -b <name>`. Avoid working directly on the `master` branch.
* Make sure your change meets our [code requirements](#code-requirements).
### Code requirements ###
* Code must be written in [Allman style](http://en.wikipedia.org/wiki/Indent_style#Allman_style), and that it follows [Java Code Conventions](http://www.oracle.com/technetwork/java/codeconventions-150003.pdf).__
* No tabs; use 4 spaces for indentation.
* No trailing whitespaces for code lines, comments or configuration files.
* No CRLF line endings, only LF is allowed.
* For Windows-based machines, you can configure Git to do this for your by running `git config --global core.autocrlf true`.
* If you're running a Linux or Mac OSX, you should run `git config --global core.autocrlf input` instead.
* For more information about line feeds. See this [this article](http://adaptivepatchwork.com/2012/03/01/mind-the-end-of-your-line/).
* No 80 character line limit or 'weird' midstatement newlines.
* Additions should be compiled, complete and tested before committing.
* Avoid using `org.bukkit.Server.dispatchCommand()`. Commits that make use of it will likely be rejected.
* Files must always end with a newline.
* Avoid nested code structures.
## Committing your changes ##
* Check for unnecessary whitespace with `git diff --check` before committing.
* Make sure your commit messages are in line with those which are already made.
* Make sure your changes build (<b>and work!</b>).
* Describe your changes in the commit description.
* For a prolonged description, continue on a new line.
* The first description line should be once sentence and should not exceed 10 words.
* The first description line should contain either:
* For a bug-related issue: "Resolves _#issue_".
* For a feature request: "Fixes _#issue_".
* "#issue" is the issue number number you based your work on.
## 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 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.__
* Features must be in line the general idea of "Total Freedom".
* Changes must be directed towards the main "TotalFreedom" server. Adding names such as the name of your own TotalFreedom-like server will get your pull request denied.
* Do not add yourself to the developer list.
* Ensure that you use the correct whitespace-style. That is: 4 spaces as indentation.
* Please make sure your changes are written such as other features would be. Eg: commands have their own class and extend TFM_Command.
* __Make sure your code is written in the [Allman style](http://en.wikipedia.org/wiki/Indent_style#Allman_style).__
* Do not increment the version number.
* If you want to add multiple changes, please make one pull request per change. This way, it's easier to accept your changes faster and won't block the other changes if there is an issue with a specific line of code.
* Please make sure there are no bugs in your code.
* Please avoid having to add files in the main namespace where possible.
* Make sure all changes work before you commit these, this avoids having multiple unnecessary commits.
* Please refrain from using an excessive amount of commits. As few as possible is generally the best.
* Please do not spread your addition over several pull-requests.
#### Example commit message ####
```
Fixed bugs with /saconfig clear. Resolves #167
Admins can now use /saconfig clear [ip] to remove the designated IP (only their own IPs can be removed.
They can also simply use /saconfig clear to remove all IPs but the current one. /saconfig clear is safe,
meaning you can't remove your current IP or an IP that doesn't belong to you.
```
## Submitting Your Changes ##
* Push your changes to a topic branch in your fork of the repository.
* Push your changes to the topic branch in your fork of the repository.
* Submit a pull request to this repository.
* Explain in detail what each one of your commits changes and point out any big changes.
* Wait as a developer evaluates your changes.
* Do not add any prefixes or tags.
## Tips - How To Get Your Pull Request Accepted ##
* Please make sure your changes are written such as other features would be. For example: Commands have their own class and extend TFM_Command.
* Do not increment the version number.
* If you want to add multiple changes, please make one pull request per change. This way, it's easier to accept your changes faster and won't block the other changes if there is an issue with a specific line of code.
* Please avoid having to add files in the main namespace where possible.
* Please refrain from using an excessive amount of commits. As few as possible is generally the best.
* Please do not spread your contribution over several pull-requests.
## Additional Resources ##
* [TotalFreedom information](http://totalfreedom.me)

View File

@ -1,12 +1,3 @@
# TotalFreedomMod License #
TotalFreedomMod is primarily derived from the Bukkit and CraftBukkit library and server, respectively. Therefore, we have chosen for it to inherit the GNU GPLv3 License as used by those programs. This license is available at http://www.gnu.org/licenses/gpl-3.0.txt
We do, however, ask that you comply by several restrictions. These restrictions are in place to make sure that credit is given to the original authors, who remain the maintainers of the plugin and its source code.
* A un-edited copy of this LICENSE.md shall always be included with this source code.
* TotalFreedomMod source code and its derivations shall be freely distributable between anyone who chooses to download it.
* You shall not remove the keywords "Madgeek1450", "StevenLawson", "DarthSalamon" or "JeromSar" from any part of the source code.
* You may not modify the file TFM_FrontDoor.java. Removing it is fine, however.
* Compiled binaries (*.jar's) shall not to be distributed.
* If you wish to obtain a copy of TotalFreedomMod you must compile the original source code or it's derivations yourself.
* The primary developers, StevenLawson (Madgeek1450) and Jerom van der Sar (DarthSalamon), may choose to provide official binaries on a discretionary basis.
* Any restrictions listed here may be waived by any of the above mentioned primary developers.
TotalFreedomMod is licensed under the TotalFreedom General License. It is available [here](https://github.com/TotalFreedom/License/blob/master/LICENSE.md).

View File

@ -2,11 +2,17 @@
<project name="TotalFreedomMod" default="default" basedir=".">
<description>Builds, tests, and runs the project TotalFreedomMod.</description>
<import file="nbproject/build-impl.xml" />
<target name="-pre-jar">
<copy file="buildcreator.default.properties" tofile="buildcreator.properties" overwrite="false" />
<property file="buildcreator.properties"/>
<buildnumber file="buildnumber.properties" />
<propertyfile file="appinfo.properties">
<entry key="program.buildnumber" value="${build.number}" />
<entry key="program.builddate" type="date" value="now" pattern="MM/dd/yyyy hh:mm aa" />
<entry key="program.buildcreator" value="${program.buildcreator}" />
</propertyfile>
<copy file="appinfo.properties" todir="${build.classes.dir}" />
<delete file="appinfo.properties" />

View File

@ -0,0 +1,6 @@
#
# Build creator configuration
#
# Note: Do not edit this file! Edit the generated "buildcreator.properties" file instead.
#
program.buildcreator=Unknown

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Tue Jan 14 20:43:15 CET 2014
build.number=698
#Mon Feb 16 16:40:10 CET 2015
build.number=982

View File

@ -48,11 +48,10 @@ jar.archive.disabled=${jnlp.enabled}
jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=\
${libs.CraftBukkit.classpath}:\
${libs.WorldEdit.classpath}:\
${libs.DisguiseCraft.classpath}:\
${libs.Essentials.classpath}:\
${libs.BukkitTelnet.classpath}
${libs.BukkitTelnet.classpath}:\
${libs.SpigotServer.classpath}
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
javac.deprecation=false

13
src/bans.yml Normal file
View File

@ -0,0 +1,13 @@
#
# TotalFreedomMod banning config
# Warning: modification of this file is not recommended
#
# 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,33 +1,67 @@
# TotalFreedomMod v3.5 Configuration
# by Madgeek1450 and DarthSalamon
#
# TotalFreedomMod v4.3 Configuration
# by Madgeek1450 and Prozza
#
# Block placement prevention:
allow_fire_place: false
allow_fire_spread: false
allow_lava_damage: false
allow_lava_place: false
allow_water_place: false
allow_fluid_spread: false
allow_tnt_minecarts: false
# Generic server information
server:
# You should change this to your server's name
name: TotalFreedom
# Explosion management:
allow_explosions: false
explosive_radius: 4.0
# The address your server is located at. Please do not include the port.
address: play.totalfreedom.me
# Shown at the server list
motd: TotalFreedom &8- Minecraft %mcversion%
# Every word in the MOTD will be a different color unless prefixed by a color code
colorful_motd: true
# All players who show up as owner
owners:
- markbyron
# URL players should appeal for bans at
ban_url: http://totalfreedom.boards.net/
# URL players should appeal for permanent bans at
permban_url: http://bit.ly/TF_PermBan
# ForceIP configuration
forceip:
enabled: false
# The port players should use to connect to your server; only applies to forceip
port: 25565
# The kick message sent to players when logging in with the wrong hostname
kickmsg: You have been kicked from the server - Please connect using %address%
# Blocking certain events
allow:
fire_place: false
fire_spread: false
fluid_spread: false
lava_place: false
lava_damage: false
water_place: false
tnt_minecarts: false
explosions: false
# Blocked commands:
#
# How blocked commands work:
# All sections described below are delimited by colon-characters.
# Make sure that you block a command by it's main command name, not an alias
# -as all aliases are blocked by default. Commands are case-insensitive ofcourse.
# You can block specific subcommands aswell. eg: /mail sendall
# All sections described below are delimited by colon characters.
# Make sure that you block a command by its main command name, not an alias
# -as all aliases are blocked by default. Commands are case-insensitive.
#
# * The first section is a letter which indicates which rank may use this command
# Valid ranks:
# n - Nobody (Completely disabled)
# c - Senior Admins (Console)
# t - Telnet Admins (Console)
# s - SuperAdmins
# s - Super Admins (Any in-game admin)
# o - Ops (Non-Ops won't be able to use it)
#
# * The second section is a letter which indicates what to do when a player executes that command.
@ -51,7 +85,6 @@ explosive_radius: 4.0
blocked_commands:
# Disabled commands
- 'n:b:/time:Server-side time changing is disabled. Please use /ptime to set your own personal time.'
- 'n:b:/md:This server now uses DisguiseCraft instead of MobDisguise. Type /d to disguise and /u to undisguise.'
- 'n:b:/gamemode:Use /creative and /survival to set your gamemode.'
- 'n:b:/gamerule:_'
- 'n:b:/ban:_'
@ -61,6 +94,7 @@ blocked_commands:
- 'n:b:/toggledownfall:_'
- 'n:b:/effect:Please use /potion to set effects.'
- 'n:b:/enderchest:_'
- 'n:b:/spreadplayers:_'
# Superadmin commands
- 's:b:/kick:_'
@ -70,64 +104,88 @@ blocked_commands:
- 's:b://:_'
- 's:b:/superpickaxe:_'
- 's:b:/brush:_'
- 's:b:/size:_'
- 's:b://mask:_'
- 's:b:/mat:_'
- 's:b:/tool:_'
- 's:b://butcher:_'
- 's:b:/scoreboard:_'
- 's:b:/setspawn:_'
- 's:b://snow:_'
- 's:b:/tellraw:_'
- 's:b:/forestgen:_'
- 's:b:/setidletimeout:_'
- 's:b:/mail sendall:_'
- 's:b:/eco reset:_'
# Superadmin commands - Auto-eject
- 's:a:/stop'
- 's:a:/reload'
- 's:a:/save-all'
- 's:a:/save-on'
- 's:a:/save-off'
- 's:a:/clearhistory'
- 's:a:/stop:_'
- 's:a:/reload:_'
- 's:a:/save-all:_'
- 's:a:/save-on:_'
- 's:a:/save-off:_'
- 's:a:/clearhistory:_'
# Automatically wipe dropped objects:
# Spigot commands
- 's:a:/restart:_'
- 's:b:/setblock:_'
# Automatically wipe dropped objects
auto_wipe: true
# Nuking prevention:
nuke_monitor: true
nuke_monitor_count_break: 100
nuke_monitor_count_place: 25
nuke_monitor_range: 10.0
freecam_trigger_count: 10
# Nuking prevention
nukemonitor:
enabled: true
count_break: 100
count_place: 40
range: 10.0
# Show all attempted commands in the log, will result in duplicate log messages:
freecam_trigger_count: 10
explosive_radius: 4.0
# Show all attempted commands in the log, will result in duplicate log messages
preprocess_log: true
# Disable nighttime:
disable_night: true
# Disable certain events
disable:
night: true
weather: true
# Disable weather:
disable_weather: true
# Enable misc. features:
# Enable misc. features
landmines_enabled: false
mp44_enabled: false
tossmob_enabled: false
# Moblimiter:
mob_limiter_enabled: true
# Max per world:
mob_limiter_max: 50
mob_limiter_disable_dragon: true
mob_limiter_disable_ghast: true
mob_limiter_disable_slime: true
mob_limiter_disable_giant: true
# Moblimiter
moblimiter:
enabled: true
max: 50
disable:
dragon: true
ghast: true
slime: true
giant: true
# Flatlands
generate_flatlands: true
# Flatlands generation parameters, uses CleanroomGenerator syntax - http://dev.bukkit.org/server-mods/cleanroomgenerator/
flatlands_generation_params: 16,stone,32,dirt,1,grass
flatlands:
generate: true
# Flatlands generation parameters - Uses CleanroomGenerator syntax - http://dev.bukkit.org/server-mods/cleanroomgenerator/
generate_params: 16,stone,32,dirt,1,grass
# Admin-Only Mode
admin_only_mode: false
# Protected Areas - Protect areas so that only superadmins can directly modify blocks in those areas. WorldEdit and other such plugins might bypass this.
protected_areas_enabled: true
auto_protect_spawnpoints: true
auto_protect_radius: 25.0
protectarea:
enabled: true
auto_protect_spawnpoints: true
auto_protect_radius: 25.0
# Give the default CONSOLE senior admin privileges.
# Handy in development environments.
console_is_senior: true
# Host Sender Names - Names that indicate automated services or host-based consoles you want to block from using some commands.
# Make sure these are all lower-case.
@ -135,6 +193,21 @@ host_sender_names:
- rcon
- remotebukkit
# Announcer
announcer:
enabled: true
# Interval between announcements, in seconds.
interval: 600
# Prefix for all announcements
prefix: '&5[&eTotalFreedom&5] &b'
announcements:
- 'Be sure to visit our forums at &6http://totalfreedom.boards.net/'
- 'You can always review the server rules here: &6http://totalfreedom.me/'
- 'If you aren''t OP, be sure to ask!'
# Players who cannot be banned by username
unbannable_usernames:
- honeydew
@ -170,30 +243,45 @@ unbannable_usernames:
- cavemanfilms
- herobrine
- whiteboy7thst
- stampylonghead
- stampylongnose
- dantdm
- gizzy14gazza
# IPs that can not be supered
noadmin_ips:
- 127.0.0.1
# TwitterBot - Used to allow superadmins to verify themselves using twitter
twitterbot_enabled: false
twitterbot_url: ''
twitterbot_secret: ''
twitterbot:
enabled: false
url: ''
secret: ''
# Pet Protect - Prevent tamed pets from being killed.
pet_protect_enabled: true
petprotect:
enabled: true
# Logs Registration
logs_register_password: ''
logs_register_url: ''
# Logviewer
logs:
url: ''
secret: ''
# Mojang service checker
service_checker_url: http://status.mojang.com/check
# HTTPD
httpd_enabled: true
httpd_public_folder: ./public_html
httpd_port: 28966
# HTTPD server
httpd:
enabled: true
port: 28966
public_folder: ./public_html
# Inactivity Auto-Kick (Requires Essentials)
autokick_enabled: true
# autokick_threshold - Percentage of server player capacity used at which players will be automatically kicked for being inactive. Range: 0.0 - 1.0
autokick_threshold: 0.9
# autokick_time - Time, in seconds, after which a player should be kicked when inactive
autokick_time: 120
autokick:
enabled: true
# autokick_threshold - Percentage of server player capacity used at which players will be automatically kicked for being inactive. Range: 0.0 - 1.0
threshold: 0.9
# autokick_time - Time, in seconds, after which a player should be kicked when inactive
time: 120

View File

@ -1,21 +1,24 @@
package me.StevenLawson.TotalFreedomMod;
package me.StevenLawson.TotalFreedomMod.Bridge;
import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.User;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
public class TFM_EssentialsBridge
{
private Essentials essentialsPlugin = null;
private static Essentials essentialsPlugin = null;
private TFM_EssentialsBridge()
{
throw new AssertionError();
}
public Essentials getEssentialsPlugin()
public static Essentials getEssentialsPlugin()
{
if (this.essentialsPlugin == null)
if (essentialsPlugin == null)
{
try
{
@ -24,7 +27,7 @@ public class TFM_EssentialsBridge
{
if (essentials instanceof Essentials)
{
this.essentialsPlugin = (Essentials) essentials;
essentialsPlugin = (Essentials) essentials;
}
}
}
@ -33,10 +36,10 @@ public class TFM_EssentialsBridge
TFM_Log.severe(ex);
}
}
return this.essentialsPlugin;
return essentialsPlugin;
}
public User getEssentialsUser(String username)
public static User getEssentialsUser(String username)
{
try
{
@ -53,7 +56,7 @@ public class TFM_EssentialsBridge
return null;
}
public void setNickname(String username, String nickname)
public static void setNickname(String username, String nickname)
{
try
{
@ -70,7 +73,24 @@ public class TFM_EssentialsBridge
}
}
public long getLastActivity(String username)
public static String getNickname(String username)
{
try
{
final User user = getEssentialsUser(username);
if (user != null)
{
return user.getNickname();
}
}
catch (Exception ex)
{
TFM_Log.severe(ex);
}
return null;
}
public static long getLastActivity(String username)
{
try
{
@ -87,7 +107,7 @@ public class TFM_EssentialsBridge
return 0L;
}
public boolean isEssentialsEnabled()
public static boolean isEssentialsEnabled()
{
try
{
@ -103,14 +123,4 @@ public class TFM_EssentialsBridge
}
return false;
}
public static TFM_EssentialsBridge getInstance()
{
return TFM_EssentialsBridgeHolder.INSTANCE;
}
private static class TFM_EssentialsBridgeHolder
{
private static final TFM_EssentialsBridge INSTANCE = new TFM_EssentialsBridge();
}
}

View File

@ -1,11 +1,15 @@
package me.StevenLawson.TotalFreedomMod;
package me.StevenLawson.TotalFreedomMod.Bridge;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.bukkit.BukkitPlayer;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.World;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
@ -14,15 +18,16 @@ import org.bukkit.scheduler.BukkitRunnable;
public class TFM_WorldEditBridge
{
private WorldEditPlugin worldEditPlugin = null;
private static WorldEditPlugin worldEditPlugin = null;
private TFM_WorldEditBridge()
{
throw new AssertionError();
}
public WorldEditPlugin getWorldEditPlugin()
public static WorldEditPlugin getWorldEditPlugin()
{
if (this.worldEditPlugin == null)
if (worldEditPlugin == null)
{
try
{
@ -31,7 +36,7 @@ public class TFM_WorldEditBridge
{
if (we instanceof WorldEditPlugin)
{
this.worldEditPlugin = (WorldEditPlugin) we;
worldEditPlugin = (WorldEditPlugin) we;
}
}
}
@ -40,14 +45,14 @@ public class TFM_WorldEditBridge
TFM_Log.severe(ex);
}
}
return this.worldEditPlugin;
return worldEditPlugin;
}
public BukkitPlayer getBukkitPlayer(Player player)
public static BukkitPlayer getBukkitPlayer(Player player)
{
try
{
WorldEditPlugin wep = this.getWorldEditPlugin();
final WorldEditPlugin wep = getWorldEditPlugin();
if (wep != null)
{
return wep.wrapPlayer(player);
@ -60,11 +65,11 @@ public class TFM_WorldEditBridge
return null;
}
public LocalSession getPlayerSession(Player player)
public static LocalSession getPlayerSession(Player player)
{
try
{
WorldEditPlugin wep = this.getWorldEditPlugin();
final WorldEditPlugin wep = getWorldEditPlugin();
if (wep != null)
{
return wep.getSession(player);
@ -77,14 +82,14 @@ public class TFM_WorldEditBridge
return null;
}
public void undo(Player player, int count)
public static void undo(Player player, int count)
{
try
{
LocalSession session = getPlayerSession(player);
if (session != null)
{
BukkitPlayer bukkitPlayer = this.getBukkitPlayer(player);
final BukkitPlayer bukkitPlayer = getBukkitPlayer(player);
if (bukkitPlayer != null)
{
for (int i = 0; i < count; i++)
@ -100,11 +105,11 @@ public class TFM_WorldEditBridge
}
}
public void setLimit(Player player, int limit)
public static void setLimit(Player player, int limit)
{
try
{
LocalSession session = getPlayerSession(player);
final LocalSession session = getPlayerSession(player);
if (session != null)
{
session.setBlockChangeLimit(limit);
@ -116,9 +121,9 @@ public class TFM_WorldEditBridge
}
}
public void validateSelection(final Player player)
public static void validateSelection(final Player player)
{
if (TFM_SuperadminList.isUserSuperadmin(player))
if (TFM_AdminList.isSuperAdmin(player))
{
return;
}
@ -126,10 +131,15 @@ public class TFM_WorldEditBridge
try
{
final LocalSession session = getPlayerSession(player);
if (session != null)
if (session == null)
{
final LocalWorld selectionWorld = session.getSelectionWorld();
return;
}
final World selectionWorld = session.getSelectionWorld();
final Region selection = session.getSelection(selectionWorld);
if (TFM_ProtectedArea.isInProtectedArea(
getBukkitVector(selection.getMinimumPoint()),
getBukkitVector(selection.getMaximumPoint()),
@ -143,9 +153,9 @@ public class TFM_WorldEditBridge
player.sendMessage(ChatColor.RED + "The region that you selected contained a protected area. Selection cleared.");
session.getRegionSelector(selectionWorld).clear();
}
}.runTaskLater(TotalFreedomMod.plugin, 1L);
}
}.runTask(TotalFreedomMod.plugin);
}
}
catch (IncompleteRegionException ex)
{
@ -160,14 +170,4 @@ public class TFM_WorldEditBridge
{
return new org.bukkit.util.Vector(worldEditVector.getX(), worldEditVector.getY(), worldEditVector.getZ());
}
public static TFM_WorldEditBridge getInstance()
{
return TFM_WorldEditBridgeHolder.INSTANCE;
}
private static class TFM_WorldEditBridgeHolder
{
private static final TFM_WorldEditBridge INSTANCE = new TFM_WorldEditBridge();
}
}

View File

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

View File

@ -1,13 +1,13 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_CONSOLE, block_host_console = true)
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandParameters(description = "Close server to non-superadmins.", usage = "/<command> [on | off]")
public class Command_adminmode extends TFM_Command
{
@ -31,7 +31,7 @@ public class Command_adminmode extends TFM_Command
TFM_Util.adminAction(sender.getName(), "Closing the server to non-superadmins.", true);
for (Player player : server.getOnlinePlayers())
{
if (!TFM_SuperadminList.isUserSuperadmin(player))
if (!TFM_AdminList.isSuperAdmin(player))
{
player.kickPlayer("Server is now closed to non-superadmins.");
}

View File

@ -1,9 +1,8 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_AdminWorld;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -15,7 +14,7 @@ public class Command_adminworld extends TFM_Command
{
private enum CommandMode
{
TELEPORT, GUEST, TIME, WEATHER
TELEPORT, GUEST, TIME, WEATHER;
}
@Override
@ -113,18 +112,15 @@ public class Command_adminworld extends TFM_Command
if ("add".equalsIgnoreCase(args[1]))
{
Player player;
try
final Player player = getPlayer(args[2]);
if (player == null)
{
player = getPlayer(args[2]);
}
catch (PlayerNotFoundException ex)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
if (player != null && TFM_AdminWorld.getInstance().addGuest(player, sender_p))
if (TFM_AdminWorld.getInstance().addGuest(player, sender_p))
{
TFM_Util.adminAction(sender.getName(), "AdminWorld guest added: " + player.getName(), false);
}
@ -133,9 +129,9 @@ public class Command_adminworld extends TFM_Command
playerMsg("Could not add player to guest list.");
}
}
else if (TFM_Util.isRemoveCommand(args[1]))
else if ("remove".equals(args[1]))
{
Player player = TFM_AdminWorld.getInstance().removeGuest(args[2]);
final Player player = TFM_AdminWorld.getInstance().removeGuest(args[2]);
if (player != null)
{
TFM_Util.adminAction(sender.getName(), "AdminWorld guest removed: " + player.getName(), false);
@ -217,15 +213,17 @@ public class Command_adminworld extends TFM_Command
private void assertCommandPerms(CommandSender sender, Player sender_p) throws PermissionDeniedException
{
if (!(sender instanceof Player) || sender_p == null || !TFM_SuperadminList.isUserSuperadmin(sender))
if (!(sender instanceof Player) || sender_p == null || !TFM_AdminList.isSuperAdmin(sender))
{
throw new PermissionDeniedException(TotalFreedomMod.MSG_NO_PERMS);
throw new PermissionDeniedException(TFM_Command.MSG_NO_PERMS);
}
}
private class PermissionDeniedException extends Exception
{
public PermissionDeniedException(String string)
private static final long serialVersionUID = 1L;
private PermissionDeniedException(String string)
{
super(string);
}

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command;
@ -36,18 +36,15 @@ public class Command_blockcmd extends TFM_Command
return true;
}
Player player;
try
final Player player = getPlayer(args[0]);
if (player == null)
{
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
{
playerMsg(ex.getMessage());
playerMsg(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
if (TFM_SuperadminList.isUserSuperadmin(player))
if (TFM_AdminList.isSuperAdmin(player))
{
playerMsg(player.getName() + " is a Superadmin, and cannot have their commands blocked.");
return true;

View File

@ -21,7 +21,7 @@ public class Command_cage extends TFM_Command
return false;
}
if (TFM_Util.isStopCommand(args[0]) && sender instanceof Player)
if ("off".equals(args[0]) && sender instanceof Player)
{
TFM_Util.adminAction(sender.getName(), "Uncaging " + sender.getName(), true);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(sender_p);
@ -32,9 +32,9 @@ public class Command_cage extends TFM_Command
return true;
}
else if ("purge".equalsIgnoreCase(args[0]))
else if ("purge".equals(args[0]))
{
TFM_Util.adminAction(sender.getName(), "Uncaging all players.", true);
TFM_Util.adminAction(sender.getName(), "Uncaging all players", true);
for (Player player : server.getOnlinePlayers())
{
@ -47,14 +47,11 @@ public class Command_cage extends TFM_Command
return true;
}
Player player;
try
final Player player = getPlayer(args[0]);
if (player == null)
{
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
@ -65,7 +62,7 @@ public class Command_cage extends TFM_Command
if (args.length >= 2)
{
if (TFM_Util.isStopCommand(args[1]))
if ("off".equals(args[1]))
{
TFM_Util.adminAction(sender.getName(), "Uncaging " + player.getName(), true);

View File

@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.Random;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.Achievement;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@ -10,35 +9,44 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "For the people that are still alive.", usage = "/<command>")
public class Command_cake extends TFM_Command
{
public static final String CAKE_LYRICS = "But there's no sense crying over every mistake. You just keep on trying till you run out of cake.";
private final Random random = new Random();
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
StringBuilder output = new StringBuilder();
Random randomGenerator = new Random();
final StringBuilder output = new StringBuilder();
String[] words = TotalFreedomMod.CAKE_LYRICS.split(" ");
for (String word : words)
final String[] words = CAKE_LYRICS.split(" ");
for (final String word : words)
{
String color_code = Integer.toHexString(1 + randomGenerator.nextInt(14));
output.append(ChatColor.COLOR_CHAR).append(color_code).append(word).append(" ");
output.append(ChatColor.COLOR_CHAR).append(Integer.toHexString(1 + random.nextInt(14))).append(word).append(" ");
}
for (Player player : server.getOnlinePlayers())
final ItemStack heldItem = new ItemStack(Material.CAKE);
final ItemMeta heldItemMeta = heldItem.getItemMeta();
heldItemMeta.setDisplayName((new StringBuilder()).append(ChatColor.WHITE).append("The ").append(ChatColor.DARK_GRAY).append("Lie").toString());
heldItem.setItemMeta(heldItemMeta);
for (final Player player : server.getOnlinePlayers())
{
ItemStack heldItem = new ItemStack(Material.CAKE, 1);
player.getInventory().setItem(player.getInventory().firstEmpty(), heldItem);
player.awardAchievement(Achievement.MINE_WOOD);
player.awardAchievement(Achievement.BUILD_WORKBENCH);
player.awardAchievement(Achievement.BUILD_HOE);
final int firstEmpty = player.getInventory().firstEmpty();
if (firstEmpty >= 0)
{
player.getInventory().setItem(firstEmpty, heldItem);
}
player.awardAchievement(Achievement.BAKE_CAKE);
}
TFM_Util.bcastMsg(output.toString());
return true;
}
}

View File

@ -1,6 +1,6 @@
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.CommandSender;
import org.bukkit.entity.Minecart;
@ -17,13 +17,12 @@ public class Command_cartsit extends TFM_Command
if (args.length == 1)
{
try
{
targetPlayer = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
if (targetPlayer == null)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
}
@ -36,7 +35,7 @@ public class Command_cartsit extends TFM_Command
return true;
}
}
else if (targetPlayer != sender_p && !TFM_SuperadminList.isUserSuperadmin(sender))
else if (targetPlayer != sender_p && !TFM_AdminList.isSuperAdmin(sender))
{
sender.sendMessage("Only superadmins can select another player as a /cartsit target.");
return true;

View File

@ -3,9 +3,11 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import net.minecraft.util.org.apache.commons.lang3.ArrayUtils;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
@ -28,7 +30,7 @@ public class Command_cbtool extends TFM_Command
if ("targetblock".equalsIgnoreCase(args[0]) && sender instanceof Player)
{
Block targetBlock = sender_p.getTargetBlock(null, 100);
Block targetBlock = TFM_DepreciationAggregator.getTargetBlock(sender_p, null, 100);
playerMsg("Your target block: " + targetBlock.getLocation().toString());
return true;
}
@ -44,6 +46,11 @@ public class Command_cbtool extends TFM_Command
}
matcher.appendTail(generatedCommand);
if (TFM_CommandBlocker.isCommandBlocked(generatedCommand.toString(), sender, false))
{
return true;
}
server.dispatchCommand(sender, generatedCommand.toString());
}
catch (SubCommandFailureException ex)

View File

@ -5,7 +5,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -2,9 +2,9 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.Iterator;
import java.util.Map;
import me.StevenLawson.TotalFreedomMod.TFM_EssentialsBridge;
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -49,7 +49,7 @@ public class Command_colorme extends TFM_Command
final String newNick = color + ChatColor.stripColor(sender_p.getDisplayName()).trim() + ChatColor.WHITE;
TFM_EssentialsBridge.getInstance().setNickname(sender.getName(), newNick);
TFM_EssentialsBridge.setNickname(sender.getName(), newNick);
playerMsg("Your nickname is now: " + newNick);

View File

@ -1,70 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE)
@CommandParameters(description = "Temporarily change config parameters.", usage = "/<command> <entry> <value>")
public class Command_config extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length != 2)
{
return false;
}
TFM_ConfigEntry entry = TFM_ConfigEntry.findConfigEntry(args[0]);
if (entry == null)
{
sender.sendMessage("Can't find configuration option: " + args[0]);
return true;
}
Object newValue = null;
final String newValueString = args[1].trim();
final Class<?> type = entry.getType();
try
{
if (type.isAssignableFrom(Integer.class))
{
newValue = new Integer(newValueString);
entry.setInteger((Integer) newValue);
}
else if (type.isAssignableFrom(Double.class))
{
newValue = new Double(newValueString);
entry.setDouble((Double) newValue);
}
else if (type.isAssignableFrom(Boolean.class))
{
newValue = Boolean.valueOf(newValueString);
entry.setBoolean((Boolean) newValue);
}
else if (type.isAssignableFrom(String.class))
{
newValue = newValueString;
entry.setString((String) newValue);
}
}
catch (Exception ex)
{
}
if (newValue != null)
{
sender.sendMessage(String.format("Set configuration entry \"%s\" to \"%s\" value \"%s\".",
entry.toString(), type.getName(), newValue.toString()));
}
else
{
sender.sendMessage("Could not parse value \"" + newValueString + "\" as type \"" + type.getName() + "\".");
}
return true;
}
}

View File

@ -1,15 +1,14 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
@CommandParameters(description = "Quickly change your own gamemode to creative, or define someone's username to change theirs.", usage = "/<command> [partialname]")
@CommandParameters(description = "Quickly change your own gamemode to creative, or define someone's username to change theirs.", usage = "/<command> [partialname]", aliases = "gmc")
public class Command_creative extends TFM_Command
{
@Override
@ -33,9 +32,9 @@ public class Command_creative extends TFM_Command
{
if (args[0].equalsIgnoreCase("-a"))
{
if (!TFM_SuperadminList.isUserSuperadmin(sender))
if (!TFM_AdminList.isSuperAdmin(sender))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
sender.sendMessage(TFM_Command.MSG_NO_PERMS);
return true;
}
@ -48,19 +47,17 @@ public class Command_creative extends TFM_Command
return true;
}
if (!(senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)))
if (!(senderIsConsole || TFM_AdminList.isSuperAdmin(sender)))
{
playerMsg("Only superadmins can change other user's gamemode.");
return true;
}
try
{
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
if (player == null)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_EssentialsBridge;
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -13,12 +13,11 @@ public class Command_denick extends TFM_Command
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
TFM_Util.adminAction(sender.getName(), "Removing all nicknames.", false);
TFM_Util.adminAction(sender.getName(), "Removing all nicknames", false);
Player[] onlinePlayers = server.getOnlinePlayers();
for (Player player : onlinePlayers)
for (Player player : server.getOnlinePlayers())
{
TFM_EssentialsBridge.getInstance().setNickname(player.getName(), null);
TFM_EssentialsBridge.setNickname(player.getName(), null);
}
return true;

View File

@ -1,5 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
@ -31,7 +32,7 @@ public class Command_deop extends TFM_Command
// if the player is not online
if (player == null)
{
player = server.getOfflinePlayer(args[0]);
player = TFM_DepreciationAggregator.getOfflinePlayer(server, args[0]);
}
TFM_Util.adminAction(sender.getName(), "De-opping " + player.getName(), false);

View File

@ -1,7 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -18,7 +17,7 @@ public class Command_deopall extends TFM_Command
for (Player player : server.getOnlinePlayers())
{
player.setOp(false);
player.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
player.sendMessage(TFM_Command.YOU_ARE_NOT_OP);
}
return true;

View File

@ -2,8 +2,9 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -35,52 +36,51 @@ public class Command_dispfill extends TFM_Command
return true;
}
String[] items_raw = StringUtils.split(args[1], ",");
List<ItemStack> items = new ArrayList<ItemStack>();
for (String search_item : items_raw)
final List<ItemStack> items = new ArrayList<ItemStack>();
final String[] itemsRaw = StringUtils.split(args[1], ",");
for (final String searchItem : itemsRaw)
{
ItemStack is = null;
is = new ItemStack(Material.matchMaterial(search_item), 64);
if (is == null)
Material material = Material.matchMaterial(searchItem);
if (material == null)
{
try
{
is = new ItemStack(Integer.parseInt(search_item), 64);
material = TFM_DepreciationAggregator.getMaterial(Integer.parseInt(searchItem));
}
catch (NumberFormatException ex)
{
}
}
if (is != null)
if (material != null)
{
items.add(is);
items.add(new ItemStack(material, 64));
}
else
{
sender.sendMessage("Skipping invalid item: " + search_item);
sender.sendMessage("Skipping invalid item: " + searchItem);
}
}
ItemStack[] items_array = items.toArray(new ItemStack[items.size()]);
final ItemStack[] itemsArray = items.toArray(new ItemStack[items.size()]);
int affected = 0;
Location center_location = sender_p.getLocation();
Block center_block = center_location.getBlock();
for (int x_offset = -radius; x_offset <= radius; x_offset++)
final Location centerLocation = sender_p.getLocation();
final Block centerBlock = centerLocation.getBlock();
for (int xOffset = -radius; xOffset <= radius; xOffset++)
{
for (int y_offset = -radius; y_offset <= radius; y_offset++)
for (int yOffset = -radius; yOffset <= radius; yOffset++)
{
for (int z_offset = -radius; z_offset <= radius; z_offset++)
for (int zOffset = -radius; zOffset <= radius; zOffset++)
{
Block targetBlock = center_block.getRelative(x_offset, y_offset, z_offset);
if (targetBlock.getLocation().distanceSquared(center_location) < (radius * radius))
final Block targetBlock = centerBlock.getRelative(xOffset, yOffset, zOffset);
if (targetBlock.getLocation().distanceSquared(centerLocation) < (radius * radius))
{
if (targetBlock.getType().equals(Material.DISPENSER))
{
sender.sendMessage("Filling dispenser @ " + TFM_Util.formatLocation(targetBlock.getLocation()));
setDispenserContents(targetBlock, items_array);
setDispenserContents(targetBlock, itemsArray);
affected++;
}
}
@ -98,11 +98,13 @@ public class Command_dispfill extends TFM_Command
return true;
}
private static void setDispenserContents(Block targetBlock, ItemStack[] items)
private static void setDispenserContents(final Block targetBlock, final ItemStack[] items)
{
Dispenser dispenser = (Dispenser) targetBlock.getState();
Inventory disp_inv = dispenser.getInventory();
disp_inv.clear();
disp_inv.addItem(items);
if (targetBlock.getType() == Material.DISPENSER)
{
final Inventory dispenserInv = ((Dispenser) targetBlock.getState()).getInventory();
dispenserInv.clear();
dispenserInv.addItem(items);
}
}
}

View File

@ -1,7 +1,9 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Ban;
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
@ -9,9 +11,10 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE)
@CommandParameters(description = "For the bad Superadmins.", usage = "/<command> <playername>")
@CommandParameters(description = "For the bad Superadmins", usage = "/<command> <playername>")
public class Command_doom extends TFM_Command
{
@Override
@ -22,27 +25,24 @@ public class Command_doom extends TFM_Command
return false;
}
final Player player;
try
final Player player = getPlayer(args[0]);
if (player == null)
{
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
TFM_Util.adminAction(sender.getName(), "Casting oblivion over " + player.getName(), true);
TFM_Util.bcastMsg(player.getName() + " will be completely obliviated!", ChatColor.RED);
final String IP = player.getAddress().getAddress().getHostAddress().trim();
final String ip = player.getAddress().getAddress().getHostAddress().trim();
// remove from superadmin
if (TFM_SuperadminList.isUserSuperadmin(player))
if (TFM_AdminList.isSuperAdmin(player))
{
TFM_Util.adminAction(sender.getName(), "Removing " + player.getName() + " from the superadmin list.", true);
TFM_SuperadminList.removeSuperadmin(player);
TFM_AdminList.removeSuperadmin(player);
}
// remove from whitelist
@ -51,11 +51,14 @@ public class Command_doom extends TFM_Command
// deop
player.setOp(false);
// ban IP
TFM_ServerInterface.banIP(IP, null, null, null);
// ban IPs
for (String playerIp : TFM_PlayerList.getEntry(player).getIps())
{
TFM_BanManager.addIpBan(new TFM_Ban(playerIp, player.getName()));
}
// ban name
TFM_ServerInterface.banUsername(player.getName(), null, null, null);
// ban uuid
TFM_BanManager.addUuidBan(player);
// set gamemode to survival
player.setGameMode(GameMode.SURVIVAL);
@ -70,6 +73,9 @@ public class Command_doom extends TFM_Command
// generate explosion
player.getWorld().createExplosion(player.getLocation(), 4F);
// Shoot the player in the sky
player.setVelocity(player.getVelocity().clone().add(new Vector(0, 20, 0)));
new BukkitRunnable()
{
@Override
@ -81,7 +87,7 @@ public class Command_doom extends TFM_Command
// kill (if not done already)
player.setHealth(0.0);
}
}.runTaskLater(plugin, 20L * 2L);
}.runTaskLater(plugin, 2L * 20L);
new BukkitRunnable()
{
@ -89,7 +95,7 @@ public class Command_doom extends TFM_Command
public void run()
{
// message
TFM_Util.adminAction(sender.getName(), "Banning " + player.getName() + ", IP: " + IP, true);
TFM_Util.adminAction(sender.getName(), "Banning " + player.getName() + ", IP: " + ip, true);
// generate explosion
player.getWorld().createExplosion(player.getLocation(), 4F);
@ -97,7 +103,7 @@ public class Command_doom extends TFM_Command
// kick player
player.kickPlayer(ChatColor.RED + "FUCKOFF, and get your shit together!");
}
}.runTaskLater(plugin, 20L * 3L);
}.runTaskLater(plugin, 3L * 20L);
return true;
}

View File

@ -1,25 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Enable/disable auto entity wiper.", usage = "/<command> <on | off>")
public class Command_droptoggle extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length != 1)
{
return false;
}
TFM_Util.adminAction(sender.getName(),
(TFM_ConfigEntry.AUTO_ENTITY_WIPE.setBoolean(!args[0].equalsIgnoreCase("off")) ? "Enabled" : "Disabled")
+ " automatic entity wiping.", false);
return true;
}
}

View File

@ -1,42 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Shortcut to enable/disable DisguiseCraft.", usage = "/<command>")
public class Command_dtoggle extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
Plugin disguiseCraft = server.getPluginManager().getPlugin("DisguiseCraft");
if (disguiseCraft != null)
{
PluginManager pluginManager = plugin.getServer().getPluginManager();
boolean enabled = disguiseCraft.isEnabled();
if (enabled)
{
pluginManager.disablePlugin(disguiseCraft);
}
else
{
pluginManager.enablePlugin(disguiseCraft);
}
TFM_Util.adminAction(sender.getName(), (!enabled ? "Enabled" : "Disabled") + " DisguiseCraft.", true);
}
else
{
sender.sendMessage("DisguiseCraft is not installed on this server.");
}
return true;
}
}

View File

@ -1,7 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
@ -55,13 +54,6 @@ public class Command_enchant extends TFM_Command
{
for (Enchantment ench : Enchantment.values())
{
/*
2013-07-20 23:17:13 [INFO] [TotalFreedomMod]: Command Error: enchant
java.lang.NullPointerException
at net.minecraft.server.v1_6_R2.EnchantmentDurability.canEnchant(SourceFile:33)
at org.bukkit.craftbukkit.v1_6_R2.enchantments.CraftEnchantment.canEnchantItem(CraftEnchantment.java:55)
at me.StevenLawson.TotalFreedomMod.Commands.Command_enchant.run(Command_enchant.java:56)
*/
try
{
if (ench.canEnchantItem(itemInHand))
@ -122,7 +114,7 @@ public class Command_enchant extends TFM_Command
playerMsg("Can't use this enchantment on held item.");
}
}
else if (TFM_Util.isRemoveCommand(args[0]))
else if (args[0].equals("remove"))
{
itemInHand.removeEnchantment(ench);

View File

@ -5,14 +5,14 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Goto the ender / \"The End\".", usage = "/<command>")
public class Command_ender extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
TFM_Util.gotoWorld(sender, server.getWorlds().get(0).getName() + "_the_end");
TFM_Util.gotoWorld(sender_p, server.getWorlds().get(0).getName() + "_the_end");
return true;
}
}

View File

@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;

View File

@ -1,47 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Enable/disable explosives and set effect radius.", usage = "/<command> <on | off> [radius]")
public class Command_explosives extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length == 0)
{
return false;
}
if (args.length == 2)
{
try
{
TFM_ConfigEntry.EXPLOSIVE_RADIUS.setDouble(Math.max(1.0, Math.min(30.0, Double.parseDouble(args[1]))));
}
catch (NumberFormatException nfex)
{
TFM_Util.playerMsg(sender, nfex.getMessage());
return true;
}
}
if (args[0].equalsIgnoreCase("on"))
{
TFM_ConfigEntry.ALLOW_EXPLOSIONS.setBoolean(true);
playerMsg("Explosives are now enabled, radius set to " + TFM_ConfigEntry.EXPLOSIVE_RADIUS.getDouble() + " blocks.");
}
else
{
TFM_ConfigEntry.ALLOW_EXPLOSIONS.setBoolean(false);
playerMsg("Explosives are now disabled.");
}
return true;
}
}

View File

@ -1,8 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_UserList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -19,18 +18,16 @@ public class Command_findip extends TFM_Command
return false;
}
final Player player;
try
final Player player = getPlayer(args[0]);
if (player == null)
{
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
{
playerMsg(ex.getMessage());
playerMsg(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
playerMsg("Player IPs: " + StringUtils.join(TFM_UserList.getInstance(TotalFreedomMod.plugin).getEntry(player).getIpAddresses(), ", "));
playerMsg("Player IPs: " + StringUtils.join(TFM_PlayerList.getEntry(player).getIps(), ", "));
return true;
}

View File

@ -1,33 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Enable/disable fire placement.", usage = "/<command> <on | off>")
public class Command_fireplace extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length != 1)
{
return false;
}
if (args[0].equalsIgnoreCase("on"))
{
TFM_ConfigEntry.ALLOW_FIRE_PLACE.setBoolean(true);
playerMsg("Fire placement is now enabled.");
}
else
{
TFM_ConfigEntry.ALLOW_FIRE_PLACE.setBoolean(false);
playerMsg("Fire placement is now disabled.");
}
return true;
}
}

View File

@ -1,31 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_GameRuleHandler;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Enable/disable fire spread.", usage = "/<command> <on | off>")
public class Command_firespread extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length != 1)
{
return false;
}
boolean fireSpread = !args[0].equalsIgnoreCase("off");
TFM_ConfigEntry.ALLOW_FIRE_SPREAD.setBoolean(fireSpread);
playerMsg("Fire spread is now " + (fireSpread ? "enabled" : "disabled") + ".");
TFM_GameRuleHandler.setGameRule(TFM_GameRuleHandler.TFM_GameRule.DO_FIRE_TICK, fireSpread);
return true;
}
}

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_Flatlands;
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.World.TFM_Flatlands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -13,7 +13,7 @@ public class Command_flatlands extends TFM_Command
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (TFM_ConfigEntry.GENERATE_FLATLANDS.getBoolean())
if (TFM_ConfigEntry.FLATLANDS_GENERATE.getBoolean())
{
TFM_Flatlands.getInstance().sendToWorld(sender_p);
}

View File

@ -1,24 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Enable/disable fluid spread.", usage = "/<command> <on | off>")
public class Command_fluidspread extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length != 1)
{
return false;
}
playerMsg("Lava and water spread is now " + (TFM_ConfigEntry.ALLOW_FLUID_SPREAD.setBoolean(!args[0].equalsIgnoreCase("off")) ? "enabled" : "disabled") + ".");
return true;
}
}

View File

@ -1,54 +1,46 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Freeze players (toggles on and off).", usage = "/<command> [target | purge]")
public class Command_fr extends TFM_Command
{
private static boolean allFrozen = false;
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length == 0)
{
TotalFreedomMod.allPlayersFrozen = !TotalFreedomMod.allPlayersFrozen;
allFrozen = !allFrozen;
if (TotalFreedomMod.allPlayersFrozen)
if (allFrozen)
{
TFM_Util.adminAction(sender.getName(), "Freezing all players", false);
TotalFreedomMod.allPlayersFrozen = true;
if (TotalFreedomMod.freezePurgeTask != null)
{
TotalFreedomMod.freezePurgeTask.cancel();
}
TotalFreedomMod.freezePurgeTask = new BukkitRunnable()
{
@Override
public void run()
{
TFM_Util.adminAction("FreezeTimer", "Unfreezing all players", false);
TotalFreedomMod.allPlayersFrozen = false;
}
}.runTaskLater(plugin, 20L * 60L * 5L);
setAllFrozen(true);
playerMsg("Players are now frozen.");
for (Player player : Bukkit.getOnlinePlayers())
{
if (!TFM_AdminList.isSuperAdmin(player))
{
playerMsg(player, "You have been frozen due to rulebreakers, you will be unfrozen soon.", ChatColor.RED);
}
}
}
else
{
TFM_Util.adminAction(sender.getName(), "Unfreezing all players", false);
TotalFreedomMod.allPlayersFrozen = false;
if (TotalFreedomMod.freezePurgeTask != null)
{
TotalFreedomMod.freezePurgeTask.cancel();
}
setAllFrozen(false);
playerMsg("Players are now free to move.");
}
}
@ -56,34 +48,20 @@ public class Command_fr extends TFM_Command
{
if (args[0].toLowerCase().equals("purge"))
{
TotalFreedomMod.allPlayersFrozen = false;
if (TotalFreedomMod.freezePurgeTask != null)
{
TotalFreedomMod.freezePurgeTask.cancel();
}
for (Player player : server.getOnlinePlayers())
{
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
playerdata.setFrozen(false);
}
TFM_Util.adminAction(sender.getName(), "Lifting all global and player freezes", false);
setAllFrozen(false);
TFM_Util.adminAction(sender.getName(), "Unfreezing all players", false);
}
else
{
Player player;
try
final Player player = getPlayer(args[0]);
if (player == null)
{
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(TFM_Command.PLAYER_NOT_FOUND, ChatColor.RED);
return true;
}
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
playerdata.setFrozen(!playerdata.isFrozen());
playerMsg(player.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
@ -93,4 +71,13 @@ public class Command_fr extends TFM_Command
return true;
}
public static void setAllFrozen(boolean freeze)
{
allFrozen = freeze;
for (TFM_PlayerData data : TFM_PlayerData.PLAYER_DATA.values())
{
data.setFrozen(freeze);
}
}
}

View File

@ -1,9 +1,10 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
import java.util.Iterator;
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import me.StevenLawson.TotalFreedomMod.TFM_UuidManager;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -11,10 +12,47 @@ import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(
description = "Use admin commands on someone by hash. Use mode 'list' to get a player's hash. Other modes are kick, nameban, ipban, ban, op, deop, ci",
usage = "/<command> [list | [<kick | nameban | ipban | ban | op | deop | ci | fr> <targethash>] ]")
description = "Use admin commands on someone by hash. Use mode 'list' to get a player's hash. Other modes are kick, nameban, ipban, ban, op, deop, ci, fr, smite.",
usage = "/<command> [list | [<kick | nameban | ipban | ban | op | deop | ci | fr | smite> <targethash>] ]")
public class Command_gadmin extends TFM_Command
{
private enum GadminMode
{
LIST("list"),
KICK("kick"),
NAMEBAN("nameban"),
IPBAN("ipban"),
BAN("ban"),
OP("op"),
DEOP("deop"),
CI("ci"),
FR("fr"),
SMITE("smite");
private final String modeName;
private GadminMode(String command)
{
this.modeName = command;
}
public String getModeName()
{
return modeName;
}
public static GadminMode findMode(String needle)
{
for (final GadminMode mode : GadminMode.values())
{
if (needle.equalsIgnoreCase(mode.getModeName()))
{
return mode;
}
}
return null;
}
}
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
@ -23,93 +61,141 @@ public class Command_gadmin extends TFM_Command
return false;
}
String mode = args[0].toLowerCase();
if (mode.equals("list"))
final GadminMode mode = GadminMode.findMode(args[0].toLowerCase());
if (mode == null)
{
playerMsg("[ Real Name ] : [ Display Name ] - Hash:");
playerMsg("Invalid mode: " + args[0], ChatColor.RED);
return true;
}
for (Player player : server.getOnlinePlayers())
final Iterator<? extends Player> it = server.getOnlinePlayers().iterator();
if (mode == GadminMode.LIST)
{
String hash = player.getUniqueId().toString().substring(0, 4);
if (mode.equals("list"))
playerMsg("[ Real Name ] : [ Display Name ] - Hash:");
while (it.hasNext())
{
final Player player = it.next();
final String hash = TFM_UuidManager.getUniqueId(player).toString().substring(0, 4);
sender.sendMessage(ChatColor.GRAY + String.format("[ %s ] : [ %s ] - %s",
player.getName(),
ChatColor.stripColor(player.getDisplayName()),
hash));
}
else if (hash.equalsIgnoreCase(args[1]))
{
if (mode.equals("kick"))
{
TFM_Util.adminAction(sender.getName(), String.format("Kicking: %s.", player.getName()), false);
player.kickPlayer("Kicked by Administrator");
}
else if (mode.equals("nameban"))
{
TFM_ServerInterface.banUsername(player.getName(), null, null, null);
TFM_Util.adminAction(sender.getName(), String.format("Banning Name: %s.", player.getName()), true);
player.kickPlayer("Username banned by Administrator.");
}
else if (mode.equals("ipban"))
{
String user_ip = player.getAddress().getAddress().getHostAddress();
String[] ip_parts = user_ip.split("\\.");
if (ip_parts.length == 4)
{
user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
}
TFM_Util.adminAction(sender.getName(), String.format("Banning IP: %s.", player.getName(), user_ip), true);
TFM_ServerInterface.banIP(user_ip, null, null, null);
player.kickPlayer("IP address banned by Administrator.");
}
else if (mode.equals("ban"))
{
String user_ip = player.getAddress().getAddress().getHostAddress();
String[] ip_parts = user_ip.split("\\.");
if (ip_parts.length == 4)
{
user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
}
TFM_Util.adminAction(sender.getName(), String.format("Banning Name: %s, IP: %s.", player.getName(), user_ip), true);
TFM_ServerInterface.banIP(user_ip, null, null, null);
TFM_ServerInterface.banUsername(player.getName(), null, null, null);
player.kickPlayer("IP and username banned by Administrator.");
}
else if (mode.equals("op"))
{
TFM_Util.adminAction(sender.getName(), String.format("Opping %s.", player.getName()), false);
player.setOp(false);
player.sendMessage(TotalFreedomMod.YOU_ARE_OP);
}
else if (mode.equals("deop"))
{
TFM_Util.adminAction(sender.getName(), String.format("Deopping %s.", player.getName()), false);
player.setOp(false);
player.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
}
else if (mode.equals("ci"))
{
player.getInventory().clear();
}
else if (mode.equals("fr"))
{
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
playerdata.setFrozen(!playerdata.isFrozen());
playerMsg(player.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
player.sendMessage(ChatColor.AQUA + "You have been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
}
return true;
}
if (args.length < 2)
{
return false;
}
if (!mode.equals("list"))
Player target = null;
while (it.hasNext() && target == null)
{
playerMsg("Invalid hash.", ChatColor.RED);
final Player player = it.next();
final String hash = TFM_UuidManager.getUniqueId(player).toString().substring(0, 4);
if (hash.equalsIgnoreCase(args[1]))
{
target = player;
}
}
if (target == null)
{
playerMsg("Invalid player hash: " + args[1], ChatColor.RED);
return true;
}
switch (mode)
{
case KICK:
{
TFM_Util.adminAction(sender.getName(), String.format("Kicking: %s.", target.getName()), false);
target.kickPlayer("Kicked by Administrator");
break;
}
case NAMEBAN:
{
TFM_BanManager.addUuidBan(target);
TFM_Util.adminAction(sender.getName(), String.format("Banning Name: %s.", target.getName()), true);
target.kickPlayer("Username banned by Administrator.");
break;
}
case IPBAN:
{
String ip = target.getAddress().getAddress().getHostAddress();
String[] ip_parts = ip.split("\\.");
if (ip_parts.length == 4)
{
ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
}
TFM_Util.adminAction(sender.getName(), String.format("Banning IP: %s.", ip), true);
TFM_BanManager.addIpBan(target);
target.kickPlayer("IP address banned by Administrator.");
break;
}
case BAN:
{
String ip = target.getAddress().getAddress().getHostAddress();
String[] ip_parts = ip.split("\\.");
if (ip_parts.length == 4)
{
ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
}
TFM_Util.adminAction(sender.getName(), String.format("Banning Name: %s, IP: %s.", target.getName(), ip), true);
TFM_BanManager.addUuidBan(target);
TFM_BanManager.addIpBan(target);
target.kickPlayer("IP and username banned by Administrator.");
break;
}
case OP:
{
TFM_Util.adminAction(sender.getName(), String.format("Opping %s.", target.getName()), false);
target.setOp(false);
target.sendMessage(TFM_Command.YOU_ARE_OP);
break;
}
case DEOP:
{
TFM_Util.adminAction(sender.getName(), String.format("Deopping %s.", target.getName()), false);
target.setOp(false);
target.sendMessage(TFM_Command.YOU_ARE_NOT_OP);
break;
}
case CI:
{
target.getInventory().clear();
break;
}
case FR:
{
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(target);
playerdata.setFrozen(!playerdata.isFrozen());
playerMsg(target.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
target.sendMessage(ChatColor.AQUA + "You have been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
break;
}
case SMITE:
{
Command_smite.smite(target);
break;
}
}
return true;

View File

@ -1,6 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import org.bukkit.ChatColor;
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -17,37 +18,25 @@ public class Command_gcmd extends TFM_Command
return false;
}
Player player;
try
final Player player = getPlayer(args[0]);
if (player == null)
{
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
String outcommand = "";
try
final String outCommand = StringUtils.join(args, " ", 1, args.length);
if (TFM_CommandBlocker.isCommandBlocked(outCommand, sender))
{
StringBuilder outcommand_bldr = new StringBuilder();
for (int i = 1; i < args.length; i++)
{
outcommand_bldr.append(args[i]).append(" ");
}
outcommand = outcommand_bldr.toString().trim();
}
catch (Throwable ex)
{
sender.sendMessage(ChatColor.GRAY + "Error building command: " + ex.getMessage());
return true;
}
try
{
playerMsg("Sending command as " + player.getName() + ": " + outcommand);
if (server.dispatchCommand(player, outcommand))
playerMsg("Sending command as " + player.getName() + ": " + outCommand);
if (server.dispatchCommand(player, outCommand))
{
playerMsg("Command sent.");
}

View File

@ -2,12 +2,14 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_UserList;
import me.StevenLawson.TotalFreedomMod.TFM_UserList.TFM_UserListEntry;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Ban;
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
import me.StevenLawson.TotalFreedomMod.TFM_Player;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import me.StevenLawson.TotalFreedomMod.TFM_UuidManager;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -28,10 +30,10 @@ public class Command_glist extends TFM_Command
{
if (args[0].equalsIgnoreCase("purge"))
{
//Purge does not clear the banlist! This is not for clearing bans! This is for clearing the yaml file that stores the player/IP database!
if (TFM_SuperadminList.isSeniorAdmin(sender))
if (TFM_AdminList.isSeniorAdmin(sender))
{
TFM_UserList.getInstance(plugin).purge();
TFM_PlayerList.purgeAll();
playerMsg("Purged playerbase");
}
else
{
@ -47,63 +49,61 @@ public class Command_glist extends TFM_Command
else if (args.length == 2)
{
String username;
List<String> ip_addresses = new ArrayList<String>();
final List<String> ips = new ArrayList<String>();
try
{
Player player = getPlayer(args[1]);
final Player player = getPlayer(args[1]);
username = player.getName();
ip_addresses.add(player.getAddress().getAddress().getHostAddress());
}
catch (PlayerNotFoundException ex)
if (player == null)
{
TFM_UserListEntry entry = TFM_UserList.getInstance(plugin).getEntry(args[1]);
final TFM_Player entry = TFM_PlayerList.getEntry(TFM_UuidManager.getUniqueId(args[1]));
if (entry == null)
{
TFM_Util.playerMsg(sender, "Can't find that user. If target is not logged in, make sure that you spelled the name exactly.");
playerMsg("Can't find that user. If target is not logged in, make sure that you spelled the name exactly.");
return true;
}
username = entry.getUsername();
ip_addresses = entry.getIpAddresses();
username = entry.getLastLoginName();
ips.addAll(entry.getIps());
}
else
{
username = player.getName();
final TFM_Player entry = TFM_PlayerList.getEntry(TFM_UuidManager.getUniqueId(player));
ips.addAll(entry.getIps());
}
String mode = args[0].toLowerCase();
if (mode.equalsIgnoreCase("ban"))
{
TFM_Util.adminAction(sender.getName(), "Banning " + username + " and IPs: " + StringUtils.join(ip_addresses, ","), true);
TFM_Util.adminAction(sender.getName(), "Banning " + username + " and IPs: " + StringUtils.join(ips, ", "), true);
Player player = server.getPlayerExact(username);
if (player != null)
final Player target = getPlayer(username, true);
if (target != null)
{
TFM_ServerInterface.banUsername(player.getName(), null, null, null);
player.kickPlayer("You have been banned by " + sender.getName() + "\n If you think you have been banned wrongly, appeal here: http://www.totalfreedom.boards.net");
TFM_BanManager.addUuidBan(new TFM_Ban(TFM_UuidManager.getUniqueId(target), target.getName()));
target.kickPlayer("You have been banned by " + sender.getName() + "\n If you think you have been banned wrongly, appeal here: http://www.totalfreedom.boards.net");
}
else
{
TFM_ServerInterface.banUsername(username, null, null, null);
TFM_BanManager.addUuidBan(new TFM_Ban(TFM_UuidManager.getUniqueId(username), username));
}
for (String ip_address : ip_addresses)
for (String ip : ips)
{
TFM_ServerInterface.banIP(ip_address, null, null, null);
String[] ip_address_parts = ip_address.split("\\.");
TFM_ServerInterface.banIP(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*", null, null, null);
TFM_BanManager.addIpBan(new TFM_Ban(ip, username));
TFM_BanManager.addIpBan(new TFM_Ban(TFM_Util.getFuzzyIp(ip), username));
}
}
else if (mode.equalsIgnoreCase("unban") || mode.equalsIgnoreCase("pardon"))
else if (mode.equalsIgnoreCase("unban"))
{
TFM_Util.adminAction(sender.getName(), "Unbanning " + username + " and IPs: " + StringUtils.join(ip_addresses, ","), true);
TFM_ServerInterface.unbanUsername(username);
for (String ip_address : ip_addresses)
TFM_Util.adminAction(sender.getName(), "Unbanning " + username + " and IPs: " + StringUtils.join(ips, ", "), true);
TFM_BanManager.unbanUuid(TFM_UuidManager.getUniqueId(username));
for (String ip : ips)
{
TFM_ServerInterface.unbanIP(ip_address);
String[] ip_address_parts = ip_address.split("\\.");
TFM_ServerInterface.unbanIP(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*");
TFM_BanManager.unbanIp(ip);
TFM_BanManager.unbanIp(TFM_Util.getFuzzyIp(ip));
}
}
else

View File

@ -1,11 +1,13 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_WorldEditBridge;
import me.StevenLawson.TotalFreedomMod.TFM_Ban;
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
import me.StevenLawson.TotalFreedomMod.TFM_RollbackManager;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TFM_WorldEditBridge;
import net.minecraft.util.org.apache.commons.lang3.ArrayUtils;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import me.StevenLawson.TotalFreedomMod.TFM_UuidManager;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
@ -25,27 +27,30 @@ public class Command_gtfo extends TFM_Command
return false;
}
Player player;
try
final Player player = getPlayer(args[0]);
if (player == null)
{
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(TFM_Command.PLAYER_NOT_FOUND, ChatColor.RED);
return true;
}
String ban_reason = null;
String reason = null;
if (args.length >= 2)
{
ban_reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
}
TFM_Util.bcastMsg(player.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED);
// Undo WorldEdits:
TFM_WorldEditBridge.getInstance().undo(player, 15);
try
{
TFM_WorldEditBridge.undo(player, 15);
}
catch (NoClassDefFoundError ex)
{
}
// rollback
TFM_RollbackManager.rollback(player.getName());
@ -71,20 +76,29 @@ public class Command_gtfo extends TFM_Command
}
// ban IP address:
String user_ip = player.getAddress().getAddress().getHostAddress();
String[] ip_parts = user_ip.split("\\.");
if (ip_parts.length == 4)
String ip = TFM_Util.getFuzzyIp(player.getAddress().getAddress().getHostAddress());
final StringBuilder bcast = new StringBuilder()
.append(ChatColor.RED)
.append("Banning: ")
.append(player.getName())
.append(", IP: ")
.append(ip);
if (reason != null)
{
user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
bcast.append(" - Reason: ").append(ChatColor.YELLOW).append(reason);
}
TFM_Util.bcastMsg(String.format("Banning: %s, IP: %s.", player.getName(), user_ip), ChatColor.RED);
TFM_ServerInterface.banIP(user_ip, ban_reason, null, null);
TFM_Util.bcastMsg(bcast.toString());
TFM_BanManager.addIpBan(new TFM_Ban(ip, player.getName(), sender.getName(), null, reason));
// ban username:
TFM_ServerInterface.banUsername(player.getName(), ban_reason, null, null);
TFM_BanManager.addUuidBan(new TFM_Ban(TFM_UuidManager.getUniqueId(player), player.getName(), sender.getName(), null, reason));
// kick Player:
player.kickPlayer(ChatColor.RED + "GTFO" + (ban_reason != null ? ("\nReason: " + ChatColor.YELLOW + ban_reason) : ""));
player.kickPlayer(ChatColor.RED + "GTFO" + (reason != null ? ("\nReason: " + ChatColor.YELLOW + reason) : ""));
return true;
}

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -25,7 +25,7 @@ public class Command_halt extends TFM_Command
int counter = 0;
for (Player player : server.getOnlinePlayers())
{
if (!TFM_SuperadminList.isUserSuperadmin(player))
if (!TFM_AdminList.isSuperAdmin(player))
{
TFM_PlayerData.getPlayerData(player).setHalted(true);
counter++;
@ -63,7 +63,7 @@ public class Command_halt extends TFM_Command
{
if (count == 0)
{
playerMsg(sender, "Halted players:");
playerMsg("Halted players:");
}
playerMsg("- " + hp.getName());
count++;
@ -76,18 +76,14 @@ public class Command_halt extends TFM_Command
return true;
}
Player player;
try
final Player player = getPlayer(args[0]);
if (player == null)
{
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
if (!playerdata.isHalted())
{

View File

@ -2,9 +2,9 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -22,6 +22,7 @@ public class Command_invis extends TFM_Command
{
if (args[0].equalsIgnoreCase("smite"))
{
TFM_Util.adminAction(sender.getName(), "Smiting all invisible players", true);
smite = true;
}
else
@ -38,9 +39,9 @@ public class Command_invis extends TFM_Command
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY))
{
players.add(player.getName());
if (smite && !TFM_SuperadminList.isUserSuperadmin(player))
if (smite && !TFM_AdminList.isSuperAdmin(player))
{
Command_smite.smite(player);
player.setHealth(0.0);
smites++;
}
}
@ -48,20 +49,19 @@ public class Command_invis extends TFM_Command
if (players.isEmpty())
{
TFM_Util.playerMsg(sender, "There are no invisible players");
playerMsg("There are no invisible players");
return true;
}
if (smite)
{
TFM_Util.playerMsg(sender, "Smitten " + smites + " players");
playerMsg("Smitten " + smites + " players");
}
else
{
TFM_Util.playerMsg(sender, "Invisble players (" + players.size() + "): " + StringUtils.join(players, ", "));
playerMsg("Invisble players (" + players.size() + "): " + StringUtils.join(players, ", "));
}
return true;
}
}

View File

@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Manage jumppads", usage = "/<command> <on | off | info |sideways <on | off> | strength <strength (1-10)>>", aliases = "launchpads,jp")
@CommandParameters(description = "Manage jumppads", usage = "/<command> <on | off | info | sideways <on | off> | strength <strength (1-10)>>", aliases = "launchpads,jp")
public class Command_jumppads extends TFM_Command
{
@Override
@ -23,26 +23,26 @@ public class Command_jumppads extends TFM_Command
{
if (args[0].equalsIgnoreCase("info"))
{
playerMsg("Jumppads: " + (TFM_Jumppads.getInstance().getMode().isOn() ? "Enabled" : "Disabled"), ChatColor.BLUE);
playerMsg("Sideways: " + (TFM_Jumppads.getInstance().getMode() == TFM_Jumppads.JumpPadMode.NORMAL_AND_SIDEWAYS ? "Enabled" : "Disabled"), ChatColor.BLUE);
playerMsg("Strength: " + (TFM_Jumppads.getInstance().getStrength() * 10 - 1), ChatColor.BLUE);
playerMsg("Jumppads: " + (TFM_Jumppads.getMode().isOn() ? "Enabled" : "Disabled"), ChatColor.BLUE);
playerMsg("Sideways: " + (TFM_Jumppads.getMode() == TFM_Jumppads.JumpPadMode.NORMAL_AND_SIDEWAYS ? "Enabled" : "Disabled"), ChatColor.BLUE);
playerMsg("Strength: " + (TFM_Jumppads.getStrength() * 10 - 1), ChatColor.BLUE);
return true;
}
if (TFM_Util.isStopCommand(args[0]))
if ("off".equals(args[0]))
{
TFM_Util.adminAction(sender.getName(), "Disabling Jumppads", false);
TFM_Jumppads.getInstance().setMode(TFM_Jumppads.JumpPadMode.OFF);
TFM_Jumppads.setMode(TFM_Jumppads.JumpPadMode.OFF);
}
else
{
TFM_Util.adminAction(sender.getName(), "Enabling Jumppads", false);
TFM_Jumppads.getInstance().setMode(TFM_Jumppads.JumpPadMode.MADGEEK);
TFM_Jumppads.setMode(TFM_Jumppads.JumpPadMode.MADGEEK);
}
}
else
{
if (TFM_Jumppads.getInstance().getMode() == TFM_Jumppads.JumpPadMode.OFF)
if (TFM_Jumppads.getMode() == TFM_Jumppads.JumpPadMode.OFF)
{
playerMsg("Jumppads are currently disabled, please enable them before changing jumppads settings.");
return true;
@ -50,15 +50,15 @@ public class Command_jumppads extends TFM_Command
if (args[0].equalsIgnoreCase("sideways"))
{
if (TFM_Util.isStopCommand(args[1]))
if ("off".equals(args[1]))
{
TFM_Util.adminAction(sender.getName(), "Setting Jumppads mode to: Madgeek", false);
TFM_Jumppads.getInstance().setMode(TFM_Jumppads.JumpPadMode.MADGEEK);
TFM_Jumppads.setMode(TFM_Jumppads.JumpPadMode.MADGEEK);
}
else
{
TFM_Util.adminAction(sender.getName(), "Setting Jumppads mode to: Normal and Sideways", false);
TFM_Jumppads.getInstance().setMode(TFM_Jumppads.JumpPadMode.NORMAL_AND_SIDEWAYS);
TFM_Jumppads.setMode(TFM_Jumppads.JumpPadMode.NORMAL_AND_SIDEWAYS);
}
}
else if (args[0].equalsIgnoreCase("strength"))
@ -81,7 +81,7 @@ public class Command_jumppads extends TFM_Command
}
TFM_Util.adminAction(sender.getName(), "Setting Jumppads strength to: " + String.valueOf(strength), false);
TFM_Jumppads.getInstance().setStrength((strength / 10) + 0.1F);
TFM_Jumppads.setStrength((strength / 10) + 0.1F);
}
else
{

View File

@ -1,13 +1,13 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH, block_host_console = true)
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(description = "Kick all non-superadmins on server.", usage = "/<command>")
public class Command_kicknoob extends TFM_Command
{
@ -18,7 +18,7 @@ public class Command_kicknoob extends TFM_Command
for (Player player : server.getOnlinePlayers())
{
if (!TFM_SuperadminList.isUserSuperadmin(player))
if (!TFM_AdminList.isSuperAdmin(player))
{
player.kickPlayer(ChatColor.RED + "Disconnected by admin.");
}

View File

@ -1,8 +1,9 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
@ -22,16 +23,29 @@ public class Command_landmine extends TFM_Command
if (!TFM_ConfigEntry.LANDMINES_ENABLED.getBoolean())
{
playerMsg("The landmine is currently disabled.", ChatColor.GREEN);
return true;
}
else if (!TFM_ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
if (!TFM_ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
{
playerMsg("Explosions are currently disabled.", ChatColor.GREEN);
return true;
}
else if (sender.isOp())
{
double radius = 2.0;
if (args.length >= 1)
{
if ("list".equalsIgnoreCase(args[0]))
{
final Iterator<TFM_LandmineData> landmines = TFM_LandmineData.landmines.iterator();
while (landmines.hasNext())
{
playerMsg(landmines.next().toString());
}
return true;
}
try
{
radius = Math.max(2.0, Math.min(6.0, Double.parseDouble(args[0])));
@ -41,29 +55,33 @@ public class Command_landmine extends TFM_Command
}
}
Block landmine = sender_p.getLocation().getBlock().getRelative(BlockFace.DOWN);
final Block landmine = sender_p.getLocation().getBlock().getRelative(BlockFace.DOWN);
landmine.setType(Material.TNT);
TFM_LandmineData.landmines.add(new TFM_LandmineData(landmine.getLocation(), sender_p, radius));
playerMsg("Landmine planted. Radius: " + radius + " blocks.", ChatColor.GREEN);
}
playerMsg("Landmine planted - Radius = " + radius + " blocks.", ChatColor.GREEN);
return true;
}
public static class TFM_LandmineData
{
public static List<TFM_LandmineData> landmines = new ArrayList<TFM_LandmineData>();
public Location location;
public Player player;
public double radius;
public static final List<TFM_LandmineData> landmines = new ArrayList<TFM_LandmineData>();
public final Location location;
public final Player player;
public final double radius;
public TFM_LandmineData(Location landmine_pos, Player player, double radius)
public TFM_LandmineData(Location location, Player player, double radius)
{
super();
this.location = landmine_pos;
this.location = location;
this.player = player;
this.radius = radius;
}
@Override
public String toString()
{
return this.location.toString() + ", " + this.radius + ", " + this.player.getName();
}
}
}

View File

@ -18,27 +18,24 @@ public class Command_lastcmd extends TFM_Command
return false;
}
Player player;
try
final Player player = getPlayer(args[0]);
if (player == null)
{
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
if (playerdata != null)
{
String last_command = playerdata.getLastCommand();
if (last_command.isEmpty())
String lastCommand = playerdata.getLastCommand();
if (lastCommand.isEmpty())
{
last_command = "(none)";
lastCommand = "(none)";
}
playerMsg(player.getName() + " - Last Command: " + last_command, ChatColor.GRAY);
playerMsg(player.getName() + " - Last Command: " + lastCommand, ChatColor.GRAY);
}
return true;

View File

@ -1,24 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Enable/disable lava damage.", usage = "/<command> <on | off>")
public class Command_lavadmg extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length != 1)
{
return false;
}
playerMsg("Lava damage is now " + (TFM_ConfigEntry.ALLOW_LAVA_DAMAGE.setBoolean(!args[0].equalsIgnoreCase("off")) ? "enabled" : "disabled") + ".");
return true;
}
}

View File

@ -1,24 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Enable/disable lava placement.", usage = "/<command> <on | off>")
public class Command_lavaplace extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length != 1)
{
return false;
}
playerMsg("Lava placement is now " + (TFM_ConfigEntry.ALLOW_LAVA_PLACE.setBoolean(!args[0].equalsIgnoreCase("off")) ? "enabled" : "disabled") + ".");
return true;
}
}

View File

@ -2,26 +2,24 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerRank;
import me.StevenLawson.TotalFreedomMod.TFM_Superadmin;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-a]", aliases = "who")
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-a | -i]", aliases = "who")
public class Command_list extends TFM_Command
{
private static enum ListFilter
{
ALL,
ADMINS;
ADMINS,
IMPOSTORS;
}
@Override
@ -43,21 +41,43 @@ public class Command_list extends TFM_Command
return true;
}
final Command_list.ListFilter listFilter = (args.length == 1 && args[0].equals("-a") ? Command_list.ListFilter.ADMINS : Command_list.ListFilter.ALL);
final ListFilter listFilter;
if (args.length == 1)
{
if ("-a".equals(args[0]))
{
listFilter = ListFilter.ADMINS;
}
else if ("-i".equals(args[0]))
{
listFilter = ListFilter.IMPOSTORS;
}
else
{
return false;
}
}
else
{
listFilter = ListFilter.ALL;
}
final StringBuilder onlineStats = new StringBuilder();
final StringBuilder onlineUsers = new StringBuilder();
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().length);
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().size());
onlineStats.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(server.getMaxPlayers());
onlineStats.append(ChatColor.BLUE).append(" players online.");
final List<String> names = new ArrayList<String>();
for (Player player : server.getOnlinePlayers())
{
final boolean userSuperadmin = TFM_SuperadminList.isUserSuperadmin(player);
if (listFilter == ListFilter.ADMINS && !TFM_AdminList.isSuperAdmin(player))
{
continue;
}
if (listFilter == Command_list.ListFilter.ADMINS && !userSuperadmin)
if (listFilter == ListFilter.IMPOSTORS && !TFM_AdminList.isAdminImpostor(player))
{
continue;
}

View File

@ -1,44 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.io.File;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true)
@CommandParameters(description = "Download the superadmin and permban lists from the main TotalFreedom server.", usage = "/<command>")
public class Command_listsync extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
TFM_Util.adminAction(sender.getName(), "Downloading superadmin and permban lists from primary TotalFreedom server.", false);
try
{
TFM_Util.downloadFile("http://madgeekonline.com/apps/get_superadmins_raw.php", new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
TotalFreedomMod.loadSuperadminConfig();
TFM_Util.adminAction(sender.getName(), TotalFreedomMod.SUPERADMIN_FILE + " downloaded.", false);
}
catch (Exception ex)
{
TFM_Log.severe(ex);
}
try
{
TFM_Util.downloadFile("http://madgeekonline.com/apps/get_permbans_raw.php", new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.PERMBAN_FILE));
TotalFreedomMod.loadPermbanConfig();
TFM_Util.adminAction(sender.getName(), TotalFreedomMod.PERMBAN_FILE + " downloaded.", false);
}
catch (Exception ex)
{
TFM_Log.severe(ex);
}
return true;
}
}

View File

@ -1,34 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Prevents new players from joining the server", usage = "/<command> <on | off>")
public class Command_lockdown extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length != 1)
{
return false;
}
if (TFM_Util.isStopCommand(args[0]))
{
TFM_Util.adminAction(sender.getName(), "De-activating server lockdown", true);
TotalFreedomMod.lockdownEnabled = false;
}
else
{
TFM_Util.adminAction(sender.getName(), "Activating server lockdown", true);
TotalFreedomMod.lockdownEnabled = true;
}
return true;
}
}

View File

@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true)
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandParameters(description = "Block target's minecraft input. This is evil, and I never should have wrote it.", usage = "/<command> <all | purge | <<partialname> on | off>>")
public class Command_lockup extends TFM_Command
{
@ -46,14 +46,11 @@ public class Command_lockup extends TFM_Command
{
if (args[1].equalsIgnoreCase("on"))
{
final Player player;
try
final Player player = getPlayer(args[0]);
if (player == null)
{
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
@ -61,16 +58,13 @@ public class Command_lockup extends TFM_Command
startLockup(player);
playerMsg("Locked up " + player.getName() + ".");
}
else if (TFM_Util.isStopCommand(args[1]))
else if ("off".equals(args[1]))
{
final Player player;
try
final Player player = getPlayer(args[0]);
if (player == null)
{
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}

View File

@ -9,12 +9,11 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_Admin;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_Superadmin;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -32,7 +31,7 @@ public class Command_logs extends TFM_Command
if (args.length == 1)
{
mode = (TFM_Util.isStopCommand(args[0]) ? LogsRegistrationMode.DELETE : LogsRegistrationMode.UPDATE);
mode = ("off".equals(args[0]) ? LogsRegistrationMode.DELETE : LogsRegistrationMode.UPDATE);
}
updateLogsRegistration(sender, sender_p, mode);
@ -47,8 +46,8 @@ public class Command_logs extends TFM_Command
public static void updateLogsRegistration(final CommandSender sender, final String targetName, final String targetIP, final LogsRegistrationMode mode)
{
final String logsRegisterURL = TFM_ConfigEntry.LOGS_REGISTER_URL.getString();
final String logsRegisterPassword = TFM_ConfigEntry.LOGS_REGISTER_PASSWORD.getString();
final String logsRegisterURL = TFM_ConfigEntry.LOGS_URL.getString();
final String logsRegisterPassword = TFM_ConfigEntry.LOGS_SECRET.getString();
if (logsRegisterURL == null || logsRegisterPassword == null || logsRegisterURL.isEmpty() || logsRegisterPassword.isEmpty())
{
@ -109,11 +108,11 @@ public class Command_logs extends TFM_Command
}.runTaskAsynchronously(TotalFreedomMod.plugin);
}
public static void deactivateSuperadmin(TFM_Superadmin superadmin)
public static void deactivateSuperadmin(TFM_Admin superadmin)
{
for (String ip : superadmin.getIps())
{
updateLogsRegistration(null, superadmin.getName(), ip, Command_logs.LogsRegistrationMode.DELETE);
updateLogsRegistration(null, superadmin.getLastLoginName(), ip, Command_logs.LogsRegistrationMode.DELETE);
}
}

View File

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

View File

@ -4,7 +4,13 @@ import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.*;
import org.bukkit.entity.Ambient;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Purge all mobs in all worlds.", usage = "/<command>")

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import org.bukkit.ChatColor;
import org.bukkit.Material;

View File

@ -5,14 +5,14 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Goto the nether.", usage = "/<command>")
public class Command_nether extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
TFM_Util.gotoWorld(sender, server.getWorlds().get(0).getName() + "_nether");
TFM_Util.gotoWorld(sender_p, server.getWorlds().get(0).getName() + "_nether");
return true;
}
}

View File

@ -5,7 +5,8 @@ import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@ -34,20 +35,14 @@ public class Command_nf extends TFM_Command
if (matcher.find())
{
String displayName = matcher.group(1);
try
{
player = getPlayerByDisplayName(displayName);
}
catch (PlayerNotFoundException ex)
{
}
if (player == null)
{
try
{
player = getPlayerByDisplayNameAlt(displayName);
}
catch (PlayerNotFoundException ex)
if (player == null)
{
sender.sendMessage(ChatColor.GRAY + "Can't find player by nickname: " + displayName);
return true;
@ -74,18 +69,24 @@ public class Command_nf extends TFM_Command
}
String newCommand = StringUtils.join(outputCommand, " ");
if (TFM_CommandBlocker.isCommandBlocked(newCommand, sender))
{
// CommandBlocker handles messages and broadcasts
return true;
}
sender.sendMessage("Sending command: \"" + newCommand + "\".");
server.dispatchCommand(sender, newCommand);
return true;
}
private static Player getPlayerByDisplayName(String needle) throws PlayerNotFoundException
private static Player getPlayerByDisplayName(String needle)
{
needle = needle.toLowerCase().trim();
Player[] onlinePlayers = Bukkit.getOnlinePlayers();
for (Player player : onlinePlayers)
for (Player player : Bukkit.getOnlinePlayers())
{
if (player.getDisplayName().toLowerCase().trim().contains(needle))
{
@ -93,18 +94,17 @@ public class Command_nf extends TFM_Command
}
}
throw new PlayerNotFoundException();
return null;
}
private static Player getPlayerByDisplayNameAlt(String needle) throws PlayerNotFoundException
private static Player getPlayerByDisplayNameAlt(String needle)
{
needle = needle.toLowerCase().trim();
Integer minEditDistance = null;
Player minEditMatch = null;
Player[] onlinePlayers = Bukkit.getOnlinePlayers();
for (Player player : onlinePlayers)
for (Player player : Bukkit.getOnlinePlayers())
{
String haystack = player.getDisplayName().toLowerCase().trim();
int editDistance = StringUtils.getLevenshteinDistance(needle, haystack.toLowerCase());
@ -115,11 +115,6 @@ public class Command_nf extends TFM_Command
}
}
if (minEditMatch == null)
{
throw new PlayerNotFoundException();
}
return minEditMatch;
}
}

View File

@ -0,0 +1,50 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Essentials Interface Command - Remove distracting things from nicknames of all players on server.", usage = "/<command>", aliases = "nc")
public class Command_nickclean extends TFM_Command
{
private static final ChatColor[] BLOCKED = new ChatColor[]
{
ChatColor.MAGIC,
ChatColor.STRIKETHROUGH,
ChatColor.ITALIC,
ChatColor.UNDERLINE,
ChatColor.BLACK
};
private static final Pattern REGEX = Pattern.compile("\\u00A7[" + StringUtils.join(BLOCKED, "") + "]");
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
TFM_Util.adminAction(sender.getName(), "Cleaning all nicknames.", false);
for (final Player player : server.getOnlinePlayers())
{
final String playerName = player.getName();
final String nickName = TFM_EssentialsBridge.getNickname(playerName);
if (nickName != null && !nickName.isEmpty() && !nickName.equalsIgnoreCase(playerName))
{
final Matcher matcher = REGEX.matcher(nickName);
if (matcher.find())
{
final String newNickName = matcher.replaceAll("");
playerMsg(ChatColor.RESET + playerName + ": \"" + nickName + ChatColor.RESET + "\" -> \"" + newNickName + ChatColor.RESET + "\".");
TFM_EssentialsBridge.setNickname(playerName, newNickName);
}
}
}
return true;
}
}

View File

@ -1,7 +1,8 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_EssentialsBridge;
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -19,9 +20,9 @@ public class Command_nicknyan extends TFM_Command
return false;
}
if (TFM_Util.isStopCommand(args[0]))
if ("off".equals(args[0]))
{
TFM_EssentialsBridge.getInstance().setNickname(sender.getName(), null);
TFM_EssentialsBridge.setNickname(sender.getName(), null);
playerMsg("Nickname cleared.");
return true;
}
@ -39,8 +40,7 @@ public class Command_nicknyan extends TFM_Command
return true;
}
final Player[] onlinePlayers = server.getOnlinePlayers();
for (final Player player : onlinePlayers)
for (Player player : Bukkit.getOnlinePlayers())
{
if (player == sender_p)
{
@ -63,7 +63,7 @@ public class Command_nicknyan extends TFM_Command
newNick.append(ChatColor.WHITE);
TFM_EssentialsBridge.getInstance().setNickname(sender.getName(), newNick.toString());
TFM_EssentialsBridge.setNickname(sender.getName(), newNick.toString());
playerMsg("Your nickname is now: " + newNick.toString());

View File

@ -1,57 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true)
@CommandParameters(description = "Attempt to detect \"invisible griefers\" and \"nukers\".", usage = "/<command> <on | off> [range] [blockrate]")
public class Command_nonuke extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length < 1)
{
return false;
}
if (args.length >= 2)
{
try
{
TFM_ConfigEntry.NUKE_MONITOR_RANGE.setDouble(Math.max(1.0, Math.min(500.0, Double.parseDouble(args[1]))));
}
catch (NumberFormatException nfex)
{
}
}
if (args.length >= 3)
{
try
{
TFM_ConfigEntry.NUKE_MONITOR_COUNT_BREAK.setInteger(Math.max(1, Math.min(500, Integer.parseInt(args[2]))));
}
catch (NumberFormatException nfex)
{
}
}
if (args[0].equalsIgnoreCase("on"))
{
TFM_ConfigEntry.NUKE_MONITOR.setBoolean(true);
playerMsg("Nuke monitor is enabled.");
playerMsg("Anti-freecam range is set to " + TFM_ConfigEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks.");
playerMsg("Block throttle rate is set to " + TFM_ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds.");
}
else
{
TFM_ConfigEntry.NUKE_MONITOR.setBoolean(false);
playerMsg("Nuke monitor is disabled.");
}
return true;
}
}

View File

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

View File

@ -1,10 +1,9 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -26,9 +25,9 @@ public class Command_onlinemode extends TFM_Command
{
boolean online_mode;
if (sender instanceof Player && !TFM_SuperadminList.isSeniorAdmin(sender, true))
if (sender instanceof Player && !TFM_AdminList.isSeniorAdmin(sender, true))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
playerMsg(TFM_Command.MSG_NO_PERMS);
return true;
}

View File

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

View File

@ -1,7 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -35,7 +34,7 @@ public class Command_opall extends TFM_Command
for (Player player : server.getOnlinePlayers())
{
player.setOp(true);
player.sendMessage(TotalFreedomMod.YOU_ARE_OP);
player.sendMessage(TFM_Command.YOU_ARE_OP);
if (doSetGamemode)
{

View File

@ -1,7 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -15,7 +14,7 @@ public class Command_opme extends TFM_Command
{
TFM_Util.adminAction(sender.getName(), "Opping " + sender.getName(), false);
sender.setOp(true);
sender.sendMessage(TotalFreedomMod.YOU_ARE_OP);
sender.sendMessage(TFM_Command.YOU_ARE_OP);
return true;
}

View File

@ -1,79 +1,65 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
@CommandParameters(description = "Manage operators", usage = "/<command> <count | list | purge>")
@CommandParameters(description = "Manager operators", usage = "/<command> <count | purge>")
public class Command_ops extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length < 1 || args.length > 1)
if (args.length != 1)
{
return false;
}
if (args[0].equalsIgnoreCase("list"))
if (args[0].equals("count"))
{
TFM_Util.playerMsg(sender, "Operators: " + TFM_Util.playerListToNames(server.getOperators()));
return true;
int totalOps = server.getOperators().size();
int onlineOps = 0;
for (Player player : server.getOnlinePlayers())
{
if (player.isOp())
{
onlineOps++;
}
}
if (args[0].equalsIgnoreCase("count"))
{
int onlineOPs = 0;
int offlineOPs = 0;
int totalOPs = 0;
for (OfflinePlayer player : server.getOperators())
{
if (player.isOnline())
{
onlineOPs++;
}
else
{
offlineOPs++;
}
totalOPs++;
}
playerMsg("Online OPs: " + onlineOPs);
playerMsg("Offline OPs: " + offlineOPs);
playerMsg("Total OPs: " + totalOPs);
playerMsg("Online OPs: " + onlineOps);
playerMsg("Offline OPs: " + (totalOps - onlineOps));
playerMsg("Total OPs: " + totalOps);
return true;
}
if (args[0].equalsIgnoreCase("purge"))
if (args[0].equals("purge"))
{
if (!senderIsConsole)
if (!TFM_AdminList.isSuperAdmin(sender))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
playerMsg(TFM_Command.MSG_NO_PERMS);
return true;
}
TFM_Util.adminAction(sender.getName(), "Removing all operators", true);
TFM_Util.adminAction(sender.getName(), "Purging all operators", true);
for (OfflinePlayer player : server.getOperators())
{
player.setOp(false);
if (player.isOnline())
{
player.getPlayer().sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
playerMsg(player.getPlayer(), TFM_Command.YOU_ARE_NOT_OP);
}
}
return true;
}
return true;
return false;
}
}

View File

@ -10,7 +10,8 @@ import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "POW!!! Right in the kisser! One of these days Alice, straight to the Moon!", usage = "/<command> <target> [power]")
@CommandParameters(description = "POW!!! Right in the kisser! One of these days Alice, straight to the Moon!",
usage = "/<command> <target> [<<power> | stop>]")
public class Command_orbit extends TFM_Command
{
@Override
@ -21,14 +22,11 @@ public class Command_orbit extends TFM_Command
return false;
}
Player player;
try
Player player = getPlayer(args[0]);
if (player == null)
{
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(TFM_Command.PLAYER_NOT_FOUND, ChatColor.RED);
return true;
}
@ -38,7 +36,7 @@ public class Command_orbit extends TFM_Command
if (args.length >= 2)
{
if (TFM_Util.isStopCommand(args[1]))
if (args[1].equals("stop"))
{
playerMsg("Stopped orbiting " + player.getName());
playerdata.stopOrbiting();
@ -60,7 +58,7 @@ public class Command_orbit extends TFM_Command
playerdata.startOrbiting(strength);
player.setVelocity(new Vector(0, strength, 0));
TFM_Util.adminAction(sender.getName(), "Orbiting " + player.getName() + ".", false);
TFM_Util.adminAction(sender.getName(), "Orbiting " + player.getName(), false);
return true;
}

View File

@ -1,13 +1,13 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import me.StevenLawson.TotalFreedomMod.TFM_PermbanList;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, block_host_console = true)
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(description = "Manage permanently banned players and IPs.", usage = "/<command> <list | reload>")
public class Command_permban extends TFM_Command
{
@ -27,11 +27,11 @@ public class Command_permban extends TFM_Command
{
if (!senderIsConsole)
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
sender.sendMessage(TFM_Command.MSG_NO_PERMS);
return true;
}
playerMsg("Reloading permban list...", ChatColor.RED);
TotalFreedomMod.loadPermbanConfig();
TFM_PermbanList.load();
dumplist(sender);
}
else
@ -44,24 +44,24 @@ public class Command_permban extends TFM_Command
private void dumplist(CommandSender sender)
{
if (TotalFreedomMod.permbannedPlayers.isEmpty())
if (TFM_PermbanList.getPermbannedPlayers().isEmpty())
{
playerMsg(sender, "No permanently banned player names.");
playerMsg("No permanently banned player names.");
}
else
{
playerMsg(sender, TotalFreedomMod.permbannedPlayers.size() + " permanently banned players:");
playerMsg(sender, StringUtils.join(TotalFreedomMod.permbannedPlayers, ", "));
playerMsg(TFM_PermbanList.getPermbannedPlayers().size() + " permanently banned players:");
playerMsg(StringUtils.join(TFM_PermbanList.getPermbannedPlayers(), ", "));
}
if (TotalFreedomMod.permbannedIps.isEmpty())
if (TFM_PermbanList.getPermbannedIps().isEmpty())
{
playerMsg(sender, "No permanently banned IPs.");
playerMsg("No permanently banned IPs.");
}
else
{
playerMsg(sender, TotalFreedomMod.permbannedIps.size() + " permanently banned IPs:");
playerMsg(sender, StringUtils.join(TotalFreedomMod.permbannedIps, ", "));
playerMsg(TFM_PermbanList.getPermbannedIps().size() + " permanently banned IPs:");
playerMsg(StringUtils.join(TFM_PermbanList.getPermbannedIps(), ", "));
}
}
}

View File

@ -1,28 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Enable/disable tamed pet protection.", usage = "/<command> <on | off>")
public class Command_petprotect extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length != 1)
{
return false;
}
TFM_Util.adminAction(
sender.getName(),
"Tamed pet protection is now " + (TFM_ConfigEntry.PET_PROTECT_ENABLED.setBoolean(!TFM_Util.isStopCommand(args[0])) ? "enabled" : "disabled") + ".",
false);
return true;
}
}

View File

@ -1,6 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -8,122 +9,142 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH)
@CommandParameters(description = "Enable / disable plugins.", usage = "/<command> < <enable | disable> <pluginname> | list >", aliases = "plc")
@CommandParameters(description = "Manage plugins", usage = "/<command> <<enable | disable | reload> <pluginname>> | list>", aliases = "plc")
public class Command_plugincontrol extends TFM_Command
{
private enum CommandMode
{
ENABLE, DISABLE, LIST, RELOAD
}
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
CommandMode commandMode = null;
if (args.length == 0 || args.length > 2)
{
return false;
}
final PluginManager pm = server.getPluginManager();
if (args.length == 1)
{
if (args[0].equalsIgnoreCase("list"))
{
commandMode = CommandMode.LIST;
}
else if (args[0].equalsIgnoreCase("reload"))
for (Plugin serverPlugin : pm.getPlugins())
{
commandMode = CommandMode.RELOAD;
}
}
else if (args.length >= 2)
{
if (args[0].equalsIgnoreCase("enable"))
{
commandMode = CommandMode.ENABLE;
}
else if (args[0].equalsIgnoreCase("disable"))
{
commandMode = CommandMode.DISABLE;
}
final String version = serverPlugin.getDescription().getVersion();
playerMsg(ChatColor.GRAY + "- " + (serverPlugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED) + serverPlugin.getName()
+ ChatColor.GOLD + (version != null && !version.isEmpty() ? " v" + version : "") + " by "
+ StringUtils.join(serverPlugin.getDescription().getAuthors(), ", "));
}
return true;
}
if (commandMode == null)
{
return false;
}
PluginManager pluginManager = plugin.getServer().getPluginManager();
if (commandMode == CommandMode.LIST)
if ("enable".equals(args[0]))
{
playerMsg("Plugins: " + StringUtils.join(pluginManager.getPlugins(), ", "));
}
else if (commandMode == CommandMode.RELOAD)
final Plugin target = getPlugin(args[1]);
if (target == null)
{
playerMsg("Disabling all plugins.");
for (Plugin targetPlugin : pluginManager.getPlugins())
{
if (!targetPlugin.getName().toLowerCase().startsWith("totalfreedommod"))
{
pluginManager.disablePlugin(targetPlugin);
}
}
playerMsg("Enabling all plugins.");
for (Plugin targetPlugin : pluginManager.getPlugins())
{
if (!targetPlugin.getName().toLowerCase().startsWith("totalfreedommod"))
{
pluginManager.enablePlugin(targetPlugin);
}
}
}
else
{
final String searchPluginName = args[1].toLowerCase().trim();
Plugin targetPlugin = null;
for (Plugin serverPlugin : pluginManager.getPlugins())
{
if (searchPluginName.equalsIgnoreCase(serverPlugin.getName().toLowerCase().trim()))
{
targetPlugin = serverPlugin;
break;
}
}
if (targetPlugin == null)
{
playerMsg("Plugin \"" + searchPluginName + "\" is not installed.");
playerMsg("Plugin not found!");
return true;
}
else
if (target.isEnabled())
{
if (commandMode == CommandMode.ENABLE)
{
pluginManager.enablePlugin(targetPlugin);
if (targetPlugin.isEnabled())
{
playerMsg("Plugin \"" + targetPlugin.getName() + "\" enabled.");
playerMsg("Plugin is already enabled.");
return true;
}
else
pm.enablePlugin(target);
if (!pm.isPluginEnabled(target))
{
playerMsg("Error enabling plugin \"" + targetPlugin.getName() + "\".");
playerMsg("Error enabling plugin " + target.getName());
return true;
}
playerMsg(target.getName() + " is now enabled.");
return true;
}
if ("disable".equals(args[0]))
{
final Plugin target = getPlugin(args[1]);
if (target == null)
{
playerMsg("Plugin not found!");
return true;
}
if (!target.isEnabled())
{
playerMsg("Plugin is already disabled.");
return true;
}
if (target.getName().equals(plugin.getName()))
{
playerMsg("You cannot disable " + plugin.getName());
return true;
}
pm.disablePlugin(target);
if (pm.isPluginEnabled(target))
{
playerMsg("Error disabling plugin " + target.getName());
return true;
}
playerMsg(target.getName() + " is now disabled.");
return true;
}
if ("reload".equals(args[0]))
{
final Plugin target = getPlugin(args[1]);
if (target == null)
{
playerMsg("Plugin not found!");
return true;
}
if (target.getName().equals(plugin.getName()))
{
playerMsg("Use /tfm reload to reload instead.");
return true;
}
pm.disablePlugin(target);
pm.enablePlugin(target);
playerMsg(target.getName() + " reloaded.");
return true;
}
return false;
}
public Plugin getPlugin(String name)
{
for (Plugin serverPlugin : server.getPluginManager().getPlugins())
{
if (serverPlugin.getName().equalsIgnoreCase(name))
{
return serverPlugin;
}
}
else
if (name.length() >= 3)
{
pluginManager.disablePlugin(targetPlugin);
if (!targetPlugin.isEnabled())
for (Plugin serverPlugin : server.getPluginManager().getPlugins())
{
playerMsg("Plugin \"" + targetPlugin.getName() + "\" disabled.");
}
else
if (serverPlugin.getName().toLowerCase().contains(name.toLowerCase()))
{
playerMsg("Error disabling plugin \"" + targetPlugin.getName() + "\".");
}
return serverPlugin;
}
}
}
return true;
return null;
}
}

View File

@ -2,10 +2,9 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -38,9 +37,9 @@ public class Command_potion extends TFM_Command
}
else if (args[0].equalsIgnoreCase("clearall"))
{
if (!(TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole))
if (!(TFM_AdminList.isSuperAdmin(sender) || senderIsConsole))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
playerMsg(TFM_Command.MSG_NO_PERMS);
return true;
}
TFM_Util.adminAction(sender.getName(), "Cleared all potion effects from all players", true);
@ -57,21 +56,19 @@ public class Command_potion extends TFM_Command
Player target = sender_p;
if (args.length == 2)
{
try
{
target = getPlayer(args[1]);
}
catch (PlayerNotFoundException ex)
if (target == null)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(TFM_Command.PLAYER_NOT_FOUND, ChatColor.RED);
return true;
}
}
if (!target.equals(sender_p))
{
if (!TFM_SuperadminList.isUserSuperadmin(sender))
if (!TFM_AdminList.isSuperAdmin(sender))
{
playerMsg("Only superadmins can clear potion effects from other players.");
return true;
@ -103,20 +100,19 @@ public class Command_potion extends TFM_Command
if (args.length == 5)
{
try
{
target = getPlayer(args[4]);
}
catch (PlayerNotFoundException ex)
if (target == null)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(TFM_Command.PLAYER_NOT_FOUND, ChatColor.RED);
return true;
}
}
if (!target.equals(sender_p))
{
if (!TFM_SuperadminList.isUserSuperadmin(sender))
if (!TFM_AdminList.isSuperAdmin(sender))
{
sender.sendMessage("Only superadmins can apply potion effects to other players.");
return true;
@ -139,6 +135,7 @@ public class Command_potion extends TFM_Command
try
{
duration = Integer.parseInt(args[2]);
duration = Math.min(duration, 100000);
}
catch (NumberFormatException ex)
{
@ -150,6 +147,7 @@ public class Command_potion extends TFM_Command
try
{
amplifier = Integer.parseInt(args[3]);
amplifier = Math.min(amplifier, 100000);
}
catch (NumberFormatException ex)
{

View File

@ -1,35 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true)
@CommandParameters(
description = "Enable/disable the command prelogger. When this is on, logs will be filled with many duplicate messages.",
usage = "/<command> <on | off>")
public class Command_prelog extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length != 1)
{
return false;
}
if (args[0].equalsIgnoreCase("on"))
{
TFM_ConfigEntry.PREPROCESS_LOG_ENABLED.setBoolean(true);
playerMsg("Command preprocess logging is now enabled. This will be spammy in the log.");
}
else
{
TFM_ConfigEntry.PREPROCESS_LOG_ENABLED.setBoolean(false);
playerMsg("Command preprocess logging is now disabled.");
}
return true;
}
}

View File

@ -23,17 +23,18 @@ public class Command_premium extends TFM_Command
return false;
}
String name;
try
final Player player = getPlayer(args[0]);
final String name;
if (player != null)
{
name = getPlayer(args[0]).getName();
name = player.getName();
}
catch (PlayerNotFoundException ex)
else
{
name = args[0];
}
final String playername = name;
new BukkitRunnable()
{
@Override
@ -41,7 +42,7 @@ public class Command_premium extends TFM_Command
{
try
{
final URL getUrl = new URL("https://minecraft.net/haspaid.jsp?user=" + playername);
final URL getUrl = new URL("https://minecraft.net/haspaid.jsp?user=" + name);
final URLConnection urlConnection = getUrl.openConnection();
// Read the response
final BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
@ -53,7 +54,7 @@ public class Command_premium extends TFM_Command
@Override
public void run()
{
playerMsg("Player " + playername + " is premium: " + message);
playerMsg("Player " + name + " is premium: " + message);
}
}.runTask(plugin);

View File

@ -1,9 +1,8 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -14,10 +13,11 @@ import org.bukkit.entity.Player;
usage = "/<command> <list | clear | remove <label> | add <label> <radius>>")
public class Command_protectarea extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean())
if (!TFM_ConfigEntry.PROTECTAREA_ENABLED.getBoolean())
{
playerMsg("Protected areas are currently disabled in the TotalFreedomMod configuration.");
return true;
@ -44,7 +44,7 @@ public class Command_protectarea extends TFM_Command
}
else if (args.length == 2)
{
if (TFM_Util.isRemoveCommand(args[0]))
if ("remove".equals(args[0]))
{
TFM_ProtectedArea.removeProtectedArea(args[1]);

View File

@ -1,9 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_DisguiseCraftBridge;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -21,9 +19,6 @@ public class Command_purgeall extends TFM_Command
// Purge entities
TFM_Util.TFM_EntityWiper.wipeEntities(true, true);
// Undisguise all players
TFM_DisguiseCraftBridge.undisguiseAllPlayers();
for (Player player : server.getOnlinePlayers())
{
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
@ -73,17 +68,8 @@ public class Command_purgeall extends TFM_Command
}
}
// Clear auto-unmute and auto-unfreeze tasks
if (TotalFreedomMod.mutePurgeTask != null)
{
TotalFreedomMod.mutePurgeTask.cancel();
}
TotalFreedomMod.allPlayersFrozen = false;
if (TotalFreedomMod.freezePurgeTask != null)
{
TotalFreedomMod.freezePurgeTask.cancel();
}
// Unfreeze all players
Command_fr.setAllFrozen(false);
// Remove all mobs
Command_mp.purgeMobs();

View File

@ -1,7 +1,9 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -24,26 +26,30 @@ public class Command_qdeop extends TFM_Command
silent = args[1].equalsIgnoreCase("-s");
}
boolean matched_player = false;
final String targetName = args[0].toLowerCase();
String targetName = args[0].toLowerCase();
for (Player player : server.getOnlinePlayers())
final List<String> matchedPlayerNames = new ArrayList<String>();
for (final Player player : server.getOnlinePlayers())
{
if (player.getName().toLowerCase().indexOf(targetName) != -1 || player.getDisplayName().toLowerCase().indexOf(targetName) != -1)
if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName))
{
matched_player = true;
if (player.isOp())
{
matchedPlayerNames.add(player.getName());
player.setOp(false);
player.sendMessage(TFM_Command.YOU_ARE_NOT_OP);
}
}
}
if (!matchedPlayerNames.isEmpty())
{
if (!silent)
{
TFM_Util.adminAction(sender.getName(), "De-opping " + player.getName(), false);
}
player.setOp(false);
player.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
TFM_Util.adminAction(sender.getName(), "De-opping " + StringUtils.join(matchedPlayerNames, ", "), false);
}
}
if (!matched_player)
else
{
playerMsg("No targets matched.");
}

View File

@ -1,12 +1,14 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
@CommandParameters(description = "Quick Op - op someone based on a partial name.", usage = "/<command> <partialname>")
public class Command_qop extends TFM_Command
{
@ -24,26 +26,30 @@ public class Command_qop extends TFM_Command
silent = args[1].equalsIgnoreCase("-s");
}
boolean matched_player = false;
final String targetName = args[0].toLowerCase();
String targetName = args[0].toLowerCase();
for (Player player : server.getOnlinePlayers())
final List<String> matchedPlayerNames = new ArrayList<String>();
for (final Player player : server.getOnlinePlayers())
{
if (player.getName().toLowerCase().indexOf(targetName) != -1 || player.getDisplayName().toLowerCase().indexOf(targetName) != -1)
if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName))
{
matched_player = true;
if (!player.isOp())
{
matchedPlayerNames.add(player.getName());
player.setOp(true);
player.sendMessage(TFM_Command.YOU_ARE_OP);
}
}
}
if (!matchedPlayerNames.isEmpty())
{
if (!silent)
{
TFM_Util.adminAction(sender.getName(), "Opping " + player.getName(), false);
}
player.setOp(true);
player.sendMessage(TotalFreedomMod.YOU_ARE_OP);
TFM_Util.adminAction(sender.getName(), "Opping " + StringUtils.join(matchedPlayerNames, ", "), false);
}
}
if (!matched_player)
else
{
playerMsg("No targets matched.");
}

View File

@ -33,14 +33,11 @@ public class Command_rank extends TFM_Command
return true;
}
Player player;
try
final Player player = getPlayer(args[0]);
if (player == null)
{
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}

View File

@ -1,12 +1,12 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true)
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandParameters(description = "Broadcasts the given message. Supports colors.", usage = "/<command> <message>")
public class Command_rawsay extends TFM_Command
{

View File

@ -13,7 +13,7 @@ public class Command_rd extends TFM_Command
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
TFM_Util.adminAction(sender.getName(), "Removing all server entities.", true);
playerMsg((TFM_Util.TFM_EntityWiper.wipeEntities(true, true)) + " enties removed.");
playerMsg((TFM_Util.TFM_EntityWiper.wipeEntities(true, true)) + " entities removed.");
return true;
}

View File

@ -0,0 +1,54 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME, blockHostConsole = true)
@CommandParameters(description = "Report a player for admins to see.", usage = "/<command> <player> <reason>")
public class Command_report extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length < 2)
{
return false;
}
Player player = getPlayer(args[0]);
if (player == null)
{
playerMsg(PLAYER_NOT_FOUND);
return true;
}
if (sender instanceof Player)
{
if (player.equals(sender_p))
{
playerMsg(ChatColor.RED + "Please, don't try to report yourself.");
return true;
}
}
if (TFM_AdminList.isSuperAdmin(player))
{
playerMsg(ChatColor.RED + "You can not report an admin.");
return true;
}
String report = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
TFM_Util.reportAction(sender_p, player, report);
playerMsg(ChatColor.GREEN + "Thank you, your report has been successfully logged.");
return true;
}
}

View File

@ -1,13 +1,19 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, block_host_console = false)
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, blockHostConsole = false)
@CommandParameters(description = "Remove all blocks of a certain type in the radius of certain players.", usage = "/<command> <block> [radius (default=50)] [player]")
public class Command_ro extends TFM_Command
{
@ -19,22 +25,29 @@ public class Command_ro extends TFM_Command
return false;
}
Material from_material = Material.matchMaterial(args[0]);
if (from_material == null)
final List<Material> materials = new ArrayList<Material>();
for (String materialName : StringUtils.split(args[0], ","))
{
Material fromMaterial = Material.matchMaterial(materialName);
if (fromMaterial == null)
{
try
{
from_material = Material.getMaterial(Integer.parseInt(args[0]));
fromMaterial = TFM_DepreciationAggregator.getMaterial(Integer.parseInt(materialName));
}
catch (NumberFormatException ex)
{
}
}
if (from_material == null)
if (fromMaterial == null)
{
playerMsg("Invalid block: " + args[0], ChatColor.RED);
playerMsg("Invalid block: " + materialName, ChatColor.RED);
return true;
}
materials.add(fromMaterial);
}
int radius = 20;
@ -51,37 +64,63 @@ public class Command_ro extends TFM_Command
}
}
Player targetPlayer = null;
final Player targetPlayer;
if (args.length == 3)
{
try
{
targetPlayer = getPlayer(args[2]);
}
catch (PlayerNotFoundException ex)
{
playerMsg(ex.getMessage(), ChatColor.RED);
return true;
}
}
int affected = 0;
if (targetPlayer == null)
{
TFM_Util.adminAction(sender.getName(), "Removing all " + from_material.name() + " within " + radius + " blocks of all players. Brace for lag...", senderIsConsole);
for (Player player : server.getOnlinePlayers())
{
affected += TFM_Util.replaceBlocks(player.getLocation(), from_material, Material.AIR, radius);
playerMsg(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
}
else
{
TFM_Util.adminAction(sender.getName(), "Removing all " + from_material.name() + " within " + radius + " blocks of " + targetPlayer.getName() + ".", senderIsConsole);
affected += TFM_Util.replaceBlocks(targetPlayer.getLocation(), from_material, Material.AIR, radius);
targetPlayer = null;
}
TFM_Util.adminAction(sender.getName(), "Remove complete. " + affected + " blocks removed.", senderIsConsole);
final String names = StringUtils.join(materials, ", ");
World adminWorld = null;
try
{
adminWorld = TFM_AdminWorld.getInstance().getWorld();
}
catch (Exception ex)
{
}
int affected = 0;
if (targetPlayer == null)
{
TFM_Util.adminAction(sender.getName(), "Removing all " + names + " within " + radius + " blocks of all players... Brace for lag!", false);
for (final Player player : server.getOnlinePlayers())
{
if (player.getWorld() == adminWorld)
{
continue;
}
for (final Material material : materials)
{
affected += TFM_Util.replaceBlocks(player.getLocation(), material, Material.AIR, radius);
}
}
}
else
{
if (targetPlayer.getWorld() != adminWorld)
{
for (Material material : materials)
{
TFM_Util.adminAction(sender.getName(), "Removing all " + names + " within " + radius + " blocks of " + targetPlayer.getName(), false);
affected += TFM_Util.replaceBlocks(targetPlayer.getLocation(), material, Material.AIR, radius);
}
}
}
TFM_Util.adminAction(sender.getName(), "Remove complete! " + affected + " blocks removed.", false);
return true;
}

View File

@ -1,31 +1,35 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_RollbackManager;
import me.StevenLawson.TotalFreedomMod.TFM_UserList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, block_host_console = true)
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(description = "Issues a rollback on a player", usage = "/<command> <[partialname] | undo [partialname] purge [partialname] | purgeall>", aliases = "rb")
public class Command_rollback extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length == 0 || args.length > 2)
{
return false;
}
if (args.length == 1)
{
if ("purgeall".equalsIgnoreCase(args[0]))
if ("purgeall".equals(args[0]))
{
TFM_Util.adminAction(sender.getName(), "Purging all rollback history", false);
playerMsg("Purged all rollback history for " + TFM_RollbackManager.purgeEntries() + " players.");
}
else
{
String playerName = getPlayerName(args[0]);
final String playerName = TFM_RollbackManager.findPlayer(args[0]);
if (!TFM_RollbackManager.canRollback(playerName))
if (playerName == null)
{
playerMsg("That player has no entries stored.");
return true;
@ -38,28 +42,32 @@ public class Command_rollback extends TFM_Command
TFM_Util.adminAction(sender.getName(), "Rolling back player: " + playerName, false);
playerMsg("Rolled back " + TFM_RollbackManager.rollback(playerName) + " edits for " + playerName + ".");
playerMsg("If this rollback was a mistake, use /rollback undo " + playerName + " within 20 seconds to reverse the rollback.");
playerMsg("If this rollback was a mistake, use /rollback undo " + playerName + " within 40 seconds to reverse the rollback.");
}
return true;
}
else if (args.length == 2)
if (args.length == 2)
{
if ("purge".equalsIgnoreCase(args[0]))
{
String playerName = getPlayerName(args[1]);
final String playerName = TFM_RollbackManager.findPlayer(args[1]);
if (!TFM_RollbackManager.canRollback(playerName))
if (playerName == null)
{
playerMsg("That player has no entries stored.");
return true;
}
playerMsg("Purged " + TFM_RollbackManager.purgeEntries(playerName) + " rollback history entries for " + playerName + ".");
return true;
}
else if ("undo".equalsIgnoreCase(args[0]))
{
String playerName = getPlayerName(args[1]);
if (!TFM_RollbackManager.canUndoRollback(playerName))
if ("undo".equalsIgnoreCase(args[0]))
{
final String playerName = TFM_RollbackManager.findPlayer(args[1]);
if (playerName == null)
{
playerMsg("That player hasn't been rolled back recently.");
return true;
@ -67,41 +75,10 @@ public class Command_rollback extends TFM_Command
TFM_Util.adminAction(sender.getName(), "Reverting rollback for player: " + playerName, false);
playerMsg("Reverted " + TFM_RollbackManager.undoRollback(playerName) + " edits for " + playerName + ".");
}
else
{
return false;
}
}
else
{
return false;
}
return true;
}
private String getPlayerName(String playerNameInput)
{
String playerName = null;
try
{
Player player = getPlayer(playerNameInput);
if (player != null)
{
playerName = player.getName();
}
}
catch (PlayerNotFoundException ex)
{
}
if (playerName == null)
{
playerName = TFM_UserList.getInstance(plugin).searchByPartialName(playerNameInput);
}
return playerName;
return false;
}
}

View File

@ -1,74 +1,112 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_Superadmin;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_Admin;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_TwitterHandler;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
@CommandParameters(description = "Manage superadmins.", usage = "/<command> <list | clean | <add|delete|info> <username>>")
@CommandParameters(description = "Manage superadmins.", usage = "/<command> <list | clean | clearme [ip] | <add | delete | info> <username>>")
public class Command_saconfig extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length == 1)
final SAConfigMode mode;
try
{
if (args[0].equals("list"))
{
playerMsg("Superadmins: " + StringUtils.join(TFM_SuperadminList.getSuperadminNames(), ", "), ChatColor.GOLD);
mode = SAConfigMode.findMode(args, sender, senderIsConsole);
}
else
catch (final PermissionsException ex)
{
if (!TFM_SuperadminList.isSeniorAdmin(sender, true))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
playerMsg(ex.getMessage());
return true;
}
if (args[0].equals("clean"))
{
TFM_Util.adminAction(sender.getName(), "Cleaning superadmin list", true);
TFM_SuperadminList.cleanSuperadminList(true);
playerMsg("Superadmins: " + StringUtils.join(TFM_SuperadminList.getSuperadminNames(), ", "), ChatColor.YELLOW);
}
else
catch (final FormatException ex)
{
playerMsg(ex.getMessage());
return false;
}
return true;
switch (mode)
{
case LIST:
{
playerMsg("Superadmins: " + StringUtils.join(TFM_AdminList.getSuperNames(), ", "), ChatColor.GOLD);
break;
}
case CLEAN:
{
TFM_Util.adminAction(sender.getName(), "Cleaning superadmin list", true);
TFM_AdminList.cleanSuperadminList(true);
playerMsg("Superadmins: " + StringUtils.join(TFM_AdminList.getSuperNames(), ", "), ChatColor.YELLOW);
break;
}
case CLEARME:
{
final TFM_Admin admin = TFM_AdminList.getEntry(sender_p);
final String ip = TFM_Util.getIp(sender_p);
if (args.length == 1)
{
TFM_Util.adminAction(sender.getName(), "Cleaning my supered IPs", true);
int counter = admin.getIps().size() - 1;
admin.clearIPs();
admin.addIp(ip);
TFM_AdminList.saveAll();
playerMsg(counter + " IPs removed.");
playerMsg(admin.getIps().get(0) + " is now your only IP address");
}
else
{
if (!admin.getIps().contains(args[1]))
{
playerMsg("That IP is not registered to you.");
}
else if (ip.equals(args[1]))
{
playerMsg("You cannot remove your current IP.");
}
else
{
TFM_Util.adminAction(sender.getName(), "Removing a supered IP", true);
admin.removeIp(args[1]);
TFM_AdminList.saveAll();
playerMsg("Removed IP " + args[1]);
playerMsg("Current IPs: " + StringUtils.join(admin.getIps(), ", "));
}
}
return true;
break;
}
else if (args.length == 2)
case INFO:
{
if (args[0].equalsIgnoreCase("info"))
{
if (!TFM_SuperadminList.isUserSuperadmin(sender))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
TFM_Superadmin superadmin = TFM_SuperadminList.getAdminEntry(args[1].toLowerCase());
TFM_Admin superadmin = TFM_AdminList.getEntry(args[1].toLowerCase());
if (superadmin == null)
{
try
{
superadmin = TFM_SuperadminList.getAdminEntry(getPlayer(args[1]).getName().toLowerCase());
}
catch (PlayerNotFoundException ex)
final Player player = getPlayer(args[1]);
if (player != null)
{
superadmin = TFM_AdminList.getEntry(player.getName().toLowerCase());
}
}
@ -78,95 +116,172 @@ public class Command_saconfig extends TFM_Command
}
else
{
playerMsg(ChatColor.stripColor(TFM_Util.colorize(superadmin.toString())));
playerMsg(superadmin.toString());
}
break;
}
case ADD:
{
OfflinePlayer player = getPlayer(args[1], true); // Exact case-insensitive match.
if (player == null)
{
final TFM_Admin superadmin = TFM_AdminList.getEntry(args[1]);
if (superadmin == null)
{
playerMsg(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
if (!senderIsConsole)
{
playerMsg("This command may only be used from the console.");
return true;
player = TFM_DepreciationAggregator.getOfflinePlayer(server, superadmin.getLastLoginName());
}
if (args[0].equalsIgnoreCase("add"))
{
Player player = null;
String admin_name = null;
TFM_Util.adminAction(sender.getName(), "Adding " + player.getName() + " to the superadmin list", true);
TFM_AdminList.addSuperadmin(player);
try
if (player.isOnline())
{
player = getPlayer(args[1]);
}
catch (PlayerNotFoundException ex)
final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player.getPlayer());
if (playerdata.isFrozen())
{
TFM_Superadmin superadmin = TFM_SuperadminList.getAdminEntry(args[1].toLowerCase());
if (superadmin != null)
{
admin_name = superadmin.getName();
}
else
{
playerMsg(ex.getMessage(), ChatColor.RED);
return true;
playerdata.setFrozen(false);
playerMsg(player.getPlayer(), "You have been unfrozen.");
}
}
break;
}
case DELETE:
{
String targetName = args[1];
final Player player = getPlayer(targetName, true); // Exact case-insensitive match.
if (player != null)
{
TFM_Util.adminAction(sender.getName(), "Adding " + player.getName() + " to the superadmin list.", true);
TFM_SuperadminList.addSuperadmin(player);
}
else if (admin_name != null)
{
TFM_Util.adminAction(sender.getName(), "Adding " + admin_name + " to the superadmin list.", true);
TFM_SuperadminList.addSuperadmin(admin_name);
}
}
else if (TFM_Util.isRemoveCommand(args[0]))
{
if (!TFM_SuperadminList.isSeniorAdmin(sender))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true;
targetName = player.getName();
}
String targetName = args[1];
try
{
targetName = getPlayer(targetName).getName();
}
catch (PlayerNotFoundException ex)
{
}
if (!TFM_SuperadminList.getSuperadminNames().contains(targetName.toLowerCase()))
if (!TFM_AdminList.getLowercaseSuperNames().contains(targetName.toLowerCase()))
{
playerMsg("Superadmin not found: " + targetName);
return true;
}
TFM_Util.adminAction(sender.getName(), "Removing " + targetName + " from the superadmin list", true);
TFM_SuperadminList.removeSuperadmin(targetName);
TFM_AdminList.removeSuperadmin(TFM_DepreciationAggregator.getOfflinePlayer(server, targetName));
// Twitterbot
if (TFM_ConfigEntry.TWITTERBOT_ENABLED.getBoolean())
{
TFM_TwitterHandler.getInstance().delTwitterVerbose(targetName, sender);
TFM_TwitterHandler.delTwitterVerbose(targetName, sender);
}
break;
}
else
{
return false;
}
return true;
}
private static enum SAConfigMode
{
LIST("list", AdminLevel.OP, SourceType.BOTH, 1, 1),
CLEAN("clean", AdminLevel.SENIOR, SourceType.BOTH, 1, 1),
CLEARME("clearme", AdminLevel.SUPER, SourceType.ONLY_IN_GAME, 1, 2),
INFO("info", AdminLevel.SUPER, SourceType.BOTH, 2, 2),
ADD("add", AdminLevel.SUPER, SourceType.ONLY_CONSOLE, 2, 2),
DELETE("delete", AdminLevel.SENIOR, SourceType.ONLY_CONSOLE, 2, 2);
private final String modeName;
private final AdminLevel adminLevel;
private final SourceType sourceType;
private final int minArgs;
private final int maxArgs;
private SAConfigMode(String modeName, AdminLevel adminLevel, SourceType sourceType, int minArgs, int maxArgs)
{
this.modeName = modeName;
this.adminLevel = adminLevel;
this.sourceType = sourceType;
this.minArgs = minArgs;
this.maxArgs = maxArgs;
}
private static SAConfigMode findMode(final String[] args, final CommandSender sender, final boolean senderIsConsole) throws PermissionsException, FormatException
{
if (args.length == 0)
{
throw new FormatException("Invalid number of arguments.");
}
boolean isSuperAdmin = TFM_AdminList.isSuperAdmin(sender);
boolean isSeniorAdmin = isSuperAdmin ? TFM_AdminList.isSeniorAdmin(sender, false) : false;
for (final SAConfigMode mode : values())
{
if (mode.modeName.equalsIgnoreCase(args[0]))
{
if (mode.adminLevel == AdminLevel.SUPER)
{
if (!isSuperAdmin)
{
throw new PermissionsException(TFM_Command.MSG_NO_PERMS);
}
}
else if (mode.adminLevel == AdminLevel.SENIOR)
{
if (!isSeniorAdmin)
{
throw new PermissionsException(TFM_Command.MSG_NO_PERMS);
}
}
if (mode.sourceType == SourceType.ONLY_IN_GAME)
{
if (senderIsConsole)
{
throw new PermissionsException("This command may only be used in-game.");
}
}
else if (mode.sourceType == SourceType.ONLY_CONSOLE)
{
if (!senderIsConsole)
{
throw new PermissionsException("This command may only be used from the console.");
}
}
if (args.length >= mode.minArgs && args.length <= mode.maxArgs)
{
return mode;
}
else
{
return false;
throw new FormatException("Invalid number of arguments for mode: " + mode.modeName);
}
}
}
throw new FormatException("Invalid mode.");
}
}
private static class PermissionsException extends Exception
{
public PermissionsException(final String message)
{
super(message);
}
}
private static class FormatException extends Exception
{
public FormatException(final String message)
{
super(message);
}
}
}

View File

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

View File

@ -11,17 +11,18 @@ import org.bukkit.entity.Player;
@CommandParameters(description = "Shows the status of all Mojang services", usage = "/<command>")
public class Command_services extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
playerMsg("Mojang Services" + ChatColor.WHITE + ":", ChatColor.BLUE);
for (ServiceStatus service : TFM_ServiceChecker.getInstance().getAllStatuses())
for (ServiceStatus service : TFM_ServiceChecker.getAllStatuses())
{
playerMsg(service.getFormattedStatus());
}
playerMsg("Version" + ChatColor.WHITE + ": " + TFM_ServiceChecker.getInstance().getVersion(), ChatColor.DARK_PURPLE);
playerMsg("Last Check" + ChatColor.WHITE + ": " + TFM_ServiceChecker.getInstance().getLastCheck(), ChatColor.DARK_PURPLE);
playerMsg("Version" + ChatColor.WHITE + ": " + TFM_ServiceChecker.getVersion(), ChatColor.DARK_PURPLE);
playerMsg("Last Check" + ChatColor.WHITE + ": " + TFM_ServiceChecker.getLastCheck(), ChatColor.DARK_PURPLE);
return true;
}

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_WorldEditBridge;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TFM_WorldEditBridge;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -14,10 +14,9 @@ public class Command_setl extends TFM_Command
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
TFM_Util.adminAction(sender.getName(), "Setting everyone's Worldedit block modification limit to 500.", true);
TFM_WorldEditBridge web = TFM_WorldEditBridge.getInstance();
for (final Player player : server.getOnlinePlayers())
{
web.setLimit(player, 500);
TFM_WorldEditBridge.setLimit(player, 500);
}
return true;
}

View File

@ -1,6 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
@ -54,15 +55,15 @@ public class Command_setlever extends TFM_Command
final Location leverLocation = new Location(world, x, y, z);
final boolean leverOn = (args[4].trim().equalsIgnoreCase("on") || args[4].trim().equalsIgnoreCase("1")) ? true : false;
final boolean leverOn = (args[4].trim().equalsIgnoreCase("on") || args[4].trim().equalsIgnoreCase("1"));
final Block targetBlock = leverLocation.getBlock();
if (targetBlock.getType() == Material.LEVER)
{
org.bukkit.material.Lever lever = new org.bukkit.material.Lever(Material.LEVER, targetBlock.getData());
org.bukkit.material.Lever lever = TFM_DepreciationAggregator.makeLeverWithData(TFM_DepreciationAggregator.getData_Block(targetBlock));
lever.setPowered(leverOn);
targetBlock.setData(lever.getData());
TFM_DepreciationAggregator.setData_Block(targetBlock, TFM_DepreciationAggregator.getData_MaterialData(lever));
targetBlock.getState().update();
}
else

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.Location;
@ -20,9 +20,9 @@ public class Command_setspawnworld extends TFM_Command
playerMsg("Spawn location for this world set to: " + TFM_Util.formatLocation(sender_p.getWorld().getSpawnLocation()));
if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean() && TFM_ConfigEntry.AUTO_PROTECT_SPAWNPOINTS.getBoolean())
if (TFM_ConfigEntry.PROTECTAREA_ENABLED.getBoolean() && TFM_ConfigEntry.PROTECTAREA_SPAWNPOINTS.getBoolean())
{
TFM_ProtectedArea.addProtectedArea("spawn_" + sender_p.getWorld().getName(), pos, TFM_ConfigEntry.AUTO_PROTECT_RADIUS.getDouble());
TFM_ProtectedArea.addProtectedArea("spawn_" + sender_p.getWorld().getName(), pos, TFM_ConfigEntry.PROTECTAREA_RADIUS.getDouble());
}
return true;

View File

@ -21,14 +21,11 @@ public class Command_smite extends TFM_Command
return false;
}
Player player;
try
final Player player = getPlayer(args[0]);
if (player == null)
{
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(TFM_Command.PLAYER_NOT_FOUND);
return true;
}

View File

@ -1,22 +1,20 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Mutes a player with brute force.", usage = "/<command> [<player> | list | purge | all]", aliases = "mute")
@CommandParameters(description = "Mutes a player with brute force.", usage = "/<command> [<player> [-s] | list | purge | all]", aliases = "mute")
public class Command_stfu extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length != 1)
if (args.length == 0 || args.length > 2)
{
return false;
}
@ -54,10 +52,6 @@ public class Command_stfu extends TFM_Command
count++;
}
}
if (TotalFreedomMod.mutePurgeTask != null)
{
TotalFreedomMod.mutePurgeTask.cancel();
}
playerMsg("Unmuted " + count + " players.");
}
else if (args[0].equalsIgnoreCase("all"))
@ -68,7 +62,7 @@ public class Command_stfu extends TFM_Command
int counter = 0;
for (Player player : server.getOnlinePlayers())
{
if (!TFM_SuperadminList.isUserSuperadmin(player))
if (!TFM_AdminList.isSuperAdmin(player))
{
playerdata = TFM_PlayerData.getPlayerData(player);
playerdata.setMuted(true);
@ -76,36 +70,15 @@ public class Command_stfu extends TFM_Command
}
}
if (TotalFreedomMod.mutePurgeTask != null)
{
TotalFreedomMod.mutePurgeTask.cancel();
}
TotalFreedomMod.mutePurgeTask = new BukkitRunnable()
{
@Override
public void run()
{
TFM_Util.adminAction("MuteTimer", "Unmuting all players", false);
for (Player player : server.getOnlinePlayers())
{
TFM_PlayerData.getPlayerData(player).setMuted(false);
}
}
}.runTaskLater(plugin, 20L * 60L * 5L);
playerMsg("Muted " + counter + " players.");
}
else
{
Player player;
try
final Player player = getPlayer(args[0]);
if (player == null)
{
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
@ -118,10 +91,16 @@ public class Command_stfu extends TFM_Command
}
else
{
if (!TFM_SuperadminList.isUserSuperadmin(player))
if (!TFM_AdminList.isSuperAdmin(player))
{
TFM_Util.adminAction(sender.getName(), "Muting " + player.getName(), true);
playerdata.setMuted(true);
if (args.length == 2 && args[1].equalsIgnoreCase("-s"))
{
Command_smite.smite(player);
}
playerMsg("Muted " + player.getName());
}
else

View File

@ -1,16 +1,14 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
@CommandParameters(description = "Quickly change your own gamemode to survival, or define someone's username to change theirs.", usage = "/<command> <[partialname] | -a>")
@CommandParameters(description = "Quickly change your own gamemode to survival, or define someone's username to change theirs.", usage = "/<command> <[partialname] | -a>", aliases = "gms")
public class Command_survival extends TFM_Command
{
@Override
@ -35,9 +33,9 @@ public class Command_survival extends TFM_Command
{
if (args[0].equalsIgnoreCase("-a"))
{
if (!TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole)
if (!TFM_AdminList.isSuperAdmin(sender) || senderIsConsole)
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
sender.sendMessage(TFM_Command.MSG_NO_PERMS);
return true;
}
@ -50,15 +48,13 @@ public class Command_survival extends TFM_Command
return true;
}
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
try
if (senderIsConsole || TFM_AdminList.isSuperAdmin(sender))
{
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
if (player == null)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
}

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