diff --git a/src/main/java/com/Acrobot/ChestShop/Commands/Give.java b/src/main/java/com/Acrobot/ChestShop/Commands/Give.java index 817d973..d33f31f 100644 --- a/src/main/java/com/Acrobot/ChestShop/Commands/Give.java +++ b/src/main/java/com/Acrobot/ChestShop/Commands/Give.java @@ -5,7 +5,6 @@ import com.Acrobot.Breeze.Utils.MaterialUtil; import com.Acrobot.Breeze.Utils.NumberUtil; import com.Acrobot.ChestShop.Configuration.Messages; import com.Acrobot.ChestShop.Events.ItemParseEvent; -import com.Acrobot.ChestShop.Permission; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; @@ -13,8 +12,9 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; /** * @author Acrobot @@ -30,7 +30,7 @@ public class Give implements CommandExecutor { Player receiver = (sender instanceof Player ? (Player) sender : null); int quantity = 1; - List disregardedIndexes = new ArrayList(); + Set disregardedIndexes = new HashSet<>(); if (args.length > 1) { for (int index = args.length - 1; index >= 0; --index) { @@ -46,7 +46,7 @@ public class Give implements CommandExecutor { } for (int index = args.length - 1; index >= 0; --index) { - if (!NumberUtil.isInteger(args[index]) || Integer.parseInt(args[index]) < 0) { + if (disregardedIndexes.contains(index) || !NumberUtil.isInteger(args[index]) || Integer.parseInt(args[index]) < 0) { continue; } @@ -77,7 +77,7 @@ public class Give implements CommandExecutor { return true; } - private static ItemStack getItem(String[] arguments, List disregardedElements) { + private static ItemStack getItem(String[] arguments, Set disregardedElements) { StringBuilder builder = new StringBuilder(arguments.length * 5); for (int index = 0; index < arguments.length; ++index) {