Compare commits

...

68 Commits
v2.14 ... v2.21

Author SHA1 Message Date
44f72815e1 Added configurable blocked commands 2013-07-04 22:46:51 +02:00
1d9e6ae931 Merge pull request #50 from Wilee999/master
Blocked /butcher and //butcher on mark's request
2013-07-02 19:41:16 -07:00
a0cf0e9352 oops 2013-07-02 19:40:18 -07:00
797de66e10 removed 2013-07-02 19:36:59 -07:00
d40d5b461d Cleaned up Command_setl. Don't use server.dispatchCommand for things that can be done with the existing API!
Fixed depreciation warnings on compile.
2013-07-02 19:08:31 -04:00
8751e0454c Cleaned up /purgeall and /halt 2013-07-02 22:31:05 +02:00
3f29f788d5 Bye bye /butcher! 2013-07-02 12:50:59 -07:00
5c2e67ae1d Merge pull request #49 from Wilee999/master
Made /mp an admin command on mark's request
2013-07-02 12:43:53 -07:00
61db5de20d Reverted last commit. 2013-07-02 12:42:06 -07:00
ed9204c735 might as well add this 2013-07-02 11:59:15 -07:00
9fc237390e grr 2013-07-02 11:58:41 -07:00
ba22aedc58 Batch formatting fix. 2013-07-02 14:31:22 -04:00
44fb26b27f Updated to Bukkit 1.6 2013-07-02 14:05:29 +02:00
fab341608b Improved mojang service checker, now using xpaw.ru, migrated to /minecraft 2013-07-01 10:04:43 +02:00
4f6a0ca5d3 Blocked TNT Minecarts from being placed 2013-06-23 15:17:12 +02:00
f3684cc2ce Whoops! 2013-06-22 20:12:58 +02:00
772b7e43f7 Added license 2013-06-22 19:59:52 +02:00
c308c9a268 Oopsies. 2013-06-18 19:52:41 +03:00
fcb424a793 Minor changes to CONTRIBUTING.md 2013-06-18 16:34:35 +02:00
be1acb4e03 Disaster839 is without a capital, who knew? 2013-06-11 22:48:38 +03:00
386989fa69 Added contribution info 2013-06-11 17:59:04 +02:00
4c7cd9cb23 Merge pull request #40 from WickedGamingUK/patch-6
Changed madgeek1540 to madgeek1450
2013-06-10 06:46:51 -07:00
1f87c05547 Changed madgeek1540 to madgeek1450
Just noticed a little typing error in the developer's StringList, so I decided to fix it :)
2013-06-10 11:51:55 +02:00
a2a6e39db9 Minor changes, added /creative -a, formatting fixes, updated version number 2013-06-10 08:24:53 +02:00
c6ca262472 Merge pull request #39 from WickedGamingUK/patch-5
Fixed survival -a
2013-06-09 13:29:41 -07:00
c96bdea066 Fixed survival -a
I was a numpty and forgot to change the gamemode it changed people to.
2013-06-09 22:26:06 +02:00
893c7c2991 Merge pull request #38 from WickedGamingUK/patch-4
Added survival -a
2013-06-09 12:59:56 -07:00
201d27e070 Added survival -a (Allman Style) 2013-06-09 21:52:13 +02:00
36ceb7007a Added Disaster839 as a developer. 2013-06-09 14:11:22 +03:00
6519ead121 Added Acidic, Wild and Hex to the developer list 2013-06-03 23:08:31 +02:00
95805dd9c1 Merge pull request #30 from Wild1145/patch-7
Added blocks to /wildcard
2013-06-02 13:03:27 -07:00
6768854eda Added new blocked wildcards
This is to stop people from being able to abuse admin or going rogue as easily
2013-06-02 18:17:33 +02:00
83176ba0b9 Merge pull request #26 from Wilee999/pull2
Added /rb (/rollback alias)
2013-06-01 14:39:30 -07:00
4a2b58bf97 Merge pull request #28 from Wilee999/pull4
/nuke will now tempban you.
2013-06-01 14:38:12 -07:00
79fc01eae7 /nuke will now tempban you. 2013-05-31 19:54:36 -06:00
d1d220f618 Added /rb (/rollback alias) 2013-05-30 16:38:27 -06:00
f6943b9754 This /stop message works better. 2013-05-29 20:57:01 -06:00
2977167bd3 Merge pull request #24 from Wilee999/master
Fixed /blockcmd in /purgeall
2013-05-28 23:03:29 -07:00
ad9e901aa0 Fixed /blockcmd in /purgeall 2013-05-27 19:57:53 -07:00
4f6e4e2e87 Merge pull request #23 from Wild1145/patch-6
Blocked /clearhistory
2013-05-26 11:32:53 -07:00
d8ae364300 Patched exploit found in commands
This will fix the issue with world edit history erasing, please push and compile ASAP as Mark would like this patched :)
2013-05-26 14:18:16 +02:00
7f9661ec11 Merge pull request #14 from Wild1145/patch-1
Blocked /rl
2013-05-22 07:40:51 -07:00
8d59ba59f4 Prepend Rollback entries, this ensures the last entries get restored first, instead of last 2013-05-20 15:40:04 +02:00
6a7e866a53 Merge pull request #19 from Wild1145/patch-5
Fixed /gtfo
2013-05-19 14:30:56 -07:00
63508addf4 /Gtfo bug fix 2013-05-19 23:28:57 +02:00
b8ab56bed5 Incremented version number 2013-05-17 23:00:27 +02:00
4853cc439b Added /rollback 2013-05-17 22:58:03 +02:00
3b7a8d4d88 Incremented version number 2013-05-17 20:05:52 +02:00
d016e1ff08 Fixed stuff with Wilee's and Wild's changes 2013-05-17 20:03:16 +02:00
ab9650dc54 Merge pull request #13 from Wilee999/master
xxWileexx: Add /purgeall, minor changes.
2013-05-16 11:54:12 -07:00
d3139dd39f hopefully this works 2013-05-16 11:49:41 -07:00
ba834b6b92 g 2013-05-16 11:45:21 -07:00
ccd4237491 Merge pull request #15 from Wild1145/patch-3
Added /setl to set the amount of world edit blocks that can be used
2013-05-16 11:35:43 -07:00
ff51bb1980 Merge pull request #16 from Wild1145/patch-4
Added warning in MOTD if in adminmode=true
2013-05-16 11:31:52 -07:00
d2457adf68 Create Command_cmdlist.java 2013-05-16 12:31:22 -06:00
aea65815a8 removed /denick from /purgeall 2013-05-16 12:29:06 -06:00
6abd2491f1 Removed /denick from /spurgeall 2013-05-16 12:28:28 -06:00
31b5c99007 Added broadcast to /spurgeall 2013-05-16 12:19:47 -06:00
4aebf33006 Added a broadcast to /purgeall 2013-05-16 12:18:39 -06:00
e29a820398 Added /spurgeall 2013-05-16 00:57:26 -07:00
fabbc78d22 Replaced /clearall with /purgeall, this cleans more! 2013-05-15 23:59:08 -07:00
a8b4f1d950 Removed /cmdlist (useless) 2013-05-15 20:56:18 -07:00
b7c9f4e02d Added warning in MOTD if in adminmode=true
I think this would save people connecting and spamming logs if in adminmode!
2013-05-15 23:12:46 +02:00
ba9289e1a3 Added /setl to set the amount of world edit blocks that can be used 2013-05-15 23:05:20 +02:00
47dec49381 added /rl as a blocked command
Just because it buggs me ALOT!
2013-05-15 21:13:36 +02:00
b1202c7871 hopefully this fixed /invis 2013-05-15 12:03:45 -06:00
e82e88f48f Added /invis, incremented version number to reflect latest changes 2013-05-15 15:23:35 +02:00
36747cb986 Added /tban, colors for /rawsay, minor changes 2013-05-15 14:56:23 +02:00
45 changed files with 1305 additions and 351 deletions

