diff --git a/pom.xml b/pom.xml
index 3a2d703..11ebc5a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
com.songoda
EpicFarming
4.0.0
- 3.0.15
+ 3.0.16
clean install
EpicFarming-${project.version}
diff --git a/src/main/java/com/songoda/epicfarming/EpicFarming.java b/src/main/java/com/songoda/epicfarming/EpicFarming.java
index c08bc86..af01db2 100644
--- a/src/main/java/com/songoda/epicfarming/EpicFarming.java
+++ b/src/main/java/com/songoda/epicfarming/EpicFarming.java
@@ -11,6 +11,7 @@ import com.songoda.core.hooks.EntityStackerManager;
import com.songoda.core.nms.NmsManager;
import com.songoda.core.nms.nbt.NBTCore;
import com.songoda.core.nms.nbt.NBTItem;
+import com.songoda.core.utils.TextUtils;
import com.songoda.epicfarming.boost.BoostData;
import com.songoda.epicfarming.boost.BoostManager;
import com.songoda.epicfarming.commands.*;
@@ -45,10 +46,7 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.PluginManager;
import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.UUID;
+import java.util.*;
/**
* Created by songoda on 1/23/2018.
@@ -297,9 +295,9 @@ public class EpicFarming extends SongodaPlugin {
public ItemStack makeFarmItem(Level level) {
ItemStack item = Settings.FARM_BLOCK_MATERIAL.getMaterial().getItem();
ItemMeta meta = item.getItemMeta();
- meta.setDisplayName(Methods.formatText(Methods.formatName(level.getLevel())));
+ meta.setDisplayName(TextUtils.formatText(Methods.formatName(level.getLevel())));
String line = getLocale().getMessage("general.nametag.lore").getMessage();
- if (!line.equals("")) meta.setLore(Arrays.asList(line));
+ if (!line.equals("")) meta.setLore(Collections.singletonList(line));
item.setItemMeta(meta);
NBTItem nbtItem = NmsManager.getNbt().of(item);
diff --git a/src/main/java/com/songoda/epicfarming/farming/levels/modules/ModuleAutoBreeding.java b/src/main/java/com/songoda/epicfarming/farming/levels/modules/ModuleAutoBreeding.java
index ec307b4..64ede40 100644
--- a/src/main/java/com/songoda/epicfarming/farming/levels/modules/ModuleAutoBreeding.java
+++ b/src/main/java/com/songoda/epicfarming/farming/levels/modules/ModuleAutoBreeding.java
@@ -141,8 +141,10 @@ public class ModuleAutoBreeding extends Module {
private void handleStackedBreed(LivingEntity entity) {
EntityStackerManager.removeOne(entity);
- LivingEntity spawned = (LivingEntity) entity.getWorld().spawnEntity(entity.getLocation(), entity.getType());
- handleBreed(spawned);
+ Bukkit.getScheduler().runTask(plugin, () -> {
+ LivingEntity spawned = (LivingEntity) entity.getWorld().spawnEntity(entity.getLocation(), entity.getType());
+ handleBreed(spawned);
+ });
}
private void handleBreed(Entity entity) {
diff --git a/src/main/java/com/songoda/epicfarming/farming/levels/modules/ModuleAutoCollect.java b/src/main/java/com/songoda/epicfarming/farming/levels/modules/ModuleAutoCollect.java
index a25d1f2..f7f8609 100644
--- a/src/main/java/com/songoda/epicfarming/farming/levels/modules/ModuleAutoCollect.java
+++ b/src/main/java/com/songoda/epicfarming/farming/levels/modules/ModuleAutoCollect.java
@@ -64,7 +64,7 @@ public class ModuleAutoCollect extends Module {
}
private void collectLivestock(Farm farm, Collection entitiesAroundFarm) {
- for (Entity entity : entitiesAroundFarm) {
+ for (Entity entity : new ArrayList<>(entitiesAroundFarm)) {
if (!ticksLived.containsKey(entity)) ticksLived.put(entity, 0);
int lived = ticksLived.get(entity);
diff --git a/src/main/java/com/songoda/epicfarming/listeners/BlockListeners.java b/src/main/java/com/songoda/epicfarming/listeners/BlockListeners.java
index 665a2ab..3f4efcf 100644
--- a/src/main/java/com/songoda/epicfarming/listeners/BlockListeners.java
+++ b/src/main/java/com/songoda/epicfarming/listeners/BlockListeners.java
@@ -88,15 +88,11 @@ public class BlockListeners implements Listener {
instance.getLocale().getMessage("event.warning.noauto").sendPrefixedMessage(e.getPlayer());
}
}
+ int level = instance.getLevelFromItem(e.getItemInHand());
Bukkit.getScheduler().runTaskLater(instance, () -> {
- int level = 1;
- if (instance.getLevelFromItem(e.getItemInHand()) != 0) {
- level = instance.getLevelFromItem(e.getItemInHand());
- }
-
if (location.getBlock().getType() != farmBlock) return;
- Farm farm = new Farm(location, instance.getLevelManager().getLevel(level), e.getPlayer().getUniqueId());
+ Farm farm = new Farm(location, instance.getLevelManager().getLevel(level == 0 ? 1 : 0), e.getPlayer().getUniqueId());
instance.getFarmManager().addFarm(location, farm);
farm.tillLand();