diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_blockcommand.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_blockcommand.java new file mode 100644 index 00000000..fe1d7870 --- /dev/null +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_blockcommand.java @@ -0,0 +1,41 @@ +package me.StevenLawson.TotalFreedomMod.Commands; + +import me.StevenLawson.TotalFreedomMod.TFM_UserInfo; +import me.StevenLawson.TotalFreedomMod.TFM_Util; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = true) +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_UserInfo playerdata = TFM_UserInfo.getPlayerData(p); + + playerdata.setCommandsBlocked(!playerdata.areCommandsBlocked()); + + TFM_Util.adminAction(sender.getName(), (playerdata.areCommandsBlocked() ? "B" : "Unb") + "locking all commands for " + p.getName(), true); + TFM_Util.playerMsg(sender, (playerdata.areCommandsBlocked() ? "B" : "Unb") + "locked all commands."); + + return true; + } +} + + diff --git a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java b/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java index 068b1225..38fc899d 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java +++ b/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java @@ -397,6 +397,12 @@ public class TFM_PlayerListener implements Listener return; } + if(playerdata.areCommandsBlocked()) + { + TFM_Util.playerMsg(p, "Your commands have been blocked by an admin", ChatColor.RED); + event.setCancelled(true); + } + if (TotalFreedomMod.preprocessLogEnabled) { TFM_Log.info(String.format("[PREPROCESS_COMMAND] %s(%s): %s", p.getName(), ChatColor.stripColor(p.getDisplayName()), command), true); diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_UserInfo.java b/src/me/StevenLawson/TotalFreedomMod/TFM_UserInfo.java index 17b56d26..f227c7ea 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_UserInfo.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_UserInfo.java @@ -47,6 +47,7 @@ public class TFM_UserInfo private int lockup_schedule_id = -1; private String last_message = ""; private boolean in_adminchat = false; + private boolean commands_blocked = false; public TFM_UserInfo(Player player) { @@ -428,4 +429,14 @@ public class TFM_UserInfo { return this.in_adminchat; } + + public boolean areCommandsBlocked() + { + return this.commands_blocked; + } + + public void setCommandsBlocked(boolean commands_blocked) + { + this.commands_blocked = commands_blocked; + } } diff --git a/src/plugin.yml b/src/plugin.yml index dc6fcb55..c0b1a359 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -7,6 +7,10 @@ commands: adminmode: description: Console-only command - Close server to non-superadmins. usage: / [on | off] + blockcommand: + description: Superadmin command - Block all commands for a specific player + usage: / + aliases: [blockcommands] cage: description: Superadmin command - Place a cage around someone. usage: / @@ -124,7 +128,7 @@ commands: usage: / [range] [blockrate] o: description: Superadmin command - AdminChat - Talk privately with other admins. Using itself will toggle AdminChat on and off for all messages. - usage: / [message] + usage: / [message...] aliases: [adminchat] onlinemode: description: Console command - Switch server online-mode on and off. diff --git a/src/superadmin.yml b/src/superadmin.yml index 4be36852..02dbfaf3 100644 --- a/src/superadmin.yml +++ b/src/superadmin.yml @@ -5,7 +5,7 @@ superadmins: - 80.60.73.144 - 213.211.159.63 last_login: Fri, 9 Nov 2012 03:09:14 -0500 - custom_login_message: a &5developer&b! + custom_login_message: a &5Developer&b! is_senior_admin: true console_aliases: - darth @@ -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 &5Chief-Developer&b and &6Master-ass-kicker&b. is_senior_admin: true console_aliases: - madgeek @@ -25,7 +25,7 @@ superadmins: - 74.125.224.72 - 8.8.4.4 last_login: Sat, 10 Nov 2012 02:09:14 -0500 - custom_login_message: the &downer&b. + custom_login_message: the &dOwner&b. is_senior_admin: true console_aliases: [] is_activated: true