65
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,65 @@
# How to contribute
TotalFreedomMod aims to be a fully functional all-op server mod which works in
a large range of configurations. In order to be as flexible as possible on the
server-end, we encourage contributing to TotalFreedomMod by making 'pull-requests'
to this repository.
## 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
## 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.
* 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 (*and work!*).
## Tips on getting your pull request accepted
* 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)
* 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.
## Submitting Changes
* Push your changes to a 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.
# Additional Resources
* [TotalFreedom information](http://totalfreedom.me)
* [TotalFreedom forums](http://totalfreedom.boards.net)
* [Bug tracker](https://github.com/TotalFreedom/TotalFreedomMod/issues)
* [General GitHub documentation](http://help.github.com/)
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)

16
LICENCE.md Normal file
View File

@ -0,0 +1,16 @@
# Legal
TotalFreedomMod by Madgeek1450 and DarthSalamon is an effort to create an opensource plugin to effectively run a "Total Freedom" like all-Op server. It consists of over 85 custom coded commands and a large variety of distinguishable features not included in any other plugin. The plugin has since its beginning grown immensely. Together with the main server "TotalFreedom" (http://totalfreedom.me) TotalFreedomMod has a long-standing reputation of effectiveness whilst maintaining a clear feel of openness towards the administrators and the players themselves.
## License
TotalFreedomMod sourcecode is freely available under the GNU GPLv3 License with a few restrictions in place. The license is available here: http://www.gnu.org/licenses/gpl.txt
The few restrictions are in place to make sure that credit is given to the original authors who remain the maintainers of the plugin and it's sourcecode.
These are the restrictions under which the sourcecode is licensed:
* A un-edited copy of this license must always be included with this sourcecode.
* TotalFreedomMod sourcecode and its derrivations are freely distributable between anyone who choses to download it.
* You may not remove the keywords "Madgeek1450", "StevenLawson", "DarthSalamon" and "jeromsar" from any part of the sourcecode.
* However, compiled binaries (*.jar's) are not to be distributed. If you wish to obtain a copy of TotalFreedomMod you must compile the original sourcecode or it's derivations yourself using an IDE like netbeans. Official superadmins and above of the TotalFreedom (totalfreedom.me) server may obtain a compiled libary with the same limitations as described in this document.
* Any conditions on this license may be waived by any of the official developers.

View File

@ -1,5 +1,5 @@
#Thu, 09 May 2013 15:32:18 +0200
#Thu, 04 Jul 2013 22:45:10 +0200
program.VERSION=2.14
program.BUILDNUM=182
program.BUILDDATE=05/09/2013 03\:32 PM
program.VERSION=2.21
program.BUILDNUM=255
program.BUILDDATE=07/04/2013 10\:45 PM

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Thu May 09 15:32:18 CEST 2013
build.number=183
#Thu Jul 04 22:45:10 CEST 2013
build.number=256

View File

@ -1,4 +1,4 @@
# TotalFreedomMod v2.13 Configuration
# TotalFreedomMod v2.21 Configuration
# by Madgeek1450 and DarthSalamon
# Block placement prevention:
@ -8,12 +8,70 @@ allow_lava_damage: false
allow_lava_place: false
allow_water_place: false
allow_fluid_spread: false
allow_tnt_minecarts: false
# Explosion management:
allow_explosions: false
explosiveRadius: 4.0
#Automatically wipe dropped objects:
# 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
#
# * 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
# 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.
# Valid actions:
# b - Block the command
# a - Block the command and auto-eject that player (for ops and below)
# u - Block the command and Return an "Unknown command" message (Used to hide commands)
#
# * The third section is the command to be blocked, prefixed with a slash
#
# * The fourth section is the message to send to the player when executing that command.
# This should be ommited if unwanted. ChatColors are supported with the &-key. By default
# -the starting ChatColor is set to gray. You can use the default 'That command is blocked.' message
# by using a single underscore.
#
# Examples:
# - 'n:b:/mail sendall:&4You can't send mails to everyone!'
# - 's:a:/stop'
# - 'n:b:/ban:_'
#
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:/ban:_'
- 'n:b:/pardon:_'
- 'n:b:/toggledownfall:_'
# Superadmin commands
- 's:b:/kick:_'
- 's:b:/socialspy:_'
- 's:b:/kill:_'
- 's:a:/stop'
- 's:a:/reload'
- 's:a:/nuke'
- 's:a:/save-all'
- 's:a:/save-on'
- 's:a:/save-off'
- 's:a:/clearhistory'
- 's:a:/butcher'
- 's:a://butcher'
# Automatically wipe dropped objects:
auto_wipe: true
# Nuking prevention:

View File

@ -15,7 +15,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package me.StevenLawson.TotalFreedomMod;
import java.util.Random;
@ -26,6 +25,7 @@ import org.bukkit.generator.BlockPopulator;
public class CleanroomBlockPopulator extends BlockPopulator
{
byte[] layerDataValues;
protected CleanroomBlockPopulator(byte[] layerDataValues)
{
this.layerDataValues = layerDataValues;
@ -38,10 +38,13 @@ public class CleanroomBlockPopulator extends BlockPopulator
int x = chunk.getX() << 4;
int z = chunk.getZ() << 4;
for (int y = 0; y < layerDataValues.length ; y++)
for (int y = 0; y < layerDataValues.length; y++)
{
byte dataValue = layerDataValues[y];
if (dataValue == 0) continue;
if (dataValue == 0)
{
continue;
}
for (int xx = 0; xx < 16; xx++)
{
for (int zz = 0; zz < 16; zz++)

View File

@ -15,7 +15,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package me.StevenLawson.TotalFreedomMod;
import static java.lang.System.arraycopy;
@ -55,16 +54,20 @@ public class CleanroomChunkGenerator extends ChunkGenerator
if ((id.length() > 0) && (id.charAt(0) == '.')) // Is the first character a '.'? If so, skip bedrock generation.
{
id = id.substring(1); // Skip bedrock then and remove the .
} else // Guess not, bedrock at layer0 it is then.
}
else // Guess not, bedrock at layer0 it is then.
{
layer[y++] = (short)Material.BEDROCK.getId();
layer[y++] = (short) Material.BEDROCK.getId();
}
if (id.length() > 0)
{
String tokens[] = id.split("[,]");
if ((tokens.length % 2) != 0) throw new Exception();
if ((tokens.length % 2) != 0)
{
throw new Exception();
}
for (int i = 0; i < tokens.length; i += 2)
{
@ -83,7 +86,8 @@ public class CleanroomChunkGenerator extends ChunkGenerator
{
// Lets try to read the data value
dataValue = Byte.parseByte(materialTokens[1]);
} catch (Exception e)
}
catch (Exception e)
{
log.warning("[CleanroomGenerator] Invalid Data Value '" + materialTokens[1] + "'. Defaulting to 0.");
dataValue = 0;
@ -96,7 +100,8 @@ public class CleanroomChunkGenerator extends ChunkGenerator
{
// Mabe it's an integer?
mat = Material.getMaterial(Integer.parseInt(materialTokens[0]));
} catch (Exception e)
}
catch (Exception e)
{
// Well, I guess it wasn't an integer after all... Awkward...
}
@ -127,7 +132,7 @@ public class CleanroomChunkGenerator extends ChunkGenerator
}
}
Arrays.fill(layer, y, y + height, (short)mat.getId());
Arrays.fill(layer, y, y + height, (short) mat.getId());
if (dataValue != 0)
{
if (layerDataValues == null)
@ -153,21 +158,23 @@ public class CleanroomChunkGenerator extends ChunkGenerator
arraycopy(layerDataValues, 0, newLayerDataValues, 0, y);
layerDataValues = newLayerDataValues;
}
} catch (Exception e)
}
catch (Exception e)
{
log.severe("[CleanroomGenerator] Error parsing CleanroomGenerator ID '" + id + "'. using defaults '64,1': " + e.toString());
e.printStackTrace();
layerDataValues = null;
layer = new short[65];
layer[0] = (short)Material.BEDROCK.getId();
Arrays.fill(layer, 1, 65, (short)Material.STONE.getId());
layer[0] = (short) Material.BEDROCK.getId();
Arrays.fill(layer, 1, 65, (short) Material.STONE.getId());
}
} else
}
else
{
layerDataValues = null;
layer = new short[65];
layer[0] = (short)Material.BEDROCK.getId();
Arrays.fill(layer, 1, 65, (short)Material.STONE.getId());
layer[0] = (short) Material.BEDROCK.getId();
Arrays.fill(layer, 1, 65, (short) Material.STONE.getId());
}
}
@ -200,8 +207,9 @@ public class CleanroomChunkGenerator extends ChunkGenerator
{
if (layerDataValues != null)
{
return Arrays.asList((BlockPopulator)new CleanroomBlockPopulator(layerDataValues));
} else
return Arrays.asList((BlockPopulator) new CleanroomBlockPopulator(layerDataValues));
}
else
{
// This is the default, but just in case default populators change to stock minecraft populators by default...
return new ArrayList<BlockPopulator>();

View File

@ -1,20 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Removes all entities, nicks and disguises.", usage = "/<command>")
public class Command_clearall extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
server.dispatchCommand(sender, "rd");
server.dispatchCommand(sender, "potion clearall");
server.dispatchCommand(sender, "uall");
return true;
}
}

View File

@ -48,4 +48,4 @@ public class Command_cmdlist extends TFM_Command
return true;
}
}
}

