mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
only cleanup furnaces without a job
This commit is contained in:
parent
4169dceca8
commit
8e3d203594
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user