From 30ffe3e471a2632562b6f75ddc81abb43ee15f2a Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 9 Sep 2021 20:43:32 +0200 Subject: [PATCH] Open Check --- .../src/de/steamwar/inventory/SWInventory.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java b/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java index 6862697..74a599b 100644 --- a/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java +++ b/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java @@ -42,6 +42,7 @@ public class SWInventory implements Listener { final Player player; final Map> callbacks = new HashMap<>(); final Inventory inventory; + boolean open = false; public SWInventory(Player p, int size, String t) { player = p; @@ -127,11 +128,10 @@ public class SWInventory implements Listener { public void open() { player.openInventory(inventory); - Bukkit.getPluginManager().registerEvents(this, Core.getInstance()); - } - - public void reOpen() { - player.openInventory(inventory); + if(!open) { + Bukkit.getPluginManager().registerEvents(this, Core.getInstance()); + open = true; + } } @EventHandler