fix for caching issue

This commit is contained in:
Brianna O'Keefe 2018-11-04 00:32:49 -05:00
parent be31a1ce5f
commit acd4f9e97a
4 changed files with 8 additions and 4 deletions

View File

@ -288,6 +288,10 @@ public class EFarm implements Farm {
cachedCrops.add(block);
}
public void removeCachedCrop(Block block) {
cachedCrops.remove(block);
}
@Override
public List<Block> getCachedCrops() {
return new ArrayList<>(cachedCrops);

View File

@ -114,7 +114,7 @@ public class FarmTask extends BukkitRunnable {
}
public List<Block> getCrops(Farm farm, boolean add) {
if (System.currentTimeMillis() - ((EFarm)farm).getLastCached() > 30 * 1000) {
if (System.currentTimeMillis() - ((EFarm)farm).getLastCached() > 30 * 1000 || !add) {
((EFarm)farm).setLastCached(System.currentTimeMillis());
Block block = farm.getLocation().getBlock();
int radius = farm.getLevel().getRadius();
@ -132,8 +132,8 @@ public class FarmTask extends BukkitRunnable {
((EFarm)farm).addCachedCrop(b2);
continue;
}
((EFarm)farm).removeCachedCrop(b2);
plugin.getGrowthTask().removeCropByLocation(b2.getLocation());
}
}
}

View File

@ -1,7 +1,7 @@
name: EpicFarming
description: EpicFarming
main: com.songoda.epicfarming.EpicFarmingPlugin
version: 2.0.13
version: 2.0.14
depend: [Arconix]
soft-depend: [Multiverse-Core]
author: Songoda

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>EpicFarming</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>2.0.13</version>
<version>2.0.14</version>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>