Fixed /ah test not checking for item in hand.

This commit is contained in:
BadBones69 2020-04-22 02:35:48 -04:00
parent 43abfb72fe
commit 0492cb9557

View File

@ -96,6 +96,7 @@ public class Main extends JavaPlugin implements Listener {
int price = 10; int price = 10;
int amount = 1; int amount = 1;
ItemStack item = Methods.getItemInHand((Player) sender); ItemStack item = Methods.getItemInHand((Player) sender);
if (item != null && item.getType() != Material.AIR) {
// For testing as another player // For testing as another player
String seller = "Test-Account"; String seller = "Test-Account";
for (int it = 1; it <= times; it++) { for (int it = 1; it <= times; it++) {
@ -131,6 +132,10 @@ public class Main extends JavaPlugin implements Listener {
} else { } else {
item.setAmount(item.getAmount() - amount); item.setAmount(item.getAmount() - amount);
} }
} else {
sender.sendMessage(Messages.DOSENT_HAVE_ITEM_IN_HAND.getMessage());
return true;
}
} }
if (args[0].equalsIgnoreCase("Reload")) {// CA Reload if (args[0].equalsIgnoreCase("Reload")) {// CA Reload
if (!Methods.hasPermission(sender, "Admin")) return true; if (!Methods.hasPermission(sender, "Admin")) return true;