Corrects harvesting time for disabled harvester.

This commit is contained in:
chenzo 2012-10-05 14:11:19 +00:00
parent 9d94eba147
commit 523236d6ce
2 changed files with 12 additions and 0 deletions

View File

@ -73,6 +73,17 @@ public abstract class CandidateHarvester
this.lastStartHarvestingTime = -1;
}
/**
* Disabless the harvesting timer. Called when the harvest is disabled.
*/
public void disableHarvesting()
{
// Remember the last harvesting time.
this.lastHarvestingTime = -1;
// Stops the current timer.
this.lastStartHarvestingTime = -1;
}
/**
* Returns the current harvesting time in ms. If this harvester is not
* currently harvesting, then returns the value of the last harvesting time.

View File

@ -469,6 +469,7 @@ public class CandidateHarvesterSet
public void setEnabled(boolean enabled)
{
logger.info("disabling harvester: " + harvester);
harvester.disableHarvesting();
this.enabled = enabled;
}
}