From 858032202a93d4ecf31b331e4f4945f463454678 Mon Sep 17 00:00:00 2001 From: Ryder Belserion Date: Mon, 30 Sep 2024 10:37:11 -0400 Subject: [PATCH] on gui close, end tasks just in case --- .../api/builders/types/features/CrateSpinMenu.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/builders/types/features/CrateSpinMenu.java b/paper/src/main/java/com/badbones69/crazycrates/api/builders/types/features/CrateSpinMenu.java index 5892ee143..266c164b9 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/api/builders/types/features/CrateSpinMenu.java +++ b/paper/src/main/java/com/badbones69/crazycrates/api/builders/types/features/CrateSpinMenu.java @@ -49,6 +49,13 @@ public void open() { this.gui.setOpenGuiAction(action -> this.userManager.addRespinPrize(this.player.getUniqueId(), this.crate.getFileName(), this.settings.getPrize().getSectionName())); + this.gui.setCloseGuiAction(action -> { + this.crateManager.removePlayerFromOpeningList(this.player); + this.crateManager.removeCrateInUse(this.player); + this.crateManager.removeCrateTask(this.player); + this.crateManager.endCrate(this.player); + }); + this.gui.setItem(this.settings.getSlot(), new GuiItem(this.settings.getPrize().getDisplayItem(this.player, this.crate))); this.gui.open(this.player);