Merge branch 'development'

This commit is contained in:
Brianna 2021-01-03 15:04:22 -06:00
commit 296de9985f
3 changed files with 7 additions and 5 deletions

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>EpicFarming</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>3.0.25</version>
<version>3.0.26</version>
<build>
<defaultGoal>clean install</defaultGoal>
<finalName>EpicFarming-${project.version}</finalName>

View File

@ -176,8 +176,9 @@ public class Farm {
return Collections.unmodifiableList(items);
}
// Should be used in sync.
public void addItem(ItemStack toAdd) {
for (ItemStack item : new ArrayList<>(getItems())) {
for (ItemStack item : new ArrayList<>(items)) {
if (item.getType() != toAdd.getType()
|| item.getAmount() + toAdd.getAmount() > item.getMaxStackSize()) continue;
item.setAmount(item.getAmount() + toAdd.getAmount());

View File

@ -220,9 +220,10 @@ public class ModuleAutoCollect extends Module {
ItemStack seedStack = new ItemStack(cropTypeData.getSeedMaterial(), random.nextInt(3) + 1 + (useBoneMeal(farm) ? 1 : 0));
if (!farm.willFit(stack) || !farm.willFit(seedStack)) return false;
Bukkit.getScheduler().runTask(plugin, () ->
Methods.animate(farm.getLocation(), cropTypeData.getYieldMaterial()));
farm.addItem(stack);
Bukkit.getScheduler().runTask(plugin, () -> {
Methods.animate(farm.getLocation(), cropTypeData.getYieldMaterial());
farm.addItem(stack);
});
if (getCollectionType(farm) != CollectionType.NO_SEEDS)
farm.addItem(seedStack);
return true;