Merge branch 'development'

This commit is contained in:
Brianna 2020-05-12 16:19:12 -04:00
commit 161c24955c
5 changed files with 12 additions and 16 deletions

View File

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

View File

@ -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);

View File

@ -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) {

View File

@ -64,7 +64,7 @@ public class ModuleAutoCollect extends Module {
}
private void collectLivestock(Farm farm, Collection<LivingEntity> entitiesAroundFarm) {
for (Entity entity : entitiesAroundFarm) {
for (Entity entity : new ArrayList<>(entitiesAroundFarm)) {
if (!ticksLived.containsKey(entity)) ticksLived.put(entity, 0);
int lived = ticksLived.get(entity);

View File

@ -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();