From 8e3d2035942af5369a5070c99465926a3345921e Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 27 Jul 2020 21:34:47 -0700 Subject: [PATCH] only cleanup furnaces without a job --- .../runnables/skills/FurnaceCleanupTask.java | 3 ++- .../nossr50/util/skills/SmeltingTracker.java | 18 +++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/FurnaceCleanupTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/FurnaceCleanupTask.java index 341a51ac4..873a6f507 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/FurnaceCleanupTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/FurnaceCleanupTask.java @@ -14,7 +14,8 @@ public class FurnaceCleanupTask extends BukkitRunnable { @Override public void run() { - if(furnace != null && furnace.getInventory().getResult() == null) { + if(furnace != null + && furnace.getInventory().getSmelting() == null) { //Furnace is empty so stop tracking it mcMMO.getSmeltingTracker().untrackFurnace(furnace); } diff --git a/src/main/java/com/gmail/nossr50/util/skills/SmeltingTracker.java b/src/main/java/com/gmail/nossr50/util/skills/SmeltingTracker.java index 709b9be8e..c0cd97773 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/SmeltingTracker.java +++ b/src/main/java/com/gmail/nossr50/util/skills/SmeltingTracker.java @@ -33,6 +33,14 @@ public class SmeltingTracker { /* Debug output */ + printOwnershipGainDebug(furnace, mcMMOPlayer); + + printOwnershipLossDebug(furnace); + + furnaceOwners.put(furnace, player); + } + + private void printOwnershipGainDebug(Furnace furnace, McMMOPlayer mcMMOPlayer) { if(mcMMOPlayer != null) { if(mcMMOPlayer.isDebugMode()) { mcMMOPlayer.getPlayer().sendMessage("Furnace ownership " + @@ -41,7 +49,9 @@ public class SmeltingTracker { } } + } + private void printOwnershipLossDebug(Furnace furnace) { if(furnaceOwners.get(furnace) != null) { OfflinePlayer furnaceOwner = furnaceOwners.get(furnace); @@ -57,9 +67,6 @@ public class SmeltingTracker { } } } - - - furnaceOwners.put(furnace, player); } @Nullable @@ -80,10 +87,6 @@ public class SmeltingTracker { return furnaceOwners.get(furnace) != null; } - public void removeFurnaceOwner(Furnace furnace) { - furnaceOwners.remove(furnace); - } - public void processFurnaceOwnership(Furnace furnace, Player player) { if(!Permissions.skillEnabled(player, PrimarySkillType.SMELTING)) return; @@ -92,6 +95,7 @@ public class SmeltingTracker { } public void untrackFurnace(Furnace furnace) { + printOwnershipLossDebug(furnace); furnaceOwners.remove(furnace); } }