File tree Expand file tree Collapse file tree
src/main/java/com/marcusslover/plus/lib/item Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,17 @@ public interface IMenu extends ISendable<IMenu> {
1717 void open (@ NotNull Canvas ctx , @ NotNull Player player );
1818
1919 /**
20- * Called when the menu is closed.
20+ * Called right before the canvas data is erased. You may use the menuUpdateContext here.
21+ *
22+ * @param ctx the canvas
23+ * @param player the player
24+ */
25+ default void preClose (@ NotNull Canvas ctx , @ NotNull Player player ) {
26+ // nothing here
27+ }
28+
29+ /**
30+ * Called when the menu is closed. At this point using menuUpdateContext is not possible.
2131 *
2232 * @param ctx the canvas
2333 * @param player the player
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ public void onClose(InventoryCloseEvent event) {
7373 }
7474
7575 Menu menu = canvas .assosiatedMenu ();
76+ menu .preClose (canvas , player ); // call the preClose method so developers can handle it
7677 Canvas remove = menu .canvasMap ().remove (player .getUniqueId ());
7778 if (remove != null ) {
7879 remove .clear (); // help the gc
You can’t perform that action at this time.
0 commit comments