Skip to content

Commit

Permalink
fix: Fix chat queries not re-opening menus
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeltumn committed Oct 10, 2024
1 parent a1a105c commit 83ce1dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,12 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)

runSync {
// Close the current inventory to open another to avoid close reasons
val reopen = view.shouldStillBeOpened
view.player.closeInventory(Reason.OPEN_NEW)

// Ensure the view is allowed to be opened again after we're done
if (reopen) (view as AbstractInterfaceView<*, *, *>).markAsReopenable()

// Clear the inventory
view.player.inventory.clear()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ public abstract class AbstractInterfaceView<I : InterfacesInventory, T : Interfa
/** Opens the inventory GUI for the viewer. */
public abstract fun openInventory()

/** Marks down that this menu should be re-opened. */
internal fun markAsReopenable() {
shouldBeOpened.set(true)
}

/**
* Marks this menu as closed and processes it. This does not actually perform
* closing the menu, this method only handles the closing.
Expand Down

0 comments on commit 83ce1dd

Please sign in to comment.