Fixed an NPE

This commit is contained in:
Brianna 2021-01-14 17:22:48 -06:00
parent 46b07826a9
commit 0a5f9e5644
2 changed files with 7 additions and 3 deletions

View File

@ -115,7 +115,7 @@ public class ModuleAutoCollect extends Module {
doLivestockDrop(farm, wool);
}
Bukkit.getScheduler().runTask(plugin, () ->
Methods.animate(farm.getLocation(), CompatibleMaterial.getMaterial(wool)));
Methods.animate(farm.getLocation(), wool));
}
ticksLived.put(entity, 0);
}

View File

@ -31,12 +31,16 @@ public class Methods {
return name;
}
public static void animate(Location location, CompatibleMaterial mat) {
public static void animate(Location location, CompatibleMaterial material) {
animate(location, material.getItem());
}
public static void animate(Location location, ItemStack item) {
if (!Settings.ANIMATE.getBoolean()) return;
Block block = location.getBlock();
if (block.getRelative(0, 1, 0).getType() != Material.AIR)
return;
Item i = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5), mat.getItem());
Item i = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5), item);
// Support for EpicHoppers suction.
i.setMetadata("grabbed", new FixedMetadataValue(EpicFarming.getInstance(), "true"));