View File

@ -1,6 +1,8 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
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;
@ -29,23 +31,39 @@ public class Command_creative extends TFM_Command
}
else
{
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
if (args[0].equalsIgnoreCase("-a"))
{
try
if (!TFM_SuperadminList.isUserSuperadmin(sender))
{
p = getPlayer(args[0]);
}
catch (CantFindPlayerException ex)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
for (Player player : server.getOnlinePlayers())
{
player.setGameMode(GameMode.CREATIVE);
}
TFM_Util.adminAction(sender.getName(), "Changing everyone's gamemode to creative", false);
return true;
}
else
if (!(senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)))
{
playerMsg("Only superadmins can change other user's gamemode.");
return true;
}
try
{
p = getPlayer(args[0]);
}
catch (CantFindPlayerException ex)
{
sender.sendMessage(ex.getMessage());
return true;
}
}
playerMsg("Setting " + p.getName() + " to game mode 'Creative'.");

View File

@ -78,7 +78,7 @@ public class Command_doom extends TFM_Command
p.getWorld().strikeLightning(p.getLocation());
// kill (if not done already)
p.setHealth(0);
p.setHealth(0.0);
}
}, 40L); // 2 seconds

View File

@ -34,17 +34,17 @@ public class Command_gtfo extends TFM_Command
TFM_Util.bcastMsg(p.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED);
// Op Player
p.setOp(true);
//Undo WorldEdits:
server.dispatchCommand(p, "/undo 15");
//rollback
server.dispatchCommand(sender, "rollback " + p.getName() + " all");
server.dispatchCommand(sender, "rollback " + p.getName());
// deop
p.setOp(false);

View File

@ -1,10 +1,8 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -29,7 +27,7 @@ public class Command_halt extends TFM_Command
{
if (!TFM_SuperadminList.isUserSuperadmin(p))
{
setHalted(p, true);
TFM_PlayerData.getPlayerData(p).setHalted(true);
counter++;
}
}
@ -43,9 +41,10 @@ public class Command_halt extends TFM_Command
int counter = 0;
for (Player p : server.getOnlinePlayers())
{
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
if (TFM_PlayerData.getPlayerData(p).isHalted())
{
setHalted(p, false);
playerdata.setHalted(false);
counter++;
}
}
@ -89,48 +88,20 @@ public class Command_halt extends TFM_Command
}
if (!TFM_PlayerData.getPlayerData(p).isHalted())
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
if (!playerdata.isHalted())
{
TFM_Util.adminAction(sender.getName(), "Halting " + p.getName(), true);
setHalted(p, true);
playerdata.setHalted(true);
return true;
}
else
{
TFM_Util.adminAction(sender.getName(), "Unhalting " + p.getName(), true);
setHalted(p, false);
playerdata.setHalted(false);
return true;
}
}
private static void setHalted(Player p, boolean is_halted)
{
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
if (is_halted)
{
p.setOp(false);
p.setGameMode(GameMode.SURVIVAL);
p.setFlying(false);
p.setDisplayName(p.getName());
p.closeInventory();
p.setTotalExperience(0);
playerdata.stopOrbiting();
playerdata.setFrozen(true);
playerdata.setMuted(true);
playerdata.setHalted(true);
p.sendMessage(ChatColor.GRAY + "You have been halted, don't move!");
}
else
{
p.setOp(true);
p.setGameMode(GameMode.CREATIVE);
playerdata.setFrozen(false);
playerdata.setMuted(false);
playerdata.setHalted(false);
p.sendMessage(ChatColor.GRAY + "You are no longer halted.");
}
}
}

View File

@ -0,0 +1,67 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.apache.commons.lang.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Shows (optionally smites) invisisible players", usage = "/<command> (smite)")
public class Command_invis extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
boolean smite = false;
if (args.length >= 1)
{
if (args[0].equalsIgnoreCase("smite"))
{
smite = true;
}
else
{
return false;
}
}
List<String> players = new ArrayList<String>();
int smites = 0;
for (Player p : server.getOnlinePlayers())
{
if (p.hasPotionEffect(PotionEffectType.INVISIBILITY))
{
players.add(p.getName());
if (smite && !TFM_SuperadminList.isUserSuperadmin(p))
{
server.dispatchCommand(sender, "smite " + p.getName());
smites++;
}
}
}
if (players.isEmpty())
{
TFM_Util.playerMsg(sender, "There are no invisible players");
return true;
}
if (smite)
{
TFM_Util.playerMsg(sender, "Smitten " + smites + " players");
}
else
{
TFM_Util.playerMsg(sender, "Invisble players (" + players.size() + "): " + StringUtils.join(players, ", "));
}
return true;
}
}

View File

@ -72,7 +72,7 @@ public class Command_list extends TFM_Command
prefix = (ChatColor.GOLD + "[SA]");
}
if (p.getName().equalsIgnoreCase("madgeek1450") || p.getName().equalsIgnoreCase("darthsalamon"))
if (TFM_Util.DEVELOPERS.contains(p.getName()))
{
prefix = (ChatColor.DARK_PURPLE + "[Dev]");
}

View File

@ -0,0 +1,24 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ServiceChecker;
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 = "Shows the uptime of all minecraft services.", usage = "/<command>")
public class Command_minecraft extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
playerMsg("Status of Mojang services:", ChatColor.BLUE);
for (String service : TFM_ServiceChecker.getAllStatuses())
{
playerMsg(service);
}
playerMsg("Version " + TFM_ServiceChecker.version + ", Last Checked: " + TFM_ServiceChecker.last_updated, ChatColor.BLUE);
return true;
}
}

View File

@ -6,7 +6,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.*;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Purge all mobs in all worlds.", usage = "/<command>")
public class Command_mp extends TFM_Command
{

View File

@ -7,7 +7,7 @@ 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.SUPER, source = SourceType.BOTH, block_host_console = true)
@CommandParameters(description = "Manage permanently banned players and IPs.", usage = "/<command> <list | reload>")
public class Command_permban extends TFM_Command
{

View File

@ -8,7 +8,7 @@ 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 >")
@CommandParameters(description = "Enable / disable plugins.", usage = "/<command> < <enable | disable> <pluginname> | list >", aliases = "plc")
public class Command_plugincontrol extends TFM_Command
{
private enum CommandMode

View File

@ -0,0 +1,103 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
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;
import org.bukkit.potion.PotionEffect;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Superadmin command - Purge everything! (except for bans).", usage = "/<command>")
public class Command_purgeall 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(), "Purging all player data", true);
// Purge entities
TFM_Util.wipeEntities(true, true);
// Undisguise all players
server.dispatchCommand(sender, "u *");
for (Player p : server.getOnlinePlayers())
{
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
// Unmute all players
if (playerdata.isMuted())
{
playerdata.setMuted(false);
}
// Unblock all commands
if (playerdata.allCommandsBlocked())
{
playerdata.setCommandsBlocked(false);
}
// Unhalt all players
if (playerdata.isHalted())
{
playerdata.setHalted(false);
}
// Stop orbiting
if (playerdata.isOrbiting())
{
playerdata.stopOrbiting();
}
// Unfreeze
if (playerdata.isFrozen())
{
playerdata.setFrozen(false);
}
// Purge potion effects
for (PotionEffect potion_effect : p.getActivePotionEffects())
{
p.removePotionEffect(potion_effect.getType());
}
}
// Clear auto-unmute and auto-unfreeze tasks
if (TotalFreedomMod.mutePurgeEventId != 0)
{
server.getScheduler().cancelTask(TotalFreedomMod.mutePurgeEventId);
TotalFreedomMod.mutePurgeEventId = 0;
}
if (TotalFreedomMod.freezePurgeEventId != 0)
{
server.getScheduler().cancelTask(TotalFreedomMod.freezePurgeEventId);
TotalFreedomMod.freezePurgeEventId = 0;
}
// Remove all mobs
for (World world : server.getWorlds())
{
for (Entity ent : world.getLivingEntities())
{
if (ent instanceof Creature || ent instanceof Ghast || ent instanceof Slime || ent instanceof EnderDragon || ent instanceof Ambient)
{
ent.remove();
}
}
}
return true;
}
}

