diff --git a/build.gradle b/build.gradle index 1bcb1f21..89d144bf 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group 'fr.minuskube.inv' -version '1.0.0' +version '1.0.1' apply plugin: 'java' @@ -22,4 +22,8 @@ repositories { dependencies { provided 'org.spigotmc:spigot-api:1.11.2-R0.1-SNAPSHOT' +} + +jar { + archiveName = 'SmartInvs-' + project.version + '.jar' } \ No newline at end of file diff --git a/src/main/java/fr/minuskube/inv/InventoryManager.java b/src/main/java/fr/minuskube/inv/InventoryManager.java index 09d3b72b..6f70810f 100644 --- a/src/main/java/fr/minuskube/inv/InventoryManager.java +++ b/src/main/java/fr/minuskube/inv/InventoryManager.java @@ -94,7 +94,10 @@ public Optional getInventory(Player p) { } protected void setInventory(Player p, SmartInventory inv) { - this.inventories.put(p, inv); + if(inv == null) + this.inventories.remove(p); + else + this.inventories.put(p, inv); } public Optional getContents(Player p) { diff --git a/src/main/java/fr/minuskube/inv/SmartInventory.java b/src/main/java/fr/minuskube/inv/SmartInventory.java index f2b2a5a6..635e64f0 100644 --- a/src/main/java/fr/minuskube/inv/SmartInventory.java +++ b/src/main/java/fr/minuskube/inv/SmartInventory.java @@ -56,10 +56,10 @@ public void close(Player player) { .forEach(listener -> ((InventoryListener) listener) .accept(new InventoryCloseEvent(player.getOpenInventory()))); + player.closeInventory(); + manager.setInventory(player, null); manager.setContents(player, null); - - player.closeInventory(); } public String getId() { return id; } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index de8f083c..c279a348 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: SmartInvs -version: 1.0.0 +version: 1.0.1 description: Inventory API for your Bukkit Plugins. author: MinusKube website: https://github.com/MinusKube/SmartInvs