mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
- To avoid possibly unexpected behavior, check to ensure that the infinite pool already contains all the items requested.
This commit is contained in:
@@ -40,6 +40,7 @@ import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.event.PopupMenuEvent;
|
||||
import javax.swing.event.PopupMenuListener;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -719,7 +720,7 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
|
||||
*/
|
||||
@Override
|
||||
public void addItem(final T item, final int qty) {
|
||||
if (this.isInfinite()) {
|
||||
if (this.isInfinite() && this.model.getOrderedList().contains(item)) {
|
||||
return;
|
||||
}
|
||||
this.pool.add(item, qty);
|
||||
@@ -739,7 +740,7 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
|
||||
*/
|
||||
@Override
|
||||
public void addItems(final Iterable<Entry<T, Integer>> itemsToAdd) {
|
||||
if (this.isInfinite()) {
|
||||
if (this.isInfinite() && this.model.getOrderedList().containsAll(Lists.newArrayList(itemsToAdd))) {
|
||||
return;
|
||||
}
|
||||
this.pool.addAll(itemsToAdd);
|
||||
|
||||
Reference in New Issue
Block a user