View File

@ -2,12 +2,13 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.apache.commons.lang.StringUtils;
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.ONLY_CONSOLE, block_host_console = true)
@CommandParameters(description = "Broadcasts the given message with no extra formatting.", usage = "/<command> <message>")
@CommandParameters(description = "Broadcasts the given message. Supports colors.", usage = "/<command> <message>")
public class Command_rawsay extends TFM_Command
{
@Override
@ -15,7 +16,7 @@ public class Command_rawsay extends TFM_Command
{
if (args.length > 0)
{
TFM_Util.bcastMsg(StringUtils.join(args, " "));
TFM_Util.bcastMsg(ChatColor.translateAlternateColorCodes('&', StringUtils.join(args, " ")));
}
return true;

View File

@ -0,0 +1,88 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_RollbackManager;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
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.SUPER, source = SourceType.BOTH, block_host_console = true)
@CommandParameters(description = "Issues a rollback on a player", usage = "/<command> <[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 > 2)
{
return false;
}
if (args.length == 1 && args[0].equalsIgnoreCase("purgeall"))
{
TFM_Util.adminAction(sender.getName(), "Puring all rollback data", false);
playerMsg("Purged entries for " + TFM_RollbackManager.purgeEntries() + " players.");
return true;
}
if (args.length == 2 && args[0].equalsIgnoreCase("purge"))
{
OfflinePlayer p;
try
{
p = getPlayer(args[1]);
}
catch (CantFindPlayerException ex)
{
p = server.getOfflinePlayer(args[1]);
if (!p.hasPlayedBefore())
{
playerMsg("Player is not online, or never joined the server.", ChatColor.RED);
return true;
}
}
if (!TFM_RollbackManager.canRollback(p.getName()))
{
playerMsg("No rollback data found for that player", ChatColor.RED);
}
else
{
playerMsg("Purged " + TFM_RollbackManager.purgeEntries(p.getName()) + " entries.");
return true;
}
}
if (args.length != 1)
{
return false;
}
OfflinePlayer p;
try
{
p = getPlayer(args[0]);
}
catch (CantFindPlayerException ex)
{
p = server.getOfflinePlayer(args[0]);
if (!p.hasPlayedBefore())
{
playerMsg("Player is not online, or never joined the server.", ChatColor.RED);
return true;
}
}
if (!TFM_RollbackManager.canRollback(p.getName()))
{
playerMsg("Player has no rollback data set.", ChatColor.RED);
return true;
}
TFM_Util.adminAction(sender.getName(), "Rolling back player: " + p.getName(), false);
playerMsg("Rolled back " + TFM_RollbackManager.rollback(p) + " blocks");
return true;
}
}

View File

@ -149,12 +149,12 @@ public class Command_saconfig extends TFM_Command
TFM_Util.adminAction(sender.getName(), "Removing " + target_name + " from the superadmin list", true);
TFM_SuperadminList.removeSuperadmin(target_name);
if (!TotalFreedomMod.twitterbotEnabled)
{
return true;
}
// Twitterbot
TFM_TwitterHandler twitterbot = TFM_TwitterHandler.getInstance(plugin);
String reply = twitterbot.delTwitter(target_name);

View File

@ -0,0 +1,45 @@
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;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Sets everyone's Worldedit block modification limit to 500.", usage = "/<command>")
public class Command_setl extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
//server.dispatchCommand(sender, "wildcard gcmd ? /limit 500"); - Madgeek: No, no, hell no.
TFM_Util.adminAction(sender.getName(), "Setting everyone's Worldedit block modification limit to 500.", true);
for (final Player p : server.getOnlinePlayers())
{
final boolean isOp = p.isOp();
if (!isOp)
{
p.setOp(true);
}
server.dispatchCommand(p, "/limit 500");
if (!isOp)
{
server.getScheduler().runTaskLater(plugin, new Runnable()
{
@Override
public void run()
{
p.setOp(false);
}
}, 20L);
}
}
return true;
}
}

View File

@ -56,7 +56,7 @@ public class Command_smite extends TFM_Command
}
//Kill:
p.setHealth(0);
p.setHealth(0.0);
return true;
}

View File

@ -1,42 +1,16 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
@CommandParameters(description = "Show misc. server info.", usage = "/<command>")
public class Command_status extends TFM_Command
{
public static final Map<String, String> SERVICE_MAP = new HashMap<String, String>();
static
{
SERVICE_MAP.put("minecraft.net", "Minecraft.net");
SERVICE_MAP.put("login.minecraft.net", "Minecraft Logins");
SERVICE_MAP.put("session.minecraft.net", "Minecraft Multiplayer Sessions");
SERVICE_MAP.put("account.mojang.com", "Mojang Accounts Website");
SERVICE_MAP.put("auth.mojang.com", "Mojang Accounts Login");
SERVICE_MAP.put("skins.minecraft.net", "Minecraft Skins");
}
@Override
public boolean run(final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
@ -52,59 +26,6 @@ public class Command_status extends TFM_Command
playerMsg(String.format("World %d: %s - %d players.", i++, world.getName(), world.getPlayers().size()), ChatColor.BLUE);
}
server.getScheduler().runTaskAsynchronously(plugin, new Runnable()
{
@SuppressWarnings("unchecked")
@Override
public void run()
{
try
{
URL mojang_status = new URL("http://status.mojang.com/check");
BufferedReader in = new BufferedReader(new InputStreamReader(mojang_status.openStream()));
JSONArray status_json = (JSONArray) JSONValue.parse(in.readLine());
in.close();
Map<String, Boolean> service_status = new HashMap<String, Boolean>();
Iterator status_it = status_json.iterator();
while (status_it.hasNext())
{
JSONObject service = (JSONObject) status_it.next();
Iterator service_it = service.entrySet().iterator();
while (service_it.hasNext())
{
Entry<String, String> pair = (Entry<String, String>) service_it.next();
service_status.put(pair.getKey(), (pair.getValue().equals("green") ? Boolean.TRUE : Boolean.FALSE));
}
}
List<String> status_output = new ArrayList<String>();
Iterator<Entry<String, Boolean>> output_it = service_status.entrySet().iterator();
while (output_it.hasNext())
{
Entry<String, Boolean> pair = output_it.next();
String service_name = pair.getKey();
boolean service_online = pair.getValue().booleanValue();
if (SERVICE_MAP.containsKey(service_name))
{
service_name = SERVICE_MAP.get(service_name);
}
status_output.add(String.format("%s is %s", service_name, (service_online ? ChatColor.GREEN + "ONLINE" + ChatColor.GRAY : ChatColor.RED + "OFFLINE" + ChatColor.GRAY)));
}
playerMsg(String.format("Mojang Service Status: %s.", StringUtils.join(status_output, ", ")), ChatColor.GRAY);
}
catch (Exception ex)
{
TFM_Log.severe(ex);
}
}
});
return true;
}
}

View File

@ -17,7 +17,7 @@ public class Command_stop extends TFM_Command
for (Player p : server.getOnlinePlayers())
{
p.kickPlayer("Server is going offline, come back in a few minutes.");
p.kickPlayer("Server is going offline, come back in about 20 seconds.");
}
server.shutdown();

View File

@ -1,6 +1,9 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
@ -8,7 +11,7 @@ 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]")
@CommandParameters(description = "Quickly change your own gamemode to survival, or define someone's username to change theirs.", usage = "/<command> <[partialname] | -a>")
public class Command_survival extends TFM_Command
{
@Override
@ -24,12 +27,30 @@ public class Command_survival extends TFM_Command
}
Player p;
if (args.length == 0)
{
p = sender_p;
}
else
{
if (args[0].equalsIgnoreCase("-a"))
{
if (!TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole)
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
for (Player player : server.getOnlinePlayers())
{
player.setGameMode(GameMode.SURVIVAL);
}
TFM_Util.adminAction(sender.getName(), "Changing everyone's gamemode to survival", false);
return true;
}
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
try

View File

@ -0,0 +1,40 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
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.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Temporarily bans a player for five minutes.", usage = "/<command> <partialname>", aliases = "nope")
public class Command_tban 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;
}
Player p;
try
{
p = getPlayer(args[0]);
}
catch (CantFindPlayerException ex)
{
playerMsg(ex.getMessage(), ChatColor.RED);
return true;
}
TFM_Util.adminAction(sender.getName(), "NOPE: " + p.getName(), true);
TFM_ServerInterface.banUsername(p.getName(), ChatColor.RED + "You have been temporarily banned for 5 minutes",
sender.getName(), TFM_Util.parseDateOffset("5m"));
p.kickPlayer(ChatColor.RED + "NOPE!\nYou have been temporarily banned for five minutes.");
return true;
}
}

