From d0569c024357b7ce1369f6780ec4c27dee780a6d Mon Sep 17 00:00:00 2001 From: Steven Lawson Date: Sun, 23 Sep 2012 19:00:45 -0400 Subject: [PATCH] Made it so console can use /potion when a target is specified. --- src/config.yml | 2 +- .../Commands/Command_potion.java | 30 ++++++++++++------- .../TotalFreedomMod/TFM_Util.java | 11 ++----- .../TotalFreedomMod/TotalFreedomMod.java | 1 + 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/config.yml b/src/config.yml index 194dd7a..3e5c8aa 100644 --- a/src/config.yml +++ b/src/config.yml @@ -1,4 +1,4 @@ -# Total Freedom Mod v2.4 Configuration +# Total Freedom Mod v2.7 Configuration # by Madgeek1450 # Block placement prevention: diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_potion.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_potion.java index 8fe3160..4924a24 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_potion.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_potion.java @@ -17,12 +17,6 @@ public class Command_potion extends TFM_Command @Override public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - if (senderIsConsole) - { - sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE); - return true; - } - if (!sender.isOp()) { sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS); @@ -60,9 +54,17 @@ public class Command_potion extends TFM_Command } } - if (!target.equals(sender_p) && !TFM_Util.isUserSuperadmin(sender)) + if (!target.equals(sender_p)) { - sender.sendMessage("Only superadmins can clear potion effects from other players."); + if (!TFM_Util.isUserSuperadmin(sender)) + { + sender.sendMessage("Only superadmins can clear potion effects from other players."); + return true; + } + } + else if (senderIsConsole) + { + sender.sendMessage("You must specify a target player when using this command from the console."); return true; } @@ -97,9 +99,17 @@ public class Command_potion extends TFM_Command } } - if (!target.equals(sender_p) && !TFM_Util.isUserSuperadmin(sender)) + if (!target.equals(sender_p)) { - sender.sendMessage("Only superadmins can apply potion effects to other players."); + if (!TFM_Util.isUserSuperadmin(sender)) + { + sender.sendMessage("Only superadmins can apply potion effects to other players."); + return true; + } + } + else if (senderIsConsole) + { + sender.sendMessage("You must specify a target player when using this command from the console."); return true; } diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java b/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java index a3c019b..510bf64 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java @@ -69,22 +69,17 @@ public class TFM_Util public static void bcastMsg(String message, ChatColor color) { - TFM_Log.info(message); + TFM_Log.info(message, true); for (Player p : Bukkit.getOnlinePlayers()) { - p.sendMessage(color + message); + p.sendMessage((color == null ? "" : color) + message); } } public static void bcastMsg(String message) { - TFM_Log.info(message); - - for (Player p : Bukkit.getOnlinePlayers()) - { - p.sendMessage(message); - } + TFM_Util.bcastMsg(message, null); } //JeromSar diff --git a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java index 547c69b..13e961c 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java +++ b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java @@ -262,6 +262,7 @@ public class TotalFreedomMod extends JavaPlugin TFM_Log.severe("Error loading superadmin list: " + ex.getMessage()); } } + public static List permbanned_players = new ArrayList(); public static List permbanned_ips = new ArrayList();