Skip to content

Commit e84fe21

Browse files
Ignore BoundItem#bind if already bound
This makes it possible to bind an item to a gui and then add it to another one. (e.g. tab buttons in a paged gui)
1 parent 94c1d98 commit e84fe21

2 files changed

Lines changed: 1 addition & 2 deletions

File tree

invui/src/main/java/xyz/xenondevs/invui/item/AbstractBoundItem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public Gui getGui() {
2121
@Override
2222
public void bind(Gui gui) {
2323
if (this.gui != null)
24-
throw new IllegalStateException("Gui is already bound");
24+
return;
2525

2626
this.gui = gui;
2727
}

invui/src/main/java/xyz/xenondevs/invui/item/BoundItem.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public sealed interface BoundItem extends Item permits AbstractBoundItem {
2828
* Called when the item is added to a {@link Gui}.
2929
*
3030
* @param gui The {@link Gui} to bind this item to.
31-
* @throws IllegalStateException If this item is already bound to a {@link Gui}.
3231
*/
3332
void bind(Gui gui);
3433

0 commit comments

Comments
 (0)