Made it so console can use /potion when a target is specified.

This commit is contained in:
Steven Lawson 2012-09-23 19:00:45 -04:00
parent 054ce678f4
commit d0569c0243
4 changed files with 25 additions and 19 deletions

View file

@ -1,4 +1,4 @@
# Total Freedom Mod v2.4 Configuration # Total Freedom Mod v2.7 Configuration
# by Madgeek1450 # by Madgeek1450
# Block placement prevention: # Block placement prevention:

View file

@ -17,12 +17,6 @@ public class Command_potion extends TFM_Command
@Override @Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) 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()) if (!sender.isOp())
{ {
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS); 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; 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; return true;
} }

View file

@ -69,22 +69,17 @@ public class TFM_Util
public static void bcastMsg(String message, ChatColor color) public static void bcastMsg(String message, ChatColor color)
{ {
TFM_Log.info(message); TFM_Log.info(message, true);
for (Player p : Bukkit.getOnlinePlayers()) for (Player p : Bukkit.getOnlinePlayers())
{ {
p.sendMessage(color + message); p.sendMessage((color == null ? "" : color) + message);
} }
} }
public static void bcastMsg(String message) public static void bcastMsg(String message)
{ {
TFM_Log.info(message); TFM_Util.bcastMsg(message, null);
for (Player p : Bukkit.getOnlinePlayers())
{
p.sendMessage(message);
}
} }
//JeromSar //JeromSar

View file

@ -262,6 +262,7 @@ public class TotalFreedomMod extends JavaPlugin
TFM_Log.severe("Error loading superadmin list: " + ex.getMessage()); TFM_Log.severe("Error loading superadmin list: " + ex.getMessage());
} }
} }
public static List<String> permbanned_players = new ArrayList<String>(); public static List<String> permbanned_players = new ArrayList<String>();
public static List<String> permbanned_ips = new ArrayList<String>(); public static List<String> permbanned_ips = new ArrayList<String>();