Tweak /whohas. Note the change from bitwise & to logical && resolving possible bug.

This commit is contained in:
StevenLawson 2014-07-26 11:48:17 -04:00
parent 5e4d1d0d6d
commit 01edfed307

View File

@ -17,22 +17,14 @@ public class Command_whohas 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)
{ {
boolean smite = false; if (args.length < 1)
if (args.length != 1)
{ {
if (args.length == 2 && args[1].equals("smite")) return false;
{
smite = true;
}
else
{
return false;
}
} }
final String materialName = args[0]; final boolean doSmite = args.length >= 2 && "smite".equalsIgnoreCase(args[1]);
final String materialName = args[0];
Material material = Material.matchMaterial(materialName); Material material = Material.matchMaterial(materialName);
if (material == null) if (material == null)
{ {
@ -58,7 +50,7 @@ public class Command_whohas extends TFM_Command
if (player.getInventory().contains(material)) if (player.getInventory().contains(material))
{ {
players.add(player.getName()); players.add(player.getName());
if (smite & !TFM_AdminList.isSuperAdmin(player)) if (doSmite && !TFM_AdminList.isSuperAdmin(player))
{ {
Command_smite.smite(player); Command_smite.smite(player);
} }
@ -75,6 +67,5 @@ public class Command_whohas extends TFM_Command
} }
return true; return true;
} }
} }