mirror of
https://github.com/songoda/EpicFarming.git
synced 2024-10-05 10:07:29 +02:00
fix for caching issue
This commit is contained in:
parent
be31a1ce5f
commit
acd4f9e97a
@ -288,6 +288,10 @@ public class EFarm implements Farm {
|
|||||||
cachedCrops.add(block);
|
cachedCrops.add(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeCachedCrop(Block block) {
|
||||||
|
cachedCrops.remove(block);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Block> getCachedCrops() {
|
public List<Block> getCachedCrops() {
|
||||||
return new ArrayList<>(cachedCrops);
|
return new ArrayList<>(cachedCrops);
|
||||||
|
@ -114,7 +114,7 @@ public class FarmTask extends BukkitRunnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Block> getCrops(Farm farm, boolean add) {
|
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());
|
((EFarm)farm).setLastCached(System.currentTimeMillis());
|
||||||
Block block = farm.getLocation().getBlock();
|
Block block = farm.getLocation().getBlock();
|
||||||
int radius = farm.getLevel().getRadius();
|
int radius = farm.getLevel().getRadius();
|
||||||
@ -132,8 +132,8 @@ public class FarmTask extends BukkitRunnable {
|
|||||||
((EFarm)farm).addCachedCrop(b2);
|
((EFarm)farm).addCachedCrop(b2);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
((EFarm)farm).removeCachedCrop(b2);
|
||||||
plugin.getGrowthTask().removeCropByLocation(b2.getLocation());
|
plugin.getGrowthTask().removeCropByLocation(b2.getLocation());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
name: EpicFarming
|
name: EpicFarming
|
||||||
description: EpicFarming
|
description: EpicFarming
|
||||||
main: com.songoda.epicfarming.EpicFarmingPlugin
|
main: com.songoda.epicfarming.EpicFarmingPlugin
|
||||||
version: 2.0.13
|
version: 2.0.14
|
||||||
depend: [Arconix]
|
depend: [Arconix]
|
||||||
soft-depend: [Multiverse-Core]
|
soft-depend: [Multiverse-Core]
|
||||||
author: Songoda
|
author: Songoda
|
||||||
|
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>EpicFarming</artifactId>
|
<artifactId>EpicFarming</artifactId>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<version>2.0.13</version>
|
<version>2.0.14</version>
|
||||||
<build>
|
<build>
|
||||||
<defaultGoal>clean package</defaultGoal>
|
<defaultGoal>clean package</defaultGoal>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
Loading…
Reference in New Issue
Block a user