diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6076bd4..e629d06 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ stages: variables: name: "UltimateRepairing" path: "/builds/$CI_PROJECT_PATH" - version: "1.2.9" + version: "1.2.10" build: stage: build diff --git a/src/main/java/com/songoda/ultimaterepairing/listeners/InventoryListeners.java b/src/main/java/com/songoda/ultimaterepairing/listeners/InventoryListeners.java index 3e8d14e..3a10ccf 100644 --- a/src/main/java/com/songoda/ultimaterepairing/listeners/InventoryListeners.java +++ b/src/main/java/com/songoda/ultimaterepairing/listeners/InventoryListeners.java @@ -1,8 +1,8 @@ package com.songoda.ultimaterepairing.listeners; import com.songoda.ultimaterepairing.UltimateRepairing; +import com.songoda.ultimaterepairing.anvil.PlayerAnvilData; import com.songoda.ultimaterepairing.anvil.PlayerAnvilData.RepairType; -import com.songoda.ultimaterepairing.handlers.RepairHandler; import com.songoda.ultimaterepairing.utils.Debugger; import com.songoda.ultimaterepairing.utils.Methods; import org.bukkit.Location; @@ -11,7 +11,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; -import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.inventory.InventoryPickupItemEvent; /** @@ -79,6 +78,14 @@ public class InventoryListeners implements Listener { @EventHandler public void onClose(InventoryCloseEvent event) { - instance.getEditor().removeEditing((Player)event.getPlayer()); + Player player = (Player) event.getPlayer(); + + instance.getEditor().removeEditing(player); + + if (instance.getRepairHandler().getDataFor(player) == null) return; + PlayerAnvilData playerAnvilData = instance.getRepairHandler().getDataFor(player); + + if (playerAnvilData.getToBeRepaired() == null || playerAnvilData.isBeingRepaired()) return; + instance.getRepairHandler().finish(false, player); } } \ No newline at end of file