This commit is contained in:
Steven Lawson 2013-04-14 16:37:33 -04:00
commit e433d9605f
96 changed files with 431 additions and 494 deletions

View File

@ -1,5 +1,5 @@
#Sun, 24 Mar 2013 16:31:08 -0400
#Tue, 09 Apr 2013 22:30:34 -0400
program.VERSION=2.12
program.BUILDNUM=111
program.BUILDDATE=03/24/2013 04\:31 PM
program.VERSION=2.13
program.BUILDNUM=157
program.BUILDDATE=04/09/2013 10\:30 PM

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Sun Mar 24 16:31:08 EDT 2013
build.number=112
#Tue Apr 09 22:30:34 EDT 2013
build.number=158

View File

@ -1,4 +1,4 @@
# TotalFreedomMod v2.12 Configuration
# TotalFreedomMod v2.13 Configuration
# by Madgeek1450 and DarthSalamon
# Block placement prevention:

View File

@ -0,0 +1,14 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface CommandParameters
{
String description();
String usage();
String aliases() default ""; // "alias1,alias2,alias3" - no spaces
}

View File

@ -8,6 +8,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_CONSOLE, block_host_console = true)
@CommandParameters(description = "Close server to non-superadmins.", usage = "/<command> [on | off]")
public class Command_adminmode extends TFM_Command
{
@Override

View File

@ -8,6 +8,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Block all commands for a specific player.", usage = "/<command> <purge | <partialname>>", aliases = "blockcommands,blockcommand")
public class Command_blockcmd extends TFM_Command
{
@Override

View File

@ -1,40 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
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)
public class Command_blockcommand 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)
{
sender.sendMessage(ex.getMessage());
return true;
}
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
playerdata.setCommandsBlocked(!playerdata.allCommandsBlocked());
TFM_Util.adminAction(sender.getName(), (playerdata.allCommandsBlocked() ? "B" : "Unb") + "locking all commands for " + p.getName(), true);
TFM_Util.playerMsg(sender, (playerdata.allCommandsBlocked() ? "B" : "Unb") + "locked all commands.");
return true;
}
}

View File

