Skip to content

Commit be0553b

Browse files
Remove custom equals/hashCode from ReferencingInventory.PlayerStorageContents
This partially reverts 0e581fb. The problem with this is that it doesn't consider other parts of the inventory, e.g. event handlers. Additionally, equals/hashCode cannot be properly implemented for ReferencingInventory due to its usage of functional interfaces. The impact of this change should be small. Users can get back to the previous slot-deduplicating behavior by simply using the same ReferencingInventory.PlayerStorageContents instance for all affected slots.
1 parent 2e1cedc commit be0553b

1 file changed

Lines changed: 0 additions & 12 deletions

File tree

invui/src/main/java/xyz/xenondevs/invui/inventory/ReferencingInventory.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
import java.util.function.BiFunction;
1919
import java.util.function.Function;
2020

21-
// TODO: equals+hashCode for normal referencing inventories
22-
2321
/**
2422
* A {@link xyz.xenondevs.invui.inventory.Inventory} which is backed by a bukkit {@link Inventory}.
2523
* <p>
@@ -245,16 +243,6 @@ public PlayerInventory getReferencedInventory() {
245243
return (PlayerInventory) super.getReferencedInventory();
246244
}
247245

248-
@Override
249-
public int hashCode() {
250-
return getReferencedInventory().hashCode();
251-
}
252-
253-
@Override
254-
public boolean equals(Object obj) {
255-
return obj instanceof ReferencingInventory.PlayerStorageContents other &&
256-
getReferencedInventory().equals(other.getReferencedInventory());
257-
}
258246
}
259247

260248
}

0 commit comments

Comments
 (0)