mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16: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
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if(furnace != null && furnace.getInventory().getResult() == null) {
|
if(furnace != null
|
||||||
|
&& furnace.getInventory().getSmelting() == null) {
|
||||||
//Furnace is empty so stop tracking it
|
//Furnace is empty so stop tracking it
|
||||||
mcMMO.getSmeltingTracker().untrackFurnace(furnace);
|
mcMMO.getSmeltingTracker().untrackFurnace(furnace);
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,14 @@ public class SmeltingTracker {
|
|||||||
/*
|
/*
|
||||||
Debug output
|
Debug output
|
||||||
*/
|
*/
|
||||||
|
printOwnershipGainDebug(furnace, mcMMOPlayer);
|
||||||
|
|
||||||
|
printOwnershipLossDebug(furnace);
|
||||||
|
|
||||||
|
furnaceOwners.put(furnace, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void printOwnershipGainDebug(Furnace furnace, McMMOPlayer mcMMOPlayer) {
|
||||||
if(mcMMOPlayer != null) {
|
if(mcMMOPlayer != null) {
|
||||||
if(mcMMOPlayer.isDebugMode()) {
|
if(mcMMOPlayer.isDebugMode()) {
|
||||||
mcMMOPlayer.getPlayer().sendMessage("Furnace ownership " +
|
mcMMOPlayer.getPlayer().sendMessage("Furnace ownership " +
|
||||||
@ -41,7 +49,9 @@ public class SmeltingTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void printOwnershipLossDebug(Furnace furnace) {
|
||||||
if(furnaceOwners.get(furnace) != null) {
|
if(furnaceOwners.get(furnace) != null) {
|
||||||
OfflinePlayer furnaceOwner = furnaceOwners.get(furnace);
|
OfflinePlayer furnaceOwner = furnaceOwners.get(furnace);
|
||||||
|
|
||||||
@ -57,9 +67,6 @@ public class SmeltingTracker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
furnaceOwners.put(furnace, player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -80,10 +87,6 @@ public class SmeltingTracker {
|
|||||||
return furnaceOwners.get(furnace) != null;
|
return furnaceOwners.get(furnace) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeFurnaceOwner(Furnace furnace) {
|
|
||||||
furnaceOwners.remove(furnace);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void processFurnaceOwnership(Furnace furnace, Player player) {
|
public void processFurnaceOwnership(Furnace furnace, Player player) {
|
||||||
if(!Permissions.skillEnabled(player, PrimarySkillType.SMELTING))
|
if(!Permissions.skillEnabled(player, PrimarySkillType.SMELTING))
|
||||||
return;
|
return;
|
||||||
@ -92,6 +95,7 @@ public class SmeltingTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void untrackFurnace(Furnace furnace) {
|
public void untrackFurnace(Furnace furnace) {
|
||||||
|
printOwnershipLossDebug(furnace);
|
||||||
furnaceOwners.remove(furnace);
|
furnaceOwners.remove(furnace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user