From 0c40b5b71a80b4462f76016b5baba6e3fb9310ec Mon Sep 17 00:00:00 2001 From: Brianna Date: Fri, 5 Mar 2021 09:13:32 -0600 Subject: [PATCH 1/4] Bonemeal isn't a material in 1.8. --- src/main/java/com/songoda/epichoppers/tasks/HopTask.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/songoda/epichoppers/tasks/HopTask.java b/src/main/java/com/songoda/epichoppers/tasks/HopTask.java index 03f74e2..92971d5 100644 --- a/src/main/java/com/songoda/epichoppers/tasks/HopTask.java +++ b/src/main/java/com/songoda/epichoppers/tasks/HopTask.java @@ -1,5 +1,6 @@ package com.songoda.epichoppers.tasks; +import com.songoda.core.compatibility.CompatibleMaterial; import com.songoda.epichoppers.EpicHoppers; import com.songoda.epichoppers.boost.BoostData; import com.songoda.epichoppers.hopper.HopperManager; @@ -521,11 +522,12 @@ public class HopTask extends BukkitRunnable { * @return true if the block is a farm item, otherwise false */ private boolean isFarmItem(Block block) { - return EpicHoppers.getInstance().isEpicFarming() && com.songoda.epicfarming.EpicFarming.getInstance().getFarmManager().getFarm(block) != null; + return plugin.isEpicFarming() && com.songoda.epicfarming.EpicFarming.getInstance().getFarmManager().getFarm(block) != null; } private ItemStack[] getFarmContents(Block block) { - return com.songoda.epicfarming.EpicFarming.getInstance().getFarmManager() - .getFarm(block).getItems().stream().filter(i -> i.getType() != Material.BONE_MEAL).collect(Collectors.toList()).toArray(new ItemStack[0]); + return com.songoda.epicfarming.EpicFarming.getInstance().getFarmManager().getFarm(block).getItems() + .stream().filter(i -> CompatibleMaterial.getMaterial(i) != CompatibleMaterial.BONE_MEAL) + .toArray(ItemStack[]::new); } } \ No newline at end of file From 079095c0736a2d990767fdc53ef6cf6e870f75de Mon Sep 17 00:00:00 2001 From: Fernando Pettinelli Date: Fri, 5 Mar 2021 12:35:16 -0300 Subject: [PATCH 2/4] Fixed hopper getting converted into Epic Hopper with a specific setup. --- .../com/songoda/epichoppers/listeners/HopperListeners.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/songoda/epichoppers/listeners/HopperListeners.java b/src/main/java/com/songoda/epichoppers/listeners/HopperListeners.java index f24041a..e0d3250 100644 --- a/src/main/java/com/songoda/epichoppers/listeners/HopperListeners.java +++ b/src/main/java/com/songoda/epichoppers/listeners/HopperListeners.java @@ -66,9 +66,10 @@ public class HopperListeners implements Listener { // Special cases when a hopper is picking up items if (destination.getHolder() instanceof org.bukkit.block.Hopper) { - Hopper toHopper = instance.getHopperManager().getHopper(destinationLocation); - if (destinationLocation != null && Settings.ALLOW_NORMAL_HOPPERS.getBoolean() && toHopper == null) + if (destinationLocation != null && Settings.ALLOW_NORMAL_HOPPERS.getBoolean() && !instance.getHopperManager().isHopper(destinationLocation)) return; + + Hopper toHopper = instance.getHopperManager().getHopper(destinationLocation); // minecraft 1.8 doesn't have a method to get the hopper's location from the inventory, so we use the holder instead final ItemStack toMove = event.getItem(); From 3a73ba8dd830eeac0218ecc4d325bc5a5d0a5247 Mon Sep 17 00:00:00 2001 From: Fernando Pettinelli Date: Sat, 20 Mar 2021 11:49:11 -0300 Subject: [PATCH 3/4] Added disabled worlds. --- .../com/songoda/epichoppers/listeners/BlockListeners.java | 3 +++ src/main/java/com/songoda/epichoppers/settings/Settings.java | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/main/java/com/songoda/epichoppers/listeners/BlockListeners.java b/src/main/java/com/songoda/epichoppers/listeners/BlockListeners.java index bdac91d..90b24bc 100644 --- a/src/main/java/com/songoda/epichoppers/listeners/BlockListeners.java +++ b/src/main/java/com/songoda/epichoppers/listeners/BlockListeners.java @@ -36,6 +36,9 @@ public class BlockListeners implements Listener { if (e.getBlock().getType() != Material.HOPPER) return; + if (Settings.DISABLED_WORLDS.getStringList().contains(player.getWorld().getName())) + return; + int amt = count(e.getBlock().getChunk()); int max = maxHoppers(player); diff --git a/src/main/java/com/songoda/epichoppers/settings/Settings.java b/src/main/java/com/songoda/epichoppers/settings/Settings.java index 22dce58..f6d6fac 100644 --- a/src/main/java/com/songoda/epichoppers/settings/Settings.java +++ b/src/main/java/com/songoda/epichoppers/settings/Settings.java @@ -25,6 +25,11 @@ public class Settings { public static final ConfigSetting ALLOW_NORMAL_HOPPERS = new ConfigSetting(config, "Main.Allow Normal Hoppers", false, "Should natural hoppers not be epic hoppers?"); + public static final ConfigSetting DISABLED_WORLDS = new ConfigSetting(config, "Main.Disabled Worlds", + Arrays.asList("example1", "example2"), + "Worlds where epic hoppers cannot be placed.", + "Any placed Epic Hopper will just be converted to a normal one."); + public static final ConfigSetting TELEPORT = new ConfigSetting(config, "Main.Allow Players To Teleport Through Hoppers", true, "Should players be able to teleport through hoppers?"); From 42538e120f2c067de18e7f2f108e3547e1f43d9c Mon Sep 17 00:00:00 2001 From: Fernando Pettinelli Date: Sat, 20 Mar 2021 11:50:18 -0300 Subject: [PATCH 4/4] Version 4.6.20 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8256d6f..291babe 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ com.songoda EpicHoppers 4.0.0 - 4.6.19 + 4.6.20 clean install EpicHoppers-${project.version}