Skip to content

Commit e72f1c5

Browse files
committed
Split InteractContainerEvent.Close to Pre and Post
It is not possible to correctly restore the state of the previous container after it has been closed.
1 parent bd5ca35 commit e72f1c5

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/main/java/org/spongepowered/api/event/item/inventory/container/InteractContainerEvent.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,27 @@ public interface InteractContainerEvent extends Event, Cancellable {
5656
interface Open extends InteractContainerEvent {}
5757

5858
/**
59-
* The target container was closed.
59+
* Base event when a {@link Container} is closed.
6060
*/
61-
interface Close extends ChangeInventoryEvent, InteractContainerEvent {}
61+
interface Close extends InteractContainerEvent {
62+
63+
/**
64+
* Fired before the {@link Container} is closed.
65+
*
66+
* <p>Cancelling this event will prevent the {@link Container}
67+
* from being closed.</p>
68+
*/
69+
interface Pre extends Close {
70+
}
71+
72+
/**
73+
* Fired after the {@link Container} was closed.
74+
*
75+
* <p>Cancelling this event will rollback the content
76+
* of the {@link Container} that was mutated during
77+
* the close.</p>
78+
*/
79+
interface Post extends Close, ChangeInventoryEvent {
80+
}
81+
}
6282
}

0 commit comments

Comments
 (0)