Skip to content

Commit

Permalink
refact: make uncancellable preclosevent.
Browse files Browse the repository at this point in the history
  • Loading branch information
hamza-cskn committed Sep 1, 2023
1 parent ca8c19c commit a19d0d2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/mc/obliviate/inventory/InvListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void onClose(final InventoryCloseEvent event) {
if (openGui == null) return;
if (!event.getInventory().equals(openGui.getInventory())) return;

if (callAndCheckCancel(new GuiPreCloseEvent(event, openGui))) return;
Bukkit.getPluginManager().callEvent(new GuiPreCloseEvent(event, openGui));
openGui.onClose(event);
openGui.setClosed(true);
inventoryAPI.getPlayers().remove(player.getUniqueId());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
package mc.obliviate.inventory.event;

import mc.obliviate.inventory.Gui;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.event.inventory.InventoryCloseEvent;

public class GuiPreCloseEvent extends Event implements Cancellable {
public class GuiPreCloseEvent extends Event {

private static final HandlerList handlers = new HandlerList();

private final InventoryCloseEvent event;
private final Gui gui;
private boolean cancelled;

public GuiPreCloseEvent(InventoryCloseEvent event, Gui gui) {
this.event = event;
Expand All @@ -36,13 +34,4 @@ public Gui getGui() {
return this.gui;
}

@Override
public boolean isCancelled() {
return this.cancelled;
}

@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
}

0 comments on commit a19d0d2

Please sign in to comment.