From 89486a686d8be558d2d3ab1f6506f2de43be9d09 Mon Sep 17 00:00:00 2001 From: Brianna Date: Tue, 12 May 2020 15:34:36 -0400 Subject: [PATCH 1/4] Spawn mobs sync. --- .../farming/levels/modules/ModuleAutoBreeding.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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) { From f33e9eb40d8eac4eb825575d9663b730537feaaf Mon Sep 17 00:00:00 2001 From: Brianna Date: Tue, 12 May 2020 15:37:48 -0400 Subject: [PATCH 2/4] Concurrent modification exception. --- .../epicfarming/farming/levels/modules/ModuleAutoCollect.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 9df3564d123d9c10fd0217c8f0dbf0cb2d674567 Mon Sep 17 00:00:00 2001 From: Brianna Date: Tue, 12 May 2020 16:17:51 -0400 Subject: [PATCH 3/4] Drop the correct level farm items. --- src/main/java/com/songoda/epicfarming/EpicFarming.java | 10 ++++------ .../songoda/epicfarming/listeners/BlockListeners.java | 8 ++------ 2 files changed, 6 insertions(+), 12 deletions(-) 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/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(); From c12a0d4af76b94b4e2f1ce137259cdbb29466cbb Mon Sep 17 00:00:00 2001 From: Brianna Date: Tue, 12 May 2020 16:18:03 -0400 Subject: [PATCH 4/4] version 3.0.16 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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}