@ -10,6 +10,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Place a cage around someone.", usage = "/<command> <partialname> <off | [[outermaterial] [innermaterial]]>")
public class Command_cage extends TFM_Command
{
@Override

View File

@ -11,6 +11,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@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
{
@Override

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Minecart;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
@CommandParameters(description = "Sit in nearest minecart. If target is in a minecart already, they will disembark.", usage = "/<command> [partialname]")
public class Command_cartsit extends TFM_Command
{
@Override

View File

@ -5,6 +5,7 @@ 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

View File

@ -13,6 +13,7 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
@CommandParameters(description = "Show all commands for all server plugins.", usage = "/<command>")
public class Command_cmdlist extends TFM_Command
{
@Override

View File

@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Spy on commands", usage = "/<command>")
public class Command_cmdspy extends TFM_Command
{
@Override

View File

@ -1,38 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.Random;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
public class Command_cookie extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
StringBuilder output = new StringBuilder();
Random randomGenerator = new Random();
String[] words = TotalFreedomMod.CAKE_LYRICS.replaceAll("cake", "cookies").split(" ");
for (String word : words)
{
String color_code = Integer.toHexString(1 + randomGenerator.nextInt(14));
output.append(ChatColor.COLOR_CHAR).append(color_code).append(word).append(" ");
}
for (Player p : server.getOnlinePlayers())
{
ItemStack heldItem = new ItemStack(Material.COOKIE, 1);
p.getInventory().setItem(p.getInventory().firstEmpty(), heldItem);
}
TFM_Util.bcastMsg(output.toString());
return true;
}
}

View File

@ -7,6 +7,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 creative, or define someone's username to change theirs.", usage = "/<command> [partialname]")
public class Command_creative extends TFM_Command
{
@Override

View File

@ -7,6 +7,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_CONSOLE)
@CommandParameters(description = "Telnet command - Send a chat message with chat formatting over telnet.", usage = "/<command> <message...>")
public class Command_csay extends TFM_Command
{
@Override

View File

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

View File

@ -7,6 +7,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Deop a player.", usage = "/<command> <playername>")
public class Command_deop extends TFM_Command
{
@Override

View File

@ -7,6 +7,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Deop everyone on the server.", usage = "/<command>")
public class Command_deopall extends TFM_Command
{
@Override

View File

@ -15,6 +15,7 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Fill nearby dispensers with a set of items of your choice.", usage = "/<command> <radius> <comma,separated,items>")
public class Command_dispfill extends TFM_Command
{
@Override

View File

@ -10,6 +10,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE)
@CommandParameters(description = "For the bad Superadmins.", usage = "/<command> <playername>")
public class Command_doom extends TFM_Command
{
@Override

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Enchant items.", usage = "/<command> <list | addall | reset | add <name> | remove <name>>")
public class Command_enchant extends TFM_Command
{
@Override

View File

@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
@CommandParameters(description = "Goto the ender / \"The End\".", usage = "/<command>")
public class Command_ender extends TFM_Command
{
@Override

View File

@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Push people away from you.", usage = "/<command> [radius] [strength]")
public class Command_expel extends TFM_Command
{
@Override

View File

@ -7,6 +7,7 @@ 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

View File

@ -6,6 +6,7 @@ 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

View File

@ -6,6 +6,7 @@ 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

View File

@ -7,6 +7,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
@CommandParameters(description = "Goto the flatlands.", usage = "/<command>")
public class Command_flatlands extends TFM_Command
{
@Override

View File

@ -6,6 +6,7 @@ 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

View File

@ -10,6 +10,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@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
{
@Override

View File

@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "You'll never even see it coming.", usage = "/<command>")
public class Command_fuckoff extends TFM_Command
{
@Override

View File

@ -10,6 +10,9 @@ import org.bukkit.command.CommandSender;
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> <targethash>] ]")
public class Command_gadmin extends TFM_Command
{
@Override

View File

@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Send a command as someone else.", usage = "/<command> <fromname> <outcommand>")
public class Command_gcmd extends TFM_Command
{
@Override

View File

@ -13,6 +13,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Ban/Unban any player, even those who are not logged in anymore.", usage = "/<command> <purge | <ban | unban> <username>>")
public class Command_glist extends TFM_Command
{
@Override

View File

@ -10,6 +10,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Makes someone GTFO (deop and ip ban by username).", usage = "/<command> <partialname>")
public class Command_gtfo extends TFM_Command
{
@Override

View File

@ -10,6 +10,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Halts a player", usage = "/<command> <<partialname> | all | purge | list>")
public class Command_halt extends TFM_Command
{
@Override

View File

@ -10,6 +10,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "View ticks-per-second", usage = "/<command>")
public class Command_health extends TFM_Command
{
@Override

View File

@ -8,6 +8,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH, block_host_console = true)
@CommandParameters(description = "Kick all non-superadmins on server.", usage = "/<command>")
public class Command_kicknoob extends TFM_Command
{
@Override

View File

@ -11,6 +11,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Set a landmine trap.", usage = "/<command>")
public class Command_landmine extends TFM_Command
{
@Override

View File

@ -1,13 +1,13 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
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 = "Show the last command that someone used.", usage = "/<command> <player>")
public class Command_lastcmd extends TFM_Command
{
@Override

View File

@ -6,6 +6,7 @@ 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

View File

@ -6,6 +6,7 @@ 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

View File

@ -11,6 +11,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command>", aliases = "who")
public class Command_list extends TFM_Command
{
private static enum ListFilter

View File

@ -9,6 +9,7 @@ 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

View File

@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitTask;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = 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
{
@Override

View File

@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_CONSOLE)
@CommandParameters(description = "Control mob rezzing parameters.", usage = "/<command> <on|off|setmax <count>|dragon|giant|ghast|slime>")
public class Command_moblimiter extends TFM_Command
{
@Override

View File

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

View File

@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Modern weaponry, FTW. Use 'draw' to start firing, 'sling' to stop firing.", usage = "/<command> <draw | sling>")
public class Command_mp44 extends TFM_Command
{
@Override

View File

@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
@CommandParameters(description = "Goto the nether.", usage = "/<command>")
public class Command_nether extends TFM_Command
{
@Override

View File

@ -6,6 +6,7 @@ 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

View File

@ -8,6 +8,10 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(
description = "AdminChat - Talk privately with other admins. Using <command> itself will toggle AdminChat on and off for all messages.",
usage = "/<command> [message...]",
aliases = "adminchat")
public class Command_o extends TFM_Command
{
@Override

View File

@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true)
@CommandParameters(description = "Switch server online-mode on and off.", usage = "/<command> <on | off>")
public class Command_onlinemode extends TFM_Command
{
@Override

View File

@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
@CommandParameters(description = "Makes a player operator", usage = "/<command> <playername>")
public class Command_op extends TFM_Command
{
@Override

View File

@ -8,6 +8,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Op everyone on the server, optionally change everyone's gamemode at the same time.", usage = "/<command> [-c | -s]")
public class Command_opall extends TFM_Command
{
@Override

View File

@ -7,6 +7,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Automatically ops user.", usage = "/<command>")
public class Command_opme extends TFM_Command
{
@Override

View File

@ -8,6 +8,7 @@ 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>")
public class Command_ops extends TFM_Command
{
@Override

View File

@ -10,6 +10,7 @@ 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]")
public class Command_orbit extends TFM_Command
{
@Override

View File

@ -8,6 +8,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true)
@CommandParameters(description = "Manage permanently banned players and IPs.", usage = "/<command> <list | reload>")
public class Command_permban extends TFM_Command
{
@Override

View File

@ -8,6 +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 >")
public class Command_plugincontrol extends TFM_Command
{
private enum CommandMode

View File

@ -14,6 +14,9 @@ import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
@CommandParameters(
description = "Manipulate potion effects. Duration is measured in server ticks (~20 ticks per second).",
usage = "/<command> <list | clear [target_name] | add <type> <duration> <amplifier> [target_name]>")
public class Command_potion extends TFM_Command
{
@Override

View File

@ -6,6 +6,9 @@ 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

View File

@ -8,6 +8,9 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(
description = "Protect areas so that only superadmins can directly modify blocks in those areas. WorldEdit and other such plugins might bypass this.",
usage = "/<command> <list | clear | remove <label> | add <label> <radius>>")
public class Command_protectarea extends TFM_Command
{
@Override

View File

@ -7,6 +7,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Quick De-Op - deop someone based on a partial name.", usage = "/<command> <partialname>")
public class Command_qdeop extends TFM_Command
{
@Override

View File

@ -7,6 +7,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Quick Op - op someone based on a partial name.", usage = "/<command> <partialname>")
public class Command_qop extends TFM_Command
{
@Override

View File

@ -11,6 +11,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Shows nearby people sorted by distance.", usage = "/<command> [range]")
public class Command_radar extends TFM_Command
{
@Override

View File

@ -7,6 +7,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
@CommandParameters(description = "Shows your rank.", usage = "/<command>")
public class Command_rank extends TFM_Command
{
@Override

View File

@ -7,6 +7,7 @@ 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>")
public class Command_rawsay extends TFM_Command
{
@Override

View File

@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Remove various server entities that may cause lag, such as dropped items, minecarts, and boats.", usage = "/<command> <carts>")
public class Command_rd extends TFM_Command
{
@Override

View File

@ -8,6 +8,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, block_host_console = 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
{
@Override

View File

@ -12,6 +12,7 @@ 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>>")
public class Command_saconfig extends TFM_Command
{
@Override

View File

@ -8,6 +8,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Broadcasts the given message as the console, includes sender name.", usage = "/<command> <message>")
public class Command_say extends TFM_Command
{
@Override

View File

@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Sets your expierence level.", usage = "/<command> [level]")
public class Command_setlevel extends TFM_Command
{
@Override

View File

@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Set world spawnpoint.", usage = "/<command>")
public class Command_setspawnworld extends TFM_Command
{
@Override

View File

@ -10,6 +10,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Someone being a little bitch? Smite them down...", usage = "/<command> [playername]")
public class Command_smite extends TFM_Command
{
@Override

View File

@ -22,6 +22,7 @@ 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>();

View File

@ -10,6 +10,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Mutes a player with brute force.", usage = "/<command> [<player> | list | purge | all]", aliases = "mute")
public class Command_stfu extends TFM_Command
{
@Override

View File

@ -7,6 +7,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Kicks everyone and stops the server.", usage = "/<command>")
public class Command_stop extends TFM_Command
{
@Override

View File

@ -8,6 +8,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]")
public class Command_survival extends TFM_Command
{
@Override

View File

@ -12,6 +12,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Temporarily ban someone.", usage = "/<command> [playername] [duration] [reason]")
public class Command_tempban extends TFM_Command
{
private static final SimpleDateFormat date_format = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");

View File

@ -1,35 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_RunSystemCommand;
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)
public class Command_terminal extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
String command;
try
{
StringBuilder command_bldr = new StringBuilder();
for (int i = 0; i < args.length; i++)
{
command_bldr.append(args[i]).append(" ");
}
command = command_bldr.toString().trim();
}
catch (Throwable ex)
{
playerMsg("Error building command: " + ex.getMessage());
return true;
}
playerMsg("Running system command: " + command);
server.getScheduler().runTaskAsynchronously(plugin, new TFM_RunSystemCommand(command, plugin));
return true;
}
}

View File

@ -11,6 +11,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
@CommandParameters(description = "Shows all banned player names. Superadmins may optionally use 'purge' to clear the list.", usage = "/<command> [purge]")
public class Command_tfbanlist extends TFM_Command
{
@Override

View File

@ -12,6 +12,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
@CommandParameters(description = "Shows all banned IPs. Superadmins may optionally use 'purge' to clear the list.", usage = "/<command> [purge]")
public class Command_tfipbanlist extends TFM_Command
{
@Override

View File

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

View File

@ -13,6 +13,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Throw a mob in the direction you are facing when you left click with a stick.", usage = "/<command> <mobtype [speed] | off | list>")
public class Command_tossmob extends TFM_Command
{
@Override

View File

@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Manage your twitter.", usage = "/<command> <set [twitter] | info | enable | disable>")
public class Command_twitter extends TFM_Command
{
@Override

View File

@ -7,6 +7,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Undisguises all players", usage = "/<command>")
public class Command_uall extends TFM_Command
{
@Override

View File

@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Enable/disable water placement.", usage = "/<command> <on | off>")
public class Command_waterplace extends TFM_Command
{
@Override

View File

@ -10,6 +10,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
@CommandParameters(description = "Manage the whitelist.", usage = "/<command> <on | off | list | count | add <player> | remove <player> | addall | purge>")
public class Command_whitelist extends TFM_Command
{
@Override

View File

@ -7,6 +7,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Run any command on all users, username placeholder = ?.", usage = "/<command> [fluff] ? [fluff] ?")
public class Command_wildcard extends TFM_Command
{
@Override

View File

@ -7,6 +7,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true)
@CommandParameters(description = "Wipe the flatlands map. Requires manual restart after command is used.", usage = "/<command>")
public class Command_wipeflatlands extends TFM_Command
{
@Override

View File

@ -1,77 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.io.File;
import java.io.IOException;
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.entity.Player;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, block_host_console = true)
public class Command_ziptool 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("zip"))
{
File directory = new File("./" + args[1]);
if (!directory.isDirectory())
{
playerMsg(directory.getPath() + " is not a directory.");
return true;
}
File output = new File(directory.getParent() + "/" + directory.getName() + ".zip");
playerMsg("Zipping '" + directory.getPath() + "' to '" + output.getPath() + "'.");
try
{
TFM_Util.zip(directory, output, true, sender);
}
catch (IOException ex)
{
TFM_Log.severe(ex);
}
playerMsg("Zip finished.");
}
else if (args[0].equalsIgnoreCase("unzip"))
{
File output = new File(args[1]);
if (!output.exists() || !output.isFile())
{
playerMsg(output.getPath() + " is not a file.");
return true;
}
playerMsg("Unzipping '" + output.getPath() + "'.");
try
{
TFM_Util.unzip(output, output.getParentFile());
}
catch (IOException ex)
{
TFM_Log.severe(ex);
}
playerMsg("Unzip finished.");
}
else
{
return false;
}
return true;
}
}

View File

@ -12,64 +12,61 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class TFM_Command
public abstract class TFM_Command
{
protected TotalFreedomMod plugin;
protected Server server;
private CommandSender commandsender;
private CommandSender commandSender;
private Class<?> commandClass;
public TFM_Command()
{
}
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
TFM_Log.severe("Command Error: Command not implemented: " + cmd.getName());
sender.sendMessage(ChatColor.RED + "Command Error: Command not implemented: " + cmd.getName());
return false;
}
abstract public boolean run(final CommandSender sender, final Player sender_p, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole);
public void setPlugin(TotalFreedomMod plugin)
public void setup(final TotalFreedomMod plugin, final CommandSender commandSender, final Class<?> commandClass)
{
this.plugin = plugin;
this.server = plugin.getServer();
this.server = this.plugin.getServer();
this.commandSender = commandSender;
this.commandClass = commandClass;
}
public void setCommandsender(CommandSender commandsender)
public void playerMsg(final CommandSender sender, final String message, final ChatColor color)
{
this.commandsender = commandsender;
if (sender == null)
{
return;
}
public void playerMsg(CommandSender sender, String message, ChatColor color) // complete function
{
sender.sendMessage(color + message);
}
public void playerMsg(String message, ChatColor color)
public void playerMsg(final String message, final ChatColor color)
{
playerMsg(commandsender, message, color);
playerMsg(commandSender, message, color);
}
public void playerMsg(CommandSender sender, String message)
public void playerMsg(final CommandSender sender, final String message)
{
playerMsg(sender, message, ChatColor.GRAY);
}
public void playerMsg(String message)
public void playerMsg(final String message)
{
playerMsg(commandsender, message);
playerMsg(commandSender, message);
}
public boolean senderHasPermission(Class<?> cmd_class, CommandSender sender)
public boolean senderHasPermission()
{
CommandPermissions permissions = cmd_class.getAnnotation(CommandPermissions.class);
CommandPermissions permissions = commandClass.getAnnotation(CommandPermissions.class);
if (permissions != null)
{
boolean is_super = TFM_SuperadminList.isUserSuperadmin(sender);
boolean is_super = TFM_SuperadminList.isUserSuperadmin(this.commandSender);
boolean is_senior = false;
if (is_super)
{
is_senior = TFM_SuperadminList.isSeniorAdmin(sender);
is_senior = TFM_SuperadminList.isSeniorAdmin(this.commandSender);
}
AdminLevel level = permissions.level();
@ -77,9 +74,9 @@ public class TFM_Command
boolean block_host_console = permissions.block_host_console();
Player sender_p = null;
if (sender instanceof Player)
if (this.commandSender instanceof Player)
{
sender_p = (Player) sender;
sender_p = (Player) this.commandSender;
}
if (sender_p == null)
@ -92,7 +89,7 @@ public class TFM_Command
{
return false;
}
else if (block_host_console && TFM_Util.isFromHostConsole(sender.getName()))
else if (block_host_console && TFM_Util.isFromHostConsole(this.commandSender.getName()))
{
return false;
}
@ -134,10 +131,14 @@ public class TFM_Command
}
return true;
}
else
{
TFM_Log.warning(commandClass.getName() + " is missing permissions annotation.");
}
return true;
}
public Player getPlayer(String partialname) throws CantFindPlayerException
public Player getPlayer(final String partialname) throws CantFindPlayerException
{
List<Player> matches = server.matchPlayer(partialname);
if (matches.isEmpty())

View File

@ -0,0 +1,253 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.io.IOException;
import java.security.CodeSource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandException;
import org.bukkit.command.CommandMap;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginIdentifiableCommand;
import org.bukkit.plugin.Plugin;
public class TFM_CommandLoader
{
public static Pattern COMMAND_CLASS_PATTERN = Pattern.compile(TotalFreedomMod.COMMAND_PATH.replace('.', '/') + "/(" + TotalFreedomMod.COMMAND_PREFIX + "[^\\$]+)\\.class");
private List<TFM_CommandInfo> commandList = null;
private TFM_CommandLoader()
{
}
public void scan()
{
CommandMap commandMap = TFM_Util.getField(Bukkit.getServer().getPluginManager(), "commandMap");
if (commandMap == null)
{
TFM_Log.severe("Error loading command map.");
return;
}
if (commandList == null)
{
commandList = getCommands();
}
for (TFM_CommandInfo commandInfo : commandList)
{
String description = commandInfo.getDescription();
switch (commandInfo.getLevel())
{
case SENIOR:
description = "Senior " + (commandInfo.getSource() == SourceType.ONLY_CONSOLE ? "Console" : "") + " Command - " + description;
break;
case SUPER:
description = "Superadmin Command - " + description;
break;
case OP:
description = "OP Command - " + description;
break;
}
TFM_DynamicCommand dynamicCommand = new TFM_DynamicCommand(commandInfo.getCommandName(), description, commandInfo.getUsage(), commandInfo.getAliases());
commandMap.register(TotalFreedomMod.plugin.getDescription().getName(), dynamicCommand);
}
}
private static List<TFM_CommandInfo> getCommands()
{
List<TFM_CommandInfo> commandList = new ArrayList<TFM_CommandInfo>();
try
{
CodeSource codeSource = TotalFreedomMod.class.getProtectionDomain().getCodeSource();
if (codeSource != null)
{
ZipInputStream zip = new ZipInputStream(codeSource.getLocation().openStream());
ZipEntry zipEntry;
while ((zipEntry = zip.getNextEntry()) != null)
{
String entryName = zipEntry.getName();
Matcher matcher = COMMAND_CLASS_PATTERN.matcher(entryName);
if (matcher.find())
{
try
{
Class<?> commandClass = Class.forName(TotalFreedomMod.COMMAND_PATH + "." + matcher.group(1));
CommandPermissions commandPermissions = (CommandPermissions) commandClass.getAnnotation(CommandPermissions.class);
CommandParameters commandParameters = (CommandParameters) commandClass.getAnnotation(CommandParameters.class);
if (commandPermissions != null && commandParameters != null)
{
TFM_CommandInfo commandInfo = new TFM_CommandInfo(
commandClass,
matcher.group(1).split("_")[1],
commandPermissions.level(),
commandPermissions.source(),
commandPermissions.block_host_console(),
commandParameters.description(),
commandParameters.usage(),
commandParameters.aliases());
commandList.add(commandInfo);
}
}
catch (ClassNotFoundException ex)
{
TFM_Log.severe(ex);
}
}
}
}
}
catch (IOException ex)
{
TFM_Log.severe(ex);
}
return commandList;
}
private static class TFM_CommandInfo
{
private final String commandName;
private final Class<?> commandClass;
private final AdminLevel level;
private final SourceType source;
private final boolean blockHostConsole;
private final String description;
private final String usage;
private final List<String> aliases;
public TFM_CommandInfo(Class<?> commandClass, String commandName, AdminLevel level, SourceType source, boolean blockHostConsole, String description, String usage, String aliases)
{
this.commandName = commandName;
this.commandClass = commandClass;
this.level = level;
this.source = source;
this.blockHostConsole = blockHostConsole;
this.description = description;
this.usage = usage;
this.aliases = Arrays.asList(aliases.split(","));
}
public List<String> getAliases()
{
return aliases;
}
public Class<?> getCommandClass()
{
return commandClass;
}
public String getCommandName()
{
return commandName;
}
public String getDescription()
{
return description;
}
public AdminLevel getLevel()
{
return level;
}
public SourceType getSource()
{
return source;
}
public String getUsage()
{
return usage;
}
public boolean getBlockHostConsole()
{
return blockHostConsole;
}
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("commandName: ").append(commandName);
sb.append("\ncommandClass: ").append(commandClass.getName());
sb.append("\nlevel: ").append(level);
sb.append("\nsource: ").append(source);
sb.append("\nblock_host_console: ").append(blockHostConsole);
sb.append("\ndescription: ").append(description);
sb.append("\nusage: ").append(usage);
sb.append("\naliases: ").append(aliases);
return sb.toString();
}
}
private class TFM_DynamicCommand extends Command implements PluginIdentifiableCommand
{
public TFM_DynamicCommand(String commandName, String description, String usage, List<String> aliases)
{
super(commandName, description, usage, aliases);
}
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args)
{
boolean success = false;
if (!getPlugin().isEnabled())
{
return false;
}
try
{
success = getPlugin().onCommand(sender, this, commandLabel, args);
}
catch (Throwable ex)
{
throw new CommandException("Unhandled exception executing command '" + commandLabel + "' in plugin " + getPlugin().getDescription().getFullName(), ex);
}
if (!success && getUsage().length() > 0)
{
for (String line : getUsage().replace("<command>", commandLabel).split("\n"))
{
sender.sendMessage(line);
}
}
return success;
}
@Override
public Plugin getPlugin()
{
return TotalFreedomMod.plugin;
}
}
public static TFM_CommandLoader getInstance()
{
return TFM_CommandScannerHolder.INSTANCE;
}
private static class TFM_CommandScannerHolder
{
private static final TFM_CommandLoader INSTANCE = new TFM_CommandLoader();
}
}

View File

@ -1,6 +1,7 @@
package me.StevenLawson.TotalFreedomMod;
import java.io.*;
import java.lang.reflect.Field;
import java.net.URI;
import java.net.URL;
import java.nio.channels.Channels;
@ -984,4 +985,28 @@ public class TFM_Util
}
return sb.toString();
}
//getField: Borrowed from WorldEdit
@SuppressWarnings("unchecked")
public static <T> T getField(Object from, String name)
{
Class<?> checkClass = from.getClass();
do
{
try
{
Field field = checkClass.getDeclaredField(name);
field.setAccessible(true);
return (T) field.get(from);
}
catch (NoSuchFieldException ex)
{
}
catch (IllegalAccessException ex)
{
}
}
while (checkClass.getSuperclass() != Object.class && ((checkClass = checkClass.getSuperclass()) != null));
return null;
}
}

View File

@ -5,6 +5,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import me.StevenLawson.TotalFreedomMod.Commands.TFM_Command;
import me.StevenLawson.TotalFreedomMod.Commands.TFM_CommandLoader;
import me.StevenLawson.TotalFreedomMod.Listener.TFM_BlockListener;
import me.StevenLawson.TotalFreedomMod.Listener.TFM_EntityListener;
import me.StevenLawson.TotalFreedomMod.Listener.TFM_PlayerListener;
@ -103,6 +104,8 @@ public class TotalFreedomMod extends JavaPlugin
server.getScheduler().scheduleSyncRepeatingTask(this, new TFM_Heartbeat(this), HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L);
TFM_CommandLoader.getInstance().scan();
// metrics @ http://mcstats.org/plugin/TotalFreedomMod
try
{
@ -154,8 +157,7 @@ public class TotalFreedomMod extends JavaPlugin
{
ClassLoader classLoader = TotalFreedomMod.class.getClassLoader();
dispatcher = (TFM_Command) classLoader.loadClass(String.format("%s.%s%s", COMMAND_PATH, COMMAND_PREFIX, cmd.getName().toLowerCase())).newInstance();
dispatcher.setPlugin(this);
dispatcher.setCommandsender(sender);
dispatcher.setup(this, sender, dispatcher.getClass());
}
catch (Throwable ex)
{
@ -166,7 +168,7 @@ public class TotalFreedomMod extends JavaPlugin
try
{
if (dispatcher.senderHasPermission(dispatcher.getClass(), sender))
if (dispatcher.senderHasPermission())
{
return dispatcher.run(sender, sender_p, cmd, commandLabel, args, senderIsConsole);
}

View File

@ -1,268 +1,7 @@
name: TotalFreedomMod
main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod
version: 2.12
version: 2.13
description: Plugin for the Total Freedom server.
authors: [StevenLawson / Madgeek1450, JeromSar / DarthSalamon]
commands:
adminmode:
description: Console-only command - Close server to non-superadmins.
usage: /<command> [on | off]
blockcmd:
description: Superadmin command - Block all commands for a specific player
usage: /<command> <purge | <partialname>>
aliases: [blockcommands, blockcommand]
cage:
description: Superadmin command - Place a cage around someone.
usage: /<command> <partialname> <off | [[outermaterial] [innermaterial]]>
cake:
description: Superadmin command - For the people that are still alive.
usage: /<command>
cartsit:
description: Sit in nearest minecart. If target is in a minecart already, they will disembark.
usage: /<command> [partialname]
clearall:
description: Superadmin command - Removes all entities, nicks and disguises
usage: /<command>
cmdlist:
description: Show all commands for all server plugins.
usage: /<command>
cmdspy:
description: Superadmin command - Spy on commands
usage: /<command>
cookie:
description: Superadmin command - cookies :)
usage: /<command>
creative:
description: Quickly change your own gamemode to creative, or define someone's username to change theirs.
usage: /<command> [partialname]
csay:
description: Telnet command - Send a chat message with chat formatting over telnet.
usage: /<command> <message...>
deafen:
description: Senior Command - Make some noise.
usage: /<command>
deop:
description: Superadmin command - Deop a player
usage: /<command> <playername>
deopall:
description: Superadmin command - Deop everyone on the server.
usage: /<command>
dispfill:
description: Fill nearby dispensers with a set of items of your choice.
usage: /<command> <radius> <comma,separated,items>
doom:
description: Senior Command - For the bad Superadmins.
usage: /<command> <playername>
enchant:
description: Enchant items.
usage: /<command> <list | addall | reset | add <name> | remove <name>>
expel:
description: Superadmin command - Push people away from you.
usage: /<command> [radius] [strength]
explosives:
description: Superadmin command - Enable/disable explosives and set effect radius.
usage: /<command> <on | off> [radius]
fireplace:
description: Superadmin command - Enable/disable fire placement.
usage: /<command> <on | off>
firespread:
description: Superadmin command - Enable/disable fire spread.
usage: /<command> <on | off>
flatlands:
description: Goto the flatlands.
usage: /<command>
fluidspread:
description: Superadmin command - Enable/disable fluid spread.
usage: /<command> <on | off>
fr:
description: Superadmin command - Freeze players (toggles on and off).
usage: /<command> [target | purge]
fuckoff:
description: You'll never even see it coming.
usage: /<command>
gadmin:
description: Superadmin command - 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> <targethash>] ]
gcmd:
description: Superadmin command - Send a command as someone else.
usage: /<command> <fromname> <outcommand>
glist:
description: Superadmin command - Ban/Unban any player, even those who are not logged in anymore.
usage: /<command> <purge | <ban | unban> <username>>
gtfo:
description: Superadmin command - Makes someone GTFO (deop and ip ban by username).
usage: /<command> <partialname>
halt:
description: Superadmin command - Halts a player
usage: /<command> <<partialname> | all | purge | list>
health:
description: Superadmin command - View ticks-per-second
usage: /<command>
kicknoob:
description: Superadmin command - Kick all non-superadmins on server.
usage: /<command>
landmine:
description: Set a landmine trap.
usage: /<command>
lastcmd:
description: Superadmin command - Show the last command that someone used.
usage: /<command> <player>
lavadmg:
description: Superadmin command - Enable/disable lava damage.
usage: /<command> <on | off>
lavaplace:
description: Superadmin command - Enable/disable lava placement.
usage: /<command> <on | off>
list:
description: Lists the real names of all online players.
usage: /<command>
aliases: [who]
listsync:
description: Senior Command - Download the superadmin and permban lists from the main TotalFreedom server.
usave: /<command>
lockup:
description: Console command - Block target's minecraft input. This is evil, and I never should have wrote it.
usage: /<command> <all | purge | <<partialname> on | off>>
moblimiter:
description: Senior Command - Control mob rezzing parameters.
usage: /<command> <on|off|setmax <count>|dragon|giant|ghast|slime>
mp:
description: Purge all mobs in all worlds.
usage: /<command>
mp44:
description: Superadmin Command - Modern weaponry, FTW. Use 'draw' to start firing, 'sling' to stop firing.
usage: /<command> <draw | sling>
nether:
description: Goto the nether.
usage: /<command>
nonuke:
description: Superadmin command - Attempt to detect "invisible griefers" and "nukers".
usage: /<command> <on | off> [range] [blockrate]
o:
description: Superadmin command - AdminChat - Talk privately with other admins. Using <command> itself will toggle AdminChat on and off for all messages.
usage: /<command> [message...]
aliases: [adminchat]
onlinemode:
description: Console command - Switch server online-mode on and off.
usage: /<command> <on | off>
op:
description: Makes a player operator
usage: /<command> <playername>
opall:
description: Superadmin command - Op everyone on the server, optionally change everyone's gamemode at the same time.
usage: /<command> [-c | -s]
ops:
description: Superadmin command - Manage operators
usage: /<command> <count | list | purge>
opme:
description: Superadmin command - Automatically ops user.
usage: /<command>
orbit:
description: Superadmin command - POW!!! Right in the kisser! One of these days Alice, straight to the Moon!
usage: /<command> <target> [power]
permban:
description: Manage permanently banned players and IPs
usage: /<command> <list | reload>
plugincontrol:
description: Senior Command - Enable / disable plugins.
usage: /<command> < <enable | disable> <pluginname> | list >
potion:
description: Manipulate potion effects. Duration is measured in server ticks (~20 ticks per second).
usage: /<command> <list | clear [target_name] | add <type> <duration> <amplifier> [target_name]>
prelog:
description: Superadmin command - Enable/disable the command prelogger. When this is on, logs will be filled with many duplicate messages.
usage: /<command> <on | off>
protectarea:
description: Superadmin command - Protect areas so that only superadmins can directly modify blocks in those areas. WorldEdit and other such plugins might bypass this.
usage: /<command> <list | clear | remove <label> | add <label> <radius>>
qdeop:
description: Quick De-Op - deop someone based on a partial name.
usage: /<command> <partialname>
qop:
description: Quick Op - op someone based on a partial name.
usage: /<command> <partialname>
radar:
description: Shows nearby people sorted by distance.
usage: /<command> [range]
rank:
description: Shows your rank.
usage: /<command>
rawsay:
description: Senior Command - Broadcasts the given message with no extra formatting.
usage: /<command> <message>
rd:
description: Superadmin command - Remove various server entities that may cause lag, such as dropped items, minecarts, and boats.
usage: /<command> <carts>
ro:
description: Superadmin Command - Remove all blocks of a certain type in the radius of certain players.
usage: /<command> <block> [radius (default=50)] [player]
saconfig:
description: Senior Command - Manage superadmins.
usage: /<command> <list | clean | <add|delete|info> <username>>
say:
description: Broadcasts the given message as the console, includes sender name.
usage: /<command> <message>
setlevel:
description: Sets your expierence level.
usage: /<command> [level]
setspawnworld:
description: Superadmin Command - Set world spawnpoint.
usage: /<command>
smite:
description: Superadmin Command - Someone being a little bitch? Smite them down...
usage: /<command> [playername]
ender:
description: Goto the ender / "The End".
usage: /<command>
status:
description: Show misc. server info.
usage: /<command>
stfu:
description: Superadmin Command - Mutes a player with brute force.
usage: /<command> [<player> | list | purge | all]
aliases: [mute]
stop:
description: Superadmin command - Kicks everyone and stops the server.
usage: /<command>
survival:
description: Quickly change your own gamemode to survival, or define someone's username to change theirs.
usage: /<command> [partialname]
tempban:
description: Superadmin Command - Temporarily ban someone.
usage: /<command> [playername] [duration] [reason]
# terminal:
# description: Execute a system command.
# usage: /<command> <syscmd>
tfbanlist:
description: Shows all banned player names. Superadmins may optionally use 'purge' to clear the list.
usage: /<command> [purge]
tfipbanlist:
description: Shows all banned IPs. Superadmins may optionally use 'purge' to clear the list.
usage: /<command> [purge]
tfupdate:
description: Madgeek command - Update server files.
usage: /<command>
tossmob:
description: SuperAdmin command - Throw a mob in the direction you are facing when you left click with a stick.
usage: /<command> <mobtype [speed] | off | list>
twitter:
description: Manage your twitter
usage: /<command> <set [twitter] | info | enable | disable>
uall:
description: Superadmin command - Undisguises all players
usage: /<command>
waterplace:
description: Superadmin command - Enable/disable water placement.
usage: /<command> <on | off>
whitelist:
description: Superadmin command - Manage the whitelist.
usage: /<command> <on | off | list | count | add <player> | remove <player> | addall | purge>
wildcard:
description: Superadmin command - Run any command on all users, username placeholder = ?.
usage: /<command> [fluff] ? [fluff] ?
wipeflatlands:
description: Senior Command - Wipe the flatlands map. Requires manual restart after command is used.
usage: /<command>
# ziptool:
# description: Senior Command - Zip and unzip files.
# usage: /<command> <zip <directory>> | <unzip <file>>
# plugin.yml is no longer used to define commands.