View File

@ -18,6 +18,21 @@ public class Command_wildcard extends TFM_Command
playerMsg("What the hell are you trying to do, you stupid idiot...", ChatColor.RED);
return true;
}
if (args[0].equals("gtfo"))
{
playerMsg("Nice try", ChatColor.RED);
return true;
}
if (args[0].equals("doom"))
{
playerMsg("Look, we all hate people, but this is not the way to deal with it, doom is evil enough!", ChatColor.RED);
return true;
}
if (args[0].equals("saconfig"))
{
playerMsg("WOA, WTF are you trying to do???", ChatColor.RED);
return true;
}
String base_command = StringUtils.join(args, " ");

View File

@ -3,6 +3,8 @@ package me.StevenLawson.TotalFreedomMod.Listener;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
import me.StevenLawson.TotalFreedomMod.TFM_RollbackEntry;
import me.StevenLawson.TotalFreedomMod.TFM_RollbackManager;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
@ -24,7 +26,6 @@ public class TFM_BlockListener implements Listener
if (!TotalFreedomMod.allowFireSpread)
{
event.setCancelled(true);
return;
}
}
@ -34,7 +35,6 @@ public class TFM_BlockListener implements Listener
if (!TotalFreedomMod.allowFirePlace)
{
event.setCancelled(true);
return;
}
}
@ -95,7 +95,6 @@ public class TFM_BlockListener implements Listener
if (TFM_ProtectedArea.isInProtectedArea(block_pos))
{
event.setCancelled(true);
return;
}
}
}
@ -180,7 +179,6 @@ public class TFM_BlockListener implements Listener
p.sendMessage(ChatColor.GRAY + "Lava placement is currently disabled.");
event.setCancelled(true);
return;
}
break;
}
@ -199,7 +197,6 @@ public class TFM_BlockListener implements Listener
p.sendMessage(ChatColor.GRAY + "Water placement is currently disabled.");
event.setCancelled(true);
return;
}
break;
}
@ -217,7 +214,6 @@ public class TFM_BlockListener implements Listener
p.sendMessage(ChatColor.GRAY + "Fire placement is currently disabled.");
event.setCancelled(true);
return;
}
break;
}
@ -235,7 +231,6 @@ public class TFM_BlockListener implements Listener
p.sendMessage(ChatColor.GRAY + "TNT is currently disabled.");
event.setCancelled(true);
return;
}
break;
}
@ -250,6 +245,21 @@ public class TFM_BlockListener implements Listener
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPlaceRollback(BlockPlaceEvent event)
{
TFM_RollbackEntry entry = new TFM_RollbackEntry();
entry.setLocation(event.getBlock().getLocation());
entry.setMaterial(Material.AIR);
TFM_RollbackManager.blockUpdate(event.getPlayer(), entry);
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockBreakRollback(BlockBreakEvent event)
{
TFM_RollbackManager.blockUpdate(event.getPlayer(), event.getBlock());
}
// @EventHandler(priority = EventPriority.NORMAL)
// public void onCommandBlockChangeEvent(CommandBlockChangeEvent event)
// {

View File

@ -36,7 +36,7 @@ public class TFM_EntityListener implements Listener
@EventHandler(priority = EventPriority.HIGH)
public void onEntityCombust(EntityCombustEvent event)
{
if (!TotalFreedomMod.allowFireSpread)
if (!TotalFreedomMod.allowExplosions)
{
event.setCancelled(true);
}

View File

@ -6,7 +6,15 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.regex.Pattern;
import me.StevenLawson.TotalFreedomMod.*;
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
import me.StevenLawson.TotalFreedomMod.TFM_LandmineData;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_UserList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -22,7 +30,17 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.player.*;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.RemoteServerCommandEvent;
import org.bukkit.event.server.ServerCommandEvent;
import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
@ -45,21 +63,34 @@ public class TFM_PlayerListener implements Listener
{
case WATER_BUCKET:
{
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
player.sendMessage(ChatColor.GRAY + "Water buckets are currently disabled.");
event.setCancelled(true);
return;
if (!TotalFreedomMod.allowWaterPlace)
{
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
player.sendMessage(ChatColor.GRAY + "Water buckets are currently disabled.");
event.setCancelled(true);
return;
}
}
case LAVA_BUCKET:
{
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
player.sendMessage(ChatColor.GRAY + "Lava buckets are currently disabled.");
event.setCancelled(true);
return;
if (!TotalFreedomMod.allowLavaPlace)
{
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
player.sendMessage(ChatColor.GRAY + "Lava buckets are currently disabled.");
event.setCancelled(true);
return;
}
}
case POTION:
case EXPLOSIVE_MINECART:
{
if (!TotalFreedomMod.allowTntMinecarts)
{
player.getInventory().clear(player.getInventory().getHeldItemSlot());
player.sendMessage(ChatColor.GRAY + "TNT minecarts are currently disabled.");
event.setCancelled(true);
}
}
}
break;
}
@ -81,7 +112,6 @@ public class TFM_PlayerListener implements Listener
playerdata.enqueueMob(rezzed_mob);
event.setCancelled(true);
return;
}
break;
}
@ -100,7 +130,6 @@ public class TFM_PlayerListener implements Listener
}
event.setCancelled(true);
return;
}
break;
}
@ -356,7 +385,7 @@ public class TFM_PlayerListener implements Listener
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
playerdata.incrementMsgCount();
// check for spam
// Check for spam
if (playerdata.getMsgCount() > 10)
{
TFM_Util.bcastMsg(p.getName() + " was automatically kicked for spamming chat.", ChatColor.RED);
@ -368,7 +397,7 @@ public class TFM_PlayerListener implements Listener
return;
}
// check for message repeat
// Check for message repeat
if (playerdata.getLastMessage().equalsIgnoreCase(message))
{
TFM_Util.playerMsg(p, "Please do not repeat messages.");
@ -377,7 +406,7 @@ public class TFM_PlayerListener implements Listener
}
playerdata.setLastMessage(message);
// check for muted
// Check for muted
if (playerdata.isMuted())
{
if (!TFM_SuperadminList.isUserSuperadmin(p))
@ -392,17 +421,17 @@ public class TFM_PlayerListener implements Listener
}
}
// strip color from messages
// Strip color from messages
message = ChatColor.stripColor(message);
// truncate messages that are too long - 100 characters is vanilla client max
// Truncate messages that are too long - 100 characters is vanilla client max
if (message.length() > 100)
{
message = message.substring(0, 100);
TFM_Util.playerMsg(p, "Message was shortened because it was too long to send.");
}
// check for caps - Quit messing with this :-/
// Check for caps
if (message.length() >= 6)
{
int caps = 0;
@ -419,7 +448,7 @@ public class TFM_PlayerListener implements Listener
}
}
// check for adminchat
// Check for adminchat
if (playerdata.inAdminChat())
{
TFM_Util.adminChatMessage(p, message, false);
@ -427,7 +456,7 @@ public class TFM_PlayerListener implements Listener
return;
}
// finally, set message
// Finally, set message
event.setMessage(message);
}
catch (Exception ex)
@ -444,6 +473,7 @@ public class TFM_PlayerListener implements Listener
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
playerdata.incrementMsgCount();
playerdata.setLastCommand(command);
if (playerdata.getMsgCount() > 10)
{
@ -465,116 +495,14 @@ public class TFM_PlayerListener implements Listener
return;
}
if (TotalFreedomMod.preprocessLogEnabled)
{
TFM_Log.info(String.format("[PREPROCESS_COMMAND] %s(%s): %s", p.getName(), ChatColor.stripColor(p.getDisplayName()), command), true);
}
playerdata.setLastCommand(command);
command = command.toLowerCase().trim();
boolean block_command = false;
//Commands that will auto-kick the user:
if (Pattern.compile("^/stop").matcher(command).find())
{
if (!TFM_SuperadminList.isUserSuperadmin(p))
{
block_command = true;
}
}
else if (Pattern.compile("^/reload").matcher(command).find())
{
if (!TFM_SuperadminList.isUserSuperadmin(p))
{
block_command = true;
}
}
else if (Pattern.compile("^/save-").matcher(command).find())
{
if (!TFM_SuperadminList.isUserSuperadmin(p))
{
block_command = true;
}
}
if (block_command)
{
TFM_Util.autoEject(p, "You used a prohibited command: " + command);
TFM_Util.bcastMsg(p.getName() + " was automatically kicked for using harmful commands.", ChatColor.RED);
}
else
{
// commands that will not auto-kick the user, but still deny:
if (Pattern.compile("^/time").matcher(command).find())
{
p.sendMessage(ChatColor.GRAY + "Server-side time changing is disabled. Please use /ptime to set your own personal time.");
block_command = true;
}
else if (Pattern.compile("^/md").matcher(command).find())
{
p.sendMessage(ChatColor.GRAY + "This server now uses DisguiseCraft instead of MobDisguise. Type /d to disguise and /u to undisguise.");
block_command = true;
}
else if (Pattern.compile("^/gamemode").matcher(command).find())
{
p.sendMessage(ChatColor.GRAY + "Use /creative and /survival to set your gamemode.");
block_command = true;
}
else if (Pattern.compile("^/ban").matcher(command).find())
{
if (!Pattern.compile("^/banlist").matcher(command).find())
{
block_command = true;
}
}
else if (Pattern.compile("^/kick").matcher(command).find())
{
if (!TFM_SuperadminList.isUserSuperadmin(p))
{
block_command = true;
}
}
else if (Pattern.compile("^/kill").matcher(command).find())
{
if (!TFM_SuperadminList.isUserSuperadmin(p))
{
block_command = true;
}
}
else if (Pattern.compile("^/socialspy").matcher(command).find())
{
if (!TFM_SuperadminList.isUserSuperadmin(p))
{
block_command = true;
}
}
else if (Pattern.compile("^/pardon").matcher(command).find())
{
block_command = true;
}
else if (Pattern.compile("^/toggledownfall").matcher(command).find())
{
block_command = true;
}
}
if (block_command)
{
p.sendMessage(ChatColor.GRAY + "That command is blocked.");
event.setCancelled(true);
return;
}
// block commands while player is muted
// Block commands if player is muted
if (playerdata.isMuted())
{
if (!TFM_SuperadminList.isUserSuperadmin(p))
{
for (String test_command : BLOCKED_MUTED_CMDS)
{
if (Pattern.compile("^/" + test_command.toLowerCase() + " ").matcher(command.toLowerCase()).find())
if (Pattern.compile("^/" + test_command.toLowerCase() + " ").matcher(command).find())
{
p.sendMessage(ChatColor.RED + "That command is blocked while you are muted.");
event.setCancelled(true);
@ -586,7 +514,20 @@ public class TFM_PlayerListener implements Listener
{
playerdata.setMuted(false);
}
return;
}
if (TotalFreedomMod.preprocessLogEnabled)
{
TFM_Log.info(String.format("[PREPROCESS_COMMAND] %s(%s): %s", p.getName(), ChatColor.stripColor(p.getDisplayName()), command), true);
}
command = command.toLowerCase().trim();
// Blocked commands
if (TFM_CommandBlocker.isCommandBlocked(command, event.getPlayer()))
{
// CommandBlocker handles messages and broadcasts
event.setCancelled(true);
}
if (!TFM_SuperadminList.isUserSuperadmin(p))
@ -601,6 +542,24 @@ public class TFM_PlayerListener implements Listener
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void onRemoteServerCommand(RemoteServerCommandEvent event)
{
if (TFM_CommandBlocker.isCommandBlocked("/" + event.getCommand(), event.getSender()))
{
event.setCommand("");
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void onServerCommand(ServerCommandEvent event)
{
if (TFM_CommandBlocker.isCommandBlocked("/" + event.getCommand(), event.getSender()))
{
event.setCommand("");
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerDropItem(PlayerDropItemEvent event)
{
@ -716,16 +675,21 @@ public class TFM_PlayerListener implements Listener
{
TFM_ServerInterface.handlePlayerLogin(event);
}
@EventHandler()
public void onServerPing(ServerListPingEvent event)
{
// Colorize :)
event.setMotd(ChatColor.translateAlternateColorCodes('&', event.getMotd()));
if (TFM_ServerInterface.isIPBanned(event.getAddress().getHostAddress()))
{
event.setMotd(ChatColor.RED + "You are banned!");
}
if (TotalFreedomMod.adminOnlyMode)
{
event.setMotd(ChatColor.RED + "Server in AdminMode!");
}
}
}

View File

@ -0,0 +1,144 @@
package me.StevenLawson.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.server.RemoteServerCommandEvent;
public class TFM_CommandBlocker
{
public static boolean isCommandBlocked(String command, CommandSender sender)
{
String name = sender.getName();
command = command.toLowerCase().trim();
for (String blocked_command : TotalFreedomMod.blockedCommands)
{
String[] parts = blocked_command.split(":");
if (parts.length < 3 || parts.length > 4)
{
continue;
}
if (!(command + " ").startsWith(parts[2] + " "))
{
continue;
}
if (SenderRank.hasPermissions(sender, parts[0]))
{
continue;
}
// Past this line indicates that the command is blocked.
// Optional: Send a message
if (parts.length == 4)
{
if ("_".equals(parts[3]))
{
sender.sendMessage(ChatColor.GRAY + "That command is blocked.");
}
else
{
sender.sendMessage(ChatColor.GRAY + ChatColor.translateAlternateColorCodes('&', parts[3]));
}
}
TFM_Log.info("Player Rank: " + SenderRank.getSenderRank(sender).rank);
// Action
if ("b".equals(parts[1]))
{
return true;
}
else if ("a".equals(parts[1]))
{
if (SenderRank.getSenderRank(sender).rank < 2) // Only auto-eject Ops and non-ops
{
TFM_Util.autoEject((Player) sender, "You used a prohibited command: " + command);
TFM_Util.bcastMsg(name + " was automatically kicked for using harmful commands.", ChatColor.RED);
}
return true;
}
else if ("u".equals(parts[1]))
{
sender.sendMessage("Unknown command. Type \"help\" for help.");
return true;
}
return false;
}
return false;
}
public enum SenderRank
{
ANYONE("a", 0),
OP("o", 1),
SUPER("s", 2),
TELNET("t", 3),
SENIOR("c", 4),
NOBODY("n", 5);
private String letter = "n";
private int rank = 5;
SenderRank(String letter, int rank)
{
this.letter = letter;
this.rank = rank;
}
public static boolean hasPermissions(CommandSender sender, String letter)
{
return (getSenderRank(sender).rank >= getSenderRankByLetter(letter).rank);
}
public static SenderRank getSenderRank(CommandSender sender)
{
if (!(sender instanceof Player))
{
if (TFM_SuperadminList.isSeniorAdmin(sender))
{
return SenderRank.SENIOR;
}
else
{
return SenderRank.TELNET;
}
}
if (TFM_SuperadminList.isUserSuperadmin(sender))
{
return SenderRank.SUPER;
}
if (sender.isOp())
{
return SenderRank.OP;
}
return SenderRank.ANYONE;
}
public static SenderRank getSenderRankByLetter(String letter)
{
for (SenderRank rank : SenderRank.values())
{
if (letter.equals(rank.letter))
{
return rank;
}
}
return SenderRank.NOBODY;
}
}
}

View File

@ -7,6 +7,8 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
@ -320,7 +322,7 @@ public class TFM_PlayerData
LivingEntity oldmob = mob_thrower_queue.remove(0);
if (oldmob != null)
{
oldmob.damage(500);
oldmob.damage(500.0);
}
}
}
@ -400,6 +402,34 @@ public class TFM_PlayerData
public void setHalted(boolean is_halted)
{
this.is_halted = is_halted;
if (is_halted)
{
player.setOp(false);
player.setGameMode(GameMode.SURVIVAL);
player.setFlying(false);
player.setDisplayName(player_name);
player.closeInventory();
player.setTotalExperience(0);
stopOrbiting();
setFrozen(true);
setMuted(true);
setHalted(true);
player.sendMessage(ChatColor.GRAY + "You have been halted, don't move!");
}
else
{
player.setOp(true);
player.setGameMode(GameMode.CREATIVE);
setFrozen(false);
setMuted(false);
setHalted(false);
player.sendMessage(ChatColor.GRAY + "You are no longer halted.");
}
}
public BukkitTask getLockupScheduleID()

View File

@ -0,0 +1,52 @@
package me.StevenLawson.TotalFreedomMod;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
public class TFM_RollbackEntry
{
private Location location;
private Material material;
private byte data;
public TFM_RollbackEntry()
{
}
public TFM_RollbackEntry(Block block)
{
location = block.getLocation();
material = block.getType();
data = block.getData();
}
public void setBlock(Block block)
{
location = block.getLocation();
material = block.getType();
data = block.getData();
}
public void setLocation(Location location)
{
this.location = location;
}
public void setMaterial(Material material)
{
this.material = material;
}
public void setData(byte data)
{
this.data = data;
}
public void restore()
{
Block b = location.getWorld().getBlockAt(location);
b.setType(material);
b.setData(data);
}
}

View File

@ -0,0 +1,86 @@
package me.StevenLawson.TotalFreedomMod;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.OfflinePlayer;
import org.bukkit.block.Block;
public class TFM_RollbackManager
{
public static Map<String, List<TFM_RollbackEntry>> entries = new HashMap<String, List<TFM_RollbackEntry>>();
public static void blockUpdate(OfflinePlayer player, Block block)
{
List<TFM_RollbackEntry> e;
if (entries.containsKey(player.getName()))
{
e = entries.get(player.getName());
}
else
{
e = new ArrayList<TFM_RollbackEntry>();
}
e.add(0, new TFM_RollbackEntry(block));
entries.put(player.getName(), e);
}
public static void blockUpdate(OfflinePlayer player, TFM_RollbackEntry entry)
{
List<TFM_RollbackEntry> e;
if (entries.containsKey(player.getName()))
{
e = entries.get(player.getName());
}
else
{
e = new ArrayList<TFM_RollbackEntry>();
}
e.add(0, entry);
entries.put(player.getName(), e);
}
public static int rollback(OfflinePlayer player)
{
if (!canRollback(player.getName()))
{
TFM_Log.severe("Could not rollback player: " + player.getName() + "! No entries are set");
return 0;
}
List<TFM_RollbackEntry> e = entries.get(player.getName());
int counter = 0;
for (TFM_RollbackEntry entry : e)
{
entry.restore();
counter++;
}
entries.remove(player.getName());
return counter;
}
public static boolean canRollback(String player)
{
return entries.containsKey(player);
}
public static int purgeEntries()
{
int counter = entries.size();
entries.clear();
return counter;
}
public static int purgeEntries(String player)
{
if (!canRollback(player))
{
return 0;
}
int counter = entries.get(player).size();
entries.remove(player);
return counter;
}
}

View File

@ -5,11 +5,11 @@ import java.util.Date;
import java.util.Iterator;
import java.util.Set;
import java.util.regex.Pattern;
import net.minecraft.server.v1_5_R3.BanEntry;
import net.minecraft.server.v1_5_R3.BanList;
import net.minecraft.server.v1_5_R3.MinecraftServer;
import net.minecraft.server.v1_5_R3.PlayerList;
import net.minecraft.server.v1_5_R3.PropertyManager;
import net.minecraft.server.v1_6_R1.BanEntry;
import net.minecraft.server.v1_6_R1.BanList;
import net.minecraft.server.v1_6_R1.MinecraftServer;
import net.minecraft.server.v1_6_R1.PlayerList;
import net.minecraft.server.v1_6_R1.PropertyManager;
import org.bukkit.ChatColor;
import org.bukkit.Server;
import org.bukkit.entity.Player;
@ -276,20 +276,20 @@ public class TFM_ServerInterface
}
}
else // if user is superadmin
{
{
// force-allow superadmins to log in
event.allow();
if (isIPBanned(player_ip))
{
unbanIP(player_ip);
}
if (isNameBanned(player_name))
{
unbanUsername(player_name);
}
for (Player test_player : server.getOnlinePlayers())
{
if (test_player.getName().equalsIgnoreCase(player_name))
@ -297,7 +297,7 @@ public class TFM_ServerInterface
test_player.kickPlayer("An admin just logged in with the username you are using.");
}
}
if (server.getOnlinePlayers().length >= server.getMaxPlayers())
{
for (Player op : server.getOnlinePlayers())
@ -308,7 +308,7 @@ public class TFM_ServerInterface
return;
}
}
// if the server is full of superadmins, however unlikely that might be, this will prevent an infinite loop.
if (server.getOnlinePlayers().length >= server.getMaxPlayers())
{

View File

@ -0,0 +1,208 @@
package me.StevenLawson.TotalFreedomMod;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.WordUtils;
import org.bukkit.ChatColor;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
public class TFM_ServiceChecker
{
private static final Map<String, String[]> SERVICE_MAP = new HashMap<String, String[]>();
public static String check_url = "http://xpaw.ru/mcstatus/status.json";
public static String version = "1.0";
public static String last_updated = ""; // On xpaw.ru
static
{
// <"up", "down", "problem">, <"Online", "Quite Slow", "Error 505", etc>, <String (Uptime percentage)>
SERVICE_MAP.put("website", new String[]
{
"up", "Online", "100.00"
});
SERVICE_MAP.put("session", new String[]
{
"up", "Online", "100.00"
});
SERVICE_MAP.put("login", new String[]
{
"up", "Online", "100.00"
});
SERVICE_MAP.put("account", new String[]
{
"up", "Online", "100.00"
});
SERVICE_MAP.put("skins", new String[]
{
"up", "Online", "100.00"
});
SERVICE_MAP.put("realms", new String[]
{
"up", "Online", "100.00"
});
}
public static Runnable checker = new Runnable()
{
@Override
public void run()
{
runCheck();
}
};
public static void runCheck()
{
TotalFreedomMod.server.getScheduler().runTaskAsynchronously(TotalFreedomMod.plugin, new Runnable()
{
@Override
public void run()
{
try
{
/* // Nubcakes be 403'ing us >;o
BufferedReader in = new BufferedReader(new InputStreamReader(new URL(check_url).openStream()));
JSONObject service_json = (JSONObject) JSONValue.parse(in.readLine());
in.close();
*/
// Well, lets bypass that! >:D
HttpURLConnection connection = (HttpURLConnection) new URL(check_url).openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("User-Agent", "Mozilla/5.0");
connection.setRequestProperty("Host", "xpaw.ru");
connection.setRequestProperty("Accept", "*/*");
connection.setUseCaches(false);
connection.setDoInput(true);
connection.setDoOutput(false);
InputStream is = connection.getInputStream();
BufferedReader in = new BufferedReader(new InputStreamReader(is));
JSONObject service_json = (JSONObject) JSONValue.parse(in.readLine());
in.close();
connection.disconnect();
version = String.valueOf(service_json.get("v"));
last_updated = (String) service_json.get("last_updated");
JSONObject services = (JSONObject) service_json.get("report");
for (String service : SERVICE_MAP.keySet())
{
JSONObject service_info = (JSONObject) services.get(service);
SERVICE_MAP.put(service, new String[]
{
(String) service_info.get("status"),
(String) service_info.get("title"),
(String) service_info.get("uptime")
});
}
}
catch (Exception ex)
{
TFM_Log.severe(ex);
}
}
});
}
public static String getFormattedStatus(String service_name)
{
String[] service = SERVICE_MAP.get(service_name);
String status = ("up".equals(service[0]) ? ChatColor.GREEN
: ("down".equals(service[0]) ? ChatColor.RED : ChatColor.GOLD)).toString();
status += service[1] + ChatColor.GRAY + " (";
status += (Float.parseFloat(service[2]) >= 96.0 ? ChatColor.GREEN
: (Float.parseFloat(service[2]) > 90.0 ? ChatColor.GOLD : ChatColor.RED));
status += service[2] + "%" + ChatColor.GRAY + ")";
return ChatColor.GRAY + WordUtils.capitalize(service_name) + ChatColor.WHITE + ": " + status;
}
public static List<String> getAllStatuses()
{
List<String> statuses = new ArrayList<String>();
for (String status : SERVICE_MAP.keySet())
{
statuses.add(getFormattedStatus(status));
}
return statuses;
}
}
/* // Mojang status
public static final Map<String, String> SERVICE_MAP = new HashMap<String, String>();
static
{
SERVICE_MAP.put("minecraft.net", "Minecraft.net");
SERVICE_MAP.put("login.minecraft.net", "Minecraft Logins");
SERVICE_MAP.put("session.minecraft.net", "Minecraft Multiplayer Sessions");
SERVICE_MAP.put("account.mojang.com", "Mojang Accounts Website");
SERVICE_MAP.put("auth.mojang.com", "Mojang Accounts Login");
SERVICE_MAP.put("skins.minecraft.net", "Minecraft Skins");
}
server.getScheduler().runTaskAsynchronously(plugin, new Runnable()
{
@SuppressWarnings("unchecked")
@Override
public void run()
{
try
{
URL mojang_status = new URL("http://status.mojang.com/check");
BufferedReader in = new BufferedReader(new InputStreamReader(mojang_status.openStream()));
JSONArray status_json = (JSONArray) JSONValue.parse(in.readLine());
in.close();
Map<String, Boolean> service_status = new HashMap<String, Boolean>();
Iterator status_it = status_json.iterator();
while (status_it.hasNext())
{
JSONObject service = (JSONObject) status_it.next();
Iterator service_it = service.entrySet().iterator();
while (service_it.hasNext())
{
Entry<String, String> pair = (Entry<String, String>) service_it.next();
service_status.put(pair.getKey(), (pair.getValue().equals("green") ? Boolean.TRUE : Boolean.FALSE));
}
}
List<String> status_output = new ArrayList<String>();
Iterator<Entry<String, Boolean>> output_it = service_status.entrySet().iterator();
while (output_it.hasNext())
{
Entry<String, Boolean> pair = output_it.next();
String service_name = pair.getKey();
boolean service_online = pair.getValue().booleanValue();
if (SERVICE_MAP.containsKey(service_name))
{
service_name = SERVICE_MAP.get(service_name);
}
status_output.add(String.format("%s is %s", service_name, (service_online ? ChatColor.GREEN + "ONLINE" + ChatColor.GRAY : ChatColor.RED + "OFFLINE" + ChatColor.GRAY)));
}
playerMsg(String.format("Mojang Service Status: %s.", StringUtils.join(status_output, ", ")), ChatColor.GRAY);
}
catch (Exception ex)
{
TFM_Log.severe(ex);
}
}
});
*/

View File

@ -27,6 +27,7 @@ public class TFM_Util
private static final Map<String, Integer> eject_tracker = new HashMap<String, Integer>();
public static final Map<String, EntityType> mobtypes = new HashMap<String, EntityType>();
public static final List<String> STOP_COMMANDS = Arrays.asList("stop", "off", "end", "halt", "die");
public static final List<String> DEVELOPERS = Arrays.asList("Madgeek1450", "DarthSalamon", "AcidicCyanide", "wild1145", "HeXeRei452", "disaster839");
static
{
@ -973,22 +974,25 @@ public class TFM_Util
}
}
}
public static String getPrefix(CommandSender sender, boolean senderIsConsole)
{
String prefix;
if (senderIsConsole) {
prefix = ChatColor.BLUE + "(Console)";
} else {
if (senderIsConsole)
{
prefix = ChatColor.BLUE + "(Console)";
}
else
{
if (TFM_SuperadminList.isSeniorAdmin(sender))
{
prefix = ChatColor.LIGHT_PURPLE + "(SrA)";
} else
}
else
{
prefix = ChatColor.GOLD + "(SA)";
}
if (sender.getName().equalsIgnoreCase("Madgeek1450")
|| sender.getName().equalsIgnoreCase("DarthSalamon"))
if (DEVELOPERS.contains(sender.getName()))
{
prefix = ChatColor.DARK_PURPLE + "(Dev)";
}

View File

@ -30,6 +30,7 @@ public class TotalFreedomMod extends JavaPlugin
public static final Server server = Bukkit.getServer();
public static final long HEARTBEAT_RATE = 5L; //Seconds
public static final long SERVICE_CHECKER_RATE = 30L;
public static final String CONFIG_FILE = "config.yml";
public static final String SUPERADMIN_FILE = "superadmin.yml";
@ -102,10 +103,16 @@ public class TotalFreedomMod extends JavaPlugin
TFM_Util.deleteFolder(new File("./_deleteme"));
// Heartbeat
server.getScheduler().scheduleSyncRepeatingTask(this, new TFM_Heartbeat(this), HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L);
// Service uptime checker
server.getScheduler().scheduleSyncRepeatingTask(this, TFM_ServiceChecker.checker, SERVICE_CHECKER_RATE * 20L, 5 * 20L);
TFM_CommandLoader.getInstance().scan();
// metrics @ http://mcstats.org/plugin/TotalFreedomMod
try
{
@ -201,7 +208,10 @@ public class TotalFreedomMod extends JavaPlugin
public static boolean allowLavaPlace = false;
public static boolean allowWaterPlace = false;
public static Boolean allowExplosions = false;
public static boolean allowFliudSpread = false;
public static boolean allowTntMinecarts = false;
public static double explosiveRadius = 4.0D;
public static List<String> blockedCommands = new ArrayList<String>();
public static boolean autoEntityWipe = true;
public static boolean nukeMonitor = true;
public static int nukeMonitorCountBreak = 100;
@ -222,7 +232,6 @@ public class TotalFreedomMod extends JavaPlugin
public static boolean tossmobEnabled = false;
public static boolean generateFlatlands = true;
public static String flatlandsGenerationParams = "16,stone,32,dirt,1,grass";
public static boolean allowFliudSpread = false;
public static boolean adminOnlyMode = false;
public static boolean protectedAreasEnabled = true;
public static boolean autoProtectSpawnpoints = true;
@ -245,7 +254,9 @@ public class TotalFreedomMod extends JavaPlugin
allowLavaPlace = config.getBoolean("allow_lava_place", allowLavaPlace);
allowWaterPlace = config.getBoolean("allow_water_place", allowWaterPlace);
allowExplosions = config.getBoolean("allow_explosions", allowExplosions);
allowTntMinecarts = config.getBoolean("allow_tnt_minecarts", allowTntMinecarts);
explosiveRadius = config.getDouble("explosiveRadius", explosiveRadius);
blockedCommands = config.getStringList("blocked_commands");
autoEntityWipe = config.getBoolean("auto_wipe", autoEntityWipe);
nukeMonitor = config.getBoolean("nuke_monitor", nukeMonitor);
nukeMonitorCountBreak = config.getInt("nuke_monitor_count_break", nukeMonitorCountBreak);
@ -272,9 +283,9 @@ public class TotalFreedomMod extends JavaPlugin
autoProtectSpawnpoints = config.getBoolean("auto_protect_spawnpoints", autoProtectSpawnpoints);
autoProtectRadius = config.getDouble("auto_protect_radius", autoProtectRadius);
host_sender_names = config.getStringList("host_sender_names");
twitterbotEnabled = config.getBoolean("twitterbot_enabled");
twitterbotUrl = config.getString("twitterbot_url");
twitterbotSecret = config.getString("twitterbot_secret");
twitterbotEnabled = config.getBoolean("twitterbot_enabled", twitterbotEnabled);
twitterbotUrl = config.getString("twitterbot_url", twitterbotUrl);
twitterbotSecret = config.getString("twitterbot_secret", twitterbotSecret);
}
catch (Exception ex)
{

View File

@ -7,3 +7,4 @@ badplayer1:
- 321.321.321.321
badplayer2:
- 111.111.111.111
badplayer3: []

View File

@ -1,6 +1,6 @@
name: TotalFreedomMod
main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod
version: 2.14
version: 2.21
description: Plugin for the Total Freedom server.
authors: [StevenLawson / Madgeek1450, JeromSar / DarthSalamon]

View File

@ -15,7 +15,7 @@ superadmins:
- 127.0.0.1
- 8.8.8.8
last_login: Sun, 11 Nov 2012 01:09:14 -0500
custom_login_message: the &5Chief-Developer&b and &6Master-ass-kicker&b.
custom_login_message: the &4Co-Founder&b and &6Master-ass-kicker&b.
is_senior_admin: true
console_aliases:
- madgeek