Skip to content

Commit

Permalink
fix: order of FrameOpenEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
RoinujNosde authored Apr 25, 2024
1 parent da9ec6c commit 8cd0b2e
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ public static void open(@Nullable SCFrame frame) {

OPENING.put(uuid, frame);
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
Inventory inventory = prepareInventory(frame);
FrameOpenEvent event = new FrameOpenEvent(frame.getViewer(), frame);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
Inventory inventory = prepareInventory(frame);

if (!frame.equals(OPENING.get(uuid))) {
return;
}
Bukkit.getScheduler().runTask(plugin, () -> {
FrameOpenEvent event = new FrameOpenEvent(frame.getViewer(), frame);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
frame.getViewer().openInventory(inventory);
InventoryController.register(frame);
OPENING.remove(uuid);
Expand Down

0 comments on commit 8cd0b2e

Please sign in to comment.